生日有礼发放修改
This commit is contained in:
parent
a685819158
commit
e71ae0e163
|
|
@ -8,6 +8,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ package com.czg.account.service;
|
|||
|
||||
import com.czg.account.dto.shopuser.*;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户储值会员 服务层。
|
||||
|
|
@ -26,4 +26,6 @@ public interface ShopUserService extends IService<ShopUser> {
|
|||
|
||||
|
||||
boolean updateInfo(ShopUser shopUser);
|
||||
|
||||
List<ShopUser> selectBirthdayUser(LocalDate current, Long mainShopId, String userType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class MkBirthdayGiftRecord implements Serializable {
|
|||
private String phone;
|
||||
private Long templateId;
|
||||
private Integer year;
|
||||
private String userType;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.mybatisflex.core.util.MapUtil;
|
|||
import com.mybatisflex.core.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.invoke.SerializedLambda;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
|
@ -23,7 +24,7 @@ import java.util.function.Consumer;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
@Slf4j
|
||||
public class MyQueryWrapper extends QueryWrapper {
|
||||
public class MyQueryWrapper extends QueryWrapper implements Serializable {
|
||||
|
||||
public MyQueryWrapper selectAll(Class<?> clazz) {
|
||||
TableInfo tableInfo = TableInfoFactory.ofEntityClass(clazz);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import com.czg.account.service.UserInfoService;
|
|||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.utils.MyQueryWrapper;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
|
@ -20,6 +22,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -124,4 +128,16 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
}
|
||||
return userFlow.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopUser> selectBirthdayUser(LocalDate current, Long mainShopId, String userType) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper().isNotNull(ShopUser::getBirthDay)
|
||||
.eq(ShopUser::getMainShopId, mainShopId)
|
||||
.eq("DATE_FORMAT(birth_day, '%m-%d')", DateUtil.format(DateUtil.date(current), "MM-dd"));
|
||||
if ("vip".equals(userType)) {
|
||||
queryWrapper.eq(ShopUser::getIsVip, 1);
|
||||
}
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,15 +172,9 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
|||
// 获取当月第一天
|
||||
current = DateUtil.beginOfMonth(now).toLocalDateTime().toLocalDate();
|
||||
}
|
||||
|
||||
QueryWrapper queryWrapper = new QueryWrapper().isNotNull(ShopUser::getBirthDay)
|
||||
.eq(ShopUser::getMainShopId, birthdayGift.getMainShopId())
|
||||
.eq("DATE_FORMAT(birth_day, '%m-%d')", DateUtil.format(DateUtil.date(current), "MM-dd"));
|
||||
if ("vip".equals(config.getUserType())) {
|
||||
queryWrapper.eq(ShopUser::getIsVip, 1);
|
||||
}
|
||||
|
||||
for (ShopUser shopUser : shopUserService.list(queryWrapper)) {
|
||||
List<ShopUser> shopUserList = shopUserService.selectBirthdayUser(current, birthdayGift.getMainShopId(), config.getUserType());
|
||||
log.info("符合用户, {}", shopUserList);
|
||||
for (ShopUser shopUser : shopUserList) {
|
||||
long count = birthdayGiftRecordService.count(new QueryWrapper().eq(MkBirthdayGiftRecord::getUserId, shopUser.getUserId())
|
||||
.eq(MkBirthdayGiftRecord::getYear, DateUtil.year(now)));
|
||||
if (count > 1) {
|
||||
|
|
@ -193,7 +187,7 @@ public class MkBirthdayGiftServiceImpl extends ServiceImpl<MkBirthdayGiftMapper,
|
|||
TableValueConstant.BirthdayGiftRecord.PushStatus.WAIT_PUSH.getCode() : TableValueConstant.BirthdayGiftRecord.PushStatus.NO_PUSH.getCode())
|
||||
.setMainShopId(birthdayGift.getMainShopId()).setBirthday(DateUtil.parseDate(shopUser.getBirthDay()).toLocalDateTime().toLocalDate())
|
||||
.setPhone(shopUser.getPhone()).setTemplateId(shopTemplate == null ? null : shopTemplate.getId())
|
||||
.setYear(DateUtil.year(now))
|
||||
.setYear(DateUtil.year(now)).setUserType(config.getUserType())
|
||||
.setSourceId(birthdayGift.getId()).setTemplateCode(shopTemplate == null ? null : shopTemplate.getTemplateCode()).setTemplateContent(JSONObject.toJSONString(Map.of(
|
||||
"用户昵称", shopUser.getNickName(),
|
||||
"店铺名称", shopInfo.getShopName(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue