|
@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.yunzhi.nanyang.common.BaseController;
|
7
|
7
|
import com.yunzhi.nanyang.common.ResponseBean;
|
8
|
8
|
import com.yunzhi.nanyang.common.SMSCaptcha;
|
|
9
|
+import com.yunzhi.nanyang.common.StringUtils;
|
|
10
|
+import com.yunzhi.nanyang.entity.SysUser;
|
|
11
|
+import com.yunzhi.nanyang.service.ISysUserService;
|
9
|
12
|
import com.yunzhi.nanyang.vo.PhoneParam;
|
10
|
13
|
import io.swagger.annotations.Api;
|
11
|
14
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -41,6 +44,9 @@ public class TaPersonController extends BaseController {
|
41
|
44
|
@Autowired
|
42
|
45
|
public ITaPersonService iTaPersonService;
|
43
|
46
|
|
|
47
|
+ @Autowired
|
|
48
|
+ public ISysUserService iSysUserService;
|
|
49
|
+
|
44
|
50
|
@Autowired
|
45
|
51
|
public SMSCaptcha smsCaptcha;
|
46
|
52
|
|
|
@@ -112,6 +118,10 @@ public class TaPersonController extends BaseController {
|
112
|
118
|
return ResponseBean.error("待更新人员ID不正确");
|
113
|
119
|
}
|
114
|
120
|
|
|
121
|
+ if (StringUtils.isEmpty(phoneParam.getPhone())) {
|
|
122
|
+ return ResponseBean.error("手机号码为空");
|
|
123
|
+ }
|
|
124
|
+
|
115
|
125
|
boolean isOk = smsCaptcha.validate(phoneParam.getPhone(), phoneParam.getCaptcha());
|
116
|
126
|
if (!isOk) {
|
117
|
127
|
return ResponseBean.error("验证码不正确或者已过期");
|
|
@@ -119,7 +129,15 @@ public class TaPersonController extends BaseController {
|
119
|
129
|
|
120
|
130
|
taPerson.setPhone(phoneParam.getPhone());
|
121
|
131
|
|
|
132
|
+ // 关联系统人员
|
|
133
|
+ SysUser sysUser = iSysUserService.getExistBy("phone", phoneParam.getPhone(), false, true);
|
|
134
|
+ if (sysUser != null && StringUtils.isEmpty(taPerson.getUserId())) {
|
|
135
|
+ taPerson.setUserId(sysUser.getUserId());
|
|
136
|
+ }
|
|
137
|
+
|
122
|
138
|
if (iTaPersonService.updateById(taPerson)){
|
|
139
|
+
|
|
140
|
+
|
123
|
141
|
return ResponseBean.success(taPerson);
|
124
|
142
|
}else {
|
125
|
143
|
return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|