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
Expand all
Hide 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 @@
...
@@ -17,12 +17,21 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
controller
;
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.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.entity.FddContractAttachInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractAttachInfoService
;
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.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
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
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
...
@@ -31,6 +40,11 @@ import lombok.RequiredArgsConstructor;
...
@@ -31,6 +40,11 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.*
;
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.*;
...
@@ -43,10 +57,14 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"/fddcontractattachinfo"
)
@RequestMapping
(
"/fddcontractattachinfo"
)
@Tag
(
name
=
"法大大合同附属信息表管理"
)
@Tag
(
name
=
"法大大合同附属信息表管理"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
@Slf4j
@EnableConfigurationProperties
(
DaprUpmsProperties
.
class
)
public
class
FddContractAttachInfoController
{
public
class
FddContractAttachInfoController
{
private
final
FddContractAttachInfoService
fddContractAttachInfoService
;
private
final
FddContractAttachInfoService
fddContractAttachInfoService
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
/**
/**
* 分页查询
* 分页查询
* @param page 分页对象
* @param page 分页对象
...
@@ -55,7 +73,6 @@ public class FddContractAttachInfoController {
...
@@ -55,7 +73,6 @@ public class FddContractAttachInfoController {
*/
*/
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontractattachinfo_get')"
)
public
R
getFddContractAttachInfoPage
(
Page
page
,
FddContractAttachInfo
fddContractAttachInfo
)
{
public
R
getFddContractAttachInfoPage
(
Page
page
,
FddContractAttachInfo
fddContractAttachInfo
)
{
return
R
.
ok
(
fddContractAttachInfoService
.
getFddContractAttachInfoPage
(
page
,
fddContractAttachInfo
));
return
R
.
ok
(
fddContractAttachInfoService
.
getFddContractAttachInfoPage
(
page
,
fddContractAttachInfo
));
}
}
...
@@ -67,7 +84,6 @@ public class FddContractAttachInfoController {
...
@@ -67,7 +84,6 @@ public class FddContractAttachInfoController {
*/
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('demo_fddcontractattachinfo_get')"
)
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询:hasPermission('demo_fddcontractattachinfo_get')"
)
@GetMapping
(
"/{id}"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontractattachinfo_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
String
id
)
{
public
R
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
R
.
ok
(
fddContractAttachInfoService
.
getById
(
id
));
return
R
.
ok
(
fddContractAttachInfoService
.
getById
(
id
));
}
}
...
@@ -111,4 +127,126 @@ public class FddContractAttachInfoController {
...
@@ -111,4 +127,126 @@ public class FddContractAttachInfoController {
return
R
.
ok
(
fddContractAttachInfoService
.
removeById
(
id
));
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;
...
@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.fadada.api.exception.ApiException
;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
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.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.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
@@ -31,6 +32,11 @@ import io.swagger.v3.oas.annotations.tags.Tag;
...
@@ -31,6 +32,11 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.*
;
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 {
...
@@ -73,19 +79,6 @@ public class FddContractTemplateController {
return
R
.
ok
(
fddContractTemplateService
.
getById
(
id
));
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 法大大员工合同模板
* @param fddContractTemplate 法大大员工合同模板
...
@@ -96,7 +89,7 @@ public class FddContractTemplateController {
...
@@ -96,7 +89,7 @@ public class FddContractTemplateController {
@PutMapping
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontracttemplate_edit')"
)
@PreAuthorize
(
"@pms.hasPermission('demo_fddcontracttemplate_edit')"
)
public
R
updateById
(
@RequestBody
FddContractTemplate
fddContractTemplate
)
{
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 {
...
@@ -112,4 +105,71 @@ public class FddContractTemplateController {
return
R
.
ok
(
fddContractTemplateService
.
removeById
(
id
));
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;
...
@@ -18,8 +18,6 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -58,8 +56,8 @@ public class FddController {
...
@@ -58,8 +56,8 @@ public class FddController {
private
FddCompanyInfoService
fddCompanyInfoService
;
private
FddCompanyInfoService
fddCompanyInfoService
;
@Autowired
@Autowired
private
FddContractAttachInfoService
fddContractAttachInfoService
;
private
FddContractAttachInfoService
fddContractAttachInfoService
;
//
@Autowired
@Autowired
//
private TEmployeeContractInfoService employeeContractInfoService;
private
TEmployeeContractInfoService
employeeContractInfoService
;
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
10
);
...
@@ -168,31 +166,22 @@ public class FddController {
...
@@ -168,31 +166,22 @@ public class FddController {
//实名认证成功发送电子合同
//实名认证成功发送电子合同
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
try
{
try
{
// //先查询下有没有没发送这个员工没发送的电子合同。如果有则发送
//先查询下有没有没发送这个员工没发送的电子合同。如果有则发送
// List<FddContractAttachInfo> attachInfos = fddContractAttachInfoService.getListByNoInfoByEmpIdcard(entity.getIdCard());
List
<
FddContractAttachInfo
>
attachInfos
=
fddContractAttachInfoService
.
getListByNoInfoByEmpIdcard
(
entity
.
getIdCard
());
// //自动创建定稿任务.查看是否有未定稿的数据。有的话自动发送
//自动创建定稿任务.查看是否有未定稿的数据。有的话自动发送
// if (attachInfos.size() == CommonConstants.ZERO_INT) {
if
(
attachInfos
.
size
()
==
CommonConstants
.
ZERO_INT
)
{
// return;
return
;
// }
}
// FddContractAttachInfo fddContractAttachInfo = attachInfos.get(CommonConstants.ZERO_INT);
FddContractAttachInfo
fddContractAttachInfo
=
attachInfos
.
get
(
CommonConstants
.
ZERO_INT
);
// TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getById(fddContractAttachInfo.getContractId());
R
<
String
>
returnR
=
fddContractInfoService
.
saveEmpContract
(
fddContractAttachInfo
);
// TEmployeeInfo employeeInfo = employeeInfoService.getById(employeeContractInfo.getEmpId());
if
(
returnR
!=
null
)
{
//获取合同创建人
//记录返回信息
// String createUserId = fddContractAttachInfo.getCreateUserId();
if
(
returnR
.
getCode
()==
CommonConstants
.
SUCCESS
){
// FeginExtendUser feginExtendUser = new FeginExtendUser();
fddContractAttachInfo
.
setRemark
(
"成功"
);
// R<List<SysUser>> remoteUserServiceSimpleUser = remoteUserService.getAllUserInfoByUserIds(createUserId, SecurityConstants.FROM_IN);
}
else
{
// SysUser sysUser = remoteUserServiceSimpleUser.getData().get(CommonConstants.ZERO_INT);
fddContractAttachInfo
.
setRemark
(
returnR
.
getMsg
());
// 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());
// }
// }
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -216,16 +205,16 @@ public class FddController {
...
@@ -216,16 +205,16 @@ public class FddController {
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
try
{
try
{
//自动创建定稿任务
//自动创建定稿任务
//
R<String> returnR = fddContractInfoService.createTaskByDraftId(fddContractInfo);
R
<
String
>
returnR
=
fddContractInfoService
.
createTaskByDraftId
(
fddContractInfo
);
//
if(returnR!=null){
if
(
returnR
!=
null
){
//
//记录返回信息
//记录返回信息
//
if(returnR.getCode()==CommonConstants.SUCCESS){
if
(
returnR
.
getCode
()==
CommonConstants
.
SUCCESS
){
//
fddContractInfo.setRemark("成功");
fddContractInfo
.
setRemark
(
"成功"
);
//
}else {
}
else
{
//
fddContractInfo.setRemark(returnR.getMsg());
fddContractInfo
.
setRemark
(
returnR
.
getMsg
());
//
}
}
//
fddContractInfoService.updateById(fddContractInfo);
fddContractInfoService
.
updateById
(
fddContractInfo
);
//
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -263,14 +252,14 @@ public class FddController {
...
@@ -263,14 +252,14 @@ public class FddController {
// 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态:
// 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态:
if
(
CommonConstants
.
TWO_STRING
.
equals
(
fddContractInfo
.
getSendSignStatus
())
if
(
CommonConstants
.
TWO_STRING
.
equals
(
fddContractInfo
.
getSendSignStatus
())
&&
CommonConstants
.
TWO_STRING
.
equals
(
fddContractInfo
.
getReceiveSignStatus
()))
{
&&
CommonConstants
.
TWO_STRING
.
equals
(
fddContractInfo
.
getReceiveSignStatus
()))
{
//
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo);
fddContractAttachInfoService
.
saveEmpAndAttarch
(
fddContractInfo
);
//
TEmployeeContractInfo ec = employeeContractInfoService.getById(fddContractInfo.getContractId());
TEmployeeContractInfo
ec
=
employeeContractInfoService
.
getById
(
fddContractInfo
.
getContractId
());
//
// 如果合同的状态是待电子签,则变更为已电子签
// 如果合同的状态是待电子签,则变更为已电子签
//
if (ec != null && ec.getIsSign() != null && ec.getIsSign() == CommonConstants.ONE_INT) {
if
(
ec
!=
null
&&
ec
.
getIsSign
()
!=
null
&&
ec
.
getIsSign
()
==
CommonConstants
.
ONE_INT
)
{
//
ec.setIsSign(CommonConstants.ZERO_INT);
ec
.
setIsSign
(
CommonConstants
.
ZERO_INT
);
//
employeeContractInfoService.updateById(ec);
employeeContractInfoService
.
updateById
(
ec
);
//
}
}
}
}
return
R
.
ok
();
return
R
.
ok
();
}
else
if
(
StringUtils
.
equals
(
fddEvent
,
"notifyUrlVerify"
))
{
}
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;
...
@@ -22,7 +22,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
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.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
;
import
java.util.List
;
/**
/**
...
@@ -46,4 +50,12 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach
...
@@ -46,4 +50,12 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach
* @return
* @return
*/
*/
List
<
FddContractAttachInfo
>
getListByNoInfoByEmpIdcard
(
String
empIdcard
);
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> {
...
@@ -110,4 +110,6 @@ public interface FddContractInfoService extends IService<FddContractInfo> {
* @return: R
* @return: R
**/
**/
R
<
String
>
moveFileToEmpConcat
(
FddContractInfo
fddContractInfo
,
HttpServletResponse
response
)
throws
ApiException
,
IOException
;
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;
...
@@ -23,6 +23,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.fadada.api.exception.ApiException
;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
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
...
@@ -39,4 +43,46 @@ public interface FddContractTemplateService extends IService<FddContractTemplate
*/
*/
IPage
<
FddContractTemplate
>
getFddContractTemplatePage
(
Page
<
FddContractTemplate
>
page
,
FddContractTemplate
fddContractTemplate
)
throws
ApiException
;
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
This diff is collapsed.
Click to expand it.
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;
...
@@ -49,6 +49,7 @@ import com.fadada.api.client.SignTaskClient;
import
com.fadada.api.exception.ApiException
;
import
com.fadada.api.exception.ApiException
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.*
;
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.mapper.FddContractInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.*
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.FddUtil
;
import
com.yifu.cloud.plus.v1.yifu.archives.utils.FddUtil
;
...
@@ -105,7 +106,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
...
@@ -105,7 +106,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
@Autowired
@Autowired
private
FddSealPersonAuthService
fddSealPersonAuthService
;
private
FddSealPersonAuthService
fddSealPersonAuthService
;
@Autowired
@Autowired
private
FddContractAttachInfo
Service
fddContractAttachInfoService
;
private
FddContractAttachInfo
Mapper
fddContractAttachInfoMapper
;
// @Autowired
// @Autowired
// private TEmployeeContractInfoService employeeContractInfoService;
// private TEmployeeContractInfoService employeeContractInfoService;
// @Autowired
// @Autowired
...
@@ -284,7 +285,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
...
@@ -284,7 +285,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
return
R
.
failed
(
"合同签署任务已完成,不能作废重签"
);
return
R
.
failed
(
"合同签署任务已完成,不能作废重签"
);
}
}
YifuUser
user
=
SecurityUtils
.
getUser
();
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
()));
.
eq
(
FddContractAttachInfo:
:
getContractId
,
entity
.
getContractId
()));
if
(!
user
.
getId
().
equals
(
fddContractAttachInfo
.
getCreateBy
()))
{
if
(!
user
.
getId
().
equals
(
fddContractAttachInfo
.
getCreateBy
()))
{
return
R
.
failed
(
"当前用户不是电子合同导入用户,不能操作"
);
return
R
.
failed
(
"当前用户不是电子合同导入用户,不能操作"
);
...
@@ -768,6 +769,99 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
...
@@ -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
)
{
public
static
Date
localDate2Date
(
LocalDate
localDate
)
{
if
(
null
==
localDate
)
{
if
(
null
==
localDate
)
{
return
null
;
return
null
;
...
@@ -789,7 +883,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
...
@@ -789,7 +883,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
if
(
reviseTaskDetailR
.
getCode
()
!=
CommonConstants
.
SUCCESS
)
{
if
(
reviseTaskDetailR
.
getCode
()
!=
CommonConstants
.
SUCCESS
)
{
return
R
.
failed
(
reviseTaskDetailR
.
getMsg
());
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
();
int
status
=
reviseTaskDetailR
.
getData
();
CancelReviseTaskReq
req
=
new
CancelReviseTaskReq
();
CancelReviseTaskReq
req
=
new
CancelReviseTaskReq
();
if
(
status
==
CommonConstants
.
ZERO_INT
||
status
==
CommonConstants
.
ONE_INT
)
{
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;
...
@@ -20,9 +20,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
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.BaseRsp
;
import
com.fadada.api.bean.rsp.template.GetCompanyTemplatePreviewUrlRsp
;
import
com.fadada.api.bean.rsp.template.GetTemplateDetailRsp
;
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.client.TemplateClient
;
import
com.fadada.api.exception.ApiException
;
import
com.fadada.api.exception.ApiException
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplate
;
...
@@ -30,13 +33,17 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractTemplateFile;
...
@@ -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.mapper.FddContractTemplateMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddContractTemplateFileService
;
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.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.archives.utils.FddUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
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
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -51,7 +58,8 @@ public class FddContractTemplateServiceImpl extends ServiceImpl<FddContractTempl
...
@@ -51,7 +58,8 @@ public class FddContractTemplateServiceImpl extends ServiceImpl<FddContractTempl
@Autowired
@Autowired
private
FddUtil
fddUtil
;
private
FddUtil
fddUtil
;
@Autowired
private
FddReqLogService
reqLogService
;
@Autowired
@Autowired
private
FddContractTemplateFileService
templateFileService
;
private
FddContractTemplateFileService
templateFileService
;
...
@@ -84,4 +92,146 @@ public class FddContractTemplateServiceImpl extends ServiceImpl<FddContractTempl
...
@@ -84,4 +92,146 @@ public class FddContractTemplateServiceImpl extends ServiceImpl<FddContractTempl
}
}
return
fddContractTemplatePage
;
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;
...
@@ -42,7 +42,9 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -222,4 +224,46 @@ public class FddSealInfoServiceImpl extends ServiceImpl<FddSealInfoMapper, FddSe
...
@@ -222,4 +224,46 @@ public class FddSealInfoServiceImpl extends ServiceImpl<FddSealInfoMapper, FddSe
reqLogService
.
saveLog
(
this
.
getClass
().
getName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
reqLogService
.
saveLog
(
this
.
getClass
().
getName
(),
Thread
.
currentThread
().
getStackTrace
()[
1
].
getMethodName
(),
req
,
rsp
);
return
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;
...
@@ -6,6 +6,7 @@ import com.fadada.api.bean.rsp.BaseRsp;
import
com.fadada.api.bean.rsp.oauth2.AccessTokenRsp
;
import
com.fadada.api.bean.rsp.oauth2.AccessTokenRsp
;
import
com.fadada.api.client.Oauth2Client
;
import
com.fadada.api.client.Oauth2Client
;
import
com.fadada.api.exception.ApiException
;
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.config.FddConfigProperties
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddReqLog
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.FddReqLog
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddReqLogService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.FddReqLogService
;
...
@@ -96,6 +97,4 @@ public class FddUtil {
...
@@ -96,6 +97,4 @@ public class FddUtil {
}
}
return
accessToken
;
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
...
@@ -72,6 +72,11 @@
...
@@ -72,6 +72,11 @@
<version>
2.6
</version>
<version>
2.6
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.35
</version>
</dependency>
<!-- aliyun-sdk-oss -->
<!-- aliyun-sdk-oss -->
<dependency>
<dependency>
<groupId>
com.aliyun.oss
</groupId>
<groupId>
com.aliyun.oss
</groupId>
...
...
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
;
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.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
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.constant.ValidityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ExcelException
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -32,6 +34,11 @@ public class ExcelUtil <T> implements Serializable {
...
@@ -32,6 +34,11 @@ public class ExcelUtil <T> implements Serializable {
private
HashMap
<
Integer
,
ErrorMessage
>
errorMessageHashMap
;
private
HashMap
<
Integer
,
ErrorMessage
>
errorMessageHashMap
;
/**
* 用于返回实体
*/
private
List
<
T
>
entityList
;
public
ExcelUtil
(
Class
<
T
>
clazz
)
{
public
ExcelUtil
(
Class
<
T
>
clazz
)
{
this
.
clazz
=
clazz
;
this
.
clazz
=
clazz
;
this
.
fields
=
clazz
.
getDeclaredFields
();
this
.
fields
=
clazz
.
getDeclaredFields
();
...
@@ -730,4 +737,204 @@ public class ExcelUtil <T> implements Serializable {
...
@@ -730,4 +737,204 @@ public class ExcelUtil <T> implements Serializable {
}
}
return
errorMessageHashMap
;
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 {
...
@@ -335,5 +335,18 @@ public class DictController {
return
sysDictItemService
.
getLableFronValue
(
value
,
type
);
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;
...
@@ -18,6 +18,9 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
import
org.apache.ibatis.annotations.Mapper
;
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;
...
@@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
SysDictItemMapper
extends
BaseMapper
<
SysDictItem
>
{
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