公众号推送
This commit is contained in:
@@ -170,4 +170,15 @@ public class ShopUserController {
|
||||
return CzgResult.success(shopUserService.getPushEventUser(smsPushEventUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公众号推送任务用户列表
|
||||
* @param pushEventUser 公众号推送任务用户
|
||||
* @return 用户列表
|
||||
*/
|
||||
@PostMapping("/getAcPushEventUser")
|
||||
public CzgResult<Page<ShopUser>> getAcPushEventUser(@RequestBody @Validated SmsPushEventUser pushEventUser) {
|
||||
AssertUtil.isNull(pushEventUser.getShopId(), "店铺id不能为空");
|
||||
return CzgResult.success(shopUserService.getAcPushEventUser(pushEventUser));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.market.dto.AcPushEventDTO;
|
||||
import com.czg.market.service.AcPushEventService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 公众号推送
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/acPushEvent")
|
||||
public class AcPushEventController {
|
||||
@Resource
|
||||
private AcPushEventService pushEventService;
|
||||
|
||||
/**
|
||||
* 公众号推送:列表
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<Page<AcPushEventDTO>> getPushEventPage(@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) Integer status,
|
||||
@RequestParam(required = false) Long id) {
|
||||
Page<AcPushEventDTO> data = pushEventService.getPushEventPage(page, size, StpKit.USER.getShopId(), status, id);
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号推送:新增
|
||||
*/
|
||||
@PostMapping
|
||||
public CzgResult<Void> addPushEvent(@RequestBody @Validated(InsertGroup.class) AcPushEventDTO param) {
|
||||
param.setShopId(StpKit.USER.getShopId());
|
||||
pushEventService.addPushEvent(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号推送:更新
|
||||
*/
|
||||
@PutMapping
|
||||
public CzgResult<Void> upPushEvent(@RequestBody @Validated(UpdateGroup.class) AcPushEventDTO param) {
|
||||
param.setShopId(StpKit.USER.getShopId());
|
||||
pushEventService.upPushEvent(param);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号推送:删除任务
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public CzgResult<Void> deletePushEvent(@PathVariable Long id) {
|
||||
pushEventService.deletePushEvent(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.czg.config;
|
||||
|
||||
import com.czg.account.service.ShopTableService;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.service.AcPushEventService;
|
||||
import com.czg.market.service.MkShopCouponRecordService;
|
||||
import com.czg.market.service.SmsPushEventService;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
@@ -37,6 +38,8 @@ public class RedisKeyExpirationListener implements MessageListener {
|
||||
private MkShopCouponRecordService mkShopCouponRecordService;
|
||||
@Resource
|
||||
private SmsPushEventService smsPushEventService;
|
||||
@Resource
|
||||
private AcPushEventService acPushEventService;
|
||||
|
||||
|
||||
//redis key失效监听
|
||||
@@ -73,6 +76,10 @@ public class RedisKeyExpirationListener implements MessageListener {
|
||||
log.info("监听到短信定时发放优惠券,sms_push_event任务Id: {}", expiredKey);
|
||||
String eventId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_SMS.length());
|
||||
smsPushEventService.sendPushEventCoupon(eventId);
|
||||
} else if (expiredKey.startsWith(RedisCst.classKeyExpired.EXPIRED_WECHAT)) {
|
||||
log.info("监听到公众号推送优惠券,ac_push_event任务Id: {}", expiredKey);
|
||||
String eventId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_WECHAT.length());
|
||||
acPushEventService.sendPushEventCoupon(eventId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user