|
|
@@ -140,7 +140,7 @@ public class serviceorder extends Controller {
|
|
|
Long sa_serviceorderid = content.getLong("sa_serviceorderid");
|
|
|
boolean issumbit = true;
|
|
|
Rows rows = dbConnect
|
|
|
- .runSqlQuery("select sa_serviceorderid,status,billno,sys_enterpriseid,province,city,county from sa_serviceorder where sa_serviceorderid ='"
|
|
|
+ .runSqlQuery("select sa_serviceorderid,status,billno,sys_enterpriseid,province,city,county,sys_enterpriseid_service from sa_serviceorder where sa_serviceorderid ='"
|
|
|
+ sa_serviceorderid + "' and siteid='" + siteid + "'");
|
|
|
for (Row row : rows) {
|
|
|
if (issumbit) {
|
|
|
@@ -201,18 +201,76 @@ public class serviceorder extends Controller {
|
|
|
|
|
|
if (issumbit) {
|
|
|
Rows agents = dbConnect.runSqlQuery("select * from sa_agents where status=1 and signingstate!='停用(已止)' and siteid='" + siteid + "' and sys_enterpriseid=" + rows.get(0).getLong("sys_enterpriseid"));
|
|
|
- if (agents.isNotEmpty()) {
|
|
|
- if (agents.get(0).getBoolean("isservice")) {
|
|
|
- sqlList.add("update sa_serviceorder set status='待受理',sys_enterpriseid_service=" + agents.get(0).getLong("sys_enterpriseid") + " where sa_serviceorderid=" + sa_serviceorderid);
|
|
|
- } 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 status=1 and signingstate!='停用(已止)' and t1.isservice=1");
|
|
|
+ Rows currentserviceagents = dbConnect.runSqlQuery("select * from sa_agents where status=1 and signingstate!='停用(已止)' and siteid='" + siteid + "' and sys_enterpriseid=" + rows.get(0).getLong("sys_enterpriseid_service"));
|
|
|
+ if(currentserviceagents.isEmpty()){
|
|
|
+ if (agents.isNotEmpty()) {
|
|
|
+ if (agents.get(0).getBoolean("isservice")) {
|
|
|
+ sqlList.add("update sa_serviceorder set status='待受理',sys_enterpriseid_service=" + agents.get(0).getLong("sys_enterpriseid") + " where sa_serviceorderid=" + sa_serviceorderid);
|
|
|
+ } 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 status=1 and signingstate!='停用(已止)' 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"))) {
|
|
|
+ for(Row row :countyRowsMap.get(rows.get(0).getString("county"))){
|
|
|
+ if(row.getString("province").equals(rows.get(0).getString("province"))
|
|
|
+ && row.getString("city").equals(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", row.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"))) {
|
|
|
+ for(Row row :cityRowsMap.get(rows.get(0).getString("city"))){
|
|
|
+ if(row.getString("province").equals(rows.get(0).getString("province"))
|
|
|
+ && StringUtils.isBlank(row.getString("county"))){
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
+ updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
+ updateSQL.setValue("status", "待受理");
|
|
|
+ updateSQL.setValue("sys_enterpriseid_service", row.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"))) {
|
|
|
+ for(Row row :provinceRowsMap.get(rows.get(0).getString("province"))){
|
|
|
+ if(StringUtils.isBlank(row.getString("city"))
|
|
|
+ && StringUtils.isBlank(row.getString("county"))){
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
+ updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
+ updateSQL.setValue("status", "待受理");
|
|
|
+ updateSQL.setValue("sys_enterpriseid_service", row.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 {
|
|
|
+ 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"))) {
|
|
|
for(Row row :countyRowsMap.get(rows.get(0).getString("county"))){
|
|
|
if(row.getString("province").equals(rows.get(0).getString("province"))
|
|
|
- && row.getString("city").equals(rows.get(0).getString("city"))){
|
|
|
+ && row.getString("city").equals(rows.get(0).getString("city"))){
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
updateSQL.setSiteid(siteid);
|
|
|
@@ -260,61 +318,7 @@ public class serviceorder extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }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"))) {
|
|
|
- for(Row row :countyRowsMap.get(rows.get(0).getString("county"))){
|
|
|
- if(row.getString("province").equals(rows.get(0).getString("province"))
|
|
|
- && row.getString("city").equals(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", row.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"))) {
|
|
|
- for(Row row :cityRowsMap.get(rows.get(0).getString("city"))){
|
|
|
- if(row.getString("province").equals(rows.get(0).getString("province"))
|
|
|
- && StringUtils.isBlank(row.getString("county"))){
|
|
|
- UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
- updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
- updateSQL.setSiteid(siteid);
|
|
|
- updateSQL.setValue("status", "待受理");
|
|
|
- updateSQL.setValue("sys_enterpriseid_service", row.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"))) {
|
|
|
- for(Row row :provinceRowsMap.get(rows.get(0).getString("province"))){
|
|
|
- if(StringUtils.isBlank(row.getString("city"))
|
|
|
- && StringUtils.isBlank(row.getString("county"))){
|
|
|
- UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sa_serviceorder");
|
|
|
- updateSQL.setUniqueid(sa_serviceorderid);
|
|
|
- updateSQL.setSiteid(siteid);
|
|
|
- updateSQL.setValue("status", "待受理");
|
|
|
- updateSQL.setValue("sys_enterpriseid_service", row.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(
|
|
|
"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 = '"
|