Merge remote-tracking branch 'origin/master'

# Conflicts:
#	bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml
This commit is contained in:
hongchao 2025-07-30 17:45:49 +08:00
commit 3be946db4c
14 changed files with 543 additions and 127 deletions

View File

@ -82,5 +82,17 @@ public interface BmAgreementInfoMapper
BmAgreementInfo queryByTeamIdAndProjectIdCl(BmAgreementInfo bmAgreementInfo);
/**
* 新增材料站协议信息
* @param bmAgreementInfo
* @return
*/
int insertBmAgreementInfoClz(BmAgreementInfo bmAgreementInfo);
/**
* 查询材料站协议列表
* @param nowDate
* @return
*/
int selectNumByMonthClz(Date nowDate);
}

View File

@ -3,9 +3,11 @@ 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;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.settlement.domain.SltAgreementReduce;
import com.bonus.material.settlement.domain.SltAgreementRelation;
import com.bonus.material.task.domain.TmTask;
@ -50,6 +52,18 @@ public class ClzSltAgreementInfoController extends BaseController {
return getDataTable(list);
}
@ApiOperation(value = "工程下拉选根据材料站班组查询")
@PostMapping("getProjectListByUnitIds")
public AjaxResult getProjectListByUnitIds(@RequestBody BmProject bmProject) {
return clzSltAgreementInfoService.getProjectListByUnitIds(bmProject);
}
@ApiOperation(value = "往来单位id和标段工程id获取协议信息")
@PostMapping("getAgreementInfoById")
public AjaxResult getAgreementInfoById(@RequestBody SelectDto dto) {
return clzSltAgreementInfoService.getAgreementInfoById(dto);
}
@ApiOperation(value = "根据协议获取结算清单")
@PostMapping("/getSltInfo")
public AjaxResult getSltInfo(@RequestBody List<MaterialSltAgreementInfo> list) {
@ -65,7 +79,7 @@ public class ClzSltAgreementInfoController extends BaseController {
dataList.add(vo);
agreementId = info.getAgreementId();
}
bean = mergerData(bean, dataList,unitNames,projectNames);
bean = clzSltAgreementInfoService.mergerData(bean, dataList,unitNames,projectNames);
// 根据协议id获取申请时间
TmTask tmTask = taskMapper.selectTaskByIdByCl(agreementId);
if (tmTask != null) {
@ -74,60 +88,6 @@ public class ClzSltAgreementInfoController extends BaseController {
return AjaxResult.success(bean);
}
public MaterialSltInfoVo mergerData(MaterialSltInfoVo vo,List<MaterialSltInfoVo> list,List<String> unitNames,List<String> projectNames){
vo.setUnitName(handleData(unitNames));
vo.setProjectName(handleData(projectNames));
BigDecimal leaseCost = BigDecimal.valueOf(0.00);
BigDecimal repairCost = BigDecimal.valueOf(0.00);
BigDecimal scrapCost = BigDecimal.valueOf(0.00);
BigDecimal loseCost = BigDecimal.valueOf(0.00);
BigDecimal reducCost = BigDecimal.valueOf(0.00);
//租赁费用列表
List<MaterialSltAgreementInfo> leaseList = new ArrayList<>();
//维修费用列表
List<MaterialSltAgreementInfo> repairList = new ArrayList<>();
//报废费用列表
List<MaterialSltAgreementInfo> scrapList = new ArrayList<>();
//丢失费用列表
List<MaterialSltAgreementInfo> loseList = new ArrayList<>();
//减免费用列表
List<SltAgreementReduce> reductionList = new ArrayList<>();
List<SltAgreementRelation> relations = new ArrayList<>();
for (MaterialSltInfoVo infoVo : list) {
leaseCost = leaseCost.add(infoVo.getLeaseCost());
repairCost = repairCost.add(infoVo.getRepairCost());
scrapCost = scrapCost.add(infoVo.getScrapCost());
loseCost = loseCost.add(infoVo.getLoseCost());
reducCost = reducCost.add(infoVo.getReductionCost());
leaseList.addAll(infoVo.getLeaseList());
repairList.addAll(infoVo.getRepairList());
scrapList.addAll(infoVo.getScrapList());
loseList.addAll(infoVo.getLoseList());
reductionList.addAll(infoVo.getReductionList());
relations.addAll(infoVo.getRelations());
}
vo.setLeaseList(leaseList);
vo.setRepairList(repairList);
vo.setScrapList(scrapList);
vo.setLoseList(loseList);
vo.setReductionList(reductionList);
vo.setLeaseCost(leaseCost);
vo.setRepairCost(repairCost);
vo.setScrapCost(scrapCost);
vo.setLoseCost(loseCost);
vo.setReductionCost(reducCost);
vo.setRelations(relations);
return vo;
}
public String handleData(List<String> list){
StringBuilder sb = new StringBuilder();
Set<String> set = new HashSet<>(list);
for (String str : set) {
sb.append(str).append("");
}
return StringUtils.removeEnd(sb.toString(), "");
}
/**
* 提交结算清单

View File

@ -1,7 +1,9 @@
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.common.domain.vo.AgreementVo;
import com.bonus.material.settlement.domain.SltAgreementReduce;
import org.apache.ibatis.annotations.Param;
@ -20,6 +22,13 @@ public interface ClzSltAgreementInfoMapper {
*/
List<MaterialSltAgreementInfo> getSltAgreementInfo4Project(MaterialSltAgreementInfo bean);
Integer[] getProjectListByUnitIds(int unitId);
List<ProjectTreeNode> getProjectList(int projectId);
List<AgreementVo> getAgreementInfoById(@Param("unitIds") List<Integer> unitIds, @Param("projectId") int projectId);
/**
* 获取租赁列表
* @param info

View File

@ -1,7 +1,10 @@
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;
import com.bonus.material.common.domain.dto.SelectDto;
import java.util.List;
@ -25,6 +28,21 @@ public interface ClzSltAgreementInfoService {
*/
MaterialSltInfoVo getSltInfo(MaterialSltAgreementInfo info);
MaterialSltInfoVo mergerData(MaterialSltInfoVo vo, List<MaterialSltInfoVo> list, List<String> unitNames, List<String> projectNames);
String handleData(List<String> list);
/**
* 工程下拉框
*
* @param bmProject 工程下拉框
* @return 工程下拉框
*/
AjaxResult getProjectListByUnitIds(BmProject bmProject);
AjaxResult getAgreementInfoById(SelectDto dto);
/**
* 提交结算清单
* @param sltInfoVo

View File

@ -1,21 +1,28 @@
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.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.settlement.domain.SltAgreementReduce;
import com.bonus.material.settlement.domain.SltAgreementRelation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -30,8 +37,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
/**
* 根据条件获取协议结算列表
* @param bean
* @return
* @param bean 查询条件
*/
@Override
public List<MaterialSltAgreementInfo> getSltAgreementInfo4Project(MaterialSltAgreementInfo bean) {
@ -73,16 +79,6 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
leaseCost = leaseCost.add(lease.getCosts());
}
}
/*for (MaterialSltAgreementInfo repair : repairList) {
if(repair.getCosts()!=null && (repair.getPartType().equals("收费"))){
repairCost = repairCost.add(repair.getCosts());
}
}
for (MaterialSltAgreementInfo scrap : scrapList) {
if(scrap.getCosts()!=null && (scrap.getPartType().equals("收费"))){
scrapCost = scrapCost.add(scrap.getCosts());
}
}*/
for (MaterialSltAgreementInfo lose : loseList) {
if(lose.getCosts()!=null){
loseCost = loseCost.add(lose.getCosts());
@ -103,6 +99,137 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
return sltInfoVo;
}
@Override
public MaterialSltInfoVo mergerData(MaterialSltInfoVo vo, List<MaterialSltInfoVo> list, List<String> unitNames, List<String> projectNames) {
vo.setUnitName(handleData(unitNames));
vo.setProjectName(handleData(projectNames));
BigDecimal leaseCost = BigDecimal.valueOf(0.00);
BigDecimal repairCost = BigDecimal.valueOf(0.00);
BigDecimal scrapCost = BigDecimal.valueOf(0.00);
BigDecimal loseCost = BigDecimal.valueOf(0.00);
BigDecimal reducCost = BigDecimal.valueOf(0.00);
//租赁费用列表
List<MaterialSltAgreementInfo> leaseList = new ArrayList<>();
//维修费用列表
List<MaterialSltAgreementInfo> repairList = new ArrayList<>();
//报废费用列表
List<MaterialSltAgreementInfo> scrapList = new ArrayList<>();
//丢失费用列表
List<MaterialSltAgreementInfo> loseList = new ArrayList<>();
//减免费用列表
List<SltAgreementReduce> reductionList = new ArrayList<>();
List<SltAgreementRelation> relations = new ArrayList<>();
for (MaterialSltInfoVo infoVo : list) {
leaseCost = leaseCost.add(infoVo.getLeaseCost());
repairCost = repairCost.add(infoVo.getRepairCost());
scrapCost = scrapCost.add(infoVo.getScrapCost());
loseCost = loseCost.add(infoVo.getLoseCost());
reducCost = reducCost.add(infoVo.getReductionCost());
leaseList.addAll(infoVo.getLeaseList());
repairList.addAll(infoVo.getRepairList());
scrapList.addAll(infoVo.getScrapList());
loseList.addAll(infoVo.getLoseList());
reductionList.addAll(infoVo.getReductionList());
relations.addAll(infoVo.getRelations());
}
vo.setLeaseList(leaseList);
vo.setRepairList(repairList);
vo.setScrapList(scrapList);
vo.setLoseList(loseList);
vo.setReductionList(reductionList);
vo.setLeaseCost(leaseCost);
vo.setRepairCost(repairCost);
vo.setScrapCost(scrapCost);
vo.setLoseCost(loseCost);
vo.setReductionCost(reducCost);
vo.setRelations(relations);
return vo;
}
@Override
public String handleData(List<String> list) {
StringBuilder sb = new StringBuilder();
Set<String> set = new HashSet<>(list);
for (String str : set) {
sb.append(str).append("");
}
return StringUtils.removeEnd(sb.toString(), "");
}
/**
* 工程下拉框
*
* @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);
}
@Override
public AjaxResult getAgreementInfoById(SelectDto dto) {
List<AgreementVo> vo;
try {
List<AgreementVo> list = clzSltAgreementInfoMapper.getAgreementInfoById(dto.getUnitIds(), Integer.parseInt(dto.getProjectId()));
if (CollectionUtils.isNotEmpty(list)) {
vo = list;
} else {
return AjaxResult.error("未找到匹配的协议信息");
}
} catch (Exception e) {
return AjaxResult.error(e+"协议查询失败");
}
return AjaxResult.success(vo);
}
/**
* 提交结算清单
* @param sltInfoVo
@ -111,7 +238,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
@Override
public int submitCosts(MaterialSltInfoVo sltInfoVo) {
try {
if(sltInfoVo.getAgreementIds()!=null) {
if (sltInfoVo.getAgreementIds() != null) {
for (Long agreementId : sltInfoVo.getAgreementIds()) {
Long id = null;
@ -180,7 +307,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
throw new ServiceException("bm_agreement_info修改失败");
}*/
}
if (sltInfoVo.getLeaseList().size() > 0) {
if (!sltInfoVo.getLeaseList().isEmpty()) {
List<MaterialSltAgreementInfo> filteredLeaseList = sltInfoVo.getLeaseList().stream()
.filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId()))
.collect(Collectors.toList());
@ -204,7 +331,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
clzSltAgreementInfoMapper.insertSltAgreementDetailScrap(filteredScrapList, id);
}
}*/
if (sltInfoVo.getLoseList().size() > 0) {
if (!sltInfoVo.getLoseList().isEmpty()) {
List<MaterialSltAgreementInfo> filteredLoseList = sltInfoVo.getLoseList().stream()
.filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId()))
.collect(Collectors.toList());
@ -222,23 +349,22 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
/**
* 获取结算关系列表
* @param leaseList
* @param repairList
* @param scrapList
* @param loseList
* @param sltInfo
* @return
* @param leaseList 领料数据
* @param repairList 维修数据
* @param scrapList 报废数据
* @param loseList 丢失数据
* @param sltInfo 结算信息
* @return 协议费用列表
*/
private List<SltAgreementRelation> getRelations(List<MaterialSltAgreementInfo> leaseList, List<MaterialSltAgreementInfo> repairList, List<MaterialSltAgreementInfo> scrapList, List<MaterialSltAgreementInfo> loseList, MaterialSltAgreementInfo sltInfo) {
List<SltAgreementRelation> relations = new ArrayList<>();
// for (SltAgreementInfo info : list) {
SltAgreementRelation relation = new SltAgreementRelation();
BigDecimal loseCost = BigDecimal.ZERO;
BigDecimal leaseCost = BigDecimal.ZERO;
BigDecimal scrapCost = BigDecimal.ZERO;
BigDecimal repairCost = BigDecimal.ZERO;
for (MaterialSltAgreementInfo lease : leaseList) {
if (lease.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
if (lease.getAgreementId().equals(sltInfo.getAgreementId())) {
relation.setAgreementId(String.valueOf(lease.getAgreementId()));
relation.setProjectName(lease.getProjectName());
relation.setUnitName(lease.getUnitName());
@ -248,19 +374,19 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
}
}
for (MaterialSltAgreementInfo repair : repairList) {
if (repair.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
if (repair.getAgreementId().equals(sltInfo.getAgreementId())) {
BigDecimal cost = repair.getCosts();
repairCost = repairCost.add(cost);
}
}
for (MaterialSltAgreementInfo scrap : scrapList) {
if (scrap.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
if (scrap.getAgreementId().equals(sltInfo.getAgreementId())) {
BigDecimal cost = scrap.getCosts();
scrapCost = scrapCost.add(cost);
}
}
for (MaterialSltAgreementInfo lose : loseList) {
if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
if (lose.getAgreementId().equals(sltInfo.getAgreementId())) {
//TODO 上面已经set过值这里为什么还要set值
relation.setAgreementId(String.valueOf(lose.getAgreementId()));
relation.setProjectName(lose.getProjectName());
@ -275,14 +401,12 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
relation.setScrapCost(scrapCost);
relation.setLoseCost(loseCost);
relations.add(relation);
// }
return relations;
}
/**
* 获取减免费用列表
* @param info
* @return
* @param info 信息表
*/
private List<SltAgreementReduce> getReductionList(MaterialSltAgreementInfo info) {
SltAgreementReduce bean =new SltAgreementReduce();
@ -292,20 +416,17 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
/**
* 获取丢失费用列表
* @param info
* @return
* @param info 信息表
*/
private List<MaterialSltAgreementInfo> getLoseList(MaterialSltAgreementInfo info) {
List<MaterialSltAgreementInfo> loseList = new ArrayList<>();
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLoseList(info);
loseList.addAll(oneOfList);
List<MaterialSltAgreementInfo> loseList = new ArrayList<>(oneOfList);
for (MaterialSltAgreementInfo bean : loseList) {
if (null == bean.getBuyPrice()) {
if (Objects.isNull(bean.getBuyPrice())) {
bean.setBuyPrice(BigDecimal.valueOf(0.00));
}
if (null == bean.getNum()) {
if (Objects.isNull(bean.getNum())) {
bean.setNum(BigDecimal.valueOf(0L));
}
BigDecimal buyPrice = bean.getBuyPrice();
@ -320,31 +441,28 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
/**
* 获取租赁费用列表
* @param info
* @return
* @param info 获取租赁费用列表参数
*/
private List<MaterialSltAgreementInfo> getLeaseList(MaterialSltAgreementInfo info) {
List<MaterialSltAgreementInfo> leaseList = new ArrayList<>();
List<MaterialSltAgreementInfo> oneOfList = clzSltAgreementInfoMapper.getLeaseList(info);
leaseList.addAll(oneOfList);
List<MaterialSltAgreementInfo> leaseList = new ArrayList<>(oneOfList);
for (MaterialSltAgreementInfo bean : leaseList) {
if (null == bean.getLeasePrice()) {
bean.setLeasePrice(BigDecimal.valueOf(0.00));
}else{
bean.setLeasePrice(bean.getLeasePrice().setScale(2, BigDecimal.ROUND_HALF_UP));
bean.setLeasePrice(bean.getLeasePrice().setScale(2, RoundingMode.HALF_UP));
}
if (null == bean.getNum()) {
if (Objects.isNull(bean.getNum())) {
bean.setNum(BigDecimal.valueOf(0L));
}
if (null == bean.getLeaseDays()) {
if (Objects.isNull(bean.getLeaseDays())) {
bean.setLeaseDay(0L);
}
BigDecimal leasePrice = bean.getLeasePrice();
BigDecimal num = bean.getNum();
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(2, RoundingMode.HALF_UP);
bean.setCosts(costs);
}
return leaseList;

View File

@ -992,7 +992,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String result = format.replace("-", "");
int num = bmAgreementInfoMapper.selectNumByMonth(nowDate);
int num = bmAgreementInfoMapper.selectNumByMonthClz(nowDate);
return MaterialConstants.AGREEMENT_PREFIX + result + String.format("-%03d", num + 1);
}

View File

@ -191,7 +191,7 @@ public interface SelectMapper {
* @param bean
* @return
*/
List<SelectVo> getTeamList(ProAuthorizeInfo bean);
List<ProjectTreeNode> getTeamList(ProAuthorizeInfo bean);
/**
* 获取工程下拉选
@ -262,4 +262,25 @@ public interface SelectMapper {
* @return
*/
List<AgreementVo> getAgreementInfoByIdBack(SelectDto dto);
/**
* 获取无需授权的项目部和后勤单位
* @param bmUnit
* @return
*/
List<ProjectTreeNode> getUnitListXm(BmUnit bmUnit);
/**
* 获取项目部项目
* @param bean
* @return
*/
List<ProjectTreeNode> getUnitListPro(ProAuthorizeInfo bean);
/**
* 获取部门项目
* @param bmUnit
* @return
*/
BmUnit selectUnitByLeaseId(BmUnit bmUnit);
}

View File

@ -209,13 +209,29 @@ public class SelectServiceImpl implements SelectService {
@Override
public AjaxResult getTeamList(ProAuthorizeInfo bean) {
List<ProjectTreeNode> groupList = new ArrayList<>();
List<ProjectTreeNode> list;
try {
// 班组固定查询typeId为1731
return AjaxResult.success(mapper.getTeamList(bean));
list = mapper.getUnitListPro(bean);
list = list.stream()
.filter(Objects::nonNull)
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
// 创建树形结构数据集合作为参数
ProjectTreeBuild treeBuild = new ProjectTreeBuild(list);
// 原查询结果转换树形结构
groupList = treeBuild.buildTree();
// 获取已授权班组进行数据拼接
List<ProjectTreeNode> newList = mapper.getTeamList(bean);
if (CollectionUtils.isNotEmpty(newList)) {
groupList.addAll(newList);
}
}
} catch (Exception e) {
log.error("班组-查询失败", e);
return AjaxResult.success(new ArrayList<>());
log.error("单位类型树-查询失败", e);
}
return AjaxResult.success(groupList);
}
/**
@ -267,7 +283,18 @@ public class SelectServiceImpl implements SelectService {
List<ProjectTreeNode> groupList = new ArrayList<>();
List<ProjectTreeNode> list;
try {
list = mapper.getUnitList(bmUnit);
list = mapper.getUnitListXm(bmUnit);
// 根据leaseId查询授权单位
BmUnit info = mapper.selectUnitByLeaseId(bmUnit);
if (info != null && info.getUnitId() != null) {
// 根据单位id查询授权单位树
bmUnit.setUnitId(info.getUnitId());
List<ProjectTreeNode> unitList = mapper.getUnitList(bmUnit);
if (CollectionUtils.isNotEmpty(unitList)) {
list.addAll(unitList);
}
}
list = list.stream()
.filter(Objects::nonNull)
.filter(unit -> unit.getId() != null && unit.getParentId() != null)

View File

@ -129,6 +129,7 @@ public class SltAgreementInfoController extends BaseController {
}
return AjaxResult.success(bean);
}
public SltInfoVo mergerData(SltInfoVo vo,List<SltInfoVo> list,List<String> unitNames,List<String> projectNames){
vo.setUnitName(handleData(unitNames));
vo.setProjectName(handleData(projectNames));

View File

@ -194,4 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
unit_id = #{unitId}
and project_id = #{projectId}
</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>

View File

@ -50,14 +50,13 @@ 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,
case when (saa.id is null or saa.status = '0') then '0' when saa.status = '1' then '1' when saa.status = '2' then '2' when saa.status = '3' then '3' end as sltStatus
FROM clz_slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN clz_bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
LEFT JOIN clz_slt_agreement_apply saa on saa.agreement_id = bai.agreement_id
@ -107,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
DATE(sai.end_time) as endTime,
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
from clz_slt_agreement_info sai
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
LEFT JOIN clz_bm_agreement_info bai on sai.agreement_id = bai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
left join ma_type mt on sai.type_id = mt.type_id
@ -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,82 @@ 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>
<select id="getAgreementInfoById" resultType="com.bonus.material.common.domain.vo.AgreementVo">
SELECT
agreement_id AS agreementId,
agreement_code AS agreementCode,
is_slt AS isSlt
FROM
clz_bm_agreement_info
WHERE
unit_id IN
<foreach item="item" index="index" collection="unitIds" open="(" separator="," close=")">
#{item}
</foreach>
AND project_id = #{projectId} AND status = '1'
</select>
</mapper>

View File

@ -89,10 +89,8 @@
ws_ma_info
<where>
<if test="maCode != null and maCode != ''">
and ma_code like concat('%', #{maCode}, '%')
</if>
<if test="qrCode != null and qrCode != ''">
and qr_code = #{qrCode}
and (ma_code like concat('%', #{maCode}, '%')
or qr_code = #{maCode})
</if>
</where>
LIMIT 10
@ -115,10 +113,8 @@
LEFT JOIN ma_type mt1 ON mt1.type_id = mt.parent_id
<where>
<if test="maCode != null and maCode != ''">
and mm.ma_code like concat('%', #{maCode}, '%')
</if>
<if test="qrCode != null and qrCode != ''">
and qr_code = #{qrCode}
and (mm.ma_code like concat('%', #{maCode}, '%')
or mm.qr_code = #{maCode})
</if>
</where>
LIMIT 10

View File

@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">
AND bu.dept_id = #{deptId}
</if>
<if test="unitId != null">
AND bu.unit_id = #{unitId}
</if>
UNION
@ -59,6 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">
AND bu.dept_id = #{deptId}
</if>
<if test="unitId != null">
AND bu.unit_id = #{unitId}
</if>
UNION
SELECT
@ -84,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">
AND bu.dept_id = #{deptId}
</if>
<if test="unitId != null">
AND bu.unit_id = #{unitId}
</if>
) ff
ORDER BY
LEVEL
@ -463,7 +472,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bm_unit
WHERE
del_flag = '0'
and type_id = 1731
and type_id = 1731
</select>
<select id="getAgreementInfoBy" resultType="com.bonus.material.common.domain.vo.AgreementVo">
@ -585,6 +594,171 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM clz_bm_agreement_info
WHERE unit_id = #{unitId} AND project_id = #{projectId} AND status = '1'
</select>
<select id="getUnitListXm" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
/*根据标段工程id查询无需授权的项目部和后勤*/
SELECT
*
FROM
(
SELECT
CONCAT( 'dw', sd.dept_id ) AS id,
sd.dept_name AS NAME,
0 AS parentId,
1 AS LEVEL,
null AS typeKey
FROM
sys_dept sd
LEFT JOIN bm_unit bu ON sd.dept_id = bu.dept_id
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
WHERE
bu.del_flag = '0'
AND sd.del_flag = '0'
AND sd.`status` = '0'
AND (bu.type_id = 36 or bu.type_id = 1685)
<if test="projectId != null">
AND bp.pro_id = #{projectId}
</if>
<if test="deptId != null">
AND bu.dept_id = #{deptId}
</if>
UNION
SELECT DISTINCT
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS id,
sda.dict_label AS NAME,
CONCAT( 'dw', bu.dept_id ) AS parentId,
2 AS LEVEL,
sda.dict_value AS typeKey
FROM
bm_unit bu
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
AND sda.dict_type = 'bm_unit_type'
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
WHERE
bu.del_flag = '0'
AND sda.STATUS = '0'
AND (bu.type_id = 36 or bu.type_id = 1685)
<if test="projectId != null">
AND bp.pro_id = #{projectId}
</if>
<if test="deptId != null">
AND bu.dept_id = #{deptId}
</if>
UNION
SELECT
bu.unit_id AS id,
bu.unit_name AS NAME,
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS parentId,
3 AS LEVEL,
sda.dict_value AS typeKey
FROM
bm_unit bu
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
AND sda.dict_type = 'bm_unit_type'
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
WHERE
bu.del_flag = '0'
AND sda.STATUS = '0'
AND (bu.type_id = 36 or bu.type_id = 1685)
<if test="projectId != null">
AND bp.pro_id = #{projectId}
</if>
<if test="deptId != null">
AND bu.dept_id = #{deptId}
</if>
) ff
ORDER BY
LEVEL
</select>
<select id="getUnitListPro" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
/*根据标段工程id查询无需授权的项目部和后勤*/
SELECT
*
FROM
(
SELECT
CONCAT( 'dw', sd.dept_id ) AS id,
sd.dept_name AS NAME,
0 AS parentId,
1 AS LEVEL,
null AS typeKey
FROM
sys_dept sd
LEFT JOIN bm_unit bu ON sd.dept_id = bu.dept_id
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
WHERE
bu.del_flag = '0'
AND sd.del_flag = '0'
AND sd.`status` = '0'
AND bu.type_id not in (36, 1685)
UNION
SELECT DISTINCT
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS id,
sda.dict_label AS NAME,
CONCAT( 'dw', bu.dept_id ) AS parentId,
2 AS LEVEL,
sda.dict_value AS typeKey
FROM
bm_unit bu
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
AND sda.dict_type = 'bm_unit_type'
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
WHERE
bu.del_flag = '0'
AND sda.STATUS = '0'
AND bu.type_id not in (36, 1685)
UNION
SELECT
bu.unit_id AS id,
bu.unit_name AS NAME,
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS parentId,
3 AS LEVEL,
sda.dict_value AS typeKey
FROM
bm_unit bu
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
AND sda.dict_type = 'bm_unit_type'
LEFT JOIN bm_agreement_info bai ON bu.unit_id = bai.unit_id
AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
AND bp.del_flag = '0'
WHERE
bu.del_flag = '0'
AND sda.STATUS = '0'
AND bu.type_id not in (36, 1685)
) ff
ORDER BY
LEVEL
</select>
<select id="selectUnitByLeaseId" resultType="com.bonus.material.basic.domain.BmUnit">
SELECT id as id,
lease_id as leaseId,
team_id as unitId
FROM pro_authorize_info
WHERE lease_id = #{leaseId}
</select>
<select id="getBackDeviceTypeTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT mt.type_id AS id,
mt.type_name AS label,

View File

@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.repair.mapper.RepairMapper">
<insert id="addRecord">
insert into repair_apply_record (task_id,ma_id,type_id,repair_num,scrap_num,repair_type,create_by,create_time,repair_content,company_id,scrap_id,scrap_reason,scrap_type,supplier_id,part_num,part_price,part_type,part_name,repairer,file_ids,remark,part_id,remark)
values (#{taskId},#{maId},#{typeId},#{repairNum},#{scrapNum},#{repairType},#{createBy},now(),#{repairContent},#{companyId}, #{scrapId},#{scrapReason},#{scrapType},#{supplierId},#{partNum},#{partPrice},#{partType},#{partName},#{repairer},#{fileIds},#{remark},#{partId},#{remark});
insert into repair_apply_record (task_id,ma_id,type_id,repair_num,scrap_num,repair_type,create_by,create_time,repair_content,company_id,scrap_id,scrap_reason,scrap_type,supplier_id,part_num,part_price,part_type,part_name,repairer,file_ids,remark,part_id)
values (#{taskId},#{maId},#{typeId},#{repairNum},#{scrapNum},#{repairType},#{createBy},now(),#{repairContent},#{companyId}, #{scrapId},#{scrapReason},#{scrapType},#{supplierId},#{partNum},#{partPrice},#{partType},#{partName},#{repairer},#{fileIds},#{remark},#{partId});
</insert>
<insert id="addPart">