diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java index aca90be61..c09f405d9 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java @@ -37,20 +37,15 @@ public class WxCouponChannelController extends BaseController @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) { if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); + if(wxCouponChannel.getStatus()==-1){ + wxCouponChannel.setStatus(null); + } wxCouponChannel.setTenantId(getUser().getTenantId()); final PageInfo page = wxCouponChannelService.listAsPage(wxCouponChannel, pageNum, pageSize); return new ResultData(page); } - @ApiOperation("新增接口") - @PostMapping("add") - public ResultData add(@RequestBody WxCouponChannel wxCouponChannel) { - //Assert.notNull(wxCouponChannel.getName(), "角色名不能为空"); - //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); - wxCouponChannel.setTenantId(getUser().getTenantId()); - wxCouponChannelService.saveOrUpdate(wxCouponChannel); - return new ResultData(); - } + @ApiOperation("根据id更新接口") @PostMapping("update") @@ -77,11 +72,11 @@ public class WxCouponChannelController extends BaseController @ApiOperation("批量新增") @PostMapping("/addbatch") - public ResultData findById(@RequestBody WxCouponChannelDto wxCouponChannelDto) { + public ResultData addbatch(@RequestBody WxCouponChannelDto wxCouponChannelDto) { String[] ids = wxCouponChannelDto.getCouponIds().split(","); String[] channelId = wxCouponChannelDto.getChannelId().split(","); MallUserInfo user = getUser(); - wxCouponChannelService.addBatch(ids,channelId,user.getTenantId()); + wxCouponChannelService.addBatch(ids,channelId,user.getTenantId(),wxCouponChannelDto.getBeginTime(),wxCouponChannelDto.getEndTime()); return new ResultData(); } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java index bb711755d..7df4bbc68 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java @@ -1,5 +1,7 @@ package com.simple.controller; +import com.simple.domain.po.WxCouponChannel; +import com.simple.service.WxCouponChannelService; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +27,12 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + @RestController @RequestMapping("wxCoupon") @Api(description="优惠券接口") @@ -35,6 +43,8 @@ public class WxCouponController extends BaseController @Autowired private WxMerchantService wxMerchantService; + @Autowired + private WxCouponChannelService wxCouponChannelService; private Logger logger = Logger.getLogger(WxCouponController.class); @@ -45,12 +55,31 @@ public class WxCouponController extends BaseController @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) public ResultData list(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { if (null == wxCoupon) wxCoupon = new WxCoupon(); + wxCoupon.setTenantId(getTenantId()); PageInfo page = null; if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) { page = wxCouponService.findEnableList(wxCoupon, pageNum, pageSize); }else { page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); } + List wxCouponList = page.getList(); + List ids = wxCouponList.stream().map(p->p.getId()).collect(Collectors.toList()); + WxCouponChannel wxCouponChannel = new WxCouponChannel(); + wxCouponChannel.setTenantId(getTenantId()); + wxCouponChannel.setIds(ids); + //上架状态 + List list = wxCouponChannelService.listAsPage(wxCouponChannel,1,5).getList(); + if(!list.isEmpty()){ + Map> groupBy = list.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); + for (WxCoupon temp:wxCouponList) { + List channels=new ArrayList<>(); + if(groupBy.get(temp.getId())!=null){ + String sss = JSON.toJSONString(groupBy.get(temp.getId())); + temp.setChannels(sss); + } + } + } + return new ResultData(page); } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSendController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSendController.java index 413bc9ecf..dbf30bd28 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSendController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponSendController.java @@ -51,16 +51,12 @@ public class WxCouponSendController extends BaseController return new ResultData(Result.ERROR,"已经添加过该券"); } WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); - if(wxCoupon.getSendEndDate().before(new Date())){ - return new ResultData(Result.ERROR,"发放日期异常"); - } wxCouponSend.setMerchantId(wxCoupon.getMerchantId()); wxCouponSend.setType(wxCoupon.getType()); wxCouponSend.setTenantId(wxCoupon.getTenantId()); wxCouponSend.setTitle(wxCoupon.getTitle()); - wxCouponSend.setSendStartTime(wxCoupon.getSendStartDate()); - wxCouponSend.setSendEndTime(wxCoupon.getSendEndDate()); + //Assert.notNull(wxCouponSend.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); wxCouponSendService.saveOrUpdate(wxCouponSend); diff --git a/mallinkService/src/main/java/com/simple/domain/dto/WxCouponChannelDto.java b/mallinkService/src/main/java/com/simple/domain/dto/WxCouponChannelDto.java index 99d4452de..f7ec8a2e6 100644 --- a/mallinkService/src/main/java/com/simple/domain/dto/WxCouponChannelDto.java +++ b/mallinkService/src/main/java/com/simple/domain/dto/WxCouponChannelDto.java @@ -1,6 +1,7 @@ package com.simple.domain.dto; import java.io.Serializable; +import java.util.Date; public class WxCouponChannelDto implements Serializable { @@ -8,8 +9,16 @@ public class WxCouponChannelDto implements Serializable { private Long couponId; private String couponIds; private String channelId; + private Date beginTime; + private Date endTime; + public Date getEndTime() { + return endTime; + } + public void setEndTime(Date endTime) { + this.endTime = endTime; + } public String getChannelId() { return channelId; @@ -34,4 +43,11 @@ public class WxCouponChannelDto implements Serializable { public void setCouponIds(String couponIds) { this.couponIds = couponIds; } + public Date getBeginTime() { + return beginTime; + } + + public void setBeginTime(Date beginTime) { + this.beginTime = beginTime; + } } diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java index 29ab921a3..b654829dc 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java @@ -20,6 +20,9 @@ public class WxCoupon implements Serializable { protected List ids; @Transient protected String sortColumns; + + @Transient + protected String channels; public Long getId() { return id; @@ -84,12 +87,6 @@ public class WxCoupon implements Serializable { /*1.主动领取2.定向投放**/ @io.swagger.annotations.ApiModelProperty(value="1.主动领取2.定向投放",name="sendType") private Integer sendType; - /*发放开始时间**/ - @io.swagger.annotations.ApiModelProperty(value="发放开始时间",name="sendStartDate") - private Date sendStartDate; - /*发放结束时间**/ - @io.swagger.annotations.ApiModelProperty(value="发放结束时间",name="sendEndDate") - private Date sendEndDate; /*有效时间类型1.时间范围(valid_start_date,valid_end_date). 2领取后几日有效(valid_days)**/ @io.swagger.annotations.ApiModelProperty(value="有效时间类型1.时间范围(valid_start_date,valid_end_date). 2领取后几日有效(valid_days)",name="validType") private Integer validType; @@ -195,18 +192,6 @@ public class WxCoupon implements Serializable { public void setSendType(Integer _sendType) { sendType = _sendType; } - public Date getSendStartDate() { - return sendStartDate; - } - public void setSendStartDate(Date _sendStartDate) { - sendStartDate = _sendStartDate; - } - public Date getSendEndDate() { - return sendEndDate; - } - public void setSendEndDate(Date _sendEndDate) { - sendEndDate = _sendEndDate; - } public Integer getValidType() { return validType; } @@ -321,6 +306,13 @@ public class WxCoupon implements Serializable { this.priceStr = priceStr; } + public String getChannels() { + return channels; + } + + public void setChannels(String channels) { + this.channels = channels; + } public static enum Field diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCouponChannel.java b/mallinkService/src/main/java/com/simple/domain/po/WxCouponChannel.java index f021b9fa0..7c2152792 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCouponChannel.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCouponChannel.java @@ -11,16 +11,15 @@ import java.io.Serializable; @Table(name = "wx_coupon_channel") public class WxCouponChannel implements Serializable { private static final long serialVersionUID = 1L; - + @Id - protected Long id; - - @Transient - protected List ids; - @Transient - protected String sortColumns; - - + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + public Long getId() { return id; } @@ -28,30 +27,20 @@ public class WxCouponChannel implements Serializable { public void setId(Long id) { this.id = id; } - + public String getSortColumns() { return sortColumns; } - - public List getIds() { + + public List getIds() { return ids; } - public void setIds(List ids) { + + public void setIds(List ids) { this.ids = ids; } - /***/ - @io.swagger.annotations.ApiModelProperty(value="",name="business") - private String business; - - public String getBusiness() { - return business; - } - - public void setBusiness(String business) { - this.business = business; - } /*租户ID**/ @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") @@ -62,9 +51,7 @@ public class WxCouponChannel implements Serializable { /*卡券id**/ @io.swagger.annotations.ApiModelProperty(value="卡券id",name="couponId") private Long couponId; - /*券状态,判断是否在前端展示**/ - @io.swagger.annotations.ApiModelProperty(value="券状态,判断是否在前端展示",name="couponStatus") - private Integer couponStatus; + /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") private Integer type; @@ -74,6 +61,18 @@ public class WxCouponChannel implements Serializable { /*投放频道位置(1.列表, 2.限时抢购)**/ @io.swagger.annotations.ApiModelProperty(value="投放频道位置(1.列表, 2.限时抢购)",name="targetAd") private Integer targetAd; + /***/ + @io.swagger.annotations.ApiModelProperty(value="",name="business") + private String business; + /*开始时间**/ + @io.swagger.annotations.ApiModelProperty(value="开始时间",name="beginTime") + private Date beginTime; + /*结束时间**/ + @io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime") + private Date endTime; + /*0:上架 1:下架**/ + @io.swagger.annotations.ApiModelProperty(value="0:上架 1:下架",name="status") + private Integer status; /*创建时间**/ @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; @@ -98,12 +97,6 @@ public class WxCouponChannel implements Serializable { public void setCouponId(Long _couponId) { couponId = _couponId; } - public Integer getCouponStatus() { - return couponStatus; - } - public void setCouponStatus(Integer _couponStatus) { - couponStatus = _couponStatus; - } public Integer getType() { return type; } @@ -122,6 +115,30 @@ public class WxCouponChannel implements Serializable { public void setTargetAd(Integer _targetAd) { targetAd = _targetAd; } + public String getBusiness() { + return business; + } + public void setBusiness(String _business) { + business = _business; + } + public Date getBeginTime() { + return beginTime; + } + public void setBeginTime(Date _beginTime) { + beginTime = _beginTime; + } + public Date getEndTime() { + return endTime; + } + public void setEndTime(Date _endTime) { + endTime = _endTime; + } + public Integer getStatus() { + return status; + } + public void setStatus(Integer _status) { + status = _status; + } public Date getCreateDate() { return createDate; } @@ -136,19 +153,24 @@ public class WxCouponChannel implements Serializable { } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") - ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") - ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") - ,CouponStatus_ASC("`couponStatus` ASC"),CouponStatus_DESC("`couponStatus` DESC") - ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") - ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") - ,TargetAd_ASC("`targetAd` ASC"),TargetAd_DESC("`targetAd` DESC") - ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") - ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") - ; + ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") + ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") + ,CouponStatus_ASC("`couponStatus` ASC"),CouponStatus_DESC("`couponStatus` DESC") + ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") + ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") + ,TargetAd_ASC("`targetAd` ASC"),TargetAd_DESC("`targetAd` DESC") + ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") + ,BeginTime_ASC("`beginTime` ASC"),BeginTime_DESC("`beginTime` DESC") + ,EndTime_ASC("`endTime` ASC"),EndTime_DESC("`endTime` DESC") + ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") + ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") + ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") + ; private String value; Field(String value){ this.value = value; @@ -164,8 +186,8 @@ public class WxCouponChannel implements Serializable { return this.getValue(); } } - - public void setSortColumns(Field... fields) + + public void setSortColumns(WxCouponChannel.Field... fields) { if (fields == null || fields.length == 0) { return; @@ -180,9 +202,9 @@ public class WxCouponChannel implements Serializable { sb.append(","); sb.append(fields[k].toString()); } - + } - + public void setSortColumns(String sortColumns) { if (sortColumns == null || "".equals(sortColumns.trim())) { @@ -190,7 +212,7 @@ public class WxCouponChannel implements Serializable { } if (sortColumns.contains(",")) { String[] cols = sortColumns.split(","); - List fList = new ArrayList(); + java.util.List fList = new java.util.ArrayList(); for (int k = 0; k < cols.length; k++) { fList.add(Field.valueOf(cols[k])); } diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java index 71891741f..a548756c8 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java @@ -178,8 +178,6 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { this.remainInventory=wxCoupon.getRemainInventory(); this.price=wxCoupon.getPrice(); this.salePrice=wxCoupon.getSalePrice(); - this.sendStartDate=wxCoupon.getSendStartDate(); - this.sendEndDate=wxCoupon.getSendEndDate(); this.sendType=wxCoupon.getSendType(); this.useLimitQuantity=wxCoupon.getUseLimitQuantity(); this.usePrice=wxCoupon.getUsePrice(); diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java b/mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java index 74192f9ec..1b1d1a985 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponChannelService.java @@ -4,6 +4,8 @@ import com.github.pagehelper.PageInfo; import com.simple.domain.po.WxCouponChannel; import com.simple.domain.vo.WxCouponChannelVo; +import java.util.Date; + public interface WxCouponChannelService { /** @@ -40,7 +42,7 @@ public interface WxCouponChannelService { */ void deleteById(Long id); - void addBatch(String[] ids,String[] channelId,String tanantId); + void addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime,Date endTime); diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponSendService.java b/mallinkService/src/main/java/com/simple/service/WxCouponSendService.java index af08191ed..d388aa9c6 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponSendService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponSendService.java @@ -37,6 +37,14 @@ public interface WxCouponSendService { * @param id */ void deleteById(Long id); + + /** + *停车或核销给用户注入卡券 + * @param tenantId + * @param cUserId + * @param type 2:停车发券 3:核销发券 + */ + void sendCouponToUser(String tenantId,Long cUserId,int type); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java index 64588733a..270f60cb4 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java @@ -61,13 +61,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { @Override @Transactional - public void addBatch(String[] ids,String[] channelId,String tanantId) { + public void addBatch(String[] ids,String[] channelId,String tanantId,Date beginTime,Date endTime) { for (String targetIdstr:channelId) { Integer targetId = Integer.parseInt(targetIdstr); for (String couponidstr:ids) { Long couponid = Long.parseLong(couponidstr); - addCuponChannel(couponid,targetId,tanantId); + addCuponChannel(couponid,targetId,tanantId,beginTime,endTime); } } @@ -75,17 +75,22 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { } @Transactional - public void addCuponChannel(Long couponid,Integer channelId,String tanantId){ + public void addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){ WxCoupon wxCoupon = wxCouponService.getById(couponid); if(wxCoupon.getStatus()!=1) { wxCoupon.setStatus(1); wxCouponService.saveOrUpdate(wxCoupon); } WxCouponChannel wxCouponChannel = new WxCouponChannel(); + wxCouponChannel.setBeginTime(beginTime); + wxCouponChannel.setEndTime(endTime); wxCouponChannel.setCouponId(couponid); - wxCouponChannel.setCouponStatus(1); + wxCouponChannel.setMerchantId(wxCoupon.getMerchantId()); + wxCouponChannel.setType(wxCoupon.getType()); wxCouponChannel.setTargetAd(channelId); wxCouponChannel.setTenantId(tanantId); + wxCouponChannel.setBusiness(wxCoupon.getBusiness()); + wxCouponChannel.setTitle(wxCoupon.getTitle()); saveOrUpdate(wxCouponChannel); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponSendServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponSendServiceImpl.java index 84b282292..6aea7694a 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponSendServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponSendServiceImpl.java @@ -3,9 +3,15 @@ package com.simple.service.impl; import java.util.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCoupon; +import com.simple.domain.po.WxCouponOrder; import com.simple.domain.po.WxCouponSend; import com.simple.mapper.WxCouponSendMapper; +import com.simple.service.WxCouponActionLogService; +import com.simple.service.WxCouponOrderService; import com.simple.service.WxCouponSendService; +import com.simple.service.WxCouponService; +import org.apache.commons.lang.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.simple.common.IdWorker; @@ -15,6 +21,12 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { @Autowired WxCouponSendMapper wxCouponSendMapper; + @Autowired + WxCouponOrderService wxCouponOrderService; + @Autowired + WxCouponService wxCouponService; + @Autowired + WxCouponActionLogService wxCouponActionLogService; @Override @@ -43,12 +55,49 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { public void deleteById(Long id) { wxCouponSendMapper.deleteByPrimaryKey(id); } - - - - - - - - + + @Override + public void sendCouponToUser(String tenantId, Long cUserId, int type) { + //查询开关是否打开 + //查询停车或者核销的券 + WxCouponSend wxCouponSendQuery = new WxCouponSend(); + wxCouponSendQuery.setTenantId(tenantId); + int actionLogType=0; + if(type==2){ + //停车 + wxCouponSendQuery.setSendType(2); + actionLogType=3; + } + if(type==3){ + //核销 + wxCouponSendQuery.setSendType(3); + actionLogType=4; + }else{ + return; + } + List wxCouponSends = wxCouponSendMapper.findList(wxCouponSendQuery); + for (WxCouponSend send:wxCouponSends) { + WxCoupon wxCoupon= wxCouponService.getById(send.getCouponId()); + WxCouponOrder wxCouponOrder = new WxCouponOrder(); + wxCouponOrder.setCouponId(wxCoupon.getId()); + wxCouponOrder.setCouponOrderStatus(0); + wxCouponOrder.setCUserId(cUserId); + wxCouponOrder.setCouponPrice(0); + wxCouponOrder.setCreateDate(new Date()); + if (wxCoupon.getValidType() == 1) { //时间范围区间 + wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); + } else { + Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); + wxCouponOrder.setExpiredTime(date); + } + wxCouponOrder.setTenantId(wxCoupon.getTenantId()); + Long couponOrderId = wxCouponOrderService.insertOne(wxCouponOrder); + wxCouponActionLogService.addOne(tenantId, wxCoupon.getId(), couponOrderId, actionLogType, send.getId()); + } + + + + } + + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index 5191ab548..16800c95f 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -6,85 +6,104 @@ - + + + - + - `id`,`tenant_id`,`merchant_id`,`coupon_id`,`coupon_status`,`type`,`title`,`target_ad`,`business`,`create_date`,`update_date` + `id`,`tenant_id`,`merchant_id`,`coupon_id`,`coupon_status`,`type`,`title`,`target_ad`,`business`,`begin_time`,`end_time`,`status`,`create_date`,`update_date` - where 1 = 1 - - - and `id` = #{id} - - - - - and `tenant_id` like concat('%', #{tenantId},'%') - - - - - and `merchant_id` = #{merchantId} - - - - - and `coupon_id` = #{couponId} - - - - - and `coupon_status` = #{couponStatus} - - - - - and `type` = #{type} - - - - - and `title` like concat('%', #{title},'%') - - - - - and `target_ad` = #{targetAd} - - - - - and `create_date` = #{createDate} - - - - - and `update_date` = #{updateDate} - - + where 1 = 1 + + + and `id` = #{id} + + + + + and `tenant_id` like concat('%', #{tenantId},'%') + + + + + and `merchant_id` = #{merchantId} + + + + + and `coupon_id` = #{couponId} + + + + + + and `type` = #{type} + + + + + and `title` like concat('%', #{title},'%') + + + + + and `target_ad` = #{targetAd} + + + + + and `business` like concat('%', #{business},'%') + + + + + and `begin_time` = #{beginTime} + + + + + and `end_time` = #{endTime} + + + + + and `status` = #{status} + + + + + and `create_date` = #{createDate} + + + + + and `update_date` = #{updateDate} + + - and id in + and id in - #{idItem} + #{idItem} - + order by ${sortColumns} - + +