|
|
@@ -9,6 +9,7 @@ import common.data.*;
|
|
|
import restcontroller.R;
|
|
|
import restcontroller.webmanage.sale.salestarget.personnel;
|
|
|
|
|
|
+import javax.sql.RowSetReader;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -33,7 +34,7 @@ public class performancetargetboard extends Controller {
|
|
|
|
|
|
@API(title = "获取当前业务员区域", apiversion = R.ID2025103010165903.v1.class)
|
|
|
public String querycurrentAreaList() throws YosException {
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_hr","name");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_hr","name","hrid");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_salearea_hr", "t2", "t1.siteid = t2.siteid and t1.hrid = t2.hrid");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_salearea", "t3", " t3.siteid = t2.siteid and t3.sa_saleareaid = t2.sa_saleareaid", "sa_saleareaid","areaname");
|
|
|
@@ -48,10 +49,10 @@ public class performancetargetboard extends Controller {
|
|
|
@API(title = "获取当前业务员区域及其下属区域", apiversion = R.ID2025103009445603.v1.class)
|
|
|
public String querySalerAreaList() throws YosException {
|
|
|
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_hr");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_hr","name","hrid");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.inner, "sa_salearea_hr", "t2", "t1.siteid = t2.siteid and t1.hrid = t2.hrid");
|
|
|
- querySQL.addJoinTable(JOINTYPE.inner, "sa_salearea", "t3", " t3.siteid = t2.siteid and t3.sa_saleareaid = t2.sa_saleareaid", "sa_saleareaid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.inner, "sa_salearea", "t3", " t3.siteid = t2.siteid and t3.sa_saleareaid = t2.sa_saleareaid", "sa_saleareaid","areaname");
|
|
|
|
|
|
querySQL.setWhere("t1.siteid", siteid);
|
|
|
querySQL.setWhere("t1.hrid", hrid);
|
|
|
@@ -67,13 +68,26 @@ public class performancetargetboard extends Controller {
|
|
|
|
|
|
if(rows.isNotEmpty()){
|
|
|
arearows =getSubSaleAreas(this,list);
|
|
|
+ Rows saleareahrrows =dbConnect.runSqlQuery("select t1.name,t2.sa_saleareaid,t1.hrid from sys_hr t1 inner join sa_salearea_hr t2 on t1.siteid = t2.siteid and t1.hrid = t2.hrid where t1.siteid='"+siteid+"'");
|
|
|
+ RowsMap saleareahrRowsMap =saleareahrrows.toRowsMap("sa_saleareaid");
|
|
|
+ for (Row row :arearows){
|
|
|
+ if(saleareahrRowsMap.containsKey(row.getString("sa_saleareaid"))){
|
|
|
+ for(Row row1 :saleareahrRowsMap.get(row.getString("sa_saleareaid"))){
|
|
|
+ row.put("name",row1.getString("name"));
|
|
|
+ row.put("hrid",row1.getString("hrid"));
|
|
|
+ rows.add(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return getSucReturnObject().setData(arearows).toString();
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
@API(title = "查询业务员月度指标", apiversion = R.ID2025103010192003.v1.class)
|
|
|
public String queryperformancetarget_month() throws YosException {
|
|
|
+ long hrid= content.getLong("hrid");
|
|
|
long sa_saleareaid= content.getLong("sa_saleareaid");
|
|
|
long year= content.getLong("year");
|
|
|
long month= content.getLong("month");
|
|
|
@@ -97,7 +111,7 @@ public class performancetargetboard extends Controller {
|
|
|
}
|
|
|
SQLFactory personnelsqlFactory = new SQLFactory(this, "人员-目标详情列表");
|
|
|
personnelsqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
- personnelsqlFactory.addParameter_SQL("where", " t.sa_saleareaid="+sa_saleareaid);
|
|
|
+ personnelsqlFactory.addParameter_SQL("where", " t.hrid="+hrid);
|
|
|
personnelsqlFactory.addParameter("siteid", siteid);
|
|
|
Rows salestargetrows = dbConnect.runSqlQuery(personnelsqlFactory.getSQL());
|
|
|
BigDecimal rw_month=BigDecimal.ZERO;
|
|
|
@@ -166,7 +180,7 @@ public class performancetargetboard extends Controller {
|
|
|
|
|
|
@API(title = "查询业务员季度指标", apiversion = R.ID2025103010193903.v1.class)
|
|
|
public String queryperformancetarget_quarter() throws YosException {
|
|
|
-
|
|
|
+ long hrid= content.getLong("hrid");
|
|
|
long sa_saleareaid= content.getLong("sa_saleareaid");
|
|
|
long year= content.getLong("year");
|
|
|
int selectmonth= content.getIntValue("month");
|
|
|
@@ -189,7 +203,7 @@ public class performancetargetboard extends Controller {
|
|
|
}
|
|
|
SQLFactory personnelsqlFactory = new SQLFactory(this, "人员-目标详情列表");
|
|
|
personnelsqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
- personnelsqlFactory.addParameter_SQL("where", " t.sa_saleareaid="+sa_saleareaid);
|
|
|
+ personnelsqlFactory.addParameter_SQL("where", " t.hrid="+hrid);
|
|
|
personnelsqlFactory.addParameter("siteid", siteid);
|
|
|
Rows salestargetrows = dbConnect.runSqlQuery(personnelsqlFactory.getSQL());
|
|
|
BigDecimal rw_quarter=BigDecimal.ZERO;
|
|
|
@@ -265,6 +279,7 @@ public class performancetargetboard extends Controller {
|
|
|
|
|
|
@API(title = "查询业务员总指标", apiversion = R.ID2025103010195403.v1.class)
|
|
|
public String queryperformancetarget_total() throws YosException {
|
|
|
+ long hrid= content.getLong("hrid");
|
|
|
long sa_saleareaid= content.getLong("sa_saleareaid");
|
|
|
long year= content.getLong("year");
|
|
|
JSONArray months = content.getJSONArray("months");
|
|
|
@@ -288,7 +303,7 @@ public class performancetargetboard extends Controller {
|
|
|
}
|
|
|
SQLFactory personnelsqlFactory = new SQLFactory(this, "人员-目标详情列表");
|
|
|
personnelsqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
|
|
|
- personnelsqlFactory.addParameter_SQL("where", " t.sa_saleareaid="+sa_saleareaid);
|
|
|
+ personnelsqlFactory.addParameter_SQL("where", " t.hrid="+hrid);
|
|
|
personnelsqlFactory.addParameter("siteid", siteid);
|
|
|
Rows salestargetrows = dbConnect.runSqlQuery(personnelsqlFactory.getSQL());
|
|
|
BigDecimal rw_all=BigDecimal.ZERO;
|