Merge remote-tracking branch 'remotes/origin/feature/v2-baseInfoOneToMore' into feature/v2-oneToMoreBaseInfo-1104
This commit is contained in:
commit
9c54d1872f
|
|
@ -252,18 +252,24 @@ public class SIAccountBiz extends Service {
|
|||
// empIds = empIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList());
|
||||
|
||||
List<InsuranceArchivesSocialSchemePO> socials = siArchivesBiz.getSocialByEmployeeIds(empIds);
|
||||
//过滤出目标个税扣缴义务人相关信息
|
||||
socials = socials.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
|
||||
List<Long> emp1 = socials.stream()
|
||||
.filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01"))))
|
||||
.map(InsuranceArchivesSocialSchemePO::getEmployeeId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<InsuranceArchivesFundSchemePO> funds = siArchivesBiz.getFundByEmployeeIds(empIds);
|
||||
//过滤出目标个税扣缴义务人相关信息
|
||||
funds = funds.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
|
||||
List<Long> emp2 = funds.stream()
|
||||
.filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01"))))
|
||||
.map(InsuranceArchivesFundSchemePO::getEmployeeId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<InsuranceArchivesOtherSchemePO> others = siArchivesBiz.getOtherByEmployeeIds(empIds);
|
||||
//过滤出目标个税扣缴义务人相关信息
|
||||
others = others.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
|
||||
List<Long> emp3 = others.stream()
|
||||
.filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01"))))
|
||||
.map(InsuranceArchivesOtherSchemePO::getEmployeeId)
|
||||
|
|
@ -323,7 +329,7 @@ public class SIAccountBiz extends Service {
|
|||
public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque<Boolean> results,*/ String billMonth, List<Long> ids, Long employeeId, String tenantKey, Long paymentOrganization) {
|
||||
/* try {*/
|
||||
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids);
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization);
|
||||
List<InsuranceAccountDetailTempPO> list = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (Map.Entry<Long, InsuranceArchivesAccountPO> entry : insuranceArchivesAccountPOS.entrySet()) {
|
||||
|
|
@ -943,7 +949,7 @@ public class SIAccountBiz extends Service {
|
|||
});
|
||||
});
|
||||
//核算开始
|
||||
accountSupplement(baseList, employeeIds, param.getBillMonth(), employeeId);
|
||||
accountSupplement(baseList, employeeIds, param.getBillMonth(), employeeId, param.getPaymentOrganization());
|
||||
|
||||
updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName);
|
||||
}
|
||||
|
|
@ -953,9 +959,9 @@ public class SIAccountBiz extends Service {
|
|||
* @param employeeIds 需要补缴的员工id
|
||||
* @return
|
||||
*/
|
||||
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth, Long employeeId) {
|
||||
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth, Long employeeId, Long paymentOrganization) {
|
||||
//(k,v) k-员工id v-员工对应的福利档案数据
|
||||
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
|
||||
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
|
||||
//核算结果集
|
||||
List<InsuranceAccountDetailPO> pos = new ArrayList<>();
|
||||
baseList.forEach(baseParam -> {
|
||||
|
|
@ -1499,7 +1505,7 @@ public class SIAccountBiz extends Service {
|
|||
}
|
||||
|
||||
|
||||
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId, String currentUserName) {
|
||||
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId, String currentUserName, Long paymentOrganization) {
|
||||
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = allInspects(ids, billMonth);
|
||||
SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel(100515, "无核算数据"));
|
||||
List<InsuranceAccountInspectPO> commonInspects = insuranceAccountInspectPOS.stream()
|
||||
|
|
@ -1527,7 +1533,7 @@ public class SIAccountBiz extends Service {
|
|||
base.setSupplementaryMonth(e.getSupplementaryMonth());
|
||||
baseList.add(base);
|
||||
});
|
||||
accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), billMonth, employeeId);
|
||||
accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), billMonth, employeeId, paymentOrganization);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class SIArchivesBiz {
|
|||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getBaseForm(WelfareTypeEnum welfareType, Long employeeId, Long operateId, User user) {
|
||||
public Map<String, Object> getBaseForm(WelfareTypeEnum welfareType, Long employeeId, Long operateId, User user, Long paymentOrganization) {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
SalaryAssert.notNull(employeeId, "员工id不可为空");
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
|
|
@ -141,7 +141,7 @@ public class SIArchivesBiz {
|
|||
//返回数据
|
||||
switch (welfareType) {
|
||||
case SOCIAL_SECURITY:
|
||||
InsuranceArchivesSocialSchemeDTO insuranceArchivesSocialSchemeDTO = buildSocialForm(employeeId, operateId);
|
||||
InsuranceArchivesSocialSchemeDTO insuranceArchivesSocialSchemeDTO = buildSocialForm(employeeId, operateId, paymentOrganization);
|
||||
List<InsuranceSchemePO> socialList = list.stream().filter(e -> Objects.equals(e.getWelfareType(), WelfareTypeEnum.SOCIAL_SECURITY.getValue())).collect(Collectors.toList());
|
||||
List<SearchConditionOption> socialOptions = new ArrayList<>();
|
||||
socialList.forEach(social -> {
|
||||
|
|
@ -160,7 +160,7 @@ public class SIArchivesBiz {
|
|||
data.put("items", addGroups);
|
||||
break;
|
||||
case ACCUMULATION_FUND:
|
||||
InsuranceArchivesFundSchemeDTO insuranceArchivesFundSchemeDTO = buildFundForm(employeeId, operateId);
|
||||
InsuranceArchivesFundSchemeDTO insuranceArchivesFundSchemeDTO = buildFundForm(employeeId, operateId, paymentOrganization);
|
||||
List<InsuranceSchemePO> fundList = list.stream().filter(e -> Objects.equals(e.getWelfareType(), WelfareTypeEnum.ACCUMULATION_FUND.getValue())).collect(Collectors.toList());
|
||||
List<SearchConditionOption> fundOptions = new ArrayList<>();
|
||||
fundList.forEach(social -> {
|
||||
|
|
@ -178,7 +178,7 @@ public class SIArchivesBiz {
|
|||
data.put("items", addGroups);
|
||||
break;
|
||||
case OTHER:
|
||||
InsuranceArchivesOtherSchemeDTO insuranceArchivesOtherSchemeDTO = buildOtherForm(employeeId, operateId);
|
||||
InsuranceArchivesOtherSchemeDTO insuranceArchivesOtherSchemeDTO = buildOtherForm(employeeId, operateId, paymentOrganization);
|
||||
List<InsuranceSchemePO> otherList = list.stream().filter(e -> Objects.equals(e.getWelfareType(), WelfareTypeEnum.OTHER.getValue())).collect(Collectors.toList());
|
||||
List<SearchConditionOption> otherOptions = new ArrayList<>();
|
||||
otherList.forEach(social -> {
|
||||
|
|
@ -238,17 +238,17 @@ public class SIArchivesBiz {
|
|||
* @param schemeId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getPaymentForm(User user, WelfareTypeEnum welfareType, Long employeeId, long operateId, Long schemeId) {
|
||||
public Map<String, Object> getPaymentForm(User user, WelfareTypeEnum welfareType, Long employeeId, long operateId, Long schemeId, Long paymentOrganization) {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
switch (welfareType) {
|
||||
case SOCIAL_SECURITY:
|
||||
data = buildSocialPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue());
|
||||
data = buildSocialPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization);
|
||||
break;
|
||||
case ACCUMULATION_FUND:
|
||||
data = buildFundPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue());
|
||||
data = buildFundPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization);
|
||||
break;
|
||||
case OTHER:
|
||||
data = buildOtherPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue());
|
||||
data = buildOtherPaymentForm(user, employeeId, schemeId, operateId, welfareType.getValue(), paymentOrganization);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
|
@ -263,9 +263,9 @@ public class SIArchivesBiz {
|
|||
* @param operateId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> buildOtherPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType) {
|
||||
public Map<String, Object> buildOtherPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
InsuranceArchivesOtherSchemeDTO data = buildOtherForm(employeeId, operateId);
|
||||
InsuranceArchivesOtherSchemeDTO data = buildOtherForm(employeeId, operateId, paymentOrganization);
|
||||
if (data != null) {
|
||||
dataMap.put("data", JSONObject.parseObject(data.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
}));
|
||||
|
|
@ -285,10 +285,10 @@ public class SIArchivesBiz {
|
|||
* @param operateId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> buildFundPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType) {
|
||||
public Map<String, Object> buildFundPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization) {
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
InsuranceArchivesFundSchemeDTO data = buildFundForm(employeeId, operateId);
|
||||
InsuranceArchivesFundSchemeDTO data = buildFundForm(employeeId, operateId, paymentOrganization);
|
||||
if (data != null) {
|
||||
dataMap.put("data", JSONObject.parseObject(data.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
}));
|
||||
|
|
@ -308,9 +308,9 @@ public class SIArchivesBiz {
|
|||
* @param operateId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> buildSocialPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType) {
|
||||
public Map<String, Object> buildSocialPaymentForm(User user, Long employeeId, Long schemeId, long operateId, Integer welfareType, Long paymentOrganization) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
InsuranceArchivesSocialSchemeDTO data = buildSocialForm(employeeId, operateId);
|
||||
InsuranceArchivesSocialSchemeDTO data = buildSocialForm(employeeId, operateId, paymentOrganization);
|
||||
if (data != null) {
|
||||
dataMap.put("data", JSONObject.parseObject(data.getSchemePaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
}));
|
||||
|
|
@ -389,11 +389,15 @@ public class SIArchivesBiz {
|
|||
* @param operateId
|
||||
* @return
|
||||
*/
|
||||
public InsuranceArchivesOtherSchemeDTO buildOtherForm(Long employeeId, Long operateId) {
|
||||
public InsuranceArchivesOtherSchemeDTO buildOtherForm(Long employeeId, Long operateId, Long paymentOrganization) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||||
List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(employeeId));
|
||||
// List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(employeeId));
|
||||
List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(employeeId)
|
||||
.paymentOrganization(paymentOrganization)
|
||||
.build());
|
||||
InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherList);
|
||||
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = otherList.size() != 0 ? otherList.get(0) : null;
|
||||
InsuranceArchivesOtherSchemeDTO data = InsuranceArchivesBO.convertOtherPOtoDTO(insuranceArchivesOtherSchemePO, employeeId);
|
||||
|
|
@ -415,12 +419,16 @@ public class SIArchivesBiz {
|
|||
* @param operateId
|
||||
* @return
|
||||
*/
|
||||
public InsuranceArchivesFundSchemeDTO buildFundForm(Long employeeId, Long operateId) {
|
||||
public InsuranceArchivesFundSchemeDTO buildFundForm(Long employeeId, Long operateId, Long paymentOrganization) {
|
||||
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||||
List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(employeeId));
|
||||
// List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(employeeId));
|
||||
List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(employeeId)
|
||||
.paymentOrganization(paymentOrganization)
|
||||
.build());
|
||||
InsuranceArchivesFundSchemePOEncrypt.decryptList(fundList);
|
||||
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = fundList.size() != 0 ? fundList.get(0) : null;
|
||||
InsuranceArchivesFundSchemeDTO data = InsuranceArchivesBO.convertFundPOtoDTO(insuranceArchivesFundSchemePO, employeeId);
|
||||
|
|
@ -442,8 +450,8 @@ public class SIArchivesBiz {
|
|||
* @param operateId
|
||||
* @return
|
||||
*/
|
||||
public InsuranceArchivesSocialSchemeDTO buildSocialForm(Long employeeId, Long operateId) {
|
||||
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = getSocialByEmployeeId(employeeId);
|
||||
public InsuranceArchivesSocialSchemeDTO buildSocialForm(Long employeeId, Long operateId, Long paymentOrganization) {
|
||||
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = getSocialByEmployeeId(employeeId, paymentOrganization);
|
||||
InsuranceArchivesSocialSchemeDTO data = InsuranceArchivesBO.convertSocialPOtoDTO(insuranceArchivesSocialSchemePO, employeeId);
|
||||
if (insuranceArchivesSocialSchemePO == null) {
|
||||
data.setEmployeeId(employeeId);
|
||||
|
|
@ -459,11 +467,14 @@ public class SIArchivesBiz {
|
|||
* @param employeeId
|
||||
* @return
|
||||
*/
|
||||
public InsuranceArchivesSocialSchemePO getSocialByEmployeeId(Long employeeId) {
|
||||
public InsuranceArchivesSocialSchemePO getSocialByEmployeeId(Long employeeId, Long paymentOrganization) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||||
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(employeeId));
|
||||
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(employeeId)
|
||||
.paymentOrganization(paymentOrganization)
|
||||
.build());
|
||||
InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialList);
|
||||
return socialList.size() != 0 ? socialList.get(0) : null;
|
||||
} finally {
|
||||
|
|
@ -520,6 +531,55 @@ public class SIArchivesBiz {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴人id获取记录
|
||||
*/
|
||||
public List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeIdAndPayOrg(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||||
List<InsuranceArchivesSocialSchemePO> allList = new ArrayList<>();
|
||||
for (InsuranceArchivesEmployeePO po : insuranceArchivesEmployeePOS) {
|
||||
List<InsuranceArchivesSocialSchemePO> socialList = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(po);
|
||||
allList.addAll(socialList);
|
||||
}
|
||||
return allList;
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<InsuranceArchivesFundSchemePO> getFundByEmployeeIdAndPayOrg(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||||
List<InsuranceArchivesFundSchemePO> allList = new ArrayList<>();
|
||||
for (InsuranceArchivesEmployeePO po : insuranceArchivesEmployeePOS) {
|
||||
List<InsuranceArchivesFundSchemePO> fundList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(po);
|
||||
allList.addAll(fundList);
|
||||
}
|
||||
return allList;
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public List<InsuranceArchivesOtherSchemePO> getOtherByEmployeeIdAndPayOrg(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||||
List<InsuranceArchivesOtherSchemePO> allList = new ArrayList<>();
|
||||
for (InsuranceArchivesEmployeePO po : insuranceArchivesEmployeePOS) {
|
||||
List<InsuranceArchivesOtherSchemePO> otherList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(po);
|
||||
allList.addAll(otherList);
|
||||
}
|
||||
return allList;
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
|
|
@ -556,8 +616,12 @@ public class SIArchivesBiz {
|
|||
|
||||
InsuranceArchivesOtherSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesOtherSaveParam.class);
|
||||
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
|
||||
// otherSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
|
||||
List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(param.getEmployeeId()));
|
||||
|
||||
// List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(param.getEmployeeId()));
|
||||
List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(param.getEmployeeId())
|
||||
.paymentOrganization(param.getPaymentOrganization())
|
||||
.build());
|
||||
if (oldOtherInfoList.size() == 1) {
|
||||
InsuranceArchivesOtherSchemePO oldOtherInfo = oldOtherInfoList.get(0);
|
||||
InsuranceArchivesOtherSchemePO updateOtherInfo =
|
||||
|
|
@ -599,8 +663,12 @@ public class SIArchivesBiz {
|
|||
FundSchemeMapper fundSchemeMapper = sqlSession.getMapper(FundSchemeMapper.class);
|
||||
InsuranceArchivesFundSaveParam param = JSONObject.parseObject(paramReq.getBaseForm(), InsuranceArchivesFundSaveParam.class);
|
||||
SalaryAssert.notNull("员工id为空", param, param.getEmployeeId());
|
||||
// fundSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
|
||||
List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(param.getEmployeeId()));
|
||||
|
||||
// List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(param.getEmployeeId()));
|
||||
List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(param.getEmployeeId())
|
||||
.paymentOrganization(param.getPaymentOrganization())
|
||||
.build());
|
||||
if (oldFundInfoList.size() == 1) {
|
||||
InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0);
|
||||
InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder()
|
||||
|
|
@ -651,7 +719,11 @@ public class SIArchivesBiz {
|
|||
// socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
|
||||
|
||||
//查询已有数据
|
||||
List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(param.getEmployeeId()));
|
||||
// List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(param.getEmployeeId()));
|
||||
List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(param.getEmployeeId())
|
||||
.paymentOrganization(param.getPaymentOrganization())
|
||||
.build());
|
||||
//组装新数据
|
||||
if (oldSocialInfoList.size() == 1) {
|
||||
InsuranceArchivesSocialSchemePO oldSocialInfo = oldSocialInfoList.get(0);
|
||||
|
|
@ -866,6 +938,8 @@ public class SIArchivesBiz {
|
|||
public Map<Integer, Map<String, String>> buildColumnTitle(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, long operateId) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
Map<Integer, Map<String, String>> result = new HashMap<>();
|
||||
|
||||
insuranceArchivesEmployeePOS = insuranceArchivesEmployeePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesEmployeePO::getEmployeeId))), ArrayList::new));
|
||||
try {
|
||||
|
||||
SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
|
||||
|
|
@ -979,20 +1053,20 @@ public class SIArchivesBiz {
|
|||
OtherSchemeMapper otherSchemeMapper = sqlSession.getMapper(OtherSchemeMapper.class);
|
||||
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
|
||||
|
||||
List<Long> employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||||
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(employeeIds))
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
|
||||
// List<Long> employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList());
|
||||
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS))
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getId, Function.identity()));
|
||||
|
||||
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(employeeIds))
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
|
||||
List<InsuranceArchivesOtherSchemePO> otherByEmployeeList = this.getOtherByEmployeeIds(employeeIds);
|
||||
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS))
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getId, Function.identity()));
|
||||
List<InsuranceArchivesOtherSchemePO> otherByEmployeeList = this.getOtherByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS);
|
||||
InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherByEmployeeList);
|
||||
Map<Long, InsuranceArchivesOtherSchemePO> otherSchemePOMap = otherByEmployeeList
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));
|
||||
.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getId, Function.identity()));
|
||||
insuranceArchivesEmployeePOS.forEach(item -> {
|
||||
InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getEmployeeId());
|
||||
InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getEmployeeId());
|
||||
InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId());
|
||||
InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getSocialId());
|
||||
InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getFundId());
|
||||
InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getOtherId());
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("employeeName", item.getUserName());
|
||||
map.put("paymentOrganizationName", longTaxAgentPOMap.get(item.getPaymentOrganization()) != null ? longTaxAgentPOMap.get(item.getPaymentOrganization()).getName() : "");
|
||||
|
|
@ -1006,6 +1080,7 @@ public class SIArchivesBiz {
|
|||
map.put("otherSchemeId", item.getOtherSchemeId());
|
||||
map.put("status", item.getUserStatus() != null ? UserStatusEnum.values()[item.getUserStatus()].getDefaultLabel() : "");
|
||||
map.put("baseInfo", item.getBaseInfoId());
|
||||
map.put("paymentOrganization", item.getPaymentOrganization());
|
||||
if (socialItem != null) {
|
||||
map.put("socialName", insuranceSchemeMapper.querySchemeName(socialItem.getSocialSchemeId()));
|
||||
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
||||
|
|
@ -1207,23 +1282,32 @@ public class SIArchivesBiz {
|
|||
* @param ids 员工id集合
|
||||
* @return map
|
||||
*/
|
||||
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids) {
|
||||
public Map<Long, InsuranceArchivesAccountPO> buildBatchAccount(List<Long> ids, Long paymentOrganization) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
//设置获取社保/公积金/其他福利档案方法的入参
|
||||
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = new ArrayList<>();
|
||||
for (Long employeeId : ids) {
|
||||
insuranceArchivesEmployeePOS.add(InsuranceArchivesEmployeePO.builder()
|
||||
.employeeId(employeeId)
|
||||
.paymentOrganization(paymentOrganization)
|
||||
.build());
|
||||
}
|
||||
|
||||
Map<Long, InsuranceArchivesAccountPO> result = new HashMap<>();
|
||||
Map<Long, InsuranceArchivesSocialSchemePO> socialMap = new HashMap<>();
|
||||
Map<Long, InsuranceArchivesFundSchemePO> funMap = new HashMap<>();
|
||||
Map<Long, InsuranceArchivesOtherSchemePO> otherMap = new HashMap<>();
|
||||
List<InsuranceArchivesSocialSchemePO> socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(ids));
|
||||
List<InsuranceArchivesSocialSchemePO> socialPOS = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS));
|
||||
if (CollectionUtils.isNotEmpty(socialPOS)) {
|
||||
socialMap = socialPOS.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
|
||||
}
|
||||
List<InsuranceArchivesFundSchemePO> fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(ids));
|
||||
List<InsuranceArchivesFundSchemePO> fundPOS = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS));
|
||||
if (CollectionUtils.isNotEmpty(fundPOS)) {
|
||||
funMap = fundPOS.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
|
||||
}
|
||||
List<InsuranceArchivesOtherSchemePO> otherPOS = this.getOtherByEmployeeIds(ids);
|
||||
List<InsuranceArchivesOtherSchemePO> otherPOS = this.getOtherByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS);
|
||||
InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherPOS);
|
||||
if (CollectionUtils.isNotEmpty(otherPOS)) {
|
||||
otherMap = otherPOS.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));
|
||||
|
|
|
|||
|
|
@ -207,12 +207,12 @@ public class InsuranceComparisonResultBO {
|
|||
Map<String, Object> temp = Maps.newHashMap();
|
||||
|
||||
if (accountMap != null && accountMap.get(welfare.getId().toString()) != null) {
|
||||
temp.put("acctResultValue", accountMap.get(welfare.getId().toString()));
|
||||
temp.put("acctResultValue", dealNull(accountMap.get(welfare.getId().toString())));
|
||||
} else {
|
||||
temp.put("acctResultValue", "");
|
||||
}
|
||||
if (excelAccountMap != null && excelAccountMap.get(welfare.getId().toString()) != null) {
|
||||
temp.put("excelResultValue", excelAccountMap.get(welfare.getId().toString()));
|
||||
temp.put("excelResultValue", dealNull(excelAccountMap.get(welfare.getId().toString())));
|
||||
}else {
|
||||
temp.put("excelResultValue", "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,6 @@ public class InspectAccountParam {
|
|||
|
||||
//账单月份")
|
||||
private String billMonth;
|
||||
|
||||
private Long paymentOrganization;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,20 +55,20 @@ public class InsuranceArchivesBaseInfoBO {
|
|||
|
||||
Map<String, InsuranceArchivesBaseInfoPO> insuranceArchivesBaseInfoListMap = SalaryEntityUtil.convert2Map(insuranceArchivesBaseInfoList, k -> k.getPaymentOrganization() + "-" + k.getEmployeeId());
|
||||
taxAgentEmpChanges.forEach(change -> {
|
||||
//以人员id筛选出侧面比较的档案数据,避免存在当前个税扣缴义务人外的该人员档案数据
|
||||
List<InsuranceArchivesBaseInfoPO> moreBaseInfos = insuranceArchivesBaseInfoList.stream().filter(f -> f.getEmployeeId().equals(change.getEmployeeId())).collect(Collectors.toList());
|
||||
// //以人员id筛选出侧面比较的档案数据,避免存在当前个税扣缴义务人外的该人员档案数据
|
||||
// List<InsuranceArchivesBaseInfoPO> moreBaseInfos = insuranceArchivesBaseInfoList.stream().filter(f -> f.getEmployeeId().equals(change.getEmployeeId())).collect(Collectors.toList());
|
||||
//以个税扣缴义务人和人员id为条件筛选当前数据直接对比的档案数据
|
||||
InsuranceArchivesBaseInfoPO insuranceBaseInfo = insuranceArchivesBaseInfoListMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId());
|
||||
// 如果是新增 说明:如果没有档案,则新增,如果有档案而且是停止缴纳,就转移到待增员中,以个税扣缴义务人和人员id判断唯一
|
||||
if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.ADD.getValue()) {
|
||||
if (insuranceBaseInfo != null && moreBaseInfos.size() == 1) {
|
||||
if (insuranceBaseInfo != null) {
|
||||
// 停止缴纳->待增员
|
||||
if (insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()) || insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_ADD.getValue())) {
|
||||
insuranceBaseInfo.setRunStatus(EmployeeStatusEnum.STAY_ADD.getValue());
|
||||
insuranceBaseInfo.setUpdateTime(now);
|
||||
baseInfoUpdateTodoList.add(insuranceBaseInfo);
|
||||
}
|
||||
} else if (insuranceBaseInfo == null && moreBaseInfos.size() == 0) {
|
||||
} else {
|
||||
//新增社保、公积金、其他福利档案
|
||||
// 新增基础信息
|
||||
baseInfoAddTodoList.add(InsuranceArchivesBaseInfoPO.builder()
|
||||
|
|
@ -85,7 +85,7 @@ public class InsuranceArchivesBaseInfoBO {
|
|||
}
|
||||
// 如果是删除 说明:如果有档案并且是在缴纳中才处理,没档案不用管
|
||||
} else if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.DEL.getValue()) {
|
||||
if (insuranceBaseInfo != null && moreBaseInfos.size() == 1) {
|
||||
if (insuranceBaseInfo != null) {
|
||||
if (insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue())) {
|
||||
// 正在缴纳->待减员
|
||||
insuranceBaseInfo.setRunStatus(EmployeeStatusEnum.STAY_DEL.getValue());
|
||||
|
|
|
|||
|
|
@ -53,4 +53,12 @@ public class InsuranceArchivesEmployeePO {
|
|||
private Long otherSchemeId;
|
||||
|
||||
private Long baseInfoId;
|
||||
/**
|
||||
* 社保、公积金、其他福利档案id
|
||||
*/
|
||||
private Long socialId;
|
||||
|
||||
private Long fundId;
|
||||
|
||||
private Long otherId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.mapper.siarchives;
|
||||
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -22,6 +23,14 @@ public interface FundSchemeMapper {
|
|||
*/
|
||||
List<InsuranceArchivesFundSchemePO> getFundByEmployeeId(@Param("employeeIds")List<Long> employeeId);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴人id获取记录
|
||||
* @param insuranceArchivesEmployeePO
|
||||
* @return
|
||||
*/
|
||||
List<InsuranceArchivesFundSchemePO> getFundByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesEmployeePO insuranceArchivesEmployeePO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
* @param ids
|
||||
|
|
@ -35,6 +44,11 @@ public interface FundSchemeMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesFundSchemePO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO);
|
||||
/**
|
||||
* 批量保存
|
||||
* @param singletonList
|
||||
|
|
|
|||
|
|
@ -58,6 +58,16 @@
|
|||
|
||||
</select>
|
||||
|
||||
<!-- 根据人员id和个税扣缴人id获取记录 -->
|
||||
<select id="getFundByEmployeeIdAndPayOrg" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_fund_archives t
|
||||
WHERE delete_type = 0
|
||||
AND employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取记录 -->
|
||||
<select id="getFundById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
|
|
@ -86,6 +96,15 @@
|
|||
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
||||
UPDATE hrsa_fund_archives
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量保存 -->
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_fund_archives(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.mapper.siarchives;
|
|||
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
|
||||
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -49,6 +50,11 @@ public interface InsuranceBaseInfoMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds")List<Long> employeeIds);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesBaseInfoPO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO);
|
||||
/**
|
||||
* 根据个税扣缴义务人id获取基础信息列表
|
||||
* @param paymentOrganization
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@
|
|||
fund.id AS fundArchivesId,
|
||||
other.id AS otherArchivesId
|
||||
FROM hrsa_social_archives social
|
||||
LEFT JOIN( SELECT fund.employee_id, fund.id FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON social.employee_id = fund.employee_id
|
||||
LEFT JOIN( SELECT other.employee_id, other.id FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON social.employee_id = other.employee_id
|
||||
LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.id FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON social.employee_id = fund.employee_id AND social.payment_organization = fund.payment_organization
|
||||
LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.id FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON social.employee_id = other.employee_id AND social.payment_organization = other.payment_organization
|
||||
WHERE
|
||||
social.delete_type = 0
|
||||
<if test="employeeIds != null and employeeIds.size()>0">
|
||||
|
|
@ -156,6 +156,15 @@
|
|||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
UPDATE hrsa_insurance_base_info
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 根据个税扣缴义务人id获取记录 -->
|
||||
<select id="getSocialByPaymentOrganization" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
SELECT
|
||||
|
|
@ -169,17 +178,17 @@
|
|||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_insurance_base_info t
|
||||
LEFT JOIN( SELECT social.employee_id, social.social_end_time FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id
|
||||
LEFT JOIN( SELECT fund.employee_id, fund.fund_end_time FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id
|
||||
LEFT JOIN( SELECT other.employee_id, other.other_end_time FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id
|
||||
LEFT JOIN( SELECT social.payment_organization, social.employee_id, social.social_end_time FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id AND t.payment_organization = social.payment_organization
|
||||
LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.fund_end_time FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id AND t.payment_organization = fund.payment_organization
|
||||
LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.other_end_time FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id AND t.payment_organization = other.payment_organization
|
||||
WHERE t.delete_type = 0
|
||||
AND t.run_status = '3'
|
||||
AND (
|
||||
(social.social_end_time is not null and social.social_end_time <![CDATA[ <> ]]> '' and social.social_end_time <![CDATA[ > ]]> #{today})
|
||||
(social.social_end_time is not null and social.social_end_time <![CDATA[ <> ]]> ' ' and social.social_end_time <![CDATA[ > ]]> #{today})
|
||||
OR
|
||||
(fund.fund_end_time is not null and fund.fund_end_time <![CDATA[ <> ]]> '' and fund.fund_end_time <![CDATA[ > ]]> #{today})
|
||||
(fund.fund_end_time is not null and fund.fund_end_time <![CDATA[ <> ]]> ' ' and fund.fund_end_time <![CDATA[ > ]]> #{today})
|
||||
OR
|
||||
(other.other_end_time is not null and other.other_end_time <![CDATA[ <> ]]> '' and other.other_end_time <![CDATA[ > ]]> #{today})
|
||||
(other.other_end_time is not null and other.other_end_time <![CDATA[ <> ]]> ' ' and other.other_end_time <![CDATA[ > ]]> #{today})
|
||||
)
|
||||
</select>
|
||||
|
||||
|
|
@ -187,14 +196,14 @@
|
|||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_insurance_base_info t
|
||||
LEFT JOIN( SELECT social.employee_id, social.social_end_time FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id
|
||||
LEFT JOIN( SELECT fund.employee_id, fund.fund_end_time FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id
|
||||
LEFT JOIN( SELECT other.employee_id, other.other_end_time FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id
|
||||
LEFT JOIN( SELECT social.payment_organization, social.employee_id, social.social_end_time FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id AND t.payment_organization = social.payment_organization
|
||||
LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.fund_end_time FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id AND t.payment_organization = fund.payment_organization
|
||||
LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.other_end_time FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id AND t.payment_organization = other.payment_organization
|
||||
WHERE t.delete_type = 0
|
||||
AND t.run_status = '2'
|
||||
AND social.social_end_time is not null and social.social_end_time <![CDATA[ <> ]]> '' and social.social_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND fund.fund_end_time is not null and fund.fund_end_time <![CDATA[ <> ]]> '' and fund.fund_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND other.other_end_time is not null and other.other_end_time <![CDATA[ <> ]]> '' and other.other_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND social.social_end_time is not null and social.social_end_time <![CDATA[ <> ]]> ' ' and social.social_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND fund.fund_end_time is not null and fund.fund_end_time <![CDATA[ <> ]]> ' ' and fund.fund_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND other.other_end_time is not null and other.other_end_time <![CDATA[ <> ]]> ' ' and other.other_end_time <![CDATA[ <= ]]> #{today}
|
||||
</select>
|
||||
|
||||
<select id="getAbnormalList" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.engine.salary.mapper.siarchives;
|
||||
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -22,6 +24,13 @@ public interface OtherSchemeMapper {
|
|||
*/
|
||||
List<InsuranceArchivesOtherSchemePO> getOtherByEmployeeId(@Param("employeeIds")List<Long> employeeId);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴人id获取记录
|
||||
* @param insuranceArchivesEmployeePO
|
||||
* @return
|
||||
*/
|
||||
List<InsuranceArchivesOtherSchemePO> getOtherByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesEmployeePO insuranceArchivesEmployeePO);
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
* @param ids
|
||||
|
|
@ -35,6 +44,11 @@ public interface OtherSchemeMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesOtherSchemePO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO);
|
||||
/**
|
||||
* 批量保存
|
||||
* @param singletonList
|
||||
|
|
|
|||
|
|
@ -54,6 +54,16 @@
|
|||
|
||||
</select>
|
||||
|
||||
<!-- 根据人员id和个税扣缴人id获取记录 -->
|
||||
<select id="getOtherByEmployeeIdAndPayOrg" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_other_archives t
|
||||
WHERE delete_type = 0
|
||||
AND employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取记录 -->
|
||||
<select id="getOtherById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
|
|
@ -82,6 +92,15 @@
|
|||
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO">
|
||||
UPDATE hrsa_other_archives
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量保存 -->
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_other_archives(
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ public interface SocialSchemeMapper {
|
|||
*/
|
||||
List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeId(@Param("employeeIds")List<Long> employeeId);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴人id获取记录
|
||||
* @param insuranceArchivesEmployeePO
|
||||
* @return
|
||||
*/
|
||||
List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeIdAndPayOrg(@Param("param")InsuranceArchivesEmployeePO insuranceArchivesEmployeePO);
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
* @param ids
|
||||
|
|
@ -37,6 +44,11 @@ public interface SocialSchemeMapper {
|
|||
*/
|
||||
void batchDeleteByEmployeeIds(@Param("employeeIds") Collection<Long> singletonList);
|
||||
|
||||
/**
|
||||
* 根据人员id和个税扣缴义务人删除档案
|
||||
* @param insuranceArchivesSocialSchemePO
|
||||
*/
|
||||
void deleteByEmployeeIdAndPayOrg(@Param("param") InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);
|
||||
/**
|
||||
* 批量保存
|
||||
* @param singletonList
|
||||
|
|
|
|||
|
|
@ -55,6 +55,16 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据人员id和个税扣缴人id获取记录 -->
|
||||
<select id="getSocialByEmployeeIdAndPayOrg" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_social_archives t
|
||||
WHERE delete_type = 0
|
||||
AND employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取记录 -->
|
||||
<select id="getSocialById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
|
|
@ -82,6 +92,15 @@
|
|||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 根据人员id和个税扣缴义务人删除档案 -->
|
||||
<update id="deleteByEmployeeIdAndPayOrg" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO">
|
||||
UPDATE hrsa_social_archives
|
||||
SET delete_type = 1
|
||||
WHERE employee_id = #{param.employeeId}
|
||||
AND payment_organization = #{param.paymentOrganization}
|
||||
AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量保存 -->
|
||||
<insert id="batchSave">
|
||||
INSERT INTO hrsa_social_archives(
|
||||
|
|
@ -312,14 +331,18 @@
|
|||
social.siSchemeId,
|
||||
base.payment_organization AS paymentOrganization,
|
||||
fund.fundSchemeId,
|
||||
other.otherSchemeId
|
||||
other.otherSchemeId,
|
||||
social.id AS socialId,
|
||||
fund.id AS fundId,
|
||||
other.id AS otherId
|
||||
|
||||
FROM hrsa_insurance_base_info base
|
||||
LEFT JOIN hrmresource e ON base.employee_id = e.id
|
||||
LEFT JOIN hrmdepartment d ON e.departmentid = d.ID
|
||||
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
||||
LEFT JOIN( SELECT social.employee_id, social.social_scheme_id AS siSchemeId, social.payment_organization AS paymentOrganization FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON e.id = social.employee_id
|
||||
LEFT JOIN( SELECT fund.employee_id, fund.fund_scheme_id AS fundSchemeId FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON e.id = fund.employee_id
|
||||
LEFT JOIN( SELECT other.employee_id, other.other_scheme_id AS otherSchemeId FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON e.id = other.employee_id
|
||||
LEFT JOIN( SELECT social.id, social.employee_id, social.social_scheme_id AS siSchemeId, social.payment_organization FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON e.id = social.employee_id AND base.payment_organization = social.payment_organization
|
||||
LEFT JOIN( SELECT fund.id, fund.employee_id, fund.fund_scheme_id AS fundSchemeId, fund.payment_organization FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON e.id = fund.employee_id AND base.payment_organization = fund.payment_organization
|
||||
LEFT JOIN( SELECT other.id, other.employee_id, other.other_scheme_id AS otherSchemeId, other.payment_organization FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON e.id = other.employee_id AND base.payment_organization = other.payment_organization
|
||||
WHERE
|
||||
1=1
|
||||
AND base.delete_type = 0
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ public interface ColumnBuildService {
|
|||
|
||||
List<WeaTableColumn> buildCommonColumns(List<InsuranceAccountDetailPO> pos);
|
||||
|
||||
List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos);
|
||||
List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos, Long paymentOrganization);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ public interface RecordsBuildService {
|
|||
|
||||
List<Map<String, Object>> buildCommonRecordsWithStyle(List<InsuranceAccountDetailPO> list, Long employeeId);
|
||||
|
||||
List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list);
|
||||
List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list, Long paymentOrganization);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,11 +289,11 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos) {
|
||||
public List<WeaTableColumn> buildInspectColumns(List<InsuranceAccountInspectPO> pos, Long paymentOrganization) {
|
||||
List<WeaTableColumn> list = new ArrayList<>();
|
||||
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
|
||||
List<Long> employeeIds = pos.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList());
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
|
||||
Map<String, String> categoryIdNameMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName));
|
||||
Map<Integer, Map<String, String>> columns = buildInspectTableTitle(new ArrayList<>(insuranceArchivesAccountPOMap.values()), categoryIdNameMap);
|
||||
WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName");
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list) {
|
||||
public List<Map<String, Object>> buildInspectRecords(List<InsuranceAccountInspectPO> list, Long paymentOrganization) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
|
|
@ -201,7 +201,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
|
|||
return result;
|
||||
}
|
||||
Map<Long, DataCollectionEmployee> collect = employeeByIds.stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity()));
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds);
|
||||
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
|
||||
list.forEach(item -> {
|
||||
Map<String, Object> record = new HashMap<>();
|
||||
DataCollectionEmployee simpleEmployee = collect.get(item.getEmployeeId()) == null ? new DataCollectionEmployee() : collect.get(item.getEmployeeId());
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
Long employeeId = (long) user.getUID();
|
||||
ValidUtil.doValidator(param);
|
||||
String currentUserName = user.getLastname();
|
||||
getSiAccountBiz(user).accountInspect(param.getIds(), param.getBillMonth(), employeeId, currentUserName);
|
||||
getSiAccountBiz(user).accountInspect(param.getIds(), param.getBillMonth(), employeeId, currentUserName, param.getPaymentOrganization());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -585,14 +585,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
|
||||
SalaryPageUtil.start(param.getCurrent(), param.getPageSize());
|
||||
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByBillMonth(param.getBillMonth());
|
||||
List<Map<String, Object>> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS);
|
||||
List<Map<String, Object>> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization()));
|
||||
|
||||
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
||||
pageInfos.setTotal(records.size());
|
||||
pageInfos.setPageNum(param.getCurrent());
|
||||
pageInfos.setPageSize(param.getPageSize());
|
||||
|
||||
List<WeaTableColumn> weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS);
|
||||
List<WeaTableColumn> weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization()));
|
||||
WeaTable table = new WeaTable();
|
||||
table.setPageUID(UUID.randomUUID().toString());
|
||||
table.setColumns(weaTableColumns);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
siArchivesBiz.setTaxAgentPOS(taxAgentPOS);
|
||||
WelfareTypeEnum welfareTypeEnum = (WelfareTypeEnum) params.get("welfareTypeEnum");
|
||||
Long employeeId = Long.valueOf(Util.null2String(params.get("employeeId")));
|
||||
apidatas = siArchivesBiz.getBaseForm(welfareTypeEnum, employeeId, (long) user.getUID(), user);
|
||||
Long paymentOrganization = welfareTypeEnum != null ? Long.valueOf(Util.null2String(params.get("paymentOrganization"))) : null;
|
||||
apidatas = siArchivesBiz.getBaseForm(welfareTypeEnum, employeeId, (long) user.getUID(), user, paymentOrganization);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
|
@ -111,12 +112,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
WelfareTypeEnum welfareTypeEnum = (WelfareTypeEnum) params.get("welfareTypeEnum");
|
||||
Long employeeId = Long.valueOf(Util.null2String(params.get("employeeId")));
|
||||
String schemeIdStr = Util.null2String(params.get("schemeId"));
|
||||
Long paymentOrganization = Long.valueOf(Util.null2String(params.get("paymentOrganization")));
|
||||
Long schemeId = null;
|
||||
if (StringUtils.isNotBlank(schemeIdStr)) {
|
||||
schemeId = Long.valueOf(schemeIdStr);
|
||||
}
|
||||
|
||||
apidatas = siArchivesBiz.getPaymentForm(user, welfareTypeEnum, employeeId, (long) user.getUID(), schemeId);
|
||||
apidatas = siArchivesBiz.getPaymentForm(user, welfareTypeEnum, employeeId, (long) user.getUID(), schemeId, paymentOrganization);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
|
@ -238,6 +240,26 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
});
|
||||
|
||||
}
|
||||
//对于逻辑删除的数据,同样逻辑删除相关的社保、公积金、其他福利档案
|
||||
List<InsuranceArchivesBaseInfoPO> delList = changeData.getBaseInfoUpdateTodoList().stream()
|
||||
.filter(f -> f.getDeleteType().equals(DeleteTypeEnum.DELETED.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
if (delList.size() > 0) {
|
||||
for (InsuranceArchivesBaseInfoPO po : delList) {
|
||||
getSocialSchemeMapper().deleteByEmployeeIdAndPayOrg(InsuranceArchivesSocialSchemePO.builder()
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build());
|
||||
getFundSchemeMapper().deleteByEmployeeIdAndPayOrg(InsuranceArchivesFundSchemePO.builder()
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build());
|
||||
getOtherSchemeMapper().deleteByEmployeeIdAndPayOrg(InsuranceArchivesOtherSchemePO.builder()
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
//修改福利档案基础信息
|
||||
List<List<InsuranceArchivesBaseInfoPO>> partitionUpdateBase = Lists.partition(changeData.getBaseInfoUpdateTodoList(), 100);
|
||||
|
|
@ -301,44 +323,42 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
}
|
||||
//导入社保档案
|
||||
if (CollectionUtils.isNotEmpty(socialList)) {
|
||||
socialList = socialList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> socialEmployeeIds = socialList.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
socialList.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
|
||||
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(socialList, 100);
|
||||
partition.forEach(getSocialSchemeMapper()::batchSave);
|
||||
}
|
||||
//导入公积金档案
|
||||
if (CollectionUtils.isNotEmpty(fundList)) {
|
||||
fundList = fundList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> fundEmployeeIds = fundList.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
fundList.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
|
||||
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(fundList, 100);
|
||||
partition.forEach(getFundSchemeMapper()::batchSave);
|
||||
}
|
||||
//导入其他福利档案
|
||||
if (CollectionUtils.isNotEmpty(otherList)) {
|
||||
otherList = otherList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> otherEmployeeIds = otherList.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
otherList.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
|
||||
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(otherList, 100);
|
||||
partition.forEach(getOtherSchemeMapper()::batchSave);
|
||||
}
|
||||
//导入福利档案基础信息
|
||||
if (CollectionUtils.isNotEmpty(baseInfoPOList)) {
|
||||
baseInfoPOList = baseInfoPOList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesBaseInfoPO::getEmployeeId))), ArrayList::new));
|
||||
//分批批量删除
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
baseInfoPOList.forEach(getInsuranceBaseInfoMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// //分批批量删除
|
||||
List<Long> baseInfoEmployeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100);
|
||||
employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds);
|
||||
|
||||
//查询目标人员的剩余的福利档案基础信息(社保、公积金、其他福利档案id)
|
||||
List<InsuranceArchivesBaseInfoPO> moreBaseInfoPOS = getInsuranceBaseInfoMapper().getInsuranceBaseInfoListByInsuranceDetail(baseInfoEmployeeIds);
|
||||
List<InsuranceArchivesBaseInfoPO> newInsuranceArchivesBaseInfoList = new ArrayList<>();
|
||||
//设置社保、公积金、其他福利档案id
|
||||
for (InsuranceArchivesBaseInfoPO po : baseInfoPOList) {
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId())).findFirst().orElse(null);
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId()) && Objects.equals(s.getPaymentOrganization(), po.getPaymentOrganization())).findFirst().orElse(null);
|
||||
po.setSocialArchivesId(moreBaseInfo.getSocialArchivesId());
|
||||
po.setFundArchivesId(moreBaseInfo.getFundArchivesId());
|
||||
po.setOtherArchivesId(moreBaseInfo.getOtherArchivesId());
|
||||
|
|
@ -559,20 +579,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
|
||||
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
|
||||
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
|
||||
//分别新建福利档案基础信息相关的社保、公积金、其他福利档案可以进行减员的人员列表
|
||||
List<Long> toStopSocialEmployeeIdList = new ArrayList<>();
|
||||
List<Long> toStopFundEmployeeIdList = new ArrayList<>();
|
||||
List<Long> toStopOtherEmployeeIdList = new ArrayList<>();
|
||||
//分别新建福利档案基础信息相关的社保、公积金、其他福利档案不可以进行减员的人员列表
|
||||
List<Long> noStopSocialEmployeeIdList = new ArrayList<>();
|
||||
List<Long> noStopFundEmployeeIdList = new ArrayList<>();
|
||||
List<Long> noStopOtherEmployeeIdList = new ArrayList<>();
|
||||
//新建最终可以进行减员的人员列表
|
||||
List<Long> toStopEmployeeIdList = new ArrayList<>();
|
||||
//新建最终不可以进行减员的人员列表
|
||||
List<Long> noStopEmployeeIds = new ArrayList<>();
|
||||
//获取待处理的员工id列表
|
||||
List<Long> employeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
|
||||
|
||||
//新建最终可以进行减员的福利档案基础信息id列表
|
||||
List<Long> toStopBaseInfoIdList = new ArrayList<>();
|
||||
//新建最终不可以进行减员的福利档案基础信息id列表
|
||||
List<Long> noStopBaseInfoIds = new ArrayList<>();
|
||||
//获取待处理的福利档案基础信息id列表
|
||||
List<Long> baseInfoIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
//设置最后缴纳月的比较月份
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
|
||||
String todayMonth = simpleDateFormat.format(new Date());
|
||||
|
|
@ -580,49 +593,54 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
List<Long> socialIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList());
|
||||
List<Long> fundIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList());
|
||||
List<Long> otherIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList());
|
||||
|
||||
List<Long> toStopSocialIds = new ArrayList<>();
|
||||
List<Long> toStopFundIds = new ArrayList<>();
|
||||
List<Long> toStopOtherIds = new ArrayList<>();
|
||||
//获取可进行减员的社保档案相关人员数据
|
||||
if (socialIds.size() > 0) {
|
||||
//获取社保档案
|
||||
socialList = getSocialSchemeMapper().getSocialById(socialIds);
|
||||
//筛选可减员的社保档案相关人员信息
|
||||
toStopSocialEmployeeIdList = socialList.stream().filter(f->f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0 && (f.getSocialEndTime().compareTo(todayMonth)) <= 0)
|
||||
.map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
//获取不可减员的社保档案相关人员信息
|
||||
if (toStopSocialEmployeeIdList.size() != baseInfoPOList.size()) {
|
||||
noStopSocialEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toStopSocialEmployeeIdList);
|
||||
}
|
||||
//筛选可减员的社保档案相关信息
|
||||
|
||||
toStopSocialIds = socialList.stream().filter(f->f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0 && (f.getSocialEndTime().compareTo(todayMonth)) <= 0)
|
||||
.map(InsuranceArchivesSocialSchemePO::getId).collect(Collectors.toList());
|
||||
//
|
||||
List<Long> finalToStopSocialIds = toStopSocialIds;
|
||||
noStopBaseInfoIds = baseInfoPOList.stream().filter(f -> !finalToStopSocialIds.contains(f.getSocialArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
if (fundIds.size() > 0) {
|
||||
fundList = getFundSchemeMapper().getFundById(fundIds);
|
||||
toStopFundEmployeeIdList = fundList.stream().filter(f->f.getFundEndTime() != null && f.getFundEndTime().length() > 0 && (f.getFundEndTime().compareTo(todayMonth)) <= 0)
|
||||
.map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
if (toStopFundEmployeeIdList.size() != baseInfoPOList.size()) {
|
||||
noStopFundEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toStopFundEmployeeIdList);
|
||||
}
|
||||
|
||||
toStopFundIds = fundList.stream().filter(f->f.getFundEndTime() != null && f.getFundEndTime().length() > 0 && (f.getFundEndTime().compareTo(todayMonth)) <= 0)
|
||||
.map(InsuranceArchivesFundSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopFundIds = toStopFundIds;
|
||||
noStopBaseInfoIds = (List<Long>) CollectionUtils.union(noStopBaseInfoIds, baseInfoPOList.stream().filter(f -> !finalToStopFundIds.contains(f.getFundArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
if (otherIds.size() > 0) {
|
||||
otherList = getOtherSchemeMapper().getOtherById(otherIds);
|
||||
toStopOtherEmployeeIdList = otherList.stream().filter(f->f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0 && (f.getOtherEndTime().compareTo(todayMonth)) <= 0)
|
||||
.map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
if (toStopOtherEmployeeIdList.size() != baseInfoPOList.size()) {
|
||||
noStopOtherEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toStopOtherEmployeeIdList);
|
||||
}
|
||||
|
||||
toStopOtherIds= otherList.stream().filter(f->f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0 && (f.getOtherEndTime().compareTo(todayMonth)) <= 0)
|
||||
.map(InsuranceArchivesOtherSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopOtherIds = toStopOtherIds;
|
||||
noStopBaseInfoIds = (List<Long>) CollectionUtils.union(noStopBaseInfoIds, baseInfoPOList.stream().filter(f -> !finalToStopOtherIds.contains(f.getOtherArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
//获取最终基础信息表中的可减员数据
|
||||
if (noStopSocialEmployeeIdList.size() == 0 && noStopFundEmployeeIdList.size() == 0 && noStopOtherEmployeeIdList.size() ==0) {
|
||||
if (noStopBaseInfoIds.size() == 0) {
|
||||
//社保、公积金、其他福利档案的可减员的人员信息与入参中的人员信息一致时
|
||||
toStopEmployeeIdList = employeeIds;
|
||||
toStopBaseInfoIdList = baseInfoIds;
|
||||
} else {
|
||||
//社保、公积金、其他福利档案的可减员的人员信息与入参中的人员信息不一致时,取三类档案不可减员的人员并集,作为最终不可减员的人员信息
|
||||
noStopEmployeeIds = (List<Long>) CollectionUtils.union(CollectionUtils.union(noStopSocialEmployeeIdList, noStopFundEmployeeIdList), noStopOtherEmployeeIdList);
|
||||
//入参人员信息和最终不可减员的人员信息做差集,获得最终可减员的人员信息
|
||||
toStopEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, noStopEmployeeIds);
|
||||
|
||||
//与最终不可减员的baseInfoId信息做差集
|
||||
toStopBaseInfoIdList = (List<Long>) CollectionUtils.subtract(baseInfoIds, noStopBaseInfoIds);
|
||||
}
|
||||
//进行减员操作
|
||||
if (toStopEmployeeIdList.size() > 0) {
|
||||
getInsuranceBaseInfoMapper().updateRunStatusByEmployeeIds(InsuranceArchivesBaseInfoPO.builder()
|
||||
.employeeIds(toStopEmployeeIdList).runStatus(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()).build());
|
||||
if (toStopBaseInfoIdList.size() > 0) {
|
||||
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
|
||||
.ids(toStopBaseInfoIdList).runStatus(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()).build());
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>(2);
|
||||
|
|
@ -631,7 +649,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
// 批量设为定薪提示
|
||||
|
||||
//输出结果,此处需区分单一减员和批量减员
|
||||
if (baseInfoPOList.size() == toStopEmployeeIdList.size()) {
|
||||
if (baseInfoPOList.size() == toStopBaseInfoIdList.size()) {
|
||||
//减员成功
|
||||
if (baseInfoPOList.size() == 1) {
|
||||
resultMsg = "减员成功";
|
||||
|
|
@ -648,9 +666,9 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
|
||||
} else {
|
||||
resultMsg = "部分或全部失败:【共提交减员数据"
|
||||
+ employeeIds.size()
|
||||
+"条,成功" + toStopEmployeeIdList.size()
|
||||
+"条,失败" + noStopEmployeeIds.size()
|
||||
+ baseInfoIds.size()
|
||||
+"条,成功" + toStopBaseInfoIdList.size()
|
||||
+"条,失败" + noStopBaseInfoIds.size()
|
||||
+"条,失败原因:数据未正常维护】";
|
||||
|
||||
}
|
||||
|
|
@ -693,20 +711,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
|
||||
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
|
||||
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
|
||||
//分别新建福利档案基础信息相关的社保、公积金、其他福利档案可以进行增员的人员列表
|
||||
List<Long> toPaySocialEmployeeIdList = new ArrayList<>();
|
||||
List<Long> toPayFundEmployeeIdList = new ArrayList<>();
|
||||
List<Long> toPayOtherEmployeeIdList = new ArrayList<>();
|
||||
//分别新建福利档案基础信息相关的社保、公积金、其他福利档案不可以进行增员的人员列表
|
||||
List<Long> noPaySocialEmployeeIdList = new ArrayList<>();
|
||||
List<Long> noPayFundEmployeeIdList = new ArrayList<>();
|
||||
List<Long> noPayOtherEmployeeIdList = new ArrayList<>();
|
||||
//新建最终可以进行增员的人员列表
|
||||
List<Long> toPayEmployeeIdList = new ArrayList<>();
|
||||
//新建最终不可以进行增员的人员列表
|
||||
List<Long> noPayEmployeeIds = new ArrayList<>();
|
||||
//获取待处理的员工id列表
|
||||
List<Long> employeeIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
|
||||
|
||||
//新建最终可以进行增员的福利档案基础信息id列表
|
||||
List<Long> toPayBaseInfoIdList = new ArrayList<>();
|
||||
//新建最终不可以进行增员的福利档案基础信息id列表
|
||||
List<Long> noPayBaseInfoIds = new ArrayList<>();
|
||||
//获取待处理的福利档案基础信息id列表
|
||||
List<Long> baseInfoIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
//设置最后缴纳月的比较月份
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
|
||||
String todayMonth = simpleDateFormat.format(new Date());
|
||||
|
|
@ -714,12 +725,16 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
List<Long> socialIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList());
|
||||
List<Long> fundIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList());
|
||||
List<Long> otherIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList());
|
||||
|
||||
List<Long> toStopSocialIds = new ArrayList<>();
|
||||
List<Long> toStopFundIds = new ArrayList<>();
|
||||
List<Long> toStopOtherIds = new ArrayList<>();
|
||||
//获取可进行增员的社保档案相关人员数据
|
||||
if (socialIds.size() > 0) {
|
||||
//获取社保档案
|
||||
socialList = getSocialSchemeMapper().getSocialById(socialIds);
|
||||
//筛选可增员的社保档案相关人员信息
|
||||
toPaySocialEmployeeIdList = socialList.stream().filter(f->
|
||||
toStopSocialIds = socialList.stream().filter(f->
|
||||
{
|
||||
boolean flag = true;
|
||||
if (f.getSocialStartTime() == null || f.getSocialStartTime().length() == 0 || f.getSocialSchemeId() == null) {
|
||||
|
|
@ -730,16 +745,15 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
}
|
||||
return flag;
|
||||
})
|
||||
.map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
//获取不可增员的社保档案相关人员信息
|
||||
if (toPaySocialEmployeeIdList.size() != baseInfoPOList.size()) {
|
||||
noPaySocialEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPaySocialEmployeeIdList);
|
||||
}
|
||||
.map(InsuranceArchivesSocialSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopSocialIds = toStopSocialIds;
|
||||
toPayBaseInfoIdList = baseInfoPOList.stream().filter(f -> finalToStopSocialIds.contains(f.getSocialArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
|
||||
|
||||
}
|
||||
if (fundIds.size() > 0) {
|
||||
fundList = getFundSchemeMapper().getFundById(fundIds);
|
||||
toPayFundEmployeeIdList = fundList.stream().filter(f->
|
||||
toStopFundIds = fundList.stream().filter(f->
|
||||
{
|
||||
boolean flag = true;
|
||||
if (f.getFundStartTime() == null || f.getFundStartTime().length() == 0 || f.getFundSchemeId() == null) {
|
||||
|
|
@ -751,13 +765,13 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
return flag;
|
||||
})
|
||||
.map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
if (toPayFundEmployeeIdList.size() != baseInfoPOList.size()) {
|
||||
noPayFundEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPayFundEmployeeIdList);
|
||||
}
|
||||
List<Long> finalToStopFundIds = toStopFundIds;
|
||||
toPayBaseInfoIdList = (List<Long>) CollectionUtils.union(toPayBaseInfoIdList, baseInfoPOList.stream().filter(f -> finalToStopFundIds.contains(f.getFundArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
if (otherIds.size() > 0) {
|
||||
otherList = getOtherSchemeMapper().getOtherById(otherIds);
|
||||
toPayOtherEmployeeIdList = otherList.stream().filter(f->
|
||||
toStopOtherIds = otherList.stream().filter(f->
|
||||
{
|
||||
boolean flag = true;
|
||||
if (f.getOtherStartTime() == null || f.getOtherStartTime().length() == 0 || f.getOtherSchemeId() == null) {
|
||||
|
|
@ -769,26 +783,19 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
return flag;
|
||||
})
|
||||
.map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
if (toPayOtherEmployeeIdList.size() != baseInfoPOList.size()) {
|
||||
noPayOtherEmployeeIdList = (List<Long>) CollectionUtils.subtract(employeeIds, toPayOtherEmployeeIdList);
|
||||
}
|
||||
}
|
||||
//获取最终基础信息表中的可增员数据
|
||||
if (noPaySocialEmployeeIdList.size() == 0 && noPayFundEmployeeIdList.size() == 0 && noPayOtherEmployeeIdList.size() ==0) {
|
||||
//社保、公积金、其他福利档案的可增员的人员信息与入参中的人员信息一致时
|
||||
toPayEmployeeIdList = employeeIds;
|
||||
} else {
|
||||
//社保、公积金、其他福利档案的可增员的人员信息与入参中的人员信息不一致时,取三类档案可增员的人员并集,作为最终可增员的人员信息
|
||||
toPayEmployeeIdList = (List<Long>) CollectionUtils.union(CollectionUtils.union(toPaySocialEmployeeIdList, toPayFundEmployeeIdList), toPayOtherEmployeeIdList);
|
||||
//入参人员信息和最终可增员的人员信息做差集,获得最终不可增员的人员信息
|
||||
noPayEmployeeIds = (List<Long>) CollectionUtils.subtract(employeeIds, toPayEmployeeIdList);
|
||||
List<Long> finalToStopOtherIds = toStopOtherIds;
|
||||
toPayBaseInfoIdList = (List<Long>) CollectionUtils.union(toPayBaseInfoIdList, baseInfoPOList.stream().filter(f -> finalToStopOtherIds.contains(f.getOtherArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
//获取最终基础信息表中的不可增员数据
|
||||
noPayBaseInfoIds = (List<Long>) CollectionUtils.subtract(baseInfoIds, toPayBaseInfoIdList);
|
||||
|
||||
//其他的个税扣缴义务人下的在缴员工中存在该员工,在缴员工未进入停缴员工时,不可进行增员
|
||||
|
||||
//进行增员操作
|
||||
if (toPayEmployeeIdList.size() > 0) {
|
||||
getInsuranceBaseInfoMapper().updateRunStatusByEmployeeIds(InsuranceArchivesBaseInfoPO.builder()
|
||||
.employeeIds(toPayEmployeeIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
|
||||
if (toPayBaseInfoIdList.size() > 0) {
|
||||
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
|
||||
.ids(toPayBaseInfoIdList).runStatus(EmployeeStatusEnum.PAYING.getValue()).build());
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>(2);
|
||||
|
|
@ -797,7 +804,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
// 批量设为定薪提示
|
||||
|
||||
//输出结果,此处需区分单一增员和批量增员
|
||||
if (baseInfoPOList.size() == toPayEmployeeIdList.size()) {
|
||||
if (baseInfoPOList.size() == toPayBaseInfoIdList.size()) {
|
||||
//增员成功
|
||||
if (baseInfoPOList.size() == 1) {
|
||||
resultMsg = "增员成功";
|
||||
|
|
@ -812,9 +819,9 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
resultMsg = "增员失败,失败原因:数据未正常维护";
|
||||
} else {
|
||||
resultMsg = "部分或全部失败:【共提交增员数据"
|
||||
+ employeeIds.size()
|
||||
+"条,成功" + toPayEmployeeIdList.size()
|
||||
+"条,失败" + noPayEmployeeIds.size()
|
||||
+ baseInfoIds.size()
|
||||
+"条,成功" + toPayBaseInfoIdList.size()
|
||||
+"条,失败" + noPayBaseInfoIds.size()
|
||||
+"条,失败原因:数据未正常维护】";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -811,16 +811,16 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
isError = true;
|
||||
}
|
||||
|
||||
//判断是否存在其他个税扣缴义务人下的该员工福利档案
|
||||
// 所有福利档案基础信息数据
|
||||
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
||||
List<InsuranceArchivesBaseInfoPO> otherTaxBaseInfos = baseInfoPOList.stream().filter(f -> f.getEmployeeId().equals(employeeId) && !f.getPaymentOrganization().equals(paymentOrgId)).collect(Collectors.toList());
|
||||
if (otherTaxBaseInfos.size() > 0) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据相关人员已存在其他个税扣缴义务人下的福利档案,不可导入"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
// //判断是否存在其他个税扣缴义务人下的该员工福利档案
|
||||
// // 所有福利档案基础信息数据
|
||||
// List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
||||
// List<InsuranceArchivesBaseInfoPO> otherTaxBaseInfos = baseInfoPOList.stream().filter(f -> f.getEmployeeId().equals(employeeId) && !f.getPaymentOrganization().equals(paymentOrgId)).collect(Collectors.toList());
|
||||
// if (otherTaxBaseInfos.size() > 0) {
|
||||
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
// errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据相关人员已存在其他个税扣缴义务人下的福利档案,不可导入"));
|
||||
// excelComments.add(errorMessageMap);
|
||||
// isError = true;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1115,10 +1115,12 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
//导入社保档案
|
||||
List<InsuranceArchivesSocialSchemePO> socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(socialSchemePOS)) {
|
||||
socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
// socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
socialSchemePOS.forEach(getSocialSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
||||
// socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePOS = InsuranceArchivesSocialSchemePOEncrypt.encryptList(socialSchemePOS);
|
||||
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(insuranceArchivesSocialSchemePOS, 100);
|
||||
partition.forEach(getSocialSchemeMapper()::batchSave);
|
||||
|
|
@ -1126,10 +1128,12 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
//导入公积金档案
|
||||
List<InsuranceArchivesFundSchemePO> fundSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getFund).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(fundSchemePOS)) {
|
||||
fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
// fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
fundSchemePOS.forEach(getFundSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
||||
// fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
List<InsuranceArchivesFundSchemePO> insuranceArchivesFundSchemePOS = InsuranceArchivesFundSchemePOEncrypt.encryptList(fundSchemePOS);
|
||||
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(insuranceArchivesFundSchemePOS, 100);
|
||||
partition.forEach(getFundSchemeMapper()::batchSave);
|
||||
|
|
@ -1137,10 +1141,12 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
//导入其他福利档案
|
||||
List<InsuranceArchivesOtherSchemePO> otherSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getOther).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(otherSchemePOS)) {
|
||||
otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
|
||||
List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
// otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
otherSchemePOS.forEach(getOtherSchemeMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
// List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
// List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
||||
// otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
||||
List<InsuranceArchivesOtherSchemePO> insuranceArchivesOtherSchemePOS = InsuranceArchivesOtherSchemePOEncrypt.encryptList(otherSchemePOS);
|
||||
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(insuranceArchivesOtherSchemePOS, 100);
|
||||
partition.forEach(getOtherSchemeMapper()::batchSave);
|
||||
|
|
@ -1148,17 +1154,19 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
//导入福利档案基础信息
|
||||
List<InsuranceArchivesBaseInfoPO> baseInfoPOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getBaseInfo).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(baseInfoPOS)) {
|
||||
baseInfoPOS = baseInfoPOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesBaseInfoPO::getEmployeeId))), ArrayList::new));
|
||||
// baseInfoPOS = baseInfoPOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesBaseInfoPO::getEmployeeId))), ArrayList::new));
|
||||
//根据人员id和个税扣缴义务人id删除对应档案
|
||||
baseInfoPOS.forEach(getInsuranceBaseInfoMapper()::deleteByEmployeeIdAndPayOrg);
|
||||
//分批批量删除
|
||||
List<Long> baseInfoEmployeeIds = baseInfoPOS.stream().map(InsuranceArchivesBaseInfoPO::getEmployeeId).collect(Collectors.toList());
|
||||
List<List<Long>> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100);
|
||||
employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds);
|
||||
// List<List<Long>> employeeIdPartition = Lists.partition(baseInfoEmployeeIds, 100);
|
||||
// employeeIdPartition.forEach(getInsuranceBaseInfoMapper()::batchDeleteByEmployeeIds);
|
||||
//查询目标人员的剩余的福利档案基础信息(社保、公积金、其他福利档案id)
|
||||
List<InsuranceArchivesBaseInfoPO> moreBaseInfoPOS = getInsuranceBaseInfoMapper().getInsuranceBaseInfoListByInsuranceDetail(baseInfoEmployeeIds);
|
||||
List<InsuranceArchivesBaseInfoPO> newInsuranceArchivesBaseInfoList = new ArrayList<>();
|
||||
//设置社保、公积金、其他福利档案id
|
||||
for (InsuranceArchivesBaseInfoPO po : baseInfoPOS) {
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId())).findFirst().orElse(null);
|
||||
InsuranceArchivesBaseInfoPO moreBaseInfo = moreBaseInfoPOS.stream().filter(s -> Objects.equals(s.getEmployeeId(), po.getEmployeeId()) && Objects.equals(s.getPaymentOrganization(), po.getPaymentOrganization())).findFirst().orElse(null);
|
||||
po.setSocialArchivesId(moreBaseInfo.getSocialArchivesId());
|
||||
po.setFundArchivesId(moreBaseInfo.getFundArchivesId());
|
||||
po.setOtherArchivesId(moreBaseInfo.getOtherArchivesId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue