| @@ -102,7 +102,7 @@ public class WxCouponSendController extends BaseController { | |||||
| wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode()); | wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode()); | ||||
| wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | ||||
| try { | try { | ||||
| wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT); | |||||
| wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT,getWxBuserId()); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("注券异常: ", e); | logger.error("注券异常: ", e); | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| @@ -192,7 +192,7 @@ public class CouponSendSchedule { | |||||
| // 发放免费券 | // 发放免费券 | ||||
| try { | try { | ||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs,cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); | WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs,cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); | ||||
| wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); | |||||
| wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(),0L); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("定时发券:发券失败 levelId=" + l.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage()); | logger.error("定时发券:发券失败 levelId=" + l.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage()); | ||||
| continue; | continue; | ||||
| @@ -322,7 +322,7 @@ public class CouponSendSchedule { | |||||
| // 发放生日券 | // 发放生日券 | ||||
| try { | try { | ||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(),cs, cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); | WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(),cs, cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND); | ||||
| wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); | |||||
| wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(), 0L); | |||||
| couponSendedUsers.add(cu); | couponSendedUsers.add(cu); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("定时发券:发券失败 levelId=" + cu.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage()); | logger.error("定时发券:发券失败 levelId=" + cu.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage()); | ||||
| @@ -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.fasterxml.jackson.annotation.JsonIgnore; | |||||
| 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; | ||||
| @@ -36,4 +37,8 @@ public class WxCouponActionLog extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="月日",name="createTimeMd") | @io.swagger.annotations.ApiModelProperty(value="月日",name="createTimeMd") | ||||
| private String createTimeMd; | private String createTimeMd; | ||||
| @JsonIgnore | |||||
| @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | |||||
| private Long operatorId; | |||||
| } | } | ||||
| @@ -42,7 +42,7 @@ public interface WxCouponActionLogService { | |||||
| void deleteById(Long id,String tenantId); | void deleteById(Long id,String tenantId); | ||||
| void addOne(TenantEntity tenantEntity,Long couponId,Long coupon_order_id,int channelType,Long channelId); | |||||
| void addOne(TenantEntity tenantEntity,Long couponId,Long coupon_order_id,int channelType,Long channelId,Long bUserId); | |||||
| int getCountByChannelId(TenantEntity tenantEntity, int channelType, Long channelId); | int getCountByChannelId(TenantEntity tenantEntity, int channelType, Long channelId); | ||||
| @@ -96,7 +96,7 @@ public interface WxCouponSendService { | |||||
| * | * | ||||
| * @param wxCouponSend | * @param wxCouponSend | ||||
| */ | */ | ||||
| void handSel(WxCouponSend wxCouponSend,Long cUserId,EnumPayWay payWay) ; | |||||
| void handSel(WxCouponSend wxCouponSend,Long cUserId,EnumPayWay payWay,Long bUserId) ; | |||||
| } | } | ||||
| @@ -56,17 +56,18 @@ public class WxCouponActionLogServiceImpl implements WxCouponActionLogService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void addOne(TenantEntity tenantEntity, Long couponId, Long coupon_order_id, int channelType, Long channelId) { | |||||
| public void addOne(TenantEntity tenantEntity, Long couponId, Long coupon_order_id, int channelType, Long channelId,Long bUserId) { | |||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| WxCouponActionLog actionLog = new WxCouponActionLog() {{ | |||||
| updateTenantInfo(tenantEntity); | |||||
| setCouponId(couponId); | |||||
| setChannelId(channelId); | |||||
| setCouponOrderId(coupon_order_id); | |||||
| setChannelType(channelType); | |||||
| setCreateTime(curDate); | |||||
| setCreateTimeMd(new SimpleDateFormat("MM/dd").format(curDate)); | |||||
| }}; | |||||
| WxCouponActionLog actionLog = new WxCouponActionLog(); | |||||
| actionLog.updateTenantInfo(tenantEntity); | |||||
| actionLog.setCouponId(couponId); | |||||
| actionLog.setChannelId(channelId); | |||||
| actionLog.setCouponOrderId(coupon_order_id); | |||||
| actionLog.setChannelType(channelType); | |||||
| actionLog.setCreateTime(curDate); | |||||
| actionLog.setCreateTimeMd(new SimpleDateFormat("MM/dd").format(curDate)); | |||||
| actionLog.setOperatorId(bUserId); | |||||
| saveOrUpdate(actionLog); | saveOrUpdate(actionLog); | ||||
| } | } | ||||
| @@ -276,7 +276,7 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService { | |||||
| try { | try { | ||||
| couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(),wxCoupon, wxCoupon.getId(),null,EnumPayWay.PAY_WAY_NOT_UNPAY_BATCH_SEND); | couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(),wxCoupon, wxCoupon.getId(),null,EnumPayWay.PAY_WAY_NOT_UNPAY_BATCH_SEND); | ||||
| if (couponOrder != null) { | if (couponOrder != null) { | ||||
| wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId); | |||||
| wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId,0L); | |||||
| } | } | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -72,21 +72,21 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { | ||||
| PageInfo<WxCouponSendVo> pageInfo; | PageInfo<WxCouponSendVo> pageInfo; | ||||
| /** | |||||
| * 设置商户购买券数 | |||||
| * 前端排序:时间、商户总库存、商户已发数、商户剩余 | |||||
| */ | |||||
| /** | |||||
| * 设置商户购买券数 | |||||
| * 前端排序:时间、商户总库存、商户已发数、商户剩余 | |||||
| */ | |||||
| if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), record.getSendType())) { | if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), record.getSendType())) { | ||||
| String sortStr = null; | String sortStr = null; | ||||
| if (Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_LNVENTORY) || | |||||
| Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_SEND) || | |||||
| if (Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_LNVENTORY) || | |||||
| Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_SEND) || | |||||
| Objects.equals(record.getSortColumn(), WxCouponSend.SORT_REMAIN)) { | Objects.equals(record.getSortColumn(), WxCouponSend.SORT_REMAIN)) { | ||||
| sortStr = record.getSortColumn() + " " + record.getSortOrder(); | sortStr = record.getSortColumn() + " " + record.getSortOrder(); | ||||
| } else if (Objects.equals(record.getSortColumn(), "createDate")) { | } else if (Objects.equals(record.getSortColumn(), "createDate")) { | ||||
| sortStr = "create_date" + " " + record.getSortOrder(); | sortStr = "create_date" + " " + record.getSortOrder(); | ||||
| } | } | ||||
| record.setSortColumn(null); | |||||
| record.setSortCol(sortStr); | |||||
| record.setSortColumn(null); | |||||
| record.setSortCol(sortStr); | |||||
| pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVoByValidType(record)); | pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVoByValidType(record)); | ||||
| for (WxCouponSendVo cs : pageInfo.getList()) { | for (WxCouponSendVo cs : pageInfo.getList()) { | ||||
| JSONObject jo = JSONObject.parseObject(cs.getConditions()); | JSONObject jo = JSONObject.parseObject(cs.getConditions()); | ||||
| @@ -375,7 +375,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| if (couponOrder != null) { | if (couponOrder != null) { | ||||
| bRet = true; | bRet = true; | ||||
| wxCouponActionLogService.addOne(couponOrder, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId()); | |||||
| wxCouponActionLogService.addOne(couponOrder, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId(),0L); | |||||
| // 发送消息 | // 发送消息 | ||||
| if (couponOrder != null) { | if (couponOrder != null) { | ||||
| @@ -430,8 +430,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ); | List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ); | ||||
| appName = appList.get(0).getName(); | appName = appList.get(0).getName(); | ||||
| }else { | }else { | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw); | |||||
| appName = appInfo.getName(); | |||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw); | |||||
| appName = appInfo.getName(); | |||||
| } | } | ||||
| Map<String, String> msgReplaceMap = new HashMap(); | Map<String, String> msgReplaceMap = new HashMap(); | ||||
| msgReplaceMap.put("title", title); | msgReplaceMap.put("title", title); | ||||
| @@ -628,7 +628,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void handSel(WxCouponSend wxCouponSend, Long cUserId,EnumPayWay payWay) { | |||||
| public void handSel(WxCouponSend wxCouponSend, Long cUserId,EnumPayWay payWay,Long bUserId) { | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId,wxCouponSend.getFinalTenantId()); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId,wxCouponSend.getFinalTenantId()); | ||||
| if (Objects.isNull(wxCUserBasicInfo)) { | if (Objects.isNull(wxCUserBasicInfo)) { | ||||
| @@ -643,7 +643,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| // 发放免费券 | // 发放免费券 | ||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId,cs, cs.getCouponId(), cs,payWay); | WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId,cs, cs.getCouponId(), cs,payWay); | ||||
| if (couponOrder != null) { | if (couponOrder != null) { | ||||
| wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); | |||||
| wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(),bUserId); | |||||
| sendMsgForSendCoupon(couponOrder, cs, couponOrder, wxCUserBasicInfo); | sendMsgForSendCoupon(couponOrder, cs, couponOrder, wxCUserBasicInfo); | ||||
| } else { | } else { | ||||
| logger.warn("handSel couponOrder is null"); | logger.warn("handSel couponOrder is null"); | ||||
| @@ -2017,7 +2017,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| // couponActionLog | // couponActionLog | ||||
| try { | try { | ||||
| wxCouponActionLogService.addOne(order, order.getProductId(), order.getOrderNumber(), EnumCouponSendSendType.ACTIVE.getCode(), orderSaveDto.getCouponChannelId()); | |||||
| wxCouponActionLogService.addOne(order, order.getProductId(), order.getOrderNumber(), EnumCouponSendSendType.ACTIVE.getCode(), orderSaveDto.getCouponChannelId(),0L); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| // 库存恢复 | // 库存恢复 | ||||
| stockBack(order); | stockBack(order); | ||||
| @@ -346,7 +346,8 @@ | |||||
| LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id | LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id | ||||
| LEFT JOIN wx_coupon c ON cal.coupon_id = c.id | LEFT JOIN wx_coupon c ON cal.coupon_id = c.id | ||||
| LEFT JOIN wx_c_user_basic_info cu ON cu.id = co.c_user_id | LEFT JOIN wx_c_user_basic_info cu ON cu.id = co.c_user_id | ||||
| LEFT JOIN wx_merchant_b_user mbu ON concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id') | |||||
| LEFT JOIN wx_merchant_b_user mbu ON mbu.id = cal.operator_id | |||||
| <!-- and concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id') --> | |||||
| WHERE cal.channel_type = #{channelType} | WHERE cal.channel_type = #{channelType} | ||||
| AND cs.conditions -> '$.id' = concat(#{merchantId},'') | AND cs.conditions -> '$.id' = concat(#{merchantId},'') | ||||
| <if test=" null != beginDate "> | <if test=" null != beginDate "> | ||||