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

This commit is contained in:
18895359881@163.com 2022-04-19 20:59:33 +08:00
commit 4fd63c1999
47 changed files with 2313 additions and 561 deletions

15
.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
/weaver-hrm-salary.iml
/out/
/.idea/
HELP.md
target/
### IntelliJ IDEA ###
.idea
/src/test
/src/META-INF
/log

View File

@ -45,6 +45,12 @@ alter table hrsa_bill_detail_temp modify id bigint auto_increment;
alter table hrsa_bill_inspect modify id bigint auto_increment;
ALTER TABLE hrsa_salary_item
ADD COLUMN data_type varchar(20) NOT NULL COMMENT '字段类型。string字符、number数字' AFTER tenant_key;
ALTER TABLE hrsa_sys_salary_item
ADD COLUMN data_type varchar(20) NOT NULL COMMENT '字段类型。string字符、number数字' AFTER tenant_key;
ALTER TABLE hrsa_salary_sob_default_item
ADD COLUMN sob_default_item_group_id bigint(0) NOT NULL COMMENT '薪资账套默认薪资项目分类的id' AFTER tenant_key,

View File

@ -35,5 +35,27 @@ CREATE TABLE hrsa_formula_var
);
ALTER TABLE hrsa_salary_sob_default_item ADD sob_default_item_group_id bigint NOT NULL ;
ALTER TABLE hrsa_salary_sob_default_item ADD sorted_index int NOT NULL ;
ALTER TABLE hrsa_salary_sob_default_item
ADD sob_default_item_group_id bigint NOT NULL;
ALTER TABLE hrsa_salary_sob_default_item
ADD sorted_index int NOT NULL;
ALTER TABLE hrsa_salary_item
ADD data_type varchar(20) NOT NULL;
CREATE TABLE hrsa_salary_sob_item
(
id bigint(20) identity (1,1) PRIMARY KEY,
salary_sob_id bigint(20) NOT NULL,
salary_item_id bigint(20) NOT NULL,
salary_sob_item_group_id bigint(20) NOT NULL,
formula_id bigint(20) NOT NULL,
sorted_index int(11) NOT NULL,
description varchar(1000) NOT NULL DEFAULT '',
create_time datetime NOT NULL,
update_time datetime NOT NULL,
creator bigint(20) NOT NULL,
delete_type int(11) NOT NULL,
tenant_key varchar(10) NOT NULL
);

View File

@ -6,6 +6,8 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
import com.engine.salary.entity.salaryarchive.po.TaxAgentPO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
@ -14,9 +16,11 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.siaccount.*;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
@ -1303,7 +1307,170 @@ public class SIAccountBiz {
}
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
PageUtil.start(queryParam.getCurrent(),queryParam.getPageSize());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = buildRecords(insuranceAccountDetailPOS, paymentMap);
// List<ICategoryPO> iCategoryPOS = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll();
// Page<InsuranceCategoryPO> page = FormatManager.getTablePage();
// Page<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new Page<>(page.getCurrent(), insuranceAccountViewListDTOS.size(), insuranceAccountViewListDTOS.size(),
// page.isSearchCount());
PageInfo<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS,InsuranceAccountViewListDTO.class);
insuranceAccountViewListDTOPage.setTotal(insuranceAccountViewListDTOS.size());
return insuranceAccountViewListDTOPage;
}
public List<InsuranceAccountViewListDTO> buildRecords(List<InsuranceAccountDetailPO> list, Map<Long, TaxAgent> paymentMap) {
Map<Long, InsuranceAccountViewListDTO> result = new HashMap<>();
//根据组织分组,对社保进行统计
Map<Long, List<InsuranceAccountDetailPO>> socialCollect = list.stream().filter(item -> item.getSocialPayOrg() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getSocialPayOrg));
socialCollect.forEach((k, v) -> {
if (result.get(k) == null) {
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
temp.setPayOrg(paymentMap.get(k).getName());
result.put(k, temp);
}
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
accountSocialView(insuranceAccountViewListDTO, v);
});
//根据组织分组对公积金进行统计
Map<Long, List<InsuranceAccountDetailPO>> fundCollect = list.stream().filter(item -> item.getFundPayOrg() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getFundPayOrg));
fundCollect.forEach((k, v) -> {
if (result.get(k) == null) {
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
temp.setPayOrg(paymentMap.get(k).getName());
result.put(k, temp);
}
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
accountFundView(insuranceAccountViewListDTO, v);
});
//根据组织分组,对其他福利进行统计
Map<Long, List<InsuranceAccountDetailPO>> otherCollect = list.stream().filter(item -> item.getOtherPayOrg() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getOtherPayOrg));
otherCollect.forEach((k, v) -> {
if (result.get(k) == null) {
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
temp.setPayOrg(paymentMap.get(k).getName());
result.put(k, temp);
}
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
accountOtherView(insuranceAccountViewListDTO, v);
});
//对各组织进行金额合计
List<InsuranceAccountViewListDTO> viewDTOS = new ArrayList<>();
result.forEach((k, v) -> {
BigDecimal socialPaySum = StringUtils.isBlank(v.getSocialPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getSocialPaySum());
BigDecimal fundPaySum = StringUtils.isBlank(v.getFundPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getFundPaySum());
BigDecimal otherPaySum = StringUtils.isBlank(v.getOtherPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getOtherPaySum());
v.setIndex(k);
BigDecimal sum = socialPaySum.add(fundPaySum).add(otherPaySum);
v.setSum(sum.toPlainString());
viewDTOS.add(v);
});
//合计
InsuranceAccountViewListDTO insuranceAccountViewListDTO = new InsuranceAccountViewListDTO();
int socialNum = 0;
int fundNum = 0;
int otherNum = 0;
BigDecimal socialSum = new BigDecimal("0");
BigDecimal fundSum = new BigDecimal("0");
BigDecimal otherSum = new BigDecimal("0");
BigDecimal sum = new BigDecimal("0");
for (InsuranceAccountViewListDTO item : viewDTOS) {
if (item.getSocialNum() != null) {
socialNum += item.getSocialNum();
}
if (item.getFundNum() != null) {
fundNum += item.getFundNum();
}
if (item.getOtherNum() != null) {
otherNum += item.getOtherNum();
}
if (StringUtils.isNotBlank(item.getSocialPaySum())) {
socialSum = socialSum.add(new BigDecimal(item.getSocialPaySum()));
}
if (StringUtils.isNotBlank(item.getFundPaySum())) {
fundSum = fundSum.add(new BigDecimal(item.getFundPaySum()));
}
if (StringUtils.isNotBlank(item.getOtherPaySum())) {
otherSum = otherSum.add(new BigDecimal(item.getOtherPaySum()));
}
if (StringUtils.isNotBlank(item.getSum())) {
sum = sum.add(new BigDecimal(item.getSum()));
}
}
insuranceAccountViewListDTO.setSum(sum.toPlainString());
insuranceAccountViewListDTO.setSocialPaySum(socialSum.toPlainString());
insuranceAccountViewListDTO.setPayOrg(SalaryI18nUtil.getI18nLabel(93278, "合计"));
insuranceAccountViewListDTO.setFundPaySum(fundSum.toPlainString());
insuranceAccountViewListDTO.setOtherPaySum(otherSum.toPlainString());
insuranceAccountViewListDTO.setSocialNum(socialNum);
insuranceAccountViewListDTO.setFundNum(fundNum);
insuranceAccountViewListDTO.setOtherNum(otherNum);
viewDTOS.add(insuranceAccountViewListDTO);
viewDTOS.forEach(e -> {
e.setSocialPaySum(StringUtils.isBlank(e.getSocialPaySum()) ? "0" : e.getSocialPaySum());
e.setSocialNum(e.getSocialNum() == null ? 0 : e.getSocialNum());
e.setFundNum(e.getFundNum() == null ? 0 : e.getFundNum());
e.setFundPaySum(StringUtils.isBlank(e.getFundPaySum()) ? "0" : e.getFundPaySum());
e.setOtherPaySum(StringUtils.isBlank(e.getOtherPaySum()) ? "0" : e.getOtherPaySum());
e.setOtherNum(e.getOtherNum() == null ? 0 : e.getOtherNum());
e.setSum(SalaryEntityUtil.thousandthConvert(e.getSum()));
e.setSocialPaySum(SalaryEntityUtil.thousandthConvert(e.getSocialPaySum()));
e.setOtherPaySum(SalaryEntityUtil.thousandthConvert(e.getOtherPaySum()));
e.setFundPaySum(SalaryEntityUtil.thousandthConvert(e.getFundPaySum()));
});
return viewDTOS;
}
public void accountOtherView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
int otherNum = 0;
BigDecimal otherPaySum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : pos) {
if (StringUtils.isNotBlank(item.getOtherSum())) {
otherNum += 1;
otherPaySum = otherPaySum.add(new BigDecimal(item.getOtherSum()));
}
}
dto.setOtherNum(otherNum);
dto.setOtherPaySum(otherPaySum.toPlainString());
}
public void accountFundView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
int fundNum = 0;
BigDecimal fundPaySum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : pos) {
if (StringUtils.isNotBlank(item.getFundSum())) {
fundNum += 1;
fundPaySum = fundPaySum.add(new BigDecimal(item.getFundSum()));
}
}
dto.setFundNum(fundNum);
dto.setFundPaySum(fundPaySum.toPlainString());
}
public void accountSocialView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
int socialNum = 0;
BigDecimal socialPaySum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : pos) {
if (StringUtils.isNotBlank(item.getSocialSum())) {
socialNum += 1;
socialPaySum = socialPaySum.add(new BigDecimal(item.getSocialSum()));
}
}
dto.setSocialNum(socialNum);
dto.setSocialPaySum(socialPaySum.toPlainString());
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryacct.bo;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
@ -20,6 +21,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
@ -370,13 +372,13 @@ public class SalaryAcctResultBO {
public static Map<String, String> buildEmployeeFieldName() {
Field[] declaredFields = SalaryFormulaEmployeeDTO.class.getDeclaredFields();
Map<String, String> employeeFieldNameMap = Maps.newHashMapWithExpectedSize(declaredFields.length);
// for (Field declaredField : declaredFields) {
// if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class)) {
// continue;
// }
// SalaryFormulaVar annotation = declaredField.getAnnotation(SalaryFormulaVar.class);
// employeeFieldNameMap.put(declaredField.getName(), SystemEnv.getHtmlLabelName(annotation.labelId(), annotation.defaultLabel()));
// }
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class)) {
continue;
}
SalaryFormulaVar annotation = declaredField.getAnnotation(SalaryFormulaVar.class);
employeeFieldNameMap.put(declaredField.getName(), SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel()));
}
return employeeFieldNameMap;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryacct.dto;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -19,79 +20,52 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class SalaryAccEmployeeListDTO {
//主键id")
//主键id
private Long id;
//人员id")
//人员id
private Long employeeId;
// @SalaryTableColumn(
// label = "姓名",
// labelId = 85429,
// width = "10%"
// )
//姓名")
//姓名
@TableTitle(title = "姓名", dataIndex = "employeeName", key = "employeeName")
private String employeeName;
//个税扣缴义务人id")
private Long taxAgentId;
// @SalaryTableColumn(
// label = "个税扣缴义务人",
// labelId = 86184,
// width = "20%"
// )
//个税扣缴义务人")
//个税扣缴义务人
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
private String taxAgentName;
//部门id")
private Long departmentId;
// @SalaryTableColumn(
// label = "部门",
// labelId = 86185,
// width = "20%"
// )
//部门")
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
private String departmentName;
// @SalaryTableColumn(
// label = "手机号",
// labelId = 86186,
// width = "10%"
// )
//手机号")
//手机号
@TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile")
private String mobile;
// @SalaryTableColumn(
// label = "工号",
// labelId = 86317,
// width = "10%"
// )
//工号")
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
private String jobNum;
// @SalaryTableColumn(
// label = "员工状态",
// labelId = 86187,
// width = "10%"
// )
//员工状态")
@TableTitle(title = "员工状态", dataIndex = "status", key = "status")
private String status;
// @SalaryTableColumn(
// label = "入职日期",
// labelId = 86319,
// width = "10%"
// )
//入职日期")
@TableTitle(title = "入职日期", dataIndex = "hireDate", key = "hireDate")
private String hireDate;
// @SalaryTableColumn(
// label = "离职日期",
// labelId = 95228,
// width = "10%"
// )
// //离职日期")
//离职日期
@TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate")
private String dismissDate;
}

View File

@ -66,6 +66,6 @@ public class SalaryAcctRecordListDTO {
@TableTitle(title = "备注", dataIndex = "description", key = "description")
private String description;
@TableTitle(title = "操作", dataIndex = "description", key = "description")
@TableTitle(title = "操作", dataIndex = "operate", key = "operate")
private List<WeaTableOperate> operate;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryAcctImportParam {
//上传文件id
@DataCheck(require = true,message = "imageId为空")
String imageId;
//薪资核算记录的id
@DataCheck(require = true,message = "薪资核算记录id为空")
Long salaryAcctRecordId;
}

View File

@ -1,6 +1,10 @@
package com.engine.salary.entity.siaccount.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -16,32 +20,34 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "b3afad76-a971-4fe3-8064-0cabdcb10b18", tableType = WeaTableType.NONE,operates = {
})
public class InsuranceAccountViewListDTO {
//"序号")
@TableTitle(title = "序号", dataIndex = "index", key = "index")
private Long index;
//缴纳组织")
@TableTitle(title = "缴纳组织", dataIndex = "payOrg", key = "payOrg")
private String payOrg;
//社保人数")
@TableTitle(title = "社保人数", dataIndex = "socialNum", key = "socialNum")
private Integer socialNum;
//公积金人数")
@TableTitle(title = "公积金人数", dataIndex = "fundNum", key = "fundNum")
private Integer fundNum;
//其他福利人数")
@TableTitle(title = "其他福利人数", dataIndex = "otherNum", key = "otherNum")
private Integer otherNum;
//社保缴费合计")
@TableTitle(title = "社保缴费合计", dataIndex = "socialPaySum", key = "socialPaySum")
private String socialPaySum;
//公积金缴费合计")
@TableTitle(title = "公积金缴费合计", dataIndex = "fundPaySum", key = "fundPaySum")
private String fundPaySum;
//其他福利缴费合计")
@TableTitle(title = "其他福利缴费合计", dataIndex = "otherPaySum", key = "otherPaySum")
private String otherPaySum;
//合计")
@TableTitle(title = "合计", dataIndex = "sum", key = "sum")
private String sum;
}

View File

@ -22,8 +22,7 @@ import java.util.Date;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "021c4a65-c401-4bcc-a720-6233996e17f1", tableType = WeaTableType.CHECKBOX,operates = {
})
@SalaryTable(pageId = "2394fba1-1381-428a-8532-4e1e6b86626e", tableType = WeaTableType.CHECKBOX)
public class InsuranceAccountDetailPO {
/**

View File

@ -0,0 +1,25 @@
package com.engine.salary.entity.siexport.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description: TODO 导出
* @Date 2022/3/7
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceExportParam {
//@NotBlank
@DataCheck(require = true,message = "账单月份不可为空")
private String billMonth;
}

View File

@ -0,0 +1,53 @@
package com.engine.salary.entity.siexport.po;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.enums.UserStatusEnum;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/3/7
* @Version V1.0
**/
public class AccountExportPO extends InsuranceAccountDetailPO {
private String userName;
private String telephone;
private String departmentName;
private UserStatusEnum userStatus;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public UserStatusEnum getUserStatus() {
return userStatus;
}
public void setUserStatus(UserStatusEnum userStatus) {
this.userStatus = userStatus;
}
}

View File

@ -0,0 +1,18 @@
package com.engine.salary.mapper;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public interface InsuranceExportMapper {
List<AccountExportPO> exportAccount(@Param("paymentStatus") Integer paymentStatus, @Param("billMonth") String billMonth);
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.engine.salary.mapper.InsuranceExportMapper">
<select id="exportAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO">
SELECT
a.*,e.username AS userName,e.MOBILE AS telephone,d.`NAME` AS departmentName,e.`STATUS` AS userStatus
FROM(
SELECT * from hrsa_bill_detail
WHERE delete_type = 0 AND bill_month = #{billMonth} AND payment_status = #{paymentStatus}
)a
LEFT JOIN {$publicdb}.employee e ON e.ID = a.employee_id
LEFT JOIN {$publicdb}.department d ON d.id = e.department
</select>
<select id="exportAccount" resultType="com.weaver.hrm.salary.entity.siexport.po.AccountExportPO" databaseId="oracle">
SELECT
a.*,e.username AS userName,e.MOBILE AS telephone,d.NAME AS departmentName,e.STATUS AS userStatus
FROM(
SELECT * from hrsa_bill_detail
WHERE delete_type = 0 AND bill_month = #{billMonth} AND payment_status = #{paymentStatus}
)a
LEFT JOIN {$publicdb}.employee e ON e.ID = a.employee_id
LEFT JOIN {$publicdb}.department d ON d.id = e.department
</select>
<select id="exportAccount" resultType="com.weaver.hrm.salary.entity.siexport.po.AccountExportPO" databaseId="sqlserver">
SELECT
a.*,e.username AS userName,e.MOBILE AS telephone,d.NAME AS departmentName,e.STATUS AS userStatus
FROM(
SELECT * from hrsa_bill_detail
WHERE delete_type = 0 AND bill_month = #{billMonth} AND payment_status = #{paymentStatus}
)a
LEFT JOIN {$publicdb}.employee e ON e.ID = a.employee_id
LEFT JOIN {$publicdb}.department d ON d.id = e.department
</select>
</mapper>

View File

@ -5,7 +5,7 @@
<select id="listEmployee" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.ID as employeeId,
e.LASTNAME as username,
d.DEPARTMENTNAME as deparmentName
d.DEPARTMENTNAME as departmentName
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
where e.status not in (7)

View File

@ -192,6 +192,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="dataType != null">
data_type,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -248,6 +251,9 @@
<if test="updateTime != null">
#{updateTime},
</if>
<if test="dataType != null">
#{dataType},
</if>
</trim>
</insert>

View File

@ -94,7 +94,7 @@
, t.tenant_key
</sql>
<sql id="paramSql">
<sql id="paramSqlCommon" >
<if test="param.billMonth != null and param.billMonth != ''">
AND
t.bill_month = #{param.billMonth}
@ -103,13 +103,33 @@
AND
t.payment_status = #{param.paymentStatus}
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</sql>
<sql id="paramSql">
<if test="param.userName != null and param.userName != ''">
AND
(
e.lastname like CONCAT('%',#{param.userName},'%')
)
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.userName != null and param.userName != ''">
AND
(
e.lastname like '%'||#{param.userName}||'%'
)
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.userName != null and param.userName != ''">
AND
(
e.lastname like '%'+#{param.userName}+'%'
)
</if>
</sql>
<select id="list" resultMap="BaseResultMap">
@ -117,14 +137,18 @@
<include refid="baseColumns"/>
FROM
hrsa_bill_detail t
left join hrmresource e
on e.ID = t.employee_id
WHERE t.delete_type = 0
<include refid="paramSqlCommon"/>
<include refid="paramSql"/>
ORDER BY t.update_time DESC
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT
t.employee_id,t.social_sum,t.fund_sum,t.other_sum
t.employee_id,t.social_sum,t.fund_sum,t.other_sum,t.fund_pay_org,t.social_pay_org,
t.other_pay_org
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
@ -414,28 +438,28 @@
FROM
(
SELECT
e.username AS userName,
e.JOB_NUM AS jobNum,
e.DEPARTMENT AS departmentId,
d.`NAME` AS departmentName,
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.POSITION AS position,
e.jobtitle AS position,
h.payment_status AS paymentStatus,
e.HIREDATE AS hiredate,
l.DIMISSION_TIME AS dimissionDate,
e.companystartdate AS hiredate,
l.dismissdate AS dimissionDate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
hrsa_bill_detail h
LEFT JOIN {$publicdb}.employee e ON e.ID = h.employee_id AND h.delete_type = 0
LEFT JOIN {$publicdb}.dimission_log l ON e.ID = l.DIMISSION_ID
LEFT JOIN {$publicdb}.department d ON d.ID = e.DEPARTMENT
LEFT JOIN hrmresource e ON e.ID = h.employee_id AND h.delete_type = 0
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
WHERE
e.`STATUS` = 'unavailable' AND h.payment_status = 0
e.`STATUS` = 5 AND h.payment_status = 0
<if test="userName != null and userName != ''">
AND e.username like CONCAT('%',#{userName},'%')
AND e.lastname like CONCAT('%',#{userName},'%')
</if>
AND(l.DIMISSION_TIME IS NOT NULL)
AND(l.dismissdate IS NOT NULL)
)AS t
LEFT JOIN hrsa_social_archives social ON t.employeeId = social.employee_id AND social.delete_type = 0
LEFT JOIN hrsa_fund_archives fund ON t.employeeId = fund.employee_id AND fund.delete_type = 0
@ -493,27 +517,27 @@
FROM
(
SELECT
e.username AS userName,
e.JOB_NUM AS jobNum,
e.DEPARTMENT AS departmentId,
d.`NAME` AS departmentName,
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.POSITION AS position,
e.HIREDATE AS hiredate,
l.DIMISSION_TIME AS dimissionDate,
e.jobtitle AS position,
e.companystartdate AS hiredate,
l.dismissdate AS dimissionDate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
{$publicdb}.employee e
LEFT JOIN {$publicdb}.dimission_log l ON e.ID = l.DIMISSION_ID
LEFT JOIN {$publicdb}.department d ON d.ID = e.DEPARTMENT
hrmresource e
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
WHERE
e.`STATUS` = 'normal'
e.`STATUS` not in (4,5,6,7)
<if test="userName != null and userName != ''">
AND e.username like CONCAT('%',#{userName},'%')
AND e.lastname like CONCAT('%',#{userName},'%')
</if>
AND(
l.DIMISSION_TIME IS NULL OR l.DIMISSION_TIME = ''
l.dismissdate IS NULL OR l.dismissdate = ''
)
)AS t
LEFT JOIN hrsa_social_archives social ON t.employeeId = social.employee_id AND social.delete_type = 0
@ -583,28 +607,28 @@
FROM
(
SELECT
e.username AS userName,
e.JOB_NUM AS jobNum,
e.DEPARTMENT AS departmentId,
d.NAME AS departmentName,
e.STATUS AS userStatus,
e.POSITION AS position,
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.jobtitle AS position,
h.payment_status AS paymentStatus,
e.HIREDATE AS hiredate,
l.DIMISSION_TIME AS dimissionDate,
e.companystartdate AS hiredate,
l.dismissdate AS dimissionDate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
hrsa_bill_detail h
LEFT JOIN {$publicdb}.employee e ON e.ID = h.employee_id AND h.delete_type = 0
LEFT JOIN {$publicdb}.dimission_log l ON e.ID = l.DIMISSION_ID
LEFT JOIN {$publicdb}.department d ON d.ID = e.DEPARTMENT
LEFT JOIN hrmresource e ON e.ID = h.employee_id AND h.delete_type = 0
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
WHERE
e.STATUS = 'unavailable' AND h.payment_status = 0
e.STATUS = 5 AND h.payment_status = 0
<if test="userName != null and userName != ''">
AND e.username like '%'||#{userName}||'%'
AND e.lastname like '%'||#{userName}||'%'
</if>
AND(l.DIMISSION_TIME IS NOT NULL)
AND(l.dismissdate IS NOT NULL)
)AS t
LEFT JOIN hrsa_social_archives social ON t.employeeId = social.employee_id AND social.delete_type = 0
LEFT JOIN hrsa_fund_archives fund ON t.employeeId = fund.employee_id AND fund.delete_type = 0
@ -662,27 +686,27 @@
FROM
(
SELECT
e.username AS userName,
e.JOB_NUM AS jobNum,
e.DEPARTMENT AS departmentId,
d.NAME AS departmentName,
e.STATUS AS userStatus,
e.POSITION AS position,
e.HIREDATE AS hiredate,
l.DIMISSION_TIME AS dimissionDate,
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.jobtitle AS position,
e.companystartdate AS hiredate,
l.dismissdate AS dimissionDate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
{$publicdb}.employee e
LEFT JOIN {$publicdb}.dimission_log l ON e.ID = l.DIMISSION_ID
LEFT JOIN {$publicdb}.department d ON d.ID = e.DEPARTMENT
hrmresource e
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
WHERE
e.STATUS = 'normal'
e.STATUS not in (4,5,6,7)
<if test="userName != null and userName != ''">
AND e.username like '%'||#{userName}||'%'
AND e.lastname like '%'||#{userName}||'%'
</if>
AND(
l.DIMISSION_TIME IS NULL OR l.DIMISSION_TIME = ''
l.dismissdate IS NULL OR l.dismissdate = ''
)
)AS t
LEFT JOIN hrsa_social_archives social ON t.employeeId = social.employee_id AND social.delete_type = 0
@ -753,28 +777,28 @@
FROM
(
SELECT
e.username AS userName,
e.JOB_NUM AS jobNum,
e.DEPARTMENT AS departmentId,
d.NAME AS departmentName,
e.STATUS AS userStatus,
e.POSITION AS position,
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.jobtitle AS position,
h.payment_status AS paymentStatus,
e.HIREDATE AS hiredate,
l.DIMISSION_TIME AS dimissionDate,
e.companystartdate AS hiredate,
l.dismissdate AS dimissionDate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
hrsa_bill_detail h
LEFT JOIN {$publicdb}.employee e ON e.ID = h.employee_id AND h.delete_type = 0
LEFT JOIN {$publicdb}.dimission_log l ON e.ID = l.DIMISSION_ID
LEFT JOIN {$publicdb}.department d ON d.ID = e.DEPARTMENT
LEFT JOIN hrmresource e ON e.ID = h.employee_id AND h.delete_type = 0
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
WHERE
e.STATUS = 'unavailable' AND h.payment_status = 0
e.STATUS = '5' AND h.payment_status = 0
<if test="userName != null and userName != ''">
AND e.username like '%'+#{userName}+'%'
AND e.lastname like '%'+#{userName}+'%'
</if>
AND(l.DIMISSION_TIME IS NOT NULL)
AND(l.dismissdate IS NOT NULL)
)AS t
LEFT JOIN hrsa_social_archives social ON t.employeeId = social.employee_id AND social.delete_type = 0
LEFT JOIN hrsa_fund_archives fund ON t.employeeId = fund.employee_id AND fund.delete_type = 0
@ -832,27 +856,27 @@
FROM
(
SELECT
e.username AS userName,
e.JOB_NUM AS jobNum,
e.DEPARTMENT AS departmentId,
d.NAME AS departmentName,
e.STATUS AS userStatus,
e.POSITION AS position,
e.HIREDATE AS hiredate,
l.DIMISSION_TIME AS dimissionDate,
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.jobtitle AS position,
e.companystartdate AS hiredate,
l.dismissdate AS dimissionDate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
{$publicdb}.employee e
LEFT JOIN {$publicdb}.dimission_log l ON e.ID = l.DIMISSION_ID
LEFT JOIN {$publicdb}.department d ON d.ID = e.DEPARTMENT
hrmresource e
LEFT JOIN bill_hrmdismiss l ON e.ID = l.resource_n
LEFT JOIN hrmdepartment d ON d.ID = e.departmentid
WHERE
e.STATUS = 'normal'
e.STATUS not in (4,5,6,7)
<if test="userName != null and userName != ''">
AND e.username like '%'+#{userName}+'%'
AND e.lastname like '%'+#{userName}+'%'
</if>
AND(
l.DIMISSION_TIME IS NULL OR l.DIMISSION_TIME = ''
l.dismissdate IS NULL OR l.dismissdate = ''
)
)AS t
LEFT JOIN hrsa_social_archives social ON t.employeeId = social.employee_id AND social.delete_type = 0

View File

@ -49,10 +49,13 @@
<include refid="baseColumns"/>
FROM hrsa_fund_archives t
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
<!-- 批量删除 -->
@ -60,10 +63,13 @@
UPDATE hrsa_fund_archives
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</delete>
<!-- 批量保存 -->

View File

@ -45,10 +45,13 @@
<include refid="baseColumns"/>
FROM hrsa_other_archives t
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
@ -58,9 +61,12 @@
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
<if test="employeeIds != null and employeeIds.size()>0">
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</delete>
<!-- 批量保存 -->

View File

@ -36,7 +36,7 @@ public interface SocialSchemeMapper {
void batchSave(@Param("socialSchemePOS") List<InsuranceArchivesSocialSchemePO> singletonList);
/**
*
* 人员档案信息
* @param param
* @return
*/
@ -47,4 +47,8 @@ public interface SocialSchemeMapper {
* @return
*/
List<Long> tips();
List<InsuranceArchivesEmployeePO> queryEmployeeList(@Param("param") InsuranceArchivesListParam param);
}

View File

@ -47,10 +47,12 @@
<include refid="baseColumns"/>
FROM hrsa_social_archives t
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
<!-- 批量删除 -->
@ -58,10 +60,12 @@
UPDATE hrsa_social_archives
SET delete_type = 1
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeIds" separator="," close=")">
#{employeeIds}
</foreach>
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</delete>
<!-- 批量保存 -->
@ -285,4 +289,146 @@
social_start_time is not null and social_end_time is null
</select>
<select id="queryEmployeeList" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO">
<!-- <![CDATA[-->
SELECT
a.employeeId,
a.userName,
a.departmentId,
a.jobNum,
a.telephone,
a.departmentName,
a.position,
a.userStatus,
a.hiredate,
l.dimissionDate,
social.siSchemeId,
fund.fundSchemeId,
other.otherSchemeId
FROM
(
SELECT
e.lastname AS userName,
e.jobtitle AS jobNum,
e.departmentid AS departmentId,
d.departmentname AS departmentName,
e.`STATUS` AS userStatus,
e.jobtitle AS position,
e.companystartdate AS hiredate,
e.ID AS employeeId,
e.MOBILE AS telephone
FROM
hrmresource e
LEFT JOIN hrmdepartment d ON e.departmentid = d.ID
)a
LEFT JOIN(
SELECT
t.*
FROM
(
SELECT
log.resource_n,
log.dismissdate AS dimissionDate
FROM
bill_hrmdismiss log
ORDER BY
log.dismissdate DESC
)t
GROUP BY
t.resource_n
)l ON a.employeeId = l.resource_n
LEFT JOIN(
SELECT
social.employee_id,
social.social_scheme_id AS siSchemeId
FROM
hrsa_social_archives social
WHERE social.delete_type = 0
)social ON a.employeeId = social.employee_id
LEFT JOIN(
SELECT
fund.employee_id,
fund.fund_scheme_id AS fundSchemeId
FROM
hrsa_fund_archives fund
WHERE fund.delete_type = 0
)fund ON a.employeeId = fund.employee_id
LEFT JOIN(
SELECT
other.employee_id,
other.other_scheme_id AS otherSchemeId
FROM
hrsa_other_archives other
WHERE other.delete_type = 0
)other ON a.employeeId = other.employee_id
WHERE
1=1
<include refid="condition"></include>
<if test="param.startNum != null and param.pageSize != null">
limit #{param.startNum},#{param.pageSize}
</if>
</select>
<!--]]>-->
<sql id="condition">
<if test="param.keyword != null and param.keyword != ''">
AND
(
userName like CONCAT('%',#{param.keyword},'%')
OR jobNum = #{param.keyword}
)
</if>
<if test="param.userName != null and param.userName != ''">
AND userName like CONCAT('%',#{param.userName},'%')
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND jobNum = #{param.jobNum}
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND departmentId IN
<foreach collection="param.departmentIds" open="(" item="departmentId" separator="," close=")">
#{departmentId}
</foreach>
</if>
<if test="param.statuses != null and param.statuses.size()>0">
AND userStatus IN
<foreach collection="param.statuses" open="(" item="userStatus" separator="," close=")">
#{userStatus}
</foreach>
</if>
<if test="param.positions != null and param.positions.size()>0">
AND position IN
<foreach collection="param.positions" open="(" item="position" separator="," close=")">
#{position}
</foreach>
</if>
<if test="param.hiredateStart != null">
AND hiredate &gt; #{param.hiredateStart}
</if>
<if test="param.hiredateEnd != null">
AND hiredate &lt; #{param.hiredateEnd}
</if>
<if test="param.dimissionDateStart != null">
AND dimissionDate &gt; #{param.dimissionDateStart}
</if>
<if test="param.dimissionDateEnd != null">
AND dimissionDate &lt; #{param.dimissionDateEnd}
</if>
<if test="param.siSchemeId != null and param.siSchemeId != 0">
AND siSchemeId = #{param.siSchemeId}
</if>
<if test="param.fundSchemeId != null and param.fundSchemeId != 0">
AND fundSchemeId = #{param.fundSchemeId}
</if>
<if test="param.otherSchemeId != null and param.otherSchemeId != 0">
AND otherSchemeId = #{param.otherSchemeId}
</if>
<if test="param.employeeIds != null and param.employeeIds.size() > 0">
AND employeeId IN
<foreach collection="param.employeeIds" open="(" separator="," item="item" close=")">
#{item}
</foreach>
</if>
</sql>
</mapper>

View File

@ -1,7 +1,11 @@
package com.engine.salary.service;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Collection;
import java.util.List;
@ -148,5 +152,31 @@ public interface SIAccountService {
* @param param
*/
Map<String,Object> getInspectTable(InsuranceAccountDetailParam param);
/**
* 正常缴纳添加缴纳人员表单
* @param params
* @return
*/
Map<String,Object> getCommonForm(Map<String, Object> params);
/**
* 补缴添加缴纳人员表单
* @param params
* @return
*/
Map<String,Object> getSupplementaryForm(Map<String, Object> params);
/**
* 总览
* @param param
* @return
*/
PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam param);
}

View File

@ -2,7 +2,10 @@ package com.engine.salary.service;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.List;
import java.util.Map;
/**
@ -24,4 +27,25 @@ public interface SIArchivesService {
Map<String, Object> listPage(InsuranceArchivesListParam insuranceArchivesListParam);
Map<String,Object> getSearchCondition(Map<String, Object> stringObjectMap);
/**
* 根据高级搜索框或者员工id集合导出档案
*
* @param param 请求报文
* @return map
*/
XSSFWorkbook export(InsuranceArchivesListParam param);
/**
* 获取员工的基本信息
* <p>
* 此处主要是一个公共接口有多处引用我们薪资系统只保存员工idemployeeId
* 但是页面上需要展示员工的更多信息姓名部门状态
* 所以这里主要是用于接收联表数据的一个接口
*
* @param param 高级搜索条件用于过滤数据
* @return list
*/
List<InsuranceArchivesEmployeePO> listPageEmployeePOS(InsuranceArchivesListParam param);
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.service;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public interface SIExportService {
/**
* 总览导出
* @param param
* @return
*/
XSSFWorkbook exportOverView(InsuranceExportParam param);
/**
* 补缴核算导出
* @param paymentStatus
* @param param
* @return
*/
XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param);
}

View File

@ -26,4 +26,10 @@ public interface SISchemeService {
List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(Long insuranceId, Integer isPayment);
Map<String, Object> listPage(Map<String, Object> params);
/**
* 获取当前租户下所有的方案id和方案名称的map
* @return Map
*/
Map<Long, String> getSchemeIdNameMap();
}

View File

@ -7,6 +7,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.List;
import java.util.Map;
/**
* 薪资核算导入导出
@ -75,6 +76,15 @@ public interface SalaryAcctExcelService {
* @return
*/
XSSFWorkbook exportComparisonResultTemplate(SalaryComparisonResultExportParam exportParam);
Map<String, Object> importSalaryAcctResult(SalaryAcctImportParam param);
Map<String, Object> importExcelAcctResult(SalaryAcctImportParam param);
Map<String, Object> preview(SalaryAcctImportParam param);
//
// /**
// * 薪资核算结果校验异常导出

View File

@ -121,7 +121,7 @@ public interface SalaryArchiveService {
*/
List<SalaryArchiveDataDTO> getSalaryArchiveTaxAgentData(LocalDateRange localDateRange, Collection<Long> employeeIds);
void importSalaryArchive(SalaryArchiveImportHandleParam param);
Map<String,Object> importSalaryArchive(SalaryArchiveImportHandleParam param);
Map<String, Object> preview(SalaryArchiveImportHandleParam param);

View File

@ -77,7 +77,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
record.put(k + "socialBase", SalaryEntityUtil.thousandthConvert((String) v));
});
}
record.put("fundPayOrg", item.getFundPayOrg() == null ? "" : paymentMap.get(item.getFundPayOrg()).getName());
record.put("fundPayOrg", item.getFundPayOrg() == null ? "" : (paymentMap.getOrDefault(item.getFundPayOrg(),TaxAgent.builder().build())).getName());
record.put("fundAccount", item.getFundAccount());
record.put("fundSchemeName", MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).querySchemeName(item.getFundSchemeId()));
record.put("supplementFundAccount", item.getSupplementFundAccount());
@ -87,7 +87,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
record.put(k + "fundBase", SalaryEntityUtil.thousandthConvert((String) v));
});
}
record.put("otherPayOrg", item.getOtherPayOrg() == null ? "" : paymentMap.get(item.getOtherPayOrg()).getName());
record.put("otherPayOrg", item.getOtherPayOrg() == null ? "" : (paymentMap.getOrDefault(item.getOtherPayOrg(),TaxAgent.builder().build())).getName());
record.put("otherSchemeName", MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).querySchemeName(item.getOtherSchemeId()));
if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, Object>().getClass());

View File

@ -2,6 +2,7 @@ package com.engine.salary.service.impl;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.cloudstore.eccom.pc.table.*;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
@ -10,11 +11,10 @@ import com.engine.salary.biz.SIAccountBiz;
import com.engine.salary.biz.SIArchivesBiz;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
@ -24,6 +24,7 @@ import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.InspectStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
@ -39,7 +40,9 @@ import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryFormItemUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.Column;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -86,6 +89,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<Map<Integer,List<Permission>>> operatesPermission = new ArrayList<>();
SalaryWeaTable<InsuranceAccountBatchListDTO> table = new SalaryWeaTable<>(user, InsuranceAccountBatchListDTO.class);
List<Column> columns = pageInfos.getColumns();
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
table.setColumns(weaTableColumn);
//table.getColumns().get(0).setFixed("left");
// for (int i = 0; i < insuranceAccountBatchListDTOS.size(); i++) {
@ -114,7 +121,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
datas.put("pageInfo", pageInfos);
datas.put("operatesPermission",operatesPermission);
//datas.put("dataKey",result.getResultMap());
datas.put("dataKey",result.getResultMap());
return datas;
// WeaTable<InsuranceAccountBatchListDTO> resultTable = FormatManager.<InsuranceAccountBatchListDTO>getInstance()
@ -152,8 +159,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//动态列组装
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, false);
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, SalaryArchiveListDTO.class);
WeaTable table = new WeaTable();
table.setPageUID(UUID.randomUUID().toString());
table.setColumns(weaTableColumn);
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
pageInfos.setColumns(columns);
WeaResultMsg result = new WeaResultMsg(false);
@ -161,7 +171,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
result.success();
datas.put("pageInfo", pageInfos);
datas.put("dataKey",result.getResultMap());
//datas.put("dataKey",result.getResultMap());
return datas;
}
@ -172,9 +182,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
public Map<String, Object> listCommonPageByName(InsuranceAccountDetailParam queryParam) {
//增加查询参数userName
if (StringUtils.isNotBlank(queryParam.getUserName())) {
List<DataCollectionEmployee> employeeIdsByUserName = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeIdsByUserName(queryParam.getUserName());
List<Long> employeeIds = employeeIdsByUserName.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
queryParam.setEmployeeIds(employeeIds);
queryParam.setUserName(queryParam.getUserName());
}
return listCommonPage(queryParam);
}
@ -186,14 +194,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//补缴缴纳列表
queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
//PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<InsuranceAccountDetailPO> list = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).list(queryParam);
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId);
PageInfo<Map<String, Object>> pageInfos = new PageInfo<Map<String, Object>>(records);
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
pageInfos.setTotal(records.size());
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
@ -202,8 +210,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//动态列组装
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, false);
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, SalaryArchiveListDTO.class);
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, InsuranceAccountDetailPO.class);
table.setColumns(weaTableColumn);
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
pageInfos.setColumns(columns);
WeaResultMsg result = new WeaResultMsg(false);
@ -211,7 +221,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
result.success();
datas.put("pageInfo", pageInfos);
datas.put("dataKey",result.getResultMap());
//datas.put("dataKey",result.getResultMap());
return datas;
}
@ -221,9 +231,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
public Map<String, Object> supplementaryByNameList(InsuranceAccountDetailParam queryParam) {
//增加查询参数userName
if (StringUtils.isNotBlank(queryParam.getUserName())) {
List<DataCollectionEmployee> employeeIdsByUserName = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeIdsByUserName(queryParam.getUserName());
List<Long> employeeIds = employeeIdsByUserName.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
queryParam.setEmployeeIds(employeeIds);
queryParam.setUserName(queryParam.getUserName());
}
return listSupplementaryPage(queryParam);
}
@ -499,5 +507,88 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return datas;
}
@Override
public Map<String, Object> getCommonForm(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<>();
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
List<SearchConditionItem> conditionItem = new ArrayList<>();
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "对象", "require", "17", "includes");
conditionItems.add(includes);
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "require", "17", "excludes");
conditionItem.add(excludes);
addGroups.add(new SearchConditionGroup("人员范围",true,conditionItems));
addGroups.add(new SearchConditionGroup("人员范围排除",true,conditionItem));
apidatas.put("condition",addGroups);
return apidatas;
}
@Override
public Map<String, Object> getSupplementaryForm(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<>();
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> condition = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
List<SearchConditionItem> conditionItem = new ArrayList<>();
SearchConditionItem billMonthList = SalaryFormItemUtil.datePickerItem(user, 2, 16, true, 2, "账单月份", "billMonth");
billMonthList.setMultiple(true);
billMonthList.getOtherParams().put("type", "months");
billMonthList.getOtherParams().put("format", "YYYY-MM");
billMonthList.getOtherParams().put("showFormat", "YYYY-MM");
billMonthList.setMultiple(true);
condition.add(billMonthList);
SearchConditionItem billProjects = SalaryFormItemUtil.checkboxItem(user,18,6,3,true,"补缴项目","projects");
billProjects.setOptions(buildBillProjectsOptions());
billMonthList.setMultiple(false);
condition.add(billProjects);
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 3, true, "对象", "require", "17", "includes");
conditionItems.add(includes);
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "require", "17", "excludes");
conditionItem.add(excludes);
addGroups.add(new SearchConditionGroup("基础信息",true,condition));
addGroups.add(new SearchConditionGroup("人员范围",true,conditionItems));
addGroups.add(new SearchConditionGroup("人员范围排除",true,conditionItem));
apidatas.put("condition",addGroups);
return apidatas;
}
@Override
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
PageInfo<InsuranceAccountViewListDTO> pageInfos = siAccountBiz.overView(queryParam);
return pageInfos;
}
public List<SearchConditionOption> buildBillProjectsOptions() {
List<SearchConditionOption> options = new ArrayList<>();
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ALL.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.ALL.getLabelId(), ProjectTypeEnum.ALL.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.SOCIAL.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.SOCIAL.getLabelId(), ProjectTypeEnum.SOCIAL.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.FUND.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.FUND.getLabelId(), ProjectTypeEnum.FUND.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.OTHER.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.OTHER.getLabelId(), ProjectTypeEnum.OTHER.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.ENDOWMENT_INSURANCE.getLabelId(), ProjectTypeEnum.ENDOWMENT_INSURANCE.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.MEDICAL_INSURANCE.getLabelId(), ProjectTypeEnum.MEDICAL_INSURANCE.getDefaultLabel())));
return options;
}
}

View File

@ -1,16 +1,22 @@
package com.engine.salary.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIArchivesBiz;
import com.engine.salary.cmd.siarchives.SIArchivesTipsCmd;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesSaveParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.Util;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
* @Author weaver_cl
@ -20,6 +26,8 @@ import java.util.Map;
**/
public class SIArchivesServiceImpl extends Service implements SIArchivesService {
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
@Override
public Map<String, Object> getTips(Map<String, Object> params) {
return commandExecutor.execute(new SIArchivesTipsCmd(params,user));
@ -70,5 +78,57 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return apidatas;
}
@Override
public XSSFWorkbook export(InsuranceArchivesListParam param) {
InsuranceArchivesListParam request = InsuranceArchivesListParam.builder().build();
if (param.getHireDate() != null && param.getHireDate().length == 2) {
param.setHiredateStart(param.getHireDate()[0]);
param.setHiredateEnd(param.getHireDate()[1]);
}
if (param.getDimissionDate() != null && param.getDimissionDate().length == 2) {
param.setDimissionDateStart(param.getDimissionDate()[0]);
param.setDimissionDateEnd(param.getDimissionDate()[1]);
}
if (Objects.equals("fromQuickSearch", param.getDataSource())) {
request.setStatuses(param.getStatuses());
request.setKeyword(param.getUserName());
} else {
request = param;
}
request.setPageSize(null);
request.setStartNum(null);
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = listPageEmployeePOS(request);
if (insuranceArchivesEmployeePOS == null) {
insuranceArchivesEmployeePOS = new ArrayList<>();
}
List<Map<String, Object>> records = siArchivesBiz.buildTableData(insuranceArchivesEmployeePOS);
List<WeaTableColumn> columns = siArchivesBiz.buildWeaTableColumns(insuranceArchivesEmployeePOS,user.getUID());
//工作簿list
List<List<Object>> excelSheetData = new ArrayList<>();
//工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案"); //表头
//表头
excelSheetData.add(Collections.singletonList(columns.stream().map(WeaTableColumn::getText).toArray(String[]::new)));
//工作簿数据
List<List<Object>> rows = new LinkedList<>();
for (Map<String, Object> recordData : records) {
List<Object> row = new LinkedList<>();
for (WeaTableColumn column : columns) {
row.add(recordData.get(column.getColumn()));
}
rows.add(row);
}
excelSheetData.addAll(rows);
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
@Override
public List<InsuranceArchivesEmployeePO> listPageEmployeePOS(InsuranceArchivesListParam param) {
return MapperProxyFactory.getProxy(SocialSchemeMapper.class).listPageEmployeePOS(param);
}
}

View File

@ -0,0 +1,474 @@
package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIAccountBiz;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.siaccount.ResourceFromEnum;
import com.engine.salary.enums.sicategory.DataTypeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.mapper.InsuranceExportMapper;
import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.service.SIExportService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import com.engine.common.util.ServiceUtil;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIExportServiceImpl extends Service implements SIExportService {
private SIAccountBiz siAccountBiz = new SIAccountBiz();
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
@Override
public XSSFWorkbook exportOverView(InsuranceExportParam queryParam) {
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = siAccountBiz.buildRecords(insuranceAccountDetailPOS, paymentMap);
List<List<Object>> excelSheetData = new ArrayList<>();
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案");
// 2.表头
String[] header = {
SalaryI18nUtil.getI18nLabel( 93270, "缴纳组织"),
SalaryI18nUtil.getI18nLabel( 93272, "社保人数"),
SalaryI18nUtil.getI18nLabel( 93273, "公积金人数"),
SalaryI18nUtil.getI18nLabel( 93274, "其他福利人数"),
SalaryI18nUtil.getI18nLabel( 93275, "社保缴费合计"),
SalaryI18nUtil.getI18nLabel( 93276, "公积金缴费合计"),
SalaryI18nUtil.getI18nLabel( 93277, "其他福利缴费合计"),
SalaryI18nUtil.getI18nLabel( 93278, "合计")};
excelSheetData.add(Collections.singletonList(header));
//工作簿数据
List<List<Object>> rows = new LinkedList<>();
for (InsuranceAccountViewListDTO dto : insuranceAccountViewListDTOS) {
List<Object> row = new LinkedList<>();
row.add(dto.getPayOrg());
row.add(dto.getSocialNum());
row.add(dto.getFundNum());
row.add(dto.getOtherNum());
row.add(dto.getSocialPaySum());
row.add(dto.getFundPaySum());
row.add(dto.getOtherPaySum());
row.add(dto.getSum());
rows.add(row);
}
excelSheetData.addAll(rows);
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
@Override
public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) {
List<AccountExportPO> accountExportPOS = MapperProxyFactory.getProxy(InsuranceExportMapper.class).exportAccount(paymentStatus, param.getBillMonth());
List<WeaTableColumn> columns = new ArrayList<>();
List<Map<String, Object>> records = new ArrayList<>();
if (PaymentStatusEnum.COMMON.getValue() == paymentStatus) {
columns = buildCommonColumns(accountExportPOS, false);
}
if (PaymentStatusEnum.REPAIR.getValue() == paymentStatus) {
columns = buildCommonColumns(accountExportPOS, true);
}
records = buildCommonRecords(accountExportPOS);
List<List<Object>> excelSheetData = new ArrayList<>();
//工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案"); //表头
excelSheetData.add(Collections.singletonList(columns.stream().map(WeaTableColumn::getText).toArray(String[]::new)));
//工作簿数据
List<List<Object>> rows = new LinkedList<>();
for (Map<String, Object> recordData : records) {
List<Object> row = new LinkedList<>();
for (WeaTableColumn column : columns) {
row.add(recordData.get(column.getColumn()));
}
rows.add(row);
}
excelSheetData.addAll(rows);
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
private List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
List<Map<String, Object>> result = new ArrayList<>();
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
Map<Long, String> schemeIdNameMap = getSISchemeService(user).getSchemeIdNameMap();
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
list.forEach(item -> {
Map<String, Object> record = new HashMap<>();
record.put("billMonth", item.getBillMonth());
record.put("billStatus", SalaryEnumUtil.enumMatchByValue(item.getBillStatus(), BillStatusEnum.values(), BillStatusEnum.class));
record.put("userName", item.getUserName());
record.put("department", item.getDepartmentName());
record.put("supplementaryMonth", item.getSupplementaryMonth());
record.put("mobile", item.getTelephone());
record.put("employeeStatus", item.getUserStatus() == null ? "" : item.getUserStatus().getDescription());
ResourceFromEnum from = SalaryEnumUtil.enumMatchByValue(item.getResourceFrom(), ResourceFromEnum.values(), ResourceFromEnum.class);
record.put("sourceFrom", SalaryI18nUtil.getI18nLabel( from.getLabelId(), from.getDefaultLabel()));
record.put("socialPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName());
record.put("socialAccount", item.getSocialAccount());
record.put("socialSchemeName", schemeIdNameMap.get(item.getSocialSchemeId()));
if (StringUtils.isNotEmpty(item.getSocialPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "socialBase", v);
});
}
record.put("fundPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName());
record.put("fundAccount", item.getFundAccount());
record.put("fundSchemeName", schemeIdNameMap.get(item.getFundSchemeId()));
record.put("supplementFundAccount", item.getSupplementFundAccount());
if (StringUtils.isNotEmpty(item.getFundPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "fundBase", v);
});
}
record.put("otherPayOrg", paymentMap.get(item.getOtherPayOrg()) == null ? "" : paymentMap.get(item.getOtherPayOrg()).getName());
record.put("otherSchemeName", schemeIdNameMap.get(item.getOtherSchemeId()));
if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "otherBase", v);
});
}
if (StringUtils.isNotEmpty(item.getSocialPerJson())) {
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "socialPer", v);
});
}
record.put("socialPerSum", item.getSocialPerSum());
if (StringUtils.isNotEmpty(item.getFundPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "fundPer", v);
});
}
record.put("fundPerSum", item.getFundPerSum());
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "otherPer", v);
});
}
record.put("otherPerSum", item.getOtherPerSum());
record.put("perSum", item.getPerSum());
if (StringUtils.isNotEmpty(item.getSocialComJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "socialCom", v);
});
}
record.put("socialComSum", item.getSocialComSum());
if (StringUtils.isNotEmpty(item.getFundComJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "fundCom", v);
});
}
record.put("fundComSum", item.getFundComSum());
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "otherCom", v);
});
}
record.put("otherComSum", item.getOtherComSum());
record.put("comSum", item.getComSum());
record.put("socialSum", item.getSocialSum());
record.put("fundSum", item.getFundSum());
record.put("otherSum", item.getOtherSum());
record.put("total", item.getTotal());
result.add(record);
});
return result;
}
private Map<Integer, Map<String, String>> buildComTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getFundComJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, String>().getClass());
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getOtherComJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, String>().getClass());
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(
categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"),
social + "socialCom");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"),
social + "fundCom");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"),
social + "otherCom");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
}
private Map<Integer, Map<String, String>> buildPersonalTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getFundPerJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"),
social + "socialPer");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"),
social + "fundPer");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"),
social + "otherPer");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
}
private List<WeaTableColumn> buildCommonColumns(List<AccountExportPO> pos, boolean flag) {
List<WeaTableColumn> list = new ArrayList<>();
Map<String, String> categoryIdNameMap = categoryIdNameMap();
Map<Integer, Map<String, String>> columns = buildPaymentTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> personColumns = buildPersonalTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> comColumns = buildComTitle(pos, categoryIdNameMap);
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86185, "部门"), "department"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86186, "手机号"), "mobile"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86187, "员工状态"), "employeeStatus"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100377, "数据来源"), "sourceFrom"));
if (flag) {
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100379, "补缴月份"), "supplementaryMonth"));
}
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91325, "社保缴纳组织"), "socialPayOrg"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91324, "社保账号"), "socialAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称"), "socialSchemeName"));
//组装社保基数
columns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91488, "公积金缴纳组织"), "fundPayOrg"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91486, "公积金账号"), "fundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91485, "公积金方案名称"), "fundSchemeName"));
//组装公积金基数
columns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91487, "补充公积金账号"), "supplementFundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91497, "其他福利缴纳组织"), "otherPayOrg"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91496, "其他福利方案名称"), "otherSchemeName"));
columns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
personColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100388, "社保个人合计"), "socialPerSum"));
personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100390, "公积金个人合计"), "fundPerSum"));
personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100392, "其他福利个人合计"), "otherPerSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100393, "个人合计"), "perSum"));
comColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100394, "社保单位合计"), "socialComSum"));
comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100395, "公积金单位合计"), "fundComSum"));
comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100396, "其他福利单位合计"), "fundComSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100397, "单位合计"), "comSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100398, "社保合计"), "socialSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100399, "公积金合计"), "fundSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100400, "其他福利合计"), "otherSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 93278, "合计"), "total"));
return list;
}
private Map<String, String> categoryIdNameMap() {
//系统福利类型
Map<Long, String> systemMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listByDataType(DataTypeEnum.SYSTEM.getValue()).stream()
.collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
Map<Long, String> customMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll()
.stream().collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
HashMap<Long, String> total = new HashMap<>();
if (MapUtils.isNotEmpty(systemMap)) {
total.putAll(systemMap);
}
if (MapUtils.isNotEmpty(customMap)) {
total.putAll(customMap);
}
HashMap<String, String> result = new HashMap<>();
total.forEach((k, v) -> {
result.put(String.valueOf(k), v);
});
return result;
}
private Map<Integer, Map<String, String>> buildPaymentTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialPaymentBaseString())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getFundPaymentBaseString())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getOtherPaymentBaseString())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "socialBase");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "fundBase");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "otherBase");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
}
}

View File

@ -4,10 +4,16 @@ import com.engine.core.impl.Service;
import com.engine.salary.biz.SISchemeBiz;
import com.engine.salary.cmd.sischeme.*;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
@ -51,4 +57,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
public Map<String, Object> listPage(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeListCmd(params,user));
}
@Override
public Map<Long, String> getSchemeIdNameMap() {
Map<Long, String> result = new HashMap<>();
List<InsuranceSchemePO> insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listAll();
if (CollectionUtils.isNotEmpty(insuranceSchemePOS)) {
result = insuranceSchemePOS.stream().collect(Collectors.toMap(InsuranceSchemePO::getId, InsuranceSchemePO::getSchemeName));
}
return result;
}
}

View File

@ -4,6 +4,7 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
@ -11,8 +12,10 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctImportFieldDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO;
@ -25,18 +28,28 @@ import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelParseHelper;
import com.engine.salary.util.excel.ExcelSupport;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
import weaver.hrm.User;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
/**
* 薪资核算导入导出
* <p>Copyright: Copyright (c) 2022</p>
@ -301,7 +314,6 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
headerList.add(salaryItemPO.getName());
dataIndexList.add("" + salaryItemPO.getId());
}
String[] headers = headerList.toArray(new String[0]);
// 查询薪资核算结果
List<Map<String, Object>> resultMapList = getSalaryAcctResultService(user).listByParam(param);
@ -408,270 +420,307 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
public Map<String, Object> importSalaryAcctResult(SalaryAcctImportParam param) {
return batchImport(param, "importSalaryAcctResult");
}
//
// @BatchImportHandler("importSalaryAcctResult")
// @Transactional(rollbackFor = Exception.class)
// public void importSalaryAcctResult() {
// BatchDocumentMessage message = BatchImportContext.getBatchDocumentMessage();
// String tenantKey = message.getTenantKey();
// try {
// // 加密用
// DSTenantKeyThreadVar.tenantKey.set(tenantKey);
// // 接收到解析的数据
// batchImport(message, "importSalaryAcctResult");
// } catch (Exception e) {
// log.error("薪资核算结果导入失败:{}", e.getMessage(), e);
// } finally {
// DSTenantKeyThreadVar.tenantKey.remove();
// }
// }
//
// @BatchImportHandler("importExcelAcctResult")
// @Transactional(rollbackFor = Exception.class)
// public void importExcelAcctResult() {
// BatchDocumentMessage message = BatchImportContext.getBatchDocumentMessage();
// String tenantKey = message.getTenantKey();
// try {
// // 加密用
// DSTenantKeyThreadVar.tenantKey.set(tenantKey);
// // 接收到解析的数据
// batchImport(message, "importExcelAcctResult");
// } catch (Exception e) {
// log.error("线下核算结果导入失败:{}", e.getMessage(), e);
// } finally {
// // 加密用
// DSTenantKeyThreadVar.tenantKey.remove();
// }
// }
//
// private void batchImport(BatchDocumentMessage message, String importType) {
// String tenantKey = message.getTenantKey();
// Long currentEmployeeId = message.getUserId();
// LocalDateTime now = LocalDateTime.now();
// // 前端传入的参数薪资核算记录的id
// Map<String, Object> paramMap = JsonUtil.parseMap(message.getUploadSet().getCustomData(), Object.class);
// // 薪资核算记录的id
// Long salaryAcctRecordId = Long.valueOf(String.valueOf(paramMap.get("salaryAcctRecordId")));
// // 薪资核算记录
// SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
// if (salaryAcctRecordPO == null) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
// }
// // 薪资账套下的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// // 薪资项目
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
// List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
// Map<String, Long> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getName, SalaryItemPO::getId);
// // 薪资核算确认的人员
// List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salaryAcctRecordId);
// Map<String, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployees, e -> e.getEmployeeId() + "-" + e.getTaxAgentId());
// // 租户下所有的人员
// List<SalaryEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(tenantKey);
// Map<String, Long> salaryEmployeeMap = SalaryEntityUtil.convert2Map(salaryEmployees, SalaryEmployee::getUsername, SalaryEmployee::getId);
// // 租户下所有的个税扣缴义务人
// List<TaxAgentPO> taxAgents = taxAgentService.listAll(tenantKey);
// Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
//
// // 索引(用于计算进度)
// int index = 0;
// // 失败的数量
// int failCount = 0;
// // 成功的数量
// int successCount = 0;
// // 总数
public Map<String, Object> importExcelAcctResult(SalaryAcctImportParam param) {
return batchImport(param, "importExcelAcctResult");
}
@Override
public Map<String, Object> preview(SalaryAcctImportParam param) {
//1参数校验
ValidUtil.doValidator(param);
Map<String, Object> map = new HashMap<>();
InputStream fileInputStream = null;
try {
// try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
// fileInputStream = new FileInputStream("C:\\Users\\钱涛\\Desktop\\salaryItemAdjust.xlsx");
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// }
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
map.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
map.put("list", ExcelParseHelper.parse2List(sheet, 1));
return map;
} finally {
IOUtils.closeQuietly(fileInputStream);
}
}
private Map<String, Object> batchImport(SalaryAcctImportParam param, String importType) {
Map<String, Object> apidatas = new HashMap<String, Object>();
ValidUtil.doValidator(param);
Date now = new Date();
Long currentEmployeeId = (long) user.getUID();
// 薪资核算记录的id
Long salaryAcctRecordId = param.getSalaryAcctRecordId();
// 薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
if (salaryAcctRecordPO == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 薪资账套下的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
Map<String, Long> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getName, SalaryItemPO::getId);
// 薪资核算确认的人员
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salaryAcctRecordId);
Map<String, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployees, e -> e.getEmployeeId() + "-" + e.getTaxAgentId());
// 租户下所有的人员
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll();
Map<String, Long> salaryEmployeeMap = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getUsername, DataCollectionEmployee::getEmployeeId);
// 租户下所有的个税扣缴义务人
List<TaxAgent> taxAgents = taxAgentService.listAll();
Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getName, TaxAgent::getId);
// 索引(用于计算进度)
int index = 0;
// 失败的数量
int failCount = 0;
// 成功的数量
int successCount = 0;
// 总数
// int total = message.getBatchFile().getExcelSheets().stream()
// .filter(e -> CollectionUtils.isNotEmpty(e.getHeader()) && CollectionUtils.isNotEmpty(e.getData()))
// .map(e -> BigDecimal.valueOf(e.getData().size()))
// .reduce(BigDecimal.ZERO, BigDecimal::add)
// .intValue();
// // 包含错误提示信息的sheet页
// List<ExcelSheet> errorExcelSheets = Lists.newArrayList();
// // 解析excel
// Set<Long> salaryAcctEmpIds = Sets.newHashSet();
// // excel导入了哪些薪资项目
// Set<Long> excelSalaryItemIds = Sets.newHashSet();
// List<SalaryAcctResultPO> salaryAcctResults = Lists.newArrayList();
// List<SalaryAcctEmployeePO> newSalaryAcctEmployees = Lists.newArrayList();
//
// List<ExcelAcctResultPO> excelAcctResults = Lists.newArrayList();
// for (ExcelSheet excelSheet : message.getBatchFile().getExcelSheets()) {
// if (CollectionUtils.isEmpty(excelSheet.getHeader())) {
// continue;
// }
// // 错误提示信息
// List<ExcelComment> excelComments = Lists.newArrayList();
// // 存在错误的那行数据
// List<Map<String, Object>> errorDatas = Lists.newArrayList();
// // 表头
// List<Map> headers = excelSheet.getHeader();
// // 处理数值
// List<Map<String, Object>> data = excelSheet.getData();
// if (CollectionUtils.isEmpty(data)) {
// continue;
// }
// for (int i = 0; i < data.size(); i++) {
// int usernameIndex = 0;
// boolean isError = false;
// Map<String, Object> map = data.get(i);
// Long employeeId = 0L;
// Long taxAgentId = 0L;
// List<SalaryAcctResultPO> salaryAcctResultsOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
// List<ExcelAcctResultPO> excelAcctResultsOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
// for (int j = 0; j < headers.size(); j++) {
// Map header = headers.get(j);
// Object dataKey = header.get("key");
// if (dataKey == null) {
// continue;
// }
// String dataValue = (String) map.getOrDefault(dataKey.toString(), "");
// if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
// usernameIndex = j;
// if (StringUtils.isEmpty(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"), i, i, j, j);
// } else {
// employeeId = salaryEmployeeMap.getOrDefault(dataValue, 0L);
// if (employeeId == null || employeeId <= 0) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"), i, i, j, j);
// }
// }
// } else if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), dataKey.toString())) {
// if (StringUtils.isEmpty(dataValue)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102839, "个税扣缴义务人不能为空"), i, i, j, j);
// } else {
// taxAgentId = taxAgentNameMap.getOrDefault(dataValue, 0L);
// if (taxAgentId == null || taxAgentId <= 0) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人"), i, i, j, j);
// }
// }
// } else {
// Long salaryItemId = salaryItemMap.get(dataKey.toString());
// if (salaryItemId == null || salaryItemId <= 0) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102841, "表头错误,本次核算所用账套不包含该薪资项目"), i, i, j, j);
// } else {
// excelSalaryItemIds.add(salaryItemId);
// if (StringUtils.equals("importExcelAcctResult", importType)) {
// ExcelAcctResultPO excelAcctResult = ExcelAcctResultPO.builder()
// .id(IdGenerator.generate())
// .salaryAcctRecordId(salaryAcctRecordPO.getId())
// .salarySobId(salaryAcctRecordPO.getSalarySobId())
// .salaryItemId(salaryItemId)
// .resultValue(dataValue)
// .creator(currentEmployeeId)
// .createTime(now)
// .updateTime(now)
// .deleteType(0)
// .tenantKey(tenantKey)
// .build();
// excelAcctResultsOfOneEmp.add(excelAcctResult);
// }
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
// SalaryAcctResultPO salaryAcctResult = SalaryAcctResultPO.builder()
// .id(IdGenerator.generate())
// .salaryAcctRecordId(salaryAcctRecordPO.getId())
// .salarySobId(salaryAcctRecordPO.getSalarySobId())
// .salaryItemId(salaryItemId)
// .resultValue(dataValue)
// .creator(currentEmployeeId)
// .createTime(now)
// .updateTime(now)
// .deleteType(0)
// .tenantKey(tenantKey)
// .build();
// salaryAcctResultsOfOneEmp.add(salaryAcctResult);
// }
// }
// }
// // 如果是线下对比如果个税扣缴义务人+人员目前不在核算人员里面不支持导入
// if (StringUtils.equals("importExcelAcctResult", importType)
// && (employeeId != null && employeeId > 0)
// && (taxAgentId != null && taxAgentId > 0)
// && i == data.size() - 1
// && !salaryAcctEmployeeMap.containsKey(employeeId + "-" + taxAgentId)) {
// isError = true;
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102842, "本次薪资核算不包含该人员"), i, i, usernameIndex, usernameIndex);
// }
// }
// // 每处理50个数据更新一次进度
// index++;
// if (index % 50 == 0 || index >= total) {
// salaryBatchService.sendImportRate(message.getBizId(), total, index);
// }
// if (isError) {
// failCount++;
// errorDatas.add(map);
// continue;
// }
// SalaryAcctEmployeePO salaryAcctEmployee = salaryAcctEmployeeMap.get(employeeId + "-" + taxAgentId);
// Long salaryAcctEmpId = Optional.ofNullable(salaryAcctEmployee).map(SalaryAcctEmployeePO::getId).orElse(0L);
// if (StringUtils.equals("importExcelAcctResult", importType)) {
// for (ExcelAcctResultPO excelAcctResultPO : excelAcctResultsOfOneEmp) {
// excelAcctResultPO.setEmployeeId(employeeId);
// excelAcctResultPO.setTaxAgentId(taxAgentId);
// excelAcctResultPO.setSalaryAcctEmpId(salaryAcctEmpId);
// }
// excelAcctResults.addAll(excelAcctResultsOfOneEmp);
// }
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
// if (salaryAcctEmpId <= 0) {
// SalaryAcctEmployeePO acctEmployee = SalaryAcctEmployeePO.builder()
// .id(IdGenerator.generate())
// .employeeId(employeeId)
// .salaryAcctRecordId(salaryAcctRecordId)
// .salarySobId(salaryAcctRecordPO.getSalarySobId())
// .salaryMonth(salaryAcctRecordPO.getSalaryMonth())
// .taxAgentId(taxAgentId)
// .creator(currentEmployeeId)
// .createTime(now)
// .updateTime(now)
// .deleteType(0)
// .tenantKey(tenantKey)
// .build();
// newSalaryAcctEmployees.add(acctEmployee);
// salaryAcctEmpId = acctEmployee.getId();
// }
// for (SalaryAcctResultPO salaryAcctResultPO : salaryAcctResultsOfOneEmp) {
// salaryAcctResultPO.setEmployeeId(employeeId);
// salaryAcctResultPO.setTaxAgentId(taxAgentId);
// salaryAcctResultPO.setSalaryAcctEmpId(salaryAcctEmpId);
// }
// salaryAcctEmpIds.add(salaryAcctEmpId);
// salaryAcctResults.addAll(salaryAcctResultsOfOneEmp);
// }
// successCount++;
// }
// // 如果sheet包含错误数据
// if (CollectionUtils.isNotEmpty(errorDatas)) {
// salaryBatchService.createErrorExcelSheet(headers, errorDatas, excelSheet.getName(), excelComments, errorExcelSheets);
// 包含错误提示信息的sheet页
List<Map<String, String>> errorExcelSheets = Lists.newArrayList();
// 解析excel
Set<Long> salaryAcctEmpIds = Sets.newHashSet();
// excel导入了哪些薪资项目
Set<Long> excelSalaryItemIds = Sets.newHashSet();
List<SalaryAcctResultPO> salaryAcctResults = Lists.newArrayList();
List<SalaryAcctEmployeePO> newSalaryAcctEmployees = Lists.newArrayList();
List<ExcelAcctResultPO> excelAcctResults = Lists.newArrayList();
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
// 错误提示信息
List<Map> excelComments = Lists.newArrayList();
// 存在错误的那行数据
List<Map<String, Object>> errorDatas = Lists.newArrayList();
// 表头
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
// 处理数值
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
if (CollectionUtils.isEmpty(headers)) {
throw new RuntimeException("表头为空");
}
if (CollectionUtils.isEmpty(data)) {
throw new RuntimeException("无数据");
}
for (int i = 0; i < data.size(); i++) {
int usernameIndex = 0;
boolean isError = false;
Map<String, Object> map = data.get(i);
Long employeeId = 0L;
Long taxAgentId = 0L;
List<SalaryAcctResultPO> salaryAcctResultsOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
List<ExcelAcctResultPO> excelAcctResultsOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
for (int j = 0; j < headers.size(); j++) {
String header = headers.get(j);
String dataKey = header;
if (dataKey == null) {
continue;
}
String dataValue = (String) map.getOrDefault(dataKey.toString(), "");
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
usernameIndex = j;
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
excelComments.add(errorMessageMap);
//salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"), i, i, j, j);
} else {
employeeId = salaryEmployeeMap.getOrDefault(dataValue, 0L);
if (employeeId == null || employeeId <= 0) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"), i, i, j, j);
}
}
} else if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), dataKey.toString())) {
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102839, "个税扣缴义务人不能为空")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102839, "个税扣缴义务人不能为空"), i, i, j, j);
} else {
taxAgentId = taxAgentNameMap.getOrDefault(dataValue, 0L);
if (taxAgentId == null || taxAgentId <= 0) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人"), i, i, j, j);
}
}
} else {
Long salaryItemId = salaryItemMap.get(dataKey.toString());
if (salaryItemId == null || salaryItemId <= 0) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次核算所用账套不包含该薪资项目")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102841, "表头错误,本次核算所用账套不包含该薪资项目"), i, i, j, j);
} else {
excelSalaryItemIds.add(salaryItemId);
if (StringUtils.equals("importExcelAcctResult", importType)) {
ExcelAcctResultPO excelAcctResult = ExcelAcctResultPO.builder()
// .id(IdGenerator.generate())
.salaryAcctRecordId(salaryAcctRecordPO.getId())
.salarySobId(salaryAcctRecordPO.getSalarySobId())
.salaryItemId(salaryItemId)
.resultValue(dataValue)
.creator(currentEmployeeId)
.createTime(now)
.updateTime(now)
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
excelAcctResultsOfOneEmp.add(excelAcctResult);
}
if (StringUtils.equals("importSalaryAcctResult", importType)) {
SalaryAcctResultPO salaryAcctResult = SalaryAcctResultPO.builder()
// .id(IdGenerator.generate())
.salaryAcctRecordId(salaryAcctRecordPO.getId())
.salarySobId(salaryAcctRecordPO.getSalarySobId())
.salaryItemId(salaryItemId)
.resultValue(dataValue)
.creator(currentEmployeeId)
.createTime(now)
.updateTime(now)
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
salaryAcctResultsOfOneEmp.add(salaryAcctResult);
}
}
}
// 如果是线下对比如果个税扣缴义务人+人员目前不在核算人员里面不支持导入
if (StringUtils.equals("importExcelAcctResult", importType)
&& (employeeId != null && employeeId > 0)
&& (taxAgentId != null && taxAgentId > 0)
&& i == data.size() - 1
&& !salaryAcctEmployeeMap.containsKey(employeeId + "-" + taxAgentId)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "本次薪资核算不包含该人员")));
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102842, "本次薪资核算不包含该人员"), i, i, usernameIndex, usernameIndex);
}
}
// 每处理50个数据更新一次进度
index++;
// if (index % 50 == 0 || index >= total) {
// salaryBatchService.sendImportRate(message.getBizId(), total, index);
// }
if (isError) {
failCount++;
errorDatas.add(map);
continue;
}
SalaryAcctEmployeePO salaryAcctEmployee = salaryAcctEmployeeMap.get(employeeId + "-" + taxAgentId);
Long salaryAcctEmpId = Optional.ofNullable(salaryAcctEmployee).map(SalaryAcctEmployeePO::getId).orElse(0L);
if (StringUtils.equals("importExcelAcctResult", importType)) {
for (ExcelAcctResultPO excelAcctResultPO : excelAcctResultsOfOneEmp) {
excelAcctResultPO.setEmployeeId(employeeId);
excelAcctResultPO.setTaxAgentId(taxAgentId);
excelAcctResultPO.setSalaryAcctEmpId(salaryAcctEmpId);
}
excelAcctResults.addAll(excelAcctResultsOfOneEmp);
}
if (StringUtils.equals("importSalaryAcctResult", importType)) {
if (salaryAcctEmpId <= 0) {
SalaryAcctEmployeePO acctEmployee = SalaryAcctEmployeePO.builder()
// .id(IdGenerator.generate())
.employeeId(employeeId)
.salaryAcctRecordId(salaryAcctRecordId)
.salarySobId(salaryAcctRecordPO.getSalarySobId())
.salaryMonth(salaryAcctRecordPO.getSalaryMonth())
.taxAgentId(taxAgentId)
.creator(currentEmployeeId)
.createTime(now)
.updateTime(now)
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
newSalaryAcctEmployees.add(acctEmployee);
salaryAcctEmpId = acctEmployee.getId();
}
for (SalaryAcctResultPO salaryAcctResultPO : salaryAcctResultsOfOneEmp) {
salaryAcctResultPO.setEmployeeId(employeeId);
salaryAcctResultPO.setTaxAgentId(taxAgentId);
salaryAcctResultPO.setSalaryAcctEmpId(salaryAcctEmpId);
}
salaryAcctEmpIds.add(salaryAcctEmpId);
salaryAcctResults.addAll(salaryAcctResultsOfOneEmp);
}
successCount++;
}
// 如果sheet包含错误数据
// if (CollectionUtils.isNotEmpty(errorDatas)) {
// salaryBatchService.createErrorExcelSheet(headers, errorDatas, excelSheet.getName(), excelComments, errorExcelSheets);
// }
// if (StringUtils.equals("importExcelAcctResult", importType)) {
// getSalaryComparisonResultService(user).deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
// if (CollectionUtils.isNotEmpty(excelAcctResults)) {
// getSalaryComparisonResultService(user).batchSave(excelAcctResults);
// }
// }
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
// if (CollectionUtils.isNotEmpty(salaryAcctEmpIds)) {
// getSalaryAcctResultService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, excelSalaryItemIds);
// }
// if (CollectionUtils.isNotEmpty(salaryAcctResults)) {
// getSalaryAcctResultService(user).batchSave(salaryAcctResults);
// }
// if (CollectionUtils.isNotEmpty(newSalaryAcctEmployees)) {
// getSalaryAcctEmployeeService(user).batchSave(newSalaryAcctEmployees);
// }
// }
// // 发送导入回调信息
if (StringUtils.equals("importExcelAcctResult", importType)) {
getSalaryComparisonResultService(user).deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
if (CollectionUtils.isNotEmpty(excelAcctResults)) {
getSalaryComparisonResultService(user).batchSave(excelAcctResults);
}
}
if (StringUtils.equals("importSalaryAcctResult", importType)) {
if (CollectionUtils.isNotEmpty(salaryAcctEmpIds)) {
getSalaryAcctResultService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, excelSalaryItemIds);
}
if (CollectionUtils.isNotEmpty(salaryAcctResults)) {
getSalaryAcctResultService(user).batchSave(salaryAcctResults);
}
if (CollectionUtils.isNotEmpty(newSalaryAcctEmployees)) {
getSalaryAcctEmployeeService(user).batchSave(newSalaryAcctEmployees);
}
}
apidatas.put("successCount", successCount);
apidatas.put("errorCount", failCount);
apidatas.put("errorData", excelComments);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
// 发送导入回调信息
// salaryBatchService.sendImportCallBackInfo(message, successCount, failCount, errorExcelSheets);
// }
//
return apidatas;
}
// @Override
// public Map<String, Object> exportCheckResult(
// SalaryCheckResultExportParam exportParam,

View File

@ -8,6 +8,7 @@ import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
@ -58,7 +59,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private SalaryAcctResultService salaryAcctResultService;
private SalaryAcctResultService getSalaryAcctResultService(User user) {
return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
}
// private SalaryCheckResultService salaryCheckResultService;
//
@ -306,7 +310,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
//todo 删除薪资核算人员
// getSalaryAcctEmployeeService(user).deleteBySalaryAcctRecordIds(ids);
// // 删除薪资核算结果
// salaryAcctResultService.deleteBySalaryAcctRecordIds(ids);
// getSalaryAcctResultService(user).deleteBySalaryAcctRecordIds(ids);
// // 删除校验异常
// salaryCheckResultService.deleteBySalaryAcctRecordIds(ids);
// // 删除校验异常明细
@ -349,11 +353,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
// if (CollectionUtils.isNotEmpty(salaryCheckResultPOS)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98784, "核算结果尚未通过校验规则,请确认是否需要忽略校验异常后再归档"));
// }
//todo 查询薪资核算结果
// List<SalaryAcctResultPO> salaryAcctResultPOS = salaryAcctResultService.listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
// if (CollectionUtils.isEmpty(salaryAcctResultPOS)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99691, "尚未核算,请先核算后再归档"));
// }
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
if (CollectionUtils.isEmpty(salaryAcctResultPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99691, "尚未核算,请先核算后再归档"));
}
// 更新薪资核算记录的状态
salaryAcctRecordPO.setStatus(SalaryAcctRecordStatusEnum.ARCHIVED.getValue());
salaryAcctRecordPO.setUpdateTime(new Date());

View File

@ -181,6 +181,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 薪资核算结果的分页结果
PageInfo<Map<String, Object>> resultPage = new PageInfo<>();
resultPage.setList(data);
resultPage.setTotal(page.getTotal());
resultPage.setPageNum(page.getPageNum());
resultPage.setPageSize(page.getPageSize());
return resultPage;
}

View File

@ -181,7 +181,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
@Override
public XSSFWorkbook exportList( SalaryArchiveQueryParam queryParam) {
public XSSFWorkbook exportList(SalaryArchiveQueryParam queryParam) {
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "薪资档案");
// 获取所有可被引用的薪资项目
@ -389,7 +389,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
/**
* 导入薪资档案
*/
public void importSalaryArchive(SalaryArchiveImportHandleParam param) {
public Map<String,Object> importSalaryArchive(SalaryArchiveImportHandleParam param) {
//1参数校验
vaildImportParam(param);
@ -435,7 +435,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 错误sheet数据
List<Map<String, Object>> errorData = new ArrayList<>();
// 错误提示
List<Map<String, Object>> excelComments = new ArrayList<>();
List<Map<String, String>> excelComments = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
@ -461,6 +461,13 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 4.数据入库处理
handleImportData(isInit, importHandleParam);
Map<String,Object> apidatas = new HashMap<>();
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorNotice", excelComments);
return apidatas;
} finally {
IOUtils.closeQuietly(fileInputStream);
}
@ -569,7 +576,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
* @param initImportData
* @param importHandleParam
*/
private Map<String, Object> validInitImportData(boolean isError, int rowNo, Map<String, Object> map, List<Map<String, Object>> excelComments, int errorCount, int successCount, List<Map<String, Object>> errorData, List<SalaryArchiveInitImportDTO> initImportData, SalaryArchiveImportHandleParam importHandleParam) {
private Map<String, Object> validInitImportData(boolean isError, int rowNo, Map<String, Object> map, List<Map<String, String>> excelComments, int errorCount, int successCount, List<Map<String, Object>> errorData, List<SalaryArchiveInitImportDTO> initImportData, SalaryArchiveImportHandleParam importHandleParam) {
Long employeeId = Long.valueOf(Optional.ofNullable(map.get("employeeId")).orElse("0").toString());
Optional<SalaryArchiveInitImportDTO> optionalInitImport = initImportData.stream().filter(f -> f.getEmployeeId().equals(employeeId)).findFirst();
@ -596,6 +603,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
sames.forEach(e -> {
if (!e.isError()) {
e.setError(Boolean.TRUE);
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", "该员工的薪资档案记录有误,请检查");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(101723, "该员工的薪资档案记录有误,请检查"), finalErrorCount.get() + 1, finalErrorCount.get() + 1, 0, 0);
finalErrorCount.addAndGet(1);
errorData.add(e.getRow());
@ -618,6 +628,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
sames.forEach(e -> {
if (!e.isError()) {
e.setError(Boolean.TRUE);
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", "该员工的薪资档案记录有误");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(101723, "该员工的薪资档案记录有误,请检查"), finalErrorCount.get() + 1, finalErrorCount.get() + 1, 0, 0);
finalErrorCount.addAndGet(1);
errorData.add(e.getRow());
@ -664,7 +677,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
* @return
*/
private boolean singleRowCheck(String importType, List<Long> allEmployeeIds, Map<String, Object> map, List<String> headers, int effectiveTimeIndex,
List<Map<String, Object>> excelComments, int errorCount, SalaryArchiveImportHandleParam importHandleParam) {
List<Map<String, String>> excelComments, int errorCount, SalaryArchiveImportHandleParam importHandleParam) {
boolean isError = false;
boolean isInit = importType.equals(SalaryArchiveImportTypeEnum.INIT.getValue());
@ -729,6 +742,28 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 调整原因列判空(调薪或调整个税扣缴义务人)
|| (adjustReasonI18n.equals(key) && (isTaxAgentAdjust || isSalaryItemAdjust)));
// 判空
if (userNameI18n.equals(key) && StringUtils.isEmpty(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", key + "不能为空");
excelComments.add(errorMessageMap);
}
// 个税扣缴义务人列判空(初始化导入或调整个税扣缴义务人)
if ((taxAgentI18n.equals(key) && (isInit || isTaxAgentAdjust)) && StringUtils.isEmpty(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", key + "不能为空");
excelComments.add(errorMessageMap);
}
if (effectiveTimeI18n.equals(key) && StringUtils.isEmpty(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", key + "不能为空");
excelComments.add(errorMessageMap);
}
// 调整原因列判空(调薪或调整个税扣缴义务人)
if ((adjustReasonI18n.equals(key) && (isTaxAgentAdjust || isSalaryItemAdjust)) && StringUtils.isEmpty(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", key + "不能为空");
excelComments.add(errorMessageMap);
}
if (isEmpty) {
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100577, "不能为空"), errorCount + 1, errorCount + 1, j, j);
isError = true;
@ -736,13 +771,22 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 1.姓名列处理
if (!isEmpty && userNameI18n.equals(key)) {
if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100578, "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"), errorCount + 1, errorCount + 1, j, j);
isError = true;
} else if (employeeId == null) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","姓名错误,系统内不存在该姓名");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"), errorCount + 1, errorCount + 1, j, j);
isError = true;
// (调薪或调整个税扣缴义务人)
} else if (finalSalaryArchive == null && (isTaxAgentAdjust || isSalaryItemAdjust)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","该人员的薪资档案不存在,请先初始化");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(101653, "该人员的薪资档案不存在,请先初始化"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
@ -751,10 +795,16 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
isError = handleTaxAgent(isError, isInit, effectiveTimeIndex, excelComments, errorCount, j, taxAgentId, effectiveTime, finalSalaryArchive, adjustReason, importHandleParam);
// 3.生效时间处理
} else if (!isEmpty && effectiveTimeI18n.equals(key) && effectiveTime == null) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","生效日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102497, "生效日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'"), errorCount + 1, errorCount + 1, j, j);
isError = true;
// 4.调整原因列处理(调薪或调整个税扣缴义务人)
} else if (!isEmpty && adjustReasonI18n.equals(key) && (isTaxAgentAdjust || isSalaryItemAdjust) && StringUtils.isEmpty(adjustReason)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整原因不存在");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100591, "调整原因不存在"), errorCount + 1, errorCount + 1, j, j);
isError = true;
// 5.薪资项目列处理(初始化导入或调薪)
@ -811,7 +861,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
* @return
*/
private boolean handleTaxAgent(boolean isError, boolean isInit, int effectiveTimeIndex,
List<Map<String, Object>> excelComments, int errorCount, int j,
List<Map<String, String>> excelComments, int errorCount, int j,
Long taxAgentId, Date effectiveTime, SalaryArchivePO finalSalaryArchive, String taxAgentAdjustReason, SalaryArchiveImportHandleParam importHandleParam) {
if (taxAgentId == null) {
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在"), errorCount + 1, errorCount + 1, j, j);
@ -835,35 +885,56 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
Date currentEffectiveTime = effectiveTaxAgent.getEffectiveTime();
// 1.1 如果早于<当前已生效
if (effectiveTime.before(currentEffectiveTime)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","生效日期不可早于当前已生效的调整日期");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"), errorCount + 1, errorCount + 1, effectiveTimeIndex, effectiveTimeIndex);
isError = true;
isBeforeError = true;
// 1.2 如果等于当前已生效
} else if (effectiveTime.equals(currentEffectiveTime)) {
if (effectiveBeforeTaxAgent != null && effectiveBeforeTaxAgent.getTaxAgentId().equals(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整前后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","与未生效的调整后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
// 1.3 如果>已经生效且<=今天
} else if (effectiveTime.after(currentEffectiveTime) && !effectiveTime.after(importHandleParam.getToday())) {
if (effectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整前后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","与未生效的调整后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
// 1.4 如果>今天
} else if (effectiveTime.after(importHandleParam.getToday()) && effectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整前后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
} else if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","与未生效的调整后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
@ -910,7 +981,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
* @return
*/
private boolean handleSalaryItem(boolean isError, boolean isInit, int effectiveTimeIndex,
List<Map<String, Object>> excelComments, int errorCount, int j,
List<Map<String, String>> excelComments, int errorCount, int j,
Date effectiveTime, SalaryArchivePO finalSalaryArchive, String salaryItemAdjustReason, SalaryArchiveImportHandleParam importHandleParam,
String key, String cellVal, Map<String, Object> map) {
Optional<SalaryItemPO> optionalSalaryItem = importHandleParam.getSalaryItems().stream().filter(e -> e.getName().equals(key)).findFirst();
@ -934,35 +1005,56 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
Date currentEffectiveTime = effectiveSalaryItem.getEffectiveTime();
// 1.1 如果早于<当前已生效
if (effectiveTime.before(currentEffectiveTime)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","生效日期不可早于当前已生效的调整日期");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"), errorCount + 1, errorCount + 1, effectiveTimeIndex, effectiveTimeIndex);
isError = true;
isBeforeError = true;
// 1.2 如果等于当前已生效
} else if (effectiveTime.equals(currentEffectiveTime)) {
if (effectiveBeforeSalaryItem != null && effectiveBeforeSalaryItem.getItemValue().equals(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整前后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","与未生效的调整后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
// 1.3 如果>已经生效且<=今天
} else if (effectiveTime.after(currentEffectiveTime) && !effectiveTime.after(importHandleParam.getToday())) {
if (effectiveSalaryItem.getItemValue().equals(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整前后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","与未生效的调整后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
// 1.4 如果>今天
} else if (effectiveTime.after(importHandleParam.getToday()) && effectiveSalaryItem.getItemValue().equals(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","调整前后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}
} else if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message","与未生效的调整后不可相同");
excelComments.add(errorMessageMap);
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
isError = true;
}

View File

@ -43,6 +43,30 @@ public class SalaryFormItemUtil {
}
/**
* checkbox
* @param user
* @param colSpan
* @param fieldcol
* @param viewAttr
* @param isQuickSearch
* @param label
* @param name
* @return
*/
public static SearchConditionItem checkboxItem(User user, int colSpan, int fieldcol,
int viewAttr, boolean isQuickSearch, String label,String name) {
ConditionFactory conditionFactory = new ConditionFactory(user);
SearchConditionItem checkbox = conditionFactory.createCondition(ConditionType.CHECKBOX,502327,name);
checkbox.setColSpan(colSpan);
checkbox.setFieldcol(fieldcol);
checkbox.setViewAttr(viewAttr);
checkbox.setIsQuickSearch(isQuickSearch);
checkbox.setLabel(label);
return checkbox;
}
/**
* 输入框数字
* @param user

View File

@ -12,6 +12,11 @@ import java.util.List;
@ToString
public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
Class<T> clazz;
public void setColumns(List<Column> columns) {
this.columns.addAll(columns);
}
List<Column> columns = new ArrayList<>();
List<DataSource> dataSource = new ArrayList<>();
@ -20,6 +25,7 @@ public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
public PageInfo(Class<T> clazz) {
this.clazz = clazz;
this.columns = buildColumns();
}
public PageInfo(List<T> list) {
@ -29,12 +35,13 @@ public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
public PageInfo(List<T> list, Class<T> clazz) {
super(list);
this.clazz = clazz;
this.columns = buildColumns();
}
public List<Column> getColumns() {
public List<Column> buildColumns() {
if(clazz==null){
return new ArrayList<>();
return this.columns;
}
Field[] fields = clazz.getDeclaredFields();
for (Field f : fields) {

View File

@ -3,9 +3,12 @@ package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SIAccountWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.HrmUserVarify;
@ -17,6 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -33,6 +37,9 @@ public class SIAccountController {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
public SIAccountWrapper getSIAccountWrapper(User user) {
return ServiceUtil.getService(SIAccountWrapper.class,user);
}
/**
* 获取台账列表页
*
@ -56,7 +63,7 @@ public class SIAccountController {
* @param insuranceAccountDetailParam
* @return
*/
@GET
@POST
@Path("/detail/common/list")
@Produces(MediaType.APPLICATION_JSON)
public String commonList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@ -73,7 +80,7 @@ public class SIAccountController {
* @param insuranceAccountDetailParam
* @return
*/
@GET
@POST
@Path("/detail/common/search")
@Produces(MediaType.APPLICATION_JSON)
public String commonByNameList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@ -90,7 +97,7 @@ public class SIAccountController {
* @param insuranceAccountDetailParam
* @return
*/
@GET
@POST
@Path("/detail/supplementary/list")
@Produces(MediaType.APPLICATION_JSON)
public String listSupplementaryPage(@Context HttpServletRequest request, @Context HttpServletResponse response,
@ -107,7 +114,7 @@ public class SIAccountController {
* @param insuranceAccountDetailParam
* @return
*/
@GET
@POST
@Path("/detail/supplementary/search")
@Produces(MediaType.APPLICATION_JSON)
public String supplementaryByNameList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@ -193,12 +200,14 @@ public class SIAccountController {
}
// @GetMapping("commonForm")
// @ApiOperation("正常缴纳添加缴纳人员表单")
// @WeaPermission
// public WeaResult<WeaForm> queryCommonForm() {
// return siAccountWrapper.getCommonForm(UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
@GET
@Path("/commonForm")
@Produces(MediaType.APPLICATION_JSON)
public String queryCommonForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::getCommonForm, ParamUtil.request2Map(request));
}
@POST
@Path("/common/save")
@ -210,12 +219,13 @@ public class SIAccountController {
}
// @GetMapping("querySupplementaryForm")
// @ApiOperation("补缴添加缴纳人员表单")
// @WeaPermission
// public WeaResult<WeaForm> querySupplementaryForm() {
// return siAccountWrapper.getSupplementaryForm(UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
@GET
@Path("/querySupplementaryForm")
@Produces(MediaType.APPLICATION_JSON)
public String querySupplementaryForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::getSupplementaryForm, ParamUtil.request2Map(request));
}
@POST
@ -257,7 +267,7 @@ public class SIAccountController {
return new ResponseResult<AccountParam, String>().run(getService(user)::file, accountParam);
}
@GET
@POST
@Path("/changeList")
@Produces(MediaType.APPLICATION_JSON)
public String changeList(@Context HttpServletRequest request, @Context HttpServletResponse response,
@ -267,13 +277,15 @@ public class SIAccountController {
}
// @GetMapping("overView")
// @ApiOperation("总览")
// @WeaPermission
// public WeaResult<WeaTable<InsuranceAccountViewListDTO>> overView(@RequestParam(value = "billMonth") String billMonth) {
// return siAccountWrapper.overView(billMonth, UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
//
@POST
@Path("/overView")
@Produces(MediaType.APPLICATION_JSON)
public String overView(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<InsuranceAccountDetailParam, PageInfo<InsuranceAccountViewListDTO>>().run(getService(user)::overView, insuranceAccountDetailParam);
}
@GET
@Path("/tabList")
@ -284,7 +296,7 @@ public class SIAccountController {
return new ResponseResult<String, InsuranceAccountTabDTO>().run(getService(user)::tabList, billMonth);
}
@GET
@POST
@Path("/inspectList")
@Produces(MediaType.APPLICATION_JSON)
public String getInspectTable(@Context HttpServletRequest request, @Context HttpServletResponse response,
@ -334,4 +346,5 @@ public class SIAccountController {
return new ResponseResult<String, Map<String, Boolean>>().run(getService(user)::buttonCheck, billMonth);
}
}

View File

@ -0,0 +1,168 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.biz.SIAccountBiz;
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.wrapper.SIExportWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIExportController {
public SIAccountService getService(User user) {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
public SIExportWrapper getSIExportWrapper(User user) {
return ServiceUtil.getService(SIExportWrapper.class,user);
}
@POST
@Path("/archives/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceArchivesListParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIExportWrapper(user).export(param);
String time = LocalDate.now().toString();
String fileName = "福利档案报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@POST
@Path("/archives/exportInspect")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportInspect(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InspectAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
SIAccountBiz siAccountBiz = new SIAccountBiz();
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = siAccountBiz.allInspects(param.getIds(), param.getBillMonth());
InsuranceArchivesListParam req = new InsuranceArchivesListParam();
req.setEmployeeIds(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getEmployeeId).distinct().collect(Collectors.toList()));
XSSFWorkbook workbook = getSIExportWrapper(user).export(req);
String time = LocalDate.now().toString();
String fileName = "核算异常人员档案报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@POST
@Path("/common/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportAccount(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceExportParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIExportWrapper(user).exportAccount(PaymentStatusEnum.COMMON.getValue(),param);
String time = LocalDate.now().toString();
String fileName = "正常缴纳核算报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@POST
@Path("/supplementary/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportSupplementary(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceExportParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIExportWrapper(user).exportAccount(PaymentStatusEnum.REPAIR.getValue(),param);
String time = LocalDate.now().toString();
String fileName = "补缴核算报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@POST
@Path("/overView/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportOverView(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceExportParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIExportWrapper(user).exportOverView(param);
String time = LocalDate.now().toString();
String fileName = "总览报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
}

View File

@ -1,7 +1,10 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryacct.dto.*;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctImportFieldDTO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctResultDetailDTO;
import com.engine.salary.entity.salaryacct.param.*;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
@ -89,7 +92,7 @@ public class SalaryAcctController {
@Produces(MediaType.APPLICATION_JSON)
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Map<String,Object>>().run(getSalaryAcctRecordWrapper(user)::getForm, id);
return new ResponseResult<Long, Map<String, Object>>().run(getSalaryAcctRecordWrapper(user)::getForm, id);
}
//获取薪资核算的薪资周期考勤周期等
@ -424,6 +427,23 @@ public class SalaryAcctController {
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
//导入核算结果
@POST
@Path("/acctresult/importSalaryAcctResult")
@Produces(MediaType.APPLICATION_JSON)
public String importSalaryAcctResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctImportParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctImportParam, Map<String, Object>>().run(getSalaryAcctExcelService(user)::importSalaryAcctResult, param);
}
@POST
@Path("/acctresult/preview")
@Produces(MediaType.APPLICATION_JSON)
public String importSalaryAcctResultPreview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctImportParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctImportParam, Map<String, Object>>().run(getSalaryAcctExcelService(user)::preview, param);
}
// **********************************薪资核算结果 end*********************************/
// **********************************检验异常 start*********************************/
@ -591,7 +611,7 @@ public class SalaryAcctController {
public Response exportComparisonResultTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryComparisonResultExportParam param = new SalaryComparisonResultExportParam();
String salaryAcctRecordId = request.getParameter("salaryAcctRecordId");
if(StringUtils.isNotBlank(salaryAcctRecordId)){
if (StringUtils.isNotBlank(salaryAcctRecordId)) {
param.setSalaryAcctRecordId(Long.parseLong(salaryAcctRecordId));
}
@ -612,5 +632,22 @@ public class SalaryAcctController {
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
//导入线下核算结果
@POST
@Path("/comparisonresult/importExcelAcctResult/preview")
@Produces(MediaType.APPLICATION_JSON)
public String importExcelAcctResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctImportParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctImportParam, Map<String, Object>>().run(getSalaryAcctExcelService(user)::preview, param);
}
@POST
@Path("/comparisonresult/preview")
@Produces(MediaType.APPLICATION_JSON)
public String importExcelAcctResultPreview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctImportParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctImportParam, Map<String, Object>>().run(getSalaryAcctExcelService(user)::preview, param);
}
/**********************************线下对比 end*********************************/
}

View File

@ -176,7 +176,7 @@ public class SalaryArchiveController {
SalaryArchiveImportTypeEnum importTypeEnum = SalaryArchiveImportTypeEnum.parseByValue(queryParam.getImportType());
String fileName = "薪资档案导入模板-" + importTypeEnum.getDefaultLabel();
String fileName = "薪资档案导入模板-" + importTypeEnum.getDefaultLabel() + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
@ -240,6 +240,7 @@ public class SalaryArchiveController {
return new ResponseResult<SalaryArchiveImportHandleParam, Map<String, Object>>().run(getSalaryArchiveWrapper(user)::preview, importParam);
}
//导入
@POST
@Path("/importSalaryArchive")
@Produces(MediaType.APPLICATION_JSON)
@ -254,7 +255,7 @@ public class SalaryArchiveController {
@Produces(MediaType.APPLICATION_JSON)
public String searchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SingleTaxAgentAdjustRecordQueryParam, Map<String,Object>>().run(getSalaryArchiveWrapper(user)::searchCondition);
return new ResponseResult<SingleTaxAgentAdjustRecordQueryParam, Map<String, Object>>().run(getSalaryArchiveWrapper(user)::searchCondition);
}
// ******** 薪资档案主表 end ***********************************************************************************************/

View File

@ -1,6 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salarysob.dto.*;
import com.engine.salary.entity.salarysob.param.*;
@ -206,7 +207,7 @@ public class SalarySobController {
@Produces(MediaType.APPLICATION_JSON)
public String listSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryItemSearchParam, Map<String, Object>>().run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam);
return new ResponseResult<SalaryItemSearchParam, PageInfo<SalaryItemListDTO> >().run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam);
}

View File

@ -0,0 +1,20 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.service.SIExportService;
import com.engine.salary.service.impl.SIExportServiceImpl;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIAccountWrapper extends Service {
}

View File

@ -0,0 +1,44 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.SIExportService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.service.impl.SIExportServiceImpl;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIExportWrapper extends Service {
public SIExportService getSIExportService(User user) {
return ServiceUtil.getService(SIExportServiceImpl.class, user);
}
public SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class, user);
}
public XSSFWorkbook exportOverView(InsuranceExportParam param) {
return getSIExportService(user).exportOverView(param);
}
public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) {
return getSIExportService(user).exportAccount(paymentStatus,param);
}
public XSSFWorkbook export(InsuranceArchivesListParam param) {
return getSIArchivesService(user).export(param);
}
}

View File

@ -263,8 +263,8 @@ public class SalaryArchiveWrapper extends Service {
return getSalaryArchiveService(user).preview(param);
}
public void importSalaryArchive(SalaryArchiveImportHandleParam param) {
getSalaryArchiveService(user).importSalaryArchive(param);
public Map<String,Object> importSalaryArchive(SalaryArchiveImportHandleParam param) {
return getSalaryArchiveService(user).importSalaryArchive(param);
}
public XSSFWorkbook exportList(SalaryArchiveQueryParam queryParam) {

View File

@ -1,13 +1,14 @@
package com.engine.salary.wrapper;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
@ -15,12 +16,15 @@ import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.SalarySobItemGroupService;
import com.engine.salary.service.SalarySobItemService;
import com.engine.salary.service.impl.SalaryFormulaServiceImpl;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
import com.engine.salary.service.impl.SalarySobItemGroupServiceImpl;
import com.engine.salary.service.impl.SalarySobItemServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Component;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.lang.reflect.Field;
@ -50,7 +54,9 @@ public class SalarySobItemWrapper extends Service {
}
private SalaryFormulaService salaryFormulaService;
private SalaryFormulaService getSalaryFormulaService(User user) {
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
/**
* 薪资账套可选薪资项目列表
@ -58,59 +64,60 @@ public class SalarySobItemWrapper extends Service {
* @param queryParam 列表查询条件
* @return
*/
public Map<String, Object> listPage4SalaryItem(SalaryItemSearchParam queryParam) {
SalaryWeaTable<SalaryItemListDTO> table = new SalaryWeaTable<SalaryItemListDTO>(user, SalaryItemListDTO.class);
String fields = " t.id" +
" , t.name" +
" , t.code" +
" , t.system_type" +
" , t.sys_salary_item_id" +
" , t.category" +
" , t.item_type as itemType" +
" , t.use_default as useDefault" +
" , t.use_in_employee_salary as useInEmployeeSalary" +
" , t.rounding_mode as roundingMode" +
" , t.pattern" +
" , t.value_type as valueType" +
" , t.datasource" +
" , t.formula_id" +
" , t.description" +
" , t.can_edit" +
" , t.can_delete";
String from = "from hrsa_salary_item t";
table.setBackfields(fields);
table.setSqlform(from);
table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(queryParam));
table.setSqlorderby("t.id DESC");
table.setSqlprimarykey("t.id");
table.setSqlisdistinct("false");
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
public PageInfo<SalaryItemListDTO> listPage4SalaryItem(SalaryItemSearchParam queryParam) {
// SalaryWeaTable<SalaryItemListDTO> table = new SalaryWeaTable<SalaryItemListDTO>(user, SalaryItemListDTO.class);
//
// String fields = " t.id" +
// " , t.name" +
// " , t.code" +
// " , t.system_type" +
// " , t.sys_salary_item_id" +
// " , t.category" +
// " , t.item_type as itemType" +
// " , t.use_default as useDefault" +
// " , t.use_in_employee_salary as useInEmployeeSalary" +
// " , t.rounding_mode as roundingMode" +
// " , t.pattern" +
// " , t.value_type as valueType" +
// " , t.datasource" +
// " , t.formula_id" +
// " , t.description" +
// " , t.can_edit" +
// " , t.can_delete";
//
// String from = "from hrsa_salary_item t";
//
// table.setBackfields(fields);
// table.setSqlform(from);
// table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(queryParam));
// table.setSqlorderby("t.id DESC");
// table.setSqlprimarykey("t.id");
// table.setSqlisdistinct("false");
//
// WeaResultMsg result = new WeaResultMsg(false);
// result.putAll(table.makeDataResult());
// result.success();
// return result.getResultMap();
// // 分页查询薪资项目
// Page<SalaryItemPO> page = salaryItemService.listPageByParam(queryParam);
// Page<SalaryItemListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
// if (CollectionUtils.isNotEmpty(page.getRecords())) {
// // 查询公式
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalaryItemPO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 转换成薪资项目列表dto
// dtoPage.setRecords(SalaryItemBO.convert2ListDTO(page.getRecords(), expressFormulas));
// }
// // 构建前端所需的数据格式
// WeaTable<SalaryItemListDTO> weaTable = SalaryFormatUtil.<SalaryItemListDTO>getInstance().buildTable(SalaryItemListDTO.class, dtoPage);
// // 列表可勾选但是不需要操作列
// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX);
// weaTable.setOperates(Collections.emptyList());
// weaTable.setOperatesPermission(Collections.emptyList());
// return weaTable;
// 分页查询薪资项目
PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(queryParam);
List<SalaryItemPO> salaryItemList = page.getList();
//最终返回的分页对象
PageInfo<SalaryItemListDTO> dtoPage = new PageInfo<>(SalaryItemListDTO.class);
dtoPage.setPageSize(page.getPageSize());
dtoPage.setPageNum(page.getPageNum());
dtoPage.setTotal(page.getTotal());
if (CollectionUtils.isNotEmpty(salaryItemList)) {
// 查询公式
Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getFormulaId);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 转换成薪资项目列表dto
dtoPage.setList(SalaryItemBO.convert2ListDTO(salaryItemList, expressFormulas));
}
return dtoPage;
}