| @@ -650,7 +650,7 @@ public class WxUserStructureController extends BaseController { | |||||
| return new ResultData(ErrorCode.MEM_SCORE_NOT_ENOUGH); | return new ResultData(ErrorCode.MEM_SCORE_NOT_ENOUGH); | ||||
| } | } | ||||
| // 2. 扣减积分 | // 2. 扣减积分 | ||||
| wxScoreRulesService.reduceScore(EnumScoreType.MEM_REDUCE, info, reason, score); | |||||
| wxScoreRulesService.reduceScore(getTenantInfo(),EnumScoreType.MEM_REDUCE, info, reason, score); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -92,7 +92,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| info.setLevel(WxLevelConfigService.DEFAULT_LEVEL); | info.setLevel(WxLevelConfigService.DEFAULT_LEVEL); | ||||
| } else { | } else { | ||||
| info.setLevel(WxLevelConfigService.DEFAULT_LEVEL); | info.setLevel(WxLevelConfigService.DEFAULT_LEVEL); | ||||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(info); | |||||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(getTenantInfo()); | |||||
| for (WxLevelConfig levelConfig : levelList) { | for (WxLevelConfig levelConfig : levelList) { | ||||
| if (info.getPoins() >= levelConfig.getPoints()) { | if (info.getPoins() >= levelConfig.getPoints()) { | ||||
| info.setLevel(levelConfig.getLevel()); | info.setLevel(levelConfig.getLevel()); | ||||
| @@ -107,7 +107,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | ||||
| if (uTag != null && StringUtils.isNotBlank(uTag.getTags())) { | if (uTag != null && StringUtils.isNotBlank(uTag.getTags())) { | ||||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | ||||
| info.setTagsList(wxCUserTagsService.findTagList(info, ids)); | |||||
| info.setTagsList(wxCUserTagsService.findTagList(getTenantInfo(), ids)); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -147,7 +147,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| wxCUserBasicInfo.setName(null); | wxCUserBasicInfo.setName(null); | ||||
| } | } | ||||
| } | } | ||||
| wxCUserBasicInfo.updateTenantInfo(getTenantInfo()); | |||||
| wxCUserBasicInfo.undateFinalTenantId(getTenantInfo()); | |||||
| // wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.ActiveTime_DESC); | // wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.ActiveTime_DESC); | ||||
| PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); | PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); | ||||
| @@ -163,7 +163,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| private int checkUniquePhone(String phone, TenantEntity tenantEntity) { | private int checkUniquePhone(String phone, TenantEntity tenantEntity) { | ||||
| WxCUserBasicInfo baseInfoQ = new WxCUserBasicInfo(); | WxCUserBasicInfo baseInfoQ = new WxCUserBasicInfo(); | ||||
| baseInfoQ.setPhone(phone); | baseInfoQ.setPhone(phone); | ||||
| baseInfoQ.updateTenantInfo(tenantEntity); | |||||
| baseInfoQ.undateFinalTenantId(getTenantInfo()); | |||||
| return wxCUserBasicInfoService.countUser(baseInfoQ); | return wxCUserBasicInfoService.countUser(baseInfoQ); | ||||
| } | } | ||||
| @@ -182,7 +182,6 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| if(wxCUserBasicInfo.getBirthdate() != null && wxCUserBasicInfo.getBirthdate().after(new Date())){ | if(wxCUserBasicInfo.getBirthdate() != null && wxCUserBasicInfo.getBirthdate().after(new Date())){ | ||||
| return new ResultData(ErrorCode.USER_BIRTHDATE_AFTER.getCode(), "出生日期大于当前日期"); | return new ResultData(ErrorCode.USER_BIRTHDATE_AFTER.getCode(), "出生日期大于当前日期"); | ||||
| } | } | ||||
| wxCUserBasicInfo.updateTenantInfo(tenantEntity); | |||||
| if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | ||||
| WxCUserTags record = new WxCUserTags(); | WxCUserTags record = new WxCUserTags(); | ||||
| record.setUserId(oldInfo.getId()); | record.setUserId(oldInfo.getId()); | ||||
| @@ -226,8 +225,6 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| if (info == null) | if (info == null) | ||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | return new ResultData(ErrorCode.USER_IS_EMPTY); | ||||
| info.updateTenantInfo(getTenantInfo()); | |||||
| setUserInfoTag(info); | setUserInfoTag(info); | ||||
| setUserInfoLevel(info); | setUserInfoLevel(info); | ||||
| setUserInfoCar(info); | setUserInfoCar(info); | ||||
| @@ -315,7 +312,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| basicInfo.updateTenantInfo(getTenantInfo()); | |||||
| basicInfo.undateFinalTenantId(getTenantInfo()); | |||||
| int exportDataCount = wxCUserBasicInfoService.exportDataCount(basicInfo); | int exportDataCount = wxCUserBasicInfoService.exportDataCount(basicInfo); | ||||
| return new ResultData(exportDataCount); | return new ResultData(exportDataCount); | ||||
| @@ -338,7 +335,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| basicInfo.updateTenantInfo(getTenantInfo()); | |||||
| basicInfo.undateFinalTenantId(getTenantInfo()); | |||||
| wxCUserBasicInfoService.exportData(basicInfo, request, response); | wxCUserBasicInfoService.exportData(basicInfo, request, response); | ||||
| } | } | ||||
| @@ -117,7 +117,7 @@ public class WxCUserController extends BaseController { | |||||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | ||||
| wxCUserBasicInfo.setUpdateDate(new Date()); | wxCUserBasicInfo.setUpdateDate(new Date()); | ||||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | wxCUserBasicInfoService.update(wxCUserBasicInfo); | ||||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||||
| wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||||
| //增加积分 | //增加积分 | ||||
| addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); | addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); | ||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | ||||
| @@ -178,7 +178,7 @@ public class WxCUserController extends BaseController { | |||||
| } | } | ||||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | ||||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | wxCUserBasicInfoService.update(wxCUserBasicInfo); | ||||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||||
| wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||||
| //增加积分 | //增加积分 | ||||
| addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); | addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); | ||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | ||||
| @@ -212,7 +212,6 @@ public class BaseController { | |||||
| basicInfo = new WxCUserBasicInfo(); | basicInfo = new WxCUserBasicInfo(); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| basicInfo.setId(idWorker.nextId()); | basicInfo.setId(idWorker.nextId()); | ||||
| basicInfo.updateTenantInfo(tenantEntity); | |||||
| basicInfo.undateFinalTenantId(tenantEntity); | basicInfo.undateFinalTenantId(tenantEntity); | ||||
| basicInfo.setPhone(userPhone); | basicInfo.setPhone(userPhone); | ||||
| basicInfo.setNickName(userName); | basicInfo.setNickName(userName); | ||||
| @@ -339,7 +339,7 @@ public class WxCarController extends BaseController { | |||||
| wxCUserCarService.saveOrUpdate(userCar); | wxCUserCarService.saveOrUpdate(userCar); | ||||
| // 成长值 | // 成长值 | ||||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar); | |||||
| wxScoreRulesService.addScore(userCar,EnumScoreType.BIND_CAR, userCar); | |||||
| //增加积分 | //增加积分 | ||||
| addCredit(park, cuUserId); | addCredit(park, cuUserId); | ||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,cuUserId); | wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,cuUserId); | ||||
| @@ -426,7 +426,7 @@ public class WxCarController extends BaseController { | |||||
| userCar.setUpdateDate(curr); | userCar.setUpdateDate(curr); | ||||
| try { | try { | ||||
| wxCUserCarService.save(userCar); | wxCUserCarService.save(userCar); | ||||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar); | |||||
| wxScoreRulesService.addScore(userCar,EnumScoreType.BIND_CAR, userCar); | |||||
| //增加积分 | //增加积分 | ||||
| addCredit(park, cuUserId); | addCredit(park, cuUserId); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -180,7 +180,7 @@ public class WxOrderController extends BaseController { | |||||
| if (user != null && user.getActRecord() > 0) | if (user != null && user.getActRecord() > 0) | ||||
| return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); | return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); | ||||
| if (wxOrderService.countCouponConditionType1(user) > 0) | |||||
| if (wxOrderService.countCouponConditionType1(coupon.getTenantId(),user.getId()) > 0) | |||||
| return new ResultData(ErrorCode.COUPON_ALREADY_IN_NEW_MEMBER); | return new ResultData(ErrorCode.COUPON_ALREADY_IN_NEW_MEMBER); | ||||
| }else if (jo.getIntValue("type") == EnumCouponConditionType.SCORE_SCOPE.getCode()){ | }else if (jo.getIntValue("type") == EnumCouponConditionType.SCORE_SCOPE.getCode()){ | ||||
| int max = jo.getIntValue("max"); | int max = jo.getIntValue("max"); | ||||
| @@ -563,7 +563,7 @@ public class WxUserGrantController extends BaseController { | |||||
| if(bFirstNickName) { | if(bFirstNickName) { | ||||
| // 首次获取昵称 | // 首次获取昵称 | ||||
| // 成长值 | // 成长值 | ||||
| wxScoreRulesService.addScore(EnumScoreType.WECHAT_PERSION, user); | |||||
| wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.WECHAT_PERSION, user); | |||||
| //增加积分 | //增加积分 | ||||
| wxCUserService.addCredit(user, EnumScoreType.WECHAT_PERSION); | wxCUserService.addCredit(user, EnumScoreType.WECHAT_PERSION); | ||||
| } | } | ||||
| @@ -668,7 +668,7 @@ public class WxUserGrantController extends BaseController { | |||||
| if(isFirstPhone) { | if(isFirstPhone) { | ||||
| // 首次授权, 增加成长值及积分 | // 首次授权, 增加成长值及积分 | ||||
| // 成长值 | // 成长值 | ||||
| wxScoreRulesService.addScore(EnumScoreType.WECHAT_PHONE, user); | |||||
| wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.WECHAT_PHONE, user); | |||||
| // 增加积分 | // 增加积分 | ||||
| wxCUserService.addCredit(user, EnumScoreType.WECHAT_PHONE); | wxCUserService.addCredit(user, EnumScoreType.WECHAT_PHONE); | ||||
| // 外部注券 | // 外部注券 | ||||
| @@ -905,7 +905,6 @@ public class WxUserGrantController extends BaseController { | |||||
| wxCUserBasicInfo.getAddress() != null) { | wxCUserBasicInfo.getAddress() != null) { | ||||
| WxCUserBasicInfo record = new WxCUserBasicInfo(); | WxCUserBasicInfo record = new WxCUserBasicInfo(); | ||||
| record.setId(getMemberId()); | record.setId(getMemberId()); | ||||
| record.updateTenantInfo(tenantEntity); | |||||
| record.setName(wxCUserBasicInfo.getName()); | record.setName(wxCUserBasicInfo.getName()); | ||||
| record.setAvatarUrl(wxCUserBasicInfo.getAvatarUrl()); | record.setAvatarUrl(wxCUserBasicInfo.getAvatarUrl()); | ||||
| record.setBirthdate(wxCUserBasicInfo.getBirthdate()); | record.setBirthdate(wxCUserBasicInfo.getBirthdate()); | ||||
| @@ -913,7 +912,7 @@ public class WxUserGrantController extends BaseController { | |||||
| record.setAddress(wxCUserBasicInfo.getAddress()); | record.setAddress(wxCUserBasicInfo.getAddress()); | ||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| wxCUserBasicInfoService.update(record); | wxCUserBasicInfoService.update(record); | ||||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, record); | |||||
| wxScoreRulesService.addScore(tenantEntity,EnumScoreType.COMPLETE_INFO, record); | |||||
| //增加积分 | //增加积分 | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setCUserId(record.getId()); | wxCreditHistory.setCUserId(record.getId()); | ||||
| @@ -2177,7 +2177,7 @@ public class PosServiceImpl implements PosService { | |||||
| // 3. 成长值 | // 3. 成长值 | ||||
| try { | try { | ||||
| WxOrder scoreOrder = orderMapper.selectById(couponOrderCVo.getOrderId()); | WxOrder scoreOrder = orderMapper.selectById(couponOrderCVo.getOrderId()); | ||||
| int point = scoreRulesService.addScore2(EnumScoreType.CONSUMPTION, scoreOrder, couponOrderCVo.getBusinessId()); | |||||
| int point = scoreRulesService.addScore2(merchantBUser,EnumScoreType.CONSUMPTION, scoreOrder, couponOrderCVo.getBusinessId()); | |||||
| scoreCreditCalc.setScore(scoreCreditCalc.getScore() + point); | scoreCreditCalc.setScore(scoreCreditCalc.getScore() + point); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("交易核销成长值异常:" + e.getMessage()); | logger.error("交易核销成长值异常:" + e.getMessage()); | ||||
| @@ -2341,7 +2341,7 @@ public class PosServiceImpl implements PosService { | |||||
| try { | try { | ||||
| WxOrder scoreOrder = orderMapper.selectById(order.getId()); | WxOrder scoreOrder = orderMapper.selectById(order.getId()); | ||||
| scoreOrder.setPayment(neuPaymentAmount); | scoreOrder.setPayment(neuPaymentAmount); | ||||
| int point = scoreRulesService.addScore2(EnumScoreType.CONSUMPTION, scoreOrder, merchant.getBusinessId()); | |||||
| int point = scoreRulesService.addScore2(scoreOrder,EnumScoreType.CONSUMPTION, scoreOrder, merchant.getBusinessId()); | |||||
| scoreCreditCalc.setScore(scoreCreditCalc.getScore() + point); | scoreCreditCalc.setScore(scoreCreditCalc.getScore() + point); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("交易核销成长值异常:" + e.getMessage()); | logger.error("交易核销成长值异常:" + e.getMessage()); | ||||
| @@ -294,7 +294,7 @@ public class CouponSendSchedule { | |||||
| //本次之前的20分钟 | //本次之前的20分钟 | ||||
| now.set(Calendar.MINUTE, now.get(Calendar.MINUTE) - 30); | now.set(Calendar.MINUTE, now.get(Calendar.MINUTE) - 30); | ||||
| Map<String, Object> params = new HashMap<>(); | Map<String, Object> params = new HashMap<>(); | ||||
| params.put("tenantId", wxCUserBasicInfo.getTenantId()); | |||||
| params.put("tenantId", mall.getTenantId()); | |||||
| params.put("cUserId", wxCUserBasicInfo.getId()); | params.put("cUserId", wxCUserBasicInfo.getId()); | ||||
| params.put("couponId", null); | params.put("couponId", null); | ||||
| params.put("startTime", startTime); | params.put("startTime", startTime); | ||||
| @@ -170,11 +170,11 @@ public class WxCUserBasicInfo extends BaseEntity { | |||||
| return Objects.hash(this.phone); | return Objects.hash(this.phone); | ||||
| } | } | ||||
| // public void undateFinalTenantId(TenantEntity tenantEntity){ | |||||
| // setFinalTenantId(tenantEntity.getTenantId()); | |||||
| // if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||||
| // setFinalTenantId(tenantEntity.getParentTenantId()); | |||||
| // } | |||||
| // } | |||||
| public void undateFinalTenantId(TenantEntity tenantEntity){ | |||||
| setFinalTenantId(tenantEntity.getTenantId()); | |||||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||||
| setFinalTenantId(tenantEntity.getParentTenantId()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -35,14 +35,6 @@ public class BaseTenantEntity extends BaseEntity { | |||||
| } | } | ||||
| } | } | ||||
| public void updateTenantInfoByUserInfo(WxCUserBasicInfo userBase) { | |||||
| log.info("info.tenantId:"+info.getTenantId()+". info.parentTenantId:"+info.getParentTenantId()+"."); | |||||
| setTenantId(info.getTenantId()); | |||||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||||
| setParentTenantId(info.getParentTenantId()); | |||||
| } | |||||
| } | |||||
| public void updateTenantInfo(BaseTenantEntity info) { | public void updateTenantInfo(BaseTenantEntity info) { | ||||
| setTenantId(info.getTenantId()); | setTenantId(info.getTenantId()); | ||||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | if (StringUtils.isNotBlank(info.getParentTenantId())) { | ||||
| @@ -4,6 +4,8 @@ import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| /** | /** | ||||
| * @author Stormeye | * @author Stormeye | ||||
| * @date 2019/4/24 14:32 | * @date 2019/4/24 14:32 | ||||
| @@ -32,20 +34,20 @@ public class TenantEntity extends BaseEntity { | |||||
| setParentTenantId(info.getParentTenantId()); | setParentTenantId(info.getParentTenantId()); | ||||
| } | } | ||||
| } | } | ||||
| public void updateFinalTenantInfo(TenantEntity info){ | |||||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||||
| setParentTenantId(info.getParentTenantId()); | |||||
| }else{ | |||||
| setTenantId(info.getTenantId()); | |||||
| } | |||||
| } | |||||
| public void updateFinalTenantInfo(BaseTenantEntity info){ | |||||
| if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||||
| setParentTenantId(info.getParentTenantId()); | |||||
| }else{ | |||||
| setTenantId(info.getTenantId()); | |||||
| } | |||||
| } | |||||
| // public void updateFinalTenantInfo(TenantEntity info){ | |||||
| // if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||||
| // setParentTenantId(info.getParentTenantId()); | |||||
| // }else{ | |||||
| // setTenantId(info.getTenantId()); | |||||
| // } | |||||
| // } | |||||
| // | |||||
| // public void updateFinalTenantInfo(BaseTenantEntity info){ | |||||
| // if (StringUtils.isNotBlank(info.getParentTenantId())) { | |||||
| // setParentTenantId(info.getParentTenantId()); | |||||
| // }else{ | |||||
| // setTenantId(info.getTenantId()); | |||||
| // } | |||||
| // } | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxActivity; | import com.iformall.domain.po.WxActivity; | ||||
| import com.iformall.domain.po.WxActivityJoin; | import com.iformall.domain.po.WxActivityJoin; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -203,7 +203,7 @@ public interface WxOrderService { | |||||
| */ | */ | ||||
| WxOrder getUnPaidOrder(WxCUserBasicInfo cUser, WxCoupon coupon); | WxOrder getUnPaidOrder(WxCUserBasicInfo cUser, WxCoupon coupon); | ||||
| int countCouponConditionType1(WxCUserBasicInfo user); | |||||
| int countCouponConditionType1(String subTenantId,Long cUserId); | |||||
| /** | /** | ||||
| * 订单处理 | * 订单处理 | ||||
| * 1. 检查coupon是否免费 | * 1. 检查coupon是否免费 | ||||
| @@ -46,17 +46,17 @@ public interface WxScoreRulesService { | |||||
| /** | /** | ||||
| * 增加成长值 | * 增加成长值 | ||||
| */ | */ | ||||
| int addScore(EnumScoreType scoreType, Object param); | |||||
| int addScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param); | |||||
| /** | /** | ||||
| * 增加成长值 | * 增加成长值 | ||||
| */ | */ | ||||
| int addScore2(EnumScoreType scoreType, Object param1, Object param2); | |||||
| int addScore2(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2); | |||||
| /** | /** | ||||
| * 扣减成长值 | * 扣减成长值 | ||||
| */ | */ | ||||
| int reduceScore(EnumScoreType scoreType, Object param1, Object param2, Object param3); | |||||
| int reduceScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2, Object param3); | |||||
| List<WxScoreRules> findList(WxScoreRules wxScoreRules); | List<WxScoreRules> findList(WxScoreRules wxScoreRules); | ||||
| @@ -9,6 +9,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.WxMsgRecord; | import com.iformall.domain.po.msg.WxMsgRecord; | ||||
| import com.iformall.domain.vo.WxActivityJoinQuestionAnswer; | import com.iformall.domain.vo.WxActivityJoinQuestionAnswer; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -954,9 +954,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| // 成长值 | // 成长值 | ||||
| if (points != null) { | if (points != null) { | ||||
| if (oldUserBase != null) { | if (oldUserBase != null) { | ||||
| wxScoreRulesService.addScore2(EnumScoreType.MEM_IMPORT, oldUserBase, bHaveCUser); | |||||
| wxScoreRulesService.addScore2(mallUserInfo,EnumScoreType.MEM_IMPORT, oldUserBase, bHaveCUser); | |||||
| } else { | } else { | ||||
| wxScoreRulesService.addScore2(EnumScoreType.MEM_IMPORT, userBase, bHaveCUser); | |||||
| wxScoreRulesService.addScore2(mallUserInfo,EnumScoreType.MEM_IMPORT, userBase, bHaveCUser); | |||||
| } | } | ||||
| } | } | ||||
| //积分处理逻辑:覆盖原积分 记录历史 | //积分处理逻辑:覆盖原积分 记录历史 | ||||
| @@ -261,7 +261,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| int credit = 0; | int credit = 0; | ||||
| // 成长值 | // 成长值 | ||||
| try { | try { | ||||
| score = wxScoreRulesService.addScore(EnumScoreType.LOGIN, user); | |||||
| score = wxScoreRulesService.addScore(user,EnumScoreType.LOGIN, user); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("c_user 成长值 " + e.getMessage()); | logger.error("c_user 成长值 " + e.getMessage()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -115,7 +115,8 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| return null; | return null; | ||||
| WxCUserTags record = new WxCUserTags(); | WxCUserTags record = new WxCUserTags(); | ||||
| record.setUserId(user.getId()); | record.setUserId(user.getId()); | ||||
| record.updateTenantInfo(user); | |||||
| record.setTenantId(user.getFinalTenantId()); | |||||
| //record.updateTenantInfo(user); | |||||
| List<WxCUserTags> cUserTagsList = wxCUserTagsMapper.findList(record); | List<WxCUserTags> cUserTagsList = wxCUserTagsMapper.findList(record); | ||||
| if (cUserTagsList.size() > 0) { | if (cUserTagsList.size() > 0) { | ||||
| record.setId(cUserTagsList.get(0).getId()); | record.setId(cUserTagsList.get(0).getId()); | ||||
| @@ -165,7 +166,8 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| return null; | return null; | ||||
| WxCUserTags record = new WxCUserTags(); | WxCUserTags record = new WxCUserTags(); | ||||
| record.setUserId(user.getId()); | record.setUserId(user.getId()); | ||||
| record.updateTenantInfo(user); | |||||
| record.setTenantId(user.getFinalTenantId()); | |||||
| //record.updateTenantInfo(user); | |||||
| List<WxCUserTags> cUserTagsList = wxCUserTagsMapper.findList(record); | List<WxCUserTags> cUserTagsList = wxCUserTagsMapper.findList(record); | ||||
| if (cUserTagsList.size() > 0) { | if (cUserTagsList.size() > 0) { | ||||
| record.setId(cUserTagsList.get(0).getId()); | record.setId(cUserTagsList.get(0).getId()); | ||||
| @@ -282,7 +282,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 成长值 | // 成长值 | ||||
| try { | try { | ||||
| orderUpdate.setPayment(real_payment); | orderUpdate.setPayment(real_payment); | ||||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||||
| wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("成长值:" + e.getMessage()); | logger.error("成长值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -900,7 +900,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| orderUpdate.setPayment(record.getRealPayment()); | orderUpdate.setPayment(record.getRealPayment()); | ||||
| orderUpdate.setPaymentTime(record.getUpdateDate()); | orderUpdate.setPaymentTime(record.getUpdateDate()); | ||||
| orderUpdate.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | orderUpdate.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | ||||
| int point = wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||||
| int point = wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||||
| scoreCreditCalc.setScore(scoreCreditCalc.getScore() + point); | scoreCreditCalc.setScore(scoreCreditCalc.getScore() + point); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("成长值:" + e.getMessage()); | logger.error("成长值:" + e.getMessage()); | ||||
| @@ -404,7 +404,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| // 成长值 | // 成长值 | ||||
| try { | try { | ||||
| WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId()); | WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId()); | ||||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||||
| wxScoreRulesService.addScore2(bUser,EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("成长值:" + e.getMessage()); | logger.error("成长值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -435,7 +435,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| // 成长值 | // 成长值 | ||||
| try { | try { | ||||
| WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId()); | WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId()); | ||||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||||
| wxScoreRulesService.addScore2(couponOrder,EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("成长值:" + e.getMessage()); | logger.error("成长值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -227,7 +227,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| if (record.getCreditType().equals(EnumScoreType.CONSUMPTION.getCode()) || record.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())) { | if (record.getCreditType().equals(EnumScoreType.CONSUMPTION.getCode()) || record.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())) { | ||||
| //等级积分配置 | //等级积分配置 | ||||
| try { | try { | ||||
| creditChangeNum = CreditUtil.calUserCredit(creditChangeNumOrigin, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| creditChangeNum = CreditUtil.calUserCredit(record,creditChangeNumOrigin, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | ||||
| hasBirthDateCredit = true; | hasBirthDateCredit = true; | ||||
| } | } | ||||
| @@ -327,7 +327,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| credit = payAddCredit(wxCreditHistory); | credit = payAddCredit(wxCreditHistory); | ||||
| if (Objects.nonNull(userId)) { | if (Objects.nonNull(userId)) { | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId); | ||||
| creditNew = CreditUtil.calUserCredit(credit, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| creditNew = CreditUtil.calUserCredit(tenantEntity,credit, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| } else { | } else { | ||||
| creditNew = credit; | creditNew = credit; | ||||
| } | } | ||||
| @@ -415,9 +415,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int checkCompleteInfoScoreCount(WxCUserBasicInfo cUser) { | |||||
| private int checkCompleteInfoScoreCount(TenantEntity tenantEntity,WxCUserBasicInfo cUser) { | |||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.updateTenantInfo(cUser); | |||||
| wxCreditHistory.updateTenantInfo(tenantEntity); | |||||
| wxCreditHistory.setCUserId(cUser.getId()); | wxCreditHistory.setCUserId(cUser.getId()); | ||||
| wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode()); | ||||
| return wxCreditHistoryMapper.countList(wxCreditHistory); | return wxCreditHistoryMapper.countList(wxCreditHistory); | ||||
| @@ -425,7 +425,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| private int infoAddCredit(WxCreditHistory record) { | private int infoAddCredit(WxCreditHistory record) { | ||||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId()); | WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId()); | ||||
| if (user == null || checkCompleteInfoScoreCount(user) > 0) | |||||
| if (user == null || checkCompleteInfoScoreCount(record,user) > 0) | |||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record); | WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record); | ||||
| @@ -453,13 +453,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| * @param user | * @param user | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public int countCouponConditionType1(WxCUserBasicInfo user) { | |||||
| public int countCouponConditionType1(String subTenantId,Long cuserId) { | |||||
| // + Order 待支付 | // + Order 待支付 | ||||
| try { | try { | ||||
| WxOrder orderQ = new WxOrder(); | WxOrder orderQ = new WxOrder(); | ||||
| orderQ.setTenantId(user.getTenantId()); | |||||
| orderQ.setTenantId(subTenantId); | |||||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | orderQ.setType(EnumOrderType.COUPON.getCode()); | ||||
| orderQ.setCUserId(user.getId()); | |||||
| orderQ.setCUserId(cuserId); | |||||
| List<Integer> statusS = new ArrayList<>(); | List<Integer> statusS = new ArrayList<>(); | ||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | ||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | ||||
| @@ -473,7 +473,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| orderQ.setStatusS(statusS); | orderQ.setStatusS(statusS); | ||||
| return wxOrderMapper.countCouponConditionType1(orderQ); | return wxOrderMapper.countCouponConditionType1(orderQ); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("用户正在参加的新手活动, userId: " + user.getId() + ", e:" + e.getMessage()); | |||||
| logger.error("用户正在参加的新手活动, userId: " + cuserId + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1528,7 +1528,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| // 成长值 计算 | // 成长值 计算 | ||||
| try { | try { | ||||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, updateOrder, wxMerchant.getBusinessId()); | |||||
| wxScoreRulesService.addScore2(bUser,EnumScoreType.CONSUMPTION, updateOrder, wxMerchant.getBusinessId()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("成长值:" + e.getMessage()); | logger.error("成长值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -2265,7 +2265,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| int left_total = total; | int left_total = total; | ||||
| WxOrderPress orderPress = new WxOrderPress(); | WxOrderPress orderPress = new WxOrderPress(); | ||||
| orderPress.setId(IdWorker.get().nextId()); | orderPress.setId(IdWorker.get().nextId()); | ||||
| orderPress.updateTenantInfo(user); | |||||
| orderPress.updateTenantInfo(coupon); | |||||
| orderPress.setCouponId(record.getProductId()); | orderPress.setCouponId(record.getProductId()); | ||||
| orderPress.setOrderId(orderNumber); | orderPress.setOrderId(orderNumber); | ||||
| orderPress.setUserId(user.getId()); | orderPress.setUserId(user.getId()); | ||||
| @@ -23,7 +23,7 @@ import com.iformall.service.pay.entity.PayExtraParam; | |||||
| import com.iformall.service.pay.service.pay.CDrivingPayService; | import com.iformall.service.pay.service.pay.CDrivingPayService; | ||||
| import com.iformall.service.pay.service.pay.CPassivePayService; | import com.iformall.service.pay.service.pay.CPassivePayService; | ||||
| import com.iformall.service.pay.service.pay.PayAdapterService; | import com.iformall.service.pay.service.pay.PayAdapterService; | ||||
| import com.iformall.service.pay.service.pay.entity.GetUser; | |||||
| import com.iformall.service.pay.service.pay.entity.CreateUser; | |||||
| import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | ||||
| import com.iformall.service.pay.service.pay.entity.PayQueryAdapterResult; | import com.iformall.service.pay.service.pay.entity.PayQueryAdapterResult; | ||||
| import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; | import com.iformall.service.pay.service.share.entity.ShareNotifyAdapterResult; | ||||
| @@ -861,9 +861,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) { | public void handleMicroOrderPaySuccess(Object result,String transcationId,EnumPayWay payWay, WxPayOrder record ,WxMerchantBUser user,WxAppinfo appInfo,PayExtraParam params) { | ||||
| //B端操作,需要生成cUser | //B端操作,需要生成cUser | ||||
| GetUser cUser = null; | |||||
| CreateUser cUser = null; | |||||
| try { | try { | ||||
| 11111111111111111 | |||||
| cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo); | cUser = payServiceFactory.getCPassivePayService(payWay.getCode()).createCUserAfterPay(result, appInfo); | ||||
| } catch (Exception e1) { | } catch (Exception e1) { | ||||
| logger.error("创建C端用户失败: " ,e1); | logger.error("创建C端用户失败: " ,e1); | ||||
| @@ -314,21 +314,21 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| return wxScoreHistoryMapper.countTodayList(scoreHistory); | return wxScoreHistoryMapper.countTodayList(scoreHistory); | ||||
| } | } | ||||
| private int loginAddScore(WxCUserBasicInfo user) { | |||||
| private int loginAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | |||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| if (checkTodayLoginScoreCount(user) > 0) | if (checkTodayLoginScoreCount(user) > 0) | ||||
| return 0; | return 0; | ||||
| // 1. score_rules | // 1. score_rules | ||||
| WxScoreRules scoreRules = getScoreRules(user); | |||||
| WxScoreRules scoreRules = getScoreRules(tenantEntity); | |||||
| // 2. 增长的成长值 | // 2. 增长的成长值 | ||||
| addScoreNumber = scoreRules.getRule(EnumScoreType.LOGIN,WxScoreRules.SCORE); | addScoreNumber = scoreRules.getRule(EnumScoreType.LOGIN,WxScoreRules.SCORE); | ||||
| updateScore(user.getId(), addScoreNumber); | updateScore(user.getId(), addScoreNumber); | ||||
| // 3. 记录历史 | // 3. 记录历史 | ||||
| recordScoreHistory(addScoreNumber, user, user.getId(), EnumScoreType.LOGIN); | |||||
| recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.LOGIN); | |||||
| return addScoreNumber; | return addScoreNumber; | ||||
| } | } | ||||
| @@ -392,10 +392,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| private int bindCarAddScore(WxCUserBasicInfo user) { | |||||
| private int bindCarAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | |||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = getScoreRules(user); | |||||
| WxScoreRules scoreRules = getScoreRules(tenantEntity); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| addScoreNumber = scoreRules.getRule(EnumScoreType.BIND_CAR,WxScoreRules.SCORE); | addScoreNumber = scoreRules.getRule(EnumScoreType.BIND_CAR,WxScoreRules.SCORE); | ||||
| @@ -404,14 +404,14 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| updateScore(user.getId(), addScoreNumber); | updateScore(user.getId(), addScoreNumber); | ||||
| // 4. 记录历史 | // 4. 记录历史 | ||||
| recordScoreHistory(addScoreNumber, user, user.getId(), EnumScoreType.BIND_CAR); | |||||
| recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.BIND_CAR); | |||||
| return addScoreNumber; | return addScoreNumber; | ||||
| } | } | ||||
| private int personAddScore(WxCUserBasicInfo user) { | |||||
| private int personAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | |||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = getScoreRules(user); | |||||
| WxScoreRules scoreRules = getScoreRules(tenantEntity); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); | addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); | ||||
| @@ -420,14 +420,14 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| updateScore(user.getId(), addScoreNumber); | updateScore(user.getId(), addScoreNumber); | ||||
| // 4. 记录历史 | // 4. 记录历史 | ||||
| recordScoreHistory(addScoreNumber, user, user.getId(), EnumScoreType.WECHAT_PERSION); | |||||
| recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.WECHAT_PERSION); | |||||
| return addScoreNumber; | return addScoreNumber; | ||||
| } | } | ||||
| private int phoneAddScore(WxCUserBasicInfo user) { | |||||
| private int phoneAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | |||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = getScoreRules(user); | |||||
| WxScoreRules scoreRules = getScoreRules(tenantEntity); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PHONE,WxScoreRules.SCORE); | addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PHONE,WxScoreRules.SCORE); | ||||
| @@ -436,7 +436,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| updateScore(user.getId(), addScoreNumber); | updateScore(user.getId(), addScoreNumber); | ||||
| // 4. 记录历史 | // 4. 记录历史 | ||||
| recordScoreHistory(addScoreNumber, user, user.getId(), EnumScoreType.WECHAT_PHONE); | |||||
| recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.WECHAT_PHONE); | |||||
| return addScoreNumber; | return addScoreNumber; | ||||
| } | } | ||||
| @@ -447,13 +447,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| return wxScoreHistoryMapper.countList(scoreHistory); | return wxScoreHistoryMapper.countList(scoreHistory); | ||||
| } | } | ||||
| private int infoAddScore(WxCUserBasicInfo user) { | |||||
| private int infoAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | |||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| if (checkCompleteInfoScoreCount(user) > 0) | if (checkCompleteInfoScoreCount(user) > 0) | ||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = getScoreRules(user); | |||||
| WxScoreRules scoreRules = getScoreRules(tenantEntity); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| addScoreNumber = scoreRules.getRule(EnumScoreType.COMPLETE_INFO,WxScoreRules.SCORE); | addScoreNumber = scoreRules.getRule(EnumScoreType.COMPLETE_INFO,WxScoreRules.SCORE); | ||||
| @@ -462,18 +462,18 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| updateScore(user.getId(), addScoreNumber); | updateScore(user.getId(), addScoreNumber); | ||||
| // 4. 记录历史 | // 4. 记录历史 | ||||
| recordScoreHistory(addScoreNumber, user, user.getId(), EnumScoreType.COMPLETE_INFO); | |||||
| recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.COMPLETE_INFO); | |||||
| return addScoreNumber; | return addScoreNumber; | ||||
| } | } | ||||
| private int memResetScore(WxCUserBasicInfo userInfo, boolean bHaveCUser) { | |||||
| private int memResetScore(TenantEntity tenantEntity,WxCUserBasicInfo userInfo, boolean bHaveCUser) { | |||||
| // 2. 记录历史 | // 2. 记录历史 | ||||
| recordScoreHistory(userInfo, EnumScoreType.MEM_IMPORT); | |||||
| recordScoreHistory(tenantEntity,userInfo, EnumScoreType.MEM_IMPORT); | |||||
| return userInfo.getPoins(); | return userInfo.getPoins(); | ||||
| } | } | ||||
| private int memReduceScore(WxCUserBasicInfo userInfo, String reason, Integer scoreNum) { | |||||
| private int memReduceScore(TenantEntity tenantEntity,WxCUserBasicInfo userInfo, String reason, Integer scoreNum) { | |||||
| int score = userInfo.getPoins() - scoreNum; | int score = userInfo.getPoins() - scoreNum; | ||||
| // 1. update score/ 修改basic表积分 | // 1. update score/ 修改basic表积分 | ||||
| @@ -491,15 +491,15 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| // } | // } | ||||
| // 2. 记录历史 | // 2. 记录历史 | ||||
| recordReduceScoreHistory(scoreNum, reason, userInfo, userInfo.getId(), EnumScoreType.MEM_REDUCE); | |||||
| recordReduceScoreHistory(scoreNum, reason, tenantEntity, userInfo.getId(), EnumScoreType.MEM_REDUCE); | |||||
| return score; | return score; | ||||
| } | } | ||||
| private void recordScoreHistory(WxCUserBasicInfo userInfo, EnumScoreType wechatPhone) { | |||||
| private void recordScoreHistory(TenantEntity tenantEntity,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()); | ||||
| history.updateTenantInfo(userInfo); | |||||
| history.updateTenantInfo(tenantEntity); | |||||
| history.setCUserId(userInfo.getId()); | history.setCUserId(userInfo.getId()); | ||||
| history.setCreateDate(new Date()); | history.setCreateDate(new Date()); | ||||
| history.setScoreType(wechatPhone.getCode()); | history.setScoreType(wechatPhone.getCode()); | ||||
| @@ -550,7 +550,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int addScore(EnumScoreType scoreType, Object param) { | |||||
| public int addScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param) { | |||||
| WxCUser wxCUser = null; | WxCUser wxCUser = null; | ||||
| WxCUserCar userCar = null; | WxCUserCar userCar = null; | ||||
| WxCUserBasicInfo userBasicInfo = null; | WxCUserBasicInfo userBasicInfo = null; | ||||
| @@ -578,19 +578,19 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| switch (scoreType){ | switch (scoreType){ | ||||
| case LOGIN: { | case LOGIN: { | ||||
| return loginAddScore(wxCUserBasicInfo); | |||||
| return loginAddScore(tenantEntity,wxCUserBasicInfo); | |||||
| } | } | ||||
| case BIND_CAR:{ | case BIND_CAR:{ | ||||
| return bindCarAddScore(wxCUserBasicInfo); | |||||
| return bindCarAddScore(tenantEntity,wxCUserBasicInfo); | |||||
| } | } | ||||
| case WECHAT_PERSION:{ | case WECHAT_PERSION:{ | ||||
| return personAddScore(wxCUserBasicInfo); | |||||
| return personAddScore(tenantEntity,wxCUserBasicInfo); | |||||
| } | } | ||||
| case WECHAT_PHONE:{ | case WECHAT_PHONE:{ | ||||
| return phoneAddScore(wxCUserBasicInfo); | |||||
| return phoneAddScore(tenantEntity,wxCUserBasicInfo); | |||||
| } | } | ||||
| case COMPLETE_INFO:{ | case COMPLETE_INFO:{ | ||||
| return infoAddScore(wxCUserBasicInfo); | |||||
| return infoAddScore(tenantEntity,wxCUserBasicInfo); | |||||
| } | } | ||||
| default: { | default: { | ||||
| @@ -600,7 +600,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int addScore2(EnumScoreType scoreType, Object param1, Object param2) { | |||||
| public int addScore2(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2) { | |||||
| WxOrder order = null; | WxOrder order = null; | ||||
| WxCUserBasicInfo user = null; | WxCUserBasicInfo user = null; | ||||
| @@ -627,7 +627,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| case MEM_IMPORT: { | case MEM_IMPORT: { | ||||
| boolean bHaveCUser = (boolean)(param2); | boolean bHaveCUser = (boolean)(param2); | ||||
| return memResetScore(user, bHaveCUser); | |||||
| return memResetScore(tenantEntity,user, bHaveCUser); | |||||
| } | } | ||||
| default: | default: | ||||
| break; | break; | ||||
| @@ -636,7 +636,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int reduceScore(EnumScoreType scoreType, Object param1, Object param2, Object param3) { | |||||
| public int reduceScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2, Object param3) { | |||||
| WxCUserBasicInfo user = (WxCUserBasicInfo) param1; | WxCUserBasicInfo user = (WxCUserBasicInfo) param1; | ||||
| if (user != null && user.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | if (user != null && user.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) { | ||||
| logger.info("会员权益被锁定:cUserId:" + user.getId()); | logger.info("会员权益被锁定:cUserId:" + user.getId()); | ||||
| @@ -646,7 +646,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| case MEM_REDUCE: { | case MEM_REDUCE: { | ||||
| String reason = (String)param2; | String reason = (String)param2; | ||||
| Integer scoreNum = (Integer)param3; | Integer scoreNum = (Integer)param3; | ||||
| return memReduceScore(user, reason, scoreNum); | |||||
| return memReduceScore(tenantEntity,user, reason, scoreNum); | |||||
| } | } | ||||
| default: | default: | ||||
| break; | break; | ||||
| @@ -12,15 +12,18 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxCUser; | import com.iformall.domain.po.WxCUser; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.po.WxPayAccount; | import com.iformall.domain.po.WxPayAccount; | ||||
| import com.iformall.domain.po.WxPayOrder; | import com.iformall.domain.po.WxPayOrder; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumPayMode; | import com.iformall.enums.EnumPayMode; | ||||
| import com.iformall.enums.EnumPayShare; | import com.iformall.enums.EnumPayShare; | ||||
| import com.iformall.enums.EnumUserIsSubscribe; | import com.iformall.enums.EnumUserIsSubscribe; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | import com.iformall.mapper.WxCUserBasicInfoMapper; | ||||
| import com.iformall.mapper.WxCUserMapper; | import com.iformall.mapper.WxCUserMapper; | ||||
| import com.iformall.mapper.WxMallMapper; | |||||
| import com.iformall.pay.WxMicroPayOrderP; | import com.iformall.pay.WxMicroPayOrderP; | ||||
| import com.iformall.pay.WxMicroPayOrderSP; | import com.iformall.pay.WxMicroPayOrderSP; | ||||
| import com.iformall.pay.WxPay; | import com.iformall.pay.WxPay; | ||||
| @@ -201,6 +204,8 @@ public class WxMiniMaPayAdapterService extends BaseWxPayAdapterService implement | |||||
| WxCUserService wxCUserService; | WxCUserService wxCUserService; | ||||
| @Autowired | @Autowired | ||||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | ||||
| @Autowired | |||||
| WxMallMapper wxMallMapper; | |||||
| @Override | @Override | ||||
| public CreateUser createCUserAfterPay(Object result,WxAppinfo appInfo) throws Exception { | public CreateUser createCUserAfterPay(Object result,WxAppinfo appInfo) throws Exception { | ||||
| @@ -212,19 +217,49 @@ public class WxMiniMaPayAdapterService extends BaseWxPayAdapterService implement | |||||
| String isSubscribe = returnMap.get("sub_is_subscribe"); | String isSubscribe = returnMap.get("sub_is_subscribe"); | ||||
| userQ.setOpenId(openId); | userQ.setOpenId(openId); | ||||
| userQ.setAppId(appInfo.getAppId()); | userQ.setAppId(appInfo.getAppId()); | ||||
| WxMall mall = wxMallMapper.getByTenantId(appInfo.getTenantId()); | |||||
| WxCUser user1 = wxCUserMapper.findByOpenId(userQ); | WxCUser user1 = wxCUserMapper.findByOpenId(userQ); | ||||
| boolean userCreate = false; | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| Long userId = idWorker.nextId(); | |||||
| if (user1 == null) { | if (user1 == null) { | ||||
| user1 = new WxCUser(); | user1 = new WxCUser(); | ||||
| user1.setAppId(appInfo.getAppId()); | user1.setAppId(appInfo.getAppId()); | ||||
| user1.setOpenId(openId); | user1.setOpenId(openId); | ||||
| 1111111111111111 | |||||
| user1.updateTenantInfo(appInfo); | |||||
| wxCUserService.saveOrUpdate(user1); | |||||
| user1.setTenantId(appInfo.getTenantId()); | |||||
| user1.setParentTenantId(mall.getParentTenantId()); | |||||
| int count = wxCUserService.saveOrUpdate(user1); | |||||
| if (count <=0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "微信扫码支付添加微信C端用户失败"); | |||||
| } | |||||
| }else { | }else { | ||||
| if (user1.isBasicInfo()) { | |||||
| userId = user1.getUserId(); | |||||
| } | |||||
| } | |||||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(userId); | |||||
| if (null == basicInfo) { | |||||
| basicInfo = new WxCUserBasicInfo(); | |||||
| basicInfo.setId(userId); | |||||
| basicInfo.setPhone(openId); | |||||
| basicInfo.setNickName("微信扫码支付非会员用户"); | |||||
| basicInfo.undateFinalTenantId(new TenantEntity() {{ | |||||
| setTenantId(mall.getTenantId()); | |||||
| setParentTenantId(mall.getParentTenantId()); | |||||
| }}); | |||||
| basicInfo.setCreateDate(new Date()); | |||||
| int count = wxCUserBasicInfoMapper.insert(basicInfo); | |||||
| if (count <=0 ) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "微信扫码支付添加会员用户失败"); | |||||
| } | |||||
| userCreate = true; | |||||
| } | |||||
| if (userCreate) { | |||||
| user1.setUserId(userId); | |||||
| wxCUserService.saveOrUpdate(user1); | |||||
| } | } | ||||
| return null; | |||||
| return new CreateUser(user1.getId(),userId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -24,7 +24,7 @@ public class CreditUtil { | |||||
| * @param wxLevelConfigMapper | * @param wxLevelConfigMapper | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int calUserCredit(int creditOrigin, WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper) { | |||||
| public static int calUserCredit(TenantEntity tenantEntity,int creditOrigin, WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper) { | |||||
| Long userId = wxCUserBasicInfo.getId(); | Long userId = wxCUserBasicInfo.getId(); | ||||
| Integer score = wxCUserBasicInfo.getPoins(); | Integer score = wxCUserBasicInfo.getPoins(); | ||||
| String tenantId = wxCUserBasicInfo.getFinalTenantId(); | String tenantId = wxCUserBasicInfo.getFinalTenantId(); | ||||
| @@ -34,7 +34,7 @@ public class CreditUtil { | |||||
| int levelScale = getLevelScale(score, levelScaleConfig); | int levelScale = getLevelScale(score, levelScaleConfig); | ||||
| // 获取生日积分倍率: | // 获取生日积分倍率: | ||||
| int birthdayScale = getBirthdayScale(wxCUserBasicInfo, wxScoreRulesService); | |||||
| int birthdayScale = getBirthdayScale(tenantEntity,wxCUserBasicInfo, wxScoreRulesService); | |||||
| int creditNew = new BigDecimal(creditOrigin) | int creditNew = new BigDecimal(creditOrigin) | ||||
| .multiply(new BigDecimal(levelScale)) | .multiply(new BigDecimal(levelScale)) | ||||
| @@ -76,7 +76,7 @@ public class CreditUtil { | |||||
| * @param wxScoreRulesService | * @param wxScoreRulesService | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| private static int getBirthdayScale(WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService) { | |||||
| private static int getBirthdayScale(TenantEntity tenantEntity,WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService) { | |||||
| int birthdayScale = WxScoreRules.DEFAULT_SCALE; | int birthdayScale = WxScoreRules.DEFAULT_SCALE; | ||||
| if (Objects.isNull(wxCUserBasicInfo) || StringUtils.isBlank(wxCUserBasicInfo.getPhone())) { | if (Objects.isNull(wxCUserBasicInfo) || StringUtils.isBlank(wxCUserBasicInfo.getPhone())) { | ||||
| return 0; | return 0; | ||||
| @@ -86,14 +86,14 @@ public class CreditUtil { | |||||
| if(Objects.isNull(wxCUserBasicInfo.getScoreDate())) { | if(Objects.isNull(wxCUserBasicInfo.getScoreDate())) { | ||||
| //设置过生日的用户 | //设置过生日的用户 | ||||
| if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getBirthdate()) == 0) { | if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getBirthdate()) == 0) { | ||||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo, wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(tenantEntity,wxScoreRulesService); | |||||
| } else { | } else { | ||||
| log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | ||||
| } | } | ||||
| } else { | } else { | ||||
| //发过生日券的用户或者享受过生日积分倍率的用户 | //发过生日券的用户或者享受过生日积分倍率的用户 | ||||
| if (Objects.nonNull(wxCUserBasicInfo.getScoreDate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getScoreDate()) == 0) { | if (Objects.nonNull(wxCUserBasicInfo.getScoreDate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getScoreDate()) == 0) { | ||||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo, wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(tenantEntity, wxScoreRulesService); | |||||
| } | } | ||||
| } | } | ||||