材料站多协议类型树修改

This commit is contained in:
bonus 2025-09-22 19:01:55 +08:00
parent a73ca331cb
commit 664d09dbeb
4 changed files with 40 additions and 28 deletions

View File

@ -15,7 +15,7 @@ import java.util.List;
/**
* 退料任务对象 back_apply_info
*
*
* @author xsheng
* @date 2024-10-16
*/
@ -211,4 +211,9 @@ public class MaterialBackApplyInfo implements Serializable {
@Excel(name = "项目部",sort = 4)
private String departName;
/**
* 协议id集合
*/
private List<String> agreementIds;
}

View File

@ -53,9 +53,9 @@ public class SelectServiceImpl implements SelectService {
// 性能监控开始
long startTime = System.currentTimeMillis();
Map<String, Long> stepTimes = new LinkedHashMap<>();
log.info("=== getUnitList开始执行参数: {}", bmUnit);
// 步骤1: 获取登陆用户的组织ID
long step1Start = System.currentTimeMillis();
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
@ -66,25 +66,25 @@ public class SelectServiceImpl implements SelectService {
log.info("用户组织ID为空直接返回空列表总耗时: {}ms", totalTime);
return AjaxResult.success(Collections.emptyList());
}
// 步骤2: 判断是否开启过滤
long step2Start = System.currentTimeMillis();
if (Objects.nonNull(bmUnit) && Objects.nonNull(bmUnit.getEnableFilter()) && bmUnit.getEnableFilter()) {
bmUnit.setDeptId(thisLoginUserDeptId);
}
stepTimes.put("过滤判断", System.currentTimeMillis() - step2Start);
// 步骤3: 判断是否是app模式
if (bmUnit.getIsApp() != null && bmUnit.getIsApp()) {
long appStart = System.currentTimeMillis();
List<BmUnit> list = mapper.getUnitListApp(bmUnit);
stepTimes.put("App模式查询", System.currentTimeMillis() - appStart);
long totalTime = System.currentTimeMillis() - startTime;
DateTimeHelper.logPerformanceAnalysis("getUnitList(App模式)", totalTime, stepTimes);
return AjaxResult.success(list);
}
List<ProjectTreeNode> groupList = new ArrayList<>();
List<ProjectTreeNode> list;
try {
@ -92,7 +92,7 @@ public class SelectServiceImpl implements SelectService {
long dbStart = System.currentTimeMillis();
list = mapper.getUnitList(bmUnit);
stepTimes.put("数据库查询", System.currentTimeMillis() - dbStart);
// 步骤5: 数据过滤
long filterStart = System.currentTimeMillis();
if (list != null) {
@ -128,11 +128,11 @@ public class SelectServiceImpl implements SelectService {
} catch (Exception e) {
log.error("单位类型树-查询失败", e);
}
// 性能分析总结
long totalTime = System.currentTimeMillis() - startTime;
DateTimeHelper.logPerformanceAnalysis("getUnitList", totalTime, stepTimes);
return AjaxResult.success(groupList);
}
@ -414,19 +414,17 @@ public class SelectServiceImpl implements SelectService {
*/
@Override
public AjaxResult getAgreementInfoByIdBack(SelectDto dto) {
AgreementVo vo = new AgreementVo();
List<AgreementVo> list = new ArrayList<>();
try {
if (dto != null && dto.getTeamId() != null) {
dto.setUnitId(Integer.parseInt(dto.getTeamId()));
}
List<AgreementVo> list = mapper.getAgreementInfoByIdBack(dto);
if (CollectionUtils.isNotEmpty(list)) {
vo = list.get(0);
}
list = mapper.getAgreementInfoByIdBack(dto);
} catch (Exception e) {
log.error("往来单位id和标段工程id获取协议信息", e);
}
return AjaxResult.success(vo);
return AjaxResult.success(list);
}
/**
@ -817,19 +815,19 @@ public class SelectServiceImpl implements SelectService {
if (CollectionUtils.isEmpty(nodes)) {
return new ArrayList<>();
}
// 使用Map来存储节点提高查找效率
Map<String, ProjectTreeNode> nodeMap = new HashMap<>();
Map<String, List<ProjectTreeNode>> childrenMap = new HashMap<>();
// 第一遍遍历建立Map索引
for (ProjectTreeNode node : nodes) {
nodeMap.put(node.getId(), node);
childrenMap.put(node.getId(), new ArrayList<>());
}
List<ProjectTreeNode> rootNodes = new ArrayList<>();
// 第二遍遍历建立父子关系
for (ProjectTreeNode node : nodes) {
String parentId = node.getParentId();
@ -844,13 +842,13 @@ public class SelectServiceImpl implements SelectService {
}
}
}
// 第三遍遍历设置children
for (ProjectTreeNode node : nodes) {
List<ProjectTreeNode> children = childrenMap.get(node.getId());
node.setChildren(children);
}
return rootNodes;
}

View File

@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
ORDER BY bai.agreement_id DESC
</select>
<select id="selectBmAgreementInfoByAgreementId" parameterType="Long" resultMap="BmAgreementInfoResult">
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
@ -73,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where agreement_id = #{agreementId}) tta on bai.agreement_id = tta.agreement_id
where bai.status = '1' and bai.agreement_id = #{agreementId}
</select>
<insert id="insertBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" useGeneratedKeys="true" keyProperty="agreementId">
insert into bm_agreement_info (agreement_code, sign_time, unit_id, project_unit_id,
project_id, create_by, lease_day,
@ -140,7 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteBmAgreementInfoByAgreementIds" parameterType="String">
delete from bm_agreement_info where agreement_id in
delete from bm_agreement_info where agreement_id in
<foreach item="agreementId" collection="array" open="(" separator="," close=")">
#{agreementId}
</foreach>
@ -195,9 +195,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
unit_id = #{unitId}
and project_id = #{projectId}
limit 1
</select>
<select id="selectNumByMonthClz" resultType="java.lang.Integer">
select count(*) from clz_bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
</select>
</mapper>
</mapper>

View File

@ -729,7 +729,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id
WHERE
sai.STATUS = '0' and sai.agreement_id = #{agreementId}
sai.STATUS = '0'
<if test="agreementIds != null ">
and sai.agreement_id in
<foreach item="item" collection="agreementIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY
mt.type_id
</select>
@ -851,4 +859,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
</mapper>
</mapper>