Commit 0863a7f6 authored by fangxinjiang's avatar fangxinjiang

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

parents 723c8483 af1d7e1c
......@@ -109,11 +109,9 @@
#{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
left join t_salary_account_item annualbonus on annualbonus.SALARY_ACCOUNT_ID = a.id and annualbonus.CN_NAME='年终奖'
left join t_salary_account_item tax on tax.SALARY_ACCOUNT_ID = a.id and tax.CN_NAME='年终奖单独扣税'
left join t_salary_standard s ON s.id = a.SALARY_FORM_ID
where a.DELETE_FLAG = 0 and annualbonus.SALARY_MONEY > 0 and tax.SALARY_MONEY > 0 and s.SEND_MONTH like '${lastYear}%'
where a.DELETE_FLAG = 0 and annualbonus.SALARY_MONEY > 0 and tax.SALARY_MONEY > 0 and a.SETTLEMENT_MONTH like '${lastYear}%'
GROUP BY a.EMP_IDCARD,a.EMP_NAME
</select>
</mapper>
......@@ -185,4 +185,11 @@ public class TIncomeDetail {
@ExcelProperty("红冲:0否1是")
private String redData;
/**
* 管理费风险金的结算方式:1预估2实缴
*/
@ExcelAttribute(name = "管理费风险金的结算方式:1预估2实缴" , maxLength = 1 )
@ExcelProperty("管理费风险金的结算方式:1预估2实缴")
private String mrSettleType;
}
......@@ -20,6 +20,9 @@ package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 收入明细表-全部明细
......@@ -29,4 +32,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TIncomeDetailMapper extends BaseMapper<TIncomeDetail> {
List<TIncomeDetail> getTIncomeDetailList(@Param("tIncomeDetail") TIncomeDetail tIncomeDetail);
}
......@@ -20,6 +20,8 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import java.util.List;
/**
* 收入明细表-全部明细
*
......@@ -27,5 +29,5 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
* @date 2022-08-30 17:34:58
*/
public interface TIncomeDetailService extends IService<TIncomeDetail> {
List<TIncomeDetail> getTIncomeDetailList(TIncomeDetail detail);
}
......@@ -23,6 +23,8 @@ import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 收入明细表-全部明细
*
......@@ -33,4 +35,8 @@ import org.springframework.stereotype.Service;
@Service
public class TIncomeDetailServiceImpl extends ServiceImpl<TIncomeDetailMapper, TIncomeDetail> implements TIncomeDetailService {
@Override
public List<TIncomeDetail> getTIncomeDetailList(TIncomeDetail detail) {
return baseMapper.getTIncomeDetailList(detail);
}
}
......@@ -44,6 +44,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeVo;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -52,9 +53,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* 收入明细表
......@@ -260,12 +259,16 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
income.setEmpIdcard(tIncomeDetail.getEmpIdcard());
income.setDeptId(tIncomeDetail.getDeptId());
List<TIncome> incomeList = baseMapper.getTIncomeList(income);
TIncomeDetail detail = new TIncomeDetail();
detail.setEmpIdcard(tIncomeDetail.getEmpIdcard());
detail.setDeptId(tIncomeDetail.getDeptId());
List<TIncomeDetail> detailList = tIncomeDetailService.getTIncomeDetailList(detail);
// 不存在,直接新增
if (incomeList == null || incomeList.isEmpty()) {
return this.saveIncome(tIncomeDetail);
} else {
// 核心判断
return this.copyCore(tIncomeDetail, incomeList);
return this.copyCore(tIncomeDetail, incomeList, detailList);
}
}
......@@ -277,11 +280,106 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
return this.save(income);
}
private boolean copyCore(TIncomeDetail tIncomeDetail, List<TIncome> incomeList) {
// 判断
private boolean copyCore(TIncomeDetail tIncomeDetail, List<TIncome> incomeList, List<TIncomeDetail> detailList) {
// 判断,比例,直接加
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getFeeMode())) {
return this.saveIncome(tIncomeDetail);
} else {
Map<String, Integer> numMap = new HashMap<>();
Map<String, Integer> incomeMap = new HashMap<>();
// 商险Map
Map<String, Integer> insureMap = new HashMap<>();
Integer nums;
Integer maxNum;
for (TIncomeDetail detail : detailList) {
nums = numMap.get(detail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + detail.getRedData());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ONE_INT;
} else {
nums++;
}
numMap.put(detail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + detail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + detail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + detail.getRedData(), nums);
}
for (TIncome income : incomeList) {
nums = incomeMap.get(income.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + income.getRedData());
if (Common.isEmpty(nums)) {
nums = CommonConstants.ONE_INT;
} else {
nums++;
}
incomeMap.put(income.getPayMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + income.getRedData(), nums);
insureMap.put(income.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + income.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + income.getRedData(), CommonConstants.ZERO_INT);
}
// 金额人数、人次,需要判重
// 1:预估模式(管理费风险金的结算方式:1预估2实缴)
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getMrSettleType())) {
// 社保、公积金(收入来源:1社保2公积金3商险4薪资)
if (CommonConstants.ONE_STRING.equals(tIncomeDetail.getSourceType())
|| CommonConstants.TWO_STRING.equals(tIncomeDetail.getSourceType())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData()) == null) {
return this.saveIncome(tIncomeDetail);
}
} else if (CommonConstants.THREE_STRING.equals(tIncomeDetail.getSourceType())) {
// 商险。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
if (insureMap.get(tIncomeDetail.getDataCreateMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData()) == null) {
return this.saveIncome(tIncomeDetail);
}
} else {
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
} else {
// 薪资。收费方式:2金额-人数
if (CommonConstants.TWO_STRING.equals(tIncomeDetail.getFeeMode())) {
if (incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData()) == null) {
return this.saveIncome(tIncomeDetail);
}
} else {
// 3金额-人次
// 各个模式累加逻辑:
return this.judgeMixModel(tIncomeDetail, numMap, incomeMap);
}
}
} else {
// 实缴
// TODO
}
}
return true;
}
/**
* @Description: 人次:各个模式累加逻辑
* @Author: hgw
* @Date: 2022/9/1 18:17
* @return: boolean
**/
private boolean judgeMixModel(TIncomeDetail tIncomeDetail, Map<String, Integer> numMap, Map<String, Integer> incomeMap) {
Integer nums;
Integer maxNum;
nums = numMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getSourceType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData());
maxNum = incomeMap.get(tIncomeDetail.getPayMonth() + CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getFeeType()
+ CommonConstants.DOWN_LINE_STRING + tIncomeDetail.getRedData());
// 当明细的次数大于总次数,才可以新增统计
if (nums > maxNum) {
return this.saveIncome(tIncomeDetail);
}
return false;
}
......
......@@ -670,8 +670,10 @@
DEPT_NO = #{infoVo.settleDomainCode},
SETTLE_DOMAIN_ID = #{infoVo.settleDomainId}
where
(SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) and DATA_PUSH = '0' and EMP_IDCARD = #{infoVo.empIdcard}
or (SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth})
((SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth})
or (SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth}))
and DATA_PUSH = '0' and EMP_IDCARD = #{infoVo.empIdcard}
</update>
<!-- 更改预估社保推送状态 -->
......
......@@ -44,6 +44,7 @@
<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
<result property="sourceId" column="SOURCE_ID"/>
<result property="redData" column="RED_DATA"/>
<result property="mrSettleType" column="MR_SETTLE_TYPE"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
......@@ -65,7 +66,8 @@
a.CREATE_TIME,
a.DATA_CREATE_MONTH,
a.SOURCE_ID,
a.RED_DATA
a.RED_DATA,
a.MR_SETTLE_TYPE
</sql>
<sql id="tIncomeDetail_where">
<if test="tIncomeDetail != null">
......@@ -132,4 +134,15 @@
</if>
</sql>
<!-- 列表 -->
<select id="getTIncomeDetailList" resultMap="tIncomeDetailMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_income_detail a
<where>
1=1
<include refid="tIncomeDetail_where"/>
</where>
</select>
</mapper>
......@@ -1093,8 +1093,8 @@
SETTLE_DOMAIN_CODE = #{infoVo.settleDomainCode},
SETTLE_DOMAIN_ID = #{infoVo.settleDomainId}
where
(SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) or
(SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth})
((SALARY_SOCIAL_FLAG = '0' and SOCIAL_CREATE_MONTH >= #{infoVo.socialCreateMonth}) or
(SALARY_FUND_FLAG = '0' and PROVIDENT_CREATE_MONTH >= #{infoVo.socialCreateMonth}))
and PUSH_STATUS = '1' and EMP_IDCARD = #{infoVo.empIdcard}
</update>
......
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