| @@ -328,21 +328,33 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| public void insertWxCardDailyLogInfo(WxCouponPassword wxCouponPassword, MallUserInfo user) { | public void insertWxCardDailyLogInfo(WxCouponPassword wxCouponPassword, MallUserInfo user) { | ||||
| try { | try { | ||||
| WxCouponPassword couponPassword = this.getById(wxCouponPassword.getId()); | WxCouponPassword couponPassword = this.getById(wxCouponPassword.getId()); | ||||
| //如果一次没用过,则cardInfo查不到。 | |||||
| WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(couponPassword.getId(), couponPassword); | WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(couponPassword.getId(), couponPassword); | ||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(couponPassword.getCouponId(), couponPassword.getTenantId()); | WxCoupon wxCoupon = wxCouponMapper.selectById(couponPassword.getCouponId(), couponPassword.getTenantId()); | ||||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | ||||
| cardSetPrice.updateTenantInfo(wxCouponPassword); | cardSetPrice.updateTenantInfo(wxCouponPassword); | ||||
| cardSetPrice.setCardPasswordId(wxCouponPassword.getId()); | cardSetPrice.setCardPasswordId(wxCouponPassword.getId()); | ||||
| cardSetPrice.setPrice(cardInfo.getRemainingAmount()); | |||||
| if (null != cardInfo) { | |||||
| cardSetPrice.setPrice(cardInfo.getRemainingAmount()); | |||||
| }else { | |||||
| cardSetPrice.setPrice(couponPassword.getPrice()); | |||||
| } | |||||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | ||||
| cardSetPrice.setOperatorId(user.getId()); | cardSetPrice.setOperatorId(user.getId()); | ||||
| cardSetPrice.setOperatorUser(user.getUsername()); | cardSetPrice.setOperatorUser(user.getUsername()); | ||||
| cardSetPrice.setCouponId(wxCoupon.getId()); | cardSetPrice.setCouponId(wxCoupon.getId()); | ||||
| cardSetPrice.setCardInfoId(cardInfo.getId()); | |||||
| if (null != cardInfo) { | |||||
| cardSetPrice.setCardInfoId(cardInfo.getId()); | |||||
| } | |||||
| cardSetPrice.setType(wxCouponPassword.getIsStop() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode()); | cardSetPrice.setType(wxCouponPassword.getIsStop() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode()); | ||||
| cardSetPrice.setCount(1); | cardSetPrice.setCount(1); | ||||
| cardSetPrice.setRemark(user.getUsername() + "给实体卡卡号[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(cardSetPrice.getType()).getInfo()); | |||||
| Long cardId = couponPassword.getId(); | |||||
| if (null != cardInfo) { | |||||
| cardId = cardInfo.getId(); | |||||
| } | |||||
| cardSetPrice.setRemark(user.getUsername() + "给实体卡卡号[" + cardId + "]" + EnumOperateLogType.getEnum(cardSetPrice.getType()).getInfo()); | |||||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | wxCardDailyLogService.saveOrUpdate(cardSetPrice); | ||||
| }catch (Exception e){ | }catch (Exception e){ | ||||
| logger.error("startOrStop insert error"); | logger.error("startOrStop insert error"); | ||||