|
@@ -1,10 +1,12 @@
|
|
package com.jpsoft.smart.modules.mobile.controller;
|
|
package com.jpsoft.smart.modules.mobile.controller;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
import com.jpsoft.smart.modules.base.entity.PersonInfo;
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
|
|
+import com.jpsoft.smart.modules.common.utils.SMSUtil;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -82,8 +84,9 @@ public class PersonInfoApiController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
@PostMapping("getVerifyCode")
|
|
@PostMapping("getVerifyCode")
|
|
- @ApiOperation(value="获取验证码")
|
|
|
|
|
|
+ @ApiOperation(value="获取短信验证码")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name="personId",value = "人员编号",required = true,paramType = "form")
|
|
@ApiImplicitParam(name="personId",value = "人员编号",required = true,paramType = "form")
|
|
})
|
|
})
|
|
@@ -91,16 +94,17 @@ public class PersonInfoApiController {
|
|
MessageResult<String> messageResult = new MessageResult<>();
|
|
MessageResult<String> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
- if(!personInfoService.exist(personId)){
|
|
|
|
|
|
+ PersonInfo personInfo = personInfoService.get(personId);
|
|
|
|
|
|
|
|
+ if(personInfo!=null){
|
|
|
|
+ throw new Exception("人员编号不存在@");
|
|
}
|
|
}
|
|
|
|
|
|
- String code = "";
|
|
|
|
-
|
|
|
|
|
|
+ String verifyCode = SMSUtil.generateNumberString(6);
|
|
|
|
+ JSONObject verifyCodeJSON = new JSONObject();
|
|
|
|
+ verifyCodeJSON.put("code", verifyCode);
|
|
|
|
|
|
-
|
|
|
|
- messageResult.setData(code);
|
|
|
|
- messageResult.setResult(true);
|
|
|
|
|
|
+ messageResult = SMSUtil.send(personInfo.getPhone(), "SMS_49390047", verifyCodeJSON.toString());
|
|
}
|
|
}
|
|
catch (Exception ex){
|
|
catch (Exception ex){
|
|
messageResult.setResult(false);
|
|
messageResult.setResult(false);
|