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:
+22
-19
@@ -13,9 +13,11 @@ 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.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.SystemConfigMapper;
|
||||
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 +59,9 @@ public class SystemConfigApiImpl implements SystemConfigApi {
|
||||
@Resource
|
||||
private LabelMapper labelMapper;
|
||||
|
||||
@Resource
|
||||
private SystemConfigSchemeMapper systemConfigSchemeMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public CommonResult<SystemConfigRespDTO> getOrgCustomPlateNoConfig() {
|
||||
@@ -65,23 +70,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 +94,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,18 +129,18 @@ 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);
|
||||
SystemConfigDO systemConfigDO = systemConfigSchemeMapper.selectById(processId);
|
||||
|
||||
AssertUtils.notEmpty(systemConfigDO,THIS_PROCESS_CONFIG_DATA_ERROR);
|
||||
|
||||
@@ -240,10 +245,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
-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));
|
||||
}
|
||||
|
||||
|
||||
+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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+70
-15
@@ -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;
|
||||
@@ -40,15 +38,8 @@ 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.*;
|
||||
|
||||
/**
|
||||
* 自定义板编号服务处理器
|
||||
@@ -304,18 +295,82 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterUpdateStatus(SystemConfigDO systemConfigDO, ConfigUpdateStatusReqVO reqVO) {
|
||||
public void deleteConfig(ConfigDeleteReqVO reqVO) {
|
||||
// TODO document why this method is empty
|
||||
}
|
||||
|
||||
|
||||
@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()));
|
||||
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
+22
-8
@@ -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;
|
||||
@@ -114,13 +111,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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user