Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
a4b7790d
Commit
a4b7790d
authored
Apr 12, 2024
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.6.2-工资原表识别-主逻辑提交
parent
cac9e50a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
26 deletions
+53
-26
SalaryOriginalVo.java
...m/yifu/cloud/plus/v1/yifu/salary/vo/SalaryOriginalVo.java
+3
-0
SalaryUploadOriginalParamVo.java
...d/plus/v1/yifu/salary/vo/SalaryUploadOriginalParamVo.java
+1
-6
TSalaryStandardOriginalController.java
.../salary/controller/TSalaryStandardOriginalController.java
+41
-12
TSalaryStandardOriginalService.java
...1/yifu/salary/service/TSalaryStandardOriginalService.java
+1
-1
TSalaryStandardOriginalServiceImpl.java
...lary/service/impl/TSalaryStandardOriginalServiceImpl.java
+7
-7
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/SalaryOriginalVo.java
View file @
a4b7790d
...
...
@@ -17,7 +17,10 @@ public class SalaryOriginalVo {
/**
* 附件
*/
//private MultipartFile file;
private
MultipartFile
file
;
private
String
filename
;
private
String
contentType
;
/**
* 配置关系(含配置list)
*/
...
...
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/SalaryUploadOriginalParamVo.java
View file @
a4b7790d
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardIssueRes
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginal
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
...
...
@@ -16,11 +14,8 @@ import java.util.List;
@Getter
@Setter
public
class
SalaryUploadOriginalParamVo
{
// 表格file
MultipartFile
file
;
// 配置
TSalaryStandardOriginal
original
;
String
originalId
;
// sheetName;必填
String
sheetName
;
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TSalaryStandardOriginalController.java
View file @
a4b7790d
...
...
@@ -17,6 +17,7 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
...
...
@@ -38,13 +39,20 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadOriginalParamVo;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.disk.DiskFileItem
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -162,7 +170,8 @@ public class TSalaryStandardOriginalController {
}
/**
* @param vo
* @param file
* @param tSalaryStandardOriginal
* @Description: 原表识别配置保存
* @Author: hgw
* @Date: 2024/4/2 18:02
...
...
@@ -171,19 +180,24 @@ public class TSalaryStandardOriginalController {
@SysLog
(
"原表识别配置新增"
)
@Operation
(
description
=
"新增"
)
@PostMapping
(
"/doSave"
)
public
R
<
String
>
doSave
(
@RequestBody
SalaryOriginalVo
vo
)
throws
IO
Exception
{
TSalaryStandardOriginal
tSalaryStandardOriginal
=
vo
.
getSalaryOriginal
();
MultipartFile
file
=
vo
.
getFile
();
if
(
tSalaryStandardOriginal
!=
null
&&
Common
.
isNotNull
(
tSalaryStandardOriginal
.
getDeptId
())
&&
file
!=
null
)
{
public
R
<
String
>
doSave
(
MultipartFile
file
,
TSalaryStandardOriginal
tSalaryStandardOriginal
)
throws
Exception
{
if
(
tSalaryStandardOriginal
!=
null
&&
Common
.
isNotNull
(
tSalaryStandardOriginal
.
getDeptId
())
&&
Common
.
isNotNull
(
tSalaryStandardOriginal
.
getSetName
())
&&
file
!=
null
)
{
List
<
TSalaryStandardOriginalDetail
>
detailList
=
tSalaryStandardOriginal
.
getDetailList
();
if
(
detailList
==
null
||
detailList
.
isEmpty
())
{
return
R
.
failed
(
"请传配置表头list"
);
}
tSalaryStandardOriginalService
.
save
(
tSalaryStandardOriginal
);
for
(
TSalaryStandardOriginalDetail
detail
:
detailList
)
{
detail
.
setOriginalId
(
tSalaryStandardOriginal
.
getId
());
// 判重
TSalaryStandardOriginal
isCur
=
new
TSalaryStandardOriginal
();
isCur
.
setDeptId
(
tSalaryStandardOriginal
.
getDeptId
());
isCur
.
setSetName
(
tSalaryStandardOriginal
.
getSetName
());
List
<
TSalaryStandardOriginal
>
curList
=
tSalaryStandardOriginalService
.
getTSalaryStandardOriginalList
(
isCur
);
if
(
curList
!=
null
&&
!
curList
.
isEmpty
())
{
return
R
.
failed
(
"该项目下已存在此原表类型,请修改!"
);
}
tSalaryStandardOriginalDetailService
.
saveBatch
(
detailList
);
// 上传附件
String
fileName
=
System
.
currentTimeMillis
()
+
"_"
+
file
.
getOriginalFilename
();
//filePath不传默认存储空间的根目录
...
...
@@ -203,16 +217,31 @@ public class TSalaryStandardOriginalController {
if
(
key
.
lastIndexOf
(
point
)
>=
0
)
{
tSalaryStandardOriginal
.
setAttaType
(
key
.
substring
(
fileName
.
lastIndexOf
(
point
),
fileName
.
length
()));
}
tSalaryStandardOriginalService
.
updateById
(
tSalaryStandardOriginal
);
}
else
{
return
R
.
failed
(
"failed:上传至存储空间失败"
);
}
tSalaryStandardOriginalService
.
save
(
tSalaryStandardOriginal
);
for
(
TSalaryStandardOriginalDetail
detail
:
detailList
)
{
detail
.
setOriginalId
(
tSalaryStandardOriginal
.
getId
());
}
tSalaryStandardOriginalDetailService
.
saveBatch
(
detailList
);
return
R
.
ok
(
"保存成功!"
);
}
else
{
return
R
.
failed
(
"请传参!"
);
}
}
public
static
MultipartFile
convert
(
String
data
,
String
filename
,
String
contentType
)
throws
Exception
{
byte
[]
bytes
=
data
.
getBytes
();
InputStream
inputStream
=
new
ByteArrayInputStream
(
bytes
);
FileItem
fileItem
=
new
DiskFileItem
(
"file"
,
contentType
,
false
,
filename
,
bytes
.
length
,
new
File
(
"/originalTmp"
));
fileItem
.
getOutputStream
().
write
(
bytes
);
return
new
CommonsMultipartFile
(
fileItem
);
}
/**
* @Description: 获取表头等信息
* @Author: hgw
...
...
@@ -235,8 +264,8 @@ public class TSalaryStandardOriginalController {
@SysLog
(
"新版原表识别导入"
)
@Operation
(
description
=
"新版原表识别导入"
)
@PostMapping
(
"/salaryUploadByOriginal"
)
public
R
<
List
<
ErrorMessage
>>
salaryUploadByOriginal
(
@RequestBody
SalaryUploadOriginalParamVo
vo
)
{
return
tSalaryStandardOriginalService
.
salaryUploadByOriginal
(
vo
);
public
R
<
List
<
ErrorMessage
>>
salaryUploadByOriginal
(
MultipartFile
file
,
SalaryUploadOriginalParamVo
vo
)
{
return
tSalaryStandardOriginalService
.
salaryUploadByOriginal
(
file
,
vo
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TSalaryStandardOriginalService.java
View file @
a4b7790d
...
...
@@ -62,6 +62,6 @@ public interface TSalaryStandardOriginalService extends IService<TSalaryStandard
* @Date: 2024/4/8 18:05
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
R
<
List
<
ErrorMessage
>>
salaryUploadByOriginal
(
SalaryUploadOriginalParamVo
excelVo
);
R
<
List
<
ErrorMessage
>>
salaryUploadByOriginal
(
MultipartFile
file
,
SalaryUploadOriginalParamVo
excelVo
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryStandardOriginalServiceImpl.java
View file @
a4b7790d
...
...
@@ -426,8 +426,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
@Override
public
R
<
List
<
ErrorMessage
>>
salaryUploadByOriginal
(
SalaryUploadOriginalParamVo
excelVo
)
{
R
<
String
>
contR
=
this
.
getExcelContent
(
excelVo
);
public
R
<
List
<
ErrorMessage
>>
salaryUploadByOriginal
(
MultipartFile
file
,
SalaryUploadOriginalParamVo
excelVo
)
{
R
<
String
>
contR
=
this
.
getExcelContent
(
file
,
excelVo
);
if
(
contR
!=
null
)
{
if
(
CommonConstants
.
SUCCESS
.
equals
(
contR
.
getCode
()))
{
SalaryUploadParamVo
vo
=
new
SalaryUploadParamVo
();
...
...
@@ -454,19 +454,19 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @Date: 2024-4-8 18:20:22
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo>
**/
private
R
<
String
>
getExcelContent
(
SalaryUploadOriginalParamVo
excelVo
)
{
MultipartFile
file
=
excelVo
.
getFile
();
private
R
<
String
>
getExcelContent
(
MultipartFile
file
,
SalaryUploadOriginalParamVo
excelVo
)
{
String
sheetName
=
excelVo
.
getSheetName
();
// 配置
TSalaryStandardOriginal
original
=
excelVo
.
getOriginal
();
String
originalId
=
excelVo
.
getOriginalId
();
// 特殊身份证允许识别为数据行
List
<
String
>
specialIdCardList
=
baseMapper
.
getSpecialIdCardList
();
try
{
//对前端传递的文件进行校验
if
(
original
==
null
||
Common
.
isEmpty
(
original
.
getId
()
))
{
if
(
Common
.
isEmpty
(
originalId
))
{
return
R
.
failed
(
"识别配置为空,请选择识别配置!"
);
}
List
<
TSalaryStandardOriginalDetail
>
detailList
=
tSalaryStandardOriginalDetailService
.
getTSalaryStandardOriginalDetailByOrgId
(
original
.
getId
()
);
List
<
TSalaryStandardOriginalDetail
>
detailList
=
tSalaryStandardOriginalDetailService
.
getTSalaryStandardOriginalDetailByOrgId
(
original
Id
);
Map
<
String
,
TSalaryStandardOriginalDetail
>
detailMap
=
new
HashMap
<>();
for
(
TSalaryStandardOriginalDetail
detail
:
detailList
)
{
detailMap
.
put
(
String
.
valueOf
(
detail
.
getColumnNo
()),
detail
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment