# Conflicts:
#	bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml
This commit is contained in:
hongchao 2025-10-10 12:11:18 +08:00
commit a0f3df9801
15 changed files with 511 additions and 184 deletions

View File

@ -88,7 +88,7 @@ public class BmQrcodeInfoController extends BaseController
*/
@ApiOperation(value = "新增二维码管理")
@PreventRepeatSubmit
@RequiresPermissions("basic:info:add")
//@RequiresPermissions("basic:info:add")
@SysLog(title = "二维码管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增二维码管理")
@PostMapping("/add")
public AjaxResult add(@RequestBody BmQrcodeInfo bmQrcodeInfo)

View File

@ -12,18 +12,14 @@ 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.SltAgreementApply;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.settlement.domain.vo.SltInfoVo;
import com.bonus.material.task.domain.TmTask;
import com.bonus.material.task.mapper.TmTaskMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "材料站结算申请接口")
@ -75,8 +71,8 @@ public class ClzSltAgreementInfoController extends BaseController {
}
@ApiOperation(value = "根据结算单号查询已提交的结算信息")
@PostMapping("/getSettledInfo")
public AjaxResult getSettledDetailsByApplyCode(@RequestBody MaterialSltAgreementInfo requestDto) {
@GetMapping("/getSettledInfo")
public AjaxResult getSettledDetailsByApplyCode(MaterialSltAgreementInfo requestDto) {
if (requestDto == null) {
throw new ServiceException("请求参数不能为空!");
}
@ -90,6 +86,19 @@ public class ClzSltAgreementInfoController extends BaseController {
return AjaxResult.success(resultList);
}
/**
* 进行结算审批
*/
@ApiOperation(value = "进行结算审批")
@PostMapping("/costExamine")
public AjaxResult costExamine(@RequestBody SltAgreementApply apply) {
try {
return clzSltAgreementInfoService.costExamine(apply);
} catch (Exception e) {
return error("系统错误, " + e.getMessage());
}
}
/**
* 提交结算清单

View File

@ -219,4 +219,7 @@ public class MaterialBackApplyInfo implements Serializable {
@ApiModelProperty(value = "是否电子签名 0 是1 否")
private Integer isElectronicSign;
@ApiModelProperty(value = "是否直转 0 否1 是")
private Integer isZz;
}

View File

@ -335,4 +335,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "领料类型0班组1项目部")
private String pickType;
@ApiModelProperty(value = "是否直转 0 否1 是")
private Integer isZz;
}

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.math.BigDecimal;
@ -30,7 +31,7 @@ public class MaterialRetainedTeamTotalVo {
private String teamLeaderIdCard;
@ApiModelProperty(value = "在用数量")
@Excel(name = "库存")
@Excel(name = "库存", cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
private BigDecimal usNum;
@ApiModelProperty(value = "关键字")

View File

@ -114,8 +114,12 @@ public class MaterialSltInfoVo {
private Long id; //申请id
@ApiModelProperty(value = "费用合计")
String cost;
@ApiModelProperty(value = "申请单号")
private String code;
@ApiModelProperty(value = "申请时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date applyTime;

View File

@ -4,6 +4,7 @@ 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.SltAgreementApply;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.settlement.domain.SltAgreementReduce;
import org.apache.ibatis.annotations.Param;
@ -16,6 +17,30 @@ import java.util.List;
*/
public interface ClzSltAgreementInfoMapper {
/**
* 进行结算审批
*
* @param sltAgreementApply 进行结算审批
* @return 结果
*/
int costExame(SltAgreementApply sltAgreementApply);
/**
* 根据结算单号查找协议ids
* @param applyCode 结算单号
* @return 协议集合
*/
List<Long> getSltAgreementIdsBySltApplyCode(String applyCode);
/**
* 更新协议结算状态
*/
int updateClzSltInfoByIds(@Param("agreementIds") List<Long> agreementIds);
/**
* 更新协议明细表状态
*/
int updateClzSltDetailsByIds(@Param("agreementIds") List<Long> agreementIds);
/**
* 查询结算审批列表

View File

@ -306,4 +306,11 @@ public interface MaterialMachineMapper {
* @return
*/
List<MaterialProvideNumInfo> batchQueryUseDemand(@Param("list") List<Map<String, Object>> queryParams);
/**
* 查询分包商领用数据
* @param bean
* @return
*/
List<MaterialRetainedEquipmentInfo> getSubInfoList(MaterialRetainedEquipmentInfo bean);
}

View File

@ -6,8 +6,8 @@ import com.bonus.material.clz.domain.ClzSltApplyDTO;
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 com.bonus.material.settlement.domain.SltAgreementApply;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.settlement.domain.vo.SltInfoVo;
import java.util.List;
@ -17,6 +17,11 @@ import java.util.List;
*/
public interface ClzSltAgreementInfoService {
/**
* 进行结算审批
*/
AjaxResult costExamine(SltAgreementApply sltAgreementApply);
/**
* 根据条件获取协议结算列表
*/

View File

@ -1,8 +1,7 @@
package com.bonus.material.clz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.IdUtil;
import com.bonus.common.biz.constant.GlobalConstants;
import com.bonus.common.biz.domain.ProjectTreeBuild;
import com.bonus.common.biz.domain.ProjectTreeNode;
@ -18,10 +17,10 @@ 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.SltAgreementApply;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import com.bonus.material.settlement.domain.SltAgreementReduce;
import com.bonus.material.settlement.domain.SltAgreementRelation;
import com.bonus.material.settlement.domain.vo.SltInfoVo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -40,9 +39,65 @@ import java.util.stream.Collectors;
@Service
public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoService {
// 结算审核通过
private static final String REVIEW_PASS = "2";
// 结算审核驳回
private static final String REVIEW_REJECT = "3";
@Resource
private ClzSltAgreementInfoMapper clzSltAgreementInfoMapper;
/**
* 进行结算审批
*
* @param sltAgreementApply
*/
@Override
public AjaxResult costExamine(SltAgreementApply sltAgreementApply) {
if (Objects.isNull(sltAgreementApply) || Objects.isNull(sltAgreementApply.getStatus())) {
return AjaxResult.error("结算信息为空,请刷新后重试!");
}
try {
sltAgreementApply.setAuditor(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
sltAgreementApply.setAuditTime(DateUtils.getNowDate());
sltAgreementApply.setUpdateTime(DateUtils.getNowDate());
if (sltAgreementApply.getCode() == null) {
return AjaxResult.error("缺少结算单号!");
}
List<Long> idsBySltApplyCode = clzSltAgreementInfoMapper.getSltAgreementIdsBySltApplyCode(sltAgreementApply.getCode());
if (Objects.equals(REVIEW_REJECT, sltAgreementApply.getStatus())) {
// 驳回更新slt_apply协议审批状态
int updateNum = clzSltAgreementInfoMapper.costExame(sltAgreementApply);
// 删除结算详情,后续删除
//clzSltAgreementInfoMapper.costDeleteDetail(sltAgreementApply);
if (updateNum != GlobalConstants.INT_1) {
return AjaxResult.error("结算审批失败");
} else {
return AjaxResult.success("驳回成功!");
}
} else if (Objects.equals(REVIEW_PASS, sltAgreementApply.getStatus())) {
// 通过更新slt_apply协议审批状态
int examNum = clzSltAgreementInfoMapper.costExame(sltAgreementApply);
if (examNum == GlobalConstants.INT_0) {
return AjaxResult.error("结算审批失败");
} else {
// 更新结算协议表及相关信息
clzSltAgreementInfoMapper.updateClzSltInfoByIds(idsBySltApplyCode);
clzSltAgreementInfoMapper.updateClzSltDetailsByIds(idsBySltApplyCode);
return AjaxResult.success();
}
} else {
return AjaxResult.error("审批错误,状态码错误");
}
} catch (Exception e) {
return AjaxResult.error();
}
}
/**
* 根据条件获取协议结算列表
* @param bean 查询条件
@ -147,53 +202,88 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
// 查询各项费用列表
List<MaterialSltAgreementInfo> sltedList = clzSltAgreementInfoMapper.getSltedList(info);
// 按照协议进行分组
if (CollectionUtils.isEmpty(sltedList)) {
throw new ServiceException("未查询到已结算信息!");
}
// 定义遍历集合
Map<Long, List<MaterialSltAgreementInfo>> materialSltInfoResultMap = sltedList.stream().collect(Collectors.groupingBy(MaterialSltAgreementInfo::getAgreementId));
// 定义返回对象
List<MaterialSltInfoVo> resultVoList = new ArrayList<>();
sltedList.forEach((item) -> {
MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;
BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
//租赁费用列表
List<MaterialSltAgreementInfo> leaseList = sltedList.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList());
//维修费用列表
List<MaterialSltAgreementInfo> repairList = sltedList.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList());
//报废费用列表
List<MaterialSltAgreementInfo> scrapList = sltedList.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList());
//丢失费用列表
List<MaterialSltAgreementInfo> loseList = sltedList.stream().filter(slt -> slt.getSltType() == 2).collect(Collectors.toList());
sltInfoVo.setLeaseList(leaseList);
sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList);
sltInfoVo.setLoseList(loseList);
sltInfoVo.setReductionList(Collections.emptyList());
for (MaterialSltAgreementInfo lease : leaseList) {
if(lease.getCosts()!=null){
leaseCost = leaseCost.add(lease.getCosts());
}
}
for (MaterialSltAgreementInfo lose : loseList) {
if(lose.getCosts()!=null){
loseCost = loseCost.add(lose.getCosts());
}
for (List<MaterialSltAgreementInfo> key : materialSltInfoResultMap.values()) {
if (CollectionUtils.isEmpty(key)) {
throw new ServiceException("已结算信息异常,请联系管理员!");
}
sltInfoVo.setLeaseCost(leaseCost);
sltInfoVo.setRepairCost(repairCost);
sltInfoVo.setScrapCost(scrapCost);
sltInfoVo.setLoseCost(loseCost);
sltInfoVo.setReductionCost(reducCost);
List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, info);
sltInfoVo.setRelations(relations);
key.forEach((item) -> {
MaterialSltInfoVo sltInfoVo = new MaterialSltInfoVo();
BigDecimal leaseCost = BigDecimal.ZERO, repairCost = BigDecimal.ZERO, scrapCost = BigDecimal.ZERO;
BigDecimal loseCost = BigDecimal.ZERO, reducCost = BigDecimal.ZERO;
resultVoList.add(sltInfoVo);
//租赁费用列表
List<MaterialSltAgreementInfo> leaseList = key.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList());
//维修费用列表
List<MaterialSltAgreementInfo> repairList = key.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList());
//报废费用列表
List<MaterialSltAgreementInfo> scrapList = key.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList());
//丢失费用列表
List<MaterialSltAgreementInfo> loseList = key.stream().filter(slt -> slt.getSltType() == 2).collect(Collectors.toList());
// 给外层的单位名称/工程名称赋值
extractInnerNameToOuter(resultVoList, sltInfoVo);
});
return resultVoList;
sltInfoVo.setLeaseList(leaseList);
sltInfoVo.setRepairList(repairList);
sltInfoVo.setScrapList(scrapList);
sltInfoVo.setLoseList(loseList);
sltInfoVo.setReductionList(Collections.emptyList());
for (MaterialSltAgreementInfo lease : leaseList) {
if (lease.getCosts() != null) {
leaseCost = leaseCost.add(lease.getCosts());
}
}
for (MaterialSltAgreementInfo lose : loseList) {
if (lose.getCosts() != null) {
loseCost = loseCost.add(lose.getCosts());
}
}
sltInfoVo.setLeaseCost(leaseCost);
sltInfoVo.setRepairCost(repairCost);
sltInfoVo.setScrapCost(scrapCost);
sltInfoVo.setLoseCost(loseCost);
sltInfoVo.setReductionCost(reducCost);
List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, info);
sltInfoVo.setRelations(relations);
resultVoList.add(sltInfoVo);
// 给外层的单位名称/工程名称赋值
extractInnerNameToOuter(resultVoList, sltInfoVo);
});
}
// 返回之前对集合做去重处理根据外层的单位名称去重,保留每个单位名称的第一个
Set<String> seen = new HashSet<>();
List<MaterialSltInfoVo> dedup = new ArrayList<>(resultVoList.size());
for (MaterialSltInfoVo it : resultVoList) {
if (it == null) continue;
String key = normalize(it.getUnitName());
// 若不希望把 null 当作一个有效键可加if (key == null) continue;
if (seen.add(key)) {
dedup.add(it); // 第一次见到该单位名 -> 保留
}
}
return dedup;
}
private static String normalize(String s) {
if (s == null) return null; // 若希望丢弃 null可直接返回 null 不参与去重键
return s.trim(); // 需要忽略大小写可用s.trim().toLowerCase(Locale.ROOT)
}
/**
@ -411,8 +501,10 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
public int submitCosts(MaterialSltInfoVo sltInfoVo) {
try {
if (sltInfoVo.getAgreementIds() != null && sltInfoVo.getAgreementIds().length > 0) {
// 生成uuid使其成为一个批次
String fastUUID = IdUtil.fastUUID();
for (Long agreementId : sltInfoVo.getAgreementIds()) {
Long id = null;
Long id;
sltInfoVo.setAgreementId(agreementId);
// 计算总成本
BigDecimal totalCost = BigDecimal.ZERO;
@ -449,6 +541,8 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
sltInfoVo.setUpdateTime(DateUtils.getNowDate());
sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
} else {
// 生成统一批次号
sltInfoVo.setCode(fastUUID);
sltInfoVo.setCreateTime(DateUtils.getNowDate());
sltInfoVo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
//新增
@ -461,6 +555,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
sltInfoVo.setUpdateTime(DateUtils.getNowDate());
}
// 插入结算明细表 -- 租赁
if (!sltInfoVo.getLeaseList().isEmpty()) {
List<MaterialSltAgreementInfo> filteredLeaseList = sltInfoVo.getLeaseList().stream()
.filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId()))
@ -469,6 +564,7 @@ public class ClzSltAgreementInfoServiceImpl implements ClzSltAgreementInfoServic
clzSltAgreementInfoMapper.insertSltAgreementDetailLease(filteredLeaseList, id);
}
}
// 插入结算明细表 -- 丢失
if (!sltInfoVo.getLoseList().isEmpty()) {
List<MaterialSltAgreementInfo> filteredLoseList = sltInfoVo.getLoseList().stream()
.filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId()))

View File

@ -168,13 +168,18 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 查询目前在用的设备信息
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getUsInfoList(bean);
// 查询目前还有库存的设备
// 查询目前还有库存的设备,仅查单位类型为项目部的
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
// 查询分包商领用数据不作为库存作为再用数据
List<MaterialRetainedEquipmentInfo> subList = materialMachineMapper.getSubInfoList(bean);
// 数据合并
if (!CollectionUtils.isEmpty(recordList)) {
usList.addAll(recordList);
}
if (!CollectionUtils.isEmpty(subList)) {
usList.addAll(subList);
}
if (!CollectionUtils.isEmpty(usList)) {
if (teamData != null) {
@ -305,9 +310,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
}
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getTeamUseNumList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
if (teamData == null) {
if (!CollectionUtils.isEmpty(list) && deptId != null) {
// 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
}
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
if (teamData != null) {
@ -315,9 +322,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
} /*else {
list = filterInfo(list, username);
}*/
}
}
if (CollectionUtils.isNotEmpty(list)) {
@ -415,16 +420,12 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
} /*else {
list = filterInfoTools(list, username);
}*/
}
}
// 根据用户名判断用户是否为班组长
if (CollectionUtils.isNotEmpty(list)) {
list1 = groupByThirdTypeId(list);
} /*else if (CollectionUtils.isNotEmpty(totalList)) {
list1 = groupByThirdTypeId(totalList);
}*/
}
return list1;
} catch (Exception e){
log.error("获取设备台账列表失败,参数:{}", bean, e);
@ -488,9 +489,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 查询clz_slt_agreement_info数据
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getTeamUseNumDetailsList(bean);
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(primaryList) && deptId != null) {
// 删除元素
primaryList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
if (teamData == null) {
if (!CollectionUtils.isEmpty(primaryList) && deptId != null) {
// 删除元素
primaryList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
}
if (CollectionUtils.isEmpty(primaryList)) {
return new MaterialRetainedEquipmentInfo();
@ -855,14 +858,8 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 分别获取useInfoList中以unitValue分组的usNum数量,展示出来
if (!CollectionUtils.isEmpty(useInfoList)) {
// 过滤掉不在未结算工程集合内的设备
Iterator<MaterialRetainedEquipmentInfo> iterator = useInfoList.iterator();
while (iterator.hasNext()) {
MaterialRetainedEquipmentInfo infos = iterator.next();
if (infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId())) {
// 如果 proId 不在未结算集合中则移除
iterator.remove();
}
}
// 如果 proId 不在未结算集合中则移除
useInfoList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
useCountNum = useInfoList.stream()
.filter(item -> "0".equals(item.getUnitValue()))
@ -880,40 +877,20 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
if (CollectionUtils.isNotEmpty(recordList)) {
// 过滤掉不在未结算工程集合内的设备
Iterator<MaterialRetainedEquipmentInfo> iterator = recordList.iterator();
while (iterator.hasNext()) {
MaterialRetainedEquipmentInfo infos = iterator.next();
if (infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId())) {
// 如果 proId 不在未结算集合中则移除
iterator.remove();
}
}
// 如果 proId 不在未结算集合中则移除
recordList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
inCountNum = recordList.stream()
.filter(item -> "0".equals(item.getUnitValue()) && !"32".equals(item.getUnitType()))
.filter(item -> "0".equals(item.getUnitValue()))
.map(MaterialRetainedEquipmentInfo::getAllNum)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);
inRopeNum = recordList.stream()
.filter(item -> "1".equals(item.getUnitValue()) && !"32".equals(item.getUnitType()) )
.filter(item -> "1".equals(item.getUnitValue()))
.map(MaterialRetainedEquipmentInfo::getAllNum)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);
useCountNumSub = recordList.stream()
.filter(item -> "0".equals(item.getUnitValue()) && "32".equals(item.getUnitType()))
.map(MaterialRetainedEquipmentInfo::getAllNum)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);
useRopeNumSub = recordList.stream()
.filter(item -> "1".equals(item.getUnitValue()) && "32".equals(item.getUnitType()))
.map(MaterialRetainedEquipmentInfo::getAllNum)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);
// 获取到recordList中externalId不为null且去重的总数转换为Integer类型
info.setProNum((int) recordList.stream()
.map(MaterialRetainedEquipmentInfo::getProName)
@ -923,18 +900,32 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
} else {
info.setProNum(0);
}
// 查询分包商领用数据不作为库存作为再用数据
List<MaterialRetainedEquipmentInfo> subList = materialMachineMapper.getSubInfoList(bean);
if (CollectionUtils.isNotEmpty(subList)) {
// 过滤掉不在未结算工程集合内的设备
// 如果 proId 不在未结算集合中则移除
subList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
useCountNumSub = subList.stream()
.filter(item -> "0".equals(item.getUnitValue()))
.map(MaterialRetainedEquipmentInfo::getAllNum)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);
useRopeNumSub = subList.stream()
.filter(item -> "1".equals(item.getUnitValue()))
.map(MaterialRetainedEquipmentInfo::getAllNum)
.reduce(BigDecimal::add)
.orElse(BigDecimal.ZERO);
}
// 查询目前在用的设备信息
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getUsInfoList(bean);
if (CollectionUtils.isNotEmpty(usList)) {
// 过滤掉不在未结算工程集合内的设备
Iterator<MaterialRetainedEquipmentInfo> iterator = usList.iterator();
while (iterator.hasNext()) {
MaterialRetainedEquipmentInfo infos = iterator.next();
if (infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId())) {
// 如果 proId 不在未结算集合中则移除
iterator.remove();
}
}
// 如果 proId 不在未结算集合中则移除
usList.removeIf(infos -> infos.getProId() == null || !unsettledProjectIds.contains(infos.getProId()));
// 获取usList中的班组id且去重的数量
info.setTeamNum((int) usList.stream()
@ -1148,7 +1139,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 部门查询赋值
extractedDept(bean);
}
return materialMachineMapper.getTeamList(bean);
MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo = new MaterialRetainedEquipmentInfo();
materialRetainedEquipmentInfo.setTeamName("站内库存");
List<MaterialRetainedEquipmentInfo> teamList = materialMachineMapper.getTeamList(bean);
teamList.add(0, materialRetainedEquipmentInfo);
return teamList;
}
/**
@ -1175,7 +1170,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 部门查询赋值
extractedDept(bean);
}
return materialMachineMapper.getSubUnitList(bean);
MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo = new MaterialRetainedEquipmentInfo();
materialRetainedEquipmentInfo.setSubUnitName("分包直领");
List<MaterialRetainedEquipmentInfo> list = materialMachineMapper.getSubUnitList(bean);
list.add(0, materialRetainedEquipmentInfo);
return list;
}
/**

View File

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into clz_slt_agreement_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="agreementId != null">agreement_id,</if>
<if test="agreementCode != null">code,</if>
<if test="code != null">`code`,</if>
<if test="createBy != null">creator,</if>
<if test="createTime != null">create_time,</if>
status,
@ -15,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="agreementId != null">#{agreementId},</if>
<if test="agreementCode != null">#{agreementCode},</if>
<if test="code != null">#{code,jdbcType=VARCHAR},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
1,
@ -52,42 +52,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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
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 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
clz_slt_agreement_info sai
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
where
bai.status = '1'
<if test="unitIds != null">
and bui.unit_id in
<foreach item="item" index="index" collection="unitIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="projectId != null and projectId != ''">
and bp.pro_id = #{projectId}
</if>
<choose>
<when test="sltStatus == '0'.toString()">
and saa.id is null
</when>
<when test="sltStatus == '1'.toString()">
and saa.status = '1'
</when>
<when test="sltStatus == '2'.toString()">
and saa.status = '2'
</when>
<when test="sltStatus == '3'.toString()">
and saa.status = '3'
</when>
</choose>
bai.status = '1'
<if test="unitIds != null">
and bui.unit_id in
<foreach item="item" index="index" collection="unitIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="projectId != null and projectId != ''">
and bp.pro_id = #{projectId}
</if>
<choose>
<when test="sltStatus == '0'.toString()">
and saa.id is null
</when>
<when test="sltStatus == '1'.toString()">
and saa.status = '1'
</when>
<when test="sltStatus == '2'.toString()">
and saa.status = '2'
</when>
<when test="sltStatus == '3'.toString()">
and saa.status = '3'
</when>
</choose>
GROUP BY sai.agreement_id
ORDER BY sai.create_time desc
</select>
@ -293,4 +293,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where
saa.`code` = #{sltApplyCode}
</select>
<select id="costExame" resultType="int">
update clz_slt_agreement_apply
<set>
<if test="status != null and status!=''">status = #{status},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="auditTime != null">audit_time = #{auditTime},</if>
<if test="auditor != null and auditor!=''">auditor = #{auditor},</if>
<if test="remark != null and remark!=''">remark = #{remark}</if>
</set>
where `code` = #{code,jdbcType=VARCHAR}
</select>
<select id="getSltAgreementIdsBySltApplyCode" resultType="java.lang.Long">
select agreement_id
from clz_slt_agreement_apply
where `code` = #{sltApplyCode}
</select>
<update id="updateClzSltInfoByIds">
update clz_bm_agreement_info
set is_slt = 1, update_time = now(), slt_time = now()
where agreement_id in
<foreach item="item" index="index" collection="agreementIds" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateClzSltDetailsByIds">
update clz_slt_agreement_info
set end_time = now(), update_time = now()
where id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>

View File

@ -228,6 +228,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.external_id AS externalId,
bp.imp_unit AS impUnit,
bt.bzz_idcard AS idCard,
bai.direct_id as directId,
CASE
WHEN bai.direct_id is null THEN
'0'
ELSE
'1'
END isZz,
CASE WHEN bai.back_sign_url IS NOT NULL
THEN 0
ELSE 1
@ -327,6 +334,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.print_status as printStatus,
bp.external_id AS externalId,
bp.imp_unit AS impUnit,
bai.direct_id as directId,
CASE
WHEN bai.direct_id is null THEN
'0'
ELSE
'1'
END isZz,
bu.bzz_idcard AS idCard
FROM
back_apply_info bai

View File

@ -88,6 +88,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.unit_id,
bai.project_id as projectId,
bt.link_man as relName,
lai.direct_id as directId,
CASE
WHEN lai.direct_id is null THEN
'0'
ELSE
'1'
END isZz,
CASE WHEN lai.lease_sign_url IS NOT NULL
THEN 0
ELSE 1
@ -538,6 +545,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.external_id AS externalId,
bu.bzz_idcard AS idCard,
bp.imp_unit AS impUnit,
lai.direct_id as directId,
CASE
WHEN lai.direct_id is null THEN
'0'
ELSE
'1'
END isZz,
lai.remark as remark,
CASE
WHEN MAX(IFNULL(lad.is_update, 0)) = 1 THEN 1
@ -1196,6 +1210,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.external_id AS externalId,
bu.bzz_idcard AS idCard,
bp.imp_unit AS impUnit,
lai.direct_id as directId,
CASE
WHEN lai.direct_id is null THEN
'0'
ELSE
'1'
END isZz,
lpd.remark as remark,
CASE
WHEN MAX(IFNULL(lpd.is_update, 0)) = 1 THEN 1

View File

@ -346,6 +346,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.status = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND sai.ma_id IS NOT NULL
<if test="typeId != null">
and mt2.type_id = #{typeId}
</if>
@ -1174,32 +1175,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getRetainTotalInfo" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter,
mt.unit_value AS unitValue
mt.type_id as typeId,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bu.unit_id as teamId,
bu.unit_name AS teamName,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
df.project_dept AS departName,
mt.unit_name AS unit,
sd.dept_name AS impUnitName,
CASE mt.manage_type WHEN 0 THEN '编码' ELSE '数量' END manageType,
mt.unit_value AS unitValue,
bz.ssfbdw AS subUnitName,
CASE mt.jiju_type WHEN 2 THEN '安全工器具' ELSE '施工机具' END jiJuType
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_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 ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_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
sai.`status` = '0'
AND sai.end_time IS NULL
@ -1207,22 +1217,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.unit_name is not null
AND bp.external_id is not NULL
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name like concat('%',#{impUnitName},'%')
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name like concat('%',#{proName},'%')
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center like concat('%',#{departName},'%')
AND bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
AND bu.unit_name like concat('%',#{teamName},'%')
AND bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name like concat('%',#{typeName},'%')
AND mt2.type_name LIKE CONCAT('%', #{typeName}, '%')
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name like concat('%',#{typeModelName},'%')
AND mt.type_name LIKE CONCAT('%', #{typeModelName}, '%')
</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
@ -1233,7 +1246,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="impUnit != null and impUnit != ''">
AND bp.imp_unit = #{impUnit}
</if>
GROUP BY mt.unit_value
<if test="jiJuType != null and jiJuType != ''">
AND mt.jiju_type = #{jiJuType}
</if>
GROUP BY
mt.type_id, bu.unit_name, bp.pro_name
</select>
<select id="getRetainStoreInfo" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
@ -1321,8 +1338,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'数量'
END manageType,
subquery1.teamName AS teamName,
subquery1.unitType as unitType,
IF( subquery1.unitType= 32,"机具分包领用",'/' )AS subUnitName,
'/' AS subUnitName,
mt.unit_value AS unitValue,
CASE mt.jiju_type
WHEN 2 THEN
@ -1349,8 +1365,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.bzz_idcard AS idCard,
df.project_dept AS proCenter,
sd.dept_name AS departName,
bu.type_id AS unitType,
if(bu.type_id=32,bu.unit_name,'站内库存' ) AS teamName
'站内库存' AS teamName
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -1369,6 +1384,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND bp.external_id IS NOT NULL
AND bu.type_id = 36
and sd.dept_id not in (342,345,347,348,101)
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name like concat('%',#{impUnitName},'%')
@ -1388,6 +1404,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="teamName != null and teamName != ''">
AND '站内库存' like concat('%',#{teamName},'%')
</if>
<if test="subUnitName != null and subUnitName != ''">
AND '站内库存' like concat('%',#{subUnitName},'%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
@ -1454,6 +1473,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="teamName != null and teamName != ''">
AND '站内库存' like concat('%',#{teamName},'%')
</if>
<if test="subUnitName != null and subUnitName != ''">
AND '站内库存' like concat('%',#{subUnitName},'%')
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name like concat('%',#{typeModelName},'%')
</if>
@ -2318,4 +2340,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lpd.project_id,
lpd.type_id
</select>
<select id="getSubInfoList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS allNum,
bp.pro_name as proName,
bp.pro_id as proId,
bp.external_id as externalId,
bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard,
df.project_dept AS departName,
sd.dept_name AS impUnitName,
bu.unit_name AS teamName,
'分包直领' AS subUnitName,
mt.unit_name AS unit,
mt.unit_value AS unitValue,
CASE mt.jiju_type
WHEN 2 THEN
'安全工器具'
ELSE
'施工机具'
END jiJuType
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN 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 data_center.dx_fb_son df ON bp.external_id = df.id
WHERE
sai.`status` = '0'
AND sai.is_slt = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND bp.external_id IS NOT NULL
AND bu.type_id = 32
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name like concat('%',#{impUnitName},'%')
</if>
<if test="proName != null and proName != ''">
AND bp.pro_name like concat('%',#{proName},'%')
</if>
<if test="departName != null and departName != ''">
AND bp.pro_center like concat('%',#{departName},'%')
</if>
<if test="typeName != null and typeName != ''">
AND mt2.type_name like concat('%',#{typeName},'%')
</if>
<if test="typeModelName != null and typeModelName != ''">
AND mt.type_name like concat('%',#{typeModelName},'%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="impUnit != null and impUnit != ''">
and bp.imp_unit = #{impUnit}
</if>
<if test="jiJuType != null and jiJuType != ''">
AND mt.jiju_type = #{jiJuType}
</if>
<if test="subUnitName != null and subUnitName != ''">
AND '分包直领' like concat('%',#{subUnitName},'%')
</if>
GROUP BY
mt.type_id,
bp.pro_id
</select>
</mapper>