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
6e3a4c62
Commit
6e3a4c62
authored
Dec 24, 2025
by
wangchunyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基础分类增加查询方法
parent
f6d8a91d
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
107 行增加
和
12 行删除
+107
-12
src/main/java/com/scpyun/platform/jilinsscgsdp/bean/entity/MaterialImp.java
+2
-2
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmLeaveTypeServiceImpl.java
+9
-0
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmMaterialCategoryServiceImpl.java
+9
-0
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmUserCategoryServiceImpl.java
+9
-0
src/main/java/com/scpyun/platform/jilinsscgsdp/utils/MaterialFileListener.java
+78
-10
src/main/resources/keyMaterialImp.xlsx
+0
-0
没有找到文件。
src/main/java/com/scpyun/platform/jilinsscgsdp/bean/entity/MaterialImp.java
View file @
6e3a4c62
...
@@ -6,9 +6,9 @@ import lombok.Data;
...
@@ -6,9 +6,9 @@ import lombok.Data;
@Data
@Data
public
class
MaterialImp
{
public
class
MaterialImp
{
private
String
category_
C
ode
;
private
String
category_
c
ode
;
@ExcelProperty
(
value
=
"分类名称"
,
index
=
0
)
@ExcelProperty
(
value
=
"分类名称"
,
index
=
0
)
private
String
category_
N
ame
;
private
String
category_
n
ame
;
@ExcelProperty
(
value
=
"用品编码"
,
index
=
1
)
@ExcelProperty
(
value
=
"用品编码"
,
index
=
1
)
private
String
material_code
;
private
String
material_code
;
@ExcelProperty
(
value
=
"用品名称"
,
index
=
2
)
@ExcelProperty
(
value
=
"用品名称"
,
index
=
2
)
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmLeaveTypeServiceImpl.java
View file @
6e3a4c62
...
@@ -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
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@Api
(
"请假类型管理"
)
@Api
(
"请假类型管理"
)
...
@@ -21,6 +22,14 @@ public class KeyDmLeaveTypeServiceImpl {
...
@@ -21,6 +22,14 @@ public class KeyDmLeaveTypeServiceImpl {
private
static
final
String
SUCCESS
=
"success"
;
private
static
final
String
SUCCESS
=
"success"
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmLeaveType."
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmLeaveType."
;
@ApiOperation
(
value
=
"查询请假类型"
,
desc
=
"查询请假类型"
)
public
List
<
Map
<
String
,
Object
>>
findList
(
Map
<
String
,
Object
>
map
)
{
if
(
map
==
null
)
{
map
=
new
HashMap
<>();
}
return
commonService
.
findList
(
namespace
+
"findList"
,
map
);
}
@ApiOperation
(
value
=
"查询请假类型列表"
,
desc
=
"分页查询请假类型"
)
@ApiOperation
(
value
=
"查询请假类型列表"
,
desc
=
"分页查询请假类型"
)
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Page
<
Map
<
String
,
Object
>>
map
)
{
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Page
<
Map
<
String
,
Object
>>
map
)
{
if
(
map
==
null
)
{
if
(
map
==
null
)
{
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmMaterialCategoryServiceImpl.java
View file @
6e3a4c62
...
@@ -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
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@Api
(
"办公用品分类管理"
)
@Api
(
"办公用品分类管理"
)
...
@@ -21,6 +22,14 @@ public class KeyDmMaterialCategoryServiceImpl {
...
@@ -21,6 +22,14 @@ public class KeyDmMaterialCategoryServiceImpl {
private
static
final
String
SUCCESS
=
"success"
;
private
static
final
String
SUCCESS
=
"success"
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialCategory."
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialCategory."
;
@ApiOperation
(
value
=
"查询办公用品分类"
,
desc
=
"查询办公用品分类"
)
public
List
<
Map
<
String
,
Object
>>
findList
(
Map
<
String
,
Object
>
map
)
{
if
(
map
==
null
)
{
map
=
new
HashMap
<>();
}
return
commonService
.
findList
(
namespace
+
"findList"
,
map
);
}
@ApiOperation
(
value
=
"查询办公用品分类列表"
,
desc
=
"分页查询办公用品分类"
)
@ApiOperation
(
value
=
"查询办公用品分类列表"
,
desc
=
"分页查询办公用品分类"
)
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Page
<
Map
<
String
,
Object
>>
map
)
{
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Page
<
Map
<
String
,
Object
>>
map
)
{
if
(
map
==
null
)
{
if
(
map
==
null
)
{
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmUserCategoryServiceImpl.java
View file @
6e3a4c62
...
@@ -22,6 +22,15 @@ public class KeyDmUserCategoryServiceImpl {
...
@@ -22,6 +22,15 @@ public class KeyDmUserCategoryServiceImpl {
private
static
final
String
SUCCESS
=
"success"
;
private
static
final
String
SUCCESS
=
"success"
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmUserCategory."
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmUserCategory."
;
@ApiOperation
(
value
=
"查询人员分类"
,
desc
=
"查询人员分类"
)
public
List
<
Map
<
String
,
Object
>>
findList
(
Map
<
String
,
Object
>
map
)
{
if
(
map
==
null
)
{
map
=
new
HashMap
<>();
}
return
commonService
.
findList
(
namespace
+
"findList"
,
map
);
}
@ApiOperation
(
value
=
"查询人员分类列表"
,
desc
=
"分页查询人员分类"
)
@ApiOperation
(
value
=
"查询人员分类列表"
,
desc
=
"分页查询人员分类"
)
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Page
<
Map
<
String
,
Object
>>
map
)
{
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Page
<
Map
<
String
,
Object
>>
map
)
{
if
(
map
==
null
)
{
if
(
map
==
null
)
{
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/utils/MaterialFileListener.java
View file @
6e3a4c62
...
@@ -2,8 +2,11 @@ package com.scpyun.platform.jilinsscgsdp.utils;
...
@@ -2,8 +2,11 @@ package com.scpyun.platform.jilinsscgsdp.utils;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.scpyun.base.core.utils.StringUtils
;
import
com.scpyun.base.core.utils.UUIDUtil
;
import
com.scpyun.base.core.utils.UUIDUtil
;
import
com.scpyun.base.core.utils.validator.IdcardUtil
;
import
com.scpyun.base.db.service.CommonService
;
import
com.scpyun.base.db.service.CommonService
;
import
com.scpyun.platform.jilinsscgsdp.bean.entity.KeyPersonImp
;
import
com.scpyun.platform.jilinsscgsdp.bean.entity.MaterialImp
;
import
com.scpyun.platform.jilinsscgsdp.bean.entity.MaterialImp
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -27,18 +30,46 @@ public class MaterialFileListener extends AnalysisEventListener<MaterialImp> {
...
@@ -27,18 +30,46 @@ public class MaterialFileListener extends AnalysisEventListener<MaterialImp> {
private
Map
<
String
,
Object
>
param
;
private
Map
<
String
,
Object
>
param
;
private
List
<
String
>
errInfo
=
new
ArrayList
<>();
private
List
<
String
>
errInfo
=
new
ArrayList
<>();
private
String
catgoryNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialCategory."
;
private
String
materialNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterial."
;
private
Map
<
String
,
Map
>
catgoryMap
=
new
HashMap
<>();
private
Map
<
String
,
Map
>
materialMap
=
new
HashMap
<>();
private
int
sortNo
=
0
;
public
MaterialFileListener
(
CommonService
commonService
,
String
namespace
,
Map
<
String
,
Object
>
param
)
{
public
MaterialFileListener
(
CommonService
commonService
,
String
namespace
,
Map
<
String
,
Object
>
param
)
{
this
.
commonService
=
commonService
;
this
.
commonService
=
commonService
;
this
.
namespace
=
namespace
;
this
.
namespace
=
namespace
;
this
.
param
=
param
;
this
.
param
=
param
;
//获取所有办公用品分类信息
//获取所有办公用品分类信息
List
<
Map
<
String
,
Object
>>
catgoryLisit
=
commonService
.
findList
(
catgoryNamespace
+
"findList"
,
param
);
catgoryLisit
.
forEach
(
item
->
{
catgoryMap
.
put
(
String
.
valueOf
(
item
.
get
(
"category_name"
)),
item
);
});
int
tempsortNo
=
0
;
//获取所有办公用品信息,后续根据办公用品编码来判断更新或插入
//获取所有办公用品信息,后续根据办公用品编码来判断更新或插入
List
<
Map
<
String
,
Object
>>
materialLisit
=
commonService
.
findList
(
materialNamespace
+
"findList"
,
param
);
materialLisit
.
forEach
(
item
->
{
catgoryMap
.
put
(
String
.
valueOf
(
item
.
get
(
"material_code"
)),
item
);
Integer
sort
=
(
Integer
)
item
.
get
(
"sort_no"
);
if
(
sort
!=
null
)
{
}
});
}
}
@Override
@Override
public
void
invoke
(
MaterialImp
data
,
AnalysisContext
context
)
{
public
void
invoke
(
MaterialImp
data
,
AnalysisContext
context
)
{
try
{
try
{
// 这里可以添加数据校验逻辑
if
(
isValidProduct
(
data
))
{
cached
.
add
(
data
);
cached
.
add
(
data
);
}
else
{
errorCount
.
incrementAndGet
();
// 失败计数增加
}
if
(
cached
.
size
()
>=
BATCH_COUNT
)
{
if
(
cached
.
size
()
>=
BATCH_COUNT
)
{
saveBatch
();
saveBatch
();
cached
.
clear
();
cached
.
clear
();
...
@@ -58,25 +89,51 @@ public class MaterialFileListener extends AnalysisEventListener<MaterialImp> {
...
@@ -58,25 +89,51 @@ public class MaterialFileListener extends AnalysisEventListener<MaterialImp> {
}
}
private
void
saveBatch
()
{
private
void
saveBatch
()
{
if
(
cached
.
isEmpty
())
{
return
;
}
for
(
MaterialImp
m
:
cached
)
{
for
(
MaterialImp
m
:
cached
)
{
try
{
try
{
Map
<
String
,
Object
>
q
=
new
HashMap
<>();
q
.
put
(
"material_code"
,
m
.
getMaterial_code
());
Map
<
String
,
Object
>
exists
=
commonService
.
getObject
(
namespace
+
"getByCode"
,
q
);
Map
<
String
,
Object
>
row
=
new
HashMap
<>();
Map
<
String
,
Object
>
row
=
new
HashMap
<>();
row
.
put
(
"category_Code"
,
m
.
getCategory_Code
());
row
.
put
(
"category_Name"
,
m
.
getCategory_Name
());
Map
<
String
,
Object
>
exists
=
materialMap
.
get
(
m
.
getMaterial_code
());
if
(
StringUtils
.
isNotEmpty
(
m
.
getCategory_name
()))
{
Map
<
String
,
Object
>
catgory
=
catgoryMap
.
get
(
m
.
getCategory_code
());
if
(
catgory
!=
null
)
{
row
.
put
(
"category_Code"
,
String
.
valueOf
(
catgory
.
get
(
"category_code"
)));
row
.
put
(
"category_Name"
,
m
.
getCategory_name
());
}
}
double
min
=
0L
;
double
max
=
0L
;
int
can_borrow
=
1
;
double
unit_price
=
0L
;
if
(
m
.
getMin_stock
()!=
null
)
{
min
=
m
.
getMin_stock
();
}
if
(
m
.
getMax_stock
()!=
null
)
{
max
=
m
.
getMax_stock
();
}
if
(!
new
Integer
(
1
).
equals
(
m
.
getCan_borrow
()))
{
can_borrow
=
0
;
}
if
(
m
.
getUnit_price
()!=
null
)
{
unit_price
=
m
.
getUnit_price
();
}
row
.
put
(
"material_code"
,
m
.
getMaterial_code
());
row
.
put
(
"material_code"
,
m
.
getMaterial_code
());
row
.
put
(
"material_name"
,
m
.
getMaterial_name
());
row
.
put
(
"material_name"
,
m
.
getMaterial_name
());
row
.
put
(
"material_spec"
,
m
.
getMaterial_spec
());
row
.
put
(
"material_spec"
,
m
.
getMaterial_spec
());
row
.
put
(
"unit"
,
m
.
getUnit
());
row
.
put
(
"unit"
,
m
.
getUnit
());
row
.
put
(
"unit_price"
,
m
.
getUnit_price
()
);
row
.
put
(
"unit_price"
,
unit_price
);
row
.
put
(
"storage_location"
,
m
.
getStorage_location
());
row
.
put
(
"storage_location"
,
m
.
getStorage_location
());
row
.
put
(
"min_stock"
,
m
.
getMin_stock
()
);
row
.
put
(
"min_stock"
,
m
in
);
row
.
put
(
"max_stock"
,
m
.
getMax_stock
()
);
row
.
put
(
"max_stock"
,
m
ax
);
row
.
put
(
"can_borrow"
,
m
.
getCan_borrow
()
);
row
.
put
(
"can_borrow"
,
can_borrow
);
row
.
put
(
"material_desc"
,
m
.
getMaterial_desc
());
row
.
put
(
"material_desc"
,
m
.
getMaterial_desc
());
row
.
put
(
"order_no"
,
0
);
row
.
put
(
"order_no"
,
sortNo
++
);
if
(
exists
==
null
)
{
if
(
exists
==
null
)
{
row
.
put
(
"id"
,
UUIDUtil
.
getUUID
());
row
.
put
(
"id"
,
UUIDUtil
.
getUUID
());
commonService
.
insert
(
namespace
+
"insert"
,
row
);
commonService
.
insert
(
namespace
+
"insert"
,
row
);
...
@@ -93,6 +150,17 @@ public class MaterialFileListener extends AnalysisEventListener<MaterialImp> {
...
@@ -93,6 +150,17 @@ public class MaterialFileListener extends AnalysisEventListener<MaterialImp> {
}
}
}
}
/**
* 数据校验方法
*/
private
boolean
isValidProduct
(
MaterialImp
data
)
{
//用品编码、名称
return
data
.
getMaterial_code
()
!=
null
&&
!
data
.
getMaterial_code
().
trim
().
isEmpty
()
&&
data
.
getMaterial_name
()
!=
null
&&
!
data
.
getMaterial_name
().
trim
().
isEmpty
();
//
}
public
Map
<
String
,
Object
>
getResult
()
{
public
Map
<
String
,
Object
>
getResult
()
{
Map
<
String
,
Object
>
r
=
new
HashMap
<>();
Map
<
String
,
Object
>
r
=
new
HashMap
<>();
r
.
put
(
"insert"
,
insertCount
.
get
());
r
.
put
(
"insert"
,
insertCount
.
get
());
...
...
src/main/resources/keyMaterialImp.xlsx
0 → 100644
View file @
6e3a4c62
File added
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论