From 949cfd2c9a72360227cc1b889d429d79fb5b7a69 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Tue, 19 Nov 2024 10:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=87=BA=E5=BA=93=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/mapper/BmAgreementInfoMapper.java | 2 + .../lease/mapper/LeaseApplyDetailsMapper.java | 2 + .../lease/mapper/LeaseApplyInfoMapper.java | 2 + .../lease/mapper/LeaseOutDetailsMapper.java | 22 +-- .../impl/LeaseOutDetailsServiceImpl.java | 44 +++-- .../mapper/SltAgreementInfoMapper.java | 10 ++ .../task/mapper/TmTaskAgreementMapper.java | 2 + .../material/task/mapper/TmTaskMapper.java | 9 +- .../material/basic/BmAgreementInfoMapper.xml | 6 + .../lease/LeaseApplyDetailsMapper.xml | 6 + .../material/lease/LeaseApplyInfoMapper.xml | 6 + .../material/lease/LeaseOutDetailsMapper.xml | 160 +++--------------- .../settlement/SltAgreementInfoMapper.xml | 41 +++++ .../material/task/TmTaskAgreementMapper.xml | 6 + .../mapper/material/task/TmTaskMapper.xml | 6 + 15 files changed, 151 insertions(+), 173 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java index 1e8919d2..2670b4be 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/mapper/BmAgreementInfoMapper.java @@ -61,4 +61,6 @@ public interface BmAgreementInfoMapper public int deleteBmAgreementInfoByAgreementIds(Long[] agreementIds); public int selectNumByMonth(Date nowDate); + + String getProtocol(String agreementId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java index f5933569..4e6ce118 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyDetailsMapper.java @@ -74,4 +74,6 @@ public interface LeaseApplyDetailsMapper { LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record); int updateLeaseApplyDetailsByLeaseOutRecord(@Param("record") LeaseOutDetails record); + + LeaseApplyDetails getOutboundNum(LeaseOutDetails record); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java index 98f18157..e5bc0139 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseApplyInfoMapper.java @@ -57,4 +57,6 @@ public interface LeaseApplyInfoMapper { * @return 结果 */ int deleteLeaseApplyInfoByIds(Long[] ids); + + String getTaskId(Long parentId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java index 48e416cd..d4f9a5e4 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/mapper/LeaseOutDetailsMapper.java @@ -46,7 +46,7 @@ public interface LeaseOutDetailsMapper { * @param leaseOutDetails 领料出库详细 * @return 结果 */ - public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); +// public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails); /** * 修改领料出库详细 @@ -72,25 +72,7 @@ public interface LeaseOutDetailsMapper { */ public int deleteLeaseOutDetailsByIds(Long[] ids); - LeaseApplyDetails getOutboundNum(LeaseOutDetails record); - - String getTaskId(Long parentId); - - int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status); - /** 插入领料出库详情表 -- 根据字段选择注入 */ - int insertSelective(LeaseOutDetails record); - - SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record); - - int updSltInfo(SltAgreementInfo sltAgreementInfo); - - String getAgreementId(String taskId); - - String getProtocol(String agreementId); - - int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") Type ma); - - + int insertLeaseOutDetails(LeaseOutDetails record); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java index 83245f69..c2cbbb94 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/lease/service/impl/LeaseOutDetailsServiceImpl.java @@ -3,7 +3,6 @@ package com.bonus.material.lease.service.impl; import java.math.BigDecimal; import java.util.List; import java.util.Objects; - import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.enums.LeaseTaskStatusEnum; import com.bonus.common.biz.enums.MaMachineStatusEnum; @@ -12,13 +11,17 @@ import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.basic.mapper.BmAgreementInfoMapper; import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper; +import com.bonus.material.lease.mapper.LeaseApplyInfoMapper; import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.mapper.MachineMapper; import com.bonus.material.ma.mapper.TypeMapper; import com.bonus.material.settlement.domain.SltAgreementInfo; -import com.bonus.material.task.domain.TmTask; +import com.bonus.material.settlement.mapper.SltAgreementInfoMapper; +import com.bonus.material.task.mapper.TmTaskAgreementMapper; +import com.bonus.material.task.mapper.TmTaskMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,6 +39,9 @@ import org.springframework.transaction.annotation.Transactional; @Service @Slf4j public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { + @Autowired + LeaseApplyInfoMapper leaseApplyInfoMapper; + @Autowired private LeaseOutDetailsMapper leaseOutDetailsMapper; @@ -47,6 +53,18 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { @Autowired TypeMapper typeMapper; + + @Autowired + private TmTaskMapper tmTaskMapper; + + @Autowired + private SltAgreementInfoMapper sltAgreementInfoMapper; + + @Autowired + BmAgreementInfoMapper bmAgreementInfoMapper; + + @Autowired + TmTaskAgreementMapper tmTaskAgreementMapper; /** * 查询领料出库详细 * @@ -157,7 +175,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { throw new RuntimeException("出库失败,修改任务状态失败"); } // 5、插入结算记录 - String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId()); + String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); res = insSltInfo(taskId, record); if (res == 0) { throw new RuntimeException("出库失败,插入结算记录失败"); @@ -179,7 +197,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { // 判断库存是否足够 private boolean checkStorageIsEnough(LeaseOutDetails record) { if (record.getManageType().equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId())) { - LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record); + LeaseApplyDetails details = leaseApplyDetailsMapper.getOutboundNum(record); if (details == null) { return false; } @@ -204,12 +222,12 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { i++; } } - String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId()); + String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId()); if (i == leaseApplyDetailsList.size()) { - leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); + tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus()); res = 1; } else { - leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus()); + tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus()); res = 1; } return res; @@ -251,7 +269,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { } if (res > 0) { // 插入领料出库明细表(lease_out_details) - res = leaseOutDetailsMapper.insertSelective(record); + res = leaseOutDetailsMapper.insertLeaseOutDetails(record); if (res > 0) { // 普通机具减少 (ma_type 设备规格表)的库存数量 res = typeMapper.updateMaTypeStockNum(record); @@ -264,15 +282,15 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { public int insSltInfo(String taskId, LeaseOutDetails record) { int res = 0; - SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record); + SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record); if (sltAgreementInfo != null) { Long num = sltAgreementInfo.getNum(); Long outNum = record.getOutNum(); sltAgreementInfo.setNum(num + outNum); - res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo); + res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo); } else { - String agreementId = leaseOutDetailsMapper.getAgreementId(taskId); - String protocol = leaseOutDetailsMapper.getProtocol(agreementId); + String agreementId = tmTaskAgreementMapper.getAgreementId(taskId); + String protocol = bmAgreementInfoMapper.getProtocol(agreementId); Type maType = typeMapper.getMaType(record.getTypeId()); if (StringUtils.isEmpty(protocol)) { maType.setFinalPrice(maType.getLeasePrice()); @@ -285,7 +303,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService { maType.setFinalPrice(maType.getLeasePrice()); } } - res = leaseOutDetailsMapper.insSltInfo(record, agreementId, maType); + res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType); } return res; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index b3f10b96..a23c4aef 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -1,7 +1,11 @@ package com.bonus.material.settlement.mapper; import java.util.List; + +import com.bonus.material.lease.domain.LeaseOutDetails; +import com.bonus.material.ma.domain.Type; import com.bonus.material.settlement.domain.SltAgreementInfo; +import org.apache.ibatis.annotations.Param; /** * 结算信息Mapper接口 @@ -57,4 +61,10 @@ public interface SltAgreementInfoMapper { * @return 结果 */ public int deleteSltAgreementInfoByIds(Long[] ids); + + SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record); + + int updSltInfo(SltAgreementInfo sltAgreementInfo); + + int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java index 2181ffa9..a1720202 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAgreementMapper.java @@ -58,4 +58,6 @@ public interface TmTaskAgreementMapper { * @return 结果 */ int deleteTmTaskAgreementByTaskIds(Long[] taskIds); + + String getAgreementId(String taskId); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java index 2eed8695..1837d3ff 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskMapper.java @@ -95,11 +95,6 @@ public interface TmTaskMapper { */ String selectTaskNumByMonths(Date nowDate, Integer taskType); -// List getAuditListByLeaseTmTask(@Param("record") TmTaskRequestVo tmTaskRequestVo); -// -// List getAuditListByLeaseTmTaskByPeople(@Param("record") TmTaskRequestVo tmTaskRequestVo); -// -// List getAuditListByLeaseInfo(@Param("record") TmTaskRequestVo record); -// -// List getLeaseApplyDetails(@Param("record") LeaseApplyInfo record); + int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status); + } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml index f30d202f..150a03b8 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml @@ -125,4 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml index 978ec252..f61195c3 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyDetailsMapper.xml @@ -188,4 +188,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE parent_id = #{record.parentId} and type_id = #{record.typeId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml index c0ceac6a..3cccd225 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseApplyInfoMapper.xml @@ -191,4 +191,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml index f37499f9..f4a32113 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml @@ -53,92 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lod.parent_id = #{parentId} - + - insert into lease_out_details - - parent_id, - type_id, - ma_id, - out_num, - out_type, - create_by, - create_time, - update_by, - update_time, - remark, - company_id, - car_code, - push_notifications, - - - #{parentId}, - #{typeId}, - #{maId}, - #{outNum}, - #{outType}, - #{createBy}, - #{createTime}, - #{updateBy}, - #{updateTime}, - #{remark}, - #{companyId}, - #{carCode}, - #{pushNotifications}, - - - - - update lease_out_details - - parent_id = #{parentId}, - type_id = #{typeId}, - ma_id = #{maId}, - out_num = #{outNum}, - out_type = #{outType}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, - remark = #{remark}, - company_id = #{companyId}, - car_code = #{carCode}, - push_notifications = #{pushNotifications}, - - where id = #{id} - - - - delete from lease_out_details where id = #{id} - - - - delete from lease_out_details where id in - - #{id} - - - - - - - - - update tm_task - set task_status = #{status}, - update_time = NOW() - where task_id = #{taskId} - - - insert into lease_out_details @@ -210,57 +126,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - update slt_agreement_info - set num = #{num}, - update_time = now() + + update lease_out_details + + parent_id = #{parentId}, + type_id = #{typeId}, + ma_id = #{maId}, + out_num = #{outNum}, + out_type = #{outType}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + company_id = #{companyId}, + car_code = #{carCode}, + push_notifications = #{pushNotifications}, + where id = #{id} - + + delete from lease_out_details where id = #{id} + - - - - insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time) - values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now()); - + + delete from lease_out_details where id in + + #{id} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 9437d8e6..06ca0284 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -135,4 +135,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + + + update slt_agreement_info + set num = #{num}, + update_time = now() + where id = #{id} + + + + insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time) + values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now()); + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml index 4a5c8c90..8933ea3c 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAgreementMapper.xml @@ -60,4 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{taskId} + + \ No newline at end of file diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml index ca60d937..e9094785 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskMapper.xml @@ -132,4 +132,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY create_time DESC LIMIT 1 + + update tm_task + set task_status = #{status}, + update_time = NOW() + where task_id = #{taskId} + \ No newline at end of file