master:系统调优;
parent
173976a170
commit
40d1927eb0
|
|
@ -31,6 +31,11 @@ public class CompareBizController extends BaseController {
|
||||||
final IShipMasterService shipMasterService;
|
final IShipMasterService shipMasterService;
|
||||||
final RedisCache redisCache;
|
final RedisCache redisCache;
|
||||||
|
|
||||||
|
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||||
|
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||||
|
// TODO 档口注册的时候,会创建现金客户,在插入客户时,需要注意
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||||
@PutMapping("/double/ship/{userId}/{supplierId}")
|
@PutMapping("/double/ship/{userId}/{supplierId}")
|
||||||
public R<Integer> compare(@PathVariable("userId") Integer userId, @PathVariable("supplierId") Integer supplierId) {
|
public R<Integer> compare(@PathVariable("userId") Integer userId, @PathVariable("supplierId") Integer supplierId) {
|
||||||
|
|
@ -45,7 +50,7 @@ public class CompareBizController extends BaseController {
|
||||||
doubleRunSaleArtNoList.forEach(article_number -> {
|
doubleRunSaleArtNoList.forEach(article_number -> {
|
||||||
// 只保留数字,去除其他所有符号
|
// 只保留数字,去除其他所有符号
|
||||||
String cleanArtNo = article_number.replaceAll("[^0-9]", "");
|
String cleanArtNo = article_number.replaceAll("[^0-9]", "");
|
||||||
List<String> existList = multiSaleSameGoMap.containsKey(cleanArtNo) ? multiSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
List<String> existList = multiSaleSameGoMap.containsKey(cleanArtNo) ? multiSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
||||||
existList.add(article_number);
|
existList.add(article_number);
|
||||||
multiSaleSameGoMap.put(cleanArtNo, existList);
|
multiSaleSameGoMap.put(cleanArtNo, existList);
|
||||||
});
|
});
|
||||||
|
|
@ -58,7 +63,7 @@ public class CompareBizController extends BaseController {
|
||||||
doubleRunOffSaleArtNoList.forEach(article_number -> {
|
doubleRunOffSaleArtNoList.forEach(article_number -> {
|
||||||
// 只保留数字,去除其他所有符号
|
// 只保留数字,去除其他所有符号
|
||||||
String cleanArtNo = article_number.replaceAll("[^0-9]", "");
|
String cleanArtNo = article_number.replaceAll("[^0-9]", "");
|
||||||
List<String> existList = multiOffSaleSameGoMap.containsKey(cleanArtNo) ? multiOffSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
List<String> existList = multiOffSaleSameGoMap.containsKey(cleanArtNo) ? multiOffSaleSameGoMap.get(cleanArtNo) : new ArrayList<>();
|
||||||
existList.add(article_number);
|
existList.add(article_number);
|
||||||
multiOffSaleSameGoMap.put(cleanArtNo, existList);
|
multiOffSaleSameGoMap.put(cleanArtNo, existList);
|
||||||
});
|
});
|
||||||
|
|
@ -72,14 +77,12 @@ public class CompareBizController extends BaseController {
|
||||||
shipArtNoList.forEach(artNo -> {
|
shipArtNoList.forEach(artNo -> {
|
||||||
// 只保留数字,去除其他所有符号
|
// 只保留数字,去除其他所有符号
|
||||||
String cleanArtNo = artNo.replaceAll("[^0-9]", "");
|
String cleanArtNo = artNo.replaceAll("[^0-9]", "");
|
||||||
List<String> existList = multiSameFMap.containsKey(cleanArtNo) ? multiSameFMap.get(cleanArtNo) : new ArrayList<>();
|
List<String> existList = multiSameFMap.containsKey(cleanArtNo) ? multiSameFMap.get(cleanArtNo) : new ArrayList<>();
|
||||||
existList.add(artNo);
|
existList.add(artNo);
|
||||||
multiSameFMap.put(cleanArtNo, existList);
|
multiSameFMap.put(cleanArtNo, existList);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
multiSaleSameGoMap.forEach((key, value) -> {
|
multiSaleSameGoMap.forEach((key, value) -> {
|
||||||
if (value.size() > 1) {
|
if (value.size() > 1) {
|
||||||
System.err.println(key + ":" + value + ":" + value.size());
|
System.err.println(key + ":" + value + ":" + value.size());
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import com.ruoyi.common.constant.CacheConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.redis.RedisCache;
|
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.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.shipMaster.vo.shipMaster.ShipMasterProdVO;
|
||||||
import com.ruoyi.xkt.service.shipMaster.IShipMasterService;
|
import com.ruoyi.xkt.service.shipMaster.IShipMasterService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
@ -36,7 +38,7 @@ public class ShipMasterController extends BaseController {
|
||||||
public R<Integer> createProdCache(@Validated @RequestBody ShipMasterProdVO prodVO) {
|
public R<Integer> createProdCache(@Validated @RequestBody ShipMasterProdVO prodVO) {
|
||||||
// 供应商ID
|
// 供应商ID
|
||||||
final Integer supplierId = prodVO.getData().getRecords().get(0).getSupplierId();
|
final Integer supplierId = prodVO.getData().getRecords().get(0).getSupplierId();
|
||||||
if (CollectionUtils.isEmpty(prodVO.getData().getRecords())) {
|
if (ObjectUtils.isEmpty(prodVO.getData()) || CollectionUtils.isEmpty(prodVO.getData().getRecords())) {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
// 先从redis中获取列表数据
|
// 先从redis中获取列表数据
|
||||||
|
|
@ -51,9 +53,8 @@ public class ShipMasterController extends BaseController {
|
||||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||||
@PostMapping("/cus/cache")
|
@PostMapping("/cus/cache")
|
||||||
public R<Integer> createCusCache(@Validated @RequestBody ShipMasterCusVO cusVO) {
|
public R<Integer> createCusCache(@Validated @RequestBody ShipMasterCusVO cusVO) {
|
||||||
// 供应商ID
|
|
||||||
final Integer supplierId = cusVO.getData().getRecords().get(0).getSupplierId();
|
final Integer supplierId = cusVO.getData().getRecords().get(0).getSupplierId();
|
||||||
if (CollectionUtils.isEmpty(cusVO.getData().getRecords())) {
|
if (ObjectUtils.isEmpty(cusVO.getData()) || CollectionUtils.isEmpty(cusVO.getData().getRecords())) {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
// 先从redis中获取列表数据
|
// 先从redis中获取列表数据
|
||||||
|
|
@ -65,7 +66,40 @@ public class ShipMasterController extends BaseController {
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||||
|
@PostMapping("/prod/stock/cache/{supplierId}")
|
||||||
|
public R<Integer> createProdStockCache(@PathVariable Integer supplierId, @Validated @RequestBody ShipMasterProdStockVO stockVO) {
|
||||||
|
// 供应商ID
|
||||||
|
if (ObjectUtils.isEmpty(stockVO.getData()) || ObjectUtils.isEmpty(stockVO.getData().getList())) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
// 先从redis中获取列表数据
|
||||||
|
List<ShipMasterProdStockVO.SMPSRecordVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||||
|
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_STOCK_KEY + supplierId), new ArrayList<>());
|
||||||
|
CollectionUtils.addAll(cacheList, stockVO.getData().getList().getRecords());
|
||||||
|
// 存到redis中
|
||||||
|
redisCache.setCacheObject(CacheConstants.MIGRATION_SUPPLIER_PROD_STOCK_KEY + supplierId, cacheList, 5, TimeUnit.DAYS);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||||
|
@PostMapping("/cus/discount/cache")
|
||||||
|
public R<Integer> createCusDiscountCache(@Validated @RequestBody ShipMasterCusDiscountVO cusDiscountVO) {
|
||||||
|
final Integer supplierId = cusDiscountVO.getData().getRecords().get(0).getSupplierId();
|
||||||
|
// 供应商ID
|
||||||
|
if (ObjectUtils.isEmpty(cusDiscountVO.getData()) || ObjectUtils.isEmpty(cusDiscountVO.getData().getRecords())) {
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
// 设置优惠价格
|
||||||
|
cusDiscountVO.getData().getRecords().forEach(record -> record.setDiscount(record.getSupplyPrice() - record.getCustomerPrice()));
|
||||||
|
// 先从redis中获取列表数据
|
||||||
|
List<ShipMasterCusDiscountVO.SMCDRecordVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||||
|
.getCacheObject(CacheConstants.MIGRATION_SUPPLIER_CUS_DISCOUNT_KEY + supplierId), new ArrayList<>());
|
||||||
|
CollectionUtils.addAll(cacheList, cusDiscountVO.getData().getRecords());
|
||||||
|
// 存到redis中
|
||||||
|
redisCache.setCacheObject(CacheConstants.MIGRATION_SUPPLIER_CUS_DISCOUNT_KEY + supplierId, cacheList, 5, TimeUnit.DAYS);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||||
@GetMapping("/prod/cache/{supplierId}")
|
@GetMapping("/prod/cache/{supplierId}")
|
||||||
|
|
@ -94,10 +128,10 @@ public class ShipMasterController extends BaseController {
|
||||||
.put(color.getColor(), color.getSupplierId() + String.format("%05d", color.getSupplierSkuId())));
|
.put(color.getColor(), color.getSupplierId() + String.format("%05d", color.getSupplierSkuId())));
|
||||||
artSnPrefixMap.put(artNo, snPrefixMap);
|
artSnPrefixMap.put(artNo, snPrefixMap);
|
||||||
});
|
});
|
||||||
artSnPrefixMap.forEach((k,v) -> {
|
artSnPrefixMap.forEach((k, v) -> {
|
||||||
System.err.println(k + ":" + v);
|
System.err.println(k + ":" + v);
|
||||||
});
|
});
|
||||||
artNoColorMap.forEach((k,v) -> {
|
artNoColorMap.forEach((k, v) -> {
|
||||||
System.err.println(k + ":" + v);
|
System.err.println(k + ":" + v);
|
||||||
});
|
});
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|
@ -114,7 +148,7 @@ public class ShipMasterController extends BaseController {
|
||||||
return R.fail();
|
return R.fail();
|
||||||
}
|
}
|
||||||
Map<Integer, List<ShipMasterCusVO.SMCVO>> cusGroupMap = cacheList.stream().collect(Collectors
|
Map<Integer, List<ShipMasterCusVO.SMCVO>> cusGroupMap = cacheList.stream().collect(Collectors
|
||||||
.groupingBy(ShipMasterCusVO.SMCVO::getSupplierId, LinkedHashMap::new, Collectors.toList()));
|
.groupingBy(ShipMasterCusVO.SMCVO::getSupplierId, LinkedHashMap::new, Collectors.toList()));
|
||||||
System.err.println(cusGroupMap);
|
System.err.println(cusGroupMap);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liangyq
|
||||||
|
* @date 2025-05-11 23:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShipMasterCusDiscountVO {
|
||||||
|
|
||||||
|
private SMCDDataVO data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SMCDDataVO {
|
||||||
|
private List<SMCDRecordVO> records;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SMCDRecordVO {
|
||||||
|
private String artNo;
|
||||||
|
private String color;
|
||||||
|
private Integer supplyPrice;
|
||||||
|
private Integer customerPrice;
|
||||||
|
private String customerName;
|
||||||
|
private Integer supplierId;
|
||||||
|
private Integer discount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.ruoyi.web.controller.xkt.shipMaster.vo.shipMaster;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author liangyq
|
||||||
|
* @date 2025-05-11 23:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShipMasterProdStockVO {
|
||||||
|
|
||||||
|
private SMPSDataVO data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SMPSDataVO {
|
||||||
|
private SMPSListVO list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SMPSListVO {
|
||||||
|
private List<SMPSRecordVO> records;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SMPSRecordVO {
|
||||||
|
private Integer supplierId;
|
||||||
|
private String artNo;
|
||||||
|
private String color;
|
||||||
|
private Integer size30;
|
||||||
|
private Integer size31;
|
||||||
|
private Integer size32;
|
||||||
|
private Integer size33;
|
||||||
|
private Integer size34;
|
||||||
|
private Integer size35;
|
||||||
|
private Integer size36;
|
||||||
|
private Integer size37;
|
||||||
|
private Integer size38;
|
||||||
|
private Integer size39;
|
||||||
|
private Integer size40;
|
||||||
|
private Integer size41;
|
||||||
|
private Integer size42;
|
||||||
|
private Integer size43;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -320,6 +320,14 @@ public class CacheConstants {
|
||||||
* FHB客户缓存
|
* FHB客户缓存
|
||||||
*/
|
*/
|
||||||
public static final String MIGRATION_SUPPLIER_CUS_KEY = "mig_supplier_cus:";
|
public static final String MIGRATION_SUPPLIER_CUS_KEY = "mig_supplier_cus:";
|
||||||
|
/**
|
||||||
|
* FHB商品库存缓存
|
||||||
|
*/
|
||||||
|
public static final String MIGRATION_SUPPLIER_PROD_STOCK_KEY = "mig_supplier_prod_stock:";
|
||||||
|
/**
|
||||||
|
* FHB客户优惠缓存
|
||||||
|
*/
|
||||||
|
public static final String MIGRATION_SUPPLIER_CUS_DISCOUNT_KEY = "mig_supplier_cus_discount:";
|
||||||
/**
|
/**
|
||||||
* double_run在售缓存
|
* double_run在售缓存
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue