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
81f87eee
Commit
81f87eee
authored
Jul 04, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huyc 项目档案代码提交
parent
f0bd1301
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1508 additions
and
73 deletions
+1508
-73
IdCardUtil.java
...com/yifu/cloud/plus/v1/yifu/archives/util/IdCardUtil.java
+123
-0
FddAutoConfigue.java
...u/cloud/plus/v1/yifu/archives/config/FddAutoConfigue.java
+14
-0
FddContractAttachInfoController.java
.../archives/controller/FddContractAttachInfoController.java
+141
-3
FddContractTemplateController.java
...fu/archives/controller/FddContractTemplateController.java
+74
-14
FddController.java
...cloud/plus/v1/yifu/archives/controller/FddController.java
+35
-46
FddContractAttachInfoService.java
...1/yifu/archives/service/FddContractAttachInfoService.java
+12
-0
FddContractInfoService.java
...plus/v1/yifu/archives/service/FddContractInfoService.java
+2
-0
FddContractTemplateService.java
.../v1/yifu/archives/service/FddContractTemplateService.java
+46
-0
FddContractAttachInfoServiceImpl.java
...chives/service/impl/FddContractAttachInfoServiceImpl.java
+513
-2
FddContractInfoServiceImpl.java
...ifu/archives/service/impl/FddContractInfoServiceImpl.java
+97
-3
FddContractTemplateServiceImpl.java
...archives/service/impl/FddContractTemplateServiceImpl.java
+152
-2
FddSealInfoServiceImpl.java
...v1/yifu/archives/service/impl/FddSealInfoServiceImpl.java
+44
-0
FddUtil.java
...a/com/yifu/cloud/plus/v1/yifu/archives/utils/FddUtil.java
+1
-2
spring.factories
...archives-biz/src/main/resources/META-INF/spring.factories
+2
-0
pom.xml
yifu-common/yifu-common-core/pom.xml
+5
-0
ExcelException.java
...ud.plus.v1/yifu/common/core/exception/ExcelException.java
+22
-0
ExcelUtil.java
...m/yifu.cloud.plus.v1/yifu/common/core/util/ExcelUtil.java
+207
-0
DictController.java
...u.cloud.plus.v1/yifu/admin/controller/DictController.java
+14
-1
SysDictItemMapper.java
...fu.cloud.plus.v1/yifu/admin/mapper/SysDictItemMapper.java
+4
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/util/IdCardUtil.java
0 → 100644
View file @
81f87eee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
util
;
import
lombok.extern.slf4j.Slf4j
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
static
java
.
util
.
regex
.
Pattern
.
compile
;
/**
* 身份证处理
* @Author fxj
* @Date 2019-11-15
* @return
**/
@Slf4j
public
class
IdCardUtil
{
public
static
int
IdNOToAge
(
String
IdNO
){
int
leh
=
IdNO
.
length
();
Date
dates
=
null
;
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy"
);
String
year
=
df
.
format
(
new
Date
());
dates
=
getBirthdate
(
IdNO
);
int
u
=
Integer
.
parseInt
(
year
)-
Integer
.
parseInt
(
df
.
format
(
dates
));
return
u
;
}
/**
* 提取身份证中的出生日期,身份证非法则返回空
* @param idNum
* @return
*/
public
static
Date
getBirthdate
(
String
idNum
){
Pattern
idNumPattern
=
null
;
Matcher
idNumMatcher
=
null
;
Date
date
=
null
;
//定义判别用户身份证号的正则表达式(要么是15位,要么是18位,最后一位可以为字母)
idNumPattern
=
compile
(
"(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])"
);
//通过Pattern获得Matcher
idNumMatcher
=
idNumPattern
.
matcher
(
idNum
);
//判断用户输入是否为身份证号
if
(
idNumMatcher
.
matches
()){
Pattern
birthDatePattern
=
null
;
Matcher
birthDateMather
=
null
;
String
year
=
null
;
if
(
idNum
.
length
()==
18
){
//如果是,定义正则表达式提取出身份证中的出生日期
birthDatePattern
=
compile
(
"\\d{6}(\\d{4})(\\d{2})(\\d{2}).*"
);
//身份证上的前6位以及出生年月日
//通过Pattern获得Matcher
birthDateMather
=
birthDatePattern
.
matcher
(
idNum
);
}
else
if
(
idNum
.
length
()==
15
){
//如果是,定义正则表达式提取出身份证中的出生日期
birthDatePattern
=
compile
(
"\\d{6}(\\d{2})(\\d{2})(\\d{2}).*"
);
//身份证上的前6位以及出生年月日
//通过Pattern获得Matcher
birthDateMather
=
birthDatePattern
.
matcher
(
idNum
);
}
//通过Matcher获得用户的出生年月日
if
(
birthDateMather
.
find
()){
if
(
idNum
.
length
()==
18
){
year
=
birthDateMather
.
group
(
1
);
}
else
if
(
idNum
.
length
()==
15
){
year
=
"19"
+
birthDateMather
.
group
(
1
);
}
String
month
=
birthDateMather
.
group
(
2
);
String
datetemp
=
birthDateMather
.
group
(
3
);
String
dateStr
=
year
+
"-"
+
month
+
"-"
+
datetemp
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
shijian
=
null
;
try
{
shijian
=
sdf
.
parse
(
dateStr
);
String
temp
=
sdf
.
format
(
shijian
);
if
(
dateStr
.
equals
(
temp
)){
//输出用户的出生年月日
date
=
shijian
;
}
}
catch
(
ParseException
e
)
{
//数据有误
}
}
}
return
date
;
}
/**
* 获取身份证的性别
* @Author fxj
* @Date 2019-12-25
* @param idNum
* @return
**/
public
static
String
getSex
(
String
idNum
){
Pattern
idNumPattern
=
null
;
Matcher
idNumMatcher
=
null
;
Date
date
=
null
;
//定义判别用户身份证号的正则表达式(要么是15位,要么是18位,最后一位可以为字母)
idNumPattern
=
compile
(
"(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])"
);
//通过Pattern获得Matcher
idNumMatcher
=
idNumPattern
.
matcher
(
idNum
);
//判断用户输入是否为身份证号
String
sex
=
null
;
if
(
idNumMatcher
.
matches
())
{
if
(
idNum
.
length
()
==
18
)
{
if
(
Integer
.
parseInt
(
idNum
.
substring
(
16
).
substring
(
0
,
1
))
%
2
==
0
)
{
// 判断性别
sex
=
"2"
;
}
else
{
sex
=
"1"
;
}
}
else
if
(
idNum
.
length
()
==
15
)
{
if
(
Integer
.
parseInt
(
idNum
.
substring
(
14
,
15
))
%
2
==
0
)
{
sex
=
"2"
;
}
else
{
sex
=
"1"
;
}
}
}
return
sex
;
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/config/FddAutoConfigue.java
0 → 100644
View file @
81f87eee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
config
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.FddUtil
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
FddAutoConfigue
{
@Bean
public
FddUtil
getFddUtils
()
{
return
new
FddUtil
();
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/FddContractAttachInfoController.java
View file @
81f87eee
...
...
@@ -17,12 +17,21 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
import
com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeConstants
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractAttachInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
...
...
@@ -31,6 +40,11 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.*
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 法大大合同附属信息表
...
...
@@ -43,10 +57,14 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"/fddcontractattachinfo"
)
@Tag
(
name
=
"法大大合同附属信息表管理"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
@Slf4j
@EnableConfigurationProperties
(
DaprUpmsProperties
.
class
)
public
class
FddContractAttachInfoController
{
private
final
FddContractAttachInfoService
fddContractAttachInfoService
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
/**
* 分页查询
* @param page 分页对象
...
...
@@ -55,7 +73,6 @@ public class FddContractAttachInfoController {
*/
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontractattachinfo_get')"
)
public
R
getFddContractAttachInfoPage
(
Page
page
,
FddContractAttachInfo
fddContractAttachInfo
)
{
return
R
.
ok
(
fddContractAttachInfoService
.
getFddContractAttachInfoPage
(
page
,
fddContractAttachInfo
));
}
...
...
@@ -67,7 +84,6 @@ public class FddContractAttachInfoController {
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('demo_fddcontractattachinfo_get')"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontractattachinfo_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
fddContractAttachInfoService
.
getById
(
id
));
}
...
...
@@ -111,4 +127,126 @@ public class FddContractAttachInfoController {
return
R
.
ok
(
fddContractAttachInfoService
.
removeById
(
id
));
}
/**
* @param jsonString
* @Author: huyc
* @Date: 2022/6/30
* @Description: 法大大合同基础信息更新
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
@Operation
(
summary
=
"法大大合同基础信息新增"
,
description
=
"法大大合同基础信息新增"
)
@SysLog
(
"法大大合同基础信息新增"
)
@PostMapping
(
"/batchAddFddEmpInfo"
)
public
R
batchAddFddEmpInfo
(
@RequestBody
String
jsonString
)
{
R
<
List
<
SysDictItem
>>
res
=
null
;
ExcelUtil
<
FddContractAttachInfo
>
util1
=
null
;
try
{
// 调用字典服务,渲染字典值
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dict/inner/getDictList"
,
null
,
Map
.
class
,
SecurityConstants
.
FROM_IN
);
Map
<
String
,
String
>
dicMap
=
new
HashMap
<>();
if
(
null
!=
res
.
getData
())
{
for
(
SysDictItem
dict
:
res
.
getData
())
{
dicMap
.
put
(
dict
.
getType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
dict
.
getLabel
(),
dict
.
getValue
());
}
}
jsonString
=
URLDecoder
.
decode
(
jsonString
,
CommonConstants
.
UTF8
).
replace
(
"="
,
""
);
util1
=
new
ExcelUtil
<>(
FddContractAttachInfo
.
class
);
//传参字典数据MAP具体见方法实现
util1
.
getJsonStringToList
(
jsonString
,
dicMap
);
if
(
null
!=
util1
.
getErrorInfo
()
&&
!
util1
.
getErrorInfo
().
isEmpty
())
{
return
R
.
failed
(
util1
.
getErrorInfo
(),
"数据异常"
);
}
else
{
if
(
null
!=
util1
.
getEntityList
())
{
List
<
ErrorMessage
>
errorInfo
=
fddContractAttachInfoService
.
batchAdd
(
util1
.
getEntityList
());
Map
<
String
,
Object
>
variableMap
=
new
HashMap
<>();
Map
<
Integer
,
Object
>
map
=
new
HashMap
<>();
boolean
allExitContract
=
errorInfo
.
stream
().
allMatch
(
e
->
e
.
getMessage
().
equals
(
"存在“在用”的合同"
));
if
(
allExitContract
)
{
variableMap
.
put
(
"allMatch"
,
"true"
);
for
(
ErrorMessage
errorMessage
:
errorInfo
){
map
.
put
(
errorMessage
.
getLineNum
(),
util1
.
getEntityList
().
get
(
errorMessage
.
getLineNum
()-
2
));
}
variableMap
.
put
(
"data"
,
map
);
}
return
R
.
ok
(
variableMap
);
}
else
{
return
R
.
ok
(
null
,
"无数据可导入"
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
"导入数据失败"
);
}
}
/**
* @param jsonString
* @Author: huyc
* @Date: 2022/6/30
* @Description: 法大大合同基础信息更新
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
@Operation
(
summary
=
"法大大合同基础信息更新"
,
description
=
"法大大合同基础信息更新"
)
@SysLog
(
"法大大合同基础信息更新"
)
@PostMapping
(
"/batchUpdateFddEmpInfo"
)
public
R
batchUpdateFddEmpInfo
(
@RequestBody
String
jsonString
)
{
R
<
List
<
SysDictItem
>>
res
=
null
;
ExcelUtil
<
FddContractAttachInfo
>
util1
=
null
;
try
{
// 调用字典服务,渲染字典值
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dict/inner/getDictList"
,
null
,
Map
.
class
,
SecurityConstants
.
FROM_IN
);
Map
<
String
,
String
>
dicMap
=
new
HashMap
<>();
if
(
null
!=
res
.
getData
())
{
for
(
SysDictItem
dict
:
res
.
getData
())
{
dicMap
.
put
(
dict
.
getType
()
+
CommonConstants
.
DOWN_LINE_STRING
+
dict
.
getLabel
(),
dict
.
getValue
());
}
}
jsonString
=
URLDecoder
.
decode
(
jsonString
,
CommonConstants
.
UTF8
).
replace
(
"="
,
""
);
util1
=
new
ExcelUtil
<>(
FddContractAttachInfo
.
class
);
//传参字典数据MAP具体见方法实现
util1
.
getJsonStringToList
(
jsonString
,
dicMap
);
if
(
null
!=
util1
.
getErrorInfo
()
&&
!
util1
.
getErrorInfo
().
isEmpty
())
{
return
R
.
failed
(
util1
.
getErrorInfo
(),
""
);
}
else
{
if
(
null
!=
util1
.
getEntityList
())
{
List
<
ErrorMessage
>
errorInfo
=
fddContractAttachInfoService
.
batchUpdate
(
util1
.
getEntityList
());
return
R
.
ok
(
errorInfo
,
"数据导入解析成功!"
);
}
else
{
return
R
.
ok
(
null
,
EmployeeConstants
.
NO_DATA_UPDATE
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
EmployeeConstants
.
DATA_UPDATE_FAIL
);
}
}
/**
* @param entityList
* @Author: huyc
* @Date: 2022/06/30
* @Description: 批量发送法大大电子合同定稿任务
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Operation
(
summary
=
"批量发送法大大电子合同定稿任务"
,
description
=
"批量发送法大大电子合同定稿任务"
)
@SysLog
(
"批量发送法大大电子合同定稿任务"
)
@PostMapping
(
"/sendTask"
)
public
R
sendTask
(
@RequestBody
List
<
FddContractAttachInfo
>
entityList
)
{
if
(
null
==
entityList
)
{
return
R
.
failed
(
"数据为空!"
);
}
List
<
ErrorMessage
>
errorInfo
=
fddContractAttachInfoService
.
sendTask
(
entityList
);
return
R
.
ok
(
errorInfo
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/FddContractTemplateController.java
View file @
81f87eee
...
...
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractTemplateService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -31,6 +32,11 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.validation.Valid
;
import
java.io.IOException
;
import
java.time.LocalDateTime
;
/**
...
...
@@ -73,19 +79,6 @@ public class FddContractTemplateController {
return
R
.
ok
(
fddContractTemplateService
.
getById
(
id
));
}
/**
* 新增法大大员工合同模板
* @param fddContractTemplate 法大大员工合同模板
* @return R
*/
@Operation
(
summary
=
"新增法大大员工合同模板"
,
description
=
"新增法大大员工合同模板:hasPermission('demo_fddcontracttemplate_add')"
)
@SysLog
(
"新增法大大员工合同模板"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontracttemplate_add')"
)
public
R
save
(
@RequestBody
FddContractTemplate
fddContractTemplate
)
{
return
R
.
ok
(
fddContractTemplateService
.
save
(
fddContractTemplate
));
}
/**
* 修改法大大员工合同模板
* @param fddContractTemplate 法大大员工合同模板
...
...
@@ -96,7 +89,7 @@ public class FddContractTemplateController {
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontracttemplate_edit')"
)
public
R
updateById
(
@RequestBody
FddContractTemplate
fddContractTemplate
)
{
return
R
.
ok
(
fddContractTemplateService
.
updateById
(
fddContractTemplate
));
return
R
.
ok
(
fddContractTemplateService
.
changeInfo
(
fddContractTemplate
));
}
/**
...
...
@@ -112,4 +105,71 @@ public class FddContractTemplateController {
return
R
.
ok
(
fddContractTemplateService
.
removeById
(
id
));
}
/**
* 新增合同模板
* @param fddContractTemplate
* @return R
*/
@Operation
(
summary
=
"新增合同模板"
,
description
=
"新增合同模板"
)
@SysLog
(
"新增合同模板"
)
@PostMapping
public
R
save
(
@Valid
@RequestBody
FddContractTemplate
fddContractTemplate
)
{
return
fddContractTemplateService
.
saveInfo
(
fddContractTemplate
);
}
/**
* @param file
* @Author: huyc
* @Date: 2022/6/30
* @Description: 法大大模板上传
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Operation
(
summary
=
"法大大模板上传"
,
description
=
"法大大模板上传"
)
@SysLog
(
"法大大模板上传"
)
@PostMapping
(
"/upload"
)
public
R
<
String
>
upload
(
@RequestBody
MultipartFile
file
,
@RequestParam
String
id
)
throws
ApiException
,
IOException
{
return
fddContractTemplateService
.
upload
(
file
,
id
);
}
/**
* @Author: huyc
* @Date: 2022/6/30
* @Description: 模板文件删除
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Operation
(
summary
=
"模板文件删除"
,
description
=
"模板文件删除"
)
@SysLog
(
"模板文件删除"
)
@PostMapping
(
"/del"
)
public
R
<
String
>
delCompanyTemplateFile
(
@RequestParam
String
id
)
throws
ApiException
{
return
fddContractTemplateService
.
delCompanyTemplateFile
(
id
);
}
/**
* @Author: huyc
* @Date: 2022/6/30
* @Description: 获取模板维护地址
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Operation
(
summary
=
"获取模板维护地址"
,
description
=
"获取模板维护地址"
)
@SysLog
(
"获取模板维护地址"
)
@GetMapping
(
"/getTemplateMainUrl"
)
public
R
<
String
>
getTemplateMainUrl
(
@RequestParam
String
id
)
throws
ApiException
{
return
fddContractTemplateService
.
getTemplateMainUrl
(
id
);
}
/**
* @Author: huyc
* @Date: 2022/6/30
* @Description: 获取模板文件预览地址
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Operation
(
summary
=
"获取模板文件预览地址"
,
description
=
"获取模板文件预览地址"
)
@SysLog
(
"获取模板文件预览地址"
)
@GetMapping
(
"/getCompanyTemplatePreviewUrl"
)
public
R
<
String
>
getCompanyTemplatePreviewUrl
(
@RequestParam
String
id
)
throws
ApiException
{
return
fddContractTemplateService
.
getCompanyTemplatePreviewUrl
(
id
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/FddController.java
View file @
81f87eee
...
...
@@ -18,8 +18,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -58,8 +56,8 @@ public class FddController {
private
FddCompanyInfoService
fddCompanyInfoService
;
@Autowired
private
FddContractAttachInfoService
fddContractAttachInfoService
;
//
@Autowired
//
private TEmployeeContractInfoService employeeContractInfoService;
@Autowired
private
TEmployeeContractInfoService
employeeContractInfoService
;
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
...
...
@@ -168,31 +166,22 @@ public class FddController {
//实名认证成功发送电子合同
executorService
.
submit
(()
->
{
try
{
// //先查询下有没有没发送这个员工没发送的电子合同。如果有则发送
// List<FddContractAttachInfo> attachInfos = fddContractAttachInfoService.getListByNoInfoByEmpIdcard(entity.getIdCard());
// //自动创建定稿任务.查看是否有未定稿的数据。有的话自动发送
// if (attachInfos.size() == CommonConstants.ZERO_INT) {
// return;
// }
// FddContractAttachInfo fddContractAttachInfo = attachInfos.get(CommonConstants.ZERO_INT);
// TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getById(fddContractAttachInfo.getContractId());
// TEmployeeInfo employeeInfo = employeeInfoService.getById(employeeContractInfo.getEmpId());
//获取合同创建人
// String createUserId = fddContractAttachInfo.getCreateUserId();
// FeginExtendUser feginExtendUser = new FeginExtendUser();
// R<List<SysUser>> remoteUserServiceSimpleUser = remoteUserService.getAllUserInfoByUserIds(createUserId, SecurityConstants.FROM_IN);
// SysUser sysUser = remoteUserServiceSimpleUser.getData().get(CommonConstants.ZERO_INT);
// feginExtendUser.setPhone(sysUser.getPhone());
// feginExtendUser.setNickName(sysUser.getNickname());
// R<String> returnR = fddContractInfoService.saveEmpContract(fddContractAttachInfo, feginExtendUser);
// if (returnR != null) {
// //记录返回信息
// if(returnR.getCode()== CommonConstants.SUCCESS){
// fddContractAttachInfo.setRemark("成功");
// }else {
// fddContractAttachInfo.setRemark(returnR.getMsg());
// }
// }
//先查询下有没有没发送这个员工没发送的电子合同。如果有则发送
List
<
FddContractAttachInfo
>
attachInfos
=
fddContractAttachInfoService
.
getListByNoInfoByEmpIdcard
(
entity
.
getIdCard
());
//自动创建定稿任务.查看是否有未定稿的数据。有的话自动发送
if
(
attachInfos
.
size
()
==
CommonConstants
.
ZERO_INT
)
{
return
;
}
FddContractAttachInfo
fddContractAttachInfo
=
attachInfos
.
get
(
CommonConstants
.
ZERO_INT
);
R
<
String
>
returnR
=
fddContractInfoService
.
saveEmpContract
(
fddContractAttachInfo
);
if
(
returnR
!=
null
)
{
//记录返回信息
if
(
returnR
.
getCode
()==
CommonConstants
.
SUCCESS
){
fddContractAttachInfo
.
setRemark
(
"成功"
);
}
else
{
fddContractAttachInfo
.
setRemark
(
returnR
.
getMsg
());
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -216,16 +205,16 @@ public class FddController {
executorService
.
submit
(()
->
{
try
{
//自动创建定稿任务
//
R<String> returnR = fddContractInfoService.createTaskByDraftId(fddContractInfo);
//
if(returnR!=null){
//
//记录返回信息
//
if(returnR.getCode()==CommonConstants.SUCCESS){
//
fddContractInfo.setRemark("成功");
//
}else {
//
fddContractInfo.setRemark(returnR.getMsg());
//
}
//
fddContractInfoService.updateById(fddContractInfo);
//
}
R
<
String
>
returnR
=
fddContractInfoService
.
createTaskByDraftId
(
fddContractInfo
);
if
(
returnR
!=
null
){
//记录返回信息
if
(
returnR
.
getCode
()==
CommonConstants
.
SUCCESS
){
fddContractInfo
.
setRemark
(
"成功"
);
}
else
{
fddContractInfo
.
setRemark
(
returnR
.
getMsg
());
}
fddContractInfoService
.
updateById
(
fddContractInfo
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -263,14 +252,14 @@ public class FddController {
// 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态:
if
(
CommonConstants
.
TWO_STRING
.
equals
(
fddContractInfo
.
getSendSignStatus
())
&&
CommonConstants
.
TWO_STRING
.
equals
(
fddContractInfo
.
getReceiveSignStatus
()))
{
//
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo);
fddContractAttachInfoService
.
saveEmpAndAttarch
(
fddContractInfo
);
//
TEmployeeContractInfo ec = employeeContractInfoService.getById(fddContractInfo.getContractId());
//
// 如果合同的状态是待电子签,则变更为已电子签
//
if (ec != null && ec.getIsSign() != null && ec.getIsSign() == CommonConstants.ONE_INT) {
//
ec.setIsSign(CommonConstants.ZERO_INT);
//
employeeContractInfoService.updateById(ec);
//
}
TEmployeeContractInfo
ec
=
employeeContractInfoService
.
getById
(
fddContractInfo
.
getContractId
());
// 如果合同的状态是待电子签,则变更为已电子签
if
(
ec
!=
null
&&
ec
.
getIsSign
()
!=
null
&&
ec
.
getIsSign
()
==
CommonConstants
.
ONE_INT
)
{
ec
.
setIsSign
(
CommonConstants
.
ZERO_INT
);
employeeContractInfoService
.
updateById
(
ec
);
}
}
return
R
.
ok
();
}
else
if
(
StringUtils
.
equals
(
fddEvent
,
"notifyUrlVerify"
))
{
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/FddContractAttachInfoService.java
View file @
81f87eee
...
...
@@ -22,7 +22,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -46,4 +50,12 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach
* @return
*/
List
<
FddContractAttachInfo
>
getListByNoInfoByEmpIdcard
(
String
empIdcard
);
List
<
ErrorMessage
>
sendTask
(
List
<
FddContractAttachInfo
>
entityList
);
R
<
String
>
saveEmpAndAttarch
(
FddContractInfo
fddContractInfo
);
List
<
ErrorMessage
>
batchAdd
(
List
<
FddContractAttachInfo
>
entityList
);
List
<
ErrorMessage
>
batchUpdate
(
List
<
FddContractAttachInfo
>
entityList
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/FddContractInfoService.java
View file @
81f87eee
...
...
@@ -110,4 +110,6 @@ public interface FddContractInfoService extends IService<FddContractInfo> {
* @return: R
**/
R
<
String
>
moveFileToEmpConcat
(
FddContractInfo
fddContractInfo
,
HttpServletResponse
response
)
throws
ApiException
,
IOException
;
R
<
String
>
generalEmployeeParam
(
FddContractAttachInfo
attachInfo
,
boolean
signFlag
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/FddContractTemplateService.java
View file @
81f87eee
...
...
@@ -23,6 +23,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
/**
* 法大大员工合同模板
...
...
@@ -39,4 +43,46 @@ public interface FddContractTemplateService extends IService<FddContractTemplate
*/
IPage
<
FddContractTemplate
>
getFddContractTemplatePage
(
Page
<
FddContractTemplate
>
page
,
FddContractTemplate
fddContractTemplate
)
throws
ApiException
;
/**
* 保存合同模板
* @param fddContractTemplate 法大大员工合同模板
* @return
*/
R
saveInfo
(
FddContractTemplate
fddContractTemplate
);
/**
* 修改合同模板
* @param fddContractTemplate 法大大员工合同模板
* @return
*/
R
changeInfo
(
FddContractTemplate
fddContractTemplate
);
/**
* 法大大模板上传
* @param file 文件
* @param id 模板id
* @return
*/
R
<
String
>
upload
(
MultipartFile
file
,
String
id
)
throws
ApiException
,
IOException
;
/**
* 获取模板维护地址
* @param id 模板id
* @return
*/
R
<
String
>
getTemplateMainUrl
(
String
id
)
throws
ApiException
;
/**
* 获取模板文件预览地址
* @param id 模板id
* @return
*/
R
<
String
>
getCompanyTemplatePreviewUrl
(
String
id
)
throws
ApiException
;
/**
* 模板文件删除
* @param id 模板id
* @return
*/
R
<
String
>
delCompanyTemplateFile
(
String
id
)
throws
ApiException
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/FddContractAttachInfoServiceImpl.java
View file @
81f87eee
...
...
@@ -16,17 +16,38 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.Constants.EmployeeConstants
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractAttachInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractAttachInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
/**
* 法大大合同附属信息表
...
...
@@ -36,8 +57,47 @@ import java.util.List;
*/
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties
(
DaprUpmsProperties
.
class
)
@Log4j2
public
class
FddContractAttachInfoServiceImpl
extends
ServiceImpl
<
FddContractAttachInfoMapper
,
FddContractAttachInfo
>
implements
FddContractAttachInfoService
{
@Autowired
private
FddPersonAccountService
fddPersonAccountService
;
@Autowired
private
FddContractInfoService
fddContractInfoService
;
@Autowired
private
TEmployeeInfoMapper
tEmployeeInfoMapper
;
@Autowired
private
TEmployeeContractInfoService
employeeContractInfoService
;
@Autowired
private
TSettleDomainService
tSettleDomainService
;
@Autowired
private
TCustomerInfoService
tCustomerInfoService
;
@Autowired
private
FddContractTemplateService
fddContractTemplateService
;
@Autowired
private
DaprUpmsProperties
daprUpmsProperties
;
@Autowired
private
TEmployeeInfoService
employeeInfoService
;
@Autowired
private
TEmployeeProjectMapper
employeeProjectMapper
;
@Autowired
private
TEmployeeLogService
tEmployeeLogService
;
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
public
static
final
String
NO_VALID_CONTRACT_FOUND
=
"未获取到有效在用合同,请确认存在对应姓名、身份证、合同起始时间的合同数据"
;
/**
* 法大大合同附属信息表简单分页查询
* @param fddContractAttachInfo 法大大合同附属信息表
...
...
@@ -57,4 +117,455 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
public
List
<
FddContractAttachInfo
>
getListByNoInfoByEmpIdcard
(
@Param
(
"empIdcard"
)
String
empIdcard
)
{
return
baseMapper
.
getListByNoInfoByEmpIdcard
(
empIdcard
);
}
@Override
public
List
<
ErrorMessage
>
sendTask
(
List
<
FddContractAttachInfo
>
entityList
)
{
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<>();
int
i
=
1
;
for
(
FddContractAttachInfo
attachInfo
:
entityList
)
{
//保存合同数据
attachInfo
.
setContractId
(
CommonConstants
.
EMPTY_STRING
);
R
<
String
>
employeeParamR
;
//新签
employeeParamR
=
fddContractInfoService
.
generalEmployeeParam
(
attachInfo
,
false
);
if
(
CommonConstants
.
FAIL
==
employeeParamR
.
getCode
())
{
errorList
.
add
(
new
ErrorMessage
(
i
,
employeeParamR
.
getMsg
(),
CommonConstants
.
RED
));
continue
;
}
//保存数据
this
.
save
(
attachInfo
);
attachInfo
.
setContractId
(
attachInfo
.
getId
());
this
.
updateById
(
attachInfo
);
//判断员工是否有实名数据,如果没有插入是实名数据
long
fddPersonCount
=
fddPersonAccountService
.
count
(
Wrappers
.<
FddPersonAccount
>
query
().
lambda
().
eq
(
FddPersonAccount:
:
getMoblie
,
attachInfo
.
getEmpPhone
())
.
eq
(
FddPersonAccount:
:
getIdCard
,
attachInfo
.
getEmpIdcard
()).
eq
(
FddPersonAccount:
:
getName
,
attachInfo
.
getEmpName
())
.
eq
(
FddPersonAccount:
:
getSystemFlag
,
CommonConstants
.
ONE_STRING
));
if
(
fddPersonCount
==
CommonConstants
.
ZERO_INT
)
{
FddPersonAccount
fddPersonAccount
=
new
FddPersonAccount
();
fddPersonAccount
.
setMoblie
(
attachInfo
.
getEmpPhone
());
fddPersonAccount
.
setName
(
attachInfo
.
getEmpName
());
fddPersonAccount
.
setIdCard
(
attachInfo
.
getEmpIdcard
());
fddPersonAccount
.
setSystemFlag
(
CommonConstants
.
ONE_STRING
);
fddPersonAccount
.
setRealStatus
(
CommonConstants
.
ZERO_STRING
);
fddPersonAccountService
.
save
(
fddPersonAccount
);
executorService
.
submit
(()
->
{
try
{
fddPersonAccountService
.
sendAuthMessage
(
fddPersonAccount
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
});
}
else
{
executorService
.
submit
(()
->
{
try
{
//如果已经实名发送电子合同
FddContractAttachInfo
fddContractAttachInfo
=
this
.
getById
(
attachInfo
.
getId
());
R
<
String
>
returnR
=
fddContractInfoService
.
saveEmpContract
(
fddContractAttachInfo
);
if
(
returnR
!=
null
)
{
//记录返回信息
if
(
returnR
.
getCode
()
==
CommonConstants
.
SUCCESS
)
{
fddContractAttachInfo
.
setRemark
(
"成功"
);
}
else
{
fddContractAttachInfo
.
setRemark
(
returnR
.
getMsg
());
}
this
.
updateById
(
fddContractAttachInfo
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
}
i
++;
errorList
.
add
(
new
ErrorMessage
(
i
,
"保存成功"
,
CommonConstants
.
GREEN
));
}
return
errorList
;
}
/**
*
* @Author hyc
* @Date 2022-06-02
* @param fddContractInfo
* @return R
**/
@Override
@Transactional
public
R
<
String
>
saveEmpAndAttarch
(
FddContractInfo
fddContractInfo
)
{
try
{
FddContractAttachInfo
fddContractAttachInfo
=
this
.
getOne
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
().
eq
(
FddContractAttachInfo:
:
getContractId
,
fddContractInfo
.
getContractId
()));
if
(
fddContractAttachInfo
!=
null
&&
fddContractAttachInfo
.
getContractId
().
equals
(
fddContractAttachInfo
.
getId
()))
{
FddContractTemplate
fddContractTemplate
=
fddContractTemplateService
.
getOne
(
Wrappers
.<
FddContractTemplate
>
query
().
lambda
()
.
eq
(
FddContractTemplate:
:
getId
,
fddContractInfo
.
getFddTemplateId
()));
TSettleDomain
settleDomain
=
tSettleDomainService
.
getOne
(
Wrappers
.<
TSettleDomain
>
query
().
lambda
().
eq
(
TSettleDomain:
:
getDepartNo
,
fddContractAttachInfo
.
getDepartNo
()));
TCustomerInfo
tCustomerInfo
=
tCustomerInfoService
.
getOne
(
Wrappers
.<
TCustomerInfo
>
query
().
lambda
().
eq
(
TCustomerInfo:
:
getId
,
settleDomain
.
getCustomerId
()));
//查询项目档案
TEmployeeProject
tEmployeeProject
=
employeeProjectMapper
.
selectOne
(
Wrappers
.<
TEmployeeProject
>
query
().
lambda
().
eq
(
TEmployeeProject:
:
getDeptId
,
settleDomain
.
getId
())
.
eq
(
TEmployeeProject:
:
getEmpIdcard
,
fddContractAttachInfo
.
getEmpIdcard
()).
eq
(
TEmployeeProject:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
));
//查询人员档案
TEmployeeInfo
tEmployeeInfo
=
employeeInfoService
.
getOne
(
Wrappers
.<
TEmployeeInfo
>
query
().
lambda
().
eq
(
TEmployeeInfo:
:
getDeleteFlag
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TEmployeeInfo:
:
getEmpIdcard
,
fddContractAttachInfo
.
getEmpIdcard
()));
//该人员该结算主体有项目档案
if
(
null
!=
tEmployeeProject
)
{
//如果是减项状态就复项
if
(
CommonConstants
.
ONE_INT
==
tEmployeeProject
.
getProjectStatus
())
{
tEmployeeProject
.
setProjectStatus
(
CommonConstants
.
ZERO_INT
);
employeeProjectMapper
.
updateById
(
tEmployeeProject
);
TEmployeeProject
tEmployeeProjectCompare
=
employeeProjectMapper
.
selectById
(
tEmployeeProject
.
getId
());
//保存操作记录
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
1
],
""
,
tEmployeeProject
.
getId
(),
tEmployeeProjectCompare
,
tEmployeeProject
);
}
//判断人员档案的状态,如果是减档状态就复档
if
(
CommonConstants
.
ONE_INT
==
tEmployeeInfo
.
getFileStatus
())
{
tEmployeeInfo
.
setFileStatus
(
CommonConstants
.
ZERO_INT
);
employeeInfoService
.
updateById
(
tEmployeeInfo
);
TEmployeeInfo
tEmployeeInfoCompare
=
employeeInfoService
.
getById
(
tEmployeeProject
.
getEmpId
());
//保存操作记录
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
tEmployeeProject
.
getId
(),
""
,
tEmployeeInfoCompare
,
tEmployeeInfo
);
}
TEmployeeContractInfo
employeeContractInfo
=
employeeContractInfoService
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
().
lambda
()
.
eq
(
TEmployeeContractInfo:
:
getEmpIdcard
,
fddContractAttachInfo
.
getEmpIdcard
()).
eq
(
TEmployeeContractInfo:
:
getSettleDomain
,
settleDomain
.
getId
())
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_STRING
));
//更新项目档案
tEmployeeProject
.
setEmpNatrue
(
fddContractTemplate
.
getType
());
tEmployeeProject
.
setPost
(
fddContractAttachInfo
.
getPost
());
employeeProjectMapper
.
updateById
(
tEmployeeProject
);
//更新人员档案
tEmployeeInfo
.
setEmpPhone
(
fddContractAttachInfo
.
getEmpPhone
());
tEmployeeInfo
.
setEmpNatrue
(
fddContractTemplate
.
getType
());
employeeInfoService
.
updateById
(
tEmployeeInfo
);
//无可用合同
if
(
null
==
employeeContractInfo
)
{
//新增合同
TEmployeeContractInfo
newEmployeeContractInfo
=
new
TEmployeeContractInfo
();
saveTEmployeeContractInfo
(
newEmployeeContractInfo
,
fddContractAttachInfo
,
settleDomain
,
fddContractTemplate
,
tEmployeeInfo
,
tCustomerInfo
,
tEmployeeProject
);
//更新合同id
updateContractId
(
fddContractInfo
,
fddContractAttachInfo
,
newEmployeeContractInfo
);
}
else
{
//已有合同设置状态为不在用
employeeContractInfo
.
setInUse
(
CommonConstants
.
ONE_STRING
);
employeeContractInfoService
.
updateById
(
employeeContractInfo
);
//新增合同
TEmployeeContractInfo
newEmployeeContractInfo2
=
new
TEmployeeContractInfo
();
saveTEmployeeContractInfo
(
newEmployeeContractInfo2
,
fddContractAttachInfo
,
settleDomain
,
fddContractTemplate
,
tEmployeeInfo
,
tCustomerInfo
,
tEmployeeProject
);
//更新合同id
updateContractId
(
fddContractInfo
,
fddContractAttachInfo
,
newEmployeeContractInfo2
);
}
}
else
{
//判断人员档案是否存在,不存在就新增人员档案,存在则判断档案状态,如果是减档就复档
if
(
Common
.
isNotNull
(
tEmployeeInfo
))
{
TEmployeeInfo
employeeInfoCompare
=
employeeInfoService
.
getById
(
tEmployeeProject
.
getEmpId
());
if
(
CommonConstants
.
ONE_INT
==
tEmployeeInfo
.
getFileStatus
())
{
tEmployeeInfo
.
setFileStatus
(
CommonConstants
.
ZERO_INT
);
}
//更新人员档案
tEmployeeInfo
.
setEmpPhone
(
fddContractAttachInfo
.
getEmpPhone
());
tEmployeeInfo
.
setEmpNatrue
(
fddContractTemplate
.
getType
());
employeeInfoService
.
updateById
(
tEmployeeInfo
);
//保存操作记录
tEmployeeLogService
.
saveModificationRecord
(
CommonConstants
.
dingleDigitIntArray
[
0
],
tEmployeeProject
.
getId
(),
""
,
employeeInfoCompare
,
tEmployeeInfo
);
}
else
{
//新增人员档案
}
//新增项目档案
TEmployeeProject
newTEmpProject
=
new
TEmployeeProject
();
// newTEmployeeInfo.setEmpName(fddContractAttachInfo.getEmpName());
// newTEmployeeInfo.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
// newTEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
// newTEmployeeInfo.setEmpType(fddContractTemplate.getType());
// newTEmployeeInfo.setSettleDomain(settleDomain.getId());
// newTEmployeeInfo.setPost(fddContractAttachInfo.getPost());
// newTEmployeeInfo.setBelongUnit(tCustomerInfo.getId());
// newTEmployeeInfo.setBelongUnitName(tCustomerInfo.getCustomerName());
// newTEmployeeInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
// newTEmployeeInfo.setWorkFlag(CommonConstants.ZERO_STRING);
// newTEmployeeInfo.setLockFlag(CommonConstants.ONE_STRING);
// newTEmployeeInfo.setWorkingStatusSub(CommonConstants.ZERO_STRING);
// newTEmployeeInfo.setContractFileStatus(CommonConstants.ZERO_STRING);
// Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard());
//
// newTEmployeeInfo.setEmpNo(str);
//
// if (null != date) {
// //初始化年龄
// newTEmployeeInfo.setEmpAge(IdCardUtil.IdNOToAge(fddContractAttachInfo.getEmpIdcard()));
// newTEmployeeInfo.setEmpBirthday(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
// }
// newTEmployeeInfo.setEmpSex(IdCardUtil.getSex(fddContractAttachInfo.getEmpIdcard()));
// //新增档案
// tEmployeeInfoMapper.insert(newTEmployeeInfo);
//新增合同
TEmployeeContractInfo
newEmployeeContractInfo1
=
new
TEmployeeContractInfo
();
saveTEmployeeContractInfo
(
newEmployeeContractInfo1
,
fddContractAttachInfo
,
settleDomain
,
fddContractTemplate
,
tEmployeeInfo
,
tCustomerInfo
,
newTEmpProject
);
//更新合同id
updateContractId
(
fddContractInfo
,
fddContractAttachInfo
,
newEmployeeContractInfo1
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"保存异常:"
+
e
.
getMessage
());
return
R
.
failed
(
"保存异常:"
+
e
.
getMessage
());
}
return
R
.
ok
();
}
@Override
public
List
<
ErrorMessage
>
batchAdd
(
List
<
FddContractAttachInfo
>
entityList
)
{
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<>();
int
i
=
1
;
try
{
if
(
null
!=
entityList
&&
!
entityList
.
isEmpty
())
{
for
(
FddContractAttachInfo
attachInfo
:
entityList
)
{
i
++;
//结算主体编码是否准确
TSettleDomain
settleDomain
=
tSettleDomainService
.
getOne
(
Wrappers
.<
TSettleDomain
>
query
().
lambda
().
eq
(
TSettleDomain:
:
getDepartNo
,
attachInfo
.
getDepartNo
()));
if
(
Common
.
isEmpty
(
settleDomain
))
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"结算主体编码有误"
,
CommonConstants
.
RED
));
continue
;
}
//查询员工合同
TEmployeeContractInfo
employeeContractInfo
=
employeeContractInfoService
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
().
lambda
()
.
eq
(
TEmployeeContractInfo:
:
getEmpIdcard
,
attachInfo
.
getEmpIdcard
()).
eq
(
TEmployeeContractInfo:
:
getSettleDomain
,
settleDomain
.
getId
())
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_STRING
));
if
(
employeeContractInfo
!=
null
)
{
long
count
=
this
.
count
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
().
eq
(
FddContractAttachInfo:
:
getContractId
,
employeeContractInfo
.
getId
()));
if
(
count
>
CommonConstants
.
ZERO_INT
&&
attachInfo
.
getContractStart
().
isBefore
(
employeeContractInfo
.
getContractEnd
()))
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"已导入合同相关基础数据"
,
CommonConstants
.
RED
));
continue
;
}
List
<
FddContractTemplate
>
fddContractTemplateList
=
fddContractTemplateService
.
list
(
Wrappers
.<
FddContractTemplate
>
query
().
lambda
()
.
eq
(
FddContractTemplate:
:
getFddTemplateId
,
attachInfo
.
getFddTemplateId
())
.
eq
(
FddContractTemplate:
:
getModifyUploadStatus
,
CommonConstants
.
dingleDigitStrArray
[
1
]));
//如果模板存在则生成法大大电子合同数据
if
(
fddContractTemplateList
.
size
()
==
CommonConstants
.
ZERO_INT
)
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"未获取到有效的合同模板"
,
CommonConstants
.
RED
));
continue
;
}
if
(
fddContractTemplateList
.
size
()
!=
CommonConstants
.
ONE_INT
)
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"法大大合同有效合同模板存在多条"
,
CommonConstants
.
RED
));
continue
;
}
else
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"存在“在用”的合同"
,
CommonConstants
.
RED
));
continue
;
}
}
//保存合同数据
attachInfo
.
setContractId
(
CommonConstants
.
EMPTY_STRING
);
attachInfo
.
setCreateTime
(
LocalDateTime
.
now
());
//校验数据
R
<
String
>
employeeParamR
;
//新签
employeeParamR
=
fddContractInfoService
.
generalEmployeeParam
(
attachInfo
,
false
);
if
(
CommonConstants
.
FAIL
==
employeeParamR
.
getCode
())
{
errorList
.
add
(
new
ErrorMessage
(
i
,
employeeParamR
.
getMsg
(),
CommonConstants
.
RED
));
continue
;
}
//保存数据
this
.
save
(
attachInfo
);
attachInfo
.
setContractId
(
attachInfo
.
getId
());
this
.
updateById
(
attachInfo
);
//判断员工是否有实名数据,如果没有插入是实名数据
long
fddPersonCount
=
fddPersonAccountService
.
count
(
Wrappers
.<
FddPersonAccount
>
query
().
lambda
().
eq
(
FddPersonAccount:
:
getMoblie
,
attachInfo
.
getEmpPhone
())
.
eq
(
FddPersonAccount:
:
getIdCard
,
attachInfo
.
getEmpIdcard
()).
eq
(
FddPersonAccount:
:
getName
,
attachInfo
.
getEmpName
())
.
eq
(
FddPersonAccount:
:
getSystemFlag
,
CommonConstants
.
ONE_STRING
));
if
(
fddPersonCount
==
CommonConstants
.
ZERO_INT
)
{
FddPersonAccount
fddPersonAccount
=
new
FddPersonAccount
();
fddPersonAccount
.
setMoblie
(
attachInfo
.
getEmpPhone
());
fddPersonAccount
.
setName
(
attachInfo
.
getEmpName
());
fddPersonAccount
.
setIdCard
(
attachInfo
.
getEmpIdcard
());
fddPersonAccount
.
setSystemFlag
(
CommonConstants
.
ONE_STRING
);
fddPersonAccount
.
setRealStatus
(
CommonConstants
.
ZERO_STRING
);
fddPersonAccountService
.
save
(
fddPersonAccount
);
executorService
.
submit
(()
->
{
try
{
fddPersonAccountService
.
sendAuthMessage
(
fddPersonAccount
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
});
}
else
{
executorService
.
submit
(()
->
{
try
{
//如果已经实名发送电子合同
FddContractAttachInfo
fddContractAttachInfo
=
this
.
getById
(
attachInfo
.
getId
());
R
<
String
>
returnR
=
fddContractInfoService
.
saveEmpContract
(
fddContractAttachInfo
);
if
(
returnR
!=
null
)
{
//记录返回信息
if
(
returnR
.
getCode
()==
CommonConstants
.
SUCCESS
){
fddContractAttachInfo
.
setRemark
(
"成功"
);
}
else
{
fddContractAttachInfo
.
setRemark
(
returnR
.
getMsg
());
}
this
.
updateById
(
fddContractAttachInfo
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
}
errorList
.
add
(
new
ErrorMessage
(
i
,
"保存成功"
,
CommonConstants
.
GREEN
));
}
}
else
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"无数据保存"
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"合同数据批量新增异常"
+
e
.
getMessage
());
errorList
.
add
(
new
ErrorMessage
(
i
,
"合同数据批量新增异常:"
+
e
.
getMessage
()));
return
errorList
;
}
return
errorList
;
}
@Override
public
List
<
ErrorMessage
>
batchUpdate
(
List
<
FddContractAttachInfo
>
entityList
)
{
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<>();
int
i
=
1
;
try
{
if
(
null
!=
entityList
&&
!
entityList
.
isEmpty
())
{
for
(
FddContractAttachInfo
attachInfo
:
entityList
)
{
//查询员工合同
TEmployeeContractInfo
employeeContractInfoValid
=
employeeContractInfoService
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
().
lambda
()
.
eq
(
TEmployeeContractInfo:
:
getEmpName
,
attachInfo
.
getEmpName
()).
eq
(
TEmployeeContractInfo:
:
getEmpIdcard
,
attachInfo
.
getEmpIdcard
())
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_STRING
).
eq
(
TEmployeeContractInfo:
:
getIsObsolete
,
CommonConstants
.
ZERO_STRING
)
.
eq
(
TEmployeeContractInfo:
:
getContractStart
,
attachInfo
.
getContractStart
()));
if
(
employeeContractInfoValid
==
null
){
errorList
.
add
(
new
ErrorMessage
(
i
,
NO_VALID_CONTRACT_FOUND
,
CommonConstants
.
RED
));
continue
;
}
if
(
StringUtils
.
equals
(
CommonConstants
.
ONE_STRING
,
employeeContractInfoValid
.
getContractType
())){
if
(
employeeContractInfoValid
.
getContractEnd
()==
null
){
errorList
.
add
(
new
ErrorMessage
(
i
,
"员工合同结束时间为空"
,
CommonConstants
.
RED
));
continue
;
}
}
//查询员工合同是否存在
TEmployeeContractInfo
employeeContractInfo
=
employeeContractInfoService
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
().
lambda
()
.
eq
(
TEmployeeContractInfo:
:
getEmpName
,
attachInfo
.
getEmpName
()).
eq
(
TEmployeeContractInfo:
:
getEmpIdcard
,
attachInfo
.
getEmpIdcard
())
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_STRING
)
.
and
(
wrapper
->
wrapper
.
and
(
wrapper2
->
wrapper2
.
eq
(
TEmployeeContractInfo:
:
getContractStart
,
attachInfo
.
getContractStart
())
.
eq
(
TEmployeeContractInfo:
:
getContractEnd
,
attachInfo
.
getContractEnd
()).
eq
(
TEmployeeContractInfo:
:
getContractType
,
CommonConstants
.
ONE_STRING
))
//有合同截止日期
.
or
(
wrapper1
->
wrapper1
.
eq
(
TEmployeeContractInfo:
:
getContractStart
,
attachInfo
.
getContractStart
()).
in
(
TEmployeeContractInfo:
:
getContractType
,
CommonConstants
.
ZERO_STRING
,
CommonConstants
.
TWO_STRING
))
//无合同截止时间
));
if
(
employeeContractInfo
==
null
)
{
errorList
.
add
(
new
ErrorMessage
(
i
,
NO_VALID_CONTRACT_FOUND
,
CommonConstants
.
RED
));
continue
;
}
FddContractAttachInfo
fddContractAttachInfo
=
this
.
getOne
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
().
eq
(
FddContractAttachInfo:
:
getContractId
,
employeeContractInfo
.
getId
()));
if
(
fddContractAttachInfo
==
null
)
{
errorList
.
add
(
new
ErrorMessage
(
i
,
"为获取到电子合同数据"
,
CommonConstants
.
RED
));
continue
;
}
BeanUtils
.
copyProperties
(
attachInfo
,
fddContractAttachInfo
);
//保存合同数据
this
.
updateById
(
fddContractAttachInfo
);
i
++;
errorList
.
add
(
new
ErrorMessage
(
i
,
"更新成功"
,
CommonConstants
.
GREEN
));
}
}
else
{
errorList
.
add
(
new
ErrorMessage
(
i
,
EmployeeConstants
.
NO_DATA_UPDATE
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"合同数据批量新增异常"
+
e
.
getMessage
());
errorList
.
add
(
new
ErrorMessage
(
i
,
"合同数据批量新增异常:"
+
e
.
getMessage
()));
return
errorList
;
}
return
errorList
;
}
/**
* @param fddContractInfo
* @param fddContractAttachInfo
* @param newEmployeeContractInfo
* @Author: huyc
* @Date: 2022/06/01
* @Description: 更新合同id
* @return:
**/
public
void
updateContractId
(
FddContractInfo
fddContractInfo
,
FddContractAttachInfo
fddContractAttachInfo
,
TEmployeeContractInfo
newEmployeeContractInfo
)
{
//更新合同id
fddContractAttachInfo
.
setContractId
(
newEmployeeContractInfo
.
getId
());
this
.
updateById
(
fddContractAttachInfo
);
//更新合同id
fddContractInfo
.
setContractId
(
newEmployeeContractInfo
.
getId
());
fddContractInfoService
.
updateById
(
fddContractInfo
);
}
/**
* @param newEmployeeContractInfo
* @param fddContractAttachInfo
* @param settleDomain
* @param fddContractTemplate
* @param tEmployeeInfo
* @param tEmployeeProject
* @Author: huyc
* @Date: 2022/06/01
* @Description: 新增合同
* @return:
**/
public
void
saveTEmployeeContractInfo
(
TEmployeeContractInfo
newEmployeeContractInfo
,
FddContractAttachInfo
fddContractAttachInfo
,
TSettleDomain
settleDomain
,
FddContractTemplate
fddContractTemplate
,
TEmployeeInfo
tEmployeeInfo
,
TCustomerInfo
tCustomerInfo
,
TEmployeeProject
tEmployeeProject
)
{
TEmployeeContractInfo
employeeContractCount
=
employeeContractInfoService
.
getOne
(
Wrappers
.<
TEmployeeContractInfo
>
query
().
lambda
()
.
eq
(
TEmployeeContractInfo:
:
getEmpIdcard
,
fddContractAttachInfo
.
getEmpIdcard
()).
eq
(
TEmployeeContractInfo:
:
getSettleDomain
,
settleDomain
.
getId
())
.
eq
(
TEmployeeContractInfo:
:
getInUse
,
CommonConstants
.
ZERO_STRING
));
//合同表里没有在用的合同
if
(
null
==
employeeContractCount
)
{
newEmployeeContractInfo
.
setEmpName
(
fddContractAttachInfo
.
getEmpName
());
newEmployeeContractInfo
.
setEmpIdcard
(
fddContractAttachInfo
.
getEmpIdcard
());
newEmployeeContractInfo
.
setSettleDomain
(
settleDomain
.
getId
());
newEmployeeContractInfo
.
setSubjectDepart
(
settleDomain
.
getDepartName
());
newEmployeeContractInfo
.
setSubjectUnit
(
tCustomerInfo
.
getCustomerName
());
newEmployeeContractInfo
.
setContractType
(
CommonConstants
.
ONE_STRING
);
newEmployeeContractInfo
.
setContractStart
(
fddContractAttachInfo
.
getContractStart
());
newEmployeeContractInfo
.
setContractEnd
(
fddContractAttachInfo
.
getContractEnd
());
newEmployeeContractInfo
.
setPost
(
fddContractAttachInfo
.
getPost
());
newEmployeeContractInfo
.
setWorkingHours
(
""
);
newEmployeeContractInfo
.
setSituation
(
"正常签订"
);
newEmployeeContractInfo
.
setIsObsolete
(
CommonConstants
.
ZERO_STRING
);
newEmployeeContractInfo
.
setEmpId
(
tEmployeeInfo
.
getId
());
newEmployeeContractInfo
.
setWorkFlag
(
CommonConstants
.
ZERO_STRING
);
newEmployeeContractInfo
.
setIsFile
(
CommonConstants
.
ONE_STRING
);
newEmployeeContractInfo
.
setEmpNo
(
tEmployeeProject
.
getEmpNo
());
newEmployeeContractInfo
.
setFileCity
(
tEmployeeInfo
.
getFileCity
());
newEmployeeContractInfo
.
setFileProvince
(
tEmployeeInfo
.
getFileProvince
());
newEmployeeContractInfo
.
setFileTown
(
tEmployeeInfo
.
getFileTown
());
newEmployeeContractInfo
.
setInUse
(
CommonConstants
.
ZERO_STRING
);
//远程接口传参
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"value"
,
fddContractTemplate
.
getType
());
jsonObject
.
put
(
"type"
,
"personnel_type"
);
R
<
String
>
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dict/inner/getLableFronValue"
,
null
,
Map
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
res
!=
null
)
{
//电子合同模板对应的“员工类型”
newEmployeeContractInfo
.
setContractName
(
res
.
getData
());
}
else
{
newEmployeeContractInfo
.
setContractName
(
""
);
}
//设置状态为在用
newEmployeeContractInfo
.
setInUse
(
CommonConstants
.
ONE_STRING
);
employeeContractInfoService
.
save
(
newEmployeeContractInfo
);
}
}
//获取员工编码
public
String
getEmpNo
(
String
deptNo
)
{
String
str
=
""
;
String
EmpNo
=
employeeProjectMapper
.
findEmployeeMaxOnlyNoByDepId
(
deptNo
);
if
(!
Common
.
isEmpty
(
EmpNo
))
{
str
=
NoUtil
.
productionNo
(
EmpNo
,
CommonConstants
.
EMPLOYEE_INIT_NO_START
);
}
else
{
str
=
deptNo
+
CommonConstants
.
EMPLOYEE_INIT_NO
;
}
return
str
;
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/FddContractInfoServiceImpl.java
View file @
81f87eee
...
...
@@ -49,6 +49,7 @@ import com.fadada.api.client.SignTaskClient;
import
com.fadada.api.exception.ApiException
;
import
com.google.common.collect.Maps
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractAttachInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.FddUtil
;
...
...
@@ -105,7 +106,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
@Autowired
private
FddSealPersonAuthService
fddSealPersonAuthService
;
@Autowired
private
FddContractAttachInfo
Service
fddContractAttachInfoService
;
private
FddContractAttachInfo
Mapper
fddContractAttachInfoMapper
;
// @Autowired
// private TEmployeeContractInfoService employeeContractInfoService;
// @Autowired
...
...
@@ -284,7 +285,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
return
R
.
failed
(
"合同签署任务已完成,不能作废重签"
);
}
YifuUser
user
=
SecurityUtils
.
getUser
();
FddContractAttachInfo
fddContractAttachInfo
=
fddContractAttachInfo
Service
.
ge
tOne
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
()
FddContractAttachInfo
fddContractAttachInfo
=
fddContractAttachInfo
Mapper
.
selec
tOne
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
()
.
eq
(
FddContractAttachInfo:
:
getContractId
,
entity
.
getContractId
()));
if
(!
user
.
getId
().
equals
(
fddContractAttachInfo
.
getCreateBy
()))
{
return
R
.
failed
(
"当前用户不是电子合同导入用户,不能操作"
);
...
...
@@ -768,6 +769,99 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
}
}
@Override
public
R
<
String
>
generalEmployeeParam
(
FddContractAttachInfo
attachInfo
,
boolean
signFlag
)
{
JSONObject
paramter
=
new
JSONObject
();
if
(
StringUtils
.
isEmpty
(
attachInfo
.
getEmpName
()))
{
return
R
.
failed
(
"姓名为空,请去档案补充对应信息!"
);
}
paramter
.
put
(
"name"
,
attachInfo
.
getEmpName
());
Date
date
=
IdcardUtil
.
getBirthDate
(
attachInfo
.
getEmpIdcard
());
if
(
LocalDateTimeUtils
.
convertDateToLDT
(
date
)
==
null
)
{
return
R
.
failed
(
"出生年月为空,请去档案补充对应信息!"
);
}
paramter
.
put
(
"birth"
,
DateUtil
.
format
(
LocalDateTimeUtils
.
convertDateToLDT
(
date
),
DatePattern
.
NORM_DATE_PATTERN
));
if
(
StringUtils
.
isEmpty
(
attachInfo
.
getEmpIdcard
()))
{
return
R
.
failed
(
"身份证号为空,请去档案补充对应信息!"
);
}
paramter
.
put
(
"id_card"
,
attachInfo
.
getEmpIdcard
());
int
sex
=
IdcardUtil
.
getGenderByIdCard
(
attachInfo
.
getEmpIdcard
());
if
(
sex
==
0
)
{
paramter
.
put
(
"sex"
,
"女"
);
}
else
if
(
sex
==
1
)
{
paramter
.
put
(
"sex"
,
"男"
);
}
if
(
StringUtils
.
isEmpty
(
attachInfo
.
getEmpPhone
()))
{
return
R
.
failed
(
"手机号为空,请去档案补充对应信息!"
);
}
paramter
.
put
(
"mobile"
,
attachInfo
.
getEmpPhone
());
//固定期限
paramter
.
put
(
"contractType"
,
"一"
);
paramter
.
put
(
"fcontractStartY"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getContractStart
()),
"yyyy"
));
paramter
.
put
(
"fcontractStartM"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getContractStart
()),
"MM"
));
paramter
.
put
(
"fcontractStartD"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getContractStart
()),
"dd"
));
paramter
.
put
(
"fcontractEndY"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getContractEnd
()),
"yyyy"
));
paramter
.
put
(
"fcontractEndM"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getContractEnd
()),
"MM"
));
paramter
.
put
(
"fcontractEndD"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getContractEnd
()),
"dd"
));
//合同起止时间填充,新签需要判断是否有试用期,试用期工资
if
(!
signFlag
)
{
if
(
attachInfo
.
getPeriodStart
()
==
null
)
{
return
R
.
failed
(
"新签试用期开始时间为空"
);
}
paramter
.
put
(
"fPeriodStartY"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getPeriodStart
()),
"yyyy"
));
paramter
.
put
(
"fPeriodStartM"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getPeriodStart
()),
"MM"
));
paramter
.
put
(
"fPeriodStartD"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getPeriodStart
()),
"dd"
));
if
(
attachInfo
.
getPeriodEnd
()
==
null
)
{
return
R
.
failed
(
"新签试用期结束时间为空"
);
}
paramter
.
put
(
"fPeriodEndY"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getPeriodEnd
()),
"yyyy"
));
paramter
.
put
(
"fPeriodEndM"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getPeriodEnd
()),
"MM"
));
paramter
.
put
(
"fPeriodEndD"
,
DateUtil
.
format
(
localDate2Date
(
attachInfo
.
getPeriodEnd
()),
"dd"
));
if
(
attachInfo
.
getPeriodSalaryPerMonth
()
==
null
)
{
return
R
.
failed
(
"新签试用期工资为空"
);
}
paramter
.
put
(
"periodSalaryPerMonth"
,
attachInfo
.
getPeriodSalaryPerMonth
());
}
//工作地点和岗位填充
if
(
StringUtils
.
isEmpty
(
attachInfo
.
getPost
()))
{
return
R
.
failed
(
"员工岗位为空,请去档案补充对应信息!"
);
}
paramter
.
put
(
"post"
,
attachInfo
.
getPost
());
if
(
StringUtils
.
isEmpty
(
attachInfo
.
getWorkSpace
()))
{
return
R
.
failed
(
"员工工作地点为空"
);
}
paramter
.
put
(
"workSpace"
,
attachInfo
.
getWorkSpace
());
//工时制
paramter
.
put
(
"workingHours"
,
""
);
//工资标准
if
(
StringUtils
.
isEmpty
(
attachInfo
.
getSalaryType
())){
return
R
.
failed
(
"工资形式不能为空"
);
}
String
salaryTypeKey
=
"salaryType"
;
if
(
StringUtils
.
equals
(
CommonConstants
.
ONE_STRING
,
attachInfo
.
getSalaryType
()))
{
paramter
.
put
(
salaryTypeKey
,
CommonConstants
.
ONE_STRING
);
//计时工资
if
(
attachInfo
.
getSalaryStandardPerHour
()==
null
)
{
return
R
.
failed
(
"计时工资为空"
);
}
paramter
.
put
(
"salaryStrandPh"
,
String
.
valueOf
(
attachInfo
.
getSalaryStandardPerHour
()));
}
else
if
(
StringUtils
.
equals
(
CommonConstants
.
TWO_STRING
,
attachInfo
.
getSalaryType
()))
{
paramter
.
put
(
salaryTypeKey
,
CommonConstants
.
TWO_STRING
);
if
(
attachInfo
.
getSalaryStandardPerPiece
()==
null
)
{
return
R
.
failed
(
"计件工资为空"
);
}
//计月工资
paramter
.
put
(
"salaryStrandPp"
,
String
.
valueOf
(
attachInfo
.
getSalaryStandardPerPiece
()));
}
else
if
(
StringUtils
.
equals
(
CommonConstants
.
THREE_STRING
,
attachInfo
.
getSalaryType
()))
{
paramter
.
put
(
salaryTypeKey
,
CommonConstants
.
THREE_STRING
);
}
else
{
return
R
.
failed
(
"未知的工资标准类型"
);
}
return
new
R
<>(
paramter
.
toJSONString
());
}
public
static
Date
localDate2Date
(
LocalDate
localDate
)
{
if
(
null
==
localDate
)
{
return
null
;
...
...
@@ -789,7 +883,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
if
(
reviseTaskDetailR
.
getCode
()
!=
CommonConstants
.
SUCCESS
)
{
return
R
.
failed
(
reviseTaskDetailR
.
getMsg
());
}
FddContractAttachInfo
attachInfo
=
fddContractAttachInfo
Service
.
ge
tOne
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
().
eq
(
FddContractAttachInfo:
:
getContractId
,
entity
.
getContractId
()));
FddContractAttachInfo
attachInfo
=
fddContractAttachInfo
Mapper
.
selec
tOne
(
Wrappers
.<
FddContractAttachInfo
>
query
().
lambda
().
eq
(
FddContractAttachInfo:
:
getContractId
,
entity
.
getContractId
()));
int
status
=
reviseTaskDetailR
.
getData
();
CancelReviseTaskReq
req
=
new
CancelReviseTaskReq
();
if
(
status
==
CommonConstants
.
ZERO_INT
||
status
==
CommonConstants
.
ONE_INT
)
{
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/FddContractTemplateServiceImpl.java
View file @
81f87eee
...
...
@@ -20,9 +20,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.fadada.api.bean.req.template.
GetTemplateDetailReq
;
import
com.fadada.api.bean.req.template.
*
;
import
com.fadada.api.bean.rsp.BaseRsp
;
import
com.fadada.api.bean.rsp.template.GetCompanyTemplatePreviewUrlRsp
;
import
com.fadada.api.bean.rsp.template.GetTemplateDetailRsp
;
import
com.fadada.api.bean.rsp.template.GetTemplateMainUrlRsp
;
import
com.fadada.api.bean.rsp.template.UploadCompanyTemplateFileRsp
;
import
com.fadada.api.client.TemplateClient
;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
...
...
@@ -30,13 +33,17 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplateFile;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractTemplateMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractTemplateFileService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractTemplateService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddReqLogService
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.FddUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -51,7 +58,8 @@ public class FddContractTemplateServiceImpl extends ServiceImpl<FddContractTempl
@Autowired
private
FddUtil
fddUtil
;
@Autowired
private
FddReqLogService
reqLogService
;
@Autowired
private
FddContractTemplateFileService
templateFileService
;
...
...
@@ -84,4 +92,146 @@ public class FddContractTemplateServiceImpl extends ServiceImpl<FddContractTempl
}
return
fddContractTemplatePage
;
}
@Override
public
R
saveInfo
(
FddContractTemplate
fddContractTemplate
)
{
long
count
=
this
.
count
(
Wrappers
.<
FddContractTemplate
>
query
().
lambda
()
.
eq
(
FddContractTemplate:
:
getLocalName
,
fddContractTemplate
.
getLocalName
())
);
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
return
R
.
failed
(
"已存在相同模板名称记录"
);
}
boolean
save
=
this
.
save
(
fddContractTemplate
);
if
(
save
)
{
return
R
.
ok
();
}
return
R
.
failed
(
"失败"
);
}
@Override
public
R
<
Boolean
>
changeInfo
(
FddContractTemplate
fddContractTemplate
)
{
long
count
=
this
.
count
(
Wrappers
.<
FddContractTemplate
>
query
().
lambda
()
.
eq
(
FddContractTemplate:
:
getLocalName
,
fddContractTemplate
.
getLocalName
())
.
notIn
(
FddContractTemplate:
:
getId
,
fddContractTemplate
.
getId
()));
if
(
count
>
CommonConstants
.
ZERO_INT
)
{
return
R
.
failed
(
"已存在相同模板名称记录"
);
}
return
new
R
<>(
this
.
updateById
(
fddContractTemplate
));
}
@Override
public
R
<
String
>
upload
(
MultipartFile
file
,
String
id
)
throws
ApiException
,
IOException
{
FddContractTemplate
entity
=
this
.
getById
(
id
);
if
(
entity
==
null
)
{
return
R
.
failed
(
"未查询到相关记录"
);
}
if
(
StringUtils
.
isNotEmpty
(
entity
.
getFddTemplateId
()))
{
return
R
.
failed
(
"已上传法大大模板"
);
}
//发送请求
UploadCompanyTemplateFileReq
req
=
new
UploadCompanyTemplateFileReq
();
req
.
setToken
(
fddUtil
.
getToken
());
req
.
setFileType
(
CommonConstants
.
ONE_INT
,
null
);
TemplateClient
client
=
new
TemplateClient
(
fddUtil
.
getFadadaApiClient
());
BaseRsp
<
UploadCompanyTemplateFileRsp
>
rsp
=
client
.
uploadCompanyTemplateFile
(
req
,
FddSealInfoServiceImpl
.
multipartFileToFile
(
file
));
reqLogService
.
saveLog
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getClassName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
//校验参数
if
(
StringUtils
.
equals
(
rsp
.
getCode
(),
FddUtil
.
SUCCESS
))
{
entity
.
setFddTemplateId
(
rsp
.
getData
().
getTemplateId
());
this
.
updateById
(
entity
);
//生成文件模板记录
FddContractTemplateFile
templateFile
=
new
FddContractTemplateFile
();
templateFile
.
setFddTemplateId
(
entity
.
getFddTemplateId
());
templateFile
.
setFddFileId
(
rsp
.
getData
().
getFileId
());
templateFileService
.
save
(
templateFile
);
return
R
.
ok
();
}
else
{
return
R
.
failed
(
"上传失败"
);
}
}
@Override
public
R
<
String
>
delCompanyTemplateFile
(
String
id
)
throws
ApiException
{
FddContractTemplate
entity
=
this
.
getById
(
id
);
if
(
entity
==
null
)
{
return
R
.
failed
(
"未查询到相关记录"
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getFddTemplateId
()))
{
return
R
.
failed
(
"法大大模板未上传"
);
}
//发送请求
DelCompanyTemplateFileReq
req
=
new
DelCompanyTemplateFileReq
();
req
.
setToken
(
fddUtil
.
getToken
());
DelCompanyTemplateFileReq
.
TemplateInfo
templateInfo
=
new
DelCompanyTemplateFileReq
.
TemplateInfo
();
templateInfo
.
setTemplateId
(
entity
.
getFddTemplateId
());
req
.
setTemplateInfo
(
templateInfo
);
TemplateClient
client
=
new
TemplateClient
(
fddUtil
.
getFadadaApiClient
());
BaseRsp
<
UploadCompanyTemplateFileRsp
>
rsp
=
client
.
delCompanyTemplateFile
(
req
);
reqLogService
.
saveLog
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getClassName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
//校验参数
if
(
StringUtils
.
equals
(
rsp
.
getCode
(),
FddUtil
.
SUCCESS
))
{
baseMapper
.
updateTeFddTemplateNull
(
entity
.
getId
());
//删除附件
templateFileService
.
remove
(
Wrappers
.<
FddContractTemplateFile
>
query
().
lambda
().
eq
(
FddContractTemplateFile:
:
getFddTemplateId
,
entity
.
getFddTemplateId
()));
return
R
.
ok
();
}
else
{
return
R
.
failed
(
"删除失败"
);
}
}
@Override
public
R
<
String
>
getTemplateMainUrl
(
String
id
)
throws
ApiException
{
FddContractTemplate
entity
=
this
.
getById
(
id
);
if
(
entity
==
null
)
{
return
R
.
failed
(
"未查询到相关记录"
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getFddTemplateId
()))
{
return
R
.
failed
(
"法大大模板未上传"
);
}
//发送请求
GetTemplateMainUrlReq
req
=
new
GetTemplateMainUrlReq
();
req
.
setToken
(
fddUtil
.
getToken
());
GetTemplateMainUrlReq
.
TemplateInfo
templateInfo
=
new
GetTemplateMainUrlReq
.
TemplateInfo
();
templateInfo
.
setTemplateId
(
entity
.
getFddTemplateId
());
req
.
setTemplateInfo
(
templateInfo
);
TemplateClient
client
=
new
TemplateClient
(
fddUtil
.
getFadadaApiClient
());
BaseRsp
<
GetTemplateMainUrlRsp
>
rsp
=
client
.
getTemplateMainUrl
(
req
);
reqLogService
.
saveLog
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getClassName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
//校验参数
if
(
StringUtils
.
equals
(
rsp
.
getCode
(),
FddUtil
.
SUCCESS
))
{
entity
.
setModifyUploadStatus
(
CommonConstants
.
ONE_STRING
);
this
.
updateById
(
entity
);
return
new
R
<>(
rsp
.
getData
().
getEditTemplateUrl
());
}
else
{
return
R
.
failed
(
"获取失败"
);
}
}
@Override
public
R
<
String
>
getCompanyTemplatePreviewUrl
(
String
id
)
throws
ApiException
{
FddContractTemplate
entity
=
this
.
getById
(
id
);
if
(
entity
==
null
)
{
return
R
.
failed
(
"未查询到相关记录"
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getFddTemplateId
()))
{
return
R
.
failed
(
"法大大模板未上传"
);
}
//发送请求
GetEditCompanyTemplateUrlReq
req
=
new
GetEditCompanyTemplateUrlReq
();
req
.
setToken
(
fddUtil
.
getToken
());
GetEditCompanyTemplateUrlReq
.
TemplateInfo
templateInfo
=
new
GetEditCompanyTemplateUrlReq
.
TemplateInfo
();
templateInfo
.
setTemplateId
(
entity
.
getFddTemplateId
());
req
.
setTemplateInfo
(
templateInfo
);
TemplateClient
client
=
new
TemplateClient
(
fddUtil
.
getFadadaApiClient
());
BaseRsp
<
GetCompanyTemplatePreviewUrlRsp
>
rsp
=
client
.
getCompanyTemplatePreviewUrl
(
req
);
reqLogService
.
saveLog
(
Thread
.
currentThread
().
getStackTrace
()[
1
].
getClassName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
//校验参数
if
(
StringUtils
.
equals
(
rsp
.
getCode
(),
FddUtil
.
SUCCESS
))
{
return
new
R
<>(
rsp
.
getData
().
getTemplatePreviewUrl
());
}
else
{
return
R
.
failed
(
rsp
.
getMsg
());
}
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/FddSealInfoServiceImpl.java
View file @
81f87eee
...
...
@@ -42,7 +42,9 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.util.List
;
/**
...
...
@@ -222,4 +224,46 @@ public class FddSealInfoServiceImpl extends ServiceImpl<FddSealInfoMapper, FddSe
reqLogService
.
saveLog
(
this
.
getClass
().
getName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
return
rsp
;
}
/**
* @param file
* @Author: huyc
* @Date: 2022/6/30
* @Description: MultipartFile转file
* @return: java.io.File
**/
public
static
File
multipartFileToFile
(
MultipartFile
file
)
throws
IOException
{
File
toFile
;
InputStream
ins
;
ins
=
file
.
getInputStream
();
toFile
=
new
File
(
file
.
getOriginalFilename
());
inputStreamToFile
(
ins
,
toFile
);
ins
.
close
();
return
toFile
;
}
/**
* @param ins
* @param file
* @Author: huyc
* @Date: 2022/6/30
* @Description: 获取流文件
* @return: void
**/
private
static
void
inputStreamToFile
(
InputStream
ins
,
File
file
)
throws
IOException
{
try
{
OutputStream
os
=
new
FileOutputStream
(
file
);
int
bytesRead
;
int
byteLength
=
8192
;
byte
[]
buffer
=
new
byte
[
byteLength
];
while
((
bytesRead
=
ins
.
read
(
buffer
,
0
,
byteLength
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
os
.
close
();
ins
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/utils/FddUtil.java
View file @
81f87eee
...
...
@@ -6,6 +6,7 @@ import com.fadada.api.bean.rsp.BaseRsp;
import
com.fadada.api.bean.rsp.oauth2.AccessTokenRsp
;
import
com.fadada.api.client.Oauth2Client
;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
import
com.yifu.cloud.plus.v1.yifu.archives.config.FddConfigProperties
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddReqLog
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddReqLogService
;
...
...
@@ -96,6 +97,4 @@ public class FddUtil {
}
return
accessToken
;
}
}
yifu-archives/yifu-archives-biz/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
81f87eee
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.archives.config.FddAutoConfigue
\ No newline at end of file
yifu-common/yifu-common-core/pom.xml
View file @
81f87eee
...
...
@@ -71,6 +71,11 @@
<artifactId>
commons-lang
</artifactId>
<version>
2.6
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.35
</version>
</dependency>
<!-- aliyun-sdk-oss -->
<dependency>
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ExcelException.java
0 → 100644
View file @
81f87eee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
exception
;
import
lombok.NoArgsConstructor
;
@NoArgsConstructor
//@NoArgsConstructor: 自动生成无参数构造函数。
public
class
ExcelException
extends
RuntimeException
{
public
ExcelException
(
String
message
)
{
super
(
message
);
}
public
ExcelException
(
Throwable
cause
)
{
super
(
cause
);
}
public
ExcelException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
ExcelException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/ExcelUtil.java
View file @
81f87eee
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ExcelException
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -32,6 +34,11 @@ public class ExcelUtil <T> implements Serializable {
private
HashMap
<
Integer
,
ErrorMessage
>
errorMessageHashMap
;
/**
* 用于返回实体
*/
private
List
<
T
>
entityList
;
public
ExcelUtil
(
Class
<
T
>
clazz
)
{
this
.
clazz
=
clazz
;
this
.
fields
=
clazz
.
getDeclaredFields
();
...
...
@@ -730,4 +737,204 @@ public class ExcelUtil <T> implements Serializable {
}
return
errorMessageHashMap
;
}
/**
* 将JSONSTRING数据源的数据导入到list
*
* @param jsonStr 接收的对象JSON串
* @param dicMap HashMap<dateType_value,dataValue_dataId> 如 {EMPTYPE_兼职工伤,ID}
* @author fxj
* @date 2019/08/01
*/
public
void
getJsonStringToList
(
String
jsonStr
,
Map
<
String
,
String
>
dicMap
)
{
List
<
HashMap
>
list
=
null
;
List
<
T
>
listt
=
new
ArrayList
<
T
>();
list
=
JSONObject
.
parseArray
(
jsonStr
,
HashMap
.
class
);
List
<
ErrorMessage
>
errorList
=
new
ArrayList
<
ErrorMessage
>();
HashMap
<
Integer
,
ErrorMessage
>
errorMessageHashMap
=
new
HashMap
<
Integer
,
ErrorMessage
>();
try
{
// 得到数据的条数
int
rows
=
list
.
size
();
// 有数据时才处理
if
(
rows
>
0
)
{
// 得到类的所有field
Field
[]
allFields
=
clazz
.
getDeclaredFields
();
Field
field
;
// 定义一个map用于存放列的序号和field
Map
<
Integer
,
Field
>
fieldsMap
=
new
HashMap
<
Integer
,
Field
>();
for
(
int
i
=
0
,
index
=
0
;
i
<
allFields
.
length
;
i
++)
{
field
=
allFields
[
i
];
// 将有注解的field存放到map中
if
(
field
.
isAnnotationPresent
(
ExcelAttribute
.
class
))
{
// 设置类的私有字段属性可访问
field
.
setAccessible
(
true
);
fieldsMap
.
put
(
index
,
field
);
index
++;
}
}
//存储错误数据
String
error
=
""
;
//临时存储单元格数据
String
tempStr
=
""
;
// 从第1行开始取数据
T
entity
=
null
;
HashMap
temp
;
ExcelAttribute
attr
;
String
c
=
null
;
Class
<?>
fieldType
;
ErrorMessage
errorTemp
=
null
;
for
(
int
i
=
0
;
i
<
rows
;
i
++)
{
// 得到一行中的所有单元格对象.
temp
=
list
.
get
(
i
);
entity
=
clazz
.
newInstance
();
for
(
int
j
=
0
;
j
<
fieldsMap
.
size
();
j
++)
{
// 从map中得到对应列的field
field
=
fieldsMap
.
get
(
j
);
//获取属性对应的注解属性
attr
=
field
.
getAnnotation
(
ExcelAttribute
.
class
);
// 单元格中的内容.
c
=
getStringValByObject
(
getFieldValueByName
(
attr
.
name
(),
temp
));
if
(
c
!=
null
)
{
c
=
c
.
trim
();
}
//校验字段是否符合要求 返回错误信息
error
=
validateUtil
(
c
,
attr
,
i
+
2
);
if
(
null
!=
error
)
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
error
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
error
),
errorTemp
);
continue
;
}
if
(
field
==
null
)
{
continue
;
}
//单元格数据为空不需要处理了
if
(!
StringUtils
.
isNotBlank
(
c
))
{
continue
;
}
//如果是需要从字典表取值数据的话在这里处理即可
if
(
attr
.
isDataId
()
&&
null
!=
dicMap
)
{
if
(
Common
.
isNotNull
(
attr
.
dataType
()))
{
//非区域字段处理
if
(
Common
.
isNotNull
(
attr
.
parentField
())){
tempStr
=
dicMap
.
get
(
attr
.
dataType
()
+
"_"
+
c
.
trim
()
+
"_"
+
getFieldValueByName
(
attr
.
parentField
(),
entity
,
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
));
}
else
{
tempStr
=
dicMap
.
get
(
attr
.
dataType
()
+
"_"
+
c
.
trim
());
}
}
else
{
if
(
attr
.
isArea
())
{
//区域字段处理
if
(
Common
.
isEmpty
(
attr
.
parentField
()))
{
tempStr
=
dicMap
.
get
(
c
.
trim
()
+
"_0"
);
}
else
{
tempStr
=
dicMap
.
get
(
c
.
trim
()
+
"_"
+
getFieldValueByName
(
attr
.
parentField
(),
entity
,
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
));
}
}
else
{
//直接按值去找数据
tempStr
=
dicMap
.
get
(
c
.
trim
());
}
}
if
(!
StringUtils
.
isNotBlank
(
tempStr
))
{
if
(
attr
.
isOrgan
())
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
"未找到:"
+
c
+
"的单位或结算主体数据,请确认存在结算主体权限"
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
"未找到:"
+
c
+
"的单位或结算主体数据,请确认存在结算主体权限"
),
errorTemp
);
}
if
(
attr
.
isArea
())
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
"未找到:"
+
c
+
"的区域数据"
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
"未找到:"
+
c
+
"的区域数据"
),
errorTemp
);
}
else
{
if
(
Common
.
isNotNull
(
attr
.
errorInfoImport
()))
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
"数据'"
+
c
+
"':"
+
attr
.
errorInfoImport
()));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
"数据'"
+
c
+
"':"
+
attr
.
errorInfoImport
()),
errorTemp
);
}
else
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
"未找到:"
+
c
+
"的字典数据"
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
"未找到:"
+
c
+
"的字典数据"
),
errorTemp
);
}
}
continue
;
}
else
{
c
=
tempStr
;
}
}
// 取得类型,并根据对象类型设置值.
fieldType
=
field
.
getType
();
if
(
fieldType
==
null
)
{
continue
;
}
if
(
String
.
class
==
fieldType
)
{
field
.
set
(
entity
,
c
);
}
else
if
(
BigDecimal
.
class
==
fieldType
)
{
c
=
c
.
indexOf
(
'%'
)
!=
-
1
?
c
.
replace
(
"%"
,
""
)
:
c
;
field
.
set
(
entity
,
BigDecimal
.
valueOf
(
Double
.
valueOf
(
c
)));
}
else
if
(
Date
.
class
==
fieldType
&&
Common
.
isNotNull
(
c
.
trim
()))
{
field
.
set
(
entity
,
DateUtil
.
stringToDate
(
c
.
trim
(),
Common
.
isEmpty
(
attr
.
dateFormat
())
?
DateUtil
.
ISO_EXPANDED_DATE_FORMAT
:
attr
.
dateFormat
()));
}
else
if
((
Integer
.
TYPE
==
fieldType
)
||
(
Integer
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Integer
.
parseInt
(
c
));
}
else
if
((
Long
.
TYPE
==
fieldType
)
||
(
Long
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Long
.
valueOf
(
c
));
}
else
if
((
Float
.
TYPE
==
fieldType
)
||
(
Float
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Float
.
valueOf
(
c
));
}
else
if
((
Short
.
TYPE
==
fieldType
)
||
(
Short
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Short
.
valueOf
(
c
));
}
else
if
((
Double
.
TYPE
==
fieldType
)
||
(
Double
.
class
==
fieldType
))
{
field
.
set
(
entity
,
Double
.
valueOf
(
c
));
}
else
if
(
Character
.
TYPE
==
fieldType
)
{
if
((
c
!=
null
)
&&
(
c
.
length
()
>
0
))
{
field
.
set
(
entity
,
Character
.
valueOf
(
c
.
charAt
(
0
)));
}
}
else
if
(
LocalDateTime
.
class
==
fieldType
&&
Common
.
isNotNull
(
c
.
trim
()))
{
String
dc
=
c
.
trim
().
replace
(
CommonConstants
.
CENTER_SPLIT_LINE_STRING
,
""
)
.
replace
(
CommonConstants
.
SLASH_SPLIT_LINE_STRING
,
""
);
try
{
if
(
dc
.
length
()
>
CommonConstants
.
EIGHT_INT
)
{
field
.
set
(
entity
,
LocalDateTimeUtils
.
convertDateToLDT
(
DateUtil
.
stringToDate
(
dc
,
DateUtil
.
DATETIME_PATTERN_CONTAINS
)));
}
else
{
field
.
set
(
entity
,
LocalDateTimeUtils
.
convertDateToLDT
(
DateUtil
.
stringToDate
(
dc
,
DateUtil
.
ISO_DATE_FORMAT
)));
}
}
catch
(
Exception
e
)
{
if
(
dc
.
length
()
>
CommonConstants
.
EIGHT_INT
)
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
attr
.
name
()
+
":"
+
c
.
trim
()
+
"应满足时间格式:"
+
DateUtil
.
DATETIME_PATTERN_SECOND
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
attr
.
name
()
+
":"
+
c
.
trim
()
+
"应满足时间格式:"
+
DateUtil
.
DATETIME_PATTERN_SECOND
),
errorTemp
);
continue
;
}
else
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
attr
.
name
()
+
":"
+
c
.
trim
()
+
"应满足时间格式:"
+
DateUtil
.
ISO_DATE_FORMAT
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
attr
.
name
()
+
":"
+
c
.
trim
()
+
"应满足时间格式:"
+
DateUtil
.
ISO_DATE_FORMAT
),
errorTemp
);
continue
;
}
}
}
else
if
(
LocalDate
.
class
==
fieldType
&&
!
Common
.
isEmpty
(
c
.
trim
()))
{
try
{
field
.
set
(
entity
,
LocalDate
.
parse
(
c
.
trim
().
replace
(
CommonConstants
.
CENTER_SPLIT_LINE_STRING
,
""
),
DateTimeFormatter
.
ofPattern
(
DateUtil
.
ISO_DATE_FORMAT
)));
}
catch
(
Exception
e
)
{
errorList
.
add
(
new
ErrorMessage
(
i
+
2
,
attr
.
name
()
+
":"
+
c
.
trim
()
+
"应满足时间格式:"
+
DateUtil
.
ISO_DATE_FORMAT
));
errorMessageHashMap
=
initErrorMessage
(
errorMessageHashMap
,
new
ErrorMessage
(
i
+
2
,
attr
.
name
()
+
":"
+
c
.
trim
()
+
"应满足时间格式:"
+
DateUtil
.
ISO_DATE_FORMAT
),
errorTemp
);
continue
;
}
}
}
if
(
null
==
error
)
{
if
(
entity
!=
null
)
{
listt
.
add
(
entity
);
}
}
else
{
continue
;
}
}
}
}
catch
(
Exception
e
)
{
throw
new
ExcelException
(
"将jsonString数据源的数据导入到list异常:"
+
e
.
getMessage
(),
e
);
}
this
.
setEntityList
(
listt
);
this
.
setErrorInfo
(
errorList
);
this
.
setErrorMessageHashMap
(
errorMessageHashMap
);
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/DictController.java
View file @
81f87eee
...
...
@@ -335,5 +335,18 @@ public class DictController {
return
sysDictItemService
.
getLableFronValue
(
value
,
type
);
}
/**
* @Description: itemType 获取对应的字典数据
* @Author: hgw
* @Date: 2022/6/22 18:19
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.Map < java.lang.String, java.util.Map < java.lang.String, java.lang.String>>>
**/
@Inner
@PostMapping
(
"/inner/getDictList"
)
public
R
<
List
<
SysDictItem
>>
getDictList
(
@RequestParam
(
value
=
"itemType"
,
required
=
false
)
String
itemType
)
{
List
<
SysDictItem
>
allList
=
sysDictItemService
.
list
(
Wrappers
.<
SysDictItem
>
query
().
lambda
()
.
in
(
SysDictItem:
:
getType
,
itemType
)
.
eq
(
SysDictItem:
:
getDelFlag
,
CommonConstants
.
ZERO_STRING
));
return
new
R
<>(
allList
);
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/mapper/SysDictItemMapper.java
View file @
81f87eee
...
...
@@ -18,6 +18,9 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 字典项
...
...
@@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
SysDictItemMapper
extends
BaseMapper
<
SysDictItem
>
{
List
<
SysDictItem
>
getDictToLable
(
@Param
(
"itemType"
)
String
itemType
);
}
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