|
|
@@ -148,27 +148,22 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void resetBasicUserScore(WxCUserBasicInfo user, int scoreNumber) { |
|
|
|
|
|
|
|
|
private void resetBasicUserScore(WxCUserBasicInfo user, boolean bHaveCUser) { |
|
|
// 1. basicUser |
|
|
// 1. basicUser |
|
|
if(user == null) { |
|
|
if(user == null) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 2. update score/ 修改basic表积分 |
|
|
// 2. update score/ 修改basic表积分 |
|
|
user.setPoins(scoreNumber); |
|
|
|
|
|
wxCUserBasicInfoMapper.updateScore(user); |
|
|
|
|
|
|
|
|
// user.setPoins(scoreNumber); |
|
|
|
|
|
// wxCUserBasicInfoMapper.updateScore(user); |
|
|
|
|
|
|
|
|
// 3. 修改 c_user表积分 score |
|
|
|
|
|
if (user.getPhone() != null) { |
|
|
|
|
|
|
|
|
// 3. 只修改已存在 c_user表积分 score |
|
|
|
|
|
if(bHaveCUser) { |
|
|
WxCUser wxCUser = new WxCUser(); |
|
|
WxCUser wxCUser = new WxCUser(); |
|
|
wxCUser.setTenantId(user.getTenantId()); |
|
|
|
|
|
wxCUser.setPhone(user.getPhone()); |
|
|
|
|
|
List<WxCUser> list = wxCUserMapper.findList(wxCUser); |
|
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
|
wxCUser = list.get(0); |
|
|
|
|
|
wxCUser.setScore(scoreNumber); |
|
|
|
|
|
wxCUserMapper.updateByPrimaryKeySelective(wxCUser); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
wxCUser.setId(user.getId()); |
|
|
|
|
|
wxCUser.setScore(user.getPoins()); |
|
|
|
|
|
wxCUserMapper.updateByPrimaryKeySelective(wxCUser); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -332,14 +327,14 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
return addScoreNumber; |
|
|
return addScoreNumber; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private int memResetScore(WxCUserBasicInfo userInfo, Integer score) { |
|
|
|
|
|
|
|
|
private int memResetScore(WxCUserBasicInfo userInfo, boolean bHaveCUser) { |
|
|
|
|
|
|
|
|
// 1. 导入成长值 |
|
|
// 1. 导入成长值 |
|
|
resetBasicUserScore(userInfo, score); |
|
|
|
|
|
|
|
|
resetBasicUserScore(userInfo, bHaveCUser); |
|
|
|
|
|
|
|
|
// 2. 记录历史 |
|
|
// 2. 记录历史 |
|
|
recordScoreHistory(userInfo, score, EnumScoreType.MEM_IMPORT); |
|
|
|
|
|
return score; |
|
|
|
|
|
|
|
|
recordScoreHistory(userInfo, EnumScoreType.MEM_IMPORT); |
|
|
|
|
|
return userInfo.getPoins(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private int memReduceScore(WxCUserBasicInfo userInfo, String reason, Integer scoreNum) { |
|
|
private int memReduceScore(WxCUserBasicInfo userInfo, String reason, Integer scoreNum) { |
|
|
@@ -364,7 +359,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
return score; |
|
|
return score; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void recordScoreHistory(WxCUserBasicInfo userInfo, int addScoreNumber, EnumScoreType wechatPhone) { |
|
|
|
|
|
|
|
|
private void recordScoreHistory(WxCUserBasicInfo userInfo, EnumScoreType wechatPhone) { |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
WxScoreHistory history = new WxScoreHistory(); |
|
|
WxScoreHistory history = new WxScoreHistory(); |
|
|
history.setId(idWorker.nextId()); |
|
|
history.setId(idWorker.nextId()); |
|
|
@@ -372,7 +367,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
history.setCUserId(userInfo.getId()); |
|
|
history.setCUserId(userInfo.getId()); |
|
|
history.setCreateDate(new Date()); |
|
|
history.setCreateDate(new Date()); |
|
|
history.setScoreType(wechatPhone.getCode()); |
|
|
history.setScoreType(wechatPhone.getCode()); |
|
|
history.setScoreAmount(addScoreNumber); |
|
|
|
|
|
|
|
|
history.setScoreAmount(userInfo.getPoins()); |
|
|
wxScoreHistoryMapper.insert(history); |
|
|
wxScoreHistoryMapper.insert(history); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -463,8 +458,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { |
|
|
} |
|
|
} |
|
|
case MEM_IMPORT: { |
|
|
case MEM_IMPORT: { |
|
|
WxCUserBasicInfo user = (WxCUserBasicInfo) param1; |
|
|
WxCUserBasicInfo user = (WxCUserBasicInfo) param1; |
|
|
Integer score = Integer.valueOf((String)param2); |
|
|
|
|
|
return memResetScore(user, score); |
|
|
|
|
|
|
|
|
boolean bHaveCUser = (boolean)(param2); |
|
|
|
|
|
return memResetScore(user, bHaveCUser); |
|
|
} |
|
|
} |
|
|
default: |
|
|
default: |
|
|
break; |
|
|
break; |
|
|
|