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:
+4
-1
@@ -26,7 +26,10 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
||||
|
||||
|
||||
|
||||
IPage<OrderRespVOCopy> selectOrderList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
List<OrderRespVOCopy> selectOrderList(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper,@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
|
||||
|
||||
|
||||
List<Long> selectOrderListCount(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||
|
||||
|
||||
|
||||
|
||||
+7
-29
@@ -605,7 +605,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
@Override
|
||||
public PageResult<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO) {
|
||||
PageDTO<OrderRespVOCopy> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
||||
List<Integer> statusList = new ArrayList<>();
|
||||
|
||||
@@ -626,6 +625,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
|
||||
}
|
||||
|
||||
Integer pageNo = (pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize();
|
||||
|
||||
QueryWrapperX<OrderDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX
|
||||
@@ -642,40 +642,18 @@ public class PlanServiceImpl implements PlanService {
|
||||
.likeIfPresent(FIELD_CUSTOMER, pageReqVO.getConsignee())
|
||||
.likeIfPresent(FIELD_CUSTOM_ORDER_NO, pageReqVO.getDefaultId())
|
||||
.likeIfPresent(FIELD_ADDRESS, pageReqVO.getConsigneeAddress())
|
||||
.betweenIfPresent(FIELD_ORDER_DATE, pageReqVO.getCreateTime())
|
||||
.orderByDesc("o.id");
|
||||
.betweenIfPresent(FIELD_ORDER_DATE, pageReqVO.getCreateTime());
|
||||
|
||||
IPage<OrderRespVOCopy> orderRespVOCopies = planItemMapper.selectOrderList(page,queryWrapperX);
|
||||
List<OrderRespVOCopy> orderRespVOCopies = planItemMapper.selectOrderList(queryWrapperX,pageNo,pageReqVO.getPageSize());
|
||||
|
||||
List<OrderRespVOCopy> records = orderRespVOCopies.getRecords();
|
||||
List<Long> sum = planItemMapper.selectOrderListCount(queryWrapperX);
|
||||
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
|
||||
if (CollUtil.isEmpty(orderRespVOCopies)) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
List<Long> orderIds = records.stream().map(OrderRespVOCopy::getOrderId).toList();
|
||||
|
||||
|
||||
QueryWrapperX<PlateDO> queryWrapperX2 = new QueryWrapperX<>();
|
||||
queryWrapperX2
|
||||
.eq("op.organ_id",getUserOrganId())
|
||||
.inIfPresent("op.order_id",orderIds)
|
||||
.eq(FIELD_OP_DELETED,false)
|
||||
.eq("op.is_optimized",false)
|
||||
.inIfPresent("op.goods_id",ids)
|
||||
.isNull(FIELD_PLAN_ID);
|
||||
|
||||
|
||||
List<PlatePage> plateList = plateMapper.selectNoPlanPlateList(queryWrapperX2);
|
||||
|
||||
|
||||
orderRespVOCopies.getRecords().forEach(m->{
|
||||
m.setNum((int) plateList.stream().filter(f->f.getOrderId().equals(m.getOrderId())).map(PlatePage::getPlateId).count());
|
||||
|
||||
m.setArea(plateList.stream().filter(f->f.getOrderId().equals(m.getOrderId())).map(PlatePage::getArea).reduce(BigDecimal.ZERO,BigDecimal::add));
|
||||
});
|
||||
|
||||
return new PageResult<>(orderRespVOCopies.getRecords(), orderRespVOCopies.getTotal());
|
||||
return new PageResult<>(orderRespVOCopies, (long) sum.size());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+23
-1
@@ -28,7 +28,29 @@
|
||||
o.customer as customer,
|
||||
o.address as address,
|
||||
o.custom_order_no as defineId,
|
||||
o.status as status
|
||||
o.status as status,
|
||||
count(op.id) as num,
|
||||
sum(op.area) as area
|
||||
|
||||
from order_plan_item opi
|
||||
right join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
right join orders o on op.organ_id = o.organ_id and op.order_id = o.id
|
||||
|
||||
${ew.customSqlSegment}
|
||||
|
||||
group by o.id
|
||||
order by o.id desc
|
||||
limit #{pageNo},#{pageSize};
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderListCount" resultType="java.lang.Long">
|
||||
|
||||
|
||||
select distinct
|
||||
o.id
|
||||
|
||||
from order_plan_item opi
|
||||
right join order_plate op on opi.organ_id = op.organ_id and opi.order_id = op.order_id and opi.goods_id = op.goods_id and opi.plate_id = op.id
|
||||
|
||||
+4
@@ -6,7 +6,9 @@ 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.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,4 +28,6 @@ public interface SystemConfigDataMapper extends BaseMapperX<SystemConfigDataDO>
|
||||
.orderByAsc(SystemConfigDataDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
@Delete("delete from system_config_data where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id, @Param("organId") Long organId);
|
||||
}
|
||||
|
||||
+5
@@ -5,7 +5,9 @@ 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.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,4 +29,7 @@ public interface SystemConfigFilterMapper extends BaseMapperX<SystemConfigFilter
|
||||
}
|
||||
|
||||
|
||||
@Delete("delete from system_config_filter where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id,@Param("organId") Long organId);
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -6,7 +6,9 @@ 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.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -28,4 +30,8 @@ public interface SystemConfigProcessMapper extends BaseMapperX<SystemConfigProce
|
||||
.orderByAsc(SystemConfigProcessDO::getSort, SystemConfigDO::getCreateTime));
|
||||
}
|
||||
|
||||
|
||||
@Delete("delete from system_config_process where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -6,7 +6,9 @@ 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.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,5 +37,7 @@ public interface SystemConfigSchemeMapper extends BaseMapperX<SystemConfigScheme
|
||||
}
|
||||
|
||||
|
||||
@Delete("delete from system_config_scheme where organ_id = #{organId} and id = #{id}")
|
||||
void deleteConfig(@Param("id") Long id, @Param("organId") Long organId);
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ public enum SystemConfigTypeEnum {
|
||||
INTELLIGENT_BRANCH(2, "板件筛选"),
|
||||
|
||||
/**
|
||||
* 加工分线
|
||||
* 加工筛选
|
||||
*/
|
||||
PROCESSING_SCREENING(3, "加工分线"),
|
||||
PROCESSING_SCREENING(3, "加工筛选"),
|
||||
|
||||
/**
|
||||
* 数据处理
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class SystemConfigServiceFactory {
|
||||
// 板件分线
|
||||
case INTELLIGENT_BRANCH:
|
||||
return applicationContext.getBean(IntellectBranchingService.class);
|
||||
// 加工分线
|
||||
// 加工筛选
|
||||
case PROCESSING_SCREENING:
|
||||
return applicationContext.getBean(ProcessScreeningServiceHandler.class);
|
||||
// 数据处理
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle
|
||||
|
||||
validateDataConfigUsedAlready(id);
|
||||
|
||||
systemConfigDataMapper.deleteById(id);
|
||||
systemConfigDataMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+25
-15
@@ -1,11 +1,14 @@
|
||||
package com.cf.imes.module.system.service.systemconfig.factory.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.systemconfig.SystemConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.dict.DictDataMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.systemconfig.SystemConfigMapper;
|
||||
import com.cf.imes.module.system.enums.config.SystemConfigTypeEnum;
|
||||
import com.cf.imes.module.system.service.systemconfig.factory.service.AbstractSystemConfigServiceHandler;
|
||||
@@ -13,7 +16,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,33 +33,37 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
@Resource
|
||||
private SystemConfigMapper systemConfigMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataMapper dictDataMapper;
|
||||
|
||||
@Resource
|
||||
private CustomPlateNoServiceHandler customPlateNoServiceHandler;
|
||||
|
||||
@Override
|
||||
public List<SystemConfigDO> selectList(ConfigPageReqVO reqVO) {
|
||||
|
||||
// 查询所有的 SystemConfigTypeEnum 类型
|
||||
List<SystemConfigTypeEnum> allConfigTypes = Arrays.asList(SystemConfigTypeEnum.values());
|
||||
List<DictDataDO> dictDataDOS = dictDataMapper.selectListByStatusAndDictType(CommonStatusEnum.ENABLE.getStatus(), "system_config_type_enum");
|
||||
|
||||
// 自定义板编号、高级筛选不走通用分页查询
|
||||
// List<SystemConfigTypeEnum> list = allConfigTypes.stream()
|
||||
// .filter(f -> ObjectUtil.notEqual(SystemConfigTypeEnum.ADVANCED_SCREEN.getType(), f.getType())).toList();
|
||||
if(CollUtil.isEmpty(dictDataDOS)){
|
||||
log.error("系统配置项对应的字典被关闭或数据查询有误");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<SystemConfigDO> systemConfigDOS = systemConfigMapper.selectList(new LambdaQueryWrapperX<SystemConfigDO>()
|
||||
.likeIfPresent(SystemConfigDO::getName, reqVO.getName())
|
||||
// .eq(SystemConfigDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.in(SystemConfigDO::getType, allConfigTypes.stream().map(SystemConfigTypeEnum::getType).toList())
|
||||
.inIfPresent(SystemConfigDO::getType, dictDataDOS.stream().map(DictDataDO::getValue).toList())
|
||||
.eqIfPresent(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())
|
||||
.select(SystemConfigDO::getId, SystemConfigDO::getName, SystemConfigDO::getStatus, SystemConfigDO::getType,SystemConfigDO::getVersion)
|
||||
.orderByAsc(SystemConfigDO::getId));
|
||||
|
||||
// 遍历枚举
|
||||
List<SystemConfigDO> resultList = new ArrayList<>();
|
||||
for (SystemConfigTypeEnum configTypeEnum : allConfigTypes) {
|
||||
|
||||
|
||||
for (DictDataDO dictDataDO : dictDataDOS) {
|
||||
// 获取当前枚举类型的配置项列表
|
||||
List<SystemConfigDO> typeConfigs = systemConfigDOS.stream()
|
||||
.filter(c -> ObjectUtil.equal(configTypeEnum.getType(), c.getType()))
|
||||
.filter(c -> ObjectUtil.equal(dictDataDO.getValue(), c.getType()))
|
||||
.toList();
|
||||
|
||||
if (typeConfigs.isEmpty()) {
|
||||
@@ -61,12 +71,12 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
SystemConfigDO initConfig = SystemConfigDO
|
||||
.builder()
|
||||
.id(null)
|
||||
.name(configTypeEnum.getName())
|
||||
.type(configTypeEnum.getType())
|
||||
.name(dictDataDO.getLabel())
|
||||
.type(Integer.parseInt(dictDataDO.getValue()))
|
||||
.build();
|
||||
|
||||
// 自定义板编号
|
||||
if(configTypeEnum.getType().equals(SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())){
|
||||
if(Integer.parseInt(dictDataDO.getValue()) == (SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType())){
|
||||
initConfig.setStatus(CommonStatusEnum.DISABLE.getStatus());
|
||||
resultList.add(initConfig);
|
||||
continue;
|
||||
@@ -76,12 +86,12 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi
|
||||
} else {
|
||||
// 如果存在配置,保留版本号最大的配置
|
||||
Optional<SystemConfigDO> maxVersionConfig = typeConfigs.stream()
|
||||
.map(m->m.setName(configTypeEnum.getName()))
|
||||
.map(m->m.setName(dictDataDO.getLabel()))
|
||||
.max(Comparator.comparingInt(SystemConfigDO::getVersion));
|
||||
|
||||
maxVersionConfig.ifPresent(resultList::add);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return resultList;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
|
||||
validateSystemConfigExists(reqVO.getId());
|
||||
|
||||
systemConfigFilterMapper.deleteById(reqVO.getId());
|
||||
systemConfigFilterMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand
|
||||
throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN);
|
||||
}
|
||||
|
||||
systemConfigSchemeMapper.deleteById(reqVO.getId());
|
||||
systemConfigSchemeMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.ge
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* @author 加工分线服务处理器
|
||||
* @author 加工筛选服务处理器
|
||||
*/
|
||||
@Service("processScreeningServiceHandler")
|
||||
@Slf4j
|
||||
@@ -88,7 +88,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH
|
||||
|
||||
validateProcessConfigUsedAlready(id);
|
||||
|
||||
systemConfigProcessMapper.deleteById(id);
|
||||
systemConfigProcessMapper.deleteConfig(reqVO.getId(),getUserOrganId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user