diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrcodeInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrcodeInfoController.java index 2e39c878..927aa767 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrcodeInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/controller/BmQrcodeInfoController.java @@ -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) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java index c8c2593e..941917c8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/ClzSltAgreementInfoController.java @@ -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()); + } + } + /** * 提交结算清单 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java index 21080b60..9bb6d04d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyInfo.java @@ -219,4 +219,7 @@ public class MaterialBackApplyInfo implements Serializable { @ApiModelProperty(value = "是否电子签名 0 是,1 否") private Integer isElectronicSign; + @ApiModelProperty(value = "是否直转 0 否,1 是") + private Integer isZz; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java index 541a2f5c..8f6d2b33 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyInfo.java @@ -335,4 +335,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity { @ApiModelProperty(value = "领料类型:0:班组,1:项目部") private String pickType; + + @ApiModelProperty(value = "是否直转 0 否,1 是") + private Integer isZz; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedTeamTotalVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedTeamTotalVo.java index 19e4450d..09c4dbad 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedTeamTotalVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/MaterialRetainedTeamTotalVo.java @@ -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 = "关键字") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/sltAgreementInfo/MaterialSltInfoVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/sltAgreementInfo/MaterialSltInfoVo.java index d336c87b..285f2015 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/sltAgreementInfo/MaterialSltInfoVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/sltAgreementInfo/MaterialSltInfoVo.java @@ -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; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java index 403293bb..75790c31 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/ClzSltAgreementInfoMapper.java @@ -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 getSltAgreementIdsBySltApplyCode(String applyCode); + + /** + * 更新协议结算状态 + */ + int updateClzSltInfoByIds(@Param("agreementIds") List agreementIds); + + /** + * 更新协议明细表状态 + */ + int updateClzSltDetailsByIds(@Param("agreementIds") List agreementIds); /** * 查询结算审批列表 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java index 7f8a74db..8c883b4a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialMachineMapper.java @@ -306,4 +306,11 @@ public interface MaterialMachineMapper { * @return */ List batchQueryUseDemand(@Param("list") List> queryParams); + + /** + * 查询分包商领用数据 + * @param bean + * @return + */ + List getSubInfoList(MaterialRetainedEquipmentInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/ClzSltAgreementInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/ClzSltAgreementInfoService.java index 1c058501..563342a5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/ClzSltAgreementInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/ClzSltAgreementInfoService.java @@ -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); + /** * 根据条件获取协议结算列表 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java index c9ca0fdd..6ca74834 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzSltAgreementInfoServiceImpl.java @@ -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 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 sltedList = clzSltAgreementInfoMapper.getSltedList(info); - // 按照协议进行分组 + if (CollectionUtils.isEmpty(sltedList)) { + throw new ServiceException("未查询到已结算信息!"); + } + + // 定义遍历集合 + Map> materialSltInfoResultMap = sltedList.stream().collect(Collectors.groupingBy(MaterialSltAgreementInfo::getAgreementId)); + + // 定义返回对象 List 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 leaseList = sltedList.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList()); - //维修费用列表 - List repairList = sltedList.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList()); - //报废费用列表 - List scrapList = sltedList.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList()); - //丢失费用列表 - List 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 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 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 leaseList = key.stream().filter(slt -> slt.getSltType() == 1).collect(Collectors.toList()); + //维修费用列表 + List repairList = key.stream().filter(slt -> slt.getSltType() == 3).collect(Collectors.toList()); + //报废费用列表 + List scrapList = key.stream().filter(slt -> slt.getSltType() == 4).collect(Collectors.toList()); + //丢失费用列表 + List 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 relations = getRelations(leaseList, repairList, scrapList, loseList, info); + sltInfoVo.setRelations(relations); + + resultVoList.add(sltInfoVo); + + // 给外层的单位名称/工程名称赋值 + extractInnerNameToOuter(resultVoList, sltInfoVo); + + }); + } + + + // 返回之前对集合做去重处理,根据外层的单位名称去重,保留每个单位名称的第一个 + Set seen = new HashSet<>(); + List 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 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 filteredLoseList = sltInfoVo.getLoseList().stream() .filter(lease -> lease.getAgreementId().equals(sltInfoVo.getAgreementId())) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java index 518ba52a..9f4932e1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java @@ -168,13 +168,18 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { // 查询目前在用的设备信息 List usList = materialMachineMapper.getUsInfoList(bean); - // 查询目前还有库存的设备 + // 查询目前还有库存的设备,仅查单位类型为项目部的 List recordList = materialMachineMapper.getRetainInfoList(bean); + // 查询分包商领用数据,不作为库存,作为再用数据 + List 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 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 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 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 recordList = materialMachineMapper.getRetainInfoList(bean); if (CollectionUtils.isNotEmpty(recordList)) { // 过滤掉不在未结算工程集合内的设备 - Iterator 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 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 usList = materialMachineMapper.getUsInfoList(bean); if (CollectionUtils.isNotEmpty(usList)) { // 过滤掉不在未结算工程集合内的设备 - Iterator 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 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 list = materialMachineMapper.getSubUnitList(bean); + list.add(0, materialRetainedEquipmentInfo); + return list; } /** diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml index 6c0c80c6..cfce416d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/ClzAgreementInfoMapper.xml @@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into clz_slt_agreement_apply agreement_id, - code, + `code`, creator, create_time, status, @@ -15,7 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{agreementId}, - #{agreementCode}, + #{code,jdbcType=VARCHAR}, #{createBy}, #{createTime}, 1, @@ -52,42 +52,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -293,4 +293,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where saa.`code` = #{sltApplyCode} + + + + + + + update clz_bm_agreement_info + set is_slt = 1, update_time = now(), slt_time = now() + where agreement_id in + + #{item} + + + + + update clz_slt_agreement_info + set end_time = now(), update_time = now() + where id in + + #{item} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml index 6da252fa..801a465c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialBackInfoMapper.xml @@ -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 diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml index 55c7d4f3..0e0c4fdc 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml @@ -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 diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index 74db825e..d52d156a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -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 and mt2.type_id = #{typeId} @@ -1174,32 +1175,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + +