From fec7be742cb305aecedc807d9b1d6154dff2df52 Mon Sep 17 00:00:00 2001
From: sxu <602087911@qq.com>
Date: Thu, 14 Nov 2024 14:40:51 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E9=A2=86=E6=96=99=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../lease/service/impl/LeaseOutDetailsServiceImpl.java | 4 ++--
.../src/main/java/com/bonus/material/ma/domain/Machine.java | 2 +-
.../mapper/material/lease/LeaseOutDetailsMapper.xml | 5 ++---
3 files changed, 5 insertions(+), 6 deletions(-)
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 e354fda5..e39fc1d0 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
@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Objects;
import com.bonus.common.biz.constant.MaterialConstants;
+import com.bonus.common.biz.enums.MaMachineStatusEnum;
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
@@ -176,7 +177,6 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
// 判断库存是否足够
private boolean checkStorageIsEnough(LeaseOutDetails record) {
- String maStatus = "1";
if (record.getManageType() == MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId() || record.getManageType() == MaTypeManageTypeEnum.SET_DEVICE.getTypeId()) {
LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
if (details == null) {
@@ -185,7 +185,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
} else if (record.getManageType() == MaTypeManageTypeEnum.CODE_DEVICE.getTypeId()) {
if (!(Objects.equals(0, record.getMaId()) || record.getMaId() == null)) {
String status = leaseOutDetailsMapper.getMachineStatus(record);
- if (!maStatus.equals(status)) {
+ if (String.valueOf(MaMachineStatusEnum.IN_STORE.getStatus()).equals(status)) {
return false;
}
}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java
index 8913cda0..cf76e071 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/domain/Machine.java
@@ -42,7 +42,7 @@ public class Machine extends BaseEntity
private String preCode;
/** 机具状态(数据字典) */
- @Excel(name = "机具状态", readConverterExp = "数=据字典")
+ @Excel(name = "机具状态")
private String maStatus;
/** 二维码 */
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 d1ae11f0..2311bac3 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
@@ -125,9 +125,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ma_id = #{maId}
-
+
+
+ UPDATE
+ lease_apply_details
+ SET
+ al_num = IF(al_num IS NULL, #{record.outNum}, al_num + #{record.outNum}),
+
+ update_by = #{record.updateBy},
+
+ update_time = now(),
+ status = '1'
+ WHERE
+ parent_id = #{record.parentId} and type_id = #{record.typeId}
+
+
+
+ SELECT
+ ifnull( pre_num, 0 ) AS preNum,
+ ifnull( audit_num, 0 ) AS auditNum,
+ ifnull( al_num, 0 ) AS alNum
+ FROM
+ lease_apply_details
+ WHERE
+ parent_id = #{record.parentId}
+ AND type_id = #{record.typeId}
+
+
+
+ UPDATE
+ lease_apply_details
+ SET
+ status = '2'
+ 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/LeaseOutDetailsMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/lease/LeaseOutDetailsMapper.xml
index 2311bac3..f37499f9 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
@@ -119,12 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
- select ma_status
- from ma_machine
- where ma_id = #{maId}
-
-
SELECT id, parent_id as parentId, type_id as typeId, pre_num as preNum, al_num as alNum, `status`, remark
FROM lease_apply_details
@@ -137,38 +131,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{parentId}
-
- SELECT
- CASE mt.manage_type
- WHEN 0 THEN
- IFNULL(subquery0.num, 0)
- ELSE
- IFNULL(mt.storage_num, 0)
- END as num
- FROM ma_type mt
- left join (SELECT mt.type_id,
- mt2.type_name AS typeName,
- mt.type_name AS typeModelName,
- count(mm.ma_id) num
- FROM ma_machine mm
- LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
- LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
- WHERE mm.ma_code is not null and mm.ma_status in (1)
- GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
- WHERE mt.del_flag = '0' and mt.type_id = #{typeId}
-
-
-
- SELECT
- mws2.type_id AS typeId,
- mws2.part_num AS partNum
- FROM
- ma_type mt1
- LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
- WHERE
- mt1.type_id = #{typeId}
-
-
update tm_task
set task_status = #{status},
@@ -176,23 +138,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where task_id = #{taskId}
-
- select * from ma_type WHERE
- type_id = #{record.typeId}
-
-
-
- select count(mm.ma_id)
- FROM ma_type mt
- left join ma_machine mm on mm.type_id=mt.type_id
- WHERE
- mm.type_id = #{record.typeId}
- and mm.ma_code is not null
- and mm.ma_status in (15)
- and mt.`level` = 4
- and mt.del_flag = '0'
-
-
insert into lease_out_details
@@ -265,28 +210,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
- UPDATE
- ma_type
- SET
- num = num - #{record.outNum} ,update_time = NOW()
- WHERE
- type_id = #{record.typeId}
-
-
-
- UPDATE
- ma_machine
- SET
- ma_status = '16',create_time = NOW()
-
- type_id = #{record.typeId}
-
- and ma_id = #{record.maId}
-
-
-
-
SELECT
id,
@@ -328,15 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from tm_task_agreement
where task_id = #{taskId}
-
- select lease_price as leasePrice,
- rent_price as rentPrice,
- buy_price as buyPrice,
- pay_price as payPrice,
- company_id as companyId
- from ma_type
- where type_id = #{typeId} and del_flag = 0
-
+
select protocol
from bm_agreement_info
@@ -348,38 +263,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
-
- UPDATE
- lease_apply_details
- SET
- al_num = IF(al_num IS NULL, #{record.outNum}, al_num + #{record.outNum}),
-
- update_by = #{record.updateBy},
-
- update_time = now(),
- status = '1'
- WHERE
- parent_id = #{record.parentId} and type_id = #{record.typeId}
-
-
-
- SELECT
- ifnull( pre_num, 0 ) AS preNum,
- ifnull( audit_num, 0 ) AS auditNum,
- ifnull( al_num, 0 ) AS alNum
- FROM
- lease_apply_details
- WHERE
- parent_id = #{record.parentId}
- AND type_id = #{record.typeId}
-
-
-
- UPDATE
- lease_apply_details
- SET
- status = '2'
- 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/ma/MachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml
index 6adb0c31..99486019 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/MachineMapper.xml
@@ -287,4 +287,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{maId}
+
+
+ select ma_status
+ from ma_machine
+ where ma_id = #{maId}
+
+
+
+ UPDATE
+ ma_machine
+ SET
+ ma_status = '16',create_time = NOW()
+
+ type_id = #{record.typeId}
+
+ and ma_id = #{record.maId}
+
+
+
\ No newline at end of file
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml
index 6f063418..e39570c6 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml
@@ -643,4 +643,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by type_id
+
+
+ UPDATE
+ ma_type
+ SET
+ storage_num = storage_num - #{record.outNum} ,update_time = NOW()
+ WHERE
+ type_id = #{record.typeId}
+
+
+
+ select * from ma_type WHERE
+ type_id = #{record.typeId}
+
+
+
+ select lease_price as leasePrice,
+ rent_price as rentPrice,
+ buy_price as buyPrice,
+ pay_price as payPrice,
+ company_id as companyId
+ from ma_type
+ where type_id = #{typeId} and del_flag = 0
+
+
+
+ select count(mm.ma_id)
+ FROM ma_type mt
+ left join ma_machine mm on mm.type_id=mt.type_id
+ WHERE
+ mm.type_id = #{record.typeId}
+ and mm.ma_code is not null
+ and mm.ma_status in (15)
+ and mt.`level` = 4
+ and mt.del_flag = '0'
+
+
+
+ SELECT
+ CASE mt.manage_type
+ WHEN 0 THEN
+ IFNULL(subquery0.num, 0)
+ ELSE
+ IFNULL(mt.storage_num, 0)
+ END as num
+ FROM ma_type mt
+ left join (SELECT mt.type_id,
+ mt2.type_name AS typeName,
+ mt.type_name AS typeModelName,
+ count(mm.ma_id) num
+ FROM ma_machine mm
+ LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
+ LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
+ WHERE mm.ma_code is not null and mm.ma_status in (1)
+ GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
+ WHERE mt.del_flag = '0' and mt.type_id = #{typeId}
+
\ No newline at end of file