mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge branch 'main' of http://192.168.1.205:9980/cf_devdept2/cf_imes_server
This commit is contained in:
+13
-2
@@ -29,8 +29,7 @@
|
||||
<mybatis-plus-generator.version>3.5.5</mybatis-plus-generator.version>
|
||||
<dynamic-datasource.version>4.3.0</dynamic-datasource.version>
|
||||
<mybatis-plus-join.version>1.4.10</mybatis-plus-join.version>
|
||||
<redisson.version>3.18.0
|
||||
</redisson.version> <!-- Spring Boot 2.X 最多使用 3.18.0 版本,否则会报 Tuple NoClassDefFoundError -->
|
||||
<redisson.version>3.36.0</redisson.version> <!-- Spring Boot 2.X 最多使用 3.18.0 版本,否则会报 Tuple NoClassDefFoundError -->
|
||||
<dm8.jdbc.version>8.1.3.62</dm8.jdbc.version>
|
||||
<elasticsearch.version>8.8.1</elasticsearch.version>
|
||||
<jakarta-json.version>2.1.1</jakarta-json.version>
|
||||
@@ -284,6 +283,18 @@
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
<version>${redisson.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.redisson</groupId>
|
||||
<!-- 使用 redisson-spring-data-27 替代,解决 Tuple NoClassDefFoundError 报错 -->
|
||||
<artifactId>redisson-spring-data-33</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-data-27</artifactId>
|
||||
<version>${redisson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-data-27</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
+7
-22
@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import com.cf.imes.framework.common.util.encrypt.AesUtils;
|
||||
import org.redisson.config.ClusterServersConfig;
|
||||
import org.redisson.config.Config;
|
||||
import org.redisson.config.MasterSlaveServersConfig;
|
||||
import org.redisson.config.ReplicatedServersConfig;
|
||||
import org.redisson.config.SentinelServersConfig;
|
||||
import org.redisson.config.SingleServerConfig;
|
||||
import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer;
|
||||
@@ -33,44 +31,31 @@ public class ChenfengRedisEncryptAutoConfiguration {
|
||||
BeanUtil.copyProperties(configuration, redissonConfig);
|
||||
|
||||
String password;
|
||||
SingleServerConfig singleServerConfig = redissonConfig.useSingleServer();
|
||||
if (singleServerConfig != null) {
|
||||
|
||||
// 单机模式
|
||||
if (redissonConfig.isSingleConfig()) {
|
||||
SingleServerConfig singleServerConfig = redissonConfig.useSingleServer();
|
||||
password = singleServerConfig.getPassword();
|
||||
singleServerConfig.setPassword(
|
||||
StringUtils.isEmpty(password) ? null : AesUtils.decrypt(password, publicKey));
|
||||
return;
|
||||
}
|
||||
|
||||
MasterSlaveServersConfig masterSlaveServersConfig = redissonConfig.useMasterSlaveServers();
|
||||
if (masterSlaveServersConfig != null) {
|
||||
password = masterSlaveServersConfig.getPassword();
|
||||
masterSlaveServersConfig.setPassword(
|
||||
StringUtils.isEmpty(password) ? null : AesUtils.decrypt(password, publicKey));
|
||||
return;
|
||||
}
|
||||
|
||||
// 哨兵模式
|
||||
if (redissonConfig.isSentinelConfig()) {
|
||||
SentinelServersConfig sentinelServersConfig = redissonConfig.useSentinelServers();
|
||||
if (sentinelServersConfig != null) {
|
||||
password = sentinelServersConfig.getPassword();
|
||||
sentinelServersConfig.setPassword(
|
||||
StringUtils.isEmpty(password) ? null : AesUtils.decrypt(password, publicKey));
|
||||
return;
|
||||
}
|
||||
|
||||
// 集群模式
|
||||
if (redissonConfig.isClusterConfig()) {
|
||||
ClusterServersConfig clusterServersConfig = redissonConfig.useClusterServers();
|
||||
if (clusterServersConfig != null) {
|
||||
password = clusterServersConfig.getPassword();
|
||||
clusterServersConfig.setPassword(
|
||||
StringUtils.isEmpty(password) ? null : AesUtils.decrypt(password, publicKey));
|
||||
return;
|
||||
}
|
||||
|
||||
ReplicatedServersConfig replicatedServersConfig = redissonConfig.useReplicatedServers();
|
||||
if (replicatedServersConfig != null) {
|
||||
password = replicatedServersConfig.getPassword();
|
||||
replicatedServersConfig.setPassword(
|
||||
StringUtils.isEmpty(password) ? null : AesUtils.decrypt(password, publicKey));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+3
@@ -111,6 +111,7 @@ public class OrderController {
|
||||
|
||||
public static final String ORDER_PLATE_MODEL = "imes_order_plate_model";
|
||||
public static final String ORDER_PLATE_MODEL_COMPRESS = "imes_order_plate_model_compress";
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产单")
|
||||
@PreAuthorize("@ss.hasPermission('production:manager-list:edit')")
|
||||
@@ -231,6 +232,7 @@ public class OrderController {
|
||||
if (orderDO == null) {
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL_COMPRESS);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PARTS_REMARK_MODEL);
|
||||
}
|
||||
|
||||
Throwable cause = e.getCause();
|
||||
@@ -380,6 +382,7 @@ public class OrderController {
|
||||
Long deleteOrderId = orderDO.getId();
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL_COMPRESS);
|
||||
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PARTS_REMARK_MODEL);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
|
||||
|
||||
|
||||
List<PlateDetailRespVO> selectPlateListByGoodsIds(@Param("orderIds") List<Long> orderIds,@Param("goodsIdList") List<Long> goodsIdList, @Param("organId") Long organId);
|
||||
List<PlateDetailRespVO> selectPlateListByGoodsIds(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
List<PlateDetailRespVO> selectNoPlanPlate(@Param("orderIds") List<Long> orderIds, @Param("ids") List<Long> ids, @Param("organId") Long organId);
|
||||
|
||||
|
||||
+12
-6
@@ -166,15 +166,17 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
||||
private int resetByYear(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
|
||||
// 上一次的年
|
||||
Integer lastYear = orgCustomPlateNoSeqRespDTO.getLastYear();
|
||||
// 初始值
|
||||
Integer initValue = plateNoRule.getInitValue();
|
||||
String nowYearFormat = plateNoRule.getNow().format(YEAR_FORMATTER);
|
||||
if (ObjectUtil.notEqual(String.valueOf(lastYear), nowYearFormat)) {
|
||||
int nowDayNum = Integer.parseInt(nowYearFormat);
|
||||
// 跨年,把上一次的年设成当前年,后续不再跨年
|
||||
orgCustomPlateNoSeqRespDTO.setLastYear(nowDayNum);
|
||||
// 复位
|
||||
return nowDayNum;
|
||||
return initValue;
|
||||
}
|
||||
return curr;
|
||||
return curr + plateNoRule.getIncrementStep();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,15 +190,17 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
||||
private int resetByMonth(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
|
||||
// 上一次的月
|
||||
Integer lastMonth = orgCustomPlateNoSeqRespDTO.getLastMonth();
|
||||
// 初始值
|
||||
Integer initValue = plateNoRule.getInitValue();
|
||||
String nowMonthFormat = plateNoRule.getNow().format(MONTH_FORMATTER);
|
||||
if (ObjectUtil.notEqual(String.valueOf(lastMonth), nowMonthFormat)) {
|
||||
int nowDayNum = Integer.parseInt(nowMonthFormat);
|
||||
// 跨月,把上一次的月设成当前月,后续不再跨月
|
||||
orgCustomPlateNoSeqRespDTO.setLastMonth(nowDayNum);
|
||||
// 复位
|
||||
return nowDayNum;
|
||||
return initValue;
|
||||
}
|
||||
return curr;
|
||||
return curr + plateNoRule.getIncrementStep();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,14 +214,16 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
|
||||
private int resetByDay(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
|
||||
// 上一次的天
|
||||
Integer lastDay = orgCustomPlateNoSeqRespDTO.getLastDay();
|
||||
// 初始值
|
||||
Integer initValue = plateNoRule.getInitValue();
|
||||
String nowDayFormat = plateNoRule.getNow().format(DAY_FORMATTER);
|
||||
if (ObjectUtil.notEqual(String.valueOf(lastDay), nowDayFormat)) {
|
||||
int nowDayNum = Integer.parseInt(nowDayFormat);
|
||||
// 跨月,把上一次的月设成当前月,后续不再跨月
|
||||
orgCustomPlateNoSeqRespDTO.setLastDay(nowDayNum);
|
||||
// 复位
|
||||
return nowDayNum;
|
||||
return initValue;
|
||||
}
|
||||
return curr;
|
||||
return curr + plateNoRule.getIncrementStep();
|
||||
}
|
||||
}
|
||||
|
||||
+133
-68
@@ -492,9 +492,9 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<GoodsReqVO> goodsDOS = goodsMapper.selectGoodsList(orderId,getUserOrganId());
|
||||
|
||||
List<Long> goodsIds = goodsDOS.stream().map(GoodsReqVO::getId).distinct().toList();
|
||||
AssertUtils.notEmpty(goodsDOS,THIS_ORDER_NOT_PLATE_DATA);
|
||||
|
||||
List<PlateDetailRespVO> plateDOS = plateMapper.selectPlateListByGoodsIds(Collections.singletonList(orderId),goodsIds,getUserOrganId());
|
||||
List<PlateDetailRespVO> plateDOS = plateMapper.selectPlateListByGoodsIds(Collections.singletonList(orderId),getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDOS,ORDER_PLATE_ERROR);
|
||||
|
||||
@@ -673,7 +673,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,req.getPlanConfigId(), planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
|
||||
List<Boolean> isLocks = new ArrayList<>();
|
||||
// List<Boolean> isLocks = new ArrayList<>();
|
||||
|
||||
// 查询原优化信息然后进行判断
|
||||
if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
@@ -682,7 +682,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
throw exception(THIS_PLAN_OPTIMIZE_DATA_ERROR);
|
||||
}
|
||||
|
||||
isLocks.addAll(optimizeBoardModelDOS.stream().map(OptimizeBoardModelDO::getIsLock).distinct().toList());
|
||||
// isLocks.addAll(optimizeBoardModelDOS.stream().map(OptimizeBoardModelDO::getIsLock).distinct().toList());
|
||||
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = optimizeBoardModelDOS.get(0);
|
||||
|
||||
@@ -702,27 +702,25 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<PlateDO> plateDOS = planItemMapper.selectOrderPlanPlateListByPlanId(planId,getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDOS,THIS_PLAN_PLATE_DATA_ERROR);
|
||||
if(CollUtil.isNotEmpty(plateDOS)) {
|
||||
|
||||
|
||||
if(processId != null && !planDO.getProcessId().equals(processId)) {
|
||||
|
||||
validatePlanStatus(planDO,isLocks);
|
||||
|
||||
planMapper.updateById(planDO.setProcessId(processId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
plateDOS.forEach(f->{
|
||||
plateDOS.forEach(f -> {
|
||||
f.setIsOptimized(true);
|
||||
});
|
||||
|
||||
plateMapper.updateBatch(plateDOS);
|
||||
}
|
||||
|
||||
// Long planConfigId = req.getPlanConfigId();
|
||||
// 这个逻辑暂时先不用,等后面方案组逻辑完善后可加入
|
||||
// if(processId != null && !planDO.getProcessId().equals(processId)) {
|
||||
//
|
||||
// validatePlanStatus(planDO,isLocks);
|
||||
//
|
||||
// planMapper.updateById(planDO.setProcessId(processId));
|
||||
//
|
||||
// }
|
||||
|
||||
// esUtils.deleteEsDocument(FIELD_PLAN_CONFIG_ID,FIELD_PLAN_ID,planConfigId,planId,ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,FIELD_PLAN_CONFIG_ID,planId,req.getPlanConfigId(),ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
|
||||
// 保存优化后的大板数据
|
||||
esUtils.saveEsDocument(ORDER_OPTIMIZE_PLATE_MODEL,req.getOptimizeBoardModelDOS());
|
||||
@@ -743,66 +741,106 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
|
||||
List<SaveProcessSchemeModelDO> modelDOList = saveProcessSchemeReqVO.getModelDOList();
|
||||
|
||||
Long planId = modelDOList.stream().map(SaveProcessSchemeModelDO::getPlanId).distinct().toList().get(0);
|
||||
List<SaveProcessSchemeModelDO> schemeModelDOS = new ArrayList<>(modelDOList.stream().filter(Objects::nonNull).toList());
|
||||
|
||||
SaveProcessSchemeModelDO saveProcessSchemeModelDO = Optional.ofNullable(schemeModelDOS.get(0)).orElseThrow(() -> new ServiceException(THIS_PLAN_SCHEME_DATA_ERROR));
|
||||
|
||||
Long planId = Optional.ofNullable(saveProcessSchemeModelDO.getPlanId()).orElseThrow(() -> new ServiceException(THIS_PLAN_SCHEME_DATA_ERROR));
|
||||
|
||||
|
||||
PlanDO planDO = planMapper.selectById(planId);
|
||||
|
||||
AssertUtils.notEmpty(planDO,PLAN_NOT_EXISTS);
|
||||
|
||||
List<Long> planConfigIds = modelDOList.stream().map(SaveProcessSchemeModelDO::getPlanConfigId).distinct().toList();
|
||||
List<Long> planConfigIds = schemeModelDOS.stream().map(SaveProcessSchemeModelDO::getPlanConfigId).distinct().toList();
|
||||
|
||||
List<PlateDO> plateDOS = planItemMapper.selectOrderPlanPlateListByPlanId(planId,getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(plateDOS,THIS_PLAN_PLATE_DATA_ERROR);
|
||||
|
||||
plateDOS.forEach(f->{
|
||||
if(CollUtil.isNotEmpty(plateDOS)) {
|
||||
|
||||
plateDOS.forEach(f -> {
|
||||
f.setIsOptimized(true);
|
||||
});
|
||||
|
||||
plateMapper.updateBatch(plateDOS);
|
||||
|
||||
|
||||
// 不能加非空判断,因为方案组里可能没有优化信息
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
|
||||
List<Boolean> isLocks = new ArrayList<>();
|
||||
|
||||
if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
|
||||
optimizeBoardModelDOS.forEach(f->{
|
||||
|
||||
isLocks.add(Optional.ofNullable(f.getIsLock()).orElse(false));
|
||||
|
||||
modelDOList.add(SaveProcessSchemeModelDO.builder()
|
||||
.planConfigId(f.getPlanConfigId())
|
||||
.planName(f.getPlanConfigName())
|
||||
.plateNum(f.getPlaceBlockNumber())
|
||||
.goodsNum(f.getBoardCount())
|
||||
.isOptimized(true)
|
||||
.build());
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 如果方案组ID不相等,就删除旧的方案组信息,再保存新的加工方案组ID
|
||||
if(!planDO.getProcessId().equals(processId)){
|
||||
|
||||
validatePlanStatus(planDO,isLocks);
|
||||
// validatePlanStatus(planDO,isLocks);
|
||||
|
||||
if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){
|
||||
throw exception(THIS_PLAN_PLATE_IS_CUT);
|
||||
}
|
||||
|
||||
|
||||
// todo 是否全部执行的判断,需要等前端完善加工方案那边的逻辑后,再判断
|
||||
// Integer processSize = systemConfigApi.getProcessSizeByIds(Collections.singletonList(planDO.getProcessId())).getCheckedData();
|
||||
//
|
||||
// List<SaveProcessSchemeModelDO> processSchemeModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, processSize, PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL, SaveProcessSchemeModelDO.class);
|
||||
//
|
||||
// if(CollUtil.isNotEmpty(processSchemeModelDOS) && processSize == processSchemeModelDOS.size()){
|
||||
// throw exception(THIS_PLAN_SCHEME_OPTIMIZE_SIZE_ERROR);
|
||||
// }
|
||||
|
||||
planMapper.updateById(planDO.setProcessId(processId));
|
||||
|
||||
|
||||
// 修改方案组,删除全部的方案组的优化信息
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL);
|
||||
|
||||
// 删除全部的生产优化信息
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,planId,ORDER_OPTIMIZE_PLATE_MODEL);
|
||||
|
||||
// 保存此时的方案组的优化信息
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL,schemeModelDOS);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
esUtils.deleteEsDocument(FIELD_PLAN_ID,FIELD_PLAN_CONFIG_ID,planId,planConfigIds,PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL);
|
||||
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL,modelDOList);
|
||||
esUtils.saveEsDocument(PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL,schemeModelDOS);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// // 不能加非空判断,因为方案组里可能没有优化信息
|
||||
// List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
//
|
||||
//// List<Boolean> isLocks = new ArrayList<>();
|
||||
//
|
||||
// if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
//
|
||||
// optimizeBoardModelDOS.forEach(f->{
|
||||
//
|
||||
//// isLocks.add(Optional.ofNullable(f.getIsLock()).orElse(false));
|
||||
//
|
||||
// schemeModelDOS.add(SaveProcessSchemeModelDO.builder()
|
||||
// .planConfigId(f.getPlanConfigId())
|
||||
// .planName(f.getPlanConfigName())
|
||||
// .plateNum(f.getPlaceBlockNumber())
|
||||
// .goodsNum(f.getBoardCount())
|
||||
// .isOptimized(true)
|
||||
// .build());
|
||||
//
|
||||
// });
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PlanProcessSchemeList getProcessSchemeConfig(Long processId,Long planId) {
|
||||
|
||||
@@ -816,55 +854,82 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
validatePlanExists(planId);
|
||||
|
||||
// 查询排单对应的方案组信息
|
||||
List<SaveProcessSchemeModelDO> saveProcessSchemeReqVOS = Optional.ofNullable(esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL, SaveProcessSchemeModelDO.class)).orElse(new ArrayList<>());
|
||||
// List<SaveProcessSchemeModelDO> saveProcessSchemeReqVOS = Optional.ofNullable(esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL, SaveProcessSchemeModelDO.class)).orElse(new ArrayList<>());
|
||||
|
||||
List<SaveProcessSchemeModelDO> saveProcessSchemeReqVOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, PLAN_PROCESS_SCHEME_OPTIMIZE_MODEL, SaveProcessSchemeModelDO.class);
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(saveProcessSchemeReqVOS)){
|
||||
|
||||
// 查询排单对应的优化信息
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, schemeDTOList.size(), ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(optimizeBoardModelDOS)) {
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(saveProcessSchemeReqVOS)) {
|
||||
if(CollUtil.isNotEmpty(optimizeBoardModelDOS)){
|
||||
|
||||
saveProcessSchemeReqVOS.forEach(f -> {
|
||||
|
||||
List<OptimizeBoardModelDO> modelDOList = optimizeBoardModelDOS.stream().filter(o -> o.getPlanConfigId().equals(f.getPlanConfigId())).toList();
|
||||
if (CollUtil.isNotEmpty(modelDOList)) {
|
||||
|
||||
String jsonString = toJsonString(modelDOList.get(0));
|
||||
OptimizeBoardModelDO optimizeBoardModelDO = modelDOList.get(0);
|
||||
|
||||
String jsonString = toJsonString(optimizeBoardModelDO);
|
||||
|
||||
f.setPlanOptimize(jsonString);
|
||||
f.setGoodsNum(optimizeBoardModelDO.getBoardCount());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
optimizeBoardModelDOS.forEach(f -> {
|
||||
|
||||
saveProcessSchemeReqVOS.add(SaveProcessSchemeModelDO.builder()
|
||||
.planConfigId(f.getPlanConfigId())
|
||||
.planName(f.getPlanConfigName())
|
||||
.planId(f.getPlanId())
|
||||
.plateNum(f.getPlaceBlockNumber())
|
||||
.goodsNum(f.getBoardCount())
|
||||
.planOptimize(toJsonString(f))
|
||||
.build());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
planProcessSchemeList.setSaveProcessSchemeReqVOS(saveProcessSchemeReqVOS);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return planProcessSchemeList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// // 查询排单对应的优化信息
|
||||
// List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLAN_ID, planId, schemeDTOList.size(), ORDER_OPTIMIZE_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
//
|
||||
//
|
||||
// if (CollUtil.isNotEmpty(optimizeBoardModelDOS)) {
|
||||
//
|
||||
//
|
||||
// if (CollUtil.isNotEmpty(saveProcessSchemeReqVOS)) {
|
||||
//
|
||||
// saveProcessSchemeReqVOS.forEach(f -> {
|
||||
//
|
||||
// List<OptimizeBoardModelDO> modelDOList = optimizeBoardModelDOS.stream().filter(o -> o.getPlanConfigId().equals(f.getPlanConfigId())).toList();
|
||||
// if (CollUtil.isNotEmpty(modelDOList)) {
|
||||
//
|
||||
// String jsonString = toJsonString(modelDOList.get(0));
|
||||
//
|
||||
// f.setPlanOptimize(jsonString);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// optimizeBoardModelDOS.forEach(f -> {
|
||||
//
|
||||
// saveProcessSchemeReqVOS.add(SaveProcessSchemeModelDO.builder()
|
||||
// .planConfigId(f.getPlanConfigId())
|
||||
// .planName(f.getPlanConfigName())
|
||||
// .planId(f.getPlanId())
|
||||
// .plateNum(f.getPlaceBlockNumber())
|
||||
// .goodsNum(f.getBoardCount())
|
||||
// .planOptimize(toJsonString(f))
|
||||
// .build());
|
||||
//
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -449,7 +449,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 配件信息
|
||||
List<PartsDO> partsDOS = getPartsGoods(partsDO);
|
||||
|
||||
customPlateNoGenerateService.generateCustomPlateNo(order, plateDO, false);
|
||||
customPlateNoGenerateService.generateCustomPlateNo(order, plateDO, true);
|
||||
orderMapper.insert(order);
|
||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, itemDO, goodsDO, plateGoodDOS, partsDOS);
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
@@ -1252,7 +1252,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
String orderPlateModeList = toJsonString(BeanUtils.toBean(orderModelDOs, OrderPlateList.class));
|
||||
orderModelCompressDO.setOrderModelZip(zipString(orderPlateModeList));
|
||||
|
||||
// 板材造型数据添加 大板分类ID,实际ID,优化信息(默认为 false)
|
||||
// 板材造型数据添加 大板分类ID,实际ID
|
||||
List<OrderGoodsPlateIds> orderGoodsPlateIds = BeanUtils.toBean(plateDO, OrderGoodsPlateIds.class);
|
||||
List<GoodsDO> finalGoodsDO = goodsDO;
|
||||
orderGoodsPlateIds.forEach(f->
|
||||
@@ -1261,7 +1261,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderModelDOs.forEach(f->{
|
||||
f.setGoodsId(orderGoodsPlateIds.stream().filter(fo->fo.getId().equals(f.getPlateId())).map(OrderGoodsPlateIds::getActualGoodsId).toList().get(0));
|
||||
f.setPlateGoodsId(orderGoodsPlateIds.stream().filter(fo->fo.getId().equals(f.getPlateId())).map(OrderGoodsPlateIds::getGoodsId).toList().get(0));
|
||||
// f.setIsOptimized(false);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -386,6 +386,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
if(CollUtil.isEmpty(orderIds)){
|
||||
planMapper.deleteBatchIds(planDOS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -540,7 +541,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
|
||||
// 根据排单ID查询ES中的优化数据
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planIds, planIds.size(), ORDER_REMAIN_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
List<OptimizeBoardModelDO> optimizeBoardModelDOS = esUtils.getEsDocument(FIELD_PLANID, planIds, 999, ORDER_REMAIN_PLATE_MODEL, OptimizeBoardModelDO.class);
|
||||
|
||||
|
||||
// 获取排单对应的生产单的信息
|
||||
|
||||
+1
@@ -394,6 +394,7 @@
|
||||
|
||||
where opi.organ_id = #{organId}
|
||||
and opi.plan_id = #{planId}
|
||||
and op.is_optimized = false
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
-5
@@ -445,11 +445,6 @@
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
|
||||
and op.goods_id in
|
||||
<foreach collection="goodsIdList" item="goodsIdList" open="(" close=")" separator=",">
|
||||
#{goodsIdList}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -6,8 +6,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -42,6 +40,9 @@ public class PlateDetailsRespVO {
|
||||
@Schema(description = "板材ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String plateId;
|
||||
|
||||
@Schema(description = "自定义板编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String customPlateNo;
|
||||
|
||||
@Schema(description = "板编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("板编号")
|
||||
private String plateNo;
|
||||
|
||||
+2
@@ -213,6 +213,7 @@
|
||||
<result property="plateNo" column="plateNo"/>
|
||||
<result property="orderId" column="orderId"/>
|
||||
<result property="plateName" column="plateName"/>
|
||||
<result property="customPlateNo" column="customPlateNo"/>
|
||||
<result property="material" column="plateMaterial"/>
|
||||
<result property="color" column="plateColor"/>
|
||||
<result property="width" column="plateWidth"/>
|
||||
@@ -243,6 +244,7 @@
|
||||
op.id as plateId,
|
||||
op.plate_no as plateNo,
|
||||
op.name as plateName,
|
||||
op.custom_plate_no as customPlateNo,
|
||||
ogs.material as plateMaterial,
|
||||
ogs.color as plateColor,
|
||||
op.order_id as orderId,
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ public final class ErrorCodeConstants {
|
||||
public static final ErrorCode TEMPLATE_NAME_UNIQE_ERROR = new ErrorCode(1_003_001_003, "模板名【{}】已存在,请编辑模板名后重试");
|
||||
public static final ErrorCode TEMPLATE_PREIVEW_QUERYPARAM_EMPTY = new ErrorCode(1_003_001_004, "查询参数不能为空:{}");
|
||||
public static final ErrorCode TEMPLATE_IMPORT_CONTENT_EMPTY_ERROR = new ErrorCode(1_003_001_005, "导入模板内容不能为空,请检查");
|
||||
public static final ErrorCode TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR = new ErrorCode(1_003_001_006, "报表模板内容为空,请检查");
|
||||
|
||||
// ========== UREPORT datasource模块 1-003-002-000 ==========
|
||||
public static final ErrorCode DATASOURCE_NOT_EXISTS = new ErrorCode(1_003_002_001, "报表数据源不存在");
|
||||
|
||||
@@ -135,6 +135,11 @@
|
||||
<version>${commons-text.version}</version>
|
||||
</dependency>
|
||||
<!--ureport-core 相关start-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi-ooxml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-full</artifactId>
|
||||
@@ -148,6 +153,10 @@
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-lite</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>poi</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>${poi-ooxml.version}</version>
|
||||
</dependency>
|
||||
|
||||
+21
@@ -12,6 +12,7 @@ import com.bstek.ureport.utils.StringUtils;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateCommonPreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateRespVO;
|
||||
@@ -114,6 +115,12 @@ public class ReportTemplateController {
|
||||
return success(templateService.preview(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/template/preview/common/")
|
||||
@Operation(summary = "模板通用预览")
|
||||
public CommonResult<HtmlReport> commonPreview(@RequestBody ReportTemplateCommonPreviewReqVO reqVO) {
|
||||
return success(templateService.commonPreview(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/template/print")
|
||||
@Operation(summary = "模板预览打印")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
@@ -121,6 +128,13 @@ public class ReportTemplateController {
|
||||
templateService.print(reqVO, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/print/common")
|
||||
@Operation(summary = "模板预览打印")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
public void commonPrint(@RequestBody ReportTemplateCommonPreviewReqVO reqVO, HttpServletResponse response) {
|
||||
templateService.commonPrint(reqVO, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/download/{type}")
|
||||
@Operation(summary = "模板预览下载")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
@@ -128,6 +142,13 @@ public class ReportTemplateController {
|
||||
templateService.download(type, reqVO, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/download/{type}/common")
|
||||
@Operation(summary = "模板预览下载")
|
||||
@PreAuthorize("@ss.hasPermission('report:preview')")
|
||||
public void commonPrint(@PathVariable @ReportTemplateProducerTypeInEnum @NotBlank(message = "模板下载类型不能为空") String type, @RequestBody ReportTemplateCommonPreviewReqVO reqVO, HttpServletResponse response) {
|
||||
templateService.commonDownload(type, reqVO, response);
|
||||
}
|
||||
|
||||
@PostMapping("/template/excel/import")
|
||||
@Operation(summary = "导入excel模板")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.cf.imes.module.report.controller.admin.template.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Gqr
|
||||
* @since 2024/7/19 9:22
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "管理后台 - 报表模板通用预览请求参数 Request VO")
|
||||
public class ReportTemplateCommonPreviewReqVO {
|
||||
@Schema(description = "页码",example = "1")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
private int pageIndex;
|
||||
|
||||
@Schema(description = "报表模板编号")
|
||||
@NotNull(message = "报表模板编号不能为空")
|
||||
private Long templateId;
|
||||
|
||||
/**
|
||||
* 表单参数
|
||||
*/
|
||||
@Schema(description = "表单参数")
|
||||
@Size(max = 30, message = "表单参数数量不能超过30个")
|
||||
private Map<String, Object> query;
|
||||
|
||||
/**
|
||||
* 表单对应组件唯一标识
|
||||
*/
|
||||
@Schema(description = "表单对应组件唯一标识")
|
||||
@Size(max = 30, message = "表单对应组件唯一标识数量不能超过30个")
|
||||
private Map<String, String> component;
|
||||
|
||||
/**
|
||||
* 图表图片目前用于PDF导出
|
||||
*/
|
||||
@Schema(description = "图表图片")
|
||||
@Size(max = 30, message = "图表图片数量不能超过30个")
|
||||
private Map<String, String> chartImages;
|
||||
|
||||
}
|
||||
+28
@@ -2,6 +2,7 @@ package com.cf.imes.module.report.service.template;
|
||||
|
||||
import com.bstek.designer.bean.ReportDefinitionWrapper;
|
||||
import com.bstek.ureport.export.html.HtmlReport;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateCommonPreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateRespVO;
|
||||
@@ -30,6 +31,7 @@ public interface ReportTemplateService {
|
||||
|
||||
/**
|
||||
* 复制报表模版
|
||||
*
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
@@ -81,11 +83,27 @@ public interface ReportTemplateService {
|
||||
*/
|
||||
HtmlReport preview(ReportTemplatePreviewReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 模板通用预览
|
||||
* 通过模板id+query参数获取预览界面
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
HtmlReport commonPreview(ReportTemplateCommonPreviewReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 模版预览打印
|
||||
*/
|
||||
void print(ReportTemplatePreviewReqVO reqVO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 模版通用预览打印
|
||||
* 通过模板id+query参数获取打印内容
|
||||
*/
|
||||
void commonPrint(ReportTemplateCommonPreviewReqVO reqVO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 模版预览下载
|
||||
*
|
||||
@@ -95,6 +113,16 @@ public interface ReportTemplateService {
|
||||
*/
|
||||
void download(String type, ReportTemplatePreviewReqVO reqVO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 模版通用预览下载
|
||||
* 通过模板id+query参数获取文件
|
||||
*
|
||||
* @param type 文件类型
|
||||
* @param reqVO
|
||||
* @param response
|
||||
*/
|
||||
void commonDownload(String type, ReportTemplateCommonPreviewReqVO reqVO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 模板导出
|
||||
*
|
||||
|
||||
+194
-12
@@ -25,6 +25,10 @@ import com.bstek.ureport.definition.datasource.ApiDatasourceDefinition;
|
||||
import com.bstek.ureport.definition.datasource.DatasourceDefinition;
|
||||
import com.bstek.ureport.definition.datasource.JdbcDatasourceDefinition;
|
||||
import com.bstek.ureport.definition.datasource.SpringBeanDatasourceDefinition;
|
||||
import com.bstek.ureport.definition.searchform.Component;
|
||||
import com.bstek.ureport.definition.searchform.InputComponent;
|
||||
import com.bstek.ureport.definition.searchform.SearchForm;
|
||||
import com.bstek.ureport.definition.searchform.TextInputComponent;
|
||||
import com.bstek.ureport.exception.ReportComputeException;
|
||||
import com.bstek.ureport.exception.ReportException;
|
||||
import com.bstek.ureport.export.ExportUtils;
|
||||
@@ -45,6 +49,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateCommonPreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplatePreviewReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateReqVO;
|
||||
import com.cf.imes.module.report.controller.admin.template.vo.ReportTemplateRespVO;
|
||||
@@ -77,6 +82,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -86,6 +92,7 @@ import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_IMPORT
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NAME_UNIQE_ERROR;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NOT_EXISTS;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_PREIVEW_QUERYPARAM_EMPTY;
|
||||
import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR;
|
||||
|
||||
/**
|
||||
* 报表模板信息 Service 实现类
|
||||
@@ -113,6 +120,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
private static final String ATTACHMENT_PREFIX = "attachment; filename=";
|
||||
private static final String DATASETIDS_FIELD_NAME = "datasetIds";
|
||||
private static final String DATASOURCEIDS_FIELD_NAME = "datasourceIds";
|
||||
private static final String DOWNLOAD_SUCCESS_HEADER_CODE = "20000";
|
||||
|
||||
@Resource
|
||||
private TenantParamsUtils tenantParamsUtils;
|
||||
@@ -417,21 +425,90 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
|
||||
@Override
|
||||
public HtmlReport preview(ReportTemplatePreviewReqVO reqVO) {
|
||||
// 检查查询参数中的空值
|
||||
checkQueryNotEmpty(reqVO.getQuery());
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
|
||||
HtmlProducer htmlProducer = new HtmlProducer();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params);
|
||||
Map<String, Object> parameters = params.getQuery();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params, true);
|
||||
|
||||
Map<String, Object> query = params.getQuery();
|
||||
// 检查表单配置
|
||||
checkSearchForm(reportDefinition.getSearchForm(), query);
|
||||
// 增加多租户参数
|
||||
tenantParamsUtils.prepareTenantParam(parameters);
|
||||
Report report = reportRender.render(reportDefinition, parameters);
|
||||
tenantParamsUtils.prepareTenantParam(query);
|
||||
Report report = reportRender.render(reportDefinition, query);
|
||||
return htmlProducer.produce(reportDefinition, report);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HtmlReport commonPreview(ReportTemplateCommonPreviewReqVO reqVO) {
|
||||
// 查询模板
|
||||
ReportTemplateDO reportTemplateDO = templateMapper.selectById(reqVO.getTemplateId());
|
||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||
throw exception(TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
// 检查模板内容
|
||||
String content = reportTemplateDO.getContent();
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
||||
}
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
params.setContent(content);
|
||||
|
||||
// 生成html
|
||||
HtmlProducer htmlProducer = new HtmlProducer();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params, false);
|
||||
|
||||
Map<String, Object> query = params.getQuery();
|
||||
// 检查表单配置
|
||||
checkSearchForm(reportDefinition.getSearchForm(), query);
|
||||
|
||||
// 增加多租户参数
|
||||
tenantParamsUtils.prepareTenantParam(query);
|
||||
Report report = reportRender.render(reportDefinition, query);
|
||||
return htmlProducer.produce(reportDefinition, report);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查报表模板定义的表单参数是否为空
|
||||
*
|
||||
* @param searchForm 模板定义的表单参数
|
||||
* @param parameters 表单查询参数
|
||||
*/
|
||||
private void checkSearchForm(SearchForm searchForm, Map<String, Object> parameters) {
|
||||
if (ObjectUtil.isNotNull(searchForm)) {
|
||||
List<Component> components = Optional.ofNullable(searchForm.getComponents()).orElse(new ArrayList<>());
|
||||
for (Component component : components) {
|
||||
checkComponent(component, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查表单中的组件明细
|
||||
*
|
||||
* @param component
|
||||
* @param parameters
|
||||
*/
|
||||
private void checkComponent(Component component, Map<String, Object> parameters) {
|
||||
InputComponent inputComponent = (InputComponent) component;
|
||||
if (ObjectUtil.isNotNull(inputComponent)) {
|
||||
String bindParameter = inputComponent.getBindParameter();
|
||||
if (StringUtils.isNotEmpty(bindParameter)) {
|
||||
if (inputComponent instanceof TextInputComponent) {
|
||||
Object bindValue = parameters.get(bindParameter);
|
||||
if (parameters.containsKey(bindParameter) && ObjectUtil.isNotNull(bindValue) && StringUtils.isEmpty(String.valueOf(bindValue))) {
|
||||
throw ServiceExceptionUtil.exception(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, bindParameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void print(ReportTemplatePreviewReqVO reqVO, HttpServletResponse response) {
|
||||
// 自定义请求vo转ureport对象
|
||||
@@ -439,8 +516,10 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params);
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params, true);
|
||||
Map<String, Object> query = params.getQuery();
|
||||
// 检查表单配置
|
||||
checkSearchForm(reportDefinition.getSearchForm(), query);
|
||||
// 增加多租户参数
|
||||
tenantParamsUtils.prepareTenantParam(query);
|
||||
Report report = reportRender.render(reportDefinition, query);
|
||||
@@ -455,7 +534,53 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
String downFileName = com.bstek.common.utils.StringUtils.randomFileName() + com.bstek.common.utils.StringUtils.getFileSuffix(p);
|
||||
response.setHeader(Header.CONTENT_DISPOSITION.getValue(), ATTACHMENT_PREFIX + URLEncoder.encode(downFileName, UTF8_CHARSET));
|
||||
|
||||
response.setHeader("code", "20000");
|
||||
response.setHeader("code", DOWNLOAD_SUCCESS_HEADER_CODE);
|
||||
ExportUtils.export(out, report, p);
|
||||
long end = System.currentTimeMillis();
|
||||
ToolUtils.logToConsole("获取打印文件耗时:" + (end - start) + "ms");
|
||||
} catch (Exception ex) {
|
||||
log.error("模版预览打印异常", ex);
|
||||
throw new ReportException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commonPrint(ReportTemplateCommonPreviewReqVO reqVO, HttpServletResponse response) {
|
||||
// 查询模板
|
||||
ReportTemplateDO reportTemplateDO = templateMapper.selectById(reqVO.getTemplateId());
|
||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||
throw exception(TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
// 检查模板内容
|
||||
String content = reportTemplateDO.getContent();
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
||||
}
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
params.setContent(content);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params, false);
|
||||
Map<String, Object> query = params.getQuery();
|
||||
// 检查表单配置
|
||||
checkSearchForm(reportDefinition.getSearchForm(), query);
|
||||
// 增加多租户参数
|
||||
tenantParamsUtils.prepareTenantParam(query);
|
||||
Report report = reportRender.render(reportDefinition, query);
|
||||
Map<String, String> chartImages = params.getChartImages();
|
||||
report.setChartImages(chartImages);
|
||||
try {
|
||||
OutputStream out = response.getOutputStream();
|
||||
response.setCharacterEncoding(UTF8_CHARSET);
|
||||
response.setContentType("application/pdf; charset=UTF-8");
|
||||
// 创建下载文件
|
||||
ProducerEnum p = ProducerEnum.PDF;
|
||||
String downFileName = com.bstek.common.utils.StringUtils.randomFileName() + com.bstek.common.utils.StringUtils.getFileSuffix(p);
|
||||
response.setHeader(Header.CONTENT_DISPOSITION.getValue(), ATTACHMENT_PREFIX + URLEncoder.encode(downFileName, UTF8_CHARSET));
|
||||
|
||||
response.setHeader("code", DOWNLOAD_SUCCESS_HEADER_CODE);
|
||||
ExportUtils.export(out, report, p);
|
||||
long end = System.currentTimeMillis();
|
||||
ToolUtils.logToConsole("获取打印文件耗时:" + (end - start) + "ms");
|
||||
@@ -471,8 +596,10 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params);
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params, true);
|
||||
Map<String, Object> query = params.getQuery();
|
||||
// 检查表单配置
|
||||
checkSearchForm(reportDefinition.getSearchForm(), query);
|
||||
// 增加多租户参数
|
||||
tenantParamsUtils.prepareTenantParam(query);
|
||||
Report report = reportRender.render(reportDefinition, query);
|
||||
@@ -486,7 +613,52 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
ProducerEnum p = ProducerEnum.valueOf(type.toUpperCase());
|
||||
String downFileName = com.bstek.common.utils.StringUtils.randomFileName() + com.bstek.common.utils.StringUtils.getFileSuffix(p);
|
||||
response.setHeader(Header.CONTENT_DISPOSITION.getValue(), ATTACHMENT_PREFIX + URLEncoder.encode(downFileName, UTF8_CHARSET));
|
||||
response.setHeader("code", "20000");
|
||||
response.setHeader("code", DOWNLOAD_SUCCESS_HEADER_CODE);
|
||||
long start = System.currentTimeMillis();
|
||||
ExportUtils.export(out, report, p);
|
||||
long end = System.currentTimeMillis();
|
||||
ToolUtils.logToConsole("下载 " + type + " 报表耗时:" + (end - start) + "ms");
|
||||
} catch (Exception ex) {
|
||||
log.error("模版预览下载文件异常", ex);
|
||||
throw new ReportException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commonDownload(String type, ReportTemplateCommonPreviewReqVO reqVO, HttpServletResponse response) {
|
||||
// 查询模板
|
||||
ReportTemplateDO reportTemplateDO = templateMapper.selectById(reqVO.getTemplateId());
|
||||
if (ObjectUtil.isNull(reportTemplateDO)) {
|
||||
throw exception(TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
// 检查模板内容
|
||||
String content = reportTemplateDO.getContent();
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR);
|
||||
}
|
||||
// 自定义请求vo转ureport对象
|
||||
PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class);
|
||||
params.setContent(content);
|
||||
|
||||
ReportRender reportRender = new ReportRender();
|
||||
ReportDefinition reportDefinition = getReportDefinition(reportRender, params, true);
|
||||
Map<String, Object> query = params.getQuery();
|
||||
// 检查表单配置
|
||||
checkSearchForm(reportDefinition.getSearchForm(), query);
|
||||
// 增加多租户参数
|
||||
tenantParamsUtils.prepareTenantParam(query);
|
||||
Report report = reportRender.render(reportDefinition, query);
|
||||
Map<String, String> chartImages = params.getChartImages();
|
||||
report.setChartImages(chartImages);
|
||||
try {
|
||||
OutputStream out = response.getOutputStream();
|
||||
response.setCharacterEncoding(UTF8_CHARSET);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
// 创建下载文件
|
||||
ProducerEnum p = ProducerEnum.valueOf(type.toUpperCase());
|
||||
String downFileName = com.bstek.common.utils.StringUtils.randomFileName() + com.bstek.common.utils.StringUtils.getFileSuffix(p);
|
||||
response.setHeader(Header.CONTENT_DISPOSITION.getValue(), ATTACHMENT_PREFIX + URLEncoder.encode(downFileName, UTF8_CHARSET));
|
||||
response.setHeader("code", DOWNLOAD_SUCCESS_HEADER_CODE);
|
||||
long start = System.currentTimeMillis();
|
||||
ExportUtils.export(out, report, p);
|
||||
long end = System.currentTimeMillis();
|
||||
@@ -545,7 +717,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
getSelf().validateTemplateNameUnique(createReqVO, isSuperAdmin);
|
||||
// 复制信息
|
||||
String content = jsonObject.getString("content");
|
||||
if(StringUtils.isEmpty(content)) {
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
throw new ServiceException(TEMPLATE_IMPORT_CONTENT_EMPTY_ERROR);
|
||||
}
|
||||
// 生成id
|
||||
@@ -572,12 +744,22 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
}
|
||||
}
|
||||
|
||||
private ReportDefinition getReportDefinition(ReportRender reportRender, PreviewParameters params) {
|
||||
/**
|
||||
* 获取报表定义
|
||||
*
|
||||
* @param reportRender 报表渲染器
|
||||
* @param params 预览参数
|
||||
* @param needDecode 是否需要解码(从前端直接拿来的需要url解码)
|
||||
* @return
|
||||
*/
|
||||
private ReportDefinition getReportDefinition(ReportRender reportRender, PreviewParameters params, boolean needDecode) {
|
||||
ReportDefinition reportDefinition;
|
||||
|
||||
String content = params.getContent();
|
||||
if (StringUtils.isNotBlank(content)) {
|
||||
if (needDecode) {
|
||||
content = URLUtil.decode(content);
|
||||
}
|
||||
reportDefinition = reportRender.getReportDefinition(content, "utf-8");
|
||||
} else {
|
||||
throw new ReportComputeException("模版文件不能为空");
|
||||
|
||||
+2
@@ -329,6 +329,8 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode THIS_PLAN_PROCESS_SCHEME_IS_LOCK = new ErrorCode(1_002_041_043, "当前排单已被锁定,无法修改方案组,请解锁后再进行修改");
|
||||
public static final ErrorCode THIS_PLAN_OPTIMIZE_DATA_ERROR = new ErrorCode(1_002_041_044, "当前排单已全部开料,无法进行再次优化");
|
||||
public static final ErrorCode THIS_PLAN_PLATE_IS_CUT = new ErrorCode(1_002_041_045, "当前排单已有板材开料,无法修改");
|
||||
public static final ErrorCode THIS_ORDER_NOT_PLATE_DATA = new ErrorCode(1_002_041_046, "当前生产单无板材数据,无法进行用板量计算");
|
||||
public static final ErrorCode THIS_PLAN_SCHEME_DATA_ERROR = new ErrorCode(1_002_041_047, "当前方案组的优化信息有误,请重新选择方案组或重新导入排单再进行优化");
|
||||
|
||||
|
||||
public static final ErrorCode THIS_PLAN_PLATE_OPTIMIZE_IS_ALL = new ErrorCode(1_002_041_046, "当前排单已全部开料,无法进行选择");
|
||||
|
||||
+35
-23
@@ -13,9 +13,15 @@ import com.cf.imes.module.system.controller.admin.systemconfig.vo.ProcessSchemeC
|
||||
import com.cf.imes.module.system.dal.dataobject.lable.LabelDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDataDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigProcessDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigSchemeDO;
|
||||
import com.cf.imes.module.system.dal.mysql.label.LabelMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.machine.MachineMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigDataMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigProcessMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigSchemeMapper;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.systemconfig.SystemConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -57,6 +63,14 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
@Resource
|
||||
private LabelMapper labelMapper;
|
||||
|
||||
@Resource
|
||||
private SystemConfigSchemeMapper systemConfigSchemeMapper;
|
||||
|
||||
@Resource
|
||||
private SystemConfigProcessMapper systemConfigProcessMapper;
|
||||
|
||||
@Resource
|
||||
private SystemConfigDataMapper systemConfigDataMapper;
|
||||
|
||||
@Override
|
||||
public CommonResult<SystemConfigRespDTO> getOrgCustomPlateNoConfig() {
|
||||
@@ -65,23 +79,23 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
|
||||
@Override
|
||||
public CommonResult<SystemConfigRespDTO> getById(Long id) {
|
||||
return success(BeanUtils.toBean(systemConfigService.getSystemConfig(id), SystemConfigRespDTO.class));
|
||||
return success(BeanUtils.toBean(systemConfigService.getSystemConfig(id,SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType()), SystemConfigRespDTO.class));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<List<SystemConfigRespDTO>> getProcessByIds(List<Long> processIds) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.in(SystemConfigDO::getId, processIds)
|
||||
.select(SystemConfigDO::getId,SystemConfigDO::getName));
|
||||
List<SystemConfigSchemeDO> systemConfigSchemeDOS = systemConfigSchemeMapper.selectList(new LambdaQueryWrapperX<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.in(SystemConfigSchemeDO::getId, processIds)
|
||||
.select(SystemConfigSchemeDO::getId,SystemConfigDO::getName));
|
||||
|
||||
if(CollUtil.isEmpty(systemConfigDOS)){
|
||||
if(CollUtil.isEmpty(systemConfigSchemeDOS)){
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
return success(BeanUtils.toBean(systemConfigDOS,SystemConfigRespDTO.class));
|
||||
return success(BeanUtils.toBean(systemConfigSchemeDOS,SystemConfigRespDTO.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -89,18 +103,18 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
@Override
|
||||
public CommonResult<Integer> getProcessSizeByIds(List<Long> processIds) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.in(SystemConfigDO::getId, processIds)
|
||||
.select(SystemConfigDO::getId,SystemConfigDO::getSetting));
|
||||
List<SystemConfigSchemeDO> systemConfigSchemeDOS = systemConfigSchemeMapper.selectList(new LambdaQueryWrapperX<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.in(SystemConfigSchemeDO::getId, processIds)
|
||||
.select(SystemConfigSchemeDO::getId,SystemConfigDO::getSetting));
|
||||
|
||||
if(CollUtil.isEmpty(systemConfigDOS)){
|
||||
if(CollUtil.isEmpty(systemConfigSchemeDOS)){
|
||||
throw exception(PLAN_PROCESS_CONFIG_ALL_IS_NULL);
|
||||
}
|
||||
|
||||
AtomicReference<Integer> processSize = new AtomicReference<>(0);
|
||||
|
||||
systemConfigDOS.forEach(f->{
|
||||
systemConfigSchemeDOS.forEach(f->{
|
||||
|
||||
try {
|
||||
|
||||
@@ -124,26 +138,26 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
@Override
|
||||
public CommonResult<SystemConfigRespDTO> getDefaultProcessConfig() {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(SystemConfigTypeEnum.PROCESS_SCHEME.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
List<SystemConfigSchemeDO> systemConfigSchemeDOS = systemConfigSchemeMapper.selectSystemConfigList(SystemConfigTypeEnum.PROCESS_SCHEME.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
|
||||
AssertUtils.notEmpty(systemConfigDOS,PROCESS_CONFIG_DEFAULT_DATA_ERROR);
|
||||
AssertUtils.notEmpty(systemConfigSchemeDOS,PROCESS_CONFIG_DEFAULT_DATA_ERROR);
|
||||
|
||||
return success(BeanUtils.toBean(systemConfigDOS.get(0),SystemConfigRespDTO.class));
|
||||
return success(BeanUtils.toBean(systemConfigSchemeDOS.get(0),SystemConfigRespDTO.class));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<List<ProcessSchemeDTO>> getProcessById(Long processId) {
|
||||
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectById(processId);
|
||||
SystemConfigSchemeDO systemConfigSchemeDO = systemConfigSchemeMapper.selectById(processId);
|
||||
|
||||
AssertUtils.notEmpty(systemConfigDO,THIS_PROCESS_CONFIG_DATA_ERROR);
|
||||
AssertUtils.notEmpty(systemConfigSchemeDO,THIS_PROCESS_CONFIG_DATA_ERROR);
|
||||
|
||||
List<ProcessSchemeConfig> processSchemeConfigs;
|
||||
|
||||
try {
|
||||
|
||||
processSchemeConfigs = parseArray(systemConfigDO.getSetting(), ProcessSchemeConfig.class);
|
||||
processSchemeConfigs = parseArray(systemConfigSchemeDO.getSetting(), ProcessSchemeConfig.class);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
@@ -168,11 +182,11 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
|
||||
|
||||
// 配置查询和数据校验
|
||||
List<SystemConfigDO> processLineConfigList = systemConfigMapper.selectBatchIds(processLineConfigIds);
|
||||
List<SystemConfigProcessDO> processLineConfigList = systemConfigProcessMapper.selectBatchIds(processLineConfigIds);
|
||||
|
||||
checkValueIsNotEmpty(processLineConfigList,"加工分线");
|
||||
|
||||
List<SystemConfigDO> optimizationConfigList = systemConfigMapper.selectBatchIds(optimizationConfigIds);
|
||||
List<SystemConfigDataDO> optimizationConfigList = systemConfigDataMapper.selectBatchIds(optimizationConfigIds);
|
||||
|
||||
checkValueIsNotEmpty(optimizationConfigList,"优化数据配置");
|
||||
|
||||
@@ -240,10 +254,8 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
@Override
|
||||
public CommonResult<Boolean> getMultiColorConfigStatus() {
|
||||
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(SystemConfigTypeEnum.MULTI_COLOR_ORDER_PLAN.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
|
||||
|
||||
return success(CollUtil.isNotEmpty(systemConfigDOS));
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -6,6 +6,7 @@ import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
@@ -54,6 +55,7 @@ public class OrganSaveReqVO {
|
||||
@Schema(description = "账号数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "账号数量不能为空")
|
||||
@NumberValid(name = "账号数量")
|
||||
@Min(value = 1 , message = "组织账号数量必须大于0")
|
||||
private Integer accountCount;
|
||||
|
||||
// ========== 仅【创建】时,需要传递的字段 ==========
|
||||
|
||||
+2
-3
@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
@@ -43,8 +42,8 @@ public class SystemConfigController {
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "根据id查询系统配置")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:base-setting:query','unplannedOrders:query','placeorder:query')")
|
||||
public CommonResult<ConfigRespVO> getSystemConfig(@PathVariable("id") Long id) {
|
||||
SystemConfigDO systemConfigDO = systemConfigService.getSystemConfig(id);
|
||||
public CommonResult<ConfigRespVO> getSystemConfig(@PathVariable("id") Long id,@RequestParam("type") Integer type) {
|
||||
SystemConfigDO systemConfigDO = systemConfigService.getSystemConfig(id,type);
|
||||
return success(BeanUtils.toBean(systemConfigDO, ConfigRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -43,6 +43,7 @@ import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -173,6 +174,9 @@ public class UserController {
|
||||
HttpServletResponse response) throws IOException {
|
||||
exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AdminUserDO> list = userService.getUserPage(exportReqVO).getList();
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
ExcelUtils.write(response, "用户数据.xls", "数据", UserExportRespVO.class, new ArrayList<>());
|
||||
}
|
||||
List<UserPostDTO> userPostDTOS = postMapper.selectJoinList(UserPostDTO.class, new MPJLambdaWrapperX<PostDO>()
|
||||
.select(PostDO::getName)
|
||||
.leftJoin(UserPostDO.class, UserPostDO::getPostId, PostDO::getId)
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import lombok.ToString;
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置
|
||||
* 系统配置-自定义板编号 和 是否混单
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/11/7 16:12
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.cf.imes.module.system.dal.dataobject.systemconfig;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @author 优化数据配置
|
||||
*/
|
||||
|
||||
@TableName(value = "system_config_data", autoResultMap = true)
|
||||
@KeySequence("system_config_data_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SystemConfigDataDO extends SystemConfigDO{
|
||||
|
||||
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.cf.imes.module.system.dal.dataobject.systemconfig;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author 板件分线
|
||||
*/
|
||||
@TableName(value = "system_config_filter", autoResultMap = true)
|
||||
@KeySequence("system_config_filter_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SystemConfigFilterDO extends SystemConfigDO{
|
||||
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.cf.imes.module.system.dal.dataobject.systemconfig;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @author 加工分线
|
||||
*/
|
||||
|
||||
@TableName(value = "system_config_process", autoResultMap = true)
|
||||
@KeySequence("system_config_process_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SystemConfigProcessDO extends SystemConfigDO{
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.cf.imes.module.system.dal.dataobject.systemconfig;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* @author 加工方案
|
||||
*/
|
||||
|
||||
@TableName(value = "system_config_scheme", autoResultMap = true)
|
||||
@KeySequence("system_config_scheme_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SystemConfigSchemeDO extends SystemConfigDO{
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.system.dal.mysql.systemconfig;
|
||||
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 优化数据配置 Mapper
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface SystemConfigDataMapper extends BaseMapperX<SystemConfigDataDO> {
|
||||
|
||||
default List<SystemConfigDataDO> selectSystemConfigList(Integer type, Integer status) {
|
||||
return selectList(new LambdaQueryWrapperX<SystemConfigDataDO>()
|
||||
.eqIfPresent(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigDataDO::getDeleted,false)
|
||||
.eq(SystemConfigDataDO::getType, type)
|
||||
.eqIfPresent(SystemConfigDataDO::getStatus,status)
|
||||
.orderByAsc(SystemConfigDataDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.cf.imes.module.system.dal.mysql.systemconfig;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigFilterDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 板件分线 Mapper
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface SystemConfigFilterMapper extends BaseMapperX<SystemConfigFilterDO> {
|
||||
|
||||
|
||||
default List<SystemConfigFilterDO> selectSystemConfigList(Integer type, Integer status) {
|
||||
return selectList(new LambdaQueryWrapperX<SystemConfigFilterDO>()
|
||||
.eqIfPresent(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigFilterDO::getDeleted,false)
|
||||
.eq(SystemConfigFilterDO::getType, type)
|
||||
.eqIfPresent(SystemConfigFilterDO::getStatus,status)
|
||||
.orderByAsc(SystemConfigFilterDO::getSort,SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.system.dal.mysql.systemconfig;
|
||||
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigProcessDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 加工分线 Mapper
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface SystemConfigProcessMapper extends BaseMapperX<SystemConfigProcessDO> {
|
||||
|
||||
|
||||
default List<SystemConfigProcessDO> selectSystemConfigList(Integer type, Integer status) {
|
||||
return selectList(new LambdaQueryWrapperX<SystemConfigProcessDO>()
|
||||
.eqIfPresent(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigProcessDO::getDeleted,false)
|
||||
.eq(SystemConfigProcessDO::getType, type)
|
||||
.eqIfPresent(SystemConfigProcessDO::getStatus,status)
|
||||
.orderByAsc(SystemConfigProcessDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.cf.imes.module.system.dal.mysql.systemconfig;
|
||||
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigSchemeDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 加工方案 Mapper
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface SystemConfigSchemeMapper extends BaseMapperX<SystemConfigSchemeDO> {
|
||||
|
||||
|
||||
default List<SystemConfigSchemeDO> selectSystemConfigList(Integer type, Integer status) {
|
||||
return selectList(new LambdaQueryWrapperX<SystemConfigSchemeDO>()
|
||||
.eqIfPresent(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigSchemeDO::getDeleted,false)
|
||||
.eq(SystemConfigSchemeDO::getType, type)
|
||||
.eqIfPresent(SystemConfigSchemeDO::getStatus,status)
|
||||
.orderByAsc(SystemConfigSchemeDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ public enum SystemConfigTypeEnum {
|
||||
ADVANCED_SCREEN(3, "高级筛选"),
|
||||
|
||||
/**
|
||||
* 加工筛选
|
||||
* 加工分线
|
||||
*/
|
||||
PROCESSING_SCREENING(4, "加工分线"),
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public interface SystemConfigService {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SystemConfigDO getSystemConfig(Long id);
|
||||
SystemConfigDO getSystemConfig(Long id,Integer type);
|
||||
|
||||
/**
|
||||
* 新增/修改基础配置
|
||||
|
||||
+22
-62
@@ -1,10 +1,8 @@
|
||||
package com.cf.imes.module.system.service.systemconfig;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
@@ -19,12 +17,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.THIS_CONFIG_DATA_ERROR;
|
||||
|
||||
/**
|
||||
* 系统配置接口实现类
|
||||
@@ -50,8 +45,12 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
return validateSystemConfigExists(id);
|
||||
public SystemConfigDO getSystemConfig(Long id,Integer type) {
|
||||
|
||||
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(type);
|
||||
|
||||
return configService.getSystemConfig(id);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,57 +58,34 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
// 根据配置类型选择对应的service
|
||||
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(reqVO.getType());
|
||||
// 校验规则
|
||||
configService.checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
configService.beforeSaveConfig(reqVO);
|
||||
SystemConfigDO systemConfigDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigDO = validateSystemConfigExists(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigMapper.updateById(systemConfigDO);
|
||||
} else {
|
||||
systemConfigDO = BeanUtils.toBean(reqVO, SystemConfigDO.class);
|
||||
// 新增
|
||||
systemConfigMapper.insert(systemConfigDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
configService.afterSaveConfig(systemConfigDO, reqVO);
|
||||
|
||||
configService.modifySystemConfig(reqVO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
// 根据配置类型选择对应的service
|
||||
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(reqVO.getType());
|
||||
Long id = reqVO.getId();
|
||||
// 校验存在
|
||||
SystemConfigDO systemConfigDO = validateSystemConfigExists(id);
|
||||
// 更新状态
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>().eq(SystemConfigDO::getId, id).set(SystemConfigDO::getStatus, reqVO.getStatus()));
|
||||
// 更新状态后操作
|
||||
configService.afterUpdateStatus(systemConfigDO, reqVO);
|
||||
|
||||
configService.updateConfigStatus(reqVO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
ArrayList<SystemConfigDO> systemConfigDOS = new ArrayList<>();
|
||||
if(reqVO.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
reqVO.forEach(f->
|
||||
systemConfigDOS.add(SystemConfigDO
|
||||
.builder()
|
||||
.id(f.getId())
|
||||
.type(f.getType())
|
||||
.status(f.getStatus())
|
||||
.sort(f.getSort())
|
||||
.build()));
|
||||
Integer type = reqVO.stream().map(ConfigUpdateSortReqVO::getType).findFirst().orElseThrow(() -> new ServiceException(THIS_CONFIG_DATA_ERROR));
|
||||
|
||||
systemConfigMapper.updateBatch(systemConfigDOS);
|
||||
// 根据配置类型选择对应的service
|
||||
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(type);
|
||||
|
||||
configService.updateConfigSort(reqVO);
|
||||
|
||||
}
|
||||
|
||||
@@ -126,26 +102,10 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
||||
|
||||
@Override
|
||||
public void deleteSystemConfig(ConfigDeleteReqVO reqVO) {
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
// 根据配置类型选择对应的service
|
||||
AbstractSystemConfigServiceHandler configService = configServiceFactory.getConfigServiceHandler(reqVO.getType());
|
||||
configService.deleteConfig(reqVO);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验基础配置是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private SystemConfigDO validateSystemConfigExists(Long id) {
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
return systemConfigDO;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class SystemConfigServiceFactory {
|
||||
// 高级筛选
|
||||
case ADVANCED_SCREEN:
|
||||
return applicationContext.getBean(AdvancedScreenServiceHandler.class);
|
||||
// 加工筛选
|
||||
// 加工分线
|
||||
case PROCESSING_SCREENING:
|
||||
return applicationContext.getBean(ProcessScreeningServiceHandler.class);
|
||||
// 数据处理
|
||||
|
||||
+32
-12
@@ -1,9 +1,6 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -47,14 +44,6 @@ public abstract class AbstractSystemConfigServiceHandler {
|
||||
*/
|
||||
public abstract void afterSaveConfig(SystemConfigDO systemConfigDO, ConfigSaveReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 修改系统配置状态后操作
|
||||
*
|
||||
* @param systemConfigDO
|
||||
* @param reqVO
|
||||
*/
|
||||
public abstract void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 删除系统配置操作
|
||||
@@ -64,4 +53,35 @@ public abstract class AbstractSystemConfigServiceHandler {
|
||||
public abstract void deleteConfig(ConfigDeleteReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 修改系统配置状态操作
|
||||
*
|
||||
* @param reqVO
|
||||
*/
|
||||
public abstract void updateConfigStatus(ConfigUpdateStatusReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 修改系统配置排序操作
|
||||
*
|
||||
* @param reqVO
|
||||
*/
|
||||
public abstract void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据 ID 查询对应的系统配置信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public abstract SystemConfigDO getSystemConfig(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 修改系统配置操作
|
||||
*
|
||||
* @param reqVO
|
||||
*/
|
||||
public abstract void modifySystemConfig(ConfigSaveReqVO reqVO);
|
||||
|
||||
}
|
||||
|
||||
+22
-9
@@ -1,10 +1,7 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -42,13 +39,29 @@ public class AdvancedScreenServiceHandler extends AbstractSystemConfigServiceHan
|
||||
// todo afterSaveConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
// todo deleteConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+107
-35
@@ -10,12 +10,10 @@ import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ErrorCode;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.customplateno.CustomPlateNoSeqDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.dict.DictDataDO;
|
||||
@@ -34,21 +32,15 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_EMPTY_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 自定义板编号服务处理器
|
||||
@@ -78,23 +70,18 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
SystemConfigTypeEnum customPlateNoEnum = SystemConfigTypeEnum.CUSTOM_PLATE_NO;
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.eq(SystemConfigDO::getType, pageReqVO.getType())
|
||||
.eqIfPresent(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.orderByAsc(SystemConfigDO::getId));
|
||||
.eq(SystemConfigDO::getType, customPlateNoEnum.getType())
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.orderByAsc(SystemConfigDO::getVersion));
|
||||
if (systemConfigDOS.isEmpty()) {
|
||||
SystemConfigDO initCustomPlateNoConfig = new SystemConfigDO().builder().id(null).name(customPlateNoEnum.getName()).type(customPlateNoEnum.getType()).build();
|
||||
return List.of(initCustomPlateNoConfig);
|
||||
} else {
|
||||
}
|
||||
// configDOPageResult下的自定义板编号配置只保留version最大的一项
|
||||
Optional<SystemConfigDO> maxVersionCustPlateNoConfigOptinal = systemConfigDOS.stream()
|
||||
.filter(s -> ObjectUtil.equal(customPlateNoEnum.getType(), s.getType()))
|
||||
.max(Comparator.comparing(SystemConfigDO::getVersion));
|
||||
if (maxVersionCustPlateNoConfigOptinal.isPresent()) {
|
||||
systemConfigDOS.removeIf(s -> ObjectUtil.equal(customPlateNoEnum.getType(), s.getType()) && ObjectUtil.notEqual(s.getId(), maxVersionCustPlateNoConfigOptinal.get().getId()));
|
||||
}
|
||||
return systemConfigDOS;
|
||||
}
|
||||
return systemConfigDOS.stream()
|
||||
.max(Comparator.comparing(SystemConfigDO::getVersion))
|
||||
.map(Collections::singletonList)
|
||||
.orElse(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -304,18 +291,103 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
if (CommonStatusEnum.DISABLE.getStatus().equals(reqVO.getStatus())) {
|
||||
// 禁用配置移除缓存
|
||||
String redisKey = String.format("%s:%d:%s", RedisKeyConstants.SYSTEM_CONFIG, OrganContextHolder.getOrganId(), RedisKeyConstants.CUSTOM_PLATE_NO);
|
||||
Boolean delete = stringRedisTemplate.delete(redisKey);
|
||||
log.info("[CustomPlateNoGenerateService][afterUpdateStatus]key:{}缓存删除结果:{}", redisKey, delete);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
Long id = reqVO.getId();
|
||||
// 状态
|
||||
Integer status = reqVO.getStatus();
|
||||
// 组织
|
||||
Long organId = OrganContextHolder.getOrganId();
|
||||
|
||||
// 校验存在
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
if (CommonStatusEnum.ENABLE.getStatus().equals(status)) {
|
||||
// 查询最大版本号
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.orderByAsc(SystemConfigDO::getVersion));
|
||||
Optional<SystemConfigDO> maxVersionCustPlateNoConfigOptinal = systemConfigDOS.stream()
|
||||
.max(Comparator.comparing(SystemConfigDO::getVersion));
|
||||
if (maxVersionCustPlateNoConfigOptinal.isPresent()) {
|
||||
// 启用配置,启用最大版本号
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, organId)
|
||||
.eq(SystemConfigDO::getId, maxVersionCustPlateNoConfigOptinal.get().getId())
|
||||
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||
.set(SystemConfigDO::getStatus, status));
|
||||
}
|
||||
} else {
|
||||
// 禁用配置,禁用组织下所有板编号配置
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, organId)
|
||||
.eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())
|
||||
.set(SystemConfigDO::getStatus, status));
|
||||
|
||||
// 禁用配置移除缓存
|
||||
String redisKey = String.format("%s:%d:%s", RedisKeyConstants.SYSTEM_CONFIG, organId, RedisKeyConstants.CUSTOM_PLATE_NO);
|
||||
Boolean delete = stringRedisTemplate.delete(redisKey);
|
||||
log.info("[CustomPlateNoGenerateService][afterUpdateStatus]key:{}缓存删除结果:{}", redisKey, delete);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigDO;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
// 校验规则
|
||||
checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
beforeSaveConfig(reqVO);
|
||||
SystemConfigDO systemConfigDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigDO = getSystemConfig(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigMapper.updateById(systemConfigDO);
|
||||
} else {
|
||||
systemConfigDO = BeanUtils.toBean(reqVO, SystemConfigDO.class);
|
||||
// 新增
|
||||
systemConfigMapper.insert(systemConfigDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
afterSaveConfig(systemConfigDO, reqVO);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+115
-13
@@ -1,19 +1,26 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDataDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigDataMapper;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* @author 数据处理服务处理器
|
||||
*/
|
||||
@@ -22,18 +29,18 @@ import java.util.List;
|
||||
public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
private SystemConfigDataMapper systemConfigDataMapper;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
List<SystemConfigDataDO> systemConfigDOS = systemConfigDataMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
|
||||
if (systemConfigDOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
return systemConfigDOS;
|
||||
return BeanUtils.toBean(systemConfigDOS,SystemConfigDO.class);
|
||||
|
||||
}
|
||||
|
||||
@@ -54,16 +61,111 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle
|
||||
// todo afterSaveConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
|
||||
systemConfigMapper.deleteById(reqVO.getId());
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
|
||||
systemConfigDataMapper.deleteById(reqVO.getId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
Long id = reqVO.getId();
|
||||
|
||||
// 校验存在
|
||||
SystemConfigDataDO systemConfigDataDO = systemConfigDataMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDataDO>()
|
||||
.eq(SystemConfigDataDO::getId, id)
|
||||
.eq(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigDataDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
systemConfigDataMapper.update(new LambdaUpdateWrapper<SystemConfigDataDO>()
|
||||
.eq(SystemConfigDataDO::getId, id)
|
||||
.set(SystemConfigDataDO::getStatus, reqVO.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
ArrayList<SystemConfigDataDO> systemConfigDataDOS = new ArrayList<>();
|
||||
|
||||
reqVO.forEach(f->
|
||||
systemConfigDataDOS.add(BeanUtils.toBean(SystemConfigDO
|
||||
.builder()
|
||||
.id(f.getId())
|
||||
.type(f.getType())
|
||||
.status(f.getStatus())
|
||||
.sort(f.getSort())
|
||||
.build(),SystemConfigDataDO.class)));
|
||||
|
||||
systemConfigDataMapper.updateBatch(systemConfigDataDOS);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
SystemConfigDataDO systemConfigDataDO = validateSystemConfigExists(id);
|
||||
|
||||
return BeanUtils.toBean(systemConfigDataDO,SystemConfigDO.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
// 校验规则
|
||||
checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
beforeSaveConfig(reqVO);
|
||||
SystemConfigDataDO systemConfigDataDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigDataDO = validateSystemConfigExists(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigDataDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigDataDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigDataMapper.updateById(systemConfigDataDO);
|
||||
} else {
|
||||
systemConfigDataDO = BeanUtils.toBean(reqVO, SystemConfigDataDO.class);
|
||||
// 新增
|
||||
systemConfigDataMapper.insert(systemConfigDataDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
afterSaveConfig(systemConfigDataDO, reqVO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验基础配置是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private SystemConfigDataDO validateSystemConfigExists(Long id) {
|
||||
|
||||
SystemConfigDataDO systemConfigDataDO = systemConfigDataMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDataDO>()
|
||||
.eq(SystemConfigDataDO::getId, id)
|
||||
.eq(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigDataDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigDataDO;
|
||||
}
|
||||
}
|
||||
|
||||
+31
-12
@@ -4,10 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
@@ -41,7 +38,7 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
|
||||
// 自定义板编号、高级筛选不走通用分页查询
|
||||
List<SystemConfigTypeEnum> list = allConfigTypes.stream()
|
||||
.filter(f -> ObjectUtil.notEqual(SystemConfigTypeEnum.ADVANCED_SCREEN.getType(), f.getType()) && ObjectUtil.notEqual(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType(), f.getType())).toList();
|
||||
.filter(f -> ObjectUtil.notEqual(SystemConfigTypeEnum.ADVANCED_SCREEN.getType(), f.getType())).toList();
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.likeIfPresent(SystemConfigDO::getName, reqVO.getName())
|
||||
@@ -68,6 +65,14 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
.type(configTypeEnum.getType())
|
||||
.build();
|
||||
|
||||
// 自定义板编号
|
||||
if(configTypeEnum.getType().equals(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())){
|
||||
initConfig.setStatus(CommonStatusEnum.DISABLE.getStatus());
|
||||
resultList.add(initConfig);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 支持多种颜色排单
|
||||
if(configTypeEnum.getType().equals(SystemConfigTypeEnum.MULTI_COLOR_ORDER_PLAN.getType())){
|
||||
SystemConfigDO systemConfigDO = SystemConfigDO
|
||||
.builder()
|
||||
@@ -93,9 +98,6 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
}
|
||||
}
|
||||
|
||||
// 增加自定义板编号配置
|
||||
List<SystemConfigDO> customPlateNoConfigList = customPlateNoServiceHandler.selectList(ConfigPageReqVO.builder().type(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType()).build());
|
||||
resultList.addAll(0, customPlateNoConfigList);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -114,13 +116,30 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
// todo afterSaveConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
}
|
||||
|
||||
+129
-28
@@ -1,42 +1,47 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigFilterDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigFilterMapper;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* @author 智能分线生成服务
|
||||
* @author 板件分线生成服务
|
||||
*/
|
||||
@Service("intellectBranchingService")
|
||||
public class IntellectBranchingService extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
@Resource
|
||||
private SystemConfigFilterMapper systemConfigFilterMapper;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
List<SystemConfigFilterDO> systemConfigDOS = systemConfigFilterMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
|
||||
if (systemConfigDOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
return systemConfigDOS;
|
||||
return BeanUtils.toBean(systemConfigDOS,SystemConfigDO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,36 +61,132 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
@Override
|
||||
public void afterSaveConfig(SystemConfigDO systemConfigDO, ConfigSaveReqVO reqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(reqVO.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
List<SystemConfigFilterDO> systemConfigDOS = systemConfigFilterMapper.selectSystemConfigList(reqVO.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
|
||||
if(systemConfigDOS.size() > 1){
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigDO::getId,systemConfigDO.getId())
|
||||
.set(SystemConfigDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
systemConfigFilterMapper.update(new LambdaUpdateWrapper<SystemConfigFilterDO>()
|
||||
.eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigFilterDO::getId,systemConfigDO.getId())
|
||||
.set(SystemConfigFilterDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigDO::getDeleted,false)
|
||||
.notIn(SystemConfigDO::getId,reqVO.getId())
|
||||
.eq(SystemConfigDO::getType, systemConfigDO.getType())
|
||||
.set(SystemConfigDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
|
||||
systemConfigMapper.deleteById(reqVO.getId());
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
|
||||
systemConfigFilterMapper.deleteById(reqVO.getId());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
Long id = reqVO.getId();
|
||||
|
||||
// 校验存在
|
||||
SystemConfigFilterDO systemConfigFilterDO = systemConfigFilterMapper.selectOne(new LambdaQueryWrapperX<SystemConfigFilterDO>()
|
||||
.eq(SystemConfigFilterDO::getId, id)
|
||||
.eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigFilterDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
systemConfigFilterMapper.update(new LambdaUpdateWrapper<SystemConfigFilterDO>()
|
||||
.eq(SystemConfigFilterDO::getId, id)
|
||||
.set(SystemConfigFilterDO::getStatus, reqVO.getStatus()));
|
||||
|
||||
systemConfigFilterMapper.update(new LambdaUpdateWrapper<SystemConfigFilterDO>()
|
||||
.eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigFilterDO::getDeleted,false)
|
||||
.notIn(SystemConfigFilterDO::getId,reqVO.getId())
|
||||
.eq(SystemConfigFilterDO::getType, systemConfigFilterDO.getType())
|
||||
.set(SystemConfigFilterDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
ArrayList<SystemConfigFilterDO> systemConfigFilterDOS = new ArrayList<>();
|
||||
|
||||
reqVO.forEach(f->
|
||||
systemConfigFilterDOS.add(BeanUtils.toBean(SystemConfigDO
|
||||
.builder()
|
||||
.id(f.getId())
|
||||
.type(f.getType())
|
||||
.status(f.getStatus())
|
||||
.sort(f.getSort())
|
||||
.build(),SystemConfigFilterDO.class)));
|
||||
|
||||
systemConfigFilterMapper.updateBatch(systemConfigFilterDOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
SystemConfigFilterDO systemConfigFilterDO = validateSystemConfigExists(id);
|
||||
|
||||
return BeanUtils.toBean(systemConfigFilterDO,SystemConfigDO.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
// 校验规则
|
||||
checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
beforeSaveConfig(reqVO);
|
||||
SystemConfigFilterDO systemConfigFilterDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigFilterDO = validateSystemConfigExists(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigFilterDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigFilterDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigFilterMapper.updateById(systemConfigFilterDO);
|
||||
} else {
|
||||
systemConfigFilterDO = BeanUtils.toBean(reqVO, SystemConfigFilterDO.class);
|
||||
// 新增
|
||||
systemConfigFilterMapper.insert(systemConfigFilterDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
afterSaveConfig(systemConfigFilterDO, reqVO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验基础配置是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private SystemConfigFilterDO validateSystemConfigExists(Long id) {
|
||||
|
||||
SystemConfigFilterDO systemConfigFilterDO = systemConfigFilterMapper.selectOne(new LambdaQueryWrapperX<SystemConfigFilterDO>()
|
||||
.eq(SystemConfigFilterDO::getId, id)
|
||||
.eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigFilterDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigFilterDO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+76
-10
@@ -1,10 +1,12 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
@@ -14,6 +16,9 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* @author 多种颜色排单
|
||||
@@ -58,16 +63,77 @@ public class MultiColorOrderPlanServiceHandler extends AbstractSystemConfigServi
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
// todo deleteConfig
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
Long id = reqVO.getId();
|
||||
|
||||
// 校验存在
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>().eq(SystemConfigDO::getId, id).set(SystemConfigDO::getStatus, reqVO.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
SystemConfigDO systemConfigDO = systemConfigMapper.selectOne(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getId, id)
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigDO;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
// 校验规则
|
||||
checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
beforeSaveConfig(reqVO);
|
||||
SystemConfigDO systemConfigDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigDO = getSystemConfig(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigMapper.updateById(systemConfigDO);
|
||||
} else {
|
||||
systemConfigDO = BeanUtils.toBean(reqVO, SystemConfigDO.class);
|
||||
// 新增
|
||||
systemConfigMapper.insert(systemConfigDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
afterSaveConfig(systemConfigDO, reqVO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+125
-24
@@ -2,18 +2,23 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.executor.api.plan.OrderPlanApi;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigSchemeDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigSchemeMapper;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -21,8 +26,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_PROCESS_SCHEME_DATA_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* @author 加工方案服务处理器
|
||||
@@ -32,9 +36,9 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_PROCESS_
|
||||
@Slf4j
|
||||
public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
private SystemConfigSchemeMapper systemConfigSchemeMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private OrderPlanApi orderPlanApi;
|
||||
@@ -42,13 +46,13 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
List<SystemConfigSchemeDO> systemConfigDOS = systemConfigSchemeMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
|
||||
if (systemConfigDOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
return systemConfigDOS;
|
||||
return BeanUtils.toBean(systemConfigDOS,SystemConfigDO.class);
|
||||
|
||||
}
|
||||
|
||||
@@ -104,38 +108,115 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
@Override
|
||||
public void afterSaveConfig(SystemConfigDO systemConfigDO, ConfigSaveReqVO reqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(reqVO.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
List<SystemConfigSchemeDO> systemConfigDOS = systemConfigSchemeMapper.selectSystemConfigList(reqVO.getType(), CommonStatusEnum.ENABLE.getStatus());
|
||||
|
||||
if(systemConfigDOS.size() > 1){
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigDO::getId,systemConfigDO.getId())
|
||||
.set(SystemConfigDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
systemConfigSchemeMapper.update(new LambdaUpdateWrapper<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigSchemeDO::getId,systemConfigDO.getId())
|
||||
.set(SystemConfigSchemeDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
systemConfigMapper.update(new LambdaUpdateWrapper<SystemConfigDO>()
|
||||
.eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigDO::getDeleted,false)
|
||||
.notIn(SystemConfigDO::getId,reqVO.getId())
|
||||
.eq(SystemConfigDO::getType, systemConfigDO.getType())
|
||||
.set(SystemConfigDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
|
||||
Boolean data = orderPlanApi.getOrderProcessScheme(reqVO.getId()).getCheckedData();
|
||||
|
||||
if(Boolean.TRUE.equals(data)){
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN);
|
||||
}
|
||||
|
||||
systemConfigMapper.deleteById(reqVO.getId());
|
||||
systemConfigSchemeMapper.deleteById(reqVO.getId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
Long id = reqVO.getId();
|
||||
|
||||
// 校验存在
|
||||
SystemConfigSchemeDO systemConfigSchemeDO = systemConfigSchemeMapper.selectOne(new LambdaQueryWrapperX<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getId, id)
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigSchemeDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
systemConfigSchemeMapper.update(new LambdaUpdateWrapper<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getId, id)
|
||||
.set(SystemConfigSchemeDO::getStatus, reqVO.getStatus()));
|
||||
|
||||
|
||||
systemConfigSchemeMapper.update(new LambdaUpdateWrapper<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigSchemeDO::getDeleted,false)
|
||||
.notIn(SystemConfigSchemeDO::getId,reqVO.getId())
|
||||
.eq(SystemConfigSchemeDO::getType, systemConfigSchemeDO.getType())
|
||||
.set(SystemConfigSchemeDO::getStatus, CommonStatusEnum.DISABLE.getStatus()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
ArrayList<SystemConfigSchemeDO> systemConfigSchemeDOS = new ArrayList<>();
|
||||
|
||||
reqVO.forEach(f->
|
||||
systemConfigSchemeDOS.add(BeanUtils.toBean(SystemConfigDO
|
||||
.builder()
|
||||
.id(f.getId())
|
||||
.type(f.getType())
|
||||
.status(f.getStatus())
|
||||
.sort(f.getSort())
|
||||
.build(),SystemConfigSchemeDO.class)));
|
||||
|
||||
systemConfigSchemeMapper.updateBatch(systemConfigSchemeDOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
SystemConfigSchemeDO systemConfigSchemeDO = validateSystemConfigExists(id);
|
||||
|
||||
return BeanUtils.toBean(systemConfigSchemeDO,SystemConfigDO.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
// 校验规则
|
||||
checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
beforeSaveConfig(reqVO);
|
||||
SystemConfigSchemeDO systemConfigSchemeDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigSchemeDO = validateSystemConfigExists(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigSchemeDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigSchemeDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigSchemeMapper.updateById(systemConfigSchemeDO);
|
||||
} else {
|
||||
systemConfigSchemeDO = BeanUtils.toBean(reqVO, SystemConfigSchemeDO.class);
|
||||
// 新增
|
||||
systemConfigSchemeMapper.insert(systemConfigSchemeDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
afterSaveConfig(systemConfigSchemeDO, reqVO);
|
||||
|
||||
}
|
||||
|
||||
@@ -148,4 +229,24 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验基础配置是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private SystemConfigSchemeDO validateSystemConfigExists(Long id) {
|
||||
|
||||
SystemConfigSchemeDO systemConfigSchemeDO = systemConfigSchemeMapper.selectOne(new LambdaQueryWrapperX<SystemConfigSchemeDO>()
|
||||
.eq(SystemConfigSchemeDO::getId, id)
|
||||
.eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigSchemeDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigSchemeDO;
|
||||
}
|
||||
}
|
||||
|
||||
+117
-13
@@ -1,39 +1,47 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigDeleteReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.ConfigUpdateStatusReqVO;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.system.controller.admin.systemconfig.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigProcessDO;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigProcessMapper;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* @author 加工筛选服务处理器
|
||||
* @author 加工分线服务处理器
|
||||
*/
|
||||
@Service("processScreeningServiceHandler")
|
||||
@Slf4j
|
||||
public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
private SystemConfigProcessMapper systemConfigProcessMapper;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
List<SystemConfigProcessDO> systemConfigDOS = systemConfigProcessMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
|
||||
if (systemConfigDOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
return systemConfigDOS;
|
||||
return BeanUtils.toBean(systemConfigDOS,SystemConfigDO.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,17 +64,113 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH
|
||||
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
|
||||
systemConfigProcessMapper.deleteById(reqVO.getId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
public void updateConfigStatus(ConfigUpdateStatusReqVO reqVO) {
|
||||
|
||||
systemConfigMapper.deleteById(reqVO.getId());
|
||||
Long id = reqVO.getId();
|
||||
|
||||
// 校验存在
|
||||
SystemConfigProcessDO systemConfigProcessDO = systemConfigProcessMapper.selectOne(new LambdaQueryWrapperX<SystemConfigProcessDO>()
|
||||
.eq(SystemConfigProcessDO::getId, id)
|
||||
.eq(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
if (ObjectUtil.isNull(systemConfigProcessDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
systemConfigProcessMapper.update(new LambdaUpdateWrapper<SystemConfigProcessDO>()
|
||||
.eq(SystemConfigProcessDO::getId, id)
|
||||
.set(SystemConfigProcessDO::getStatus, reqVO.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
ArrayList<SystemConfigProcessDO> systemConfigProcessDOS = new ArrayList<>();
|
||||
|
||||
reqVO.forEach(f->
|
||||
systemConfigProcessDOS.add(BeanUtils.toBean(SystemConfigDO
|
||||
.builder()
|
||||
.id(f.getId())
|
||||
.type(f.getType())
|
||||
.status(f.getStatus())
|
||||
.sort(f.getSort())
|
||||
.build(),SystemConfigProcessDO.class)));
|
||||
|
||||
systemConfigProcessMapper.updateBatch(systemConfigProcessDOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SystemConfigDO getSystemConfig(Long id) {
|
||||
|
||||
SystemConfigProcessDO systemConfigProcessDO = validateSystemConfigExists(id);
|
||||
|
||||
return BeanUtils.toBean(systemConfigProcessDO,SystemConfigDO.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void modifySystemConfig(ConfigSaveReqVO reqVO) {
|
||||
|
||||
// 校验规则
|
||||
checkValid(reqVO.getSetting());
|
||||
// 系统配置保存前操作
|
||||
beforeSaveConfig(reqVO);
|
||||
SystemConfigProcessDO systemConfigProcessDO;
|
||||
if (ObjectUtil.isNotNull(reqVO.getId())) {
|
||||
systemConfigProcessDO = validateSystemConfigExists(reqVO.getId());
|
||||
// 覆盖配置
|
||||
systemConfigProcessDO.setSetting(reqVO.getSetting());
|
||||
// 覆盖名称
|
||||
systemConfigProcessDO.setName(reqVO.getName());
|
||||
// 更新
|
||||
systemConfigProcessMapper.updateById(systemConfigProcessDO);
|
||||
} else {
|
||||
systemConfigProcessDO = BeanUtils.toBean(reqVO, SystemConfigProcessDO.class);
|
||||
// 新增
|
||||
systemConfigProcessMapper.insert(systemConfigProcessDO);
|
||||
}
|
||||
// 系统配置保存后操作
|
||||
afterSaveConfig(systemConfigProcessDO, reqVO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 校验基础配置是否存在
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private SystemConfigProcessDO validateSystemConfigExists(Long id) {
|
||||
|
||||
SystemConfigProcessDO systemConfigProcessDO = systemConfigProcessMapper.selectOne(new LambdaQueryWrapperX<SystemConfigProcessDO>()
|
||||
.eq(SystemConfigProcessDO::getId, id)
|
||||
.eq(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId()));
|
||||
|
||||
if (ObjectUtil.isNull(systemConfigProcessDO)) {
|
||||
throw exception(SYSTEM_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return systemConfigProcessDO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -765,6 +765,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 新手机号入库 -> setUsername
|
||||
userMapper.update(new LambdaUpdateWrapper<AdminUserDO>()
|
||||
.set(AdminUserDO::getUsername, mobile)
|
||||
.set(AdminUserDO::getMobile, mobile)
|
||||
.eq(AdminUserDO::getId, id));
|
||||
|
||||
// 校验和消耗验证码
|
||||
|
||||
Reference in New Issue
Block a user