Commit 5a75dff4 authored by hongguangwu's avatar hongguangwu

MVP1.7.15-税友模板

parent 97cb8b41
...@@ -57,11 +57,11 @@ public class TAttaInfo extends BaseEntity { ...@@ -57,11 +57,11 @@ public class TAttaInfo extends BaseEntity {
@Schema(description = "资源类型") @Schema(description = "资源类型")
private String attaType; private String attaType;
/** /**
* 1户配置的章;2:派单审核附件,税友单个使用,社保3医保附件 * 1户配置的章;2:派单审核附件,税友单个使用,社保3医保附件;11社保增花名册模板;12社保减花名册模板;13医保增花名册模板;14医保减花名册模板
*/ */
@NotBlank(message = "关系类型不能为空") @NotBlank(message = "关系类型不能为空")
@Length(max = 2, message = "关系类型不能超过2个字符") @Length(max = 2, message = "关系类型不能超过2个字符")
@Schema(description = "关系类型(1户配置的章;2:派单审核附件,税友单个使用,社保;3医保附件)") @Schema(description = "关系类型(1户配置的章;2:派单审核附件,税友单个使用,社保;3医保附件;11社保增花名册模板;12社保减花名册模板;13医保增花名册模板;14医保减花名册模板)")
private String relationType; private String relationType;
/** /**
* 实体id和关系类型共同确定附件所属(9、10、21、22、23、24、25存项目档案id,0、2、26存附属表id) * 实体id和关系类型共同确定附件所属(9、10、21、22、23、24、25存项目档案id,0、2、26存附属表id)
......
...@@ -54,6 +54,9 @@ public interface TAttaInfoMapper extends BaseMapper<TAttaInfo> { ...@@ -54,6 +54,9 @@ public interface TAttaInfoMapper extends BaseMapper<TAttaInfo> {
// 获取离职证明模板 // 获取离职证明模板
String getLeaveDocTemplate(); String getLeaveDocTemplate();
// 税友花名册模板ID:11、12、13、14 (社保增减,医保增减) // 税友花名册模板ID:11、12、13、14 (社保增减,医保增减)
String getTemplateSrcById(@Param("id") String id); List<TAttaInfo> getTemplateSrcById();
// 1:户配置的章,11社保增花名册模板;12社保减花名册模板;13医保增花名册模板;14医保减花名册模板
String getTemplateSrcByIdAndType(@Param("domainId") String domainId, @Param("relationType") String relationType);
} }
...@@ -114,16 +114,27 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -114,16 +114,27 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
TSocialFreindSet set = tSocialFreindSetService.getById("1"); TSocialFreindSet set = tSocialFreindSetService.getById("1");
if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) { if (set != null && Common.isNotNull(set.getType()) && 1 == set.getType()) {
// 通用的模板+查到的户的模板map
Map<String, URL> templateSrcMap = new HashMap<>();
// 通用的花名册模板
List<TAttaInfo> srcList = attaInfoMapper.getTemplateSrcById();
URL url;
if (srcList != null && !srcList.isEmpty()) {
for (TAttaInfo src : srcList) {
url = ossUtil.getObjectUrl(null, src.getAttaSrc());
templateSrcMap.put("template_" + src.getId(), url);
}
}
// 离职原因Map,将离职原因翻译为税友的字典 // 离职原因Map,将离职原因翻译为税友的字典
Map<String, TSocialFriendReduceSet> reduceYgsMap = tSocialFriendReduceSetService.getFriendReduceMap(CommonConstants.ONE_STRING); Map<String, TSocialFriendReduceSet> reduceYgsMap = tSocialFriendReduceSetService.getFriendReduceMap(CommonConstants.ONE_STRING);
Map<String, TSocialFriendReduceSet> reduceYsdMap = tSocialFriendReduceSetService.getFriendReduceMap(CommonConstants.TWO_STRING); Map<String, TSocialFriendReduceSet> reduceYsdMap = tSocialFriendReduceSetService.getFriendReduceMap(CommonConstants.TWO_STRING);
// 获取时间限制配置(获取 当月启用 的配置) // 获取时间限制配置(获取 当月启用 的配置)
Map<String, TSocialDeadlineInfo> socialSetMap = tSocialDeadlineInfoService.getSocialSetByAreaId(); Map<String, TSocialDeadlineInfo> socialSetMap = tSocialDeadlineInfoService.getSocialSetByAreaId();
// 所有的章
List<SysHouseHoldInfo> zhangList = houseHoldInfoMapper.getAttaSrcByAutoDoc(); List<SysHouseHoldInfo> zhangList = houseHoldInfoMapper.getAttaSrcByAutoDoc();
Map<String, URL> zhangMap = new HashMap<>(); Map<String, URL> zhangMap = new HashMap<>();
if (zhangList != null && !zhangList.isEmpty()) { if (zhangList != null && !zhangList.isEmpty()) {
URL url;
for (SysHouseHoldInfo zhang : zhangList) { for (SysHouseHoldInfo zhang : zhangList) {
url = ossUtil.getObjectUrl(null, zhang.getType()); url = ossUtil.getObjectUrl(null, zhang.getType());
zhangMap.put(zhang.getName(), url); zhangMap.put(zhang.getName(), url);
...@@ -139,23 +150,23 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -139,23 +150,23 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
// 养工失新增列表 // 养工失新增列表
List<SociaFriendYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList); List<SociaFriendYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) { if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
return this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1, reduceYgsMap, zhangMap, templateUrl); return this.doPushSocialAndLogYgs(socialSetMap, ygsAddlist, 1, reduceYgsMap, zhangMap, templateUrl, templateSrcMap);
} }
// 养工失减少列表 // 养工失减少列表
List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList); List<SociaFriendYgsAddVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) { if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
return this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2, reduceYgsMap, zhangMap, templateUrl); return this.doPushSocialAndLogYgs(socialSetMap, ygsReducelist, 2, reduceYgsMap, zhangMap, templateUrl, templateSrcMap);
} }
// 医生大新增列表 // 医生大新增列表
List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList); List<SociaFriendYgsAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) { if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3, reduceYsdMap, zhangMap, templateUrl); this.doPushSocialAndLogYsd(socialSetMap, ysdAddlist, 3, reduceYsdMap, zhangMap, templateUrl, templateSrcMap);
} }
// 医生大减少列表 // 医生大减少列表
List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList); List<SociaFriendYgsAddVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) { if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4, reduceYsdMap, zhangMap, templateUrl); this.doPushSocialAndLogYsd(socialSetMap, ysdReducelist, 4, reduceYsdMap, zhangMap, templateUrl, templateSrcMap);
} }
if ((ygsAddlist == null || ygsAddlist.isEmpty()) if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty()) && (ygsReducelist == null || ygsReducelist.isEmpty())
...@@ -183,7 +194,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -183,7 +194,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
**/ **/
private R<String> doPushSocialAndLogYgs(Map<String, TSocialDeadlineInfo> socialSetMap private R<String> doPushSocialAndLogYgs(Map<String, TSocialDeadlineInfo> socialSetMap
, List<SociaFriendYgsAddVo> ygsAddlist, int type, Map<String, TSocialFriendReduceSet> reduceMap , List<SociaFriendYgsAddVo> ygsAddlist, int type, Map<String, TSocialFriendReduceSet> reduceMap
, Map<String, URL> zhangMap, URL templateUrl) { , Map<String, URL> zhangMap, URL templateUrl, Map<String, URL> templateSrcMap) {
int canPushType; int canPushType;
TSocialInfo socialInfo; TSocialInfo socialInfo;
String typeStr = "提交"; String typeStr = "提交";
...@@ -255,7 +266,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -255,7 +266,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
&& CommonConstants.ONE_STRING.equals(vo.getIsAutoLeaveDoc()); && CommonConstants.ONE_STRING.equals(vo.getIsAutoLeaveDoc());
if (isAutoLeaveDoc || isSingle || nextFlag || i % 10 == 0 || index >= ygsAddlist.size()-1) { if (isAutoLeaveDoc || isSingle || nextFlag || i % 10 == 0 || index >= ygsAddlist.size()-1) {
urlR = doExportRosterNew(vo, type, listVo); urlR = doExportRosterNew(vo, type, listVo, zhangMap, templateSrcMap);
// 房工接口,获取 企业职工社会保险增员花名册 url // 房工接口,获取 企业职工社会保险增员花名册 url
// urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode(), listVo) // urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode(), listVo)
if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) { if (urlR != null && urlR.getCode() == 200 && Common.isNotNull(urlR.getData())) {
...@@ -439,7 +450,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -439,7 +450,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
**/ **/
private void doPushSocialAndLogYsd(Map<String, TSocialDeadlineInfo> socialSetMap private void doPushSocialAndLogYsd(Map<String, TSocialDeadlineInfo> socialSetMap
, List<SociaFriendYgsAddVo> ysdAddlist, int type, Map<String, TSocialFriendReduceSet> reduceMap , List<SociaFriendYgsAddVo> ysdAddlist, int type, Map<String, TSocialFriendReduceSet> reduceMap
, Map<String, URL> zhangMap, URL templateUrl) { , Map<String, URL> zhangMap, URL templateUrl, Map<String, URL> templateSrcMap) {
int canPushType; int canPushType;
TSocialInfo socialInfo; TSocialInfo socialInfo;
String typeStr = "提交"; String typeStr = "提交";
...@@ -526,7 +537,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -526,7 +537,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
&& CommonConstants.ONE_STRING.equals(vo.getIsAutoLeaveDoc()); && CommonConstants.ONE_STRING.equals(vo.getIsAutoLeaveDoc());
if (isAutoLeaveDoc || isSingle || nextFlag || i % 10 == 0 || index >= ysdAddlist.size()-1) { if (isAutoLeaveDoc || isSingle || nextFlag || i % 10 == 0 || index >= ysdAddlist.size()-1) {
urlR = doExportRosterNew(vo, type, listVo); urlR = doExportRosterNew(vo, type, listVo, zhangMap, templateSrcMap);
// 房工接口,获取 企业职工基本医疗保险参保登记表 url // 房工接口,获取 企业职工基本医疗保险参保登记表 url
//urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode(), listVo); //urlR = doExportRoster(vo.getSocialId(), String.valueOf(type), vo.getUnitCreditCode(), listVo);
...@@ -721,22 +732,14 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -721,22 +732,14 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
* @Date 15:58 2024/12/10 * @Date 15:58 2024/12/10
* @Param socialId:社保明细ID type: 1 社保增 2社保减 3 医保增 4 医保减 unitCreditCode:单位统一信用代码 * @Param socialId:社保明细ID type: 1 社保增 2社保减 3 医保增 4 医保减 unitCreditCode:单位统一信用代码
**/ **/
private R<String> doExportRosterNew(SociaFriendYgsAddVo vo, int type, List<SociaFriendYgsAddVo> listVo) { private R<String> doExportRosterNew(SociaFriendYgsAddVo vo, int type, List<SociaFriendYgsAddVo> listVo
,Map<String, URL> zhangMap, Map<String, URL> templateSrcMap) {
if (vo == null || Common.isEmpty(listVo)) { if (vo == null || Common.isEmpty(listVo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
TAttaInfo att = attaInfoMapper.selectOne(Wrappers.<TAttaInfo>query().lambda()
.eq(TAttaInfo::getDomainId, vo.getHuId()).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(att)) {
return R.failed("获取电子印章信息失败");
}
String fileName = DispatchConstants.SOCIAL_MEDICAL_EXPORT + vo.getSocialHouseholdName() + "_" + vo.getSocialId() + CommonConstants.XLS;
String projectRoot = System.getProperty(CommonConstants.USER_DIR);
String filePath = projectRoot + CommonConstants.DOUBLE_LINE + fileName;
//社保增减 //社保增减
return doExportRosterSocialNew(vo, type, listVo, fileName, projectRoot, filePath, att.getAttaSrc()); return doExportRosterSocialNew(vo, type, listVo, zhangMap, templateSrcMap);
} }
/** /**
...@@ -1038,26 +1041,53 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -1038,26 +1041,53 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
* @Description 社保增减花名册 * @Description 社保增减花名册
* @Date 2025-9-3 16:20:32 * @Date 2025-9-3 16:20:32
**/ **/
public R<String> doExportRosterSocialNew(SociaFriendYgsAddVo vo, int type, List<SociaFriendYgsAddVo> listVo, public R<String> doExportRosterSocialNew(SociaFriendYgsAddVo vo, int type, List<SociaFriendYgsAddVo> listVo
String fileName, , Map<String, URL> zhangMap, Map<String, URL> templateSrcMap) {
String projectRoot, String huId = vo.getHuId();
String filePath, URL url = zhangMap.get(vo.getSocialHouseholdName());
String src) { if (Common.isEmpty(url)) {
TAttaInfo att = attaInfoMapper.selectOne(Wrappers.<TAttaInfo>query().lambda()
.eq(TAttaInfo::getDomainId, huId).last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(att)) {
return R.failed("获取电子印章信息失败");
}
url = ossUtil.getObjectUrl(null, att.getAttaSrc());
zhangMap.put(vo.getSocialHouseholdName(), url);
}
String fileName = DispatchConstants.SOCIAL_MEDICAL_EXPORT + vo.getSocialHouseholdName() + "_" + vo.getSocialId() + CommonConstants.XLS;
String projectRoot = System.getProperty(CommonConstants.USER_DIR);
String filePath = projectRoot + CommonConstants.DOUBLE_LINE + fileName;
//获取要导出的列表 //获取要导出的列表
List<TDispatchSocialPersionExportVo> list = new ArrayList<>(); List<TDispatchSocialPersionExportVo> list = new ArrayList<>();
ExcelWriter excelWriter = null; ExcelWriter excelWriter = null;
File createFile = null; File createFile = null;
try { try {
String templateId = "11";
String templateId = "template_11";
String relationType = "11";
if (type == CommonConstants.TWO_INT) { if (type == CommonConstants.TWO_INT) {
templateId = "12"; templateId = "template_12";
relationType = "12";
} else if (type == CommonConstants.THREE_INT) { } else if (type == CommonConstants.THREE_INT) {
templateId = "13"; templateId = "template_13";
relationType = "13";
} else if (type == CommonConstants.FOUR_INT) { } else if (type == CommonConstants.FOUR_INT) {
templateId = "14"; templateId = "template_14";
relationType = "14";
}
String huKey = type + CommonConstants.DOWN_LINE_STRING + huId;
URL templateUrl = templateSrcMap.get(huKey);
if (Common.isEmpty(templateUrl)) {
String templateSrc = attaInfoMapper.getTemplateSrcByIdAndType(huId, relationType);
if (Common.isNotNull(templateSrc)) {
templateUrl = ossUtil.getObjectUrl(null, templateSrc);
} else {
templateUrl = templateSrcMap.get(templateId);
templateSrcMap.put(huKey, templateUrl);
}
} }
String templateSrc = attaInfoMapper.getTemplateSrcById(templateId);
URL templateUrl = ossUtil.getObjectUrl(null, templateSrc);
if (Common.isEmpty(templateUrl)) { if (Common.isEmpty(templateUrl)) {
return R.failed(CommonConstants.RESULT_DATA_FAIL + ":花名册模板OSS获取URL异常"); return R.failed(CommonConstants.RESULT_DATA_FAIL + ":花名册模板OSS获取URL异常");
} }
...@@ -1098,7 +1128,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe ...@@ -1098,7 +1128,7 @@ public class TSocialFriendPushServiceImpl extends ServiceImpl<TSocialFriendMappe
String tempPath = projectRoot + "//temp_" + fileName; String tempPath = projectRoot + "//temp_" + fileName;
tempFile = new File(tempPath); tempFile = new File(tempPath);
fileOUt = new FileOutputStream(tempFile); fileOUt = new FileOutputStream(tempFile);
URL url = ossUtil.getObjectUrl(null, src);
if (Common.isEmpty(url)) { if (Common.isEmpty(url)) {
return R.failed(CommonConstants.RESULT_DATA_FAIL + ":电子印章OSS获取URL异常"); return R.failed(CommonConstants.RESULT_DATA_FAIL + ":电子印章OSS获取URL异常");
} }
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
<select id="getAttaSrcByAutoDoc" resultMap="sysHouseHoldSingleInfoMap" > <select id="getAttaSrcByAutoDoc" resultMap="sysHouseHoldSingleInfoMap" >
SELECT h.NAME NAME,a.ATTA_SRC TYPE 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 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' where a.RELATION_TYPE = '1'
</select> </select>
<select id="getHouseInfoAutoDoc" resultMap="sysHouseHoldInfoMap" > <select id="getHouseInfoAutoDoc" resultMap="sysHouseHoldInfoMap" >
......
...@@ -144,10 +144,19 @@ ...@@ -144,10 +144,19 @@
</select> </select>
<!-- 税友花名册模板ID:11、12、13、14 (社保增减,医保增减)--> <!-- 税友花名册模板ID:11、12、13、14 (社保增减,医保增减)-->
<select id="getTemplateSrcById" resultType="java.lang.String"> <select id="getTemplateSrcById" resultMap="tAttaInfoMap">
SELECT SELECT
a.id,
a.atta_src a.atta_src
FROM t_atta_info a where a.id = #{id} FROM t_atta_info a where a.id in ('11','12','13','14')
</select>
<!-- 1:户配置的章,11社保增花名册模板;12社保减花名册模板;13医保增花名册模板;14医保减花名册模板-->
<select id="getTemplateSrcByIdAndType" resultType="java.lang.String">
SELECT
a.atta_src
FROM t_atta_info a where a.domain_id = #{domainId} and a.relation_type = #{relationType}
limit 1
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment