Commit 92583dfb authored by hongguangwu's avatar hongguangwu

MVP1.7.18-税友分支(强制参保+是否批量+医疗金额判断)

parent b0ea3de8
......@@ -153,5 +153,11 @@ public class TFascTemplateDetail extends BaseEntity {
@TableField(exist = false)
@Schema(description = "字段格式化或键值对")
private String fieldValue;
/**
* 公司主体Id
*/
@TableField(exist = false)
@Schema(description = "公司主体Id")
private String companyId;
}
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.FascUtil;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateSearchVo;
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.OSSUtil;
......@@ -84,27 +85,34 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
List<TFascCompany> companyList = tFascCompanyService.getTFascCompanyAllList();
if (companyList != null && !companyList.isEmpty()) {
// templateName 签署任务模板名称
List<TFascTemplate> tList = new ArrayList<>();
List<TFascTemplate> tList ;
List<SignTemplateListInfo> listSubList;
List<TFascTemplate> tempList;
List<TFascTemplateDetail> detailList = new ArrayList<>();
List<TFascTemplateDetail> detailSubList;
List<TFascTemplateDetail> detailList ;
// 重试次数
int maxRetries = 3;
// 是否全部成功,若为false,则说明有失败的,不删除未找到的。
boolean success;
Exception lastException;
// 20秒后重试、40秒后重试、60秒后重试
long millis = 20000;
for (TFascCompany company : companyList) {
listSubList = null;
try {
listSubList = fascUtil.getTemplateList(templateName, tFascPushLogService, company);
} catch (Exception e) {
logger.error("法大大获取模板信息失败", e);
}
if (listSubList != null && !listSubList.isEmpty()) {
detailSubList = new ArrayList<>();
tempList = new ArrayList<>();
detailList = new ArrayList<>();
tList = new ArrayList<>();
success = false;
lastException = null;
for (int attempt = 0; attempt < maxRetries && !success; attempt++) {
// 重试,要重置
detailList = new ArrayList<>();
tList = new ArrayList<>();
try {
fascUtil.getTemplateDetailList(listSubList, tempList, detailSubList, tFascPushLogService, company);
fascUtil.getTemplateDetailList(listSubList, tList, detailList, tFascPushLogService, company);
success = true;
} catch (Exception e) {
lastException = e;
......@@ -120,14 +128,6 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
if (!success) {
logger.error("法大大获取模板详情,重试 " + maxRetries + " 次依然失败", lastException);
continue;
}
if (!tempList.isEmpty() && !detailSubList.isEmpty()) {
tList.addAll(tempList);
detailList.addAll(detailSubList);
}
}
}
// 拉取到数据再更新:
......@@ -141,10 +141,14 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
List<TFascTemplate> updateMain = new ArrayList<>();
List<TFascTemplateDetail> updateDetail = new ArrayList<>();
// TODO - 这里后期要分每个公司去拉取
List<TFascTemplate> allMain = tFascTemplateService.getTFascTemplateListAll(null);
// TODO - 这里后期要分每个公司去拉取
List<TFascTemplateDetail> allDetail = tFascTemplateDetailService.getTFascTemplateDetailList(null);
// 分每个公司去拉取
TFascTemplateSearchVo searchMain = new TFascTemplateSearchVo();
searchMain.setCompanyId(company.getId());
List<TFascTemplate> allMain = tFascTemplateService.getTFascTemplateListAll(searchMain);
// 分每个公司去拉取
TFascTemplateDetail searchDetail = new TFascTemplateDetail();
searchDetail.setCompanyId(company.getId());
List<TFascTemplateDetail> allDetail = tFascTemplateDetailService.getTFascTemplateDetailList(searchDetail);
List<TFascEditLog> logList = new ArrayList<>();
if (allMain == null || allMain.isEmpty()) {
// 都是新的:
......@@ -181,11 +185,13 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
updateMain.add(t);
oldMainMap.remove(t.getSignTemplateId());
}
if (success) {
for (TFascTemplate t : oldMainMap.values()) {
this.addFascLogToList(t.getId(), CommonConstants.ONE_STRING, editContent2, logList, userId, userName);
t.setDeleteFlag(CommonConstants.DELETE_FLAG);
updateMain.add(t);
}
}
// 映射表:
TFascTemplateDetail oldDetail;
for (TFascTemplateDetail t : detailList) {
......@@ -202,12 +208,14 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
updateDetail.add(t);
oldDetailMap.remove(t.getSignTemplateId() + CommonConstants.DOWN_LINE_STRING + t.getFascFieldId());
}
if (success) {
for (TFascTemplateDetail t : oldDetailMap.values()) {
this.addFascLogToList(t.getId(), CommonConstants.TWO_STRING, editContent2, logList, userId, userName);
t.setDeleteFlag(CommonConstants.DELETE_FLAG);
updateDetail.add(t);
}
}
}
// 更新日志
if (!logList.isEmpty()) {
tFascEditLogService.saveBatch(logList);
......@@ -220,10 +228,13 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
if (!updateDetail.isEmpty()) {
tFascTemplateDetailService.saveOrUpdateBatch(updateDetail);
}
}
}
}
// 重新刷新主模板表的必填是否已填
tFascTemplateDetailService.initFascTemplateIsMust(null);
}
}
return R.ok();
}
......
......@@ -251,7 +251,16 @@ public class FascUtil {
pushLog.setTypeName("获取明细映射");
tFascPushLogService.save(pushLog);
try {
res = templateClient.getSignTemplateDetail(signTemplateDetailReq);
} catch (Exception e) {
try {
Thread.sleep(5000); // Wait 5 seconds
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
res = templateClient.getSignTemplateDetail(signTemplateDetailReq);
}
if (res != null) {
// 更新日志
......
......@@ -144,6 +144,9 @@
<if test="tFascTemplateDetail.contractType != null and tFascTemplateDetail.contractType.trim() != ''">
AND b.contract_type = #{tFascTemplateDetail.contractType}
</if>
<if test="tFascTemplateDetail.companyId != null and tFascTemplateDetail.companyId.trim() != ''">
AND b.company_id = #{tFascTemplateDetail.companyId}
</if>
</if>
</sql>
<!--tFascTemplateDetail简单分页查询-->
......
......@@ -269,4 +269,23 @@ public class TSocialHouseholdInsertVo extends RowIndex implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医保仅补缴生成材料")
private String dataFlagYsd;
/**
* 推送时,社保是否单个接口 0批量1单个(为空,则随isSingle)
*/
@ExcelAttribute(name = "社保推送税友接口通道" )
@Schema(description ="社保推送税友接口通道")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保推送税友接口通道")
private String isSingleYgsPush;
/**
* 推送时,医保是否单个接口 0批量1单个(为空,则随isSingleYsd)
*/
@ExcelAttribute(name = "医保推送税友接口通道" )
@Schema(description ="医保推送税友接口通道")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医保推送税友接口通道")
private String isSingleYsdPush;
}
......@@ -270,4 +270,22 @@ public class TSocialHouseholdUpdateVo extends RowIndex implements Serializable {
@ExcelProperty("医保仅补缴生成材料")
private String dataFlagYsd;
/**
* 推送时,社保是否单个接口 0批量1单个(为空,则随isSingle)
*/
@ExcelAttribute(name = "社保推送税友接口通道" )
@Schema(description ="社保推送税友接口通道")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保推送税友接口通道")
private String isSingleYgsPush;
/**
* 推送时,医保是否单个接口 0批量1单个(为空,则随isSingleYsd)
*/
@ExcelAttribute(name = "医保推送税友接口通道" )
@Schema(description ="医保推送税友接口通道")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医保推送税友接口通道")
private String isSingleYsdPush;
}
......@@ -933,6 +933,8 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
household.setHouseType(excel.getHouseType().equals(HouseConfigConstants.HOUSE_TYPE_ONE) ? "1" : "0");
household.setAuditUser(null == auditUser.getUserId() ? "" : auditUser.getUserId());
household.setHandleUser(null == handlerUser.getUserId() ? "" :handlerUser.getUserId());
// 初始化
household.setIsSingleYgsPush(null);
//如果社保自动化为是时,才更新 推送类型、是否生成花名册、是否仅补缴生成材料、
if (CommonConstants.ZERO_STRING.equals(household.getAutoStatus())){
if (Common.isNotNull(excel.getRosterAutoFlagYgs())){
......@@ -947,13 +949,27 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
}
if (Common.isNotNull(excel.getIsSingle())){
household.setIsSingle(excel.getIsSingle().equals(HouseConfigConstants.IS_SINGLE_NO) ? "0" : "1");
if (excel.getIsSingle().equals(HouseConfigConstants.IS_SINGLE_NO)) {
household.setIsSingle(CommonConstants.ZERO_STRING);
} else {
household.setIsSingle(CommonConstants.ONE_STRING);
// MVP 1.7.18,单个里,加了接口通道:
if (Common.isNotNull(excel.getIsSingleYgsPush())) {
if (HouseConfigConstants.IS_SINGLE_NO.equals(excel.getIsSingleYgsPush())) {
household.setIsSingleYgsPush(CommonConstants.ZERO_STRING);
} else if (HouseConfigConstants.IS_SINGLE_YES.equals(excel.getIsSingleYgsPush())) {
household.setIsSingleYgsPush(CommonConstants.ONE_STRING);
}
}
}
}
}else {
household.setRosterAutoFlagYgs(null);
household.setDataFlagYgs(null);
household.setIsSingle(null);
}
// 初始化
household.setIsSingleYsdPush(null);
//如果医保自动化为是时,才更新 推送类型、是否生成花名册、是否仅补缴生成材料、
if (CommonConstants.ZERO_STRING.equals(household.getAutoStatusYsd())){
if (Common.isNotNull(excel.getRosterAutoFlagYsd())){
......@@ -968,8 +984,21 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
}
if (Common.isNotNull(excel.getIsSingleYsd())){
household.setIsSingleYsd(excel.getIsSingleYsd().equals(HouseConfigConstants.IS_SINGLE_NO) ? "0" : "1");
if (excel.getIsSingleYsd().equals(HouseConfigConstants.IS_SINGLE_NO)) {
household.setIsSingleYsd(CommonConstants.ZERO_STRING);
} else {
household.setIsSingleYsd(CommonConstants.ONE_STRING);
// MVP 1.7.18,单个里,加了接口通道:
if (Common.isNotNull(excel.getIsSingleYsdPush())) {
if (HouseConfigConstants.IS_SINGLE_NO.equals(excel.getIsSingleYsdPush())) {
household.setIsSingleYsdPush(CommonConstants.ZERO_STRING);
} else if (HouseConfigConstants.IS_SINGLE_YES.equals(excel.getIsSingleYsdPush())) {
household.setIsSingleYsdPush(CommonConstants.ONE_STRING);
}
}
}
}
}else {
household.setRosterAutoFlagYsd(null);
household.setDataFlagYsd(null);
......@@ -1304,10 +1333,24 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
if (Common.isNotNull(excel.getAutoStatusYsd())) {
info.setAutoStatusYsd(excel.getAutoStatusYsd().equals(CommonConstants.IS_TRUE) ? "0" : "1");
}
info.setIsSingleYgsPush(null);
if (CommonConstants.ZERO_STRING.equals(info.getAutoStatus())){
if (Common.isNotNull(excel.getIsSingle())) {
info.setIsSingle(excel.getIsSingle().equals(HouseConfigConstants.IS_SINGLE_NO) ? "0" : "1");
if (Common.isNotNull(excel.getIsSingle())){
if (excel.getIsSingle().equals(HouseConfigConstants.IS_SINGLE_NO)) {
info.setIsSingle(CommonConstants.ZERO_STRING);
} else {
info.setIsSingle(CommonConstants.ONE_STRING);
// MVP 1.7.18,单个里,加了接口通道:
if (Common.isNotNull(excel.getIsSingleYgsPush())) {
if (HouseConfigConstants.IS_SINGLE_NO.equals(excel.getIsSingleYgsPush())) {
info.setIsSingleYgsPush(CommonConstants.ZERO_STRING);
} else if (HouseConfigConstants.IS_SINGLE_YES.equals(excel.getIsSingleYgsPush())) {
info.setIsSingleYgsPush(CommonConstants.ONE_STRING);
}
}
}
}
if (CommonConstants.IS_TRUE.equals(excel.getRosterAutoFlagYgs())){
if (Common.isNotNull(excel.getDataFlagYgs())) {
info.setDataFlagYgs(excel.getDataFlagYgs().equals(CommonConstants.IS_TRUE) ? "1" : "0");
......@@ -1324,13 +1367,28 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
info.setDataFlagYgs(null);
info.setRosterAutoFlagYgs(null);
}
info.setIsSingleYsdPush(null);
if (CommonConstants.ZERO_STRING.equals(info.getAutoStatusYsd())){
if (Common.isNotNull(excel.getIsSingleYsd())){
if (excel.getIsSingleYsd().equals(HouseConfigConstants.IS_SINGLE_NO)) {
info.setIsSingleYsd(CommonConstants.ZERO_STRING);
} else {
info.setIsSingleYsd(CommonConstants.ONE_STRING);
// MVP 1.7.18,单个里,加了接口通道:
if (Common.isNotNull(excel.getIsSingleYsdPush())) {
if (HouseConfigConstants.IS_SINGLE_NO.equals(excel.getIsSingleYsdPush())) {
info.setIsSingleYsdPush(CommonConstants.ZERO_STRING);
} else if (HouseConfigConstants.IS_SINGLE_YES.equals(excel.getIsSingleYsdPush())) {
info.setIsSingleYsdPush(CommonConstants.ONE_STRING);
}
}
}
}
if (Common.isNotNull(excel.getRosterAutoFlagYsd())) {
info.setRosterAutoFlagYsd(excel.getRosterAutoFlagYsd().equals(CommonConstants.IS_TRUE) ? "1" : "0");
}
if (Common.isNotNull(excel.getIsSingleYsd())) {
info.setIsSingleYsd(excel.getIsSingleYsd().equals(HouseConfigConstants.IS_SINGLE_NO) ? "0" : "1");
}
if (CommonConstants.IS_TRUE.equals(excel.getRosterAutoFlagYsd())){
if (Common.isNotNull(excel.getDataFlagYsd())) {
info.setDataFlagYsd(excel.getDataFlagYsd().equals(CommonConstants.IS_TRUE) ? "1" : "0");
......
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