Commit f020ae71 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.6.3' into MVP1.6.3

parents 6eb9d611 288afaa9
......@@ -599,4 +599,12 @@ public class TSalaryAccount extends BaseEntity {
@ExcelProperty(value = "导入行号")
private Integer rowIndex;
// 额外给前端导出使用的
@TableField(exist = false)
@ExcelProperty("企业(职业)年金")
private String enterpriseAnnuity;
@TableField(exist = false)
@ExcelProperty("个人代扣金额")
private String pdeductionMoney;
}
/*
* 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
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;
// 银行卡号
@ExcelProperty("银行卡号")
private String bankNo;
// 开户行总行
@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;
// 年终奖扣税方案0:合并;1:单独
@ExcelProperty("年终奖扣税方案")
private String annualBonusType;
// 开户行省
@ExcelProperty("开户行省")
private String bankProvince;
// ,开户行市,开户行支行,工资发放方式,工资发放时间,社保缴纳月份,公积金缴纳月份,社保优先级,公积金优先级,是否扣除社保,是否扣除公积金
// 开户行市
@ExcelProperty("开户行市")
private String bankCity;
// 开户行支行
@ExcelProperty("开户行支行")
private String bankSubName;
// 工资发放方式(0现金/1银行)/2线下
@ExcelProperty("工资发放方式")
private String salaryStyle;
// 工资发放时间(0立即发、1暂停发)
@ExcelProperty("工资发放时间")
private String salaryGiveTime;
// 社保缴纳月份
@ExcelProperty("社保缴纳月份")
private String deduSocialMonth;
// 公积金缴纳月份
@ExcelProperty("公积金缴纳月份")
private String deduProvidentMonth;
// 社保优先级0:生成月;1:缴纳月
@ExcelProperty("社保优先级")
private String socialPriority;
// 公积金优先级0:生成月;1:缴纳月
@ExcelProperty("公积金优先级")
private String fundPriority;
// 是否扣除社保 0:否,1:是
@ExcelProperty("是否扣除社保")
private String isDeductSocial;
// 是否扣除公积金 0:否,1:是
@ExcelProperty("是否扣除公积金")
private String isDeductFund;
// ,本月是否重复金额,是否自有员工,是否薪资特殊值,支出结算状态
// 本月是否重复金额0:否;1:是重复导入的
@ExcelProperty("本月是否重复金额")
private String isRepeat;
// 是否自有员工0:否;1:是自有员工
@ExcelProperty("是否自有员工")
private String ownFlag;
// 是否含有特殊金额
@ExcelProperty("是否薪资特殊值")
private String 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;*/
}
......@@ -51,11 +51,6 @@
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-archives-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId>
......@@ -88,6 +83,11 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.monitorjbl</groupId>
<artifactId>xlsx-streamer</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -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;
}
}
......@@ -357,21 +357,21 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
|| (CommonConstants.ONE_STRING.equals(employee.getSalaryGiveTime()) && Common.isNotNull(employee.getBankNo())))) {
if (bankMap.get(employee.getBankNo()) != null) {
if (Boolean.FALSE.equals(bankMap.get(employee.getBankNo()))) {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建失败:【姓名与卡号验证:认证不一致】"));
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() ) + "行:该员工新建失败:【姓名与卡号验证:认证不一致】"));
isFalse = true;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建失败:【姓名与卡号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() ) + "行:该员工新建失败:【姓名与卡号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
isFalse = true;
}
}
if (phoneMap.get(employee.getEmpPhone()) != null) {
if (Boolean.FALSE.equals(phoneMap.get(employee.getEmpPhone()))) {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建失败:【手机号验证:手机号错误】"));
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() ) + "行:该员工新建失败:【手机号验证:手机号错误】"));
isFalse = true;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2) + "行:该员工新建失败:【手机号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() ) + "行:该员工新建失败:【手机号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
isFalse = true;
}
}
......@@ -710,7 +710,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
for (TSalaryEmployee employee : empList) {
employee.setIssueStatus(CommonConstants.ZERO_INT);
if (bankMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankMap.get(employee.getBankNo()))) {
errorList.add(new ErrorMessage((employee.getLineNums() + 2), "第" + (employee.getLineNums() + 2)
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() )
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!"));
return false;
}
......@@ -776,18 +776,18 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
try {
Integer.parseInt(excel.getTaxMonth());
} catch (NumberFormatException e) {
errorMessageList.add(new ErrorMessage((i + 2), "新增员工,计税月份错误"));
errorMessageList.add(new ErrorMessage((i ), "新增员工,计税月份错误"));
continue;
}
emp.setTaxMonth(excel.getTaxMonth());
} else {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.TAX_MONTH_LENGTH));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.TAX_MONTH_LENGTH));
continue;
}
}
if (Common.isNotNull(excel.getBankName())) {
if (bankMap.get(excel.getBankName()) == null) {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.BANK_NAME_ERROR));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.BANK_NAME_ERROR));
continue;
}
emp.setBankName(excel.getBankName());
......@@ -805,12 +805,12 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (Common.isNotNull(areaCity)) {
emp.setBankCity(areaCity);
} else {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.CITY_ERROR));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.CITY_ERROR));
continue;
}
}
} else {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.PROVINCE_ERROR));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.PROVINCE_ERROR));
continue;
}
}
......@@ -833,7 +833,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (Common.isNotNull(excel.getBankNo())) {
checkBankNo = new TCheckBankNo();
emp.setLineNums((i + 2));
emp.setLineNums((i ));
checkBankNo.setName(excel.getEmpName());
checkBankNo.setBankNo(excel.getBankNo());
bankList.add(checkBankNo);
......@@ -841,12 +841,12 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
updateList.add(emp);
if (curTaxMonth) {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.CUR_TAX_INFO));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.CUR_TAX_INFO));
} else {
errorMessageList.add(new ErrorMessage((i + 2), CommonConstants.SAVE_SUCCESS));
errorMessageList.add(new ErrorMessage((i ), CommonConstants.SAVE_SUCCESS));
}
} else {
errorMessageList.add(new ErrorMessage((i + 2), "已存在,不可更新"));
errorMessageList.add(new ErrorMessage((i ), "已存在,不可更新"));
}
} else {
// 新增人员
......@@ -854,27 +854,27 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
|| Common.isEmpty(excel.getEmpPhone()) || Common.isEmpty(excel.getBankName())
|| Common.isEmpty(excel.getBankNo()) || Common.isEmpty(excel.getBankProvince())
|| Common.isEmpty(excel.getBankCity()) || Common.isEmpty(excel.getTaxMonth())) {
errorMessageList.add(new ErrorMessage((i + 2), "新增员工,除了支行,其他必填"));
errorMessageList.add(new ErrorMessage((i ), "新增员工,除了支行,其他必填"));
continue;
} else {
if (excel.getTaxMonth().length() == 6) {
try {
Integer.parseInt(excel.getTaxMonth());
} catch (NumberFormatException e) {
errorMessageList.add(new ErrorMessage((i + 2), "新增员工,计税月份错误"));
errorMessageList.add(new ErrorMessage((i ), "新增员工,计税月份错误"));
continue;
}
} else {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.TAX_MONTH_LENGTH));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.TAX_MONTH_LENGTH));
continue;
}
if (bankMap.get(excel.getBankName()) == null) {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.BANK_NAME_ERROR));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.BANK_NAME_ERROR));
continue;
}
String pre = this.checkNewEmpBankAndPhone(excel, true);
if (pre != null) {
errorMessageList.add(new ErrorMessage((i + 2), pre));
errorMessageList.add(new ErrorMessage((i ), pre));
continue;
} else {
areaProvince = ExcelUtil.getRedisAreaValue(CacheConstants.AREA_VALUE + excel.getBankProvince().trim());
......@@ -885,11 +885,11 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (Common.isNotNull(areaCity)) {
excel.setBankCity(areaCity);
} else {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.CITY_ERROR));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.CITY_ERROR));
continue;
}
} else {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.PROVINCE_ERROR));
errorMessageList.add(new ErrorMessage((i ), SalaryConstants.PROVINCE_ERROR));
continue;
}
excel.setUnitId(dept.getCustomerId());
......@@ -901,13 +901,13 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
excel.setInvoiceTitle(dept.getInvoiceTitleSalary());
if (Common.isNotNull(excel.getBankNo())) {
checkBankNo = new TCheckBankNo();
excel.setLineNums((i + 2));
excel.setLineNums((i ));
checkBankNo.setName(excel.getEmpName());
checkBankNo.setBankNo(excel.getBankNo());
bankList.add(checkBankNo);
}
saveList.add(excel);
errorMessageList.add(new ErrorMessage((i + 2), CommonConstants.SAVE_SUCCESS));
errorMessageList.add(new ErrorMessage((i ), CommonConstants.SAVE_SUCCESS));
}
}
}
......
......@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.monitorjbl.xlsx.StreamingReader;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -38,11 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryUploadParamVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
......@@ -127,9 +124,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
InputStream inputStream = file.getInputStream();
//根据文件格式 对应不同的api解析
if (filename.endsWith(".xlsx")) {
voR = readXlsx(inputStream, specialIdCardList, true, sheetName);
voR = readXlsx(inputStream, specialIdCardList, true, sheetName, -1);
} else {
voR = readXls(inputStream, specialIdCardList, true, sheetName);
voR = readXls(inputStream, specialIdCardList, true, sheetName, -1);
}
if (voR != null && voR.getCode() == CommonConstants.SUCCESS) {
vo = voR.getData();
......@@ -158,7 +155,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/
private R<ExcelSheetVo> readXls(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag
, String sheetName) throws IOException {
, String sheetName, int idCardNum) throws IOException {
HSSFWorkbook sheets = null;
ExcelSheetVo sheetVo = new ExcelSheetVo();
try {
......@@ -182,7 +179,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行
int dataRow;
// 身份证所在列
int idCardColumn = -1;
int idCardColumn = idCardNum;
// 空白列起始号
int nullColumn = -1;
// 上一个空白行
......@@ -190,7 +187,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 空白列数(一旦数量达到 maxNullColumNum,将停止循环列,并删除title list与content)
int nullColumnNum = 0;
// 极限空白列,超过阈值,将不继续循环列
int maxNullColumNum = 10;
int maxNullColumNum = 30;
String idCardValue = null;
// 数据行是否被确认,true否
boolean dataRowFlag;
......@@ -199,6 +196,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 极限空白表头列,超过阈值,将不继续循环列
int maxTitleNullColumNum = 50;
HSSFCell cell;
// 极限空白身份证,超过将不循环行
int maxIdCardNullRow = 50;
int idCardNullNum = 0;
// 循环每个sheet
for (int i = 0; i < sheetNum; i++) {
sheetAt = sheets.getSheetAt(i);
......@@ -211,6 +211,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 初始化每个sheet的数据行
dataRow = 0;
dataRowFlag = true;
idCardNullNum = 0;
// 循环当前sheet的每行内容
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
......@@ -259,19 +260,32 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
//sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage())
//return sheetVo
}
if (Common.isNotNull(cellValue) && dataRowFlag
&& (((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
if (dataRowFlag) {
if (idCardColumn != -1) {
if (idCardColumn == cellNum && Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum;
dataRowFlag = false;
}
} else {
if (Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum;
idCardColumn = cellNum;
dataRowFlag = false;
}
}
}
columnVo.setLineNum(cellNum);
columnVo.setContent(cellValue);
if (Common.isNotNull(cellValue)) {
cellValue = cellValue.trim().replaceAll("\\s+", "");
titleMap.put(String.valueOf(cellNum), cellValue);
}
columnVo.setContent(cellValue);
if (nullFlag) {
contentMap.put(String.valueOf(cellNum), cellValue);
if (dataRowFlag) {
......@@ -342,22 +356,25 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
if (!dataRowFlag) {
if (idCardColumn != -1) {
if (Common.isEmpty(idCardValue)) {
idCardNullNum++;
}
if (Common.isNotNull(idCardValue)) {
contentList.add(contentMap);
}
}
} else {
titleList = new ArrayList<>(columnList);
}
}
if (rowNum >= 50 && dataRowFlag) {
return R.failed("未找到身份证所在的数据行,请检查表数据!");
return R.failed("请检查模板与配置是否一致!未找到身份证所在的数据行,请检查表数据!");
}
if (titleFlag && !dataRowFlag) {
break;
}
// 阻断空白行
if (idCardColumn != -1 && Common.isEmpty(idCardValue)) {
if (!contentList.isEmpty() && contentList.size() > 1) {
contentList.remove(contentList.size() - 1);
}
if (idCardNullNum >= maxIdCardNullRow) {
break;
}
}
......@@ -393,9 +410,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
* @return: com.yifu.cloud.plus.v1.yifu.salary.vo.ExcelVo
**/
private R<ExcelSheetVo> readXlsx(InputStream inputStream, List<String> specialIdCardList, boolean titleFlag
, String sheetName) throws IOException {
XSSFWorkbook sheets = null;
, String sheetName, int idCardNum) throws IOException {
ExcelSheetVo sheetVo = new ExcelSheetVo();
Workbook sheets = null;
try {
List<ExcelColumnVo> titleList;
List<ExcelColumnVo> columnList;
......@@ -406,10 +423,15 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
Map<String, String> contentMap;
// 存储每一列有值的表头
Map<String, String> titleMap = new HashMap<>();
sheets = new XSSFWorkbook(inputStream);
//sheets = new SXSSFWorkbook(inputStream);
sheets = StreamingReader.builder()
.rowCacheSize(1000) // 缓存到内存中的行数(默认是10)
.bufferSize(10240) // 读取资源时,缓存到内存的字节大小(默认是1024)
.open(inputStream);
// sheet
XSSFSheet sheetAt;
XSSFRow row;
//XSSFSheet sheetAt;
//XSSFRow row;
// 获取sheet数量
int sheetNum = sheets.getNumberOfSheets();
// 每个单元格内容
......@@ -417,7 +439,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
// 内容行
int dataRow;
// 身份证所在列
int idCardColumn = -1;
int idCardColumn = idCardNum;
// 空白列起始号
int nullColumn = -1;
// 上一个空白行
......@@ -433,9 +455,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
boolean nullFlag = true;
// 极限空白表头列,超过阈值,将不继续循环列
int maxTitleNullColumNum = 50;
XSSFCell cell;
// 极限空白身份证,超过将不循环行
int maxIdCardNullRow = 50;
int idCardNullNum = 0;
Cell cell;
// 循环每个sheet
Sheet sheetAt;
for (int i = 0; i < sheetNum; i++) {
//sheetAt = sheets.getSheetAt(i);
sheetAt = sheets.getSheetAt(i);
if (Common.isNotNull(sheetAt.getSheetName()) && Common.isNotNull(sheetName)
&& sheetName.equals(sheetAt.getSheetName())) {
......@@ -447,7 +474,12 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
dataRow = 0;
dataRowFlag = true;
// 循环当前sheet的每行内容
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
//for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) {
idCardNullNum = 0;
int rowNum = 0;
for (Row row : sheetAt) {
nullColumn = -1;
preNullColumn = -1;
......@@ -457,7 +489,6 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
idCardValue = null;
contentMap = new HashMap<>();
columnList = new ArrayList<>();
row = sheetAt.getRow(rowNum);
if (row != null) {
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
columnVo = new ExcelColumnVo();
......@@ -467,8 +498,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
cellValue = "";
} else {
if (cell.getCellType() == CellType.FORMULA) {
cell.setCellType(CellType.STRING);
cellValue = cell.getStringCellValue();
cellValue = String.valueOf(cell.getStringCellValue());
} else if (CellType.STRING == cell.getCellType()) {
cellValue = row.getCell(cellNum).getStringCellValue();
} else if (CellType.NUMERIC == cell.getCellType()) {
......@@ -494,19 +524,32 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
//sheetVo.setErrorInfo("请注意单元格格式,第" + (i + 1) + "个sheet,第" + (rowNum + 1) + "行第" + (cellNum + 1) + "列。" + e.getMessage())
//return sheetVo
}
if (Common.isNotNull(cellValue) && dataRowFlag
&& (((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
if (dataRowFlag) {
if (idCardColumn != -1) {
if (idCardColumn == cellNum && Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum;
dataRowFlag = false;
}
} else {
if (Common.isNotNull(cellValue) &&
(((cellValue.length() == 15 || cellValue.length() == 18) && regIdCard(cellValue))
// 特殊身份证允许识别
|| regSpecialIdCard(cellValue, specialIdCardList))) {
dataRow = rowNum;
idCardColumn = cellNum;
dataRowFlag = false;
}
}
}
columnVo.setLineNum(cellNum);
columnVo.setContent(cellValue);
if (Common.isNotNull(cellValue)) {
cellValue = cellValue.trim().replaceAll("\\s+", "");
titleMap.put(String.valueOf(cellNum), cellValue);
}
columnVo.setContent(cellValue);
if (nullFlag) {
contentMap.put(String.valueOf(cellNum), cellValue);
if (dataRowFlag) {
......@@ -577,7 +620,14 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
if (!dataRowFlag) {
if (idCardColumn != -1) {
if (Common.isEmpty(idCardValue)) {
idCardNullNum++;
}
if (Common.isNotNull(idCardValue)) {
contentList.add(contentMap);
}
}
} else {
titleList = new ArrayList<>(columnList);
}
......@@ -585,14 +635,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
if (rowNum >= 50 && dataRowFlag) {
return R.failed("未找到身份证所在的数据行,请检查表数据!");
}
rowNum++;
if (titleFlag && !dataRowFlag) {
break;
}
// 阻断空白行
if (idCardColumn != -1 && Common.isEmpty(idCardValue)) {
if (!contentList.isEmpty() && contentList.size() > 1) {
contentList.remove(contentList.size() - 1);
}
if (idCardNullNum >= maxIdCardNullRow) {
break;
}
}
......@@ -605,7 +652,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
return R.ok(sheetVo);
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
if (sheets != null) {
sheets.close();
......@@ -688,6 +735,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginalDetailService.getTSalaryStandardOriginalDetailByOrgId(originalId);
Map<String, TSalaryStandardOriginalDetail> detailMap = new HashMap<>();
int idCardNum = -1;
for (TSalaryStandardOriginalDetail detail : detailList) {
if (Common.isEmpty(detail.getModelName())
&& ("是否新员工(默认否)".equals(detail.getExcelName())
......@@ -699,6 +747,8 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
|| "手机号码".equals(detail.getExcelName())
|| "计税月份".equals(detail.getExcelName()))) {
detail.setModelName(detail.getExcelName());
} else if (SalaryConstants.ID_NUMBER.equals(detail.getModelName())) {
idCardNum = detail.getColumnNo();
}
detailMap.put(String.valueOf(detail.getColumnNo()), detail);
}
......@@ -724,9 +774,9 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
ExcelSheetVo vo;
//根据文件格式 对应不同的api解析
if (filename.endsWith(".xlsx")) {
voR = readXlsx(inputStream, specialIdCardList, false, sheetName);
voR = readXlsx(inputStream, specialIdCardList, false, sheetName, idCardNum);
} else {
voR = readXls(inputStream, specialIdCardList, false, sheetName);
voR = readXls(inputStream, specialIdCardList, false, sheetName, idCardNum);
}
if (voR != null && voR.getCode() == CommonConstants.SUCCESS) {
vo = voR.getData();
......@@ -774,11 +824,11 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
|| !"计税月份".equals(title.getContent()))
) {
return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!");
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为【" + title.getContent() + "】");
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为【" + title.getContent() + "】")
}
} else if (detailMap.get(String.valueOf(title.getLineNum())) != null && Common.isNotNull(detailMap.get(String.valueOf(title.getLineNum())).getExcelName())) {
return R.failed("未找到对应配置的表头,请核实导入的原表信息后,重新尝试!!!");
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!");
//return R.failed("表头与导入的不一致,第" + (i + 1) + "列应为【" + detailMap.get(String.valueOf(title.getLineNum())).getExcelName() + "】,实际为空!")
}
}
} else {
......@@ -803,12 +853,13 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
detail = detailMap.get(column.getKey());
if (detail != null && Common.isNotNull(detail.getModelName())) {
value = column.getValue();
if (Common.isNotNull(value)) {
try {
if ("REDUCE".equals(detail.getFlag())) {
value = String.valueOf(new BigDecimal(value).negate());
}
oldValue = newRowMap.get(detail.getModelName());
if (oldValue != null) {
if (Common.isNotNull(oldValue)) {
value = String.valueOf(new BigDecimal(oldValue).add(new BigDecimal(value))
.setScale(SalaryConstants.PLACES, BigDecimal.ROUND_HALF_UP));
}
......@@ -824,6 +875,7 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
}
}
}
}
if (Common.isEmpty(check.getIdCard())) {
return R.failed("数据行第 " + i + " 行,无身份证号!");
}
......
......@@ -102,6 +102,87 @@
<result property="isDiff" column="IS_DIFF"/>
</resultMap>
<resultMap id="tSalaryAccountWebExportMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
<id property="id" column="ID"/>
<result property="invoiceTitle" column="INVOICE_TITLE"/>
<result property="salaryFormId" column="SALARY_FORM_ID"/>
<result property="salaryMonth" column="SALARY_MONTH"/>
<result property="empId" column="EMP_ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="bankNo" column="BANK_NO"/>
<result property="bankName" column="BANK_NAME"/>
<result property="deptId" column="DEPT_ID"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="unitId" column="UNIT_ID"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="unitNo" column="UNIT_NO"/>
<result property="salaryStyle" column="SALARY_STYLE"/>
<result property="salaryGiveTime" column="SALARY_GIVE_TIME"/>
<result property="distributionFlag" column="DISTRIBUTION_FLAG"/>
<result property="deduSocialMonth" column="DEDU_SOCIAL_MONTH"/>
<result property="deduProvidentMonth" column="DEDU_PROVIDENT_MONTH"/>
<result property="formType" column="FORM_TYPE"/>
<result property="settlementMonth" column="SETTLEMENT_MONTH"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
<result property="socialPriority" column="SOCIAL_PRIORITY"/>
<result property="fundPriority" column="FUND_PRIORITY"/>
<result property="annualBonusType" column="ANNUAL_BONUS_TYPE"/>
<result property="taxMonth" column="TAX_MONTH"/>
<result property="isDeductSocial" column="IS_DEDUCT_SOCIAL"/>
<result property="isDeductFund" column="IS_DEDUCT_FUND"/>
<result property="province" column="PROVINCE"/>
<result property="city" column="CITY"/>
<result property="town" column="TOWN"/>
<result property="empPhone" column="EMP_PHONE"/>
<result property="ownFlag" column="OWN_FLAG"/>
<result property="isRepeat" column="IS_REPEAT"/>
<result property="bankSubName" column="BANK_SUB_NAME"/>
<result property="bankProvince" column="BANK_PROVINCE"/>
<result property="bankCity" column="BANK_CITY"/>
<result property="isPersonTax" column="IS_PERSON_TAX"/>
<result property="relaySalary" column="RELAY_SALARY"/>
<result property="actualSalary" column="ACTUAL_SALARY"/>
<result property="salaryTax" column="SALARY_TAX"/>
<result property="relaySalaryUnit" column="RELAY_SALARY_UNIT"/>
<result property="salaryTaxUnit" column="SALARY_TAX_UNIT"/>
<result property="haveSalaryFlag" column="HAVE_SALARY_FLAG"/>
<result property="haveSpecialFlag" column="HAVE_SPECIAL_FLAG"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="sendStatus" column="SEND_STATUS"/>
<result property="sendTime" column="SEND_TIME"/>
<result property="sendUser" column="SEND_USER"/>
<result property="sendUserName" column="SEND_USER_NAME"/>
<result property="sendMonth" column="SEND_MONTH"/>
<result property="orderId" column="ORDER_ID"/>
<result property="unitSocial" column="UNIT_SOCIAL"/>
<result property="personSocial" column="PERSON_SOCIAL"/>
<result property="unitFund" column="UNIT_FUND"/>
<result property="personFund" column="PERSON_FUND"/>
<result property="costReduction" column="COST_REDUCTION"/>
<result property="annualBonusTax" column="ANNUAL_BONUS_TAX"/>
<result property="sumChildEduMoney" column="SUM_CHILD_EDU_MONEY"/>
<result property="sumHousingLoanMoney" column="SUM_HOUSING_LOAN_MONEY"/>
<result property="sumHousingRentMoney" column="SUM_HOUSING_RENT_MONEY"/>
<result property="sumSupportElderlyMoney" column="SUM_SUPPORT_ELDERLY_MONEY"/>
<result property="sumContinuingEducationMoney" column="SUM_CONTINUING_EDUCATION_MONEY"/>
<result property="sumBabyMoney" column="SUM_BABY_MONEY"/>
<result property="sumPrivatePension" column="SUM_PRIVATE_PENSION"/>
<result property="incomeSettleFlag" column="INCOME_SETTLE_FLAG"/>
<result property="incomeCollectFlag" column="INCOME_COLLECT_FLAG"/>
<result property="paySettleFlag" column="PAY_SETTLE_FLAG"/>
<result property="payCollectFlag" column="PAY_COLLECT_FLAG"/>
<result property="isDiff" column="IS_DIFF"/>
<result property="enterpriseAnnuity" column="ENTERPRISE_ANNUITY"/>
<result property="pdeductionMoney" column="PDEDUCTION_MONEY"/>
</resultMap>
<!-- B端薪酬第一个统计列表 -->
<resultMap id="settlementFormVoMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.SettlementFormVo">
<result property="salaryMonth" column="SALARY_MONTH"/>
......@@ -871,18 +952,84 @@
</select>
<select id="getAccountListBySalaryId" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
<select id="getAccountListBySalaryId" resultMap="tSalaryAccountWebExportMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
SELECT
<include refid="Base_Column_List"/>
,enterpriseAnnuity.SALARY_MONEY as ENTERPRISE_ANNUITY
,sum(ifnull(pdeduction.SALARY_MONEY,0)) PDEDUCTION_MONEY
FROM
<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
t_salary_account a
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'
</if>
<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
left join t_salary_account_item_hro_2021 enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
left join t_salary_account_item_hro_2021 pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'
</if>
where a.SALARY_FORM_ID = #{searchVo.salaryFormId}
ORDER BY a.ROW_INDEX ASC
GROUP BY a.id ORDER BY a.ROW_INDEX ASC
</select>
<!-- 导出报账专用hgw -->
<select id="getAccountListByApplyNo" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportByEkpVo">
select
a.EMP_PHONE as empPhone,
a.TAX_MONTH as taxMonth,
a.SETTLEMENT_MONTH as settlementMonth,
a.SALARY_MONTH as salaryMonth,
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,
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,
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
,a.BANK_NO as bankNo
,a.BANK_NAME as bankName
,if(a.ANNUAL_BONUS_TYPE='1','单独','合并') as annualBonusType
,ap.AREA_NAME as bankProvince
,ac.AREA_NAME as bankCity
,a.BANK_SUB_NAME as bankSubName
,if(a.SALARY_STYLE='0','现金','银行') as salaryStyle
,if(a.SALARY_GIVE_TIME='1','暂停发','立即发') as salaryGiveTime
,a.DEDU_SOCIAL_MONTH as deduSocialMonth
,a.DEDU_PROVIDENT_MONTH as deduProvidentMonth
,if(a.SOCIAL_PRIORITY='1','缴纳月','生成月') as socialPriority
,if(a.FUND_PRIORITY='1','缴纳月','生成月') as fundPriority
,if(a.IS_DEDUCT_SOCIAL='0','否','是') as isDeductSocial
,if(a.IS_DEDUCT_FUND='0','否','是') as isDeductFund
,if(a.IS_REPEAT='0','否','是') as isRepeat
,if(a.OWN_FLAG='0','否','是') as ownFlag
,if(a.HAVE_SPECIAL_FLAG='0','否','是') haveSpecialFlag
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 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 sys_area ap on ap.id=a.BANK_PROVINCE
left join sys_area ac on ac.id=a.BANK_CITY
where s.APPLY_NO = #{applyNo} and a.DELETE_FLAG = 0
GROUP BY a.id ORDER BY a.ROW_INDEX ASC
</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