|
@@ -47,15 +47,15 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
wrapper.like(StringUtils.isNotEmpty(storeName), "store.store_name", storeName);
|
|
|
if (StringUtils.isNotEmpty(status) && !"0".equals(status)) {
|
|
|
wrapper.eq("coupon.status", status);
|
|
|
- } else {
|
|
|
- wrapper.notIn("coupon.status","-1","-2");
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
+ wrapper.notIn("coupon.status", "-1", "-2");
|
|
|
}
|
|
|
wrapper.eq(StringUtils.isNotEmpty(type), "coupon.type", type);
|
|
|
wrapper.eq("coupon.delete_flag", 0);
|
|
|
wrapper.eq("store.delete_flag", 0);
|
|
|
wrapper.eq("user.delete_flag", 0);
|
|
|
- wrapper.like(StringUtils.isNotEmpty(createdTime),"coupon.created_time", createdTime);
|
|
|
- wrapper.like(StringUtils.isNotEmpty(phone),"user.phone", phone);
|
|
|
+ wrapper.like(StringUtils.isNotEmpty(createdTime), "coupon.created_time", createdTime);
|
|
|
+ wrapper.like(StringUtils.isNotEmpty(phone), "user.phone", phone);
|
|
|
wrapper.isNotNull("coupon.status");
|
|
|
wrapper.orderByDesc("coupon.created_time");
|
|
|
IPage<LifeCouponVo> lifeCouponVo = platformStoreCouponMapper.getCouponList(new Page<>(page, size), wrapper);
|
|
@@ -70,7 +70,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
// expiredState 赋值逻辑(修正版)
|
|
|
LocalDateTime now = LocalDateTime.now(); // 获取当前时间
|
|
|
Date endDate = item.getEndDate();
|
|
|
- if (endDate != null){
|
|
|
+ if (endDate != null) {
|
|
|
LocalDateTime endDateTime = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
// 核心逻辑:未过期时赋 0,已过期赋 1(与前端枚举定义一致)
|
|
|
if (now.isBefore(endDateTime)) {
|
|
@@ -93,18 +93,18 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
|
|
|
|
|
|
// 定义允许的状态值
|
|
|
- List<String> allowedStatus = Arrays.asList( "1","2", "3");
|
|
|
+ List<String> allowedStatus = Arrays.asList("1", "2", "3");
|
|
|
if ("-3".equals(status)) { // 已售罄(逻辑状态,状态为进行中但是余量为0的)
|
|
|
wrapper.eq("coupon.status", "1");
|
|
|
wrapper.eq("coupon.stock_qty", 0);
|
|
|
- }else if ("1".equals(status)) {
|
|
|
+ } else if ("1".equals(status)) {
|
|
|
wrapper.eq("coupon.status", "1");
|
|
|
wrapper.ne("coupon.stock_qty", 0);
|
|
|
- }else if ("4".equals(status)){
|
|
|
+ } else if ("4".equals(status)) {
|
|
|
wrapper.eq("coupon.status", "1");
|
|
|
- wrapper.gt("coupon.start_date",new Date());
|
|
|
- }else{
|
|
|
- if (StringUtils.isNotEmpty(status)){
|
|
|
+ wrapper.gt("coupon.start_date", new Date());
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
wrapper.eq("coupon.status", status);
|
|
|
}
|
|
|
}
|
|
@@ -119,9 +119,9 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
wrapper.orderByDesc("coupon.created_time");
|
|
|
|
|
|
Date currentDate = new Date();
|
|
|
- if ("0".equals(expiredState)){
|
|
|
+ if ("0".equals(expiredState)) {
|
|
|
wrapper.ge("coupon.end_date", currentDate);
|
|
|
- }else if ("1".equals(expiredState)){
|
|
|
+ } else if ("1".equals(expiredState)) {
|
|
|
wrapper.lt("coupon.end_date", currentDate);
|
|
|
}
|
|
|
|
|
@@ -138,7 +138,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
// expiredState 赋值逻辑(修正版)
|
|
|
LocalDateTime now = LocalDateTime.now(); // 获取当前时间
|
|
|
Date endDate = item.getEndDate(); // 假设 endDate 是 Date 类型
|
|
|
- if (endDate != null){
|
|
|
+ if (endDate != null) {
|
|
|
LocalDateTime endDateTime = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
// 核心逻辑:未过期时赋 0,已过期赋 1(与前端枚举定义一致)
|
|
|
if (now.isBefore(endDateTime)) {
|
|
@@ -154,7 +154,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
}
|
|
|
|
|
|
//判断是否为未开始
|
|
|
- if (item.getStatus() == 1 && item.getStartDate().after( new Date())){
|
|
|
+ if (item.getStatus() == 1 && item.getStartDate().after(new Date())) {
|
|
|
item.setStatus(4);
|
|
|
}
|
|
|
});
|
|
@@ -197,7 +197,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String couponStatusExport(String status, String expiredState) throws IOException {
|
|
|
+ public String couponStatusExport(String status, String expiredState) throws IOException {
|
|
|
|
|
|
QueryWrapper<LifeCouponVo> wrapper = new QueryWrapper<>();
|
|
|
// 定义允许的状态值
|
|
@@ -205,12 +205,12 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
// wrapper.like(StringUtils.isNotEmpty(storeName), "store.store_name", storeName);
|
|
|
if (StringUtils.isNotEmpty(status) && status.equals("-3")) {
|
|
|
status = "1";
|
|
|
- wrapper.eq("coupon.single_qty",0);
|
|
|
+ wrapper.eq("coupon.single_qty", 0);
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(status) && allowedStatus.indexOf(status) != -1) {
|
|
|
wrapper.eq(StringUtils.isNotEmpty(status), "coupon.status", status);
|
|
|
- }else {
|
|
|
- wrapper.in( "coupon.status", allowedStatus);
|
|
|
+ } else {
|
|
|
+ wrapper.in("coupon.status", allowedStatus);
|
|
|
}
|
|
|
wrapper.eq("coupon.delete_flag", 0);
|
|
|
wrapper.eq("store.delete_flag", 0);
|
|
@@ -222,9 +222,9 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
wrapper.orderByDesc("coupon.created_time");
|
|
|
|
|
|
Date currentDate = new Date();
|
|
|
- if ("0".equals(expiredState)){
|
|
|
+ if ("0".equals(expiredState)) {
|
|
|
wrapper.ge("coupon.end_date", currentDate);
|
|
|
- }else if ("1".equals(expiredState)){
|
|
|
+ } else if ("1".equals(expiredState)) {
|
|
|
wrapper.lt("coupon.end_date", currentDate);
|
|
|
}
|
|
|
|
|
@@ -232,7 +232,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
lifeCouponVo.forEach(item -> {
|
|
|
if (item.getStatus() == 1 && item.getStockQty() > 0) {
|
|
|
item.setCouponState("进行中");
|
|
|
- }else if (item.getStatus() == 1 && item.getStockQty() == 0) {
|
|
|
+ } else if (item.getStatus() == 1 && item.getStockQty() == 0) {
|
|
|
item.setCouponState("已售罄");
|
|
|
} else if (item.getStatus() == 2) {
|
|
|
item.setCouponState("已暂停");
|
|
@@ -250,7 +250,7 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
// 格式化日期
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
String formattedEndDate = "";
|
|
|
- if (endDate != null){
|
|
|
+ if (endDate != null) {
|
|
|
LocalDateTime endDateTime = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
// 调整结束时间为前一天的23:59:59
|
|
|
endDateTime = endDateTime.minusDays(1).withHour(23).withMinute(59).withSecond(59);
|
|
@@ -298,9 +298,9 @@ public class PlatformStoreCouponServiceImpl implements PlatformStoreCouponServic
|
|
|
storeCouponStatusVo.setId(String.valueOf(index++)); // 设置序号
|
|
|
storeCouponStatusVos.add(storeCouponStatusVo);
|
|
|
}
|
|
|
- String fileName = UUID.randomUUID().toString().replace("-","");
|
|
|
+ String fileName = UUID.randomUUID().toString().replace("-", "");
|
|
|
|
|
|
- ExcelGenerator.generateExcel(excelPath + excelGeneratePath + fileName + ".xlsx",storeCouponStatusVos,StoreCouponStatusVo.class);
|
|
|
+ ExcelGenerator.generateExcel(excelPath + excelGeneratePath + fileName + ".xlsx", storeCouponStatusVos, StoreCouponStatusVo.class);
|
|
|
return fileUrl + "excel" + excelGeneratePath + fileName + ".xlsx";
|
|
|
}
|
|
|
|