From 5f0709c5a9ed526a9e3b95e75e1838e0b0269507 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 15 Nov 2024 13:16:00 +0800 Subject: [PATCH 01/47] =?UTF-8?q?=E4=BF=AE=E9=A5=B0=E5=AE=A1=E6=A0=B8--?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AE=A1=E6=A0=B8=E9=A9=B3=E5=9B=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RepairAuditDetailsController.java | 16 +++++++++++++++- .../mapper/RepairAuditDetailsMapper.java | 8 ++++++++ .../service/IRepairAuditDetailsService.java | 8 ++++++++ .../impl/RepairAuditDetailsServiceImpl.java | 19 +++++++++++++++++-- .../repair/RepairAuditDetailsMapper.xml | 7 +++++++ 5 files changed, 55 insertions(+), 3 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairAuditDetailsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairAuditDetailsController.java index 2447a78d..4d60b421 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairAuditDetailsController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairAuditDetailsController.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotNull; + import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.repair.domain.RepairPart; @@ -173,7 +175,7 @@ public class RepairAuditDetailsController extends BaseController { /** * 修改修试审核详细 - */ + @ApiOperation(value = "修改修试审核详细") @PreventRepeatSubmit @RequiresPermissions("repair:details:edit") @@ -185,6 +187,18 @@ public class RepairAuditDetailsController extends BaseController { } catch (Exception e) { return error("系统错误, " + e.getMessage()); } + }*/ + + /** + * 批量修改修试审核详细 + */ + @ApiOperation(value = "批量修改修试审核详细") + @PreventRepeatSubmit + @RequiresPermissions("repair:details:edit") + @SysLog(title = "批量修试审核详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->批量修改修试审核详细") + @PutMapping + public AjaxResult edit(@RequestBody @NotNull List repairAuditDetails) { + return toAjax(repairAuditDetailsService.updateRepairAuditDetailsBatch(repairAuditDetails)); } /** diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java index 77313a48..56d12821 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java @@ -61,6 +61,14 @@ public interface RepairAuditDetailsMapper { */ int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails); + /** + * 批量修改修试审核详细--批量 + * + * @param repairAuditDetails 批量修试审核详细 + * @return 结果 + */ + int updateRepairAuditDetailsBatch(@Param("ids") List repairAuditDetails); + /** * 删除修试审核详细 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/IRepairAuditDetailsService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/IRepairAuditDetailsService.java index 02166752..722bd7dc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/IRepairAuditDetailsService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/IRepairAuditDetailsService.java @@ -80,6 +80,14 @@ public interface IRepairAuditDetailsService { */ int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails); + /** + * 批量修改修试审核详细 + * + * @param repairAuditDetails 修试审核详细集合 + * @return 结果 + */ + int updateRepairAuditDetailsBatch(List repairAuditDetails); + /** * 批量删除修试审核详细 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index 1e47370a..b11d96e7 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -68,8 +68,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService } /** - * @param repairAuditDetails - * @return + * @param repairAuditDetails 查询参数 */ @Override public List getRepairAuditList(RepairAuditDetails repairAuditDetails) { @@ -445,6 +444,22 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService } } + /** + * 批量修改修试审核详细 + * + * @param repairAuditDetails 修试审核详细 + * @return 结果 + */ + @Override + public int updateRepairAuditDetailsBatch(@NotNull List repairAuditDetails) { + try { + repairAuditDetails.stream().filter(Objects::nonNull).forEach(item -> item.setUpdateTime(DateUtils.getNowDate())); + return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(repairAuditDetails); + } catch (Exception e) { + throw new ServiceException("错误信息描述"); + } + } + /** * 批量删除修试审核详细 * diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml index 111a8241..0271f92d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml @@ -474,4 +474,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY task_id + + + update repair_audit_details set status = #{status} where id in + + #{id} + + \ No newline at end of file From 0f7de5c916bcde3606362a8336ecb75ff755ce23 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 15 Nov 2024 13:54:57 +0800 Subject: [PATCH 02/47] =?UTF-8?q?=E4=BF=AE=E9=A5=B0=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9SQL=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/controller/RepairController.java | 23 ++++++++++--------- .../repair/domain/RepairAuditDetails.java | 2 +- .../mapper/RepairAuditDetailsMapper.java | 4 ++-- .../impl/RepairAuditDetailsServiceImpl.java | 19 +++++++++++---- .../repair/RepairAuditDetailsMapper.xml | 4 +++- 5 files changed, 33 insertions(+), 19 deletions(-) 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 5fe7e31f..4531a2d3 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 @@ -44,7 +44,7 @@ public class RepairController extends BaseController { /** * 获取维修任务列表 */ - @ApiOperation(value = "获取维修任务列表") + @ApiOperation(value = "获取维修任务列表--分页") @GetMapping("/getRepairTaskList") @RequiresPermissions(value = "repair:manage:list") public TableDataInfo getRepairTaskList(RepairTask bean) { @@ -53,6 +53,17 @@ public class RepairController extends BaseController { return getDataTable(list); } + /** + * 获取维修任务列表--不分页--NO_PAGE + */ + @ApiOperation(value = "获取维修任务列表---不分页") + @GetMapping("/getAppRepairTaskList") + @RequiresPermissions("repair:manage:list") + public AjaxResult getAppRepairTaskList(RepairTask bean) { + List list = service.getRepairTaskList(bean); + return AjaxResult.success(list); + } + /** * 导出维修任务列表 */ @@ -65,16 +76,6 @@ public class RepairController extends BaseController { util.exportExcel(response, list, "维修任务列表"); } - /** - * 获取维修任务列表--APP - */ - @ApiOperation(value = "获取维修任务列表---APP") - @GetMapping("/getAppRepairTaskList") - @RequiresPermissions("repair:manage:list") - public AjaxResult getAppRepairTaskList(RepairTask bean) { - List list = service.getRepairTaskList(bean); - return AjaxResult.success(list); - } /** * 获取维修任务物资设备列表--不分页 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java index 98a460f8..5d4504ac 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairAuditDetails.java @@ -91,7 +91,7 @@ public class RepairAuditDetails extends BaseEntity { /** 0未审核1已审核2驳回 */ @Excel(name = "状态", readConverterExp = "0=未审核,1=已审核,2=驳回") @ApiModelProperty(value = "0未审核1已审核2驳回") - private char status; + private String status; /** 数据所属组织 */ @ApiModelProperty(value = "数据所属组织") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java index 56d12821..fb0f3734 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java @@ -64,10 +64,10 @@ public interface RepairAuditDetailsMapper { /** * 批量修改修试审核详细--批量 * - * @param repairAuditDetails 批量修试审核详细 + * @param ids 批量修试审核详细 * @return 结果 */ - int updateRepairAuditDetailsBatch(@Param("ids") List repairAuditDetails); + int updateRepairAuditDetailsBatch(@Param("ids") List ids, @Param("status") String status); /** * 删除修试审核详细 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index b11d96e7..be40e30b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -311,7 +311,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService if (CollectionUtil.isNotEmpty(auditDetailList)) { for (RepairAuditDetails bean : auditDetailList) { bean.setAuditBy(SecurityUtils.getLoginUser().getUserid()); - bean.setStatus(status); + bean.setStatus(String.valueOf(status)); bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); bean.setAuditRemark(scrapAudit.getRemark()); repairAuditDetailsMapper.updateStatus(bean); @@ -321,7 +321,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService if (auditAllList != null) { for (RepairAuditDetails bean : auditAllList) { bean.setAuditBy(SecurityUtils.getLoginUser().getUserid()); - bean.setStatus(status); + bean.setStatus(String.valueOf(status)); bean.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid())); bean.setAuditRemark(scrapAudit.getRemark()); repairAuditDetailsMapper.updateStatus(bean); @@ -452,9 +452,20 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService */ @Override public int updateRepairAuditDetailsBatch(@NotNull List repairAuditDetails) { + // 提取所有需要更新的 ID + List ids = repairAuditDetails.stream() + .filter(Objects::nonNull) + .map(RepairAuditDetails::getId) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + + if (ids.isEmpty()) { + return 0; + } + try { - repairAuditDetails.stream().filter(Objects::nonNull).forEach(item -> item.setUpdateTime(DateUtils.getNowDate())); - return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(repairAuditDetails); + // 调用 Mapper 方法进行批量更新 + return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids,repairAuditDetails.get(0).getStatus()); } catch (Exception e) { throw new ServiceException("错误信息描述"); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml index 0271f92d..4ab5963d 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml @@ -476,7 +476,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update repair_audit_details set status = #{status} where id in + update repair_audit_details + set status = #{status}, update_time = now() + where id in #{id} From b3a578e91b4e1a34f694ef45b6e52ac521402b10 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Fri, 15 Nov 2024 18:18:17 +0800 Subject: [PATCH 03/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E4=BF=AE=E9=A5=B0=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/common/biz/domain/BaseVO.java | 53 ++++++++++++++ .../biz/enums/RepairTaskStatusEnum.java | 2 +- .../repair/controller/RepairController.java | 17 ++++- .../repair/domain/RepairTaskDetails.java | 15 ++-- .../repair/domain/vo/RepairDeviceListVo.java | 65 +++++++++++++++++ .../repair/domain/vo/RepairDeviceVO.java | 46 ++++++++++++ .../material/repair/mapper/RepairMapper.java | 3 +- .../repair/service/RepairService.java | 5 +- .../impl/RepairAuditDetailsServiceImpl.java | 2 + .../service/impl/RepairServiceImpl.java | 71 +++++++++++++++++-- .../mapper/material/repair/RepairMapper.xml | 3 +- 11 files changed, 262 insertions(+), 20 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/domain/BaseVO.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceListVo.java create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/BaseVO.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/BaseVO.java new file mode 100644 index 00000000..791c5975 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/BaseVO.java @@ -0,0 +1,53 @@ +package com.bonus.common.biz.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.util.Date; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @Description: 基础Base VO + */ +@Getter +@Setter +@ToString +public class BaseVO { + + @ApiModelProperty(value = "关键字") + private String keyword; + + @ApiModelProperty(value = "状态") + private String status; + + @ApiModelProperty(value = "组织id") + private Long companyId; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "创建人") + private String createBy; + + @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @ApiModelProperty(value = "更新人") + private String updateBy; + + @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + +} diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/RepairTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/RepairTaskStatusEnum.java index 19dcb150..58d90ba6 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/RepairTaskStatusEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/RepairTaskStatusEnum.java @@ -13,7 +13,7 @@ public enum RepairTaskStatusEnum { TASK_STATUS_PROCESSING(0, "维修管理--进行中"), TASK_STATUS_COMPLETE(1, "维修管理--已完成"), - TASK_STATUS_REJECT(2, "维修管理--被驳回"), + TASK_STATUS_REJECT(2, "维修管理--驳回退料"), TASK_STATUS_TO_EXAM(3, "修饰审核--待审核"), TASK_STATUS_REVIEW(4, "修饰审核--审核通过"), TASK_STATUS_NO_REVIEW(5, "修饰审核--审核不通过"), 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 4531a2d3..3419966d 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 @@ -10,6 +10,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord; import com.bonus.material.repair.domain.RepairPartDetails; import com.bonus.material.repair.domain.RepairTask; import com.bonus.material.repair.domain.RepairTaskDetails; +import com.bonus.material.repair.domain.vo.RepairDeviceListVo; import com.bonus.material.repair.service.RepairService; import com.bonus.system.api.domain.SysUser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -23,6 +24,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotNull; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -65,7 +67,7 @@ public class RepairController extends BaseController { } /** - * 导出维修任务列表 + * 导出维修任务列表--外层--壹级列表 */ @PostMapping("/export") @RequiresPermissions("repair:manage:export") @@ -85,7 +87,7 @@ public class RepairController extends BaseController { @RequiresPermissions("repair:manage:preview") public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) { startPage(); - List list = service.getRepairMaTypeList(bean); + List list = service.getRepairMaTypeList(bean); return getDataTable(list); } @@ -95,7 +97,7 @@ public class RepairController extends BaseController { @ApiOperation(value = "获取维修物资设备列表---不分页") @GetMapping("/getAppRepairMaTypeList") public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) { - List list = service.getRepairMaTypeList(bean); + List list = service.getRepairMaTypeList(bean); return AjaxResult.success(list); } @@ -142,6 +144,15 @@ public class RepairController extends BaseController { return service.endRepairTask(taskList); } + /** + * 驳回退料--批量 + */ + @ApiOperation(value = "驳回退料") + @DeleteMapping("/{ids}") + public AjaxResult rejectRepair(@PathVariable Long[] ids) { + return service.rejectRepair(Arrays.asList(ids)); + } + /** * 获取维修员下拉选 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java index 49aef973..99ca0a42 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java @@ -34,6 +34,13 @@ public class RepairTaskDetails extends BaseEntity { */ @ApiModelProperty(value = "类型名称") private String typeName; + + /** + * 规格类型id + */ + @ApiModelProperty(value = "规格型号id") + private String typeId; + /** * 规格型号 */ @@ -49,7 +56,7 @@ public class RepairTaskDetails extends BaseEntity { /** * 编码 */ - @ApiModelProperty(value = "编码") + @ApiModelProperty(value = "设备编码") private String code; /** * 维修总量 @@ -72,12 +79,6 @@ public class RepairTaskDetails extends BaseEntity { @ApiModelProperty(value = "待修状态") private String status; - /** - * 规格类型id - */ - @ApiModelProperty(value = "规格型号id") - private String typeId; - @ApiModelProperty(value = "组织id") private Long companyId; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceListVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceListVo.java new file mode 100644 index 00000000..8ed4a21b --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceListVo.java @@ -0,0 +1,65 @@ +package com.bonus.material.repair.domain.vo; + +import com.bonus.common.biz.domain.BaseVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @CreateTime: 2024-11-15 13:26 + * @Description: 维修设备列表返回VO + */ +@EqualsAndHashCode(callSuper = false) +@Data +public class RepairDeviceListVo extends BaseVO { + + @ApiModelProperty(value = "id") + private Long id; + + @ApiModelProperty(value = "任务ID") + private Integer taskId; + + @ApiModelProperty(value = "类型id") + private Long typeNameId; + + @ApiModelProperty(value = "设备编码") + private String code; + + @ApiModelProperty(value = "类型名称") + private String typeName; + + @ApiModelProperty(value = "规格型号id") + private Long typeId; + + @ApiModelProperty(value = "规格型号") + private String type; + + @ApiModelProperty(value = "物资设备计量单位") + private String unitName; + + @ApiModelProperty(value = "管理模式") + private Integer manageType; + + @ApiModelProperty(value = "设备表主键id") + private Long maId; + + @ApiModelProperty(value = "维修人员") + private String repairer; + + @ApiModelProperty(value = "维修总量") + private int repairNum; + + @ApiModelProperty(value = "已修数量") + private int repairedNum; + + @ApiModelProperty(value = "维修报废数量") + private int scrapNum; + + @ApiModelProperty(value = "内层物资类型集合") + private List repairDeviceList = new ArrayList<>(); +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java new file mode 100644 index 00000000..51a02c7e --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java @@ -0,0 +1,46 @@ +package com.bonus.material.repair.domain.vo; + +import com.bonus.material.repair.domain.RepairPart; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @CreateTime: 2024-11-15 14:35 + * @Description: 维修设备VO + */ +@Data +public class RepairDeviceVO { + + @ApiModelProperty(value = "主键") + private Long id; + + @ApiModelProperty(value = "任务ID") + private Long taskId; + + @ApiModelProperty(value = "设备类型") + private String typeName; + + @ApiModelProperty(value = "规格型号") + private String type; + + @ApiModelProperty(value = "设备编码") + private String code; + + @ApiModelProperty(value = "状态") + private String status; + + @ApiModelProperty(value = "维修配件信息") + private String partInfo; + + @ApiModelProperty(value = "附件") + private String fileUrl; + + @ApiModelProperty(value = "维修配件集合") + private List repairPartList; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java index 07326577..dd28fe6e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java @@ -4,6 +4,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord; import com.bonus.material.repair.domain.RepairPartDetails; import com.bonus.material.repair.domain.RepairTask; import com.bonus.material.repair.domain.RepairTaskDetails; +import com.bonus.material.repair.domain.vo.RepairDeviceListVo; import com.bonus.system.api.domain.SysUser; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -27,7 +28,7 @@ public interface RepairMapper { * 获取维修详细列表 * @param bean 维修任务详情--查询条件 */ - List getRepairMaTypeList(RepairTaskDetails bean); + List getRepairMaTypeList(RepairTaskDetails bean); /** * 新增维修记录 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java index e1e0ebe4..7a2d2a51 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java @@ -5,6 +5,7 @@ import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.repair.domain.RepairApplyRecord; import com.bonus.material.repair.domain.RepairTask; import com.bonus.material.repair.domain.RepairTaskDetails; +import com.bonus.material.repair.domain.vo.RepairDeviceListVo; import com.bonus.system.api.domain.SysUser; import java.util.ArrayList; @@ -27,7 +28,7 @@ public interface RepairService { * @param bean * @return */ - List getRepairMaTypeList(RepairTaskDetails bean); + List getRepairMaTypeList(RepairTaskDetails bean); /** * 新增维修记录 @@ -63,6 +64,8 @@ public interface RepairService { */ AjaxResult endRepairTask(List taskList); + AjaxResult rejectRepair(List taskList); + /** * 导出维修列表 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index be40e30b..656bcab8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -24,6 +24,8 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; import com.bonus.material.task.domain.TmTask; import javax.validation.constraints.NotNull; + +import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import com.bonus.material.repair.mapper.RepairAuditDetailsMapper; import com.bonus.material.repair.service.IRepairAuditDetailsService; 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 181d2ee3..d9d0cb0b 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 @@ -1,5 +1,7 @@ package com.bonus.material.repair.service.impl; +import cn.hutool.core.bean.BeanUtil; +import com.bonus.common.biz.enums.RepairTaskStatusEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; @@ -7,17 +9,27 @@ import com.bonus.material.repair.domain.RepairApplyRecord; import com.bonus.material.repair.domain.RepairPartDetails; import com.bonus.material.repair.domain.RepairTask; import com.bonus.material.repair.domain.RepairTaskDetails; +import com.bonus.material.repair.domain.vo.RepairDeviceListVo; +import com.bonus.material.repair.domain.vo.RepairDeviceVO; import com.bonus.material.repair.mapper.RepairMapper; import com.bonus.material.repair.service.RepairService; +import com.bonus.material.task.domain.TmTask; +import com.bonus.material.task.mapper.TmTaskMapper; import com.bonus.system.api.domain.SysUser; import com.bonus.system.api.model.LoginUser; +import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; /** * @author syruan @@ -28,6 +40,8 @@ public class RepairServiceImpl implements RepairService { @Resource private RepairMapper repairMapper; + private TmTaskMapper taskMapper; + @Override public List getRepairTaskList(RepairTask bean) { @@ -40,10 +54,44 @@ public class RepairServiceImpl implements RepairService { } @Override - public List getRepairMaTypeList(RepairTaskDetails bean) { - //Long companyId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); + public List getRepairMaTypeList(RepairTaskDetails bean) { bean.setCompanyId(null); - return repairMapper.getRepairMaTypeList(bean); + List repairMaTypeList = repairMapper.getRepairMaTypeList(bean); + + if (repairMaTypeList.isEmpty()) { + return repairMaTypeList; + } + + // 创建Map集合,用于快速分组 + Map resultMap = new ConcurrentHashMap<>(); + + // 遍历处理,把相同的父级对象,拆分到子集合中 + repairMaTypeList.forEach(item -> { + // 创建对象,并复制字段value + RepairDeviceVO repairDeviceVO = new RepairDeviceVO(); + try { + BeanUtil.copyProperties(item, repairDeviceVO); + } catch (Exception e) { + // 记录异常日志,并提供更详细的错误信息 + System.err.println("复制属性时发生错误: {}" + e.getMessage()); + throw new RuntimeException("复制属性时发生错误", e); + } + + if (item.getTypeNameId() == null) { + // 处理 typeNameId 为空的情况 + System.err.println("typeNameId 为空,跳过当前项: " + item); + return; + } + + // 使用 computeIfAbsent 方法,如果 key 不存在,则创建一个新对象,并添加到 resultMap 中 + resultMap.computeIfAbsent(item.getTypeNameId(), k -> { + item.getRepairDeviceList().add(repairDeviceVO); + return item; + }).getRepairDeviceList().add(repairDeviceVO); + + }); + + return new ArrayList<>(resultMap.values()); } @@ -69,7 +117,7 @@ public class RepairServiceImpl implements RepairService { } switch (bean.getRepairType()) { case "1": { - int repairNum = (details.getRepairedNum() + bean.getRepairNum()); + int repairNum = details.getRepairedNum() + bean.getRepairNum(); int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { throw new ServiceException("维修数量大于维修总量"); @@ -78,7 +126,7 @@ public class RepairServiceImpl implements RepairService { break; } case "2": { - int repairNum = (int) (details.getRepairedNum() + bean.getRepairNum()); + int repairNum = details.getRepairedNum() + bean.getRepairNum(); int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { throw new ServiceException("维修数量大于维修总量"); @@ -87,7 +135,7 @@ public class RepairServiceImpl implements RepairService { break; } case "3": { - int scrapNum = (int) (details.getScrapNum() + bean.getScrapNum()); + int scrapNum = details.getScrapNum() + bean.getScrapNum(); int num = scrapNum + details.getRepairedNum(); if (num > details.getRepairNum()) { throw new ServiceException("维修数量大于维修总量"); @@ -216,6 +264,17 @@ public class RepairServiceImpl implements RepairService { return AjaxResult.success(); } + @Override + public AjaxResult rejectRepair(@NotNull List taskList) { + try { + taskList.forEach(taskId -> taskMapper.updateTmTaskStatusByTaskId(taskId, RepairTaskStatusEnum.TASK_STATUS_REJECT.getStatus())); + } catch (DataAccessException e) { + System.err.println(e.getMessage()); + throw new RuntimeException(e); + } + return AjaxResult.success("执行完成"); + } + @Override public int completeRepair(ArrayList ids) { 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 2dc94a4b..370645ea 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 @@ -197,12 +197,13 @@ tt.create_time DESC - select rad.id as id, rad.task_id as taskId, rad.ma_id as maId, mt2.type_name as typeName, + mt2.type_id as typeNameId, mt.type_name as type, mt.unit_name as unitName, mt.manage_type as manageType, From befffbc5a82c069a3b5e1da9d2ab1a35647dd886 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Sat, 16 Nov 2024 18:30:55 +0800 Subject: [PATCH 04/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96=E3=80=81?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/controller/RepairController.java | 35 ++-- .../material/repair/domain/RepairTask.java | 7 + .../repair/domain/vo/RepairDeviceVO.java | 75 ++++++++- .../material/repair/mapper/RepairMapper.java | 4 +- .../repair/service/RepairService.java | 13 +- .../service/impl/RepairServiceImpl.java | 152 ++++++++++++------ .../mapper/material/repair/RepairMapper.xml | 4 +- 7 files changed, 209 insertions(+), 81 deletions(-) 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 3419966d..45f1f471 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 @@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -26,6 +27,7 @@ import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Optional; /** * @author syruan @@ -84,7 +86,7 @@ public class RepairController extends BaseController { */ @ApiOperation(value = "获取维修物资设备列表---分页") @GetMapping("/getRepairMaTypeList") - @RequiresPermissions("repair:manage:preview") +// @RequiresPermissions("repair:manage:preview") public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) { startPage(); List list = service.getRepairMaTypeList(bean); @@ -92,7 +94,7 @@ public class RepairController extends BaseController { } /** - * 获取维修任务机具列表 + * 获取维修任务机具列表--Ⅱ级页面详情列表 */ @ApiOperation(value = "获取维修物资设备列表---不分页") @GetMapping("/getAppRepairMaTypeList") @@ -109,8 +111,10 @@ public class RepairController extends BaseController { public AjaxResult submitRepairApply(@RequestBody @NotNull RepairApplyRecord bean) { try { String partStrList = bean.getPartStrList(); - List repairPartDetails = objectMapper.readValue(partStrList, new TypeReference>() {}); - bean.setPartList(repairPartDetails); + if (StringUtils.isNoneBlank(partStrList)) { + List repairPartDetails = objectMapper.readValue(partStrList, new TypeReference>() {}); + bean.setPartList(Optional.ofNullable(repairPartDetails).orElse(new ArrayList<>())); + } return service.submitRepairApply(bean); } catch (JsonProcessingException e) { throw new ServiceException("Jackson反序列化异常:" + e.getMessage()); @@ -118,27 +122,36 @@ public class RepairController extends BaseController { } /** - * 快捷维修记录 + * 快捷维修 1.把维修都设置为内部维修,增加维修配件明细 */ - @ApiOperation(value = "快捷维修记录") + @ApiOperation(value = "快捷维修--批量--默认内部维修") @PostMapping("/fastRepairApply") public AjaxResult fastRepairApply(@RequestBody List list) { return service.fastRepairApply(list); } /** - * 完成维修 + * 批量维修 1.判断维修方式,增加维修配件明细 */ - @ApiOperation(value = "完成维修") + @ApiOperation(value = "批量维修--批量--按照传参维修方式进行维修") + @PostMapping("/batchRepairApply") + public AjaxResult batchRepairApply(@RequestBody List list) { + return service.fastRepairApply(list); + } + + /** + * 维修明细--批量审核--更新明细status + */ + @ApiOperation(value = "维修明细更新status--批量") @PostMapping("/completeRepair") public AjaxResult completeRepair(@RequestBody ArrayList ids) { return toAjax(service.completeRepair(ids)); } /** - * 提交审核 + * 任务维修完成--提交修饰审核 */ - @ApiOperation(value = "提交审核") + @ApiOperation(value = "任务维修完成--提交至修饰审核") @PostMapping("/endRepairTask") public AjaxResult endRepairTask(@RequestBody ArrayList taskList) { return service.endRepairTask(taskList); @@ -147,7 +160,7 @@ public class RepairController extends BaseController { /** * 驳回退料--批量 */ - @ApiOperation(value = "驳回退料") + @ApiOperation(value = "驳回退料--批量") @DeleteMapping("/{ids}") public AjaxResult rejectRepair(@PathVariable Long[] ids) { return service.rejectRepair(Arrays.asList(ids)); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java index 6155f031..5b0c6ea1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTask.java @@ -18,6 +18,13 @@ public class RepairTask { */ @ApiModelProperty(value = "任务id") private String taskId; + + @ApiModelProperty(value = "任务状态") + private Integer taskStatus; + + @ApiModelProperty(value = "任务类型") + private Integer taskType; + /** * 维修单号 */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java index 51a02c7e..18f32154 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java @@ -2,9 +2,10 @@ package com.bonus.material.repair.domain.vo; import com.bonus.material.repair.domain.RepairPart; import io.swagger.annotations.ApiModelProperty; -import io.swagger.annotations.ApiOperation; import lombok.Data; +import lombok.experimental.Accessors; +import java.util.ArrayList; import java.util.List; /** @@ -14,6 +15,7 @@ import java.util.List; * @Description: 维修设备VO */ @Data +@Accessors(chain = true) public class RepairDeviceVO { @ApiModelProperty(value = "主键") @@ -37,10 +39,77 @@ public class RepairDeviceVO { @ApiModelProperty(value = "维修配件信息") private String partInfo; + @ApiModelProperty(value = "维修方式: 1内部 2外部返厂 3报废") + private Integer repairType; + @ApiModelProperty(value = "附件") private String fileUrl; - @ApiModelProperty(value = "维修配件集合") - private List repairPartList; + @ApiModelProperty(value = "编码--内部维修配件集合") + private List codeInRepairPartList; + @ApiModelProperty(value = "编码--返厂维修配件集合") + private List codeOutRepairPartList; + + @ApiModelProperty(value = "编码--报废维修配件集合") + private List codeScrapRepairPartList; + + @ApiModelProperty(value = "数量--内部维修配件集合") + private List numberInRepairPartList; + + @ApiModelProperty(value = "数量--返厂维修配件集合") + private List numberOutRepairPartList; + + @ApiModelProperty(value = "数量--报废维修配件集合") + private List numberScrapRepairPartList; + + // 手动覆盖 getter 方法,确保 List 始终被初始化 + public List getCodeInRepairPartList() { + if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();} + return this.codeInRepairPartList; + } + + public List getCodeOutRepairPartList() { + if (this.codeOutRepairPartList == null) {this.codeOutRepairPartList = new ArrayList<>();} + return this.codeOutRepairPartList; + } + + public List getCodeScrapRepairPartList() { + if (this.codeScrapRepairPartList == null) {this.codeScrapRepairPartList = new ArrayList<>();} + return this.codeScrapRepairPartList; + } + + public List getNumberInRepairPartList() { + if (this.numberInRepairPartList == null) {this.numberInRepairPartList = new ArrayList<>();} + return this.numberInRepairPartList; + } + + public List getNumberOutRepairPartList() { + if (this.numberOutRepairPartList == null) {this.numberOutRepairPartList = new ArrayList<>();} + return this.numberOutRepairPartList; + } + + public List getNumberScrapRepairPartList() { + if (this.numberScrapRepairPartList == null) {this.numberScrapRepairPartList = new ArrayList<>();} + return this.numberScrapRepairPartList; + } + + // 自定义 clear 方法 + public void clear() { + this.id = null; + this.taskId = null; + this.typeName = null; + this.type = null; + this.code = null; + this.status = null; + this.partInfo = null; + this.repairType = null; + this.fileUrl = null; + this.codeInRepairPartList.clear(); + this.codeOutRepairPartList.clear(); + this.codeScrapRepairPartList.clear(); + this.numberInRepairPartList.clear(); + this.numberOutRepairPartList.clear(); + this.numberScrapRepairPartList.clear(); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java index dd28fe6e..67ef5235 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java @@ -82,7 +82,7 @@ public interface RepairMapper { * @param taskList 任务列表集合 * @param userid 用户id */ - int updateTaskStatus(@Param("taskList") List taskList, @Param("userId") Long userid); + int updateTaskStatus(@Param("taskList") List taskList, @Param("userId") Long userid, @Param("taskStatus") Integer taskStatus); /** * 新增任务 @@ -123,7 +123,7 @@ public interface RepairMapper { List getDetailsListByTaskId(RepairTask task); /** - * 新增实验建议审核数据 + * 新增修饰审核审核数据 * @param details 数据详情 */ int addAuditDetails(RepairTaskDetails details); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java index 7a2d2a51..4608da83 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java @@ -25,15 +25,11 @@ public interface RepairService { /** * 获取维修详细列表 - * @param bean - * @return */ List getRepairMaTypeList(RepairTaskDetails bean); /** - * 新增维修记录 - * @param bean - * @return + * 提交维修记录 */ AjaxResult submitRepairApply(RepairApplyRecord bean); @@ -45,9 +41,7 @@ public interface RepairService { AjaxResult fastRepairApply(List list); /** - * 完成维修 - * @param ids - * @return + * 维修明细--批量审核--更新明细status */ int completeRepair(ArrayList ids); @@ -59,8 +53,7 @@ public interface RepairService { /** * 提交审核 - * @param taskList - * @return + * @param taskList 任务信息集合 */ AjaxResult endRepairTask(List taskList); 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 d9d0cb0b..c53c9450 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 @@ -1,7 +1,9 @@ package com.bonus.material.repair.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import com.bonus.common.biz.enums.RepairTaskStatusEnum; +import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; @@ -13,7 +15,6 @@ import com.bonus.material.repair.domain.vo.RepairDeviceListVo; import com.bonus.material.repair.domain.vo.RepairDeviceVO; import com.bonus.material.repair.mapper.RepairMapper; import com.bonus.material.repair.service.RepairService; -import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.mapper.TmTaskMapper; import com.bonus.system.api.domain.SysUser; import com.bonus.system.api.model.LoginUser; @@ -24,12 +25,8 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.validation.constraints.NotNull; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; /** * @author syruan @@ -40,6 +37,7 @@ public class RepairServiceImpl implements RepairService { @Resource private RepairMapper repairMapper; + @Resource private TmTaskMapper taskMapper; @@ -62,7 +60,7 @@ public class RepairServiceImpl implements RepairService { return repairMaTypeList; } - // 创建Map集合,用于快速分组 + // 创建Map集合,用于快速分组,使用 ConcurrentHashMap 保证线程安全 Map resultMap = new ConcurrentHashMap<>(); // 遍历处理,把相同的父级对象,拆分到子集合中 @@ -83,54 +81,54 @@ public class RepairServiceImpl implements RepairService { return; } - // 使用 computeIfAbsent 方法,如果 key 不存在,则创建一个新对象,并添加到 resultMap 中 - resultMap.computeIfAbsent(item.getTypeNameId(), k -> { - item.getRepairDeviceList().add(repairDeviceVO); - return item; - }).getRepairDeviceList().add(repairDeviceVO); - + // 使用 computeIfAbsent 方法,如果 key 不存在,则创建一个新对象,并添加到 resultMap 中 + resultMap.computeIfAbsent(item.getTypeNameId(), k -> item).getRepairDeviceList().add(repairDeviceVO); }); - return new ArrayList<>(resultMap.values()); } /** - * 新增维修记录 + * 提交维修记录 * @param bean repairApplyRecord */ @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult submitRepairApply(RepairApplyRecord bean) { + public AjaxResult submitRepairApply(@NotNull(message = "参数不能为空") RepairApplyRecord bean) { + // 获取维修详情记录:待维修、已维修、报废的数量 RepairTaskDetails details = repairMapper.getById(bean.getId()); LoginUser loginUser = SecurityUtils.getLoginUser(); bean.setCreateBy(String.valueOf(loginUser.getUserid())); + + // 获取维修配件列表 List partList = bean.getPartList(); BigDecimal sfCosts = new BigDecimal("0"); - String nbType = "1"; - String fcType = "2"; + + // 内部维修类型 + String inRepairType = "1"; + // 返厂维修类型 + String outRepairType = "2"; + // 收费配件 String sfPart = "1"; + // 不收费配件 String bsfPart = "0"; - if (partList != null && !partList.isEmpty()) { + + if (CollectionUtil.isNotEmpty(partList)) { bean.setRepairNum(partList.get(0).getRepairNum()); bean.setRepairer(partList.get(0).getRepairer()); } + + // 根据维修类型,更新维修数量、报废数量 switch (bean.getRepairType()) { case "1": { - int repairNum = details.getRepairedNum() + bean.getRepairNum(); - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { - throw new ServiceException("维修数量大于维修总量"); - } + int repairNum = getNum(bean, details); + // 更新维修数量、并修改维修人员 repairMapper.updateRepairedNum(bean.getId(), repairNum, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); break; } case "2": { - int repairNum = details.getRepairedNum() + bean.getRepairNum(); - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { - throw new ServiceException("维修数量大于维修总量"); - } + int repairNum = getNum(bean, details); + // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); break; } @@ -140,17 +138,22 @@ public class RepairServiceImpl implements RepairService { if (num > details.getRepairNum()) { throw new ServiceException("维修数量大于维修总量"); } + // 更新报废数量 repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); break; } default: break; } - if (partList != null && !partList.isEmpty()) { - if (nbType.equals(bean.getRepairType())) { + + // 判断配件列表是否为空 + if (CollectionUtil.isNotEmpty(partList)) { + // 内部维修 + if (inRepairType.equals(bean.getRepairType())) { + // 遍历配件列表,判断配件类型,收费还是不收费 for (RepairPartDetails partDetails : partList) { if (partDetails.getPartId() != null) { - // 有维修配件时 + // 有维修配件时,如果价格为空,设置为0 if (partDetails.getPartCost() == null) { partDetails.setPartCost(new BigDecimal(0)); } @@ -159,23 +162,30 @@ public class RepairServiceImpl implements RepairService { partDetails.setTypeId(bean.getTypeId()); partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); partDetails.setCompanyId(bean.getCompanyId()); - // 根据partid 找到配件单价 + + // 根据 partId 找配件单价 BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); + // 设置配件费用 partDetails.setPartCost(partPrice); + // 添加【维修配件明细表】 repairMapper.addPart(partDetails); + bean.setPartPrice(partDetails.getPartCost()); bean.setPartId((long) partDetails.getPartId().intValue()); bean.setPartNum(partDetails.getPartNum()); bean.setRepairContent(partDetails.getRepairContent()); bean.setPartType(partDetails.getPartType()); + // 添加【维修记录表】 repairMapper.addRecord(bean); } else { - // 不选维修配件时 + // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(bean); } } } - if (fcType.equals(bean.getRepairType())) { + + // 返厂维修 + if (outRepairType.equals(bean.getRepairType())) { bean.setPartName(partList.get(0).getPartName()); bean.setPartType(partList.get(0).getPartType()); bean.setRepairContent(partList.get(0).getRepairContent()); @@ -190,8 +200,11 @@ public class RepairServiceImpl implements RepairService { bean.setPartPrice(partList.get(0).getPartPrice()); } bean.setPartNum(partList.get(0).getPartNum()); + // 新增【维修记录表】 repairMapper.addRecord(bean); } + + // 配件费用计算 for (RepairPartDetails partDetails : partList) { if (partDetails.getPartCost() != null) { BigDecimal partCost = partDetails.getPartCost(); @@ -200,64 +213,95 @@ public class RepairServiceImpl implements RepairService { } } - if (!"0".equals(sfCosts.toString())) { + // 判断是否是收费配件 + if (sfPart.equals(sfCosts.toString())) { + // SQL: 新增【维修费用记录表】 repairMapper.addRepairCost(bean, sfCosts, sfPart); } } else { - // 新增预报废记录 + // 新增【维修记录表--预报废】 repairMapper.addRecord(bean); } return AjaxResult.success(); } + private static int getNum(RepairApplyRecord bean, RepairTaskDetails details) { + int repairNum = details.getRepairedNum() + bean.getRepairNum(); + int num = repairNum + details.getScrapNum(); + if (num > details.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } + return repairNum; + } + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult fastRepairApply(List list) { LoginUser loginUser = SecurityUtils.getLoginUser(); + + // 判断待维修数量是否大于0 for (RepairTaskDetails bean : list) { int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum(); if (repairedNum <= 0) { throw new ServiceException("选中的数据中包含待维修数量为0的机具,请重新选择"); } } + + // 执行SQL: 1.增加【维修记录表】、 2.修改【维修明细表】的维修数量 for (RepairTaskDetails bean : list) { int repairedNum = bean.getRepairNum() - bean.getRepairedNum() - bean.getScrapNum(); - RepairApplyRecord partDetails = new RepairApplyRecord(); - partDetails.setTaskId(Long.valueOf(bean.getTaskId())); - partDetails.setMaId(Long.valueOf(bean.getMaId())); - partDetails.setTypeId(Long.valueOf(bean.getTypeId())); - partDetails.setRepairNum(repairedNum); - partDetails.setRepairType("1"); - partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); - partDetails.setCompanyId(bean.getCompanyId()); - repairMapper.addRecord(partDetails); + RepairApplyRecord repairRecord = new RepairApplyRecord(); + repairRecord.setTaskId(Long.valueOf(bean.getTaskId())); + repairRecord.setMaId(Long.valueOf(bean.getMaId())); + repairRecord.setTypeId(Long.valueOf(bean.getTypeId())); + repairRecord.setRepairNum(repairedNum); + // 快捷维修,设置为内部维修 + repairRecord.setRepairType("1"); + repairRecord.setCreateBy(String.valueOf(loginUser.getUserid())); + repairRecord.setCompanyId(bean.getCompanyId()); + repairMapper.addRecord(repairRecord); int i = repairedNum + bean.getRepairedNum(); repairMapper.updateRepairedNumTwo(bean.getId(), i, loginUser.getUserid()); } + + // 执行完毕,无异常返回至前端 return AjaxResult.success(); } @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult endRepairTask(List taskList) { + public AjaxResult endRepairTask(@NotNull List taskList) { LoginUser loginUser = SecurityUtils.getLoginUser(); + + // 1.查询选择任务是否还有未完成维修的数据 for (RepairTask task : taskList) { - int i = repairMapper.getUnFinish(task); - if (i > 0) { - throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核"); + if (repairMapper.getUnFinish(task) > 0) { + return AjaxResult.error("选中的数据中包含维修未完成的,请完成维修再进行提交审核"); } } - int i = repairMapper.updateTaskStatus(taskList, loginUser.getUserid()); + + // 2.更新tm_task任务状态 + repairMapper.updateTaskStatus(taskList, loginUser.getUserid(), RepairTaskStatusEnum.TASK_STATUS_COMPLETE.getStatus()); + + // 3.业务逻辑处理 for (RepairTask task : taskList) { task.setCreateBy(loginUser.getUserid()); + // 查询任务的协议id Long agreementId = repairMapper.getAgreementId(task); + // 查询维修任务的详情表 List detailsList = repairMapper.getDetailsListByTaskId(task); + // 新增tm_task表数据、修饰审核任务、状态是待审核 + task.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR_STORAGE.getTaskTypeId()); + task.setTaskStatus(RepairTaskStatusEnum.TASK_STATUS_TO_EXAM.getStatus()); repairMapper.addTask(task); + + // 循环插入【修饰审核明细表】 for (RepairTaskDetails details : detailsList) { details.setCreateBy(String.valueOf(loginUser.getUserid())); details.setTaskId(task.getTaskId()); repairMapper.addAuditDetails(details); } + // 新增协议任务表--关联修饰任务与协议 task.setAgreementId(agreementId); repairMapper.createAgreementTask(task); } @@ -270,12 +314,14 @@ public class RepairServiceImpl implements RepairService { taskList.forEach(taskId -> taskMapper.updateTmTaskStatusByTaskId(taskId, RepairTaskStatusEnum.TASK_STATUS_REJECT.getStatus())); } catch (DataAccessException e) { System.err.println(e.getMessage()); - throw new RuntimeException(e); + return AjaxResult.error("数据库SQL修改执行失败" + e.getMessage()); } return AjaxResult.success("执行完成"); } - + /** + * 维修明细--批量审核--更新明细status + */ @Override public int completeRepair(ArrayList ids) { LoginUser loginUser = SecurityUtils.getLoginUser(); 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 370645ea..d6731c80 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 @@ -13,7 +13,7 @@ insert into tm_task (task_status,task_type,code,create_by,create_time,company_id) - values (46,45,#{repairCode},#{createBy},now(),#{companyId}); + values (#{taskStatus},#{taskType},#{repairCode},#{createBy},now(),#{companyId}); @@ -61,7 +61,7 @@ update tm_task - set task_status = '44', + set task_status = #{taskStatus}, update_by = #{userId}, update_time = now() where task_id in From b9f92a587b37fb88cf1e9897cbf6d9c47db4bd05 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 10:50:29 +0800 Subject: [PATCH 05/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/domain/PurchaseCheckDetails.java | 3 +++ .../impl/PurchaseCheckInfoServiceImpl.java | 17 +++++++++++------ .../purchase/PurchaseCheckDetailsMapper.xml | 9 ++++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java index 5f53845a..38dd2270 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java @@ -147,6 +147,9 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "管理方式(0编号 1计数)") private Integer manageType; + @ApiModelProperty(value = "机具编码") + private String maCode; + /** 验收附件列表 */ //@Excel(name = "验收附件列表") @ApiModelProperty(value = "验收附件列表") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 8556b2c7..84f44895 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -12,6 +12,7 @@ import com.bonus.common.biz.enums.PurchaseTaskStatusEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; 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.basic.domain.BmFileInfo; @@ -74,14 +75,20 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { if (purchaseCheckInfo != null) { purchaseCheckDtoResult.setPurchaseCheckInfo(purchaseCheckInfo); boolean isAllowPartTransfer = bmConfigService.isBmConfigEnabledWithDefaultFalse(BmConfigItems.BOOLEAN_ALLOW_PURCHASE_PART_TRANSFER); - List purchaseCheckDetails; + List purchaseCheckDetailsList; if (isAllowPartTransfer) { - purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + if (purchaseQueryDto.getStatusList().contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) { + purchaseCheckDetailsList = purchaseCheckDetailsList.stream() + .filter(o -> MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(o.getManageType()) || + MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(o.getManageType()) && StringUtils.isNotEmpty(o.getMaCode())) + .collect(Collectors.toList()); + } } else { purchaseQueryDto.setStatusList(null); - purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); } - purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails); + purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetailsList); } return purchaseCheckDtoResult; } @@ -191,8 +198,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId(), PurchaseTaskStatusEnum.TO_NOTICE.getStatus(), purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); - //tmTask.setMonthOrder(thisMonthMaxOrder); - //tmTask.setCode(genderTaskCode(purchaseCheckInfo, thisMonthMaxOrder)); tmTask.setCreateTime(DateUtils.getNowDate()); tmTaskMapper.insertTmTask(tmTask); Long taskId = tmTask.getTaskId(); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index eca38ca0..4cc2ec9c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -44,10 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select pcd.id, pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_tax_price, pcd.purchase_num, pcd.check_num, pcd.bind_num, pcd.check_result, pcd.supplier_id, pcd.status, pcd.create_by, pcd.production_time, pcd.create_time, pcd.update_by, pcd.update_time, pcd.remark, pcd.check_url_name, pcd.check_url, pcd.input_num, pcd.input_status, pcd.input_time, pcd.file_name, - pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type + pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type,pmi.ma_code from purchase_check_details pcd left join ma_type mt on pcd.type_id = mt.type_id left join ma_type mtp on mt.parent_id = mtp.type_id + left join purchase_macode_info pmi on pcd.task_id=pmi.task_id and pcd.type_id=pmi.type_id @@ -111,6 +109,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pcd.production_time between #{startTime} and #{endTime} + + + and pcd.status in @@ -300,7 +301,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" (#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseTaxPrice}, #{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId}, - #{item.status},#{item.productionTime},#{item.createBy},NOW(),#{item.updateBy}, + #{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy}, #{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum}, #{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId},#{item.fixCode}) From 20d547eedee62cfaa99e35d21f71dbfae0faad74 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 11:24:36 +0800 Subject: [PATCH 07/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/PurchaseMacodeInfoMapper.java | 3 +++ .../impl/PurchaseCheckInfoServiceImpl.java | 24 ++++++++++++++----- .../purchase/PurchaseCheckDetailsMapper.xml | 5 +--- .../purchase/PurchaseMacodeInfoMapper.xml | 4 ++++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseMacodeInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseMacodeInfoMapper.java index bdf33408..da4b527a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseMacodeInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseMacodeInfoMapper.java @@ -2,6 +2,7 @@ package com.bonus.material.purchase.mapper; import java.util.List; import com.bonus.material.purchase.domain.PurchaseMacodeInfo; +import org.apache.ibatis.annotations.Param; /** * 新购验收编号管理Mapper接口 @@ -57,4 +58,6 @@ public interface PurchaseMacodeInfoMapper { * @return 结果 */ public int deletePurchaseMacodeInfoByIds(Long[] ids); + + public int getPurchaseMaCodeCount(@Param("taskId") Long taskId, @Param("typeId") Long typeId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 8556b2c7..0d9aaf0e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -23,6 +23,7 @@ import com.bonus.material.purchase.domain.dto.PurchaseQueryDto; import com.bonus.material.purchase.domain.vo.PurchaseVerifyVo; import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper; import com.bonus.material.purchase.domain.vo.PurchaseCheckFormVo; +import com.bonus.material.purchase.mapper.PurchaseMacodeInfoMapper; import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.mapper.TmTaskMapper; import org.apache.commons.lang3.BooleanUtils; @@ -55,6 +56,9 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { @Resource private PurchaseCheckDetailsMapper purchaseCheckDetailsMapper; + @Autowired + private PurchaseMacodeInfoMapper purchaseMacodeInfoMapper; + @Resource private TmTaskMapper tmTaskMapper; @@ -74,18 +78,28 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { if (purchaseCheckInfo != null) { purchaseCheckDtoResult.setPurchaseCheckInfo(purchaseCheckInfo); boolean isAllowPartTransfer = bmConfigService.isBmConfigEnabledWithDefaultFalse(BmConfigItems.BOOLEAN_ALLOW_PURCHASE_PART_TRANSFER); - List purchaseCheckDetails; + List purchaseCheckDetailsList; if (isAllowPartTransfer) { - purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + if (purchaseQueryDto.getStatusList().contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) { + purchaseCheckDetailsList = purchaseCheckDetailsList.stream() + .filter(o -> MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(o.getManageType()) || + MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(o.getManageType()) && getPurchaseMaCodeCount(o.getTaskId(), o.getTypeId()) > 0) + .collect(Collectors.toList()); + } } else { purchaseQueryDto.setStatusList(null); - purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); } - purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails); + purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetailsList); } return purchaseCheckDtoResult; } + private int getPurchaseMaCodeCount(Long taskId, Long typeId) { + return purchaseMacodeInfoMapper.getPurchaseMaCodeCount(taskId, typeId); + } + /** * 查询新购验收任务列表 * @@ -191,8 +205,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId(), PurchaseTaskStatusEnum.TO_NOTICE.getStatus(), purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); - //tmTask.setMonthOrder(thisMonthMaxOrder); - //tmTask.setCode(genderTaskCode(purchaseCheckInfo, thisMonthMaxOrder)); tmTask.setCreateTime(DateUtils.getNowDate()); tmTaskMapper.insertTmTask(tmTask); Long taskId = tmTask.getTaskId(); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index eca38ca0..0843dddc 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml @@ -109,9 +109,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pcd.production_time between #{startTime} and #{endTime} - - - and pcd.status in @@ -301,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" (#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseTaxPrice}, #{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId}, - #{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy}, + #{item.status},#{item.productionTime},#{item.createBy},NOW(),#{item.updateBy}, #{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum}, #{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId},#{item.fixCode}) diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseMacodeInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseMacodeInfoMapper.xml index c6694080..206ecb8e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseMacodeInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseMacodeInfoMapper.xml @@ -122,4 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file From 4821406f98151437939f44004e3f8e3c155c47d9 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Nov 2024 14:01:20 +0800 Subject: [PATCH 08/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/controller/RepairController.java | 31 +-- .../repair/domain/RepairApplyRecord.java | 12 +- .../repair/domain/vo/RepairDeviceVO.java | 46 ++-- .../material/repair/mapper/RepairMapper.java | 2 +- .../repair/service/RepairService.java | 3 + .../service/impl/RepairServiceImpl.java | 197 ++++++++++++++++-- 6 files changed, 242 insertions(+), 49 deletions(-) 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 45f1f471..5862a027 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 @@ -11,6 +11,7 @@ import com.bonus.material.repair.domain.RepairPartDetails; import com.bonus.material.repair.domain.RepairTask; import com.bonus.material.repair.domain.RepairTaskDetails; import com.bonus.material.repair.domain.vo.RepairDeviceListVo; +import com.bonus.material.repair.domain.vo.RepairDeviceVO; import com.bonus.material.repair.service.RepairService; import com.bonus.system.api.domain.SysUser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -68,19 +69,6 @@ public class RepairController extends BaseController { return AjaxResult.success(list); } - /** - * 导出维修任务列表--外层--壹级列表 - */ - @PostMapping("/export") - @RequiresPermissions("repair:manage:export") - @ApiOperation(value = "导出维修任务列表") - public void export(HttpServletResponse response, RepairTask bean) { - List list = service.exportRepairTaskList(bean); - ExcelUtil util = new ExcelUtil<>(RepairTask.class); - util.exportExcel(response, list, "维修任务列表"); - } - - /** * 获取维修任务物资设备列表--不分页 */ @@ -135,8 +123,8 @@ public class RepairController extends BaseController { */ @ApiOperation(value = "批量维修--批量--按照传参维修方式进行维修") @PostMapping("/batchRepairApply") - public AjaxResult batchRepairApply(@RequestBody List list) { - return service.fastRepairApply(list); + public AjaxResult batchRepairApply(@RequestBody List list) { + return service.batchRepairApply(list); } /** @@ -175,4 +163,17 @@ public class RepairController extends BaseController { return AjaxResult.success(list); } + /** + * 导出维修任务列表--外层--壹级列表 + */ + @PostMapping("/export") + @RequiresPermissions("repair:manage:export") + @ApiOperation(value = "导出维修任务列表") + public void export(HttpServletResponse response, RepairTask bean) { + List list = service.exportRepairTaskList(bean); + ExcelUtil util = new ExcelUtil<>(RepairTask.class); + util.exportExcel(response, list, "维修任务列表"); + } + + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java index 261b17d0..8061f653 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java @@ -7,20 +7,22 @@ import java.util.List; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import lombok.experimental.Accessors; /** * 维修记录对象 repair_apply_record * - * @author xsheng - * @date 2024-10-16 + * @author syruan */ - - +@EqualsAndHashCode(callSuper = false) @Data @ToString +@Accessors(chain = true) public class RepairApplyRecord extends BaseEntity { + private static final long serialVersionUID = 1L; /** $column.columnComment */ @@ -53,7 +55,7 @@ public class RepairApplyRecord extends BaseEntity { /** 维修方式(1内部2返厂3报废) */ @Excel(name = "维修方式", readConverterExp = "1=内部2返厂3报废") - private String repairType; + private Integer repairType; /** 数据所属组织 */ @Excel(name = "数据所属组织") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java index 18f32154..b67d30fe 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java @@ -1,6 +1,7 @@ package com.bonus.material.repair.domain.vo; import com.bonus.material.repair.domain.RepairPart; +import com.bonus.material.repair.domain.RepairPartDetails; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; @@ -24,12 +25,18 @@ public class RepairDeviceVO { @ApiModelProperty(value = "任务ID") private Long taskId; + @ApiModelProperty(value = "设备表主键id") + private Long maId; + @ApiModelProperty(value = "设备类型") private String typeName; @ApiModelProperty(value = "规格型号") private String type; + @ApiModelProperty(value = "规格型号ID") + private Long typeId; + @ApiModelProperty(value = "设备编码") private String code; @@ -42,54 +49,69 @@ public class RepairDeviceVO { @ApiModelProperty(value = "维修方式: 1内部 2外部返厂 3报废") private Integer repairType; + @ApiModelProperty(value = "维修人员") + private String repairer; + + @ApiModelProperty(value = "管理模式") + private Integer manageType; + @ApiModelProperty(value = "附件") private String fileUrl; + @ApiModelProperty(value = "维修数量") + private int repairNum; + + @ApiModelProperty(value = "维修合格数量") + private int repairedNum; + + @ApiModelProperty(value = "维修报废数量") + private int scrapNum; + @ApiModelProperty(value = "编码--内部维修配件集合") - private List codeInRepairPartList; + private List codeInRepairPartList; @ApiModelProperty(value = "编码--返厂维修配件集合") - private List codeOutRepairPartList; + private List codeOutRepairPartList; @ApiModelProperty(value = "编码--报废维修配件集合") - private List codeScrapRepairPartList; + private List codeScrapRepairPartList; @ApiModelProperty(value = "数量--内部维修配件集合") - private List numberInRepairPartList; + private List numberInRepairPartList; @ApiModelProperty(value = "数量--返厂维修配件集合") - private List numberOutRepairPartList; + private List numberOutRepairPartList; @ApiModelProperty(value = "数量--报废维修配件集合") - private List numberScrapRepairPartList; + private List numberScrapRepairPartList; // 手动覆盖 getter 方法,确保 List 始终被初始化 - public List getCodeInRepairPartList() { + public List getCodeInRepairPartList() { if (this.codeInRepairPartList == null) {this.codeInRepairPartList = new ArrayList<>();} return this.codeInRepairPartList; } - public List getCodeOutRepairPartList() { + public List getCodeOutRepairPartList() { if (this.codeOutRepairPartList == null) {this.codeOutRepairPartList = new ArrayList<>();} return this.codeOutRepairPartList; } - public List getCodeScrapRepairPartList() { + public List getCodeScrapRepairPartList() { if (this.codeScrapRepairPartList == null) {this.codeScrapRepairPartList = new ArrayList<>();} return this.codeScrapRepairPartList; } - public List getNumberInRepairPartList() { + public List getNumberInRepairPartList() { if (this.numberInRepairPartList == null) {this.numberInRepairPartList = new ArrayList<>();} return this.numberInRepairPartList; } - public List getNumberOutRepairPartList() { + public List getNumberOutRepairPartList() { if (this.numberOutRepairPartList == null) {this.numberOutRepairPartList = new ArrayList<>();} return this.numberOutRepairPartList; } - public List getNumberScrapRepairPartList() { + public List getNumberScrapRepairPartList() { if (this.numberScrapRepairPartList == null) {this.numberScrapRepairPartList = new ArrayList<>();} return this.numberScrapRepairPartList; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java index 67ef5235..a9668836 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java @@ -108,7 +108,7 @@ public interface RepairMapper { * @param repairNum 维修数量 * @param userid 用户id */ - int updateRepairedNumTwo(@Param("id")Long id, @Param("repairNum")int repairNum, @Param("userId")Long userid); + int updateRepairedNumTwo(@Param("id") Long id, @Param("repairNum") int repairNum, @Param("userId") Long userid); /** * 查询是否存在未完成维修的 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java index 4608da83..ee87204d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java @@ -6,6 +6,7 @@ import com.bonus.material.repair.domain.RepairApplyRecord; import com.bonus.material.repair.domain.RepairTask; import com.bonus.material.repair.domain.RepairTaskDetails; import com.bonus.material.repair.domain.vo.RepairDeviceListVo; +import com.bonus.material.repair.domain.vo.RepairDeviceVO; import com.bonus.system.api.domain.SysUser; import java.util.ArrayList; @@ -40,6 +41,8 @@ public interface RepairService { */ AjaxResult fastRepairApply(List list); + AjaxResult batchRepairApply(List repairDeviceVOList); + /** * 维修明细--批量审核--更新明细status */ 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 c53c9450..805a0b83 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 @@ -7,10 +7,7 @@ import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; -import com.bonus.material.repair.domain.RepairApplyRecord; -import com.bonus.material.repair.domain.RepairPartDetails; -import com.bonus.material.repair.domain.RepairTask; -import com.bonus.material.repair.domain.RepairTaskDetails; +import com.bonus.material.repair.domain.*; import com.bonus.material.repair.domain.vo.RepairDeviceListVo; import com.bonus.material.repair.domain.vo.RepairDeviceVO; import com.bonus.material.repair.mapper.RepairMapper; @@ -40,6 +37,17 @@ public class RepairServiceImpl implements RepairService { @Resource private TmTaskMapper taskMapper; + // 内部维修类型 + private final int inRepairType = 1; + // 返厂维修类型 + private final int outRepairType = 2; + // 报废维修类型 + private final int scrapRepairType = 3; + + // 维修管理方式--编码 + private final int manageTypeByCode = 0; + private final int manageTypeByNumber = 1; + @Override public List getRepairTaskList(RepairTask bean) { @@ -104,14 +112,9 @@ public class RepairServiceImpl implements RepairService { List partList = bean.getPartList(); BigDecimal sfCosts = new BigDecimal("0"); - // 内部维修类型 - String inRepairType = "1"; - // 返厂维修类型 - String outRepairType = "2"; + // 收费配件 String sfPart = "1"; - // 不收费配件 - String bsfPart = "0"; if (CollectionUtil.isNotEmpty(partList)) { bean.setRepairNum(partList.get(0).getRepairNum()); @@ -120,19 +123,19 @@ public class RepairServiceImpl implements RepairService { // 根据维修类型,更新维修数量、报废数量 switch (bean.getRepairType()) { - case "1": { + case inRepairType: { int repairNum = getNum(bean, details); // 更新维修数量、并修改维修人员 repairMapper.updateRepairedNum(bean.getId(), repairNum, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); break; } - case "2": { + case outRepairType: { int repairNum = getNum(bean, details); // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); break; } - case "3": { + case scrapRepairType: { int scrapNum = details.getScrapNum() + bean.getScrapNum(); int num = scrapNum + details.getRepairedNum(); if (num > details.getRepairNum()) { @@ -149,7 +152,7 @@ public class RepairServiceImpl implements RepairService { // 判断配件列表是否为空 if (CollectionUtil.isNotEmpty(partList)) { // 内部维修 - if (inRepairType.equals(bean.getRepairType())) { + if (Objects.equals(inRepairType, bean.getRepairType())) { // 遍历配件列表,判断配件类型,收费还是不收费 for (RepairPartDetails partDetails : partList) { if (partDetails.getPartId() != null) { @@ -185,7 +188,7 @@ public class RepairServiceImpl implements RepairService { } // 返厂维修 - if (outRepairType.equals(bean.getRepairType())) { + if (outRepairType == bean.getRepairType()) { bean.setPartName(partList.get(0).getPartName()); bean.setPartType(partList.get(0).getPartType()); bean.setRepairContent(partList.get(0).getRepairContent()); @@ -256,7 +259,7 @@ public class RepairServiceImpl implements RepairService { repairRecord.setTypeId(Long.valueOf(bean.getTypeId())); repairRecord.setRepairNum(repairedNum); // 快捷维修,设置为内部维修 - repairRecord.setRepairType("1"); + repairRecord.setRepairType(inRepairType); repairRecord.setCreateBy(String.valueOf(loginUser.getUserid())); repairRecord.setCompanyId(bean.getCompanyId()); repairMapper.addRecord(repairRecord); @@ -268,6 +271,168 @@ public class RepairServiceImpl implements RepairService { return AjaxResult.success(); } + @Override + public AjaxResult batchRepairApply(@NotNull List repairDeviceVOList) { + // 准备业务逻辑数据 + LoginUser loginUser = SecurityUtils.getLoginUser(); + // 配件集合 + List partList = new ArrayList<>(); + + // 校验参数,过滤空数据 + repairDeviceVOList.removeIf(Objects::isNull); + + for (RepairDeviceVO bean : repairDeviceVOList) { + if (bean.getManageType() == null) { + throw new ServiceException("请选择物资管理方式"); + } + if (Objects.equals(manageTypeByCode, bean.getManageType())) { + // 物资管理方式--编码管理 + // 根据维修方式,更新维修数量、报废数量 + switch (bean.getRepairType()) { + case inRepairType: { + partList = bean.getCodeInRepairPartList(); + // 更新维修数量、并修改维修人员 + repairMapper.updateRepairedNum(bean.getId(), 1, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); + break; + } + case outRepairType: { + partList = bean.getCodeOutRepairPartList(); + // 更新维修数量、维修人员不变 + repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid()); + break; + } + case scrapRepairType: { + partList = bean.getCodeScrapRepairPartList(); + // 更新报废数量 + repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); + break; + } + default: + System.err.println("请输入正确的维修类型:" + bean.getRepairType()); + break; + } + + // 处理配件集合数据 + if (CollectionUtil.isNotEmpty(partList)) { + // 遍历配件列表,判断配件类型,收费还是不收费 + for (RepairPartDetails partDetails : partList) { + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(bean.getRepairType()); + repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); + repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + + if (partDetails.getPartId() != null) { + // 有维修配件时,如果价格为空,设置为0 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setTaskId(bean.getTaskId()); + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); + partDetails.setCompanyId(null); + + // 根据 partId 找配件单价 + BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); + // 设置配件费用 + partDetails.setPartCost(partPrice); + // 添加【维修配件明细表】 + repairMapper.addPart(partDetails); + + // 设置配件费用 + repairApplyRecord.setPartPrice(partDetails.getPartCost()); + repairApplyRecord.setPartId((long) partDetails.getPartId().intValue()); + repairApplyRecord.setPartNum(partDetails.getPartNum()); + repairApplyRecord.setRepairContent(partDetails.getRepairContent()); + repairApplyRecord.setPartType(partDetails.getPartType()); + // 添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } else { + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } + } else { + // 配件为空,添加【维修记录表】 + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(bean.getRepairType()); + repairApplyRecord.setRepairNum(bean.getRepairType() != 3 ? 1 : 0); + repairApplyRecord.setScrapNum(bean.getRepairType() == 3 ? 1 : 0); + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + + + } else if (Objects.equals(manageTypeByNumber, bean.getManageType())) { + // 物资管理方式--数量管理 + + if (bean.getId() == null) { + throw new ServiceException("请完善参数,维修详情ID为空!"); + } + // 获取维修详情表中的维修详情记录:待维修、已维修、报废的数量 + RepairTaskDetails details = repairMapper.getById(bean.getId()); + + if (details == null) { + throw new ServiceException("此维修记录不存在,请检查!"); + } + + // 根据维修方式,更新维修数量、报废数量 + switch (bean.getRepairType()) { + case inRepairType: { + partList = bean.getCodeInRepairPartList(); + // 更新维修数量、并修改维修人员 + repairMapper.updateRepairedNum(bean.getId(), 1, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); + break; + } + case outRepairType: { + partList = bean.getCodeOutRepairPartList(); + // 更新维修数量、维修人员不变 + repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid()); + break; + } + case scrapRepairType: { + partList = bean.getCodeScrapRepairPartList(); + + // -------------校验维修数量---------------- + // 统计历史已报废数量 + 本次报废数量 = 报废总数 + int scrapNum = details.getScrapNum() + bean.getScrapNum(); + // 统计 报废总数 + 历史已维修数量, + int num = scrapNum + details.getRepairedNum(); + // 不能大与总的待维修数量 + if (num > details.getRepairNum()) { + throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum()); + } + + // 更新报废数量 + repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); + break; + } + default: + System.err.println("请输入正确的维修类型:" + bean.getRepairType()); + break; + } + + } else { + throw new ServiceException("请选择维修类型"); + } + } + + + return AjaxResult.success("维修完成"); + } + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult endRepairTask(@NotNull List taskList) { From 9ccc563fecc2f26f99ed9e321ddbebf4c4dc3f94 Mon Sep 17 00:00:00 2001 From: mashuai Date: Mon, 18 Nov 2024 14:23:47 +0800 Subject: [PATCH 09/47] =?UTF-8?q?=E5=85=A5=E5=BA=93=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchaseStorageController.java | 9 +++ .../purchase/domain/PurchaseCheckDetails.java | 3 + .../purchase/domain/dto/PurchaseDto.java | 7 +- .../purchase/mapper/PurchaseBindMapper.java | 3 + .../mapper/PurchaseStorageMapper.java | 4 +- .../service/IPurchaseStorageService.java | 7 ++ .../impl/PurchaseStorageServiceImpl.java | 74 +++++++++++++------ .../material/purchase/PurchaseBindMapper.xml | 18 ++++- .../purchase/PurchaseStorageMapper.xml | 2 +- 9 files changed, 99 insertions(+), 28 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseStorageController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseStorageController.java index 3929aafd..4d0c0fbb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseStorageController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseStorageController.java @@ -70,6 +70,15 @@ public class PurchaseStorageController extends BaseController { return purchaseStorageService.warehouse(dto); } + + @ApiOperation(value = "查询待绑定编号机具详情") + @PreventRepeatSubmit + @RequiresPermissions("purchase:storage:list") + @PostMapping("/getMachineById") + public AjaxResult getMachineById(@RequestBody PurchaseDto dto) { + return purchaseStorageService.getMachineById(dto); + } + /** * 驳回或批量驳回 * @param dto diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java index 5f53845a..3b19acaa 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java @@ -40,6 +40,9 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "规格名称") private String typeName; + @ApiModelProperty(value = "机具编号") + private String maCode; + @ApiModelProperty(value = "物资单位名称") private String unitName; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseDto.java index a68333fe..b2a52efb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseDto.java @@ -20,6 +20,8 @@ import java.util.List; @NoArgsConstructor public class PurchaseDto { + private Long id; + @ApiModelProperty(value = "id") private String taskId; @@ -45,7 +47,7 @@ public class PurchaseDto { private Integer status; @ApiModelProperty(value = "出厂日期") - private String productDate; + private Date productDate; @ApiModelProperty(value = "二级明细id") private String purchaseId; @@ -74,6 +76,9 @@ public class PurchaseDto { @ApiModelProperty(value = "提交绑定数据集合") private List dtoList; + @ApiModelProperty(value = "提交入库数据集合") + private List inPutList; + /** 是否是固定资产编号(0 否,1 是) */ @ApiModelProperty(value = "是否是固定资产编号(0 否,1 是)") private String fixCode; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java index b1eff88b..7ca6cf1b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java @@ -1,5 +1,6 @@ package com.bonus.material.purchase.mapper; +import com.bonus.material.purchase.domain.PurchaseCheckDetails; import com.bonus.material.purchase.domain.dto.PurchaseDto; import com.bonus.material.purchase.domain.vo.PurchaseVo; import org.apache.ibatis.annotations.Param; @@ -95,4 +96,6 @@ public interface PurchaseBindMapper { * @return */ List getDetailById(PurchaseDto purchaseDto); + + List getMachineById(PurchaseDto dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseStorageMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseStorageMapper.java index 15d50a8a..5a740c84 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseStorageMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseStorageMapper.java @@ -45,10 +45,10 @@ public interface PurchaseStorageMapper { /** * 新增机具入库记录 - * @param detail + * @param dto * @return */ - int insertMachine(PurchaseVo detail); + int insertMachine(PurchaseDto dto); /** * 更新库存数量 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseStorageService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseStorageService.java index f169ce33..07ffccdb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseStorageService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/IPurchaseStorageService.java @@ -40,4 +40,11 @@ public interface IPurchaseStorageService { * @return */ AjaxResult reject(PurchaseDto dto); + + /** + * 查询机具信息 + * @param dto + * @return + */ + AjaxResult getMachineById(PurchaseDto dto); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java index 55736ffc..8a870291 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java @@ -8,6 +8,7 @@ import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.ma.mapper.MachineMapper; import com.bonus.material.purchase.config.RemoteConfig; +import com.bonus.material.purchase.domain.PurchaseCheckDetails; import com.bonus.material.purchase.domain.dto.PurchaseDto; import com.bonus.material.purchase.mapper.PurchaseBindMapper; import com.bonus.material.purchase.mapper.PurchaseStorageMapper; @@ -91,14 +92,12 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult warehouse(PurchaseDto dto) { - if (dto.getTaskId() != null) { + //内层入库 + return processByPurchaseIds(dto); + /*if (dto.getTaskId() != null) { //外层入库 return processByTaskIds(dto); - } else if (dto.getPurchaseId() != null) { - //内层入库 - return processByPurchaseIds(dto); - } - return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); + }*/ } /** @@ -119,6 +118,17 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } + /** + * 查询机具详情 + * @param dto + * @return + */ + @Override + public AjaxResult getMachineById(PurchaseDto dto) { + List list = purchaseBindMapper.getMachineById(dto); + return AjaxResult.success(list); + } + /** * 内层驳回 * @param purchaseDto @@ -195,13 +205,36 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { purchaseDto.setStatus(PurchaseTaskStatusEnum.IN_STORE.getStatus()); int result = 0; try { - List details = purchaseBindMapper.getDetails(purchaseDto); - List purchaseVoList = purchaseBindMapper.getDetailById(purchaseDto); - if (CollectionUtils.isNotEmpty(details)) { - result += updatePurchaseInfoAndDetails(purchaseVoList, details.get(0), Integer.parseInt(purchaseDto.getPurchaseId())); - List statusList = purchaseStorageMapper.select(details.get(0).getTaskId().toString()); - result += updateTaskStatus(statusList); + //判断为数量还是编码入库 + if (CollectionUtils.isEmpty(purchaseDto.getInPutList())) { + //数量入库 + List details = purchaseBindMapper.getDetails(purchaseDto); + result += updatePurchaseInfoAndDetails(details.get(0), Integer.parseInt(purchaseDto.getPurchaseId())); + } else { + //编码入库 + List purchaseVoList = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto); + for (PurchaseDto dto : purchaseDto.getInPutList()) { + if (CollectionUtils.isNotEmpty(purchaseVoList)) { + for (PurchaseVo purchaseVo : purchaseVoList) { + if (purchaseVo.getMaCode().equals(dto.getMaCode())) { + dto.setOutFacCode(purchaseVo.getOutFacCode() == null ? "" : purchaseVo.getOutFacCode()); + dto.setProductDate(purchaseVo.getProductDate() == null ? null : purchaseVo.getProductDate()); + } + } + } + dto.setTypeId(purchaseDto.getTypeId()); + result += purchaseStorageMapper.insertMachine(dto); + result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), purchaseDto.getInPutList().size()); + List list = purchaseBindMapper.getMachineById(dto); + if (CollectionUtils.isNotEmpty(list)) { + result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId())); + } else { + result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId())); + } + } } + List statusList = purchaseStorageMapper.select(purchaseDto.getTaskId()); + result += updateTaskStatus(statusList); if (result > 0) { return AjaxResult.success("入库成功"); } @@ -217,16 +250,10 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { * @param purchaseId * @return */ - private int updatePurchaseInfoAndDetails(List details, PurchaseVo detail, int purchaseId) { - int result = purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId); - if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) { - for (PurchaseVo purchaseVo : details) { - result += purchaseStorageMapper.insertMachine(purchaseVo); - } - } else if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) { - result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId()); - } - return result + purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum()); + private int updatePurchaseInfoAndDetails(PurchaseVo detail, int purchaseId) { + int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getCheckNum()); + result += purchaseStorageMapper.updateStorageNum(detail.getCheckNum(), detail.getTypeId()); + return result + purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), purchaseId); } /** @@ -266,7 +293,8 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { int result = purchaseStorageMapper.updateNum(detail.getPurchaseId(), detail.getBindNum()); result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(detail.getPurchaseId())); if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) { - result += purchaseStorageMapper.insertMachine(detail); + //根据类型id获取设备详情信息 + //result += purchaseStorageMapper.insertMachine(detail); } else if (MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(Integer.valueOf(detail.getManageType()))) { result += purchaseStorageMapper.updateStorageNum(detail.getBindNum(), detail.getTypeId()); } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseBindMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseBindMapper.xml index 96f774cd..ce3f94f6 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseBindMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseBindMapper.xml @@ -230,7 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN purchase_macode_info pm on pcd.task_id = pm.task_id and pm.type_id = pcd.type_id where 1 = 1 - AND mt.id = #{typeId} + AND mt.type_id = #{typeId} AND ms.supplier_id = #{supplierId} @@ -319,4 +319,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml index 9eade9d8..df3e46bf 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml @@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" UPDATE purchase_check_details - SET input_num = #{bindNum}, + SET input_num = COALESCE(input_num, 0) + #{bindNum}, input_time = now() WHERE id = #{id} From 7a381a0de4266afbdea553f759853df60713cb49 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Nov 2024 14:51:19 +0800 Subject: [PATCH 10/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=BB=B4=E4=BF=AE=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RepairServiceImpl.java | 215 ++++++++++-------- 1 file changed, 119 insertions(+), 96 deletions(-) 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 805a0b83..690357d6 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 @@ -46,6 +46,7 @@ public class RepairServiceImpl implements RepairService { // 维修管理方式--编码 private final int manageTypeByCode = 0; + // 维修管理方式--数量 private final int manageTypeByNumber = 1; @@ -126,7 +127,7 @@ public class RepairServiceImpl implements RepairService { case inRepairType: { int repairNum = getNum(bean, details); // 更新维修数量、并修改维修人员 - repairMapper.updateRepairedNum(bean.getId(), repairNum, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); + repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); break; } case outRepairType: { @@ -292,7 +293,7 @@ public class RepairServiceImpl implements RepairService { case inRepairType: { partList = bean.getCodeInRepairPartList(); // 更新维修数量、并修改维修人员 - repairMapper.updateRepairedNum(bean.getId(), 1, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); + repairMapper.updateRepairedNum(bean.getId(), 1, loginUser.getUserid(), loginUser.getUserid()); break; } case outRepairType: { @@ -313,66 +314,7 @@ public class RepairServiceImpl implements RepairService { } // 处理配件集合数据 - if (CollectionUtil.isNotEmpty(partList)) { - // 遍历配件列表,判断配件类型,收费还是不收费 - for (RepairPartDetails partDetails : partList) { - // 维修记录表信息 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(bean.getRepairType()); - repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); - repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); - repairApplyRecord.setCreateBy(loginUser.getUsername()); - repairApplyRecord.setStatus(0L); - - if (partDetails.getPartId() != null) { - // 有维修配件时,如果价格为空,设置为0 - if (partDetails.getPartCost() == null) { - partDetails.setPartCost(new BigDecimal(0)); - } - partDetails.setTaskId(bean.getTaskId()); - partDetails.setMaId(bean.getMaId()); - partDetails.setTypeId(bean.getTypeId()); - partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); - partDetails.setCompanyId(null); - - // 根据 partId 找配件单价 - BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); - // 设置配件费用 - partDetails.setPartCost(partPrice); - // 添加【维修配件明细表】 - repairMapper.addPart(partDetails); - - // 设置配件费用 - repairApplyRecord.setPartPrice(partDetails.getPartCost()); - repairApplyRecord.setPartId((long) partDetails.getPartId().intValue()); - repairApplyRecord.setPartNum(partDetails.getPartNum()); - repairApplyRecord.setRepairContent(partDetails.getRepairContent()); - repairApplyRecord.setPartType(partDetails.getPartType()); - // 添加【维修记录表】 - repairMapper.addRecord(repairApplyRecord); - } else { - // 不选维修配件时, 只添加【维修记录表】 - repairMapper.addRecord(repairApplyRecord); - } - } - } else { - // 配件为空,添加【维修记录表】 - // 维修记录表信息 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(bean.getRepairType()); - repairApplyRecord.setRepairNum(bean.getRepairType() != 3 ? 1 : 0); - repairApplyRecord.setScrapNum(bean.getRepairType() == 3 ? 1 : 0); - repairApplyRecord.setCreateBy(loginUser.getUsername()); - repairApplyRecord.setStatus(0L); - // 不选维修配件时, 只添加【维修记录表】 - repairMapper.addRecord(repairApplyRecord); - } + copeNumberManageInList(bean, partList, loginUser); } else if (Objects.equals(manageTypeByNumber, bean.getManageType())) { @@ -381,47 +323,64 @@ public class RepairServiceImpl implements RepairService { if (bean.getId() == null) { throw new ServiceException("请完善参数,维修详情ID为空!"); } - // 获取维修详情表中的维修详情记录:待维修、已维修、报废的数量 + // 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量 RepairTaskDetails details = repairMapper.getById(bean.getId()); if (details == null) { - throw new ServiceException("此维修记录不存在,请检查!"); + throw new ServiceException("此维修记录不存在,请检查后提交!"); } - // 根据维修方式,更新维修数量、报废数量 - switch (bean.getRepairType()) { - case inRepairType: { - partList = bean.getCodeInRepairPartList(); - // 更新维修数量、并修改维修人员 - repairMapper.updateRepairedNum(bean.getId(), 1, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); - break; - } - case outRepairType: { - partList = bean.getCodeOutRepairPartList(); - // 更新维修数量、维修人员不变 - repairMapper.updateRepairedNumTwo(bean.getId(), 1, loginUser.getUserid()); - break; - } - case scrapRepairType: { - partList = bean.getCodeScrapRepairPartList(); + if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) { + partList = bean.getNumberInRepairPartList(); - // -------------校验维修数量---------------- - // 统计历史已报废数量 + 本次报废数量 = 报废总数 - int scrapNum = details.getScrapNum() + bean.getScrapNum(); - // 统计 报废总数 + 历史已维修数量, - int num = scrapNum + details.getRepairedNum(); - // 不能大与总的待维修数量 - if (num > details.getRepairNum()) { - throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum()); - } - - // 更新报废数量 - repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); - break; + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + int repairNum = details.getRepairedNum() + bean.getRepairNum(); + // 统计报废数量 + 维修合计数量 + int num = repairNum + details.getScrapNum(); + if (num > details.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); } - default: - System.err.println("请输入正确的维修类型:" + bean.getRepairType()); - break; + // ---------------校验维修数量----------------- + + // 更新维修数量、并修改维修人员 + repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); + + copeNumberManageInList(bean, partList, loginUser); + + } + if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) { + partList = bean.getNumberOutRepairPartList(); + + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + int repairNum = details.getRepairedNum() + bean.getRepairNum(); + // 统计报废数量 + 维修合计数量 + int num = repairNum + details.getScrapNum(); + if (num > details.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } + // ---------------校验维修数量----------------- + + // 更新维修数量、维修人员不变 + repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); + } + if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) { + partList = bean.getNumberScrapRepairPartList(); + + // -------------校验维修数量开始---------------- + // 统计历史已报废数量 + 本次报废数量 = 报废总数 + int scrapNum = details.getScrapNum() + bean.getScrapNum(); + // 统计 报废总数 + 历史已维修数量, + int num = scrapNum + details.getRepairedNum(); + // 不能大与总的待维修数量 + if (num > details.getRepairNum()) { + throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum()); + } + // -------------校验维修数量结束---------------- + + // 更新报废数量 + repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); } } else { @@ -433,6 +392,70 @@ public class RepairServiceImpl implements RepairService { return AjaxResult.success("维修完成"); } + private void copeNumberManageInList(RepairDeviceVO bean, List partList, LoginUser loginUser) { + // 处理配件集合数据 + if (CollectionUtil.isNotEmpty(partList)) { + // 遍历配件列表,判断配件类型,收费还是不收费 + for (RepairPartDetails partDetails : partList) { + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(bean.getRepairType()); + repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); + repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + + if (partDetails.getPartId() != null) { + // 有维修配件时,如果价格为空,设置为0 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setTaskId(bean.getTaskId()); + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); + partDetails.setCompanyId(null); + + // 根据 partId 找配件单价 + BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); + // 设置配件费用 + partDetails.setPartCost(partPrice); + // 添加【维修配件明细表】 + repairMapper.addPart(partDetails); + + // 设置配件费用 + repairApplyRecord.setPartPrice(partDetails.getPartCost()); + repairApplyRecord.setPartId((long) partDetails.getPartId().intValue()); + repairApplyRecord.setPartNum(partDetails.getPartNum()); + repairApplyRecord.setRepairContent(partDetails.getRepairContent()); + repairApplyRecord.setPartType(partDetails.getPartType()); + // 添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } else { + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } + } else { + // 配件为空,添加【维修记录表】 + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(bean.getRepairType()); + repairApplyRecord.setRepairNum(bean.getRepairType() != 3 ? 1 : 0); + repairApplyRecord.setScrapNum(bean.getRepairType() == 3 ? 1 : 0); + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult endRepairTask(@NotNull List taskList) { From ad84dc38b2ec3d74347561c108720d65741d59ca Mon Sep 17 00:00:00 2001 From: mashuai Date: Mon, 18 Nov 2024 14:55:20 +0800 Subject: [PATCH 11/47] =?UTF-8?q?=E5=85=A5=E5=BA=93=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/service/impl/PurchaseStorageServiceImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java index 8a870291..09431f89 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java @@ -202,7 +202,6 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { * @return */ private AjaxResult processByPurchaseIds(PurchaseDto purchaseDto) { - purchaseDto.setStatus(PurchaseTaskStatusEnum.IN_STORE.getStatus()); int result = 0; try { //判断为数量还是编码入库 @@ -213,6 +212,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { } else { //编码入库 List purchaseVoList = purchaseBindMapper.selectPurchaseCheckInfoById(purchaseDto); + result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), purchaseDto.getInPutList().size()); for (PurchaseDto dto : purchaseDto.getInPutList()) { if (CollectionUtils.isNotEmpty(purchaseVoList)) { for (PurchaseVo purchaseVo : purchaseVoList) { @@ -224,10 +224,9 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { } dto.setTypeId(purchaseDto.getTypeId()); result += purchaseStorageMapper.insertMachine(dto); - result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), purchaseDto.getInPutList().size()); - List list = purchaseBindMapper.getMachineById(dto); + List list = purchaseBindMapper.getMachineById(purchaseDto); if (CollectionUtils.isNotEmpty(list)) { - result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId())); + result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId())); } else { result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), Integer.parseInt(purchaseDto.getPurchaseId())); } From b5fdfb50a9f2b2332706cd8fd0a52c6a75e6efbc Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 14:58:37 +0800 Subject: [PATCH 12/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PurchaseCheckInfoServiceImpl.java | 20 ++++++++++--------- .../impl/PurchaseNoticePersonServiceImpl.java | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 0d9aaf0e..a71a8bc8 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -120,7 +120,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> !(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(o.getManageType()) && (o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND.getStatus()) || o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus())))).collect(Collectors.toList()); OptionalInt minStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).min(); - OptionalInt maxStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).max(); + //OptionalInt maxStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).max(); if (isAllowPartTransfer) { purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList()); purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), purchaseQueryDto.getStatusList())); @@ -146,13 +146,15 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { purchaseInfo.setPurchaseTaxPrice(calculateTaxPrice(purchaseMaTotalPrice.get(), purchaseInfo.getTaxRate())); } // 设置外层任务状态:入库待开始、入库进行中、入库已完成 - if (maxStatus.isPresent() && maxStatus.getAsInt() == PurchaseTaskStatusEnum.TO_NOTICE.getStatus()) { - purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus()); // 外层任务待开始 - } else if (minStatus.isPresent() && minStatus.getAsInt() == PurchaseTaskStatusEnum.IN_STORE.getStatus()) { - purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus()); // 外层任务已完成 - } else { - purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus()); //外层任务进行中 - } + TmTask tmTask = tmTaskMapper.selectTmTaskByTaskId(purchaseInfo.getTaskId()); + purchaseInfo.setTaskStatus(tmTask.getTaskStatus()); +// if (maxStatus.isPresent() && maxStatus.getAsInt() == PurchaseTaskStatusEnum.TO_NOTICE.getStatus()) { +// purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus()); // 外层任务待开始 +// } else if (minStatus.isPresent() && minStatus.getAsInt() == PurchaseTaskStatusEnum.IN_STORE.getStatus()) { +// purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus()); // 外层任务已完成 +// } else { +// purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus()); //外层任务进行中 +// } // 设置外层任务列表 if (isAllowPartTransfer) { purchaseCheckInfoResult.add(purchaseInfo); @@ -203,7 +205,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId()); String taskCode = genderTaskCode(thisMonthMaxOrder); TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId(), - PurchaseTaskStatusEnum.TO_NOTICE.getStatus(), + PurchaseTaskStatusEnum.TASK_TO_START.getStatus(), purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTaskMapper.insertTmTask(tmTask); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java index 3d5e8e36..81861017 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseNoticePersonServiceImpl.java @@ -79,7 +79,7 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer tmTaskMapper.updateTmTask(new TmTask() .setTaskId(purchaseNoticePersonDto.getTaskId()) .setTaskType(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId()) - .setTaskStatus(PurchaseTaskStatusEnum.TO_CHECK.getStatus()) + .setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus()) ); // 修改采购明细的任务状态 From a8956fa0f830d3b74b8debad566bbb0d70bebbeb Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 15:14:29 +0800 Subject: [PATCH 13/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96tm=5Ftask=E5=8E=BB=E9=99=A4status?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/LeaseApplyInfoServiceImpl.java | 2 +- .../impl/PurchaseCheckInfoServiceImpl.java | 2 +- .../bonus/material/task/domain/TmTask.java | 8 +- .../material/back/BackApplyInfoMapper.xml | 2 +- .../mapper/material/task/TmTaskMapper.xml | 123 +----------------- 5 files changed, 5 insertions(+), 132 deletions(-) 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 36368d6e..e05866a5 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 @@ -116,7 +116,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { String taskCode = genderTaskCode(thisMonthMaxOrder); TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId(), LeaseTaskStatusEnum.LEASE_TASK_TO_PUBLISHED.getStatus(), - leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); + leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTask.setCreateBy(SecurityUtils.getUsername()); tmTaskMapper.insertTmTask(tmTask); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index a71a8bc8..2ef4b115 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -206,7 +206,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { String taskCode = genderTaskCode(thisMonthMaxOrder); TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId(), PurchaseTaskStatusEnum.TASK_TO_START.getStatus(), - purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); + purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTaskMapper.insertTmTask(tmTask); Long taskId = tmTask.getTaskId(); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java index a6eaf172..c3f67041 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTask.java @@ -46,20 +46,14 @@ public class TmTask extends BaseEntity { @ApiModelProperty(value = "数据所属组织") private Long companyId; - /** 0不启用 1启用 */ - @Excel(name = "0不启用 1启用") - @ApiModelProperty(value = "0不启用 1启用") - private String status; - @ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型") private Integer monthOrder; - public TmTask(Long taskId, Integer taskType, Integer taskStatus, Long companyId, String status, Integer monthOrder, String code) { + public TmTask(Long taskId, Integer taskType, Integer taskStatus, Long companyId, Integer monthOrder, String code) { this.taskId = taskId; this.taskType = taskType; this.taskStatus = taskStatus; this.companyId = companyId; - this.status = status; this.monthOrder = monthOrder; this.code = code; } 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 8f35ce34..3210a194 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 @@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM back_apply_info bai LEFT JOIN back_apply_details bad on bad.parent_id = bai.id - LEFT JOIN tm_task tt on tt.task_id = bai.task_id and tt.status = '1' + LEFT JOIN tm_task tt on tt.task_id = bai.task_id LEFT JOIN tm_task_agreement tta on tta.task_id = tt.task_id LEFT JOIN bm_agreement_info bagi on bagi.agreement_id = tta.agreement_id AND bagi.`status` = '1' diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index bea4a162..85b57af1 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -14,13 +14,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select task_id, task_type, task_status, code, create_by, create_time, - update_by, update_time, remark, company_id, status, month_order + update_by, update_time, remark, company_id, month_order from tm_task @@ -33,7 +32,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and code = #{code} and month_order = #{monthOrder} and company_id = #{companyId} - and status = #{status} @@ -55,7 +53,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, remark, company_id, - `status`, #{taskType}, @@ -68,7 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateTime}, #{remark}, #{companyId}, - #{status}, @@ -85,7 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time = #{updateTime}, remark = #{remark}, company_id = #{companyId}, - `status` = #{status}, where task_id = #{taskId} @@ -137,120 +132,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY create_time DESC LIMIT 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 6fe995e8d8cb51fe21e3c40a1394af6e1d1ce614 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 15:31:17 +0800 Subject: [PATCH 14/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PurchaseCheckInfoServiceImpl.java | 8 ++++---- .../main/resources/mapper/material/task/TmTaskMapper.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 2ef4b115..77bbeb27 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -272,7 +272,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { updateCount += purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details); } } - // 注意: 维护tm_task的状态,但因为新购任务中的物资可以部分流转,所以汇总的状态失去意义,不再维护 } return updateCount > 0 ? AjaxResult.success("验证成功") : AjaxResult.error("无验证信息"); } catch (Exception e) { @@ -286,8 +285,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { try { AjaxResult result = new AjaxResult(); if (!CollectionUtils.isEmpty(purchaseVerifyVo.getPurchaseCheckDetailsList())) { - //Long taskId = purchaseVerifyVo.getPurchaseCheckDetailsList().get(0).getTaskId(); - //Integer status = purchaseCheckDetailsList.get(0).getStatus(); if (BooleanUtils.isTrue(purchaseVerifyVo.getVerifyPass())) { for (PurchaseCheckDetails details : purchaseVerifyVo.getPurchaseCheckDetailsList()) { if (MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(details.getManageType())) { @@ -301,9 +298,12 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { for (PurchaseCheckDetails details : purchaseVerifyVo.getPurchaseCheckDetailsList()) { details.setStatus(PurchaseTaskStatusEnum.TO_NOTICE.getStatus()); result = purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details) > 0 ? AjaxResult.success("detail验证驳回成功") : AjaxResult.error("details无验证信息"); + tmTaskMapper.updateTmTask(new TmTask() + .setTaskId(details.getTaskId()) + .setTaskType(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId()) + .setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus())); } } - // 注意: 维护tm_task的状态,但因为新购任务中的物资可以部分流转,所以汇总的状态失去意义,不再维护 } return result; } catch (Exception e) { diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index 85b57af1..ca60d937 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -78,9 +78,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, - update_time = #{updateTime}, remark = #{remark}, company_id = #{companyId}, + update_time = NOW() where task_id = #{taskId} From 65c7979cea36562fd2bd8c79329615781f807e00 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 15:56:55 +0800 Subject: [PATCH 15/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PurchaseCheckInfoServiceImpl.java | 8 -------- .../mapper/material/purchase/PurchaseCheckInfoMapper.xml | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 77bbeb27..b815c4d1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -120,7 +120,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> !(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId().equals(o.getManageType()) && (o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND.getStatus()) || o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus())))).collect(Collectors.toList()); OptionalInt minStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).min(); - //OptionalInt maxStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).max(); if (isAllowPartTransfer) { purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList()); purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), purchaseQueryDto.getStatusList())); @@ -148,13 +147,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { // 设置外层任务状态:入库待开始、入库进行中、入库已完成 TmTask tmTask = tmTaskMapper.selectTmTaskByTaskId(purchaseInfo.getTaskId()); purchaseInfo.setTaskStatus(tmTask.getTaskStatus()); -// if (maxStatus.isPresent() && maxStatus.getAsInt() == PurchaseTaskStatusEnum.TO_NOTICE.getStatus()) { -// purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus()); // 外层任务待开始 -// } else if (minStatus.isPresent() && minStatus.getAsInt() == PurchaseTaskStatusEnum.IN_STORE.getStatus()) { -// purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus()); // 外层任务已完成 -// } else { -// purchaseInfo.setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus()); //外层任务进行中 -// } // 设置外层任务列表 if (isAllowPartTransfer) { purchaseCheckInfoResult.add(purchaseInfo); diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml index 68ce8a16..d6d5e0c8 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml @@ -139,6 +139,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pci.purchaser = #{purchaser} and pci.supplier_id = #{supplierId} and pci.tax_rate = #{taxRate} + + and ( + t.code like concat('%', #{keyWord}, '%') or + msi.supplier like concat('%', #{keyWord}, '%') or + pci.create_by like concat('%', #{keyWord}, '%') or + pci.arrival_time like concat('%', #{keyWord}, '%') or + pci.create_time like concat('%', #{keyWord}, '%') + ) + From 7e4725c23189626b2efae55a0d066b53859a8799 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Nov 2024 17:30:07 +0800 Subject: [PATCH 16/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95=E6=8A=BD=E5=8F=96=E3=80=81?= =?UTF-8?q?=E5=B8=B8=E9=87=8F=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/domain/RepairApplyRecord.java | 2 +- .../repair/domain/RepairPartDetails.java | 4 +- .../material/repair/mapper/RepairMapper.java | 2 +- .../service/impl/RepairServiceImpl.java | 254 ++++++++++++------ .../mapper/material/repair/RepairMapper.xml | 4 +- 5 files changed, 181 insertions(+), 85 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java index 8061f653..026cabcc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairApplyRecord.java @@ -93,7 +93,7 @@ public class RepairApplyRecord extends BaseEntity { /** 类型(0不收费,1收费) */ @Excel(name = "类型", readConverterExp = "0=不收费,1收费") - private String partType; + private Integer partType; /** 配件名称 */ @Excel(name = "配件名称") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java index e7cf18b6..0cc08f07 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java @@ -13,8 +13,6 @@ import com.bonus.common.core.web.domain.BaseEntity; * @author xsheng * @date 2024-10-16 */ - - @Data @ToString public class RepairPartDetails extends BaseEntity { @@ -55,7 +53,7 @@ public class RepairPartDetails extends BaseEntity { /** 类型(0不收费,1收费) */ @Excel(name = "类型", readConverterExp = "0=不收费,1收费") - private String partType; + private Integer partType; /** 数据所属组织 */ @Excel(name = "数据所属组织") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java index a9668836..90ebeed6 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java @@ -136,7 +136,7 @@ public interface RepairMapper { /** * 新增维修费用 */ - int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs,@Param("partType") String partType); + int addRepairCost(@Param("bean") RepairApplyRecord bean, @Param("costs") BigDecimal costs, @Param("partType") String partType); /** * 查询配件价格 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 690357d6..b36eca9b 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 @@ -37,17 +37,11 @@ public class RepairServiceImpl implements RepairService { @Resource private TmTaskMapper taskMapper; - // 内部维修类型 - private final int inRepairType = 1; - // 返厂维修类型 - private final int outRepairType = 2; - // 报废维修类型 - private final int scrapRepairType = 3; + // 1:内部维修 2:外部返厂维修 3:报废 + private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3; - // 维修管理方式--编码 - private final int manageTypeByCode = 0; - // 维修管理方式--数量 - private final int manageTypeByNumber = 1; + // 维修管理方式--0:编码管理 1:数量管理 + private final int manageTypeByCode = 0, manageTypeByNumber = 1; @Override @@ -113,7 +107,6 @@ public class RepairServiceImpl implements RepairService { List partList = bean.getPartList(); BigDecimal sfCosts = new BigDecimal("0"); - // 收费配件 String sfPart = "1"; @@ -125,13 +118,13 @@ public class RepairServiceImpl implements RepairService { // 根据维修类型,更新维修数量、报废数量 switch (bean.getRepairType()) { case inRepairType: { - int repairNum = getNum(bean, details); + int repairNum = verifyRepairNum(bean, details); // 更新维修数量、并修改维修人员 repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); break; } case outRepairType: { - int repairNum = getNum(bean, details); + int repairNum = verifyRepairNum(bean, details); // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); break; @@ -209,13 +202,7 @@ public class RepairServiceImpl implements RepairService { } // 配件费用计算 - for (RepairPartDetails partDetails : partList) { - if (partDetails.getPartCost() != null) { - BigDecimal partCost = partDetails.getPartCost(); - BigDecimal partNumber = new BigDecimal(partDetails.getPartNum()); - sfCosts = sfCosts.add(partCost.multiply(partNumber)); - } - } + sfCosts = countPartCosts(partList, sfCosts); // 判断是否是收费配件 if (sfPart.equals(sfCosts.toString())) { @@ -229,7 +216,10 @@ public class RepairServiceImpl implements RepairService { return AjaxResult.success(); } - private static int getNum(RepairApplyRecord bean, RepairTaskDetails details) { + /** + * 校验维修数量 + */ + private static int verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) { int repairNum = details.getRepairedNum() + bean.getRepairNum(); int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { @@ -303,7 +293,8 @@ public class RepairServiceImpl implements RepairService { break; } case scrapRepairType: { - partList = bean.getCodeScrapRepairPartList(); + // 报废无需上传配件、直接初始化空集合 + partList = new ArrayList<>(0); // 更新报废数量 repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); break; @@ -313,13 +304,11 @@ public class RepairServiceImpl implements RepairService { break; } - // 处理配件集合数据 - copeNumberManageInList(bean, partList, loginUser); - + // 统一处理配件集合数据 + copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); } else if (Objects.equals(manageTypeByNumber, bean.getManageType())) { // 物资管理方式--数量管理 - if (bean.getId() == null) { throw new ServiceException("请完善参数,维修详情ID为空!"); } @@ -330,6 +319,7 @@ public class RepairServiceImpl implements RepairService { throw new ServiceException("此维修记录不存在,请检查后提交!"); } + // 处理配件--数量管理--内部维修 if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) { partList = bean.getNumberInRepairPartList(); @@ -342,14 +332,15 @@ public class RepairServiceImpl implements RepairService { throw new ServiceException("维修数量大于维修总量"); } // ---------------校验维修数量----------------- - // 更新维修数量、并修改维修人员 repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); - - copeNumberManageInList(bean, partList, loginUser); - + // 处理配件集合数据 + copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); } + + // 处理配件集合数据 -- 数量管理--外部返厂维修 if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) { + BigDecimal sfCosts = new BigDecimal("0"); partList = bean.getNumberOutRepairPartList(); // ---------------校验维修数量----------------- @@ -364,10 +355,37 @@ public class RepairServiceImpl implements RepairService { // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); - } - if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) { - partList = bean.getNumberScrapRepairPartList(); + // 数量管理--外部返厂维修 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(outRepairType); + repairApplyRecord.setPartName(partList.get(0).getPartName()); + repairApplyRecord.setPartType(partList.get(0).getPartType()); + repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); + if (partList.get(0).getSupplierId() == null) { + throw new ServiceException("请选择返厂厂家"); + } else { + repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); + } + if (partList.get(0).getPartPrice() == null) { + repairApplyRecord.setPartPrice(new BigDecimal(0)); + } else { + repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); + } + repairApplyRecord.setPartNum(partList.get(0).getPartNum()); + // 新增【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + + sfCosts = countPartCosts(partList, sfCosts); + // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 + // SQL: 新增【维修费用记录表】 + repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); + } + + if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) { // -------------校验维修数量开始---------------- // 统计历史已报废数量 + 本次报废数量 = 报废总数 int scrapNum = details.getScrapNum() + bean.getScrapNum(); @@ -380,65 +398,145 @@ public class RepairServiceImpl implements RepairService { // -------------校验维修数量结束---------------- // 更新报废数量 - repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); + repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); } - } else { - throw new ServiceException("请选择维修类型"); + throw new ServiceException("请选择正确的维修类型"); } } - return AjaxResult.success("维修完成"); } - private void copeNumberManageInList(RepairDeviceVO bean, List partList, LoginUser loginUser) { - // 处理配件集合数据 + /** + * 配件列表价格合计 + * @param partList 配件列表 + * @param sfCosts 配件价格合计 + * @return 配件合计后的价格 + */ + private static BigDecimal countPartCosts(List partList, BigDecimal sfCosts) { + for (RepairPartDetails partDetails : partList) { + if (partDetails.getPartCost() != null) { + BigDecimal partCost = partDetails.getPartCost(); + BigDecimal partNumber = new BigDecimal(partDetails.getPartNum()); + sfCosts = sfCosts.add(partCost.multiply(partNumber)); + } + } + return sfCosts; + } + + /** + * 处理配件集合数据 + * @param bean 维修申请单 + * @param partList 配件列表 + * @param loginUser 当前登录用户 + * @param manageType 管理方式:0编码管理 1数量管理 + */ + private void copeNumberManageInList(RepairDeviceVO bean, List partList, LoginUser loginUser, Integer manageType) { if (CollectionUtil.isNotEmpty(partList)) { - // 遍历配件列表,判断配件类型,收费还是不收费 - for (RepairPartDetails partDetails : partList) { - // 维修记录表信息 + // 内部维修 + if (bean.getRepairType() == inRepairType) { + // 遍历配件列表,判断配件类型,收费还是不收费 + for (RepairPartDetails partDetails : partList) { + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(bean.getRepairType()); + if (manageType == manageTypeByCode) { + repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); + repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); + } + if (manageType == manageTypeByNumber) { + repairApplyRecord.setRepairNum(bean.getRepairNum()); + repairApplyRecord.setScrapNum(bean.getScrapNum()); + } + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + + if (partDetails.getPartId() != null) { + // 有维修配件时,如果价格为空,设置为0 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setTaskId(bean.getTaskId()); + partDetails.setMaId(bean.getMaId()); + partDetails.setTypeId(bean.getTypeId()); + partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); + partDetails.setCompanyId(null); + + // 根据 partId 找配件单价 + BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); + // 设置配件费用 + partDetails.setPartCost(partPrice); + // 添加【维修配件明细表】 + repairMapper.addPart(partDetails); + + // 设置维修记录的配件费用 + repairApplyRecord.setPartPrice(partDetails.getPartCost()); + repairApplyRecord.setPartId(partDetails.getPartId() == null ? 0L : partDetails.getPartId()); + repairApplyRecord.setPartNum(partDetails.getPartNum()); + repairApplyRecord.setRepairContent(partDetails.getRepairContent()); + repairApplyRecord.setPartType(partDetails.getPartType()); + // 添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } else { + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } + } + + // 外部维修 + if (bean.getRepairType() == outRepairType) { + BigDecimal sfCosts = new BigDecimal("0"); + partList = bean.getNumberOutRepairPartList(); + + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + int repairNum = bean.getRepairedNum() + bean.getRepairNum(); + // 统计报废数量 + 维修合计数量 + int num = repairNum + bean.getScrapNum(); + if (num > bean.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } + // ---------------校验维修数量----------------- + + // 更新维修数量、维修人员不变 + repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); + + // 编码管理--外部返厂维修 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); repairApplyRecord.setTaskId(bean.getTaskId()); repairApplyRecord.setMaId(bean.getMaId()); repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(bean.getRepairType()); - repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); - repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); - repairApplyRecord.setCreateBy(loginUser.getUsername()); - repairApplyRecord.setStatus(0L); - - if (partDetails.getPartId() != null) { - // 有维修配件时,如果价格为空,设置为0 - if (partDetails.getPartCost() == null) { - partDetails.setPartCost(new BigDecimal(0)); - } - partDetails.setTaskId(bean.getTaskId()); - partDetails.setMaId(bean.getMaId()); - partDetails.setTypeId(bean.getTypeId()); - partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); - partDetails.setCompanyId(null); - - // 根据 partId 找配件单价 - BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); - // 设置配件费用 - partDetails.setPartCost(partPrice); - // 添加【维修配件明细表】 - repairMapper.addPart(partDetails); - - // 设置配件费用 - repairApplyRecord.setPartPrice(partDetails.getPartCost()); - repairApplyRecord.setPartId((long) partDetails.getPartId().intValue()); - repairApplyRecord.setPartNum(partDetails.getPartNum()); - repairApplyRecord.setRepairContent(partDetails.getRepairContent()); - repairApplyRecord.setPartType(partDetails.getPartType()); - // 添加【维修记录表】 - repairMapper.addRecord(repairApplyRecord); + repairApplyRecord.setRepairType(outRepairType); + repairApplyRecord.setPartName(partList.get(0).getPartName()); + repairApplyRecord.setPartType(partList.get(0).getPartType()); + repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); + if (partList.get(0).getSupplierId() == null) { + throw new ServiceException("请选择返厂厂家"); } else { - // 不选维修配件时, 只添加【维修记录表】 - repairMapper.addRecord(repairApplyRecord); + repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); } + if (partList.get(0).getPartPrice() == null) { + repairApplyRecord.setPartPrice(new BigDecimal(0)); + } else { + repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); + } + repairApplyRecord.setPartNum(partList.get(0).getPartNum()); + // 新增【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + + // 配件费用计算 + sfCosts = countPartCosts(partList, sfCosts); + + // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 + // SQL: 新增【维修费用记录表】 + repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); } + } else { // 配件为空,添加【维修记录表】 // 维修记录表信息 @@ -447,8 +545,8 @@ public class RepairServiceImpl implements RepairService { repairApplyRecord.setMaId(bean.getMaId()); repairApplyRecord.setTypeId(bean.getTypeId()); repairApplyRecord.setRepairType(bean.getRepairType()); - repairApplyRecord.setRepairNum(bean.getRepairType() != 3 ? 1 : 0); - repairApplyRecord.setScrapNum(bean.getRepairType() == 3 ? 1 : 0); + repairApplyRecord.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0); + repairApplyRecord.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0); repairApplyRecord.setCreateBy(loginUser.getUsername()); repairApplyRecord.setStatus(0L); // 不选维修配件时, 只添加【维修记录表】 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 d6731c80..45459e42 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 @@ -27,8 +27,8 @@ - insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status,company_id) - values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.companyId}); + insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status) + values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0'); From 353cf73e7956b00a4c10da76ca24599a695767e6 Mon Sep 17 00:00:00 2001 From: mashuai Date: Mon, 18 Nov 2024 17:54:46 +0800 Subject: [PATCH 17/47] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/back/controller/BackApplyInfoController.java | 6 ++++-- .../java/com/bonus/material/back/domain/BackApplyInfo.java | 5 ++++- .../bonus/material/back/domain/vo/BackApplyRequestVo.java | 2 ++ .../mapper/material/purchase/PurchaseStorageMapper.xml | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) 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 cd05d759..6bb38b28 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 @@ -2,6 +2,8 @@ package com.bonus.material.back.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + import com.bonus.common.log.enums.OperaType; import com.bonus.material.back.domain.vo.BackApplyRequestVo; import com.bonus.material.common.annotation.PreventRepeatSubmit; @@ -90,7 +92,7 @@ public class BackApplyInfoController extends BaseController { @RequiresPermissions("back:info:add") @SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务") @PostMapping - public AjaxResult add(@RequestBody BackApplyRequestVo dto) { + public AjaxResult add(@Valid @RequestBody BackApplyRequestVo dto) { try { return backApplyInfoService.insertBackApplyInfo(dto); } catch (Exception e) { @@ -106,7 +108,7 @@ public class BackApplyInfoController extends BaseController { @RequiresPermissions("back:info:edit") @SysLog(title = "退料任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改退料任务") @PostMapping("/edit") - public AjaxResult edit(@RequestBody BackApplyRequestVo dto) { + public AjaxResult edit(@Valid @RequestBody BackApplyRequestVo dto) { try { return backApplyInfoService.updateBackApplyInfo(dto); } catch (Exception e) { 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 09f4a213..d19cbb18 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 @@ -6,7 +6,8 @@ import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; -import com.bonus.common.core.web.domain.BaseEntity; + +import javax.validation.constraints.Size; /** * 退料任务对象 back_apply_info @@ -65,6 +66,7 @@ public class BackApplyInfo { /** 退料人 */ @Excel(name = "退料人") @ApiModelProperty(value = "退料人") + @Size(max = 20, message = "退料人长度不能超过20个字符") private String backPerson; /** @@ -124,6 +126,7 @@ public class BackApplyInfo { private String printStatus; @Excel(name = "备注") + @Size(max = 500, message = "备注长度不能超过500个字符") private String remark; @ApiModelProperty(value = "机具id") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java index 2327ebcb..7aca1fcc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/domain/vo/BackApplyRequestVo.java @@ -4,6 +4,7 @@ import com.bonus.material.back.domain.BackApplyDetails; import com.bonus.material.back.domain.BackApplyInfo; import lombok.Data; +import javax.validation.Valid; import java.util.List; /** @@ -19,6 +20,7 @@ public class BackApplyRequestVo { /** * 退料申请信息 */ + @Valid private BackApplyInfo backApplyInfo; /** diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml index df3e46bf..11e553ba 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseStorageMapper.xml @@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ma_code, ma_status, qr_code, + out_fac_time, out_fac_code, create_time @@ -19,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{maCode}, 1, #{qrCode}, + #{productDate}, #{outFacCode}, now() From 1aa586b07d3ee15ba971dc66ada40bb1bc45796e Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Nov 2024 18:20:25 +0800 Subject: [PATCH 18/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=A4=9A=E7=BB=B4=E4=BF=AE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/controller/RepairController.java | 2 +- .../repair/service/impl/RepairServiceImpl.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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 5862a027..e5181e3d 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 @@ -123,7 +123,7 @@ public class RepairController extends BaseController { */ @ApiOperation(value = "批量维修--批量--按照传参维修方式进行维修") @PostMapping("/batchRepairApply") - public AjaxResult batchRepairApply(@RequestBody List list) { + public AjaxResult batchRepairApply(@RequestBody @NotNull List list) { return service.batchRepairApply(list); } 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 b36eca9b..81993905 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 @@ -43,7 +43,6 @@ public class RepairServiceImpl implements RepairService { // 维修管理方式--0:编码管理 1:数量管理 private final int manageTypeByCode = 0, manageTypeByNumber = 1; - @Override public List getRepairTaskList(RepairTask bean) { return repairMapper.getRepairTaskList(bean); @@ -90,7 +89,6 @@ public class RepairServiceImpl implements RepairService { return new ArrayList<>(resultMap.values()); } - /** * 提交维修记录 * @param bean repairApplyRecord @@ -325,7 +323,7 @@ public class RepairServiceImpl implements RepairService { // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = details.getRepairedNum() + bean.getRepairNum(); + int repairNum = details.getRepairedNum() + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { @@ -340,12 +338,13 @@ public class RepairServiceImpl implements RepairService { // 处理配件集合数据 -- 数量管理--外部返厂维修 if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) { + BigDecimal sfCosts = new BigDecimal("0"); partList = bean.getNumberOutRepairPartList(); // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = details.getRepairedNum() + bean.getRepairNum(); + int repairNum = details.getRepairedNum() + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { @@ -388,7 +387,8 @@ public class RepairServiceImpl implements RepairService { if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) { // -------------校验维修数量开始---------------- // 统计历史已报废数量 + 本次报废数量 = 报废总数 - int scrapNum = details.getScrapNum() + bean.getScrapNum(); + // TODO : get数组的维修数量不对,后续修改对象 + int scrapNum = details.getScrapNum() + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); // 统计 报废总数 + 历史已维修数量, int num = scrapNum + details.getRepairedNum(); // 不能大与总的待维修数量 From 5e49360f854927336a590aa7c89552fb72c60675 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 18:26:26 +0800 Subject: [PATCH 19/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/biz/utils/PaginationUtil.java | 45 +++++++++++++++++++ .../PurchaseCheckInfoController.java | 11 ++++- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java new file mode 100644 index 00000000..b4b95c34 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java @@ -0,0 +1,45 @@ +package com.bonus.common.biz.utils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class PaginationUtil { + + /** + * 对列表进行分页 + * @param list 要分页的列表 + * @param pageNum 当前页码(从1开始) + * @param pageSize 每页的条目数 + * @param 列表中元素的类型 + * @return 指定页码的子列表 + */ + public static List paginate(List list, int pageNum, int pageSize) { + if (list == null || list.isEmpty() || pageNum <= 0 || pageSize <= 0) { + return Collections.emptyList(); + } + + int totalItems = list.size(); + int fromIndex = (pageNum - 1) * pageSize; + if (fromIndex >= totalItems) { + return Collections.emptyList(); + } + + int toIndex = Math.min(fromIndex + pageSize, totalItems); + return new ArrayList<>(list.subList(fromIndex, toIndex)); + } + + public static void main(String[] args) { + // 示例用法 + List numbers = new ArrayList<>(); + for (int i = 1; i <= 100; i++) { + numbers.add(i); + } + + int pageNum = 2; + int pageSize = 10; + List page = paginate(numbers, pageNum, pageSize); + + System.out.println("Page " + pageNum + ": " + page); + } +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java index 3b001b5c..4ff08411 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java @@ -5,6 +5,9 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; +import cn.hutool.core.convert.Convert; +import com.bonus.common.biz.utils.PaginationUtil; +import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; import com.bonus.material.purchase.domain.PurchaseCheckDetails; @@ -22,6 +25,8 @@ import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.page.TableDataInfo; +import static com.bonus.common.core.web.page.TableSupport.PAGE_NUM; +import static com.bonus.common.core.web.page.TableSupport.PAGE_SIZE; /** * 新购验收任务Controller @@ -43,9 +48,11 @@ public class PurchaseCheckInfoController extends BaseController { //@RequiresPermissions("purchase:info:list") @GetMapping("/list") public TableDataInfo list(PurchaseQueryDto purchaseQueryDto) { - startPage(); List list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseQueryDto); - return getDataTable(list); + Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); + List result = PaginationUtil.paginate(list, pageIndex, pageSize); + return getDataTable(result); } From 3d7dd6bb2c388946dddff4ec9c5fa353590aaac9 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 18 Nov 2024 18:43:50 +0800 Subject: [PATCH 20/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/mapper/PurchaseBindMapper.java | 2 +- .../service/impl/PurchaseBindServiceImpl.java | 116 +++++++++--------- .../impl/PurchaseStorageServiceImpl.java | 9 +- 3 files changed, 64 insertions(+), 63 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java index 7ca6cf1b..2f7c0f96 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java @@ -80,7 +80,7 @@ public interface PurchaseBindMapper { * @param updatedStatus * @param purchaseId */ - void updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId); + int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String purchaseId); /** * 更新数量 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java index 7c72d0c8..0ace2e12 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseBindServiceImpl.java @@ -158,17 +158,17 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { } } } - PurchaseDto purchaseDto = new PurchaseDto(); - purchaseDto.setTaskId(dto.getTaskId()); - List list = purchaseBindMapper.getDetails(purchaseDto); - Map> groupedByIdStatus = list.stream() - .collect(Collectors.groupingBy( - PurchaseVo::getTaskId, - Collectors.mapping(PurchaseVo::getStatus, Collectors.toList()) - )); - result += groupedByIdStatus.entrySet().stream() - .mapToInt(entry -> updateTaskStatus(entry.getKey(), entry.getValue())) - .sum(); +// PurchaseDto purchaseDto = new PurchaseDto(); +// purchaseDto.setTaskId(dto.getTaskId()); +// List list = purchaseBindMapper.getDetails(purchaseDto); +// Map> groupedByIdStatus = list.stream() +// .collect(Collectors.groupingBy( +// PurchaseVo::getTaskId, +// Collectors.mapping(PurchaseVo::getStatus, Collectors.toList()) +// )); +// result += groupedByIdStatus.entrySet().stream() +// .mapToInt(entry -> updateTaskStatus(entry.getKey(), entry.getValue())) +// .sum(); if (result > 0) { return AjaxResult.success("绑定成功"); } @@ -181,17 +181,17 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { * @param statusList * @return */ - private int updateTaskStatus(Integer taskId, List statusList) { - if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) || - statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) { - return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString()); - } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) && - !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus()) && - statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) { - return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString()); - } - return 0; - } +// private int updateTaskStatus(Integer taskId, List statusList) { +// if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) || +// statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) { +// return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString()); +// } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) && +// !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus()) && +// statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) { +// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString()); +// } +// return 0; +// } /** * 下载二维码 @@ -243,27 +243,27 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { } } } - result += tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, dto.getTaskId()); + //result += tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, dto.getTaskId()); } //二级页面驳回 if (dto.getPurchaseId() != null) { List idList = Arrays.asList(dto.getPurchaseId().split(",")); for (String purchaseId : idList) { - purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), purchaseId); - } - for (String id : idList) { - //根据二级页面驳回状态更新任务状态 - dto.setPurchaseId(id); - List list = purchaseBindMapper.getDetails(dto); - if (CollectionUtils.isNotEmpty(list)) { - for (PurchaseVo purchaseVo : list) { - PurchaseDto purchaseDto = new PurchaseDto(); - purchaseDto.setTaskId(purchaseVo.getTaskId().toString()); - List voList = purchaseBindMapper.getDetails(purchaseDto); - result = getResult(result, voList); - } - } + result += purchaseBindMapper.updateStatusById(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus(), purchaseId); } +// for (String id : idList) { +// //根据二级页面驳回状态更新任务状态 +// dto.setPurchaseId(id); +// List list = purchaseBindMapper.getDetails(dto); +// if (CollectionUtils.isNotEmpty(list)) { +// for (PurchaseVo purchaseVo : list) { +// PurchaseDto purchaseDto = new PurchaseDto(); +// purchaseDto.setTaskId(purchaseVo.getTaskId().toString()); +// List voList = purchaseBindMapper.getDetails(purchaseDto); +// result = getResult(result, voList); +// } +// } +// } } if (result > 0) { return AjaxResult.success("操作成功"); @@ -277,27 +277,27 @@ public class PurchaseBindServiceImpl implements IPurchaseBindService { * @param voList * @return */ - private int getResult(int result, List voList) { - Map> groupedByIdStatus = voList.stream() - .collect(Collectors.groupingBy( - PurchaseVo::getTaskId, - Collectors.mapping(PurchaseVo::getStatus, Collectors.toList()) - )); - result += groupedByIdStatus.entrySet().stream() - .mapToInt(entry -> { - Integer taskId = entry.getKey(); - List statusList = entry.getValue(); - if (statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) || - statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) { - return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString()); - } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus()) - && statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) { - return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString()); - } - return 0; - }).sum(); - return result; - } +// private int getResult(int result, List voList) { +// Map> groupedByIdStatus = voList.stream() +// .collect(Collectors.groupingBy( +// PurchaseVo::getTaskId, +// Collectors.mapping(PurchaseVo::getStatus, Collectors.toList()) +// )); +// result += groupedByIdStatus.entrySet().stream() +// .mapToInt(entry -> { +// Integer taskId = entry.getKey(); +// List statusList = entry.getValue(); +// if (statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) || +// statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus())) { +// return tmTaskMapper.updateStatusById(MaterialConstants.TEN_CONSTANT, taskId.toString()); +// } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_BIND.getStatus()) +// && statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus())) { +// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.IN_STORE.getStatus(), taskId.toString()); +// } +// return 0; +// }).sum(); +// return result; +// } /** * 内层二维码下载 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java index 09431f89..0316657a 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java @@ -317,10 +317,11 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { .mapToInt(entry -> { Integer id = entry.getKey(); List statusList = entry.getValue(); - if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) || statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())) { - return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), id.toString()); - } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) - && statusList.stream().allMatch(status -> status.equals(PurchaseTaskStatusEnum.IN_STORE.getStatus()))) { +// if (statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) || statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus())) { +// return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), id.toString()); +// } else + if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) + && statusList.stream().allMatch(status -> status.equals(PurchaseTaskStatusEnum.IN_STORE.getStatus()))) { return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus(), id.toString()); } return 0; From 8b02d0d3ec8d56a6df749ed5706f848af1c7b528 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Nov 2024 18:46:20 +0800 Subject: [PATCH 21/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86-null?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 81993905..31de3f9e 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 @@ -323,7 +323,7 @@ public class RepairServiceImpl implements RepairService { // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = details.getRepairedNum() + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { @@ -344,7 +344,7 @@ public class RepairServiceImpl implements RepairService { // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = details.getRepairedNum() + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { @@ -388,7 +388,7 @@ public class RepairServiceImpl implements RepairService { // -------------校验维修数量开始---------------- // 统计历史已报废数量 + 本次报废数量 = 报废总数 // TODO : get数组的维修数量不对,后续修改对象 - int scrapNum = details.getScrapNum() + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); + int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); // 统计 报废总数 + 历史已维修数量, int num = scrapNum + details.getRepairedNum(); // 不能大与总的待维修数量 From 7b9b0eac6562f7b1337e9b7cb3621104203aae16 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Nov 2024 18:49:22 +0800 Subject: [PATCH 22/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/repair/service/impl/RepairServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 31de3f9e..140e76d2 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 @@ -323,7 +323,7 @@ public class RepairServiceImpl implements RepairService { // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberInRepairPartList().get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { @@ -344,7 +344,7 @@ public class RepairServiceImpl implements RepairService { // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberOutRepairPartList().get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 int num = repairNum + details.getScrapNum(); if (num > details.getRepairNum()) { From 20dc13b75683aa176294c04ca9d070ad73868b2e Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 09:33:37 +0800 Subject: [PATCH 23/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/biz/utils/PaginationUtil.java | 45 ------------------- .../PurchaseCheckInfoController.java | 8 ++-- 2 files changed, 3 insertions(+), 50 deletions(-) delete mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java deleted file mode 100644 index b4b95c34..00000000 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/utils/PaginationUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.bonus.common.biz.utils; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class PaginationUtil { - - /** - * 对列表进行分页 - * @param list 要分页的列表 - * @param pageNum 当前页码(从1开始) - * @param pageSize 每页的条目数 - * @param 列表中元素的类型 - * @return 指定页码的子列表 - */ - public static List paginate(List list, int pageNum, int pageSize) { - if (list == null || list.isEmpty() || pageNum <= 0 || pageSize <= 0) { - return Collections.emptyList(); - } - - int totalItems = list.size(); - int fromIndex = (pageNum - 1) * pageSize; - if (fromIndex >= totalItems) { - return Collections.emptyList(); - } - - int toIndex = Math.min(fromIndex + pageSize, totalItems); - return new ArrayList<>(list.subList(fromIndex, toIndex)); - } - - public static void main(String[] args) { - // 示例用法 - List numbers = new ArrayList<>(); - for (int i = 1; i <= 100; i++) { - numbers.add(i); - } - - int pageNum = 2; - int pageSize = 10; - List page = paginate(numbers, pageNum, pageSize); - - System.out.println("Page " + pageNum + ": " + page); - } -} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java index 4ff08411..bc77c5b9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java @@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; import cn.hutool.core.convert.Convert; -import com.bonus.common.biz.utils.PaginationUtil; +import com.bonus.common.biz.config.ListPagingUtil; import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.log.enums.OperaType; import com.bonus.material.common.annotation.PreventRepeatSubmit; @@ -24,7 +24,6 @@ import com.bonus.material.purchase.service.IPurchaseCheckInfoService; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.utils.poi.ExcelUtil; -import com.bonus.common.core.web.page.TableDataInfo; import static com.bonus.common.core.web.page.TableSupport.PAGE_NUM; import static com.bonus.common.core.web.page.TableSupport.PAGE_SIZE; @@ -47,12 +46,11 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "查询新购验收任务列表") //@RequiresPermissions("purchase:info:list") @GetMapping("/list") - public TableDataInfo list(PurchaseQueryDto purchaseQueryDto) { + public AjaxResult list(PurchaseQueryDto purchaseQueryDto) { List list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseQueryDto); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); - List result = PaginationUtil.paginate(list, pageIndex, pageSize); - return getDataTable(result); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } From a759a4bdbaf212de1d7c9cab4da96f4d90970d1b Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 10:01:43 +0800 Subject: [PATCH 24/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/domain/RepairPartDetails.java | 14 ++ .../service/impl/RepairServiceImpl.java | 162 +++++++++++------- 2 files changed, 111 insertions(+), 65 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java index 0cc08f07..6af1a446 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java @@ -66,9 +66,23 @@ public class RepairPartDetails extends BaseEntity { private String repairContent; /** 维修数量 */ + @ApiModelProperty(value = "维修数量") private Integer repairNum; + /** 报废数量 */ + @ApiModelProperty(value = "报废数量") + private Integer scrapNum; + + /** 报废原因 */ + @ApiModelProperty(value = "报废原因") + private String scrapReason; + + /** 报废原因类型(0:自然损坏,1人为损坏) */ + @Excel(name = "损坏原因类型", readConverterExp = "0=:自然损坏,1人为损坏") + private String scrapType; + /** 维修人员 */ + @ApiModelProperty(value = "维修人") private String repairer; @ApiModelProperty(value = "配件名称") 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 140e76d2..97e52e6a 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 @@ -320,85 +320,106 @@ public class RepairServiceImpl implements RepairService { // 处理配件--数量管理--内部维修 if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) { partList = bean.getNumberInRepairPartList(); - - // ---------------校验维修数量----------------- - // 统计已维修数量 + 本次维修数量 - int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberInRepairPartList().get(0).getRepairNum(); - // 统计报废数量 + 维修合计数量 - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { - throw new ServiceException("维修数量大于维修总量"); + if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) { + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberInRepairPartList().get(0).getRepairNum(); + // 统计报废数量 + 维修合计数量 + int num = repairNum + details.getScrapNum(); + if (num > details.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } + // ---------------校验维修数量----------------- + // 更新维修数量、并修改维修人员 + repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); + // 处理配件集合数据 + copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); } - // ---------------校验维修数量----------------- - // 更新维修数量、并修改维修人员 - repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); - // 处理配件集合数据 - copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); } // 处理配件集合数据 -- 数量管理--外部返厂维修 if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) { - BigDecimal sfCosts = new BigDecimal("0"); partList = bean.getNumberOutRepairPartList(); - // ---------------校验维修数量----------------- - // 统计已维修数量 + 本次维修数量 - int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getNumberOutRepairPartList().get(0).getRepairNum(); - // 统计报废数量 + 维修合计数量 - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { - throw new ServiceException("维修数量大于维修总量"); - } - // ---------------校验维修数量----------------- + // 判断外部维修配件数量是否为空 + if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) { - // 更新维修数量、维修人员不变 - repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + partList.get(0).getRepairNum(); + // 统计报废数量 + 维修合计数量 + int num = repairNum + details.getScrapNum(); + if (num > details.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } + // ---------------校验维修数量----------------- - // 数量管理--外部返厂维修 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(outRepairType); - repairApplyRecord.setPartName(partList.get(0).getPartName()); - repairApplyRecord.setPartType(partList.get(0).getPartType()); - repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); - if (partList.get(0).getSupplierId() == null) { - throw new ServiceException("请选择返厂厂家"); - } else { - repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); - } - if (partList.get(0).getPartPrice() == null) { - repairApplyRecord.setPartPrice(new BigDecimal(0)); - } else { - repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); - } - repairApplyRecord.setPartNum(partList.get(0).getPartNum()); - // 新增【维修记录表】 - repairMapper.addRecord(repairApplyRecord); + // 更新维修数量、维修人员不变 + repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); - sfCosts = countPartCosts(partList, sfCosts); - // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 - // SQL: 新增【维修费用记录表】 - repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); + // 数量管理--外部返厂维修 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(outRepairType); + repairApplyRecord.setPartName(partList.get(0).getPartName()); + repairApplyRecord.setPartType(partList.get(0).getPartType()); + repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); + if (partList.get(0).getSupplierId() == null) { + throw new ServiceException("请选择返厂厂家"); + } else { + repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); + } + if (partList.get(0).getPartPrice() == null) { + repairApplyRecord.setPartPrice(new BigDecimal(0)); + } else { + repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); + } + repairApplyRecord.setPartNum(partList.get(0).getPartNum()); + // 新增【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + + sfCosts = countPartCosts(partList, sfCosts); + // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 + // SQL: 新增【维修费用记录表】 + repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); + } } + // 处理配件集合数据 -- 数量管理--报废维修 if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) { - // -------------校验维修数量开始---------------- - // 统计历史已报废数量 + 本次报废数量 = 报废总数 - // TODO : get数组的维修数量不对,后续修改对象 - int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getRepairNum(); - // 统计 报废总数 + 历史已维修数量, - int num = scrapNum + details.getRepairedNum(); - // 不能大与总的待维修数量 - if (num > details.getRepairNum()) { - throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum()); - } - // -------------校验维修数量结束---------------- + // 判断报废数量是否为空 + if (bean.getNumberScrapRepairPartList().get(0).getScrapNum() != null && bean.getNumberScrapRepairPartList().get(0).getScrapNum() > 0) { + // -------------校验维修数量开始---------------- + // 统计历史已报废数量 + 本次报废数量 = 报废总数 + int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getScrapNum(); + // 统计 报废总数 + 历史已维修数量, + int num = scrapNum + details.getRepairedNum(); + // 不能大与总的待维修数量 + if (num > details.getRepairNum()) { + throw new ServiceException("报废数量大于维修总量! 本次报废数量:" + bean.getScrapNum() + ",已报废数量:" + details.getScrapNum() + ",维修总量:" + details.getRepairNum()); + } + // -------------校验维修数量结束---------------- - // 更新报废数量 - repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); + // 更新报废数量 + repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); + + // 报废类型无需配件,所以配件为空,添加【维修记录表】 + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()); + repairApplyRecord.setMaId(bean.getMaId()); + repairApplyRecord.setTypeId(bean.getTypeId()); + repairApplyRecord.setRepairType(bean.getRepairType()); + repairApplyRecord.setRepairNum(null); + repairApplyRecord.setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()); + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } } } else { throw new ServiceException("请选择正确的维修类型"); @@ -434,6 +455,17 @@ public class RepairServiceImpl implements RepairService { */ private void copeNumberManageInList(RepairDeviceVO bean, List partList, LoginUser loginUser, Integer manageType) { if (CollectionUtil.isNotEmpty(partList)) { + + // 如果是数量管理,那么默认为内部维修 + if (bean.getRepairType() == null && bean.getManageType() != null && manageType == manageTypeByNumber) { + bean.setRepairType(inRepairType); + } + + // 再检查还是null的话直接结束任务 + if (bean.getRepairType() == null) { + return; + } + // 内部维修 if (bean.getRepairType() == inRepairType) { // 遍历配件列表,判断配件类型,收费还是不收费 @@ -455,7 +487,7 @@ public class RepairServiceImpl implements RepairService { repairApplyRecord.setCreateBy(loginUser.getUsername()); repairApplyRecord.setStatus(0L); - if (partDetails.getPartId() != null) { + if (partDetails.getPartId() != null && partDetails.getPartNum() != null) { // 有维修配件时,如果价格为空,设置为0 if (partDetails.getPartCost() == null) { partDetails.setPartCost(new BigDecimal(0)); From cfd1e9162de5ab9a28a6a2ce33978e6abed334ce Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 10:23:09 +0800 Subject: [PATCH 25/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=8C=E5=96=84=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 97e52e6a..cafeda6f 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 @@ -364,6 +364,9 @@ public class RepairServiceImpl implements RepairService { repairApplyRecord.setMaId(bean.getMaId()); repairApplyRecord.setTypeId(bean.getTypeId()); repairApplyRecord.setRepairType(outRepairType); + repairApplyRecord.setRepairNum(partList.get(0).getRepairNum()); + repairApplyRecord.setScrapNum(0); + repairApplyRecord.setCreateBy(loginUser.getUsername()); repairApplyRecord.setPartName(partList.get(0).getPartName()); repairApplyRecord.setPartType(partList.get(0).getPartType()); repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); @@ -378,6 +381,7 @@ public class RepairServiceImpl implements RepairService { repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); } repairApplyRecord.setPartNum(partList.get(0).getPartNum()); + repairApplyRecord.setRepairer(loginUser.getUsername()); // 新增【维修记录表】 repairMapper.addRecord(repairApplyRecord); @@ -415,8 +419,12 @@ public class RepairServiceImpl implements RepairService { repairApplyRecord.setRepairType(bean.getRepairType()); repairApplyRecord.setRepairNum(null); repairApplyRecord.setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()); + repairApplyRecord.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()); + repairApplyRecord.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()); repairApplyRecord.setCreateBy(loginUser.getUsername()); repairApplyRecord.setStatus(0L); + repairApplyRecord.setIsSlt(0L); + // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); } From 949cfd2c9a72360227cc1b889d429d79fb5b7a69 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 10:33:56 +0800 Subject: [PATCH 26/47] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/mapper/BmAgreementInfoMapper.java | 2 + .../lease/mapper/LeaseApplyDetailsMapper.java | 2 + .../lease/mapper/LeaseApplyInfoMapper.java | 2 + .../lease/mapper/LeaseOutDetailsMapper.java | 22 +-- .../impl/LeaseOutDetailsServiceImpl.java | 44 +++-- .../mapper/SltAgreementInfoMapper.java | 10 ++ .../task/mapper/TmTaskAgreementMapper.java | 2 + .../material/task/mapper/TmTaskMapper.java | 9 +- .../material/basic/BmAgreementInfoMapper.xml | 6 + .../lease/LeaseApplyDetailsMapper.xml | 6 + .../material/lease/LeaseApplyInfoMapper.xml | 6 + .../material/lease/LeaseOutDetailsMapper.xml | 160 +++--------------- .../settlement/SltAgreementInfoMapper.xml | 41 +++++ .../material/task/TmTaskAgreementMapper.xml | 6 + .../mapper/material/task/TmTaskMapper.xml | 6 + 15 files changed, 151 insertions(+), 173 deletions(-) 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 1e8919d2..2670b4be 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 @@ -61,4 +61,6 @@ public interface BmAgreementInfoMapper public int deleteBmAgreementInfoByAgreementIds(Long[] agreementIds); public int selectNumByMonth(Date nowDate); + + String getProtocol(String agreementId); } 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 f5933569..4e6ce118 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 @@ -74,4 +74,6 @@ public interface LeaseApplyDetailsMapper { LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record); int updateLeaseApplyDetailsByLeaseOutRecord(@Param("record") LeaseOutDetails record); + + LeaseApplyDetails getOutboundNum(LeaseOutDetails record); } 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 98f18157..e5bc0139 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 @@ -57,4 +57,6 @@ public interface LeaseApplyInfoMapper { * @return 结果 */ int deleteLeaseApplyInfoByIds(Long[] ids); + + String getTaskId(Long parentId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java index 48e416cd..d4f9a5e4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java @@ -46,7 +46,7 @@ public interface LeaseOutDetailsMapper { * @param leaseOutDetails 领料出库详细 * @return 结果 */ - public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); +// public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); /** * 修改领料出库详细 @@ -72,25 +72,7 @@ public interface LeaseOutDetailsMapper { */ public int deleteLeaseOutDetailsByIds(Long[] ids); - LeaseApplyDetails getOutboundNum(LeaseOutDetails record); - - String getTaskId(Long parentId); - - int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status); - /** 插入领料出库详情表 -- 根据字段选择注入 */ - int insertSelective(LeaseOutDetails record); - - SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record); - - int updSltInfo(SltAgreementInfo sltAgreementInfo); - - String getAgreementId(String taskId); - - String getProtocol(String agreementId); - - int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") Type ma); - - + int insertLeaseOutDetails(LeaseOutDetails record); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index 83245f69..c2cbbb94 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -3,7 +3,6 @@ package com.bonus.material.lease.service.impl; import java.math.BigDecimal; import java.util.List; import java.util.Objects; - import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.enums.LeaseTaskStatusEnum; import com.bonus.common.biz.enums.MaMachineStatusEnum; @@ -12,13 +11,17 @@ import com.bonus.common.core.exception.ServiceException; 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.material.basic.mapper.BmAgreementInfoMapper; import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper; +import com.bonus.material.lease.mapper.LeaseApplyInfoMapper; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.mapper.MachineMapper; import com.bonus.material.ma.mapper.TypeMapper; import com.bonus.material.settlement.domain.SltAgreementInfo; -import com.bonus.material.task.domain.TmTask; +import com.bonus.material.settlement.mapper.SltAgreementInfoMapper; +import com.bonus.material.task.mapper.TmTaskAgreementMapper; +import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,6 +39,9 @@ import org.springframework.transaction.annotation.Transactional; @Service @Slf4j public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { + @Autowired + LeaseApplyInfoMapper leaseApplyInfoMapper; + @Autowired private LeaseOutDetailsMapper leaseOutDetailsMapper; @@ -47,6 +53,18 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { @Autowired TypeMapper typeMapper; + + @Autowired + private TmTaskMapper tmTaskMapper; + + @Autowired + private SltAgreementInfoMapper sltAgreementInfoMapper; + + @Autowired + BmAgreementInfoMapper bmAgreementInfoMapper; + + @Autowired + TmTaskAgreementMapper tmTaskAgreementMapper; /** * 查询领料出库详细 * @@ -157,7 +175,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { throw new RuntimeException("出库失败,修改任务状态失败"); } // 5、插入结算记录 - String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId()); + String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); res = insSltInfo(taskId, record); if (res == 0) { throw new RuntimeException("出库失败,插入结算记录失败"); @@ -179,7 +197,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { // 判断库存是否足够 private boolean checkStorageIsEnough(LeaseOutDetails record) { if (record.getManageType().equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId())) { - LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record); + LeaseApplyDetails details = leaseApplyDetailsMapper.getOutboundNum(record); if (details == null) { return false; } @@ -204,12 +222,12 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { i++; } } - String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId()); + String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); if (i == leaseApplyDetailsList.size()) { - leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); + tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); res = 1; } else { - leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus()); + tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus()); res = 1; } return res; @@ -251,7 +269,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } if (res > 0) { // 插入领料出库明细表(lease_out_details) - res = leaseOutDetailsMapper.insertSelective(record); + res = leaseOutDetailsMapper.insertLeaseOutDetails(record); if (res > 0) { // 普通机具减少 (ma_type 设备规格表)的库存数量 res = typeMapper.updateMaTypeStockNum(record); @@ -264,15 +282,15 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { public int insSltInfo(String taskId, LeaseOutDetails record) { int res = 0; - SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record); + SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record); if (sltAgreementInfo != null) { Long num = sltAgreementInfo.getNum(); Long outNum = record.getOutNum(); sltAgreementInfo.setNum(num + outNum); - res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo); + res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo); } else { - String agreementId = leaseOutDetailsMapper.getAgreementId(taskId); - String protocol = leaseOutDetailsMapper.getProtocol(agreementId); + String agreementId = tmTaskAgreementMapper.getAgreementId(taskId); + String protocol = bmAgreementInfoMapper.getProtocol(agreementId); Type maType = typeMapper.getMaType(record.getTypeId()); if (StringUtils.isEmpty(protocol)) { maType.setFinalPrice(maType.getLeasePrice()); @@ -285,7 +303,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { maType.setFinalPrice(maType.getLeasePrice()); } } - res = leaseOutDetailsMapper.insSltInfo(record, agreementId, maType); + res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType); } return res; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index b3f10b96..a23c4aef 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -1,7 +1,11 @@ package com.bonus.material.settlement.mapper; import java.util.List; + +import com.bonus.material.lease.domain.LeaseOutDetails; +import com.bonus.material.ma.domain.Type; import com.bonus.material.settlement.domain.SltAgreementInfo; +import org.apache.ibatis.annotations.Param; /** * 结算信息Mapper接口 @@ -57,4 +61,10 @@ public interface SltAgreementInfoMapper { * @return 结果 */ public int deleteSltAgreementInfoByIds(Long[] ids); + + SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record); + + int updSltInfo(SltAgreementInfo sltAgreementInfo); + + int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java index 2181ffa9..a1720202 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java @@ -58,4 +58,6 @@ public interface TmTaskAgreementMapper { * @return 结果 */ int deleteTmTaskAgreementByTaskIds(Long[] taskIds); + + String getAgreementId(String taskId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index 2eed8695..1837d3ff 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -95,11 +95,6 @@ public interface TmTaskMapper { */ String selectTaskNumByMonths(Date nowDate, Integer taskType); -// List getAuditListByLeaseTmTask(@Param("record") TmTaskRequestVo tmTaskRequestVo); -// -// List getAuditListByLeaseTmTaskByPeople(@Param("record") TmTaskRequestVo tmTaskRequestVo); -// -// List getAuditListByLeaseInfo(@Param("record") TmTaskRequestVo record); -// -// List getLeaseApplyDetails(@Param("record") LeaseApplyInfo record); + int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status); + } 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 f30d202f..150a03b8 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 @@ -125,4 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ 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 978ec252..f61195c3 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 @@ -188,4 +188,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE parent_id = #{record.parentId} and type_id = #{record.typeId} + + \ No newline at end of file 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 c0ceac6a..3cccd225 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 @@ -191,4 +191,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml index f37499f9..f4a32113 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml @@ -53,92 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lod.parent_id = #{parentId} - + - insert into lease_out_details - - parent_id, - type_id, - ma_id, - out_num, - out_type, - create_by, - create_time, - update_by, - update_time, - remark, - company_id, - car_code, - push_notifications, - - - #{parentId}, - #{typeId}, - #{maId}, - #{outNum}, - #{outType}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{remark}, - #{companyId}, - #{carCode}, - #{pushNotifications}, - - - - - update lease_out_details - - parent_id = #{parentId}, - type_id = #{typeId}, - ma_id = #{maId}, - out_num = #{outNum}, - out_type = #{outType}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - remark = #{remark}, - company_id = #{companyId}, - car_code = #{carCode}, - push_notifications = #{pushNotifications}, - - where id = #{id} - - - - delete from lease_out_details where id = #{id} - - - - delete from lease_out_details where id in - - #{id} - - - - - - - - - update tm_task - set task_status = #{status}, - update_time = NOW() - where task_id = #{taskId} - - - insert into lease_out_details @@ -210,57 +126,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - update slt_agreement_info - set num = #{num}, - update_time = now() + + update lease_out_details + + parent_id = #{parentId}, + type_id = #{typeId}, + ma_id = #{maId}, + out_num = #{outNum}, + out_type = #{outType}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + company_id = #{companyId}, + car_code = #{carCode}, + push_notifications = #{pushNotifications}, + where id = #{id} - + + delete from lease_out_details where id = #{id} + - - - - insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time) - values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now()); - + + delete from lease_out_details where id in + + #{id} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 9437d8e6..06ca0284 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -135,4 +135,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + + update slt_agreement_info + set num = #{num}, + update_time = now() + where id = #{id} + + + + insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time) + values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now()); + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml index 4a5c8c90..8933ea3c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml @@ -60,4 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{taskId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index ca60d937..e9094785 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -132,4 +132,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY create_time DESC LIMIT 1 + + update tm_task + set task_status = #{status}, + update_time = NOW() + where task_id = #{taskId} + \ No newline at end of file From 4c86d69f4b48c15a5b80f18ddcde5a2e1c200e31 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 11:10:52 +0800 Subject: [PATCH 27/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=8C=E5=96=84=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/domain/RepairPartDetails.java | 2 + .../service/impl/RepairServiceImpl.java | 127 ++++++------------ 2 files changed, 46 insertions(+), 83 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java index 6af1a446..81bb8943 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import lombok.experimental.Accessors; /** * 维修配件详细对象 repair_part_details @@ -15,6 +16,7 @@ import com.bonus.common.core.web.domain.BaseEntity; */ @Data @ToString +@Accessors(chain = true) public class RepairPartDetails extends BaseEntity { private static final long serialVersionUID = 1L; 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 cafeda6f..82e4cfc4 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 @@ -218,9 +218,8 @@ public class RepairServiceImpl implements RepairService { * 校验维修数量 */ private static int verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) { - int repairNum = details.getRepairedNum() + bean.getRepairNum(); - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + bean.getRepairNum(); + if (repairNum + OptionalInt.of(details.getScrapNum()).orElse(0) > details.getRepairNum()) { throw new ServiceException("维修数量大于维修总量"); } return repairNum; @@ -301,7 +300,6 @@ public class RepairServiceImpl implements RepairService { System.err.println("请输入正确的维修类型:" + bean.getRepairType()); break; } - // 统一处理配件集合数据 copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); @@ -313,7 +311,7 @@ public class RepairServiceImpl implements RepairService { // 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量 RepairTaskDetails details = repairMapper.getById(bean.getId()); - if (details == null) { + if (Objects.isNull(details)) { throw new ServiceException("此维修记录不存在,请检查后提交!"); } @@ -358,30 +356,20 @@ public class RepairServiceImpl implements RepairService { // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); - // 数量管理--外部返厂维修 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(outRepairType); - repairApplyRecord.setRepairNum(partList.get(0).getRepairNum()); - repairApplyRecord.setScrapNum(0); - repairApplyRecord.setCreateBy(loginUser.getUsername()); - repairApplyRecord.setPartName(partList.get(0).getPartName()); - repairApplyRecord.setPartType(partList.get(0).getPartType()); - repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); if (partList.get(0).getSupplierId() == null) { throw new ServiceException("请选择返厂厂家"); - } else { - repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); } - if (partList.get(0).getPartPrice() == null) { - repairApplyRecord.setPartPrice(new BigDecimal(0)); - } else { - repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); - } - repairApplyRecord.setPartNum(partList.get(0).getPartNum()); - repairApplyRecord.setRepairer(loginUser.getUsername()); + + // 数量管理--外部返厂维修 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(outRepairType).setRepairNum(partList.get(0).getRepairNum()).setScrapNum(0) + .setPartName(partList.get(0).getPartName()).setPartType(partList.get(0).getPartType()) + .setRepairContent(partList.get(0).getRepairContent()).setSupplierId(partList.get(0).getSupplierId()) + .setPartNum(partList.get(0).getPartNum()).setRepairer(loginUser.getUsername()) + .setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0))) + .setCreateBy(loginUser.getUsername()); + // 新增【维修记录表】 repairMapper.addRecord(repairApplyRecord); @@ -413,17 +401,12 @@ public class RepairServiceImpl implements RepairService { // 报废类型无需配件,所以配件为空,添加【维修记录表】 // 维修记录表信息 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(bean.getRepairType()); - repairApplyRecord.setRepairNum(null); - repairApplyRecord.setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()); - repairApplyRecord.setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()); - repairApplyRecord.setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()); - repairApplyRecord.setCreateBy(loginUser.getUsername()); - repairApplyRecord.setStatus(0L); - repairApplyRecord.setIsSlt(0L); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(bean.getRepairType()).setStatus(0L).setIsSlt(0L) + .setRepairNum(null).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()) + .setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()) + .setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()) + .setCreateBy(loginUser.getUsername()); // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); @@ -446,7 +429,7 @@ public class RepairServiceImpl implements RepairService { private static BigDecimal countPartCosts(List partList, BigDecimal sfCosts) { for (RepairPartDetails partDetails : partList) { if (partDetails.getPartCost() != null) { - BigDecimal partCost = partDetails.getPartCost(); + BigDecimal partCost = partDetails.getPartPrice(); BigDecimal partNumber = new BigDecimal(partDetails.getPartNum()); sfCosts = sfCosts.add(partCost.multiply(partNumber)); } @@ -480,10 +463,7 @@ public class RepairServiceImpl implements RepairService { for (RepairPartDetails partDetails : partList) { // 维修记录表信息 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(bean.getRepairType()); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(bean.getRepairType()); if (manageType == manageTypeByCode) { repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); @@ -500,11 +480,8 @@ public class RepairServiceImpl implements RepairService { if (partDetails.getPartCost() == null) { partDetails.setPartCost(new BigDecimal(0)); } - partDetails.setTaskId(bean.getTaskId()); - partDetails.setMaId(bean.getMaId()); - partDetails.setTypeId(bean.getTypeId()); + partDetails.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setCompanyId(null); partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); - partDetails.setCompanyId(null); // 根据 partId 找配件单价 BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); @@ -514,11 +491,11 @@ public class RepairServiceImpl implements RepairService { repairMapper.addPart(partDetails); // 设置维修记录的配件费用 - repairApplyRecord.setPartPrice(partDetails.getPartCost()); - repairApplyRecord.setPartId(partDetails.getPartId() == null ? 0L : partDetails.getPartId()); - repairApplyRecord.setPartNum(partDetails.getPartNum()); - repairApplyRecord.setRepairContent(partDetails.getRepairContent()); - repairApplyRecord.setPartType(partDetails.getPartType()); + repairApplyRecord.setPartPrice(partDetails.getPartCost()) + .setPartNum(partDetails.getPartNum()) + .setRepairContent(partDetails.getRepairContent()) + .setPartType(partDetails.getPartType()) + .setPartId(partDetails.getPartId() == null ? 0L : partDetails.getPartId()); // 添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); } else { @@ -530,47 +507,35 @@ public class RepairServiceImpl implements RepairService { // 外部维修 if (bean.getRepairType() == outRepairType) { - BigDecimal sfCosts = new BigDecimal("0"); partList = bean.getNumberOutRepairPartList(); // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 - int repairNum = bean.getRepairedNum() + bean.getRepairNum(); - // 统计报废数量 + 维修合计数量 - int num = repairNum + bean.getScrapNum(); - if (num > bean.getRepairNum()) { - throw new ServiceException("维修数量大于维修总量"); - } - // ---------------校验维修数量----------------- + int repairNum = OptionalInt.of(bean.getRepairedNum()).orElse(0) + bean.getRepairNum(); + // 统计报废数量 + 维修合计数量 不能 大与> 总的待维修量 + if (repairNum + OptionalInt.of(bean.getScrapNum()).orElse(0) > bean.getRepairNum()) {throw new ServiceException("维修数量大于维修总量");} // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); // 编码管理--外部返厂维修 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(outRepairType); - repairApplyRecord.setPartName(partList.get(0).getPartName()); - repairApplyRecord.setPartType(partList.get(0).getPartType()); - repairApplyRecord.setRepairContent(partList.get(0).getRepairContent()); + RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setTaskId(bean.getTaskId()).setMaId(bean.getMaId()) + .setTypeId(bean.getTypeId()).setRepairType(outRepairType) + .setPartName(partList.get(0).getPartName()) + .setPartType(partList.get(0).getPartType()) + .setRepairContent(partList.get(0).getRepairContent()).setPartNum(partList.get(0).getPartNum()); + if (partList.get(0).getSupplierId() == null) { throw new ServiceException("请选择返厂厂家"); } else { repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); } - if (partList.get(0).getPartPrice() == null) { - repairApplyRecord.setPartPrice(new BigDecimal(0)); - } else { - repairApplyRecord.setPartPrice(partList.get(0).getPartPrice()); - } - repairApplyRecord.setPartNum(partList.get(0).getPartNum()); + repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0))); // 新增【维修记录表】 repairMapper.addRecord(repairApplyRecord); // 配件费用计算 - sfCosts = countPartCosts(partList, sfCosts); + BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0)); // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 // SQL: 新增【维修费用记录表】 @@ -579,16 +544,12 @@ public class RepairServiceImpl implements RepairService { } else { // 配件为空,添加【维修记录表】 - // 维修记录表信息 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()); - repairApplyRecord.setMaId(bean.getMaId()); - repairApplyRecord.setTypeId(bean.getTypeId()); - repairApplyRecord.setRepairType(bean.getRepairType()); - repairApplyRecord.setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0); - repairApplyRecord.setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0); - repairApplyRecord.setCreateBy(loginUser.getUsername()); - repairApplyRecord.setStatus(0L); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(bean.getRepairType()).setStatus(0L) + .setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0) + .setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0).setCreateBy(loginUser.getUsername()); + // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); } From 9ad10a3d8e3b8dee81c384c0dca288473fa17c60 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 11:16:31 +0800 Subject: [PATCH 28/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=85=8D=E4=BB=B6=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E7=BA=A0=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 82e4cfc4..404146ad 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 @@ -428,10 +428,10 @@ public class RepairServiceImpl implements RepairService { */ private static BigDecimal countPartCosts(List partList, BigDecimal sfCosts) { for (RepairPartDetails partDetails : partList) { - if (partDetails.getPartCost() != null) { - BigDecimal partCost = partDetails.getPartPrice(); + if (partDetails.getPartPrice() != null) { + BigDecimal partPrice = partDetails.getPartPrice(); BigDecimal partNumber = new BigDecimal(partDetails.getPartNum()); - sfCosts = sfCosts.add(partCost.multiply(partNumber)); + sfCosts = sfCosts.add(partPrice.multiply(partNumber)); } } return sfCosts; From 4eaca91a802930cfb679520f945ce921540fd5fd Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 11:30:29 +0800 Subject: [PATCH 29/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=8C=E5=96=84=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 404146ad..ab24f0e9 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 @@ -402,11 +402,11 @@ public class RepairServiceImpl implements RepairService { // 维修记录表信息 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) - .setRepairType(bean.getRepairType()).setStatus(0L).setIsSlt(0L) - .setRepairNum(null).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()) + .setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0) + .setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()) .setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()) .setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()) - .setCreateBy(loginUser.getUsername()); + .setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername()); // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); From 9625d500f63100926a49cdb7835d65ddc9f80d42 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 11:59:15 +0800 Subject: [PATCH 30/47] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/biz/constant/MaterialConstants.java | 5 ----- .../material/basic/domain/BmAgreementInfo.java | 3 +++ .../lease/mapper/LeaseOutDetailsMapper.java | 5 +---- .../impl/PurchaseStorageServiceImpl.java | 2 +- .../material/task/mapper/TmTaskMapper.java | 18 +----------------- .../material/basic/BmAgreementInfoMapper.xml | 14 ++++++-------- .../mapper/material/task/TmTaskMapper.xml | 18 +++++------------- 7 files changed, 17 insertions(+), 48 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java index 77af7f45..a747522f 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java @@ -44,11 +44,6 @@ public class MaterialConstants { */ public static final String LATITUDE_PATTERN = "^(-?(90(\\.0+)?|[1-8]?\\d(\\.\\d{1,6})?))$"; - /** - * 未完成 - */ - public static final Integer TEN_CONSTANT = 10; - public final static String STRING_ADMIN = "admin"; /** 协议号的开头字母 */ 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 5994a9c9..b13feeaa 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 @@ -128,6 +128,9 @@ public class BmAgreementInfo extends BaseEntity @ApiModelProperty(value = "结束时间") private String endTime; + @ApiModelProperty(value = "关联任务ID") + private Long taskId; + @ApiModelProperty(value = "附件列表") private List bmFileInfos; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java index d4f9a5e4..1597f6f9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java @@ -46,7 +46,7 @@ public interface LeaseOutDetailsMapper { * @param leaseOutDetails 领料出库详细 * @return 结果 */ -// public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); + public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); /** * 修改领料出库详细 @@ -72,7 +72,4 @@ public interface LeaseOutDetailsMapper { */ public int deleteLeaseOutDetailsByIds(Long[] ids); - /** 插入领料出库详情表 -- 根据字段选择注入 */ - int insertLeaseOutDetails(LeaseOutDetails record); - } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java index 0316657a..7e59e819 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseStorageServiceImpl.java @@ -322,7 +322,7 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { // } else if (!statusList.contains(PurchaseTaskStatusEnum.TO_STORE.getStatus()) && !statusList.contains(PurchaseTaskStatusEnum.TO_STORE_AFTER_REJECT.getStatus()) && statusList.stream().allMatch(status -> status.equals(PurchaseTaskStatusEnum.IN_STORE.getStatus()))) { - return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus(), id.toString()); + return tmTaskMapper.updateTaskStatus(id.toString(), PurchaseTaskStatusEnum.TASK_FINISHED.getStatus()); } return 0; }).sum(); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index 1837d3ff..ebcc80ba 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -52,13 +52,7 @@ public interface TmTaskMapper { */ int updateTmTask(TmTask tmTask); - - /** - * 根据任务id更新任务状态 -- 批量、限制状态 - * @param taskId 任务id 必传 - * @param newTaskStatus 新状态 - */ - int updateTmTaskStatusByTaskId(@Param("taskId") Long taskId, @Param("newTaskStatus") Integer newTaskStatus); + int updateTaskStatus(@Param("taskId") String taskId, @Param("newStatus")int newStatus); /** * 删除任务 @@ -76,14 +70,6 @@ public interface TmTaskMapper { */ int deleteTmTaskByTaskIds(Long[] taskIds); - /** - * 更新任务状态 - * @param updatedStatus - * @param id - * @return - */ - int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") String id); - int deleteTmTaskByPurchaseIds(Long[] ids); /** @@ -95,6 +81,4 @@ public interface TmTaskMapper { */ String selectTaskNumByMonths(Date nowDate, Integer taskType); - int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status); - } 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 150a03b8..0c435dc4 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 @@ -20,15 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + @@ -102,8 +102,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time = #{updateTime}, remark = #{remark}, company_id = #{companyId}, - file_name = #{fileName}, - file_url = #{fileUrl}, status = #{status}, protocol = #{protocol}, is_slt = #{isSlt}, diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index e9094785..7258090e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -85,8 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where task_id = #{taskId} - - update tm_task set task_status = #{updatedStatus} where task_id = #{id} + + update tm_task + set task_status = #{newStatus}, + update_time = NOW() + where task_id = #{taskId} @@ -109,11 +112,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - update tm_task set task_status = #{newTaskStatus} - where task_id = #{taskId} - - delete from tm_task where task_id in ( @@ -132,10 +130,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY create_time DESC LIMIT 1 - - update tm_task - set task_status = #{status}, - update_time = NOW() - where task_id = #{taskId} - \ No newline at end of file From cdc46024fec80e27aa2ec15c6e73987692d0c149 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 13:24:35 +0800 Subject: [PATCH 31/47] =?UTF-8?q?=E9=A2=86=E6=96=99=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/material/lease/LeaseApplyInfoMapper.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 3cccd225..ce0f3e2d 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 @@ -80,6 +80,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item} + + and (bu.unit_name like concat('%', #{keyWord}, '%') or + bp.pro_name like concat('%', #{keyWord}, '%') or + lai.code like concat('%', #{keyWord}, '%') or + lai.create_by like concat('%', #{keyWord}, '%') or + lai.lease_person like concat('%', #{keyWord}, '%') or + lai.phone like concat('%', #{keyWord}, '%')) + + + + and lai.direct_id = #{directId} and lai.lease_type = #{leaseType} and lai.estimate_lease_time = #{estimateLeaseTime} From c7b3e2f7f8c48d827d715ae3c9c8761b95f35ee4 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 13:50:48 +0800 Subject: [PATCH 32/47] =?UTF-8?q?=E9=A2=86=E6=96=99=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/lease/domain/LeaseApplyInfo.java | 6 ++++++ .../lease/mapper/LeaseApplyDetailsMapper.java | 2 ++ .../impl/LeaseApplyInfoServiceImpl.java | 6 +++++- .../lease/LeaseApplyDetailsMapper.xml | 20 +++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java index ca75a00c..1c993bf3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseApplyInfo.java @@ -186,6 +186,12 @@ public class LeaseApplyInfo extends BaseEntity { @Excel(name = "领料工程", sort = 3) private String projectName; + /** + * 领料物资名称汇总 + */ + @ApiModelProperty(value = "领料物资名称汇总") + private String maTypeNames; + /** * 预领料合计数 */ 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 4e6ce118..059b6136 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 @@ -76,4 +76,6 @@ public interface LeaseApplyDetailsMapper { int updateLeaseApplyDetailsByLeaseOutRecord(@Param("record") LeaseOutDetails record); LeaseApplyDetails getOutboundNum(LeaseOutDetails record); + + String selectMaTypeNameByParentId(Long parentId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseApplyInfoServiceImpl.java index e05866a5..b0679885 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 @@ -92,7 +92,11 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService { */ @Override public List selectLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { - return leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); + List list = leaseApplyInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo); + for (LeaseApplyInfo applyInfo : list) { + applyInfo.setMaTypeNames(leaseApplyDetailsMapper.selectMaTypeNameByParentId(applyInfo.getId())); + } + return list; } /** 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 f61195c3..3deba40e 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 @@ -194,4 +194,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM lease_apply_details WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0 + + \ No newline at end of file From f7245330713ad950c11cab685208fb63b03f2a73 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 14:00:58 +0800 Subject: [PATCH 33/47] =?UTF-8?q?=E9=A2=86=E6=96=99=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/material/basic/BmAgreementInfoMapper.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 0c435dc4..3689a98f 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 @@ -63,9 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName, plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,tta.task_id FROM bm_agreement_info bai - LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id - LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id - LEFT JOIN tm_task_agreement tta on bai.agreement_id = tta.agreement_id + LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id + LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id + LEFT JOIN (select MIN(task_id) as task_id,agreement_id from tm_task_agreement + where agreement_id = #{agreementId}) tta on bai.agreement_id = tta.agreement_id where bai.status = '1' and bai.agreement_id = #{agreementId} From 1585841ab10767b3963d6a258e67950c998f0314 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 14:21:18 +0800 Subject: [PATCH 34/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=8A=A5=E5=BA=9F=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/basic/domain/BmFileInfo.java | 8 +- .../repair/domain/RepairPartDetails.java | 7 ++ .../service/impl/RepairServiceImpl.java | 100 +++++++++++++----- 3 files changed, 86 insertions(+), 29 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmFileInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmFileInfo.java index 1e144095..4eb08151 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmFileInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmFileInfo.java @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; +import lombok.experimental.Accessors; /** * 附件 @@ -13,12 +14,11 @@ import com.bonus.common.core.web.domain.BaseEntity; * @author xsheng * @date 2024-09-26 */ - - @Data @ToString -public class BmFileInfo extends BaseEntity -{ +@Accessors(chain = true) +public class BmFileInfo extends BaseEntity { + private static final long serialVersionUID = 1L; /** 主键id */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java index 81bb8943..43560cdb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java @@ -1,7 +1,10 @@ package com.bonus.material.repair.domain; import java.math.BigDecimal; +import java.util.List; + import com.bonus.common.core.annotation.Excel; +import com.bonus.material.basic.domain.BmFileInfo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; @@ -83,6 +86,10 @@ public class RepairPartDetails extends BaseEntity { @Excel(name = "损坏原因类型", readConverterExp = "0=:自然损坏,1人为损坏") private String scrapType; + /** 附件集合 */ + @ApiModelProperty(value = "附件集合") + private List fileList; + /** 维修人员 */ @ApiModelProperty(value = "维修人") private String repairer; 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 ab24f0e9..d0f774d5 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 @@ -7,6 +7,8 @@ import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.basic.domain.BmFileInfo; +import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.repair.domain.*; import com.bonus.material.repair.domain.vo.RepairDeviceListVo; import com.bonus.material.repair.domain.vo.RepairDeviceVO; @@ -37,6 +39,9 @@ public class RepairServiceImpl implements RepairService { @Resource private TmTaskMapper taskMapper; + @Resource + private BmFileInfoMapper bmFileInfoMapper; + // 1:内部维修 2:外部返厂维修 3:报废 private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3; @@ -291,7 +296,7 @@ public class RepairServiceImpl implements RepairService { } case scrapRepairType: { // 报废无需上传配件、直接初始化空集合 - partList = new ArrayList<>(0); + partList = bean.getCodeScrapRepairPartList(); // 更新报废数量 repairMapper.updateScrapNum(bean.getId(), 1, loginUser.getUserid()); break; @@ -343,15 +348,12 @@ public class RepairServiceImpl implements RepairService { // 判断外部维修配件数量是否为空 if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) { - // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + partList.get(0).getRepairNum(); // 统计报废数量 + 维修合计数量 - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { + if ((repairNum + OptionalInt.of(details.getScrapNum()).orElse(0)) > details.getRepairNum()) { throw new ServiceException("维修数量大于维修总量"); } - // ---------------校验维修数量----------------- // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); @@ -398,18 +400,42 @@ public class RepairServiceImpl implements RepairService { // 更新报废数量 repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); - // 报废类型无需配件,所以配件为空,添加【维修记录表】 - // 维修记录表信息 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) - .setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0) - .setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()) - .setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()) - .setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()) - .setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername()); + if (CollectionUtil.isNotEmpty(partList.get(0).getFileList())) { + for (BmFileInfo fileInfo : partList.get(0).getFileList()) { + fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId()) + .setTaskId(bean.getTaskId()).setModelId(bean.getId()) + .setCreateBy(loginUser.getUsername()); + bmFileInfoMapper.insertBmFileInfo(fileInfo); + + // 报废类型无需配件,所以配件为空,添加【维修记录表】 + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0) + .setFileIds(fileInfo.getId() == null ? "" : String.valueOf(fileInfo.getId())) + .setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()) + .setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()) + .setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()) + .setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername()); + + // 因报废操作无需配件, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } else { + // 报废类型无需配件,所以配件为空,添加【维修记录表】 + // 维修记录表信息 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(scrapRepairType).setStatus(0L).setIsSlt(0L).setPartNum(0) + .setRepairNum(0).setScrapNum(bean.getNumberScrapRepairPartList().get(0).getScrapNum()) + .setScrapReason(bean.getNumberScrapRepairPartList().get(0).getScrapReason()) + .setScrapType(bean.getNumberScrapRepairPartList().get(0).getScrapType()) + .setRepairer(loginUser.getUsername()).setCreateBy(loginUser.getUsername()); + + // 因报废操作无需配件, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } - // 不选维修配件时, 只添加【维修记录表】 - repairMapper.addRecord(repairApplyRecord); } } } else { @@ -446,12 +472,13 @@ public class RepairServiceImpl implements RepairService { */ private void copeNumberManageInList(RepairDeviceVO bean, List partList, LoginUser loginUser, Integer manageType) { if (CollectionUtil.isNotEmpty(partList)) { - + if (bean.getManageType() == null) { + throw new ServiceException("请选择物资管理方式"); + } // 如果是数量管理,那么默认为内部维修 - if (bean.getRepairType() == null && bean.getManageType() != null && manageType == manageTypeByNumber) { + if (bean.getRepairType() == null && manageType == manageTypeByNumber) { bean.setRepairType(inRepairType); } - // 再检查还是null的话直接结束任务 if (bean.getRepairType() == null) { return; @@ -507,13 +534,13 @@ public class RepairServiceImpl implements RepairService { // 外部维修 if (bean.getRepairType() == outRepairType) { - partList = bean.getNumberOutRepairPartList(); - // ---------------校验维修数量----------------- // 统计已维修数量 + 本次维修数量 int repairNum = OptionalInt.of(bean.getRepairedNum()).orElse(0) + bean.getRepairNum(); // 统计报废数量 + 维修合计数量 不能 大与> 总的待维修量 - if (repairNum + OptionalInt.of(bean.getScrapNum()).orElse(0) > bean.getRepairNum()) {throw new ServiceException("维修数量大于维修总量");} + if (repairNum + OptionalInt.of(bean.getScrapNum()).orElse(0) > bean.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); @@ -527,9 +554,8 @@ public class RepairServiceImpl implements RepairService { if (partList.get(0).getSupplierId() == null) { throw new ServiceException("请选择返厂厂家"); - } else { - repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); } + repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0))); // 新增【维修记录表】 repairMapper.addRecord(repairApplyRecord); @@ -542,13 +568,37 @@ public class RepairServiceImpl implements RepairService { repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); } + // 如果是报废类型,进行上传附件相关处理 + if (scrapRepairType == bean.getRepairType()) { + if (CollectionUtil.isNotEmpty(partList.get(0).getFileList())) { + for (BmFileInfo fileInfo : partList.get(0).getFileList()) { + fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId()) + .setTaskId(bean.getTaskId()).setModelId(bean.getId()) + .setCreateBy(loginUser.getUsername()); + bmFileInfoMapper.insertBmFileInfo(fileInfo); + + // 配件为空,添加【维修记录表】 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(bean.getRepairType()).setStatus(0L).setFileIds(String.valueOf(fileInfo.getId())) + .setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0) + .setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0) + .setCreateBy(loginUser.getUsername()); + + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } + } + } else { // 配件为空,添加【维修记录表】 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) .setRepairType(bean.getRepairType()).setStatus(0L) .setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0) - .setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0).setCreateBy(loginUser.getUsername()); + .setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0) + .setCreateBy(loginUser.getUsername()); // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); From 2941434e9ed2f6479bedacbf7e46952968fba8c6 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 14:52:37 +0800 Subject: [PATCH 35/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E2=80=94=E2=80=94=E6=9B=B4=E6=96=B0=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/service/impl/RepairServiceImpl.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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 d0f774d5..9aecafe7 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 @@ -400,8 +400,8 @@ public class RepairServiceImpl implements RepairService { // 更新报废数量 repairMapper.updateScrapNum(bean.getId(), scrapNum, loginUser.getUserid()); - if (CollectionUtil.isNotEmpty(partList.get(0).getFileList())) { - for (BmFileInfo fileInfo : partList.get(0).getFileList()) { + if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList().get(0).getFileList())) { + for (BmFileInfo fileInfo : bean.getNumberScrapRepairPartList().get(0).getFileList()) { fileInfo.setTaskType(TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId()) .setTaskId(bean.getTaskId()).setModelId(bean.getId()) .setCreateBy(loginUser.getUsername()); @@ -588,6 +588,17 @@ public class RepairServiceImpl implements RepairService { // 不选维修配件时, 只添加【维修记录表】 repairMapper.addRecord(repairApplyRecord); } + } else { + // 配件为空,添加【维修记录表】 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(bean.getRepairType()).setStatus(0L) + .setRepairNum(bean.getRepairType() != scrapRepairType ? 1 : 0) + .setScrapNum(bean.getRepairType() == scrapRepairType ? 1 : 0) + .setCreateBy(loginUser.getUsername()); + + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); } } From 750c0af1df47af03f9a1d7cd68908c2840c072a8 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 15:05:17 +0800 Subject: [PATCH 36/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RepairServiceImpl.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) 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 9aecafe7..7a0dfc73 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 @@ -313,15 +313,16 @@ public class RepairServiceImpl implements RepairService { if (bean.getId() == null) { throw new ServiceException("请完善参数,维修详情ID为空!"); } - // 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量 - RepairTaskDetails details = repairMapper.getById(bean.getId()); - - if (Objects.isNull(details)) { - throw new ServiceException("此维修记录不存在,请检查后提交!"); - } // 处理配件--数量管理--内部维修 if (CollectionUtil.isNotEmpty(bean.getNumberInRepairPartList())) { + // 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量 + RepairTaskDetails details = repairMapper.getById(bean.getId()); + + if (Objects.isNull(details)) { + throw new ServiceException("此维修记录不存在,请检查后提交!"); + } + partList = bean.getNumberInRepairPartList(); if (bean.getNumberInRepairPartList().get(0).getRepairNum() != null && bean.getNumberInRepairPartList().get(0).getRepairNum() != 0) { // ---------------校验维修数量----------------- @@ -342,9 +343,19 @@ public class RepairServiceImpl implements RepairService { // 处理配件集合数据 -- 数量管理--外部返厂维修 if (CollectionUtil.isNotEmpty(bean.getNumberOutRepairPartList())) { + // 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量 + RepairTaskDetails details = repairMapper.getById(bean.getId()); + + if (Objects.isNull(details)) { + throw new ServiceException("此维修记录不存在,请检查后提交!"); + } + BigDecimal sfCosts = new BigDecimal("0"); partList = bean.getNumberOutRepairPartList(); + // 重新查询维修详情 + details = repairMapper.getById(bean.getId()); + // 判断外部维修配件数量是否为空 if (partList.get(0).getRepairNum() != null && partList.get(0).getRepairNum() != 0) { @@ -386,6 +397,12 @@ public class RepairServiceImpl implements RepairService { if (CollectionUtil.isNotEmpty(bean.getNumberScrapRepairPartList())) { // 判断报废数量是否为空 if (bean.getNumberScrapRepairPartList().get(0).getScrapNum() != null && bean.getNumberScrapRepairPartList().get(0).getScrapNum() > 0) { + // 获取维修详情表中的维修详情记录:待维修、已维修、已报废的数量 + RepairTaskDetails details = repairMapper.getById(bean.getId()); + + if (Objects.isNull(details)) { + throw new ServiceException("此维修记录不存在,请检查后提交!"); + } // -------------校验维修数量开始---------------- // 统计历史已报废数量 + 本次报废数量 = 报废总数 int scrapNum = OptionalInt.of(details.getScrapNum()).orElse(0) + bean.getNumberScrapRepairPartList().get(0).getScrapNum(); From ff162d0cd52563bfe08c17ce7d2f76969d7c3ec9 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 15:18:00 +0800 Subject: [PATCH 37/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/common/biz/domain/vo/KeyValueVO.java | 9 +++++++++ .../repair/mapper/RepairAuditDetailsMapper.java | 4 ++-- .../impl/RepairAuditDetailsServiceImpl.java | 12 ++++++++---- .../material/lease/LeaseApplyDetailsMapper.xml | 2 +- .../material/repair/RepairAuditDetailsMapper.xml | 16 ++++++++-------- 5 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/domain/vo/KeyValueVO.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/vo/KeyValueVO.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/vo/KeyValueVO.java new file mode 100644 index 00000000..0c28fca9 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/domain/vo/KeyValueVO.java @@ -0,0 +1,9 @@ +package com.bonus.common.biz.domain.vo; + +import lombok.Data; + +@Data +public class KeyValueVO { + private String mapKey; + private String mapValue; +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java index 77313a48..0268cb2e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java @@ -1,12 +1,12 @@ package com.bonus.material.repair.mapper; import java.util.List; -import java.util.Map; import com.bonus.material.repair.domain.RepairAuditDetails; import com.bonus.material.repair.domain.RepairPart; import com.bonus.material.repair.domain.RepairRecord; import com.bonus.material.repair.domain.RepairTaskDetails; +import com.bonus.common.biz.domain.vo.KeyValueVO; import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO; import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO; import org.apache.ibatis.annotations.Param; @@ -89,7 +89,7 @@ public interface RepairAuditDetailsMapper { * 根据taskIds批量查询规格名称---批量 * @param taskIds 任务id集合 */ - Map selectTypeNamesByTaskIds(@Param("taskIds") List taskIds); + List selectTypeNamesByTaskIds(@Param("taskIds") List taskIds); List selectRepairAuditDetailsByTaskId(Long taskId); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index 1e47370a..34f10779 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -13,6 +13,7 @@ import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.repair.domain.*; +import com.bonus.common.biz.domain.vo.KeyValueVO; import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO; import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO; import com.bonus.material.repair.domain.vo.ScrapAudit; @@ -24,6 +25,8 @@ import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; import com.bonus.material.task.domain.TmTask; import javax.validation.constraints.NotNull; + +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import com.bonus.material.repair.mapper.RepairAuditDetailsMapper; import com.bonus.material.repair.service.IRepairAuditDetailsService; @@ -38,6 +41,7 @@ import javax.annotation.Resource; * @date 2024-10-16 */ @Service +@Slf4j public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService { @Resource @@ -110,14 +114,14 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService .collect(Collectors.toList()); // 批量查询 typeName - Map typeNameMap = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds); - + List keyValueList = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds); // 设置 itemType - if (CollectionUtil.isNotEmpty(typeNameMap)) { + if (CollectionUtil.isNotEmpty(keyValueList)) { + Map keyValueMap = keyValueList.stream().collect(Collectors.toMap(KeyValueVO::getMapKey, KeyValueVO::getMapValue)); for (ScrapApplyDetailsVO scrapApplyDetailsVO : repairQuestList) { Long taskId = scrapApplyDetailsVO.getTaskId(); if (taskId != null) { - String typeName = typeNameMap.get(taskId); + String typeName = keyValueMap.get(taskId); if (typeName != null) { scrapApplyDetailsVO.setItemType(typeName); } 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 3deba40e..557c903a 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 @@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(lad.pre_num,0) as pre_num, IFNULL(lad.audit_num,0) as audit_num, IFNULL(lad.al_num,0) as al_num, - lad.status, mt.unit_name, + IFNULL(lad.status,0) as status, mt.unit_name, lad.create_by, lad.create_time, lad.update_by, lad.update_time, lad.remark, lad.company_id from lease_apply_details lad diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml index 111a8241..fe3181ea 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/repair/RepairAuditDetailsMapper.xml @@ -457,21 +457,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update repair_apply_record set status = 1,update_time = now() where id = #{id} - select - task_id, GROUP_CONCAT(type_name) as typeName + task_id as mapKey, GROUP_CONCAT(type_name) as mapValue from (select distinct rad.task_id, mt1.type_name from repair_audit_details rad left join ma_type mt on rad.type_id = mt.type_id left join ma_type mt1 on mt.parent_id = mt1.type_id - where rad.task_id in - - #{taskId} - + + where rad.task_id in + + #{taskId} + + ) t GROUP BY task_id - \ No newline at end of file From 8781a3b74e5a7d5ff3f7583ed465551b9b9a9992 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 15:39:27 +0800 Subject: [PATCH 38/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=8C=E5=96=84=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/domain/RepairTaskDetails.java | 7 +++++ .../service/impl/RepairServiceImpl.java | 29 ++++++++++++------- .../mapper/material/repair/RepairMapper.xml | 10 ++++--- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java index 99ca0a42..118bdea4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java @@ -63,6 +63,13 @@ public class RepairTaskDetails extends BaseEntity { */ @ApiModelProperty(value = "维修总量") private int repairNum; + + /** + * 维修方式: 1内部 2外部返厂 3报废 + */ + @ApiModelProperty(value = "维修方式: 1内部 2外部 3报废") + private Integer repairType; + /** * 维修合格数量 */ 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 7a0dfc73..9af4f1f8 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 @@ -373,18 +373,20 @@ public class RepairServiceImpl implements RepairService { throw new ServiceException("请选择返厂厂家"); } - // 数量管理--外部返厂维修 + // 数量管理--外部返厂维修 -- 记录表插入数据 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); - repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) - .setRepairType(outRepairType).setRepairNum(partList.get(0).getRepairNum()).setScrapNum(0) - .setPartName(partList.get(0).getPartName()).setPartType(partList.get(0).getPartType()) - .setRepairContent(partList.get(0).getRepairContent()).setSupplierId(partList.get(0).getSupplierId()) - .setPartNum(partList.get(0).getPartNum()).setRepairer(loginUser.getUsername()) - .setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0))) - .setCreateBy(loginUser.getUsername()); + for (RepairPartDetails repairPartDetails : partList) { + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + .setRepairType(outRepairType).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0) + .setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType()) + .setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId()) + .setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername()) + .setPartPrice(Optional.ofNullable(repairPartDetails.getPartPrice()).orElse(new BigDecimal(0))) + .setCreateBy(loginUser.getUsername()); - // 新增【维修记录表】 - repairMapper.addRecord(repairApplyRecord); + // 新增【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } sfCosts = countPartCosts(partList, sfCosts); // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 @@ -503,10 +505,10 @@ public class RepairServiceImpl implements RepairService { // 内部维修 if (bean.getRepairType() == inRepairType) { + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); // 遍历配件列表,判断配件类型,收费还是不收费 for (RepairPartDetails partDetails : partList) { // 维修记录表信息 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(bean.getRepairType()); if (manageType == manageTypeByCode) { repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); @@ -547,6 +549,11 @@ public class RepairServiceImpl implements RepairService { repairMapper.addRecord(repairApplyRecord); } } + + BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0)); + // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 + // SQL: 新增【维修费用记录表】 + repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); } // 外部维修 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 45459e42..d183abf8 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 @@ -22,13 +22,15 @@ - insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status,create_by,create_time,company_id) - values (#{taskId},#{id},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},'0',#{createBy},now(),#{companyId}); + insert into repair_audit_details (task_id,repair_id,ma_id,type_id,repair_num,repaired_num,scrap_num,status, + create_by,create_time,company_id) + values (#{taskId},#{id},#{maId},#{typeId},#{repairNum},#{repairedNum},#{scrapNum},'0',#{createBy},now(), + #{companyId}); - insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status) - values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0'); + insert into repair_cost (task_id,repair_id,type_id,ma_id,repair_num,costs,part_type,status,repair_type) + values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.repairType}); From 1658a72fd04676db1c4b77b2cf558a16eaa915b0 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 16:11:41 +0800 Subject: [PATCH 39/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repair/service/impl/RepairAuditDetailsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index 34f10779..72265aaf 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -121,7 +121,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService for (ScrapApplyDetailsVO scrapApplyDetailsVO : repairQuestList) { Long taskId = scrapApplyDetailsVO.getTaskId(); if (taskId != null) { - String typeName = keyValueMap.get(taskId); + String typeName = keyValueMap.get(String.valueOf(taskId)); if (typeName != null) { scrapApplyDetailsVO.setItemType(typeName); } From 4cbede39d1a5d9fdb23228f3def2a95dc41288fd Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 16:13:02 +0800 Subject: [PATCH 40/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=8C=E5=96=84=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 9af4f1f8..e0acb898 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 @@ -509,14 +509,13 @@ public class RepairServiceImpl implements RepairService { // 遍历配件列表,判断配件类型,收费还是不收费 for (RepairPartDetails partDetails : partList) { // 维修记录表信息 - repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(bean.getRepairType()); + repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setRepairType(inRepairType); if (manageType == manageTypeByCode) { repairApplyRecord.setRepairNum(scrapRepairType != bean.getRepairType() ? 1 : 0); repairApplyRecord.setScrapNum(scrapRepairType == bean.getRepairType() ? 1 : 0); } if (manageType == manageTypeByNumber) { - repairApplyRecord.setRepairNum(bean.getRepairNum()); - repairApplyRecord.setScrapNum(bean.getScrapNum()); + repairApplyRecord.setRepairNum(partDetails.getRepairNum()); } repairApplyRecord.setCreateBy(loginUser.getUsername()); repairApplyRecord.setStatus(0L); From 44d3b24295e846cc6652e91f9394ccec4411a6a8 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 16:27:32 +0800 Subject: [PATCH 41/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96--=E9=85=8D=E4=BB=B6=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/repair/service/impl/RepairServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 e0acb898..ec251540 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 @@ -530,8 +530,8 @@ public class RepairServiceImpl implements RepairService { // 根据 partId 找配件单价 BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); - // 设置配件费用 - partDetails.setPartCost(partPrice); + // 设置配件单价费用 + partDetails.setPartPrice(partPrice); // 添加【维修配件明细表】 repairMapper.addPart(partDetails); From 9b2e7d38972dd2bd28ba60d04aa1c174bb5b6ef3 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 16:39:58 +0800 Subject: [PATCH 42/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=AE=8C=E5=96=84=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/repair/service/impl/RepairServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 ec251540..13efcfbf 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 @@ -376,7 +376,7 @@ public class RepairServiceImpl implements RepairService { // 数量管理--外部返厂维修 -- 记录表插入数据 RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); for (RepairPartDetails repairPartDetails : partList) { - repairApplyRecord.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) + repairApplyRecord.setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()) .setRepairType(outRepairType).setRepairNum(repairPartDetails.getRepairNum()).setScrapNum(0) .setPartName(repairPartDetails.getPartName()).setPartType(repairPartDetails.getPartType()) .setRepairContent(repairPartDetails.getRepairContent()).setSupplierId(repairPartDetails.getSupplierId()) @@ -536,7 +536,7 @@ public class RepairServiceImpl implements RepairService { repairMapper.addPart(partDetails); // 设置维修记录的配件费用 - repairApplyRecord.setPartPrice(partDetails.getPartCost()) + repairApplyRecord.setId(bean.getId()).setPartPrice(partDetails.getPartCost()) .setPartNum(partDetails.getPartNum()) .setRepairContent(partDetails.getRepairContent()) .setPartType(partDetails.getPartType()) @@ -569,7 +569,7 @@ public class RepairServiceImpl implements RepairService { repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); // 编码管理--外部返厂维修 - RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setTaskId(bean.getTaskId()).setMaId(bean.getMaId()) + RepairApplyRecord repairApplyRecord = new RepairApplyRecord().setId(bean.getId()).setTaskId(bean.getTaskId()).setMaId(bean.getMaId()) .setTypeId(bean.getTypeId()).setRepairType(outRepairType) .setPartName(partList.get(0).getPartName()) .setPartType(partList.get(0).getPartType()) From ad7d0e9c67381cc12ad845a880204be35cc0ba5f Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 16:54:46 +0800 Subject: [PATCH 43/47] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96--=E9=85=8D=E4=BB=B6=E5=8D=95=E4=BB=B7?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/repair/service/impl/RepairServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 13efcfbf..1665af0b 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 @@ -536,7 +536,7 @@ public class RepairServiceImpl implements RepairService { repairMapper.addPart(partDetails); // 设置维修记录的配件费用 - repairApplyRecord.setId(bean.getId()).setPartPrice(partDetails.getPartCost()) + repairApplyRecord.setId(bean.getId()).setPartPrice(partPrice) .setPartNum(partDetails.getPartNum()) .setRepairContent(partDetails.getRepairContent()) .setPartType(partDetails.getPartType()) From 41b7547baef44aa973000c47c391abc4c9e78e8e Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 19 Nov 2024 17:03:01 +0800 Subject: [PATCH 44/47] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BackApplyInfoController.java | 18 ++++++++ .../back/mapper/BackApplyInfoMapper.java | 22 ---------- .../back/service/IBackApplyInfoService.java | 15 +++---- .../impl/BackApplyInfoServiceImpl.java | 39 ++++++++++------- .../material/basic/domain/BmProject.java | 5 +++ .../bonus/material/basic/domain/BmUnit.java | 4 ++ .../material/common/mapper/SelectMapper.java | 14 ++++++ .../service/impl/SelectServiceImpl.java | 10 +++++ .../purchase/domain/PurchaseCheckDetails.java | 8 ++++ .../impl/PurchaseCheckInfoServiceImpl.java | 43 +++++++++++++++++++ .../material/back/BackApplyInfoMapper.xml | 23 +++------- .../mapper/material/common/SelectMapper.xml | 36 ++++++++++++++++ .../purchase/PurchaseCheckDetailsMapper.xml | 16 +++++-- 13 files changed, 188 insertions(+), 65 deletions(-) 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 6bb38b28..672b85a9 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 @@ -100,6 +100,24 @@ public class BackApplyInfoController extends BaseController { } } + /** + * 新增退料任务app + * @param dto + * @return + */ + @ApiOperation(value = "新增退料任务app") + @PreventRepeatSubmit + @RequiresPermissions("back:info:add") + @SysLog(title = "退料任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增退料任务app") + @PostMapping("/insertApp") + public AjaxResult insertApp(@RequestBody BackApplyRequestVo dto) { + try { + return backApplyInfoService.insertApp(dto); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } + } + /** * 修改退料任务 */ 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 09e2f7e2..0d8584a5 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 @@ -56,14 +56,6 @@ public interface BackApplyInfoMapper { */ public int deleteBackApplyInfoById(Long id); - /** - * 批量删除退料任务 - * - * @param ids 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteBackApplyInfoByIds(Long[] ids); - /** * 查询任务编号 * @param date @@ -121,20 +113,6 @@ public interface BackApplyInfoMapper { */ int insertCheckDetails(BackApplyDetails details); - /** - * 删除任务 - * @param taskId - * @return - */ - int deleteTask(Long taskId); - - /** - * 删除任务关联协议 - * @param taskId - * @return - */ - int deleteTaskAgreement(Long taskId); - /** * 删除退料主表 * @param id 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 6939d38d..fbe37ccb 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 @@ -45,14 +45,6 @@ public interface IBackApplyInfoService { */ public AjaxResult updateBackApplyInfo(BackApplyRequestVo dto); - /** - * 批量删除退料任务 - * - * @param ids 需要删除的退料任务主键集合 - * @return 结果 - */ - public int deleteBackApplyInfoByIds(Long[] ids); - /** * 删除退料任务信息 * @@ -81,4 +73,11 @@ public interface IBackApplyInfoService { * @return */ AjaxResult editPrintStatus(BackApplyInfo dto); + + /** + * 新增退料任务app + * @param dto + * @return + */ + AjaxResult insertApp(BackApplyRequestVo dto); } 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 dcd326cb..19cb2135 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 @@ -19,6 +19,8 @@ import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.basic.domain.BmFileInfo; import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.settlement.domain.SltAgreementInfo; +import com.bonus.material.task.mapper.TmTaskAgreementMapper; +import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import com.bonus.material.back.mapper.BackApplyInfoMapper; @@ -44,6 +46,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { @Resource private BmFileInfoMapper bmFileInfoMapper; + @Resource + private TmTaskMapper taskMapper; + + @Resource + private TmTaskAgreementMapper taskAgreementMapper; + /** * 查询退料任务 * @@ -212,7 +220,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { if (StringUtils.isNotBlank(dto.getBackApplyInfo().getPhone()) && !PhoneUtil.isMobile(dto.getBackApplyInfo().getPhone())) { return AjaxResult.error("手机号格式不正确,请重新填写!"); } - //对提交的退料详情树木进行校验 + //对提交的退料详情数目进行校验 for (BackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) { if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) { if (backApplyDetails.getNum() < backApplyDetails.getPreNum()) { @@ -403,8 +411,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { List maCodeList = backApplyInfoMapper.selectByCode(id); // 删除相关任务信息 int result = 0; - result += backApplyInfoMapper.deleteTask(backApplyInfo.getTaskId()); - result += backApplyInfoMapper.deleteTaskAgreement(backApplyInfo.getTaskId()); + result += taskMapper.deleteTmTaskByTaskId(backApplyInfo.getTaskId()); + result += taskAgreementMapper.deleteTmTaskAgreementByTaskId(backApplyInfo.getTaskId()); result += backApplyInfoMapper.deleteBackApplyDetails(backApplyInfo.getId()); result += backApplyInfoMapper.deleteCheckDetails(backApplyInfo.getId()); // 删除退料详情附件 @@ -440,17 +448,6 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } - /** - * 批量删除退料任务 - * - * @param ids 需要删除的退料任务主键 - * @return 结果 - */ - @Override - public int deleteBackApplyInfoByIds(Long[] ids) { - return backApplyInfoMapper.deleteBackApplyInfoByIds(ids); - } - /** * 删除退料任务信息 * @@ -488,8 +485,8 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { private int deleteTaskInfo(BackApplyInfo backApplyInfo) { // 删除任务、任务协议及相关信息 int result = 0; - result += backApplyInfoMapper.deleteTask(backApplyInfo.getTaskId()); - result += backApplyInfoMapper.deleteTaskAgreement(backApplyInfo.getTaskId()); + result += taskMapper.deleteTmTaskByTaskId(backApplyInfo.getTaskId()); + result += taskAgreementMapper.deleteTmTaskAgreementByTaskId(backApplyInfo.getTaskId()); result += backApplyInfoMapper.deleteBackApply(backApplyInfo.getId()); result += backApplyInfoMapper.deleteBackApplyDetails(backApplyInfo.getId()); result += backApplyInfoMapper.deleteCheckDetails(backApplyInfo.getId()); @@ -627,6 +624,16 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { return result > 0 ? AjaxResult.success() : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); } + /** + * 新增退料申请app + * @param dto + * @return + */ + @Override + public AjaxResult insertApp(BackApplyRequestVo dto) { + return null; + } + /** * 更新任务表及退料申请表状态 * @param backApplyInfo diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java index 3266ee74..b293d999 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmProject.java @@ -25,6 +25,11 @@ public class BmProject extends BaseEntity { private static final long serialVersionUID = 1L; + /** + * 是否app 端(app采有非下拉树) + */ + private Boolean isApp; + /** 主键ID */ private Long proId; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmUnit.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmUnit.java index 922436a5..863b72ee 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmUnit.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/domain/BmUnit.java @@ -23,6 +23,10 @@ import javax.validation.constraints.Size; public class BmUnit extends BaseEntity { private static final long serialVersionUID = 1L; + /** + * 是否app 端(app采有非下拉树) + */ + private Boolean isApp; /** 类型ID */ private Long unitId; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java index 1cdea8ee..7759ce30 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/mapper/SelectMapper.java @@ -137,4 +137,18 @@ public interface SelectMapper { * @return */ List getUseTypeTreeL21(List list); + + /** + * 获取单位下拉选app + * @param bmUnit + * @return + */ + List getUnitListApp(BmUnit bmUnit); + + /** + * 获取工程下拉选app + * @param bmProject + * @return + */ + List getProjectListApp(BmProject bmProject); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java index caf997d7..642c9fba 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/service/impl/SelectServiceImpl.java @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -36,6 +37,10 @@ public class SelectServiceImpl implements SelectService { */ @Override public AjaxResult getUnitList(BmUnit bmUnit) { + if (bmUnit.getIsApp() != null && bmUnit.getIsApp()) { + List list = mapper.getUnitListApp(bmUnit); + return AjaxResult.success(list); + } List groupList = new ArrayList<>(); List list = new ArrayList<>(); try { @@ -59,6 +64,11 @@ public class SelectServiceImpl implements SelectService { */ @Override public AjaxResult getProjectList(BmProject bmProject) { + if (bmProject.getIsApp() != null && bmProject.getIsApp()) { + List list = mapper.getProjectListApp(bmProject); + list.removeIf(Objects::isNull); + return AjaxResult.success(list); + } List groupList = new ArrayList<>(); List list = new ArrayList<>(); try { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java index 3b19acaa..d65943e9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/PurchaseCheckDetails.java @@ -79,6 +79,14 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "验收结论") private String checkResult; + /** 质保材料 */ + @ApiModelProperty(value = "质保材料") + private String warnDocuments; + + /** 原因 */ + @ApiModelProperty(value = "原因") + private String reason; + /** 物资厂家id */ //@Excel(name = "物资厂家id") @ApiModelProperty(value = "物资厂家id") diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index b815c4d1..82e40764 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -87,15 +87,38 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { MaTypeManageTypeEnum.CODE_DEVICE.getTypeId().equals(o.getManageType()) && getPurchaseMaCodeCount(o.getTaskId(), o.getTypeId()) > 0) .collect(Collectors.toList()); } + //针对于app查询可能存在的验收图片 + extractedFile(purchaseCheckDetailsList); } else { purchaseQueryDto.setStatusList(null); purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + //针对于app查询可能存在的验收图片 + extractedFile(purchaseCheckDetailsList); } purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetailsList); } return purchaseCheckDtoResult; } + /** + * 提取app新购验收文件信息 + * @param purchaseCheckDetailsList + */ + private void extractedFile(List purchaseCheckDetailsList) { + if (!CollectionUtils.isEmpty(purchaseCheckDetailsList)) { + for (PurchaseCheckDetails purchaseCheckDetails : purchaseCheckDetailsList) { + BmFileInfo fileInfo = new BmFileInfo(); + fileInfo.setTaskType(10); + fileInfo.setModelId(purchaseCheckDetails.getId()); + fileInfo.setTaskId(purchaseCheckDetails.getTaskId()); + List bmFileInfoList = bmFileInfoMapper.selectBmFileInfoList(fileInfo); + if (!CollectionUtils.isEmpty(bmFileInfoList)) { + purchaseCheckDetails.setBmFileInfos(bmFileInfoList); + } + } + } + } + private int getPurchaseMaCodeCount(Long taskId, Long typeId) { return purchaseMacodeInfoMapper.getPurchaseMaCodeCount(taskId, typeId); } @@ -285,6 +308,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { details.setStatus(PurchaseTaskStatusEnum.TO_STORE.getStatus()); } result = purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details) > 0 ? AjaxResult.success("detail验证成功") : AjaxResult.error("details无验证信息"); + extractedFile(details); } } else { for (PurchaseCheckDetails details : purchaseVerifyVo.getPurchaseCheckDetailsList()) { @@ -294,6 +318,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { .setTaskId(details.getTaskId()) .setTaskType(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId()) .setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus())); + extractedFile(details); } } } @@ -303,6 +328,24 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { } } + /** + * app新购验收图片上传方法抽取 + * @param details + */ + private void extractedFile(PurchaseCheckDetails details) { + if (!CollectionUtils.isEmpty(details.getBmFileInfos())) { + for (BmFileInfo bmFileInfo : details.getBmFileInfos()) { + if (bmFileInfo.getTaskType() != null && bmFileInfo.getTaskType() == 10) { + bmFileInfo.setTaskId(details.getTaskId()); + bmFileInfo.setModelId(details.getId()); + bmFileInfo.setCreateBy(SecurityUtils.getUsername()); + bmFileInfo.setCreateTime(DateUtils.getNowDate()); + bmFileInfoMapper.insertBmFileInfo(bmFileInfo); + } + } + } + } + /** * 根据任务id查询验收单 * 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 3210a194..033e308f 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 @@ -71,11 +71,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bai.phone like concat('%', #{keyWord}, '%') ) + + and bu.unit_id = #{unitId} + + + and bp.pro_id = #{proId} + - and bai.status = #{status} + and tt.task_status = #{status} GROUP BY bai.`code` ORDER BY bai.create_time desc @@ -565,21 +571,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from back_apply_info where id = #{id} - - delete from back_apply_info where id in - - #{id} - - - - - update tm_task set status = 0 where task_id = #{taskId} - - - - delete from tm_task_agreement where task_id = #{taskId} - - delete from back_apply_info where id = #{id} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml index c7610c70..22853232 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/common/SelectMapper.xml @@ -305,4 +305,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY level + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index 0843dddc..df2908b9 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml @@ -44,7 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select pcd.id, pcd.task_id, pcd.type_id, pcd.purchase_price, pcd.purchase_tax_price, pcd.purchase_num, pcd.check_num, pcd.bind_num, pcd.check_result, pcd.supplier_id, pcd.status, pcd.create_by, pcd.production_time, pcd.create_time, pcd.update_by, pcd.update_time, pcd.remark, pcd.check_url_name, pcd.check_url, pcd.input_num, pcd.input_status, pcd.input_time, pcd.file_name, - pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type + pcd.file_url, pcd.company_id, pcd.fix_code, mt.type_name, mt.unit_name, mtp.type_name as ma_type_name, mt.manage_type as manage_type, + pcd.warn_documents as warnDocuments, pcd.reason as reason from purchase_check_details pcd left join ma_type mt on pcd.type_id = mt.type_id left join ma_type mtp on mt.parent_id = mtp.type_id @@ -331,8 +332,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update purchase_check_details - set - `status` = #{status}, check_result = #{checkResult}, check_num = purchase_num + + `status` = #{status}, + check_result = #{checkResult}, + check_num = purchase_num, + + warn_documents = #{warnDocuments}, + + + reason = #{reason} + + where 1=1 From 80f79f92218855a61fc15acb1b2dc24da51d5d90 Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 19 Nov 2024 18:20:07 +0800 Subject: [PATCH 45/47] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/biz/enums/BackTaskStatusEnum.java | 24 +++++ .../back/mapper/BackApplyInfoMapper.java | 14 --- .../impl/BackApplyInfoServiceImpl.java | 90 +++++++++++-------- .../material/back/BackApplyInfoMapper.xml | 59 ------------ .../material/task/TmTaskAgreementMapper.xml | 38 +++++++- 5 files changed, 112 insertions(+), 113 deletions(-) create mode 100644 bonus-common-biz/src/main/java/com/bonus/common/biz/enums/BackTaskStatusEnum.java diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/BackTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/BackTaskStatusEnum.java new file mode 100644 index 00000000..00b463a4 --- /dev/null +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/BackTaskStatusEnum.java @@ -0,0 +1,24 @@ +package com.bonus.common.biz.enums; + +import lombok.Getter; + +/** + * @author : mashuai + * @version : 1.0 + * 退料任务状态枚举 + */ +@Getter +public enum BackTaskStatusEnum { + + BACK_TASK_NO_FINISHED(0, "退料未完成"), + BACK_TASK_TO_REJECT(1, "维修驳回"), + BACK_TASK_IN_FINISHED(3, "退料已完成"); + + private final Integer status; + private final String statusName; + + BackTaskStatusEnum(Integer status, String statusName) { + this.status = status; + this.statusName = statusName; + } +} 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 0d8584a5..ccac5e25 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 @@ -64,20 +64,6 @@ public interface BackApplyInfoMapper { */ String selectTaskNumByMonth(@Param("date") Date date, @Param("taskType") Integer taskType); - /** - * 新增任务 - * @param backApplyInfo - * @return - */ - int insertTmTask(BackApplyInfo backApplyInfo); - - /** - * 新增任务关联协议 - * @param backApplyInfo - * @return - */ - int insertTaskAgreement(BackApplyInfo backApplyInfo); - /** * 新增任务详情 * @param details 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 19cb2135..bd87b8da 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 @@ -6,7 +6,9 @@ import java.util.stream.Collectors; import cn.hutool.core.util.PhoneUtil; import com.alibaba.nacos.common.utils.CollectionUtils; +import com.bonus.common.biz.enums.BackTaskStatusEnum; import com.bonus.common.biz.enums.HttpCodeEnum; +import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; @@ -19,6 +21,8 @@ import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.basic.domain.BmFileInfo; import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.settlement.domain.SltAgreementInfo; +import com.bonus.material.task.domain.TmTask; +import com.bonus.material.task.domain.TmTaskAgreement; import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; @@ -233,26 +237,30 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { if (StringUtils.isBlank(code)) { return AjaxResult.error("后台退料编号生成异常,请重试!"); } - BackApplyInfo backApplyInfo = dto.getBackApplyInfo(); - backApplyInfo.setCode(code); - backApplyInfo.setCreateBy(SecurityUtils.getUsername()); - backApplyInfo.setCreateTime(DateUtils.getNowDate()); - backApplyInfo.setTaskType(3); - backApplyInfo.setTaskStatus(0); - backApplyInfo.setStatus("0"); - int result = 0; try { - // 保存退料信息到 tm_task 表中 - result += backApplyInfoMapper.insertTmTask(backApplyInfo); - if (result > 0) { - Long taskId = backApplyInfo.getTaskId(); - result += backApplyInfoMapper.insertTaskAgreement(backApplyInfo); - backApplyInfo.setTaskId(taskId); + int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId()); + TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), + BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(), + null,thisMonthMaxOrder + 1, code); + tmTask.setCreateTime(DateUtils.getNowDate()); + tmTask.setCreateBy(SecurityUtils.getUsername()); + BackApplyInfo backApplyInfo = dto.getBackApplyInfo(); + backApplyInfo.setTaskId(tmTask.getTaskId()); + backApplyInfo.setCode(code); + backApplyInfo.setCreateBy(SecurityUtils.getUsername()); + backApplyInfo.setCreateTime(DateUtils.getNowDate()); + // 保存退料信息到 tm_task 表中 + result += taskMapper.insertTmTask(tmTask); + if (result > 0) { + TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId()); + tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); + tmTaskAgreement.setCreateBy(SecurityUtils.getUsername()); + taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); result += backApplyInfoMapper.insertBackApplyInfo(backApplyInfo); - } - // 保存退料详情 - result = saveBackApplyDetails(dto, backApplyInfo, result); + } + // 保存退料详情 + result = saveBackApplyDetails(dto, backApplyInfo, result); } catch (Exception e) { log.error("保存退料信息时发生异常: ", e); } @@ -271,7 +279,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { details.setCode(backApplyInfo.getCode()); details.setParentId(backApplyInfo.getId()); details.setAuditNum(details.getPreNum()); - details.setStatus("0"); + details.setStatus(String.valueOf(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus())); details.setCreateBy(SecurityUtils.getUsername()); details.setCreateTime(DateUtils.getNowDate()); // 保存退料详情 @@ -419,23 +427,30 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { result += deleteFileInfoForDetails(backApplyDetailsList, id); // 删除编码设备附件 result += deleteFileInfoForMaCodes(maCodeList, id); + if (result > 0) { //执行新增操作 - backApplyInfo.setTaskType(3); - backApplyInfo.setTaskStatus(0); - backApplyInfo.setStatus("0"); + backApplyInfo.setTaskType(TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId()); + backApplyInfo.setTaskStatus(BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus()); backApplyInfo.setId(id); backApplyInfo.setUpdateTime(DateUtils.getNowDate()); backApplyInfo.setUpdateBy(SecurityUtils.getUsername()); backApplyInfo.setBackPerson(dto.getBackApplyInfo().getBackPerson()); backApplyInfo.setPhone(dto.getBackApplyInfo().getPhone()); backApplyInfo.setRemark(dto.getBackApplyInfo().getRemark() == null ? backApplyInfo.getRemark() : dto.getBackApplyInfo().getRemark()); + int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId()); + TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(), + null,thisMonthMaxOrder + 1, backApplyInfo.getCode()); + tmTask.setCreateTime(DateUtils.getNowDate()); + tmTask.setCreateBy(SecurityUtils.getUsername()); // 保存退料信息到 tm_task 表中 - result += backApplyInfoMapper.insertTmTask(backApplyInfo); + result += taskMapper.insertTmTask(tmTask); + backApplyInfo.setTaskId(tmTask.getTaskId()); if (result > 0) { - Long taskId = backApplyInfo.getTaskId(); - result += backApplyInfoMapper.insertTaskAgreement(backApplyInfo); - backApplyInfo.setTaskId(taskId); + TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId()); + tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); + tmTaskAgreement.setCreateBy(SecurityUtils.getUsername()); + taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); result += backApplyInfoMapper.updateBackApplyInfo(backApplyInfo); } // 保存退料详情 @@ -714,11 +729,10 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { private int insertTta(Long taskId, List list) { int res; String agreementId = String.valueOf(list.get(0).getAgreementId()); - BackApplyInfo backApplyInfo = new BackApplyInfo(); - backApplyInfo.setAgreementId(Long.parseLong(agreementId)); - backApplyInfo.setTaskId(taskId); - backApplyInfo.setCreateBy(SecurityUtils.getUsername()); - res = backApplyInfoMapper.insertTaskAgreement(backApplyInfo); + TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(taskId, Long.parseLong(agreementId)); + tmTaskAgreement.setCreateTime(DateUtils.getNowDate()); + tmTaskAgreement.setCreateBy(SecurityUtils.getUsername()); + res = taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement); return res; } @@ -731,16 +745,16 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { Long newTask = null; // 生成维修单号 String code = genCodeRule(); - BackApplyInfo applyInfo = new BackApplyInfo(); - applyInfo.setTaskType(4); // 设置任务类型 - applyInfo.setCode(code); // 设置单号 - applyInfo.setCreateBy(createBy); // 设置创建者 - applyInfo.setTaskStatus(0); + int thisMonthMaxOrder = taskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId()); + TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_BACK.getTaskTypeId(), BackTaskStatusEnum.BACK_TASK_NO_FINISHED.getStatus(), + null,thisMonthMaxOrder + 1, code); + tmTask.setCreateTime(DateUtils.getNowDate()); + tmTask.setCreateBy(createBy); // 插入任务 - int taskId = backApplyInfoMapper.insertTmTask(applyInfo); + int taskId = taskMapper.insertTmTask(tmTask); // 如果插入成功且返回的 taskId 大于 0 - if (taskId > 0 && applyInfo.getTaskId() > 0) { - newTask = applyInfo.getTaskId(); + if (taskId > 0 && tmTask.getTaskId() > 0) { + newTask = tmTask.getTaskId(); } return newTask; } 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 033e308f..a000a667 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 @@ -315,65 +315,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - insert into tm_task ( - task_type, - task_status, - code, - create_by, - remark, - company_id, - create_time - ) values ( - #{taskType}, - #{taskStatus}, - #{code}, - #{createBy}, - #{remark}, - #{companyId}, - NOW() - ) - - - - insert into tm_task_agreement - ( - - task_id, - - - agreement_id, - - - create_by, - - - remark, - - - company_id, - - create_time - ) values ( - - #{taskId}, - - - #{agreementId}, - - - #{createBy}, - - - #{remark}, - - - #{companyId}, - - NOW() - ) - - insert into back_apply_details diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml index 8933ea3c..e04e785a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml @@ -32,8 +32,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - INSERT INTO tm_task_agreement (task_id, agreement_id, create_by, create_time, company_id) - VALUES(#{taskId},#{agreementId},#{createBy},NOW(),#{companyId}) + insert into tm_task_agreement + ( + + task_id, + + + agreement_id, + + + create_by, + + + remark, + + + company_id, + + create_time + ) values ( + + #{taskId}, + + + #{agreementId}, + + + #{createBy}, + + + #{remark}, + + + #{companyId}, + + NOW() + ) From dcfb7fad0609f3e739c959eaa97f3d440ae91113 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 19 Nov 2024 18:40:16 +0800 Subject: [PATCH 46/47] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/RepairAuditDetailsServiceImpl.java | 28 +++++++++---------- .../service/impl/RepairServiceImpl.java | 2 +- .../material/task/mapper/TmTaskMapper.java | 7 ++++- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java index fd28ec22..11113ddf 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/impl/RepairAuditDetailsServiceImpl.java @@ -1,11 +1,8 @@ package com.bonus.material.repair.service.impl; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - import cn.hutool.core.collection.CollectionUtil; import com.bonus.common.biz.constant.MaterialConstants; +import com.bonus.common.biz.domain.vo.KeyValueVO; import com.bonus.common.biz.enums.RepairTaskStatusEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.core.exception.ServiceException; @@ -13,26 +10,27 @@ import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.repair.domain.*; -import com.bonus.common.biz.domain.vo.KeyValueVO; import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO; import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO; import com.bonus.material.repair.domain.vo.ScrapAudit; +import com.bonus.material.repair.mapper.RepairAuditDetailsMapper; import com.bonus.material.repair.mapper.RepairInputDetailsMapper; +import com.bonus.material.repair.service.IRepairAuditDetailsService; import com.bonus.material.scrap.domain.ScrapApplyDetails; import com.bonus.material.scrap.mapper.ScrapApplyDetailsMapper; +import com.bonus.material.task.domain.TmTask; import com.bonus.material.task.domain.TmTaskAgreement; import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskMapper; -import com.bonus.material.task.domain.TmTask; -import javax.validation.constraints.NotNull; import lombok.extern.slf4j.Slf4j; -import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Service; -import com.bonus.material.repair.mapper.RepairAuditDetailsMapper; -import com.bonus.material.repair.service.IRepairAuditDetailsService; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.validation.constraints.NotNull; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; /** * 修试审核详细Service业务层处理 @@ -113,14 +111,14 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService .collect(Collectors.toList()); // 批量查询 typeName - Map typeNameMap = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds); - + List keyValueList = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds); // 设置 itemType - if (CollectionUtil.isNotEmpty(typeNameMap)) { + if (CollectionUtil.isNotEmpty(keyValueList)) { + Map keyValueMap = keyValueList.stream().collect(Collectors.toMap(KeyValueVO::getMapKey, KeyValueVO::getMapValue)); for (ScrapApplyDetailsVO scrapApplyDetailsVO : repairQuestList) { Long taskId = scrapApplyDetailsVO.getTaskId(); if (taskId != null) { - String typeName = typeNameMap.get(taskId); + String typeName = keyValueMap.get(String.valueOf(taskId)); if (typeName != null) { scrapApplyDetailsVO.setItemType(typeName); } @@ -469,7 +467,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService try { // 调用 Mapper 方法进行批量更新 - return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids,repairAuditDetails.get(0).getStatus()); + return repairAuditDetailsMapper.updateRepairAuditDetailsBatch(ids, String.valueOf(repairAuditDetails.get(0).getStatus())); } catch (Exception e) { throw new ServiceException("错误信息描述"); } 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 1665af0b..18bacca9 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 @@ -682,7 +682,7 @@ public class RepairServiceImpl implements RepairService { @Override public AjaxResult rejectRepair(@NotNull List taskList) { try { - taskList.forEach(taskId -> taskMapper.updateTmTaskStatusByTaskId(taskId, RepairTaskStatusEnum.TASK_STATUS_REJECT.getStatus())); + taskList.forEach(taskId -> taskMapper.updateTaskStatus(String.valueOf(taskId), RepairTaskStatusEnum.TASK_STATUS_REJECT.getStatus())); } catch (DataAccessException e) { System.err.println(e.getMessage()); return AjaxResult.error("数据库SQL修改执行失败" + e.getMessage()); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index ebcc80ba..0bbb8c7b 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -52,7 +52,12 @@ public interface TmTaskMapper { */ int updateTmTask(TmTask tmTask); - int updateTaskStatus(@Param("taskId") String taskId, @Param("newStatus")int newStatus); + /** + * 根据任务id更新任务状态 -- 批量、限制状态 + * @param taskId 任务id 必传 + * @param newStatus 新状态 + */ + int updateTaskStatus(@Param("taskId") String taskId, @Param("newStatus") int newStatus); /** * 删除任务 From efffcf2c6af5639f6043db5dc7020bc7d22246bf Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 20 Nov 2024 12:17:37 +0800 Subject: [PATCH 47/47] =?UTF-8?q?=E6=96=B0=E8=B4=AD=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/common/biz/enums/PurchaseTaskStatusEnum.java | 1 - .../bonus/material/ma/controller/MachineController.java | 2 +- .../material/purchase/domain/dto/PurchaseQueryDto.java | 4 ++-- .../service/impl/PurchaseCheckInfoServiceImpl.java | 8 +++++--- .../mapper/material/purchase/PurchaseCheckInfoMapper.xml | 1 + 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java index 3846f5a7..4096a158 100644 --- a/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java +++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/enums/PurchaseTaskStatusEnum.java @@ -16,7 +16,6 @@ public enum PurchaseTaskStatusEnum { TO_BIND_AFTER_REJECT(13, "待绑定(驳回后)"), TO_STORE_AFTER_REJECT(14, "待入库(驳回后)"), IN_STORE(19, "已入库"), - TASK_TO_START(20, "入库待开始"), TASK_IN_PROGRESS(21, "入库进行中"), TASK_FINISHED(22, "入库已完成"); 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 a01cfd8a..cd045ebb 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 @@ -44,7 +44,7 @@ public class MachineController extends BaseController { * 查询机具设备管理列表 */ @ApiOperation(value = "查询机具设备管理列表1") - @RequiresPermissions("ma:machine:list") + //@RequiresPermissions("ma:machine:list") @GetMapping("/list") public TableDataInfo list(Machine machine) { diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseQueryDto.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseQueryDto.java index b4104621..04f822f9 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseQueryDto.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/domain/dto/PurchaseQueryDto.java @@ -37,8 +37,8 @@ public class PurchaseQueryDto { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date endTime; -// @ApiModelProperty(value = "外层任务状态") -// private Integer taskStatus; + @ApiModelProperty(value = "外层任务状态") + private Integer taskStatus; @ApiModelProperty(value = "关键字") private String keyWord; diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 82e40764..d2fc7644 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java @@ -144,7 +144,9 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { (o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND.getStatus()) || o.getStatus().equals(PurchaseTaskStatusEnum.TO_BIND_AFTER_REJECT.getStatus())))).collect(Collectors.toList()); OptionalInt minStatus = purchaseCheckDetails.stream().mapToInt(PurchaseCheckDetails::getStatus).min(); if (isAllowPartTransfer) { - purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(purchaseQueryDto.getStatusList())) { + purchaseCheckDetails = purchaseCheckDetails.stream().filter(o -> purchaseQueryDto.getStatusList().contains(o.getStatus())).collect(Collectors.toList()); + } purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), purchaseQueryDto.getStatusList())); } else { purchaseInfo.setPurchaseMaTypeName(purchaseCheckDetailsMapper.selectMaTypeNameByTaskAndStatusList(purchaseInfo.getTaskId(), new ArrayList<>())); @@ -220,7 +222,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId()); String taskCode = genderTaskCode(thisMonthMaxOrder); TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId(), - PurchaseTaskStatusEnum.TASK_TO_START.getStatus(), + PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTaskMapper.insertTmTask(tmTask); @@ -317,7 +319,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { tmTaskMapper.updateTmTask(new TmTask() .setTaskId(details.getTaskId()) .setTaskType(TmTaskTypeEnum.TM_TASK_PURCHASE.getTaskTypeId()) - .setTaskStatus(PurchaseTaskStatusEnum.TASK_TO_START.getStatus())); + .setTaskStatus(PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus())); extractedFile(details); } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml index d6d5e0c8..0fc90673 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckInfoMapper.xml @@ -139,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pci.purchaser = #{purchaser} and pci.supplier_id = #{supplierId} and pci.tax_rate = #{taxRate} + and t.task_status = #{taskStatus} and ( t.code like concat('%', #{keyWord}, '%') or