From 260bf92be17f56ad203f56668ba78a3571c23c15 Mon Sep 17 00:00:00 2001 From: mashuai Date: Fri, 10 Oct 2025 12:10:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=90=E6=96=99=E7=AB=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialLeaseInfoController.java | 31 ++- .../controller/MaterialMachineController.java | 26 +- .../lease/MaterialLeaseApplyDetailExport.java | 131 ++++++++++ .../domain/vo/SafeMaterialEquipmentInfo.java | 245 ++++++++++++++++++ .../clz/mapper/MaterialLeaseInfoMapper.java | 15 ++ .../clz/mapper/MaterialMachineMapper.java | 2 +- .../clz/service/MaterialLeaseInfoService.java | 12 +- .../clz/service/MaterialMachineService.java | 4 +- .../service/impl/ClzDirectServiceImpl.java | 5 +- .../impl/MaterialLeaseInfoServiceImpl.java | 109 ++++++-- .../impl/MaterialMachineServiceImpl.java | 68 +++-- .../material/clz/MaterialLeaseInfoMapper.xml | 139 +++++++++- .../material/clz/MaterialMachineMapper.xml | 16 +- 13 files changed, 739 insertions(+), 64 deletions(-) create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyDetailExport.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/SafeMaterialEquipmentInfo.java diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java index cfa42f3c..51fbcd5b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialLeaseInfoController.java @@ -3,6 +3,7 @@ package com.bonus.material.clz.controller; import cn.hutool.core.convert.Convert; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; @@ -11,11 +12,8 @@ import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.enums.OperaType; import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.basic.domain.BmQrcodeInfo; +import com.bonus.material.clz.domain.lease.*; import com.bonus.material.common.annotation.PreventRepeatSubmit; -import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo; -import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo; -import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails; -import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo; import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo; import com.bonus.material.clz.domain.vo.lease.MaterialLeaseApplyRequestVo; import com.bonus.material.clz.service.MaterialLeaseInfoService; @@ -66,6 +64,29 @@ public class MaterialLeaseInfoController extends BaseController { return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } + /** + * 综合查询--导出材料站领料记录 + * @param response + * @param bean + */ + @ApiOperation(value = "综合查询--导出材料站领料记录") + @PostMapping("/exportTotalList") + public void exportSafeDetailsList(HttpServletResponse response, MaterialLeaseApplyInfo bean) { + String fileName = "领料记录"; + if (bean.getStartTime() != null && bean.getEndTime() != null) { + fileName = "领料记录"+ "(领料时间" +bean.getStartTime() + "至" + bean.getEndTime()+ ")"; + } + List list = materialLeaseInfoService.getTotalDetailsList(bean); + // 根据list集合数,去填充序号 + for (int i = 0; i < list.size(); i++) { + list.get(i).setSeq(i + 1); + } + ExcelUtil util = new ExcelUtil<>(MaterialLeaseApplyDetailExport.class); + // 获取当前年月日时分秒导出时间,用括号拼接在后面 + String title = "材料站领料记录" + "(" + DateUtils.getTime() + ")"; + util.exportExcel(response, list, fileName, title); + } + /** * 领料任务添加备注 * @param leaseApplyInfo @@ -343,7 +364,7 @@ public class MaterialLeaseInfoController extends BaseController { bean.setIsExport(0); List list = materialLeaseInfoService.getLeaseInfoDetails(bean); ExcelUtil util = new ExcelUtil<>(LeaseTotalInfo.class); - util.exportExcel(response, list, "综合查询--工器具领料记录查询"); + util.exportExcel(response, list, "综合查询--工器具领料记录查询", "工器具领料记录查询"); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialMachineController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialMachineController.java index 4e0243c8..fe768efa 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialMachineController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/controller/MaterialMachineController.java @@ -3,6 +3,7 @@ package com.bonus.material.clz.controller; import cn.hutool.core.convert.Convert; import com.alibaba.nacos.common.utils.CollectionUtils; import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; @@ -256,10 +257,33 @@ public class MaterialMachineController extends BaseController { @GetMapping("/getSafeDetailsList") public AjaxResult getSafeDetailsList(MaterialRetainedEquipmentInfo bean) { startPage(); - List list = materialMachineService.getSafeDetailsList(bean); + List list = materialMachineService.getSafeDetailsList(bean); return AjaxResult.success(getDataTable(list)); } + /** + * 导出工器具预警页面查询 + * @param response + * @param bean + */ + @ApiOperation(value = "综合查询--导出工器具预警页面查询") + @PostMapping("/exportSafeDetailsList") + public void exportSafeDetailsList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) { + String fileName = "预警记录"; + if (bean.getStartTime() != null && bean.getEndTime() != null) { + fileName = "预警记录"+ "(检验时间" +bean.getStartTime() + "至" + bean.getEndTime()+ ")"; + } + List list = materialMachineService.getSafeDetailsList(bean); + // 根据list集合数,去填充序号 + for (int i = 0; i < list.size(); i++) { + list.get(i).setSeq(i + 1); + } + ExcelUtil util = new ExcelUtil<>(SafeMaterialEquipmentInfo.class); + // 获取当前年月日导出时间,用括号拼接在后面 + String title = "工器具预警记录" + "(" + DateUtils.getTime() + ")"; + util.exportExcel(response, list, fileName, title); + } + /** * 安全工器具预警页面查询获取协议id * @param bean diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyDetailExport.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyDetailExport.java new file mode 100644 index 00000000..33c25588 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/lease/MaterialLeaseApplyDetailExport.java @@ -0,0 +1,131 @@ +package com.bonus.material.clz.domain.lease; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 领料任务对象 lease_apply_info + * + * @author xsheng + * @date 2024-10-16 + */ + +@EqualsAndHashCode(callSuper = false) +@Data +@ToString +public class MaterialLeaseApplyDetailExport extends BaseEntity{ + + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + private int number; + + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5) + private Integer seq; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date releaseTime; + + @ApiModelProperty(value = "分公司") + @Excel(name = "分公司") + private String impUnitName; + + @ApiModelProperty(value = "领料单位") + @Excel(name = "领料单位", width = 30) + private String leaseUnit; + + @ApiModelProperty(value = "工程名称") + @Excel(name = "领料工程", width = 30) + private String leaseProject; + + @ApiModelProperty(value = "物资仓库") + private String materialName; + + @ApiModelProperty(value = "物资名称") + @Excel(name = "物资名称") + private String typeModelName; + + @ApiModelProperty(value = "物资型号") + @Excel(name = "物资型号") + private String typeName; + + @ApiModelProperty(value = "单位") + @Excel(name = "单位") + private String unitName; + + @ApiModelProperty(value = "领料数量") + @Excel(name = "领料数量", cellType = Excel.ColumnType.NUMERIC) + private BigDecimal alNum; + + @ApiModelProperty(value = "出库数量") + @Excel(name = "出库数量", cellType = Excel.ColumnType.NUMERIC) + private BigDecimal outNum; + + @ApiModelProperty(value = "出库时间") + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "出库时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date outTime; + + @ApiModelProperty(value = "出库方式") + @Excel(name = "出库方式") + private String manageTypeName; + + /** 任务编号: 领料单号 */ + @ApiModelProperty(value = "领料单号") + @Excel(name = "领料单号") + private String code; + + /** 领料人 */ + @Excel(name = "领料人") + @ApiModelProperty(value = "领料人") + private String leasePerson; + + /** 任务状态(定义数据字典) */ + @ApiModelProperty(value = "任务状态(定义数据字典)") + private Integer taskStatus; + + @ApiModelProperty(value = "任务状态(定义数据字典)") + private String taskStatusName; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "关键字") + private String keyWord; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "任务状态列表") + private List statusList; + + private String businessCode; + + @ApiModelProperty(value = "实施单位") + private String impUnit; + + @ApiModelProperty(value = "身份证号码") + private String idCard; + + @ApiModelProperty(value="工程id") + private Long proId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/SafeMaterialEquipmentInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/SafeMaterialEquipmentInfo.java new file mode 100644 index 00000000..21710403 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/domain/vo/SafeMaterialEquipmentInfo.java @@ -0,0 +1,245 @@ +package com.bonus.material.clz.domain.vo; + +import com.bonus.common.core.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** +* @description 综合查询--保有设备总量查询 +* @author ma_sh +* @date 2024/2/26 14:51 +*/ +@ApiModel(description = "保有设备总量查询") +@Data +public class SafeMaterialEquipmentInfo { + + private static final long serialVersionUID = 2227217051604273598L; + + @ApiModelProperty(value = "是否app 0 是,1 否") + private Integer isApp; + + @ApiModelProperty(value = "是否导出 0 是,1 否") + private Integer isExport; + + @ApiModelProperty(value = "主键id") + private Integer id; + + @ApiModelProperty(value = "仓库信息") + private String whHouseName; + + @ApiModelProperty(value = "工程id") + private String proId; + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5) + private Integer seq; + + @ApiModelProperty(value = "分公司") + @Excel(name = "分公司") + private String impUnitName; + + @ApiModelProperty(value = "项目部") + @Excel(name = "项目部", width = 25) + private String departName; + + @ApiModelProperty(value = "项目部id") + private String departId; + + @ApiModelProperty(value = "工程名称") + @Excel(name = "工程名称", width = 60) + private String proName; + + @ApiModelProperty(value = "分包单位") + @Excel(name = "分包单位", width = 25) + private String subUnitName; + + @ApiModelProperty(value = "班组名称") + @Excel(name = "班组名称") + private String teamName; + + @ApiModelProperty(value = "物资类型") + @Excel(name = "物资类型") + private String materialName; + + @ApiModelProperty(value = "物资名称") + @Excel(name = "物资名称") + private String typeName; + + @ApiModelProperty(value = "规格ID") + private Integer typeId; + + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格型号") + private String typeModelName; + + @Excel(name = "设备编号") + private String maCode; + + + + /** 本次检验日期 */ + @ApiModelProperty(value = "本次检验日期") + @DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "本次检验时间", width = 20, align = HorizontalAlignment.CENTER, dateFormat = "yyyy-MM-dd") + private Date thisCheckTime; + + /** 下次检验日期 */ + @ApiModelProperty(value = "下次检验日期") + @DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "下次检验时间", width = 20, align = HorizontalAlignment.CENTER, dateFormat = "yyyy-MM-dd") + private Date nextCheckTime; + + @ApiModelProperty(value = "二维码code") + @Excel(name = "二维码") + private String qrCode; + + /** + * 状态(0 =正常,1= 3个月检测到期,2= 1个月检测到期,3= 已过期) + */ + @Excel(name = "状态", width = 20, readConverterExp = "0=正常,1=3个月检测到期,2=1个月检测到期,3=已过期") + private String status; + + @ApiModelProperty("机具类型(1机具,2安全工器具)") + private String jiJuType; + + @ApiModelProperty(value = "计量单位") + private String unit; + + @ApiModelProperty(value = "在库数量") + private BigDecimal storeNum; + + @ApiModelProperty(value = "在用数量") + private BigDecimal usNum; + + @ApiModelProperty(value = "数量") + private BigDecimal allNum; + + @ApiModelProperty(value = "管理模式") + private String manageType; + + @ApiModelProperty(value = "创建者") + private String createBy; + + @ApiModelProperty(value = "创建时间") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @ApiModelProperty(value = "更新者") + private String updateBy; + + @ApiModelProperty(value = "更新时间 ") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + @ApiModelProperty(value = "关键字") + private String keyWord; + + @ApiModelProperty(value = "数据所属组织") + private Integer companyId; + + /** 1.机具仓储 2.调试仓储 */ + private String maType; + + private String maTypeName; + + /** + * 是否伸展(APP) + */ + private boolean expanded = false; + + /** + * 检验状态 + */ + private String checkStatus; + + + + + + /** 正常设备数量 */ + private long normalNum; + + /** 3个月检测到期设备数量 */ + private long threeMonthNum; + + /** 1个月检测到期设备数量 */ + private long oneMonthNum; + + /** 已过期设备数量 */ + private long expiredNum; + + @ApiModelProperty(value = "班组id") + private String teamId; + + /** + * 班组长账号 + */ + private String teamLeaderIdCard; + + @ApiModelProperty(value = "i8工程id") + private String externalId; + + @ApiModelProperty(value = "身份证号码") + private String idCard; + + @ApiModelProperty(value = "实施单位id") + private String impUnit; + + /** + * i8工程id集合 + */ + private List projectIdList; + + @ApiModelProperty(value = "协议id集合") + private List agreementIdList; + + private Long maId; + + @ApiModelProperty(value = "领料人") + private String code; + + @ApiModelProperty(value = "领料人") + private String leasePerson; + + @ApiModelProperty(value = "协议id") + private Long agreementId; + + private Long deptId; + + @ApiModelProperty(value = "项目部名称") + private String proCenter; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "0整型 1小数") + private String unitValue; + + private String unitType; + + @ApiModelProperty(value = "报告编码") + private String reportCode; + + @ApiModelProperty(value = "报告路径") + private String reportUrl; + + @ApiModelProperty(value = "协议id") + private String agreementIds; + + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java index dba18a49..6f45c74f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/mapper/MaterialLeaseInfoMapper.java @@ -7,6 +7,7 @@ import com.bonus.material.basic.domain.BmAgreementInfo; import com.bonus.material.basic.domain.BmQrcodeInfo; import com.bonus.material.clz.domain.TeamVo; import com.bonus.material.clz.domain.direct.ClzDirectApplyDetails; +import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetailExport; import com.bonus.material.clz.domain.vo.MaterialMaCodeVo; import com.bonus.material.ma.domain.Type; import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo; @@ -461,4 +462,18 @@ public interface MaterialLeaseInfoMapper { * @return */ List getJcTeamInfo(MaterialLeaseApplyDetails materialLeaseApplyDetails); + + /** + * 领料列表查询 + * @param bean + * @return + */ + List selectLeaseApplyLL(MaterialLeaseApplyInfo bean); + + /** + * 领用列表查询 + * @param bean + * @return + */ + List selectLeaseApplyLY(MaterialLeaseApplyInfo bean); } 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 8c883b4a..5d3eb3b5 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 @@ -128,7 +128,7 @@ public interface MaterialMachineMapper { * @param bean * @return */ - List getTotalList(MaterialRetainedEquipmentInfo bean); + List getTotalList(MaterialRetainedEquipmentInfo bean); /** * 班组库存查询 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialLeaseInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialLeaseInfoService.java index 364071cf..d68a40b2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialLeaseInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialLeaseInfoService.java @@ -3,10 +3,7 @@ package com.bonus.material.clz.service; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.basic.domain.BmQrcodeInfo; -import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo; -import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo; -import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails; -import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo; +import com.bonus.material.clz.domain.lease.*; import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo; import com.bonus.material.clz.domain.vo.lease.MaterialLeaseApplyRequestVo; @@ -167,4 +164,11 @@ public interface MaterialLeaseInfoService { * @return */ AjaxResult getLeaseDataByCode(LeaseTotalInfo info); + + /** + * 导出材料站领料记录 + * @param bean + * @return + */ + List getTotalDetailsList(MaterialLeaseApplyInfo bean); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialMachineService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialMachineService.java index 6dc15de7..4a3f327f 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialMachineService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/MaterialMachineService.java @@ -83,7 +83,7 @@ public interface MaterialMachineService { * @param bean * @return */ - List getSafeDetailsList(MaterialRetainedEquipmentInfo bean); + List getSafeDetailsList(MaterialRetainedEquipmentInfo bean); /** * 后台班组在用库存查询 @@ -111,7 +111,7 @@ public interface MaterialMachineService { * @param bean * @return */ - MaterialRetainedEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean); + SafeMaterialEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean); /** * 安全工器具预警页面查询获取协议id diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzDirectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzDirectServiceImpl.java index 6069d24d..49181ebf 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzDirectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/ClzDirectServiceImpl.java @@ -739,7 +739,8 @@ public class ClzDirectServiceImpl implements ClzDirectService { if (history.getNextNodeId() != null && history.getNextNodeId() == 43) { userList = directAuditMapper.getProjectId(directApplyInfo.getLeaseTeamId()); } - if (history.getNextNodeId() != null && history.getNextNodeId() == 44) { + // 项目经理审核 + /*if (history.getNextNodeId() != null && history.getNextNodeId() == 44) { //根据project_id获取external_id String externalId = directAuditMapper.getExternalId(Integer.parseInt(directApplyInfo.getLeaseProId())); if (externalId != null && !externalId.isEmpty()) { @@ -751,7 +752,7 @@ public class ClzDirectServiceImpl implements ClzDirectService { userList = directAuditMapper.getUserIdByUserName(leaderAccount); } } - } + }*/ String userIds = userList.stream().map(WorkPeopleInfo::getUserId).map(String::valueOf).collect(Collectors.joining(",")); history.setDirectUserIds(userIds); history.setRemark(directApplyInfo.getRemark()); 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 ced1bc2c..95e8cb7b 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 @@ -6,7 +6,6 @@ import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.biz.domain.TypeTreeBuild; 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.domain.lease.LeaseOutSign; import com.bonus.common.biz.domain.lease.MaterialLeaseMaCodeDto; @@ -18,16 +17,14 @@ import com.bonus.common.core.utils.DateUtils; 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.BackApplyInfo; 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.mapper.BmAgreementInfoMapper; import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.clz.domain.BmTeam; +import com.bonus.material.clz.domain.lease.*; import com.bonus.material.clz.domain.vo.MaterialMaCodeVo; -import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo; -import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo; import com.bonus.material.clz.mapper.BmTeamMapper; import com.bonus.material.clz.mapper.IwsTeamUserMapper; import com.bonus.material.clz.mapper.MaterialMachineMapper; @@ -36,10 +33,6 @@ import com.bonus.material.common.domain.vo.AgreementVo; import com.bonus.material.common.mapper.SelectMapper; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.mapper.TypeMapper; -import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo; -import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo; -import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails; -import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo; import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo; import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo; import com.bonus.material.clz.domain.vo.lease.MaterialLeaseApplyRequestVo; @@ -265,10 +258,12 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { if (teamData == null) { // 根据用户名查询项目部信息 List departId = mapper.getDepartId(username); - // 根据项目部id查询工程信息 - List projectIdList = mapper.getAllProjectList(departId); - if (!CollectionUtils.isEmpty(projectIdList)) { - leaseApplyInfo.setProjectIdList(projectIdList); + if (!CollectionUtils.isEmpty(departId)) { + // 根据项目部id查询工程信息 + List projectIdList = mapper.getAllProjectList(departId); + if (!CollectionUtils.isEmpty(projectIdList)) { + leaseApplyInfo.setProjectIdList(projectIdList); + } } } } @@ -295,14 +290,16 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { } // 使用 Stream API 进行降序排序 List sortedList = list.stream() - .sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime, + .sorted(Comparator.comparing(MaterialLeaseApplyInfo::getLeaseTime, Comparator.nullsLast(Comparator.naturalOrder())).reversed()) .collect(Collectors.toList()); if (!hasSpecialRole) { - Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); - if (!CollectionUtils.isEmpty(sortedList) && deptId != null) { - // 删除元素 - sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit())); + if (teamData == null) { + Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); + if (!CollectionUtils.isEmpty(sortedList) && deptId != null) { + // 删除元素 + sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit())); + } } } if (!CollectionUtils.isEmpty(sortedList)) { @@ -433,6 +430,84 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService { } } + /** + * 获取总站点领料详情列表 + * @param bean + * @return + */ + @Override + public List getTotalDetailsList(MaterialLeaseApplyInfo bean) { + Set userRoles = SecurityUtils.getLoginUser().getRoles(); + String username = SecurityUtils.getLoginUser().getUsername(); + BmTeam teamData = new BmTeam(); + // 检查用户是否具有特殊角色 + boolean hasSpecialRole = hasSpecialRole(userRoles); + if (!hasSpecialRole) { + // 根据用户名判断用户是否为班组长 + teamData = materialMachineMapper.getTeamData(username); + if (teamData == null) { + // 根据用户名查询项目部信息 + List departId = mapper.getDepartId(username); + if (!CollectionUtils.isEmpty(departId)) { + // 根据项目部id查询工程信息 + List projectIdList = mapper.getAllProjectList(departId); + if (!CollectionUtils.isEmpty(projectIdList)) { + bean.setProjectIdList(projectIdList); + } + } + } + } + // 领料数据 + List list = materialLeaseInfoMapper.selectLeaseApplyLL(bean); + + // 查询领用数据 + List leaseApplyOutList = materialLeaseInfoMapper.selectLeaseApplyLY(bean); + if (!CollectionUtils.isEmpty(leaseApplyOutList)) { + list.addAll(leaseApplyOutList); + } + // 使用 Stream API 进行降序排序 + List sortedList = list.stream() + .sorted(Comparator.comparing(MaterialLeaseApplyDetailExport::getCreateTime, + Comparator.nullsLast(Comparator.naturalOrder())).reversed()) + .collect(Collectors.toList()); + if (!hasSpecialRole) { + if (teamData == null) { + Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); + if (!CollectionUtils.isEmpty(sortedList) && deptId != null) { + // 删除元素 + sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit())); + } + } + } + if (!CollectionUtils.isEmpty(sortedList)) { + // 班组数据权限 + if (teamData != null) { + // 将sortedList中班组身份证号与username相同的元素过滤处理 + sortedList = sortedList.stream() + .filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) + .collect(Collectors.toList()); + } + } + if (!CollectionUtils.isEmpty(sortedList)) { + // 查询所有未结算的工程 + List projectIdList = mapper.getUnsettledProId(); + // 使用 HashSet 来加速查找过程 + Set unsettledProjectIds = new HashSet<>(projectIdList); + // 过滤掉不在未结算工程集合内的设备 + Iterator iterator = sortedList.iterator(); + while (iterator.hasNext()) { + MaterialLeaseApplyDetailExport info = iterator.next(); + String proId = info.getProId() != null ? + info.getProId().toString() : null; + + if (proId == null || !unsettledProjectIds.contains(proId)) { + iterator.remove(); + } + } + } + return sortedList; + } + private List getMachineByProIdAndTypeId(Long proId,Long typeId){ MaterialLeaseApplyInfo dto = new MaterialLeaseApplyInfo(); dto.setProId(proId); 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 9f4932e1..c3f7b133 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 @@ -43,9 +43,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { @Resource private SelectMapper mapper; - @Resource - private IwsTeamUserMapper iwsTeamUserMapper; - /** * 获取机具追溯管理数据 * @param machine @@ -603,35 +600,45 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { * @return */ @Override - public List getSafeDetailsList(MaterialRetainedEquipmentInfo bean) { - bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId()); - List usList = materialMachineMapper.getTotalList(bean); - for (MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo : usList) { - // 根据班组名称查询分包单位 - String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName()); - materialRetainedEquipmentInfo.setSubUnitName(subUnitName); - } - if(bean.getSubUnitName()!=null && !"".equals(bean.getSubUnitName()) && !usList.isEmpty()){ - // 根据传入的SubUnitName过滤列表 - usList = usList.stream() - .filter(item -> StringUtils.equals(item.getSubUnitName(), bean.getSubUnitName())) - .collect(Collectors.toList()); - + public List getSafeDetailsList(MaterialRetainedEquipmentInfo bean) { + List usList = materialMachineMapper.getTotalList(bean); + /*if(CollectionUtils.isNotEmpty(usList)) { // 查询所有未结算的工程 List projectIdList = mapper.getUnsettledProId(); // 使用 HashSet 来加速查找过程 Set unsettledProjectIds = new HashSet<>(projectIdList); // 过滤掉不在未结算工程集合内的工程 - Iterator iterator = usList.iterator(); + Iterator iterator = usList.iterator(); while (iterator.hasNext()) { - MaterialRetainedEquipmentInfo info = iterator.next(); + SafeMaterialEquipmentInfo info = iterator.next(); String proId = info.getProId() != null ? - info.getProId().toString() : null; + info.getProId() : null; if (proId == null || !unsettledProjectIds.contains(proId)) { iterator.remove(); } } + }*/ + String username = SecurityUtils.getLoginUser().getUsername(); + Set userRoles = SecurityUtils.getLoginUser().getRoles(); + BmTeam teamData = new BmTeam(); + // 检查用户是否具有特殊角色 + boolean hasSpecialRole = hasSpecialRole(userRoles); + if (!hasSpecialRole) { + // 根据用户名判断用户是否为班组长 + teamData = materialMachineMapper.getTeamData(username); + if (teamData == null) { + //将deptId和usList对应,删除元素 + Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); + usList.removeIf(m -> !deptId.toString().equals(m.getImpUnit())); + } + } + if (!hasSpecialRole) { + if (teamData != null) { + return usList.stream().filter(item -> { + return StringUtils.isNotBlank(item.getIdCard()) && item.getIdCard().equals(username); + }).collect(Collectors.toList()); + } } return usList; } @@ -642,7 +649,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { * @param keyWord * @return */ - private boolean containsNumKeyword(MaterialRetainedEquipmentInfo item, String keyWord) { + private boolean containsNumKeyword(SafeMaterialEquipmentInfo item, String keyWord) { return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) || (item.getTypeModelName() != null && item.getTypeModelName().contains(keyWord)) || (item.getProName() != null && item.getProName().contains(keyWord)) || @@ -738,10 +745,21 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { * @return */ @Override - public MaterialRetainedEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean) { - MaterialRetainedEquipmentInfo retainedEquipmentInfo = new MaterialRetainedEquipmentInfo(); - bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId()); - List totalList = materialMachineMapper.getTotalList(bean); + public SafeMaterialEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean) { + String username = SecurityUtils.getLoginUser().getUsername(); + Set userRoles = SecurityUtils.getLoginUser().getRoles(); + BmTeam teamData = new BmTeam(); + // 检查用户是否具有特殊角色 + boolean hasSpecialRole = hasSpecialRole(userRoles); + if (!hasSpecialRole) { + // 根据用户名判断用户是否为班组长 + teamData = materialMachineMapper.getTeamData(username); + if (teamData == null) { + bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId()); + } + } + SafeMaterialEquipmentInfo retainedEquipmentInfo = new SafeMaterialEquipmentInfo(); + List totalList = materialMachineMapper.getTotalList(bean); if (!CollectionUtil.isEmpty(totalList)) { if (StringUtils.isNotBlank(bean.getStatus())) { totalList = totalList.stream().filter(item -> StringUtils.isNotBlank(item.getStatus()) && item.getStatus().equals(bean.getStatus())).collect(Collectors.toList()); 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 0e0c4fdc..71a61ea1 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 @@ -607,7 +607,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and tt.task_type = '2' GROUP BY lai.id - ORDER BY tt.create_time desc + ORDER BY lai.create_time desc + + + + 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 4e3da8bc..1068ed77 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 @@ -733,7 +733,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LIMIT 1 - SELECT * FROM ( -- 原查询(包含status计算) SELECT @@ -759,7 +759,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" END AS status, bp.pro_id AS proId, bp.pro_name AS proName, - bu.unit_name AS teamName + bu.unit_name AS teamName, + bu.bzz_idcard AS idCard, + mm.qr_code AS qrCode, + bz.ssfbdw AS subUnitName FROM slt_agreement_info sai LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id @@ -772,10 +775,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN clz_bm_agreement_info cba ON csi.agreement_id = cba.agreement_id LEFT JOIN bm_unit bu ON cba.unit_id = bu.unit_id LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit + LEFT JOIN `micro-tool`.bzgl_bz bz ON bp.external_id = bz.project_id + AND bz.bzmc = bu.unit_name WHERE sai.`status` = '0' + AND sai.is_slt = '0' AND mm.ma_status = 2 - AND mt.jiju_type = 2 AND sai.ma_id IS NOT NULL AND mt2.type_id not in (6032,6008,6270,6012,6761) @@ -805,6 +810,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND bp.imp_unit = #{deptId} + + AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%') + and ( bu.unit_name like concat('%',#{keyWord},'%') or @@ -829,7 +837,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ELSE 1 -- 其他情况排在后面 END ASC, -- 可根据需要添加其他排序字段(如原顺序或时间) - temp.maId ASC -- 示例:按maId升序排列(可选) + temp.nextCheckTime ASC -- 示例:按maId升序排列(可选)