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
3661b067
Commit
3661b067
authored
May 27, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.7.11-是否自动生成解除劳动合同书 0否1是
parent
fb7d9967
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
537 additions
and
39 deletions
+537
-39
TEmployeeContractInfoController.java
.../archives/controller/TEmployeeContractInfoController.java
+14
-0
TEmployeeContractInfoMapper.java
.../v1/yifu/archives/mapper/TEmployeeContractInfoMapper.java
+3
-4
TEmployeeContractInfoService.java
...1/yifu/archives/service/TEmployeeContractInfoService.java
+3
-1
TEmployeeContractInfoServiceImpl.java
...chives/service/impl/TEmployeeContractInfoServiceImpl.java
+7
-2
TEmployeeContractInfoMapper.xml
...src/main/resources/mapper/TEmployeeContractInfoMapper.xml
+8
-0
ChecksUtil.java
...n/java/com/yifu/cloud/plus/v1/check/utils/ChecksUtil.java
+12
-2
ArchivesDaprUtil.java
...cloud/plus/v1/yifu/common/dapr/util/ArchivesDaprUtil.java
+22
-0
TDispatchInfo.java
.../yifu/cloud/plus/v1/yifu/social/entity/TDispatchInfo.java
+9
-0
TSocialFriendBackLog.java
...loud/plus/v1/yifu/social/entity/TSocialFriendBackLog.java
+7
-1
SociaFriendYgsAddVo.java
...ifu/cloud/plus/v1/yifu/social/vo/SociaFriendYgsAddVo.java
+11
-0
SocialFriendConfig.java
.../cloud/plus/v1/yifu/social/config/SocialFriendConfig.java
+7
-0
TSocialFriendWordController.java
...1/yifu/social/controller/TSocialFriendWordController.java
+54
-2
SysHouseHoldInfoMapper.java
...ud/plus/v1/yifu/social/mapper/SysHouseHoldInfoMapper.java
+8
-0
TAttaInfoMapper.java
...ifu/cloud/plus/v1/yifu/social/mapper/TAttaInfoMapper.java
+3
-0
TDispatchInfoMapper.java
...cloud/plus/v1/yifu/social/mapper/TDispatchInfoMapper.java
+2
-0
TDispatchInfoServiceImpl.java
...v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
+24
-0
TSocialFriendPushServiceImpl.java
...ifu/social/service/impl/TSocialFriendPushServiceImpl.java
+92
-10
WordToImageUtil.java
.../yifu/cloud/plus/v1/yifu/social/util/WordToImageUtil.java
+216
-0
WordToImageWithSeal.java
...u/cloud/plus/v1/yifu/social/util/WordToImageWithSeal.java
+0
-17
SysHouseHoldInfoMapper.xml
...-biz/src/main/resources/mapper/SysHouseHoldInfoMapper.xml
+7
-0
TAttaInfoMapper.xml
...-social-biz/src/main/resources/mapper/TAttaInfoMapper.xml
+6
-0
TDispatchInfoMapper.xml
...ial-biz/src/main/resources/mapper/TDispatchInfoMapper.xml
+14
-0
TSocialFriendMapper.xml
...ial-biz/src/main/resources/mapper/TSocialFriendMapper.xml
+8
-0
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeContractInfoController.java
View file @
3661b067
...
...
@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractAuditVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ErrorVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.IdNameNoVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
...
...
@@ -399,4 +400,17 @@ public class TEmployeeContractInfoController {
return
tEmployeeContractInfoService
.
getContractByEmpIdCardAndDeptId
(
empIdCard
,
deptId
);
}
/**
* @Description: 获取项目下人员最小的合同起始日期
* @Author: hgw
* @Date: 2025/5/26 19:06
* @return: java.lang.String
**/
@Operation
(
summary
=
"获取项目下人员最小的合同起始日期"
,
description
=
"获取项目下人员最小的合同起始日期"
)
@Inner
@PostMapping
(
"/getMinDateByCardAndDeptId"
)
public
String
getMinDateByCardAndDeptId
(
@RequestBody
IdNameNoVo
idVo
)
{
return
tEmployeeContractInfoService
.
getMinDateByCardAndDeptId
(
idVo
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeContractInfoMapper.java
View file @
3661b067
...
...
@@ -21,10 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractBusinessPageVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportAuditVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.*
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -110,5 +107,7 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
String
getContractByEmpIdCardAndDeptId
(
@Param
(
"empIdCard"
)
String
empIdCard
,
@Param
(
"deptId"
)
String
deptId
);
String
getMinDateByCardAndDeptId
(
@Param
(
"vo"
)
IdNameNoVo
vo
);
void
updateContractEnd
(
@Param
(
"tEmployeeContractInfo"
)
TEmployeeContractInfo
tEmployeeContractInfo
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeContractInfoService.java
View file @
3661b067
...
...
@@ -184,6 +184,8 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
List
<
EmpContractBusinessPageVo
>
getOtherContractBusinessInfo
(
String
empId
,
String
contractId
);
R
<
String
>
getContractByEmpIdCardAndDeptId
(
String
mpIdCard
,
String
deptId
);
R
<
String
>
getContractByEmpIdCardAndDeptId
(
String
empIdCard
,
String
deptId
);
String
getMinDateByCardAndDeptId
(
IdNameNoVo
vo
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractInfoServiceImpl.java
View file @
3661b067
...
...
@@ -1957,8 +1957,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
@Override
public
R
<
String
>
getContractByEmpIdCardAndDeptId
(
String
mpIdCard
,
String
deptId
)
{
String
contractStart
=
baseMapper
.
getContractByEmpIdCardAndDeptId
(
mpIdCard
,
deptId
);
public
R
<
String
>
getContractByEmpIdCardAndDeptId
(
String
e
mpIdCard
,
String
deptId
)
{
String
contractStart
=
baseMapper
.
getContractByEmpIdCardAndDeptId
(
e
mpIdCard
,
deptId
);
if
(
Common
.
isNotNull
(
contractStart
))
{
return
R
.
ok
(
contractStart
);
}
else
{
...
...
@@ -1966,6 +1966,11 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
@Override
public
String
getMinDateByCardAndDeptId
(
IdNameNoVo
vo
)
{
return
baseMapper
.
getMinDateByCardAndDeptId
(
vo
);
}
//是否同步终止合同、减项、减档为是的时候 单独写逻辑
public
void
changeStatus
(
TEmployeeContractInfo
contractInfo
,
YifuUser
user
)
{
//同步任务处理清单执行详情
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeContractInfoMapper.xml
View file @
3661b067
...
...
@@ -843,4 +843,12 @@
)
limit 1
</select>
<!-- 获取最小的审核通过的合同,税友自动生成 离职证明书使用 -->
<select
id=
"getMinDateByCardAndDeptId"
resultType=
"java.lang.String"
>
select
DATE_FORMAT(min(e.CONTRACT_START),'%Y年%m月%d日') CONTRACT_START
from t_employee_contract_info e
where e.EMP_IDCARD = #{vo.no} and e.SETTLE_DOMAIN = #{vo.id} and e.DELETE_FLAG = '0' and e.AUDIT_STATUS = '2'
</select>
</mapper>
yifu-check/yifu-check-api/src/main/java/com/yifu/cloud/plus/v1/check/utils/ChecksUtil.java
View file @
3661b067
...
...
@@ -187,8 +187,18 @@ public class ChecksUtil {
return
R
.
ok
(
checkBankNo
);
}
private
static
String
getJsonElementValue
(
JsonElement
temp
){
return
Common
.
isNotNull
(
temp
)?
temp
.
getAsString
():
CommonConstants
.
EMPTY_STRING
;
private
static
String
getJsonElementValue
(
JsonElement
temp
)
{
String
msg
=
""
;
if
(
Common
.
isNotNull
(
temp
))
{
try
{
msg
=
temp
.
toString
().
substring
(
0
,
10
);
return
temp
.
getAsString
();
}
catch
(
Exception
e
)
{
return
"创蓝云智返回异常:"
+
msg
;
}
}
else
{
return
CommonConstants
.
EMPTY_STRING
;
}
}
/**
...
...
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/ArchivesDaprUtil.java
View file @
3661b067
...
...
@@ -589,4 +589,26 @@ public class ArchivesDaprUtil {
Set
<
String
>
map
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
res
.
getData
()),
new
TypeReference
<
Set
<
String
>>(){});
return
R
.
ok
(
map
);
}
/**
* @param idCard 身份证
* @param deptId 项目Id
* @Description: 获取项目下人员最小的合同起始日期
* @Author: hgw
* @Date: 2025/5/26 18:39
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo>
**/
public
R
<
String
>
getMinDateByCardAndDeptId
(
String
idCard
,
String
deptId
)
{
IdNameNoVo
idVo
=
new
IdNameNoVo
();
idVo
.
setId
(
deptId
);
idVo
.
setNo
(
idCard
);
R
<
String
>
res
=
HttpDaprUtil
.
invokeMethodPost
(
daprArchivesProperties
.
getAppUrl
(),
daprArchivesProperties
.
getAppId
()
,
"/temployeecontractinfo/getMinDateByCardAndDeptId"
,
idVo
,
String
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
Common
.
isEmpty
(
res
)
||
Common
.
isEmpty
(
res
.
getData
())){
return
new
R
<>(
"--"
);
}
return
res
;
}
}
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/entity/TDispatchInfo.java
View file @
3661b067
...
...
@@ -837,4 +837,13 @@ public class TDispatchInfo extends BaseEntity {
@ExcelProperty
(
"是否单个接口"
)
private
String
isSingle
;
/**
* 是否自动生成解除劳动合同书 0否1是(是的话,走单个推送,因为税友的减员接口没有批量附件的字段)
*/
@ExcelAttribute
(
name
=
"是否自动生成解除劳动合同书"
)
@Schema
(
description
=
"是否自动生成解除劳动合同书"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"是否自动生成解除劳动合同书 0否1是"
)
private
String
isAutoLeaveDoc
;
}
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/entity/TSocialFriendBackLog.java
View file @
3661b067
...
...
@@ -63,9 +63,15 @@ public class TSocialFriendBackLog {
@Schema
(
description
=
"请求ID"
)
private
String
requestId
;
/**
* @Description: 类型1社保增 2社保减 3医保增 4医保减 5推送的日志 6社保图片路径7医保图片路径
* 8社保解除劳动合同9医保解除劳动合同11社保增拉取 12社保减拉取 13医保增拉取 14医保减拉取16社保单个图片17医保单个图片
* @Author: hgw
* @Date: 2025/5/27 10:15
**/
@ExcelAttribute
(
name
=
"类型"
)
@ExcelProperty
(
"类型"
)
@Schema
(
description
=
"类型
1社保增 2社保减 3医保增 4医保减 5推送的日志 6社保图片路径7医保图片路径11社保增拉取 12社保减拉取 13医保增拉取 14医保减拉取16社保单个图片17医保单个图片
"
)
@Schema
(
description
=
"类型"
)
private
Integer
type
;
/**
...
...
yifu-social/yifu-social-api/src/main/java/com/yifu/cloud/plus/v1/yifu/social/vo/SociaFriendYgsAddVo.java
View file @
3661b067
...
...
@@ -85,6 +85,8 @@ public class SociaFriendYgsAddVo implements Serializable {
private
String
qyzgshbxzyhmc
;
// 单个附件list
private
List
<
String
>
imgList
;
// 自动生成解除劳动证明
private
String
autoLeaveDoc
;
// 当前行政经办区——2025-3-31 10:23:02 盛宇与税友沟通,可以默认安徽省,暂时不用这个字段了,后面有特殊要求再加
/*@ExcelProperty("当前行政经办区
private String dqxzjbq*/
...
...
@@ -114,6 +116,15 @@ public class SociaFriendYgsAddVo implements Serializable {
@ExcelProperty
(
"是否单个"
)
private
String
isSingle
;
@ExcelProperty
(
"是否自动生成解除劳动合同书0否1是"
)
private
String
isAutoLeaveDoc
;
// 自动生成解除劳动合同书使用的
@ExcelProperty
(
"离职日期"
)
private
String
leaveDate
;
@ExcelProperty
(
"派单日期"
)
private
String
dispatchDate
;
@ExcelProperty
(
"项目Id"
)
private
String
deptId
;
// 用来获取单个推送的附件
@ExcelProperty
(
"派单ID"
)
private
String
dispatchId
;
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/config/SocialFriendConfig.java
View file @
3661b067
...
...
@@ -431,6 +431,9 @@ public class SocialFriendConfig {
tszdxx
.
put
(
"ybygxs"
,
"原固定职工"
);
// 毕业院校
tszdxx
.
put
(
"byyx"
,
vo
.
getByyx
());
if
(
Common
.
isNotNull
(
vo
.
getIsSingle
())
&&
CommonConstants
.
ONE_STRING
.
equals
(
vo
.
getIsSingle
()))
{
tszdxx
.
put
(
"sfpl"
,
"否"
);
}
if
(
type
<
3
)
{
// 企业职工社会保险增员花名册 安徽非必填!
// 社保增员必填
...
...
@@ -510,9 +513,13 @@ public class SocialFriendConfig {
// tszdxx.put("ybjycl", )
// 职工社会保险减少花名册 无
// tszdxx.put("zgshbxjshmc", )
if
(
type
>
2
)
{
// 职工基本医疗保险参保登记表
tszdxx
.
put
(
"zgjbylbxcbdjb"
,
arr
);
tszdxx
.
put
(
"ybjycl"
,
vo
.
getAutoLeaveDoc
());
}
else
{
tszdxx
.
put
(
"shjycl"
,
vo
.
getAutoLeaveDoc
());
}
cbrymdOne
.
put
(
"tszdxx"
,
tszdxx
);
cbrymdArr
.
add
(
cbrymdOne
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TSocialFriendWordController.java
View file @
3661b067
...
...
@@ -17,11 +17,16 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
controller
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
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.social.config.SocialFriendConfig
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog
;
import
com.yifu.cloud.plus.v1.yifu.social.mapper.TAttaInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.social.util.WordToImageUtil
;
import
com.yifu.cloud.plus.v1.yifu.social.util.WordToImageWithSeal
;
import
com.yifu.cloud.plus.v1.yifu.social.util.WordUtil
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -31,9 +36,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -54,19 +61,64 @@ public class TSocialFriendWordController {
@Operation
(
description
=
"生成新word"
)
@GetMapping
(
"/updateNewFileTest"
)
@SysLog
(
"生成新word"
)
public
void
updateNewFileTest
()
throws
Exception
{
public
R
<
String
>
updateNewFileTest
()
throws
Exception
{
// 1:将劳动合同解除证明书.doc某些文字替换
// 2:盖章
// 3:生成新文件
String
inputPath
=
"D:/test126.docx"
;
String
outputPath
=
"D:/test126666.docx"
;
String
outputImagePath
=
"D:/document_with_seal.png"
;
// 可以从配置中获取
re
placeText
(
inputPath
,
outputPath
,
outputImagePath
);
re
turn
wordToImage
(
inputPath
,
outputPath
,
outputImagePath
);
}
@Autowired
private
OSSUtil
ossUtil
;
@Autowired
private
TAttaInfoMapper
attaInfoMapper
;
private
final
RestTemplate
restTemplate
;
private
final
SocialFriendConfig
socialFriendConfig
;
public
R
<
String
>
wordToImage
(
String
inputPath
,
String
outputPath
,
String
outputImagePath
)
throws
Exception
{
String
src
=
"1735185038602皖信.png"
;
URL
url
=
ossUtil
.
getObjectUrl
(
null
,
src
);
if
(
Common
.
isEmpty
(
url
))
{
throw
new
RuntimeException
(
"获取印章图片失败"
);
}
try
(
InputStream
imageStream
=
url
.
openStream
())
{
// 准备替换参数
Map
<
String
,
String
>
replacements
=
new
HashMap
<>();
replacements
.
put
(
"empName"
,
"张三丰"
);
replacements
.
put
(
"empSex"
,
"女"
);
replacements
.
put
(
"empAge"
,
"33"
);
replacements
.
put
(
"idCard"
,
"340826199012121212"
);
replacements
.
put
(
"startDate"
,
"2023年11月28日"
);
replacements
.
put
(
"leaveReason"
,
"个人原因"
);
replacements
.
put
(
"leaveDate"
,
"2025年01月20日"
);
replacements
.
put
(
"nowDate"
,
DateUtil
.
formatDatePatten
(
new
Date
(),
DateUtil
.
CHINA_PATTEN_YMD
));
// 离职证明模板
String
templateSrc
=
attaInfoMapper
.
getLeaveDocTemplate
();
URL
templateUrl
=
null
;
if
(
Common
.
isNotNull
(
templateSrc
))
{
templateUrl
=
ossUtil
.
getObjectUrl
(
null
,
templateSrc
);
}
if
(
templateUrl
!=
null
)
{
// 执行替换 + 插入印章
TSocialFriendBackLog
backLog
=
new
TSocialFriendBackLog
();
backLog
.
setSocialId
(
"test"
);
backLog
.
setType
(
CommonConstants
.
EIGHT_INT
);
backLog
.
setCreateTime
(
LocalDateTime
.
now
());
String
friendUrl
=
WordToImageUtil
.
replaceTextInWord
(
templateUrl
.
openStream
()
,
replacements
,
imageStream
,
restTemplate
,
socialFriendConfig
,
backLog
);
return
R
.
ok
(
friendUrl
);
}
}
return
R
.
ok
();
}
public
R
<
String
>
replaceText
(
String
inputPath
,
String
outputPath
,
String
outputImagePath
)
throws
Exception
{
String
src
=
"1735185038602皖信.png"
;
URL
url
=
ossUtil
.
getObjectUrl
(
null
,
src
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/SysHouseHoldInfoMapper.java
View file @
3661b067
...
...
@@ -62,4 +62,12 @@ public interface SysHouseHoldInfoMapper extends BaseMapper<SysHouseHoldInfo> {
* @return
*/
List
<
TSocialHouseholdExportVo
>
selectExportList
(
@Param
(
"sysHouseHoldInfo"
)
SysHouseHoldInfo
sysHouseHoldInfo
);
/**
* @Description: 获取自动生成解除劳动合同的户与公章
* @Author: hgw
* @Date: 2025/5/26 17:32
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.entity.SysHouseHoldInfo>
**/
List
<
SysHouseHoldInfo
>
getAttaSrcByAutoDoc
();
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/TAttaInfoMapper.java
View file @
3661b067
...
...
@@ -51,4 +51,7 @@ public interface TAttaInfoMapper extends BaseMapper<TAttaInfo> {
// 删除学历与职业资格之外的附件
void
deleteByDomainIdAndOther
(
@Param
(
"domainId"
)
String
domainId
);
// 获取离职证明模板
String
getLeaveDocTemplate
();
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/mapper/TDispatchInfoMapper.java
View file @
3661b067
...
...
@@ -304,4 +304,6 @@ public interface TDispatchInfoMapper extends BaseMapper<TDispatchInfo> {
* @return: java.util.List<java.lang.String>
**/
List
<
String
>
getSingleFlagMap
(
@Param
(
"idsList"
)
List
<
String
>
idsList
);
// 获取自动生成减员离职证明的派单ID
List
<
String
>
getAutoDocFlagMap
(
@Param
(
"idsList"
)
List
<
String
>
idsList
);
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TDispatchInfoServiceImpl.java
View file @
3661b067
...
...
@@ -3530,6 +3530,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
// 户配置为单个推送的派单
Map
<
String
,
String
>
singleFlagMap
=
new
HashMap
<>();
singleFlagMap
=
getSingleFlagMap
(
idsList
,
singleFlagMap
);
Map
<
String
,
String
>
autoDocMap
=
new
HashMap
<>();
autoDocMap
=
getAutoDocFlagMap
(
idsList
,
autoDocMap
);
if
(
Common
.
isNotNull
(
dispatchs
))
{
// 获取所有派单查询信息
Map
<
String
,
TSocialFundInfo
>
socialFundMap
=
initSocialFundMap
(
dispatchs
);
...
...
@@ -3855,6 +3857,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
dis
.
setIsSingle
(
isSingleAudit
);
dis
.
setIsAutoLeaveDoc
(
autoDocMap
.
get
(
dis
.
getId
()));
baseMapper
.
updateById
(
dis
);
socialFundMapper
.
updateById
(
sf
);
// 非(批量审核+审核为自动化+户配置为单个推送),才可以改社保
...
...
@@ -3943,6 +3946,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return
autoFlagMap
;
}
// 返回单个派单的map
private
Map
<
String
,
String
>
getSingleFlagMap
(
List
<
String
>
idsList
,
Map
<
String
,
String
>
singleFlagMap
)
{
List
<
String
>
singleFlagList
=
baseMapper
.
getSingleFlagMap
(
idsList
);
if
(
Common
.
isNotNull
(
singleFlagList
)){
...
...
@@ -3956,6 +3960,26 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return
singleFlagMap
;
}
// 返回需要自动生成离职证明的map
private
Map
<
String
,
String
>
getAutoDocFlagMap
(
List
<
String
>
idsList
,
Map
<
String
,
String
>
autoDocMap
)
{
List
<
String
>
singleFlagList
=
baseMapper
.
getAutoDocFlagMap
(
idsList
);
autoDocMap
=
getHuMap
(
autoDocMap
,
singleFlagList
);
return
autoDocMap
;
}
// 根据list返回map
private
Map
<
String
,
String
>
getHuMap
(
Map
<
String
,
String
>
singleFlagMap
,
List
<
String
>
singleFlagList
)
{
if
(
Common
.
isNotNull
(
singleFlagList
)){
if
(
Common
.
isNotNull
(
singleFlagMap
)){
singleFlagMap
=
new
HashMap
<>();
}
for
(
String
dispatchId
:
singleFlagList
){
singleFlagMap
.
put
(
dispatchId
,
CommonConstants
.
ONE_STRING
);
}
}
return
singleFlagMap
;
}
private
void
initReduceStatus
(
TSocialFundInfo
sf
,
TSocialInfo
socialInfo
)
{
// 各个明细项的可派减项为待办理
if
(
CommonConstants
.
ONE_STRING
.
equals
(
sf
.
getPensionHandle
())
||
CommonConstants
.
FOUR_STRING
.
equals
(
sf
.
getPensionHandle
())){
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TSocialFriendPushServiceImpl.java
View file @
3661b067
This diff is collapsed.
Click to expand it.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/WordToImageUtil.java
0 → 100644
View file @
3661b067
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
social
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.social.config.SocialFriendConfig
;
import
com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFriendBackLog
;
import
org.apache.pdfbox.pdmodel.PDDocument
;
import
org.apache.pdfbox.rendering.ImageType
;
import
org.apache.pdfbox.rendering.PDFRenderer
;
import
org.apache.poi.xwpf.usermodel.*
;
import
org.jodconverter.core.office.OfficeException
;
import
org.jodconverter.core.office.OfficeManager
;
import
org.jodconverter.local.LocalConverter
;
import
org.jodconverter.local.office.LocalOfficeManager
;
import
org.springframework.web.client.RestTemplate
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.*
;
import
java.nio.file.DirectoryNotEmptyException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author hgw
* @description word工具类
* @date 2025-5-26 16:03:05
*/
public
class
WordToImageUtil
{
private
static
final
String
PDF_TEMP
=
"\\test126666.docx"
;
private
static
final
String
IMAGE_TEMP
=
"\\document_with_seal.png"
;
private
static
final
String
TO_IMAGE_TEMP
=
"\\ToImgTemp.png"
;
private
static
final
String
TO_IMAG_OSS_ERROR
=
":WordToImage上传OSS异常"
;
public
static
String
replaceTextInWord
(
InputStream
templateFile
,
Map
<
String
,
String
>
replacements
,
InputStream
imageStream
,
RestTemplate
restTemplate
,
SocialFriendConfig
socialFriendConfig
,
TSocialFriendBackLog
backLog
)
{
String
projectRoot
=
System
.
getProperty
(
CommonConstants
.
USER_DIR
);
String
outputFilePath
=
projectRoot
+
PDF_TEMP
;
String
outputImagePath
=
projectRoot
+
IMAGE_TEMP
;
try
(
XWPFDocument
document
=
new
XWPFDocument
(
templateFile
))
{
// 替换段落中的文本
for
(
XWPFParagraph
paragraph
:
document
.
getParagraphs
())
{
for
(
String
key
:
replacements
.
keySet
())
{
if
(
paragraph
.
getText
().
contains
(
key
))
{
String
newText
=
paragraph
.
getText
().
replace
(
key
,
replacements
.
get
(
key
));
paragraph
.
getRuns
().
clear
();
XWPFRun
newRun
=
paragraph
.
createRun
();
newRun
.
setText
(
newText
);
}
}
}
String
text
;
// 替换表格中的文本
for
(
XWPFTable
table
:
document
.
getTables
())
{
for
(
XWPFTableRow
row
:
table
.
getRows
())
{
for
(
XWPFTableCell
cell
:
row
.
getTableCells
())
{
for
(
XWPFParagraph
p
:
cell
.
getParagraphs
())
{
for
(
XWPFRun
run
:
p
.
getRuns
())
{
text
=
run
.
getText
(
0
);
if
(
Common
.
isNotNull
(
text
)
&&
replacements
.
get
(
text
)
!=
null
)
{
run
.
setText
(
replacements
.
get
(
text
),
0
);
}
}
}
}
}
}
// 保存输出文件
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
outputFilePath
))
{
document
.
write
(
fos
);
}
return
convertAndAddSeal
(
outputFilePath
,
imageStream
,
outputImagePath
,
projectRoot
,
restTemplate
,
socialFriendConfig
,
backLog
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
Path
outputPath
=
Paths
.
get
(
outputFilePath
);
if
(
Files
.
exists
(
outputPath
))
{
try
{
Files
.
delete
(
outputPath
);
// 如果文件不存在会抛异常,先判断是否存在
}
catch
(
DirectoryNotEmptyException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
imageStream
!=
null
)
{
try
{
imageStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
"-"
;
}
// 在生产环境中,建议在整个应用生命周期中共享一个OfficeManager:
public
static
OfficeManager
OFFICE_MANAGER
;
static
{
OFFICE_MANAGER
=
LocalOfficeManager
.
builder
()
.
portNumbers
(
2003
)
.
build
();
try
{
OFFICE_MANAGER
.
start
();
}
catch
(
OfficeException
e
)
{
e
.
printStackTrace
();
}
}
public
static
String
convertAndAddSeal
(
String
inputDocx
,
InputStream
sealImagePath
,
String
outputImagePath
,
String
projectRoot
,
RestTemplate
restTemplate
,
SocialFriendConfig
socialFriendConfig
,
TSocialFriendBackLog
backLog
)
throws
IOException
,
OfficeException
{
File
pdfFile
=
null
;
File
imgFile
=
null
;
try
{
// Step 1: Word 转为 PDF(中间格式)
pdfFile
=
new
File
(
inputDocx
.
replace
(
".docx"
,
".pdf"
));
Map
<
String
,
Object
>
pdfProps
=
new
HashMap
<>();
pdfProps
.
put
(
"FilterName"
,
"writer_pdf_Export"
);
pdfProps
.
put
(
"SelectPdfVersion"
,
1
);
// PDF/A-1
LocalConverter
.
builder
()
.
officeManager
(
OFFICE_MANAGER
)
.
storeProperties
(
pdfProps
)
.
build
()
.
convert
(
new
File
(
inputDocx
))
.
to
(
pdfFile
)
.
execute
();
// Step 2: PDF 转为 PNG 图片(可使用 Apache PDFBox 或 ImageMagick 转换)
BufferedImage
pageImage
=
convertPdfToImage
(
pdfFile
.
getAbsolutePath
());
// Step 3: 加盖公章
BufferedImage
sealedImage
=
addSealToImage
(
pageImage
,
sealImagePath
);
imgFile
=
new
File
(
outputImagePath
);
// Step 4: 输出图片
ImageIO
.
write
(
sealedImage
,
"png"
,
imgFile
);
if
(
imgFile
.
exists
())
{
// file 压缩到1M以内
imgFile
=
compressImage
(
projectRoot
,
imgFile
);
String
key
=
System
.
currentTimeMillis
()
+
imgFile
.
getName
();
byte
[]
fileContent
=
Files
.
readAllBytes
(
imgFile
.
toPath
());
String
base64String
=
Base64
.
getEncoder
().
encodeToString
(
fileContent
);
String
url
=
socialFriendConfig
.
uploadPng
(
restTemplate
,
key
,
base64String
,
backLog
);
if
(
Common
.
isEmpty
(
url
)){
return
"--"
;
}
return
url
;
}
}
finally
{
if
(
pdfFile
!=
null
)
{
pdfFile
.
delete
();
}
if
(
imgFile
!=
null
)
{
imgFile
.
delete
();
}
}
return
"---"
;
}
private
static
File
compressImage
(
String
projectRoot
,
File
originalFile
)
throws
IOException
{
BufferedImage
image
=
ImageIO
.
read
(
originalFile
);
int
quality
=
100
;
// 从100%开始
File
compressedFile
=
new
File
(
projectRoot
,
TO_IMAGE_TEMP
);
int
maxSize
=
1024
*
1024
;
while
(
originalFile
.
length
()
>
maxSize
&&
quality
>
10
)
{
quality
-=
5
;
ImageIO
.
write
(
image
,
"png"
,
compressedFile
);
if
(
compressedFile
.
length
()
<
maxSize
)
{
originalFile
.
delete
();
compressedFile
.
renameTo
(
originalFile
);
break
;
}
compressedFile
.
delete
();
}
return
originalFile
;
}
private
static
BufferedImage
convertPdfToImage
(
String
pdfPath
)
throws
IOException
{
try
(
PDDocument
document
=
PDDocument
.
load
(
new
File
(
pdfPath
)))
{
PDFRenderer
pdfRenderer
=
new
PDFRenderer
(
document
);
// 渲染第一页为图像,分辨率为 300 DPI
return
pdfRenderer
.
renderImageWithDPI
(
0
,
300
,
ImageType
.
RGB
);
}
}
private
static
BufferedImage
addSealToImage
(
BufferedImage
image
,
InputStream
sealImagePath
)
throws
IOException
{
BufferedImage
seal
=
ImageIO
.
read
(
sealImagePath
);
BufferedImage
combined
=
new
BufferedImage
(
image
.
getWidth
(),
image
.
getHeight
(),
BufferedImage
.
TYPE_INT_ARGB
);
Graphics2D
g
=
combined
.
createGraphics
();
g
.
drawImage
(
image
,
0
,
0
,
null
);
// 设置公章位置(右下角)
int
x
=
1600
;
int
y
=
1150
;
g
.
drawImage
(
seal
,
x
,
y
,
null
);
g
.
dispose
();
return
combined
;
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/WordToImageWithSeal.java
View file @
3661b067
...
...
@@ -3,7 +3,6 @@ package com.yifu.cloud.plus.v1.yifu.social.util;
import
org.apache.pdfbox.pdmodel.PDDocument
;
import
org.apache.pdfbox.rendering.ImageType
;
import
org.apache.pdfbox.rendering.PDFRenderer
;
import
org.jodconverter.core.document.DefaultDocumentFormatRegistry
;
import
org.jodconverter.core.office.OfficeException
;
import
org.jodconverter.core.office.OfficeManager
;
import
org.jodconverter.local.LocalConverter
;
...
...
@@ -25,19 +24,6 @@ import java.util.Map;
*/
public
class
WordToImageWithSeal
{
// 主方法用于测试或外部调用
/*public static void main(String[] args) {
String inputDocx = "D:/test/document.docx";
String sealImagePath = "D:/seal/seal.png";
String outputImagePath = "D:/output/document_with_seal.png";
try {
convertAndAddSeal(inputDocx, sealImagePath, outputImagePath);
System.out.println("转换并加盖公章成功!");
} catch (Exception e) {
e.printStackTrace();
}
}*/
// 在生产环境中,建议在整个应用生命周期中共享一个OfficeManager:
public
static
OfficeManager
OFFICE_MANAGER
;
static
{
...
...
@@ -54,8 +40,6 @@ public class WordToImageWithSeal {
// Step 1: Word 转为 PDF(中间格式)
File
pdfFile
=
new
File
(
inputDocx
.
replace
(
".docx"
,
".pdf"
));
/*converter.convert(new File(inputDocx)).as(DocumentType.DOCX)
.to(pdfFile).as(DocumentType.PDF).execute();*/
Map
<
String
,
Object
>
pdfProps
=
new
HashMap
<>();
pdfProps
.
put
(
"FilterName"
,
"writer_pdf_Export"
);
pdfProps
.
put
(
"SelectPdfVersion"
,
1
);
// PDF/A-1
...
...
@@ -75,7 +59,6 @@ public class WordToImageWithSeal {
// Step 4: 输出图片
ImageIO
.
write
(
sealedImage
,
"png"
,
new
File
(
outputImagePath
));
//ImageIO.write(sealedImage, "png", new File(outputImagePath));
}
private
static
BufferedImage
convertPdfToImage
(
String
pdfPath
)
throws
IOException
{
...
...
yifu-social/yifu-social-biz/src/main/resources/mapper/SysHouseHoldInfoMapper.xml
View file @
3661b067
...
...
@@ -228,4 +228,11 @@
</where>
order by a.CREATE_TIME desc
</select>
<!-- 获取自动生成解除劳动合同书的户与公章src -->
<select
id=
"getAttaSrcByAutoDoc"
resultMap=
"sysHouseHoldSingleInfoMap"
>
SELECT h.NAME NAME,a.ATTA_SRC TYPE
FROM t_atta_info a join sys_house_hold_info h on h.id=a.DOMAIN_ID
where a.RELATION_TYPE = '1' and h.IS_AUTO_LEAVE_DOC = '1'
</select>
</mapper>
yifu-social/yifu-social-biz/src/main/resources/mapper/TAttaInfoMapper.xml
View file @
3661b067
...
...
@@ -135,4 +135,10 @@
delete from t_atta_info where domain_id=#{domainId} and relation_type not in ('0','2','26','27')
</delete>
<select
id=
"getLeaveDocTemplate"
resultType=
"java.lang.String"
>
SELECT
a.atta_src
FROM t_atta_info a where a.id = "1";
</select>
</mapper>
yifu-social/yifu-social-biz/src/main/resources/mapper/TDispatchInfoMapper.xml
View file @
3661b067
...
...
@@ -105,6 +105,7 @@
<result
property=
"graduationTime"
column=
"GRADUATION_TIME"
/>
<result
property=
"autoFlag"
column=
"AUTO_FLAG"
/>
<result
property=
"isSingle"
column=
"IS_SINGLE"
/>
<result
property=
"isAutoLeaveDoc"
column=
"IS_AUTO_LEAVE_DOC"
/>
</resultMap>
<resultMap
id=
"dispatchPageMap"
type=
"com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoPageVo"
extends=
"tDispatchInfoMap"
>
...
...
@@ -435,6 +436,7 @@
a.MAJOR,
a.FIRST_PAY_TIME,
a.GRADUATION_TIME,a.AUTO_FLAG,a.IS_SINGLE
,a.IS_AUTO_LEAVE_DOC
</sql>
<sql
id=
"tDispatchInfo_where"
>
<if
test=
"tDispatchInfo != null"
>
...
...
@@ -2762,4 +2764,16 @@
#{item}
</foreach>
</select>
<select
id=
"getAutoDocFlagMap"
resultType=
"java.lang.String"
>
select a.id as "dispatchId"
FROM t_dispatch_info a
LEFT JOIN sys_house_hold_info b on a.SOCIAL_HOUSEHOLD_NAME=b.`NAME` and b.TYPE='0'
where a.SOCIAL_HOUSEHOLD_NAME is not null
and b.IS_AUTO_LEAVE_DOC='1'
and a.id in
<foreach
item=
"item"
index=
"index"
collection=
"idsList"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
</mapper>
yifu-social/yifu-social-biz/src/main/resources/mapper/TSocialFriendMapper.xml
View file @
3661b067
...
...
@@ -81,6 +81,10 @@
s.SOCIAL_TOWN socialTown,
a.SCHOOL_NAME byyx,
a.IS_SINGLE isSingle,
a.IS_AUTO_LEAVE_DOC isAutoLeaveDoc,
DATE_FORMAT(a.LEAVE_DATE,'%Y年%m月%d日') leaveDate,
DATE_FORMAT(a.create_time,'%Y年%m月%d日') dispatchDate,
a.settle_domain deptId,
a.ID dispatchId
</sql>
...
...
@@ -225,6 +229,10 @@
s.SOCIAL_TOWN socialTown,
a.SCHOOL_NAME byyx,
a.IS_SINGLE isSingle,
a.IS_AUTO_LEAVE_DOC isAutoLeaveDoc,
DATE_FORMAT(a.LEAVE_DATE,'%Y年%m月%d日') leaveDate,
DATE_FORMAT(a.create_time,'%Y年%m月%d日') dispatchDate,
a.settle_domain deptId,
a.ID dispatchId
<include
refid=
"getSocialSoldierBaseTwo"
/>
and a.type = '1' and s.YSD_HANDLE_STATUS in ('0','1','3')
...
...
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