|
|
@@ -3,6 +3,7 @@ package restcontroller.webmanage.sale.serviceorder;
|
|
|
import beans.data.BatchDeleteErr;
|
|
|
import beans.datacontrllog.DataContrlLog;
|
|
|
import beans.datateam.DataTeam;
|
|
|
+import beans.parameter.Parameter;
|
|
|
import beans.salearea.SaleArea;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
@@ -684,25 +685,40 @@ public class serviceorder extends Controller {
|
|
|
|
|
|
@API(title = "发送手机验证码", apiversion = R.ID20230215173103.v1.class, accesstoken = false)
|
|
|
public String sendMessage() throws YosException {
|
|
|
- String customerphone = content.getStringValue("customerphone");
|
|
|
+ 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()){
|
|
|
+ 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);
|
|
|
+ long usertype = 0;
|
|
|
+ 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 (!Pattern.matches("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$", customerphone)) {
|
|
|
return getErrReturnObject().setErrMsg("手机格式有误").toString();
|
|
|
}
|
|
|
- Rows rows = dbConnect.runSqlQuery("select scenecontactphonenumber from sa_serviceorder where scenecontactphonenumber='" + customerphone + "'");
|
|
|
- if (rows.isEmpty()) {
|
|
|
- return getErrReturnObject().setErrMsg("您的手机号暂无使用权限!").toString();
|
|
|
- }
|
|
|
String verificationCode = createVerificationCode();
|
|
|
- String result = null;
|
|
|
- try {
|
|
|
- result = sendMessage_0(customerphone, verificationCode);
|
|
|
- } catch (Exception e) {
|
|
|
- return getErrReturnObject().setErrMsg(e.getMessage()).toString();
|
|
|
- }
|
|
|
+ Sms sms = new Sms();
|
|
|
+ sms.sendout(Sms.SmsType.PassWord,customerphone, Parameter.getString("chuanglan_sms_model_password"), new String[]{verificationCode});
|
|
|
message_map.put(customerphone, new VerificationManage(verificationCode));
|
|
|
Row row = new Row();
|
|
|
- row.put("code", verificationCode);
|
|
|
- row.put("msg", result);
|
|
|
+ row.put("code", 1);
|
|
|
+ row.put("msg", "手机验证码已发送,请注意查收!");
|
|
|
return getSucReturnObject().setData(row).toString();
|
|
|
}
|
|
|
|
|
|
@@ -711,7 +727,29 @@ public class serviceorder extends Controller {
|
|
|
**/
|
|
|
@API(title = "发送手机验证码", apiversion = R.ID20230215173203.v1.class, accesstoken = false)
|
|
|
public String checkVerificationCode() throws YosException {
|
|
|
- String customerphone = content.getStringValue("customerphone");
|
|
|
+ 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()){
|
|
|
+ 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);
|
|
|
+ long usertype = 0;
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ }
|
|
|
String code = content.getStringValue("code");
|
|
|
if (!message_map.containsKey(customerphone) || !message_map.get(customerphone).check(code)) {
|
|
|
return getErrReturnObject().setErrMsg("验证码错误或者过期").toString();
|
|
|
@@ -796,25 +834,24 @@ public class serviceorder extends Controller {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private String sendMessage_0(String phone, String verificationCode) throws Exception {
|
|
|
-
|
|
|
- HttpURLRest rest = new HttpURLRest("http://smssh1.253.com/msg/v1/send/json");
|
|
|
- rest.addHeader("Content-type", "application/json");
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("account", "YZM1357742");
|
|
|
- jsonObject.put("password", "cBLqr5kRMVc541");
|
|
|
- jsonObject.put("msg", "【Banninger】您好,您的验证码是" + verificationCode);
|
|
|
- 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();
|
|
|
- return s;
|
|
|
- }
|
|
|
+// private String sendMessage_0(String phone, String verificationCode) throws Exception {
|
|
|
+// HttpURLRest rest = new HttpURLRest("http://smssh1.253.com/msg/v1/send/json");
|
|
|
+// rest.addHeader("Content-type", "application/json");
|
|
|
+// JSONObject jsonObject = new JSONObject();
|
|
|
+// jsonObject.put("account", "N3147701");
|
|
|
+// jsonObject.put("password", "4ClGyab6fv6a87");
|
|
|
+// jsonObject.put("msg", "【浙江美大】您好,您的验证码是" + verificationCode);
|
|
|
+// 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();
|
|
|
+// return s;
|
|
|
+// }
|
|
|
|
|
|
|
|
|
public static String createVerificationCode() {
|