Commit 8cf37236 authored by hongguangwu's avatar hongguangwu

MVP1.7.10-工资条

parent 02bf4ff2
/**
* Copyright © 2017yifu. All rights reserved.
*
* @Title: NumberToCN.java
* @Prject: wanxin_hr
* @Package: com.yifu.util
* @Description: TODO
* @author: Administrator
* @date: 2017年5月8日 下午6:45:01
* @version: V1.0
*/
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
/**
* @Author: wangan-hgw
* @Date: 2019/8/9-2025-4-21 15:32:18
* @Description: Excel样式, 从老hr复制过
* @return:
**/
public class EasyExcelStyle {
// 私有构造函数,防止实例化
private EasyExcelStyle() {
throw new UnsupportedOperationException("工具类不能被实例化");
}
/**
* @param
* @Description: 设置倩倩审美下的excel样式
* @Author: hgw
* @Date: 2024/7/9 20:30
* @return: com.alibaba.excel.write.style.HorizontalCellStyleStrategy
**/
public static HorizontalCellStyleStrategy getBaseStyle () {
// 表头——单元格样式对象
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
headWriteCellStyle.setWrapped(false);
// 背景设置为白色,也可设置为其他颜色
headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
// 设置表头字体
WriteFont headWriteFont = new WriteFont();
// 设置字体大小为12
headWriteFont.setFontHeightInPoints((short)12);
// 设置加粗
headWriteFont.setBold(true);
// 把字体对象设置到单元格样式对象中
headWriteCellStyle.setWriteFont(headWriteFont);
//设置表头居中
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
// 内容——单元格样式对象
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
contentWriteCellStyle.setWrapped(false);
// 背景设置为白色,也可设置为其他颜色
contentWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
// 设置表头字体
WriteFont contentWriteFont = new WriteFont();
// 设置字体大小为12
contentWriteFont.setFontHeightInPoints((short)11);
// 把字体对象设置到单元格样式对象中
contentWriteCellStyle.setWriteFont(contentWriteFont);
//设置表头居中
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
return horizontalCellStyleStrategy;
}
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 工资条导出-特殊的列-详情
*
* @author hgw
* @date 2019-07-30 15:00:05
*/
@Data
public class TSalaryAccountExportSpecialItemVo implements Serializable {
private static final long serialVersionUID = 1L;
private String cnName;
private String textValue;
private String accountId;
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 工资条导出-特殊的列
*
* @author hgw
* @date 2019-07-30 15:00:05
*/
@Data
public class TSalaryAccountExportSpecialVo implements Serializable {
private static final long serialVersionUID = 1L;
private String export1;
private String export2;
private String export3;
private String export4;
private String export5;
private String export6;
private String export7;
private String export8;
private String export9;
private String export10;
private String export11;
private String export12;
private String export13;
private String export14;
private String export15;
private String export16;
private String accountId;
}
...@@ -47,11 +47,15 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> { ...@@ -47,11 +47,15 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
@Param("tSalaryAccount") TSalaryAccount tSalaryAccount, @Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("deptNos") List<String> deptNos); @Param("deptNos") List<String> deptNos);
IPage<TSalaryAccount> getEmpAccountPage(Page<TSalaryAccount> page, @Param("tSalaryAccount") TSalaryAccount tSalaryAccount); IPage<TSalaryAccount> getEmpAccountPage(Page<TSalaryAccount> page, @Param("tSalaryAccount") TSalaryAccountSearchVo tSalaryAccount);
int getEmpAccountCount(@Param("tSalaryAccount") TSalaryAccount tSalaryAccount); int getEmpAccountCount(@Param("tSalaryAccount") TSalaryAccountSearchVo tSalaryAccount);
List<TSalaryAccount> getEmpAccountExport(@Param("tSalaryAccount") TSalaryAccount tSalaryAccount); List<TSalaryAccountExportSpecialVo> getEmpAccountExport(@Param("tSalaryAccount") TSalaryAccountSearchVo tSalaryAccount);
List<String> getItemAllTitle(@Param("tSalaryAccount") TSalaryAccountSearchVo tSalaryAccount);
List<TSalaryAccountExportSpecialItemVo> getEmpAccountItemExport(@Param("settlementMonth") String settlementMonth, @Param("ids") List<String> ids);
List<TSalaryAccount> getTSalaryAccountPageDataByIds(@Param("tSalaryAccount") TSalaryAccount tSalaryAccount, List<TSalaryAccount> getTSalaryAccountPageDataByIds(@Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("ids") List<String> ids); @Param("ids") List<String> ids);
......
...@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants; ...@@ -28,6 +28,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; 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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DictConverter; import com.yifu.cloud.plus.v1.yifu.common.core.util.DictConverter;
import com.yifu.cloud.plus.v1.yifu.common.core.util.EasyExcelStyle;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo; import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TDeptSee; import com.yifu.cloud.plus.v1.yifu.salary.entity.TDeptSee;
...@@ -384,7 +385,6 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -384,7 +385,6 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
String fileName = "工资条查询导出" + DateUtil.getThisTime() + CommonConstants.XLSX; String fileName = "工资条查询导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表 //获取要导出的列表
List<TSalaryAccountExportVo> list = new ArrayList<>(); List<TSalaryAccountExportVo> list = new ArrayList<>();
//long count = baseMapper.auditExportCountDiy(searchVo, searchVo.getIdList());
long count = baseMapper.getEmpAccountCount(searchVo); long count = baseMapper.getEmpAccountCount(searchVo);
ServletOutputStream out = null; ServletOutputStream out = null;
...@@ -400,9 +400,15 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -400,9 +400,15 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
return; return;
} }
List<String> titleAllList = baseMapper.getItemAllTitle(searchVo);
List<List<String>> headList = Lists.newArrayList(); List<List<String>> headList = Lists.newArrayList();
String title = "工资月份,发放状态,结算月份,项目名称,员工姓名,银行卡号,开户行,身份证号,工资发放方式,社保扣缴月份" + String title = "工资月份,发放状态,结算月份,项目名称,员工姓名,银行卡号,开户行,身份证号,工资发放方式,社保扣缴月份" +
",公积金扣缴月份,社保优先级,公积金优先级,年终奖扣税方案,是否扣除社保,是否扣除公积金"; ",公积金扣缴月份,社保优先级,公积金优先级,年终奖扣税方案,是否扣除社保,是否扣除公积金";
if (titleAllList != null && !titleAllList.isEmpty()) {
for (String temp : titleAllList) {
title += "," + temp;
}
}
String[] strTemp = title.split(","); String[] strTemp = title.split(",");
List<String> titleList; List<String> titleList;
for (String temp : strTemp) { for (String temp : strTemp) {
...@@ -410,17 +416,75 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -410,17 +416,75 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
titleList.add(temp); titleList.add(temp);
headList.add(titleList); headList.add(titleList);
} }
/*excelWriter = EasyExcelFactory.write(out).registerWriteHandler(ExcelStyle.getNormalStype()) ExcelWriter excelWriter = EasyExcelFactory.write(out).registerWriteHandler(EasyExcelStyle.getBaseStyle())
.registerConverter(new DictConverter(nameAndDicTypeMap, redisLabelMap)) .head(headList).build();
.includeColumnFieldNames(titleContent).head(headList).build();*/
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, TSalaryAccountExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build(); //ExcelWriter excelWriter = EasyExcelFactory.write(out, TSalaryAccountExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0; int index = 0;
WriteSheet writeSheet = null; WriteSheet writeSheet = null;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
Map<String,TSalaryAccountItemExportVo> itemExportVoMap = new HashMap<>(); searchVo.setLimitStart(0);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
List<TSalaryAccountExportSpecialVo> baseList = baseMapper.getEmpAccountExport(searchVo);
List<List<String>> listContent = new ArrayList<>();
List<String> contentList = new ArrayList<>();
if (baseList != null && !baseList.isEmpty()) {
for (TSalaryAccountExportSpecialVo a : baseList) {
contentList.add(a.getAccountId());
}
Map<String, Map<String, String>> itemMap = new HashMap<>();
Map<String, String> tempMap = new HashMap<>();
if (titleAllList != null && !titleAllList.isEmpty()) {
List<TSalaryAccountExportSpecialItemVo> itemList = baseMapper.getEmpAccountItemExport(searchVo.getSettlementMonth() ,contentList);
for (TSalaryAccountExportSpecialItemVo itemVo : itemList) {
tempMap = itemMap.get(itemVo.getAccountId());
if (tempMap == null) {
tempMap = new HashMap<>();
}
tempMap.put(itemVo.getCnName(), itemVo.getTextValue());
itemMap.put(itemVo.getAccountId(), tempMap);
}
}
for (TSalaryAccountExportSpecialVo a : baseList) {
contentList = new ArrayList<>();
contentList.add(a.getExport1());
contentList.add(a.getExport2());
contentList.add(a.getExport3());
contentList.add(a.getExport4());
contentList.add(a.getExport5());
contentList.add(a.getExport6());
contentList.add(a.getExport7());
contentList.add(a.getExport8());
contentList.add(a.getExport9());
contentList.add(a.getExport10());
contentList.add(a.getExport11());
contentList.add(a.getExport12());
contentList.add(a.getExport13());
contentList.add(a.getExport14());
contentList.add(a.getExport15());
contentList.add(a.getExport16());
if (titleAllList != null && !titleAllList.isEmpty()) {
tempMap = itemMap.get(a.getAccountId());
for (String temp : titleAllList) {
if (tempMap != null) {
if (tempMap.get(temp) != null) {
contentList.add(tempMap.get(temp));
} else {
contentList.add("");
}
} else {
contentList.add("");
}
}
}
listContent.add(contentList);
}
}
writeSheet = EasyExcelFactory.writerSheet("工资条" + index).build();
excelWriter.write(listContent, writeSheet);
/*Map<String,TSalaryAccountItemExportVo> itemExportVoMap = new HashMap<>();
List<String> idList = null; List<String> idList = null;
List<String> idStandardList = null; List<String> idStandardList = null;
List<TAuditExportStandardVo> standardItems = null; List<TAuditExportStandardVo> standardItems = null;
...@@ -515,7 +579,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, ...@@ -515,7 +579,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
list.clear(); list.clear();
} }
clearMap(itemExportVoMap, idList, idStandardList, itemStandardMap, itemAnnualBonusMap, itemPersionTaxMap, itemAnnuityMap, itemSubsidyMap); clearMap(itemExportVoMap, idList, idStandardList, itemStandardMap, itemAnnualBonusMap, itemPersionTaxMap, itemAnnuityMap, itemSubsidyMap);
} }*/
} else { } else {
writeSheet = EasyExcelFactory.writerSheet("工资条" + index).build(); writeSheet = EasyExcelFactory.writerSheet("工资条" + index).build();
excelWriter.write(list, writeSheet); excelWriter.write(list, writeSheet);
......
...@@ -574,10 +574,10 @@ ...@@ -574,10 +574,10 @@
SELECT SELECT
count(1) count(1)
FROM FROM
<if test="settlementMonth == null or settlementMonth.trim() >= '202201' "> <if test="tSalaryAccount.settlementMonth == null or tSalaryAccount.settlementMonth.trim() >= '202201' ">
t_salary_account a t_salary_account a
</if> </if>
<if test="settlementMonth != null and settlementMonth.trim() &lt; '202201' "> <if test="tSalaryAccount.settlementMonth != null and tSalaryAccount.settlementMonth.trim() &lt; '202201' ">
t_salary_account_hro_2021 a t_salary_account_hro_2021 a
</if> </if>
where a.DELETE_FLAG = 0 where a.DELETE_FLAG = 0
...@@ -585,50 +585,86 @@ ...@@ -585,50 +585,86 @@
</select> </select>
<!--项目薪酬查询-工资条查询-导出--> <!--项目薪酬查询-工资条查询-导出-->
<select id="getEmpAccountExport" resultMap="tSalaryAccountMap"> <select id="getEmpAccountExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportSpecialVo">
SELECT SELECT
a.SALARY_MONTH, a.SALARY_MONTH export1,
if(a.DISTRIBUTION_FLAG='1','发放成功',if(a.DISTRIBUTION_FLAG='2','发放失败','未发放')) DISTRIBUTION_FLAG, if(a.DISTRIBUTION_FLAG='1','发放成功',if(a.DISTRIBUTION_FLAG='2','发放失败','未发放')) export2,
a.SETTLEMENT_MONTH, a.SETTLEMENT_MONTH export3,
a.DEPT_NAME, a.DEPT_NAME export4,
a.EMP_NAME, a.EMP_NAME export5,
a.BANK_NO, a.BANK_NO export6,
a.BANK_NAME, a.BANK_NAME export7,
a.EMP_IDCARD, a.EMP_IDCARD export8,
if(a.SALARY_STYLE='0','现金',if(a.SALARY_STYLE='1','转账','线下')) SALARY_STYLE, if(a.SALARY_STYLE='0','现金',if(a.SALARY_STYLE='1','转账','线下')) export9,
a.DEDU_SOCIAL_MONTH, a.DEDU_SOCIAL_MONTH export10,
a.DEDU_PROVIDENT_MONTH, a.DEDU_PROVIDENT_MONTH export11,
if(a.SOCIAL_PRIORITY='0','生成','缴纳') SOCIAL_PRIORITY, if(a.SOCIAL_PRIORITY='0','生成','缴纳') export12,
if(a.FUND_PRIORITY='0','生成','缴纳') FUND_PRIORITY, if(a.FUND_PRIORITY='0','生成','缴纳') export13,
if(a.ANNUAL_BONUS_TYPE='0','合并','单独') ANNUAL_BONUS_TYPE, if(a.ANNUAL_BONUS_TYPE='0','合并','单独') export14,
if(a.IS_DEDUCT_SOCIAL='0','否','是') IS_DEDUCT_SOCIAL, if(a.IS_DEDUCT_SOCIAL='0','否','是') export15,
if(a.IS_DEDUCT_FUND='0','否','是') IS_DEDUCT_FUND if(a.IS_DEDUCT_FUND='0','否','是') export16,
a.id accountId
FROM FROM
<if test="settlementMonth == null or settlementMonth.trim() >= '202201' "> <if test="tSalaryAccount.settlementMonth == null or tSalaryAccount.settlementMonth.trim() >= '202201' ">
t_salary_account a t_salary_account a
</if> </if>
<if test="settlementMonth != null and settlementMonth.trim() &lt; '202201' "> <if test="tSalaryAccount.settlementMonth != null and tSalaryAccount.settlementMonth.trim() &lt; '202201' ">
t_salary_account_hro_2021 a t_salary_account_hro_2021 a
</if> </if>
where a.DELETE_FLAG = 0 where a.DELETE_FLAG = 0
<include refid="tSalaryAccount_where"/> <include refid="tSalaryAccount_where"/>
order by a.SETTLEMENT_MONTH asc order by a.SETTLEMENT_MONTH asc
<if test="searchVo != null"> <if test="tSalaryAccount != null">
<if test="searchVo.limitStart != null"> <if test="tSalaryAccount.limitStart != null">
limit #{searchVo.limitStart},#{searchVo.limitEnd} limit #{tSalaryAccount.limitStart},#{tSalaryAccount.limitEnd}
</if> </if>
</if> </if>
</select> </select>
<!--项目薪酬查询-工资条查询-导出-->
<select id="getItemAllTitle" resultType="java.lang.String">
SELECT
i.CN_NAME
FROM
<if test="tSalaryAccount.settlementMonth == null or tSalaryAccount.settlementMonth.trim() >= '202201' ">
t_salary_account_item i
LEFT JOIN t_salary_account a on i.SALARY_ACCOUNT_ID=a.id
</if>
<if test="tSalaryAccount.settlementMonth != null and tSalaryAccount.settlementMonth.trim() &lt; '202201' ">
t_salary_account_item_hro_2021 i
LEFT JOIN t_salary_account_hro_2021 a on i.SALARY_ACCOUNT_ID=a.id
</if>
where a.DELETE_FLAG = 0
<include refid="tSalaryAccount_where"/>
GROUP BY i.CN_NAME
</select>
<!--项目薪酬查询-工资条查询-导出-->
<select id="getEmpAccountItemExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportSpecialItemVo">
SELECT
a.CN_NAME cnName,ifnull(a.TEXT_VALUE,a.SALARY_MONEY) textValue,a.SALARY_ACCOUNT_ID accountId
FROM
<if test="settlementMonth == null or settlementMonth.trim() >= '202201' ">
t_salary_account_item a
</if>
<if test="settlementMonth != null and settlementMonth.trim() &lt; '202201' ">
t_salary_account_item_hro_2021 a
</if>
where a.SALARY_ACCOUNT_ID in
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<!--项目薪酬查询-工资条查询--> <!--项目薪酬查询-工资条查询-->
<select id="getEmpAccountPage" resultMap="tSalaryAccountMap"> <select id="getEmpAccountPage" resultMap="tSalaryAccountMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM FROM
<if test="settlementMonth == null or settlementMonth.trim() >= '202201' "> <if test="tSalaryAccount.settleMonthStart == null or tSalaryAccount.settleMonthStart.trim() >= '202201' ">
t_salary_account a t_salary_account a
</if> </if>
<if test="settlementMonth != null and settlementMonth.trim() &lt; '202201' "> <if test="tSalaryAccount.settleMonthStart != null and tSalaryAccount.settleMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a t_salary_account_hro_2021 a
</if> </if>
where a.DELETE_FLAG = 0 where a.DELETE_FLAG = 0
......
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