生日有礼修改

This commit is contained in:
张松 2025-10-16 16:16:58 +08:00
parent e1e2061d4b
commit 75ce21c95c
3 changed files with 16 additions and 3 deletions

View File

@ -24,10 +24,15 @@ import java.time.LocalDateTime;
@RestController
@RequestMapping("/admin/birthdayGift")
public class BirthdayGiftController {
@Resource
private MkBirthdayGiftService service;
@GetMapping("/test")
public CzgResult<String> test() {
service.deliver();
return CzgResult.success();
}
/**
* 配置信息获取
* 权限标识: activate:list

View File

@ -63,6 +63,8 @@ public class MkBirthdayGiftRecord implements Serializable {
private String pushResp;
private String templateCode;
private String templateContent;
private String phone;
private Long templateId;
}

View File

@ -147,7 +147,12 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
public void deliver() {
list(new QueryWrapper().eq(MkBirthdayGift::getIsEnable, 1)).forEach(birthdayGift -> {
if (StrUtil.isNotBlank(birthdayGift.getConfigList())) {
SmsShopTemplate shopTemplate = smsShopTemplateService.getById(birthdayGift.getTemplateId());
SmsShopTemplate shopTemplate;
if (birthdayGift.getTemplateId() != null) {
shopTemplate = smsShopTemplateService.getById(birthdayGift.getTemplateId());
} else {
shopTemplate = null;
}
ShopInfo shopInfo = shopInfoService.getById(birthdayGift.getMainShopId());
FunUtils.safeRunVoid(() -> {
JSONArray.parseArray(birthdayGift.getConfigList()).toJavaList(MkBirthdayGiftConfig.class).forEach(config -> {
@ -174,7 +179,8 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
.setPushStatus(birthdayGift.getSendSms() == 1 ?
TableValueConstant.BirthdayGiftRecord.PushStatus.WAIT_PUSH.getCode() : TableValueConstant.BirthdayGiftRecord.PushStatus.NO_PUSH.getCode())
.setMainShopId(birthdayGift.getMainShopId()).setBirthday(DateUtil.parseDate(shopUser.getBirthDay()).toLocalDateTime().toLocalDate())
.setSourceId(birthdayGift.getId()).setTemplateCode(shopTemplate.getTemplateCode()).setTemplateContent(JSONObject.toJSONString(Map.of(
.setPhone(shopUser.getPhone()).setTemplateId(shopTemplate == null ? null : shopTemplate.getId())
.setSourceId(birthdayGift.getId()).setTemplateCode(shopTemplate == null ? null : shopTemplate.getTemplateCode()).setTemplateContent(JSONObject.toJSONString(Map.of(
"用户昵称", shopUser.getNickName(),
"店铺名称", shopInfo.getShopName(),
"数量", config.getCouponInfoList() != null ? config.getCouponInfoList().stream().map(CouponInfoDTO::getNum).reduce(0, Integer::sum) : 0