|
|
@@ -50,7 +50,7 @@ public class serviceorder extends Controller {
|
|
|
String tableName = "sa_serviceorder";
|
|
|
Long sa_serviceorderid = content.getLong("sa_serviceorderid");
|
|
|
String servicetype = content.getString("servicetype"); //服务分类
|
|
|
- if (sys_enterpriseid<=0) {
|
|
|
+ if (sys_enterpriseid <= 0) {
|
|
|
sys_enterpriseid = content.getLong("sys_enterpriseid");
|
|
|
}
|
|
|
String remarks = content.getStringValue("remarks");
|
|
|
@@ -85,12 +85,6 @@ public class serviceorder extends Controller {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (content.containsKey("phonenumber") && !"".equals(content.getString("phonenumber"))) {
|
|
|
- if (!Pattern.matches("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$", content.getString("phonenumber"))) {
|
|
|
- return getErrReturnObject().setErrMsg("手机格式有误").toString();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
if (sa_serviceorderid <= 0 || dbConnect.runSqlQuery(
|
|
|
"select sa_serviceorderid from sa_serviceorder where sa_serviceorderid=" + sa_serviceorderid)
|
|
|
@@ -251,7 +245,7 @@ public class serviceorder extends Controller {
|
|
|
ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
|
|
|
RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
|
|
|
- for(Row row : rows){
|
|
|
+ for (Row row : rows) {
|
|
|
if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
|
|
|
row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
} else {
|
|
|
@@ -465,37 +459,37 @@ public class serviceorder extends Controller {
|
|
|
where.append(" and t1.createuserid ='").append(whereObject.getString("createuserid")).append("'");
|
|
|
}
|
|
|
|
|
|
- if(whereObject.getBooleanValue("todaysubmitCount")){
|
|
|
+ if (whereObject.getBooleanValue("todaysubmitCount")) {
|
|
|
where.append(" and t1.status != '新建' and DATE(t1.submitdate) = CURDATE() ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("todayazsubmitCount")){
|
|
|
+ if (whereObject.getBooleanValue("todayazsubmitCount")) {
|
|
|
where.append(" and t1.status != '新建' and t10.type='安装' and DATE(t1.submitdate) = CURDATE() ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("todaywxsubmitCount")){
|
|
|
+ if (whereObject.getBooleanValue("todaywxsubmitCount")) {
|
|
|
where.append(" and t1.status != '新建' and t10.type='维修' and DATE(t1.submitdate) = CURDATE() ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("todayqxsubmitCount")){
|
|
|
+ if (whereObject.getBooleanValue("todayqxsubmitCount")) {
|
|
|
where.append(" and t1.status != '新建' and t10.type='清洗' and DATE(t1.submitdate) = CURDATE() ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("tobeassignedCount")){
|
|
|
+ if (whereObject.getBooleanValue("tobeassignedCount")) {
|
|
|
where.append(" and t1.status = '待分配' ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("tobeassignedCount24")){
|
|
|
+ if (whereObject.getBooleanValue("tobeassignedCount24")) {
|
|
|
where.append(" and t1.status = '待分配' and t1.submitdate < DATE_SUB(NOW(), INTERVAL 24 HOUR) ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("pendingCount")){
|
|
|
+ if (whereObject.getBooleanValue("pendingCount")) {
|
|
|
where.append(" and t1.status = '待受理' ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("pendingCount24")){
|
|
|
+ if (whereObject.getBooleanValue("pendingCount24")) {
|
|
|
where.append(" and t1.status = '待受理' and t1.allocationdate < DATE_SUB(NOW(), INTERVAL 24 HOUR) ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("refuseacceptCount")){
|
|
|
+ if (whereObject.getBooleanValue("refuseacceptCount")) {
|
|
|
where.append(" and t1.status = '拒绝受理' ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("tobeservedCount")){
|
|
|
+ if (whereObject.getBooleanValue("tobeservedCount")) {
|
|
|
where.append(" and t1.status = '待服务' ");
|
|
|
}
|
|
|
- if(whereObject.getBooleanValue("inserviceCount")){
|
|
|
+ if (whereObject.getBooleanValue("inserviceCount")) {
|
|
|
where.append(" and t1.status = '服务中' ");
|
|
|
}
|
|
|
|
|
|
@@ -619,9 +613,9 @@ public class serviceorder extends Controller {
|
|
|
if (!rows.get(0).getString("status").equals("待受理")) {
|
|
|
return getErrReturnObject().setErrMsg("非待受理状态无法生成工单").toString();
|
|
|
}
|
|
|
- Rows serviceorderitems = dbConnect.runSqlQuery("select sku from sa_serviceorderitems where sa_serviceorderid="+sa_serviceorderid);
|
|
|
- if(serviceorderitems.isNotEmpty()){
|
|
|
- if(StringUtils.isNotBlank(serviceorderitems.get(0).getString("sku"))){
|
|
|
+ Rows serviceorderitems = dbConnect.runSqlQuery("select sku from sa_serviceorderitems where sa_serviceorderid=" + sa_serviceorderid);
|
|
|
+ if (serviceorderitems.isNotEmpty()) {
|
|
|
+ if (StringUtils.isNotBlank(serviceorderitems.get(0).getString("sku"))) {
|
|
|
if (dbConnect.runSqlQuery("select * from sa_warrantycard where sku='" + serviceorderitems.get(0).getString("sku") + "' and siteid='" + siteid + "' and isvoid=0").isNotEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该序列号已安装,无法再次安装").toString();
|
|
|
}
|
|
|
@@ -716,7 +710,7 @@ public class serviceorder extends Controller {
|
|
|
}
|
|
|
|
|
|
@API(title = "重新指派工单", apiversion = R.ID2025101710510903.v1.class)
|
|
|
- @CACHEING_CLEAN(apiversions = {serviceorder.class, workorder.class,restcontroller.sale.serviceorder.serviceorder.class})
|
|
|
+ @CACHEING_CLEAN(apiversions = {serviceorder.class, workorder.class, restcontroller.sale.serviceorder.serviceorder.class})
|
|
|
public String reAssigningWorkorder() throws YosException {
|
|
|
Long sa_workorderid = content.getLong("sa_workorderid");
|
|
|
JSONArray projectlearders = content.getJSONArray("projectlearders");
|
|
|
@@ -731,18 +725,18 @@ public class serviceorder extends Controller {
|
|
|
.toString();
|
|
|
}
|
|
|
}
|
|
|
- if(!ismanage){
|
|
|
- Rows datateamrows =dbConnect.runSqlQuery("select * from sys_datateam where ownertable='sa_workorder' and ownerid="
|
|
|
+ if (!ismanage) {
|
|
|
+ Rows datateamrows = dbConnect.runSqlQuery("select * from sys_datateam where ownertable='sa_workorder' and ownerid="
|
|
|
+ sa_workorderid + " and siteid='" + siteid + "'");
|
|
|
- if(datateamrows.isNotEmpty()){
|
|
|
+ if (datateamrows.isNotEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该任务已由其他同事负责推进").toString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(rows.get(0).getString("status").equals("提交")){
|
|
|
+ if (rows.get(0).getString("status").equals("提交")) {
|
|
|
sqlList.add("update sa_workorder set status='进行中' where sa_workorderid ='"
|
|
|
+ sa_workorderid + "' and siteid='" + siteid + "'");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
sqlList.add("update sa_workorder set status='待接单' where sa_workorderid ='"
|
|
|
+ sa_workorderid + "' and siteid='" + siteid + "'");
|
|
|
}
|
|
|
@@ -788,74 +782,69 @@ public class serviceorder extends Controller {
|
|
|
@API(title = "发送手机验证码", apiversion = R.ID20230215173103.v1.class, accesstoken = false)
|
|
|
public String sendMessage() throws YosException {
|
|
|
String customerphone = "";
|
|
|
- long sa_workorderid=content.getLong("sa_workorderid");
|
|
|
- Rows rows = dbConnect.runSqlQuery("select t1.type,t1.verificationcode,t1.verificationdate,t2.* from sa_workorder t1 inner join sa_serviceorder t2 on t1.sa_serviceorderid=t2.sa_serviceorderid and t1.siteid=t2.siteid where t1.sa_workorderid="+sa_workorderid);
|
|
|
- if(rows.isEmpty()){
|
|
|
+ long sa_workorderid = content.getLong("sa_workorderid");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t1.type,t1.verificationcode,t1.verificationdate,t2.* from sa_workorder t1 inner join sa_serviceorder t2 on t1.sa_serviceorderid=t2.sa_serviceorderid and t1.siteid=t2.siteid where t1.sa_workorderid=" + sa_workorderid);
|
|
|
+ if (rows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该工单不存在").toString();
|
|
|
}
|
|
|
long createuserid = rows.get(0).getLong("createuserid");
|
|
|
- String type=rows.get(0).getString("type");
|
|
|
- Rows userrows =dbConnect.runSqlQuery("select t2.usertype,t1.phonenumber from sys_users t1 inner join sys_usersite t2 on t1.userid = t2.userid where t2.siteid = '"+siteid+"' and t1.userid="+createuserid);
|
|
|
+ String type = rows.get(0).getString("type");
|
|
|
+ Rows userrows = dbConnect.runSqlQuery("select t2.usertype,t1.phonenumber from sys_users t1 inner join sys_usersite t2 on t1.userid = t2.userid where t2.siteid = '" + siteid + "' and t1.userid=" + createuserid);
|
|
|
long usertype = 0;
|
|
|
- if(userrows.isNotEmpty()){
|
|
|
- usertype=userrows.get(0).getLong("usertype");
|
|
|
- }else{
|
|
|
+ if (userrows.isNotEmpty()) {
|
|
|
+ usertype = userrows.get(0).getLong("usertype");
|
|
|
+ } else {
|
|
|
//return getErrReturnObject().setErrMsg("工单创建人信息有误").toString();
|
|
|
}
|
|
|
- if(usertype==99){
|
|
|
- customerphone=userrows.get(0).getString("phonenumber");
|
|
|
- }else{
|
|
|
- if(type.equals("安装")){
|
|
|
- customerphone=rows.get(0).getString("scenecontactphonenumber");
|
|
|
- }
|
|
|
- }
|
|
|
- if(StringUtils.isNotBlank(customerphone)){
|
|
|
- if (!Pattern.matches("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$", customerphone)) {
|
|
|
- return getErrReturnObject().setErrMsg("手机格式有误").toString();
|
|
|
+ if (usertype == 99) {
|
|
|
+ customerphone = userrows.get(0).getString("phonenumber");
|
|
|
+ } else {
|
|
|
+ if (type.equals("安装")) {
|
|
|
+ customerphone = rows.get(0).getString("scenecontactphonenumber");
|
|
|
}
|
|
|
}
|
|
|
- String verificationCode ="";
|
|
|
- if(StringUtils.isBlank(rows.get(0).getString("verificationcode"))){
|
|
|
+ String verificationCode = "";
|
|
|
+ if (StringUtils.isBlank(rows.get(0).getString("verificationcode"))) {
|
|
|
verificationCode = createVerificationCode();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
verificationCode = rows.get(0).getString("verificationcode");
|
|
|
}
|
|
|
|
|
|
- dbConnect.runSqlUpdate("update sa_workorder set verificationcode='"+verificationCode+"' where sa_workorderid="+sa_workorderid);
|
|
|
- Rows wxserviceRows = dbConnect.runSqlQuery("select t2.userid from sys_wechatapp_openids t1 inner join sys_users t2 on t1.userid=t2.userid where t2.phonenumber='"+customerphone+"'");
|
|
|
+ dbConnect.runSqlUpdate("update sa_workorder set verificationcode='" + verificationCode + "' where sa_workorderid=" + sa_workorderid);
|
|
|
+ Rows wxserviceRows = dbConnect.runSqlQuery("select t2.userid from sys_wechatapp_openids t1 inner join sys_users t2 on t1.userid=t2.userid where t2.phonenumber='" + customerphone + "'");
|
|
|
Row row = new Row();
|
|
|
- if(wxserviceRows.isEmpty()){
|
|
|
- ArrayList<Long> userids = wxserviceRows.toArrayList("userid",new ArrayList<>());
|
|
|
+ if (wxserviceRows.isEmpty()) {
|
|
|
+ ArrayList<Long> userids = wxserviceRows.toArrayList("userid", new ArrayList<>());
|
|
|
JSONObject extradata = new JSONObject();
|
|
|
extradata.put("extraUserList", userids);
|
|
|
- Executor.sendEml(this, "verificationcode_push", sa_workorderid,siteid, extradata);
|
|
|
+ Executor.sendEml(this, "verificationcode_push", sa_workorderid, siteid, extradata);
|
|
|
if (!BaseClass.isdebug() && !Arrays.asList(Parameter.getString("system_invalidate_phonenumber").split(",")).contains(customerphone)) {
|
|
|
row.put("code", 1);
|
|
|
row.put("msg", "验证码已发送,请注意查收!");
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
if (!BaseClass.isdebug() && !Arrays.asList(Parameter.getString("system_invalidate_phonenumber").split(",")).contains(customerphone)) {
|
|
|
- if(StringUtils.isNotBlank("customerphone")){
|
|
|
- if(StringUtils.isNotBlank(rows.get(0).getString("verificationdate"))){
|
|
|
- if(isMoreThanOneHourUsingCalendar(rows.get(0).getDate("verificationdate"),new Date())){
|
|
|
+ if (StringUtils.isNotBlank("customerphone")) {
|
|
|
+ if (StringUtils.isNotBlank(rows.get(0).getString("verificationdate"))) {
|
|
|
+ if (isMoreThanOneHourUsingCalendar(rows.get(0).getDate("verificationdate"), new Date())) {
|
|
|
Sms sms = new Sms();
|
|
|
- sms.sendout(Sms.SmsType.Notice,customerphone, "尊敬的用户您好,您的工单服务已完成,完工验证码是"+verificationCode+"。");
|
|
|
+ sms.sendout(Sms.SmsType.Notice, customerphone, "尊敬的用户您好,您的工单服务已完成,完工验证码是" + verificationCode + "。");
|
|
|
message_map.put(customerphone, new VerificationManage(verificationCode));
|
|
|
- dbConnect.runSqlUpdate("update sa_workorder set verificationdate=CURRENT_TIME where sa_workorderid="+sa_workorderid);
|
|
|
+ dbConnect.runSqlUpdate("update sa_workorder set verificationdate=CURRENT_TIME where sa_workorderid=" + sa_workorderid);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Sms sms = new Sms();
|
|
|
- sms.sendout(Sms.SmsType.Notice,customerphone, "尊敬的用户您好,您的工单服务已完成,完工验证码是"+verificationCode+"。");
|
|
|
+ sms.sendout(Sms.SmsType.Notice, customerphone, "尊敬的用户您好,您的工单服务已完成,完工验证码是" + verificationCode + "。");
|
|
|
message_map.put(customerphone, new VerificationManage(verificationCode));
|
|
|
- dbConnect.runSqlUpdate("update sa_workorder set verificationdate=CURRENT_TIME where sa_workorderid="+sa_workorderid);
|
|
|
+ dbConnect.runSqlUpdate("update sa_workorder set verificationdate=CURRENT_TIME where sa_workorderid=" + sa_workorderid);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
row.put("code", 1);
|
|
|
row.put("msg", "手机验证码已发送,请注意查收!");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
row.put("code", 1);
|
|
|
- row.put("msg", "手机验证码为:"+verificationCode);
|
|
|
+ row.put("msg", "手机验证码为:" + verificationCode);
|
|
|
}
|
|
|
}
|
|
|
return getSucReturnObject().setData(row).toString();
|
|
|
@@ -867,38 +856,38 @@ public class serviceorder extends Controller {
|
|
|
@API(title = "验证码校验", apiversion = R.ID20230215173203.v1.class, accesstoken = false)
|
|
|
public String checkVerificationCode() throws YosException {
|
|
|
String customerphone = "";
|
|
|
- long sa_workorderid=content.getLong("sa_workorderid");
|
|
|
- Rows rows = dbConnect.runSqlQuery("select t1.type,t2.* from sa_workorder t1 inner join sa_serviceorder t2 on t1.sa_serviceorderid=t2.sa_serviceorderid and t1.siteid=t2.siteid where t1.sa_workorderid="+sa_workorderid);
|
|
|
- if(rows.isEmpty()){
|
|
|
+ long sa_workorderid = content.getLong("sa_workorderid");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t1.type,t2.* from sa_workorder t1 inner join sa_serviceorder t2 on t1.sa_serviceorderid=t2.sa_serviceorderid and t1.siteid=t2.siteid where t1.sa_workorderid=" + sa_workorderid);
|
|
|
+ if (rows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("该工单不存在").toString();
|
|
|
}
|
|
|
long createuserid = rows.get(0).getLong("createuserid");
|
|
|
- String type=rows.get(0).getString("type");
|
|
|
- Rows userrows =dbConnect.runSqlQuery("select t2.usertype,t1.phonenumber from sys_users t1 inner join sys_usersite t2 on t1.userid = t2.userid where t2.siteid = '"+siteid+"' and t1.userid="+createuserid);
|
|
|
+ String type = rows.get(0).getString("type");
|
|
|
+ Rows userrows = dbConnect.runSqlQuery("select t2.usertype,t1.phonenumber from sys_users t1 inner join sys_usersite t2 on t1.userid = t2.userid where t2.siteid = '" + siteid + "' and t1.userid=" + createuserid);
|
|
|
long usertype = 0;
|
|
|
- if(userrows.isNotEmpty()){
|
|
|
- usertype=userrows.get(0).getLong("usertype");
|
|
|
- }else{
|
|
|
+ if (userrows.isNotEmpty()) {
|
|
|
+ usertype = userrows.get(0).getLong("usertype");
|
|
|
+ } else {
|
|
|
//return getErrReturnObject().setErrMsg("工单创建人信息有误").toString();
|
|
|
}
|
|
|
|
|
|
- if(usertype==99){
|
|
|
- customerphone=userrows.get(0).getString("phonenumber");
|
|
|
- }else{
|
|
|
- if(type.equals("安装")){
|
|
|
- customerphone=rows.get(0).getString("scenecontactphonenumber");
|
|
|
+ if (usertype == 99) {
|
|
|
+ customerphone = userrows.get(0).getString("phonenumber");
|
|
|
+ } else {
|
|
|
+ if (type.equals("安装")) {
|
|
|
+ customerphone = rows.get(0).getString("scenecontactphonenumber");
|
|
|
}
|
|
|
}
|
|
|
String code = content.getStringValue("code");
|
|
|
boolean isgeneralcompletioncode = Parameter.getBoolean(siteid, "isgeneralcompletioncode");
|
|
|
- String generalcompletioncode=Parameter.getString(siteid, "generalcompletioncode");
|
|
|
- if(isgeneralcompletioncode){
|
|
|
- if(!code.equals(generalcompletioncode)){
|
|
|
+ String generalcompletioncode = Parameter.getString(siteid, "generalcompletioncode");
|
|
|
+ if (isgeneralcompletioncode) {
|
|
|
+ if (!code.equals(generalcompletioncode)) {
|
|
|
if (!message_map.containsKey(customerphone) || !message_map.get(customerphone).check(code)) {
|
|
|
return getErrReturnObject().setErrMsg("验证码错误或者过期").toString();
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (!message_map.containsKey(customerphone) || !message_map.get(customerphone).check(code)) {
|
|
|
return getErrReturnObject().setErrMsg("验证码错误或者过期").toString();
|
|
|
}
|
|
|
@@ -992,16 +981,15 @@ public class serviceorder extends Controller {
|
|
|
// jsonObject.put("phone", phone);
|
|
|
// rest.addRawBody(jsonObject.toString());
|
|
|
// String s = rest.post();
|
|
|
-//// PaoSetRemote verCodehistory = getpaoset("VerCodehistory");
|
|
|
-//// PaoRemote remote = verCodehistory.addAtEnd();
|
|
|
-//// remote.setValue("phone",phone);
|
|
|
-//// remote.setValue("msg","【Banninger】您好,您的验证码是"+verificationCode);
|
|
|
-//// remote.setValue("content",s);
|
|
|
-//// verCodehistory.save();
|
|
|
+
|
|
|
+ /// / PaoSetRemote verCodehistory = getpaoset("VerCodehistory");
|
|
|
+ /// / PaoRemote remote = verCodehistory.addAtEnd();
|
|
|
+ /// / remote.setValue("phone",phone);
|
|
|
+ /// / remote.setValue("msg","【Banninger】您好,您的验证码是"+verificationCode);
|
|
|
+ /// / remote.setValue("content",s);
|
|
|
+ /// / verCodehistory.save();
|
|
|
// return s;
|
|
|
// }
|
|
|
-
|
|
|
-
|
|
|
public static String createVerificationCode() {
|
|
|
String s = "";
|
|
|
while (s.length() < 6)
|
|
|
@@ -1012,7 +1000,7 @@ public class serviceorder extends Controller {
|
|
|
/**
|
|
|
* 方法2:使用 Calendar 计算是否超过一小时
|
|
|
*/
|
|
|
- public boolean isMoreThanOneHourUsingCalendar(Date date1, Date date2) {
|
|
|
+ public boolean isMoreThanOneHourUsingCalendar(Date date1, Date date2) {
|
|
|
Calendar cal1 = Calendar.getInstance();
|
|
|
Calendar cal2 = Calendar.getInstance();
|
|
|
cal1.setTime(date1);
|
|
|
@@ -1022,4 +1010,5 @@ public class serviceorder extends Controller {
|
|
|
long diffInMillis = Math.abs(cal2.getTimeInMillis() - cal1.getTimeInMillis());
|
|
|
return diffInMillis >= 3600000L;
|
|
|
}
|
|
|
+
|
|
|
}
|