master:获取档口库存系统接口,系统调优;
parent
b9530d76f6
commit
becb581b34
|
|
@ -190,5 +190,11 @@ public class StoreController extends XktBaseController {
|
|||
return R.ok(BeanUtil.toBean(storeService.getAppViewRank(), StoreAppViewRankResVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store,seller,agent')||@ss.hasSupplierSubRole()")
|
||||
@ApiOperation(value = "获取档口库存系统", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/stock-sys/{storeId}")
|
||||
public R<Integer> getStockSys(@PathVariable Long storeId) {
|
||||
return R.ok(storeService.getStockSys(storeId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ShipMaster 相关
|
||||
* FHB 相关
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -127,8 +128,8 @@ public class GtController extends BaseController {
|
|||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@GetMapping("/cache/{userId}")
|
||||
public R<Integer> getCache(@PathVariable Integer userId) {
|
||||
@GetMapping("/prod/cache/{userId}")
|
||||
public R<Integer> getProdCache(@PathVariable Integer userId) {
|
||||
// 从redis中获取数据
|
||||
List<GtProdSkuVO> cacheList = ObjectUtils.defaultIfNull(redisCache
|
||||
.getCacheObject(CacheConstants.MIGRATION_GT_SALE_BASIC_KEY + userId), new ArrayList<>());
|
||||
|
|
@ -141,9 +142,9 @@ public class GtController extends BaseController {
|
|||
.collect(Collectors
|
||||
.groupingBy(GtProdSkuVO::getArticle_number, LinkedHashMap::new, Collectors.toList()));
|
||||
// 货号 颜色 map
|
||||
Map<String, List<String>> artNoColorMap = new LinkedHashMap<>();
|
||||
Map<String, Set<String>> artNoColorMap = new LinkedHashMap<>();
|
||||
artNoGroup.forEach((artNo, colorList) -> {
|
||||
artNoColorMap.put(artNo, colorList.stream().map(GtProdSkuVO::getColor).collect(Collectors.toList()));
|
||||
artNoColorMap.put(artNo, colorList.stream().map(GtProdSkuVO::getColor).collect(Collectors.toSet()));
|
||||
});
|
||||
|
||||
artNoColorMap.forEach((k, v) -> {
|
||||
|
|
@ -153,12 +154,14 @@ public class GtController extends BaseController {
|
|||
// cacheList 按照货号分组,获取所有价格,价格去重
|
||||
Map<String, Set<BigDecimal>> artNoPriceMap = cacheList.stream().collect(Collectors.groupingBy(
|
||||
GtProdSkuVO::getArticle_number, Collectors.mapping(GtProdSkuVO::getPrice, Collectors.toSet())));
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
artNoPriceMap.forEach((k, v) -> {
|
||||
System.out.println(k + ":" + v);
|
||||
if (v.size() > 1) {
|
||||
count.addAndGet(1);
|
||||
System.err.println(k + ":" + v);
|
||||
}
|
||||
});
|
||||
System.err.println(count);
|
||||
|
||||
// Map<String, List<Integer>> artNoPriceMap =
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
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.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.ty.TyCusImportVO;
|
||||
import com.ruoyi.web.controller.xkt.migartion.vo.ty.TyProdImportVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* TY 相关
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/ty")
|
||||
public class TyController extends BaseController {
|
||||
|
||||
final RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/prod/cache/{userId}")
|
||||
public R<Integer> createProdCache(@PathVariable Integer userId, MultipartFile file) throws IOException {
|
||||
ExcelUtil<TyProdImportVO> util = new ExcelUtil<>(TyProdImportVO.class);
|
||||
List<TyProdImportVO> tyProdVOList = util.importExcel(file.getInputStream());
|
||||
Map<String, List<TyProdImportVO>> prodMap = tyProdVOList.stream().collect(Collectors.groupingBy(TyProdImportVO::getProdArtNum));
|
||||
prodMap.forEach((k, v) -> {
|
||||
System.err.println(k + ":" + v);
|
||||
});
|
||||
// 存到redis中
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_TY_PROD_KEY + userId, tyProdVOList, 5, TimeUnit.DAYS);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PostMapping("/cus/cache/{userId}")
|
||||
public R<Integer> createCusCache(@PathVariable Integer userId, MultipartFile file) throws IOException {
|
||||
ExcelUtil<TyCusImportVO> util = new ExcelUtil<>(TyCusImportVO.class);
|
||||
List<TyCusImportVO> tyProdVOList = util.importExcel(file.getInputStream());
|
||||
// 存到redis中
|
||||
redisCache.setCacheObject(CacheConstants.MIGRATION_TY_CUS_KEY + userId, tyProdVOList, 5, TimeUnit.DAYS);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion.vo.ty;
|
||||
|
||||
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 TyCusImportVO {
|
||||
|
||||
@Excel(name = "客户名称")
|
||||
private String cusName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion.vo.ty;
|
||||
|
||||
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 TyProdImportVO {
|
||||
|
||||
@Excel(name = "HUOH")
|
||||
private String prodArtNum;
|
||||
@Excel(name = "COL")
|
||||
private String colorName;
|
||||
@Excel(name = "jg")
|
||||
private Integer price;
|
||||
@Excel(name = "HPBM")
|
||||
private String otherSnPrefix;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi.web.controller.xkt.migartion.vo.ty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-05-11 23:46
|
||||
*/
|
||||
@Data
|
||||
public class TyProdVO {
|
||||
|
||||
private SMIDataVO data;
|
||||
|
||||
@Data
|
||||
public static class SMIDataVO {
|
||||
private List<SMIVO> records;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SMIVO {
|
||||
private Integer supplierId;
|
||||
private Integer supplierSkuId;
|
||||
private String artNo;
|
||||
private String color;
|
||||
private String size;
|
||||
private BigDecimal addPrice;
|
||||
private String addPriceSize;
|
||||
private String snPrefix;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -344,5 +344,13 @@ public class CacheConstants {
|
|||
* GT档口分类缓存
|
||||
*/
|
||||
public static final String MIGRATION_GT_SALE_CATE_KEY = "mig_gt_sale_cate:";
|
||||
/**
|
||||
* TY商品缓存
|
||||
*/
|
||||
public static final String MIGRATION_TY_PROD_KEY = "mig_ty_prod:";
|
||||
/**
|
||||
* TY客户缓存
|
||||
*/
|
||||
public static final String MIGRATION_TY_CUS_KEY = "mig_ty_cus:";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,4 +197,12 @@ public interface IStoreService {
|
|||
* @return StoreAppViewRankResDTO
|
||||
*/
|
||||
StoreAppViewRankResDTO getAppViewRank();
|
||||
|
||||
/**
|
||||
* 获取档口库存系统
|
||||
*
|
||||
* @return
|
||||
* @param storeId
|
||||
*/
|
||||
Integer getStockSys(Long storeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,6 +431,19 @@ public class StoreServiceImpl implements IStoreService {
|
|||
return redisAppViewRank;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口库存系统
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Integer getStockSys(Long storeId) {
|
||||
Store store = Optional.ofNullable(storeMapper.selectById(storeId)).orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
|
||||
return store.getStockSys();
|
||||
}
|
||||
|
||||
/**
|
||||
* 档口首页今日销售额
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue