|
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -43,7 +44,7 @@ public class PersonInfoApiController {
|
|
|
@PostMapping("findByNameAndPhone")
|
|
|
@ApiOperation(value="通过姓名和手机号查询人员")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name="name",value = "照片名称",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="name",value = "姓名",required = true,paramType = "form"),
|
|
|
@ApiImplicitParam(name = "phone",value = "电话号码", required = true,paramType="form")
|
|
|
})
|
|
|
public MessageResult<Long> findByNameAndPhone(String name,String phone){
|
|
@@ -52,6 +53,14 @@ public class PersonInfoApiController {
|
|
|
try {
|
|
|
PersonInfo personInfo = personInfoService.findByNameAndPhone(name, phone);
|
|
|
|
|
|
+ if (personInfo==null){
|
|
|
+ throw new Exception("当前用户信息未登记,请先联系单位管理员!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (personInfo.getFaceEnabled()==null || !personInfo.getFaceEnabled()){
|
|
|
+ throw new Exception("当前用户未被允许使用人脸识别!");
|
|
|
+ }
|
|
|
+
|
|
|
messageResult.setData(personInfo.getId());
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
@@ -75,6 +84,10 @@ public class PersonInfoApiController {
|
|
|
try {
|
|
|
PersonInfo personInfo = personInfoService.findByOpenId(openId);
|
|
|
|
|
|
+ if (personInfo==null){
|
|
|
+ throw new Exception("当前用户不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
messageResult.setData(personInfo);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
@@ -98,7 +111,7 @@ public class PersonInfoApiController {
|
|
|
try {
|
|
|
PersonInfo personInfo = personInfoService.get(personId);
|
|
|
|
|
|
- if(personInfo!=null){
|
|
|
+ if(personInfo==null){
|
|
|
throw new Exception("人员编号不存在!");
|
|
|
}
|
|
|
|
|
@@ -106,7 +119,7 @@ public class PersonInfoApiController {
|
|
|
|
|
|
String verifyCode = (String)valueOperations.get(key);
|
|
|
|
|
|
- if(StringUtils.isNotEmpty(verifyCode)) {
|
|
|
+ if(StringUtils.isEmpty(verifyCode)) {
|
|
|
verifyCode = SMSUtil.generateNumberString(6);
|
|
|
JSONObject verifyCodeJSON = new JSONObject();
|
|
|
verifyCodeJSON.put("code", verifyCode);
|
|
@@ -173,6 +186,10 @@ public class PersonInfoApiController {
|
|
|
personInfo.setOpenId(openId);
|
|
|
personInfo.setFaceImageUrl(faceImageUrl);
|
|
|
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ personInfoService.update(personInfo);
|
|
|
+
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
|
} catch (Exception e) {
|