| @@ -12,9 +12,7 @@ import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| import com.iformall.service.WxProfitSharingOrderService; | |||
| import com.iformall.service.*; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -66,6 +64,12 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Autowired | |||
| WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| WxScoreRulesService wxScoreRulesService; | |||
| @Override | |||
| public WxCouponMerchant checkMerchantInCoupon(WxCardInfo cardInfo, Long merchantId) { | |||
| WxCouponMerchant couponMerchant = null; | |||
| @@ -240,6 +244,34 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| if (cardInfo.getSupportTransfer().equals(EnumCouponTransfer.YES.getCode())) { | |||
| wxCardInfoMapper.updateByPrimaryKeySelective(wxCardInfo); | |||
| } | |||
| // 成长值 | |||
| try { | |||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| } | |||
| // 积分 | |||
| try { | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | |||
| creditHistory.setOperatorId(record.getOwnerId()); | |||
| creditHistory.setCUserId(record.getOwnerId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| creditHistory.setTenantId(record.getTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setCouponId(coupon.getId()); | |||
| creditHistory.setBusinessId(Long.valueOf(coupon.getBusiness())); | |||
| creditHistory.setSpend(record.getPayment()); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| } | |||
| return new ResultData(record); | |||
| } | |||
| @@ -106,6 +106,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Autowired | |||
| WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| WxScoreRulesService wxScoreRulesService; | |||
| @Override | |||
| public PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); | |||
| @@ -321,6 +328,35 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| logger.error("核销异常:updatete num " + num); | |||
| throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); | |||
| } | |||
| // 成长值 | |||
| try { | |||
| WxOrder order = wxOrderMapper.selectByPrimaryKey(couponOrder.getOrderId()); | |||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, order, wxCoupon.getBusiness()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| } | |||
| // 积分 | |||
| try { | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||
| creditHistory.setOperatorId(bUser.getId()); | |||
| creditHistory.setCUserId(couponOrder.getcUserId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| creditHistory.setTenantId(couponOrder.getTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setCouponId(wxCoupon.getId()); | |||
| creditHistory.setBusinessId(Long.valueOf(wxCoupon.getBusiness())); | |||
| creditHistory.setSpend(couponOrder.getSalePrice()); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| creditHistory.setMerchantId(bUser.getMerchantId()); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| } | |||
| return couponOrder; | |||
| } | |||
| @@ -717,32 +717,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } catch (Exception e) { | |||
| logger.error("订单发券:" + e.getMessage()); | |||
| } | |||
| // 成长值 | |||
| try { | |||
| wxScoreRulesService.addScore2(EnumScoreType.CONSUMPTION, updateOrder, coupon.getBusiness()); | |||
| } catch (Exception e) { | |||
| logger.error("成长值:" + e.getMessage()); | |||
| } | |||
| // 积分 | |||
| try { | |||
| //-------此处为【现金支付】记录增加积分操作------- | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | |||
| creditHistory.setOperatorId(user.getId()); | |||
| creditHistory.setCUserId(user.getId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| creditHistory.setTenantId(user.getTenantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setCouponId(coupon.getId()); | |||
| creditHistory.setBusinessId(Long.valueOf(coupon.getBusiness())); | |||
| creditHistory.setSpend(updateOrder.getPayment()); | |||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | |||
| setMerchantId(coupon, creditHistory); | |||
| wxCreditHistoryService.saveOrUpdate(creditHistory); | |||
| } catch (Exception e) { | |||
| logger.error("积分值:" + e.getMessage()); | |||
| } | |||
| } | |||
| /** | |||