Commit a533c244 authored by hongguangwu's avatar hongguangwu

MVP1.6.2-工资原表识别-优化

parent 0d91c4b2
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
/**
* 薪资详情里的报账导出-EKP附件专用
* 薪资详情里的报账导出,是前端导出,此处后端导出,给EKP项目订单获取附件使用的
* @author hgw
* @date 2024-4-18 17:04:21
*/
@Data
@Schema(description = "薪资详情里的报账导出-EKP附件专用")
@HeadFontStyle(fontHeightInPoints = 11)
public class TSalaryAccountExportByEkpVo {
// 薪酬状态,项目名称,项目编码,发放月份,薪酬月份,员工姓名,身份证号,手机号码,银行卡号,开户行总行
// ,应发工资,个人社保,个人公积金,个税,年终奖单独扣税税费,企业(职业)年金,个人代扣金额,个人实发合计,单位社保,单位公积金
// ,减除费用,累计子女教育,累计继续教育,累计住房贷款利息,累计住房租金,累计赡养老人,累计3岁以下婴幼儿照护,累计个人养老金,年终奖扣税方案,开户行省
// ,开户行市,开户行支行,工资发放方式,工资发放时间,社保缴纳月份,公积金缴纳月份,社保优先级,公积金优先级,是否扣除社保,是否扣除公积金
// ,本月是否重复金额,是否自有员工,是否薪资特殊值,支出结算状态
@ExcelProperty("薪酬状态")
private String status;
@ExcelProperty("项目名称")
private String deptName;
@ExcelProperty("项目编码")
private String deptNo;
@ExcelProperty("发放月份")
private String settlementMonth;
@ExcelProperty("薪酬月份")
private String salaryMonth;
@ExcelProperty("员工姓名")
private String empName;
@ExcelProperty("身份证号")
private String empIdcard;
@ExcelProperty("手机号码")
private String empPhone;
// TODO
@ExcelProperty("银行卡号")
private String bankNo;
// TODO
@ExcelProperty("开户行总行")
private String bankName;
// ,应发工资,个人社保,个人公积金,个税,年终奖单独扣税税费,企业(职业)年金,个人代扣金额,个人实发合计,单位社保,单位公积金
@ExcelProperty("应发工资")
private BigDecimal relaySalary;
@ExcelProperty("个人社保")
private BigDecimal personSocial;
@ExcelProperty("个人公积金")
private BigDecimal personFund;
@ExcelProperty("个税")
private BigDecimal salaryTax;
@ExcelProperty(value = "年终奖单独扣税税费")
private BigDecimal annualBonusTax;
@ExcelProperty("企业(职业)年金")
private BigDecimal enterpriseAnnuity;
@ExcelProperty("个人代扣金额")
private String pdeductionMoney;
@ExcelProperty("个人实发合计")
private BigDecimal actualSalary;
@ExcelProperty("单位社保")
private BigDecimal unitSocial;
@ExcelProperty("单位公积金")
private BigDecimal unitFund;
// ,减除费用,累计子女教育,累计继续教育,累计住房贷款利息,累计住房租金,累计赡养老人,累计3岁以下婴幼儿照护,累计个人养老金,年终奖扣税方案,开户行省
@ExcelProperty("减除费用")
private BigDecimal costReduction;
@ExcelProperty(value = "累计子女教育")
private BigDecimal sumChildEduMoney;
@ExcelProperty(value = "累计继续教育")
private BigDecimal sumContinuingEducationMoney;
@ExcelProperty(value = "累计住房贷款利息")
private BigDecimal sumHousingLoanMoney;
@ExcelProperty(value = "累计住房租金")
private BigDecimal sumHousingRentMoney;
@ExcelProperty(value = "累计赡养老人")
private BigDecimal sumSupportElderlyMoney;
@ExcelProperty(value = "累计3岁以下婴幼儿照护")
private BigDecimal sumBabyMoney;
@ExcelProperty(value = "累计个人养老金")
private BigDecimal sumPrivatePension;
// TODO 年终奖扣税方案0:合并;1:单独
@ExcelProperty("年终奖扣税方案")
private String annualBonusType;
// TODO
@ExcelProperty("开户行省")
private String bankProvince;
// ,开户行市,开户行支行,工资发放方式,工资发放时间,社保缴纳月份,公积金缴纳月份,社保优先级,公积金优先级,是否扣除社保,是否扣除公积金
// TODO
@ExcelProperty("开户行市")
private String bankCity;
// TODO
@ExcelProperty("开户行支行")
private String bankSubName;
// TODO 工资发放方式(0现金/1银行)/2线下
@ExcelProperty("工资发放方式")
private String salaryStyle;
// TODO 工资发放时间(0立即发、1暂停发)
@ExcelProperty("工资发放时间")
private String salaryGiveTime;
// TODO
@ExcelProperty("社保缴纳月份")
private String deduSocialMonth;
// TODO
@ExcelProperty("公积金缴纳月份")
private String deduProvidentMonth;
// TODO 社保优先级0:生成月;1:缴纳月
@ExcelProperty("社保优先级")
private String socialPriority;
// TODO 公积金优先级0:生成月;1:缴纳月
@ExcelProperty("公积金优先级")
private String fundPriority;
// TODO 是否扣除社保 0:否,1:是
@ExcelProperty("是否扣除社保")
private String isDeductSocial;
// TODO 是否扣除公积金 0:否,1:是
@ExcelProperty("是否扣除公积金")
private String isDeductFund;
// ,本月是否重复金额,是否自有员工,是否薪资特殊值,支出结算状态
// TODO 本月是否重复金额0:否;1:是重复导入的
@ExcelProperty("本月是否重复金额")
private String isRepeat;
// TODO 是否自有员工0:否;1:是自有员工
@ExcelProperty("是否自有员工")
private String ownFlag;
// TODO 是否含有特殊金额
@ExcelProperty("是否薪资特殊值")
private Integer haveSpecialFlag;
@ExcelProperty("支出结算状态")
private String paySettleFlag;
@ExcelProperty("免个税个人代扣")
private BigDecimal exemptionPersionTax;
@ExcelProperty("是否劳务费")
private String formType;
@ExcelProperty("计税月份")
private String taxMonth;
@ExcelProperty("出账单位")
private String invoiceTitle;
@ExcelProperty("业务类型分类")
private String businessPrimaryType;
@ExcelProperty("业务类型二级分类")
private String businessSecondType;
@ExcelProperty("业务类型三级分类")
private String businessThirdType;
@ExcelProperty("年终奖")
private BigDecimal annualBonus;
@ExcelProperty("通讯补贴(不计税)")
private BigDecimal phoneSubsidy;
@ExcelProperty("表单上传人")
private String createName;
@ExcelProperty("个人代扣明细")
private String pdeductionDetail;
@ExcelProperty("结算单位")
private String unitName;
@ExcelProperty("结算单位编码")
private String unitNo;
}
......@@ -21,7 +21,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAtta;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAttaService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAttaVo;
......@@ -35,7 +34,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
......@@ -163,7 +161,6 @@ public class TSalaryAttaController {
@SysLog("获取薪资原表附件--EKP调用接口")
@GetMapping("/getFileByApplyNo")
public R<SalaryAttaVo> getFileByApplyNo(@RequestParam String applyNo) {
List<SalaryAttaVo> voList = new ArrayList<>();
// * linkType 类型:0工资;1工程工资;2暂停发;3自定义项暂停发;4打印记录;5核准表打印记录;6:非扣税项;8自有员工附件
// * ;9财务回执附件;10换人换卡;11薪资原表;12劳务费或稿酬已有发薪记录;13薪资特殊值(3500、5000)
// * 14:薪资详情导出组装的附件
......@@ -178,13 +175,8 @@ public class TSalaryAttaController {
vo.setAttaName(a.getAttaName());
vo.setAttaUrl(url.toString().replace("http","https"));
} else {
// TODO 生成附件:
//TSalaryAccount a
//vo.setAttaName(a.getAttaName());
//vo.setAttaUrl(url.toString().replace("http","https"));
// 获取薪资报账,转化为excel,上传到系统,然后将附件名称与地址返回
vo = tSalaryAttaService.getSalaryAccountToExcel(applyNo);
}
return R.ok(vo);
}
......
......@@ -113,6 +113,9 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List<TSalaryAccount> getAccountListBySalaryId(@Param("searchVo") TSalaryAccountSearchVo searchVo);
// 导出报账专用hgw
List<TSalaryAccountExportByEkpVo> getAccountListByApplyNo(@Param("applyNo") String applyNo);
/**
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
* @Author: hgw
......
......@@ -24,10 +24,7 @@ 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.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountAndItemVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountSumVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
......@@ -78,6 +75,15 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
**/
List<TSalaryAccount> getAccountListBySalaryId(TSalaryAccountSearchVo searchVo);
/**
* @param applyNo 薪酬申请编号
* @Description: 导出报账专用hgw
* @Author: hgw
* @Date: 2024/4/18 11:00
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
List<TSalaryAccountExportByEkpVo> getAccountListByApplyNo(String applyNo);
/**
* @param settleId
* @param settleMonth
......
......@@ -23,6 +23,7 @@ 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.FileVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAtta;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAttaVo;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
......@@ -98,4 +99,14 @@ public interface TSalaryAttaService extends IService<TSalaryAtta> {
void updateAttaByLinkId(List<String> salaryAttaIds, String linkId);
void setSrc(List<TSalaryAtta> attaList);
/**
* @param applyNo
* @Description: 获取薪资报账,转化为excel,上传到系统,然后将附件名称与地址返回
* @Author: hgw
* @Date: 2024/4/18 10:26
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAttaVo
**/
SalaryAttaVo getSalaryAccountToExcel(String applyNo);
}
......@@ -198,6 +198,18 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
return baseMapper.getAccountListBySalaryId(searchVo);
}
/**
* @param applyNo
* @Description: 导出报账专用hgw
* @Author: hgw
* @Date: 2024/4/18 11:00
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount>
**/
@Override
public List<TSalaryAccountExportByEkpVo> getAccountListByApplyNo(String applyNo) {
return baseMapper.getAccountListByApplyNo(applyNo);
}
private int noPageCountDiy(TSalaryAccountSearchVo searchVo) {
return baseMapper.noPageCountDiy(searchVo,searchVo.getIdList());
}
......
......@@ -16,37 +16,39 @@
*/
package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.alibaba.excel.EasyExcelFactory;
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.common.core.constant.CommonConstants;
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.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
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.TSalaryAtta;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAttaMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAttaService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardService;
import io.swagger.v3.oas.annotations.Operation;
import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAttaVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportByEkpVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -63,6 +65,7 @@ public class TSalaryAttaServiceImpl extends ServiceImpl<TSalaryAttaMapper, TSala
private final OSSUtil ossUtil;
private final TSalaryStandardService tSalaryStandardService;
private final TSalaryAccountService tSalaryAccountService;
/**
* 薪资结算附件表简单分页查询
......@@ -281,4 +284,53 @@ public class TSalaryAttaServiceImpl extends ServiceImpl<TSalaryAttaMapper, TSala
}
}
/**
* @param applyNo
* @Description: 获取薪资报账,转化为excel,上传到系统,然后将附件名称与地址返回
* @Author: hgw
* @Date: 2024/4/18 17:05
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAttaVo
**/
@Override
public synchronized SalaryAttaVo getSalaryAccountToExcel(String applyNo) {
SalaryAttaVo returnVo = new SalaryAttaVo();
List<TSalaryAccountExportByEkpVo> accountList = tSalaryAccountService.getAccountListByApplyNo(applyNo);
if (accountList != null) {
String filePath = "salaryAccountFile";
String fileName = "薪资报表"+ applyNo + DateUtil.getThisTime() + CommonConstants.XLSX;
String key = filePath + "/" + fileName;
EasyExcelFactory.write(filePath, TSalaryAccountExportByEkpVo.class).sheet("薪资报表生成").doWrite(accountList);
try {
File file = new File(filePath);
InputStream inputStream = new FileInputStream(file);
// 调用上传服务
boolean flag = ossUtil.uploadFileByStream(inputStream, key,null);
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
TSalaryAtta salaryAtta = this.saveTSalaryAtta(fileName, key, file.length(), applyNo, 14, null, null, null);
try {
this.save(salaryAtta);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
}
URL url = ossUtil.getObjectUrl(null, salaryAtta.getAttaSrc());
returnVo.setAttaUrl(url.toString());
returnVo.setAttaName(salaryAtta.getAttaName());
return returnVo;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
//删除临时文件
try {
org.apache.commons.io.FileUtils.forceDelete(new File(filePath));
} catch (IOException e) {
e.printStackTrace();
}
}
}
return returnVo;
}
}
......@@ -885,6 +885,61 @@
ORDER BY a.ROW_INDEX ASC
</select>
<!-- 导出报账专用hgw -->
<select id="getAccountListByApplyNo" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportByEkpVo">
select
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,
annualBonus.SALARY_MONEY as annualBonus,
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,
exemptionPersionTax.SALARY_MONEY as exemptionPersionTax,
enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity,
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,
GROUP_CONCAT(pdeduction.CN_NAME,':',pdeduction.SALARY_MONEY SEPARATOR ';') pdeductionDetail,
sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeductionMoney,
if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag,
case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
,phoneSubsidy.SALARY_MONEY as phoneSubsidy
,s.BUSINESS_PRIMARY_TYPE as businessPrimaryType
,s.BUSINESS_SECOND_TYPE as businessSecondType
,s.BUSINESS_THIRD_TYPE as businessThirdType
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 s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0
ORDER BY a.ROW_INDEX ASC
</select>
<!-- 计算收入需要的报账明细 -->
<select id="getListByIncome" resultMap="tSalaryAccountMap">
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