Commit 5bc2a4cc authored by hongguangwu's avatar hongguangwu

MVP1.5-薪资差额单

parent 9c916409
......@@ -541,6 +541,12 @@ public class TSalaryAccount extends BaseEntity {
@Schema(description = "支出信息付款状态")
private String payCollectFlag;
/**
* 是否差额单 默认0否; 1是
*/
@Schema(description = "是否差额单")
private String isDiff;
/**
* 工资月份-起
*/
......
......@@ -439,6 +439,12 @@ public class TSalaryStandard extends BaseEntity {
@Schema(description ="代发户状态(0正常;1代发户)")
private Integer issueStatus;
/**
* 是否差额单 默认0否; 1是
*/
@Schema(description = "是否差额单")
private String isDiff;
/**
* 工资月份-起
*/
......
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
/**
* @author hgw2
* @description 差额单Vo
* @date 2023/2/2
*/
@Getter
@Setter
public class AccountByEkpDiffVo {
// 报账表id
private String accountId;
// 应发薪酬(劳务费、稿酬)
private BigDecimal relaySalary;
// 实发(个人实收)
private BigDecimal actualSalary;
// 个税金额(个人承担)
private BigDecimal salaryTax;
}
......@@ -26,9 +26,11 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
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.AccountByEkpDiffVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -38,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
......@@ -247,5 +250,18 @@ public class TSalaryStandardController {
public String testSendEkpList(@RequestParam String id) {
return tSalaryStandardService.testSendEkpList(id);
}
/**
* @Description: 差额单--EKP调用接口
* @Author: hgw
* @Date: 2023/1/31 17:28
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "差额单--EKP调用接口", description = "差额单--EKP调用接口")
@SysLog("差额单--EKP调用接口")
@PostMapping("/saveSalaryDiff")
public R<String> saveSalaryDiff(@RequestBody List<AccountByEkpDiffVo> voList) {
return tSalaryStandardService.saveSalaryDiff(voList);
}
}
......@@ -168,4 +168,6 @@ public interface TSalaryAccountItemMapper extends BaseMapper<TSalaryAccountItem>
*/
IPage<TSalaryAccountItem> getTSalaryAccountItemPage(Page<TSalaryAccountItem> page, @Param("tSalaryAccountItem") TSalaryAccountItem tSalaryAccountItem);
List<TSalaryAccountItem> getListByAccIdList(@Param("accIdList") List<String> accIdList);
}
......@@ -163,4 +163,13 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
**/
IPage<SalaryAccountAndItemVo> getSalaryAccountAndItemVoPage(Page<SalaryAccountAndItemVo> page
, @Param("salaryAccountAndItemVo") SalaryAccountAndItemVo salaryAccountAndItemVo);
/**
* @param idList
* @Description: 根据idList获取报账信息
* @Author: hgw
* @Date: 2023/2/2 17:16
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
List<TSalaryAccount> getListByIdList(@Param("idList") List<String> idList);
}
......@@ -119,4 +119,13 @@ public interface TSalaryAccountItemService extends IService<TSalaryAccountItem>
**/
Set<String> getItemSet(String salaryId);
/**
* @param accIdList
* @Description: 获取list
* @Author: hgw
* @Date: 2023/2/3 15:46
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem>
**/
List<TSalaryAccountItem> getListByAccIdList(List<String> accIdList);
}
\ No newline at end of file
......@@ -166,4 +166,13 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
**/
IPage<SalaryAccountAndItemVo> getSalaryAccountAndItemVoPage(Page<SalaryAccountAndItemVo> page
, SalaryAccountAndItemVo salaryAccountAndItemVo);
/**
* @Description: 根据idList获取报账信息
* @Author: hgw
* @Date: 2023/2/2 17:42
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
List<TSalaryAccount> getListByIdList(List<String> idList);
}
......@@ -22,7 +22,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandard;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountByEkpDiffVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
......@@ -115,4 +117,12 @@ public interface TSalaryStandardService extends IService<TSalaryStandard> {
String testSendEkpList(String id);
/**
* @Description: 差额单--EKP调用接口
* @Author: hgw
* @Date: 2023/1/31 17:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> saveSalaryDiff(List<AccountByEkpDiffVo> voList);
}
......@@ -204,4 +204,9 @@ public class TSalaryAccountItemServiceImpl extends ServiceImpl<TSalaryAccountIte
public Set<String> getItemSet(String salaryId) {
return baseMapper.getItemSet(salaryId);
}
@Override
public List<TSalaryAccountItem> getListByAccIdList(List<String> accIdList) {
return baseMapper.getListByAccIdList(accIdList);
}
}
......@@ -287,4 +287,15 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
return baseMapper.getSalaryAccountAndItemVoPage(page, salaryAccountAndItemVo);
}
/**
* @param idList
* @Description: 根据idList获取报账信息
* @Author: hgw
* @Date: 2023/2/2 17:41
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
@Override
public List<TSalaryAccount> getListByIdList(List<String> idList) {
return baseMapper.getListByIdList(idList);
}
}
......@@ -16,6 +16,7 @@
*/
package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
......@@ -48,6 +49,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.*;
import com.yifu.cloud.plus.v1.yifu.salary.util.DoJointSalaryAsyncTask;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.AccountByEkpDiffVo;
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.TIncome;
......@@ -62,11 +64,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.HashMap;
import java.util.List;
import java.util.*;
/**
* 标准薪酬工资表
......@@ -82,6 +82,7 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
private final TApprovalRecordService approvalRecordService;
private final TSalaryAccountService salaryAccountService;
private final TSalaryAccountItemService salaryAccountItemService;
private final MSalaryEstimateService mSalaryEstimateService;
private final DaprSocialProperties socialProperties;
private final DaprArchivesProperties archivesProperties;
......@@ -915,4 +916,127 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
return R.failed("请耐心等待!");
}
}
/**
* @param voList
* @Description: 差额单--EKP调用接口
* @Author: hgw
* @Date: 2023/1/31 17:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
public R<String> saveSalaryDiff(List<AccountByEkpDiffVo> voList) {
if (voList != null && !voList.isEmpty()) {
List<String> accIdList = new ArrayList<>();
for (AccountByEkpDiffVo vo : voList) {
if (Common.isEmpty(vo.getAccountId()) || Common.isEmpty(vo.getRelaySalary())
|| Common.isEmpty(vo.getActualSalary()) || Common.isEmpty(vo.getSalaryTax())) {
return R.failed("参数不可为空");
}
accIdList.add(vo.getAccountId());
}
List<TSalaryAccount> accountList = salaryAccountService.getListByIdList(accIdList);
if (accountList != null && !accountList.isEmpty()) {
Map<String, TSalaryAccount> accountMap = new HashMap<>();
for (TSalaryAccount account : accountList) {
accountMap.put(account.getId(), account);
}
List<TSalaryAccount> newAccountList = new ArrayList<>();
TSalaryAccount oldAccount;
TSalaryAccount newAccount;
BigDecimal allRelaySalary = BigDecimal.ZERO;
for (AccountByEkpDiffVo idVo : voList) {
oldAccount = accountMap.get(idVo.getAccountId());
if (oldAccount == null) {
return R.failed("未找到id为:【" + idVo.getAccountId() + "】的表");
} else {
newAccount = new TSalaryAccount();
BeanUtil.copyProperties(oldAccount, newAccount);
this.deleteAccountBaseInfo(newAccount);
newAccount.setRelaySalary(idVo.getRelaySalary());
newAccount.setActualSalary(idVo.getActualSalary());
newAccount.setSalaryTax(idVo.getSalaryTax());
newAccount.setIsDiff(CommonConstants.ONE_STRING);
newAccountList.add(newAccount);
allRelaySalary = allRelaySalary.add(idVo.getRelaySalary());
}
}
TSalaryStandard oldSalary = this.getById(accountList.get(CommonConstants.ZERO_INT).getSalaryFormId());
if (oldSalary == null) {
return R.failed("未找到工资表!");
}
List<TSalaryAccountItem> itemList = salaryAccountItemService.getListByAccIdList(accIdList);
TSalaryStandard newSalary = new TSalaryStandard();
BeanUtil.copyProperties(oldSalary, newSalary);
newSalary.setId(null);
newSalary.setSettlementAmount(allRelaySalary);
newSalary.setIsDiff(CommonConstants.ONE_STRING);
this.save(newSalary);
int i = 1;
TSalaryAccountItem relayItem;
TSalaryAccountItem actualItem;
TSalaryAccountItem taxItem;
for (TSalaryAccount account : newAccountList) {
account.setSalaryFormId(newSalary.getId());
account.setRowIndex(i);
salaryAccountService.save(account);
// 应发
relayItem = new TSalaryAccountItem();
relayItem.setSalaryAccountId(account.getId());
relayItem.setJavaFiedName(SalaryConstants.RELAY_SALARY_JAVA);
relayItem.setCnName(SalaryConstants.RELAY_SALARY);
relayItem.setSalaryMoney(account.getRelaySalary());
relayItem.setIsTax(CommonConstants.ZERO_INT);
salaryAccountItemService.save(relayItem);
// 实发
actualItem = new TSalaryAccountItem();
actualItem.setSalaryAccountId(account.getId());
actualItem.setJavaFiedName(SalaryConstants.ACTUAL_SALARY_SUM_JAVA);
actualItem.setCnName(SalaryConstants.ACTUAL_SALARY_SUM);
actualItem.setSalaryMoney(account.getActualSalary());
actualItem.setIsTax(CommonConstants.ZERO_INT);
salaryAccountItemService.save(actualItem);
// 个税
taxItem = new TSalaryAccountItem();
taxItem.setSalaryAccountId(account.getId());
taxItem.setJavaFiedName(SalaryConstants.SALARY_TAX_JAVA);
taxItem.setCnName(SalaryConstants.SALARY_TAX);
taxItem.setSalaryMoney(account.getSalaryTax());
taxItem.setIsTax(CommonConstants.ZERO_INT);
salaryAccountItemService.save(taxItem);
i++;
}
return R.ok();
}
}
return R.failed("未找到工资表!");
}
/**
* @param newAccount
* @Description: 复制原报账信息后,清空无关列
* @Author: hgw
* @Date: 2023/2/3 11:28
* @return: void
**/
private void deleteAccountBaseInfo(TSalaryAccount newAccount) {
newAccount.setId(null);
newAccount.setRelaySalaryUnit(null);
newAccount.setSalaryTaxUnit(null);
newAccount.setUnitSocial(null);
newAccount.setPersonSocial(null);
newAccount.setUnitFund(null);
newAccount.setPersonFund(null);
newAccount.setSumChildEduMoney(null);
newAccount.setSumContinuingEducationMoney(null);
newAccount.setSumHousingLoanMoney(null);
newAccount.setSumHousingRentMoney(null);
newAccount.setSumSupportElderlyMoney(null);
newAccount.setSumBabyMoney(null);
newAccount.setSumPrivatePension(null);
newAccount.setAnnualBonusTax(null);
}
}
......@@ -485,4 +485,21 @@
a.JAVA_FIED_NAME='actualSalarySum'
</select>
<select id="getListByAccIdList" resultMap="tSalaryAccountItemMap">
SELECT
ID,
SALARY_ACCOUNT_ID,
CN_NAME,
JAVA_FIED_NAME,
SALARY_MONEY,
TEXT_VALUE,
IS_TAX
FROM t_salary_account_item a
where a.SALARY_ACCOUNT_ID in
<foreach collection="accIdList" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</select>
</mapper>
......@@ -96,6 +96,7 @@
<result property="incomeCollectFlag" column="INCOME_COLLECT_FLAG"/>
<result property="paySettleFlag" column="PAY_COLLECT_FLAG"/>
<result property="payCollectFlag" column="PAY_SETTLE_FLAG"/>
<result property="isDiff" column="IS_DIFF"/>
</resultMap>
<!-- B端薪酬第一个统计列表 -->
......@@ -272,7 +273,8 @@
a.SUM_SUPPORT_ELDERLY_MONEY,
a.SUM_CONTINUING_EDUCATION_MONEY,
a.SUM_BABY_MONEY,
a.SUM_PRIVATE_PENSION
a.SUM_PRIVATE_PENSION,
a.IS_DIFF
</sql>
<sql id="tSalaryAccount_where">
......@@ -412,6 +414,9 @@
<if test="tSalaryAccount.sendStatus != null">
AND a.SEND_STATUS = #{tSalaryAccount.sendStatus}
</if>
<if test="tSalaryAccount.isDiff != null and tSalaryAccount.isDiff.trim() != ''">
AND a.IS_DIFF = #{tSalaryAccount.isDiff}
</if>
</if>
</sql>
<!--tSalaryAccount简单分页查询-->
......@@ -998,4 +1003,15 @@
AND a.SALARY_MONTH like concat(#{salaryAccountAndItemVo.years},'%')
</if>
</select>
<!-- 根据idList获取报账信息 -->
<select id="getListByIdList" resultMap="tSalaryAccountMap">
select
<include refid="Base_Column_List"/>
from t_salary_account a
where a.id in
<foreach collection="idList" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</select>
</mapper>
......@@ -78,6 +78,7 @@
<result property="incomeStartTime" column="INCOME_START_TIME"/>
<result property="incomeEndTime" column="INCOME_END_TIME"/>
<result property="issueStatus" column="ISSUE_STATUS"/>
<result property="isDiff" column="IS_DIFF"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -134,7 +135,8 @@
a.APPLY_NO,
a.INCOME_START_TIME,
a.INCOME_END_TIME,
a.ISSUE_STATUS
a.ISSUE_STATUS,
a.IS_DIFF
</sql>
<sql id="tSalaryStandard_where">
<if test="tSalaryStandard != null">
......@@ -279,6 +281,9 @@
<if test="tSalaryStandard.applyNo != null and tSalaryStandard.applyNo.trim() != ''">
AND a.APPLY_NO like concat('%',#{tSalaryStandard.applyNo},'%')
</if>
<if test="tSalaryStandard.isDiff != null and tSalaryStandard.isDiff.trim() != ''">
AND a.IS_DIFF = #{tSalaryStandard.isDiff}
</if>
</if>
</sql>
<!--tSalaryStandard简单分页查询-->
......
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