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-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/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-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-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-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/back/controller/BackApplyInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/back/controller/BackApplyInfoController.java index cd05d759..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 @@ -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) { @@ -98,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()); + } + } + /** * 修改退料任务 */ @@ -106,7 +126,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/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..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 @@ -56,14 +56,6 @@ public interface BackApplyInfoMapper { */ public int deleteBackApplyInfoById(Long id); - /** - * 批量删除退料任务 - * - * @param ids 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteBackApplyInfoByIds(Long[] ids); - /** * 查询任务编号 * @param date @@ -72,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 @@ -121,20 +99,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..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,10 @@ 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; import org.springframework.stereotype.Service; import com.bonus.material.back.mapper.BackApplyInfoMapper; @@ -44,6 +50,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService { @Resource private BmFileInfoMapper bmFileInfoMapper; + @Resource + private TmTaskMapper taskMapper; + + @Resource + private TmTaskAgreementMapper taskAgreementMapper; + /** * 查询退料任务 * @@ -212,7 +224,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()) { @@ -225,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); } @@ -263,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()); // 保存退料详情 @@ -403,31 +419,38 @@ 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()); // 删除退料详情附件 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); } // 保存退料详情 @@ -440,17 +463,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 +500,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 +639,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 @@ -707,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; } @@ -724,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/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/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/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/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/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/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 f5933569..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 @@ -74,4 +74,8 @@ public interface LeaseApplyDetailsMapper { LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record); 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/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..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 @@ -72,25 +72,4 @@ 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); - - - } 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..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; } /** @@ -116,7 +120,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/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/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/controller/PurchaseCheckInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/controller/PurchaseCheckInfoController.java index 3b001b5c..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 @@ -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.config.ListPagingUtil; +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; @@ -21,7 +24,8 @@ 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; /** * 新购验收任务Controller @@ -42,10 +46,11 @@ public class PurchaseCheckInfoController extends BaseController { @ApiOperation(value = "查询新购验收任务列表") //@RequiresPermissions("purchase:info:list") @GetMapping("/list") - public TableDataInfo list(PurchaseQueryDto purchaseQueryDto) { - startPage(); + public AjaxResult list(PurchaseQueryDto purchaseQueryDto) { 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); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list)); } 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..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 @@ -40,6 +40,9 @@ public class PurchaseCheckDetails extends BaseEntity { @ApiModelProperty(value = "规格名称") private String typeName; + @ApiModelProperty(value = "机具编号") + private String maCode; + @ApiModelProperty(value = "物资单位名称") private String unitName; @@ -76,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/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/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/mapper/PurchaseBindMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/mapper/PurchaseBindMapper.java index b1eff88b..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 @@ -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; @@ -79,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); /** * 更新数量 @@ -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/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/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/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/PurchaseCheckInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/purchase/service/impl/PurchaseCheckInfoServiceImpl.java index 8556b2c7..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 @@ -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,51 @@ 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()); + } + //针对于app查询可能存在的验收图片 + extractedFile(purchaseCheckDetailsList); } else { purchaseQueryDto.setStatusList(null); - purchaseCheckDetails = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + purchaseCheckDetailsList = purchaseCheckDetailsMapper.selectPurchaseCheckDetailsListByQueryDto(purchaseQueryDto); + //针对于app查询可能存在的验收图片 + extractedFile(purchaseCheckDetailsList); } - purchaseCheckDtoResult.setPurchaseCheckDetailsList(purchaseCheckDetails); + 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); + } + /** * 查询新购验收任务列表 * @@ -106,9 +143,10 @@ 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()); + 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<>())); @@ -132,13 +170,8 @@ 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 (isAllowPartTransfer) { purchaseCheckInfoResult.add(purchaseInfo); @@ -189,10 +222,8 @@ 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(), - purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1, taskCode); - //tmTask.setMonthOrder(thisMonthMaxOrder); - //tmTask.setCode(genderTaskCode(purchaseCheckInfo, thisMonthMaxOrder)); + PurchaseTaskStatusEnum.TASK_IN_PROGRESS.getStatus(), + purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), thisMonthMaxOrder + 1, taskCode); tmTask.setCreateTime(DateUtils.getNowDate()); tmTaskMapper.insertTmTask(tmTask); Long taskId = tmTask.getTaskId(); @@ -258,7 +289,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService { updateCount += purchaseCheckDetailsMapper.updatePurchaseDetails4Check(details); } } - // 注意: 维护tm_task的状态,但因为新购任务中的物资可以部分流转,所以汇总的状态失去意义,不再维护 } return updateCount > 0 ? AjaxResult.success("验证成功") : AjaxResult.error("无验证信息"); } catch (Exception e) { @@ -272,8 +302,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())) { @@ -282,14 +310,19 @@ 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()) { 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_IN_PROGRESS.getStatus())); + extractedFile(details); } } - // 注意: 维护tm_task的状态,但因为新购任务中的物资可以部分流转,所以汇总的状态失去意义,不再维护 } return result; } catch (Exception e) { @@ -297,6 +330,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/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()) ); // 修改采购明细的任务状态 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..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 @@ -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 @@ -192,16 +202,38 @@ public class PurchaseStorageServiceImpl implements IPurchaseStorageService { * @return */ private AjaxResult processByPurchaseIds(PurchaseDto purchaseDto) { - 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); + result += purchaseStorageMapper.updateNum(purchaseDto.getPurchaseId(), purchaseDto.getInPutList().size()); + 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); + List list = purchaseBindMapper.getMachineById(purchaseDto); + if (CollectionUtils.isNotEmpty(list)) { + result += purchaseStorageMapper.updateStatusById(PurchaseTaskStatusEnum.TO_STORE.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 +249,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 +292,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()); } @@ -290,11 +317,12 @@ 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()))) { - return tmTaskMapper.updateStatusById(PurchaseTaskStatusEnum.TASK_FINISHED.getStatus(), id.toString()); +// 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.updateTaskStatus(id.toString(), PurchaseTaskStatusEnum.TASK_FINISHED.getStatus()); } return 0; }).sum(); 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/controller/RepairController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/controller/RepairController.java index 5fe7e31f..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 @@ -10,6 +10,8 @@ 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.service.RepairService; import com.bonus.system.api.domain.SysUser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -17,13 +19,16 @@ 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; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotNull; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Optional; /** * @author syruan @@ -44,7 +49,7 @@ public class RepairController extends BaseController { /** * 获取维修任务列表 */ - @ApiOperation(value = "获取维修任务列表") + @ApiOperation(value = "获取维修任务列表--分页") @GetMapping("/getRepairTaskList") @RequiresPermissions(value = "repair:manage:list") public TableDataInfo getRepairTaskList(RepairTask bean) { @@ -54,21 +59,9 @@ public class RepairController extends BaseController { } /** - * 导出维修任务列表 + * 获取维修任务列表--不分页--NO_PAGE */ - @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, "维修任务列表"); - } - - /** - * 获取维修任务列表--APP - */ - @ApiOperation(value = "获取维修任务列表---APP") + @ApiOperation(value = "获取维修任务列表---不分页") @GetMapping("/getAppRepairTaskList") @RequiresPermissions("repair:manage:list") public AjaxResult getAppRepairTaskList(RepairTask bean) { @@ -81,20 +74,20 @@ 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); + List list = service.getRepairMaTypeList(bean); return getDataTable(list); } /** - * 获取维修任务机具列表 + * 获取维修任务机具列表--Ⅱ级页面详情列表 */ @ApiOperation(value = "获取维修物资设备列表---不分页") @GetMapping("/getAppRepairMaTypeList") public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) { - List list = service.getRepairMaTypeList(bean); + List list = service.getRepairMaTypeList(bean); return AjaxResult.success(list); } @@ -106,8 +99,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()); @@ -115,32 +110,50 @@ 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 @NotNull List list) { + return service.batchRepairApply(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); } + /** + * 驳回退料--批量 + */ + @ApiOperation(value = "驳回退料--批量") + @DeleteMapping("/{ids}") + public AjaxResult rejectRepair(@PathVariable Long[] ids) { + return service.rejectRepair(Arrays.asList(ids)); + } + /** * 获取维修员下拉选 */ @@ -150,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..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 @@ -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 = "数据所属组织") @@ -91,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/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/domain/RepairPartDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairPartDetails.java index e7cf18b6..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,11 +1,15 @@ 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; import com.bonus.common.core.web.domain.BaseEntity; +import lombok.experimental.Accessors; /** * 维修配件详细对象 repair_part_details @@ -13,10 +17,9 @@ import com.bonus.common.core.web.domain.BaseEntity; * @author xsheng * @date 2024-10-16 */ - - @Data @ToString +@Accessors(chain = true) public class RepairPartDetails extends BaseEntity { private static final long serialVersionUID = 1L; @@ -55,7 +58,7 @@ public class RepairPartDetails extends BaseEntity { /** 类型(0不收费,1收费) */ @Excel(name = "类型", readConverterExp = "0=不收费,1收费") - private String partType; + private Integer partType; /** 数据所属组织 */ @Excel(name = "数据所属组织") @@ -68,9 +71,27 @@ 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 List fileList; + /** 维修人员 */ + @ApiModelProperty(value = "维修人") private String repairer; @ApiModelProperty(value = "配件名称") 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/RepairTaskDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/RepairTaskDetails.java index 49aef973..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 @@ -34,6 +34,13 @@ public class RepairTaskDetails extends BaseEntity { */ @ApiModelProperty(value = "类型名称") private String typeName; + + /** + * 规格类型id + */ + @ApiModelProperty(value = "规格型号id") + private String typeId; + /** * 规格型号 */ @@ -49,13 +56,20 @@ public class RepairTaskDetails extends BaseEntity { /** * 编码 */ - @ApiModelProperty(value = "编码") + @ApiModelProperty(value = "设备编码") private String code; /** * 维修总量 */ @ApiModelProperty(value = "维修总量") private int repairNum; + + /** + * 维修方式: 1内部 2外部返厂 3报废 + */ + @ApiModelProperty(value = "维修方式: 1内部 2外部 3报废") + private Integer repairType; + /** * 维修合格数量 */ @@ -72,12 +86,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..b67d30fe --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/domain/vo/RepairDeviceVO.java @@ -0,0 +1,137 @@ +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; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author : 阮世耀 + * @version : 1.0 + * @CreateTime: 2024-11-15 14:35 + * @Description: 维修设备VO + */ +@Data +@Accessors(chain = true) +public class RepairDeviceVO { + + @ApiModelProperty(value = "主键") + private Long id; + + @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; + + @ApiModelProperty(value = "状态") + private String status; + + @ApiModelProperty(value = "维修配件信息") + private String partInfo; + + @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; + + @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/RepairAuditDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairAuditDetailsMapper.java index 77313a48..d793ff08 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; @@ -61,6 +61,14 @@ public interface RepairAuditDetailsMapper { */ int updateRepairAuditDetails(RepairAuditDetails repairAuditDetails); + /** + * 批量修改修试审核详细--批量 + * + * @param ids 批量修试审核详细 + * @return 结果 + */ + int updateRepairAuditDetailsBatch(@Param("ids") List ids, @Param("status") String status); + /** * 删除修试审核详细 * @@ -89,7 +97,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/mapper/RepairMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/mapper/RepairMapper.java index 07326577..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 @@ -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); /** * 新增维修记录 @@ -81,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); /** * 新增任务 @@ -107,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); /** * 查询是否存在未完成维修的 @@ -122,7 +123,7 @@ public interface RepairMapper { List getDetailsListByTaskId(RepairTask task); /** - * 新增实验建议审核数据 + * 新增修饰审核审核数据 * @param details 数据详情 */ int addAuditDetails(RepairTaskDetails details); @@ -135,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/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/RepairService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/repair/service/RepairService.java index e1e0ebe4..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 @@ -5,6 +5,8 @@ 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.material.repair.domain.vo.RepairDeviceVO; import com.bonus.system.api.domain.SysUser; import java.util.ArrayList; @@ -24,15 +26,11 @@ public interface RepairService { /** * 获取维修详细列表 - * @param bean - * @return */ - List getRepairMaTypeList(RepairTaskDetails bean); + List getRepairMaTypeList(RepairTaskDetails bean); /** - * 新增维修记录 - * @param bean - * @return + * 提交维修记录 */ AjaxResult submitRepairApply(RepairApplyRecord bean); @@ -43,10 +41,10 @@ public interface RepairService { */ AjaxResult fastRepairApply(List list); + AjaxResult batchRepairApply(List repairDeviceVOList); + /** - * 完成维修 - * @param ids - * @return + * 维修明细--批量审核--更新明细status */ int completeRepair(ArrayList ids); @@ -58,11 +56,12 @@ public interface RepairService { /** * 提交审核 - * @param taskList - * @return + * @param taskList 任务信息集合 */ 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 1e47370a..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; @@ -16,20 +13,24 @@ import com.bonus.material.repair.domain.*; 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.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业务层处理 @@ -38,6 +39,7 @@ import javax.annotation.Resource; * @date 2024-10-16 */ @Service +@Slf4j public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService { @Resource @@ -68,8 +70,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService } /** - * @param repairAuditDetails - * @return + * @param repairAuditDetails 查询参数 */ @Override public List getRepairAuditList(RepairAuditDetails repairAuditDetails) { @@ -110,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); } @@ -312,7 +313,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); @@ -322,7 +323,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); @@ -445,6 +446,33 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService } } + /** + * 批量修改修试审核详细 + * + * @param repairAuditDetails 修试审核详细 + * @return 结果 + */ + @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 { + // 调用 Mapper 方法进行批量更新 + 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 181d2ee3..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 @@ -1,23 +1,31 @@ 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; -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.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; import com.bonus.material.repair.mapper.RepairMapper; import com.bonus.material.repair.service.RepairService; +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.List; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; /** * @author syruan @@ -28,6 +36,17 @@ public class RepairServiceImpl implements RepairService { @Resource private RepairMapper repairMapper; + @Resource + private TmTaskMapper taskMapper; + + @Resource + private BmFileInfoMapper bmFileInfoMapper; + + // 1:内部维修 2:外部返厂维修 3:报废 + private final int inRepairType = 1, outRepairType = 2, scrapRepairType = 3; + + // 维修管理方式--0:编码管理 1:数量管理 + private final int manageTypeByCode = 0, manageTypeByNumber = 1; @Override public List getRepairTaskList(RepairTask bean) { @@ -40,69 +59,101 @@ 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集合,用于快速分组,使用 ConcurrentHashMap 保证线程安全 + 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 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 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("维修数量大于维修总量"); - } - repairMapper.updateRepairedNum(bean.getId(), repairNum, Long.valueOf(bean.getRepairer()), loginUser.getUserid()); + case inRepairType: { + int repairNum = verifyRepairNum(bean, details); + // 更新维修数量、并修改维修人员 + repairMapper.updateRepairedNum(bean.getId(), repairNum, loginUser.getUserid(), loginUser.getUserid()); break; } - case "2": { - int repairNum = (int) (details.getRepairedNum() + bean.getRepairNum()); - int num = repairNum + details.getScrapNum(); - if (num > details.getRepairNum()) { - throw new ServiceException("维修数量大于维修总量"); - } + case outRepairType: { + int repairNum = verifyRepairNum(bean, details); + // 更新维修数量、维修人员不变 repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); break; } - case "3": { - int scrapNum = (int) (details.getScrapNum() + bean.getScrapNum()); + case scrapRepairType: { + int scrapNum = details.getScrapNum() + bean.getScrapNum(); int num = scrapNum + details.getRepairedNum(); 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 (Objects.equals(inRepairType, bean.getRepairType())) { + // 遍历配件列表,判断配件类型,收费还是不收费 for (RepairPartDetails partDetails : partList) { if (partDetails.getPartId() != null) { - // 有维修配件时 + // 有维修配件时,如果价格为空,设置为0 if (partDetails.getPartCost() == null) { partDetails.setPartCost(new BigDecimal(0)); } @@ -111,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 == bean.getRepairType()) { bean.setPartName(partList.get(0).getPartName()); bean.setPartType(partList.get(0).getPartType()); bean.setRepairContent(partList.get(0).getRepairContent()); @@ -142,81 +200,499 @@ 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(); - BigDecimal partNumber = new BigDecimal(partDetails.getPartNum()); - sfCosts = sfCosts.add(partCost.multiply(partNumber)); - } - } - if (!"0".equals(sfCosts.toString())) { + // 配件费用计算 + sfCosts = countPartCosts(partList, sfCosts); + + // 判断是否是收费配件 + if (sfPart.equals(sfCosts.toString())) { + // SQL: 新增【维修费用记录表】 repairMapper.addRepairCost(bean, sfCosts, sfPart); } } else { - // 新增预报废记录 + // 新增【维修记录表--预报废】 repairMapper.addRecord(bean); } return AjaxResult.success(); } + /** + * 校验维修数量 + */ + private static int verifyRepairNum(RepairApplyRecord bean, RepairTaskDetails details) { + 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; + } + @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(inRepairType); + 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 batchRepairApply(@NotNull List repairDeviceVOList) { + // 准备业务逻辑数据 LoginUser loginUser = SecurityUtils.getLoginUser(); - for (RepairTask task : taskList) { - int i = repairMapper.getUnFinish(task); - if (i > 0) { - throw new ServiceException("选中的数据中包含维修未完成的,请完成维修再进行提交审核"); + // 配件集合 + 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, loginUser.getUserid(), 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; + } + // 统一处理配件集合数据 + copeNumberManageInList(bean, partList, loginUser, bean.getManageType()); + + } else if (Objects.equals(manageTypeByNumber, bean.getManageType())) { + // 物资管理方式--数量管理 + if (bean.getId() == null) { + throw new ServiceException("请完善参数,维修详情ID为空!"); + } + + // 处理配件--数量管理--内部维修 + 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) { + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + 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()); + } + } + + // 处理配件集合数据 -- 数量管理--外部返厂维修 + 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) { + + // 统计已维修数量 + 本次维修数量 + int repairNum = OptionalInt.of(details.getRepairedNum()).orElse(0) + partList.get(0).getRepairNum(); + // 统计报废数量 + 维修合计数量 + if ((repairNum + OptionalInt.of(details.getScrapNum()).orElse(0)) > details.getRepairNum()) { + throw new ServiceException("维修数量大于维修总量"); + } + + // 更新维修数量、维修人员不变 + repairMapper.updateRepairedNumTwo(bean.getId(), repairNum, loginUser.getUserid()); + + if (partList.get(0).getSupplierId() == null) { + throw new ServiceException("请选择返厂厂家"); + } + + // 数量管理--外部返厂维修 -- 记录表插入数据 + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + for (RepairPartDetails repairPartDetails : partList) { + 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()) + .setPartNum(repairPartDetails.getPartNum()).setRepairer(loginUser.getUsername()) + .setPartPrice(Optional.ofNullable(repairPartDetails.getPartPrice()).orElse(new BigDecimal(0))) + .setCreateBy(loginUser.getUsername()); + + // 新增【维修记录表】 + 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())) { + // 判断报废数量是否为空 + 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(); + // 统计 报废总数 + 历史已维修数量, + 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()); + + 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()); + 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); + } + + } + } + } else { + throw new ServiceException("请选择正确的维修类型"); } } - int i = repairMapper.updateTaskStatus(taskList, loginUser.getUserid()); + + return AjaxResult.success("维修完成"); + } + + /** + * 配件列表价格合计 + * @param partList 配件列表 + * @param sfCosts 配件价格合计 + * @return 配件合计后的价格 + */ + private static BigDecimal countPartCosts(List partList, BigDecimal sfCosts) { + for (RepairPartDetails partDetails : partList) { + if (partDetails.getPartPrice() != null) { + BigDecimal partPrice = partDetails.getPartPrice(); + BigDecimal partNumber = new BigDecimal(partDetails.getPartNum()); + sfCosts = sfCosts.add(partPrice.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)) { + if (bean.getManageType() == null) { + throw new ServiceException("请选择物资管理方式"); + } + // 如果是数量管理,那么默认为内部维修 + if (bean.getRepairType() == null && manageType == manageTypeByNumber) { + bean.setRepairType(inRepairType); + } + // 再检查还是null的话直接结束任务 + if (bean.getRepairType() == null) { + return; + } + + // 内部维修 + if (bean.getRepairType() == inRepairType) { + RepairApplyRecord repairApplyRecord = new RepairApplyRecord(); + // 遍历配件列表,判断配件类型,收费还是不收费 + for (RepairPartDetails partDetails : partList) { + // 维修记录表信息 + 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(partDetails.getRepairNum()); + } + repairApplyRecord.setCreateBy(loginUser.getUsername()); + repairApplyRecord.setStatus(0L); + + if (partDetails.getPartId() != null && partDetails.getPartNum() != null) { + // 有维修配件时,如果价格为空,设置为0 + if (partDetails.getPartCost() == null) { + partDetails.setPartCost(new BigDecimal(0)); + } + partDetails.setTaskId(bean.getTaskId()).setMaId(bean.getMaId()).setTypeId(bean.getTypeId()).setCompanyId(null); + partDetails.setCreateBy(String.valueOf(loginUser.getUserid())); + + // 根据 partId 找配件单价 + BigDecimal partPrice = repairMapper.selectPartPrice(partDetails.getPartId()); + // 设置配件单价费用 + partDetails.setPartPrice(partPrice); + // 添加【维修配件明细表】 + repairMapper.addPart(partDetails); + + // 设置维修记录的配件费用 + repairApplyRecord.setId(bean.getId()).setPartPrice(partPrice) + .setPartNum(partDetails.getPartNum()) + .setRepairContent(partDetails.getRepairContent()) + .setPartType(partDetails.getPartType()) + .setPartId(partDetails.getPartId() == null ? 0L : partDetails.getPartId()); + // 添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } else { + // 不选维修配件时, 只添加【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + } + } + + BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0)); + // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 + // SQL: 新增【维修费用记录表】 + repairMapper.addRepairCost(repairApplyRecord, sfCosts, sfCosts.equals(new BigDecimal("0")) ? "0" : "1"); + } + + // 外部维修 + if (bean.getRepairType() == outRepairType) { + // ---------------校验维修数量----------------- + // 统计已维修数量 + 本次维修数量 + 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().setId(bean.getId()).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("请选择返厂厂家"); + } + repairApplyRecord.setSupplierId(partList.get(0).getSupplierId()); + repairApplyRecord.setPartPrice(Optional.ofNullable(partList.get(0).getPartPrice()).orElse(new BigDecimal(0))); + // 新增【维修记录表】 + repairMapper.addRecord(repairApplyRecord); + + // 配件费用计算 + BigDecimal sfCosts = countPartCosts(partList, new BigDecimal(0)); + + // TODO: 判断是否是收费配件,因数据存在多条,可能有些是免费配件 有些收费,所以这里用价格统一做处理,后续讨论 + // SQL: 新增【维修费用记录表】 + 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()); + + // 不选维修配件时, 只添加【维修记录表】 + 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); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult endRepairTask(@NotNull List taskList) { + LoginUser loginUser = SecurityUtils.getLoginUser(); + + // 1.查询选择任务是否还有未完成维修的数据 + for (RepairTask task : taskList) { + if (repairMapper.getUnFinish(task) > 0) { + return AjaxResult.error("选中的数据中包含维修未完成的,请完成维修再进行提交审核"); + } + } + + // 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); } return AjaxResult.success(); } + @Override + public AjaxResult rejectRepair(@NotNull List taskList) { + try { + 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()); + } + return AjaxResult.success("执行完成"); + } + /** + * 维修明细--批量审核--更新明细status + */ @Override public int completeRepair(ArrayList ids) { LoginUser loginUser = SecurityUtils.getLoginUser(); 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/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/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..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,13 +52,12 @@ public interface TmTaskMapper { */ int updateTmTask(TmTask tmTask); - /** * 根据任务id更新任务状态 -- 批量、限制状态 * @param taskId 任务id 必传 - * @param newTaskStatus 新状态 + * @param newStatus 新状态 */ - int updateTmTaskStatusByTaskId(@Param("taskId") Long taskId, @Param("newTaskStatus") Integer newTaskStatus); + int updateTaskStatus(@Param("taskId") String taskId, @Param("newStatus") int newStatus); /** * 删除任务 @@ -76,14 +75,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,11 +86,4 @@ 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); } 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..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 @@ -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' @@ -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 @@ -309,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 @@ -565,21 +512,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/basic/BmAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml index f30d202f..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 @@ -20,15 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + @@ -102,8 +103,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}, @@ -125,4 +124,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/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/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index 978ec252..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 @@ -188,4 +188,30 @@ 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..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} @@ -191,4 +202,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/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/PurchaseCheckDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/purchase/PurchaseCheckDetailsMapper.xml index eca38ca0..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 @@ -109,9 +110,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pcd.production_time between #{startTime} and #{endTime} - - - and pcd.status in @@ -301,7 +299,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}) @@ -334,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 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..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,16 @@ 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 + 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}, '%') + ) + 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 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..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() @@ -26,7 +28,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} 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..4ac34698 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,30 @@ 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 - + + + update repair_audit_details + set status = #{status}, update_time = now() + where id in + + #{id} + + \ No newline at end of file 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..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 @@ -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}); @@ -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,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,repair_type) + values (#{bean.taskId},#{bean.id},#{bean.typeId},#{bean.maId},#{bean.repairNum},#{costs},#{partType},'0',#{bean.repairType}); @@ -61,7 +63,7 @@ update tm_task - set task_status = '44', + set task_status = #{taskStatus}, update_by = #{userId}, update_time = now() where task_id in @@ -197,12 +199,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, 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..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() + ) @@ -60,4 +94,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 bea4a162..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 @@ -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}, @@ -82,16 +78,18 @@ 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}, - `status` = #{status}, + update_time = NOW() 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} @@ -114,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 ( @@ -137,120 +130,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY create_time DESC LIMIT 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file