This commit is contained in:
		
							parent
							
								
									4ca6bc49d2
								
							
						
					
					
						commit
						2a8dca2a2b
					
				| 
						 | 
				
			
			@ -26,7 +26,7 @@ public class LeaseTotalInfo {
 | 
			
		|||
    private Long parentId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "序号")
 | 
			
		||||
    @Excel(name = "序号", isSequence = true, sort = 0)
 | 
			
		||||
    @Excel(name = "序号", isSequence = true, sort = 0, width = 5)
 | 
			
		||||
    private String serialNumber;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "分公司")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1472,10 +1472,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
 | 
			
		|||
                list = list.stream()
 | 
			
		||||
                        .filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
 | 
			
		||||
                        .collect(Collectors.toList());
 | 
			
		||||
            } /*else {
 | 
			
		||||
                // 材料员权限
 | 
			
		||||
                list = filterListInfo(list, username);
 | 
			
		||||
            }*/
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // 处理数据并计算总和
 | 
			
		||||
        if (!CollectionUtils.isEmpty(list)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1494,7 +1491,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
 | 
			
		|||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            for (LeaseTotalInfo leaseTotalInfo : list) {
 | 
			
		||||
            /*for (LeaseTotalInfo leaseTotalInfo : list) {
 | 
			
		||||
                // 根据typeId和parentId查询领料数量
 | 
			
		||||
                LeaseTotalInfo totalInfo = materialLeaseInfoMapper.getTotalInfo(leaseTotalInfo);
 | 
			
		||||
                if (totalInfo != null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1518,6 +1515,16 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
 | 
			
		|||
                summary.setOutNum(outNum.setScale(3, RoundingMode.HALF_UP));
 | 
			
		||||
                summary.setPendingNum(pendingNum.setScale(3, RoundingMode.HALF_UP));
 | 
			
		||||
                list.add(0, summary);
 | 
			
		||||
            }*/
 | 
			
		||||
            // 累加list中的outNum数量
 | 
			
		||||
            BigDecimal totalOutNum = list.stream()
 | 
			
		||||
                    .map(LeaseTotalInfo::getOutNum)
 | 
			
		||||
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
 | 
			
		||||
            if (info.getIsExport() == 0) {
 | 
			
		||||
                LeaseTotalInfo summary = new LeaseTotalInfo();
 | 
			
		||||
                summary.setUnitName("合计");
 | 
			
		||||
                summary.setOutNum(totalOutNum.setScale(3, RoundingMode.HALF_UP));
 | 
			
		||||
                list.add(0, summary);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return list;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1280,6 +1280,25 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
 | 
			
		|||
        MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo = new MaterialRetainedEquipmentInfo();
 | 
			
		||||
        materialRetainedEquipmentInfo.setSubUnitName("分包直领");
 | 
			
		||||
        List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getSubUnitList(bean);
 | 
			
		||||
        if (CollectionUtils.isNotEmpty(list)) {
 | 
			
		||||
            // 使用Stream过滤并收集符合条件的元素
 | 
			
		||||
            list = list.stream()
 | 
			
		||||
                    .filter(info -> info.getSubUnitName() != null)
 | 
			
		||||
                    .filter(this::hasRelatedAgreements)
 | 
			
		||||
                    .collect(Collectors.toList());
 | 
			
		||||
            list = new ArrayList<>(list.stream()
 | 
			
		||||
                    // 过滤条件:subUnitName非空 + 满足关联协议判断
 | 
			
		||||
                    .filter(info -> info.getSubUnitName() != null)
 | 
			
		||||
                    .filter(this::hasRelatedAgreements)
 | 
			
		||||
                    // 按 subUnitName 去重:用 subUnitName 做Map的key,value为原对象
 | 
			
		||||
                    .collect(Collectors.toMap(
 | 
			
		||||
                            MaterialRetainedEquipmentInfo::getSubUnitName,
 | 
			
		||||
                            info -> info,
 | 
			
		||||
                            (existing, replacement) -> existing
 | 
			
		||||
                    ))
 | 
			
		||||
                    // 将Map的value(去重后的对象)转回List
 | 
			
		||||
                    .values());
 | 
			
		||||
        }
 | 
			
		||||
        list.add(0, materialRetainedEquipmentInfo);
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1346,6 +1346,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
              AND bu.type_id = 36
 | 
			
		||||
              and sd.dept_id not in (342,345,347,348,101)
 | 
			
		||||
              and bp.pro_id not in (3414,1192,3321,3595)
 | 
			
		||||
              and bp.pro_center IS NOT NULL
 | 
			
		||||
        <if test="impUnitName != null and impUnitName != ''">
 | 
			
		||||
            AND sd.dept_name = #{impUnitName}
 | 
			
		||||
        </if>
 | 
			
		||||
| 
						 | 
				
			
			@ -1514,6 +1515,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            AND bp.external_id is not NULL
 | 
			
		||||
            and sd.dept_id not in (342,345,347,348,101)
 | 
			
		||||
            and bp.pro_id not in (3414,1192,3321,3595)
 | 
			
		||||
            and bp.pro_center IS NOT NULL
 | 
			
		||||
            <if test="impUnitName != null and impUnitName != ''">
 | 
			
		||||
                AND sd.dept_name = #{impUnitName}
 | 
			
		||||
            </if>
 | 
			
		||||
| 
						 | 
				
			
			@ -1738,23 +1740,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
 | 
			
		||||
    <select id="getSubUnitList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
 | 
			
		||||
        SELECT DISTINCT
 | 
			
		||||
            bz.bzmc AS teamName,
 | 
			
		||||
            bz.ssfbdw AS subUnitName
 | 
			
		||||
        bu.unit_name  AS teamName,
 | 
			
		||||
        bp.external_id AS externalId,
 | 
			
		||||
        bz.ssfbdw      AS subUnitName
 | 
			
		||||
        FROM
 | 
			
		||||
            `micro-tool`.bzgl_bz bz
 | 
			
		||||
        LEFT JOIN bm_project bp ON bz.project_id = bp.external_id
 | 
			
		||||
        LEFT JOIN  sys_dept sd ON sd.dept_id = bp.imp_unit
 | 
			
		||||
        clz_slt_agreement_info sai
 | 
			
		||||
        LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
 | 
			
		||||
        LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
 | 
			
		||||
        LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
 | 
			
		||||
        LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
 | 
			
		||||
        LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
 | 
			
		||||
        LEFT JOIN `micro-tool`.bzgl_bz bz ON bp.external_id = bz.project_id AND bz.bzmc = bu.unit_name
 | 
			
		||||
        LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
 | 
			
		||||
        WHERE
 | 
			
		||||
        bz.bzmc IS NOT NULL
 | 
			
		||||
        sai.`status` = '0'
 | 
			
		||||
        AND sai.end_time IS NULL
 | 
			
		||||
        AND sai.back_id IS NULL
 | 
			
		||||
        AND bu.unit_name is not null
 | 
			
		||||
        AND bp.external_id is not NULL
 | 
			
		||||
        and sd.dept_id not in (342,345,347,348,101)
 | 
			
		||||
        and bp.pro_id not in (3414,1192,3321,3595)
 | 
			
		||||
        <if test="impUnitName != null and impUnitName != ''">
 | 
			
		||||
            AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
 | 
			
		||||
            AND sd.dept_name = #{impUnitName}
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="proName != null and proName != ''">
 | 
			
		||||
            AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
 | 
			
		||||
            AND bp.pro_name = #{proName}
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="departName != null and departName != ''">
 | 
			
		||||
            AND df.project_dept  LIKE CONCAT('%', #{departName}, '%')
 | 
			
		||||
            AND bp.pro_center  LIKE CONCAT('%', #{departName}, '%')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="teamName != null and teamName != ''">
 | 
			
		||||
            AND bu.unit_name  LIKE CONCAT('%', #{teamName}, '%')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="subUnitName != null and subUnitName != ''">
 | 
			
		||||
            AND bz.ssfbdw  LIKE CONCAT('%', #{subUnitName}, '%')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="projectIdList != null  and projectIdList.size() > 0">
 | 
			
		||||
            AND bp.external_id in
 | 
			
		||||
| 
						 | 
				
			
			@ -1762,14 +1781,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
                #{item}
 | 
			
		||||
            </foreach>
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="subUnitName != null and subUnitName != ''">
 | 
			
		||||
            AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%')
 | 
			
		||||
        </if>
 | 
			
		||||
        <if test="impUnit != null and impUnit != ''">
 | 
			
		||||
            AND bp.imp_unit = #{impUnit}
 | 
			
		||||
        </if>
 | 
			
		||||
        GROUP BY
 | 
			
		||||
        bz.ssfbdw
 | 
			
		||||
        mt.type_id, bu.unit_name, bp.pro_name, bz.ssfbdw
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getStoreNumAndUseList" resultType="com.bonus.material.clz.domain.vo.MaterialStorageAndUseNumInfo">
 | 
			
		||||
| 
						 | 
				
			
			@ -2062,6 +2078,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
         sai.is_slt = '0'
 | 
			
		||||
        AND bp.external_id IS NOT NULL
 | 
			
		||||
        and bp.pro_id not in (3414,1192,3321,3595)
 | 
			
		||||
        and bp.pro_center IS NOT NULL
 | 
			
		||||
        <if test="impUnitName != null and impUnitName != ''">
 | 
			
		||||
            AND sd.dept_name = #{impUnitName}
 | 
			
		||||
        </if>
 | 
			
		||||
| 
						 | 
				
			
			@ -2137,6 +2154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        AND sai.end_time IS NULL
 | 
			
		||||
        AND sai.back_id IS NULL
 | 
			
		||||
        and bp.pro_id not in (3414,1192,3321,3595)
 | 
			
		||||
        and bp.pro_center IS NOT NULL
 | 
			
		||||
        <if test="impUnitName != null and impUnitName != ''">
 | 
			
		||||
            AND sd.dept_name = #{impUnitName}
 | 
			
		||||
        </if>
 | 
			
		||||
| 
						 | 
				
			
			@ -2399,6 +2417,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        AND bp.external_id IS NOT NULL
 | 
			
		||||
        AND bu.type_id in(32,33)
 | 
			
		||||
        and bp.pro_id not in (3414,1192,3321,3595)
 | 
			
		||||
        and bp.pro_center IS NOT NULL
 | 
			
		||||
        <if test="impUnitName != null and impUnitName != ''">
 | 
			
		||||
            AND sd.dept_name = #{impUnitName}
 | 
			
		||||
        </if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -499,6 +499,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            bp.del_flag = '0'
 | 
			
		||||
        -- 剔除已结算工程
 | 
			
		||||
        AND bp.pro_id IN (SELECT project_id FROM bm_agreement_info WHERE is_slt = 0)
 | 
			
		||||
        AND bp.external_id IS NOT NULL
 | 
			
		||||
        <if test="impUnit != null and impUnit != ''">
 | 
			
		||||
            and bp.imp_unit = #{impUnit}
 | 
			
		||||
        </if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue