| @@ -67,7 +67,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| } | } | ||||
| try { | try { | ||||
| Map<String, Integer> result = wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId, getTenantInfo()) ; | |||||
| Map<String, Integer> result = wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId, getTenantInfo().getFinalTenantId()) ; | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return new ResultData(e.getErrorCode(),e.getMessage()); | return new ResultData(e.getErrorCode(),e.getMessage()); | ||||
| @@ -86,7 +86,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| wxCreditHistory.setTenantId(user.getFinalTenantId()); | wxCreditHistory.setTenantId(user.getFinalTenantId()); | ||||
| wxCreditHistory.setOperatorId(user.getId()); | wxCreditHistory.setOperatorId(user.getId()); | ||||
| try { | try { | ||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxCreditHistory) ; | |||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; | |||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | ||||
| return new ResultData(Result.SUCCESS, "操作成功", credit); | return new ResultData(Result.SUCCESS, "操作成功", credit); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| @@ -56,7 +56,7 @@ public class WxScoreRulesController extends BaseController { | |||||
| @SystemControllerLog(description = "积分-配置") | @SystemControllerLog(description = "积分-配置") | ||||
| public ResultData creditRulesList() { | public ResultData creditRulesList() { | ||||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(ifParentUpdateTenantInfo()); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo().getFinalTenantId()); | |||||
| return new ResultData(scoreRules); | return new ResultData(scoreRules); | ||||
| } | } | ||||
| @@ -192,7 +192,8 @@ public class WxCUserController extends BaseController { | |||||
| private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId, TenantEntity tenantEntity) { | private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId, TenantEntity tenantEntity) { | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); | wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); | ||||
| wxCreditHistory.updateTenantInfo(tenantEntity); | |||||
| // wxCreditHistory.updateTenantInfo(tenantEntity); | |||||
| wxCreditHistory.setTenantId(tenantEntity.getFinalTenantId()); | |||||
| wxCreditHistory.setCreateDate(new Date()); | wxCreditHistory.setCreateDate(new Date()); | ||||
| wxCreditHistory.setCreditType(enumScoreType.getCode()); | wxCreditHistory.setCreditType(enumScoreType.getCode()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | ||||
| @@ -71,7 +71,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | ||||
| } | } | ||||
| try { | try { | ||||
| Map<String, Integer> result = wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId, getTenantInfo()); | |||||
| Map<String, Integer> result = wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId, getTenantInfo().getFinalTenantId()); | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| @@ -99,7 +99,9 @@ public class WxCreditHistoryController extends BaseController { | |||||
| @PostMapping("/add") | @PostMapping("/add") | ||||
| public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | ||||
| log.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); | log.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); | ||||
| wxCreditHistory.updateTenantInfo(getTenantInfo()); | |||||
| // wxCreditHistory.updateTenantInfo(getTenantInfo()); | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); | |||||
| wxCreditHistory.setOperatorId(getLoginBUser().getId()); | wxCreditHistory.setOperatorId(getLoginBUser().getId()); | ||||
| WxMerchant wxMerchant = new WxMerchant(); | WxMerchant wxMerchant = new WxMerchant(); | ||||
| wxMerchant.setId(getLoginBUser().getMerchantId()); | wxMerchant.setId(getLoginBUser().getMerchantId()); | ||||
| @@ -120,7 +122,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| //B端操作用户 | //B端操作用户 | ||||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | ||||
| try { | try { | ||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxCreditHistory); | |||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),tenantInfo); | |||||
| WxBuser buser = getWxBuser(); | WxBuser buser = getWxBuser(); | ||||
| if (null != buser) { | if (null != buser) { | ||||
| wxCreditHistory.setBuserId(buser.getId()); | wxCreditHistory.setBuserId(buser.getId()); | ||||
| @@ -128,7 +130,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | ||||
| //更新标签 | //更新标签 | ||||
| if (wxCreditHistory.getTags() != null && !wxCreditHistory.getTags().isEmpty()) { | if (wxCreditHistory.getTags() != null && !wxCreditHistory.getTags().isEmpty()) { | ||||
| wxCUserTagsService.updateTagByUserId(wxCreditHistory.getCUserId(),wxCreditHistory, wxCreditHistory.getTags()); | |||||
| wxCUserTagsService.updateTagByUserId(wxCreditHistory.getCUserId(),tenantInfo, wxCreditHistory.getTags()); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "操作成功", credit); | return new ResultData(Result.SUCCESS, "操作成功", credit); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| @@ -83,7 +83,7 @@ public class WxMerchantBUserController extends BaseController { | |||||
| } | } | ||||
| resultMap.put("creditLocked", merchant.getCreditLocked()); | resultMap.put("creditLocked", merchant.getCreditLocked()); | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user.getFinalTenantId()); | |||||
| if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) { | if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) { | ||||
| resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode()); | resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode()); | ||||
| } | } | ||||
| @@ -970,7 +970,8 @@ public class WxUserGrantController extends BaseController { | |||||
| //增加积分 | //增加积分 | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setCUserId(record.getId()); | wxCreditHistory.setCUserId(record.getId()); | ||||
| wxCreditHistory.updateTenantInfo(tenantEntity); | |||||
| // wxCreditHistory.updateTenantInfo(tenantEntity); | |||||
| wxCreditHistory.setTenantId(tenantEntity.getFinalTenantId()); | |||||
| wxCreditHistory.setCreateDate(new Date()); | wxCreditHistory.setCreateDate(new Date()); | ||||
| wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | ||||
| @@ -1363,7 +1363,8 @@ public class PosServiceImpl implements PosService { | |||||
| creditHistory.setOperatorId(buUserId); | creditHistory.setOperatorId(buUserId); | ||||
| creditHistory.setCUserId(couponOrderCVo.getcUserId()); | creditHistory.setCUserId(couponOrderCVo.getcUserId()); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(couponOrderCVo); | |||||
| // creditHistory.updateTenantInfo(couponOrderCVo); | |||||
| creditHistory.setTenantId(couponOrderCVo.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setCouponId(couponOrderCVo.getCouponId()); | creditHistory.setCouponId(couponOrderCVo.getCouponId()); | ||||
| creditHistory.setBusinessId(coupon.getBusiness()); | creditHistory.setBusinessId(coupon.getBusiness()); | ||||
| @@ -1390,7 +1391,8 @@ public class PosServiceImpl implements PosService { | |||||
| creditHistory.setOperatorId(buUserId); | creditHistory.setOperatorId(buUserId); | ||||
| creditHistory.setCUserId(memId); | creditHistory.setCUserId(memId); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(merchant); | |||||
| // creditHistory.updateTenantInfo(merchant); | |||||
| creditHistory.setTenantId(merchant.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setBusinessId(merchant.getBusinessId()); | creditHistory.setBusinessId(merchant.getBusinessId()); | ||||
| creditHistory.setSpend(payment); | creditHistory.setSpend(payment); | ||||
| @@ -1422,11 +1424,7 @@ public class PosServiceImpl implements PosService { | |||||
| creditHistory.setOperatorId(buUserId); | creditHistory.setOperatorId(buUserId); | ||||
| creditHistory.setCUserId(couponOrderCVo.getcUserId()); | creditHistory.setCUserId(couponOrderCVo.getcUserId()); | ||||
| // creditHistory.updateTenantInfo(couponOrderCVo); | // creditHistory.updateTenantInfo(couponOrderCVo); | ||||
| if(StringUtils.isNotBlank(couponOrderCVo.getParentTenantId())){ | |||||
| creditHistory.setTenantId(couponOrderCVo.getParentTenantId()); | |||||
| }else{ | |||||
| creditHistory.setTenantId(couponOrderCVo.getTenantId()); | |||||
| } | |||||
| creditHistory.setTenantId(couponOrderCVo.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setCouponId(couponOrderCVo.getCouponId()); | creditHistory.setCouponId(couponOrderCVo.getCouponId()); | ||||
| int num = creditHistoryService.cancelCredit(creditHistory); | int num = creditHistoryService.cancelCredit(creditHistory); | ||||
| @@ -337,7 +337,7 @@ public class CouponSendSchedule { | |||||
| } | } | ||||
| } | } | ||||
| int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity, wxScoreRulesService); | |||||
| int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity.getFinalTenantId(), wxScoreRulesService); | |||||
| for (WxCUserBasicInfo cu : couponSendedUsers) { | for (WxCUserBasicInfo cu : couponSendedUsers) { | ||||
| // 记录积分倍率日期 | // 记录积分倍率日期 | ||||
| try { | try { | ||||
| @@ -2,6 +2,7 @@ package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -12,7 +13,7 @@ import java.util.List; | |||||
| @TableName(value = "wx_credit_history") | @TableName(value = "wx_credit_history") | ||||
| @Data | @Data | ||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class WxCreditHistory extends TenantEntity { | |||||
| public class WxCreditHistory extends BaseTenantEntity { | |||||
| protected Long id; | protected Long id; | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.domain.vo; | package com.iformall.domain.vo; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | import cn.afterturn.easypoi.excel.annotation.Excel; | ||||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -9,7 +10,7 @@ import java.util.Date; | |||||
| @Data | @Data | ||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class WxCreditHistoryVo extends TenantEntity { | |||||
| public class WxCreditHistoryVo extends BaseTenantEntity { | |||||
| @Excel(name = "微信昵称", width = 20, orderNum = "1") | @Excel(name = "微信昵称", width = 20, orderNum = "1") | ||||
| @@ -77,7 +77,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| */ | */ | ||||
| // List<WxCUserBasicInfo> selectNotCUserList(); | // List<WxCUserBasicInfo> selectNotCUserList(); | ||||
| void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId,@Param("tableIndex")Integer tableIndex); | |||||
| void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId, | |||||
| @Param("tableIndex")Integer tableIndex,@Param("finalTableIndex")Integer finalTableIndex); | |||||
| } | } | ||||
| @@ -68,7 +68,7 @@ public interface WxCreditHistoryService { | |||||
| */ | */ | ||||
| //void deleteById(Long id); | //void deleteById(Long id); | ||||
| Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, Long userId, TenantEntity tenantEntity); | |||||
| Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, Long userId, String tenantId); | |||||
| void clearCreditByYear(); | void clearCreditByYear(); | ||||
| @@ -25,10 +25,10 @@ public interface WxScoreRulesService { | |||||
| /** | /** | ||||
| * 获取租户的积分规则 | * 获取租户的积分规则 | ||||
| * @param tenantEntity | |||||
| * @param | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxScoreRules getCreditRules(TenantEntity tenantEntity); | |||||
| WxScoreRules getCreditRules(String tenantId); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| @@ -181,7 +181,8 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||||
| Integer credit = wxActivity.getCredit(); | Integer credit = wxActivity.getCredit(); | ||||
| //积分历史 | //积分历史 | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.updateTenantInfo(wxActivity); | |||||
| // wxCreditHistory.updateTenantInfo(wxActivity); | |||||
| wxCreditHistory.setTenantId(wxActivity.getFinalTenantId()); | |||||
| wxCreditHistory.setCUserId(wxActivityJoin.getUserId()); | wxCreditHistory.setCUserId(wxActivityJoin.getUserId()); | ||||
| wxCreditHistory.setCreditNum(credit); | wxCreditHistory.setCreditNum(credit); | ||||
| wxCreditHistory.setCreditType(EnumScoreType.ACTIVITY_JOIN.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.ACTIVITY_JOIN.getCode()); | ||||
| @@ -1071,7 +1071,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| //积分处理逻辑:覆盖原积分 记录历史 | //积分处理逻辑:覆盖原积分 记录历史 | ||||
| if (credit != null) { | if (credit != null) { | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.updateTenantInfo(mallUserInfo); | |||||
| // wxCreditHistory.updateTenantInfo(mallUserInfo); | |||||
| wxCreditHistory.setTenantId(mallUserInfo.getFinalTenantId()); | |||||
| wxCreditHistory.setCreateDate(new Date()); | wxCreditHistory.setCreateDate(new Date()); | ||||
| if (mallUserInfo != null) { | if (mallUserInfo != null) { | ||||
| wxCreditHistory.setOperatorId(mallUserInfo.getId()); | wxCreditHistory.setOperatorId(mallUserInfo.getId()); | ||||
| @@ -1215,9 +1216,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Override | @Override | ||||
| public void cuserOldToNew(Long oldCuserId, Long newCuserId,TenantEntity tenantinfo) { | public void cuserOldToNew(Long oldCuserId, Long newCuserId,TenantEntity tenantinfo) { | ||||
| String finalTenantId = tenantinfo.getFinalTenantId(); | |||||
| Integer tableIndex = Integer.parseInt(String.valueOf(Long.parseLong(finalTenantId)%100)); | |||||
| wxCUserBasicInfoMapper.cuserOldToNew(oldCuserId,newCuserId,tableIndex); | |||||
| String tenantId = tenantinfo.getTenantId(); | |||||
| String finalTenantId = tenantinfo.getFinalTenantId(); | |||||
| Integer tableIndex = Integer.parseInt(String.valueOf(Long.parseLong(tenantId)%100)); | |||||
| Integer finalTableIndex = Integer.parseInt(String.valueOf(Long.parseLong(finalTenantId)%100)); | |||||
| wxCUserBasicInfoMapper.cuserOldToNew(oldCuserId,newCuserId,tableIndex,finalTableIndex); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -295,7 +295,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| creditHistory.setOperatorId(record.getOwnerId()); | creditHistory.setOperatorId(record.getOwnerId()); | ||||
| creditHistory.setCUserId(record.getOwnerId()); | creditHistory.setCUserId(record.getOwnerId()); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(record); | |||||
| // creditHistory.updateTenantInfo(record); | |||||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setBusinessId(coupon.getBusiness()); | creditHistory.setBusinessId(coupon.getBusiness()); | ||||
| creditHistory.setSpend(real_payment); | creditHistory.setSpend(real_payment); | ||||
| @@ -914,7 +915,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| creditHistory.setOperatorId(buUser.getId()); | creditHistory.setOperatorId(buUser.getId()); | ||||
| creditHistory.setCUserId(record.getOwnerId()); | creditHistory.setCUserId(record.getOwnerId()); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(record); | |||||
| // creditHistory.updateTenantInfo(record); | |||||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setBusinessId(merchant.getBusinessId()); | creditHistory.setBusinessId(merchant.getBusinessId()); | ||||
| creditHistory.setSpend(record.getRealPayment()); | creditHistory.setSpend(record.getRealPayment()); | ||||
| @@ -445,7 +445,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| creditHistory.setOperatorId(bUser.getId()); | creditHistory.setOperatorId(bUser.getId()); | ||||
| creditHistory.setCUserId(couponOrder.getcUserId()); | creditHistory.setCUserId(couponOrder.getcUserId()); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(couponOrder); | |||||
| // creditHistory.updateTenantInfo(couponOrder); | |||||
| creditHistory.setTenantId(couponOrder.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setCouponId(wxCoupon.getId()); | creditHistory.setCouponId(wxCoupon.getId()); | ||||
| creditHistory.setBusinessId(wxCoupon.getBusiness()); | creditHistory.setBusinessId(wxCoupon.getBusiness()); | ||||
| @@ -476,7 +477,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| creditHistory.setOperatorId(cuUser.getId()); | creditHistory.setOperatorId(cuUser.getId()); | ||||
| creditHistory.setCUserId(couponOrder.getcUserId()); | creditHistory.setCUserId(couponOrder.getcUserId()); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(couponOrder); | |||||
| // creditHistory.updateTenantInfo(couponOrder); | |||||
| creditHistory.setTenantId(couponOrder.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setCouponId(wxCoupon.getId()); | creditHistory.setCouponId(wxCoupon.getId()); | ||||
| creditHistory.setBusinessId(wxCoupon.getBusiness()); | creditHistory.setBusinessId(wxCoupon.getBusiness()); | ||||
| @@ -199,7 +199,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public WxCreditHistory saveOrUpdate(WxCreditHistory record) { | public WxCreditHistory saveOrUpdate(WxCreditHistory record) { | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getFinalTenantId()); | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | |||||
| if (wxCUserBasicInfo == null) { | if (wxCUserBasicInfo == null) { | ||||
| //验证此用户是否存在 | //验证此用户是否存在 | ||||
| throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE); | throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE); | ||||
| @@ -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(record,creditChangeNumOrigin, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| creditChangeNum = CreditUtil.calUserCredit(creditChangeNumOrigin, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | ||||
| hasBirthDateCredit = true; | hasBirthDateCredit = true; | ||||
| } | } | ||||
| @@ -297,7 +297,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| // 2. user | // 2. user | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getFinalTenantId()); | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | |||||
| if (wxCUserBasicInfo != null) { | if (wxCUserBasicInfo != null) { | ||||
| WxCUserBasicInfo wxCUserBasicInfoNew = new WxCUserBasicInfo(); | WxCUserBasicInfo wxCUserBasicInfoNew = new WxCUserBasicInfo(); | ||||
| wxCUserBasicInfoNew.setId(wxCUserBasicInfo.getId()); | wxCUserBasicInfoNew.setId(wxCUserBasicInfo.getId()); | ||||
| @@ -314,22 +314,22 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| // } | // } | ||||
| @Override | @Override | ||||
| public Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, Long userId, TenantEntity tenantEntity) { | |||||
| public Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, Long userId, String tenantId) { | |||||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(merchantId); | WxMerchant wxMerchant = wxMerchantMapper.selectById(merchantId); | ||||
| Map<String, Integer> creditMap = Maps.newHashMap(); | Map<String, Integer> creditMap = Maps.newHashMap(); | ||||
| if (wxMerchant != null && wxMerchant.getBusinessId() != null) { | if (wxMerchant != null && wxMerchant.getBusinessId() != null) { | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setBusinessId(wxMerchant.getBusinessId()); | wxCreditHistory.setBusinessId(wxMerchant.getBusinessId()); | ||||
| //wxCreditHistory.updateTenantInfo(tenantEntity); | //wxCreditHistory.updateTenantInfo(tenantEntity); | ||||
| wxCreditHistory.setTenantId(tenantEntity.getFinalTenantId()); | |||||
| wxCreditHistory.setTenantId(tenantId); | |||||
| int credit; | int credit; | ||||
| int creditNew = 0 ; | int creditNew = 0 ; | ||||
| if (StringUtils.isNotBlank(spendStr)) { | if (StringUtils.isNotBlank(spendStr)) { | ||||
| wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | ||||
| credit = payAddCredit(wxCreditHistory); | credit = payAddCredit(wxCreditHistory); | ||||
| if (Objects.nonNull(userId)) { | if (Objects.nonNull(userId)) { | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,tenantEntity.getFinalTenantId()); | |||||
| creditNew = CreditUtil.calUserCredit(tenantEntity,credit, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,tenantId); | |||||
| creditNew = CreditUtil.calUserCredit(credit, wxCUserBasicInfo, wxScoreRulesService,wxLevelConfigMapper); | |||||
| } else { | } else { | ||||
| creditNew = credit; | creditNew = credit; | ||||
| } | } | ||||
| @@ -391,45 +391,46 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| // 1. 获取当前租户下积分的增加规则 | // 1. 获取当前租户下积分的增加规则 | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(EnumScoreType.LOGIN, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.LOGIN, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int bindCarAddCredit(WxCreditHistory record) { | private int bindCarAddCredit(WxCreditHistory record) { | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int personAddCredit(WxCreditHistory record) { | private int personAddCredit(WxCreditHistory record) { | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int phoneAddCredit(WxCreditHistory record) { | private int phoneAddCredit(WxCreditHistory record) { | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int checkCompleteInfoScoreCount(TenantEntity tenantEntity,WxCUserBasicInfo cUser) { | |||||
| private int checkCompleteInfoScoreCount(WxCUserBasicInfo cUser) { | |||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setTenantId(cUser.getFinalTenantId()); | |||||
| 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); | ||||
| } | } | ||||
| private int infoAddCredit(WxCreditHistory record) { | private int infoAddCredit(WxCreditHistory record) { | ||||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getFinalTenantId()); | |||||
| if (user == null || checkCompleteInfoScoreCount(record,user) > 0) | |||||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | |||||
| if (user == null || checkCompleteInfoScoreCount(user) > 0) | |||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| return scoreRules.getRule(EnumScoreType.COMPLETE_INFO, WxScoreRules.SCORE); | return scoreRules.getRule(EnumScoreType.COMPLETE_INFO, WxScoreRules.SCORE); | ||||
| } | } | ||||
| @@ -443,7 +444,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | ||||
| } | } | ||||
| //根据商户id和花费金额计算需要新增的积分 | //根据商户id和花费金额计算需要新增的积分 | ||||
| Map<String, Integer> map = findByMerchantIdAndSpend(record.getMerchantId(), record.getSpendStr(), null,record); | |||||
| Map<String, Integer> map = findByMerchantIdAndSpend(record.getMerchantId(), record.getSpendStr(), null,record.getTenantId()); | |||||
| return map.get("credit"); | return map.get("credit"); | ||||
| } | } | ||||
| @@ -458,7 +459,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| if (record.getCreditNum() != null && record.getCreditNum() == 0) | if (record.getCreditNum() != null && record.getCreditNum() == 0) | ||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // 2. 获取成长值 by id | // 2. 获取成长值 by id | ||||
| JSONObject payRule = scoreRules.getRuleObj(EnumScoreType.CONSUMPTION); | JSONObject payRule = scoreRules.getRuleObj(EnumScoreType.CONSUMPTION); | ||||
| @@ -1541,7 +1541,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| creditHistory.setOperatorId(user.getId()); | creditHistory.setOperatorId(user.getId()); | ||||
| creditHistory.setCUserId(user.getId()); | creditHistory.setCUserId(user.getId()); | ||||
| creditHistory.setCreateDate(new Date()); | creditHistory.setCreateDate(new Date()); | ||||
| creditHistory.updateTenantInfo(wxMerchant); | |||||
| // creditHistory.updateTenantInfo(wxMerchant); | |||||
| creditHistory.setTenantId(wxMerchant.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| if (updateOrder.getCouponChannelId() != null) { | if (updateOrder.getCouponChannelId() != null) { | ||||
| WxCouponChannel wxCouponChannel = wxCouponChannelMapper.selectById(updateOrder.getCouponChannelId(),updateOrder.getTenantId()); | WxCouponChannel wxCouponChannel = wxCouponChannelMapper.selectById(updateOrder.getCouponChannelId(),updateOrder.getTenantId()); | ||||
| @@ -2178,7 +2179,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| creditHistory.setCreditNum(coupon.getCreditPrice()); | creditHistory.setCreditNum(coupon.getCreditPrice()); | ||||
| creditHistory.setCUserId(user.getId()); | creditHistory.setCUserId(user.getId()); | ||||
| creditHistory.updateTenantInfo(coupon); | |||||
| // creditHistory.updateTenantInfo(coupon); | |||||
| creditHistory.setTenantId(coupon.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | ||||
| creditHistory.setCouponId(coupon.getId()); | creditHistory.setCouponId(coupon.getId()); | ||||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | ||||
| @@ -186,13 +186,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxScoreRules getCreditRules(TenantEntity tenantEntity) { | |||||
| String tenantId = ""; | |||||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||||
| tenantId = tenantEntity.getParentTenantId(); | |||||
| }else{ | |||||
| tenantId = tenantEntity.getTenantId(); | |||||
| } | |||||
| public WxScoreRules getCreditRules(String tenantId) { | |||||
| // String tenantId = ""; | |||||
| // if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||||
| // tenantId = tenantEntity.getParentTenantId(); | |||||
| // }else{ | |||||
| // tenantId = tenantEntity.getTenantId(); | |||||
| // } | |||||
| // get pushLime from cache | // get pushLime from cache | ||||
| String key = Constant.CREDIT_RULES_KEY_PREV + tenantId; | String key = Constant.CREDIT_RULES_KEY_PREV + tenantId; | ||||
| @@ -80,7 +80,8 @@ public class ParkHelper { | |||||
| public void addCredit(WxPark park, Long cuUserId){ | public void addCredit(WxPark park, Long cuUserId){ | ||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | WxCreditHistory wxCreditHistory = new WxCreditHistory(); | ||||
| wxCreditHistory.setCUserId(cuUserId); | wxCreditHistory.setCUserId(cuUserId); | ||||
| wxCreditHistory.updateTenantInfo(park); | |||||
| // wxCreditHistory.updateTenantInfo(park); | |||||
| wxCreditHistory.setTenantId(park.getFinalTenantId()); | |||||
| wxCreditHistory.setCreateDate(new Date()); | wxCreditHistory.setCreateDate(new Date()); | ||||
| wxCreditHistory.setCreditType(EnumScoreType.BIND_CAR.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.BIND_CAR.getCode()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | ||||
| @@ -24,7 +24,7 @@ public class CreditUtil { | |||||
| * @param wxLevelConfigMapper | * @param wxLevelConfigMapper | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int calUserCredit(TenantEntity tenantEntity,int creditOrigin, WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper) { | |||||
| public static int calUserCredit(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(tenantEntity,wxCUserBasicInfo, wxScoreRulesService); | |||||
| int birthdayScale = getBirthdayScale(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(TenantEntity tenantEntity,WxCUserBasicInfo wxCUserBasicInfo, WxScoreRulesService wxScoreRulesService) { | |||||
| private static int getBirthdayScale(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(tenantEntity,wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo.getFinalTenantId(),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(tenantEntity, wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(wxCUserBasicInfo.getFinalTenantId(), wxScoreRulesService); | |||||
| } | } | ||||
| } | } | ||||
| @@ -107,13 +107,13 @@ public class CreditUtil { | |||||
| /** | /** | ||||
| * 获取生日积分倍率 | * 获取生日积分倍率 | ||||
| * | * | ||||
| * @param tenantEntity | |||||
| * @param | |||||
| * @param wxScoreRulesService | * @param wxScoreRulesService | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int getBirthdayScoreScale(TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) { | |||||
| public static int getBirthdayScoreScale(String tenantId, WxScoreRulesService wxScoreRulesService) { | |||||
| int birthdayScale = WxScoreRules.DEFAULT_SCALE; | int birthdayScale = WxScoreRules.DEFAULT_SCALE; | ||||
| WxScoreRules rules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| WxScoreRules rules = wxScoreRulesService.getCreditRules(tenantId); | |||||
| if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | ||||
| //规则存使用积分倍率 | //规则存使用积分倍率 | ||||
| birthdayScale = rules.getScale(); | birthdayScale = rules.getScale(); | ||||
| @@ -1049,6 +1049,6 @@ | |||||
| </select>--> | </select>--> | ||||
| <update id="cuserOldToNew" statementType="CALLABLE" > | <update id="cuserOldToNew" statementType="CALLABLE" > | ||||
| {call cuser_old_to_new(#{oldCuserId},#{newCuserId},#{tableIndex})} | |||||
| {call cuser_old_to_new(#{oldCuserId},#{newCuserId},#{tableIndex},#{finalTableIndex})} | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||
| @@ -4,7 +4,6 @@ | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCreditHistory"> | <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCreditHistory"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| <result column="credit_amount" jdbcType="INTEGER" property="creditAmount" /> | <result column="credit_amount" jdbcType="INTEGER" property="creditAmount" /> | ||||
| <result column="credit_num" jdbcType="INTEGER" property="creditNum" /> | <result column="credit_num" jdbcType="INTEGER" property="creditNum" /> | ||||
| @@ -23,7 +22,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`credit_amount`,`credit_num`,`credit_type`,`create_date`,`receipt_url`,`operator_type`,`operator_id`,`merchant_id`,`coupon_id`,`business_id`,`spend`,`change_purpose`,`ticket_number`,`buser_id` | |||||
| `id`,`tenant_id`,`c_user_id`,`credit_amount`,`credit_num`,`credit_type`,`create_date`,`receipt_url`,`operator_type`,`operator_id`,`merchant_id`,`coupon_id`,`business_id`,`spend`,`change_purpose`,`ticket_number`,`buser_id` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -34,9 +33,6 @@ | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != cUserId "> | <if test=" null != cUserId "> | ||||
| and `c_user_id` = #{cUserId} | and `c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| @@ -105,11 +101,8 @@ | |||||
| and credit.create_date < #{endTime} | and credit.create_date < #{endTime} | ||||
| </if> | </if> | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and ( credit.`tenant_id` = #{tenantId} or credit.`parent_tenant_id` = #{tenantId} ) | |||||
| and credit.`tenant_id` = #{tenantId} | |||||
| </if> | </if> | ||||
| <!-- <if test=" null != parentTenantId and '' != parentTenantId">--> | |||||
| <!-- and credit.`parent_tenant_id` = #{parentTenantId}--> | |||||
| <!-- </if>--> | |||||
| <if test=" null != operatorType "> | <if test=" null != operatorType "> | ||||
| and credit.operator_type = #{operatorType} | and credit.operator_type = #{operatorType} | ||||
| </if> | </if> | ||||
| @@ -154,7 +147,6 @@ | |||||
| basic.phone phone, | basic.phone phone, | ||||
| basic.sex sex, | basic.sex sex, | ||||
| credit.tenant_id tenantId, | credit.tenant_id tenantId, | ||||
| credit.parent_tenant_id parentTenantId, | |||||
| credit.c_user_id cUserId, | credit.c_user_id cUserId, | ||||
| credit.credit_amount creditAmount, | credit.credit_amount creditAmount, | ||||
| credit.credit_num creditNum, | credit.credit_num creditNum, | ||||
| @@ -199,9 +191,6 @@ | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != cUserId "> | <if test=" null != cUserId "> | ||||
| and `c_user_id` = #{cUserId} | and `c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| @@ -222,9 +211,6 @@ | |||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != cUserId "> | <if test=" null != cUserId "> | ||||
| and `c_user_id` = #{cUserId} | and `c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| @@ -203,7 +203,7 @@ public class DataInitController extends BaseController { | |||||
| creditHistory.setOperatorId(buUser.getId()); | creditHistory.setOperatorId(buUser.getId()); | ||||
| creditHistory.setCUserId(co.getcUserId()); | creditHistory.setCUserId(co.getcUserId()); | ||||
| creditHistory.setCreateDate(co.getUpdateDate()); | creditHistory.setCreateDate(co.getUpdateDate()); | ||||
| creditHistory.setTenantId(co.getTenantId()); | |||||
| creditHistory.setTenantId(co.getFinalTenantId()); | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setCouponId(coupon.getId()); | creditHistory.setCouponId(coupon.getId()); | ||||
| creditHistory.setBusinessId(coupon.getBusiness()); | creditHistory.setBusinessId(coupon.getBusiness()); | ||||