From a0f4d1e8d556223984c153204aa6157d7bf3b968 Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Tue, 12 Aug 2025 15:09:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(material):=20=E6=94=AF=E6=8C=81=E7=8F=AD?= =?UTF-8?q?=E7=BB=84=E9=A2=86=E6=96=99=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增字段和方法以支持班组领料 - 修改出库流程,增加对班组领料的处理逻辑 - 更新退料和结算相关功能,以适应班组领料 - 优化查询接口,支持按班组查询领料信息 --- .../bonus/common/biz/domain/TypeTreeNode.java | 3 ++ .../biz/domain/lease/LeaseOutDetails.java | 6 +++ .../material/back/domain/BackApplyInfo.java | 3 ++ .../basic/domain/BmAgreementInfo.java | 7 +++ .../basic/mapper/BmAgreementInfoMapper.java | 5 ++ .../domain/back/MaterialBackApplyDetails.java | 4 ++ .../MaterialBackApplyInfoServiceImpl.java | 8 ++- .../impl/MaterialLeaseInfoServiceImpl.java | 3 +- .../material/common/domain/dto/SelectDto.java | 2 + .../service/impl/SelectServiceImpl.java | 8 +++ .../lease/mapper/LeaseApplyInfoMapper.java | 28 +++++++++- .../impl/LeaseApplyInfoServiceImpl.java | 16 ++++++ .../impl/LeaseOutDetailsServiceImpl.java | 54 ++++++++++++++++--- .../service/impl/LeaseTaskServiceImpl.java | 2 +- .../impl/SltAgreementInfoServiceImpl.java | 1 - .../material/basic/BmAgreementInfoMapper.xml | 10 ++-- .../material/clz/MaterialBackInfoMapper.xml | 4 +- .../mapper/material/common/SelectMapper.xml | 34 ++++++++++-- .../material/lease/LeaseApplyInfoMapper.xml | 35 ++++++++++++ .../settlement/SltAgreementInfoMapper.xml | 6 +++ 20 files changed, 217 insertions(+), 22 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java index d1b4feb9..72abaddc 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/TypeTreeNode.java @@ -48,4 +48,7 @@ public class TypeTreeNode { @ApiModelProperty(value = "协议id") private Long agreementId; + + @ApiModelProperty(value = "领料方式 0材料领料 1工器具领料 2数据同步") + private Integer leaseStyle; } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java index a8de06a7..0f4f1c47 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseOutDetails.java @@ -108,6 +108,9 @@ public class LeaseOutDetails extends BaseEntity { @ApiModelProperty(value = "协议id") private Long agreementId; + @ApiModelProperty(value = "项目部协议id") + private Long projectUnitAgreementId; + @ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)") private Integer isFinished; @@ -140,6 +143,9 @@ public class LeaseOutDetails extends BaseEntity { @ApiModelProperty(value = "领料id") private Integer leaseUnitId; + @ApiModelProperty(value = "领料单位是否为班组") + private Boolean leaseUnitIsTeam; + @ApiModelProperty(value = "领料工程id") private Integer leaseProjectId; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java index 0207b50c..22c9c4c9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/BackApplyInfo.java @@ -39,6 +39,9 @@ public class BackApplyInfo implements Serializable { @ApiModelProperty(value = "协议id") private Long agreementId; + @ApiModelProperty(value = "材料站协议id") + private Long clzAgreementId; + @ApiModelProperty(value = "任务类型") private Integer taskType; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java index 5643ca51..fe169166 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmAgreementInfo.java @@ -49,6 +49,13 @@ public class BmAgreementInfo extends BaseEntity @NotNull(message = "往来单位id不能为空") private Long unitId; + /** + * 往来单位所属项目部ID + */ + @NotNull(message = "所属项目部ID不能为空") + @ApiModelProperty(value = "所属项目部ID") + private Long projectUnitId; + /** * 往来单位 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java index 2b519aa4..de31fafd 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java @@ -62,6 +62,11 @@ public interface BmAgreementInfoMapper public int selectNumByMonth(Date nowDate); + /** + * 查询单位类型,是内部单位/外部单位 + * @param agreementId + * @return + */ String getProtocol(String agreementId); /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java index 76edaa1b..68fe7314 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/back/MaterialBackApplyDetails.java @@ -119,6 +119,10 @@ public class MaterialBackApplyDetails extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private Long companyId; + /** 领用方式 */ + @ApiModelProperty(value = "领用方式 2数据同步") + private Integer leaseStyle; + /** * 附件列表 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java index 2d8d000a..f55a8274 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialBackApplyInfoServiceImpl.java @@ -416,6 +416,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId()); tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); tmTaskAgreement.setCreateBy(createBy); + // 增加任务和协议关联表数据 taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); backApplyInfo.setTaskId(tmTask.getTaskId()); backApplyInfo.setBackStyle("1"); @@ -443,7 +444,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe //对提交的退料详情数量进行校验 for (MaterialBackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) { - if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) { + if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum()) < 0) { return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!"); } } @@ -851,6 +852,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe * @return */ private int saveBackApplyDetails(String createBy, MaterialBackApplyRequestVo dto, MaterialBackApplyInfo backApplyInfo, int result) { + // 循环退料详情 for (MaterialBackApplyDetails details : dto.getBackApplyDetailsList()) { details.setCode(backApplyInfo.getCode()); details.setParentId(backApplyInfo.getId()); @@ -862,15 +864,18 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe result += materialBackInfoMapper.insertBackApplyDetails(details); // 处理附件 result = saveBmFileInfo(details, backApplyInfo.getId(), result); + // 判断是否为编码设备并处理附件 Integer isBack = dto.getBackApplyInfo().getIsBack(); details.setIsFinished(isBack); result = saveMaCodeBmFileInfo(createBy, isBack, details, backApplyInfo.getId(), result); + if (isBack == 1) { // 更新任务表及退料申请表状态 result += updateTaskAndBackInfo(backApplyInfo); // 更新结算表 backApplyInfo.setTypeId(details.getTypeId().toString()); + // 查询材料站的退料明细 List allList = materialBackInfoMapper.selectBackDetails(backApplyInfo); if (CollectionUtils.isNotEmpty(allList)) { List newList = new ArrayList<>(); @@ -892,6 +897,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe } } } + // 更新材料站的结算协议表 int res = updateSlt4Bean(backApplyInfo, newList); // 检查机具是否领料 if (res == 0) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java index 130ba2b8..3f4b80e1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialLeaseInfoServiceImpl.java @@ -1380,8 +1380,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { // 获取要减去的值,默认值为BigDecimal.ZERO BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO); // 计算新值,处理num为null的情况(若业务允许) - BigDecimal currentNum = Optional.ofNullable(node.getNum()) - .orElse(BigDecimal.ZERO); + BigDecimal currentNum = Optional.ofNullable(node.getNum()).orElse(BigDecimal.ZERO); BigDecimal newNum = currentNum.subtract(subtractNum); if (newNum.compareTo(BigDecimal.ZERO) == 0) { iterator.remove(); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java index b94ee401..e18955c5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/domain/dto/SelectDto.java @@ -1,6 +1,7 @@ package com.bonus.material.common.domain.dto; import lombok.Data; +import lombok.experimental.Accessors; import java.util.List; @@ -8,6 +9,7 @@ import java.util.List; * @author 10488 */ @Data +@Accessors(chain = true) public class SelectDto { /** 参数id*/ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java index 23db006f..79c29d66 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java @@ -507,6 +507,14 @@ public class SelectServiceImpl implements SelectService { List listL3 = new ArrayList<>(); List listL21 = new ArrayList<>(); try { + // 判断单位是否为班组,如果为班组的话,把材料站的领用数据也查询出来 + if (bean.getUnitId() != null && bean.getProId() != null) { + List clzAgreementInfos = mapper.getAgreementInfoByIdBack(new SelectDto().setProId(bean.getProId()).setUnitId(Math.toIntExact(bean.getUnitId()))); + // 如果在材料站该单位有签署协议,说明该单位是班组 + if (CollectionUtils.isNotEmpty(clzAgreementInfos)) { + bean.setClzAgreementId(Long.valueOf(clzAgreementInfos.get(0).getAgreementId())); + } + } // 先查第四层类型 listL4 = mapper.getUseTypeTreeL4(bean); if (CollectionUtils.isNotEmpty(listL4)) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java index 3104a998..00d02991 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java @@ -1,6 +1,5 @@ package com.bonus.material.lease.mapper; -import java.util.Date; import java.util.List; import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseConfirmSign; @@ -75,6 +74,33 @@ public interface LeaseApplyInfoMapper { */ int deleteLeaseApplyInfoByIds(Long[] ids); + /** + * 查询领料任务的单位类型是否是班组 + * @param leaseId 领料任务id + * @return 领料单位类型 + */ + Long selectLeaseApplyInfoIsTeam(Long leaseId); + + /** + * 根据单位id查询单位类型 + */ + Long selectUnitTypeByUnitId(Long unitId); + + /** + * 查询领料任务的单位ID + * @param leaseId 领料任务id + * @return 单位ID + */ + Long selectLeaseApplyInfoUnitIdByLeaseId(Long leaseId); + + /** + * 根据班组ID和工程ID查询挂靠的项目部的协议id + * @param teamId 班组单位id + * @param projectId 工程id + * @return 挂靠的项目部协议id + */ + Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") Integer teamId, @Param("projectId") Integer projectId); + String getTaskId(Long parentId); /** 设置审批人为默认的董班长 --防止代码冲突 **/ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index 6ede5f0f..7dc54b55 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java @@ -1273,6 +1273,22 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Override public AjaxResult leaseOut(LeaseOutRequestVo leaseOutRequestVo) { for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) { + if (Objects.isNull(bean)) { + continue; + } + // 默认设置领料单位为非班组 + bean.setLeaseUnitIsTeam(false); + // 根据现在的领料发布出库单位ID来判断类型是否是班组 + if (bean.getLeaseUnitId() != null) { + // 查询单位类型 + Long leaseUnitTypeId = leaseApplyInfoMapper.selectUnitTypeByUnitId(Long.valueOf(bean.getLeaseUnitId())); + if (leaseUnitTypeId != null && Objects.equals(leaseUnitTypeId, 1731L)) { + System.out.println("发布出库的领料单位是班组,Yes"); + bean.setLeaseUnitIsTeam(true); + } else { + System.out.println("发布出库的领料单位不是班组,No"); + } + } AjaxResult ajaxResult = leaseOutDetailsService.leaseOut(bean); if (ajaxResult.isError()) { return ajaxResult; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index 5214d5c0..12669e64 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -205,6 +205,27 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { // 5、插入结算记录 String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); record.setTaskId(taskId); + // 判断如果是班组领料,则插入原本项目部的协议结算记录 + if (record.getLeaseUnitIsTeam() != null && record.getLeaseUnitIsTeam()) { + // 暂存现在出库的班组单位ID + Integer thisOutId = record.getLeaseUnitId(); + // 查询班组挂靠的项目部协议ID + Long projectUnitAgreementId = leaseApplyInfoMapper.selectProjectUnitAgreementIdByTeamAndProject(record.getLeaseUnitId(), record.getLeaseProjectId()); + if (projectUnitAgreementId != null && projectUnitAgreementId > 0L) { + record.setProjectUnitAgreementId(projectUnitAgreementId); + } else { + return AjaxResult.error("出库失败,没有找到班组所属项目部协议信息"); + } + // 查询申请领料的项目部单位ID + Long originLeaseUnitId = leaseApplyInfoMapper.selectLeaseApplyInfoUnitIdByLeaseId(record.getParentId()); + record.setLeaseUnitId(Math.toIntExact(originLeaseUnitId)); + // 插入项目部领料的结算记录 + int inserts = insSltInfo(taskId, record); + System.out.println("插入原本项目部领料结算记录" + (inserts > 0 ? "成功" : "失败")); + // 恢复出库班组单位ID + record.setLeaseUnitId(thisOutId); + record.setLeaseUnitIsTeam(false); + } res = insSltInfo(taskId, record); if (res == 0) { throw new RuntimeException("出库失败,插入结算记录失败"); @@ -230,8 +251,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { if (task == null) { int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId()); String taskCode = genderTaskCode(thisMonthMaxOrder); - TmTask tmTask = new TmTask(); - tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(), + TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(), LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(), null, thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); @@ -261,6 +281,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { bmAgreementInfo.setUnitId(tbTeam.getId()); } else { bmAgreementInfo.setUnitId(bmTeam.getId()); + // 修改班组信息 bmTeamMapper.update(tbTeam); } // 先根据班组和工程id查询,若存在则直接返回,不存在则新增 @@ -313,6 +334,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { throw new Exception("更新clz_lease_apply_details表数据失败"); } } else { + // 走新增 record.setPreNum(record.getOutNum()); record.setAlNum(record.getOutNum()); res = materialLeaseInfoMapper.insertLeaseApplyDetails(record); @@ -357,7 +379,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } } catch (Exception e) { log.error(e.getMessage()); - return AjaxResult.error("出库失败"); + return AjaxResult.error("出库失败" + e.getMessage()); } return AjaxResult.success("出库成功"); } @@ -758,21 +780,35 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { return res; } + /** + * 插入结算信息 + * @param taskId 任务id + * @param record 出库记录 + */ public int insSltInfo(String taskId, LeaseOutDetails record) { int res = 0; - SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record); + // 根据发布批次查询结算协议信息 + SltAgreementInfo sltAgreementInfo; + // 判断是否是班组领用 + sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record); if (sltAgreementInfo != null) { BigDecimal num = sltAgreementInfo.getNum(); BigDecimal outNum = record.getOutNum(); sltAgreementInfo.setNum(num.add(outNum)); res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo); - record.setAgreementId(sltAgreementInfo.getAgreementId()); + if (!record.getLeaseUnitIsTeam()) { + record.setAgreementId(sltAgreementInfo.getAgreementId()); + } } else { - String agreementId = " "; - agreementId = tmTaskAgreementMapper.getAgreementId(taskId); + String agreementId = tmTaskAgreementMapper.getAgreementId(taskId); + // 根据发布批次,查询协议ID🆔 if (StringUtils.isNotBlank(record.getPublishTask())) { agreementId = tmTaskAgreementMapper.selectAgreementId(record.getPublishTask()); } + if (record.getLeaseUnitIsTeam()) { + agreementId = String.valueOf(record.getProjectUnitAgreementId()); + } + // 查询单位类型:内部单位/外部单位 String protocol = bmAgreementInfoMapper.getProtocol(agreementId); Type maType = typeMapper.getMaType(record.getTypeId()); if (StringUtils.isEmpty(protocol)) { @@ -787,7 +823,9 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } } res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType); - record.setAgreementId(Long.valueOf(agreementId)); + if (!record.getLeaseUnitIsTeam()) { + record.setAgreementId(Long.valueOf(agreementId)); + } } return res; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java index 314f6274..016a8940 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseTaskServiceImpl.java @@ -587,7 +587,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService { if (0==sysWorkflowNode.getNodeSignType()){ //当前节点已经审核需要修改节点值 if (SysWorkflowRecordHistoryList.get(0) != null) { - // todo 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询 + // 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询 // String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId()); // leaseApplyInfoNew.setNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId()); // leaseApplyInfoNew.setConfigValue(configValueNew); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index 7b2f0463..5ddeba5d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -330,7 +330,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { } for (SltAgreementInfo lose : loseList) { if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) { - //TODO 上面已经set过值,这里为什么还要set值 relation.setAgreementId(String.valueOf(lose.getAgreementId())); relation.setProjectName(lose.getProjectName()); relation.setUnitName(lose.getUnitName()); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml index 0069998d..5310fd46 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml @@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time, - bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName, + bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName, plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,tta.task_id,bai.branch_project as branchProIdsStr FROM bm_agreement_info bai LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id @@ -74,14 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into bm_agreement_info (agreement_code, sign_time, unit_id, + insert into bm_agreement_info (agreement_code, sign_time, unit_id, project_unit_id, project_id, create_by, lease_day, plan_start_time, contract_code, auth_person, phone, create_time, update_by, update_time, remark, company_id, protocol, branch_project ) - values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}, + values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}, #{projectUnitId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{leaseDay,jdbcType=INTEGER}, #{planStartTime,jdbcType=TIMESTAMP}, #{contractCode,jdbcType=VARCHAR}, #{authPerson,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, @@ -113,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" agreement_code = #{agreementCode}, sign_time = #{signTime}, unit_id = #{unitId}, + project_unit_id = #{projectUnitId}, project_id = #{projectId}, create_by = #{createBy}, lease_day = #{leaseDay}, 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 c0e99058..e5744c6d 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 @@ -663,11 +663,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.unit_value as unitValue, mt.manage_type as manageType, SUM(sai.num) AS num, - mt.LEVEL as level + mt.LEVEL as level, + clai.lease_style as leaseStyle FROM ma_type mt LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' + LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id WHERE sai.STATUS = '0' and sai.agreement_id = #{agreementId} GROUP BY diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml index c311fd1e..e7d43647 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml @@ -216,13 +216,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.LEVEL as level FROM ma_type mt - LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id - LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' + LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id + LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' WHERE sai.STATUS = '0' and sai.agreement_id = #{agreementId} GROUP BY mt.type_id - HAVING num> 0 + HAVING + num > 0 + + + union all + + SELECT + mt.type_id as typeId, + mt1.type_name as materialName, + mt.type_name as typeName, + mt.parent_id as parentId, + mt.unit_name as unitName, + mt.unit_value as unitValue, + mt.manage_type as manageType, + SUM( IF(sai.agreement_id = #{clzAgreementId} AND sai.STATUS = '0', sai.num, 0) ) AS num, + mt.LEVEL as level + FROM + ma_type mt + LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id + LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id + LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0' + WHERE + sai.STATUS = '0' and clai.lease_style != 2 + GROUP BY + mt.type_id + HAVING + num> 0 + + + + + + + + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 734d87c1..724bdd60 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -177,6 +177,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND publish_task = #{publishTask} + + AND agreement_id = #{projectUnitAgreementId} + + + AND agreement_id = #{agreementId} + AND DATE(start_time) = CURDATE();