|
|
@@ -7,6 +7,7 @@ import common.YosException;
|
|
|
import common.annotation.API;
|
|
|
import common.annotation.CACHEING;
|
|
|
import common.data.*;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
|
import restcontroller.R;
|
|
|
import restcontroller.webmanage.saletool.orderclue.ExportExcel;
|
|
|
@@ -113,7 +114,7 @@ public class personnelstatistics extends Controller {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int year = cal.get(Calendar.YEAR);
|
|
|
|
|
|
- Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators FROM sa_salestargetbill WHERE year="+year+" AND siteid ='" + siteid + "' and targettype = '人员目标'");
|
|
|
+ Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators,statisticaldimension FROM sa_salestargetbill WHERE year="+year+" AND siteid ='" + siteid + "' and targettype = '人员目标'");
|
|
|
|
|
|
SQLFactory hrsqlFactory = new SQLFactory(this, "业务员列表查询");
|
|
|
hrsqlFactory.addParameter("siteid", siteid);
|
|
|
@@ -126,9 +127,12 @@ public class personnelstatistics extends Controller {
|
|
|
//考核指标类型
|
|
|
long sa_salestargetbillid = 0;
|
|
|
String assessmentindicators="";
|
|
|
+ //统计维度
|
|
|
+ String statisticaldimension="";
|
|
|
if (billRows.isNotEmpty()) {
|
|
|
sa_salestargetbillid=billRows.get(0).getLong("sa_salestargetbillid");
|
|
|
assessmentindicators=billRows.get(0).getString("assessmentindicators");
|
|
|
+ statisticaldimension=billRows.get(0).getString("statisticaldimension");
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -196,6 +200,11 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-开票");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(statisticaldimension.equals("订单审核")){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -206,6 +215,11 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-订单");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(statisticaldimension.equals("订单审核")){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -215,6 +229,8 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-出货");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ sqlFactory.addParameter("statisticaldimension", statisticaldimension);
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -224,6 +240,19 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-收款");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(StringUtils.isBlank(statisticaldimension)){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ }else{
|
|
|
+ if(isJSONArray(statisticaldimension)){
|
|
|
+ JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
|
|
|
+ String where1="t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult;
|
|
|
+ where1 = where1.replace("[", "(").replace("]", ")");
|
|
|
+ sqlFactory.addParameter_SQL("where1", where1);
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -284,7 +313,7 @@ public class personnelstatistics extends Controller {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
int year = cal.get(Calendar.YEAR);
|
|
|
|
|
|
- Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators FROM sa_salestargetbill WHERE year="+year+" AND siteid ='" + siteid + "' and targettype = '人员目标'");
|
|
|
+ Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators,statisticaldimension FROM sa_salestargetbill WHERE year="+year+" AND siteid ='" + siteid + "' and targettype = '人员目标'");
|
|
|
|
|
|
SQLFactory hrsqlFactory = new SQLFactory(this, "业务员列表查询");
|
|
|
hrsqlFactory.addParameter("siteid", siteid);
|
|
|
@@ -302,9 +331,12 @@ public class personnelstatistics extends Controller {
|
|
|
//考核指标类型
|
|
|
long sa_salestargetbillid = 0;
|
|
|
String assessmentindicators="";
|
|
|
+ //统计维度
|
|
|
+ String statisticaldimension="";
|
|
|
if (billRows.isNotEmpty()) {
|
|
|
sa_salestargetbillid=billRows.get(0).getLong("sa_salestargetbillid");
|
|
|
assessmentindicators=billRows.get(0).getString("assessmentindicators");
|
|
|
+ statisticaldimension=billRows.get(0).getString("statisticaldimension");
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -372,6 +404,11 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-开票");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(statisticaldimension.equals("订单审核")){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -382,6 +419,11 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-订单");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(statisticaldimension.equals("订单审核")){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -391,6 +433,7 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-出货");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -400,6 +443,19 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-收款");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(StringUtils.isBlank(statisticaldimension)){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ }else{
|
|
|
+ if(isJSONArray(statisticaldimension)){
|
|
|
+ JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
|
|
|
+ String where1="t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult;
|
|
|
+ where1 = where1.replace("[", "(").replace("]", ")");
|
|
|
+ sqlFactory.addParameter_SQL("where1", where1);
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -453,13 +509,16 @@ public class personnelstatistics extends Controller {
|
|
|
public String queryList() throws YosException {
|
|
|
//年份
|
|
|
Long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
|
|
|
- Rows billRows = dbConnect.runSqlQuery("SELECT assessmentindicators,year FROM sa_salestargetbill WHERE sa_salestargetbillid=" + sa_salestargetbillid + " AND siteid ='" + siteid + "'");
|
|
|
+ Rows billRows = dbConnect.runSqlQuery("SELECT assessmentindicators,year,statisticaldimension FROM sa_salestargetbill WHERE sa_salestargetbillid=" + sa_salestargetbillid + " AND siteid ='" + siteid + "'");
|
|
|
|
|
|
//考核指标类型
|
|
|
String assessmentindicators = "";
|
|
|
+ //统计维度
|
|
|
+ String statisticaldimension="";
|
|
|
long year = 2023;
|
|
|
if (billRows.isNotEmpty()) {
|
|
|
assessmentindicators=billRows.get(0).getString("assessmentindicators");
|
|
|
+ statisticaldimension=billRows.get(0).getString("statisticaldimension");
|
|
|
year=billRows.get(0).getLong("year");
|
|
|
}
|
|
|
|
|
|
@@ -540,6 +599,11 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-开票");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(statisticaldimension.equals("订单审核")){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -550,6 +614,11 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-订单");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(statisticaldimension.equals("订单审核")){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -559,6 +628,7 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-出货");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -568,6 +638,19 @@ public class personnelstatistics extends Controller {
|
|
|
sqlFactory = new SQLFactory(this, "人员目标统计-收款");
|
|
|
sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
+ if(StringUtils.isBlank(statisticaldimension)){
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ }else{
|
|
|
+ if(isJSONArray(statisticaldimension)){
|
|
|
+ JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
|
|
|
+ String where1="t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult;
|
|
|
+ where1 = where1.replace("[", "(").replace("]", ")");
|
|
|
+ sqlFactory.addParameter_SQL("where1", where1);
|
|
|
+ }else{
|
|
|
+ sqlFactory.addParameter_SQL("where1", "1=1");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
actualRows = dbConnect.runSqlQuery(sqlFactory);
|