|
|
@@ -1071,6 +1071,73 @@ public class salestargetstatistics extends Controller {
|
|
|
return getSucReturnObject().setData(itemclassrows).toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "小程序医院目标-产品目标", apiversion = R.ID2026010716393302.v1.class)
|
|
|
+ public String mATargetGoods() throws YosException {
|
|
|
+ int year = content.getIntValue("year");
|
|
|
+ int befyear = year - 1;
|
|
|
+ int month_start = content.getIntValue("month_start");
|
|
|
+ int month_end = content.getIntValue("month_end");
|
|
|
+ String itemclassname = content.getStringValue("itemclassname");
|
|
|
+ String yearMonthStr = year + "-12";
|
|
|
+ String startMonth = year + "-" + (month_start > 9 ? month_start : "0" + month_start) + "-01";
|
|
|
+ String endMonth = (year + 1) + "-01-01";
|
|
|
+ if (month_end < 12) {
|
|
|
+ endMonth = year + "-" + ((month_end + 1) > 9 ? (month_end + 1) : "0" + (month_end + 1)) + "-01";
|
|
|
+ }
|
|
|
+
|
|
|
+ Long sa_customersid = content.getLongValue("sa_customersid");
|
|
|
+
|
|
|
+ //查询商品
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "小程序医院目标-产品");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("startMonth", startMonth);
|
|
|
+ sqlFactory.addParameter("endMonth", endMonth);
|
|
|
+ sqlFactory.addParameter("itemclassname", itemclassname);
|
|
|
+ sqlFactory.addParameter("sa_customersid", sa_customersid);
|
|
|
+ Rows itemrows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+
|
|
|
+
|
|
|
+ sqlFactory = new SQLFactory(this, "小程序医院目标-产品-订单");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("year", year);
|
|
|
+ sqlFactory.addParameter("befyear", befyear);
|
|
|
+ sqlFactory.addParameter("sa_customersid", sa_customersid);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+ RowsMap salesRowsMap = rows.toRowsMap("itemid");
|
|
|
+
|
|
|
+ sqlFactory = new SQLFactory(this, "小程序医院目标-产品-目标");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("year", year);
|
|
|
+ sqlFactory.addParameter("sa_customersid", sa_customersid);
|
|
|
+ Rows targetrows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+ RowsMap targetRowsMap = targetrows.toRowsMap("itemid");
|
|
|
+
|
|
|
+ ArrayList<String> itemids = itemrows.toArrayList("itemid");
|
|
|
+ ArrayList<String> alldates = yearToDate(yearMonthStr);
|
|
|
+ Rows datas = new Rows();
|
|
|
+ for (String itemid : itemids) {
|
|
|
+ Rows salesRows = salesRowsMap.getOrDefault(itemid, new Rows());
|
|
|
+ RowsMap dateDateRow = salesRows.toRowsMap("ym");
|
|
|
+ Rows targetRows = targetRowsMap.getOrDefault(itemid, new Rows());
|
|
|
+ for (String date : alldates) {
|
|
|
+ Rows dateDate = dateDateRow.getOrDefault(date, new Rows());
|
|
|
+ Row row = new Row();
|
|
|
+ row.put("itemid", itemid);
|
|
|
+ processDataRows(datas, row, dateDate, targetRows, date);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ RowsMap dataRowsMap = datas.toRowsMap("itemid");
|
|
|
+
|
|
|
+ for (Row arearow : itemrows) {
|
|
|
+ Rows dataRows = dataRowsMap.getOrDefault(arearow.getString("itemid"), new Rows());
|
|
|
+ //计算范围
|
|
|
+ calculate("m", arearow, dataRows, getMonths(year, month_start, month_end));
|
|
|
+ }
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(itemrows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@API(title = "查询当前账号的营销区域", apiversion = R.ID2026010513574702.v1.class)
|
|
|
public String queryCurrentUserarea() throws YosException {
|