| @@ -100,6 +100,10 @@ public class TenantInfoImpl implements TenantInfo { | |||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxActivityJoinMapper.updateStatus".equals(ms.getId())) | if ("com.iformall.mapper.WxActivityJoinMapper.updateStatus".equals(ms.getId())) | ||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxCouponMapper.findCouponList".equals(ms.getId())) | |||||
| return true; | |||||
| if ("com.iformall.mapper.WxCouponMapper.findCouponListCount".equals(ms.getId())) | |||||
| return true; | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -207,9 +207,24 @@ public class WxCoupon extends BaseEntity { | |||||
| @Transient | @Transient | ||||
| private Integer pressSuccCount; | private Integer pressSuccCount; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "过滤可投放0不过滤 1过滤", name = "filterCanPut") | @io.swagger.annotations.ApiModelProperty(value = "过滤可投放0不过滤 1过滤", name = "filterCanPut") | ||||
| @Transient | @Transient | ||||
| private Integer filterCanPut; | private Integer filterCanPut; | ||||
| //审批模板id 卷、卡、拼团、砍价 | |||||
| @Transient | |||||
| private Long couponModelId; | |||||
| @Transient | |||||
| private Long cardModelId; | |||||
| @Transient | |||||
| private Long groupModelId; | |||||
| @Transient | |||||
| private Long pressModelId; | |||||
| @Transient | |||||
| private Integer limitStart; | |||||
| @Transient | |||||
| private Integer limitEnd; | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") | ||||
| @@ -9,7 +9,7 @@ public enum EnumCouponType { | |||||
| // 100.消费卡 | // 100.消费卡 | ||||
| COUPON_MANJIAN(1, "满减券"), | COUPON_MANJIAN(1, "满减券"), | ||||
| COUPON_DAIJIN(2, "代金券"), | COUPON_DAIJIN(2, "代金券"), | ||||
| COUPON_TUANGOU(3, "团购券"), | |||||
| COUPON_TUANGOU(3, "团购券"),//弃用 | |||||
| COUPON_LIPIN(4, "礼品券"), | COUPON_LIPIN(4, "礼品券"), | ||||
| COUPON_TINGCHE(5, "停车券"), | COUPON_TINGCHE(5, "停车券"), | ||||
| COUPON_MULTIMCH(6, "通用券"), | COUPON_MULTIMCH(6, "通用券"), | ||||
| @@ -17,7 +17,6 @@ public enum EnumCouponType { | |||||
| COUPON_GROUP(9, "团购券"), | COUPON_GROUP(9, "团购券"), | ||||
| COUPON_CREDIT(50,"积分券"), | COUPON_CREDIT(50,"积分券"), | ||||
| COUPON_CREDIT_PARK(51,"积分停车券"), | COUPON_CREDIT_PARK(51,"积分停车券"), | ||||
| CARD_MULTIMCH(100, "消费卡"), | CARD_MULTIMCH(100, "消费卡"), | ||||
| ; | ; | ||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by luozukai | |||||
| */ | |||||
| public enum EnumFilterPut{ | |||||
| NO(0, "不过滤"), | |||||
| ; | |||||
| public static EnumFilterPut getEnum(Integer code) { | |||||
| for (EnumFilterPut value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumFilterPut(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -86,4 +86,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| // 库存,有效期修改 | // 库存,有效期修改 | ||||
| int updateStockAndValidDate(WxCoupon wxCoupon); | int updateStockAndValidDate(WxCoupon wxCoupon); | ||||
| WxCoupon findCouponModel(WxCoupon wxCoupon); | |||||
| Integer findCouponListCount(WxCoupon wxCoupon); | |||||
| } | } | ||||
| @@ -2,7 +2,6 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponCar; | import com.iformall.domain.po.WxCouponCar; | ||||
| import com.iformall.domain.vo.WxCouponCarVo; | import com.iformall.domain.vo.WxCouponCarVo; | ||||
| import com.iformall.mapper.WxCouponCarMapper; | import com.iformall.mapper.WxCouponCarMapper; | ||||
| @@ -69,6 +69,18 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| PageInfo<WxCoupon> page = null; | PageInfo<WxCoupon> page = null; | ||||
| if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) | if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) | ||||
| wxCoupon.setStatus(null); | wxCoupon.setStatus(null); | ||||
| //除了a端列表 其他默认需要过滤 | |||||
| if(!EnumFilterPut.NO.equals(wxCoupon.getFilterCanPut())) { | |||||
| WxCoupon couponModel = wxCouponMapper.findCouponModel(wxCoupon); | |||||
| if (couponModel != null) { | |||||
| wxCoupon.setCouponModelId(couponModel.getCouponModelId()); | |||||
| wxCoupon.setCardModelId(couponModel.getCardModelId()); | |||||
| wxCoupon.setGroupModelId(couponModel.getGroupModelId()); | |||||
| wxCoupon.setPressModelId(couponModel.getPressModelId()); | |||||
| } | |||||
| } | |||||
| page = listAsPage(wxCoupon, pageNum, pageSize); | page = listAsPage(wxCoupon, pageNum, pageSize); | ||||
| List<WxCoupon> wxCouponList = page.getList(); | List<WxCoupon> wxCouponList = page.getList(); | ||||
| @@ -111,11 +123,25 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponList(record)); | |||||
| int total = wxCouponMapper.findCouponListCount(record); | |||||
| int pages; | |||||
| if(total % pageSize == 0){ | |||||
| pages = total / pageSize; | |||||
| }else{ | |||||
| pages = total / pageSize +1; | |||||
| } | |||||
| record.setLimitStart((pageIndex -1) * pageSize); | |||||
| record.setLimitEnd(pageSize); | |||||
| List<WxCoupon> list = wxCouponMapper.findCouponList(record); | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| PageInfo<WxCoupon> pageInfo = new PageInfo<>(list); | |||||
| pageInfo.setPages(pages); | |||||
| pageInfo.setTotal(total); | |||||
| PageHelper.clearPage(); | |||||
| return pageInfo; | |||||
| } | } | ||||
| @@ -233,6 +233,9 @@ | |||||
| and `credit_refund` = #{creditRefund} | and `credit_refund` = #{creditRefund} | ||||
| </if> | </if> | ||||
| <if test=" 1 == filterCanPut "> | |||||
| and `credit_refund` = #{creditRefund} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| @@ -248,7 +251,6 @@ | |||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| @@ -256,7 +258,7 @@ | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon | from wx_coupon | ||||
| <include refid="dynamicWhereConditions"/> | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | </select> | ||||
| <update id="updateStockAndValidDate" parameterType="com.iformall.domain.po.WxCoupon"> | <update id="updateStockAndValidDate" parameterType="com.iformall.domain.po.WxCoupon"> | ||||
| @@ -405,6 +407,22 @@ | |||||
| and c.`auto_refund` = #{autoRefund} | and c.`auto_refund` = #{autoRefund} | ||||
| </if> | </if> | ||||
| <!--如果配置了审批模板,需要过滤投放审批状态--> | |||||
| <if test="0 != filterCanPut or null ==filterCanPut "> | |||||
| <if test=" null != pressModelId "> | |||||
| and if(type=8,put_apply_status =2,1=1) | |||||
| </if> | |||||
| <if test=" null != groupModelId "> | |||||
| and if(type=9,put_apply_status =2,1=1) | |||||
| </if> | |||||
| <if test=" null != cardModelId "> | |||||
| and if(type=100,put_apply_status =2,1=1) | |||||
| </if> | |||||
| <if test=" null != couponModelId "> | |||||
| and if(type !=8 and type !=9 and type!=100,put_apply_status =2,1=1) | |||||
| </if> | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and c.id in | and c.id in | ||||
| @@ -420,12 +438,6 @@ | |||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <!-- | |||||
| <if test="0 == status "> | |||||
| and c.id not in | |||||
| (select coupon_id from wx_coupon_channel where tenant_id=#{tenantId} and status = 0) | |||||
| </if>--> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| @@ -434,8 +446,18 @@ | |||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon c | from wx_coupon c | ||||
| <include refid="dynamicWhereConditionsForCoupon"/> | <include refid="dynamicWhereConditionsForCoupon"/> | ||||
| limit #{limitStart},#{limitEnd} | |||||
| </select> | </select> | ||||
| <select id="findCouponListCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Integer"> | |||||
| select | |||||
| count(*) | |||||
| from wx_coupon c | |||||
| <include refid="dynamicWhereConditionsForCoupon"/> | |||||
| </select> | |||||
| <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> | <resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| @@ -831,4 +853,12 @@ where cpd.tenant_id=#{tenantId} | |||||
| and ct.status = 0 | and ct.status = 0 | ||||
| </select> | </select> | ||||
| <select id="findCouponModel" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||||
| select | |||||
| max(case type when 9 then model_id else 0 end) couponModelId, | |||||
| max(case type when 10 then model_id else 0 end) cardModelId, | |||||
| max(case type when 11 then model_id else 0 end) groupModelId, | |||||
| max(case type when 12 then model_id else 0 end) pressModelId | |||||
| from wx_flow_config where type in(9,10,11,12) and tenant_id=#{tenantId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -42,4 +42,6 @@ | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||