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();
// WeeklyHeavyStockReport();
// QuarterlyProductGroupingReport();
customerTypeAnalysis();
// customerTypeAnalysis();
// getBestSell();
}
@@ -1831,14 +1831,43 @@ public class MiTuExportScheduledTask {
member.setMbrName(rs.getString("mbr_name"));
member.setMbrMobile(rs.getString("mbr_mobile"));
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.setBirthMonth(rs.getInt("birth_m"));
member.setMbrSex(rs.getString("mbr_sex").charAt(0));
member.setOffBonus(rs.getDouble("off_bonus"));
member.setEffBonus(rs.getDouble("eff_bonus"));
member.setSumBonus(rs.getDouble("sum_bonus"));
// Check if "mbr_sex" is not NULL
String mbrSex = rs.getString("mbr_sex");
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;
}
private Map<Long, Integer> getProductIdListByQueryType(Integer type) {
public Map<Long, Integer> getProductIdListByQueryType(Integer type) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate today = LocalDate.now();
String startDate = "";

View File

@@ -19,6 +19,7 @@ import com.mixi.mapper.entity.TProduct;
import com.mixi.model.dto.QueryMiTuExportPageDTO;
import com.mixi.model.vo.MiTuExportVO;
import com.mixi.service.MiTuExportService;
import com.mixi.service.TAppProductService;
import com.mixi.service.TProductService;
import io.minio.errors.MinioException;
import lombok.extern.slf4j.Slf4j;
@@ -38,6 +39,7 @@ import java.net.URLEncoder;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -68,6 +70,8 @@ public class MiTuExportServiceImpl implements MiTuExportService {
@Resource
private TProductMapper productMapper;
@Resource
private TAppProductService appProductService;
@Override
public PageBaseResponse<MiTuExportVO> queryMiTuExportPage(QueryMiTuExportPageDTO query) {
@@ -162,7 +166,17 @@ public class MiTuExportServiceImpl implements MiTuExportService {
switch (memberType) {
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" : {
QueryWrapper<MiTuProduct> miTuProductQueryWrapper = new QueryWrapper<>();
@@ -194,7 +208,12 @@ public class MiTuExportServiceImpl implements MiTuExportService {
}
case "Type S" : {
// 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 :
throw new BusinessException("Unknown memberType.");