Commit c2986b90 authored by huyuchen's avatar huyuchen

缴费库收入生成修改

parent 0a7e52a7
......@@ -30,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -186,6 +187,26 @@ public class TSettleDomainController {
return listVo;
}
/**
* @param
* @Author: wangan
* @Date: 2019/10/18
* @Description:获取所有客户单位的项目信息
**/
@Inner
@PostMapping("/selectSettleDomainSelectVoByNo")
public TSettleDomainListVo selectSettleDomainSelectVoByNo(@RequestBody TSettleDomainSelectVo tSettleDomainSelectVo) {
List<TSettleDomainSelectVo> list = new ArrayList<>();
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, tSettleDomainSelectVo.getDepartNo())
.last(CommonConstants.LAST_ONE_SQL));
BeanUtils.copyProperties(tSettleDomain,tSettleDomainSelectVo);
list.add(tSettleDomainSelectVo);
TSettleDomainListVo listVo = new TSettleDomainListVo();
listVo.setListSelectVO(list);
return listVo;
}
/**
* @Author fxj
* @Description 通过项目编码获取项目及客户信息
......
......@@ -139,6 +139,23 @@ public class ArchivesDaprUtil {
return res;
}
/**
* @Author huyc
* @Description 根据项目id 获取项目编码
* @Date 11:50 2022/8/9
* @Param
* @return
**/
public R<TSettleDomainListVo> selectSettleDomainSelectVoByNo(String deptNo){
TSettleDomainSelectVo settleDomainSelectVo = new TSettleDomainSelectVo();
settleDomainSelectVo.setDepartNo(deptNo);
R<TSettleDomainListVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tsettledomain/selectSettleDomainSelectVoByNo",settleDomainSelectVo, TSettleDomainListVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("通过项目id获取项目信息失败!");
}
return res;
}
public R<EmpDispatchAddVo> addDispatchInfo(EmpDispatchAddVo addVo) {
R<EmpDispatchAddVo> res = HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/temployeeinfo/addDispatchInfo" , JSON.toJSONString(addVo), EmpDispatchAddVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
......
......@@ -8,6 +8,8 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......@@ -58,8 +60,8 @@ public class SocialDaprUtils {
/**
* @Author huyc
* @Description 去缴费库查询查询这些人社保是否存在
* @Date 17:38 2022/8/15
* @Description 更新预估库
* @Date 2022/8/15
* @Param
* @return
**/
......@@ -69,12 +71,38 @@ public class SocialDaprUtils {
/**
* @Author huyc
* @Description 去缴费库查询查询这些人社保是否存在
* @Date 17:38 2022/8/15
* @Description 更新缴费库
* @Date 2022/8/15
* @Param
* @return
**/
public void updateSocialAndFoundInfo(UpdateSocialFoundVo infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tsocialfundinfo/inner/updateSocialAndFoundInfo", JSON.toJSONString(infoVo), UpdateSocialFoundVo.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 生成收入数据
* @Date 2022/9/2
* @Param
* @return
**/
public void createTIncomeDetail(TIncomeDetail infoVo) {
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/createTIncomeDetail", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 生成收入数据
* @Date 2022/9/2
* @Param
* @return
**/
public R<TIncomeDetailReturnVo> getTIncomeDetailList(TIncomeDetail infoVo) {
R<TIncomeDetailReturnVo> listVo = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tincomedetail/inner/getTIncomeDetailList", JSON.toJSONString(infoVo), TIncomeDetail.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(listVo)){
return R.failed("查询人员收入数据失败!");
}
return listVo;
}
}
......@@ -98,4 +98,15 @@ public class SocialTask {
log.info("------------定时生成公积金缴费库明细的数据-定时任务结束------------");
}
/**
* @Description: 定时生成公积金缴费库明细的数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
public void createPaymentInfoIncome() {
log.info("------------定时生成缴费库的收入数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tpaymentinfo/inner/createPaymentInfoIncome","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成缴费库的收入数据-定时任务结束------------");
}
}
......@@ -340,4 +340,32 @@ public class TPaymentInfoController {
public void createPaymentFundInfo() {
tPaymentInfoService.createPaymentFundInfo();
}
/**
* @Description: 定时生成缴费库的收入数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
@Operation(summary = "定时生成缴费库的收入数据", description = "定时生成缴费库的收入数据")
@SysLog("定时生成缴费库的收入数据")
@Inner
@PostMapping("/inner/createPaymentInfoIncome")
public void createPaymentInfoIncome() {
tPaymentInfoService.createPaymentInfoIncome();
}
/**
* @Description: 定时生成公积金的收入数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
@Operation(summary = "定时生成公积金的收入数据", description = "定时生成公积金的收入数据")
@SysLog("定时生成公积金的收入数据")
@Inner
@PostMapping("/inner/createPaymentFundIncome")
public void createPaymentFundIncome() {
tPaymentInfoService.createPaymentFundIncome();
}
}
......@@ -134,4 +134,7 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
void createPaymentSocialInfo();
void createPaymentFundInfo();
void createPaymentInfoIncome();
void createPaymentFundIncome();
}
......@@ -28,19 +28,28 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
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.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpFundUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSocialUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushFundParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpPushSocialParam;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.UpdateSocialFoundVo;
......@@ -54,6 +63,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentHeFeiVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -64,10 +74,8 @@ import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -112,6 +120,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Autowired
private EkpSocialUtil ekpSocialUtil;
@Autowired
private TIncomeDetailMapper detailMapper;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
/**
* 缴费库简单分页查询
*
......@@ -2239,6 +2253,46 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
}
}
@Override
public void createPaymentInfoIncome() {
BigDecimal sumSocial = BigDecimal.ZERO;
//判断缴费库中社保合计和本次导入合计相加是否为0,为0则不生成收入
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.lt(TPaymentInfo::getCreateTime, LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getSocialId));
if (Common.isNotNull(sumList)) {
for (TPaymentInfo paymentInfo: sumList) {
//获取员工当前缴纳月总合计
List<TPaymentInfo> payInfoList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.eq(TPaymentInfo::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TPaymentInfo::getSocialPayMonth, paymentInfo.getSocialPayMonth())
.eq(TPaymentInfo::getSettleDomainId, paymentInfo.getSettleDomainId()));
if (Common.isNotNull(payInfoList)) {
for (TPaymentInfo payInfo:payInfoList)
sumSocial = BigDecimalUtils.safeAdd(sumSocial,payInfo.getSocialSum());
}
if (sumSocial.compareTo(BigDecimal.ZERO) == CommonConstants.ZERO_INT) {
continue;
}
//生成收入
createIncomeInfo(paymentInfo,CommonConstants.ONE_STRING);
}
}
}
@Override
public void createPaymentFundIncome() {
List<TPaymentInfo> sumList = baseMapper.selectList(Wrappers.<TPaymentInfo>query().lambda()
.lt(TPaymentInfo::getCreateTime, LocalDateTimeUtils.getDayStart(LocalDateTime.now()))
.isNotNull(TPaymentInfo::getFundId));
if (Common.isNotNull(sumList)) {
for (TPaymentInfo paymentInfo: sumList) {
//生成公积金收入
createIncomeInfo(paymentInfo,CommonConstants.TWO_STRING);
}
}
}
public List<String> initEkpPushSocialParam(List<TPaymentInfo> unPushInfo) {
List<String> pushList = new ArrayList<>();
for (TPaymentInfo library:unPushInfo) {
......@@ -2555,4 +2609,110 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return pushList;
}
public void createIncomeInfo(TPaymentInfo paymentInfo,String socialFundFlag) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoById(paymentInfo.getSettleDomainId());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
}
}
}
Boolean exitFlag = false;
TIncomeDetail exitIncome = new TIncomeDetail();
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
exitIncome = detailMapper.selectOne(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getSocialPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL));
} else {
exitIncome = detailMapper.selectOne(Wrappers.<TIncomeDetail>query().lambda()
.eq(TIncomeDetail::getEmpIdcard, paymentInfo.getEmpIdcard())
.eq(TIncomeDetail::getPayMonth, paymentInfo.getSocialPayMonth())
.eq(TIncomeDetail::getDeptId, paymentInfo.getSettleDomainId())
.eq(TIncomeDetail::getSourceType, CommonConstants.TWO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
}
if (Common.isNotNull(exitIncome)) {
exitFlag = true;
}
if (Common.isNotNull(settleDomain)) {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//按金额计算的话要看缴纳月有没有收入数据
if (!exitFlag) {
BigDecimal gMoney = BigDecimal.ZERO;
if (CommonConstants.ONE_STRING.equals(settleDomain.getManagementType())) {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(), settleDomain.getManagementFee());
} else {
gMoney = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getManagementFee());
}
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
gMoney = paymentInfo.getSocialSum();
} else {
gMoney = paymentInfo.getProvidentSum();
}
createIncomeRiskInfo(paymentInfo, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney, socialFundFlag);
}
}
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.ONE_STRING.equals(settleDomain.getRiskFundType())) {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = BigDecimalUtils.safeMultiply(paymentInfo.getSocialSum(), settleDomain.getRiskFundFee());
} else {
money = BigDecimalUtils.safeMultiply(paymentInfo.getProvidentSum(), settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ONE_STRING.equals(socialFundFlag)) {
money = paymentInfo.getSocialSum();
} else {
money = paymentInfo.getProvidentSum();
}
}
createIncomeRiskInfo(paymentInfo, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money, socialFundFlag);
}
}
}
}
public void createIncomeRiskInfo(TPaymentInfo paymentInfo,TSettleDomain settleDomain,String feeType,
String charges, String feeMode,BigDecimal money,String sourceType) {
//生成收入数据
TIncomeDetail detail = new TIncomeDetail();
detail.setCreateTime(DateUtil.getCurrentDateTime());
detail.setDeptName(paymentInfo.getSettleDomainName());
detail.setDeptNo(paymentInfo.getSettleDomainCode());
detail.setDeptId(paymentInfo.getSettleDomainId());
detail.setEmpIdcard(paymentInfo.getEmpIdcard());
detail.setEmpName(paymentInfo.getEmpName());
detail.setUnitNo(settleDomain.getCustomerNo());
detail.setUnitId(paymentInfo.getUnitId());
detail.setUnitName(paymentInfo.getUnitName());
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(paymentInfo.getId());
detail.setSourceType(sourceType);
detail.setCreateMonth(paymentInfo.getSocialCreateMonth());
detail.setPayMonth(paymentInfo.getSocialPayMonth());
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
detail.setCharges(charges);
detail.setMrSettleType(settleDomain.getMrSettleType());
detail.setId(CommonConstants.NULL);
detailMapper.insert(detail);
}
}
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