|
@@ -18,6 +18,7 @@ import com.yonge.cooleshow.common.security.SecurityConstants;
|
|
|
import com.yonge.cooleshow.tenant.io.request.SysUserWrapper;
|
|
|
import com.yonge.cooleshow.tenant.io.request.TenantInfoVo;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import com.yonge.toolset.utils.obj.ObjectUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -148,28 +149,34 @@ public class TenantInfoController extends BaseController {
|
|
|
String code = sysUser.getCode();
|
|
|
String phone = sysUser.getPhone();
|
|
|
|
|
|
- boolean re = smsCodeService.verifyValidCode(phone, code, "PHONE");
|
|
|
-
|
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser sysUser1 = JSON.parseObject(sysUser.jsonString(), com.yonge.cooleshow.biz.dal.entity.SysUser.class);
|
|
|
|
|
|
- if (re) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- tenantInfoService.updateSysUser(sysUser1, user.getId());
|
|
|
+ //如果传手机号
|
|
|
+ if (StringUtils.isNotBlank(phone)){
|
|
|
+ boolean re = smsCodeService.verifyValidCode(phone, code, "PHONE");
|
|
|
+ if (re){
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ tenantInfoService.updateSysUser(sysUser1, user.getId());
|
|
|
+
|
|
|
+ //设置默认头像
|
|
|
+ if (sysUser.getAvatar().isEmpty()) {
|
|
|
+ sysUser.setAvatar(sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD));
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断更改的手机所属的机构信息
|
|
|
+
|
|
|
+ String oldPhone = user.getPhone();
|
|
|
+ //查看原机构信息
|
|
|
+ List<TenantInfo> list = tenantInfoService.lambdaQuery().eq(TenantInfo::getPhone, oldPhone).list();
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ TenantInfo info = list.get(0);
|
|
|
+ if (ObjectUtil.isEmpty(info)) {
|
|
|
+ //更新tennatInfo
|
|
|
+ info.setPhone(phone);
|
|
|
+ tenantInfoService.updateById(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //设置默认头像
|
|
|
- if (sysUser.getAvatar().isEmpty()) {
|
|
|
- sysUser.setAvatar(sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD));
|
|
|
- }
|
|
|
- //判断更改的手机所属的机构信息
|
|
|
- List<TenantInfo> list = tenantInfoService.lambdaQuery().eq(TenantInfo::getPhone, phone).list();
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
- TenantInfo info = list.get(0);
|
|
|
- if (info != null) {
|
|
|
- //更新tennatInfo
|
|
|
- info.setPhone(phone);
|
|
|
- tenantInfoService.updateById(info);
|
|
|
- }
|
|
|
- }
|
|
|
//更新员工表
|
|
|
Long id = user.getId();
|
|
|
TenantStaff staff = tenantStaffService.getByUserId(id);
|
|
@@ -178,8 +185,26 @@ public class TenantInfoController extends BaseController {
|
|
|
staff.setAvatar(sysUser.getAvatar());
|
|
|
tenantStaffService.updateById(staff);
|
|
|
}
|
|
|
- } else {
|
|
|
- throw new BizException("手机号校验有误");
|
|
|
+ } else {
|
|
|
+ throw new BizException("手机号校验有误");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
+ tenantInfoService.updateSysUser(sysUser1, user.getId());
|
|
|
+
|
|
|
+ //设置默认头像
|
|
|
+ if (sysUser.getAvatar().isEmpty()) {
|
|
|
+ sysUser.setAvatar(sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD));
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新员工表
|
|
|
+ Long id = user.getId();
|
|
|
+ TenantStaff staff = tenantStaffService.getByUserId(id);
|
|
|
+ if (staff != null){
|
|
|
+ staff.setNickname(sysUser.getUsername());
|
|
|
+ staff.setAvatar(sysUser.getAvatar());
|
|
|
+ tenantStaffService.updateById(staff);
|
|
|
+ }
|
|
|
}
|
|
|
return HttpResponseResult.succeed(true);
|
|
|
}
|