zhoushihao
2025-05-26 4d00b5a1923103b25ae4beaf26ba0a04b8d3ca4a
中空代码优化:提供字符串多级排序
提供客户名称
4个文件已修改
1个文件已添加
87 ■■■■ 已修改文件
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/dto/OrderDetailsDTO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/vo/HollowAllFlowCardVO.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/dto/OrderDetailsDTO.java
New file
@@ -0,0 +1,21 @@
package com.mes.hollow.entity.dto;
import lombok.Data;
/**
 * @Author : zhoush
 * @Date: 2025/5/23 15:18
 * @Description:客户相关信息
 */
@Data
public class OrderDetailsDTO {
    /**
     * 客户名称
     */
    private String customerName;
    /**
     * 产品名称
     */
    private String productName;
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/vo/HollowAllFlowCardVO.java
@@ -15,11 +15,15 @@
    /**
     * 流程卡号
     */
    private String FlowCardId;
    private String flowCardId;
    /**
     * 客户名称
     */
    private String customerName;
    /**
     * 产品名称
     */
    private String ProductName;
    private String productName;
    /**
     * 是否直通
     */
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
@@ -4,6 +4,7 @@
import com.mes.hollow.entity.HollowGlassRelationInfo;
import com.mes.hollow.entity.dto.HollowGlassDetailsDTO;
import com.mes.hollow.entity.dto.LackDetailsDTO;
import com.mes.hollow.entity.dto.OrderDetailsDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -34,6 +35,6 @@
     * @param flowCardId
     * @return
     */
    String queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId);
    OrderDetailsDTO queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId);
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -13,10 +13,7 @@
import com.mes.hollow.entity.HollowBigStorageCageDetails;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.HollowGlassRelationInfo;
import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO;
import com.mes.hollow.entity.dto.HollowBigStorageDTO;
import com.mes.hollow.entity.dto.HollowGlassDetailsDTO;
import com.mes.hollow.entity.dto.LackDetailsDTO;
import com.mes.hollow.entity.dto.*;
import com.mes.hollow.entity.vo.HollowAllFlowCardVO;
import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO;
import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
@@ -30,10 +27,13 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -315,21 +315,23 @@
        listMap.forEach((e, v) -> {
            HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO();
            HollowBigStorageCageDetails cageDetails = v.get(0);
            //按照流程卡获取对应的产品名称
            OrderDetailsDTO orderDetails = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId());
            if (null != orderDetails) {
                BeanUtils.copyProperties(orderDetails, hollowAllFlowCardVO);
            }
            hollowAllFlowCardVO.setFlowCardId(e);
            if (cageDetails.getHollowSequence() == 0) {
                hollowAllFlowCardVO.setIsThroughSlot(Boolean.TRUE);
            } else {
                hollowAllFlowCardVO.setIsThroughSlot(Boolean.FALSE);
            }
            //按照流程卡获取对应的产品名称
            String productName = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId());
            hollowAllFlowCardVO.setProductName(productName);
            List<FlowCardGlassInfoDTO> flowCardInfoList = hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE);
            hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(flowCardInfoList);
            resultList.add(hollowAllFlowCardVO);
        });
        sortFlowCardIdList(resultList);
        return resultList;
//        return dtos.stream().collect(Collectors.groupingBy(e -> e.getFlowCardId() + ":" + e.getProductName()));
    }
    @Override
@@ -396,5 +398,33 @@
//        return lackDetailsList;
//    }
    private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) {
        Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$");
        list.sort((v1, v2) -> {
            Matcher m1 = pattern.matcher(v1.getFlowCardId());
            Matcher m2 = pattern.matcher(v2.getFlowCardId());
            if (!m1.find() || !m2.find()) {
                throw new IllegalArgumentException("获取到的流程卡不符合校验规则");
            }
            // 提取部分
            BigInteger order1 = new BigInteger(m1.group(1));
            BigInteger order2 = new BigInteger(m2.group(1));
            String layer1 = m1.group(2);
            String layer2 = m2.group(2);
            BigInteger seq1 = new BigInteger(m1.group(3));
            BigInteger seq2 = new BigInteger(m2.group(3));
            // 优先级排序
            int cmp = order1.compareTo(order2);
            if (cmp != 0) return cmp;
            cmp = layer1.compareTo(layer2);
            if (cmp != 0) return cmp;
            return seq1.compareTo(seq2);
        });
    }
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -129,10 +129,11 @@
        from hollow_glass_relation_info
        where flow_card_id = #{flowCardId}
    </select>
    <select id="queryProductNameByFlowCardId" resultType="java.lang.String">
        select product_name
        from sd.order_detail
        where (order_id, order_number) = (
    <select id="queryProductNameByFlowCardId" resultType="com.mes.hollow.entity.dto.OrderDetailsDTO">
        select t.product_name, t1.customer_name
        from sd.order_detail t
                 inner join sd.order t1 on t.order_id = t1.order_id
        where (t.order_id, t.order_number) = (
            select min(order_id) as order_id, min(order_number) as order_number
            from pp.flow_card
            where process_id = #{flowCardId}