|
@@ -10,6 +10,7 @@ import com.jpsoft.smart.modules.base.service.PersonDeviceRelationService;
|
|
|
import com.jpsoft.smart.modules.base.service.PersonInfoService;
|
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.smart.modules.common.utils.CheckIdCard;
|
|
|
import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.smart.modules.common.utils.SMSUtil;
|
|
@@ -451,4 +452,61 @@ public class PersonInfoApiController {
|
|
|
|
|
|
return messageResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="保存人员信息并将照片上传到终端")
|
|
|
+ @PostMapping("saveDetail")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="name",value = "姓名",required = false,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="phone",value = "手机号码",required = false,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="idCard",value = "身份证号",required = false,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="wechatNoticeEnabled",value = "是否接收微信通知",required = false,paramType = "form",dataType = "Boolean"),
|
|
|
+ @ApiImplicitParam(name="openId",value = "微信openId",required = true,paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="token",value = "令牌",paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<PersonInfo> saveDetail(String name,String phone,String idCard,Boolean wechatNoticeEnabled,String openId,String token){
|
|
|
+ MessageResult<PersonInfo> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ PersonInfo personInfo = personInfoService.findByOpenId(openId);
|
|
|
+
|
|
|
+ if (personInfo==null){
|
|
|
+ throw new Exception("人员信息不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ CheckIdCard cic = null;
|
|
|
+ if (StringUtils.isEmpty(idCard)) {
|
|
|
+// msgResult.setMessage("身份证不能为空!");
|
|
|
+// msgResult.setResult(false);
|
|
|
+// return msgResult;
|
|
|
+ } else {
|
|
|
+ personInfo.setIdCard(idCard.trim().toUpperCase());
|
|
|
+
|
|
|
+ cic = new CheckIdCard(personInfo.getIdCard());
|
|
|
+ if (!cic.validate()) {
|
|
|
+ messageResult.setMessage("身份证验证失败!");
|
|
|
+ messageResult.setResult(false);
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ personInfo.setName(name);
|
|
|
+ personInfo.setPhone(phone);
|
|
|
+ if(wechatNoticeEnabled != null) personInfo.setWechatNoticeEnabled(wechatNoticeEnabled);
|
|
|
+ personInfo.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ personInfoService.update(personInfo);
|
|
|
+
|
|
|
+ messageResult.setData(personInfo);
|
|
|
+ messageResult.setResult(true);
|
|
|
+
|
|
|
+ messageResult.setCode(200);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage(),e);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
}
|