Przeglądaj źródła

tt

release_toaliyun_real
xhxu 5 lat temu
rodzic
commit
d46c0a9645
6 zmienionych plików z 88 dodań i 13 usunięć
  1. +65
    -8
      mallinkPublicApi/src/main/java/com/iformall/controller/UserBasicInfoController.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java
  4. +15
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java
  6. +5
    -1
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml

+ 65
- 8
mallinkPublicApi/src/main/java/com/iformall/controller/UserBasicInfoController.java Wyświetl plik

@@ -2,10 +2,12 @@ package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCUserBasicInfo;
import com.iformall.domain.po.WxLevelConfig;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserService;
import com.iformall.service.WxLevelConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -26,6 +28,9 @@ public class UserBasicInfoController extends BaseController {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxCUserService wxCUserService;

@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@@ -42,6 +47,9 @@ public class UserBasicInfoController extends BaseController {
public ResultData userRegister(@RequestBody Map<String,Object> map) {
logger.info("UserBasicInfoController >>>>>>>>>>>> userRegister >>>>>>>>>>>>>"+map.toString());
String phone = (String) map.get("phone");
String nickName = (String) map.get("nickName");
String sexStr = (String) map.get("sex");
String avatarUrl = (String) map.get("avatarUrl");
if(StringUtils.isBlank(phone)){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"手机号不能为空");
}
@@ -49,22 +57,71 @@ public class UserBasicInfoController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"手机号格式不正确");
}

Integer sex = 0;
if(StringUtils.isNotBlank(sexStr)){
try {
sex = Integer.parseInt(sexStr);
} catch (NumberFormatException e) {
// e.printStackTrace();
}
}

TenantEntity tenantEntity = getTenantInfo();

WxCUserBasicInfo userBasicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone);
WxCUserBasicInfo userBasicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone,nickName,sex,avatarUrl);

this.setLevel(userBasicInfo,tenantEntity);

return new ResultData(userBasicInfo);
}

/**
*
* @param
* @return
*/
@PostMapping("/get")
@ApiOperation(value = "会员", notes = "")
public ResultData getUserInfo(@RequestBody Map<String,Object> map) {
logger.info("UserBasicInfoController >>>>>>>>>>>> getUserInfo >>>>>>>>>>>>>"+map.toString());
String phone = (String) map.get("phone");
String openId = (String) map.get("openId");
WxCUserBasicInfo basicInfo = null;
if(StringUtils.isBlank(phone) && StringUtils.isBlank(openId)){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
if(StringUtils.isNotBlank(phone)){
basicInfo = wxCUserBasicInfoService.findInfoByPhone(getTenantInfo(), phone);
}
if(basicInfo == null && StringUtils.isNotBlank(openId)){
WxCUser wxCUserQ = new WxCUser();
wxCUserQ.updateTenantInfo(getTenantInfo());
wxCUserQ.setOpenId(openId);
WxCUser byOpenId = wxCUserService.getByOpenId(wxCUserQ);
if(byOpenId != null && byOpenId.basicInfoIs()){
basicInfo = wxCUserBasicInfoService.getById(byOpenId.getUserId(),getTenantInfo().getFinalTenantId());
}
}
if(basicInfo == null){
return new ResultData(ErrorCode.USER_IS_EMPTY);
}

this.setLevel(basicInfo,getTenantInfo());

return new ResultData(basicInfo);
}

private void setLevel(WxCUserBasicInfo basicInfo,TenantEntity tenantEntity){
List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(tenantEntity);
userBasicInfo.setLevelList(levelList);
userBasicInfo.setLevel(WxLevelConfigService.DEFAULT_LEVEL);
if(userBasicInfo.getPoins() != null && userBasicInfo.getPoins() > 0){
basicInfo.setLevelList(levelList);
basicInfo.setLevel(WxLevelConfigService.DEFAULT_LEVEL);
if(basicInfo.getPoins() != null && basicInfo.getPoins() > 0){
for (WxLevelConfig levelConfig : levelList) {
if (userBasicInfo.getPoins() >= levelConfig.getPoints()) {
userBasicInfo.setLevel(levelConfig.getLevel());
if (basicInfo.getPoins() >= levelConfig.getPoints()) {
basicInfo.setLevel(levelConfig.getLevel());
}
}
}

return new ResultData(userBasicInfo);
}

}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java Wyświetl plik

@@ -175,7 +175,7 @@ public interface WxCUserBasicInfoService {

void updateQrCode(WxCUserBasicInfo wxCUserBasicInfo);

WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone);
WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName, Integer sex, String avatarUrl);

int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType wechatPhone);
}


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java Wyświetl plik

@@ -117,7 +117,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder
AliPayCUser aliUser = aliPayCUserService.getByAliPayUserId(userQ);
if(aliUser != null){
// WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(aliUser, aliUser.getPhone());
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone());
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone(),aliUser.getName(),null,null);
if(infoByPhone != null ){
record.setCUserId(infoByPhone.getId());
}else{


+ 15
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Wyświetl plik

@@ -638,7 +638,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
}

@Override
public WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone) {
public WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName, Integer sex, String avatarUrl) {
if (StringUtils.isBlank(phone))
return null;

@@ -648,7 +648,21 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
basicInfo.setTenantId("," + tenantEntity.getTenantId() + ",");
basicInfo.setFinalTenantId(tenantEntity.getFinalTenantId());
basicInfo.setPhone(phone);
basicInfo.setNickName(nickName);
basicInfo.setSex(sex);
basicInfo.setAvatarUrl(avatarUrl);
this.save(basicInfo);
}else{
if(StringUtils.isNotBlank(nickName)){
basicInfo.setNickName(nickName);
}
if(sex != null){
basicInfo.setSex(sex);
}
if(StringUtils.isNotBlank(avatarUrl)){
basicInfo.setAvatarUrl(avatarUrl);
}
wxCUserBasicInfoMapper.updateById(basicInfo);
}

return basicInfo;


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java Wyświetl plik

@@ -131,7 +131,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService
basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId());
}
if(basicInfo == null){
basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone());
basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null);
}

if(basicInfo != null){


+ 5
- 1
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Wyświetl plik

@@ -269,7 +269,11 @@

<select id="findByOpenId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap">
select <include refid="allColumns"/> from wx_c_user
where `app_id` = #{appId} and `open_id` = #{openId}
where `open_id` = #{openId}
<if test=" null != appId and '' != appId">
and `app_id` = #{appId}
</if>

</select>

<select id="findByUnionId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap">


Ładowanie…
Anuluj
Zapisz