| @@ -117,7 +117,22 @@ public class WxCouponController extends BaseController | |||||
| dto.setWxMerchant(merchant); | dto.setWxMerchant(merchant); | ||||
| return new ResultData(Result.SUCCESS,"查询成功",dto); | return new ResultData(Result.SUCCESS,"查询成功",dto); | ||||
| } | } | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("send/list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| wxCoupon.setStatus(1); | |||||
| PageInfo<WxCoupon> page = null; | |||||
| page = wxCouponService.findCanSendList(wxCoupon, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | } | ||||
| @@ -38,6 +38,7 @@ public class WxCouponSendController extends BaseController | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend,Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCouponSend wxCouponSend,Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | ||||
| wxCouponSend.setTenantId(getTenantId()); | |||||
| final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -50,11 +51,12 @@ public class WxCouponSendController extends BaseController | |||||
| return new ResultData(Result.ERROR,"已经添加过该券"); | return new ResultData(Result.ERROR,"已经添加过该券"); | ||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); | WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); | ||||
| if(wxCoupon.getSendEndDate().after(new Date())){ | |||||
| if(wxCoupon.getSendEndDate().before(new Date())){ | |||||
| return new ResultData(Result.ERROR,"发放日期异常"); | return new ResultData(Result.ERROR,"发放日期异常"); | ||||
| } | } | ||||
| wxCouponSend.setMerchantId(wxCoupon.getMerchantId()); | wxCouponSend.setMerchantId(wxCoupon.getMerchantId()); | ||||
| wxCouponSend.setType(wxCoupon.getType()); | |||||
| wxCouponSend.setTenantId(wxCoupon.getTenantId()); | wxCouponSend.setTenantId(wxCoupon.getTenantId()); | ||||
| wxCouponSend.setTitle(wxCoupon.getTitle()); | wxCouponSend.setTitle(wxCoupon.getTitle()); | ||||
| wxCouponSend.setSendStartTime(wxCoupon.getSendStartDate()); | wxCouponSend.setSendStartTime(wxCoupon.getSendStartDate()); | ||||
| @@ -68,6 +70,7 @@ public class WxCouponSendController extends BaseController | |||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | ||||
| wxCouponSend.setTenantId(getTenantId()); | |||||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | wxCouponSendService.saveOrUpdate(wxCouponSend); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -12,6 +12,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findEnableList(WxCoupon wxCoupon); | List<WxCoupon> findEnableList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findCanSendList(WxCoupon record); | |||||
| @@ -48,7 +48,10 @@ public interface WxCouponService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * | |||||
| */ | |||||
| PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| @@ -50,12 +50,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCouponMapper.deleteByPrimaryKey(id); | wxCouponMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCanSendList(record)); | |||||
| } | |||||
| } | } | ||||
| @@ -327,6 +327,145 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <sql id="findCanSendConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != coverImg "> | |||||
| and `cover_img` like concat('%', #{coverImg},'%') | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != subTitle "> | |||||
| and `sub_title` like concat('%', #{subTitle},'%') | |||||
| </if> | |||||
| <if test=" null != salePrice "> | |||||
| and `sale_price` = #{salePrice} | |||||
| </if> | |||||
| <if test=" null != usePrice "> | |||||
| and `use_price` = #{usePrice} | |||||
| </if> | |||||
| <if test=" null != useLimitQuantity "> | |||||
| and `use_limit_quantity` = #{useLimitQuantity} | |||||
| </if> | |||||
| <if test=" null != targetAd "> | |||||
| and `target_ad` = #{targetAd} | |||||
| </if> | |||||
| <if test=" null != sendType "> | |||||
| and `send_type` = #{sendType} | |||||
| </if> | |||||
| and `send_end_date` >= NOW() | |||||
| and `send_start_date` <= NOW() | |||||
| <if test=" null != validType "> | |||||
| and `valid_type` = #{validType} | |||||
| </if> | |||||
| <if test=" null != validStartDate "> | |||||
| and `valid_start_date` = #{validStartDate} | |||||
| </if> | |||||
| <if test=" null != validEndDate "> | |||||
| and `valid_end_date` = #{validEndDate} | |||||
| </if> | |||||
| <if test=" null != validDays "> | |||||
| and `valid_days` = #{validDays} | |||||
| </if> | |||||
| <if test=" null != detail "> | |||||
| and `detail` like concat('%', #{detail},'%') | |||||
| </if> | |||||
| <if test=" null != price "> | |||||
| and `price` = #{price} | |||||
| </if> | |||||
| <if test=" null != remainInventory "> | |||||
| and `remain_inventory` = #{remainInventory} | |||||
| </if> | |||||
| <if test=" null != inventory "> | |||||
| and `inventory` = #{inventory} | |||||
| </if> | |||||
| <if test=" null != remark "> | |||||
| and `remark` like concat('%', #{remark},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` in (0,1,2) | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != business "> | |||||
| and `business` like concat('%', #{business},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon | select <include refid="allColumns" /> from wx_coupon | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| @@ -337,6 +476,13 @@ | |||||
| <include refid="findEnableConditions" /> | <include refid="findEnableConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findCanSendList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon | |||||
| <include refid="findCanSendConditions" /> | |||||
| </select> | |||||
| @@ -72,7 +72,7 @@ | |||||
| and `send_end_time` = #{sendEndTime} | and `send_end_time` = #{sendEndTime} | ||||
| </if> | </if> | ||||
| <if test=" null != status and status==1"> | |||||
| <if test=" null != status and status==0"> | |||||
| and `send_end_time` >= NOW() | and `send_end_time` >= NOW() | ||||
| and `send_start_time` <= NOW() | and `send_start_time` <= NOW() | ||||
| </if> | </if> | ||||