直转优化
This commit is contained in:
parent
db56b45f4a
commit
28ea7cc40e
|
|
@ -420,4 +420,12 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
ProAuthorizeInfo selectProAuthorizeInfo(ProAuthorizeInfo bean);
|
||||
|
||||
/**
|
||||
* 根据单位和工程id查询该班组是否建立项目部挂靠协议
|
||||
* @param id
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") String id, @Param("projectId") Long projectId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -415,16 +415,31 @@ public class SelectServiceImpl implements SelectService {
|
|||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
if (bmUnit.getDeptId() != null) {
|
||||
groupList = treeBuild.buildTree();
|
||||
} else if (bmUnit.getProjectId() != null && bmUnit.getLeaseId() != null) {
|
||||
} else if (bmUnit.getProjectId() != null) {
|
||||
groupList = treeBuild.buildTree();
|
||||
// 获取已授权班组,进行数据拼接
|
||||
List<ProjectTreeNode> newList = mapper.getTeamLeaseList(bmUnit);
|
||||
if (CollectionUtils.isNotEmpty(newList)) {
|
||||
groupList.addAll(newList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 原查询结果转换树形结构
|
||||
if (bmUnit.getProjectId() != null && bmUnit.getLeaseId() != null) {
|
||||
// 获取已授权班组,筛选出已建立项目部挂靠协议的班组
|
||||
List<ProjectTreeNode> newList = mapper.getTeamLeaseList(bmUnit);
|
||||
if (CollectionUtils.isNotEmpty(newList)) {
|
||||
// 1. 筛选:仅保留“能查到挂靠协议ID”的班组(过滤无协议的)
|
||||
List<ProjectTreeNode> filteredList = newList.stream()
|
||||
.filter(team -> {
|
||||
// 避免team或team.getId()为空导致的空指针
|
||||
if (team == null || team.getId() == null) {
|
||||
return false;
|
||||
}
|
||||
// 查询该班组是否有挂靠协议
|
||||
Long agreementId = mapper.selectProjectUnitAgreementIdByTeamAndProject(team.getId(), bmUnit.getProjectId());
|
||||
return agreementId != null;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 2. 将筛选后的有效班组加入groupList
|
||||
groupList.addAll(filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -206,4 +206,26 @@ public class DirectApplyInfo extends BaseEntity {
|
|||
private List<Integer> statusList;
|
||||
|
||||
private Integer deptId;
|
||||
|
||||
/**
|
||||
* 领料i8工程id
|
||||
*/
|
||||
private String leaseExternalId;
|
||||
|
||||
/**
|
||||
* 退料i8工程id
|
||||
*/
|
||||
private String backExternalId;
|
||||
|
||||
@ApiModelProperty(value = "领料分公司")
|
||||
private String leaseImpUnitName;
|
||||
|
||||
@ApiModelProperty(value = "退料分公司")
|
||||
private String backImpUnitName;
|
||||
|
||||
@ApiModelProperty(value = "领料项目部")
|
||||
private String leaseDepartName;
|
||||
|
||||
@ApiModelProperty(value = "退料项目部")
|
||||
private String backDepartName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,4 +116,6 @@ public interface DirectRotationMapper {
|
|||
* @return
|
||||
*/
|
||||
List<SltAgreementInfo> getBatchInfo(@Param("agreementId") Long agreementId, @Param("pairs")List<SltAgreementInfo> list);
|
||||
|
||||
DirectApplyInfo getDeptInfo(DirectApplyInfo directApplyInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,10 +146,6 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
return AjaxResult.error("申请失败,不能转入同单位同工程");
|
||||
}
|
||||
// 根据退料协议ID查询该协议是否还有未审核单据待处理,若有,则无法申请,剔除工地直转
|
||||
/*int result = workSiteDirectManageService.checkLeaseApply(directApplyInfos);
|
||||
if (result > 0) {
|
||||
return AjaxResult.error("申请失败,该转出单位和转出工程下有未审核单据待处理,请处理完毕后再重新提交");
|
||||
}*/
|
||||
code = workSiteDirectManageService.genderLeaseCode();
|
||||
directApplyInfos.setCode(code);
|
||||
directApplyInfos.setCreateTime(new Date());
|
||||
|
|
@ -270,6 +266,18 @@ public class DirectRotationImpl implements DirectRotationService {
|
|||
@Override
|
||||
public DirectApplyInfo getInfoById(SltAgreementInfo sltAgreementInfo) {
|
||||
DirectApplyInfo directApplyInfo = mapper.getInfoById(sltAgreementInfo);
|
||||
// 根据领退料i8工程id查询分公司及项目部信息
|
||||
DirectApplyInfo leaseApplyInfo = mapper.getDeptInfo(directApplyInfo);
|
||||
if (leaseApplyInfo != null) {
|
||||
directApplyInfo.setLeaseImpUnitName(leaseApplyInfo.getLeaseImpUnitName());
|
||||
directApplyInfo.setLeaseDepartName(leaseApplyInfo.getLeaseDepartName());
|
||||
}
|
||||
directApplyInfo.setLeaseExternalId(directApplyInfo.getBackExternalId());
|
||||
leaseApplyInfo = mapper.getDeptInfo(directApplyInfo);
|
||||
if (leaseApplyInfo != null) {
|
||||
directApplyInfo.setBackImpUnitName(leaseApplyInfo.getLeaseImpUnitName());
|
||||
directApplyInfo.setBackDepartName(leaseApplyInfo.getLeaseDepartName());
|
||||
}
|
||||
if (directApplyInfo.getDirUrl()!= null){
|
||||
//用逗号分割放入数组
|
||||
String[] split = directApplyInfo.getDirUrl().split(",");
|
||||
|
|
|
|||
|
|
@ -1291,4 +1291,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
lai.id = #{leaseId}
|
||||
</select>
|
||||
|
||||
<select id="selectProjectUnitAgreementIdByTeamAndProject" resultType="java.lang.Long">
|
||||
SELECT
|
||||
baii.agreement_id AS projectUnitAgreementId
|
||||
FROM
|
||||
bm_agreement_info bai
|
||||
LEFT JOIN bm_agreement_info baii ON baii.unit_id = bai.project_unit_id AND baii.project_id = #{projectId}
|
||||
AND baii.status = '1'
|
||||
WHERE
|
||||
bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -177,7 +177,9 @@
|
|||
dai.lease_man AS leaseMan,
|
||||
dai.lease_phone AS leasePhone,
|
||||
dai.dir_url AS dirUrl,
|
||||
dai.`status`
|
||||
dai.`status`,
|
||||
bpl.external_id AS backExternalId,
|
||||
bpl1.external_id AS leaseExternalId
|
||||
FROM
|
||||
direct_apply_info dai
|
||||
LEFT JOIN direct_apply_details dad ON dai.id = dad.direct_id
|
||||
|
|
@ -407,4 +409,23 @@
|
|||
GROUP BY
|
||||
da.back_agreement_id, dad.type_id, dad.ma_id, da.id;
|
||||
</select>
|
||||
|
||||
<select id="getDeptInfo" resultType="com.bonus.material.ma.domain.DirectApplyInfo">
|
||||
SELECT DISTINCT
|
||||
df.project_dept AS leaseDepartName,
|
||||
sd.dept_name AS leaseImpUnitName
|
||||
FROM
|
||||
bm_project bp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
bp.pro_center IS NOT NULL
|
||||
AND bp.external_id IS NOT NULL
|
||||
AND bp.pro_id NOT IN ( 3414, 1192, 3321, 3595 )
|
||||
AND bp.external_id = #{leaseExternalId}
|
||||
AND bp.del_flag = '0'
|
||||
GROUP BY
|
||||
bp.pro_name
|
||||
LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue