Commit 3ff254ce authored by fangxinjiang's avatar fangxinjiang

Merge branch 'MVP1.7.6' into MVP1.7.7

parents 0ab73ad6 b06f292a
...@@ -47,6 +47,16 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> { ...@@ -47,6 +47,16 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
@Param("tSalaryAccount") TSalaryAccount tSalaryAccount, @Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("deptNos") List<String> deptNos); @Param("deptNos") List<String> deptNos);
List<TSalaryAccount> getTSalaryAccountPageDataByIds(@Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("ids") List<String> ids);
List<String> getTSalaryAccountPageIds(@Param("page")Long page,
@Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("deptNos") List<String> deptNos, @Param("size")Long size);
int getTSalaryAccountPageCount(@Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("deptNos") List<String> deptNos);
List<TSalaryAccount> getTSalaryAccountPageDiy( @Param("tSalaryAccount") TSalaryAccount tSalaryAccount,@Param("page")Long page, @Param("size")Long size); List<TSalaryAccount> getTSalaryAccountPageDiy( @Param("tSalaryAccount") TSalaryAccount tSalaryAccount,@Param("page")Long page, @Param("size")Long size);
...@@ -112,12 +122,24 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> { ...@@ -112,12 +122,24 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List<SalaryAccountExportVo> noPageDiyLast(@Param("searchVo") TSalaryAccountSearchVo searchVo, List<SalaryAccountExportVo> noPageDiyLast(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList, @Param("idList") List<String> idList,
@Param("deptNos") List<String> deptNos); @Param("deptNos") List<String> deptNos);
List<SalaryAccountExportVo> noPageDiyLastByIds(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
List<String> noPageDiyLastIds(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList,
@Param("deptNos") List<String> deptNos);
List<TSalaryAccountExportVo> auditExport(@Param("searchVo") TSalaryAccountSearchVo searchVo, List<TSalaryAccountExportVo> auditExport(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList); @Param("idList") List<String> idList);
List<TSalaryAccountExportVo> auditExportDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo, List<TSalaryAccountExportVo> auditExportDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList); @Param("idList") List<String> idList);
List<TSalaryAccountExportVo> auditExportDiyByIds(@Param("idList") List<String> idList);
List<String> auditExportDiyIds(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
List<TSalaryAccountItemExportVo> auditExportSelectItems(@Param("idList") List<String> idList); List<TSalaryAccountItemExportVo> auditExportSelectItems(@Param("idList") List<String> idList);
......
...@@ -39,7 +39,6 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService; ...@@ -39,7 +39,6 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*; import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -87,7 +86,20 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -87,7 +86,20 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
if (Common.isNotNull(depts)){ if (Common.isNotNull(depts)){
deptNos = depts.stream().map(TDeptSee::getDeptNo).collect(Collectors.toList()); deptNos = depts.stream().map(TDeptSee::getDeptNo).collect(Collectors.toList());
} }
return baseMapper.getTSalaryAccountPage(page, tSalaryAccount,deptNos); int count = baseMapper.getTSalaryAccountPageCount(tSalaryAccount,deptNos);
if (count < 100000){
return baseMapper.getTSalaryAccountPage(page, tSalaryAccount,deptNos);
}else {
List<String> ids = baseMapper.getTSalaryAccountPageIds((page.getCurrent()==0?0:(page.getCurrent()-1))*page.getSize(),tSalaryAccount,deptNos,page.getSize());
List<TSalaryAccount> data = baseMapper.getTSalaryAccountPageDataByIds(tSalaryAccount,ids);
IPage<TSalaryAccount> pageData = new Page<TSalaryAccount>();
pageData.setCurrent(page.getCurrent());
pageData.setTotal(count);
pageData.setSize(page.getSize());
pageData.setRecords(data);
return pageData;
}
} }
/** /**
...@@ -148,11 +160,22 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -148,11 +160,22 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
int index = 0; int index = 0;
WriteSheet writeSheet = null; WriteSheet writeSheet = null;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
List<String> ids = null;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_1) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_1) {
// 获取实际记录 // 获取实际记录
searchVo.setLimitStart(i); searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_1); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_1);
list = noPageDiyLast(searchVo,deptNos); if (count < 200000){
list = noPageDiyLast(searchVo,deptNos);
}else{
ids = baseMapper.noPageDiyLastIds(searchVo,null,deptNos);
if (Common.isNotNull(ids)){
list = baseMapper.noPageDiyLastByIds(searchVo,ids);
}else {
list = new ArrayList<>();
}
}
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
if (i%CommonConstants.EXCEL_EXPORT_LIMIT==0){ if (i%CommonConstants.EXCEL_EXPORT_LIMIT==0){
writeSheet = EasyExcelFactory.writerSheet("工资报账主表(工资条)" + index).build(); writeSheet = EasyExcelFactory.writerSheet("工资报账主表(工资条)" + index).build();
...@@ -161,6 +184,9 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -161,6 +184,9 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
excelWriter.write(list, writeSheet); excelWriter.write(list, writeSheet);
list.clear(); list.clear();
} }
if (Common.isNotNull(ids)){
ids.clear();
}
} }
} else { } else {
writeSheet = EasyExcelFactory.writerSheet("工资报账主表(工资条)" + index).build(); writeSheet = EasyExcelFactory.writerSheet("工资报账主表(工资条)" + index).build();
...@@ -220,11 +246,29 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -220,11 +246,29 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
List<TAuditExportItemVo> exemptionPersionTaxItems; List<TAuditExportItemVo> exemptionPersionTaxItems;
List<TAuditExportItemVo> enterpriseAnnuityItems; List<TAuditExportItemVo> enterpriseAnnuityItems;
List<TAuditExportItemVo> phoneSubsidyItems; List<TAuditExportItemVo> phoneSubsidyItems;
List<String> ids = null;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_1) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_1) {
// 获取实际记录 // 获取实际记录
searchVo.setLimitStart(i); searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_1); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_1);
list = baseMapper.auditExportDiy(searchVo, searchVo.getIdList()); if (count < 200000){
list = baseMapper.auditExportDiy(searchVo, searchVo.getIdList());
}else{
if (Common.isNotNull(searchVo.getIdList())){
ids = searchVo.getIdList();
}else {
ids = baseMapper.auditExportDiyIds(searchVo, searchVo.getIdList());
}
if (Common.isNotNull(ids)){
searchVo.setIdList(null);
list = baseMapper.auditExportDiyByIds(ids);
}else {
list = new ArrayList<>();
}
}
if (Common.isNotNull(ids)){
ids.clear();
}
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
//先把数据封装完成 //先把数据封装完成
idList = list.stream().map(TSalaryAccountExportVo::getId).collect(Collectors.toList()); idList = list.stream().map(TSalaryAccountExportVo::getId).collect(Collectors.toList());
......
...@@ -568,7 +568,79 @@ ...@@ -568,7 +568,79 @@
</where> </where>
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<!--tSalaryAccount简单分页查询-->
<select id="getTSalaryAccountPageDataByIds" resultMap="tSalaryAccountMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<if test="tSalaryAccount.salaryMonthStart == null or tSalaryAccount.salaryMonthStart.trim() >= '202201' ">
t_salary_account a
</if>
<if test="tSalaryAccount.salaryMonthStart != null and tSalaryAccount.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
<where>
<if test="ids != null and ids.size>0">
AND a.id in
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<!--tSalaryAccount简单分页查询-->
<select id="getTSalaryAccountPageIds" resultType="java.lang.String">
SELECT
id
FROM
<if test="tSalaryAccount.salaryMonthStart == null or tSalaryAccount.salaryMonthStart.trim() >= '202201' ">
t_salary_account a
</if>
<if test="tSalaryAccount.salaryMonthStart != null and tSalaryAccount.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
<where>
<include refid="tSalaryAccount_where"/>
<if test="deptNos != null and deptNos.size>0">
AND a.DEPT_NO not in
<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="tSalaryAccount.authSql != null and tSalaryAccount.authSql.trim() != ''">
${tSalaryAccount.authSql}
</if>
</where>
order by a.CREATE_TIME desc
<if test="null != page and null != size">
limit #{page},#{size}
</if>
</select>
<!--tSalaryAccount简单分页查询前置判断,如果数量过大采用延迟加载数据的方式-->
<select id="getTSalaryAccountPageCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
<if test="tSalaryAccount.salaryMonthStart == null or tSalaryAccount.salaryMonthStart.trim() >= '202201' ">
t_salary_account a
</if>
<if test="tSalaryAccount.salaryMonthStart != null and tSalaryAccount.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
<where>
<include refid="tSalaryAccount_where"/>
<if test="deptNos != null and deptNos.size>0">
AND a.DEPT_NO not in
<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="tSalaryAccount.authSql != null and tSalaryAccount.authSql.trim() != ''">
${tSalaryAccount.authSql}
</if>
</where>
order by a.CREATE_TIME desc
</select>
<!--tSalaryAccount简单分页查询--> <!--tSalaryAccount简单分页查询-->
<select id="getTSalaryAccountPageDiy" resultMap="tSalaryAccountMap"> <select id="getTSalaryAccountPageDiy" resultMap="tSalaryAccountMap">
SELECT SELECT
...@@ -1496,7 +1568,8 @@ ...@@ -1496,7 +1568,8 @@
<select id="getAccountIdByIdCard" resultType="java.lang.Integer"> <select id="getAccountIdByIdCard" resultType="java.lang.Integer">
select count(1) from t_salary_account a where a.DELETE_FLAG = 0 and a.EMP_IDCARD = #{empIdCard} and a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%') select count(1) from t_salary_account a where a.DELETE_FLAG = 0 and a.EMP_IDCARD = #{empIdCard} and a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
</select> </select>
<select id="noPageDiyLast" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo"> <!-- 员工报账导出 通过id获取数据 -->
<select id="noPageDiyLastByIds" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo">
SELECT SELECT
a.DEPT_NAME, a.DEPT_NAME,
a.DEPT_NO, a.DEPT_NO,
...@@ -1521,6 +1594,27 @@ ...@@ -1521,6 +1594,27 @@
</if> </if>
left join sys_area ap on ap.id=a.BANK_PROVINCE left join sys_area ap on ap.id=a.BANK_PROVINCE
left join sys_area ac on ac.id=a.BANK_CITY left join sys_area ac on ac.id=a.BANK_CITY
<where>
<if test="idList != null and idList.size>0">
AND a.id in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
</where>
ORDER BY a.CREATE_TIME desc
</select>
<!-- 员工报账导出 获取id数据-->
<select id="noPageDiyLastIds" resultType="java.lang.String" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo">
SELECT
a.id
FROM
<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
t_salary_account a
</if>
<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
<where> <where>
a.DELETE_FLAG = 0 a.DELETE_FLAG = 0
...@@ -1541,9 +1635,54 @@ ...@@ -1541,9 +1635,54 @@
</if> </if>
</if> </if>
</where> </where>
</select> </select>
<!-- 员工报账导出查询 -->
<select id="noPageDiyLast" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo">
SELECT
a.DEPT_NAME,
a.DEPT_NO,
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_PHONE,
a.BANK_NO,
a.BANK_NAME,
ap.AREA_NAME BANK_PROVINCE,
ac.AREA_NAME BANK_CITY,
a.BANK_SUB_NAME,
case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as FORM_TYPE,
a.SALARY_MONTH,
if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,ifnull(a.RELAY_SALARY,0)) RELAY_SALARY,
a.ACTUAL_SALARY
FROM
<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
t_salary_account a
</if>
<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
left join sys_area ap on ap.id=a.BANK_PROVINCE
left join sys_area ac on ac.id=a.BANK_CITY
<where>
a.DELETE_FLAG = 0
<include refid="where_export"/>
<if test="deptNos != null and deptNos.size>0">
AND a.DEPT_NO not in
<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
${searchVo.authSql}
</if>
ORDER BY a.CREATE_TIME desc
<if test="searchVo != null">
<if test="searchVo.limitStart != null">
limit #{searchVo.limitStart},#{searchVo.limitEnd}
</if>
</if>
</where>
</select>
<select id="noPageCountDiyLast" resultType="java.lang.Integer"> <select id="noPageCountDiyLast" resultType="java.lang.Integer">
SELECT SELECT
count(1) count(1)
...@@ -1568,6 +1707,7 @@ ...@@ -1568,6 +1707,7 @@
${searchVo.authSql} ${searchVo.authSql}
</if> </if>
</where> </where>
order by a.CREATE_TIME desc
</select> </select>
<select id="auditExportDiy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportVo" <select id="auditExportDiy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportVo"
...@@ -1631,6 +1771,79 @@ ...@@ -1631,6 +1771,79 @@
</if> </if>
</where> </where>
</select>
<select id="auditExportDiyByIds" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportVo"
parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
select
a.SALARY_FORM_ID as salaryFormId,
a.id,
case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as formType,
a.EMP_PHONE as empPhone,
a.TAX_MONTH as taxMonth,
a.SETTLEMENT_MONTH as settlementMonth,
a.SALARY_MONTH as salaryMonth,
a.INVOICE_TITLE as invoiceTitle,
a.UNIT_NAME as unitName,
a.UNIT_NO as unitNo,
a.DEPT_NAME as deptName,
a.DEPT_NO as deptNo,
a.EMP_NAME as empName,
a.EMP_IDCARD as empIdcard,
if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0, a.RELAY_SALARY_UNIT, ifnull(a.RELAY_SALARY,0)) as relaySalary,
a.ACTUAL_SALARY as actualSalary,
ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0) as salaryTax,
a.ANNUAL_BONUS_TAX as annualBonusTax,
a.PERSON_SOCIAL as personSocial,
a.PERSON_FUND as personFund,
a.UNIT_SOCIAL as unitSocial,
a.UNIT_FUND as unitFund,
a.SUM_BABY_MONEY as sumBabyMoney,
a.SUM_CHILD_EDU_MONEY as sumChildEduMoney,
a.SUM_CONTINUING_EDUCATION_MONEY as sumContinuingEducationMoney,
a.SUM_HOUSING_LOAN_MONEY as sumHousingLoanMoney,
a.SUM_HOUSING_RENT_MONEY as sumHousingRentMoney,
a.SUM_PRIVATE_PENSION as sumPrivatePension,
a.SUM_SUPPORT_ELDERLY_MONEY as sumSupportElderlyMoney,
a.COST_REDUCTION as costReduction,
a.CREATE_NAME as createName,
if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag
from
t_salary_account a
<where>
a.DELETE_FLAG = 0
<if test="idList != null and idList.size>0">
AND a.id in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
ORDER BY a.SALARY_MONTH asc
</where>
</select>
<select id="auditExportDiyIds" resultType="java.lang.String"
parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
select
a.id
from
t_salary_account a
/*left join t_salary_standard s on a.SALARY_FORM_ID = s.id
left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
left join t_salary_account_item phoneSubsidy on phoneSubsidy.SALARY_ACCOUNT_ID = a.id and phoneSubsidy.JAVA_FIED_NAME='phoneSubsidy'*/
<where>
a.DELETE_FLAG = 0
<include refid="where_export"/>
ORDER BY a.SALARY_MONTH asc
<if test="searchVo != null">
<if test="searchVo.limitStart != null">
limit #{searchVo.limitStart},#{searchVo.limitEnd}
</if>
</if>
</where>
</select> </select>
<select id="auditExportPhoneSubsidy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportItemVo"> <select id="auditExportPhoneSubsidy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TAuditExportItemVo">
select select
......
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