TASK:mixi;

This commit is contained in:
shahaibo
2024-04-25 04:21:56 +08:00
parent 1d44cf21c1
commit 41c03b27ad
3 changed files with 58 additions and 10 deletions

View File

@@ -58,7 +58,7 @@ public class MiTuExportScheduledTask {
// weeklySellThrReport(); // weeklySellThrReport();
// WeeklyHeavyStockReport(); // WeeklyHeavyStockReport();
// QuarterlyProductGroupingReport(); // QuarterlyProductGroupingReport();
customerTypeAnalysis(); // customerTypeAnalysis();
// getBestSell(); // getBestSell();
} }
@@ -1831,14 +1831,43 @@ public class MiTuExportScheduledTask {
member.setMbrName(rs.getString("mbr_name")); member.setMbrName(rs.getString("mbr_name"));
member.setMbrMobile(rs.getString("mbr_mobile")); member.setMbrMobile(rs.getString("mbr_mobile"));
member.setMbrGroup(rs.getString("mbr_group")); member.setMbrGroup(rs.getString("mbr_group"));
member.setMbrStatus(rs.getString("mbr_status").charAt(0));
member.setJoinDate(rs.getDate("join_date").toLocalDate()); // Check if "mbr_status" is not NULL
String mbrStatus = rs.getString("mbr_status");
if (mbrStatus != null) {
member.setMbrStatus(mbrStatus.charAt(0));
} else {
// Handle NULL value for "mbr_status"
}
// Check if "join_date" is not NULL
Date joinDate = rs.getDate("join_date");
if (joinDate != null) {
member.setJoinDate(joinDate.toLocalDate());
} else {
// Handle NULL value for "join_date"
}
member.setMbrIssue(rs.getString("mbr_issue")); member.setMbrIssue(rs.getString("mbr_issue"));
member.setBirthMonth(rs.getInt("birth_m")); member.setBirthMonth(rs.getInt("birth_m"));
member.setMbrSex(rs.getString("mbr_sex").charAt(0));
member.setOffBonus(rs.getDouble("off_bonus")); // Check if "mbr_sex" is not NULL
member.setEffBonus(rs.getDouble("eff_bonus")); String mbrSex = rs.getString("mbr_sex");
member.setSumBonus(rs.getDouble("sum_bonus")); if (mbrSex != null) {
member.setMbrSex(mbrSex.charAt(0));
} else {
// Handle NULL value for "mbr_sex"
}
// Check if "off_bonus" is not NULL
double offBonus = rs.getDouble("off_bonus");
if (!rs.wasNull()) {
member.setOffBonus(offBonus);
} else {
// Handle NULL value for "off_bonus"
}
// Repeat similar checks for other fields...
} }
// 清理环境 // 清理环境

View File

@@ -344,7 +344,7 @@ public class TAppProductService extends ServiceImpl<TProductMapper, TProduct> {
return sortedList; return sortedList;
} }
private Map<Long, Integer> getProductIdListByQueryType(Integer type) { public Map<Long, Integer> getProductIdListByQueryType(Integer type) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
String startDate = ""; String startDate = "";

View File

@@ -19,6 +19,7 @@ import com.mixi.mapper.entity.TProduct;
import com.mixi.model.dto.QueryMiTuExportPageDTO; import com.mixi.model.dto.QueryMiTuExportPageDTO;
import com.mixi.model.vo.MiTuExportVO; import com.mixi.model.vo.MiTuExportVO;
import com.mixi.service.MiTuExportService; import com.mixi.service.MiTuExportService;
import com.mixi.service.TAppProductService;
import com.mixi.service.TProductService; import com.mixi.service.TProductService;
import io.minio.errors.MinioException; import io.minio.errors.MinioException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -38,6 +39,7 @@ import java.net.URLEncoder;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -68,6 +70,8 @@ public class MiTuExportServiceImpl implements MiTuExportService {
@Resource @Resource
private TProductMapper productMapper; private TProductMapper productMapper;
@Resource
private TAppProductService appProductService;
@Override @Override
public PageBaseResponse<MiTuExportVO> queryMiTuExportPage(QueryMiTuExportPageDTO query) { public PageBaseResponse<MiTuExportVO> queryMiTuExportPage(QueryMiTuExportPageDTO query) {
@@ -162,7 +166,17 @@ public class MiTuExportServiceImpl implements MiTuExportService {
switch (memberType) { switch (memberType) {
case "Type D" : { case "Type D" : {
// 根据牌子、款式、颜色推荐 // 根据牌子、款式、颜色推荐
return new ArrayList<>(); QueryWrapper<MiTuProduct> miTuProductQueryWrapper = new QueryWrapper<>();
miTuProductQueryWrapper.lambda().like(MiTuProduct::getColor, miTuMembers.get(0).getMostFrequentColor());
List<MiTuProduct> miTuProductList = miTuProductMapper.selectList(miTuProductQueryWrapper);
if (CollectionUtils.isEmpty(miTuProductList)) {
return new ArrayList<>();
}
Set<Long> collect = miTuProductList.stream().map(MiTuProduct::getProductId).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(collect)) {
return new ArrayList<>();
}
return new ArrayList<>(collect);
} }
case "Type i" : { case "Type i" : {
QueryWrapper<MiTuProduct> miTuProductQueryWrapper = new QueryWrapper<>(); QueryWrapper<MiTuProduct> miTuProductQueryWrapper = new QueryWrapper<>();
@@ -194,7 +208,12 @@ public class MiTuExportServiceImpl implements MiTuExportService {
} }
case "Type S" : { case "Type S" : {
// Sell through 前20 // Sell through 前20
return new ArrayList<>(); Map<Long, Integer> productIdNumMap = appProductService.getProductIdListByQueryType(3);
List<Long> collect = productIdNumMap.keySet().stream().collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)) {
return new ArrayList<>();
}
return collect;
} }
default : default :
throw new BusinessException("Unknown memberType."); throw new BusinessException("Unknown memberType.");