Commit 33a5fdec authored by 李灿灿's avatar 李灿灿

Merge branch 'develop' into feature-licancan

parents a3ee208b 9d046c44
......@@ -17,6 +17,7 @@
package com.yifu.cloud.plus.v1.yifu.salary.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
......@@ -46,6 +47,7 @@ public class TStatisticsDeclarer {
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelIgnore
private String id;
/**
* 申报单位
......@@ -86,9 +88,8 @@ public class TStatisticsDeclarer {
/**
* 任职受雇从业类型
*/
@ExcelAttribute(name = "任职受雇从业类型", maxLength = 2,readConverterExp = "0=雇员,1=其他")
@Length(max = 2, message = "任职受雇从业类型不能超过2个字符")
@ExcelProperty("任职受雇从业类型")
@ExcelIgnore
private String occupationType;
/**
* 任职受雇从业日期
......
......@@ -972,27 +972,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
return backList;
}
/**
* @param itemList
* @param settleMonth
* @Description: 循环获取符合条件的报账
* @Author: hgw
* @Date: 2022/1/27 17:32
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSalaryAccountItem>
**/
private List<TSalaryAccountItem> getRemuAsList(List<TSalaryAccountItem> itemList, String settleMonth) {
List<TSalaryAccountItem> backList = new ArrayList<>();
if (itemList != null && !itemList.isEmpty()) {
for (TSalaryAccountItem item : itemList) {
if (("4".equals(item.getFormType()))
&& settleMonth.equals(item.getSettlementMonth())) {
backList.add(item);
}
}
}
return backList;
}
/**
* @param realSalary 应发工资
* @param saiList 报账详情表list
......@@ -1672,7 +1651,15 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
//保存工资表
tSalaryStandardService.save(salary);
TApprovalRecord tApprovalRecord = new TApprovalRecord();
tApprovalRecord.setApprovalResult(CommonConstants.TWO_STRING);
tApprovalRecord.setApprovalOpinion("新建表单");
tApprovalRecord.setSalaryId(salary.getId());
tApprovalRecord.setNodeId("待提交");
tApprovalRecord.setApprovalMan(user.getId());
tApprovalRecord.setApprovalManName(user.getNickname());
tApprovalRecord.setApprovalTime(DateUtil.getCurrentDateTime());
auditLogService.save(tApprovalRecord);
for (TSalaryAccount account : aList) {
saiList = account.getSaiList();
......@@ -1841,7 +1828,6 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
List<TSalaryAccount> aList = new ArrayList<>();
TSalaryAccount a;//定库:
BigDecimal relaySalarySum = BigDecimal.ZERO; //工资应发
List<TSalaryAccountItem> asList; //累计扣税
int size = savList.size();
// 自有员工人数
int ownNum = 0;
......@@ -1891,14 +1877,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
}
//累计扣税list
asList = this.getRemuAsList(itemMap.get(a.getEmpIdcard()), a.getSettlementMonth());
// 实发稿酬,按月累计扣税
this.saveNewItems(sai, saiList, SalaryConstants.SALARY_TAX,
SalaryConstants.SALARY_TAX_JAVA,
calculationRemu(saiList, asList
, saiList, a), CommonConstants.ZERO_INT);
calculationRemu(saiList, saiList, a), CommonConstants.ZERO_INT);
// 自有员工以及自有员工应发金额
if (Common.isNotNull(a.getOwnFlag()) && a.getOwnFlag() == 1) {
......@@ -1935,6 +1917,15 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
//保存工资表
tSalaryStandardService.save(salary);
TApprovalRecord tApprovalRecord = new TApprovalRecord();
tApprovalRecord.setApprovalResult(CommonConstants.TWO_STRING);
tApprovalRecord.setApprovalOpinion("新建表单");
tApprovalRecord.setSalaryId(salary.getId());
tApprovalRecord.setNodeId("待提交");
tApprovalRecord.setApprovalMan(user.getId());
tApprovalRecord.setApprovalManName(user.getNickname());
tApprovalRecord.setApprovalTime(DateUtil.getCurrentDateTime());
auditLogService.save(tApprovalRecord);
for (TSalaryAccount account : aList) {
saiList = account.getSaiList();
......@@ -1957,15 +1948,14 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
/**
* @param itemList
* @param itemHistoryList
* @param saiList
* @Description: 计算劳务费个税、应发
* @Author: hgw
* @Date: 2022/3/3 11:30
* @return: java.math.BigDecimal
**/
private static BigDecimal calculationRemu(List<TSalaryAccountItem> itemList, List<TSalaryAccountItem> itemHistoryList,
List<TSalaryAccountItem> saiList, TSalaryAccount a) {
private static BigDecimal calculationRemu(List<TSalaryAccountItem> itemList, List<TSalaryAccountItem> saiList,
TSalaryAccount a) {
// 本次实发
BigDecimal actualSalarySumNow = BigDecimal.ZERO;
// 历史个税合计
......@@ -1981,7 +1971,7 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
BigDecimal relaySalary;
nowTaxT = getNowTaxRemu(actualSalarySumNow);
relaySalary = BigDecimalUtils.safeAdd(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
relaySalary = BigDecimalUtils.safeSubtract(actualSalarySumNow, nowTaxT).setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP);
a.setSalaryTax(nowTaxT);
a.setActualSalary(relaySalary);
a.setRelaySalaryUnit(actualSalarySumNow);
......
......@@ -29,20 +29,14 @@ 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.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.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsDeclarerMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsDeclarerService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsDeclarerSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsDeclarerVo;
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,12 +54,8 @@ import java.util.List;
*/
@Log4j2
@Service
@EnableConfigurationProperties(DaprArchivesProperties.class)
public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDeclarerMapper, TStatisticsDeclarer> implements TStatisticsDeclarerService {
@Autowired
private DaprArchivesProperties archivesProperties;
/**
* 申报对象表简单分页查询
* @param tStatisticsDeclarer 申报对象表
......@@ -83,7 +73,7 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
*/
@Override
public void listExport(HttpServletResponse response, TStatisticsDeclarerSearchVo searchVo){
String fileName = "个税申报对象" + DateUtil.getThisTime() + ".xlsx";
String fileName = "申报对象批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TStatisticsDeclarer> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
......@@ -186,18 +176,6 @@ public class TStatisticsDeclarerServiceImpl extends ServiceImpl<TStatisticsDecla
String lastYear = lastMonth.substring(0,4);
List<TStatisticsDeclarer> stdvoList = baseMapper.doStatisticsTaxDeclarer(nowMonth,lastYear);
for (TStatisticsDeclarer declarer : stdvoList) {
if (Common.isNotNull(declarer.getDeclareUnit())) {
R<TSettleDomainSelectVo> sdr = HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
, "/tsettledomain/inner/getSettleDomainVoById", declarer.getDeclareUnit(), TSettleDomainSelectVo.class, SecurityConstants.FROM_IN);
// 结算主体
TSettleDomainSelectVo dept = null;
if (sdr != null && sdr.getData() != null) {
dept = sdr.getData();
}
if (Common.isNotNull(dept)) {
declarer.setDeclareUnit(dept.getBusinessSubjectName());
}
}
this.save(declarer);
}
return R.ok();
......
......@@ -284,7 +284,7 @@
AND a.SALARY_MONTH = #{tSalaryStandard.salaryMonth}
</if>
<if test="tSalaryStandard.status == null">
AND a.STATUS = 1 OR a.STATUS = 2 or a.STATUS = 5
AND (a.STATUS = 1 OR a.STATUS = 2 or a.STATUS = 5)
</if>
<if test="tSalaryStandard.status != null">
AND a.STATUS = #{tSalaryStandard.status}
......
......@@ -106,7 +106,7 @@
<!--统计-->
<select id="doStatisticsBonus" resultMap="tStatisticsBonusMap">
select
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,b.UNIT_NAME DECLARE_UNIT,
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,a.INVOICE_TITLE DECLARE_UNIT,
sum(annualbonus.SALARY_MONEY) ANNUAL_BONUS,sum(tax.SALARY_MONEY) BONUS_TAX
from t_salary_account a
left join t_salary_employee b on b.id = a.EMP_ID
......
......@@ -96,11 +96,11 @@
<!--统计-->
<select id="doStatisticsTaxDeclarer" resultMap="tStatisticsDeclarerMap">
select
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,b.UNIT_ID DECLARE_UNIT,
if(a.FORM_TYPE=0,'雇员',if(a.FORM_TYPE=3 or a.FORM_TYPE=4,'其他','-')) OCCUPATION_TYPE
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,a.EMP_PHONE,a.INVOICE_TITLE DECLARE_UNIT,
if(a.FORM_TYPE=0,'0',if(a.FORM_TYPE=3 or a.FORM_TYPE=4,'1','-')) OCCUPATION_TYPE
from t_salary_account a
left join t_salary_employee b on b.id = a.EMP_ID
where a.DELETE_FLAG = '0' and a.SETTLEMENT_MONTH like '${lastYear}%'
GROUP BY a.EMP_IDCARD,OCCUPATION_TYPE,b.UNIT_ID,a.SETTLEMENT_MONTH
GROUP BY a.EMP_IDCARD,OCCUPATION_TYPE,DECLARE_UNIT,a.SETTLEMENT_MONTH
</select>
</mapper>
......@@ -92,7 +92,7 @@
<select id="doStatisticsLabor" resultMap="tStatisticsLaborMap">
select
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,sum(a.SALARY_TAX) PERSONAL_TAX,sum(a.ACTUAL_SALARY) INCOME,
b.UNIT_NAME DECLARE_UNIT,'一般劳务报酬所得' INCOME_ITEM,'居民身份证' CARD_TYPE
a.INVOICE_TITLE DECLARE_UNIT,'一般劳务报酬所得' INCOME_ITEM,'居民身份证' CARD_TYPE
from t_salary_account a
left join t_salary_employee b on b.id = a.EMP_ID
where a.DELETE_FLAG = '1' and a.SETTLEMENT_MONTH like '${lastYear}%' and a.FORM_TYPE = '3'
......
......@@ -88,7 +88,7 @@
<select id="doStatisticsRemuneration" resultMap="tStatisticsRemunerationMap">
select
#{nowMonth} DECLARE_MONTH,a.EMP_NAME,a.EMP_IDCARD,sum(a.SALARY_TAX) PERSONAL_TAX,
sum(a.ACTUAL_SALARY) INCOME,b.UNIT_NAME DECLARE_UNIT,'居民身份证' CARD_TYPE
sum(a.ACTUAL_SALARY) INCOME,a.INVOICE_TITLE DECLARE_UNIT,'居民身份证' CARD_TYPE
from t_salary_account a
left join t_salary_employee b on b.id = a.EMP_ID
where a.DELETE_FLAG = '1' and a.SETTLEMENT_MONTH like '${lastYear}%' and a.FORM_TYPE = '4'
......
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