|
|
|
@@ -3,6 +3,7 @@ package com.iformall.controller; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
@@ -98,14 +99,27 @@ public class WxCUserBasicInfoController extends BaseController { |
|
|
|
// return new ResultData(); |
|
|
|
// } |
|
|
|
|
|
|
|
private int checkUniquePhone(String phone, String tenantId) { |
|
|
|
WxCUserBasicInfo baseInfoQ = new WxCUserBasicInfo(); |
|
|
|
baseInfoQ.setPhone(phone); |
|
|
|
baseInfoQ.setTenantId(tenantId); |
|
|
|
return wxCUserBasicInfoService.cntUserList(baseInfoQ); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id更新接口") |
|
|
|
@PostMapping("update") |
|
|
|
public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { |
|
|
|
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); |
|
|
|
MallUserInfo currentUser = getUser(); |
|
|
|
WxCUserBasicInfo oldInfo = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); |
|
|
|
if (!oldInfo.getPhone().equals(wxCUserBasicInfo.getPhone())) { |
|
|
|
if(checkUniquePhone(wxCUserBasicInfo.getPhone(), currentUser.getTenantId()) > 0){ |
|
|
|
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
wxCUserBasicInfo.setTenantId(getTenantId()); |
|
|
|
if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { |
|
|
|
WxCUserTags record = new WxCUserTags(); |
|
|
|
record.setUserId(info.getId()); |
|
|
|
record.setUserId(oldInfo.getId()); |
|
|
|
record.setTenantId(getTenantId()); |
|
|
|
PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1); |
|
|
|
if (page.getSize() > 0) { |
|
|
|
|