|
|
|
|
@ -4,17 +4,11 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.flossom.common.core.constant.CacheConstants;
|
|
|
|
|
import com.flossom.common.core.constant.UserConstants;
|
|
|
|
|
import com.flossom.common.core.domain.R;
|
|
|
|
|
import com.flossom.common.core.domain.entity.SysUser;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxScriptMessage;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxUserMember;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
|
|
|
|
import com.flossom.common.core.domain.entity.*;
|
|
|
|
|
import com.flossom.common.core.enums.MessageTypeEnum;
|
|
|
|
|
import com.flossom.common.core.enums.WxUserIntegralMessageTypeEnum;
|
|
|
|
|
import com.flossom.common.core.exception.ServiceException;
|
|
|
|
|
import com.flossom.common.core.mapper.SysUserMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.WxScriptMessageMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.WxUserMemberMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.WxUserScriptLogMapper;
|
|
|
|
|
import com.flossom.common.core.mapper.*;
|
|
|
|
|
import com.flossom.common.core.utils.DateUtils;
|
|
|
|
|
import com.flossom.common.core.utils.StringUtils;
|
|
|
|
|
import com.flossom.common.redis.service.RedisService;
|
|
|
|
|
@ -59,6 +53,13 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IntegralGlobalMapper integralGlobalMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private WxUserIntegralLogMapper wxUserIntegralLogMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public WxUserMember wxRegister(String code) throws Exception {
|
|
|
|
|
@ -175,16 +176,31 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public LoginUserVo updateUser(UserMemberUpdateVo userMemberUpdateVo) {
|
|
|
|
|
// 完善用户信息, 判断是否标记完善信息
|
|
|
|
|
WxUserMember wxUserMember = wxUserMemberMapper.selectWxUserMemberByOpenId(SecurityUtils.getLoginUser().getWxUserMember().getOpenid());
|
|
|
|
|
Boolean isCompleteInformation = false;
|
|
|
|
|
int floatScore = 0;
|
|
|
|
|
if (wxUserMember.getIsCompleteInformation() == null || wxUserMember.getIsCompleteInformation() == 0) {
|
|
|
|
|
isCompleteInformation = true;
|
|
|
|
|
// 修改完善状态
|
|
|
|
|
wxUserMember.setIsCompleteInformation(1);
|
|
|
|
|
// TODO: 首次完善,增加加分 (未完成)
|
|
|
|
|
|
|
|
|
|
List<IntegralGlobal> integralGlobalList = integralGlobalMapper.selectIntegralGlobalList(new IntegralGlobal());
|
|
|
|
|
IntegralGlobal integralGlobal = integralGlobalList.get(0);
|
|
|
|
|
wxUserMember.setCredit(wxUserMember.getCredit() + integralGlobal.getIntegral().intValue());
|
|
|
|
|
|
|
|
|
|
// 保存积分详情
|
|
|
|
|
WxUserIntegralLog wxUserIntegralLog = new WxUserIntegralLog();
|
|
|
|
|
wxUserIntegralLog.setUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
|
|
|
|
|
wxUserIntegralLog.setUserName(SecurityUtils.getLoginUser().getWxUserMember().getNickname());
|
|
|
|
|
wxUserIntegralLog.setUserPhone(SecurityUtils.getLoginUser().getWxUserMember().getMobile());
|
|
|
|
|
wxUserIntegralLog.setSource("1");
|
|
|
|
|
wxUserIntegralLog.setFloatScore(integralGlobal.getIntegral());
|
|
|
|
|
wxUserIntegralLog.setRemarkContent("首次完善用户信息");
|
|
|
|
|
wxUserIntegralLogMapper.insertWxUserIntegralLog(wxUserIntegralLog);
|
|
|
|
|
|
|
|
|
|
// TODO: 首次完善,增加加分 (对接数云未完成)
|
|
|
|
|
}
|
|
|
|
|
WxUserMember update = new WxUserMember();
|
|
|
|
|
update.setId(wxUserMember.getId());
|
|
|
|
|
@ -195,8 +211,7 @@ public class WxUserMemberServiceImpl implements IWxUserMemberService {
|
|
|
|
|
// 刷新用户信息
|
|
|
|
|
LoginUserVo loginUserVo = refreshWxUserInfo();
|
|
|
|
|
if (isCompleteInformation) {
|
|
|
|
|
// TODO:查询积分列表
|
|
|
|
|
loginUserVo.setIntegralText("您已完善个人信息,获得XX积分");
|
|
|
|
|
loginUserVo.setIntegralText("您已完善个人信息,获得" + floatScore + "积分");
|
|
|
|
|
}
|
|
|
|
|
return loginUserVo;
|
|
|
|
|
}
|
|
|
|
|
|