| @@ -112,7 +112,7 @@ public class WxCampaignController extends BaseController { | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||
| wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||
| wxCampaign.setCoupons(couponList); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | |||
| @@ -52,7 +52,7 @@ public class WxCouponChannelController extends BaseController { | |||
| } | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); | |||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | |||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -28,8 +28,6 @@ public class WxCouponOrderController extends BaseController { | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -93,8 +91,7 @@ public class WxCouponOrderController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "string", paramType = "query", required = true) | |||
| }) | |||
| public ResultData detail(String couponOrderId) { | |||
| public ResultData detail(String couponOrderId) { | |||
| if(couponOrderId == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| @@ -66,7 +66,7 @@ public class WxCampaignController extends BaseController { | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||
| wxCouponChannel.setStatus(0); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||
| wxCampaign.setCoupons(couponList); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | |||
| @@ -27,8 +27,6 @@ public class WxCouponChannelController extends BaseController { | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -40,7 +38,7 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); | |||
| return new ResultData(wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize)); | |||
| return new ResultData(wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize)); | |||
| } | |||
| } | |||
| @@ -2,10 +2,10 @@ package com.iformall.controller; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -25,7 +25,7 @@ public class WxCouponController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @ApiOperation("根据id(couponChannel)查询接口") | |||
| @@ -46,7 +46,7 @@ public class WxCouponController extends BaseController { | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setId(couponChannelIdL); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCouponChannel); | |||
| WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(wxCouponChannel); | |||
| if (wxCouponCVo == null) | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import javax.persistence.Id; | |||
| @@ -9,19 +10,14 @@ import java.math.BigDecimal; | |||
| import java.text.DecimalFormat; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| public class WxCouponCVo implements Serializable { | |||
| @JsonIgnoreProperties(value = {"handler"}) | |||
| public class WxCouponCVo extends WxCoupon implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /*投放券频道id**/ | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| @@ -30,19 +26,6 @@ public class WxCouponCVo implements Serializable { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| @Transient | |||
| private String salePriceStr; | |||
| @@ -52,12 +35,14 @@ public class WxCouponCVo implements Serializable { | |||
| @Transient | |||
| private String priceStr; | |||
| /*券ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券ID",name="couponId") | |||
| private Long couponId; | |||
| /*投放频道位置(1.列表, 2.限时抢购)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="投放频道位置(1.列表, 2.限时抢购)",name="targetAd") | |||
| private Integer targetAd; | |||
| /*发放相关参数*/ | |||
| /*卡券id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="卡券id",name="couponId") | |||
| private Long couponId; | |||
| /*开始时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="beginTime") | |||
| private Date beginTime; | |||
| @@ -66,355 +51,50 @@ public class WxCouponCVo implements Serializable { | |||
| private Date endTime; | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*商户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private Long merchantId; | |||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") | |||
| private Integer type; | |||
| /*封面图**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||
| private String coverImg; | |||
| /*券名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| private String title; | |||
| /*副标题**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||
| private String subTitle; | |||
| /*售价(适用于类型2,3,4,5)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") | |||
| private Integer salePrice; | |||
| /*使用条件金额(适用于类型1,2,3,4)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="使用条件金额(适用于类型1,2,3,4)",name="usePrice") | |||
| private Integer usePrice; | |||
| /*限领张数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") | |||
| private Integer useLimitQuantity; | |||
| /*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; | |||
| /*有效日期-开始**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate") | |||
| private Date validStartDate; | |||
| /*有效日期-结束**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate") | |||
| private Date validEndDate; | |||
| /*自领取之日几日有效,(停车券当天有效)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="自领取之日几日有效,(停车券当天有效)",name="validDays") | |||
| private Integer validDays; | |||
| /*须知**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||
| private String detail; | |||
| /*面额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | |||
| private Integer price; | |||
| /*单位**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") | |||
| private Integer unit; | |||
| /*剩余库存**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | |||
| private Integer remainInventory; | |||
| /*总库存**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="总库存",name="inventory") | |||
| private Integer inventory; | |||
| /*购买须知**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||
| private String remark; | |||
| /*状态(-1:全部,0:草稿/待生效,1:已生效,2:已失效,3:已作废)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="状态(-1:全部,0:草稿/待生效,1:已生效,2:已失效,3:已作废)",name="status") | |||
| private Integer status; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| /*业态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="业态",name="business") | |||
| private Integer business; | |||
| /*发券商户信息*/ | |||
| /*商户图片**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl") | |||
| private String merchantImgUrl; | |||
| /*商户名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| private String merchantName; | |||
| /*联系方式**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | |||
| private String merchantLinkPhone; | |||
| /*商户状态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户状态1可用0停用",name="status") | |||
| private Integer merchantStatus; | |||
| /*地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="addr") | |||
| private String addr; | |||
| /*百度poi(省市区县street等)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="百度poi(省市区县street等)",name="baiduPoi") | |||
| private String baiduPoi; | |||
| /*商铺编号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") | |||
| private String shopNumber; | |||
| /*楼座号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座",name="buildingName") | |||
| private String buildingName; | |||
| /*楼层号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼层",name="floorName") | |||
| private String floorName; | |||
| @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") | |||
| private List<WxMerchantVo> merchantVoList; | |||
| 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 Long getCouponId() { | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long _couponId) { | |||
| couponId = _couponId; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| } | |||
| public String getCoverImg() { | |||
| return coverImg; | |||
| } | |||
| public void setCoverImg(String _coverImg) { | |||
| coverImg = _coverImg; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String _title) { | |||
| title = _title; | |||
| } | |||
| public String getSubTitle() { | |||
| return subTitle; | |||
| } | |||
| public void setSubTitle(String _subTitle) { | |||
| subTitle = _subTitle; | |||
| } | |||
| public Integer getSalePrice() { | |||
| return salePrice; | |||
| } | |||
| public void setSalePrice(Integer _salePrice) { | |||
| salePrice = _salePrice; | |||
| } | |||
| public Integer getUsePrice() { | |||
| return usePrice; | |||
| } | |||
| public void setUsePrice(Integer _usePrice) { | |||
| usePrice = _usePrice; | |||
| } | |||
| public Integer getUseLimitQuantity() { | |||
| return useLimitQuantity; | |||
| } | |||
| public void setUseLimitQuantity(Integer _useLimitQuantity) { | |||
| useLimitQuantity = _useLimitQuantity; | |||
| } | |||
| public Integer getSendType() { | |||
| return sendType; | |||
| } | |||
| 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; | |||
| } | |||
| public void setValidType(Integer _validType) { | |||
| validType = _validType; | |||
| } | |||
| public Date getValidStartDate() { | |||
| return validStartDate; | |||
| } | |||
| public void setValidStartDate(Date _validStartDate) { | |||
| validStartDate = _validStartDate; | |||
| } | |||
| public Date getValidEndDate() { | |||
| return validEndDate; | |||
| } | |||
| public void setValidEndDate(Date _validEndDate) { | |||
| validEndDate = _validEndDate; | |||
| } | |||
| public Integer getValidDays() { | |||
| return validDays; | |||
| } | |||
| public void setValidDays(Integer _validDays) { | |||
| validDays = _validDays; | |||
| } | |||
| public String getDetail() { | |||
| return detail; | |||
| } | |||
| public void setDetail(String _detail) { | |||
| detail = _detail; | |||
| } | |||
| public Integer getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(Integer _price) { | |||
| price = _price; | |||
| public void setCouponId(Long couponId) { | |||
| this.couponId = couponId; | |||
| } | |||
| public Integer getUnit() { | |||
| return unit; | |||
| public Integer getTargetAd() { | |||
| return targetAd; | |||
| } | |||
| public void setUnit(Integer unit) { | |||
| this.unit = unit; | |||
| public void setTargetAd(Integer targetAd) { | |||
| this.targetAd = targetAd; | |||
| } | |||
| public Integer getRemainInventory() { | |||
| return remainInventory; | |||
| } | |||
| public void setRemainInventory(Integer _remainInventory) { | |||
| remainInventory = _remainInventory; | |||
| } | |||
| public Integer getInventory() { | |||
| return inventory; | |||
| } | |||
| public void setInventory(Integer _inventory) { | |||
| inventory = _inventory; | |||
| } | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setRemark(String _remark) { | |||
| remark = _remark; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer _status) { | |||
| status = _status; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public Integer getBusiness() { | |||
| return business; | |||
| } | |||
| public void setBusiness(Integer _business) { | |||
| business = _business; | |||
| public List<WxMerchantVo> getMerchantVoList() { | |||
| return merchantVoList; | |||
| } | |||
| public String getBuildingName() {return buildingName; } | |||
| public void setBuildingName(String _building) { | |||
| buildingName = _building; | |||
| } | |||
| public String getFloorName() { | |||
| return floorName; | |||
| } | |||
| public void setFloorName(String _floor) { | |||
| floorName = _floor; | |||
| } | |||
| public String getShopNumber() { | |||
| return shopNumber; | |||
| } | |||
| public void setShopNumber(String _shopNumber) { | |||
| shopNumber = _shopNumber; | |||
| } | |||
| public String getBaiduPoi() { | |||
| return baiduPoi; | |||
| } | |||
| public void setBaiduPoi(String _baiduPoi) { | |||
| baiduPoi = _baiduPoi; | |||
| } | |||
| public String getAddr() { | |||
| return addr; | |||
| } | |||
| public void setAddr(String _addr) { | |||
| addr = _addr; | |||
| public void setMerchantVoList(List<WxMerchantVo> merchantVoList) { | |||
| this.merchantVoList = merchantVoList; | |||
| } | |||
| public String getMerChantImgUrl() { | |||
| return merchantImgUrl; | |||
| } | |||
| public void setMerChantImgUrl(String _imgUrl) { | |||
| merchantImgUrl = _imgUrl; | |||
| } | |||
| public String getMerchantName() { | |||
| return merchantName; | |||
| } | |||
| public void setMerchantName(String _name) { | |||
| merchantName = _name; | |||
| } | |||
| public String getMerchantLinkPhone() { | |||
| return merchantLinkPhone; | |||
| public Date getBeginTime() { | |||
| return beginTime; | |||
| } | |||
| public void setMerchantLinkPhone(String _linkPhone) { | |||
| merchantLinkPhone = _linkPhone; | |||
| public void setBeginTime(Date _beginTime) { | |||
| beginTime = _beginTime; | |||
| } | |||
| public Integer getMerchantStatus() { | |||
| return merchantStatus; | |||
| public Date getEndTime() { | |||
| return endTime; | |||
| } | |||
| public void setMerchantStatus(Integer status) { | |||
| this.merchantStatus = status; | |||
| public void setEndTime(Date _endTime) { | |||
| endTime = _endTime; | |||
| } | |||
| public String getSalePriceStr() { | |||
| if(salePrice!=null) { | |||
| salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString(); | |||
| if(getSalePrice()!=null) { | |||
| salePriceStr = new BigDecimal(getSalePrice()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return salePriceStr; | |||
| } | |||
| @@ -424,8 +104,8 @@ public class WxCouponCVo implements Serializable { | |||
| } | |||
| public String getUsePriceStr() { | |||
| if(usePrice!=null) { | |||
| usePriceStr = new BigDecimal(usePrice).divide(new BigDecimal(100)).toString(); | |||
| if(getUsePrice()!=null) { | |||
| usePriceStr = new BigDecimal(getUsePrice()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return usePriceStr; | |||
| } | |||
| @@ -435,8 +115,8 @@ public class WxCouponCVo implements Serializable { | |||
| } | |||
| public String getPriceStr() { | |||
| if(price!=null) { | |||
| priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString(); | |||
| if(getPrice()!=null) { | |||
| priceStr = new BigDecimal(getPrice()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return priceStr; | |||
| } | |||
| @@ -445,84 +125,4 @@ public class WxCouponCVo implements Serializable { | |||
| this.priceStr = priceStr; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,CouponChannelId_ASC("`couponChannelId` ASC"),CouponChannelId_DESC("`couponChannelId` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,CoverImg_ASC("`coverImg` ASC"),CoverImg_DESC("`coverImg` DESC") | |||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||
| ,SubTitle_ASC("`subTitle` ASC"),SubTitle_DESC("`subTitle` DESC") | |||
| ,SalePrice_ASC("`salePrice` ASC"),SalePrice_DESC("`salePrice` DESC") | |||
| ,UsePrice_ASC("`usePrice` ASC"),UsePrice_DESC("`usePrice` DESC") | |||
| ,UseLimitQuantity_ASC("`useLimitQuantity` ASC"),UseLimitQuantity_DESC("`useLimitQuantity` DESC") | |||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||
| ,SendStartDate_ASC("`sendStartDate` ASC"),SendStartDate_DESC("`sendStartDate` DESC") | |||
| ,SendEndDate_ASC("`sendEndDate` ASC"),SendEndDate_DESC("`sendEndDate` DESC") | |||
| ,ValidType_ASC("`validType` ASC"),ValidType_DESC("`validType` DESC") | |||
| ,ValidStartDate_ASC("`validStartDate` ASC"),ValidStartDate_DESC("`validStartDate` DESC") | |||
| ,ValidEndDate_ASC("`validEndDate` ASC"),ValidEndDate_DESC("`validEndDate` DESC") | |||
| ,ValidDays_ASC("`validDays` ASC"),ValidDays_DESC("`validDays` DESC") | |||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | |||
| ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | |||
| ,RemainInventory_ASC("`remainInventory` ASC"),RemainInventory_DESC("`remainInventory` DESC") | |||
| ,Inventory_ASC("`inventory` ASC"),Inventory_DESC("`inventory` DESC") | |||
| ,Remark_ASC("`remark` ASC"),Remark_DESC("`remark` 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") | |||
| ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxCoupon.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<WxCoupon.Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(WxCoupon.Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new WxCoupon.Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(WxCoupon.Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,14 +1,11 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.math.BigDecimal; | |||
| import java.text.DecimalFormat; | |||
| import java.util.List; | |||
| /** | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| @@ -13,6 +14,8 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||
| List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel); | |||
| WxCouponCVo findVoDetail(WxCouponChannel wxCouponChannel); | |||
| void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | |||
| void offExpiriedCouponChannelByEndTime(); | |||
| @@ -11,10 +11,9 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| List<WxCoupon> findList(WxCoupon wxCoupon); | |||
| WxCouponCVo selectDetailForCUser(WxCouponChannel wxCouponChannel); | |||
| void reduceInventory(@Param("id")Long id,@Param("number")Integer number); | |||
| void offExpiriedCouponByValidDate(); | |||
| void offExpiriedCouponByMerchantStatus(); | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import java.util.Date; | |||
| @@ -28,7 +29,9 @@ public interface WxCouponChannelService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize); | |||
| WxCouponCVo findDetailVo(WxCouponChannel record); | |||
| /** | |||
| * 根据实体查询Vo分页列表 | |||
| @@ -36,7 +39,7 @@ public interface WxCouponChannelService { | |||
| * @param record | |||
| * @return | |||
| */ | |||
| List<WxCouponChannelVo> listAPI(WxCouponChannel record); | |||
| List<WxCouponChannelVo> listVo(WxCouponChannel record); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -49,8 +49,6 @@ public interface WxCouponService { | |||
| */ | |||
| void deleteById(Long id); | |||
| WxCouponCVo selectDetailForCUser(WxCouponChannel record); | |||
| ResultData updateCoupon(WxCoupon wxCoupon); | |||
| void reduceInventory(Long id,Integer number); | |||
| @@ -11,6 +11,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponChannelAddVo; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.enums.EnumCouponChannelStatus; | |||
| @@ -129,7 +130,6 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| return vo; | |||
| } | |||
| if(wxCoupon.getStatus()!=EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) { | |||
| logger.debug(wxCoupon.getId()+couponid+ErrorCode.COUPON_IS_TAKE_OFF.getMessage()); | |||
| vo.toCouponChannnelVo(wxCoupon,channelId); | |||
| @@ -191,20 +191,19 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| * @return | |||
| */ | |||
| @Override | |||
| public PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize) { | |||
| List<WxCouponChannelVo> wxCouponChannelVoList = new ArrayList<>(); | |||
| public PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize) { | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| return new PageInfo<>(wxCouponChannelMapper.findVoList(record)); | |||
| } | |||
| wxCouponChannelVoList = wxCouponChannelMapper.findVoList(record); | |||
| return new PageInfo<>(wxCouponChannelVoList); | |||
| @Override | |||
| public WxCouponCVo findDetailVo(WxCouponChannel record) { | |||
| return wxCouponChannelMapper.findVoDetail(record); | |||
| } | |||
| @Override | |||
| public List<WxCouponChannelVo> listAPI(WxCouponChannel record) { | |||
| List<WxCouponChannelVo> wxCouponChannelVoList = new ArrayList<>(); | |||
| public List<WxCouponChannelVo> listVo(WxCouponChannel record) { | |||
| return wxCouponChannelMapper.findVoList(record); | |||
| } | |||
| } | |||
| @@ -176,11 +176,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| public void deleteById(Long id) { | |||
| wxCouponMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public WxCouponCVo selectDetailForCUser(WxCouponChannel record) { | |||
| return wxCouponMapper.selectDetailForCUser(record); | |||
| } | |||
| @Override | |||
| @Transactional | |||
| @@ -83,7 +83,7 @@ public class WxGameServiceImpl implements WxGameService { | |||
| couponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); | |||
| couponChannelQ.setSubTargetId(record.getId()); | |||
| couponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||
| List<WxCouponChannelVo> wxCouponChannelVos = wxCouponChannelService.listAPI(couponChannelQ); | |||
| List<WxCouponChannelVo> wxCouponChannelVos = wxCouponChannelService.listVo(couponChannelQ); | |||
| Map<Long, WxCouponChannelVo> wxCouponChannelsMap = new HashMap<Long, WxCouponChannelVo>(); | |||
| for(WxCouponChannelVo wxCouponChannelVo: wxCouponChannelVos) { | |||
| wxCouponChannelsMap.put(wxCouponChannelVo.getCouponId(), wxCouponChannelVo); | |||
| @@ -100,7 +100,7 @@ | |||
| update wx_coupon_channel set status=#{status} where tenant_id=#{tenantId} and coupon_id=#{couponId} | |||
| </update> | |||
| <sql id="allVoColumns"> | |||
| <sql id="CouponChannelVoColumns"> | |||
| <include refid="allColumns" />, | |||
| c.remain_inventory,c.inventory,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type | |||
| </sql> | |||
| @@ -136,14 +136,66 @@ | |||
| </collection> | |||
| </resultMap> | |||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | |||
| select <include refid="allVoColumns" /> | |||
| select <include refid="CouponChannelVoColumns" /> | |||
| from wx_coupon_channel cc | |||
| left join wx_coupon c on cc.coupon_id = c.id | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <sql id="WxCouponCVoColumn"> | |||
| cc.id,cc.coupon_id,cc.target_ad,cc.begin_time,cc.end_time, | |||
| c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business | |||
| </sql> | |||
| <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <collection column="{productId=coupon_id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| javaType="java.util.ArrayList" | |||
| select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantVoList" > | |||
| </collection> | |||
| </resultMap> | |||
| <select id="findVoDetail" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="WxCouponCVoMap"> | |||
| select | |||
| <include refid="WxCouponCVoColumn"/> | |||
| from wx_coupon_channel cc | |||
| left join wx_coupon c on cc.coupon_id = c.id | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="countCoupon" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer"> | |||
| select count(distinct coupon_id) from wx_coupon_channel cc | |||
| <include refid="dynamicWhereConditions" /> | |||
| @@ -4,7 +4,6 @@ | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCoupon"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| @@ -30,7 +29,7 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` | |||
| `id`,`tenant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -44,10 +43,6 @@ | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| @@ -145,7 +140,6 @@ | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| @@ -153,86 +147,6 @@ | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <resultMap id="CUserResultMap" type="com.iformall.domain.vo.WxCouponCVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||
| <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/> | |||
| <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/> | |||
| <result column="name" jdbcType="VARCHAR" property="merchantName"/> | |||
| <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> | |||
| <result column="status" jdbcType="VARCHAR" property="merchantStatus"/> | |||
| <result column="addr" jdbcType="VARCHAR" property="addr"/> | |||
| <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/> | |||
| <result column="building_name" jdbcType="VARCHAR" property="buildingName"/> | |||
| <result column="floor_name" jdbcType="VARCHAR" property="floorName"/> | |||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | |||
| </resultMap> | |||
| <sql id="allCUserColumns"> | |||
| c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||
| m.img_url,m.name,m.link_phone,m.status, | |||
| s.addr,s.shop_number,s.baidu_poi, | |||
| mb.building_name,mf.floor_name, | |||
| cc.id,cc.coupon_id,cc.target_ad,cc.begin_time,cc.end_time | |||
| </sql> | |||
| <select id="selectDetailForCUser" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CUserResultMap"> | |||
| select | |||
| <include refid="allCUserColumns"/> | |||
| from wx_coupon_channel cc, wx_coupon c | |||
| left join wx_merchant m on c.merchant_id = m.id | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where cc.coupon_id = c.id | |||
| <if test=" null != id "> | |||
| and cc.id = #{id} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and c.id = #{couponId} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and c.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and cc.target_ad = #{targetAd} | |||
| </if> | |||
| </select> | |||
| <update id="reduceInventory"> | |||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number} | |||
| </update> | |||