From 663a871b56904c956f5fae1ef1a70baed1788eb8 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 12 Nov 2024 14:39:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E6=8E=A5=E5=8F=A3=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/domain/BmAgreementInfo.java | 5 + .../impl/BmAgreementInfoServiceImpl.java | 23 +++- .../controller/LeaseOutDetailsController.java | 4 +- .../lease/domain/LeaseOutDetails.java | 2 + .../service/ILeaseOutDetailsService.java | 6 +- .../impl/LeaseOutDetailsServiceImpl.java | 101 ++++++++++++++++-- 6 files changed, 129 insertions(+), 12 deletions(-) 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 361000ca..ff75c0af 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 @@ -1,6 +1,8 @@ package com.bonus.material.basic.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; @@ -119,4 +121,7 @@ public class BmAgreementInfo extends BaseEntity @ApiModelProperty(value = "关键词") private String keyWord; + + @ApiModelProperty(value = "附件列表") + private List bmFileInfos; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmAgreementInfoServiceImpl.java index 30ea973a..bc73dbdb 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmAgreementInfoServiceImpl.java @@ -3,11 +3,13 @@ package com.bonus.material.basic.service.impl; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; +import com.bonus.material.basic.mapper.BmFileInfoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.basic.mapper.BmAgreementInfoMapper; @@ -15,6 +17,8 @@ import com.bonus.material.basic.domain.BmAgreementInfo; import com.bonus.material.basic.service.IBmAgreementInfoService; import org.springframework.util.CollectionUtils; +import javax.annotation.Resource; + /** * 协议管理Service业务层处理 * @@ -27,6 +31,9 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService @Autowired private BmAgreementInfoMapper bmAgreementInfoMapper; + @Resource + private BmFileInfoMapper bmFileInfoMapper; + /** * 查询协议管理 * @@ -68,7 +75,21 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService bmAgreementInfo.setCreateTime(DateUtils.getNowDate()); bmAgreementInfo.setCreateBy(SecurityUtils.getUsername()); bmAgreementInfo.setAgreementCode(getAgreementCode()); - return AjaxResult.success(bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo)); + int count = bmAgreementInfoMapper.insertBmAgreementInfo(bmAgreementInfo); + if (count > 0) { + if (CollectionUtils.isEmpty(bmAgreementInfo.getBmFileInfos())) { + return AjaxResult.success("新增任务成功,无营业执照附件"); + } + AtomicBoolean addFileInfoResult = new AtomicBoolean(false); + bmAgreementInfo.getBmFileInfos().forEach(bmFileInfo -> { + bmFileInfo.setModelId(bmAgreementInfo.getAgreementId()); + bmFileInfo.setCreateTime(DateUtils.getNowDate()); + addFileInfoResult.set(bmFileInfoMapper.insertBmFileInfo(bmFileInfo) > 0); + }); + return addFileInfoResult.get() ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,附件表插入0条"); + } else { + return AjaxResult.error("新建任务失败,插入0条"); + } } catch (Exception e) { throw new ServiceException("错误信息描述"); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java index 07bc242f..ffdabc7d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/controller/LeaseOutDetailsController.java @@ -81,9 +81,9 @@ public class LeaseOutDetailsController extends BaseController { @RequiresPermissions("lease:details:add") @SysLog(title = "领料出库详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料出库详细") @PostMapping - public AjaxResult add(@RequestBody LeaseOutDetails leaseOutDetails) { + public AjaxResult add(@RequestBody List leaseOutDetailsList) { try { - return toAjax(leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetails)); + return leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetailsList); } catch (Exception e) { return error("系统错误, " + e.getMessage()); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseOutDetails.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseOutDetails.java index c437ba29..300f049d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseOutDetails.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/domain/LeaseOutDetails.java @@ -62,5 +62,7 @@ public class LeaseOutDetails extends BaseEntity { @ApiModelProperty(value = "是否推送到智慧工程0:否,1:是") private Long pushNotifications; + @ApiModelProperty(value = "出库类型 0编码出库 1数量出库 2成套出库") + private Integer manageType; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java index 35e4e88a..271828df 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/ILeaseOutDetailsService.java @@ -1,6 +1,8 @@ package com.bonus.material.lease.service; import java.util.List; + +import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.material.lease.domain.LeaseOutDetails; /** @@ -29,10 +31,10 @@ public interface ILeaseOutDetailsService { /** * 新增领料出库详细 * - * @param leaseOutDetails 领料出库详细 + * @param leaseOutDetailsList 领料出库详细 * @return 结果 */ - public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); + public AjaxResult insertLeaseOutDetails(List leaseOutDetailsList); /** * 修改领料出库详细 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 d16ef8b1..8c099c7c 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,11 +3,13 @@ package com.bonus.material.lease.service.impl; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.core.web.domain.AjaxResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.material.lease.mapper.LeaseOutDetailsMapper; import com.bonus.material.lease.domain.LeaseOutDetails; import com.bonus.material.lease.service.ILeaseOutDetailsService; +import org.springframework.transaction.annotation.Transactional; /** * 领料出库详细Service业务层处理 @@ -45,17 +47,19 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { /** * 新增领料出库详细 * - * @param leaseOutDetails 领料出库详细 + * @param leaseOutDetailsList 领料出库详细 * @return 结果 */ @Override - public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails) { - leaseOutDetails.setCreateTime(DateUtils.getNowDate()); - try { - return leaseOutDetailsMapper.insertLeaseOutDetails(leaseOutDetails); - } catch (Exception e) { - throw new ServiceException("错误信息描述"); + public AjaxResult insertLeaseOutDetails(List leaseOutDetailsList) { + for (LeaseOutDetails bean : leaseOutDetailsList) { +// AjaxResult ajaxResult = submitOut(bean); +// if (ajaxResult.isError()) { +// return ajaxResult; +// } + leaseOutDetailsMapper.insertLeaseOutDetails(bean); } + return AjaxResult.success(); } /** @@ -95,4 +99,87 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { public int deleteLeaseOutDetailsById(Long id) { return leaseOutDetailsMapper.deleteLeaseOutDetailsById(id); } + + /** + * 领料出库处理 + * + * @param record 出库对象 + * @return 结果 + */ + //@Override +// @Transactional(rollbackFor = Exception.class) +// public AjaxResult submitOut(LeaseOutDetails record) { +// int res = 0; +// try { +// // 1、判断是否重复提交 +// res = checkRepeatSubmit(record); +// //record.setPreStoreNum(getStorageNum(record)); +// if (res > 0) { +// if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) { +// record.setOutNum(record.getInputNum()); +// } +// //2、判断成套机具出库库存是否足够 +// if (record.getManageType() == 2) { +// res = checkStorageNumCt(record); +// if (res == 0) { +// throw new RuntimeException("出库失败,库存不足"); +// } +// } else { +// res = checkStorageNum(record); +// } +// +// if (res > 0) { +// // 3、插入出库记录,修改库存,修改机具状态 +// res = insertRecords(record); +// if (res == 0) { +// throw new RuntimeException("出库失败,更新设备规格库存数量时出错!"); +// } +// // 4、修改任务状态(tm_task) +// res = updateTaskStatus(record); +// if (res == 0) { +// throw new RuntimeException("出库失败,修改任务状态失败"); +// } +// // 5、插入结算记录 +// String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId()); +// res = insSltInfo(taskId, record); +// if (res == 0) { +// throw new RuntimeException("出库失败,插入结算记录失败"); +// } +// record.setPostStoreNum(getStorageNum(record)); +// } else { +// return AjaxResult.error("领料出库失败,机具库存不足"); +// } +// } else { +// return AjaxResult.error("已领数量大于预领数量或该机具未在库"); +// } +// } catch (Exception e) { +// return AjaxResult.error("出库失败"); +// } +// return AjaxResult.success("出库成功"); +// } +// +// private int checkRepeatSubmit(LeaseOutDetails record) { +// String maStatus = "15"; +// int res = 0; +// if (record.getManageType() == 1 || record.getManageType() == 2) { +// // 如果是数量出库校验待出库数量 +// LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record); +// if (details == null) { +// return res; +// } else { +// res = 1; +// } +// } else { +// // 如果是编码出库判断是否在库 +// if (!(Objects.equals(0, record.getMaId()) || record.getMaId() == null)) { +// String status = leaseOutDetailsMapper.getMachineStatus(record); +// if (!maStatus.equals(status)) { +// return res; +// } else { +// res = 1; +// } +// } +// } +// return res; +// } }