Commit a4abe059 authored by hongguangwu's avatar hongguangwu

调基、导出相关

parent f82273af
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.social.vo; package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 社保公积金查询表 * 社保公积金查询表
...@@ -32,12 +34,13 @@ import java.util.List; ...@@ -32,12 +34,13 @@ import java.util.List;
@Data @Data
public class TSocialFundInfoSearchVo extends TSocialFundInfo { public class TSocialFundInfoSearchVo extends TSocialFundInfo {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
@TableField(exist = false)
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
@Schema(description = "选中的idList")
private List<String> idList; private List<String> idList;
/** /**
* 创建时间区间 [开始时间,结束时间] * 创建时间区间 [开始时间,结束时间]
......
...@@ -98,8 +98,8 @@ public class TSocialFundInfoController { ...@@ -98,8 +98,8 @@ public class TSocialFundInfoController {
@SysLog("批量调基") @SysLog("批量调基")
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('tsocialfundinfo-batch-import')") @PreAuthorize("@pms.hasPermission('tsocialfundinfo-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file){ public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file, @RequestParam String doMonth){
return tSocialFundInfoService.importDiy(file.getInputStream()); return tSocialFundInfoService.importDiy(file.getInputStream(), doMonth);
} }
/** /**
......
...@@ -21,12 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -21,12 +21,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.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig; import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary; import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -66,7 +65,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> { ...@@ -66,7 +65,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
* @Date: 2022/7/25 17:33 * @Date: 2022/7/25 17:33
* @return: void * @return: void
**/ **/
R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo); R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth);
/** /**
* @param socialFundInfo * @param socialFundInfo
...@@ -83,7 +82,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> { ...@@ -83,7 +82,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
* @Date: 2022/7/26 19:09 * @Date: 2022/7/26 19:09
* @return: void * @return: void
**/ **/
void updateForecastLibaryBySysBase(); void updateForecastLibaryBySysBase(SysBaseSetInfo newSysBaseSetInfo);
/** /**
* @Description: 每月定时预估库 TODO-加定时器 * @Description: 每月定时预估库 TODO-加定时器
......
...@@ -45,13 +45,13 @@ public interface TSocialFundInfoService extends IService<TSocialFundInfo> { ...@@ -45,13 +45,13 @@ public interface TSocialFundInfoService extends IService<TSocialFundInfo> {
IPage<TSocialFundInfo> getTSocialFundInfoPage(Page<TSocialFundInfo> page, TSocialFundInfoSearchVo tSocialFundInfo); IPage<TSocialFundInfo> getTSocialFundInfoPage(Page<TSocialFundInfo> page, TSocialFundInfoSearchVo tSocialFundInfo);
/** /**
* @param inputStream * @param doMonth 执行月份
* @Description: 批量调基 * @Description: 批量调基
* @Author: hgw * @Author: hgw
* @Date: 2022/7/22 11:32 * @Date: 2022/7/22 11:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/ **/
R<List<ErrorMessage>> importDiy(InputStream inputStream); R<List<ErrorMessage>> importDiy(InputStream inputStream, String doMonth);
/** /**
* @Description: 导出 * @Description: 导出
......
...@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion; ...@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.SysPayProportionService; import com.yifu.cloud.plus.v1.yifu.social.service.SysPayProportionService;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -55,6 +56,8 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -55,6 +56,8 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
private final SysPayProportionService sysPayProportionService; private final SysPayProportionService sysPayProportionService;
private final TForecastLibraryService tForecastLibraryService;
/** /**
* 基数设置表简单分页查询 * 基数设置表简单分页查询
* *
...@@ -251,7 +254,10 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -251,7 +254,10 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
} else { } else {
sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT); sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT);
sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING); sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
sysBaseSetInfo.setIsNew(CommonConstants.ONE_STRING);
baseMapper.insert(sysBaseSetInfo); baseMapper.insert(sysBaseSetInfo);
// TODO-测试用(同步社保公积金查询、预估库),后面可删除
tForecastLibraryService.updateForecastLibaryBySysBase(sysBaseSetInfo);
} }
List<SysPayProportion> payProportionList = sysBaseSetInfo.getFundProList(); List<SysPayProportion> payProportionList = sysBaseSetInfo.getFundProList();
if (Common.isNotNull(payProportionList)) { if (Common.isNotNull(payProportionList)) {
......
...@@ -37,7 +37,6 @@ import com.yifu.cloud.plus.v1.yifu.social.mapper.TAgentConfigMapper; ...@@ -37,7 +37,6 @@ 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.TForecastLibraryMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialFundInfoMapper; 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.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialFundInfoService;
import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil; import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -467,7 +466,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -467,7 +466,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} }
} }
private void initSocialLibary(String diffType,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 , TSocialFundInfo tSocialInfo, boolean isReduceFund, HashMap<String, TAgentConfig> agentConfigMap
, TForecastLibrary lib, String sfMapKey, TForecastLibrary historyLibrary) { , TForecastLibrary lib, String sfMapKey, TForecastLibrary historyLibrary) {
if (null == lib) { if (null == lib) {
...@@ -1173,6 +1172,186 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1173,6 +1172,186 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
saveLibraryMap.put(mapKeyStr, lib); saveLibraryMap.put(mapKeyStr, lib);
} }
private void changeSocialFundInfoByBase(TSocialFundInfo social, SysBaseSetInfo socialSet) {
if (Common.isNotNull(socialSet)) {
social.setCanOverpay(socialSet.getCanOverpay());
social.setSocialHousehold(socialSet.getId());
social.setCollectMoth(socialSet.getCollectMoth());
social.setCollectType(socialSet.getCollectType());
social.setHaveThisMonth(socialSet.getHaveThisMonth());
social.setInsuranceBigailment(socialSet.getInsuranceBigailment());
social.setInsuranceBirth(socialSet.getInsuranceBirth());
social.setInsuranceInjury(socialSet.getInsuranceInjury());
social.setInsuranceMedical(socialSet.getInsuranceMedical());
social.setInsurancePension(socialSet.getInsurancePension());
social.setInsuranceUnemployment(socialSet.getInsuranceUnemployment());
social.setLatestCardinality(socialSet.getInsuranceIsLatestCardinality());
social.setIsChargePersonal(socialSet.getIsChargePersonal());
social.setIsIllness(socialSet.getIsIllness());
social.setOverpayNumber(socialSet.getOverpayNumber());
social.setValueType(socialSet.getValueType());
// 比例初始化
// 按最低
if (CommonConstants.ZERO_STRING.equals(social.getPaymentType())) {
this.setBaseInfo(social, socialSet.getLowerLimit());
} else if (CommonConstants.TWO_STRING.equals(social.getPaymentType())) {
//按最高
this.setBaseInfo(social, socialSet.getUpperLimit());
} else if (CommonConstants.ONE_STRING.equals(social.getPaymentType())) {
//自定义
// 五险
if (social.getUnitPensionCardinal() != null) {
if (social.getUnitPensionCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setPersonalPensionCardinal(socialSet.getLowerLimit());
social.setUnitPensionCardinal(socialSet.getLowerLimit());
} else if (social.getUnitPensionCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setPersonalPensionCardinal(socialSet.getUpperLimit());
social.setUnitPensionCardinal(socialSet.getUpperLimit());
}
if (social.getUnitMedicalCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setPersonalMedicalCardinal(socialSet.getLowerLimit());
social.setUnitMedicalCardinal(socialSet.getLowerLimit());
} else if (social.getUnitMedicalCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setPersonalMedicalCardinal(socialSet.getUpperLimit());
social.setUnitMedicalCardinal(socialSet.getUpperLimit());
}
if (social.getUnitUnemploymentCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setPersonalUnemploymentCardinal(socialSet.getLowerLimit());
social.setUnitUnemploymentCardinal(socialSet.getLowerLimit());
} else if (social.getUnitUnemploymentCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setPersonalUnemploymentCardinal(socialSet.getUpperLimit());
social.setUnitUnemploymentCardinal(socialSet.getUpperLimit());
}
if (social.getUnitWorkInjuryCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setUnitWorkInjuryCardinal(socialSet.getLowerLimit());
} else if (social.getUnitWorkInjuryCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setUnitWorkInjuryCardinal(socialSet.getUpperLimit());
}
if (social.getUnitBirthCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setUnitBirthCardinal(socialSet.getLowerLimit());
} else if (social.getUnitBirthCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setUnitBirthCardinal(socialSet.getUpperLimit());
}
if (social.getUnitBigailmentCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setPersonalBigailmentCardinal(socialSet.getLowerLimit());
social.setUnitBigailmentCardinal(socialSet.getLowerLimit());
} else if (social.getUnitBigailmentCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setPersonalBigailmentCardinal(socialSet.getUpperLimit());
social.setUnitBigailmentCardinal(socialSet.getUpperLimit());
}
} else if (social.getUnitWorkInjuryCardinal() != null) {
// 兼职工伤
if (social.getUnitWorkInjuryCardinal().compareTo(socialSet.getLowerLimit()) < CommonConstants.ZERO_INT) {
social.setUnitWorkInjuryCardinal(socialSet.getLowerLimit());
} else if (social.getUnitWorkInjuryCardinal().compareTo(socialSet.getUpperLimit()) > CommonConstants.ZERO_INT) {
social.setUnitWorkInjuryCardinal(socialSet.getUpperLimit());
}
}
}
// 比例与金额
this.setProAndMoney(social, socialSet);
}
}
/**
* @param social
* @param limitBase
* @Description: 塞基数
* @Author: hgw
* @Date: 2022/7/27 14:55
* @return: void
**/
private void setBaseInfo(TSocialFundInfo social, BigDecimal limitBase) {
if (social.getUnitPensionCardinal() != null) {
// 基数
social.setPersonalPensionCardinal(limitBase);
social.setPersonalMedicalCardinal(limitBase);
social.setPersonalUnemploymentCardinal(limitBase);
social.setPersonalBigailmentCardinal(limitBase);
social.setUnitPensionCardinal(limitBase);
social.setUnitMedicalCardinal(limitBase);
social.setUnitUnemploymentCardinal(limitBase);
social.setUnitWorkInjuryCardinal(limitBase);
social.setUnitBigailmentCardinal(limitBase);
social.setUnitBirthCardinal(limitBase);
} else if (social.getUnitWorkInjuryCardinal() != null) {
social.setUnitWorkInjuryCardinal(limitBase);
}
}
/**
* @param social
* @param socialSet
* @Description: 塞比例与金额
* @Author: hgw
* @Date: 2022/7/27 14:55
* @return: void
**/
private void setProAndMoney(TSocialFundInfo social, SysBaseSetInfo socialSet) {
if (social.getUnitPensionCardinal() != null) {
// 比例
social.setPersonalPensionPer(socialSet.getPersonalPersionPro());
social.setPersonalMedicalPer(socialSet.getPersonalMedicalPro());
social.setPersonalUnemploymentPer(socialSet.getPersonalUnemploymentPro());
social.setPersonalBigailmentPer(socialSet.getPayPersonalPro());
social.setUnitPensionPer(socialSet.getUnitPersionPro());
social.setUnitMedicalPer(socialSet.getUnitMedicalPro());
social.setUnitUnemploymentPer(socialSet.getUnitUnemploymentPro());
social.setUnitWorkUnjuryPer(socialSet.getUnitInjuryPro());
social.setUnitBigailmentPer(socialSet.getPayCompanyPro());
social.setUnitBirthPer(socialSet.getUnitBirthPro());
// 金额
social.setUnitPersionMoney(BigDecimalUtils.safeMultiply(social.getUnitPensionCardinal(), social.getUnitPensionPer(), CommonConstants.ONE_OF_PERCENT));
social.setUnitMedicalMoney(BigDecimalUtils.safeMultiply(social.getUnitMedicalCardinal(), social.getUnitMedicalPer(), CommonConstants.ONE_OF_PERCENT));
social.setUnitBirthMoney(BigDecimalUtils.safeMultiply(social.getUnitBirthCardinal(), social.getUnitBirthPer(), CommonConstants.ONE_OF_PERCENT));
social.setUnitInjuryMoney(BigDecimalUtils.safeMultiply(social.getUnitWorkInjuryCardinal(), social.getUnitWorkUnjuryPer(), CommonConstants.ONE_OF_PERCENT));
social.setUnitUnemploymentMoney(BigDecimalUtils.safeMultiply(social.getUnitUnemploymentCardinal(), social.getUnitUnemploymentPer(), CommonConstants.ONE_OF_PERCENT));
social.setPersonalPersionMoney(BigDecimalUtils.safeMultiply(social.getPersonalPensionCardinal(), social.getPersonalPensionPer(), CommonConstants.ONE_OF_PERCENT));
social.setPersonalMedicalMoney(BigDecimalUtils.safeMultiply(social.getPersonalMedicalCardinal(), social.getPersonalMedicalPer(), CommonConstants.ONE_OF_PERCENT));
social.setPersonalUnemploymentMoney(BigDecimalUtils.safeMultiply(social.getPersonalUnemploymentCardinal(), social.getPersonalUnemploymentPer(), CommonConstants.ONE_OF_PERCENT));
// 大病金额
boolean flag = CommonConstants.ZERO_STRING.equals(social.getIsIllness()) && (CommonConstants.ZERO_STRING.equals(social.getCollectType()) || CommonConstants.ONE_STRING.equals(social.getCollectType()));
if (flag) {
//收取方式按年 且为指定月份时产生数据
if (CommonConstants.ZERO_STRING.equals(social.getCollectType()) && Common.isNotNull(socialSet)) {
//按年收取大病方式按定值
social.setUnitBigailmentMoney(socialSet.getPayCompany());
social.setPersonalBigailmentMoney(socialSet.getPayPersonal());
} else if (CommonConstants.ONE_STRING.equals(social.getCollectType())) {
//收取方式按月
if (CommonConstants.ZERO_STRING.equals(social.getValueType())) {
//收取大病按比例
social.setUnitBigailmentMoney(BigDecimalUtils.safeMultiply(social.getUnitBigailmentCardinal(), social.getUnitBigailmentPer(), BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
social.setPersonalBigailmentMoney(BigDecimalUtils.safeMultiply(social.getPersonalBigailmentCardinal(), social.getPersonalBigailmentPer(), BigDecimal.valueOf(CommonConstants.ONE_OF_PERCENT.doubleValue())));
} else if (CommonConstants.ONE_STRING.equals(social.getValueType()) && Common.isNotNull(socialSet)) {
//收取大病方式按定值
social.setUnitBigailmentMoney(socialSet.getPayCompany());
social.setPersonalBigailmentMoney(socialSet.getPayPersonal());
}
}
}
} else if (social.getUnitWorkInjuryCardinal() != null) {
social.setUnitWorkUnjuryPer(socialSet.getUnitInjuryPro());
social.setUnitInjuryMoney(BigDecimalUtils.safeMultiply(social.getUnitWorkInjuryCardinal(), social.getUnitWorkUnjuryPer(), CommonConstants.ONE_OF_PERCENT));
}
social.setUnitSocialSum(BigDecimalUtils.safeAdd(social.getUnitPersionMoney()
, social.getUnitMedicalMoney(), social.getUnitBirthMoney()
, social.getUnitInjuryMoney()
, social.getUnitUnemploymentMoney()
, social.getUnitInterestFee()
, social.getUnitBigailmentMoney()));
social.setPersonalSocialSum(BigDecimalUtils.safeAdd(social.getPersonalBigailmentMoney()
, social.getPersonalPersionMoney()
, social.getPersonalMedicalMoney()
, social.getPersonalInterestFee()
, social.getPersonalUnemploymentMoney()));
}
/** /**
* @Description: 基数新增,同步社保公积金查询表,同步预估库 * @Description: 基数新增,同步社保公积金查询表,同步预估库
* @Author: hgw * @Author: hgw
...@@ -1180,10 +1359,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1180,10 +1359,15 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @return: void * @return: void
**/ **/
@Override @Override
public void updateForecastLibaryBySysBase() { public void updateForecastLibaryBySysBase(SysBaseSetInfo newSysBaseSetInfo) {
List<SysBaseSetInfo> sysBaseSetInfoList = sysBaseSetInfoMapper.selectList( List<SysBaseSetInfo> sysBaseSetInfoList = new ArrayList<>();
if (newSysBaseSetInfo == null) {
sysBaseSetInfoList = sysBaseSetInfoMapper.selectList(
Wrappers.<SysBaseSetInfo>query().lambda() Wrappers.<SysBaseSetInfo>query().lambda()
.eq(SysBaseSetInfo::getIsNew, CommonConstants.ONE_INT)); .eq(SysBaseSetInfo::getIsNew, CommonConstants.ONE_INT));
} else {
sysBaseSetInfoList.add(newSysBaseSetInfo);
}
if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) { if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) {
Map<String, TSocialFundInfo> socialFundInfoMap = new HashMap<>(); Map<String, TSocialFundInfo> socialFundInfoMap = new HashMap<>();
List<TSocialFundInfo> socialFundInfoList; List<TSocialFundInfo> socialFundInfoList;
...@@ -1193,6 +1377,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1193,6 +1377,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
socialFundInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda() socialFundInfoList = socialFundInfoMapper.selectList(Wrappers.<TSocialFundInfo>query().lambda()
.eq(TSocialFundInfo::getSocialHousehold, sysBaseSetInfo.getDepartId())); .eq(TSocialFundInfo::getSocialHousehold, sysBaseSetInfo.getDepartId()));
for (TSocialFundInfo socialFundInfo : socialFundInfoList) { for (TSocialFundInfo socialFundInfo : socialFundInfoList) {
this.changeSocialFundInfoByBase(socialFundInfo, sysBaseSetInfo);
socialFundInfoMap.put(socialFundInfo.getId(), socialFundInfo); socialFundInfoMap.put(socialFundInfo.getId(), socialFundInfo);
} }
} }
...@@ -1206,7 +1391,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1206,7 +1391,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
} }
} }
for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) { for (TSocialFundInfo socialFundInfo : socialFundInfoMap.values()) {
this.updateForecastLibaryCore(socialFundInfo); this.updateForecastLibaryCore(socialFundInfo, null);
} }
} }
} }
...@@ -1219,8 +1404,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1219,8 +1404,8 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @return: void * @return: void
**/ **/
@Override @Override
public R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo) { public R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth) {
return this.updateForecastLibaryCore(socialFundInfo); return this.updateForecastLibaryCore(socialFundInfo, doMonth);
} }
/** /**
...@@ -1232,7 +1417,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1232,7 +1417,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
**/ **/
@Override @Override
public R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo) { public R<String> updateForecastLibaryByDispatch(TSocialFundInfo socialFundInfo) {
return this.updateForecastLibaryCore(socialFundInfo); return this.updateForecastLibaryCore(socialFundInfo, null);
} }
/** /**
...@@ -1242,7 +1427,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1242,7 +1427,7 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
* @Date: 2022/7/26 19:01 * @Date: 2022/7/26 19:01
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
private R<String> updateForecastLibaryCore(TSocialFundInfo socialFundInfo) { private R<String> updateForecastLibaryCore(TSocialFundInfo socialFundInfo, String doMonth) {
String empIdCard = socialFundInfo.getEmpIdcard(); String empIdCard = socialFundInfo.getEmpIdcard();
//定义未推送的按条件查询得到的预估数据 //定义未推送的按条件查询得到的预估数据
List<TForecastLibrary> librarySocialList = null; List<TForecastLibrary> librarySocialList = null;
...@@ -1253,8 +1438,20 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap ...@@ -1253,8 +1438,20 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
//定义已推送的按条件查询得到的预估数据 //定义已推送的按条件查询得到的预估数据
List<TForecastLibrary> libraryFundListTemp = null; List<TForecastLibrary> libraryFundListTemp = null;
int monthDiff;
// 获取要更新的月份 // 获取要更新的月份
int monthDiff = DateUtil.getMonthDiff(socialFundInfo.getSocialStartDate(), new Date()) + 2; if (Common.isNotNull(doMonth)) {
try {
if (Integer.parseInt(doMonth) > Integer.parseInt(DateUtil.addMonth(1))) {
return R.failed("同步预估库,doMonth大于下月:" + doMonth);
}
monthDiff = DateUtil.getMonthDiff(DateUtil.parseDate(doMonth, "yyyyMM"), new Date()) + 2;
} catch (Exception e) {
return R.failed("同步预估库,doMonth格式错误:" + doMonth);
}
} else {
monthDiff = DateUtil.getMonthDiff(socialFundInfo.getSocialStartDate(), new Date()) + 2;
}
List<String> payMonthList = new ArrayList<>(); List<String> payMonthList = new ArrayList<>();
for (int i = 0; i < monthDiff; i++) { for (int i = 0; i < monthDiff; i++) {
payMonthList.add(DateUtil.addMonth(1 - i)); payMonthList.add(DateUtil.addMonth(1 - i));
......
...@@ -32,6 +32,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -32,6 +32,7 @@ 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.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
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.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
...@@ -105,7 +106,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -105,7 +106,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TSocialFundInfo.class).build(); ExcelWriter excelWriter = EasyExcel.write(out, TSocialFundInfo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
...@@ -148,9 +149,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -148,9 +149,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
@Override @Override
public List<TSocialFundInfo> noPageDiy(TSocialFundInfoSearchVo searchVo) { public List<TSocialFundInfo> noPageDiy(TSocialFundInfoSearchVo searchVo) {
LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo.getIdList())) {
if (Common.isNotNull(idList)) { wrapper.in(TSocialFundInfo::getId, searchVo.getIdList());
wrapper.in(TSocialFundInfo::getId, idList);
} }
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) { if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd()); wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
...@@ -160,18 +160,16 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -160,18 +160,16 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
} }
private List<TSocialFundInfoExportVo> export(TSocialFundInfoSearchVo searchVo) { private List<TSocialFundInfoExportVo> export(TSocialFundInfoSearchVo searchVo) {
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo.getIdList())) {
if (Common.isNotNull(idList)) { searchVo.setIdList(searchVo.getIdList());
searchVo.setIdList(idList);
} }
return baseMapper.exportList(searchVo); return baseMapper.exportList(searchVo);
} }
private Long noPageCountDiy(TSocialFundInfoSearchVo searchVo) { private Long noPageCountDiy(TSocialFundInfoSearchVo searchVo) {
LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo.getIdList())) {
if (Common.isNotNull(idList)) { wrapper.in(TSocialFundInfo::getId, searchVo.getIdList());
wrapper.in(TSocialFundInfo::getId, idList);
} }
return baseMapper.selectCount(wrapper); return baseMapper.selectCount(wrapper);
} }
...@@ -190,14 +188,14 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -190,14 +188,14 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
} }
/** /**
* @param inputStream * @param doMonth 执行月份
* @Description: 批量调基 * @Description: 批量调基
* @Author: hgw * @Author: hgw
* @Date: 2022/7/22 11:32 * @Date: 2022/7/22 11:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/ **/
@Override @Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) { public R<List<ErrorMessage>> importDiy(InputStream inputStream, String doMonth) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TSocialFundHistoryVo> util1 = new ExcelUtil<>(TSocialFundHistoryVo.class); ExcelUtil<TSocialFundHistoryVo> util1 = new ExcelUtil<>(TSocialFundHistoryVo.class);
// 写法2: // 写法2:
...@@ -242,7 +240,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -242,7 +240,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTSocialFundInfo(cachedDataList, errorMessageList); importTSocialFundInfo(cachedDataList, errorMessageList, doMonth);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -253,7 +251,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -253,7 +251,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
private void importTSocialFundInfo(List<TSocialFundHistoryVo> excelVOList, List<ErrorMessage> errorMessageList) { private void importTSocialFundInfo(List<TSocialFundHistoryVo> excelVOList
, List<ErrorMessage> errorMessageList, String doMonth) {
// 执行数据插入操作 组装 // 执行数据插入操作 组装
TSocialFundHistoryVo excel; TSocialFundHistoryVo excel;
List<String> idCardList = new ArrayList<>(); List<String> idCardList = new ArrayList<>();
...@@ -373,7 +372,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -373,7 +372,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
// 3:新增变更日志 // 3:新增变更日志
tSocialLogService.saveModificationRecord(CommonConstants.ONE_INT, oldSocialFundInfo.getId(), oldSocialFundInfo, socialFundInfo); tSocialLogService.saveModificationRecord(CommonConstants.ONE_INT, oldSocialFundInfo.getId(), oldSocialFundInfo, socialFundInfo);
// 4:同步预估库 // 4:同步预估库
tForecastLibraryService.updateToneForecastLibary(socialFundInfo); tForecastLibraryService.updateToneForecastLibary(socialFundInfo, doMonth);
// 返回信息处理 // 返回信息处理
initResSuccessMessage(errorMessageList, excel.getRowIndex(), isSocial, isFund); initResSuccessMessage(errorMessageList, excel.getRowIndex(), isSocial, isFund);
} else { } else {
......
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