材料站班组下拉选、协议下拉选
This commit is contained in:
parent
76f1a1f7f9
commit
33df1a7311
|
|
@ -3,6 +3,7 @@ package com.bonus.material.clz.controller;
|
|||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo;
|
||||
import com.bonus.material.clz.domain.vo.sltAgreementInfo.MaterialSltInfoVo;
|
||||
import com.bonus.material.clz.service.ClzSltAgreementInfoService;
|
||||
|
|
@ -50,6 +51,12 @@ public class ClzSltAgreementInfoController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "工程下拉选根据材料站单位查询")
|
||||
@PostMapping("getProjectListByUnitIds")
|
||||
public AjaxResult getProjectListByUnitIds(@RequestBody BmProject bmProject) {
|
||||
return clzSltAgreementInfoService.getProjectListByUnitIds(bmProject);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据协议获取结算清单")
|
||||
@PostMapping("/getSltInfo")
|
||||
public AjaxResult getSltInfo(@RequestBody List<MaterialSltAgreementInfo> list) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.clz.mapper;
|
||||
|
||||
import com.bonus.common.biz.domain.ProjectTreeNode;
|
||||
import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo;
|
||||
import com.bonus.material.clz.domain.vo.sltAgreementInfo.MaterialSltInfoVo;
|
||||
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
||||
|
|
@ -20,6 +21,11 @@ public interface ClzSltAgreementInfoMapper {
|
|||
*/
|
||||
List<MaterialSltAgreementInfo> getSltAgreementInfo4Project(MaterialSltAgreementInfo bean);
|
||||
|
||||
Integer[] getProjectListByUnitIds(int unitId);
|
||||
|
||||
List<ProjectTreeNode> getProjectList(int projectId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取租赁列表
|
||||
* @param info
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.material.clz.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo;
|
||||
import com.bonus.material.clz.domain.vo.sltAgreementInfo.MaterialSltInfoVo;
|
||||
|
||||
|
|
@ -25,6 +27,14 @@ public interface ClzSltAgreementInfoService {
|
|||
*/
|
||||
MaterialSltInfoVo getSltInfo(MaterialSltAgreementInfo info);
|
||||
|
||||
/**
|
||||
* 工程下拉框
|
||||
*
|
||||
* @param bmProject 工程下拉框
|
||||
* @return 工程下拉框
|
||||
*/
|
||||
AjaxResult getProjectListByUnitIds(BmProject bmProject);
|
||||
|
||||
/**
|
||||
* 提交结算清单
|
||||
* @param sltInfoVo
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
package com.bonus.material.clz.service.impl;
|
||||
|
||||
import com.bonus.common.biz.domain.ProjectTreeBuild;
|
||||
import com.bonus.common.biz.domain.ProjectTreeNode;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo;
|
||||
import com.bonus.material.clz.domain.vo.sltAgreementInfo.MaterialSltInfoVo;
|
||||
import com.bonus.material.clz.mapper.ClzSltAgreementInfoMapper;
|
||||
import com.bonus.material.clz.service.ClzSltAgreementInfoService;
|
||||
import com.bonus.material.settlement.domain.SltAgreementReduce;
|
||||
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -103,6 +106,64 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
|
|||
return sltInfoVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工程下拉框
|
||||
*
|
||||
* @param bmProject 工程下拉框
|
||||
* @return 工程下拉框
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getProjectListByUnitIds(BmProject bmProject) {
|
||||
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||
List<ProjectTreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
if (bmProject.getUnitIds()!=null) {
|
||||
Map<Integer,Integer> map= new HashMap<>();
|
||||
for (int i = 0; i < bmProject.getUnitIds().length; i++) {
|
||||
int id = bmProject.getUnitIds()[i];
|
||||
Integer[] projectIds= clzSltAgreementInfoMapper.getProjectListByUnitIds(bmProject.getUnitIds()[i]);
|
||||
Map<Integer,Integer> mapTemp = new HashMap<>();
|
||||
for (int projectId : projectIds) {
|
||||
mapTemp.put(projectId, 1);
|
||||
}
|
||||
mapTemp.forEach((k,v) -> {
|
||||
if (map.containsKey(k)) {
|
||||
map.put(k, map.get(k) + v);
|
||||
} else {
|
||||
map.put(k, v);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!map.isEmpty()) {
|
||||
List<Integer> keys = new ArrayList<>();
|
||||
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
||||
if (entry.getValue() == bmProject.getUnitIds().length) {
|
||||
keys.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
for (Integer key : keys) {
|
||||
List<ProjectTreeNode> listTemp = clzSltAgreementInfoMapper.getProjectList(key);
|
||||
for (ProjectTreeNode node : listTemp) {
|
||||
if (!list.contains(node)) {
|
||||
list.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e+"工程下拉树查询失败");
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交结算清单
|
||||
* @param sltInfoVo
|
||||
|
|
|
|||
|
|
@ -50,8 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where agreement_id = #{agreementId}
|
||||
</update>
|
||||
|
||||
<select id="getSltAgreementInfo4Project"
|
||||
resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||
<select id="getSltAgreementInfo4Project" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||
SELECT bai.agreement_id as agreementId, bai.agreement_code as agreementCode,
|
||||
bui.unit_id as unitId,bui.unit_name as unitName, bp.pro_id as projectId , bp.pro_name as projectName,
|
||||
saa.remark,bai.protocol,saa.cost as costs,
|
||||
|
|
@ -115,8 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where sai.agreement_id = #{agreementId}
|
||||
</select>
|
||||
|
||||
<select id="getLoseList"
|
||||
resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||
<select id="getLoseList" resultType="com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo">
|
||||
select sai.id,
|
||||
sai.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
|
|
@ -173,4 +171,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from clz_slt_agreement_apply saa
|
||||
where saa.agreement_id = #{agreementId}
|
||||
</select>
|
||||
|
||||
<!-- 根据往来单位id关联协议查询工程 -->
|
||||
<select id="getProjectListByUnitIds" resultType="int">
|
||||
SELECT
|
||||
bmp.pro_id AS id
|
||||
FROM
|
||||
bm_project bmp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
|
||||
LEFT JOIN clz_bm_agreement_info bai ON bai.project_id = bmp.pro_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id AND bu.del_flag = '0'
|
||||
WHERE
|
||||
sd.del_flag = '0' AND sd.`status` = '0' AND bmp.del_flag = '0'
|
||||
<if test="unitId != null">
|
||||
AND bu.unit_id = #{unitId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据往来单位id关联协议查询工程 -->
|
||||
<select id="getProjectList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
bmp.pro_id AS id,
|
||||
bmp.pro_name AS name,
|
||||
concat( 'gs', bmp.imp_unit ) AS parentId,
|
||||
2 AS level
|
||||
FROM
|
||||
bm_project bmp
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bmp.imp_unit
|
||||
LEFT JOIN clz_bm_agreement_info bai ON bai.project_id = bmp.pro_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id AND bu.del_flag = '0'
|
||||
WHERE
|
||||
sd.del_flag = '0'
|
||||
AND sd.`status` = '0'
|
||||
AND bmp.del_flag = '0'
|
||||
<if test="projectId != null">
|
||||
AND bmp.pro_id = #{projectId}
|
||||
</if>
|
||||
UNION
|
||||
SELECT DISTINCT
|
||||
concat( 'gs', sd.dept_id ) AS id,
|
||||
sd.dept_name AS proName,
|
||||
'0' AS parentId,
|
||||
1 AS level
|
||||
FROM
|
||||
sys_dept sd
|
||||
LEFT JOIN bm_project bmp ON sd.dept_id = bmp.imp_unit
|
||||
LEFT JOIN clz_bm_agreement_info bai ON bai.project_id = bmp.pro_id AND bai.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
|
||||
WHERE
|
||||
bmp.pro_id IS NOT NULL
|
||||
AND sd.del_flag = '0'
|
||||
AND sd.`status` = '0'
|
||||
AND bmp.del_flag = '0'
|
||||
<if test="projectId != null">
|
||||
AND bmp.pro_id = #{projectId}
|
||||
</if>
|
||||
) a
|
||||
ORDER BY
|
||||
level
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue