From adf91681f50ffa3c2b878222f246fb9e7d50f075 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 13 May 2025 19:06:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/domain/lease/LeaseApplyInfo.java | 23 +++ .../common/biz/enums/LeaseTaskStatusEnum.java | 2 +- .../controller/BackApplyInfoController.java | 28 +++ .../material/back/domain/BackApplyInfo.java | 11 ++ .../back/mapper/BackApplyInfoMapper.java | 15 ++ .../back/service/IBackApplyInfoService.java | 15 ++ .../impl/BackApplyInfoServiceImpl.java | 44 +++++ .../basic/domain/BmAgreementInfo.java | 3 + .../basic/mapper/BmAgreementInfoMapper.java | 7 + .../controller/LeaseApplyInfoController.java | 77 ++++++++ .../lease/domain/LeaseApplyDetailsInfo.java | 154 +++++++++++++++ .../lease/mapper/LeaseApplyDetailsMapper.java | 8 + .../lease/mapper/LeaseApplyInfoMapper.java | 14 ++ .../lease/service/ILeaseApplyInfoService.java | 22 +++ .../impl/LeaseApplyInfoServiceImpl.java | 181 ++++++++++++------ .../ma/controller/MachineController.java | 14 ++ .../ma/controller/TypeController.java | 6 + .../com/bonus/material/ma/domain/Machine.java | 18 ++ .../com/bonus/material/ma/domain/Type.java | 7 + .../material/ma/mapper/MachineMapper.java | 14 ++ .../bonus/material/ma/mapper/TypeMapper.java | 17 ++ .../material/ma/service/IMachineService.java | 7 + .../material/ma/service/ITypeService.java | 3 + .../ma/service/impl/MachineServiceImpl.java | 10 + .../ma/service/impl/TypeServiceImpl.java | 13 ++ .../bonus/material/warning/StatisticTask.java | 175 +++++++++++++++++ .../resources/bootstrap-sgzb_bns_local.yml | 2 +- .../material/back/BackApplyInfoMapper.xml | 30 +++ .../material/basic/BmAgreementInfoMapper.xml | 12 ++ .../lease/LeaseApplyDetailsMapper.xml | 39 ++++ .../material/lease/LeaseApplyInfoMapper.xml | 51 ++++- .../mapper/material/ma/MachineMapper.xml | 45 +++++ .../mapper/material/ma/TypeMapper.xml | 96 +++++++++- 33 files changed, 1098 insertions(+), 65 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetailsInfo.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/StatisticTask.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java index 51cbc158..b2288a05 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/lease/LeaseApplyInfo.java @@ -204,6 +204,15 @@ public class LeaseApplyInfo extends BaseEntity{ @ApiModelProperty(value = "工程名称") private String projectName; + @ApiModelProperty(value = "班组id") + private Long teamId; + + @ApiModelProperty(value = "班组名称") + private String teamName; + + @ApiModelProperty(value = "领料方式(0 材料领料,1 工器具领料,2 系统推送)") + private String leaseStyle; + /** * 预领料合计数 */ @@ -290,4 +299,18 @@ public class LeaseApplyInfo extends BaseEntity{ @ApiModelProperty(value = "发布批次") private String publishTask; + + @ApiModelProperty(value = "领料时间") + private String leaseTime; + + /** 类型编号 */ + @ApiModelProperty(value = "类型编号") + private String typeCode; + + /** 规格编号 */ + @ApiModelProperty(value = "规格编号") + private String modelCode; + + @ApiModelProperty(value = "计量单位") + private String unitNames; } diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java index 07904636..a9149599 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/LeaseTaskStatusEnum.java @@ -12,7 +12,7 @@ public enum LeaseTaskStatusEnum { //0-领用申请任务待审核,其余为领料申请流程状态 LEASE_TASK_ZERO(0, "待审核"), LEASE_TASK_SUBMIT(5, "待提交"), - LEASE_TASK_TO_PUBLISHED(1, "待发布"), + LEASE_TASK_TO_PUBLISHED(1, "待出库"), LEASE_TASK_TO_AUDIT(2, "已终止"), LEASE_TASK_IN_PROGRESS(3, "出库进行中"), LEASE_TASK_FINISHED(4, "出库已完成"), diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java index 793994ce..b8ccba24 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java @@ -8,6 +8,7 @@ import javax.validation.constraints.NotNull; import cn.hutool.core.convert.Convert; import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.log.enums.OperaType; import com.bonus.material.back.domain.BackApplyDetails; @@ -56,6 +57,33 @@ public class BackApplyInfoController extends BaseController { return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } + /** + * 查询总站点退料记录数据 + * @param backApplyInfo + * @return + */ + @ApiOperation(value = "查询总站点退料记录数据") + @GetMapping("/getTotalList") + public AjaxResult getTotalList(BackApplyInfo backApplyInfo) { + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + List list = backApplyInfoService.getTotalList(backApplyInfo); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); + } + + /** + * 查询站点退料详情数据 + * @param backApplyInfo + * @return + */ + @ApiOperation(value = "查询总站点退料详情数据") + @GetMapping("/getDetailsList") + public AjaxResult getDetailsList(BackApplyInfo backApplyInfo) { + startPage(); + List list = backApplyInfoService.getDetailsList(backApplyInfo); + return AjaxResult.success(getDataTable(list)); + } + /** * 查询修试查询-退料查询列表 * @param dto 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 41b0d41b..5af86255 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 @@ -174,4 +174,15 @@ public class BackApplyInfo implements Serializable { private Integer appTaskStatus; private String maStatus; + + /** 类型编号 */ + @ApiModelProperty(value = "类型编号") + private String typeCode; + + /** 规格编号 */ + @ApiModelProperty(value = "规格编号") + private String modelCode; + + @ApiModelProperty(value = "计量单位") + private String unitNames; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java index 85bd99cf..12d2c523 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/mapper/BackApplyInfoMapper.java @@ -3,6 +3,7 @@ package com.bonus.material.back.mapper; import java.util.Date; import java.util.List; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.material.back.domain.BackApplyDetails; import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.back.domain.MaCodeDto; @@ -358,4 +359,18 @@ public interface BackApplyInfoMapper { BackApplyInfoVo selectIdList(BackApplyInfoVo dto); BackApplyInfoVo selectDetails(BackApplyInfoVo dto); + + /** + * 查询总站点退料记录数据 + * @param backApplyInfo + * @return + */ + List getTotalList(BackApplyInfo backApplyInfo); + + /** + * 查询站点退料详情数据 + * @param backApplyInfo + * @return + */ + List getDetailsList(BackApplyInfo backApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java index fd373809..0ff617e9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/IBackApplyInfoService.java @@ -2,6 +2,7 @@ package com.bonus.material.back.service; import java.util.List; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.back.domain.BackApplyDetails; import com.bonus.material.back.domain.BackApplyInfo; @@ -151,5 +152,19 @@ public interface IBackApplyInfoService { * @return */ BackApplyInfoVo selectSecondList(BackApplyInfoVo dto); + + /** + * 查询总站点退料记录数据 + * @param backApplyInfo + * @return + */ + List getTotalList(BackApplyInfo backApplyInfo); + + /** + * 查询站点退料详情数据 + * @param backApplyInfo + * @return + */ + List getDetailsList(BackApplyInfo backApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java index b286fb57..3106f4d6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/service/impl/BackApplyInfoServiceImpl.java @@ -9,6 +9,7 @@ import cn.hutool.core.util.PhoneUtil; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.TypeTreeNode; +import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.common.biz.enums.*; import com.bonus.common.core.exception.ServiceException; @@ -1412,6 +1413,49 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { return vo; } + /** + * 查询总站点退料记录数据 + * @param backApplyInfo + * @return + */ + @Override + public List getTotalList(BackApplyInfo backApplyInfo) { + List list = backApplyInfoMapper.getTotalList(backApplyInfo); + if (!org.springframework.util.CollectionUtils.isEmpty(list)) { + // 如果关键字不为空,进行过滤 + if (!StringUtils.isBlank(backApplyInfo.getKeyWord())) { + list = list.stream() + .filter(item -> containsTotalKeyword(item, backApplyInfo.getKeyWord())) + .collect(Collectors.toList()); + } + } + return list; + } + + /** + * 查询站点退料详情数据 + * @param backApplyInfo + * @return + */ + @Override + public List getDetailsList(BackApplyInfo backApplyInfo) { + return backApplyInfoMapper.getDetailsList(backApplyInfo); + } + + /** + * 总站点关键字搜索 + * @param item + * @param keyWord + * @return + */ + private boolean containsTotalKeyword(BackApplyInfo item, String keyWord) { + return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) || + (item.getUnitName() != null && item.getUnitName().contains(keyWord)) || + (item.getProName() != null && item.getProName().contains(keyWord)) || + (item.getBackPerson() != null && item.getBackPerson().contains(keyWord)) || + (item.getCode() != null && item.getCode().contains(keyWord)); + } + /** * 关键字搜索 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 2798afee..78fd76c1 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 @@ -47,6 +47,9 @@ public class BmAgreementInfo extends BaseEntity @NotNull(message = "往来单位id不能为空") private Long unitId; + @ApiModelProperty(value = "班组id") + private Long teamId; + /** * 往来单位 */ 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 286921bf..5dfa01e4 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 @@ -72,4 +72,11 @@ public interface BmAgreementInfoMapper int selectByagreementId(Long agreementId); String getDictLabel(int id); + + /** + * 根据班组id和标段id查询协议信息 + * @param bmAgreementInfo + * @return + */ + BmAgreementInfo queryByTeamIdAndProjectId(BmAgreementInfo bmAgreementInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java index 0397de97..c4ac4845 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseApplyInfoController.java @@ -1,6 +1,7 @@ package com.bonus.material.lease.controller; import cn.hutool.core.convert.Convert; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.annotation.StoreLog; import com.bonus.common.biz.config.ListPagingUtil; import com.bonus.common.biz.domain.lease.LeaseOutDetails; @@ -11,9 +12,11 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.enums.OperaType; import com.bonus.material.basic.domain.BmQrcodeInfo; +import com.bonus.material.basic.domain.RetainedEquipmentInfo; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.material.lease.domain.LeaseApplyDetails; +import com.bonus.material.lease.domain.LeaseApplyDetailsInfo; import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; import com.bonus.common.biz.domain.lease.LeaseOutRequestVo; import com.bonus.material.lease.service.ILeaseApplyInfoService; @@ -52,6 +55,33 @@ public class LeaseApplyInfoController extends BaseController { return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } + /** + * 查询总站点领料记录数据 + * @param leaseApplyInfo + * @return + */ + @ApiOperation(value = "查询总站点领料记录数据") + @GetMapping("/getTotalList") + public AjaxResult getTotalList(LeaseApplyInfo leaseApplyInfo) { + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + List list = leaseApplyInfoService.getTotalList(leaseApplyInfo); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); + } + + /** + * 查询总站点领料详情数据 + * @param leaseApplyInfo + * @return + */ + @ApiOperation(value = "查询总站点领料详情数据") + @GetMapping("/getDetailsList") + public AjaxResult getDetailsList(LeaseApplyInfo leaseApplyInfo) { + startPage(); + List list = leaseApplyInfoService.getDetailsList(leaseApplyInfo); + return AjaxResult.success(getDataTable(list)); + } + /** * 导出领料任务列表 */ @@ -90,6 +120,53 @@ public class LeaseApplyInfoController extends BaseController { return success(leaseApplyInfoService.getInnerById(leaseApplyDetails)); } + /** + * 工器具领料数据 + * @param dto + * @return + */ + @ApiOperation(value = "工器具领料数据") + @GetMapping(value = "/getLeaseInfo") + public AjaxResult getLeaseInfo(LeaseApplyDetailsInfo dto) { + dto.setIsExport(1); + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + List list = leaseApplyInfoService.getLeaseInfo(dto); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); + } + + /** + * 工器具领料数据查询不带分页 + * @param dto + * @return + */ + @ApiOperation(value = "工器具领料数据查询不带分页") + @GetMapping("/getLeaseInfoNoPage") + public AjaxResult getLeaseInfoNoPage(LeaseApplyDetailsInfo dto) { + dto.setIsExport(0); + List list = leaseApplyInfoService.getLeaseInfo(dto); + LeaseApplyDetailsInfo info = new LeaseApplyDetailsInfo(); + if (CollectionUtils.isNotEmpty(list)) { + info = list.get(0); + } + return AjaxResult.success(info); + } + + /** + * 导出工器具领料数据查询 + * @param response + * @param dto + */ + @ApiOperation("导出工器具领料数据查询") + @PostMapping("/exportRetainedEquipmentList") + public void exportRetainedEquipmentList(HttpServletResponse response, LeaseApplyDetailsInfo dto) + { + dto.setIsExport(0); + List list = leaseApplyInfoService.getLeaseInfo(dto); + ExcelUtil util = new ExcelUtil<>(LeaseApplyDetailsInfo.class); + util.exportExcel(response, list, "工器具领料数据查询"); + } + /** * 获取领料出库内部详细信息 * @param leaseApplyDetails diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetailsInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetailsInfo.java new file mode 100644 index 00000000..74a29915 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyDetailsInfo.java @@ -0,0 +1,154 @@ +package com.bonus.material.lease.domain; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import com.bonus.material.back.domain.vo.MaCodeVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 领料任务详细对象 lease_apply_details + * + * @author xsheng + * @date 2024-10-16 + */ +@Data +@ToString +public class LeaseApplyDetailsInfo extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "是否导出 0 是,1 否") + private Integer isExport; + + /** ID */ + private Long id; + + /** 任务ID */ + @ApiModelProperty(value = "任务ID") + private Long parentId; + + @ApiModelProperty(value = "机具ID") + private Long maId; + + /** 物资类型 */ + @ApiModelProperty(value = "物资类型名称") + @Excel(name = "工器具名称") + private String maTypeName; + + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格型号") + private String typeName; + + /** 规格型号id */ + @ApiModelProperty(value = "规格型号id") + private Long typeId; + + @ApiModelProperty(value = "规格型号id") + private Long newTypeId; + + @ApiModelProperty(value = "三级id") + private Long thirdTypeId; + + @ApiModelProperty(value = "规格型号id") + private Long taskId; + + @ApiModelProperty(value = "机具编码") + private String maCode; + + /** 计量单位 */ + @ApiModelProperty(value = "计量单位") + @Excel(name = "计量单位") + private String unitName; + + /** 计量单位数值 */ + @ApiModelProperty(value = "计量单位数值") + private String unitValue; + + @ApiModelProperty(value = "已发布数量") + private BigDecimal publishNum; + + @ApiModelProperty(value = "待发布数量") + private BigDecimal pendingNum; + + @ApiModelProperty(value = "本次发布数量") + private BigDecimal num; + + /** 预领料数 */ + @Excel(name = "领料数量") + @ApiModelProperty(value = "预领料数") + private BigDecimal preNum; + + /** 审批数量 */ + @ApiModelProperty(value = "审批数量") + private BigDecimal auditNum; + + /** 已领数量 */ + @ApiModelProperty(value = "已领数量") + @Excel(name = "出库数量") + private BigDecimal alNum; + + /** + * 此数量是剩余需要出库的数量(preNum - alNum) + */ + @ApiModelProperty(value = "剩余最大出库数量") + @Excel(name = "待出库数量") + private BigDecimal outNum; + + @ApiModelProperty(value = "领料日期") + @Excel(name = "领料日期") + private String leaseDate; + + @ApiModelProperty(value = "出库日期") + @Excel(name = "出库日期") + private String outDate; + + @ApiModelProperty(value = "班组名称") + @Excel(name = "领料班组") + private String teamName; + + @ApiModelProperty(value = "工程名称") + @Excel(name = "领料工程") + private String projectName; + + /** 备注 */ + @ApiModelProperty(value = "领料人") + @Excel(name = "领料人") + private String leasePerson; + + @ApiModelProperty(value = "出库人") + @Excel(name = "出库人") + private String outPerson; + + @ApiModelProperty(value = "领料单号") + @Excel(name = "领料单号") + private String leaseCode; + + /** + * 装备管理方式(0编号 1计数) + */ + @ApiModelProperty(name = "装备管理方式") + private int manageType; + + /** 状态(0待审批,1进行中,2已出库) */ + private String status; + + /** 数据所属组织 */ + @ApiModelProperty(value = "数据所属组织") + private Long companyId; + + private String keyWord; + + @ApiModelProperty(value = "用户ID") + private Long userId; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java index 532de993..e7c4f6a6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java @@ -6,6 +6,7 @@ import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.basic.domain.BmQrcodeInfo; import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.common.biz.domain.lease.LeaseOutDetails; +import com.bonus.material.lease.domain.LeaseApplyDetailsInfo; import com.bonus.material.lease.domain.vo.LeaseOutVo; import org.apache.ibatis.annotations.Param; @@ -162,4 +163,11 @@ public interface LeaseApplyDetailsMapper { * @return */ int deletePublishTask(LeaseOutDetails leaseOutDetails); + + /** + * 工器具领料数据 + * @param dto + * @return + */ + List getLeaseInfo(LeaseApplyDetailsInfo dto); } 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 92a54f0f..b7d7417a 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 @@ -80,4 +80,18 @@ public interface LeaseApplyInfoMapper { * @return */ List selectPublishList(LeaseApplyInfo leaseApplyInfo); + + /** + * 查询总站点领料记录数据 + * @param leaseApplyInfo + * @return + */ + List getTotalList(LeaseApplyInfo leaseApplyInfo); + + /** + * 查询总站点领料详情数据 + * @param leaseApplyInfo + * @return + */ + List getDetailsList(LeaseApplyInfo leaseApplyInfo); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java index ea78b725..c73152a5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseApplyInfoService.java @@ -7,6 +7,7 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.material.basic.domain.BmQrcodeInfo; import com.bonus.material.lease.domain.LeaseApplyDetails; +import com.bonus.material.lease.domain.LeaseApplyDetailsInfo; import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; import com.bonus.common.biz.domain.lease.LeaseOutRequestVo; @@ -144,4 +145,25 @@ public interface ILeaseApplyInfoService { * @return */ AjaxResult useExamine(LeaseApplyInfo leaseApplyInfo); + + /** + * 工器具领料数据 + * @param dto + * @return + */ + List getLeaseInfo(LeaseApplyDetailsInfo dto); + + /** + * 查询总站点领料记录数据 + * @param leaseApplyInfo + * @return + */ + List getTotalList(LeaseApplyInfo leaseApplyInfo); + + /** + * 查询总站点领料详情数据 + * @param leaseApplyInfo + * @return + */ + List getDetailsList(LeaseApplyInfo leaseApplyInfo); } 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 6fb9ff24..403d84e1 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 @@ -1,6 +1,8 @@ package com.bonus.material.lease.service.impl; import java.io.OutputStream; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.*; @@ -20,10 +22,14 @@ import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.back.domain.vo.MaCodeVo; +import com.bonus.material.basic.domain.BmAgreementInfo; import com.bonus.material.basic.domain.BmQrcodeInfo; +import com.bonus.material.basic.domain.RetainedEquipmentInfo; +import com.bonus.material.basic.mapper.BmAgreementInfoMapper; import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.common.biz.domain.lease.LeaseOutDetails; +import com.bonus.material.lease.domain.LeaseApplyDetailsInfo; import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; import com.bonus.common.biz.domain.lease.LeaseOutRequestVo; import com.bonus.material.lease.domain.vo.LeaseOutVo; @@ -35,6 +41,7 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import com.bonus.material.lease.mapper.LeaseApplyInfoMapper; @@ -73,6 +80,9 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { @Resource private BmFileInfoMapper bmFileInfoMapper; + @Resource + private BmAgreementInfoMapper bmAgreementInfoMapper; + /** * 查询领料任务 * @@ -177,7 +187,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { leaseApplyInfo.setUserId(SecurityUtils.getUserId()); List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); - // 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接 + /*// 如果statusList包含3、4、5,则为领料出库查询,需查询领用出库数据,进行拼接 if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) { if (leaseApplyInfo.getStatusList().contains(3) || leaseApplyInfo.getStatusList().contains(4) || leaseApplyInfo.getStatusList().contains(5)) { // 查询领用出库数据 @@ -195,7 +205,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { list.addAll(leaseApplyOutList); } } - } + }*/ // 使用 Stream API 进行降序排序 List sortedList = list.stream() .sorted(Comparator.comparing(LeaseApplyInfo::getCreateTime).reversed()) @@ -227,7 +237,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ private boolean containsKeyword(LeaseApplyInfo item, String keyWord) { return (item.getMaTypeNames() != null && item.getMaTypeNames().contains(keyWord)) || - (item.getUnitName() != null && item.getUnitName().contains(keyWord)) || + (item.getTeamName() != null && item.getTeamName().contains(keyWord)) || (item.getProjectName() != null && item.getProjectName().contains(keyWord)) || (item.getCode() != null && item.getCode().contains(keyWord)) || (item.getCreateBy() != null && item.getCreateBy().contains(keyWord)) || @@ -245,59 +255,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public AjaxResult insertLeaseApplyInfo(LeaseApplyRequestVo leaseApplyRequestVo) { - /*int result = 0; - if (null == leaseApplyRequestVo.getLeaseApplyInfo()) { - return AjaxResult.error("请先填写领料任务信息"); - } - if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) { - return AjaxResult.error("请先添加领料任务物资明细"); - } - leaseApplyRequestVo.getLeaseApplyInfo().setCreateTime(DateUtils.getNowDate()); - leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getUsername()); - try { - // 获取 LeaseApplyDetails 列表 - List leaseApplyDetailsList = leaseApplyRequestVo.getLeaseApplyDetailsList(); - for (LeaseApplyDetails applyDetails : leaseApplyDetailsList) { - if (applyDetails.getCompanyId() == null) { - throw new RuntimeException("未知所属公司领料任务,无法操作!"); - } - } - // 按 companyId 进行分组 - Map> groupedByCompanyId = leaseApplyDetailsList.stream() - .collect(Collectors.groupingBy(LeaseApplyDetails::getCompanyId)); - for (Map.Entry> entry : groupedByCompanyId.entrySet()) { - Long key = entry.getKey(); - List details = entry.getValue(); - TmTaskTypeEnum splitType = null; - String taskTypeLabel = null; - // 机具领料任务 - if (key == 101) { - splitType = TmTaskTypeEnum.TM_TASK_JJ_LEASE; - taskTypeLabel = MaterialConstants.JJ_LEASE_TASK_TYPE_LABEL; - // 安全工器具领料任务 - } else if (key == 102) { - splitType = TmTaskTypeEnum.TM_TASK_SAFE_LEASE; - taskTypeLabel = MaterialConstants.AQ_LEASE_TASK_TYPE_LABEL; - // 宏源领料任务 - } else if (key == 309) { - splitType = TmTaskTypeEnum.TM_TASK_HY_LEASE; - taskTypeLabel = MaterialConstants.HY_LEASE_TASK_TYPE_LABEL; - } else { - throw new RuntimeException("未知所属公司领料任务,无法操作!"); - } - result += processLeaseTask(leaseApplyRequestVo, splitType, taskTypeLabel); - if (result > 0) { - return insertPurchaseCheckDetails(details, leaseApplyRequestVo.getLeaseApplyInfo().getId()); - } else { - return AjaxResult.error("新增任务失败,lease_apply_info表插入0条"); - } - } - } catch (DataAccessException e) { - throw new RuntimeException("数据库操作失败:" + e.getMessage()); - } catch (Exception e) { - throw new RuntimeException("新增任务失败:" + e.getMessage()); - } - return AjaxResult.error("新增任务失败");*/ if (null == leaseApplyRequestVo.getLeaseApplyInfo()) { return AjaxResult.error("请先填写领料任务信息"); } @@ -315,6 +272,21 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { tmTask.setCreateTime(DateUtils.getNowDate()); tmTask.setCreateBy(SecurityUtils.getUsername()); tmTaskMapper.insertTmTask(tmTask); + BmAgreementInfo bmAgreementInfo = new BmAgreementInfo(); + bmAgreementInfo.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProjectId()); + bmAgreementInfo.setTeamId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId()); + // 先根据班组和工程id查询,若存在则直接返回,不存在则新增 + BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectId(bmAgreementInfo); + if (info != null) { + leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(info.getAgreementId()); + } else { + int count = bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo); + if (count > 0) { + leaseApplyRequestVo.getLeaseApplyInfo().setAgreementId(bmAgreementInfo.getAgreementId()); + } else { + return AjaxResult.error("新增bm_agreement_info表失败"); + } + } TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyInfo().getAgreementId()); tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); tmTaskAgreement.setCreateBy(SecurityUtils.getUsername()); @@ -327,6 +299,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { leaseApplyRequestVo.getLeaseApplyInfo().setDirectAuditBy(peopleId); /** 设置审批人为默认的董班长 --防止代码冲突 **/ + // 领料任务类型为1 工器具领料 + leaseApplyRequestVo.getLeaseApplyInfo().setLeaseStyle("1"); int count = leaseApplyInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo()); if (!CollectionUtils.isEmpty(leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos())) { leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos().forEach(bmFileInfo -> { @@ -464,6 +438,101 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { } } + /** + * 工器具领料数据 + * @param dto + * @return + */ + @Override + public List getLeaseInfo(LeaseApplyDetailsInfo dto) { + BigDecimal preNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); + BigDecimal alNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); + BigDecimal outNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP); + List list = leaseApplyDetailsMapper.getLeaseInfo(dto); + if (!CollectionUtils.isEmpty(list)) { + String keyWord = dto.getKeyWord(); + // 如果关键字不为空,进行过滤 + if (!StringUtils.isBlank(keyWord)) { + list = list.stream() + .filter(item -> containsLeaseKeyword(item, keyWord)) + .collect(Collectors.toList()); + } + for (LeaseApplyDetailsInfo leaseApplyDetailsInfo : list) { + preNum = preNum.add(leaseApplyDetailsInfo.getPreNum()); + alNum = alNum.add(leaseApplyDetailsInfo.getAlNum()); + outNum = outNum.add(leaseApplyDetailsInfo.getOutNum()); + } + if (dto.getIsExport() == 0) { + LeaseApplyDetailsInfo info = new LeaseApplyDetailsInfo(); + info.setPreNum(preNum); + info.setAlNum(alNum); + info.setOutNum(outNum); + info.setUnitName("合计"); + list.add(0, info); + } + } + return list; + } + + /** + * 查询总站点领料记录数据 + * @param leaseApplyInfo + * @return + */ + @Override + public List getTotalList(LeaseApplyInfo leaseApplyInfo) { + List list = leaseApplyInfoMapper.getTotalList(leaseApplyInfo); + if (!CollectionUtils.isEmpty(list)) { + // 如果关键字不为空,进行过滤 + if (!StringUtils.isBlank(leaseApplyInfo.getKeyWord())) { + list = list.stream() + .filter(item -> containsTotalKeyword(item, leaseApplyInfo.getKeyWord())) + .collect(Collectors.toList()); + } + } + return list; + } + + /** + * 查询总站点领料详情数据 + * @param leaseApplyInfo + * @return + */ + @Override + public List getDetailsList(LeaseApplyInfo leaseApplyInfo) { + return leaseApplyInfoMapper.getDetailsList(leaseApplyInfo); + } + + /** + * 总站点领料记录数据过滤 + * @param item + * @param keyWord + * @return + */ + private boolean containsTotalKeyword(LeaseApplyInfo item, String keyWord) { + return (item.getMaTypeNames() != null && item.getMaTypeNames().contains(keyWord)) || + (item.getLeaseUnit() != null && item.getLeaseUnit().contains(keyWord)) || + (item.getLeaseProject() != null && item.getLeaseProject().contains(keyWord)) || + (item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) || + (item.getCode() != null && item.getCode().contains(keyWord)); + } + + /** + * 工器具领料数据过滤 + * @param item + * @param keyWord + * @return + */ + private boolean containsLeaseKeyword(LeaseApplyDetailsInfo item, String keyWord) { + return (item.getMaTypeName() != null && item.getMaTypeName().contains(keyWord)) || + (item.getTeamName() != null && item.getTeamName().contains(keyWord)) || + (item.getProjectName() != null && item.getProjectName().contains(keyWord)) || + (item.getTypeName() != null && item.getTypeName().contains(keyWord)) || + (item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) || + (item.getOutPerson() != null && item.getOutPerson().contains(keyWord)) || + (item.getLeaseCode() != null && item.getLeaseCode().contains(keyWord)); + } + /** * 插入领料任务详情数据 * @param leaseApplyDetailsList diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java index e851db95..fea5e299 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/MachineController.java @@ -254,4 +254,18 @@ public class MachineController extends BaseController { { return machineService.synchReport(machine); } + + /** + * 获取机具追溯管理数据 + * @param machine + * @return + */ + @ApiOperation(value = "获取机具追溯管理数据") + @GetMapping(value = "/getMachineInfo") + public AjaxResult getMachineInfo(Machine machine) { + startPage(); + List list = machineService.getMachineInfo(machine); + return AjaxResult.success(getDataTable(list)); + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java index 391e5d0c..bcd8b511 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/controller/TypeController.java @@ -318,4 +318,10 @@ public class TypeController extends BaseController { } return null; }*/ + + @ApiOperation(value = "查询一级列表") + @GetMapping("/getPushDetailsInfo") + public AjaxResult getPushDetailsInfo() { + return typeService.getPushDetailsInfo(); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java index 7340b52f..fcc08f6a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java @@ -210,4 +210,22 @@ public class Machine extends BaseEntity @ApiModelProperty(value = "集合") private List samples; + + @ApiModelProperty(value = "入库时间") + private String inputTime; + + @ApiModelProperty(value = "类型名称") + private String typeName; + + /** 类型编号 */ + @ApiModelProperty(value = "类型编号") + private String typeCode; + + /** 规格编号 */ + @ApiModelProperty(value = "规格编号") + private String modelCode; + + @ApiModelProperty(value = "推送时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private String pushTime; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java index 88f21c1b..2b01e73f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Type.java @@ -33,6 +33,9 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "任务ID") private Long taskId; + @ApiModelProperty(value = "物资类型") + private String materialName; + /** 类型名称 */ @Excel(name = "规格型号", sort = 5) @ApiModelProperty(value = "类型名称") @@ -232,4 +235,8 @@ public class Type extends BaseEntity { @ApiModelProperty(value = "抽检比例") private String samplingRatio; + @ApiModelProperty(value = "推送时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private String pushTime; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java index c995da77..f760d5fe 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/MachineMapper.java @@ -141,4 +141,18 @@ public interface MachineMapper * 同步检验报告 */ int updateSynchReport(SampleSync sampleSync); + + /** + * 根据主键查询机具信息 + * @param machine + * @return + */ + Machine getMachineById(Machine machine); + + /** + * 获取机具追溯管理数据 + * @param machine + * @return + */ + List getMachineInfo(Machine machine); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java index b6ca8868..f50c67c2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/mapper/TypeMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.bonus.common.biz.domain.lease.LeaseOutDetails; import com.bonus.material.ma.domain.MaTypeHistory; +import com.bonus.material.ma.domain.Machine; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.vo.MaTypeConfigVo; import com.bonus.material.ma.domain.vo.MaTypeVo; @@ -196,4 +197,20 @@ public interface TypeMapper { * @return */ List getListLevel(MaTypeVo maTypeVo); + + /** + * 首先查询当天ma_station_push表推送的数据 + * @param type + * @return + */ + List getPushDetailsInfo(Type type); + + int updateNum(Type type3); + + /** + * 查询机具详情 + * @param dto + * @return + */ + List getMaTypeDetails(Type dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java index b1d64d6c..6d705b36 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/IMachineService.java @@ -107,4 +107,11 @@ public interface IMachineService * @return 结果 */ public AjaxResult synchReport(Machine machine); + + /** + * 获取机具追溯管理数据 + * @param machine + * @return + */ + List getMachineInfo(Machine machine); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java index 7ba9a874..268adbe5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/ITypeService.java @@ -137,4 +137,7 @@ public interface ITypeService { * @return */ AjaxResult getListLevel(MaTypeVo maTypeVo); + + AjaxResult getPushDetailsInfo(); + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java index dea2ef9e..ee9091fb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/MachineServiceImpl.java @@ -302,4 +302,14 @@ public class MachineServiceImpl implements IMachineService } } + /** + * 获取机具追溯管理数据 + * @param machine + * @return + */ + @Override + public List getMachineInfo(Machine machine) { + return machineMapper.getMachineInfo(machine); + } + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index cee4c3c4..a3410894 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -194,6 +194,19 @@ public class TypeServiceImpl implements ITypeService { return AjaxResult.success(maTypeVos); } + @Override + public AjaxResult getPushDetailsInfo() { + Type type = new Type(); + List list = typeMapper.getPushDetailsInfo(type); + // 根据materialName,typeName,typeCode将list数据进行分组 + Map> simplifiedGroupedData = list.stream() + .collect(Collectors.groupingBy( + item -> item.getMaterialName() + "|" + item.getTypeName() + "|" + item.getTypeCode(), + Collectors.toList() + )); + return AjaxResult.success(simplifiedGroupedData); + } + @Override public List selectMaTypeListByHouseId(Long houseId) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/StatisticTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/StatisticTask.java new file mode 100644 index 00000000..b05070a7 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/warning/StatisticTask.java @@ -0,0 +1,175 @@ +package com.bonus.material.warning; + +import com.alibaba.nacos.common.utils.CollectionUtils; +import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.ma.domain.Machine; +import com.bonus.material.ma.domain.Type; +import com.bonus.material.ma.mapper.MachineMapper; +import com.bonus.material.ma.mapper.TypeMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 机具推送数据处理定时任务 + * @Author ma_sh + * @create 2025/5/13 15:40 + */ +@Component +@Slf4j +public class StatisticTask { + + @Resource + private TypeMapper typeMapper; + + @Resource + private MachineMapper machineMapper; + + /** + * 每日凌晨1点统计数据 + */ + @Scheduled(cron = "0 30 0 * * ?") + public void setTypeInfoToMaType() { + // 首先查询当天ma_station_push表推送的数据 + LocalDate today = LocalDate.now(); + String formDate = today.format(DateTimeFormatter.ISO_LOCAL_DATE); + Type type = new Type(); + type.setPushTime(formDate); + List list = typeMapper.getPushDetailsInfo(type); + // 根据materialName,typeName,typeCode将list数据进行分组 + if (CollectionUtils.isNotEmpty(list)) { + Map> groupedData = list.stream() + .collect(Collectors.groupingBy( + item -> item.getMaterialName() + "|" + item.getTypeName() + "|" + item.getTypeCode(), + Collectors.toList() + )); + + for (Map.Entry> entry : groupedData.entrySet()) { + String key = entry.getKey(); + List valueList = entry.getValue(); + String[] keys = key.split("\\|"); + + if (keys.length != 3) { + log.warn("Invalid key format: {}", key); + continue; + } + + try { + // 创建或获取一级分类 + Long parentId = createOrGetCategory(keys[0], 0L, "1", type); + + // 创建或获取二级分类 + Long level2Id = createOrGetCategory(keys[1], parentId, "2", type); + + // 创建或获取三级分类 + Long level3Id = createOrGetCategory(keys[2], level2Id, "3", type); + + // 处理四级分类和机具信息 + processLevel4Items(formDate, valueList, level3Id, keys, typeMapper, machineMapper); + + } catch (Exception e) { + log.error("Failed to process category: {}", key, e); + } + } + } + } + + /** + * 创建或获取分类 + * @param name + * @param parentId + * @param level + * @param typeTemplate + * @return + */ + private Long createOrGetCategory(String name, Long parentId, String level, Type typeTemplate) { + Type existing = typeMapper.queryByNameAndParentId(name, parentId); + + if (existing != null) { + return existing.getTypeId(); + } + + Type newType = new Type(); + // 复制通用属性 + BeanUtils.copyProperties(typeTemplate, newType); + + newType.setTypeName(name); + newType.setParentId(parentId); + newType.setLevel(level); + newType.setCreateTime(DateUtils.getNowDate()); + newType.setCreateBy(SecurityUtils.getUserId().toString()); + + int count = typeMapper.insertType(newType); + if (count <= 0) { + throw new RuntimeException("Failed to insert category: " + name); + } + + return newType.getTypeId(); + } + + /** + * 处理四级分类和机具信息 + * @param formDate + * @param items + * @param parentId + * @param categoryKeys + * @param typeMapper + * @param machineMapper + */ + private void processLevel4Items(String formDate, List items, Long parentId, String[] categoryKeys, + TypeMapper typeMapper, MachineMapper machineMapper) { + for (Type item : items) { + item.setLevel("4"); + item.setParentId(parentId); + item.setTypeName(item.getModelCode()); + + Type existing = typeMapper.queryByNameAndParentId(item.getModelCode(), parentId); + + if (existing != null) { + // 更新库存数量 + existing.setStorageNum(item.getStorageNum()); + typeMapper.updateNum(existing); + item.setTypeId(existing.getTypeId()); + } else { + int count = typeMapper.insertType(item); + if (count <= 0) { + throw new RuntimeException("Failed to insert level 4 item: " + item.getModelCode()); + } + } + + // 查询并更新机具信息 + Type queryDto = new Type(); + queryDto.setMaterialName(categoryKeys[0]); + queryDto.setTypeName(categoryKeys[1]); + queryDto.setTypeCode(categoryKeys[2]); + queryDto.setModelCode(item.getModelCode()); + queryDto.setPushTime(formDate); + + List machineList = typeMapper.getMaTypeDetails(queryDto); + + if (CollectionUtils.isNotEmpty(machineList)) { + for (Machine machine : machineList) { + machine.setTypeId(item.getTypeId()); + Machine existingMachine = machineMapper.getMachineById(machine); + if (existingMachine == null) { + // 推送过来的数据默认状态为 在库 + machine.setMaStatus("1"); + machineMapper.insertMachine(machine); + } /*else { + machineMapper.updateMachine(machine); + }*/ + } + } + } + } + +} diff --git a/bonus-modules/bonus-material/src/main/resources/bootstrap-sgzb_bns_local.yml b/bonus-modules/bonus-material/src/main/resources/bootstrap-sgzb_bns_local.yml index be72758f..df6df68f 100644 --- a/bonus-modules/bonus-material/src/main/resources/bootstrap-sgzb_bns_local.yml +++ b/bonus-modules/bonus-material/src/main/resources/bootstrap-sgzb_bns_local.yml @@ -1,6 +1,6 @@ # Tomcat server: - port: 18588 + port: 18589 # Spring spring: diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml index d28a6763..54fa780a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/back/BackApplyInfoMapper.xml @@ -932,4 +932,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bcd.type_id = #{typeId} + + + 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 e6f78732..cd0c4d54 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 @@ -55,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and bu.unit_id = #{unitId} + + and bu.unit_id = #{unitId} + and bp.pro_id = #{projectId} @@ -151,4 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_dict_data sdd where sdd.dict_type="branch_project" and sdd.dict_value = #{id} and sdd.`status` = 0 + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index a50530a4..84dcc5b7 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -542,4 +542,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lod.create_time DESC + + diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml index c097da4c..707ddde9 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml @@ -45,8 +45,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark, lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id, lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.lease_sign_type, - bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus, + lai.pro_id as projectId, bp.pro_name as projectName, tt.task_status as taskStatus, sda.dict_label as taskStatusName, + lai.team_id as teamId, + bt.team_name as teamName, IFNULL(sum(lad.pre_num),0) as preCountNum, IFNULL(sum(lad.al_num),0) as alNum, GROUP_CONCAT(mt1.type_name) as maTypeNames, @@ -56,10 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id left join lease_apply_details lad on lai.id = lad.parent_id - left join tm_task_agreement tta on lai.task_id = tta.task_id - left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id - left join bm_unit bu on bu.unit_id = bai.unit_id - left join bm_project bp on bp.pro_id = bai.project_id + left join bm_project bp on bp.pro_id = lai.pro_id + left join bm_team bt on bt.id = lai.team_id left join sys_dept sd on sd.dept_id = bp.imp_unit left join sys_dict_data sda on tt.task_status = sda.dict_value and sda.dict_type = 'lease_task_status' @@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and lai.lease_type = #{leaseType} and lai.estimate_lease_time = #{estimateLeaseTime} and lai.cost_bearing_party = #{costBearingParty} - and tt.task_type = '2' + and tt.task_type = '2' and lai.lease_style = '1' GROUP BY lai.id ORDER BY tt.task_status,tt.create_time desc @@ -139,6 +139,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lease_type, estimate_lease_time, cost_bearing_party, + team_id, + pro_id, + lease_style, #{code}, @@ -165,6 +168,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{leaseType}, #{estimateLeaseTime}, #{costBearingParty}, + #{teamId}, + #{projectId}, + #{leaseStyle}, @@ -193,6 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lease_type = #{leaseType}, estimate_lease_time = #{estimateLeaseTime}, cost_bearing_party = #{costBearingParty}, + team_id = #{teamId}, + pro_id = #{projectId}, where id = #{id} @@ -302,4 +310,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY lpd.create_time DESC + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml index cc46871f..7f09ff8b 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml @@ -249,6 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" inspect_man, inspect_status, phone, + input_time, #{typeId}, @@ -277,6 +278,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{inspectMan}, #{inspectStatus}, #{phone}, + #{inputTime}, @@ -473,6 +475,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mm.ma_status = '2' and mm.ma_code like concat('%', #{maCode}, '%') + + + delete from ma_machine where ma_code = #{maCode} and type_id = #{typeId} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index d53666a0..5baafcdf 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -609,7 +609,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select type_id as typeId, parent_id as parentId, type_name as typeName, level as level from ma_type - where type_name = #{typeName} and parent_id = #{parentId} and del_flag = '0' + where type_name = #{typeName} + and del_flag = '0' + + and parent_id = #{parentId} + select * from ma_type WHERE type_id = #{record.typeId} @@ -932,4 +946,84 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ma_type WHERE `level` = '1' + + + +