|
@@ -243,19 +243,21 @@ public class databoard extends Controller {
|
|
|
/*
|
|
|
* 过滤条件设置
|
|
|
*/
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
if (content.containsKey("where")) {
|
|
|
JSONObject whereObject = content.getJSONObject("where");
|
|
|
if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
|
|
|
- begindate = whereObject.getString("begindate");
|
|
|
+ begindate = sdf.format(sdf.parse(whereObject.getString("begindate")));
|
|
|
}
|
|
|
if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
|
|
|
- enddate = whereObject.getString("enddate");
|
|
|
+ enddate =sdf.format(sdf.parse(whereObject.getString("enddate")));
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
StringBuffer whereLastYear = new StringBuffer(" 1=1 ");
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
//区域经理判断
|
|
|
where.append(getManangerSqlWhere("t1",hrid));
|
|
|
whereLastYear.append(getManangerSqlWhere("t1",hrid));
|
|
@@ -472,6 +474,65 @@ public class databoard extends Controller {
|
|
|
return getSucReturnObject().setData(list).toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "收款趋势按月份分析", apiversion = R.ID2025031209363503.v1.class)
|
|
|
+ @CACHEING
|
|
|
+ public String PaymentTrendByMonthAnalysis() throws YosException {
|
|
|
+ String where = " 1=1 ";
|
|
|
+ if (sys_enterpriseid > 0) {
|
|
|
+ where = where + " and t1.sys_enterpriseid=" + sys_enterpriseid;
|
|
|
+ }
|
|
|
+ if(hrid>0){
|
|
|
+ //区域经理判断
|
|
|
+ where = where + getManangerSqlWhere("t1",hrid);
|
|
|
+ }
|
|
|
+ boolean isall =content.getBooleanValue("isall");
|
|
|
+ /*
|
|
|
+ * 过滤条件设置
|
|
|
+ */
|
|
|
+// 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");
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ SQLFactory factory = new SQLFactory(this, "收款统计查询_月份");
|
|
|
+ factory.addParameter("siteid", siteid);
|
|
|
+ if(isall){
|
|
|
+ Rows accountclassRows = dbConnect.runSqlQuery("select sa_accountclassid from sa_accountclass where siteid='"+siteid+"'");
|
|
|
+ factory.addParameter_in("sa_accountclassids", accountclassRows.toArray("sa_accountclassid"));
|
|
|
+ }else{
|
|
|
+ JSONArray sa_accountclassids = content.getJSONArray("sa_accountclassids");
|
|
|
+ List<String> list = sa_accountclassids.toJavaList(String.class);
|
|
|
+ list.add("0");
|
|
|
+ factory.addParameter_in("sa_accountclassids", list);
|
|
|
+ }
|
|
|
+
|
|
|
+ Rows rows = dbConnect.runSqlQuery(factory.getSQL(false));
|
|
|
+ String year = new SimpleDateFormat("yyyy").format(new Date());
|
|
|
+ String lastyear = String.valueOf(Integer.parseInt(new SimpleDateFormat("yyyy").format(new Date())) - 1);
|
|
|
+ List<DataTrans> list = new ArrayList();
|
|
|
+
|
|
|
+ for (Row row : rows) {
|
|
|
+ DataTrans dataTrans = new DataTrans();
|
|
|
+ if (row.getString("y").equals(year) || row.getString("y").equals(lastyear)) {
|
|
|
+ dataTrans.setName(row.getString("y") + "-" + row.getString("m"));
|
|
|
+ dataTrans.setMonth(row.getString("m"));
|
|
|
+ dataTrans.setYear(row.getString("y"));
|
|
|
+ dataTrans.setValue(row.getBigDecimal("typestatistics"));
|
|
|
+ list.add(dataTrans);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list = supplementDate(Integer.parseInt(year), list);
|
|
|
+ list = supplementDate(Integer.parseInt(lastyear), list);
|
|
|
+ list.sort(Comparator.comparingLong(o -> Long.parseLong(StringUtils.isBlank(o.getMonth()) ? "9999" : o.getMonth())));
|
|
|
+ return getSucReturnObject().setData(list).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 销售类型分析
|
|
|
*
|