|
@@ -194,6 +194,45 @@ public class serviceorder extends Controller {
|
|
|
DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "自动分配", "服务申请单自动分配成功").getSQL());
|
|
DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "自动分配", "服务申请单自动分配成功").getSQL());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else {
|
|
|
|
|
+ Rows serviceagents = dbConnect.runSqlQuery("select t1.sys_enterpriseid,t2.province,t2.city,t2.county from sa_agents t1 inner join sa_agents_salescope t2 on t1.sa_agentsid=t2.sa_agentsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.isservice=1");
|
|
|
|
|
+ RowsMap countyRowsMap = serviceagents.toRowsMap("county");
|
|
|
|
|
+ RowsMap cityRowsMap = serviceagents.toRowsMap("city");
|
|
|
|
|
+ RowsMap provinceRowsMap = serviceagents.toRowsMap("province");
|
|
|
|
|
+ if (countyRowsMap.containsKey(rows.get(0).getString("county"))) {
|
|
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
|
|
+ updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
|
|
+ updateSQL.setValue("status", "待受理");
|
|
|
|
|
+ updateSQL.setValue("sys_enterpriseid_service", countyRowsMap.get(rows.get(0).getString("county")).get(0).getLong("sys_enterpriseid"));
|
|
|
|
|
+ updateSQL.setDateValue("allocationdate");
|
|
|
|
|
+ updateSQL.setValue("allocationby", username);
|
|
|
|
|
+ sqlList.add(updateSQL.getSQL());
|
|
|
|
|
+ sqlList.add(
|
|
|
|
|
+ DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "自动分配", "服务申请单自动分配成功").getSQL());
|
|
|
|
|
+ } else if (cityRowsMap.containsKey(rows.get(0).getString("city"))) {
|
|
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
|
|
+ updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
|
|
+ updateSQL.setValue("status", "待受理");
|
|
|
|
|
+ updateSQL.setValue("sys_enterpriseid_service", cityRowsMap.get(rows.get(0).getString("city")).get(0).getLong("sys_enterpriseid"));
|
|
|
|
|
+ updateSQL.setDateValue("allocationdate");
|
|
|
|
|
+ updateSQL.setValue("allocationby", username);
|
|
|
|
|
+ sqlList.add(updateSQL.getSQL());
|
|
|
|
|
+ sqlList.add(
|
|
|
|
|
+ DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "自动分配", "服务申请单自动分配成功").getSQL());
|
|
|
|
|
+ } else if (provinceRowsMap.containsKey(rows.get(0).getString("province"))) {
|
|
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
|
|
+ updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
|
|
+ updateSQL.setValue("status", "待受理");
|
|
|
|
|
+ updateSQL.setValue("sys_enterpriseid_service", provinceRowsMap.get(rows.get(0).getString("province")).get(0).getLong("sys_enterpriseid"));
|
|
|
|
|
+ updateSQL.setDateValue("allocationdate");
|
|
|
|
|
+ updateSQL.setValue("allocationby", username);
|
|
|
|
|
+ sqlList.add(updateSQL.getSQL());
|
|
|
|
|
+ sqlList.add(
|
|
|
|
|
+ DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "自动分配", "服务申请单自动分配成功").getSQL());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
Rows workersRows = dbConnect.runSqlQuery(
|
|
Rows workersRows = dbConnect.runSqlQuery(
|
|
|
"select t3.phonenumber from sys_hr t1 left join sys_users t3 on t1.userid = t3.userid left join sys_hr t4 on t1.siteid = t4.siteid and t1.reporthrid = t4.hrid where t1.siteid = '"
|
|
"select t3.phonenumber from sys_hr t1 left join sys_users t3 on t1.userid = t3.userid left join sys_hr t4 on t1.siteid = t4.siteid and t1.reporthrid = t4.hrid where t1.siteid = '"
|
|
@@ -231,9 +270,10 @@ public class serviceorder extends Controller {
|
|
|
if (rows.isEmpty()) {
|
|
if (rows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该服务申请单不存在").toString();
|
|
return getErrReturnObject().setErrMsg("该服务申请单不存在").toString();
|
|
|
}
|
|
}
|
|
|
- if (!rows.get(0).getString("status").equals("待分配") && !rows.get(0).getString("status").equals("手工完结") && !rows.get(0).getString("status").equals("拒绝受理")) {
|
|
|
|
|
- return getErrReturnObject().setErrMsg("非待分配或手工完结或拒绝受理的服务申请单无法分配服务商").toString();
|
|
|
|
|
|
|
+ if (rows.get(0).getString("status").equals("新建") || rows.get(0).getString("status").equals("已完结")) {
|
|
|
|
|
+ return getErrReturnObject().setErrMsg("非新建或完结的服务申请单无法分配服务商").toString();
|
|
|
}
|
|
}
|
|
|
|
|
+ ArrayList<String> sqllist = new ArrayList<>();
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
updateSQL.setUniqueid(sa_serviceorderid);
|
|
updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
updateSQL.setSiteid(siteid);
|
|
updateSQL.setSiteid(siteid);
|
|
@@ -243,10 +283,12 @@ public class serviceorder extends Controller {
|
|
|
updateSQL.setValue("refuseremarks", "");
|
|
updateSQL.setValue("refuseremarks", "");
|
|
|
updateSQL.setDateValue("allocationdate");
|
|
updateSQL.setDateValue("allocationdate");
|
|
|
updateSQL.setValue("allocationby", username);
|
|
updateSQL.setValue("allocationby", username);
|
|
|
-
|
|
|
|
|
- dbConnect.runSqlUpdate(updateSQL.getSQL());
|
|
|
|
|
- dbConnect.runSqlUpdate(
|
|
|
|
|
- DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "手工分配", "服务申请单手工分配成功").getSQL());
|
|
|
|
|
|
|
+ if(rows.get(0).getString("status").equals("待服务") || rows.get(0).getString("status").equals("服务中")){
|
|
|
|
|
+ sqllist.add("update sa_workorder set status='作废' where sa_serviceorderid ="+sa_serviceorderid);
|
|
|
|
|
+ }
|
|
|
|
|
+ sqllist.add(updateSQL.getSQL());
|
|
|
|
|
+ sqllist.add(DataContrlLog.createLog(this, "sa_serviceorder", sa_serviceorderid, "手工分配", "服务申请单手工分配成功").getSQL());
|
|
|
|
|
+ dbConnect.runSqlUpdate(sqllist);
|
|
|
return getSucReturnObject().toString();
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
}
|
|
|
|
|
|