Commit 676ea1d3 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 05b03632 f26e62e0
......@@ -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,27 @@ 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("------------定时生成缴费库的收入数据-定时任务结束------------");
}
/**
* @Description: 定时生成公积金缴费库明细的数据
* @Author: huyc
* @Date: 2022/8/30
* @return: void
**/
public void createPaymentFundIncome() {
log.info("------------定时生成缴费库的收入数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tpaymentinfo/inner/createPaymentFundIncome","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时生成缴费库的收入数据-定时任务结束------------");
}
}
......@@ -186,7 +186,7 @@ public class TSalaryStandardController {
if (user != null) {
TApprovalRecord tApprovalRecord = new TApprovalRecord();
tApprovalRecord.setApprovalResult(CommonConstants.TWO_STRING);
tApprovalRecord.setApprovalOpinion("提交审核");
tApprovalRecord.setApprovalOpinion(tSalaryStandard.getRemark());
tApprovalRecord.setSalaryId(tSalaryStandard.getId());
tApprovalRecord.setNodeId("提交审核");
tApprovalRecord.setApprovalMan(user.getId());
......
......@@ -102,6 +102,14 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List<TSalaryAccount> noPageDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList")List<String> idList);
/**
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
* @Author: hgw
* @Date: 2022/9/2 17:07
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
List<TSalaryAccount> getListByIncome(@Param("salaryId") String salaryId);
int noPageCountDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList")List<String> idList);
}
......@@ -46,6 +46,15 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
void listExport(HttpServletResponse response, TSalaryAccountSearchVo searchVo);
/**
* @param salaryId
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
* @Author: hgw
* @Date: 2022/9/2 16:48
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
List<TSalaryAccount> getListByIncome(String salaryId);
List<TSalaryAccount> noPageDiy(TSalaryAccountSearchVo searchVo);
/**
......
......@@ -73,8 +73,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
private final TSalaryLockService salaryLockService;
private final MSalaryPaymentResService salaryPaymentResService;
private final TSalaryAttaService tSalaryAttaService;
private final TApprovalRecordService auditLogService;
......@@ -117,7 +115,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
// 2020-3-29 11:24:14变更为结算主体的封面抬头
String invoiceTitle = dept.getBusinessSubjectName();
if (Common.isEmpty(invoiceTitle)) {
return R.failed("上传失败-获取结算主体的-封面抬头-信息为空,请去<客户管理-结算主体>模块,编辑封面抬头后再导入");
return R.failed("上传失败-获取结算主体的-封面抬头-信息为空,请去<EKP系统-项目>模块,编辑封面抬头后再导入");
}
YifuUser user = SecurityUtils.getUser();
......@@ -301,7 +299,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
String invoiceTitle = dept.getBusinessSubjectName();
if (Common.isEmpty(invoiceTitle)) {
return R.failed("新建工资主表失败-获取结算主体的-封面抬头-信息为空,请去<客户管理-结算主体>模块,编辑封面抬头后再导入");
return R.failed("新建工资主表失败-获取结算主体的-封面抬头-信息为空,请去<EKP系统-项目>模块,编辑封面抬头后再导入");
}
YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) {
......@@ -491,7 +489,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
R<TDepartSettlementInfo> deptSetR = HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
, "/tsettledomain/inner/getInnerBySettlementId", dept.getId(), TDepartSettlementInfo.class, SecurityConstants.FROM_IN);
if (deptSetR == null || deptSetR.getData() == null || Common.isEmpty(deptSetR.getData().getId())) {
return R.failed("请去客户管理模块编辑结算主体 " + dept.getDepartName() + "(" + dept.getDepartNo() + ")的结算配置!");
return R.failed("请去EKP系统-项目模块编辑结算主体 " + dept.getDepartName() + "(" + dept.getDepartNo() + ")的结算配置!");
} else {
deptSet = deptSetR.getData();
}
......
......@@ -130,6 +130,17 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
}
/**
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
* @Author: hgw
* @Date: 2022/9/2 17:07
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
@Override
public List<TSalaryAccount> getListByIncome(String salaryId) {
return baseMapper.getListByIncome(salaryId);
}
@Override
public List<TSalaryAccount> noPageDiy(TSalaryAccountSearchVo searchVo) {
return baseMapper.noPageDiy(searchVo,searchVo.getIdList());
......
......@@ -24,13 +24,12 @@ 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.archives.vo.TSettleDomainSelectVo;
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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
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;
......@@ -49,6 +48,8 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -58,10 +59,9 @@ import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* 标准薪酬工资表
......@@ -71,7 +71,7 @@ import java.util.List;
*/
@Log4j2
@Service
@EnableConfigurationProperties({DaprSocialProperties.class})
@EnableConfigurationProperties({DaprArchivesProperties.class, DaprSocialProperties.class})
public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMapper, TSalaryStandard> implements TSalaryStandardService {
@Autowired
......@@ -86,6 +86,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
@Autowired
private DaprSocialProperties socialProperties;
@Autowired
private DaprArchivesProperties archivesProperties;
@Autowired
private EkpSalaryUtil ekpSalaryUtil;
......@@ -200,6 +203,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
tSalaryStandard.setStatus(CommonConstants.TWO_INT);
tApprovalRecord.setApprovalResult(CommonConstants.ZERO_STRING);
tApprovalRecord.setNodeId("审核通过");
// 收入相关
R<String> failed = doIncomeDetail(id, tSalaryStandard);
if (failed != null) return failed;
} else {
tSalaryStandard.setStatus(CommonConstants.FIVE_INT);
tApprovalRecord.setApprovalResult(CommonConstants.ONE_STRING);
......@@ -223,6 +229,174 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
}
/**
* @param id
* @param tSalaryStandard
* @Description: 处理收入明细
* @Author: hgw
* @Date: 2022/9/2 17:35
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> doIncomeDetail(String id, TSalaryStandard tSalaryStandard) {
R<TSettleDomainSelectVo> sdr = HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
, "/tsettledomain/inner/getSettleDomainVoById", tSalaryStandard.getDeptId()
, TSettleDomainSelectVo.class, SecurityConstants.FROM_IN);
// 结算主体
TSettleDomainSelectVo dept = null;
if (sdr != null && sdr.getData() != null) {
dept = sdr.getData();
} else {
return R.failed("获取项目信息失败,请联管理员!");
}
// 含有薪资,则计算收入
if (Common.isNotNull(dept.getMrServerItem()) && dept.getMrServerItem().contains(CommonConstants.FOUR_STRING)) {
// 管理费
if (CommonConstants.ZERO_STRING.equals(dept.getManagementTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getManagementType())) {
// 收入相关
TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailExist", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value;
if (detailR != null) {
if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) {
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
}
if (CommonConstants.ZERO_STRING.equals(incomeDetail.getRedData())) {
value++;
} else {
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType(), value);
}
}
} else {
return R.failed("获取收入明细的详情出错,请联系管理员!");
}
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, detailMap, dept.getManagementType(), CommonConstants.ONE_STRING);
if (failed != null) return failed;
} else {
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, new HashMap<>(), dept.getManagementType(), CommonConstants.ONE_STRING);
if (failed != null) return failed;
}
}
// 风险金
if (CommonConstants.ZERO_STRING.equals(dept.getRiskFundTag())) {
// 金额-人数
if (CommonConstants.TWO_STRING.equals(dept.getRiskFundType())) {
// 收入相关
TIncomeDetail detail = new TIncomeDetail();
detail.setPayMonth(tSalaryStandard.getSalaryMonth());
R<TIncomeDetailReturnVo> detailR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincomedetail/inner/getTIncomeDetailExist", detail
, TIncomeDetailReturnVo.class, SecurityConstants.FROM_IN);
Map<String, Integer> detailMap = new HashMap<>();
Integer value;
if (detailR != null) {
if (detailR.getData() != null && detailR.getData().getDetailList() != null && !detailR.getData().getDetailList().isEmpty()) {
TIncomeDetailReturnVo vo = detailR.getData();
List<TIncomeDetail> detailList = vo.getDetailList();
for (TIncomeDetail incomeDetail : detailList) {
value = detailMap.get(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType());
if (Common.isEmpty(value)) {
value = CommonConstants.ZERO_INT;
}
if (CommonConstants.ZERO_STRING.equals(incomeDetail.getRedData())) {
value++;
} else {
value--;
}
detailMap.put(incomeDetail.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + incomeDetail.getFeeType(), value);
}
}
} else {
return R.failed("获取收入明细的详情出错,请联系管理员!");
}
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, detailMap, dept.getRiskFundType(), CommonConstants.TWO_STRING);
if (failed != null) return failed;
} else {
// 保存明细
R<String> failed = saveIncomeDetail(id, tSalaryStandard, dept, new HashMap<>(), dept.getRiskFundType(), CommonConstants.TWO_STRING);
if (failed != null) return failed;
}
}
}
return null;
}
/**
* @param feeType 1按比例2金额-人数3金额-人次
* @param isManage 1 管理费2 风险金
* @Description: 保存明细
* @Author: hgw
* @Date: 2022/9/2 17:25
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
private R<String> saveIncomeDetail(String id, TSalaryStandard tSalaryStandard, TSettleDomainSelectVo dept
, Map<String, Integer> detailMap, String feeType, String isManage) {
TIncomeDetail detail;
Integer value;
List<TSalaryAccount> salaryAccountList = salaryAccountService.getListByIncome(id);
if (salaryAccountList != null && !salaryAccountList.isEmpty()) {
BigDecimal money;
for (TSalaryAccount account : salaryAccountList) {
value = detailMap.get(account.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + isManage);
if (Common.isEmpty(value) || value == 0) {
detail = new TIncomeDetail();
detail.setPayMonth(account.getSalaryMonth());
detail.setCharges(String.valueOf(dept.getManagementFee()));
detail.setDeptId(account.getDeptId());
detail.setDeptName(account.getDeptName());
detail.setDeptNo(account.getDeptNo());
detail.setUnitId(tSalaryStandard.getUnitId());
detail.setUnitName(tSalaryStandard.getUnitName());
detail.setUnitNo(tSalaryStandard.getUnitNo());
detail.setCreateMonth(account.getSalaryMonth());
detail.setEmpIdcard(account.getEmpIdcard());
detail.setEmpName(account.getEmpName());
detail.setFeeMode(dept.getManagementType());
detail.setFeeType(isManage);
money = dept.getManagementFee();
if (CommonConstants.TWO_STRING.equals(isManage)) {
money = dept.getRiskFundFee();
}
if (CommonConstants.ONE_STRING.equals(feeType)) {
money = BigDecimalUtils.safeMultiply(account.getRelaySalary(), money, CommonConstants.ONE_OF_PERCENT);
}
detail.setMoney(money);
detail.setMrSettleType(dept.getMrSettleType());
detail.setRedData(CommonConstants.ZERO_STRING);
detail.setSourceId(account.getId());
detail.setSourceType(CommonConstants.FOUR_STRING);
R<Boolean> saveR = HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tincome/inner/saveDetail", detail, Boolean.class, SecurityConstants.FROM_IN);
if (saveR == null || saveR.getData() == null || Boolean.FALSE.equals(saveR.getData())) {
return R.failed("保存收入明细以及统计出错!");
}
}
}
}
return null;
}
/**
* @Description: 删除
* @Author: hgw
* @Date: 2022/9/2 17:16
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> deleteSalaryById(String id) {
if (id != null) {
......@@ -325,6 +499,12 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
return R.failed("id 不可为空");
}
/**
* @Description: 推送
* @Author: hgw
* @Date: 2022/9/2 17:16
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> doSend(String id) {
TSalaryStandard s = this.getById(id);
......
......@@ -537,6 +537,25 @@
</where>
</select>
<!-- 计算收入需要的报账明细 -->
<select id="getListByIncome" resultMap="tSalaryAccountMap">
SELECT
a.ID,
a.SALARY_MONTH,
a.EMP_NAME,
a.EMP_IDCARD,
a.DEPT_ID,
a.DEPT_NO,
a.DEPT_NAME,
ifnull(if(a.FORM_TYPE='4',a.RELAY_SALARY_UNIT,a.RELAY_SALARY),0)
-ifnull(personalSocial.SALARY_MONEY,0)
-ifnull(personalFund.SALARY_MONEY,0) RELAY_SALARY
FROM t_salary_account a
left join t_salary_account_item personalSocial on personalSocial.SALARY_ACCOUNT_ID = a.id and personalSocial.JAVA_FIED_NAME='personalSocial'
left join t_salary_account_item personalFund on personalFund.SALARY_ACCOUNT_ID = a.id and personalFund.JAVA_FIED_NAME='personalFund'
where a.DELETE_FLAG = 0 and a.SALARY_FORM_ID = #{salaryId}
</select>
<select id="noPageCountDiy" resultType="java.lang.Integer">
SELECT
count(1)
......
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import lombok.Data;
import java.util.List;
/**
* @author hgw
* @description 收入明细详情的Vo
* @date 2022/8/10
*/
@Data
public class TIncomeDetailReturnVo {
List<TIncomeDetail> detailList;
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
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.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
......@@ -155,9 +156,8 @@ public class TIncomeController {
* @Date: 2022/8/31 16:34
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation(summary = "新增收入明细-详细表,同时统计", description = "新增收入明细表")
@SysLog("新增收入明细-详细表,同时统计")
@PostMapping("/saveDetail")
@Inner
@PostMapping("/inner/saveDetail")
public R<Boolean> saveDetail(@RequestBody TIncomeDetail tIncomeDetail) {
return R.ok(tIncomeService.saveDetail(tIncomeDetail));
}
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 收入明细-详细表
*
* @author hgw
* @date 2022-9-2 15:55:09
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tincomedetail")
@Tag(name = "收入明细-详细表管理")
public class TIncomeDetailController {
private final TIncomeDetailService tIncomeDetailService;
/**
* @Description: 查询list(建议传参项目id、月份,一次性获取大批量,自行组装Map来使用)
* @Author: hgw
* @Date: 2022-9-2 15:56:28
**/
@Inner
@PostMapping("/inner/getTIncomeDetailList")
public TIncomeDetailReturnVo getTIncomeDetailList(@RequestBody TIncomeDetail detail) {
TIncomeDetailReturnVo vo = new TIncomeDetailReturnVo();
vo.setDetailList(tIncomeDetailService.getTIncomeDetailList(detail));
return vo;
}
}
......@@ -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