mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
系统配置新需接口更改
This commit is contained in:
-6
@@ -26,12 +26,6 @@ public interface MachineApi {
|
||||
CommonResult<CuttingRespDTO> getCutting(@RequestParam("id") Long id);
|
||||
|
||||
|
||||
@GetMapping(PREFIX + "/get-drill")
|
||||
@Operation(summary = "获得钻孔机台信息")
|
||||
@Parameter(name = "id", description = "机台id", example = "1024", required = true)
|
||||
CommonResult<CuttingRespDTO> getDrill(@RequestParam("id") Long id);
|
||||
|
||||
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@Operation(summary = "获得机台基本信息列表")
|
||||
@Parameter(name = "ids", description = "机台id", example = "1024", required = true)
|
||||
|
||||
-4
@@ -34,10 +34,6 @@ public class MachineApiImpl implements MachineApi {
|
||||
return success(BeanUtils.toBean(machineService.getCutting(id), CuttingRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<CuttingRespDTO> getDrill(Long id) {
|
||||
return success(BeanUtils.toBean(machineService.getDrill(id), CuttingRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<CuttingRespDTO>> list(Collection<Long> ids) {
|
||||
|
||||
-10
@@ -1,22 +1,18 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||
import com.cf.imes.module.system.service.machine.MachineTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -34,12 +30,6 @@ public class MachineTemplateController {
|
||||
@Resource
|
||||
private MachineTemplateService machineTemplateService;
|
||||
|
||||
// @GetMapping("/setDefaultTemplate")
|
||||
// @Operation(summary = "设置默认机台模板")
|
||||
// @PreAuthorize("@ss.hasPermission('machine-template::update')")
|
||||
// public CommonResult<Boolean> setDefaultTemplate(@RequestParam Long id) {
|
||||
// return success(machineTemplateService.setDefaultTemplate(id));
|
||||
// }
|
||||
|
||||
@GetMapping("getMachineTemplateTree")
|
||||
@Operation(summary = "获得机台模板树")
|
||||
|
||||
-4
@@ -2,8 +2,6 @@ package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -36,8 +34,6 @@ public class CuttingTemplateRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/*@Schema(description = "开料机台模板配置")
|
||||
private CuttingTemplateMachineDO cuttingTemplateMachineDO;*/
|
||||
|
||||
@Schema(description = "开料机台模板配置")
|
||||
private JSONObject cuttingTemplateMachineDO;
|
||||
|
||||
-8
@@ -46,14 +46,6 @@ public class CuttingTemplateSaveReqVO {
|
||||
@Schema(description = "机台模板是否可用")
|
||||
private Boolean isEnabled;
|
||||
|
||||
// @Schema(description = "机台的品牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
// @NotNull(message = "品牌名称不能为空")
|
||||
// private String brand;
|
||||
|
||||
|
||||
// @Schema(description = "机台的型号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
// private String model;
|
||||
|
||||
|
||||
@Schema(description = "机台的型号-机台ID", example = "2")
|
||||
private Long machineId;
|
||||
|
||||
+9
@@ -56,6 +56,15 @@ public class SystemConfigController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/sort")
|
||||
@Operation(summary = "修改系统配置的顺序")
|
||||
@PreAuthorize("@ss.hasPermission('system:base-setting:setting')")
|
||||
public CommonResult<Boolean> updateConfigSort(@Valid @RequestBody List<ConfigUpdateSortReqVO> reqVO){
|
||||
systemConfigService.updateConfigSort(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping()
|
||||
@Operation(summary = "修改系统配置")
|
||||
@PreAuthorize("@ss.hasPermission('system:base-setting:setting')")
|
||||
|
||||
+5
@@ -47,6 +47,11 @@ public class SystemConfigDO extends BaseDO {
|
||||
*/
|
||||
private int status;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 配置类型
|
||||
*/
|
||||
|
||||
+2
-1
@@ -53,7 +53,8 @@ public interface SystemConfigMapper extends BaseMapperX<SystemConfigDO> {
|
||||
.eqIfPresent(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.eq(SystemConfigDO::getDeleted,false)
|
||||
.eq(SystemConfigDO::getType, type)
|
||||
.eqIfPresent(SystemConfigDO::getStatus,status));
|
||||
.eqIfPresent(SystemConfigDO::getStatus,status)
|
||||
.orderByAsc(SystemConfigDO::getSort,SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+23
-3
@@ -19,14 +19,34 @@ public enum SystemConfigTypeEnum {
|
||||
CUSTOM_PLATE_NO(1, "自定义板编号"),
|
||||
|
||||
/**
|
||||
* 智能分线
|
||||
* 板件分线
|
||||
*/
|
||||
INTELLIGENT_BRANCH(2, "智能分线"),
|
||||
INTELLIGENT_BRANCH(2, "板件筛选"),
|
||||
|
||||
/**
|
||||
* 高级筛选
|
||||
*/
|
||||
ADVANCED_SCREEN(3, "高级筛选");
|
||||
ADVANCED_SCREEN(3, "高级筛选"),
|
||||
|
||||
/**
|
||||
* 加工筛选
|
||||
*/
|
||||
PROCESSING_SCREENING(4, "加工分线"),
|
||||
|
||||
/**
|
||||
* 数据处理
|
||||
*/
|
||||
DATA_PROCESSING(5, "优化数据配置"),
|
||||
|
||||
/**
|
||||
* 加工方案
|
||||
*/
|
||||
PROCESS_SCHEME(6, "加工方案组"),
|
||||
|
||||
/**
|
||||
* 支持多种颜色排单
|
||||
*/
|
||||
MULTI_COLOR_ORDER_PLAN(7, "支持多种颜色排单");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
-2
@@ -62,8 +62,6 @@ public interface MachineService {
|
||||
void batchDeleteCutting(List<Long> ids);
|
||||
|
||||
|
||||
DrillRespVO getDrill(Long id);
|
||||
|
||||
List<MachineDO> list(Collection<Long> ids);
|
||||
|
||||
List<MachineSimpleRespVO> getMachineModelAll(Integer type);
|
||||
|
||||
-21
@@ -630,8 +630,6 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
@Override
|
||||
public PageResult<MachineDO> getPage(MachinePageReqVO pageReqVO) {
|
||||
// return machineMapper.selectPage(pageReqVO);
|
||||
|
||||
|
||||
PageResult<MachineDO> machineDOPageResult = machineMapper.selectPage(pageReqVO);
|
||||
// 将查询到的机台的数据中的配置信息进行解压
|
||||
@@ -641,23 +639,4 @@ public class MachineServiceImpl implements MachineService {
|
||||
}
|
||||
|
||||
|
||||
private Object buildResp(Long machineId, String index, Class<? extends ESDocument> clazz) {
|
||||
SearchRequest.Builder builder = new SearchRequest.Builder();
|
||||
builder.index(index);
|
||||
builder.query(q -> q.term(TermQuery.of(e -> e.field("machineId").value(machineId))));
|
||||
SearchResponse<CuttingSettingDO> searchSetting = null;
|
||||
try {
|
||||
SearchResponse<?> search = elasticsearchClient.search(builder.build(), clazz);
|
||||
List<? extends Hit<?>> hits = search.hits().hits();
|
||||
if (CollUtil.isNotEmpty(hits)) {
|
||||
Hit<?> hit = hits.get(0);
|
||||
return hit.source();
|
||||
}
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw exception(INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+6
-7
@@ -172,8 +172,6 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
@Override
|
||||
public Map<Integer, List<MachineTemplateRespVO>> getMachineTemplateTree() {
|
||||
|
||||
// List<MachineBrandDO> machineBrandDOS = machineBrandMapper.selectListByType(machineType);
|
||||
|
||||
List<MachineBrandDO> machineBrandDOS = machineBrandMapper.selectList();
|
||||
|
||||
|
||||
@@ -187,11 +185,12 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
.filter(m -> !Objects.equals(m.getBrandId(), null))
|
||||
.map(m -> m.setSetting(unzipString(m.getSetting()))).toList();
|
||||
|
||||
for (MachineTemplateRespVO machineTemplateRespVO : machineTemplateRespVOS) {
|
||||
machineTemplateRespVO.setMachineTemplateDOS(machineTemplateDOS.stream()
|
||||
.filter(m -> m.getBrandId().equals(machineTemplateRespVO.getId()))
|
||||
.toList());
|
||||
}
|
||||
machineTemplateRespVOS.forEach(f->
|
||||
f.setMachineTemplateDOS(machineTemplateDOS.stream()
|
||||
.filter(m -> m.getBrandId().equals(f.getId()))
|
||||
.toList())
|
||||
);
|
||||
|
||||
|
||||
return machineTemplateRespVOS.stream().collect(Collectors.groupingBy(MachineTemplateRespVO::getMachineType));
|
||||
|
||||
|
||||
+9
-4
@@ -1,9 +1,6 @@
|
||||
package com.cf.imes.module.system.service.systemconfig;
|
||||
|
||||
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;
|
||||
@@ -46,6 +43,13 @@ public interface SystemConfigService {
|
||||
*/
|
||||
void updateStatus(ConfigUpdateStatusReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 更新基础配置顺序
|
||||
*
|
||||
* @param reqVO
|
||||
*/
|
||||
void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO);
|
||||
|
||||
/**
|
||||
* 查询组织下自定义板编号配置(缓存)
|
||||
*
|
||||
@@ -55,4 +59,5 @@ public interface SystemConfigService {
|
||||
|
||||
void deleteSystemConfig(ConfigDeleteReqVO reqVO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+21
-4
@@ -6,10 +6,7 @@ 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.redis.RedisKeyConstants;
|
||||
@@ -23,6 +20,7 @@ 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;
|
||||
@@ -97,6 +95,25 @@ public class SystemConfigServiceImpl implements SystemConfigService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateConfigSort(List<ConfigUpdateSortReqVO> reqVO) {
|
||||
|
||||
ArrayList<SystemConfigDO> systemConfigDOS = new ArrayList<>();
|
||||
|
||||
reqVO.forEach(f->
|
||||
systemConfigDOS.add(SystemConfigDO
|
||||
.builder()
|
||||
.id(f.getId())
|
||||
.type(f.getType())
|
||||
.status(f.getStatus())
|
||||
.sort(f.getSort())
|
||||
.build()));
|
||||
|
||||
systemConfigMapper.updateBatch(systemConfigDOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = RedisKeyConstants.SYSTEM_CONFIG, key = "'" + RedisKeyConstants.CUSTOM_PLATE_NO + "'", unless = "#result == null")
|
||||
public SystemConfigDO getOrgCustomPlateNoConfig() {
|
||||
|
||||
+19
-4
@@ -5,9 +5,7 @@ import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.CustomPlateNoServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.DefaultSystemConfigServiceHandler;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.IntellectBranchingService;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.impl.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -39,12 +37,29 @@ public class SystemConfigServiceFactory {
|
||||
return applicationContext.getBean(DefaultSystemConfigServiceHandler.class);
|
||||
}
|
||||
switch (systemConfigTypeEnum) {
|
||||
|
||||
// 自定义板编号
|
||||
case CUSTOM_PLATE_NO:
|
||||
return applicationContext.getBean(CustomPlateNoServiceHandler.class);
|
||||
// 板件分线
|
||||
case INTELLIGENT_BRANCH:
|
||||
return applicationContext.getBean(IntellectBranchingService.class);
|
||||
// 高级筛选
|
||||
case ADVANCED_SCREEN:
|
||||
// todo 高级筛选
|
||||
return applicationContext.getBean(AdvancedScreenServiceHandler.class);
|
||||
// 加工筛选
|
||||
case PROCESSING_SCREENING:
|
||||
return applicationContext.getBean(ProcessScreeningServiceHandler.class);
|
||||
// 数据处理
|
||||
case DATA_PROCESSING:
|
||||
return applicationContext.getBean(DataProcessServiceHandler.class);
|
||||
// 加工方案
|
||||
case PROCESS_SCHEME:
|
||||
return applicationContext.getBean(ProcessSchemeServiceHandler.class);
|
||||
// 多种颜色排单
|
||||
case MULTI_COLOR_ORDER_PLAN:
|
||||
return applicationContext.getBean(MultiColorOrderPlanServiceHandler.class);
|
||||
|
||||
default:
|
||||
throw new ServiceException(ErrorCodeConstants.SYSTEM_CONFIG_TYPE_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
+37
-18
@@ -16,9 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -34,29 +32,50 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO reqVO) {
|
||||
// todo 后续所有configTypeEnum中的类型需要上到列表补全时通过遍历enum来补充
|
||||
SystemConfigTypeEnum customplateNoEnum = SystemConfigTypeEnum.CUSTOM_PLATE_NO;
|
||||
|
||||
// 查询所有的 SystemConfigTypeEnum 类型
|
||||
List<SystemConfigTypeEnum> allConfigTypes = Arrays.asList(SystemConfigTypeEnum.values());
|
||||
|
||||
List<SystemConfigTypeEnum> list = allConfigTypes.stream().filter(f -> !f.getType().equals(3)).toList();
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.likeIfPresent(SystemConfigDO::getName, reqVO.getName())
|
||||
.eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.eq(SystemConfigDO::getType, customplateNoEnum.getType())
|
||||
.in(SystemConfigDO::getType, list.stream().map(SystemConfigTypeEnum::getType).toList())
|
||||
.eqIfPresent(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.select(SystemConfigDO::getId, SystemConfigDO::getName, SystemConfigDO::getStatus, SystemConfigDO::getType)
|
||||
.orderByAsc(SystemConfigDO::getId));
|
||||
Optional<SystemConfigDO> configDOOptional = systemConfigDOS.stream().filter(c -> ObjectUtil.equal(customplateNoEnum.getType(), c.getType())).findAny();
|
||||
if (configDOOptional.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(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType(), s.getType()))
|
||||
.max(Comparator.comparing(SystemConfigDO::getVersion));
|
||||
if(maxVersionCustPlateNoConfigOptinal.isPresent()) {
|
||||
systemConfigDOS.removeIf(s -> ObjectUtil.equal(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType(), s.getType()) && ObjectUtil.notEqual(s.getId(), maxVersionCustPlateNoConfigOptinal.get().getId()));
|
||||
|
||||
// 遍历枚举
|
||||
List<SystemConfigDO> resultList = new ArrayList<>();
|
||||
for (SystemConfigTypeEnum configTypeEnum : list) {
|
||||
// 获取当前枚举类型的配置项列表
|
||||
List<SystemConfigDO> typeConfigs = systemConfigDOS.stream()
|
||||
.filter(c -> ObjectUtil.equal(configTypeEnum.getType(), c.getType()))
|
||||
.toList();
|
||||
|
||||
if (typeConfigs.isEmpty()) {
|
||||
// 如果没有当前类型的配置,则创建默认配置
|
||||
SystemConfigDO initConfig = SystemConfigDO
|
||||
.builder()
|
||||
.id(null)
|
||||
.name(configTypeEnum.getName())
|
||||
.type(configTypeEnum.getType())
|
||||
.build();
|
||||
|
||||
resultList.add(initConfig);
|
||||
} else {
|
||||
// 如果存在配置,保留版本号最大的配置
|
||||
Optional<SystemConfigDO> maxVersionConfig = typeConfigs.stream()
|
||||
.map(m->m.setName(configTypeEnum.getName()))
|
||||
.max(Comparator.comparing(SystemConfigDO::getVersion));
|
||||
|
||||
maxVersionConfig.ifPresent(resultList::add);
|
||||
|
||||
}
|
||||
return systemConfigDOS;
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+18
-20
@@ -2,9 +2,6 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
@@ -23,7 +20,8 @@ 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.*;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.BRANCHING_SETTING_RULE_SAVE_CHECK_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.BRANCHING_SETTING_SAVE_ERROR;
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,22 +48,22 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
|
||||
@Override
|
||||
public void checkValid(String setting) {
|
||||
|
||||
JSONArray jsonArray = JSON.parseArray(setting);
|
||||
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
|
||||
checkMachineId(jsonObject.getString("machineId"));
|
||||
String machineName = jsonObject.getString("machineName");
|
||||
checkMachineName(machineName);
|
||||
checkMachineConfig(jsonObject.get("machineConfig"),machineName);
|
||||
}
|
||||
|
||||
if(jsonArray.size() < 2){
|
||||
throw new ServiceException(BRANCHING_SETTING_COUNT_ERROR);
|
||||
}
|
||||
//
|
||||
// JSONArray jsonArray = JSON.parseArray(setting);
|
||||
//
|
||||
// for (int i = 0; i < jsonArray.size(); i++) {
|
||||
//
|
||||
// JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
//
|
||||
// checkMachineId(jsonObject.getString("machineId"));
|
||||
// String machineName = jsonObject.getString("machineName");
|
||||
// checkMachineName(machineName);
|
||||
// checkMachineConfig(jsonObject.get("machineConfig"),machineName);
|
||||
// }
|
||||
//
|
||||
// if(jsonArray.size() < 2){
|
||||
// throw new ServiceException(BRANCHING_SETTING_COUNT_ERROR);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
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.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 多种颜色排单
|
||||
*/
|
||||
@Service("multiColorOrderPlanServiceHandler")
|
||||
@Slf4j
|
||||
public class MultiColorOrderPlanServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void checkValid(String setting) {
|
||||
// todo checkValid
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeSaveConfig(ConfigSaveReqVO reqVO) {
|
||||
// todo beforeSaveConfig
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void afterSaveConfig(SystemConfigDO systemConfigDO, ConfigSaveReqVO reqVO) {
|
||||
// todo afterSaveConfig
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
// todo deleteConfig
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
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.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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 加工方案服务处理器
|
||||
*/
|
||||
|
||||
@Service("processSchemeServiceHandler")
|
||||
@Slf4j
|
||||
public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
|
||||
if (systemConfigDOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
return systemConfigDOS;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkValid(String setting) {
|
||||
// todo checkValid
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeSaveConfig(ConfigSaveReqVO reqVO) {
|
||||
// todo beforeSaveConfig
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterSaveConfig(SystemConfigDO systemConfigDO, ConfigSaveReqVO reqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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());
|
||||
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
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.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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 加工筛选服务处理器
|
||||
*/
|
||||
@Service("processScreeningServiceHandler")
|
||||
@Slf4j
|
||||
public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceHandler {
|
||||
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO pageReqVO) {
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectSystemConfigList(pageReqVO.getType(),null);
|
||||
|
||||
if (systemConfigDOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
|
||||
return systemConfigDOS;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void checkValid(String setting) {
|
||||
// todo checkValid
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeSaveConfig(ConfigSaveReqVO reqVO) {
|
||||
// todo beforeSaveConfig
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterSaveConfig(SystemConfigDO systemConfigDO, ConfigSaveReqVO reqVO) {
|
||||
// todo afterSaveConfig
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
// todo afterUpdateStatus
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
|
||||
systemConfigMapper.deleteById(reqVO.getId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user