社保方案起始缴纳和最后缴纳生效

This commit is contained in:
钱涛 2022-07-28 14:22:59 +08:00
parent d1e6cec693
commit 36e2f96ae5
2 changed files with 49 additions and 18 deletions

View File

@ -39,6 +39,7 @@ import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
@ -419,7 +420,9 @@ public class SIAccountBiz extends Service {
insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization());
insuranceAccountDetailPO.setOtherSchemeId(otherPO.getOtherSchemeId());
insuranceAccountDetailPO.setOtherPaymentBaseString(otherPO.getOtherPaymentBaseString());
if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null) {
//判断是否在起始缴纳月和最后缴纳月之间
Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), otherPO.getOtherStartTime(), otherPO.getOtherEndTime());
if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null && inDataRange) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(otherPO.getOtherSchemeId());
InsuranceSchemeDetailPOEncrypt.decryptList(detailPOS);
//方案中包含的需要缴纳其他的个人福利
@ -431,7 +434,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算其他的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
archivesPerson.forEach((id, value) -> {
if (otherPerson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
@ -468,7 +471,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算其他的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (otherCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
@ -508,7 +511,9 @@ public class SIAccountBiz extends Service {
insuranceAccountDetailPO.setSupplementFundAccount(fundPO.getSupplementFundAccount());
insuranceAccountDetailPO.setFundSchemeId(fundPO.getFundSchemeId());
insuranceAccountDetailPO.setFundPaymentBaseString(fundPO.getFundPaymentBaseString());
if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null) {
//判断是否在起始缴纳月和最后缴纳月之间
Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), fundPO.getFundStartTime(), fundPO.getFundEndTime());
if ((NonPaymentEnum.YES.getValue() == fundPO.getNonPayment() || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null && inDataRange) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(fundPO.getFundSchemeId());
InsuranceSchemeDetailPOEncrypt.decryptList(detailPOS);
//方案中包含的需要缴纳社保的个人福利
@ -520,7 +525,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算公积金的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
archivesPerson.forEach((id, value) -> {
if (fundperson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
@ -556,7 +561,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算公积金的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (fundCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
@ -597,7 +602,9 @@ public class SIAccountBiz extends Service {
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
if ((NonPaymentEnum.YES.getValue().equals(socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null) {
//判断是否在起始缴纳月和最后缴纳月之间
Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime());
if ((NonPaymentEnum.YES.getValue().equals(socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) {
List<InsuranceSchemeDetailPO> detailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryListBySchemeId(socialPO.getSocialSchemeId());
InsuranceSchemeDetailPOEncrypt.decryptList(detailPOS);
//方案中包含的需要缴纳社保的个人福利
@ -609,7 +616,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
archivesPerson.forEach((id, value) -> {
if (schemeperson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
@ -645,7 +652,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (schemeCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
@ -994,7 +1001,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算其他的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
archivesPerson.forEach((id, value) -> {
if (otherPerson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
@ -1032,7 +1039,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算其他的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (otherCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
@ -1084,7 +1091,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算公积金的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
archivesPerson.forEach((id, value) -> {
if (fundperson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
@ -1121,7 +1128,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算公积金的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (fundCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
@ -1173,7 +1180,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
archivesPerson.forEach((id, value) -> {
if (schemeperson.containsKey(Long.valueOf(id))) {
needArchivesPerson.add(Long.valueOf(id));
@ -1209,7 +1216,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (schemeCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));
@ -1261,7 +1268,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 个人
List<Long> needArchivesPerson = new ArrayList<>();
if(archivesPerson!=null){
if (archivesPerson != null) {
categoryIds.forEach(item -> {
if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) {
needArchivesPerson.add(item);
@ -1298,7 +1305,7 @@ public class SIAccountBiz extends Service {
HashMap<String, String> archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
//需要核算社保的福利id 单位
List<Long> needArchivesCom = new ArrayList<>();
if(archivesCom!=null){
if (archivesCom != null) {
archivesCom.forEach((id, value) -> {
if (schemeCom.containsKey(Long.valueOf(id))) {
needArchivesCom.add(Long.valueOf(id));

View File

@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.time.FastDateFormat;
import org.jetbrains.annotations.NotNull;
import weaver.general.BaseBean;
import java.text.ParseException;
@ -453,7 +454,7 @@ public class SalaryDateUtil {
return str;
}
private static Date dateStrToLocalDate(String date) {
public static Date dateStrToLocalDate(String date) {
Date localDate = null;
try {
date = date.substring(0, 10);
@ -489,6 +490,29 @@ public class SalaryDateUtil {
return localDate;
}
@NotNull
public static Boolean monthInRange(String billMonth, String startMonth, String endMonth) {
billMonth = billMonth + "-01";
Date billMonthDate = SalaryDateUtil.dateStrToLocalDate(billMonth);
Boolean inDataRange = true;
if (StringUtils.isNotBlank(startMonth)) {
startMonth = startMonth + "-01";
Date socialStartDate = SalaryDateUtil.dateStrToLocalDate(startMonth);
if (billMonthDate.before(socialStartDate)) {
inDataRange = false;
}
}
if (StringUtils.isNotBlank(endMonth)) {
endMonth = endMonth + "-01";
Date socialEndDate = SalaryDateUtil.dateStrToLocalDate(endMonth);
if (billMonthDate.after(socialEndDate)) {
inDataRange = false;
}
}
return inDataRange;
}
}