| @@ -39,6 +39,7 @@ public class WxCouponChannelController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -62,31 +63,8 @@ public class WxCouponChannelController extends BaseController { | |||||
| public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { | public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponChannelController::update"); | logger.debug("[" + getIpAddr() + "] WxCouponChannelController::update"); | ||||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | wxCouponChannel.setTenantId(getUser().getTenantId()); | ||||
| if (wxCouponChannel.getCouponId() != null && wxCouponChannel.getStatus() != null) { | |||||
| WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | |||||
| if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) | |||||
| && wxCouponChannel.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { | |||||
| WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId()); | |||||
| if (wxCoupon == null) | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| //查找是否该券 在该频道有其他上架 | |||||
| WxCouponChannel query = new WxCouponChannel(); | |||||
| query.setTenantId(orignal.getTenantId()); | |||||
| query.setCouponId(orignal.getCouponId()); | |||||
| query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());//已上架 | |||||
| query.setTargetAd(orignal.getTargetAd()); | |||||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(query, 1, 1).getList(); | |||||
| if (list != null && list.size() > 0) { | |||||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED); | |||||
| } | |||||
| } | |||||
| } | |||||
| wxCouponChannelService.saveOrUpdate(wxCouponChannel); | |||||
| return new ResultData(); | |||||
| return wxCouponChannelService.saveOrUpdate(wxCouponChannel); | |||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @@ -42,7 +42,7 @@ public class WxDeviceController extends BaseController { | |||||
| @ApiOperation("添加设备") | @ApiOperation("添加设备") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public Result add(@ModelAttribute WxDevice wxDevice) { | |||||
| public Result add(@RequestBody WxDevice wxDevice) { | |||||
| WxDevice record = new WxDevice(); | WxDevice record = new WxDevice(); | ||||
| record.setDeviceId(wxDevice.getDeviceId()); | record.setDeviceId(wxDevice.getDeviceId()); | ||||
| @@ -59,7 +59,7 @@ public class WxDeviceController extends BaseController { | |||||
| @ApiOperation("更新设备") | @ApiOperation("更新设备") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public Result update(@ModelAttribute WxDevice wxDevice) { | |||||
| public Result update(@RequestBody WxDevice wxDevice) { | |||||
| if (wxDevice == null) | if (wxDevice == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| if (wxDevice.getId() == null) | if (wxDevice.getId() == null) | ||||
| @@ -71,7 +71,7 @@ public class WxDeviceController extends BaseController { | |||||
| @ApiOperation("设备详情") | @ApiOperation("设备详情") | ||||
| @GetMapping("detail") | @GetMapping("detail") | ||||
| public Result detail(Long id) { | |||||
| public Result detail(@RequestParam Long id) { | |||||
| if (id == null) | if (id == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| WxDevice wxDevice = wxDeviceService.getById(id); | WxDevice wxDevice = wxDeviceService.getById(id); | ||||
| @@ -83,7 +83,7 @@ public class WxDeviceController extends BaseController { | |||||
| @ApiOperation("删除设备") | @ApiOperation("删除设备") | ||||
| @PostMapping("delete") | @PostMapping("delete") | ||||
| public Result delete(Long id) { | |||||
| public Result delete(@RequestParam Long id) { | |||||
| if (id == null) | if (id == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| WxDevice wxDevice = new WxDevice(); | WxDevice wxDevice = new WxDevice(); | ||||
| @@ -53,7 +53,7 @@ public class WxScreenAdController extends BaseController { | |||||
| @ApiOperation("添加广告") | @ApiOperation("添加广告") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public Result add(@ModelAttribute WxScreenAd wxScreenAd) { | |||||
| public Result add(@RequestBody WxScreenAd wxScreenAd) { | |||||
| wxScreenAd.setStatus(EnumScreenAdStatus.VALID.getCode()); | wxScreenAd.setStatus(EnumScreenAdStatus.VALID.getCode()); | ||||
| wxScreenAd.setTenantId(getTenantId()); | wxScreenAd.setTenantId(getTenantId()); | ||||
| wxScreenAdService.saveOrUpdate(wxScreenAd); | wxScreenAdService.saveOrUpdate(wxScreenAd); | ||||
| @@ -62,7 +62,7 @@ public class WxScreenAdController extends BaseController { | |||||
| @ApiOperation("更新广告") | @ApiOperation("更新广告") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public Result update(@ModelAttribute WxScreenAd wxScreenAd) { | |||||
| public Result update(@RequestBody WxScreenAd wxScreenAd) { | |||||
| if (wxScreenAd == null) | if (wxScreenAd == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| if (wxScreenAd.getId() == null) | if (wxScreenAd.getId() == null) | ||||
| @@ -74,7 +74,7 @@ public class WxScreenAdController extends BaseController { | |||||
| @ApiOperation("广告详情") | @ApiOperation("广告详情") | ||||
| @GetMapping("detail") | @GetMapping("detail") | ||||
| public Result detail(Long id) { | |||||
| public Result detail(@RequestParam Long id) { | |||||
| if (id == null) | if (id == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| WxScreenAd wxScreenAd = wxScreenAdService.getById(id); | WxScreenAd wxScreenAd = wxScreenAdService.getById(id); | ||||
| @@ -93,7 +93,7 @@ public class WxScreenAdController extends BaseController { | |||||
| @ApiOperation("删除广告") | @ApiOperation("删除广告") | ||||
| @PostMapping("delete") | @PostMapping("delete") | ||||
| public Result delete(Long id) { | |||||
| public Result delete(@RequestParam Long id) { | |||||
| if (id == null) | if (id == null) | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| WxScreenAd wxScreenAd = new WxScreenAd(); | WxScreenAd wxScreenAd = new WxScreenAd(); | ||||
| @@ -23,6 +23,9 @@ public class CouponExpiringSchedule { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponSendMapper wxCouponSendMapper; | private WxCouponSendMapper wxCouponSendMapper; | ||||
| @Autowired | |||||
| private WxScreenAdMapper wxScreenAdMapper; | |||||
| @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券 | @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| @@ -41,7 +44,6 @@ public class CouponExpiringSchedule { | |||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); | wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); | ||||
| } | } | ||||
| @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架主动领取 | @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架主动领取 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void couponChannelExpiringSchedule() { | public void couponChannelExpiringSchedule() { | ||||
| @@ -51,6 +53,12 @@ public class CouponExpiringSchedule { | |||||
| wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(); | wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(); | ||||
| } | } | ||||
| @Scheduled(cron = "0 15 0 * * ?") // 每天凌晨00:15 下架券广告 | |||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||||
| public void screenAdExpiringSchedule() { | |||||
| wxScreenAdMapper.offScreeAdByCouponChannelStatus(); | |||||
| } | |||||
| @Scheduled(cron = "0 0,1,2,3 0/1 * * ?") // 每小时 0, 1 ,2 ,3 分钟(整点)执行//限时抢购 | @Scheduled(cron = "0 0,1,2,3 0/1 * * ?") // 每小时 0, 1 ,2 ,3 分钟(整点)执行//限时抢购 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void couponChannel2ExpiringSchedule() { | public void couponChannel2ExpiringSchedule() { | ||||
| @@ -10,4 +10,7 @@ public interface WxScreenAdMapper extends CommonMapper<WxScreenAd, Long> { | |||||
| List<WxScreenAd> findList(WxScreenAd wxScreenAd); | List<WxScreenAd> findList(WxScreenAd wxScreenAd); | ||||
| void offScreeAdByCouponChannelStatus(); | |||||
| void updateStatusByCouponChannelId(WxScreenAd wxScreenAd); | |||||
| } | } | ||||
| @@ -61,7 +61,7 @@ public interface WxCouponChannelService { | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxCouponChannel record); | |||||
| ResultData saveOrUpdate(WxCouponChannel record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -54,5 +54,8 @@ public interface WxScreenAdService { | |||||
| List<WxScreenAd> findList(WxScreenAd record); | List<WxScreenAd> findList(WxScreenAd record); | ||||
| void updateStatusByCouponChannelId(Long couponChannelId, String tenantId, int status); | |||||
| void updateStatusByCouponId(Long couponId, String tenantId, int status); | |||||
| } | } | ||||
| @@ -22,6 +22,7 @@ import com.iformall.mapper.WxCouponMerchantMapper; | |||||
| import com.iformall.mapper.WxMerchantMapper; | import com.iformall.mapper.WxMerchantMapper; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxScreenAdService; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -40,6 +41,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| WxMerchantMapper wxMerchantMapper; | WxMerchantMapper wxMerchantMapper; | ||||
| @Autowired | @Autowired | ||||
| WxCouponMerchantMapper wxCouponMerchantMapper; | WxCouponMerchantMapper wxCouponMerchantMapper; | ||||
| @Autowired | |||||
| WxScreenAdService wxScreenAdService; | |||||
| /** | /** | ||||
| * B端业务端 | * B端业务端 | ||||
| * @param record | * @param record | ||||
| @@ -58,15 +61,47 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxCouponChannel record) { | |||||
| public ResultData saveOrUpdate(WxCouponChannel record) { | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxCouponChannelMapper.insertSelective(record); | wxCouponChannelMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| if (record.getCouponId() != null && record.getStatus() != null) { | |||||
| WxCouponChannel orignal = getById(record.getId()); | |||||
| if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) | |||||
| && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { | |||||
| WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId()); | |||||
| if (wxCoupon == null) | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| //查找是否该券 在该频道有其他上架 | |||||
| WxCouponChannel query = new WxCouponChannel(); | |||||
| query.setTenantId(orignal.getTenantId()); | |||||
| query.setCouponId(orignal.getCouponId()); | |||||
| query.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());//已上架 | |||||
| query.setTargetAd(orignal.getTargetAd()); | |||||
| List<WxCouponChannel> list = wxCouponChannelMapper.findList(query); | |||||
| if (list != null && list.size() > 0) { | |||||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (record.getStatus() != null) { | |||||
| WxCouponChannel orignal = getById(record.getId()); | |||||
| if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()) | |||||
| && record.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) { | |||||
| wxScreenAdService.updateStatusByCouponChannelId(record.getId(),record.getTenantId(),EnumScreenAdStatus.INVALID.getCode()); | |||||
| } | |||||
| } | |||||
| wxCouponChannelMapper.updateByPrimaryKeySelective(record); | wxCouponChannelMapper.updateByPrimaryKeySelective(record); | ||||
| } | } | ||||
| return new ResultData(); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -171,7 +206,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | WxCouponChannel wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.setEndTime(endTime); | wxCouponChannel.setEndTime(endTime); | ||||
| wxCouponChannel.setStatus(0); | |||||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||||
| wxCouponChannel.setBeginTime(beginTime); | wxCouponChannel.setBeginTime(beginTime); | ||||
| wxCouponChannel.setCouponId(couponid); | wxCouponChannel.setCouponId(couponid); | ||||
| wxCouponChannel.setType(wxCoupon.getType()); | wxCouponChannel.setType(wxCoupon.getType()); | ||||
| @@ -10,16 +10,14 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponMerchant; | import com.iformall.domain.po.WxCouponMerchant; | ||||
| import com.iformall.domain.po.WxScreenAd; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.mapper.WxCouponMerchantMapper; | import com.iformall.mapper.WxCouponMerchantMapper; | ||||
| import com.iformall.mapper.WxMerchantMapper; | import com.iformall.mapper.WxMerchantMapper; | ||||
| import com.iformall.service.WxCouponChannelService; | |||||
| import com.iformall.service.WxCouponSendService; | |||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxOrderService; | |||||
| import com.iformall.service.*; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -52,6 +50,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Autowired | @Autowired | ||||
| WxOrderService wxOrderService; | WxOrderService wxOrderService; | ||||
| @Autowired | |||||
| WxScreenAdService wxScreenAdService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type) { | public PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type) { | ||||
| @@ -242,8 +242,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| .updateStatusByCouponId(record.getId(), record.getTenantId(), EnumCouponSendStatus.INVALID.getCode()); | .updateStatusByCouponId(record.getId(), record.getTenantId(), EnumCouponSendStatus.INVALID.getCode()); | ||||
| //下架所有已砍价券 | //下架所有已砍价券 | ||||
| wxOrderService.updateStatusByPressCouponId(record.getId(), record.getTenantId(), EnumOrderStatus.ORDER_STATUS_PRESS_CANCEL.getCode()); | wxOrderService.updateStatusByPressCouponId(record.getId(), record.getTenantId(), EnumOrderStatus.ORDER_STATUS_PRESS_CANCEL.getCode()); | ||||
| //下架所有相关广告 | |||||
| wxScreenAdService.updateStatusByCouponId(record.getId(), record.getTenantId(), EnumScreenAdStatus.INVALID.getCode()); | |||||
| } | } | ||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| wxCouponMapper.updateByPrimaryKeySelective(record); | wxCouponMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -8,8 +8,10 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.WxScreenAd; | import com.iformall.domain.po.WxScreenAd; | ||||
| import com.iformall.enums.EnumScreenAdType; | import com.iformall.enums.EnumScreenAdType; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | |||||
| import com.iformall.mapper.WxScreenAdMapper; | import com.iformall.mapper.WxScreenAdMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxScreenAdService; | import com.iformall.service.WxScreenAdService; | ||||
| @@ -38,6 +40,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| WxCouponChannelMapper wxCouponChannelMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxScreenAd> listAsPage(WxScreenAd record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxScreenAd> listAsPage(WxScreenAd record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxScreenAdMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxScreenAdMapper.findList(record)); | ||||
| @@ -76,6 +81,35 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| } | } | ||||
| @Override | |||||
| public void updateStatusByCouponChannelId(Long couponChannelId, String tenantId, int status) { | |||||
| WxScreenAd wxScreenAd = new WxScreenAd(); | |||||
| wxScreenAd.setTenantId(tenantId); | |||||
| wxScreenAd.setStatus(status); | |||||
| wxScreenAd.setTargetId(couponChannelId); | |||||
| wxScreenAd.setUpdateDate(new Date()); | |||||
| wxScreenAdMapper.updateStatusByCouponChannelId(wxScreenAd); | |||||
| } | |||||
| @Override | |||||
| public void updateStatusByCouponId(Long couponId, String tenantId, int status) { | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTenantId(tenantId); | |||||
| wxCouponChannel.setCouponId(couponId); | |||||
| List<WxCouponChannel> list = wxCouponChannelMapper.findList(wxCouponChannel); | |||||
| list.stream().forEach(cc->{ | |||||
| WxScreenAd wxScreenAd = new WxScreenAd(); | |||||
| wxScreenAd.setTenantId(tenantId); | |||||
| wxScreenAd.setStatus(status); | |||||
| wxScreenAd.setTargetId(cc.getId()); | |||||
| wxScreenAd.setUpdateDate(new Date()); | |||||
| wxScreenAdMapper.updateStatusByCouponChannelId(wxScreenAd); | |||||
| }); | |||||
| } | |||||
| private void setQrcode(WxScreenAd record){ | private void setQrcode(WxScreenAd record){ | ||||
| if (record.getTargetId() != null && | if (record.getTargetId() != null && | ||||
| @@ -102,7 +102,8 @@ | |||||
| </select> | </select> | ||||
| <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel"> | <update id="updateStatusByCouponId" parameterType="com.iformall.domain.po.WxCouponChannel"> | ||||
| update wx_coupon_channel set status=#{status} | |||||
| update wx_coupon_channel | |||||
| set status=#{status}, update_date=#{updateDate} | |||||
| where coupon_id=#{couponId} | where coupon_id=#{couponId} | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and tenant_id = #{tenantId} | and tenant_id = #{tenantId} | ||||
| @@ -64,12 +64,28 @@ | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxDevice" resultMap="BaseResultMap"> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxScreenAd" resultMap="BaseResultMap"> | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_screen_ad | from wx_screen_ad | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <update id="updateStatusByCouponChannelId" parameterType="com.iformall.domain.po.WxScreenAd"> | |||||
| update wx_screen_ad sa | |||||
| set sa.status = #{status}, sa.update_date = #{updateDate} | |||||
| where sa.target_id = #{targetId} | |||||
| <if test=" null != tenantId "> | |||||
| and tenant_id = #{tenantId} | |||||
| </if> | |||||
| </update> | |||||
| <update id="offScreeAdByCouponChannelStatus"> | |||||
| update wx_screen_ad sa, wx_coupon_channel cc | |||||
| SET sa.status = 1, sa.update_date = now() | |||||
| where sa.status = 0 | |||||
| and sa.target_id = cc.id | |||||
| and cc.status = 1 | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||