生日有礼修改
This commit is contained in:
parent
e1e2061d4b
commit
75ce21c95c
|
|
@ -24,10 +24,15 @@ import java.time.LocalDateTime;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/birthdayGift")
|
@RequestMapping("/admin/birthdayGift")
|
||||||
public class BirthdayGiftController {
|
public class BirthdayGiftController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MkBirthdayGiftService service;
|
private MkBirthdayGiftService service;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public CzgResult<String> test() {
|
||||||
|
service.deliver();
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 配置信息获取
|
* 配置信息获取
|
||||||
* 权限标识: activate:list
|
* 权限标识: activate:list
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ public class MkBirthdayGiftRecord implements Serializable {
|
||||||
private String pushResp;
|
private String pushResp;
|
||||||
private String templateCode;
|
private String templateCode;
|
||||||
private String templateContent;
|
private String templateContent;
|
||||||
|
private String phone;
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,12 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||||
public void deliver() {
|
public void deliver() {
|
||||||
list(new QueryWrapper().eq(MkBirthdayGift::getIsEnable, 1)).forEach(birthdayGift -> {
|
list(new QueryWrapper().eq(MkBirthdayGift::getIsEnable, 1)).forEach(birthdayGift -> {
|
||||||
if (StrUtil.isNotBlank(birthdayGift.getConfigList())) {
|
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());
|
ShopInfo shopInfo = shopInfoService.getById(birthdayGift.getMainShopId());
|
||||||
FunUtils.safeRunVoid(() -> {
|
FunUtils.safeRunVoid(() -> {
|
||||||
JSONArray.parseArray(birthdayGift.getConfigList()).toJavaList(MkBirthdayGiftConfig.class).forEach(config -> {
|
JSONArray.parseArray(birthdayGift.getConfigList()).toJavaList(MkBirthdayGiftConfig.class).forEach(config -> {
|
||||||
|
|
@ -174,7 +179,8 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
||||||
.setPushStatus(birthdayGift.getSendSms() == 1 ?
|
.setPushStatus(birthdayGift.getSendSms() == 1 ?
|
||||||
TableValueConstant.BirthdayGiftRecord.PushStatus.WAIT_PUSH.getCode() : TableValueConstant.BirthdayGiftRecord.PushStatus.NO_PUSH.getCode())
|
TableValueConstant.BirthdayGiftRecord.PushStatus.WAIT_PUSH.getCode() : TableValueConstant.BirthdayGiftRecord.PushStatus.NO_PUSH.getCode())
|
||||||
.setMainShopId(birthdayGift.getMainShopId()).setBirthday(DateUtil.parseDate(shopUser.getBirthDay()).toLocalDateTime().toLocalDate())
|
.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(),
|
"用户昵称", shopUser.getNickName(),
|
||||||
"店铺名称", shopInfo.getShopName(),
|
"店铺名称", shopInfo.getShopName(),
|
||||||
"数量", config.getCouponInfoList() != null ? config.getCouponInfoList().stream().map(CouponInfoDTO::getNum).reduce(0, Integer::sum) : 0
|
"数量", config.getCouponInfoList() != null ? config.getCouponInfoList().stream().map(CouponInfoDTO::getNum).reduce(0, Integer::sum) : 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue