Commit 69a24780 authored by hongguangwu's avatar hongguangwu

工资拉取-社保公积金

parent 784ef949
......@@ -68,6 +68,12 @@ public class MSalaryEstimate {
@NotBlank(message = "类型:0:社保;1:公积金;不能为空")
@ExcelProperty("类型:0:社保;1:公积金;")
private Integer isSocial;
/**
* 来源类型:0:缴费库;1:预估库;
*/
@ExcelAttribute(name = "来源类型:0:缴费库;1:预估库;", isNotEmpty = true, errorInfo = "来源类型:0:缴费库;1:预估库;不能为空")
@ExcelProperty("来源类型:0:缴费库;1:预估库;")
private Integer type;
/**
* 类型:0:正常扣缴;1:无工资人员;
*/
......
......@@ -747,23 +747,23 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
}
if (!socialList.isEmpty()) {
//更新社保状态为-结算
HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
//更新社保状态为-结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tpaymentinfo/inner/updatePaymentSocialStatusToSettle", socialList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
if (!fundList.isEmpty()) {
//更新公积金状态为-结算
HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
//更新公积金状态为-结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tpaymentinfo/inner/updatePaymentFundStatusToSettle", fundList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
if (!forecastSocialList.isEmpty()) {
//更新社保状态为-结算
HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
//更新社保状态为-结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tforecastlibrary/inner/updateForecastSocialStatusToSettle", forecastSocialList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
if (!forecastFundList.isEmpty()) {
//更新公积金状态为-结算
HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
//更新公积金状态为-结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tforecastlibrary/inner/updateForecastFundStatusToSettle", forecastFundList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
//保存工资表
......@@ -772,10 +772,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
// 获取上一个工资条顺序,复制:
tSalaryStandardSetService.copyLastSetByDeptId(salary.getId(), dept.getId(), String.valueOf(user.getId()));
// 保存后,修改结算预警统计中的结算状态
List<String> deptIdList = new ArrayList<>();
deptIdList.add(dept.getId());
salaryDetailVo.setSalary(salary);
MSalaryEstimate se;
......@@ -787,6 +783,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
se.setEstimateId(estId);
se.setIsSocial(SalaryConstants.IS_SOCIAL_ZERO);
se.setIsNoSalary(SalaryConstants.NOT_IS_NO_SALARY_ZERO);
se.setType(CommonConstants.ZERO_INT);
mSalaryEstimateService.save(se);
}
}
......@@ -797,6 +794,29 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
se.setEstimateId(estId);
se.setIsSocial(SalaryConstants.IS_FUND_ONE);
se.setIsNoSalary(SalaryConstants.NOT_IS_NO_SALARY_ZERO);
se.setType(CommonConstants.ZERO_INT);
mSalaryEstimateService.save(se);
}
}
if (!forecastSocialList.isEmpty()) {
for (String estId : forecastSocialList) {
se = new MSalaryEstimate();
se.setSalaryId(salary.getId());
se.setEstimateId(estId);
se.setIsSocial(SalaryConstants.IS_SOCIAL_ZERO);
se.setIsNoSalary(SalaryConstants.NOT_IS_NO_SALARY_ZERO);
se.setType(CommonConstants.ONE_INT);
mSalaryEstimateService.save(se);
}
}
if (!forecastFundList.isEmpty()) {
for (String estId : forecastFundList) {
se = new MSalaryEstimate();
se.setSalaryId(salary.getId());
se.setEstimateId(estId);
se.setIsSocial(SalaryConstants.IS_FUND_ONE);
se.setIsNoSalary(SalaryConstants.NOT_IS_NO_SALARY_ZERO);
se.setType(CommonConstants.ONE_INT);
mSalaryEstimateService.save(se);
}
}
......
......@@ -28,9 +28,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TDepartSettlementInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.constants.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.entity.*;
......@@ -41,6 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
......@@ -60,6 +66,7 @@ import java.util.*;
*/
@Log4j2
@Service
@EnableConfigurationProperties({DaprSocialProperties.class})
public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMapper, TSalaryStandard> implements TSalaryStandardService {
@Autowired
......@@ -72,8 +79,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
private MSalaryEstimateService mSalaryEstimateService;
@Autowired
private MSalaryPaymentResService salaryPaymentResService;
private DaprSocialProperties socialProperties;
/**
* 标准薪酬工资表简单分页查询
*
......@@ -311,51 +317,64 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
MSalaryEstimate salaryEstimate = new MSalaryEstimate();
salaryEstimate.setSalaryId(id);
salaryEstimate.setIsSocial(SalaryConstants.IS_SOCIAL_ZERO);
salaryEstimate.setType(CommonConstants.ZERO_INT);
QueryWrapper<MSalaryEstimate> salaryEstimateQueryWrapper = new QueryWrapper<>();
salaryEstimateQueryWrapper.setEntity(salaryEstimate);
//社保
//缴费库社保
List<MSalaryEstimate> socialList = mSalaryEstimateService.list(salaryEstimateQueryWrapper);
salaryEstimate.setIsSocial(SalaryConstants.IS_FUND_ONE);
salaryEstimateQueryWrapper.setEntity(salaryEstimate);
//公积金
//缴费库公积金
List<MSalaryEstimate> fundList = mSalaryEstimateService.list(salaryEstimateQueryWrapper);
if ((socialList != null && !socialList.isEmpty())
|| (fundList != null && !fundList.isEmpty())) {
MSalaryPaymentRes res;
Map<String, MSalaryPaymentRes> saveResMap = new HashMap<>();
if (socialList != null && !socialList.isEmpty()) {
for (MSalaryEstimate est : socialList) {
res = saveResMap.get(est.getEstimateId());
if (res == null) {
res = new MSalaryPaymentRes();
res.setId(est.getEstimateId());
res.setDeptId(deptId);
}
res.setSalarySocialFlag(CommonConstants.ZERO_STRING);
saveResMap.put(est.getEstimateId(), res);
}
salaryEstimate.setType(CommonConstants.ONE_INT);
salaryEstimateQueryWrapper.setEntity(salaryEstimate);
//缴费库公积金
List<MSalaryEstimate> forecastFundList = mSalaryEstimateService.list(salaryEstimateQueryWrapper);
salaryEstimate.setIsSocial(SalaryConstants.IS_SOCIAL_ZERO);
salaryEstimateQueryWrapper.setEntity(salaryEstimate);
//缴费库公积金
List<MSalaryEstimate> forecastSocialList = mSalaryEstimateService.list(salaryEstimateQueryWrapper);
List<String> stringList;
if (socialList != null && !socialList.isEmpty()) {
stringList = new ArrayList<>();
for (MSalaryEstimate s : socialList) {
stringList.add(s.getEstimateId());
}
//更新社保状态为-待结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tpaymentinfo/inner/updatePaymentSocialStatusToNoSettle", stringList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
if (fundList != null && !fundList.isEmpty()) {
stringList = new ArrayList<>();
for (MSalaryEstimate s : fundList) {
stringList.add(s.getEstimateId());
}
if (fundList != null && !fundList.isEmpty()) {
for (MSalaryEstimate est : fundList) {
res = saveResMap.get(est.getEstimateId());
if (res == null) {
res = new MSalaryPaymentRes();
res.setId(est.getEstimateId());
res.setDeptId(deptId);
}
res.setSalaryFundFlag(CommonConstants.ZERO_STRING);
saveResMap.put(est.getEstimateId(), res);
}
//更新公积金状态为-待结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tpaymentinfo/inner/updatePaymentFundStatusToNoSettle", stringList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
if (forecastSocialList != null && !forecastSocialList.isEmpty()) {
stringList = new ArrayList<>();
for (MSalaryEstimate s : forecastSocialList) {
stringList.add(s.getEstimateId());
}
// 开始更新res
if (!saveResMap.isEmpty()) {
Iterator<MSalaryPaymentRes> iter = saveResMap.values().iterator();
while (iter.hasNext()) {
res = iter.next();
salaryPaymentResService.saveOrUpdate(res);
}
//更新社保状态为-待结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tforecastlibrary/inner/updateForecastSocialStatusToNoSettle", stringList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
if (forecastFundList != null && !forecastFundList.isEmpty()) {
stringList = new ArrayList<>();
for (MSalaryEstimate s : forecastFundList) {
stringList.add(s.getEstimateId());
}
//更新公积金状态为-待结算
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tforecastlibrary/inner/updateForecastFundStatusToNoSettle", stringList, TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
}
}
}
//6:删除工资表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment