|
|
@@ -447,6 +447,77 @@ public class databoard extends Controller {
|
|
|
return getSucReturnObject().setData(topItemclassRows).toString();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 战区数据分析
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @API(title = "战区数据分析", apiversion = R.ID20230802093703.v1.class)
|
|
|
+ @CACHEING
|
|
|
+ public String warZoneAnalysis() throws YosException {
|
|
|
+
|
|
|
+ String datetype = content.getStringValue("datetype");
|
|
|
+ String datatype = content.getString("datatype");
|
|
|
+ String begindate = "";
|
|
|
+ String enddate = "";
|
|
|
+ switch (datetype) {
|
|
|
+ case "月":
|
|
|
+ begindate = getMonthFirstDay();
|
|
|
+ enddate = getMonthLastDay();
|
|
|
+ break;
|
|
|
+ case "年":
|
|
|
+ begindate = new SimpleDateFormat("yyyy").format(new Date()) + "-01-01";
|
|
|
+ enddate = new SimpleDateFormat("yyyy").format(new Date()) + "-12-31";
|
|
|
+ break;
|
|
|
+ case "周":
|
|
|
+ begindate = getWeekFirstDay();
|
|
|
+ enddate = getWeekLastDay();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 过滤条件设置
|
|
|
+ */
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
|
|
|
+ begindate = whereObject.getString("begindate");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
|
|
|
+ enddate = whereObject.getString("enddate");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
+ if (begindate != "") {
|
|
|
+ where.append(" and DATE_FORMAT(t1.checkdate, '%Y-%m-%d') >='").append(begindate).append("' ");
|
|
|
+ }
|
|
|
+ if (enddate != "") {
|
|
|
+ where.append(" and DATE_FORMAT(t1.checkdate, '%Y-%m-%d') <='").append(enddate).append("' ");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ SQLFactory factory;
|
|
|
+ if (datatype.equals("经销商")) {
|
|
|
+ factory = new SQLFactory(this, "战区数据_经销商");
|
|
|
+ } else if (datatype.equals("区域")) {
|
|
|
+ factory = new SQLFactory(this, "战区数据_区域");
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg("datatype类型错误").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ factory.addParameter("siteid", siteid);
|
|
|
+ factory.addParameter_SQL("where", where);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(factory.getSQL(false));
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @Description: 获取季度第一天
|
|
|
* 1.根据给定日期计算当前季度的第一个月份
|