| @@ -1679,42 +1679,42 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| } | |||
| } | |||
| /** | |||
| * 核销停车劵增加成长值,积分 | |||
| * @param couponOrder | |||
| * @param wxCoupon | |||
| * @param cuUser | |||
| */ | |||
| private void doAfterVerify(WxCouponOrder couponOrder, WxCoupon wxCoupon, WxCUserBasicInfo cuUser) { | |||
| // 成长值 | |||
| try { | |||
| WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId(),couponOrder.getTenantId()); | |||
| wxScoreRulesService.addScore2(couponOrder,EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| } | |||
| // 积分 | |||
| try { | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| creditHistory.setOperatorId(cuUser.getId()); | |||
| creditHistory.setCUserId(couponOrder.getcUserId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| // creditHistory.updateTenantInfo(couponOrder); | |||
| creditHistory.setTenantId(couponOrder.getFinalTenantId()); | |||
| creditHistory.setFinalTenantId(couponOrder.getFinalTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setCouponId(wxCoupon.getId()); | |||
| creditHistory.setBusinessId(wxCoupon.getBusiness()); | |||
| creditHistory.setSpend(couponOrder.getCouponPrice()); | |||
| creditHistory.setChangePurpose("核销停车劵["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] "); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| } | |||
| } | |||
| // /** | |||
| // * 核销停车劵增加成长值,积分 | |||
| // * @param couponOrder | |||
| // * @param wxCoupon | |||
| // * @param cuUser | |||
| // */ | |||
| // private void doAfterVerify(WxCouponOrder couponOrder, WxCoupon wxCoupon, WxCUserBasicInfo cuUser) { | |||
| // // 成长值 | |||
| // try { | |||
| // WxOrder order = wxOrderMapper.selectById(couponOrder.getOrderId(),couponOrder.getTenantId()); | |||
| // wxScoreRulesService.addScore2(couponOrder,EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||
| // } catch (Exception e) { | |||
| // logger.error("成长值:" + e.getMessage()); | |||
| // } | |||
| // | |||
| // // 积分 | |||
| // try { | |||
| // //-------此处为【现金支付】记录增加积分操作------- | |||
| // WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| // creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| // creditHistory.setOperatorId(cuUser.getId()); | |||
| // creditHistory.setCUserId(couponOrder.getcUserId()); | |||
| // creditHistory.setCreateDate(new Date()); | |||
| //// creditHistory.updateTenantInfo(couponOrder); | |||
| // creditHistory.setTenantId(couponOrder.getFinalTenantId()); | |||
| // creditHistory.setFinalTenantId(couponOrder.getFinalTenantId()); | |||
| // creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| // creditHistory.setCouponId(wxCoupon.getId()); | |||
| // creditHistory.setBusinessId(wxCoupon.getBusiness()); | |||
| // creditHistory.setSpend(couponOrder.getCouponPrice()); | |||
| // creditHistory.setChangePurpose("核销停车劵["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] "); | |||
| // wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder); | |||
| // } catch (Exception e) { | |||
| // logger.error("积分值:" + e.getMessage()); | |||
| // } | |||
| // } | |||
| // /** | |||
| // * 自主核销商品加成长值 积分 | |||
| @@ -77,6 +77,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Autowired | |||
| WxScoreRulesService wxScoreRulesService; | |||
| @Autowired | |||
| WxMerchantScoreRulesService wxMerchantScoreRulesService; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @@ -92,9 +95,6 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Autowired | |||
| WxLevelConfigMapper wxLevelConfigMapper; | |||
| @Autowired | |||
| WxMerchantScoreRulesMapper wxMerchantScoreRulesMapper; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @@ -750,6 +750,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setTenantId(tenantEntity.getFinalTenantId()); | |||
| wxCreditHistory.setMerchantId(merchantId); | |||
| wxCreditHistory.setBusinessId(wxMerchant.getBusinessId()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.SPEND_CREDIT.getCode()); | |||
| wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | |||
| @@ -1051,7 +1052,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| //积分倍率 | |||
| try { | |||
| addCreditNumber = CreditUtil.calUserCredit(addCreditNumber, wxCUserBasicInfo, tenantEntity, record.getMerchantId(), | |||
| wxScoreRulesService,wxLevelConfigMapper,wxMerchantScoreRulesMapper); | |||
| wxScoreRulesService,wxLevelConfigMapper,wxMerchantScoreRulesService); | |||
| if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | |||
| hasBirthDateCredit = true; | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.iformall.enums.EnumScoreScaleRules; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.mapper.WxLevelConfigMapper; | |||
| import com.iformall.mapper.WxMerchantScoreRulesMapper; | |||
| import com.iformall.service.WxMerchantScoreRulesService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -33,7 +34,7 @@ public class CreditUtil { | |||
| * @return | |||
| */ | |||
| public static int calUserCredit(int creditOrigin, WxCUserBasicInfo wxCUserBasicInfo, TenantEntity tenantEntity, Long merchantId, | |||
| WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper, WxMerchantScoreRulesMapper wxMerchantScoreRulesMapper) { | |||
| WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper, WxMerchantScoreRulesService wxMerchantScoreRulesService) { | |||
| Long userId = wxCUserBasicInfo.getId(); | |||
| Integer score = wxCUserBasicInfo.getPoins(); | |||
| String finalTenantId = wxCUserBasicInfo.getFinalTenantId(); | |||
| @@ -49,7 +50,7 @@ public class CreditUtil { | |||
| int memberDayScale = getMemberDayScale(tenantEntity, wxScoreRulesService); | |||
| //获取商户积分倍率: | |||
| int merchantScale = getMerchantScale(merchantId,wxMerchantScoreRulesMapper); | |||
| int merchantScale = getMerchantScale(merchantId,wxMerchantScoreRulesService); | |||
| int creditNew = new BigDecimal(creditOrigin) | |||
| .multiply(new BigDecimal(levelScale)) | |||
| @@ -241,13 +242,13 @@ public class CreditUtil { | |||
| * 获取商户积分倍率 | |||
| * | |||
| * @param | |||
| * @param wxMerchantScoreRulesMapper | |||
| * @param wxMerchantScoreRulesService | |||
| * @return | |||
| */ | |||
| private static int getMerchantScale(Long merchantId, WxMerchantScoreRulesMapper wxMerchantScoreRulesMapper) { | |||
| private static int getMerchantScale(Long merchantId, WxMerchantScoreRulesService wxMerchantScoreRulesService) { | |||
| int merchantScale = WxMerchantScoreRules.DEFAULT_SCALE; | |||
| WxMerchantScoreRules rules = wxMerchantScoreRulesMapper.findMerchantScoreRules(merchantId, EnumScoreRules.CREDIT.getCode()); | |||
| WxMerchantScoreRules rules = wxMerchantScoreRulesService.getScoreRules(merchantId, EnumScoreRules.CREDIT.getCode()); | |||
| if (Objects.nonNull(rules) && EnumYesOrNo.YES.getCode().equals(rules.getOpen())) { | |||
| merchantScale = rules.getScale(); | |||