diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairController.java index 06051dc7..863c70b6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairController.java @@ -5,6 +5,7 @@ import com.bonus.common.biz.config.ListPagingUtil; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.ServletUtils; +import com.bonus.common.core.utils.bean.BeanUtils; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; @@ -14,10 +15,13 @@ import com.bonus.common.log.enums.OperaType; import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.material.back.domain.BackApplyInfo; import com.bonus.material.back.domain.vo.BackApplyVo; +import com.bonus.material.basic.domain.ProjUsingRecord; +import com.bonus.material.basic.domain.ProjUsingRecordExport; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.ma.domain.LabelBind; import com.bonus.material.repair.domain.*; import com.bonus.material.repair.domain.vo.*; +import com.bonus.material.repair.service.IRepairAuditDetailsService; import com.bonus.material.repair.service.RepairService; import com.bonus.system.api.domain.SysUser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -35,6 +39,8 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotNull; import java.util.*; +import static com.bonus.common.biz.enums.TmTaskTypeEnum.TM_TASK_REPAIR_AUDIT; + /** * @author syruan */ @@ -46,6 +52,9 @@ public class RepairController extends BaseController { @Resource private RepairService service; + @Resource + private IRepairAuditDetailsService repairAuditDetailsService; + /** * Jackson -- 避免反序列化漏洞 */ @@ -483,6 +492,26 @@ public class RepairController extends BaseController { return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } + @PostMapping("/exportDetails") + @ApiOperation(value = "导出维修任务列表") + public void exportDetails(HttpServletResponse response, RepairTask bean) { + List list = new ArrayList<>(); + List listExport = new ArrayList<>(); + try { + list = service.getRepairQueryList(bean); + //将list复制到exportList + for (RepairTask repairTask : list) { + RepairDetailsExport repairDetailsExport = new RepairDetailsExport(); + BeanUtils.copyProperties(repairTask, repairDetailsExport); + listExport.add(repairDetailsExport); + } + } catch (Exception e) { + list = new ArrayList<>(); + } + ExcelUtil util = new ExcelUtil<>(RepairDetailsExport.class); + util.exportExcel(response, listExport, "机具维修报表", "机具维修报表"); + } + /** * -----------维修审核查询页面接口---------- */ @@ -498,4 +527,36 @@ public class RepairController extends BaseController { List list = service.getRepairAuditQueryList(bean); return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } + + /** + * 导出修试审核任务详情列表 + */ + @PostMapping("/exportAuditDetails") + @SysLog(title = "导出修试审核任务详情列表", businessType = OperaType.EXPORT, module = "机具系统->导出修试审核任务详情列表") + public void exportAuditDetails(HttpServletResponse response, RepairAuditDetails bean) { + if (Objects.isNull(bean)) { + bean = new RepairAuditDetails(); + } + if (Objects.isNull(bean.getTaskType())) { + bean.setTaskType(TM_TASK_REPAIR_AUDIT.getTaskTypeId()); + } + List listExport = new ArrayList<>(); + repairAuditDetailsService.queryTimeCope(bean); + RepairTask repairTask = new RepairTask(); + repairTask.setTaskType(bean.getTaskType()); + repairTask.setTaskStatus(Integer.valueOf(bean.getTaskStatus())); + repairTask.setStartTime(bean.getStartTime()); + repairTask.setEndTime(bean.getEndTime()); + repairTask.setKeyWord(bean.getKeyWord()); + List list = service.getRepairAuditQueryList(repairTask); + for (RepairTask repairTask1 : list){ + RepairAuditDetailsExport repairAuditDetailsExport = new RepairAuditDetailsExport(); + BeanUtils.copyProperties(repairTask1, repairAuditDetailsExport); + listExport.add(repairAuditDetailsExport); + } + + + ExcelUtil util = new ExcelUtil<>(RepairAuditDetailsExport.class); + util.exportExcel(response, listExport, "入库单", "入库单"); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetailsExport.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetailsExport.java new file mode 100644 index 00000000..6eae56d2 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetailsExport.java @@ -0,0 +1,234 @@ +package com.bonus.material.repair.domain; + +import com.bonus.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author syruan + */ +@Data +@ApiModel(value="维修任务") +public class RepairAuditDetailsExport { + + private Long id; + /** + * 任务id + */ + @ApiModelProperty(value = "任务id") + private Long taskId; + + @ApiModelProperty(value = "前置任务id") + private Long preTaskId; + + @ApiModelProperty(value = "任务状态") + private Integer taskStatus; + + @ApiModelProperty(value = "任务类型") + private Integer taskType; + + @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") + private Integer monthOrder; + + @ApiModelProperty(value = "维修拆分层级") + private String level; + + @ApiModelProperty(value = "维修拆分父级id") + private Long parentId; + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", isSequence = true, sort = 0) + private String serialNumber; + + /** + * 退料单位名称 + */ + @ApiModelProperty(value = "退料单位名称") + private String backUnit; + /** + * 退料工程名称 + */ + @ApiModelProperty(value = "退料工程名称") + private String backPro; + /** + * 退料单号 + */ + @ApiModelProperty(value = "退料单号") + private String backCode; + /** + * 维修单号 + */ + @ApiModelProperty(value = "维修单号") + @Excel(name = "维修单号",sort = 2) + private String repairCode; + /** + * 维修机具类型 + */ + @ApiModelProperty(value = "维修机具类型") + @Excel(name = "机具名称",sort = 3) + private String type; + /** + * 规格型号 + */ + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格型号",sort = 4) + private String typeName; + @ApiModelProperty(value = "退料数量") + private BigDecimal returnNum; + /** + * 维修总量 + */ + @ApiModelProperty(value = "维修总量") + @Excel(name = "退料数量",sort = 5) + private BigDecimal repairNum; + /** + * 维修报废数量 + */ + @ApiModelProperty(value = "报废数量") + @Excel(name = "报废数量",sort = 7) + private BigDecimal scrapNum; + @ApiModelProperty(value = "待维修数量") + private BigDecimal beRepairedNum; + /** + * 任务创建人 + */ + @ApiModelProperty(value = "任务创建人") + private String createName; + /** + * 任务创建时间 + */ + @ApiModelProperty(value = "任务创建时间") + @Excel(name = "审核提交时间", sort = 1) + private String createTime; + /** + * 任务创建人 + */ + @ApiModelProperty(value = "任务创建人") + private Long createBy; + /** + * 维修状态 + */ + @ApiModelProperty(value = "维修状态") + private String repairStatus; + /** + * 关键字 + */ + private String keyWord; + /** + * 开始时间 + */ + private String startTime; + /** + * 结束时间 + */ + private String endTime; + + @ApiModelProperty(value = "组织id") + private Long companyId; + + @ApiModelProperty(value = "协议id") + private Long agreementId; + + @ApiModelProperty(value = "维修状态编码CODE") + private String repairStatusCode; + + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + private String code; + + /** + * 维修合格数量 + */ + @ApiModelProperty(value = "维修合格数量") + @Excel(name = "合格数量",sort = 6) + private BigDecimal repairedNum; + + /** + * 待修状态 + */ + @ApiModelProperty(value = "待修状态") + private String status; + /** + * 维修人员 + */ + @ApiModelProperty(value = "维修人员") + private String repairer; + /** + * 维修时间 + */ + @ApiModelProperty(value = "维修时间") + private String updateTime; + + /** 导出选中列表 */ + @ApiModelProperty(value = "导出选中列表") + private List dataCondition; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "app维修任务状态,0 进行中 1已审核(包含通过和驳回)") + private Integer appTaskStatus; + + /** + * 退料人 + */ + private String backPerson; + + private List ids; + + private List taskIds; + + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "一级类型id") + private String firstId; + + /** + * 数据状态 0-未定损,1-已定损 3-修饰后入库驳回 + */ + private String dataStatus; + + private Integer num; + + @ApiModelProperty(value = "退料ID") + private Long backId; + + /** + * 签名地址 + */ + @ApiModelProperty(value = "签名地址") + private String signUrl; + + @ApiModelProperty(value = "签名类型 手写0 和 图片上传1") + private int signType; + + /** + * 维修完成时间 + */ + private String repairTime; + + /** + * 单位 + */ + private String unit; + + @ApiModelProperty(value = "单位id") + private Long unitId; + + @ApiModelProperty(value="工程id") + private Long proId; + + @ApiModelProperty(value = "类型id") + private String typeId; + + @ApiModelProperty(value = "规格id") + private String typeModelId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairDetailsExport.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairDetailsExport.java new file mode 100644 index 00000000..05c0e030 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairDetailsExport.java @@ -0,0 +1,239 @@ +package com.bonus.material.repair.domain; + +import com.bonus.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author syruan + */ +@Data +@ApiModel(value="维修任务") +public class RepairDetailsExport { + + private Long id; + /** + * 任务id + */ + @ApiModelProperty(value = "任务id") + private Long taskId; + + @ApiModelProperty(value = "前置任务id") + private Long preTaskId; + + @ApiModelProperty(value = "任务状态") + private Integer taskStatus; + + @ApiModelProperty(value = "任务类型") + private Integer taskType; + + @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") + private Integer monthOrder; + + @ApiModelProperty(value = "维修拆分层级") + private String level; + + @ApiModelProperty(value = "维修拆分父级id") + private Long parentId; + + @ApiModelProperty(value = "序号") + @Excel(name = "序号", isSequence = true, sort = 0) + private String serialNumber; + + /** + * 退料单位名称 + */ + @ApiModelProperty(value = "退料单位名称") + @Excel(name = "退料单位名称",sort = 4) + private String backUnit; + /** + * 退料工程名称 + */ + @ApiModelProperty(value = "退料工程名称") + @Excel(name = "退料工程名称",sort = 5) + private String backPro; + /** + * 退料单号 + */ + @ApiModelProperty(value = "退料单号") + @Excel(name = "退料单号",sort = 3) + private String backCode; + /** + * 维修单号 + */ + @ApiModelProperty(value = "维修单号") + @Excel(name = "维修单号",sort = 2) + private String repairCode; + /** + * 维修机具类型 + */ + @ApiModelProperty(value = "维修机具类型") + @Excel(name = "机具名称",sort = 6) + private String type; + /** + * 规格型号 + */ + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格型号",sort = 7) + private String typeName; + @ApiModelProperty(value = "退料数量") + private BigDecimal returnNum; + /** + * 维修总量 + */ + @ApiModelProperty(value = "维修总量") + @Excel(name = "维修数量",sort = 10) + private BigDecimal repairNum; + /** + * 维修报废数量 + */ + @ApiModelProperty(value = "报废数量") + @Excel(name = "报废数量",sort = 12) + private BigDecimal scrapNum; + @ApiModelProperty(value = "待维修数量") + private BigDecimal beRepairedNum; + /** + * 任务创建人 + */ + @ApiModelProperty(value = "任务创建人") + private String createName; + /** + * 任务创建时间 + */ + @ApiModelProperty(value = "任务创建时间") + private String createTime; + /** + * 任务创建人 + */ + @ApiModelProperty(value = "任务创建人") + private Long createBy; + /** + * 维修状态 + */ + @ApiModelProperty(value = "维修状态") + @Excel(name = "维修状态",sort = 9) + private String repairStatus; + /** + * 关键字 + */ + private String keyWord; + /** + * 开始时间 + */ + private String startTime; + /** + * 结束时间 + */ + private String endTime; + + @ApiModelProperty(value = "组织id") + private Long companyId; + + @ApiModelProperty(value = "协议id") + private Long agreementId; + + @ApiModelProperty(value = "维修状态编码CODE") + private String repairStatusCode; + + + /** + * 编码 + */ + @ApiModelProperty(value = "编码") + private String code; + + /** + * 维修合格数量 + */ + @ApiModelProperty(value = "维修合格数量") + @Excel(name = "维修合格数量",sort = 11) + private BigDecimal repairedNum; + + /** + * 待修状态 + */ + @ApiModelProperty(value = "待修状态") + private String status; + /** + * 维修人员 + */ + @ApiModelProperty(value = "维修人员") + private String repairer; + /** + * 维修时间 + */ + @ApiModelProperty(value = "维修时间") + private String updateTime; + + /** 导出选中列表 */ + @ApiModelProperty(value = "导出选中列表") + private List dataCondition; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "app维修任务状态,0 进行中 1已审核(包含通过和驳回)") + private Integer appTaskStatus; + + /** + * 退料人 + */ + private String backPerson; + + private List ids; + + private List taskIds; + + @ApiModelProperty(value = "登录用户id") + private Long userId; + + @ApiModelProperty(value = "一级类型id") + private String firstId; + + /** + * 数据状态 0-未定损,1-已定损 3-修饰后入库驳回 + */ + private String dataStatus; + + private Integer num; + + @ApiModelProperty(value = "退料ID") + private Long backId; + + /** + * 签名地址 + */ + @ApiModelProperty(value = "签名地址") + private String signUrl; + + @ApiModelProperty(value = "签名类型 手写0 和 图片上传1") + private int signType; + + /** + * 维修完成时间 + */ + @Excel(name = "维修时间",sort = 1) + private String repairTime; + + /** + * 单位 + */ + @Excel(name = "单位",sort = 8) + private String unit; + + @ApiModelProperty(value = "单位id") + private Long unitId; + + @ApiModelProperty(value="工程id") + private Long proId; + + @ApiModelProperty(value = "类型id") + private String typeId; + + @ApiModelProperty(value = "规格id") + private String typeModelId; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index aff744df..8c7c287d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -1973,6 +1973,13 @@ public class RepairServiceImpl implements RepairService { @Override public List getRepairQueryList(RepairTask bean) { try { + Long userId = SecurityUtils.getLoginUser().getUserid(); + Set userRoles = SecurityUtils.getLoginUser().getRoles(); + // 检查用户是否具有特殊角色 + boolean hasSpecialRole = hasSpecialRole(userRoles); + if (!hasSpecialRole) { + bean.setUserId(userId == 0 ? null : userId); + } return repairMapper.getRepairQueryList(bean); } catch (Exception e) { log.error("查询修试查询列表", e.getMessage()); @@ -1983,6 +1990,13 @@ public class RepairServiceImpl implements RepairService { @Override public List getRepairAuditQueryList(RepairTask bean) { try { + Long userId = SecurityUtils.getLoginUser().getUserid(); + Set userRoles = SecurityUtils.getLoginUser().getRoles(); + // 检查用户是否具有特殊角色 + boolean hasSpecialRole = hasSpecialRole(userRoles); + if (!hasSpecialRole) { + bean.setUserId(userId == 0 ? null : userId); + } return repairMapper.getRepairAuditQueryList(bean); } catch (Exception e) { log.error("查询修试查询列表", e.getMessage()); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml index ad6bcd10..d6d9ebb0 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairMapper.xml @@ -1687,6 +1687,9 @@ LEFT JOIN back_apply_info bai ON rad.back_id = bai.id LEFT JOIN ma_type mt on mt.type_id=rad.type_id LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id + + JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId} + WHERE rad.is_ds = 0 @@ -1714,6 +1717,15 @@ and mt.type_id = #{typeModelId} + + AND tt.task_status = #{repairStatus} + + + and (tt.task_status = 3 or tt.task_status = 4) + + + and (tt.task_status = 1 or tt.task_status = 2) + GROUP BY rad.task_id,rad.type_id ORDER BY tt.create_time desc @@ -1731,6 +1743,9 @@ LEFT JOIN tm_task tt2 ON tt2.task_id = rad.repair_id LEFT JOIN ma_type mt ON rad.type_id = mt.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id + + JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId} + WHERE tt.create_time < '2025-08-20 00:00:00' AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59') @@ -1748,6 +1763,9 @@ and mt.type_id = #{typeModelId} + + AND tt.task_status = #{taskStatus} + GROUP BY rad.task_id, rad.type_id UNION @@ -1764,6 +1782,9 @@ LEFT JOIN tm_task tt2 ON tt2.task_id = tt.pre_task_id LEFT JOIN ma_type mt ON rad.type_id = mt.type_id LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id + + JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId} + WHERE tt.create_time >= '2025-08-20 00:00:00' AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59') @@ -1781,6 +1802,9 @@ and mt.type_id = #{typeModelId} + + AND tt.task_status = #{taskStatus} + GROUP BY rad.task_id, rad.type_id) a order by createTime desc