Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jilinzhongdianrenqun
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
jilinzhongdianrenqun
Commits
5e903f55
Commit
5e903f55
authored
Dec 31, 2025
by
zhangtw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
审批调整
parent
bfec1bf4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
116 行增加
和
11 行删除
+116
-11
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmBorrowServiceImpl.java
+21
-2
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmInboundServiceImpl.java
+1
-1
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowApplicationDao.xml
+91
-7
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowDetailDao.xml
+3
-1
没有找到文件。
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmBorrowServiceImpl.java
View file @
5e903f55
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.PostConstruct
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.Instant
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
...
@@ -31,6 +32,22 @@ public class KeyDmBorrowServiceImpl {
...
@@ -31,6 +32,22 @@ public class KeyDmBorrowServiceImpl {
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrow."
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrow."
;
private
final
String
detailNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrowDetail."
;
private
final
String
detailNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmBorrowDetail."
;
private
final
String
materialNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialLog."
;
private
final
String
materialNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialLog."
;
private
final
String
userNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmUser."
;
private
Map
<
String
,
String
>
userMap
;
// 把用户的id和名做成字典
@PostConstruct
public
void
initUserMap
()
{
List
<
Map
<
String
,
Object
>>
userList
=
commonService
.
findList
(
userNamespace
+
"getUserMap"
,
null
);
// 此时commonService已被注入,非null
userMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
user
:
userList
)
{
String
userId
=
String
.
valueOf
(
user
.
get
(
"Id"
));
// 转为String,避免类型问题
String
userName
=
(
String
)
user
.
get
(
"name"
);
if
(
userId
!=
null
&&
userName
!=
null
)
{
// 空值防御
userMap
.
put
(
userId
,
userName
);
}
}
}
@ApiOperation
(
value
=
"领用申请列表"
,
desc
=
"分页查询"
)
@ApiOperation
(
value
=
"领用申请列表"
,
desc
=
"分页查询"
)
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Map
<
String
,
Object
>
map
)
{
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Map
<
String
,
Object
>
map
)
{
if
(
map
==
null
)
map
=
new
HashMap
<>();
if
(
map
==
null
)
map
=
new
HashMap
<>();
...
@@ -82,14 +99,17 @@ public class KeyDmBorrowServiceImpl {
...
@@ -82,14 +99,17 @@ public class KeyDmBorrowServiceImpl {
throw
new
CustomException
(
"日期格式错误,支持格式:2025-12-26 或 2025-12-26T16:00:00.000Z"
);
throw
new
CustomException
(
"日期格式错误,支持格式:2025-12-26 或 2025-12-26T16:00:00.000Z"
);
}
}
}
}
initUserMap
();
map
.
put
(
"approver_name"
,
userMap
.
get
(
map
.
get
(
"approver_id"
)));
map
.
put
(
"expected_return_date"
,
expected_return_date
);
map
.
put
(
"expected_return_date"
,
expected_return_date
);
if
(
id
==
null
||
String
.
valueOf
(
id
).
trim
().
isEmpty
())
{
if
(
id
==
null
||
String
.
valueOf
(
id
).
trim
().
isEmpty
())
{
map
.
put
(
"
application_no"
,
"borrow"
);
map
.
put
(
"
id"
,
UUID
.
randomUUID
().
toString
()
);
map
.
put
(
"applicant_id"
,
user
.
get
(
"id"
));
map
.
put
(
"applicant_id"
,
user
.
get
(
"id"
));
map
.
put
(
"applicant_name"
,
user
.
get
(
"name"
));
map
.
put
(
"applicant_name"
,
user
.
get
(
"name"
));
map
.
put
(
"department_id"
,
user
.
get
(
"company_id"
));
map
.
put
(
"department_id"
,
user
.
get
(
"company_id"
));
map
.
put
(
"department_name"
,
user
.
get
(
"company_name"
));
map
.
put
(
"department_name"
,
user
.
get
(
"company_name"
));
map
.
put
(
"approval_status"
,
0
);
map
.
put
(
"approval_status"
,
0
);
map
.
put
(
"issue_status"
,
0
);
map
.
put
(
"issue_status"
,
0
);
map
.
put
(
"order_no"
,
0
);
map
.
put
(
"order_no"
,
0
);
...
@@ -98,7 +118,6 @@ public class KeyDmBorrowServiceImpl {
...
@@ -98,7 +118,6 @@ public class KeyDmBorrowServiceImpl {
// insert details if any
// insert details if any
if
(
details
!=
null
)
{
if
(
details
!=
null
)
{
for
(
Map
<
String
,
Object
>
d
:
details
)
{
for
(
Map
<
String
,
Object
>
d
:
details
)
{
d
.
put
(
"id"
,
UUID
.
randomUUID
().
toString
());
d
.
put
(
"application_id"
,
map
.
get
(
"id"
));
d
.
put
(
"application_id"
,
map
.
get
(
"id"
));
commonService
.
insert
(
detailNamespace
+
"insertDetail"
,
d
);
commonService
.
insert
(
detailNamespace
+
"insertDetail"
,
d
);
}
}
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmInboundServiceImpl.java
View file @
5e903f55
...
@@ -51,7 +51,7 @@ public class KeyDmInboundServiceImpl {
...
@@ -51,7 +51,7 @@ public class KeyDmInboundServiceImpl {
private
final
String
userNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmUser."
;
private
final
String
userNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmUser."
;
private
Map
<
String
,
String
>
userMap
;
private
Map
<
String
,
String
>
userMap
;
// 把用户的id和名做成字典
@PostConstruct
@PostConstruct
public
void
initUserMap
()
{
public
void
initUserMap
()
{
List
<
Map
<
String
,
Object
>>
userList
=
commonService
.
findList
(
userNamespace
+
"getUserMap"
,
null
);
List
<
Map
<
String
,
Object
>>
userList
=
commonService
.
findList
(
userNamespace
+
"getUserMap"
,
null
);
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowApplicationDao.xml
View file @
5e903f55
...
@@ -65,34 +65,118 @@
...
@@ -65,34 +65,118 @@
<insert
id=
"insert"
parameterType=
"map"
>
<insert
id=
"insert"
parameterType=
"map"
>
INSERT INTO jl_key_dm_borrow_application(
INSERT INTO jl_key_dm_borrow_application(
id,application_no,applicant_id,applicant_name,department_id,department_name,borrow_purpose,expected_return_date,
id,application_no,applicant_id,applicant_name,department_id,department_name,borrow_purpose,expected_return_date,
approver_id,approver_name,
approval_status,issue_status,is_used,create_by,create_time,order_no
approval_status,issue_status,is_used,create_by,create_time,order_no
) VALUES (
) VALUES (
#{id},CONCAT('borrow', REPLACE(UUID(),'-','')),#{applicant_id},#{applicant_name},#{department_id},#{department_name},#{borrow_purpose},#{expected_return_date},
#{id},CONCAT('borrow', REPLACE(UUID(),'-','')),#{applicant_id},#{applicant_name},#{department_id},#{department_name},#{borrow_purpose},#{expected_return_date},
#{approver_id},#{approver_name}
#{approval_status},#{issue_status},1,#{_user.id},NOW(),#{order_no}
#{approval_status},#{issue_status},1,#{_user.id},NOW(),#{order_no}
)
)
</insert>
</insert>
<update
id=
"update"
parameterType=
"map"
>
<update
id=
"update"
parameterType=
"map"
>
UPDATE jl_key_dm_borrow_application
UPDATE jl_key_dm_borrow_application
SET borrow_purpose = #{borrow_purpose}, expected_return_date = #{expected_return_date}, update_by = #{_user.id}, update_time = NOW()
<set>
<!-- 借用用途:非空时更新 -->
<if
test=
"borrow_purpose != null"
>
borrow_purpose = #{borrow_purpose},
</if>
<!-- 审批人ID:非空时更新 -->
<if
test=
"approver_id != null"
>
approver_id = #{approver_id},
</if>
<!-- 审批人名称:非空时更新 -->
<if
test=
"approver_name != null"
>
approver_name = #{approver_name},
</if>
<!-- 预计归还日期:非空时更新(日期类型只需判断null) -->
<if
test=
"expected_return_date != null"
>
expected_return_date = #{expected_return_date},
</if>
<!-- 更新人:强制更新(无需判断,确保操作痕迹) -->
update_by = #{_user.id},
<!-- 更新时间:强制更新(数据库自动生成) -->
update_time = NOW()
</set>
WHERE id = #{id}
WHERE id = #{id}
</update>
</update>
<update
id=
"submit"
parameterType=
"map"
>
<update
id=
"submit"
parameterType=
"map"
>
UPDATE jl_key_dm_borrow_application SET approver_id = #{approver_id}, approver_name = #{approver_name}, approval_status = 1, submit_time = NOW(), update_by = #{_user.id}, update_time = NOW() WHERE id = #{id}
UPDATE jl_key_dm_borrow_application
<set>
<!-- 审批人ID:非空才更新 -->
<if
test=
"approver_id != null and approver_id != ''"
>
approver_id = #{approver_id},
</if>
<!-- 审批人名称:非空才更新 -->
<if
test=
"approver_name != null and approver_name != ''"
>
approver_name = #{approver_name},
</if>
<!-- 审批状态:提交时强制设为1,无需判断 -->
approval_status = 1,
<!-- 提交时间:强制更新为当前时间 -->
submit_time = NOW(),
<!-- 更新人:强制记录 -->
update_by = #{_user.id},
<!-- 更新时间:强制更新 -->
update_time = NOW()
</set>
WHERE id = #{id}
</update>
</update>
<update
id=
"revoke"
parameterType=
"map"
>
<update
id=
"revoke"
parameterType=
"map"
>
UPDATE jl_key_dm_borrow_application SET approval_status = 0, update_by = #{_user.id}, update_time = NOW() WHERE id = #{id} AND approval_status = 1
UPDATE jl_key_dm_borrow_application
<set>
<!-- 审批状态:撤销时强制设为0 -->
approval_status = 0,
<!-- 更新人:强制记录 -->
update_by = #{_user.id},
<!-- 更新时间:强制更新 -->
update_time = NOW()
</set>
WHERE id = #{id}
AND approval_status = 1
<!-- 仅能撤销“待审批”状态的申请 -->
</update>
</update>
<update
id=
"approve"
parameterType=
"map"
>
<update
id=
"approve"
parameterType=
"map"
>
UPDATE jl_key_dm_borrow_application SET approval_status = 9, approval_time = NOW(), issue_time = NOW(), issue_status = 1, update_by = #{_user.id}, update_time = NOW() WHERE id = #{id}
UPDATE jl_key_dm_borrow_application
<set>
<!-- 审批意见:非空才更新 -->
<if
test=
"comment != null and comment != ''"
>
approval_opinion = #{comment},
</if>
<!-- 审批状态:通过时强制设为9 -->
approval_status = 9,
<!-- 审批时间:强制更新为当前时间 -->
approval_time = NOW(),
<!-- 发放时间:强制更新为当前时间 -->
issue_time = NOW(),
<!-- 发放状态:通过时强制设为1 -->
issue_status = 1,
<!-- 更新人:强制记录 -->
update_by = #{_user.id},
<!-- 更新时间:强制更新 -->
update_time = NOW()
</set>
WHERE id = #{id}
</update>
</update>
<update
id=
"reject"
parameterType=
"map"
>
<update
id=
"reject"
parameterType=
"map"
>
UPDATE jl_key_dm_borrow_application SET approval_status = -1, approval_time = NOW(), approval_opinion = #{comment}, update_by = #{_user.id}, update_time = NOW() WHERE id = #{id}
UPDATE jl_key_dm_borrow_application
<set>
<!-- 审批状态:驳回时强制设为-1 -->
approval_status = -1,
<!-- 审批时间:强制更新为当前时间 -->
approval_time = NOW(),
<!-- 审批意见(approval_opinion):复用comment,非空才更新 -->
<if
test=
"comment != null and comment != ''"
>
approval_opinion = #{comment},
</if>
<!-- 更新人:强制记录 -->
update_by = #{_user.id},
<!-- 更新时间:强制更新 -->
update_time = NOW()
</set>
WHERE id = #{id}
</update>
</update>
<!-- 删除所有明细 -->
<!-- 删除所有明细 -->
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowDetailDao.xml
View file @
5e903f55
...
@@ -11,10 +11,12 @@
...
@@ -11,10 +11,12 @@
</insert>
</insert>
<select
id=
"selectDetailsByApplicationId"
parameterType=
"map"
resultType=
"map"
>
<select
id=
"selectDetailsByApplicationId"
parameterType=
"map"
resultType=
"map"
>
SELECT bd.*,m.category_id
SELECT bd.*,m.category_id
,(COALESCE(i.total_quantity,0) - COALESCE(i.borrowed_quantity) - COALESCE(i.damaged_quantity)) as available_quantity
FROM jl_key_dm_borrow_application_detail as bd
FROM jl_key_dm_borrow_application_detail as bd
left join jl_key_dm_material as m
left join jl_key_dm_material as m
on m.id = bd.material_id
on m.id = bd.material_id
left join jl_key_dm_inventory as i
on bd.material_id = i.material_id
WHERE bd.application_id = #{id} AND bd.is_used = 1 ORDER BY bd.create_time ASC
WHERE bd.application_id = #{id} AND bd.is_used = 1 ORDER BY bd.create_time ASC
</select>
</select>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论