|
|
@@ -13,6 +13,7 @@ import com.iformall.enums.EnumAssignTagsTrigger; |
|
|
import com.iformall.enums.EnumScoreType; |
|
|
import com.iformall.enums.EnumScoreType; |
|
|
import com.iformall.enums.EnumUserType; |
|
|
import com.iformall.enums.EnumUserType; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.*; |
|
|
|
|
|
import com.iformall.utils.Constant; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
@@ -23,6 +24,7 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@@ -35,7 +37,6 @@ import java.util.List; |
|
|
public class WxCUserController extends BaseController { |
|
|
public class WxCUserController extends BaseController { |
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxCUserBasicInfoService wxCUserBasicInfoService; |
|
|
private WxCUserBasicInfoService wxCUserBasicInfoService; |
|
|
|
|
|
|
|
|
@@ -48,6 +49,9 @@ public class WxCUserController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxMerchantBUserService wxMerchantBUserService; |
|
|
private WxMerchantBUserService wxMerchantBUserService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxCUserFromBService wxCUserFromBService; |
|
|
private WxCUserFromBService wxCUserFromBService; |
|
|
|
|
|
|
|
|
@@ -57,7 +61,6 @@ public class WxCUserController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxCreditHistoryService wxCreditHistoryService; |
|
|
private WxCreditHistoryService wxCreditHistoryService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 会员更新信息 |
|
|
* 会员更新信息 |
|
|
* |
|
|
* |
|
|
@@ -76,70 +79,126 @@ public class WxCUserController extends BaseController { |
|
|
if (StringUtils.isEmpty(wxCUserFromBDto.getAppId())) { |
|
|
if (StringUtils.isEmpty(wxCUserFromBDto.getAppId())) { |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端appId不能为空"); |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端appId不能为空"); |
|
|
} |
|
|
} |
|
|
if (wxCUserFromBDto.getUserId() == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "bUserId不能为空"); |
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(wxCUserFromBDto.getPhone())) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端手机号不能为空"); |
|
|
} |
|
|
} |
|
|
|
|
|
// if (wxCUserFromBDto.getUserId() == null) { |
|
|
|
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "bUserId不能为空"); |
|
|
|
|
|
// } |
|
|
//根据bUserId查询B端用户是否存在 |
|
|
//根据bUserId查询B端用户是否存在 |
|
|
WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getUserId()); |
|
|
|
|
|
|
|
|
// WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getUserId()); |
|
|
|
|
|
WxMerchantBUser bUser = getLoginBUser(); |
|
|
if (bUser == null) { |
|
|
if (bUser == null) { |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "B端用户不存在"); |
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "B端用户不存在"); |
|
|
} |
|
|
} |
|
|
|
|
|
WxMerchant wxMerchant = wxMerchantService.getById(bUser.getMerchantId()); |
|
|
|
|
|
if (wxMerchant == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "商户不存在"); |
|
|
|
|
|
} |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
|
|
|
WxCUserFromB wxCUserFromB = wxCUserFromBService.getByOpenidAndAppId(wxCUserFromBDto); |
|
|
WxCUserFromB wxCUserFromB = wxCUserFromBService.getByOpenidAndAppId(wxCUserFromBDto); |
|
|
//查询C端微信信息 |
|
|
|
|
|
WxCUser wxCUser = new WxCUser(); |
|
|
WxCUser wxCUser = new WxCUser(); |
|
|
wxCUser.setAppId(wxCUserFromBDto.getAppId()); |
|
|
wxCUser.setAppId(wxCUserFromBDto.getAppId()); |
|
|
wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); |
|
|
wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); |
|
|
wxCUser = wxCUserService.getByOpenId(wxCUser); |
|
|
wxCUser = wxCUserService.getByOpenId(wxCUser); |
|
|
if (wxCUserFromB == null) { |
|
|
|
|
|
//TODO phone可能为空 |
|
|
|
|
|
String phone = wxCUser.getPhone(); |
|
|
|
|
|
|
|
|
|
|
|
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.findInfoByPhone(bUser, phone); |
|
|
|
|
|
//查询会员信息 |
|
|
|
|
|
//List<WxCUserBasicInfo> byPhone = wxCUserBasicInfoService.findByPhone(bUser, phone); |
|
|
|
|
|
//存在会员信息 |
|
|
|
|
|
if (wxCUserBasicInfo != null) { |
|
|
|
|
|
//更新会员信息 |
|
|
|
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { |
|
|
|
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto != null) { |
|
|
|
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isAddCredit = false; |
|
|
|
|
|
WxCUserBasicInfo wxCUserBasicInfo = null; |
|
|
|
|
|
|
|
|
|
|
|
if(wxCUserFromB != null){ |
|
|
|
|
|
wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),bUser.getFinalTenantId()); |
|
|
|
|
|
if (!wxCUserBasicInfo.getPhone().equals(wxCUserFromBDto.getPhone())){ |
|
|
|
|
|
wxCUser.setPhone(wxCUserFromBDto.getPhone()); |
|
|
|
|
|
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { |
|
|
|
|
|
if(StringUtils.isEmpty(wxCUserBasicInfo.getName())){ |
|
|
|
|
|
isAddCredit = true; |
|
|
} |
|
|
} |
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { |
|
|
|
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
|
|
|
|
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getBirthdate() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotEmpty(wxCUserFromBDto.getAddress())) { |
|
|
|
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
|
|
|
} |
|
|
|
|
|
wxCUserBasicInfoService.update(wxCUserBasicInfo); |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
wxCUserFromB = new WxCUserFromB(); |
|
|
|
|
|
if(wxCUser != null){ |
|
|
|
|
|
if(wxCUser.getUserId() != null){ |
|
|
|
|
|
wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUser.getUserId(),wxCUser.getFinalTenantId()); |
|
|
|
|
|
if (!wxCUserBasicInfo.getPhone().equals(wxCUserFromBDto.getPhone())){ |
|
|
|
|
|
wxCUser.setPhone(wxCUserFromBDto.getPhone()); |
|
|
|
|
|
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { |
|
|
|
|
|
if(StringUtils.isEmpty(wxCUserBasicInfo.getName())){ |
|
|
|
|
|
isAddCredit = true; |
|
|
|
|
|
} |
|
|
|
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getBirthdate() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotEmpty(wxCUserFromBDto.getAddress())) { |
|
|
|
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
|
|
|
} |
|
|
|
|
|
wxCUserBasicInfoService.update(wxCUserBasicInfo); |
|
|
|
|
|
|
|
|
|
|
|
wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); |
|
|
|
|
|
wxCUserFromB.setCUserId(wxCUserBasicInfo.getId()); |
|
|
|
|
|
wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); |
|
|
|
|
|
wxCUserFromB.setMerchantId(bUser.getMerchantId()); |
|
|
|
|
|
wxCUserFromB.updateTenantInfo(bUser); |
|
|
|
|
|
wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); |
|
|
|
|
|
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); |
|
|
|
|
|
}else{ |
|
|
|
|
|
isAddCredit = true; |
|
|
|
|
|
wxCUserBasicInfo = new WxCUserBasicInfo(); |
|
|
|
|
|
wxCUserBasicInfo.setId(idWorker.nextId()); |
|
|
|
|
|
wxCUserBasicInfo.setTenantId("," + wxCUser.getTenantId() + ","); |
|
|
|
|
|
wxCUserBasicInfo.setFinalTenantId(wxCUser.getFinalTenantId()); |
|
|
|
|
|
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); |
|
|
|
|
|
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { |
|
|
|
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getBirthdate() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { |
|
|
|
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
|
|
|
} |
|
|
|
|
|
wxCUserBasicInfo.setLoginCount(1); |
|
|
|
|
|
wxCUserBasicInfo.setActiveTime(new Date()); |
|
|
|
|
|
wxCUserBasicInfo.setCreateDate(new Date()); |
|
|
|
|
|
wxCUserBasicInfo.setUpdateDate(new Date()); |
|
|
|
|
|
wxCUserBasicInfoService.save(wxCUserBasicInfo); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
wxCUserBasicInfo.setPhone(wxCUser.getPhone()); |
|
|
|
|
|
wxCUserBasicInfo.setUpdateDate(new Date()); |
|
|
|
|
|
wxCUserBasicInfoService.update(wxCUserBasicInfo); |
|
|
|
|
|
wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); |
|
|
|
|
|
//增加积分 |
|
|
|
|
|
addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); |
|
|
|
|
|
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); |
|
|
|
|
|
//新增来自B端的会员关联数据 |
|
|
|
|
|
wxCUserFromB = new WxCUserFromB(); |
|
|
|
|
|
wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); |
|
|
|
|
|
wxCUserFromB.setCUserId(wxCUserBasicInfo.getId()); |
|
|
|
|
|
wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); |
|
|
|
|
|
wxCUserFromB.setMerchantId(bUser.getMerchantId()); |
|
|
|
|
|
wxCUserFromB.updateTenantInfo(bUser); |
|
|
|
|
|
wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); |
|
|
|
|
|
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); |
|
|
|
|
|
wxCUserFromBService.saveOrUpdate(wxCUserFromB); |
|
|
|
|
|
} else { |
|
|
|
|
|
//新增来自B端的会员 |
|
|
|
|
|
long cUserId = idWorker.nextId(); |
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
isAddCredit = true; |
|
|
wxCUserBasicInfo = new WxCUserBasicInfo(); |
|
|
wxCUserBasicInfo = new WxCUserBasicInfo(); |
|
|
wxCUserBasicInfo.setId(cUserId); |
|
|
|
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { |
|
|
|
|
|
|
|
|
wxCUserBasicInfo.setId(idWorker.nextId()); |
|
|
|
|
|
wxCUserBasicInfo.setTenantId("," + wxCUser.getTenantId() + ","); |
|
|
|
|
|
wxCUserBasicInfo.setFinalTenantId(wxCUser.getFinalTenantId()); |
|
|
|
|
|
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); |
|
|
|
|
|
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) { |
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
} |
|
|
} |
|
|
if (wxCUserFromBDto != null) { |
|
|
|
|
|
|
|
|
if (wxCUserFromBDto.getBirthdate() != null) { |
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
} |
|
|
} |
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
@@ -148,57 +207,50 @@ public class WxCUserController extends BaseController { |
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { |
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { |
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
} |
|
|
} |
|
|
wxCUserBasicInfo.setPhone(wxCUser.getPhone()); |
|
|
|
|
|
|
|
|
wxCUserBasicInfo.setLoginCount(1); |
|
|
|
|
|
wxCUserBasicInfo.setActiveTime(new Date()); |
|
|
|
|
|
wxCUserBasicInfo.setCreateDate(new Date()); |
|
|
wxCUserBasicInfo.setUpdateDate(new Date()); |
|
|
wxCUserBasicInfo.setUpdateDate(new Date()); |
|
|
wxCUserBasicInfoService.save(wxCUserBasicInfo); |
|
|
wxCUserBasicInfoService.save(wxCUserBasicInfo); |
|
|
//新增来自B端的会员关联数据 |
|
|
|
|
|
wxCUserFromB = new WxCUserFromB(); |
|
|
|
|
|
wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId()); |
|
|
|
|
|
wxCUserFromB.setCUserId(cUserId); |
|
|
|
|
|
wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); |
|
|
|
|
|
wxCUserFromB.setMerchantId(bUser.getMerchantId()); |
|
|
|
|
|
wxCUserFromB.updateTenantInfo(bUser); |
|
|
|
|
|
wxCUserFromB.setAppId(wxCUserFromBDto.getAppId()); |
|
|
|
|
|
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); |
|
|
|
|
|
wxCUserFromBService.saveOrUpdate(wxCUserFromB); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),bUser.getFinalTenantId()); |
|
|
|
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { |
|
|
|
|
|
wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto != null) { |
|
|
|
|
|
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxCUserFromBDto.getSex() != null) { |
|
|
|
|
|
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) { |
|
|
|
|
|
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxCUser = new WxCUser(); |
|
|
|
|
|
wxCUser.setTenantId(bUser.getTenantId()); |
|
|
|
|
|
wxCUser.setParentTenantId(bUser.getParentTenantId()); |
|
|
|
|
|
wxCUser.setAppId(wxCUserFromBDto.getAppId()); |
|
|
|
|
|
wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); |
|
|
|
|
|
wxCUser.setPhone(wxCUserBasicInfo.getPhone()); |
|
|
|
|
|
wxCUser.setLoginCount(1); |
|
|
|
|
|
wxCUser.setUserId(wxCUserBasicInfo.getId()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
wxCUserBasicInfo.setPhone(wxCUser.getPhone()); |
|
|
|
|
|
wxCUserBasicInfoService.update(wxCUserBasicInfo); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wxCUserService.saveOrUpdate(wxCUser); |
|
|
|
|
|
if(isAddCredit){ |
|
|
wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); |
|
|
wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); |
|
|
//增加积分 |
|
|
//增加积分 |
|
|
addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); |
|
|
|
|
|
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); |
|
|
|
|
|
//更新B端来源会员 |
|
|
|
|
|
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); |
|
|
|
|
|
wxCUserFromBService.saveOrUpdate(wxCUserFromB); |
|
|
|
|
|
|
|
|
addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, bUser,wxMerchant); |
|
|
} |
|
|
} |
|
|
|
|
|
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser); |
|
|
|
|
|
//更新B端来源会员 |
|
|
|
|
|
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); |
|
|
|
|
|
wxCUserFromBService.saveOrUpdate(wxCUserFromB); |
|
|
|
|
|
|
|
|
return new ResultData(); |
|
|
return new ResultData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId) { |
|
|
|
|
|
|
|
|
private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, WxMerchantBUser bUser,WxMerchant wxMerchant) { |
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); |
|
|
wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); |
|
|
|
|
|
wxCreditHistory.setMerchantId(wxMerchant.getId()); |
|
|
// wxCreditHistory.updateTenantInfo(tenantEntity); |
|
|
// wxCreditHistory.updateTenantInfo(tenantEntity); |
|
|
wxCreditHistory.setTenantId(wxCUserBasicInfo.getFinalTenantId()); |
|
|
wxCreditHistory.setTenantId(wxCUserBasicInfo.getFinalTenantId()); |
|
|
wxCreditHistory.setFinalTenantId(wxCUserBasicInfo.getFinalTenantId()); |
|
|
wxCreditHistory.setFinalTenantId(wxCUserBasicInfo.getFinalTenantId()); |
|
|
wxCreditHistory.setCreateDate(new Date()); |
|
|
wxCreditHistory.setCreateDate(new Date()); |
|
|
wxCreditHistory.setCreditType(enumScoreType.getCode()); |
|
|
wxCreditHistory.setCreditType(enumScoreType.getCode()); |
|
|
|
|
|
wxCreditHistory.setChangePurpose("B端("+wxMerchant.getName()+")("+bUser.getPhone()+")操作完善个人信息"); |
|
|
wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); |
|
|
wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); |
|
|
wxCreditHistory.setOperatorId(userId); |
|
|
|
|
|
|
|
|
wxCreditHistory.setOperatorId(bUser.getId()); |
|
|
wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
wxCreditHistoryService.saveOrUpdate(wxCreditHistory); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -228,6 +280,16 @@ public class WxCUserController extends BaseController { |
|
|
if(wxCUserFromB!=null){ |
|
|
if(wxCUserFromB!=null){ |
|
|
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),wxCUserFromB.getFinalTenantId()); |
|
|
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),wxCUserFromB.getFinalTenantId()); |
|
|
return new ResultData(wxCUserBasicInfo); |
|
|
return new ResultData(wxCUserBasicInfo); |
|
|
|
|
|
}else{ |
|
|
|
|
|
WxCUser wxCUser = new WxCUser(); |
|
|
|
|
|
wxCUser.updateTenantInfo(getTenantInfo()); |
|
|
|
|
|
wxCUser.setAppId(wxCUserFromBDto.getAppId()); |
|
|
|
|
|
wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); |
|
|
|
|
|
WxCUser byOpenId = wxCUserService.getByOpenId(wxCUser); |
|
|
|
|
|
if(null != byOpenId.getUserId()){ |
|
|
|
|
|
WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(byOpenId.getUserId(), byOpenId.getFinalTenantId()); |
|
|
|
|
|
return new ResultData(byId); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return new ResultData(Result.SUCCESS,"查询成功",null); |
|
|
return new ResultData(Result.SUCCESS,"查询成功",null); |
|
|
} |
|
|
} |
|
|
|