master:系统调优;
parent
40d1927eb0
commit
61f2271d19
|
|
@ -0,0 +1,179 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.GtAndFHBCompareDownloadVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.fhb.FhbProdVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.gt.GtProdSkuVO;
|
||||
import com.ruoyi.xkt.service.shipMaster.IShipMasterService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Compare 相关
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/compare")
|
||||
public class CompareBizController extends BaseController {
|
||||
|
||||
final IShipMasterService shipMasterService;
|
||||
final RedisCache redisCache;
|
||||
|
||||
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PutMapping("/double/ship/{userId}/{supplierId}")
|
||||
public void compare(HttpServletResponse response, @PathVariable("userId") Integer userId, @PathVariable("supplierId") Integer supplierId) throws UnsupportedEncodingException {
|
||||
Map<String, List<String>> multiSaleSameGoMap = new HashMap<>();
|
||||
Map<String, List<String>> multiOffSaleSameGoMap = new HashMap<>();
|
||||
Map<String, List<String>> multiSameFMap = new HashMap<>();
|
||||
List<GtProdSkuVO> doubleRunSaleBasicList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
Map<String, String> articleNoColorMap = doubleRunSaleBasicList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
GtProdSkuVO::getArticle_number,
|
||||
Collectors.collectingAndThen(Collectors.mapping(GtProdSkuVO::getColor, Collectors.toList()),
|
||||
list -> "(" + list.stream().distinct().collect(Collectors.joining(",")) + ")")));
|
||||
List<String> doubleRunSaleArtNoList = doubleRunSaleBasicList.stream().map(GtProdSkuVO::getArticle_number)
|
||||
.distinct().collect(Collectors.toList());
|
||||
// 查看double_run 在售的商品 这边有多少相似的货号
|
||||
doubleRunSaleArtNoList.forEach(article_number -> {
|
||||
// 只保留核心连续的数字,去除其他所有符号
|
||||
String cleanArtNo = this.extractCoreArticleNumber(article_number);
|
||||
List<String> existList = multiSaleSameGoMap.containsKey(cleanArtNo) ? multiSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
||||
existList.add(article_number + articleNoColorMap.get(article_number));
|
||||
multiSaleSameGoMap.put(cleanArtNo, existList);
|
||||
});
|
||||
|
||||
// 查看double_run 下架的商品有多少相似的货号
|
||||
List<GtProdSkuVO> doubleRunOffSaleBasicList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_OFF_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<String> doubleRunOffSaleArtNoList = doubleRunOffSaleBasicList.stream().map(GtProdSkuVO::getArticle_number)
|
||||
.distinct().collect(Collectors.toList());
|
||||
doubleRunOffSaleArtNoList.forEach(article_number -> {
|
||||
// 只保留核心连续的数字,去除其他所有符号
|
||||
String cleanArtNo = this.extractCoreArticleNumber(article_number);
|
||||
List<String> existList = multiOffSaleSameGoMap.containsKey(cleanArtNo) ? multiOffSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
||||
existList.add(article_number);
|
||||
multiOffSaleSameGoMap.put(cleanArtNo, existList);
|
||||
});
|
||||
|
||||
// 查看ShipMaster 这边有多少相似的货号
|
||||
List<FhbProdVO.SMIVO> shipMasterProdList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_KEY + supplierId), new ArrayList<>());
|
||||
Map<String, String> shipMasterArticleNoColorMap = shipMasterProdList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
FhbProdVO.SMIVO::getArtNo,
|
||||
Collectors.collectingAndThen(Collectors.mapping(FhbProdVO.SMIVO::getColor, Collectors.toList()),
|
||||
list -> "(" + list.stream().distinct().collect(Collectors.joining(",")) + ")")));
|
||||
List<String> shipArtNoList = shipMasterProdList.stream().map(FhbProdVO.SMIVO::getArtNo)
|
||||
.distinct().collect(Collectors.toList());
|
||||
shipArtNoList.forEach(artNo -> {
|
||||
// 只保留核心连续的数字,去除其他所有符号
|
||||
String cleanArtNo = this.extractCoreArticleNumber(artNo);
|
||||
List<String> existList = multiSameFMap.containsKey(cleanArtNo) ? multiSameFMap.get(cleanArtNo) : new ArrayList<>();
|
||||
existList.add(artNo + shipMasterArticleNoColorMap.get(artNo));
|
||||
multiSameFMap.put(cleanArtNo, existList);
|
||||
});
|
||||
|
||||
// 清洗数据之后,GO平台和FHB平台 货号一致的,按照这种来展示: GT => [Z1110(黑色,黑色绒里,棕色,棕色绒里)] <= 清洗后的货号 => [Z1110(黑色,黑色绒里,棕色,棕色绒里)] <= FHB
|
||||
|
||||
System.err.println("============ 两边系统“一致”的货号 ============");
|
||||
// 清洗后,相同货号映射
|
||||
List<String> matchArtNoList = new ArrayList<>();
|
||||
Set<String> commonArtNos = new HashSet<>(multiSaleSameGoMap.keySet());
|
||||
commonArtNos.retainAll(multiSameFMap.keySet());
|
||||
commonArtNos.forEach(artNo -> {
|
||||
final String sameArtNo = "GT => " + multiSaleSameGoMap.get(artNo) + " <= " + artNo + " => " + multiSameFMap.get(artNo) + " <= FHB";
|
||||
matchArtNoList.add(sameArtNo);
|
||||
});
|
||||
// 输出货号清洗后相同的货号
|
||||
matchArtNoList.forEach(System.out::println);
|
||||
|
||||
matchArtNoList.add("============ GT独有的货号 ============");
|
||||
matchArtNoList.add("============ GT独有的货号 ============");
|
||||
|
||||
System.err.println("============ GT独有的key ============");
|
||||
// 获取GO2独有的key
|
||||
Set<String> onlyInGoMap = new HashSet<>(multiSaleSameGoMap.keySet());
|
||||
onlyInGoMap.removeAll(commonArtNos);
|
||||
if (CollectionUtils.isNotEmpty(onlyInGoMap)) {
|
||||
onlyInGoMap.forEach(x -> {
|
||||
matchArtNoList.addAll(multiSaleSameGoMap.get(x));
|
||||
System.out.println(multiSaleSameGoMap.get(x));
|
||||
});
|
||||
}
|
||||
|
||||
matchArtNoList.add("============ FHB独有的货号 ============");
|
||||
matchArtNoList.add("============ FHB独有的货号 ============");
|
||||
|
||||
System.err.println("============ ShipMaster 去掉公共的、下架的 独有的key ============");
|
||||
// 获取ShipMaster独有的key 去掉公共的、去掉下架的商品
|
||||
Set<String> onlyInFMap = new HashSet<>(multiSameFMap.keySet());
|
||||
onlyInFMap.removeAll(commonArtNos);
|
||||
onlyInFMap.removeAll(multiOffSaleSameGoMap.keySet());
|
||||
if (CollectionUtils.isNotEmpty(onlyInFMap)) {
|
||||
onlyInFMap.forEach(x -> {
|
||||
matchArtNoList.addAll(multiSameFMap.get(x));
|
||||
System.out.println(multiSameFMap.get(x));
|
||||
});
|
||||
}
|
||||
|
||||
List<GtAndFHBCompareDownloadVO> downloadList = new ArrayList<>();
|
||||
for (int i = 0; i < matchArtNoList.size(); i++) {
|
||||
downloadList.add(new GtAndFHBCompareDownloadVO().setOrderNum(i + 1).setCode(matchArtNoList.get(i)));
|
||||
}
|
||||
ExcelUtil<GtAndFHBCompareDownloadVO> util = new ExcelUtil<>(GtAndFHBCompareDownloadVO.class);
|
||||
String encodedFileName = URLEncoder.encode("GT与FHB差异" + DateUtils.getDate(), "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + encodedFileName + ".xlsx");
|
||||
util.exportExcel(response, downloadList, "差异");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取货号中的核心数字部分
|
||||
* 例如: z1104 -> 1104, z1087高 -> 1087, z1003-1 -> 1003, 922- -> 922, -8072 -> 8072
|
||||
*
|
||||
* @param articleNumber 货号
|
||||
* @return 核心数字部分
|
||||
*/
|
||||
private String extractCoreArticleNumber(String articleNumber) {
|
||||
if (articleNumber == null || articleNumber.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
// 使用正则表达式匹配第一组连续的数字
|
||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("\\d+");
|
||||
java.util.regex.Matcher matcher = pattern.matcher(articleNumber);
|
||||
// 返回第一组匹配到的数字
|
||||
if (matcher.find()) {
|
||||
return matcher.group();
|
||||
}
|
||||
// 如果没有找到数字,返回空字符串
|
||||
throw new ServiceException("货号格式错误", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster;
|
||||
package com.ruoyi.web.controller.xkt.migartion;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster.ShipMasterCusDiscountVO;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster.ShipMasterCusVO;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster.ShipMasterProdStockVO;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster.ShipMasterProdVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.fhb.FhbCusDiscountVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.fhb.FhbCusVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.fhb.FhbProdStockVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.fhb.FhbProdVO;
|
||||
import com.ruoyi.xkt.service.shipMaster.IShipMasterService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -27,22 +27,22 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/ship-master")
|
||||
public class ShipMasterController extends BaseController {
|
||||
@RequestMapping("/rest/v1/fhb")
|
||||
public class FhbController extends BaseController {
|
||||
|
||||
final IShipMasterService shipMasterService;
|
||||
final RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/prod/cache")
|
||||
public R<Integer> createProdCache(@Validated @RequestBody ShipMasterProdVO prodVO) {
|
||||
public R<Integer> createProdCache(@Validated @RequestBody FhbProdVO prodVO) {
|
||||
// 供应商ID
|
||||
final Integer supplierId = prodVO.getData().getRecords().get(0).getSupplierId();
|
||||
if (ObjectUtils.isEmpty(prodVO.getData()) || CollectionUtils.isEmpty(prodVO.getData().getRecords())) {
|
||||
return R.ok();
|
||||
}
|
||||
// 先从redis中获取列表数据
|
||||
List<ShipMasterProdVO.SMIVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
List<FhbProdVO.SMIVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_KEY + supplierId), new ArrayList<>());
|
||||
CollectionUtils.addAll(cacheList, prodVO.getData().getRecords());
|
||||
// 存到redis中
|
||||
|
|
@ -52,13 +52,13 @@ public class ShipMasterController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/cus/cache")
|
||||
public R<Integer> createCusCache(@Validated @RequestBody ShipMasterCusVO cusVO) {
|
||||
public R<Integer> createCusCache(@Validated @RequestBody FhbCusVO cusVO) {
|
||||
final Integer supplierId = cusVO.getData().getRecords().get(0).getSupplierId();
|
||||
if (ObjectUtils.isEmpty(cusVO.getData()) || CollectionUtils.isEmpty(cusVO.getData().getRecords())) {
|
||||
return R.ok();
|
||||
}
|
||||
// 先从redis中获取列表数据
|
||||
List<ShipMasterCusVO.SMCVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
List<FhbCusVO.SMCVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_CUS_KEY + supplierId), new ArrayList<>());
|
||||
CollectionUtils.addAll(cacheList, cusVO.getData().getRecords());
|
||||
// 存到redis中
|
||||
|
|
@ -68,13 +68,13 @@ public class ShipMasterController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/prod/stock/cache/{supplierId}")
|
||||
public R<Integer> createProdStockCache(@PathVariable Integer supplierId, @Validated @RequestBody ShipMasterProdStockVO stockVO) {
|
||||
public R<Integer> createProdStockCache(@PathVariable Integer supplierId, @Validated @RequestBody FhbProdStockVO stockVO) {
|
||||
// 供应商ID
|
||||
if (ObjectUtils.isEmpty(stockVO.getData()) || ObjectUtils.isEmpty(stockVO.getData().getList())) {
|
||||
return R.ok();
|
||||
}
|
||||
// 先从redis中获取列表数据
|
||||
List<ShipMasterProdStockVO.SMPSRecordVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
List<FhbProdStockVO.SMPSRecordVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_STOCK_KEY + supplierId), new ArrayList<>());
|
||||
CollectionUtils.addAll(cacheList, stockVO.getData().getList().getRecords());
|
||||
// 存到redis中
|
||||
|
|
@ -84,7 +84,7 @@ public class ShipMasterController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/cus/discount/cache")
|
||||
public R<Integer> createCusDiscountCache(@Validated @RequestBody ShipMasterCusDiscountVO cusDiscountVO) {
|
||||
public R<Integer> createCusDiscountCache(@Validated @RequestBody FhbCusDiscountVO cusDiscountVO) {
|
||||
final Integer supplierId = cusDiscountVO.getData().getRecords().get(0).getSupplierId();
|
||||
// 供应商ID
|
||||
if (ObjectUtils.isEmpty(cusDiscountVO.getData()) || ObjectUtils.isEmpty(cusDiscountVO.getData().getRecords())) {
|
||||
|
|
@ -93,7 +93,7 @@ public class ShipMasterController extends BaseController {
|
|||
// 设置优惠价格
|
||||
cusDiscountVO.getData().getRecords().forEach(record -> record.setDiscount(record.getSupplyPrice() - record.getCustomerPrice()));
|
||||
// 先从redis中获取列表数据
|
||||
List<ShipMasterCusDiscountVO.SMCDRecordVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
List<FhbCusDiscountVO.SMCDRecordVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_CUS_DISCOUNT_KEY + supplierId), new ArrayList<>());
|
||||
CollectionUtils.addAll(cacheList, cusDiscountVO.getData().getRecords());
|
||||
// 存到redis中
|
||||
|
|
@ -105,23 +105,23 @@ public class ShipMasterController extends BaseController {
|
|||
@GetMapping("/prod/cache/{supplierId}")
|
||||
public R<Integer> getProdCache(@PathVariable Integer supplierId) {
|
||||
// 从redis中获取数据
|
||||
List<ShipMasterProdVO.SMIVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
List<FhbProdVO.SMIVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_KEY + supplierId), new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(cacheList)) {
|
||||
return R.fail();
|
||||
}
|
||||
// 按照artNo分组
|
||||
Map<String, List<ShipMasterProdVO.SMIVO>> artNoGroup = cacheList.stream()
|
||||
.sorted(Comparator.comparing(ShipMasterProdVO.SMIVO::getArtNo)
|
||||
.thenComparing(ShipMasterProdVO.SMIVO::getColor))
|
||||
Map<String, List<FhbProdVO.SMIVO>> artNoGroup = cacheList.stream()
|
||||
.sorted(Comparator.comparing(FhbProdVO.SMIVO::getArtNo)
|
||||
.thenComparing(FhbProdVO.SMIVO::getColor))
|
||||
.collect(Collectors
|
||||
.groupingBy(ShipMasterProdVO.SMIVO::getArtNo, LinkedHashMap::new, Collectors.toList()));
|
||||
.groupingBy(FhbProdVO.SMIVO::getArtNo, LinkedHashMap::new, Collectors.toList()));
|
||||
// 货号 颜色 对应的条码前缀
|
||||
Map<String, Map<String, String>> artSnPrefixMap = new LinkedHashMap<>();
|
||||
// 货号 颜色 map
|
||||
Map<String, List<String>> artNoColorMap = new LinkedHashMap<>();
|
||||
artNoGroup.forEach((artNo, colorList) -> {
|
||||
artNoColorMap.put(artNo, colorList.stream().map(ShipMasterProdVO.SMIVO::getColor).collect(Collectors.toList()));
|
||||
artNoColorMap.put(artNo, colorList.stream().map(FhbProdVO.SMIVO::getColor).collect(Collectors.toList()));
|
||||
Map<String, String> snPrefixMap = new LinkedHashMap<>();
|
||||
// 按照颜色设置条码前缀
|
||||
colorList.forEach(color -> snPrefixMap
|
||||
|
|
@ -142,13 +142,13 @@ public class ShipMasterController extends BaseController {
|
|||
@GetMapping("/cus/cache/{supplierId}")
|
||||
public R<Integer> getCusCache(@PathVariable Integer supplierId) {
|
||||
// 从redis中获取数据
|
||||
List<ShipMasterCusVO.SMCVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
List<FhbCusVO.SMCVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_CUS_KEY + supplierId), new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(cacheList)) {
|
||||
return R.fail();
|
||||
}
|
||||
Map<Integer, List<ShipMasterCusVO.SMCVO>> cusGroupMap = cacheList.stream().collect(Collectors
|
||||
.groupingBy(ShipMasterCusVO.SMCVO::getSupplierId, LinkedHashMap::new, Collectors.toList()));
|
||||
Map<Integer, List<FhbCusVO.SMCVO>> cusGroupMap = cacheList.stream().collect(Collectors
|
||||
.groupingBy(FhbCusVO.SMCVO::getSupplierId, LinkedHashMap::new, Collectors.toList()));
|
||||
System.err.println(cusGroupMap);
|
||||
return R.ok();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster;
|
||||
package com.ruoyi.web.controller.xkt.migartion;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
|
|
@ -6,8 +6,9 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.doubRun.DoubleRunAttrVO;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.doubRun.DoubleRunProdVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.gt.GtAttrVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.gt.GtProdSkuVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.gt.GtProdVO;
|
||||
import com.ruoyi.xkt.service.shipMaster.IShipMasterService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -27,59 +28,59 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/double-run")
|
||||
public class DoubleRunController extends BaseController {
|
||||
@RequestMapping("/rest/v1/gt")
|
||||
public class GtController extends BaseController {
|
||||
|
||||
final IShipMasterService shipMasterService;
|
||||
final RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/sale/cache")
|
||||
public R<Integer> createSaleCache(@Validated @RequestBody DoubleRunProdVO doubleRunVO) {
|
||||
List<DoubleRunProdVO.DRIArtNoVO> artNoList = doubleRunVO.getData().getData();
|
||||
public R<Integer> createSaleCache(@Validated @RequestBody GtProdVO doubleRunVO) {
|
||||
List<GtProdVO.DRIArtNoVO> artNoList = doubleRunVO.getData().getData();
|
||||
final Integer userId = doubleRunVO.getData().getData().get(0).getUser_id();
|
||||
// 先从redis中获取列表数据
|
||||
List<DoubleRunProdVO.DRIArtNoSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<GtProdSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
artNoList.forEach(artNoInfo -> {
|
||||
artNoInfo.getSkus().forEach(x -> x.setColor(this.decodeUnicode(x.getColor()))
|
||||
.setArticle_number(artNoInfo.getArticle_number()).setProduct_id(artNoInfo.getId()));
|
||||
cacheList.addAll(artNoInfo.getSkus());
|
||||
});
|
||||
// 存到redis中
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_SALE_BASIC_KEY + userId, cacheList);
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId, cacheList);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/off-sale/cache")
|
||||
public R<Integer> createOffSaleCache(@Validated @RequestBody DoubleRunProdVO doubleRunVO) {
|
||||
List<DoubleRunProdVO.DRIArtNoVO> artNoList = doubleRunVO.getData().getData();
|
||||
public R<Integer> createOffSaleCache(@Validated @RequestBody GtProdVO doubleRunVO) {
|
||||
List<GtProdVO.DRIArtNoVO> artNoList = doubleRunVO.getData().getData();
|
||||
final Integer userId = doubleRunVO.getData().getData().get(0).getUser_id();
|
||||
// 先从redis中获取列表数据
|
||||
List<DoubleRunProdVO.DRIArtNoSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_OFF_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<GtProdSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_OFF_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
artNoList.forEach(artNoInfo -> {
|
||||
artNoInfo.getSkus().forEach(x -> x.setColor(this.decodeUnicode(x.getColor()))
|
||||
.setArticle_number(artNoInfo.getArticle_number()).setProduct_id(artNoInfo.getId()));
|
||||
cacheList.addAll(artNoInfo.getSkus());
|
||||
});
|
||||
// 存到redis中
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_OFF_SALE_BASIC_KEY + userId, cacheList);
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_GT_OFF_SALE_BASIC_KEY + userId, cacheList);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/attr/cache/{user_id}/{product_id}")
|
||||
public R<Integer> createAttrCache(@PathVariable(value = "user_id") Integer user_id, @PathVariable("product_id") Integer product_id,
|
||||
@Validated @RequestBody DoubleRunAttrVO attrVO) {
|
||||
@Validated @RequestBody GtAttrVO attrVO) {
|
||||
// 判断缓存中是否有该product_id
|
||||
Map<String, String> existMap = redisCache.getCacheMap(CacheConstants.MIGRATION_DOUBLE_RUN_SALE_ATTR_KEY + user_id + "_" + product_id);
|
||||
Map<String, String> existMap = redisCache.getCacheMap(CacheConstants.MIGRATION_GT_SALE_ATTR_KEY + user_id + "_" + product_id);
|
||||
if (MapUtils.isNotEmpty(existMap)) {
|
||||
throw new ServiceException("该商品已设置过类目属性", HttpStatus.ERROR);
|
||||
}
|
||||
Map<String, String> attrMap = new HashMap<>();
|
||||
attrVO.getData().forEach((itemId, attr) -> {
|
||||
attrVO.getData().forEach((itemId, attr) -> {
|
||||
// 不处理 multi=1 的属性
|
||||
if (attr.getMulti() == 1) {
|
||||
return;
|
||||
|
|
@ -90,7 +91,7 @@ public class DoubleRunController extends BaseController {
|
|||
.put(this.decodeUnicode(x.getProps_name()), this.decodeUnicode(x.getPropsvalue_name())));
|
||||
}
|
||||
});
|
||||
redisCache.setCacheMap(CacheConstants.MIGRATION_DOUBLE_RUN_SALE_ATTR_KEY + user_id + "_" + product_id, attrMap);
|
||||
redisCache.setCacheMap(CacheConstants.MIGRATION_GT_SALE_ATTR_KEY + user_id + "_" + product_id, attrMap);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
|
@ -99,23 +100,23 @@ public class DoubleRunController extends BaseController {
|
|||
@GetMapping("/cache/{userId}")
|
||||
public R<Integer> getCache(@PathVariable Integer userId) {
|
||||
// 从redis中获取数据
|
||||
List<DoubleRunProdVO.DRIArtNoSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<GtProdSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(cacheList)) {
|
||||
return R.fail();
|
||||
}
|
||||
Map<String, List<DoubleRunProdVO.DRIArtNoSkuVO>> artNoGroup = cacheList.stream()
|
||||
.sorted(Comparator.comparing(DoubleRunProdVO.DRIArtNoSkuVO::getArticle_number)
|
||||
.thenComparing(DoubleRunProdVO.DRIArtNoSkuVO::getColor))
|
||||
Map<String, List<GtProdSkuVO>> artNoGroup = cacheList.stream()
|
||||
.sorted(Comparator.comparing(GtProdSkuVO::getArticle_number)
|
||||
.thenComparing(GtProdSkuVO::getColor))
|
||||
.collect(Collectors
|
||||
.groupingBy(DoubleRunProdVO.DRIArtNoSkuVO::getArticle_number, LinkedHashMap::new, Collectors.toList()));
|
||||
.groupingBy(GtProdSkuVO::getArticle_number, LinkedHashMap::new, Collectors.toList()));
|
||||
// 货号 颜色 map
|
||||
Map<String, List<String>> artNoColorMap = new LinkedHashMap<>();
|
||||
artNoGroup.forEach((artNo, colorList) -> {
|
||||
artNoColorMap.put(artNo, colorList.stream().map(DoubleRunProdVO.DRIArtNoSkuVO::getColor).collect(Collectors.toList()));
|
||||
artNoColorMap.put(artNo, colorList.stream().map(GtProdSkuVO::getColor).collect(Collectors.toList()));
|
||||
});
|
||||
|
||||
artNoColorMap.forEach((k,v) -> {
|
||||
artNoColorMap.forEach((k, v) -> {
|
||||
System.err.println(k + ":" + v);
|
||||
});
|
||||
|
||||
|
|
@ -125,9 +126,9 @@ public class DoubleRunController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Unicode解码方法
|
||||
*
|
||||
* @param unicodeStr 包含Unicode编码的字符串
|
||||
* @return 解码后的字符串
|
||||
*/
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion.vo;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GtAndFHBCompareDownloadVO {
|
||||
|
||||
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Integer orderNum;
|
||||
@Excel(name = "货号对比结果")
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster;
|
||||
package com.ruoyi.web.controller.xkt.migartion.vo.fhb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class ShipMasterCusDiscountVO {
|
||||
public class FhbCusDiscountVO {
|
||||
|
||||
private SMCDDataVO data;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster;
|
||||
package com.ruoyi.web.controller.xkt.migartion.vo.fhb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class ShipMasterCusVO {
|
||||
public class FhbCusVO {
|
||||
|
||||
private SMCDataVO data;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster;
|
||||
package com.ruoyi.web.controller.xkt.migartion.vo.fhb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class ShipMasterProdStockVO {
|
||||
public class FhbProdStockVO {
|
||||
|
||||
private SMPSDataVO data;
|
||||
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster;
|
||||
package com.ruoyi.web.controller.xkt.migartion.vo.fhb;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -9,7 +10,7 @@ import java.util.List;
|
|||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class ShipMasterProdVO {
|
||||
public class FhbProdVO {
|
||||
|
||||
private SMIDataVO data;
|
||||
|
||||
|
|
@ -25,6 +26,8 @@ public class ShipMasterProdVO {
|
|||
private String artNo;
|
||||
private String color;
|
||||
private String size;
|
||||
private BigDecimal addPrice;
|
||||
private String addPriceSize;
|
||||
private String snPrefix;
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster.vo.doubRun;
|
||||
package com.ruoyi.web.controller.xkt.migartion.vo.gt;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class DoubleRunAttrVO {
|
||||
public class GtAttrVO {
|
||||
|
||||
private Map<String, DRAAttrVO> data;
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion.vo.gt;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GtProdSkuVO {
|
||||
|
||||
private Integer product_id;
|
||||
private String article_number;
|
||||
private String color;
|
||||
private Integer size;
|
||||
private BigDecimal weight;
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion.vo.gt;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class GtProdVO {
|
||||
|
||||
private DRIDataVO data;
|
||||
|
||||
@Data
|
||||
public static class DRIDataVO {
|
||||
private List<DRIArtNoVO> data;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DRIArtNoVO {
|
||||
private Integer id;
|
||||
private Integer user_id;
|
||||
private String article_number;
|
||||
private List<GtProdSkuVO> skus;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.doubRun.DoubleRunProdVO;
|
||||
import com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster.ShipMasterProdVO;
|
||||
import com.ruoyi.xkt.service.shipMaster.IShipMasterService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Compare 相关
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/compare")
|
||||
public class CompareBizController extends BaseController {
|
||||
|
||||
final IShipMasterService shipMasterService;
|
||||
final RedisCache redisCache;
|
||||
|
||||
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PutMapping("/double/ship/{userId}/{supplierId}")
|
||||
public R<Integer> compare(@PathVariable("userId") Integer userId, @PathVariable("supplierId") Integer supplierId) {
|
||||
Map<String, List<String>> multiSaleSameGoMap = new HashMap<>();
|
||||
Map<String, List<String>> multiOffSaleSameGoMap = new HashMap<>();
|
||||
Map<String, List<String>> multiSameFMap = new HashMap<>();
|
||||
List<DoubleRunProdVO.DRIArtNoSkuVO> doubleRunSaleBasicList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<String> doubleRunSaleArtNoList = doubleRunSaleBasicList.stream().map(DoubleRunProdVO.DRIArtNoSkuVO::getArticle_number)
|
||||
.distinct().collect(Collectors.toList());
|
||||
// 查看double_run 在售的商品 这边有多少相似的货号
|
||||
doubleRunSaleArtNoList.forEach(article_number -> {
|
||||
// 只保留数字,去除其他所有符号
|
||||
String cleanArtNo = article_number.replaceAll("[^0-9]", "");
|
||||
List<String> existList = multiSaleSameGoMap.containsKey(cleanArtNo) ? multiSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
||||
existList.add(article_number);
|
||||
multiSaleSameGoMap.put(cleanArtNo, existList);
|
||||
});
|
||||
|
||||
// 查看double_run 下架的商品有多少相似的货号
|
||||
List<DoubleRunProdVO.DRIArtNoSkuVO> doubleRunOffSaleBasicList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_OFF_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<String> doubleRunOffSaleArtNoList = doubleRunOffSaleBasicList.stream().map(DoubleRunProdVO.DRIArtNoSkuVO::getArticle_number)
|
||||
.distinct().collect(Collectors.toList());
|
||||
doubleRunOffSaleArtNoList.forEach(article_number -> {
|
||||
// 只保留数字,去除其他所有符号
|
||||
String cleanArtNo = article_number.replaceAll("[^0-9]", "");
|
||||
List<String> existList = multiOffSaleSameGoMap.containsKey(cleanArtNo) ? multiOffSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
||||
existList.add(article_number);
|
||||
multiOffSaleSameGoMap.put(cleanArtNo, existList);
|
||||
});
|
||||
|
||||
|
||||
// 查看ShipMaster 这边有多少相似的货号
|
||||
List<ShipMasterProdVO.SMIVO> shipMasterProdList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_KEY + supplierId), new ArrayList<>());
|
||||
List<String> shipArtNoList = shipMasterProdList.stream().map(ShipMasterProdVO.SMIVO::getArtNo)
|
||||
.distinct().collect(Collectors.toList());
|
||||
shipArtNoList.forEach(artNo -> {
|
||||
// 只保留数字,去除其他所有符号
|
||||
String cleanArtNo = artNo.replaceAll("[^0-9]", "");
|
||||
List<String> existList = multiSameFMap.containsKey(cleanArtNo) ? multiSameFMap.get(cleanArtNo) : new ArrayList<>();
|
||||
existList.add(artNo);
|
||||
multiSameFMap.put(cleanArtNo, existList);
|
||||
});
|
||||
|
||||
|
||||
multiSaleSameGoMap.forEach((key, value) -> {
|
||||
if (value.size() > 1) {
|
||||
System.err.println(key + ":" + value + ":" + value.size());
|
||||
}
|
||||
});
|
||||
|
||||
System.err.println("============");
|
||||
|
||||
multiSameFMap.forEach((key, value) -> {
|
||||
if (value.size() > 1) {
|
||||
System.err.println(key + ":" + value + ":" + value.size());
|
||||
}
|
||||
});
|
||||
|
||||
Set<String> commonKeys = new HashSet<>(multiSaleSameGoMap.keySet());
|
||||
commonKeys.retainAll(multiSameFMap.keySet());
|
||||
|
||||
// 获取GO2独有的key
|
||||
Set<String> onlyInGoMap = new HashSet<>(multiSaleSameGoMap.keySet());
|
||||
onlyInGoMap.removeAll(commonKeys);
|
||||
|
||||
// 获取ShipMaster独有的key
|
||||
Set<String> onlyInFMap = new HashSet<>(multiSameFMap.keySet());
|
||||
onlyInFMap.removeAll(commonKeys);
|
||||
|
||||
// 打印各自独有的key
|
||||
System.err.println("============ GO2独有的key ============");
|
||||
onlyInGoMap.forEach(key -> {
|
||||
System.err.println(key + ":" + multiSaleSameGoMap.get(key));
|
||||
});
|
||||
|
||||
System.err.println("============ ShipMaster独有的key ============");
|
||||
onlyInFMap.forEach(key -> {
|
||||
System.err.println(key + ":" + multiSameFMap.get(key));
|
||||
});
|
||||
|
||||
|
||||
onlyInFMap.removeAll(multiOffSaleSameGoMap.keySet());
|
||||
System.err.println("============ ShipMaster 去掉下架的 独有的key ============");
|
||||
onlyInFMap.forEach(key -> {
|
||||
System.err.println(key + ":" + multiSameFMap.get(key));
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* List<String> articleNumberList = doubleRunBasicList.stream().map(DoubleRunVO.DRIArtNoSkuVO::getArticle_number)
|
||||
.distinct().collect(Collectors.toList());
|
||||
List<ShipMasterVO.SMIVO> shipMasterProdList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_KEY + supplierId), new ArrayList<>());
|
||||
List<String> artNoList = shipMasterProdList.stream().map(ShipMasterVO.SMIVO::getArtNo).distinct().collect(Collectors.toList());
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*// double_run基础数据
|
||||
List<DoubleRunVO.DRIArtNoSkuVO> doubleRunBasicList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_DOUBLE_RUN_BASIC_KEY + userId), new ArrayList<>());
|
||||
List<String> articleNumberList = doubleRunBasicList.stream().map(DoubleRunVO.DRIArtNoSkuVO::getArticle_number)
|
||||
.map(this::cleanArticleNumber).map(x -> x.toLowerCase(Locale.ROOT)).distinct().collect(Collectors.toList());
|
||||
// ship_master基础数据
|
||||
List<ShipMasterVO.SMIVO> shipMasterProdList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_KEY + supplierId), new ArrayList<>());
|
||||
List<String> artNoList = shipMasterProdList.stream().map(ShipMasterVO.SMIVO::getArtNo)
|
||||
.map(x -> x.toLowerCase(Locale.ROOT)).distinct().collect(Collectors.toList());
|
||||
|
||||
|
||||
Set<String> common = new HashSet<>(articleNumberList);
|
||||
common.retainAll(artNoList);
|
||||
|
||||
// 找出只存在于第一个列表的货号
|
||||
Set<String> onlyInList1 = new HashSet<>(articleNumberList);
|
||||
onlyInList1.removeAll(artNoList);
|
||||
|
||||
// 找出只存在于第二个列表的货号
|
||||
Set<String> onlyInList2 = new HashSet<>(artNoList);
|
||||
onlyInList2.removeAll(articleNumberList);
|
||||
|
||||
common.forEach(artNo -> System.err.println("common:" + artNo));
|
||||
onlyInList1.stream().sorted(Comparator.naturalOrder()).forEach(artNo -> System.err.println("onlyInList1:" + artNo));
|
||||
onlyInList2.stream().sorted(Comparator.naturalOrder()).forEach(artNo -> System.err.println("onlyInList2:" + artNo));*/
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package com.ruoyi.web.controller.xkt.shipMaster.vo.doubRun;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class DoubleRunProdVO {
|
||||
|
||||
private DRIDataVO data;
|
||||
|
||||
@Data
|
||||
public static class DRIDataVO {
|
||||
private List<DRIArtNoVO> data;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DRIArtNoVO {
|
||||
private Integer id;
|
||||
private Integer user_id;
|
||||
private String article_number;
|
||||
private List<DRIArtNoSkuVO> skus;
|
||||
}
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class DRIArtNoSkuVO {
|
||||
private Integer product_id;
|
||||
private String article_number;
|
||||
private String color;
|
||||
private Integer size;
|
||||
private BigDecimal weight;
|
||||
private BigDecimal price;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -329,16 +329,16 @@ public class CacheConstants {
|
|||
*/
|
||||
public static final String MIGRATION_SUPPLIER_CUS_DISCOUNT_KEY = "mig_supplier_cus_discount:";
|
||||
/**
|
||||
* double_run在售缓存
|
||||
* GT在售缓存
|
||||
*/
|
||||
public static final String MIGRATION_DOUBLE_RUN_SALE_BASIC_KEY = "mig_double_run_sale_basic:";
|
||||
public static final String MIGRATION_GT_SALE_BASIC_KEY = "mig_gt_sale_basic:";
|
||||
/**
|
||||
* double_run下架缓存
|
||||
* GT下架缓存
|
||||
*/
|
||||
public static final String MIGRATION_DOUBLE_RUN_OFF_SALE_BASIC_KEY = "mig_double_run_off_sale_basic:";
|
||||
public static final String MIGRATION_GT_OFF_SALE_BASIC_KEY = "mig_gt_off_sale_basic:";
|
||||
/**
|
||||
* 档口属性缓存
|
||||
* GT档口属性缓存
|
||||
*/
|
||||
public static final String MIGRATION_DOUBLE_RUN_SALE_ATTR_KEY = "mig_double_run_sale_attr:";
|
||||
public static final String MIGRATION_GT_SALE_ATTR_KEY = "mig_gt_sale_attr:";
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue