Commit 4cadfe3f authored by hongguangwu's avatar hongguangwu

社保公积金查询-导出

parent 9547f46d
......@@ -457,6 +457,11 @@ public class SysBaseSetInfo extends BaseEntity {
@ExcelProperty("执行月份")
private String doMonth;
@ExcelAttribute(name = "是否新数据:0否1是。为1,将同步社保公积金查询、预估库。其余值,不同步")
@Schema(description = "是否新数据:0否1是。为1,将同步社保公积金查询、预估库。其余值,不同步")
@ExcelProperty("是否新数据:0否1是。为1,将同步社保公积金查询、预估库。其余值,不同步")
private String isNew;
@Schema(description = "适用月")
@TableField(exist = false)
private String applyDate;
......
......@@ -493,6 +493,12 @@ public class TForecastLibrary extends BaseEntity {
@ExcelAttribute(name = "类型:0社保;1公积金")
@ExcelProperty("类型:0社保;1公积金")
private Integer dataType;
/**
* 数据类型:预估/差额(汉字)
*/
@ExcelAttribute(name = "数据类型:预估/差额")
@ExcelProperty("数据类型:预估/差额")
private String diffType;
@TableField(exist = false)
private List<String> idList;
......
......@@ -9,4 +9,6 @@ public class SocialConstants {
// 社保补缴配置有误!
public static final String SOCIAL_SET_ERROR = "社保补缴配置有误!";
public static final String EMP_NAME_ERROR = "员工姓名错误!";
public static final String DIFF_TYPE_ONE = "预估";
public static final String DIFF_TYPE_TWO = "差额";
}
......@@ -77,4 +77,20 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
**/
R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo);
/**
* @Description: 基数变更,同步社保公积金查询、预估库 TODO-加定时器
* @Author: hgw
* @Date: 2022/7/26 19:09
* @return: void
**/
void updateForecastLibaryBySysBase();
/**
* @Description: 每月定时预估库 TODO-加定时器
* @Author: hgw
* @Date: 2022/7/26 19:09
* @return: void
**/
void everyMonthCreateForecastLibary();
}
......@@ -37,6 +37,7 @@ import com.yifu.cloud.plus.v1.yifu.social.mapper.TAgentConfigMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TForecastLibraryMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFundInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFundInfoService;
import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
......@@ -63,6 +64,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
private final TAgentConfigMapper agentConfigMapper;
private final TSocialFundInfoService tSocialFundInfoService;
private final TSocialFundInfoMapper socialFundInfoMapper;
private final SysBaseSetInfoMapper sysBaseSetInfoMapper;
......@@ -466,12 +468,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
private void initSocialLibary(String payMonth, Map<String, TForecastLibrary> saveLibraryMap
private void initSocialLibary(String diffType,String payMonth, Map<String, TForecastLibrary> saveLibraryMap
, TSocialFundInfo tSocialInfo, boolean isReduceFund, HashMap<String, TAgentConfig> agentConfigMap
, TForecastLibrary lib, String sfMapKey, TForecastLibrary historyLibrary) {
if (null == lib) {
lib = new TForecastLibrary();
}
lib.setDiffType(diffType);
lib.setDataType(CommonConstants.ZERO_INT);
lib.setEmpId(tSocialInfo.getEmpId());
lib.setEmpIdcard(tSocialInfo.getEmpIdcard());
......@@ -1125,12 +1128,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @Author fxj
* @Date 2020-07-21
**/
private void initFundLibary(String payMonth, Map<String, TForecastLibrary> saveLibraryMap
private void initFundLibary(String diffType, String payMonth, Map<String, TForecastLibrary> saveLibraryMap
, TSocialFundInfo providentFund, boolean isReduceSocial, TForecastLibrary lib, String mapKeyStr
, TForecastLibrary historyLibrary) {
if (lib == null) {
lib = new TForecastLibrary();
}
lib.setDiffType(diffType);
lib.setDataType(CommonConstants.ONE_INT);
lib.setEmpId(providentFund.getEmpId());
lib.setEmpIdcard(providentFund.getEmpIdcard());
......@@ -1170,6 +1174,44 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
saveLibraryMap.put(mapKeyStr, lib);
}
/**
* @Description: 基数新增,同步社保公积金查询表,同步预估库
* @Author: hgw
* @Date: 2022/7/25 17:37
* @return: void
**/
@Override
public void updateForecastLibaryBySysBase() {
List<SysBaseSetInfo> sysBaseSetInfoList = sysBaseSetInfoMapper.selectList(
Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getIsNew, CommonConstants.ONE_INT));
if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) {
Map<String, TSocialFundInfo> socialFundInfoMap = new HashMap<>();
List<TSocialFundInfo> socialFundInfoList;
for (SysBaseSetInfo sysBaseSetInfo : sysBaseSetInfoList) {
// 社保
if (CommonConstants.ZERO_STRING.equals(sysBaseSetInfo.getBaseType())) {
socialFundInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.eq(TSocialFundInfo::getSocialHousehold, sysBaseSetInfo.getDepartId()));
for (TSocialFundInfo socialFundInfo : socialFundInfoList) {
socialFundInfoMap.put(socialFundInfo.getId(), socialFundInfo);
}
}
// 公积金
if (CommonConstants.ONE_STRING.equals(sysBaseSetInfo.getBaseType())) {
socialFundInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.eq(TSocialFundInfo::getProvidentHousehold, sysBaseSetInfo.getDepartId()));
for (TSocialFundInfo socialFundInfo : socialFundInfoList) {
socialFundInfoMap.put(socialFundInfo.getId(), socialFundInfo);
}
}
}
for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) {
this.updateForecastLibaryCore(socialFundInfo);
}
}
}
/**
* @param socialFundInfo
* @Description: 批量调基,同步预估库
......@@ -1182,6 +1224,13 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return this.updateForecastLibaryCore(socialFundInfo);
}
/**
* @param socialFundInfo
* @Description: 派单,同步预估库
* @Author: hgw
* @Date: 2022/7/25 17:37
* @return: void
**/
@Override
public R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo) {
return this.updateForecastLibaryCore(socialFundInfo);
......@@ -1311,6 +1360,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
String createMonth;
String sfMapKey;
TForecastLibrary tForecastLibrary;
String diffType;
for (String payMonth : payMonthList) {
//封装社保预估数据
if (Common.isNotNull(socialInfoList)) {
......@@ -1320,12 +1370,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
// 变更:已推送的,计算变更值
tForecastLibrary = socialPushMap.get(sfMapKey);
diffType = SocialConstants.DIFF_TYPE_ONE;
if (null != tForecastLibrary) {
diffType = SocialConstants.DIFF_TYPE_TWO;
this.getChangeReduceData(tSocialInfo, tForecastLibrary);
} else if (CommonConstants.dingleDigitStrArray[5].equals(tSocialInfo.getSocialStatus())
|| CommonConstants.dingleDigitStrArray[10].equals(tSocialInfo.getSocialStatus())) {
// 5 办理失败 10 审核不通过,且无推送数据,不新增
continue;
}
//起缴月份在要生成的月份前不处理 || 截止月份在要生成的月份后不处理
if (Integer.parseInt(payMonth) < DateUtil.formatDateInt(tSocialInfo.getSocialStartDate())
|| Integer.parseInt(payMonth) > DateUtil.formatDateInt(tSocialInfo.getSocialReduceDate())) {
|| (Common.isNotNull(tSocialInfo.getSocialReduceDate())
&& Integer.parseInt(payMonth) > DateUtil.formatDateInt(tSocialInfo.getSocialReduceDate()))) {
continue;
}
flag = CommonConstants.ZERO_STRING.equals(tSocialInfo.getCanOverpay()) && (null == tSocialInfo.getOverpayNumber() || null == tSocialInfo.getHaveThisMonth() || null == tSocialInfo.getSocialStartDate());
......@@ -1334,7 +1391,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} else {
historyLibrary = socialHistoryMap.get(sfMapKey);
// 初始化社保
initSocialLibary(payMonth, saveLibraryMap, tSocialInfo, isReduceFund, agentConfigHashMap, tForecastLibrary, sfMapKey, historyLibrary);
initSocialLibary(diffType, payMonth, saveLibraryMap, tSocialInfo, isReduceFund, agentConfigHashMap, tForecastLibrary, sfMapKey, historyLibrary);
}
}
}
......@@ -1345,12 +1402,19 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
sfMapKey = this.getMapKey(providentFund.getEmpIdcard(), providentFund.getSettleDomainFund(), payMonth, createMonth);
// 变更:已推送的,计算变更值
tForecastLibrary = fundPushMap.get(sfMapKey);
diffType = SocialConstants.DIFF_TYPE_ONE;
if (null != tForecastLibrary) {
diffType = SocialConstants.DIFF_TYPE_TWO;
this.getChangeReduceData(providentFund, tForecastLibrary);
} else if (CommonConstants.dingleDigitStrArray[4].equals(providentFund.getFundStatus())
|| CommonConstants.dingleDigitStrArray[9].equals(providentFund.getFundStatus())) {
// 4办理失败9 审核不通过,且无推送数据,不新增
continue;
}
//起缴月份在要生成的月份后不处理 || 截止月份在要生成的月份后不处理
if (Integer.parseInt(payMonth) < DateUtil.formatDateInt(providentFund.getProvidentStart())
|| Integer.parseInt(payMonth) > DateUtil.formatDateInt(providentFund.getFundReduceDate())) {
|| (Common.isNotNull(providentFund.getFundReduceDate())
&& Integer.parseInt(payMonth) > DateUtil.formatDateInt(providentFund.getFundReduceDate()))) {
continue;
}
flag = CommonConstants.ZERO_STRING.equals(providentFund.getCanOverpay()) && (null == providentFund.getOverpayNumber() || null == providentFund.getHaveThisMonth() || null == providentFund.getProvidentStart());
......@@ -1359,7 +1423,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} else {
historyLibrary = fundHistoryMap.get(sfMapKey);
// 初始化公积金
initFundLibary(payMonth, saveLibraryMap, providentFund, isReduceSocial, tForecastLibrary, sfMapKey, historyLibrary);
initFundLibary(diffType, payMonth, saveLibraryMap, providentFund, isReduceSocial, tForecastLibrary, sfMapKey, historyLibrary);
}
}
......@@ -1368,4 +1432,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
return null;
}
@Override
public void everyMonthCreateForecastLibary() {
List<TSocialFundInfo> socialFundInfoList = tSocialFundInfoService.list();
if (socialFundInfoList != null && !socialFundInfoList.isEmpty()) {
for (TSocialFundInfo socialFundInfo : socialFundInfoList) {
// TODO-生成新的社保公积金数据
}
}
}
}
......@@ -94,6 +94,7 @@
<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
<result property="dataPush" column="DATA_PUSH"/>
<result property="dataType" column="DATA_TYPE"/>
<result property="diffType" column="DIFF_TYPE"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
......@@ -171,6 +172,7 @@
a.PROVIDENT_HOUSEHOLD_NAME,
a.DATA_PUSH,
a.DATA_TYPE,
a.DIFF_TYPE,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
......@@ -395,6 +397,9 @@
<if test="tForecastLibrary.dataType != null">
AND a.DATA_TYPE = #{tForecastLibrary.dataType}
</if>
<if test="tForecastLibrary.diffType != null and tForecastLibrary.diffType.trim() != ''">
AND a.DIFF_TYPE = #{tForecastLibrary.diffType}
</if>
<if test="tForecastLibrary.createBy != null and tForecastLibrary.createBy.trim() != ''">
AND a.CREATE_BY = #{tForecastLibrary.createBy}
</if>
......
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