Merge remote-tracking branch 'origin/master-hlq20240911update' into test
This commit is contained in:
commit
7cf9e0f0c3
|
|
@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.nflg.product.base.core.api.BaseApi;
|
import com.nflg.product.base.core.api.BaseApi;
|
||||||
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
import com.nflg.product.material.pojo.dto.FindLastAttrValuesDTO;
|
import com.nflg.product.material.pojo.dto.FindLastAttrValuesDTO;
|
||||||
import com.nflg.product.material.pojo.dto.MaterialMainDTO;
|
import com.nflg.product.material.pojo.dto.MaterialMainDTO;
|
||||||
|
|
@ -94,7 +95,7 @@ public class MaterialMainApi extends BaseApi {
|
||||||
@GetMapping("selectByRowId")
|
@GetMapping("selectByRowId")
|
||||||
@ApiOperation("auto-根据rowId查询物料主数据表")
|
@ApiOperation("auto-根据rowId查询物料主数据表")
|
||||||
public ResultVO<MaterialMainVO> selectByRowId(@RequestParam("rowId") Long rowId, @RequestParam("type") Integer type) {
|
public ResultVO<MaterialMainVO> selectByRowId(@RequestParam("rowId") Long rowId, @RequestParam("type") Integer type) {
|
||||||
return ResultVO.success(materialMainService.selectByRowId(rowId, type));
|
return ResultVO.success(materialMainService.selectByRowId(rowId, type, SessionUtil.getUserCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.nflg.product.material.pojo.dto.TwentyMaterialTemplateExcelDTO;
|
||||||
import com.nflg.product.material.pojo.dto.MaterialUpdateBillDTO;
|
import com.nflg.product.material.pojo.dto.MaterialUpdateBillDTO;
|
||||||
import com.nflg.product.material.pojo.entity.MaterialUpdateBillEntity;
|
import com.nflg.product.material.pojo.entity.MaterialUpdateBillEntity;
|
||||||
import com.nflg.product.material.pojo.query.MaterialUpdateBillQuery;
|
import com.nflg.product.material.pojo.query.MaterialUpdateBillQuery;
|
||||||
|
import com.nflg.product.material.pojo.vo.MaterialBatchImportVO;
|
||||||
import com.nflg.product.material.pojo.vo.MaterialMainVO;
|
import com.nflg.product.material.pojo.vo.MaterialMainVO;
|
||||||
import com.nflg.product.material.pojo.vo.MaterialUpdateBillVO;
|
import com.nflg.product.material.pojo.vo.MaterialUpdateBillVO;
|
||||||
import com.nflg.product.material.service.MaterialUpdateBillService;
|
import com.nflg.product.material.service.MaterialUpdateBillService;
|
||||||
|
|
@ -132,7 +133,7 @@ public class MaterialUpdateBillApi extends BaseApi {
|
||||||
@ApiOperation("批量变更")
|
@ApiOperation("批量变更")
|
||||||
@PostMapping("batchImport")
|
@PostMapping("batchImport")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ResultVO<Boolean> batchImport(@RequestParam(required = true, value = "file") MultipartFile file) throws IOException {
|
public ResultVO<MaterialBatchImportVO> batchImport(@RequestParam(required = true, value = "file") MultipartFile file) throws IOException {
|
||||||
try {
|
try {
|
||||||
return materialUpdateBillService.batchImport(file);
|
return materialUpdateBillService.batchImport(file);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.nflg.product.material.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RedisTemplateConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis 解决key和value前多出一段xACxEDx00
|
||||||
|
* c.r. https://blog.csdn.net/u010667710/article/details/131452820
|
||||||
|
*
|
||||||
|
* @param redisTemplate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RedisTemplate<Object, Object> redisStringTemplate(RedisTemplate<Object, Object> redisTemplate) {
|
||||||
|
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||||
|
redisTemplate.setKeySerializer(stringRedisSerializer);
|
||||||
|
// 如果手动将Value转换成了JSON,就不要再用JSON序列化器了。
|
||||||
|
// redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
|
||||||
|
redisTemplate.setValueSerializer(stringRedisSerializer);
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.nflg.product.material.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MaterialBatchImportVO {
|
||||||
|
|
||||||
|
private Boolean inBatches; // 是否分批次
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -823,12 +823,12 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
*
|
*
|
||||||
* @param list
|
* @param list
|
||||||
*/
|
*/
|
||||||
private void initFavoritesState(List<MaterialMainVO> list) {
|
private void initFavoritesState(List<MaterialMainVO> list, String userCode) {
|
||||||
if (list.size() <= 0) {
|
if (list.size() <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Long> materialRowIds = list.stream().map(MaterialMainVO::getRowId).collect(Collectors.toList());
|
List<Long> materialRowIds = list.stream().map(MaterialMainVO::getRowId).collect(Collectors.toList());
|
||||||
List<MaterialFavoritesEntity> favorityList = materialFavoritesService.lambdaQuery().eq(MaterialFavoritesEntity::getUserCode, SessionUtil.getUserCode()).in(MaterialFavoritesEntity::getMaterialRowId, materialRowIds).list();
|
List<MaterialFavoritesEntity> favorityList = materialFavoritesService.lambdaQuery().eq(MaterialFavoritesEntity::getUserCode, userCode).in(MaterialFavoritesEntity::getMaterialRowId, materialRowIds).list();
|
||||||
Map<Long, MaterialFavoritesEntity> favorityMap = ListCommonUtil.listToMap(favorityList, MaterialFavoritesEntity::getMaterialRowId);
|
Map<Long, MaterialFavoritesEntity> favorityMap = ListCommonUtil.listToMap(favorityList, MaterialFavoritesEntity::getMaterialRowId);
|
||||||
list.forEach(k -> {
|
list.forEach(k -> {
|
||||||
k.setFavoritesState(0);
|
k.setFavoritesState(0);
|
||||||
|
|
@ -862,7 +862,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
* @param rowId 主键
|
* @param rowId 主键
|
||||||
* @return 单条数据
|
* @return 单条数据
|
||||||
*/
|
*/
|
||||||
public MaterialMainVO selectByRowId(@RequestParam("rowId") Long rowId, Integer type) {
|
public MaterialMainVO selectByRowId(@RequestParam("rowId") Long rowId, Integer type, String userCode) {
|
||||||
long Date10 = new Date().getTime();
|
long Date10 = new Date().getTime();
|
||||||
log.info("[计算耗时][selectByRowId]================================" + Date10 );
|
log.info("[计算耗时][selectByRowId]================================" + Date10 );
|
||||||
MaterialMainEntity materialMainEntity = materialMainMapper.selectById(rowId);
|
MaterialMainEntity materialMainEntity = materialMainMapper.selectById(rowId);
|
||||||
|
|
@ -879,7 +879,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
//task.add(CompletableFuture.runAsync(() -> {
|
//task.add(CompletableFuture.runAsync(() -> {
|
||||||
List<MaterialMainVO> list = new ArrayList<>();
|
List<MaterialMainVO> list = new ArrayList<>();
|
||||||
list.add(materialMainVO);
|
list.add(materialMainVO);
|
||||||
initFavoritesState(list);
|
initFavoritesState(list, userCode);
|
||||||
//}));
|
//}));
|
||||||
|
|
||||||
long Date20 = new Date().getTime();
|
long Date20 = new Date().getTime();
|
||||||
|
|
@ -1108,7 +1108,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
public MaterialMainVO selectByMaterialNo(String materialNo) {
|
public MaterialMainVO selectByMaterialNo(String materialNo) {
|
||||||
MaterialMainEntity ent = this.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, materialNo).one();
|
MaterialMainEntity ent = this.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, materialNo).one();
|
||||||
if (!Objects.isNull(ent)) {
|
if (!Objects.isNull(ent)) {
|
||||||
return selectByRowId(ent.getRowId(), MaterialMainTypeEnum.ONE.getCode());
|
return selectByRowId(ent.getRowId(), MaterialMainTypeEnum.ONE.getCode(), SessionUtil.getUserCode());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -1119,7 +1119,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
list.add("22");
|
list.add("22");
|
||||||
MaterialMainEntity ent = materialMainMapper.selectByMaterialNoAndRelCategoryCode(materialNo, list);
|
MaterialMainEntity ent = materialMainMapper.selectByMaterialNoAndRelCategoryCode(materialNo, list);
|
||||||
if (!Objects.isNull(ent)) {
|
if (!Objects.isNull(ent)) {
|
||||||
return selectByRowId(ent.getRowId(), MaterialMainTypeEnum.ONE.getCode());
|
return selectByRowId(ent.getRowId(), MaterialMainTypeEnum.ONE.getCode(), SessionUtil.getUserCode());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class MaterialSubmitService {
|
||||||
|
|
||||||
public void submitOne(Long rowId) {
|
public void submitOne(Long rowId) {
|
||||||
|
|
||||||
MaterialMainVO materialMainVO = materialMainService.selectByRowId(rowId, MaterialMainTypeEnum.ONE.getCode());
|
MaterialMainVO materialMainVO = materialMainService.selectByRowId(rowId, MaterialMainTypeEnum.ONE.getCode(), SessionUtil.getUserCode());
|
||||||
if (materialMainVO.getProcessState() > 0) {
|
if (materialMainVO.getProcessState() > 0) {
|
||||||
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, materialMainVO.getMaterialNo().concat("物料已提交,不能重复提交"));
|
throw new NflgBusinessException(STATE.ParamErr, materialMainVO.getMaterialNo().concat("物料已提交,不能重复提交"));
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,7 @@ import com.nflg.product.material.pojo.dto.MaterialMainAttrDTO;
|
||||||
import com.nflg.product.material.pojo.dto.MaterialUpdateBillDTO;
|
import com.nflg.product.material.pojo.dto.MaterialUpdateBillDTO;
|
||||||
import com.nflg.product.material.pojo.entity.*;
|
import com.nflg.product.material.pojo.entity.*;
|
||||||
import com.nflg.product.material.pojo.query.MaterialUpdateBillQuery;
|
import com.nflg.product.material.pojo.query.MaterialUpdateBillQuery;
|
||||||
import com.nflg.product.material.pojo.vo.MaterialHomeMainVO;
|
import com.nflg.product.material.pojo.vo.*;
|
||||||
import com.nflg.product.material.pojo.vo.MaterialMainAttrValuesVO;
|
|
||||||
import com.nflg.product.material.pojo.vo.MaterialMainVO;
|
|
||||||
import com.nflg.product.material.pojo.vo.MaterialUpdateBillVO;
|
|
||||||
import com.nflg.product.material.util.EecExcelUtil;
|
import com.nflg.product.material.util.EecExcelUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
|
|
@ -40,6 +37,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
@ -52,6 +50,7 @@ import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -88,6 +87,11 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
||||||
@Value("${material.home.day:30}")
|
@Value("${material.home.day:30}")
|
||||||
private Integer homeDay;
|
private Integer homeDay;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
private static final String PREFIX = "frontend:material";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询所有数据
|
* 分页查询所有数据
|
||||||
*
|
*
|
||||||
|
|
@ -346,7 +350,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
||||||
List<MaterialUpdateBillEntity> ents = new ArrayList<>();
|
List<MaterialUpdateBillEntity> ents = new ArrayList<>();
|
||||||
for (MaterialStateUpExcelDTO data : excelContext) {
|
for (MaterialStateUpExcelDTO data : excelContext) {
|
||||||
MaterialMainEntity material = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, data.getMaterialNo()).one();
|
MaterialMainEntity material = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, data.getMaterialNo()).one();
|
||||||
MaterialMainVO materialMainVO = materialMainService.selectByRowId(material.getRowId(), MaterialMainTypeEnum.ONE.getCode());
|
MaterialMainVO materialMainVO = materialMainService.selectByRowId(material.getRowId(), MaterialMainTypeEnum.ONE.getCode(), SessionUtil.getUserCode());
|
||||||
MaterialUpdateBillEntity ent = new MaterialUpdateBillEntity();
|
MaterialUpdateBillEntity ent = new MaterialUpdateBillEntity();
|
||||||
ent.setMaterialNo(data.getMaterialNo());
|
ent.setMaterialNo(data.getMaterialNo());
|
||||||
ent.setOldMaterialState(material.getMaterialState());
|
ent.setOldMaterialState(material.getMaterialState());
|
||||||
|
|
@ -363,16 +367,19 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
||||||
}
|
}
|
||||||
this.saveBatch(ents);
|
this.saveBatch(ents);
|
||||||
//同步OA
|
//同步OA
|
||||||
materialUpdateToOAService.sysncToOaOnleState(ents);
|
materialUpdateToOAService.sysncToOaOnleState(ents, SessionUtil.getUserCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultVO<Boolean> batchImport(MultipartFile file) throws IOException {
|
public ResultVO<MaterialBatchImportVO> batchImport(MultipartFile file) throws IOException {
|
||||||
if (file != null && !file.getOriginalFilename().endsWith("xls") && !file.getOriginalFilename().endsWith("xlsx")) {
|
if (file != null && !file.getOriginalFilename().endsWith("xls") && !file.getOriginalFilename().endsWith("xlsx")) {
|
||||||
return ResultVO.error("上传的文件非Excel文件");
|
return ResultVO.error("上传的文件非Excel文件");
|
||||||
}
|
}
|
||||||
|
Object cacheFileName = redisTemplate.boundValueOps(buildKey(SessionUtil.getUserCode() + ":updateBatchImport")).get();
|
||||||
|
if (ObjectUtil.isNotEmpty(cacheFileName) && file.getOriginalFilename().equals(cacheFileName)) {
|
||||||
|
return ResultVO.error("当前Excel文件正在处理中,请勿重复导入");
|
||||||
|
}
|
||||||
|
|
||||||
int lastColIndex = ExcelReader.read(file.getInputStream()).sheet(0).getHeader().getLastColumnIndex();
|
int lastColIndex = ExcelReader.read(file.getInputStream()).sheet(0).getHeader().getLastColumnIndex();
|
||||||
List<MaterialUpdateBillEntity> ents = new ArrayList<>();
|
|
||||||
|
|
||||||
AuthorityDepartmentEntity deptEnt = departmentService.getById(SessionUtil.getPartRowId());
|
AuthorityDepartmentEntity deptEnt = departmentService.getById(SessionUtil.getPartRowId());
|
||||||
if (Objects.isNull(deptEnt)) {
|
if (Objects.isNull(deptEnt)) {
|
||||||
|
|
@ -392,263 +399,329 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
||||||
applyDeptName = String.join("/", deptNameList);
|
applyDeptName = String.join("/", deptNameList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String realName = SessionUtil.getRealName();
|
||||||
|
String userCode = SessionUtil.getUserCode();
|
||||||
|
MaterialBatchImportVO importVO = new MaterialBatchImportVO();
|
||||||
|
importVO.setInBatches(false);
|
||||||
if (lastColIndex == 4) {
|
if (lastColIndex == 4) {
|
||||||
List<MaterialStateUpExcelDTO> excelContext = EecExcelUtil.getExcelContext(file.getInputStream(), MaterialStateUpExcelDTO.class);
|
List<MaterialStateUpExcelDTO> excelContext = EecExcelUtil.getExcelContext(file.getInputStream(), MaterialStateUpExcelDTO.class);
|
||||||
excelContext = excelContext.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.toList());
|
if (CollectionUtil.isNotEmpty(excelContext) && excelContext.size() > 1000) {
|
||||||
if (excelContext.size() <= 0) {
|
redisTemplate.opsForValue().set(buildKey(userCode + ":updateBatchImport"), file.getOriginalFilename());
|
||||||
return ResultVO.error("导入内容不允许为空");
|
// 大数据量,子线程分批次提交OA(每批1000条),主线程提前返回结果给前端
|
||||||
}
|
CompletableFuture<Integer> task1 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
List<String> upMaterialNos = excelContext.stream().map(MaterialStateUpExcelDTO::getMaterialNo).collect(Collectors.toList());
|
List<List<MaterialStateUpExcelDTO>> lists = Lists.partition(excelContext, 1000);
|
||||||
checkMaterialRep(upMaterialNos);
|
lists.forEach(items -> this.handleImportDataForState(items, applyDeptName, deptEnt, realName, userCode));
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
Set<String> exitstUpNos = Sets.newHashSet(this.getBaseMapper().getExtstUpdataBillMaterialNos(upMaterialNos));
|
log.info("物料变更批量导入耗时(ms): {}", endTime - startTime);
|
||||||
Set<String> upMaterialNosSet = Sets.newHashSet(upMaterialNos);
|
redisTemplate.delete(buildKey(userCode + ":updateBatchImport"));
|
||||||
Set<String> intersection = Sets.intersection(exitstUpNos, upMaterialNosSet);
|
return 1;
|
||||||
if (intersection.size() > 0) {
|
});
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", intersection).concat("已有存在申请中的变更单"));
|
task1.exceptionally(ex -> {
|
||||||
}
|
// 异常处理器,打印异常信息并返回默认值
|
||||||
//正式物料
|
log.error("物料变更批量导入异常: " + ex.getMessage());
|
||||||
HashSet<String> formalMNos = Sets.newHashSet(this.getBaseMapper().getExtstFormalMaterialNos(upMaterialNos));
|
redisTemplate.delete(buildKey(userCode + ":updateBatchImport"));
|
||||||
Set<String> formDifferenceSet = Sets.difference(upMaterialNosSet, formalMNos);
|
return -1;
|
||||||
if (formDifferenceSet.size() > 0) {
|
});
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", formDifferenceSet).concat("为非正式物料,不允许变更"));
|
// task1.join(); // 阻塞获取结果
|
||||||
}
|
importVO.setInBatches(true);
|
||||||
|
return ResultVO.success(importVO);
|
||||||
List<MaterialStateUpExcelDTO> updateResionList = excelContext.stream().filter(item -> StringUtils.isEmpty(item.getUpdateResion())).collect(Collectors.toList());
|
} else {
|
||||||
List<String> updateResionMaterialNoList = updateResionList.stream().map(MaterialStateUpExcelDTO::getMaterialNo).collect(Collectors.toList());
|
this.handleImportDataForState(excelContext, applyDeptName, deptEnt, realName, userCode);
|
||||||
if (updateResionMaterialNoList.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", updateResionMaterialNoList).concat("为未填写变更原因"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> states = Sets.newHashSet("激活", "禁止采购", "售后专用", "冻结", "完全弃用");
|
|
||||||
Set<String> excelStates = Sets.newHashSet(excelContext.stream().map(u -> EecExcelUtil.StringTrim(u.getNewState())).filter(StringUtils::isNotEmpty).collect(Collectors.toList()));
|
|
||||||
Set<String> difState = Sets.difference(excelStates, states);
|
|
||||||
if (difState.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", difState).concat(" 状态错误,状态不能含有空格,状态只能选择激活/禁止采购/售后专用/冻结/完全弃用"));
|
|
||||||
}
|
|
||||||
// 变更后状态不是冻结的集合
|
|
||||||
Set<String> notFreezeSet = new HashSet<>();
|
|
||||||
for (MaterialStateUpExcelDTO data : excelContext) {
|
|
||||||
MaterialMainEntity material = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, data.getMaterialNo()).one();
|
|
||||||
MaterialMainVO materialMainVO = materialMainService.selectByRowId(material.getRowId(), MaterialMainTypeEnum.ONE.getCode());
|
|
||||||
|
|
||||||
String checkMaterialState = checkMaterialState(material);
|
|
||||||
if (ObjectUtil.isNotEmpty(checkMaterialState)) {
|
|
||||||
return ResultVO.error(checkMaterialState);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果物料是状态变更,且变更状态为冻结或完全弃用,物料昨日库得值 大于 0时,不允许申请冻结
|
|
||||||
Integer materialState = MaterialStateConstant.materialStateNameKeyMp.get(EecExcelUtil.StringTrim(data.getNewState()));
|
|
||||||
Double materialStock = 0D;
|
|
||||||
if (Objects.nonNull(material.getMaterialStock())) {
|
|
||||||
materialStock = material.getMaterialStock();
|
|
||||||
}
|
|
||||||
boolean flagOne = materialStock.compareTo(0D) > 0;
|
|
||||||
boolean flagTwo = materialState.compareTo(material.getMaterialState()) != 0;
|
|
||||||
boolean flagThree = materialState.compareTo(MaterialStateEnum.FROZEN.getValue()) == 0 || materialState.compareTo(MaterialStateEnum.GIVEUP.getValue()) == 0;
|
|
||||||
if (flagTwo && flagThree) {
|
|
||||||
if (flagOne) {
|
|
||||||
return ResultVO.error("物料编号为" + material.getMaterialNo() + "的物料还有库存,无法申请冻结或完全弃用");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MaterialUpdateBillEntity ent = new MaterialUpdateBillEntity();
|
|
||||||
ent.setMaterialNo(data.getMaterialNo());
|
|
||||||
ent.setOldMaterialState(material.getMaterialState());
|
|
||||||
ent.setOldMaterialStateName(MaterialStateConstant.materialStateMp.get(material.getMaterialState()));
|
|
||||||
ent.setNewMaterialState(materialState);
|
|
||||||
ent.setNewMaterialStateName(data.getNewState());
|
|
||||||
ent.setUpdateResion(data.getUpdateResion());
|
|
||||||
ent.setReplaceMaterialNo(data.getReplaceMaterialNo());
|
|
||||||
ent.setOldCategoryCode(material.getMaterialCategoryCode());
|
|
||||||
ent.setOldCategoryNameTree(getMaterialCategoryTree(materialMainVO));
|
|
||||||
ent.setOldMaterialDesc(material.getMaterialDesc());
|
|
||||||
ent.setApplyDeptName(applyDeptName);
|
|
||||||
ent.setCreatedByName(SessionUtil.getRealName());
|
|
||||||
ent.setCreatedBy(SessionUtil.getUserCode());
|
|
||||||
ent.setCreatedTime(new Date());
|
|
||||||
ents.add(ent);
|
|
||||||
|
|
||||||
if (materialState != 4) {
|
|
||||||
notFreezeSet.add(data.getMaterialNo());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
|
|
||||||
this.saveBatch(ents);
|
|
||||||
//同步OA
|
|
||||||
materialUpdateToOAService.sysncToOaOnleState(ents);
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(notFreezeSet)) {
|
|
||||||
// 过滤出 11、51物料 && 解冻
|
|
||||||
List<MaterialMainEntity> notFreezeList = materialMainService.lambdaQuery()
|
|
||||||
.and(q -> q.in(MaterialMainEntity::getMaterialNo, notFreezeSet))
|
|
||||||
.and(q -> q.likeRight(MaterialMainEntity::getMaterialCategoryCode, "10").or().likeRight(MaterialMainEntity::getMaterialCategoryCode, "50"))
|
|
||||||
.and(q -> q.eq(MaterialMainEntity::getMaterialState, 4))
|
|
||||||
.list();
|
|
||||||
if (CollectionUtil.isNotEmpty(notFreezeList)) {
|
|
||||||
log.debug("【物料变更】解冻的物料号:\n");
|
|
||||||
List<MaterialMainEntity> updateList = new ArrayList<>(notFreezeList.size());
|
|
||||||
// 11、51物料 && 解冻,则运算起始时间为变更申请时间一年之后
|
|
||||||
Date startDate = Date.from(LocalDate.now().plusYears(1L).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
|
|
||||||
notFreezeList.forEach(item -> {
|
|
||||||
MaterialMainEntity entity = new MaterialMainEntity();
|
|
||||||
entity.setRowId(item.getRowId());
|
|
||||||
updateList.add(entity);
|
|
||||||
log.debug("{}\t", item.getMaterialNo());
|
|
||||||
});
|
|
||||||
updateList.forEach(item -> item.setFreezeCalcStart(startDate));
|
|
||||||
materialMainService.updateBatchById(updateList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 制作物料
|
// 制作物料
|
||||||
List<TwentyMaterialTemplateExcelDTO> excelContext = EecExcelUtil.getExcelContext(file.getInputStream(), TwentyMaterialTemplateExcelDTO.class);
|
List<TwentyMaterialTemplateExcelDTO> excelContext = EecExcelUtil.getExcelContext(file.getInputStream(), TwentyMaterialTemplateExcelDTO.class);
|
||||||
excelContext = excelContext.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.toList());
|
if (CollectionUtil.isNotEmpty(excelContext) && excelContext.size() > 1000) {
|
||||||
if (excelContext.size() <= 0) {
|
redisTemplate.opsForValue().set(buildKey(userCode + ":updateBatchImport"), file.getOriginalFilename());
|
||||||
return ResultVO.error("导入内容不允许为空");
|
// 大数据量,子线程分批次提交OA(每批1000条),主线程提前返回结果给前端
|
||||||
|
CompletableFuture<Integer> task1 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
List<List<TwentyMaterialTemplateExcelDTO>> lists = Lists.partition(excelContext, 1000);
|
||||||
|
lists.forEach(items -> this.handleImportDataForSummary(items, applyDeptName, deptEnt, realName, userCode));
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
|
log.info("物料变更批量导入耗时(ms): {}", endTime - startTime);
|
||||||
|
redisTemplate.delete(buildKey(userCode + ":updateBatchImport"));
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
task1.exceptionally(ex -> {
|
||||||
|
// 异常处理器,打印异常信息并返回默认值
|
||||||
|
log.error("物料变更批量导入异常: " + ex.getMessage());
|
||||||
|
redisTemplate.delete(buildKey(userCode + ":updateBatchImport"));
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
// task1.join(); // 阻塞获取结果
|
||||||
|
importVO.setInBatches(true);
|
||||||
|
return ResultVO.success(importVO);
|
||||||
|
} else {
|
||||||
|
this.handleImportDataForSummary(excelContext, applyDeptName, deptEnt, realName, userCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> upMaterialNos = excelContext.stream().map(TwentyMaterialTemplateExcelDTO::getMaterialNo).collect(Collectors.toList());
|
|
||||||
checkMaterialRep(upMaterialNos);
|
|
||||||
|
|
||||||
Set<String> exitstUpNos = Sets.newHashSet(this.getBaseMapper().getExtstUpdataBillMaterialNos(upMaterialNos));
|
|
||||||
Set<String> upMaterialNosSet = Sets.newHashSet(upMaterialNos);
|
|
||||||
Set<String> intersection = Sets.intersection(exitstUpNos, upMaterialNosSet);
|
|
||||||
if (intersection.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", intersection).concat("已有存在申请中的变更单"));
|
|
||||||
}
|
|
||||||
//正式物料
|
|
||||||
HashSet<String> formalMNos = Sets.newHashSet(this.getBaseMapper().getExtstFormalMaterialNos(upMaterialNos));
|
|
||||||
Set<String> formDifferenceSet = Sets.difference(upMaterialNosSet, formalMNos);
|
|
||||||
if (formDifferenceSet.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", formDifferenceSet).concat("为非正式物料,不允许变更"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断新图号是否在数据库中已存在
|
|
||||||
List<String> drawingNoList = excelContext.stream().map(TwentyMaterialTemplateExcelDTO::getDrawingNo).collect(Collectors.toList());
|
|
||||||
List<MaterialMainEntity> entityList = this.materialMainService.lambdaQuery().in(MaterialMainEntity::getDrawingNo, drawingNoList).list();
|
|
||||||
if (entityList != null && entityList.size() > 0) {
|
|
||||||
List<String> drawingNos = entityList.stream().map(MaterialMainEntity::getDrawingNo).collect(Collectors.toList());
|
|
||||||
List<MaterialMainEntity> others = entityList.stream().filter(item -> !upMaterialNos.contains(item.getMaterialNo())).collect(Collectors.toList());
|
|
||||||
if (others.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", drawingNos).concat("的图号在正式物料中已存在"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 申请中的变更
|
|
||||||
List<MaterialUpdateBillEntity> billEntityList = this.lambdaQuery().eq(MaterialUpdateBillEntity::getBillState, 1).in(MaterialUpdateBillEntity::getDrawingNo, drawingNoList).list();
|
|
||||||
if (billEntityList != null && billEntityList.size() > 0) {
|
|
||||||
List<String> drawingNos = billEntityList.stream().map(MaterialUpdateBillEntity::getDrawingNo).collect(Collectors.toList());
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", drawingNos).concat("的新图号在变更申请中已存在,请检查"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> states = Sets.newHashSet("激活", "禁止采购", "售后专用", "冻结", "完全弃用");
|
|
||||||
Set<String> excelStates = excelContext.stream().filter(item -> StringUtils.isNotEmpty(item.getNewState()))
|
|
||||||
.map(u -> EecExcelUtil.StringTrim(u.getNewState())).filter(StringUtils::isNotEmpty).collect(Collectors.toSet());
|
|
||||||
Set<String> difState = Sets.difference(excelStates, states);
|
|
||||||
if (difState.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", difState).concat("状态错误,状态不能含有空格,状态只能选择激活/禁止采购/售后专用/冻结/完全弃用"));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<TwentyMaterialTemplateExcelDTO> updateResionList = excelContext.stream().filter(item -> StringUtils.isEmpty(item.getUpdateResion())).collect(Collectors.toList());
|
|
||||||
List<String> updateResionMaterialNoList = updateResionList.stream().map(TwentyMaterialTemplateExcelDTO::getMaterialNo).collect(Collectors.toList());
|
|
||||||
if (updateResionMaterialNoList.size() > 0) {
|
|
||||||
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", updateResionMaterialNoList).concat("为未填写变更原因"));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (TwentyMaterialTemplateExcelDTO data : excelContext) {
|
|
||||||
MaterialMainEntity material = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, data.getMaterialNo()).one();
|
|
||||||
if (material.getProcessState().compareTo(MaterialProcessStateEnum.AUDIT.getValue()) != 0 && material.getProcessState().compareTo(MaterialProcessStateEnum.HISTORY_MATERIAL.getValue()) != 0) {
|
|
||||||
MaterialProcessStateEnum materialProcessStateEnum = MaterialProcessStateEnum.findDescriptionByValue(material.getProcessState());
|
|
||||||
throw new NflgBusinessException(STATE.Error, "物料号为" + data.getMaterialNo() + "的物料流程状态为" + materialProcessStateEnum.getDescription() + ",不允许导入变更");
|
|
||||||
}
|
|
||||||
|
|
||||||
String checkMaterialState = checkMaterialState(material);
|
|
||||||
if (ObjectUtil.isNotEmpty(checkMaterialState)) {
|
|
||||||
return ResultVO.error(checkMaterialState);
|
|
||||||
}
|
|
||||||
|
|
||||||
MaterialMainVO materialMainVO = new MaterialMainVO();
|
|
||||||
BeanUtils.copyProperties(material, materialMainVO);
|
|
||||||
MaterialUpdateBillEntity ent = new MaterialUpdateBillEntity();
|
|
||||||
ent.setMaterialNo(data.getMaterialNo());
|
|
||||||
if (StringUtils.isNotEmpty(data.getNewState())) {
|
|
||||||
ent.setNewMaterialState(MaterialStateConstant.materialStateNameKeyMp.get(EecExcelUtil.StringTrim(data.getNewState())));
|
|
||||||
ent.setNewMaterialStateName(data.getNewState());
|
|
||||||
}
|
|
||||||
|
|
||||||
MaterialCategoryEntity materialCategoryEntity = materialCategoryService.lambdaQuery().eq(MaterialCategoryEntity::getCategoryCode, 20L).one();
|
|
||||||
MaterialCategoryEntity secCategoryEntity, threeCategoryEntity;
|
|
||||||
if (StringUtils.isNotEmpty(data.getSecondMaterialCategoryName()) && StringUtils.isNotEmpty(data.getThirdMaterialCategoryName())) {
|
|
||||||
secCategoryEntity = materialCategoryService.getBaseMapper().selectByParentCategoryRowIdAndCategoryName(materialCategoryEntity.getRowId(), data.getSecondMaterialCategoryName().trim());
|
|
||||||
if (secCategoryEntity == null) {
|
|
||||||
throw new NflgBusinessException(STATE.Error, "新中类不存在,请确认是否是制作物料的中类");
|
|
||||||
}
|
|
||||||
threeCategoryEntity = materialCategoryService.getBaseMapper().selectByParentCategoryRowIdAndCategoryName(secCategoryEntity.getRowId(), data.getThirdMaterialCategoryName().trim());
|
|
||||||
if (threeCategoryEntity == null) {
|
|
||||||
throw new NflgBusinessException(STATE.Error, "新小类不存在,请确认是否是制作物料的小类");
|
|
||||||
}
|
|
||||||
ent.setNewCategoryCode(threeCategoryEntity.getCategoryCode());
|
|
||||||
MaterialMainVO vo = new MaterialMainVO();
|
|
||||||
vo.setSecondMaterialCategoryName(secCategoryEntity.getCategoryName());
|
|
||||||
vo.setThirdMaterialCategoryName(threeCategoryEntity.getCategoryName());
|
|
||||||
ent.setNewCategoryNameTree(getMaterialCategoryTree(vo));
|
|
||||||
} else {
|
|
||||||
threeCategoryEntity = materialCategoryService.lambdaQuery().eq(MaterialCategoryEntity::getCategoryCode, material.getMaterialCategoryCode()).one();
|
|
||||||
}
|
|
||||||
// (relCategoryCode=21)的物料,图号或者名称有变更时,导入后系统需自动重新拼接生成新物料描述。
|
|
||||||
// (relCategoryCode=22)的物料,当前新增物料描述或申请变更时,他们的物料描述=物料名称
|
|
||||||
if (threeCategoryEntity.getRelCategoryCode().equals("21")) {
|
|
||||||
if (StringUtils.isNotEmpty(data.getDrawingNo()) && StringUtils.isNotEmpty(data.getMaterialName())) {
|
|
||||||
ent.setNewMateiralDesc(data.getDrawingNo() + " " + data.getMaterialName());
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(data.getDrawingNo()) && StringUtils.isNotEmpty(data.getMaterialName())) {
|
|
||||||
ent.setNewMateiralDesc(material.getDrawingNo() + " " + data.getMaterialName());
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(data.getDrawingNo()) && StringUtils.isEmpty(data.getMaterialName())) {
|
|
||||||
ent.setNewMateiralDesc(data.getDrawingNo() + " " + material.getMaterialName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果制作物料-发货直发制作包、非图纸物料,则强制赋值:物料名称=图号=物料描述
|
|
||||||
if (threeCategoryEntity.getRelCategoryCode().equals("22")) {
|
|
||||||
if (StringUtils.isNotEmpty(data.getMaterialName())) {
|
|
||||||
ent.setNewMateiralDesc(data.getMaterialName());
|
|
||||||
ent.setNewDrawingNo(data.getMaterialName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ent.setOldMaterialState(material.getMaterialState());
|
|
||||||
ent.setOldMaterialStateName(MaterialStateConstant.materialStateMp.get(material.getMaterialState()));
|
|
||||||
ent.setOldCategoryCode(material.getMaterialCategoryCode());
|
|
||||||
ent.setOldCategoryNameTree(getMaterialCategoryTree(materialMainVO));
|
|
||||||
ent.setOldMaterialDesc(material.getMaterialDesc());
|
|
||||||
ent.setOldShortMaterialDesc(material.getShortMaterialDesc());
|
|
||||||
ent.setOldDrawingNo(material.getDrawingNo());
|
|
||||||
|
|
||||||
// 20230809--新增物料名称数据
|
|
||||||
ent.setMaterialName(data.getMaterialName());
|
|
||||||
ent.setNewDrawingNo(data.getDrawingNo());
|
|
||||||
ent.setUpdateResion(data.getUpdateResion());
|
|
||||||
ent.setReplaceMaterialNo(data.getReplaceMaterialNo());
|
|
||||||
ent.setApplyDeptName(applyDeptName);
|
|
||||||
ent.setCreatedByName(SessionUtil.getRealName());
|
|
||||||
ent.setCreatedBy(SessionUtil.getUserCode());
|
|
||||||
ent.setCreatedTime(new Date());
|
|
||||||
ents.add(ent);
|
|
||||||
|
|
||||||
// 允许简化描述变更前后相同,但不可与系统内其他物料的描述或简化描述相同
|
|
||||||
ResultVO<String> checkMaterialDesc = checkMaterialDesc(ent);
|
|
||||||
if (Objects.nonNull(checkMaterialDesc)) {
|
|
||||||
log.info("【checkMaterialDesc校验结果】:" + checkMaterialDesc.getMsg());
|
|
||||||
return ResultVO.error(checkMaterialDesc.getMsg());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
|
|
||||||
this.saveBatch(ents);
|
|
||||||
//同步OA
|
|
||||||
materialUpdateToOAService.sysnToOa(ents);
|
|
||||||
}
|
}
|
||||||
return ResultVO.success(Boolean.TRUE);
|
return ResultVO.success(importVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态变更
|
||||||
|
*/
|
||||||
|
private void handleImportDataForState(List<MaterialStateUpExcelDTO> excelContext, String applyDeptName, AuthorityDepartmentEntity deptEnt, String realName, String userCode) {
|
||||||
|
List<MaterialUpdateBillEntity> ents = new ArrayList<>();
|
||||||
|
excelContext = excelContext.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||||
|
if (excelContext.size() <= 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, "导入内容不允许为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> upMaterialNos = excelContext.stream().map(MaterialStateUpExcelDTO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
checkMaterialRep(upMaterialNos);
|
||||||
|
|
||||||
|
Set<String> exitstUpNos = Sets.newHashSet(this.getBaseMapper().getExtstUpdataBillMaterialNos(upMaterialNos));
|
||||||
|
Set<String> upMaterialNosSet = Sets.newHashSet(upMaterialNos);
|
||||||
|
Set<String> intersection = Sets.intersection(exitstUpNos, upMaterialNosSet);
|
||||||
|
if (intersection.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", intersection).concat("已有存在申请中的变更单"));
|
||||||
|
}
|
||||||
|
//正式物料
|
||||||
|
HashSet<String> formalMNos = Sets.newHashSet(this.getBaseMapper().getExtstFormalMaterialNos(upMaterialNos));
|
||||||
|
Set<String> formDifferenceSet = Sets.difference(upMaterialNosSet, formalMNos);
|
||||||
|
if (formDifferenceSet.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", formDifferenceSet).concat("为非正式物料,不允许变更"));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MaterialStateUpExcelDTO> updateResionList = excelContext.stream().filter(item -> StringUtils.isEmpty(item.getUpdateResion())).collect(Collectors.toList());
|
||||||
|
List<String> updateResionMaterialNoList = updateResionList.stream().map(MaterialStateUpExcelDTO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
if (updateResionMaterialNoList.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", updateResionMaterialNoList).concat("为未填写变更原因"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> states = Sets.newHashSet("激活", "禁止采购", "售后专用", "冻结", "完全弃用");
|
||||||
|
Set<String> excelStates = Sets.newHashSet(excelContext.stream().map(u -> EecExcelUtil.StringTrim(u.getNewState())).filter(StringUtils::isNotEmpty).collect(Collectors.toList()));
|
||||||
|
Set<String> difState = Sets.difference(excelStates, states);
|
||||||
|
if (difState.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", difState).concat(" 状态错误,状态不能含有空格,状态只能选择激活/禁止采购/售后专用/冻结/完全弃用"));
|
||||||
|
}
|
||||||
|
// 变更后状态不是冻结的集合
|
||||||
|
Set<String> notFreezeSet = new HashSet<>();
|
||||||
|
for (MaterialStateUpExcelDTO data : excelContext) {
|
||||||
|
MaterialMainEntity material = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, data.getMaterialNo()).one();
|
||||||
|
MaterialMainVO materialMainVO = materialMainService.selectByRowId(material.getRowId(), MaterialMainTypeEnum.ONE.getCode(), userCode);
|
||||||
|
|
||||||
|
String checkMaterialState = checkMaterialState(material);
|
||||||
|
if (ObjectUtil.isNotEmpty(checkMaterialState)) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, checkMaterialState);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果物料是状态变更,且变更状态为冻结或完全弃用,物料昨日库得值 大于 0时,不允许申请冻结
|
||||||
|
Integer materialState = MaterialStateConstant.materialStateNameKeyMp.get(EecExcelUtil.StringTrim(data.getNewState()));
|
||||||
|
Double materialStock = 0D;
|
||||||
|
if (Objects.nonNull(material.getMaterialStock())) {
|
||||||
|
materialStock = material.getMaterialStock();
|
||||||
|
}
|
||||||
|
boolean flagOne = materialStock.compareTo(0D) > 0;
|
||||||
|
boolean flagTwo = materialState.compareTo(material.getMaterialState()) != 0;
|
||||||
|
boolean flagThree = materialState.compareTo(MaterialStateEnum.FROZEN.getValue()) == 0 || materialState.compareTo(MaterialStateEnum.GIVEUP.getValue()) == 0;
|
||||||
|
if (flagTwo && flagThree) {
|
||||||
|
if (flagOne) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, "物料编号为" + material.getMaterialNo() + "的物料还有库存,无法申请冻结或完全弃用");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialUpdateBillEntity ent = new MaterialUpdateBillEntity();
|
||||||
|
ent.setMaterialNo(data.getMaterialNo());
|
||||||
|
ent.setOldMaterialState(material.getMaterialState());
|
||||||
|
ent.setOldMaterialStateName(MaterialStateConstant.materialStateMp.get(material.getMaterialState()));
|
||||||
|
ent.setNewMaterialState(materialState);
|
||||||
|
ent.setNewMaterialStateName(data.getNewState());
|
||||||
|
ent.setUpdateResion(data.getUpdateResion());
|
||||||
|
ent.setReplaceMaterialNo(data.getReplaceMaterialNo());
|
||||||
|
ent.setOldCategoryCode(material.getMaterialCategoryCode());
|
||||||
|
ent.setOldCategoryNameTree(getMaterialCategoryTree(materialMainVO));
|
||||||
|
ent.setOldMaterialDesc(material.getMaterialDesc());
|
||||||
|
ent.setApplyDeptName(applyDeptName);
|
||||||
|
ent.setCreatedByName(realName);
|
||||||
|
ent.setCreatedBy(userCode);
|
||||||
|
ent.setCreatedTime(new Date());
|
||||||
|
ents.add(ent);
|
||||||
|
|
||||||
|
if (materialState != 4) {
|
||||||
|
notFreezeSet.add(data.getMaterialNo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
|
||||||
|
this.saveBatch(ents);
|
||||||
|
//同步OA
|
||||||
|
materialUpdateToOAService.sysncToOaOnleState(ents, userCode);
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(notFreezeSet)) {
|
||||||
|
// 过滤出 11、51物料 && 解冻
|
||||||
|
List<MaterialMainEntity> notFreezeList = materialMainService.lambdaQuery()
|
||||||
|
.and(q -> q.in(MaterialMainEntity::getMaterialNo, notFreezeSet))
|
||||||
|
.and(q -> q.likeRight(MaterialMainEntity::getMaterialCategoryCode, "10").or().likeRight(MaterialMainEntity::getMaterialCategoryCode, "50"))
|
||||||
|
.and(q -> q.eq(MaterialMainEntity::getMaterialState, 4))
|
||||||
|
.list();
|
||||||
|
if (CollectionUtil.isNotEmpty(notFreezeList)) {
|
||||||
|
log.debug("【物料变更】解冻的物料号:\n");
|
||||||
|
List<MaterialMainEntity> updateList = new ArrayList<>(notFreezeList.size());
|
||||||
|
// 11、51物料 && 解冻,则运算起始时间为变更申请时间一年之后
|
||||||
|
Date startDate = Date.from(LocalDate.now().plusYears(1L).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
notFreezeList.forEach(item -> {
|
||||||
|
MaterialMainEntity entity = new MaterialMainEntity();
|
||||||
|
entity.setRowId(item.getRowId());
|
||||||
|
updateList.add(entity);
|
||||||
|
log.debug("{}\t", item.getMaterialNo());
|
||||||
|
});
|
||||||
|
updateList.forEach(item -> item.setFreezeCalcStart(startDate));
|
||||||
|
materialMainService.updateBatchById(updateList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制作物料综合变更
|
||||||
|
*/
|
||||||
|
private void handleImportDataForSummary(List<TwentyMaterialTemplateExcelDTO> excelContext, String applyDeptName, AuthorityDepartmentEntity deptEnt, String realName, String userCode) {
|
||||||
|
List<MaterialUpdateBillEntity> ents = new ArrayList<>();
|
||||||
|
excelContext = excelContext.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||||
|
if (excelContext.size() <= 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, "导入内容不允许为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> upMaterialNos = excelContext.stream().map(TwentyMaterialTemplateExcelDTO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
checkMaterialRep(upMaterialNos);
|
||||||
|
|
||||||
|
Set<String> exitstUpNos = Sets.newHashSet(this.getBaseMapper().getExtstUpdataBillMaterialNos(upMaterialNos));
|
||||||
|
Set<String> upMaterialNosSet = Sets.newHashSet(upMaterialNos);
|
||||||
|
Set<String> intersection = Sets.intersection(exitstUpNos, upMaterialNosSet);
|
||||||
|
if (intersection.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", intersection).concat("已有存在申请中的变更单"));
|
||||||
|
}
|
||||||
|
//正式物料
|
||||||
|
HashSet<String> formalMNos = Sets.newHashSet(this.getBaseMapper().getExtstFormalMaterialNos(upMaterialNos));
|
||||||
|
Set<String> formDifferenceSet = Sets.difference(upMaterialNosSet, formalMNos);
|
||||||
|
if (formDifferenceSet.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", formDifferenceSet).concat("为非正式物料,不允许变更"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断新图号是否在数据库中已存在
|
||||||
|
List<String> drawingNoList = excelContext.stream().map(TwentyMaterialTemplateExcelDTO::getDrawingNo).collect(Collectors.toList());
|
||||||
|
List<MaterialMainEntity> entityList = this.materialMainService.lambdaQuery().in(MaterialMainEntity::getDrawingNo, drawingNoList).list();
|
||||||
|
if (entityList != null && entityList.size() > 0) {
|
||||||
|
List<String> drawingNos = entityList.stream().map(MaterialMainEntity::getDrawingNo).collect(Collectors.toList());
|
||||||
|
List<MaterialMainEntity> others = entityList.stream().filter(item -> !upMaterialNos.contains(item.getMaterialNo())).collect(Collectors.toList());
|
||||||
|
if (others.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", drawingNos).concat("的图号在正式物料中已存在"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 申请中的变更
|
||||||
|
List<MaterialUpdateBillEntity> billEntityList = this.lambdaQuery().eq(MaterialUpdateBillEntity::getBillState, 1).in(MaterialUpdateBillEntity::getDrawingNo, drawingNoList).list();
|
||||||
|
if (billEntityList != null && billEntityList.size() > 0) {
|
||||||
|
List<String> drawingNos = billEntityList.stream().map(MaterialUpdateBillEntity::getDrawingNo).collect(Collectors.toList());
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", drawingNos).concat("的新图号在变更申请中已存在,请检查"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> states = Sets.newHashSet("激活", "禁止采购", "售后专用", "冻结", "完全弃用");
|
||||||
|
Set<String> excelStates = excelContext.stream().filter(item -> StringUtils.isNotEmpty(item.getNewState()))
|
||||||
|
.map(u -> EecExcelUtil.StringTrim(u.getNewState())).filter(StringUtils::isNotEmpty).collect(Collectors.toSet());
|
||||||
|
Set<String> difState = Sets.difference(excelStates, states);
|
||||||
|
if (difState.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", difState).concat("状态错误,状态不能含有空格,状态只能选择激活/禁止采购/售后专用/冻结/完全弃用"));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TwentyMaterialTemplateExcelDTO> updateResionList = excelContext.stream().filter(item -> StringUtils.isEmpty(item.getUpdateResion())).collect(Collectors.toList());
|
||||||
|
List<String> updateResionMaterialNoList = updateResionList.stream().map(TwentyMaterialTemplateExcelDTO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
if (updateResionMaterialNoList.size() > 0) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, StrUtil.join(",", updateResionMaterialNoList).concat("为未填写变更原因"));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TwentyMaterialTemplateExcelDTO data : excelContext) {
|
||||||
|
MaterialMainEntity material = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, data.getMaterialNo()).one();
|
||||||
|
if (material.getProcessState().compareTo(MaterialProcessStateEnum.AUDIT.getValue()) != 0 && material.getProcessState().compareTo(MaterialProcessStateEnum.HISTORY_MATERIAL.getValue()) != 0) {
|
||||||
|
MaterialProcessStateEnum materialProcessStateEnum = MaterialProcessStateEnum.findDescriptionByValue(material.getProcessState());
|
||||||
|
throw new NflgBusinessException(STATE.Error, "物料号为" + data.getMaterialNo() + "的物料流程状态为" + materialProcessStateEnum.getDescription() + ",不允许导入变更");
|
||||||
|
}
|
||||||
|
|
||||||
|
String checkMaterialState = checkMaterialState(material);
|
||||||
|
if (ObjectUtil.isNotEmpty(checkMaterialState)) {
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, checkMaterialState);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialMainVO materialMainVO = new MaterialMainVO();
|
||||||
|
BeanUtils.copyProperties(material, materialMainVO);
|
||||||
|
MaterialUpdateBillEntity ent = new MaterialUpdateBillEntity();
|
||||||
|
ent.setMaterialNo(data.getMaterialNo());
|
||||||
|
if (StringUtils.isNotEmpty(data.getNewState())) {
|
||||||
|
ent.setNewMaterialState(MaterialStateConstant.materialStateNameKeyMp.get(EecExcelUtil.StringTrim(data.getNewState())));
|
||||||
|
ent.setNewMaterialStateName(data.getNewState());
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialCategoryEntity materialCategoryEntity = materialCategoryService.lambdaQuery().eq(MaterialCategoryEntity::getCategoryCode, 20L).one();
|
||||||
|
MaterialCategoryEntity secCategoryEntity, threeCategoryEntity;
|
||||||
|
if (StringUtils.isNotEmpty(data.getSecondMaterialCategoryName()) && StringUtils.isNotEmpty(data.getThirdMaterialCategoryName())) {
|
||||||
|
secCategoryEntity = materialCategoryService.getBaseMapper().selectByParentCategoryRowIdAndCategoryName(materialCategoryEntity.getRowId(), data.getSecondMaterialCategoryName().trim());
|
||||||
|
if (secCategoryEntity == null) {
|
||||||
|
throw new NflgBusinessException(STATE.Error, "新中类不存在,请确认是否是制作物料的中类");
|
||||||
|
}
|
||||||
|
threeCategoryEntity = materialCategoryService.getBaseMapper().selectByParentCategoryRowIdAndCategoryName(secCategoryEntity.getRowId(), data.getThirdMaterialCategoryName().trim());
|
||||||
|
if (threeCategoryEntity == null) {
|
||||||
|
throw new NflgBusinessException(STATE.Error, "新小类不存在,请确认是否是制作物料的小类");
|
||||||
|
}
|
||||||
|
ent.setNewCategoryCode(threeCategoryEntity.getCategoryCode());
|
||||||
|
MaterialMainVO vo = new MaterialMainVO();
|
||||||
|
vo.setSecondMaterialCategoryName(secCategoryEntity.getCategoryName());
|
||||||
|
vo.setThirdMaterialCategoryName(threeCategoryEntity.getCategoryName());
|
||||||
|
ent.setNewCategoryNameTree(getMaterialCategoryTree(vo));
|
||||||
|
} else {
|
||||||
|
threeCategoryEntity = materialCategoryService.lambdaQuery().eq(MaterialCategoryEntity::getCategoryCode, material.getMaterialCategoryCode()).one();
|
||||||
|
}
|
||||||
|
// (relCategoryCode=21)的物料,图号或者名称有变更时,导入后系统需自动重新拼接生成新物料描述。
|
||||||
|
// (relCategoryCode=22)的物料,当前新增物料描述或申请变更时,他们的物料描述=物料名称
|
||||||
|
if (threeCategoryEntity.getRelCategoryCode().equals("21")) {
|
||||||
|
if (StringUtils.isNotEmpty(data.getDrawingNo()) && StringUtils.isNotEmpty(data.getMaterialName())) {
|
||||||
|
ent.setNewMateiralDesc(data.getDrawingNo() + " " + data.getMaterialName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(data.getDrawingNo()) && StringUtils.isNotEmpty(data.getMaterialName())) {
|
||||||
|
ent.setNewMateiralDesc(material.getDrawingNo() + " " + data.getMaterialName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(data.getDrawingNo()) && StringUtils.isEmpty(data.getMaterialName())) {
|
||||||
|
ent.setNewMateiralDesc(data.getDrawingNo() + " " + material.getMaterialName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果制作物料-发货直发制作包、非图纸物料,则强制赋值:物料名称=图号=物料描述
|
||||||
|
if (threeCategoryEntity.getRelCategoryCode().equals("22")) {
|
||||||
|
if (StringUtils.isNotEmpty(data.getMaterialName())) {
|
||||||
|
ent.setNewMateiralDesc(data.getMaterialName());
|
||||||
|
ent.setNewDrawingNo(data.getMaterialName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ent.setOldMaterialState(material.getMaterialState());
|
||||||
|
ent.setOldMaterialStateName(MaterialStateConstant.materialStateMp.get(material.getMaterialState()));
|
||||||
|
ent.setOldCategoryCode(material.getMaterialCategoryCode());
|
||||||
|
ent.setOldCategoryNameTree(getMaterialCategoryTree(materialMainVO));
|
||||||
|
ent.setOldMaterialDesc(material.getMaterialDesc());
|
||||||
|
ent.setOldShortMaterialDesc(material.getShortMaterialDesc());
|
||||||
|
ent.setOldDrawingNo(material.getDrawingNo());
|
||||||
|
|
||||||
|
// 20230809--新增物料名称数据
|
||||||
|
ent.setMaterialName(data.getMaterialName());
|
||||||
|
ent.setNewDrawingNo(data.getDrawingNo());
|
||||||
|
ent.setUpdateResion(data.getUpdateResion());
|
||||||
|
ent.setReplaceMaterialNo(data.getReplaceMaterialNo());
|
||||||
|
ent.setApplyDeptName(applyDeptName);
|
||||||
|
ent.setCreatedByName(realName);
|
||||||
|
ent.setCreatedBy(userCode);
|
||||||
|
ent.setCreatedTime(new Date());
|
||||||
|
ents.add(ent);
|
||||||
|
|
||||||
|
// 允许简化描述变更前后相同,但不可与系统内其他物料的描述或简化描述相同
|
||||||
|
ResultVO<String> checkMaterialDesc = checkMaterialDesc(ent);
|
||||||
|
if (Objects.nonNull(checkMaterialDesc)) {
|
||||||
|
log.info("【checkMaterialDesc校验结果】:" + checkMaterialDesc.getMsg());
|
||||||
|
throw new NflgBusinessException(STATE.ParamErr, checkMaterialDesc.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.validateFreezeStateChangeOther(ents, deptEnt.getDptCode());
|
||||||
|
this.saveBatch(ents);
|
||||||
|
//同步OA
|
||||||
|
materialUpdateToOAService.sysnToOa(ents, userCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 申请部门是 营销中心,11,21变更,由冻结改成其他状态,不允许改成激活
|
// 申请部门是 营销中心,11,21变更,由冻结改成其他状态,不允许改成激活
|
||||||
|
|
@ -850,7 +923,7 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
||||||
MaterialUpdateBillEntity materialUpdateBillEntity = this.lambdaQuery().eq(MaterialUpdateBillEntity::getRowId, rowId).one();
|
MaterialUpdateBillEntity materialUpdateBillEntity = this.lambdaQuery().eq(MaterialUpdateBillEntity::getRowId, rowId).one();
|
||||||
MaterialMainEntity ent = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, materialNo).one();
|
MaterialMainEntity ent = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, materialNo).one();
|
||||||
if (!Objects.isNull(ent)) {
|
if (!Objects.isNull(ent)) {
|
||||||
materialMainVO = materialMainService.selectByRowId(ent.getRowId(), MaterialMainTypeEnum.ONE.getCode());
|
materialMainVO = materialMainService.selectByRowId(ent.getRowId(), MaterialMainTypeEnum.ONE.getCode(), SessionUtil.getUserCode());
|
||||||
materialMainVO.setMaterialDesc(materialUpdateBillEntity.getNewMateiralDesc());
|
materialMainVO.setMaterialDesc(materialUpdateBillEntity.getNewMateiralDesc());
|
||||||
materialMainVO.setOldMaterialDesc(materialUpdateBillEntity.getOldMaterialDesc());
|
materialMainVO.setOldMaterialDesc(materialUpdateBillEntity.getOldMaterialDesc());
|
||||||
materialMainVO.setShortMaterialDesc(materialUpdateBillEntity.getNewShortMaterialDesc());
|
materialMainVO.setShortMaterialDesc(materialUpdateBillEntity.getNewShortMaterialDesc());
|
||||||
|
|
@ -1031,4 +1104,8 @@ public class MaterialUpdateBillService extends ServiceImpl<MaterialUpdateBillMap
|
||||||
}
|
}
|
||||||
return rlist;
|
return rlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildKey(String key) {
|
||||||
|
return StrUtil.format("{}:{}", PREFIX, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,13 @@ public class MaterialUpdateToOAService {
|
||||||
|
|
||||||
public void submit(List<Long> rowIds) {
|
public void submit(List<Long> rowIds) {
|
||||||
List<MaterialUpdateBillEntity> entityList = materialUpdateBillService.lambdaQuery().in(MaterialUpdateBillEntity::getRowId, rowIds).list();
|
List<MaterialUpdateBillEntity> entityList = materialUpdateBillService.lambdaQuery().in(MaterialUpdateBillEntity::getRowId, rowIds).list();
|
||||||
sysnToOa(entityList);
|
sysnToOa(entityList, SessionUtil.getUserCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<String, Object> getHttpMap() {
|
public Map<String, Object> getHttpMap(String userCode) {
|
||||||
Map<String, Object> result = new LinkedHashMap<>();
|
Map<String, Object> result = new LinkedHashMap<>();
|
||||||
result.put("userid", SessionUtil.getUserCode());
|
result.put("userid", userCode);
|
||||||
result.put("summary", NacosConfig.getNacosConfig().getSummary());
|
result.put("summary", NacosConfig.getNacosConfig().getSummary());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -89,9 +89,9 @@ public class MaterialUpdateToOAService {
|
||||||
* 同步OA变更状态
|
* 同步OA变更状态
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
public void sysncToOaOnleState(List<MaterialUpdateBillEntity> data) {
|
public void sysncToOaOnleState(List<MaterialUpdateBillEntity> data, String userCode) {
|
||||||
|
|
||||||
Map<String, Object> result = getHttpMap();
|
Map<String, Object> result = getHttpMap(userCode);
|
||||||
List<Map<String, String>> list = new ArrayList<>();
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
data.forEach(u -> {
|
data.forEach(u -> {
|
||||||
Map<String, String> material = new LinkedHashMap<>();
|
Map<String, String> material = new LinkedHashMap<>();
|
||||||
|
|
@ -133,14 +133,14 @@ public class MaterialUpdateToOAService {
|
||||||
httpStateToOa(result, data);
|
httpStateToOa(result, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sysnToOa(List<MaterialUpdateBillEntity> data) {
|
public void sysnToOa(List<MaterialUpdateBillEntity> data, String userCode) {
|
||||||
// 批量提交,校验是否有重复物料变更
|
// 批量提交,校验是否有重复物料变更
|
||||||
Set<String> materialNoSet = data.stream().map(MaterialUpdateBillEntity::getMaterialNo).collect(Collectors.toSet());
|
Set<String> materialNoSet = data.stream().map(MaterialUpdateBillEntity::getMaterialNo).collect(Collectors.toSet());
|
||||||
if (data.size() != materialNoSet.size()) {
|
if (data.size() != materialNoSet.size()) {
|
||||||
throw new NflgBusinessException(STATE.BusinessError, "批量提交的物料含重复项,请先删除重复项");
|
throw new NflgBusinessException(STATE.BusinessError, "批量提交的物料含重复项,请先删除重复项");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> result = getHttpMap();
|
Map<String, Object> result = getHttpMap(userCode);
|
||||||
List<Map<String, String>> list = new ArrayList<>();
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
preHandleCategoryNameTree(data);
|
preHandleCategoryNameTree(data);
|
||||||
data.forEach(u -> {
|
data.forEach(u -> {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,14 @@
|
||||||
#nacos.server-addr=114.132.64.230:8123
|
#nacos.server-addr=114.132.64.230:8123
|
||||||
nacos.server-addr=192.168.0.194:8848
|
nacos.server-addr=192.168.0.194:8848
|
||||||
|
spring.cache.type=redis
|
||||||
|
spring.redis.database=1
|
||||||
|
spring.redis.host=192.168.0.194
|
||||||
|
spring.redis.password=
|
||||||
|
spring.redis.port=6379
|
||||||
|
spring.redis.timeout=0
|
||||||
|
spring.redis.ssl=false
|
||||||
|
spring.redis.lettuce.pool.max-wait=-1ms
|
||||||
|
spring.redis.lettuce.pool.max-active=8
|
||||||
|
spring.redis.lettuce.pool.max-idle=8
|
||||||
|
spring.redis.lettuce.pool.min-idle=0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,12 @@
|
||||||
nacos.server-addr=192.168.0.191:8848
|
nacos.server-addr=192.168.0.191:8848
|
||||||
|
spring.cache.type=redis
|
||||||
|
spring.redis.database=0
|
||||||
|
spring.redis.host=192.168.0.191
|
||||||
|
spring.redis.password=
|
||||||
|
spring.redis.port=6379
|
||||||
|
spring.redis.timeout=0
|
||||||
|
spring.redis.ssl=false
|
||||||
|
spring.redis.lettuce.pool.max-wait=-1ms
|
||||||
|
spring.redis.lettuce.pool.max-active=8
|
||||||
|
spring.redis.lettuce.pool.max-idle=8
|
||||||
|
spring.redis.lettuce.pool.min-idle=0
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,14 @@
|
||||||
#nacos.server-addr=114.132.64.230:8123
|
#nacos.server-addr=114.132.64.230:8123
|
||||||
nacos.server-addr=192.168.0.194:8848
|
nacos.server-addr=192.168.0.194:8848
|
||||||
|
spring.cache.type=redis
|
||||||
|
spring.redis.database=1
|
||||||
|
spring.redis.host=192.168.0.194
|
||||||
|
spring.redis.password=
|
||||||
|
spring.redis.port=6379
|
||||||
|
spring.redis.timeout=0
|
||||||
|
spring.redis.ssl=false
|
||||||
|
spring.redis.lettuce.pool.max-wait=-1ms
|
||||||
|
spring.redis.lettuce.pool.max-active=8
|
||||||
|
spring.redis.lettuce.pool.max-idle=8
|
||||||
|
spring.redis.lettuce.pool.min-idle=0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue