Merge branch 'feature/acct' into develop

# Conflicts:
#	src/com/engine/salary/entity/salaryformula/dto/SalaryFormulaEmployeeDTO.java
#	src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java
This commit is contained in:
钱涛 2022-04-14 20:49:24 +08:00
commit 941a34990f
53 changed files with 2241 additions and 637 deletions

View File

@ -0,0 +1,7 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/formula")
public class SalaryFormulaController extends com.engine.salary.web.SalaryFormulaController {
}

View File

@ -1,12 +1,13 @@
package com.engine.salary.constant;
/**
* @description: 薪酬管理公式编辑器的常量
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/24/21 5:51 PM
* @version:v1.0
*/
* 薪酬管理公式编辑器的常量
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryFormulaFieldConstant {
// 公式变量的所属模块

View File

@ -1,46 +0,0 @@
package com.engine.salary.entity.formula;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.weaver.excel.formula.api.entity.ExpressFormulaSourceLink;
import com.weaver.excel.formula.api.entity.FormulaVar;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ExpressFormula {
@JsonSerialize(
using = ToStringSerializer.class
)
private Long id;
//名称
private String name;
private String module;
private String parameter;
private Long userId;
private Integer status;
private String msgFormula;
private String msgParameter;
private Date addTime;
private Date lastUpdate;
private Integer isDelete;
private Long formId;
private int type;
private String tenantKey;
private DataCollectionEmployee creator;
private List<ExpressFormulaSourceLink> sourceLinks;
//引用类型
private String referenceType;
//返回类型
private String returnType;
//公式内容
private String formula;
private boolean showInLibrary;
private String codeFormula;
private String msgCodeFormula;
private List<FormulaVar> parameters;
private List<FormulaVar> msgParameters;
}

View File

@ -1,16 +1,13 @@
package com.engine.salary.entity.salaryacct.bo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.salary.constant.SalaryFormulaFieldConstant;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.enums.SalaryFormulaReferenceEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Maps;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.excel.formula.api.entity.FormulaVar;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -18,17 +15,17 @@ import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @description: 薪资核算公式
* @author: xiajun
* @modified By: xiajun
* @date: Created in 6/2/22 10:33 PM
* @version:v1.0
*/
* 薪资核算公式
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class ExpressFormulaBO {
/**
@ -53,17 +50,7 @@ public class ExpressFormulaBO {
}
Map<Long, List<FormulaVar>> resultMap = Maps.newHashMapWithExpectedSize(expressFormulas.size());
for (ExpressFormula expressFormula : expressFormulas) {
if (StringUtils.isEmpty(expressFormula.getParameter())) {
continue;
}
JSONObject paramJson = JSON.parseObject(expressFormula.getParameter());
if (paramJson != null) {
JSONArray paramArray = paramJson.getJSONArray("formulavars");
if (paramArray != null) {
List<FormulaVar> formulaVars = paramArray.toJavaList(FormulaVar.class);
resultMap.put(expressFormula.getId(), formulaVars);
}
}
resultMap.put(expressFormula.getId(), expressFormula.getParameters());
}
return resultMap;
}
@ -106,25 +93,15 @@ public class ExpressFormulaBO {
*/
public static List<FormulaVar> buildFormulaVar4Accounting(ExpressFormula expressFormula, Map<String, String> formulaVarValueMap) {
List<FormulaVar> formulaVars = Collections.emptyList();
// 公式异常
if (Objects.isNull(expressFormula) || StringUtils.isEmpty(expressFormula.getParameter())) {
return Collections.emptyList();
}
JSONObject paramJson = JSON.parseObject(expressFormula.getParameter());
if (paramJson != null) {
JSONArray paramArray = paramJson.getJSONArray("formulavars");
if (paramArray != null) {
formulaVars = paramArray.toJavaList(FormulaVar.class);
for (FormulaVar formulaVar : formulaVars) {
// 公式变量的值
String formulaVarValue = formulaVarValueMap.getOrDefault(formulaVar.getFieldId(), StringUtils.EMPTY);
// 如果公式的返回值类型为number公式中的变量的值如果为空公式运行的时候会报错所以需要替换成0
if (StringUtils.isEmpty(formulaVarValue) && "number".equals(expressFormula.getReturnType())) {
formulaVarValue = BigDecimal.ZERO.toPlainString();
}
formulaVar.setContent(formulaVarValue);
}
formulaVars = expressFormula.getParameters();
for (FormulaVar formulaVar : formulaVars) {
// 公式变量的值
String formulaVarValue = formulaVarValueMap.getOrDefault(formulaVar.getFieldId(), StringUtils.EMPTY);
// 如果公式的返回值类型为number公式中的变量的值如果为空公式运行的时候会报错所以需要替换成0
if (StringUtils.isEmpty(formulaVarValue) && "number".equals(expressFormula.getReturnType())) {
formulaVarValue = BigDecimal.ZERO.toPlainString();
}
formulaVar.setContent(formulaVarValue);
}
return formulaVars;
}

View File

@ -1,13 +1,13 @@
package com.engine.salary.entity.salaryacct.bo;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,6 +1,8 @@
package com.engine.salary.entity.salaryacct.bo;
import com.engine.salary.constant.SalaryFormulaFieldConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.enums.SalaryFormulaReferenceEnum;
@ -9,8 +11,6 @@ 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 com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.excel.formula.api.entity.FormulaVar;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -24,12 +24,13 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @description: 薪资核算-薪资项目运算优先级
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2/7/22 2:49 PM
* @version:v1.0
*/
* 薪资核算-薪资项目运算优先级
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryAcctCalculatePriorityBO {
/**

View File

@ -22,10 +22,7 @@ import java.util.Collection;
@AllArgsConstructor
public class SalaryAcctCalculateParam {
/**
* 不是employeeId而是salaryAcctEmpId
*/
//核算人员的id")
//核算人员的id,不是employeeId而是salaryAcctEmpId
private Collection<Long> ids;
@DataCheck(require = true,message = "参数错误薪资核算记录ID不能为空")

View File

@ -5,15 +5,17 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Date;
/**
* @description: 线下excel核算的结果
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/14/21 2:33 PM
* @version:v1.0
*/
* 线下excel核算的结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@ -79,10 +81,13 @@ public class ExcelAcctResultPO {
/**
* 创建时间
*/
private LocalDateTime createTime;
private Date createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
private Date updateTime;
//条件
private Collection<Long> salaryAcctEmpIds;
}

View File

@ -0,0 +1,70 @@
package com.engine.salary.entity.salaryformula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ExpressFormula {
/**
* id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 备注
*/
private String description;
/**
* 模块
*/
private String module;
/**
* 用途
*/
private String use;
/**
* 引用类型
*/
private String referenceType;
/**
* 返回类型
*/
private String returnType;
/**
* 校验类型
*/
private String validateType;
/**
* 扩展参数
*/
private String extendParam;
/**
* 公式内容
*/
private String formula;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除0否1是
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private List<FormulaVar> parameters;
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.salaryformula.bo;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
@ -9,12 +9,13 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* @description: 薪酬管理公式
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/7/21 5:49 PM
* @version:v1.0
*/
* 薪酬管理公式
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryFormulaBO {
public static List<ExpressFormulaDTO> convert2DTO(List<ExpressFormula> expressFormulas) {

View File

@ -19,12 +19,12 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class ExpressFormulaDTO {
//公式idTaxAgent
//公式id
private Long id;
//公式名称TaxAgent
//公式名称
private String name;
//公式表达式TaxAgent
//公式表达式
private String formula;
}

View File

@ -22,43 +22,43 @@ public class SalaryFormulaEmployeeDTO {
private Long employeeId;
@SalaryFormulaVar(defaultLabel ="个税扣缴义务人", labelId = 86184, dataType = "string")
@SalaryFormulaVar(defaultLabel = "个税扣缴义务人", labelId = 86184, dataType = "string")
private String taxAgentName;
@SalaryFormulaVar(defaultLabel ="姓名", labelId = 85429, dataType = "string")
@SalaryFormulaVar(defaultLabel = "姓名", labelId = 85429, dataType = "string")
private String username;
@SalaryFormulaVar(defaultLabel ="邮件", labelId = 92919, dataType = "string")
@SalaryFormulaVar(defaultLabel = "邮件", labelId = 92919, dataType = "string")
private String email;
@SalaryFormulaVar(defaultLabel ="手机", labelId = 98621, dataType = "string")
@SalaryFormulaVar(defaultLabel = "手机", labelId = 98621, dataType = "string")
private String mobile;
@SalaryFormulaVar(defaultLabel ="电话", labelId = 98620, dataType = "string")
@SalaryFormulaVar(defaultLabel = "电话", labelId = 98620, dataType = "string")
private String telephone;
// //证件号码", labelId = 86318, dataType = "string")
// @SalaryFormulaVar(defaultLabel = "证件号码", labelId = 86318, dataType = "string")
// private String idNo;
@SalaryFormulaVar(defaultLabel ="性别", labelId = 98622, dataType = "string")
@SalaryFormulaVar(defaultLabel = "性别", labelId = 98622, dataType = "string")
private String sex;
@SalaryFormulaVar(defaultLabel ="状态", labelId = 91075, dataType = "string")
@SalaryFormulaVar(defaultLabel = "状态", labelId = 91075, dataType = "string")
private String status;
@SalaryFormulaVar(defaultLabel ="部门", labelId = 86185, dataType = "string")
@SalaryFormulaVar(defaultLabel = "部门", labelId = 86185, dataType = "string")
private String departmentName;
@SalaryFormulaVar(defaultLabel ="岗位", labelId = 90633, dataType = "string")
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "string")
private String positionName;
@SalaryFormulaVar(defaultLabel ="职级", labelId = 98623, dataType = "string")
@SalaryFormulaVar(defaultLabel = "职级", labelId = 98623, dataType = "string")
private String gradeName;
@SalaryFormulaVar(defaultLabel ="入职日期", labelId = 86319, dataType = "string")
@SalaryFormulaVar(defaultLabel = "入职日期", labelId = 86319, dataType = "string")
private String hireDate;
@SalaryFormulaVar(defaultLabel ="出生日期", labelId = 98624, dataType = "string")
@SalaryFormulaVar(defaultLabel = "出生日期", labelId = 98624, dataType = "string")
private String birthday;
// //首次参加工作日期", labelId = 98625, dataType = "string")

View File

@ -8,12 +8,13 @@ import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @description: 薪资公式计算器-个税税率表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/30/21 5:03 PM
* @version:v1.0
*/
* 薪资公式计算器-个税税率表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor

View File

@ -0,0 +1,29 @@
package com.engine.salary.entity.salaryformula.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Map;
/**
* 公式字段查询参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryFormulaFieldQueryParam {
@DataCheck(require = true,message = "变量来源不可为空")
String sourceId;
Map<String, Object> extendParam;
}

View File

@ -0,0 +1,62 @@
package com.engine.salary.entity.salaryformula.param;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.util.valid.DataCheck;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryFormulaSaveParam {
/**
* id
*/
@DataCheck(require = true,message = "主键为空",runtime = RuntimeTypeEnum.UPDATE)
private Long id;
/**
* 名称
*/
private String name;
/**
* 备注
*/
private String description;
/**
* 模块
*/
private String module;
/**
* 用途
*/
private String useFor;
/**
* 引用类型
*/
private String referenceType;
/**
* 返回类型
*/
private String returnType;
/**
* 校验类型
*/
private String validateType;
/**
* 扩展参数
*/
private String extendParam;
/**
* 公式内容
*/
private String formula;
private List<FormulaVar> parameters;
}

View File

@ -0,0 +1,75 @@
package com.engine.salary.entity.salaryformula.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FormulaPO {
/**
* id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 备注
*/
private String description;
/**
* 模块
*/
private String module;
/**
* 用途
*/
private String useFor;
/**
* 引用类型
*/
private String referenceType;
/**
* 返回类型
*/
private String returnType;
/**
* 校验类型
*/
private String validateType;
/**
* 扩展参数
*/
private String extendParam;
/**
* 公式内容
*/
private String formula;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除0否1是
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
//主键id集合
private Collection<Long> ids;
}

View File

@ -0,0 +1,67 @@
package com.engine.salary.entity.salaryformula.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FormulaVar {
/**
* id
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 公式id
*/
private Long formulaId;
/**
* 字段id
*/
private String fieldId;
/**
* 字段名称
*/
private String fieldName;
/**
* 字段类型number,string
*/
private String fieldType;
/**
* 来源
*/
private String source;
/**
* 排序
*/
private Integer orderIndex;
/**
* 创建人
*/
private Long creator;
/**
* 是否删除,0否1是
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
//
private String content;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryitem.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
@ -11,21 +12,22 @@ import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.conn.util.IdGenerator;
import java.util.*;
import java.util.stream.Collectors;
/**
* @description: 薪资项目
* @author: xiajun
* @modified By: xiajun
* @date: Created in 10/28/21 4:55 PM
* @version:v1.0
*/
* 薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryItemBO {
@ -165,7 +167,7 @@ public class SalaryItemBO {
// long id = IdGenerator.generate();
SalaryItemPO salaryItemPO = SalaryItemPO.builder()
// .id(id)
// .code(String.valueOf(id))
.code(IdGenerator.getUUID())
.name(saveParam.getName())
.systemType(SalarySystemTypeEnum.CUSTOM.getValue())
.sysSalaryItemId(NumberUtils.LONG_ZERO)
@ -175,7 +177,7 @@ public class SalaryItemBO {
.pattern(Optional.ofNullable(saveParam.getPattern()).orElse(2))
.valueType(saveParam.getValueType())
.dataType(saveParam.getDataType())
.formulaId(saveParam.getValueType() == SalaryValueTypeEnum.FORMULA.getValue() ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
.formulaId(Objects.equals(saveParam.getValueType(), SalaryValueTypeEnum.FORMULA.getValue()) ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
.description(saveParam.getDescription())
.canEdit(NumberUtils.INTEGER_ONE)
.creator(employeeId)

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
@ -8,7 +9,6 @@ import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -17,7 +17,6 @@ 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 com.weaver.excel.formula.api.entity.ExpressFormula;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -134,7 +133,7 @@ public class SalarySobItemAggregateBO {
if (CollectionUtils.isEmpty(salarySobEmpFields)) {
return Collections.emptyList();
}
Field[] declaredFields = DataCollectionEmployee.class.getDeclaredFields();
Field[] declaredFields = SalaryFormulaEmployeeDTO.class.getDeclaredFields();
Map<String, String> empFieldMap = Maps.newHashMapWithExpectedSize(declaredFields.length);
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class)) {

View File

@ -4,38 +4,39 @@ package com.engine.salary.enums;
import java.util.Objects;
/**
* @description: 薪资项目公式引用分类
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/1/21 10:16 AM
* @version:v1.0
*/
public enum SalaryFormulaReferenceEnum implements BaseEnum<Integer> {
* 薪资项目公式引用分类
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryFormulaReferenceEnum implements BaseEnum<String> {
SALARY_ITEM(1, "薪资项目", 84960),
// SALARY_ITEM_OF_HISTORY(2, "历史台账薪资项目", 85364),
EMPLOYEE_INFO(3, "员工基本信息", 85366),
SALARY_ARCHIVES(4, "薪资档案", 85368),
ATTEND(5, "考勤引用", 85367),
ADD_UP_SITUATION(6, "往期累计情况", 104412),
ADD_UP_DEDUCTIONS(7, "累计专项附加扣除", 85380),
WELFARE(8, "社保福利", 87522),
OTHER_DEDUCTION(9, "其他免税扣除", 93849),
SALARY_ITEM("salaryItem", "薪资项目", 84960),
// SALARY_ITEM_OF_HISTORY("salaryItemOfHistory", "历史台账薪资项目", 85364),
EMPLOYEE_INFO("employeeInfo", "员工基本信息", 85366),
SALARY_ARCHIVES("salaryArchives", "薪资档案", 85368),
ATTEND("attend", "考勤引用", 85367),
ADD_UP_SITUATION("addUpSituation", "往期累计情况", 104412),
ADD_UP_DEDUCTIONS("addUpDeductions", "累计专项附加扣除", 85380),
WELFARE("welfare", "社保福利", 87522),
OTHER_DEDUCTION("otherDeduction", "其他免税扣除", 93849),
;
private int value;
private String value;
private String defaultLabel;
private int labelId;
SalaryFormulaReferenceEnum(int value, String defaultLabel, int labelId) {
SalaryFormulaReferenceEnum(String value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
@Override
public Integer getValue() {
public String getValue() {
return value;
}
@ -51,7 +52,7 @@ public enum SalaryFormulaReferenceEnum implements BaseEnum<Integer> {
public static SalaryFormulaReferenceEnum parseByValue(String value) {
for (SalaryFormulaReferenceEnum referenceEnum : SalaryFormulaReferenceEnum.values()) {
if (Objects.equals(referenceEnum.getValue() + "", value)) {
if (Objects.equals(referenceEnum.getValue(), value)) {
return referenceEnum;
}
}

View File

@ -5,12 +5,13 @@ import java.util.Arrays;
import java.util.Objects;
/**
* @description: 字段类型
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/1/21 4:35 PM
* @version:v1.0
*/
* 字段类型
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryValueTypeEnum implements BaseEnum<Integer> {
INPUT(1, "输入", 84976),

View File

@ -6,12 +6,13 @@ import java.util.Arrays;
import java.util.Objects;
/**
* @description: 薪资项目的字段类型
* @author: xiajun
* @modified By: xiajun
* @date: 2022/3/10 17:16
* @version:v1.0
*/
* 薪资项目的字段类型
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryDataTypeEnum implements BaseEnum<String> {
STRING("string", "字符", 105093),
NUMBER("number", "数值", 87625),

View File

@ -22,6 +22,8 @@ alter table hrsa_salary_archive_item modify id bigint auto_increment;
alter table hrsa_salary_acct_record modify id bigint auto_increment;
alter table hrsa_salary_acct_emp modify id bigint auto_increment;
alter table hrsa_acct_result_temp modify id bigint auto_increment;
alter table hrsa_formula modify id bigint auto_increment;
alter table hrsa_formula_var modify id bigint auto_increment;
--

View File

@ -0,0 +1,60 @@
package com.engine.salary.mapper.formula;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface FormulaMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<FormulaPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<FormulaPO> listSome(FormulaPO formula);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
FormulaPO getById(Long id);
/**
* 新增忽略null字段
*
* @param formula 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(FormulaPO formula);
/**
* 修改忽略null字段
*
* @param formula 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(FormulaPO formula);
/**
* 删除记录
*
* @param formula 待删除的记录
* @return 返回影响行数
*/
int delete(FormulaPO formula);
List<FormulaPO> listByIds(@Param("ids")Collection<Long> ids);
}

View File

@ -0,0 +1,302 @@
<?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.formula.FormulaMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryformula.po.FormulaPO">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="description" property="description"/>
<result column="module" property="module"/>
<result column="use_for" property="useFor"/>
<result column="reference_type" property="referenceType"/>
<result column="return_type" property="returnType"/>
<result column="validate_type" property="validateType"/>
<result column="extend_param" property="extendParam"/>
<result column="formula" property="formula"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.name
, t.description
, t.module
, t.use_for
, t.reference_type
, t.return_type
, t.validate_type
, t.extend_param
, t.formula
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="name != null">
AND name = #{name}
</if>
<if test="description != null">
AND description = #{description}
</if>
<if test="module != null">
AND module = #{module}
</if>
<if test="useFor != null">
AND use_for = #{useFor}
</if>
<if test="referenceType != null">
AND reference_type = #{referenceType}
</if>
<if test="returnType != null">
AND return_type = #{returnType}
</if>
<if test="validateType != null">
AND validate_type = #{validateType}
</if>
<if test="extendParam != null">
AND extend_param = #{extendParam}
</if>
<if test="formula != null">
AND formula = #{formula}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_formula
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="module != null">
module,
</if>
<if test="useFor != null">
use_for,
</if>
<if test="referenceType != null">
reference_type,
</if>
<if test="returnType != null">
return_type,
</if>
<if test="validateType != null">
validate_type,
</if>
<if test="extendParam != null">
extend_param,
</if>
<if test="formula != null">
formula,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="name != null">
#{name},
</if>
<if test="description != null">
#{description},
</if>
<if test="module != null">
#{module},
</if>
<if test="useFor != null">
#{useFor},
</if>
<if test="referenceType != null">
#{referenceType},
</if>
<if test="returnType != null">
#{returnType},
</if>
<if test="validateType != null">
#{validateType},
</if>
<if test="extendParam != null">
#{extendParam},
</if>
<if test="formula != null">
#{formula},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
UPDATE hrsa_formula
<set>
name=#{name},
description=#{description},
module=#{module},
use_for=#{useFor},
reference_type=#{referenceType},
return_type=#{returnType},
validate_type=#{validateType},
extend_param=#{extendParam},
formula=#{formula},
creator=#{creator},
delete_type=#{deleteType},
create_time=#{createTime},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
UPDATE hrsa_formula
<set>
<if test="name != null">
name=#{name},
</if>
<if test="description != null">
description=#{description},
</if>
<if test="module != null">
module=#{module},
</if>
<if test="useFor != null">
use_for=#{useFor},
</if>
<if test="referenceType != null">
reference_type=#{referenceType},
</if>
<if test="returnType != null">
return_type=#{returnType},
</if>
<if test="validateType != null">
validate_type=#{validateType},
</if>
<if test="extendParam != null">
extend_param=#{extendParam},
</if>
<if test="formula != null">
formula=#{formula},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.salaryformula.po.FormulaPO">
UPDATE hrsa_formula
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<!-- 查询全部 -->
<select id="listByIds" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@ -0,0 +1,49 @@
package com.engine.salary.mapper.formula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import java.util.List;
public interface FormulaVarMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<FormulaVar> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<FormulaVar> listSome(FormulaVar formulaVar);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
FormulaVar getById(Long id);
/**
* 新增忽略null字段
*
* @param formulaVar 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(FormulaVar formulaVar);
/**
* 修改忽略null字段
*
* @param formulaVar 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(FormulaVar formulaVar);
void deleteByFormulaId(Long formulaId);
}

View File

@ -0,0 +1,226 @@
<?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.formula.FormulaVarMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryformula.po.FormulaVar">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="formula_id" property="formulaId"/>
<result column="field_id" property="fieldId"/>
<result column="field_name" property="fieldName"/>
<result column="field_type" property="fieldType"/>
<result column="source" property="source"/>
<result column="order_index" property="orderIndex"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.name
, t.formula_id
, t.field_id
, t.field_name
, t.field_type
, t.source
, t.order_index
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula_var t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula_var t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar">
SELECT
<include refid="baseColumns"/>
FROM hrsa_formula_var t
WHERE delete_type = 0
<if test="name != null">
AND name = #{name}
</if>
<if test="formulaId != null">
AND formula_id = #{formulaId}
</if>
<if test="fieldId != null">
AND field_id = #{fieldId}
</if>
<if test="fieldName != null">
AND field_name = #{fieldName}
</if>
<if test="fieldType != null">
AND field_type = #{fieldType}
</if>
<if test="source != null">
AND source = #{source}
</if>
<if test="orderIndex != null">
AND order_index = #{orderIndex}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_formula_var
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
name,
</if>
<if test="formulaId != null">
formula_id,
</if>
<if test="fieldId != null">
field_id,
</if>
<if test="fieldName != null">
field_name,
</if>
<if test="fieldType != null">
field_type,
</if>
<if test="source != null">
source,
</if>
<if test="orderIndex != null">
order_index,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name},
</if>
<if test="formulaId != null">
#{formulaId},
</if>
<if test="fieldId != null">
#{fieldId},
</if>
<if test="fieldName != null">
#{fieldName},
</if>
<if test="fieldType != null">
#{fieldType},
</if>
<if test="source != null">
#{source},
</if>
<if test="orderIndex != null">
#{orderIndex},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar">
UPDATE hrsa_formula_var
<set>
<if test="name != null">
name=#{name},
</if>
<if test="formulaId != null">
formula_id=#{formulaId},
</if>
<if test="fieldId != null">
field_id=#{fieldId},
</if>
<if test="fieldName != null">
field_name=#{fieldName},
</if>
<if test="fieldType != null">
field_type=#{fieldType},
</if>
<if test="source != null">
source=#{source},
</if>
<if test="orderIndex != null">
order_index=#{orderIndex},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<delete id="deleteByFormulaId" parameterType="com.engine.salary.entity.salaryformula.po.FormulaVar">
UPDATE hrsa_formula_var
SET delete_type=1
WHERE formula_id = #{formulaId}
AND delete_type = 0
</delete>
</mapper>

View File

@ -0,0 +1,54 @@
package com.engine.salary.mapper.salaryacct;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* 线下excel核算的结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface ExcelAcctResultMapper {
/**
* 分页查询ExcelAcctResult和SalaryAcctResult的employeeId
*
* @return
*/
List<Long> listEmployeeIdUnionSalaryAcctResult(@Param("employeeIds") Collection<Long> employeeIds,
@Param("salaryAcctRecordId") Long salaryAcctRecordId);
/**
* 批量新增
*
* @param excelAcctResults
*/
void batchInsert(@Param("collection") Collection<ExcelAcctResultPO> excelAcctResults);
/**
* 根据薪资核算记录id删除
*
* @param salaryAcctEmployeeIds
*/
void deleteBySalaryAcctEmployeeIds(@Param("salaryAcctEmployeeIds") Collection<Long> salaryAcctEmployeeIds);
/**
* 根据薪资核算记录id删除
*
* @param salaryAcctRecordIds
*/
void deleteBySalaryAcctRecordIds(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctRecordIds);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<ExcelAcctResultPO> listSome(ExcelAcctResultPO excelAcctResult);
}

View File

@ -0,0 +1,194 @@
<?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.salaryacct.ExcelAcctResultMapper">
<select id="listEmployeeIdUnionSalaryAcctResult" resultType="long">
SELECT DISTINCT employee_id
FROM hrsa_salary_acct_result
WHERE salary_acct_record_id = #{salaryAcctRecordId}
<if test="employeeIds != null and employeeIds.size() > 0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
UNION
SELECT DISTINCT employee_id
FROM hrsa_excel_acct_result
WHERE salary_acct_record_id = #{salaryAcctRecordId}
<if test="employeeIds != null and employeeIds.size() > 0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
<insert id="batchInsert">
INSERT INTO hrsa_excel_acct_result(salary_sob_id, salary_acct_emp_id, salary_acct_record_id, employee_id,
salary_item_id, result_value, creator, create_time, update_time,
delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.salaryAcctEmpId},
#{item.salaryAcctRecordId},
#{item.employeeId},
#{item.salaryItemId},
#{item.resultValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_excel_acct_result(salary_sob_id, salary_acct_emp_id, salary_acct_record_id, employee_id,
salary_item_id, result_value, creator, create_time, update_time,
delete_type, tenant_key)
<foreach collection="collection" item="item" separator="union all">
select
#{item.salarySobId},
#{item.salaryAcctEmpId},
#{item.salaryAcctRecordId},
#{item.employeeId},
#{item.salaryItemId},
#{item.resultValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
INSERT INTO hrsa_excel_acct_result( salary_sob_id, salary_acct_emp_id, salary_acct_record_id, employee_id,
salary_item_id, result_value, creator, create_time, update_time,
delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.salaryAcctEmpId},
#{item.salaryAcctRecordId},
#{item.employeeId},
#{item.salaryItemId},
#{item.resultValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<delete id="deleteBySalaryAcctEmployeeIds">
DELETE FROM hrsa_excel_acct_result
WHERE salary_acct_emp_id IN
<foreach collection="salaryAcctEmployeeIds" open="(" item="salaryAcctEmployeeId" separator="," close=")">
#{salaryAcctEmployeeId}
</foreach>
</delete>
<delete id="deleteBySalaryAcctRecordIds">
DELETE FROM hrsa_excel_acct_result
WHERE salary_acct_record_id IN
<foreach collection="salaryAcctRecordIds" open="(" item="salaryAcctRecordId" separator="," close=")">
#{salaryAcctRecordId}
</foreach>
</delete>
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO">
<result column="id" property="id" />
<result column="salary_sob_id" property="salarySobId" />
<result column="salary_acct_emp_id" property="salaryAcctEmpId" />
<result column="salary_acct_record_id" property="salaryAcctRecordId" />
<result column="employee_id" property="employeeId" />
<result column="salary_item_id" property="salaryItemId" />
<result column="result_value" property="resultValue" />
<result column="creator" property="creator" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
<result column="tax_agent_id" property="taxAgentId" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.salary_sob_id
, t.salary_acct_emp_id
, t.salary_acct_record_id
, t.employee_id
, t.salary_item_id
, t.result_value
, t.creator
, t.create_time
, t.update_time
, t.delete_type
, t.tenant_key
, t.tax_agent_id
</sql>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_excel_acct_result t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="salaryAcctEmpId != null">
AND salary_acct_emp_id = #{salaryAcctEmpId}
</if>
<if test="salaryAcctRecordId != null">
AND salary_acct_record_id = #{salaryAcctRecordId}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="salaryItemId != null">
AND salary_item_id = #{salaryItemId}
</if>
<if test="resultValue != null">
AND result_value = #{resultValue}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="salaryAcctEmpIds != null and salaryAcctEmpIds.size()>0">
AND salary_acct_emp_id IN
<foreach collection="salaryAcctEmpIds" open="(" item="salaryAcctEmpId" separator="," close=")">
#{salaryAcctEmpId}
</foreach>
</if>
ORDER BY id DESC
</select>
</mapper>

View File

@ -1,6 +1,7 @@
package com.engine.salary.service;
import com.weaver.excel.formula.api.entity.FormulaVar;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import java.util.List;
import java.util.Map;
@ -12,6 +13,9 @@ public interface RemoteExcelService {
List<FormulaVar> fieldList(String sourceId, Map<String, Object> extendParam);
List<Map<String,Object>> fieldGroupList(Map<String, Object> extendParam);
// ExcelPage<FormulaDataSource> dataSourceList(String categoryId, ExcelPage<FormulaDataSource> page, Map<String, Object> extendParam, SimpleEmployee employee);
//
// List<FormulaVar> findProperData(String dataId, String fieldId, String fieldType, Map<String, Object> extendParam, SimpleEmployee employee);

View File

@ -60,14 +60,14 @@ public interface SalaryAcctExcelService {
*/
XSSFWorkbook exportImportTemplate(SalaryAcctImportTemplateParam param);
// /**
// * 薪资核算线下对比结果导出
// *
// * @param queryParam
// * @return
// */
// XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam);
//
/**
* 薪资核算线下对比结果导出
*
* @param queryParam
* @return
*/
XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam);
// /**
// * 薪资核算线下对比结果导入模板导出
// *

View File

@ -8,12 +8,13 @@ import java.util.Collection;
import java.util.List;
/**
* @description: 薪资核算的线下对比结果
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/20/22 7:00 PM
* @version:v1.0
*/
* 薪资核算的线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalaryComparisonResultService {
/**

View File

@ -1,17 +1,19 @@
package com.engine.salary.service;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import java.util.Collection;
import java.util.List;
/**
* @description: 薪酬管理公式编辑器
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/7/21 5:38 PM
* @version:v1.0
*/
* 薪酬管理公式编辑器
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalaryFormulaService {
/**
@ -26,8 +28,11 @@ public interface SalaryFormulaService {
* 根据公式id获取公式内容
*
* @param formulaId
* @param tenantKey
* @return
*/
ExpressFormula getExpressFormula(Long formulaId);
void save(SalaryFormulaSaveParam salaryFormulaSaveParam);
void update(SalaryFormulaSaveParam salaryFormulaSaveParam);
}

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.formula.DataType;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaTaxRateDTO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -22,7 +23,6 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import com.weaver.excel.formula.api.entity.FormulaVar;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -130,6 +130,16 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
return vars;
}
@Override
public List<Map<String, Object>> fieldGroupList(Map<String, Object> extendParam) {
return Arrays.stream(SalaryFormulaReferenceEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put("key", e.getValue());
map.put("value", SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()));
return map;
}).collect(Collectors.toList());
}
// @Override
// public ExcelPage<FormulaDataSource> dataSourceList(String categoryId, ExcelPage<FormulaDataSource> page, Map<String, Object> extendParam, SimpleEmployee employee) {
// log.info("categoryId: {}, page: {}", categoryId, JsonUtil.toJsonString(page));
@ -218,7 +228,7 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
private List<FormulaVar> salaryItem2FormulaVar(SalaryFormulaReferenceEnum referenceEnum, Map<String, Object> extendParam) {
Set<Long> salaryItemIds = Collections.emptySet();
Object salarySobId = extendParam.get("salarySobId");
Object salarySobId = extendParam == null ? null : extendParam.get("salarySobId");
if (Objects.nonNull(salarySobId)) {
List<SalarySobItemPO> salarySobItems = getSalarySobItemService(user).listBySalarySobId(Long.valueOf(String.valueOf(salarySobId)));
salaryItemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId);
@ -233,12 +243,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
.map(e -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + e.getCode());
formulaVar.setTitle(e.getName());
formulaVar.setFormId("" + referenceEnum.getValue());
formulaVar.setDataType(DataType.NUMBER);
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setProperKey(DataType.NUMBER);
formulaVar.setProperKey(e.getDataType());
formulaVar.setName(e.getName());
formulaVar.setSource("" + referenceEnum.getValue());
formulaVar.setFieldType(e.getDataType());
return formulaVar;
}).collect(Collectors.toList());
@ -258,13 +265,11 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
} else {
formulaVar.setFieldId(annotation.fieldId());
}
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setTitle(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel()));
formulaVar.setFormId(formId);
formulaVar.setDataType(annotation.dataType());
formulaVar.setProperKey(DataType.NUMBER);
formulaVar.setName(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel()));
formulaVar.setSource(formId);
formulaVar.setFieldType(annotation.dataType());
if (StringUtils.equals(formId, "" + SalaryFormulaReferenceEnum.EMPLOYEE_INFO.getValue())) {
formulaVar.setProperKey(DataType.STRING);
formulaVar.setSource(DataType.STRING);
}
formulaVars.add(formulaVar);
}
@ -279,12 +284,12 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
List<FormulaVar> formulaVars = Lists.newArrayListWithExpectedSize(welfareColumns.size());
welfareColumns.forEach((k, v) -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + v);
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setTitle(k);
formulaVar.setFormId("" + referenceEnum.getValue());
formulaVar.setDataType(DataType.NUMBER);
formulaVar.setProperKey(DataType.NUMBER);
// formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + v);
// formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
// formulaVar.setTitle(k);
// formulaVar.setFormId("" + referenceEnum.getValue());
// formulaVar.setDataType(DataType.NUMBER);
// formulaVar.setProperKey(DataType.NUMBER);
formulaVars.add(formulaVar);
});
return formulaVars;
@ -298,11 +303,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
List<FormulaVar> formulaVars = fields.stream().map(e -> {
FormulaVar formulaVar = new FormulaVar();
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + e.getId());
formulaVar.setModule(SalaryFormulaFieldConstant.MODULE);
formulaVar.setTitle(e.getFieldName());
formulaVar.setFormId("" + referenceEnum.getValue());
formulaVar.setDataType(DataType.NUMBER);
formulaVar.setProperKey(DataType.NUMBER);
formulaVar.setName(e.getFieldName());
formulaVar.setSource("" + referenceEnum.getValue());
formulaVar.setFieldType(DataType.NUMBER);
return formulaVar;
}).collect(Collectors.toList());
return formulaVars;

View File

@ -9,6 +9,8 @@ import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteDataDTO;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryacct.bo.*;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
@ -22,8 +24,6 @@ import com.engine.salary.enums.SalaryFormulaReferenceEnum;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.excel.formula.api.entity.FormulaVar;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

View File

@ -9,13 +9,16 @@ import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
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.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctImportTemplateParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.SalaryValueTypeEnum;
@ -74,9 +77,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
// }
// private SalaryComparisonResultService getSalaryComparisonResultService(User user) {
// return (SalaryComparisonResultService) ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user);
// }
private SalaryComparisonResultService getSalaryComparisonResultService(User user) {
return (SalaryComparisonResultService) ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user);
}
private TaxAgentBiz taxAgentService = new TaxAgentBiz();
@ -317,76 +320,61 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
//
// @Override
// public XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
// // 查询薪资核算记录
// SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
// if (Objects.isNull(salaryAcctRecordPO)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
// }
// // 查询线下对比结果
// SalaryComparisonResultListDTO salaryComparisonResultListDTO = getSalaryComparisonResultService(user).listByParam(queryParam);
// // 薪资核算线下对比结果列表表头
// List<String> headerList = Lists.newArrayList();
// // 查询薪资核算所用的薪资账套的员工信息字段
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// Set<String> employeeFieldCodeSet = SalaryEntityUtil.properties(salarySobEmpFieldPOS, SalarySobEmpFieldPO::getFieldCode);
// // 查询薪资项目
// List<SalaryItemPO> salaryItemPOS = getSalarySobItemService(user).listBySalarySobId4SalaryItem(salaryAcctRecordPO.getSalarySobId());
// Set<String> salaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, salaryItemPO -> "" + salaryItemPO.getId());
// for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// // 员工信息字段
// if (employeeFieldCodeSet.contains(weaTableColumn.getDataIndex())) {
// headerList.add(weaTableColumn.getTitle());
// }
// // 薪资项目的表头
// if (salaryItemIds.contains(weaTableColumn.getDataIndex())) {
// headerList.add(weaTableColumn.getTitle() + " (线上值)");
// headerList.add(weaTableColumn.getTitle() + " (线下值)");
// }
// }
// String[] headers = headerList.toArray(new String[0]);
//
// List<Map<String, Object>> resultMapList = salaryComparisonResultListDTO.getData().getRecords();
// // excel导出的数据
// List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
// for (Map<String, Object> map : resultMapList) {
// List<Object> row = Lists.newArrayList();
// for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// // 员工信息字段的值
// if (employeeFieldCodeSet.contains(weaTableColumn.getDataIndex())) {
// row.add(map.get(weaTableColumn.getDataIndex()));
// }
// // 薪资项目的值
// if (salaryItemIds.contains(weaTableColumn.getDataIndex())) {
// Map tempMap = (Map) map.getOrDefault(weaTableColumn.getDataIndex(), Collections.emptyMap());
// row.add(tempMap.get("acctResultValue"));
// row.add(tempMap.get("excelResultValue"));
// }
// }
// rows.add(row);
// }
//
// ExcelSheetData excelSheetData = new ExcelSheetData();
// excelSheetData.setSheetName("线下对比结果");
// excelSheetData.setHeaders(Collections.singletonList(headers));
// excelSheetData.setRows(rows);
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
// .fileName("线下对比结果")
// .dataType("线下对比结果")
// .function(excelExportParam.getFunction())
// .handlerName("comparisonResultHandler")
// .flag(true)
// .bizId(String.valueOf(excelExportParam.getBiz()))
// .module(excelExportParam.getModule())
// .userId(simpleEmployee.getEmployeeId())
// .tenantKey(tenantKey)
// .operator(simpleEmployee.getUsername())
// .eteamsId(eteamsId)
// .build();
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
// }
@Override
public XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 查询线下对比结果
SalaryComparisonResultListDTO salaryComparisonResultListDTO = getSalaryComparisonResultService(user).listByParam(queryParam);
// 薪资核算线下对比结果列表表头
List<Object> headerList = Lists.newArrayList();
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
Set<String> employeeFieldCodeSet = SalaryEntityUtil.properties(salarySobEmpFieldPOS, SalarySobEmpFieldPO::getFieldCode);
// 查询薪资项目
List<SalaryItemPO> salaryItemPOS = getSalarySobItemService(user).listBySalarySobId4SalaryItem(salaryAcctRecordPO.getSalarySobId());
Set<String> salaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, salaryItemPO -> "" + salaryItemPO.getId());
for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// 员工信息字段
if (employeeFieldCodeSet.contains(weaTableColumn.getColumn())) {
headerList.add(weaTableColumn.getText());
}
// 薪资项目的表头
if (salaryItemIds.contains(weaTableColumn.getColumn())) {
headerList.add(weaTableColumn.getText() + " (线上值)");
headerList.add(weaTableColumn.getText() + " (线下值)");
}
}
List<Map<String, Object>> resultMapList = salaryComparisonResultListDTO.getData().getList();
// excel导出的数据
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
List<Object> row = Lists.newArrayList();
for (WeaTableColumn weaTableColumn : salaryComparisonResultListDTO.getWeaTableColumns()) {
// 员工信息字段的值
if (employeeFieldCodeSet.contains(weaTableColumn.getColumn())) {
row.add(map.get(weaTableColumn.getColumn()));
}
// 薪资项目的值
if (salaryItemIds.contains(weaTableColumn.getColumn())) {
Map tempMap = (Map) map.getOrDefault(weaTableColumn.getColumn(), Collections.emptyMap());
row.add(tempMap.get("acctResultValue"));
row.add(tempMap.get("excelResultValue"));
}
}
rows.add(row);
}
String sheetName = "线下对比结果";
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
//
//
// @Override

View File

@ -6,6 +6,7 @@ import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
@ -39,7 +40,6 @@ import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
@ -95,8 +95,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
// return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
return null;
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
private SalarySobAdjustRuleService getSalarySobAdjustRuleService(User user) {
return (SalarySobAdjustRuleService) ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
@ -390,7 +389,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 8查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
List<ExpressFormula> expressFormulas = Lists.newArrayList();//getSalaryFormulaService(user).listExpressFormula(formulaIds);
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 9计算薪资项目的运算优先级
List<List<Long>> salarySobItemsWithPriority = SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS, salaryItemPOS, expressFormulas);
// 10根据id查询其他合并计税的薪资核算记录
@ -482,6 +481,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// salaryAcctRecordLoggerTemplate.write(loggerContext);
} catch (Exception e) {
log.info("薪资核算出错:{}", e.getMessage(), e);
throw new SalaryRunTimeException(e);
// salaryAcctProgressService.fail("" + calculateParam.getSalaryAcctRecordId(), SalaryI18nUtil.getI18nLabel(99642, "薪资核算出错") + ": " + e.getMessage());
} finally {
// 数据库字段加密用

View File

@ -1,244 +1,257 @@
//package com.engine.salary.service.impl;
//
//import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
//import com.engine.core.impl.Service;
//import com.engine.salary.service.SalaryComparisonResultService;
//import com.google.common.collect.Sets;
//import com.weaver.common.component.table.column.WeaTableColumn;
//import com.weaver.common.component.table.page.Page;
//import com.weaver.common.hrm.service.HrmCommonEmployeeService;
//import com.weaver.excel.formula.api.entity.ExpressFormula;
//import com.weaver.hrm.salary.dao.ExcelAcctResultMapper;
//import com.weaver.hrm.salary.entity.salaryacct.bo.SalaryAcctResultBO;
//import com.weaver.hrm.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
//import com.weaver.hrm.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
//import com.weaver.hrm.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
//import com.weaver.hrm.salary.entity.salaryacct.po.ExcelAcctResultPO;
//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctRecordPO;
//import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctResultPO;
//import com.weaver.hrm.salary.entity.salaryarchive.po.TaxAgentPO;
//import com.weaver.hrm.salary.entity.salaryitem.po.SalaryItemPO;
//import com.weaver.hrm.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
//import com.weaver.hrm.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobEmpFieldPO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobItemGroupPO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobItemPO;
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobPO;
//import com.weaver.hrm.salary.exception.SalaryRunTimeException;
//import com.weaver.hrm.salary.service.*;
//import com.weaver.hrm.salary.util.SalaryEntityUtil;
//import com.weaver.hrm.salary.util.SalaryI18nUtil;
//import com.weaver.hrm.salary.util.SalaryPageUtil;
//import com.weaver.teams.domain.user.SimpleEmployee;
//import org.apache.commons.collections4.CollectionUtils;
//import org.apache.commons.lang3.BooleanUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.commons.lang3.math.NumberUtils;
//
//import java.util.*;
//import java.util.stream.Collectors;
//
///**
// * 薪资核算的线下对比结果
// * <p>Copyright: Copyright (c) 2022</p>
// * <p>Company: 泛微软件</p>
// *
// * @author qiantao
// * @version 1.0
// **/
//public class SalaryComparisonResultServiceImpl extends Service implements SalaryComparisonResultService {
//
//
// private ExcelAcctResultMapper excelAcctResultMapper;
//
// private SalaryAcctResultService salaryAcctResultService;
//
// private SalaryAcctEmployeeService salaryAcctEmployeeService;
//
// private SalarySobItemService salarySobItemService;
//
// private SalaryAcctRecordService salaryAcctRecordService;
//
// private SalarySobEmpFieldService salarySobEmpFieldService;
//
// private HrmCommonEmployeeService hrmCommonEmployeeService;
//
// private TaxAgentService taxAgentService;
//
// private SalaryFormulaService salaryFormulaService;
//
// private SalaryItemService salaryItemService;
//
// private SalarySobService salarySobService;
//
// private SalarySobItemGroupService salarySobItemGroupService;
//
// @Override
// public List<ExcelAcctResultPO> listBySalaryAcctRecordId(Long salaryAcctRecordId, String tenantKey) {
// return new LambdaQueryChainWrapper<>(excelAcctResultMapper)
// .eq(ExcelAcctResultPO::getTenantKey, tenantKey)
// .eq(ExcelAcctResultPO::getDeleteType, 0)
// .eq(ExcelAcctResultPO::getSalaryAcctRecordId, salaryAcctRecordId)
// .list();
// }
//
// @Override
// public List<ExcelAcctResultPO> listBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds, String tenantKey) {
// if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
// return Collections.emptyList();
// }
// return new LambdaQueryChainWrapper<>(excelAcctResultMapper)
// .eq(ExcelAcctResultPO::getTenantKey, tenantKey)
// .eq(ExcelAcctResultPO::getDeleteType, 0)
// .in(ExcelAcctResultPO::getSalaryAcctEmpId, salaryAcctEmployeeIds)
// .list();
// }
//
// @Override
// public SalaryComparisonResultListDTO listPageByParam(SalaryComparisonResultQueryParam queryParam, String tenantKey) {
// return listByParam(true, queryParam, tenantKey);
// }
//
// @Override
// public SalaryComparisonResultListDTO listByParam(SalaryComparisonResultQueryParam queryParam, String tenantKey) {
// return listByParam(false, queryParam, tenantKey);
// }
//
// /**
// * 根据薪资核算人员查询薪资核算线下对比结果
// *
// * @param queryParam 列表查询条件
// * @param tenantKey 租户key
// * @return
// */
// private SalaryComparisonResultListDTO listByParam(boolean needPage, SalaryComparisonResultQueryParam queryParam, String tenantKey) {
// // 查询薪资核算记录
// SalaryAcctRecordPO salaryAcctRecordPO = salaryAcctRecordService.getById(queryParam.getSalaryAcctRecordId(), tenantKey);
// if (Objects.isNull(salaryAcctRecordPO)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
// }
// // 查询薪资核算所用薪资账套
// SalarySobPO salarySobPO = salarySobService.getById(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询薪资核算所用的薪资账套的员工信息字段
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询薪资账套的薪资项目分类
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询薪资核算所用薪资账套的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalarySobId(salaryAcctRecordPO.getSalarySobId(), tenantKey);
// // 查询公式详情
// Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 转换成
// Map<Long, String> expressFormulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
// Map<Long, String> customParameters = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId, salarySobItemPO -> {
// if (salarySobItemPO.getFormulaId() <= 0) {
// return SalaryI18nUtil.getI18nLabel(92004, "输入/导入");
// }
// return expressFormulaMap.getOrDefault(salarySobItemPO.getFormulaId(), StringUtils.EMPTY);
// });
// // 查询薪资项目
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
// List<SalaryItemPO> salaryItemPOS = salaryItemService.listByIds(salaryItemIds, tenantKey);
// // 转换成聚合dto
// SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
// salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
// SalarySobItemAggregateDTO salarySobItemAggregateDTO = salarySobItemAggregateBO.convert2AggregateDTO();
//
// // 薪资核算人员
// List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = salaryAcctEmployeeService.listByResultQueryParam(queryParam, tenantKey);
// if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
// // 构建薪资核算结果列表表头
// List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, Collections.emptySet());
// // 构建列表数据
// Page<Map<String, Object>> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// dtoPage.setTotal(NumberUtils.INTEGER_ZERO);
// dtoPage.setRecords(Collections.emptyList());
// // 返回结果
// return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
// }
// // 薪资核算结果
// List<SalaryAcctResultPO> salaryAcctResultPOS;
// // 线下导入结果
// List<ExcelAcctResultPO> excelAcctResultPOS;
// // 如果薪资核算人员太多利用薪资核算人员id查询薪资核算结果的效率就不太好改为直接用薪资核算记录id查询
// if (salaryAcctEmployeePOS.size() > 1000) {
// // 查询薪资核算结果
// salaryAcctResultPOS = salaryAcctResultService.listBySalaryAcctRecordIds(Collections.singleton(queryParam.getSalaryAcctRecordId()), tenantKey);
// // 查询线下导入结果
// excelAcctResultPOS = listBySalaryAcctRecordId(queryParam.getSalaryAcctRecordId(), tenantKey);
// } else {
// // 薪资核算人员id
// Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
// // 查询薪资核算结果
// salaryAcctResultPOS = salaryAcctResultService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey);
// // 查询线下导入结果
// excelAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey);
// }
//
// // 查询个税扣缴义务人
// Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
// List<TaxAgentPO> taxAgentPOS = taxAgentService.listByIds(taxAgentIds, tenantKey);
// // 查询人员信息
// List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
// List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey);
// // 判断是否存在合并计税
// Set<Long> salaryAcctEmployeeIds4ConsolidatedTax;
// if (StringUtils.isEmpty(queryParam.getConsolidatedTaxation())) {
// salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
// } else {
// SalaryAcctEmployeeQueryParam accEmployeeQueryParam = new SalaryAcctEmployeeQueryParam()
// .setSalaryAcctRecordId(queryParam.getSalaryAcctRecordId())
// .setIds(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId));
// List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = salaryAcctEmployeeService.listByParam4ConsolidatedTax(accEmployeeQueryParam, tenantKey);
// salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);
// }
// // 系统值和线下值不一致的薪资项目id
// Set<Long> includeSalaryItemIds = Sets.newHashSetWithExpectedSize(salaryItemPOS.size());
// // 转换成薪资核算线下对比结果
// List<Map<String, Object>> resultMapList = SalaryAcctResultBO.buildComparisonTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees,
// salaryAcctEmployeePOS, salaryAcctResultPOS, excelAcctResultPOS, taxAgentPOS, customParameters, salaryAcctEmployeeIds4ConsolidatedTax, includeSalaryItemIds);
// // 系统值和线下值一致的人员
// if (queryParam.isOnlyDiffEmployee()) {
// // 过滤系统值和线下值一致的薪资核算人员
// resultMapList = resultMapList.stream()
// .filter(map -> BooleanUtils.toBoolean(String.valueOf(map.get("different"))))
// .collect(Collectors.toList());
// }
// // 分页
// Page<Map<String, Object>> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// dtoPage.setTotal(resultMapList.size());
// if (needPage) {
// dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), resultMapList));
// } else {
// dtoPage.setRecords(resultMapList);
// }
// Set<Long> excludeSalaryItemIds = Sets.newHashSet();
// if (queryParam.isOnlyDiffSalaryItem()) {
// // 过滤系统值和线下值一致的薪资项目
// excludeSalaryItemIds = salaryItemPOS.stream()
// .filter(salaryItemPO -> !includeSalaryItemIds.contains(salaryItemPO.getId()))
// .map(SalaryItemPO::getId)
// .collect(Collectors.toSet());
// }
// // 构建薪资核算结果列表表头
// List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, excludeSalaryItemIds);
// // 返回结果
// return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
// }
//
// @Override
// public void batchSave(Collection<ExcelAcctResultPO> excelAcctResultPOS) {
// excelAcctResultMapper.batchInsert(excelAcctResultPOS);
// }
//
// @Override
// public void deleteBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds, String tenantKey) {
// excelAcctResultMapper.deleteBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey);
// }
//
// @Override
// public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds, String tenantKey) {
// excelAcctResultMapper.deleteBySalaryAcctRecordIds(salaryAcctRecordIds, tenantKey);
// }
//}
package com.engine.salary.service.impl;
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.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
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.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资核算的线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryComparisonResultServiceImpl extends Service implements SalaryComparisonResultService {
private ExcelAcctResultMapper getExcelAcctResultMapper() {
return MapperProxyFactory.getProxy(ExcelAcctResultMapper.class);
}
private SalaryAcctResultService getSalaryAcctResultService(User user) {
return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
}
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) {
return (SalarySobEmpFieldService) ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private TaxAgentBiz taxAgentService = new TaxAgentBiz();
private SalaryFormulaService getSalaryFormulaService(User user) {
return null;
// return (SalaryFormulaService)ServiceUtil.getService(SalaryFormulaServiceImpl.class,user);
}
private SalaryItemService getSalaryItemService(User user) {
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private SalarySobService getSalarySobService(User user) {
return (SalarySobService) ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SalarySobItemGroupService getSalarySobItemGroupService(User user) {
return (SalarySobItemGroupService) ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user);
}
@Override
public List<ExcelAcctResultPO> listBySalaryAcctRecordId(Long salaryAcctRecordId) {
return getExcelAcctResultMapper().listSome(ExcelAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).build());
}
@Override
public List<ExcelAcctResultPO> listBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds) {
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
return Collections.emptyList();
}
return getExcelAcctResultMapper().listSome(ExcelAcctResultPO.builder().salaryAcctEmpIds(salaryAcctEmployeeIds).build());
}
@Override
public SalaryComparisonResultListDTO listPageByParam(SalaryComparisonResultQueryParam queryParam) {
return listByParam(true, queryParam);
}
@Override
public SalaryComparisonResultListDTO listByParam(SalaryComparisonResultQueryParam queryParam) {
return listByParam(false, queryParam);
}
/**
* 根据薪资核算人员查询薪资核算线下对比结果
*
* @param queryParam 列表查询条件
* @return
*/
private SalaryComparisonResultListDTO listByParam(boolean needPage, SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
if (Objects.isNull(salaryAcctRecordPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
// 查询薪资核算所用薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
// 查询薪资核算所用的薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询薪资核算所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
List<ExpressFormula> expressFormulas = Lists.newArrayList();//todo getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 转换成
Map<Long, String> expressFormulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
Map<Long, String> customParameters = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId, salarySobItemPO -> {
if (salarySobItemPO.getFormulaId() <= 0) {
return SalaryI18nUtil.getI18nLabel(92004, "输入/导入");
}
return expressFormulaMap.getOrDefault(salarySobItemPO.getFormulaId(), StringUtils.EMPTY);
});
// 查询薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 转换成聚合dto
SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
SalarySobItemAggregateDTO salarySobItemAggregateDTO = salarySobItemAggregateBO.convert2AggregateDTO();
// 薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByResultQueryParam(queryParam);
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
// 构建薪资核算结果列表表头
List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, Collections.emptySet());
// 构建列表数据
// 返回结果
return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(new PageInfo<>());
}
// 薪资核算结果
List<SalaryAcctResultPO> salaryAcctResultPOS;
// 线下导入结果
List<ExcelAcctResultPO> excelAcctResultPOS;
// 如果薪资核算人员太多利用薪资核算人员id查询薪资核算结果的效率就不太好改为直接用薪资核算记录id查询
if (salaryAcctEmployeePOS.size() > 1000) {
// 查询薪资核算结果
salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(queryParam.getSalaryAcctRecordId()));
// 查询线下导入结果
excelAcctResultPOS = listBySalaryAcctRecordId(queryParam.getSalaryAcctRecordId());
} else {
// 薪资核算人员id
Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
// 查询薪资核算结果
salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
// 查询线下导入结果
excelAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
}
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = taxAgentService.listByIds(taxAgentIds);
// 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);
// 判断是否存在合并计税
Set<Long> salaryAcctEmployeeIds4ConsolidatedTax;
if (StringUtils.isEmpty(queryParam.getConsolidatedTaxation())) {
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
} else {
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder()
.salaryAcctRecordId(queryParam.getSalaryAcctRecordId())
.ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId))
.build();
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = getSalaryAcctEmployeeService(user).listByParam4ConsolidatedTax(accEmployeeQueryParam);
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);
}
// 系统值和线下值不一致的薪资项目id
Set<Long> includeSalaryItemIds = Sets.newHashSetWithExpectedSize(salaryItemPOS.size());
// 转换成薪资核算线下对比结果
List<Map<String, Object>> resultMapList = SalaryAcctResultBO.buildComparisonTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees,
salaryAcctEmployeePOS, salaryAcctResultPOS, excelAcctResultPOS, taxAgentPOS, customParameters, salaryAcctEmployeeIds4ConsolidatedTax, includeSalaryItemIds);
// 系统值和线下值一致的人员
if (queryParam.isOnlyDiffEmployee()) {
// 过滤系统值和线下值一致的薪资核算人员
resultMapList = resultMapList.stream()
.filter(map -> BooleanUtils.toBoolean(String.valueOf(map.get("different"))))
.collect(Collectors.toList());
}
// 分页
PageInfo<Map<String, Object>> dtoPage = new PageInfo<>();
dtoPage.setTotal(resultMapList.size());
if (needPage) {
dtoPage.setList(PageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), resultMapList));
} else {
dtoPage.setList(resultMapList);
}
Set<Long> excludeSalaryItemIds = Sets.newHashSet();
if (queryParam.isOnlyDiffSalaryItem()) {
// 过滤系统值和线下值一致的薪资项目
excludeSalaryItemIds = salaryItemPOS.stream()
.filter(salaryItemPO -> !includeSalaryItemIds.contains(salaryItemPO.getId()))
.map(SalaryItemPO::getId)
.collect(Collectors.toSet());
}
// 构建薪资核算结果列表表头
List<WeaTableColumn> weaTableColumns = SalaryAcctResultBO.buildTableColumns4ComparisonResult(salarySobItemAggregateDTO, excludeSalaryItemIds);
// 返回结果
return new SalaryComparisonResultListDTO().setWeaTableColumns(weaTableColumns).setData(dtoPage);
}
@Override
public void batchSave(Collection<ExcelAcctResultPO> excelAcctResultPOS) {
getExcelAcctResultMapper().batchInsert(excelAcctResultPOS);
}
@Override
public void deleteBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds) {
getExcelAcctResultMapper().deleteBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
}
@Override
public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
getExcelAcctResultMapper().deleteBySalaryAcctRecordIds(salaryAcctRecordIds);
}
}

View File

@ -0,0 +1,165 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.formula.FormulaMapper;
import com.engine.salary.mapper.formula.FormulaVarMapper;
import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪酬管理公式编辑器
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Slf4j
public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaService {
private FormulaMapper getFormulaMapper() {
return MapperProxyFactory.getProxy(FormulaMapper.class);
}
private FormulaVarMapper getFormulaVarMapper() {
return MapperProxyFactory.getProxy(FormulaVarMapper.class);
}
@Override
public List<ExpressFormula> listExpressFormula(Collection<Long> formulaIds) {
formulaIds = formulaIds.stream().filter(id -> id != null && id > 0).collect(Collectors.toList());
if (CollectionUtils.isEmpty(formulaIds)) {
return Collections.emptyList();
}
try {
// 当前租户自己新建的公式
List<FormulaPO> expressFormulas = getFormulaMapper().listByIds(Lists.newArrayList(formulaIds));
return expressFormulas.stream()
.filter(Objects::nonNull)
.map(m -> {
ExpressFormula expressFormula = new ExpressFormula();
BeanUtils.copyProperties(m, expressFormula);
List<FormulaVar> formulaVarPOS = getFormulaVarMapper().listSome(FormulaVar.builder().formulaId(m.getId()).build());
expressFormula.setParameters(formulaVarPOS);
return expressFormula;
})
.collect(Collectors.toList());
} catch (Exception e) {
log.info("获取公示详情失败", e);
throw new SalaryRunTimeException("获取公示详情失败");
}
}
@Override
public ExpressFormula getExpressFormula(Long formulaId) {
if (formulaId == null || formulaId <= 0) {
return null;
}
try {
// 当前租户自己新建的公式
FormulaPO formulaPO = getFormulaMapper().getById(formulaId);
ExpressFormula expressFormula = new ExpressFormula();
BeanUtils.copyProperties(formulaPO, expressFormula);
List<FormulaVar> formulaVarPOS = getFormulaVarMapper().listSome(FormulaVar.builder().formulaId(formulaId).build());
expressFormula.setParameters(formulaVarPOS);
return expressFormula;
} catch (Exception e) {
log.info("获取公示详情失败", e);
throw new SalaryRunTimeException("获取公示详情失败");
}
}
@Override
public void save(SalaryFormulaSaveParam param) {
FormulaPO formulaPO = new FormulaPO();
formulaPO.setName(param.getName());
formulaPO.setDescription(param.getDescription());
formulaPO.setModule(param.getModule());
formulaPO.setUseFor(param.getUseFor());
formulaPO.setReferenceType(param.getReferenceType());
formulaPO.setReturnType(param.getReturnType());
formulaPO.setValidateType(param.getValidateType());
formulaPO.setExtendParam(param.getExtendParam());
formulaPO.setFormula(param.getFormula());
formulaPO.setDeleteType(NumberUtils.INTEGER_ZERO);
Date now = new Date();
formulaPO.setCreateTime(now);
formulaPO.setUpdateTime(now);
formulaPO.setCreator((long) user.getUID());
getFormulaMapper().insertIgnoreNull(formulaPO);
List<FormulaVar> parameters = param.getParameters();
parameters.forEach(po -> {
po.setFormulaId(formulaPO.getId());
po.setDeleteType(NumberUtils.INTEGER_ZERO);
po.setCreator((long) user.getUID());
po.setCreateTime(now);
po.setUpdateTime(now);
getFormulaVarMapper().insertIgnoreNull(po);
});
}
@Override
public void update(SalaryFormulaSaveParam param) {
ValidUtil.doValidator(param, RuntimeTypeEnum.UPDATE);
Long id = param.getId();
FormulaPO formulaPO = getFormulaMapper().getById(id);
if (formulaPO == null) {
throw new SalaryRunTimeException("公式不存在或已删除");
}
formulaPO.setName(param.getName());
formulaPO.setDescription(param.getDescription());
formulaPO.setModule(param.getModule());
formulaPO.setUseFor(param.getUseFor());
formulaPO.setReferenceType(param.getReferenceType());
formulaPO.setReturnType(param.getReturnType());
formulaPO.setValidateType(param.getValidateType());
formulaPO.setExtendParam(param.getExtendParam());
formulaPO.setFormula(param.getFormula());
formulaPO.setDeleteType(NumberUtils.INTEGER_ZERO);
Date now = new Date();
formulaPO.setUpdateTime(now);
formulaPO.setCreator((long) user.getUID());
getFormulaMapper().updateIgnoreNull(formulaPO);
List<FormulaVar> parameters = param.getParameters();
//删除公式下的变量
getFormulaVarMapper().deleteByFormulaId(id);
parameters.forEach(po -> {
po.setCreator((long) user.getUID());
po.setCreateTime(now);
po.setUpdateTime(now);
getFormulaVarMapper().insertIgnoreNull(po);
});
}
}

View File

@ -6,6 +6,7 @@ import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.biz.SalarySobItemBiz;
import com.engine.salary.biz.SalarySobItemGroupBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
@ -18,7 +19,6 @@ 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.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -270,6 +270,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
@Override
public void batchSave(Collection<SalarySobItemPO> salarySobItemPOS) {
if (CollectionUtils.isEmpty(salarySobItemPOS)){
return;
}
salarySobItemMapper.batchInsert(salarySobItemPOS);
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.transmethod;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.SalaryDataSourceEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.datacollection.AttendQuoteFieldSourceTypeEnum;
import com.engine.salary.enums.datacollection.AttendQuoteFieldTypeEnum;
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
@ -90,7 +90,7 @@ public class TransMethod {
* @return
*/
public static String datasource(String datasource) {
return SalaryDataSourceEnum.getDefaultLabelByValue(Integer.valueOf(datasource));
return SalaryValueTypeEnum.getDefaultLabelByValue(Integer.valueOf(datasource));
}
/**

View File

@ -119,7 +119,7 @@ public class ExcelUtil {
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
cell.setCellValue(o == null ? "" : o.toString());
}
}
}
@ -184,8 +184,8 @@ public class ExcelUtil {
}
}
if(CollectionUtils.isNotEmpty(comments)){
for (ExcelComment c:comments) {
if (CollectionUtils.isNotEmpty(comments)) {
for (ExcelComment c : comments) {
XSSFDrawing patr = sheet.createDrawingPatriarch();
XSSFComment cellComment = patr.createCellComment(new XSSFClientAnchor(c.dx1, c.dy1, c.dx2, c.dy2, c.col1, c.row1, c.col2, c.row2));
cellComment.setString(c.content);

View File

@ -8,13 +8,12 @@ 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;
import com.engine.salary.service.SalaryAcctExcelService;
import com.engine.salary.service.impl.SalaryAcctExcelServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalaryAcctEmployeeWrapper;
import com.engine.salary.wrapper.SalaryAcctExcelWrapper;
import com.engine.salary.wrapper.SalaryAcctRecordWrapper;
import com.engine.salary.wrapper.SalaryAcctResultWrapper;
import com.engine.salary.wrapper.*;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -62,11 +61,17 @@ public class SalaryAcctController {
}
// private SalaryAcctCheckResultWrapper salaryAcctCheckResultWrapper;
// private SalaryComparisonResultWrapper salaryComparisonResultWrapper;
private SalaryComparisonResultWrapper getSalaryComparisonResultWrapper(User user) {
return (SalaryComparisonResultWrapper) ServiceUtil.getService(SalaryComparisonResultWrapper.class, user);
}
private SalaryAcctExcelWrapper getSalaryAcctExcelWrapper(User user) {
return (SalaryAcctExcelWrapper) ServiceUtil.getService(SalaryAcctExcelWrapper.class, user);
}
// private SalaryAcctExcelService salaryAcctExcelService;
private SalaryAcctExcelService getSalaryAcctExcelService(User user) {
return (SalaryAcctExcelService) ServiceUtil.getService(SalaryAcctExcelServiceImpl.class, user);
}
// private SalaryBatchService salaryBatchService;
//
// /**********************************薪资核算记录相关 start*********************************/
@ -305,9 +310,9 @@ public class SalaryAcctController {
}
/**********************************薪资核算人员相关 end*********************************/
// **********************************薪资核算人员相关 end*********************************/
/**********************************薪资核算结果 start*********************************/
// **********************************薪资核算结果 start*********************************/
//薪资核算结果列表
@POST
@ -368,7 +373,8 @@ public class SalaryAcctController {
@Path("/acctresult/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportSalaryAcctResult(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryAcctResultQueryParam param = null;
SalaryAcctResultQueryParam param = new SalaryAcctResultQueryParam();
setSalaryAcctResultQueryParam(request,param);
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportSalaryAcctResult(param);
String time = LocalDate.now().toString();
@ -387,40 +393,53 @@ public class SalaryAcctController {
}
// @GetMapping("/acctresult/importField")
// @GetMapping("/acctresult/importField")
// @ApiOperation("导入核算结果前生成导入模板时可选的薪资项目")
// @WeaPermission
// public WeaResult<SalaryAcctImportFieldDTO> getImportField(@RequestParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
// SalaryAcctImportFieldDTO importField = salaryAcctExcelService.getImportField(salaryAcctRecordId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// SalaryAcctImportFieldDTO importField = getSalaryAcctExcelService(user).getImportField(salaryAcctRecordId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(importField);
// }
//
// @PostMapping("/acctresult/importtemplate/export")
// @ApiOperation("导出导入模板")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportImportTemplate(@RequestBody @Validated SalaryAcctImportTemplateParam param) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportImportTemplate(param, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// @GetMapping("/acctresult/importParams")
// @ApiOperation("获取导入核算结果的导入参数")
// @WeaPermission
// public WeaResult<ExcelImportParam> getAcctResultImportParams() {
// return WeaResult.success(salaryBatchService.buildImportParam("importSalaryAcctResult",
// "importSalaryAcctResult",
// "薪资核算结果",
// null,
// null));
// }
//
// /**********************************薪资核算结果 end*********************************/
//
// /**********************************检验异常 start*********************************/
//
//导出导入模板
@GET
@Path("/acctresult/importtemplate/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportImportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryAcctImportTemplateParam param = new SalaryAcctImportTemplateParam();
setSalaryAcctResultQueryParam(request,param);
String importType = request.getParameter("importType");
if (StringUtils.isNotBlank(importType)) {
param.setImportType(importType);
}
String salaryItemIds = request.getParameter("salaryItemIds");
if (StringUtils.isNotBlank(salaryItemIds)) {
param.setSalaryItemIds(Arrays.stream(salaryItemIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportImportTemplate(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();
}
// **********************************薪资核算结果 end*********************************/
// **********************************检验异常 start*********************************/
// @GetMapping("/checkresult/getCount")
// @ApiOperation(("获取校验结果(异常)总数"))
// @WeaPermission
@ -491,18 +510,20 @@ public class SalaryAcctController {
// return WeaResult.success(map);
// }
//
// /**********************************检验异常 end*********************************/
//
// /**********************************线下对比 start*********************************/
//
// @PostMapping("/comparisonresult/list")
// @ApiOperation("线上线下对比结果列表")
// @WeaPermission
// public WeaResult<WeaTable<Map<String, Object>>> listComparisonResult(@RequestBody @Validated SalaryComparisonResultQueryParam queryParam) {
// WeaTable<Map<String, Object>> weaTable = salaryComparisonResultWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// **********************************检验异常 end*********************************/
// **********************************线下对比 start*********************************/
//线上线下对比结果列表
@POST
@Path("/comparisonresult/list")
@Produces(MediaType.APPLICATION_JSON)
public String listComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryComparisonResultQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryComparisonResultQueryParam, Map<String, Object>>().run(getSalaryComparisonResultWrapper(user)::listPage, param);
}
// @GetMapping("/comparisonresult/importParams")
// @ApiOperation("获取导入核算结果的导入参数")
// @WeaPermission
@ -513,7 +534,79 @@ public class SalaryAcctController {
// null,
// null));
// }
//
//导出线上线下对比结果
@GET
@Path("/comparisonresult/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response) {
SalaryComparisonResultQueryParam param = new SalaryComparisonResultQueryParam();
setSalaryAcctResultQueryParam(request, param);
String onlyDiffEmployee = request.getParameter("onlyDiffEmployee");
if(StringUtils.isNotBlank(onlyDiffEmployee)){
param.setOnlyDiffEmployee(Boolean.parseBoolean(onlyDiffEmployee));
}
String onlyDiffSalaryItem = request.getParameter("onlyDiffSalaryItem");
if(StringUtils.isNotBlank(onlyDiffSalaryItem)){
param.setOnlyDiffSalaryItem(Boolean.parseBoolean(onlyDiffSalaryItem));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportComparisonResult(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();
}
private void setSalaryAcctResultQueryParam(HttpServletRequest request, SalaryAcctResultQueryParam param) {
String salaryAcctRecordId = request.getParameter("salaryAcctRecordId");
if (StringUtils.isNotBlank(salaryAcctRecordId)) {
param.setSalaryAcctRecordId(Long.parseLong(salaryAcctRecordId));
}
String employeeName = request.getParameter("employeeName");
if (StringUtils.isNotBlank(employeeName)) {
param.setEmployeeName(employeeName);
}
String taxAgentId = request.getParameter("taxAgentId");
if (StringUtils.isNotBlank(taxAgentId)) {
param.setTaxAgentId(Long.parseLong(taxAgentId));
}
String departmentIds = request.getParameter("departmentIds");
if (StringUtils.isNotBlank(departmentIds)) {
param.setDepartmentIds(Arrays.stream(departmentIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
String positionIds = request.getParameter("positionIds");
if (StringUtils.isNotBlank(positionIds)) {
param.setPositionIds(Arrays.stream(positionIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
String status = request.getParameter("status");
if (StringUtils.isNotBlank(status)) {
param.setStatus(SalaryEmployeeStatusEnum.parseByValue(Integer.parseInt(status)));
}
//fixme 日期
request.getParameter("dismissDate");
String consolidatedTaxation = request.getParameter("consolidatedTaxation");
if (StringUtils.isNotBlank(consolidatedTaxation)) {
param.setConsolidatedTaxation(consolidatedTaxation);
}
String ids = request.getParameter("ids");
if (StringUtils.isNotBlank(ids)) {
param.setIds(Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
}
// @PostMapping("/comparisonresult/export")
// @ApiOperation("导出线上线下对比结果")
// @WeaPermission

View File

@ -0,0 +1,65 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.wrapper.SalaryFormulaWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
public class SalaryFormulaController {
private SalaryFormulaWrapper getSalaryFormulaWrapper(User user) {
return (SalaryFormulaWrapper) ServiceUtil.getService(SalaryFormulaWrapper.class, user);
}
//变量项
@POST
@Path("/search/group")
@Produces(MediaType.APPLICATION_JSON)
public String fieldGroupList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map<String, Object> param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Map<String, Object>, List<Map<String, Object>>>().run(getSalaryFormulaWrapper(user)::fieldGroupList, param);
}
//变量字段列表
@POST
@Path("/search/field")
@Produces(MediaType.APPLICATION_JSON)
public String fieldList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryFormulaFieldQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryFormulaFieldQueryParam, List<FormulaVar>>().run(getSalaryFormulaWrapper(user)::fieldList, param);
}
//获取公式详情
@GET
@Path("/detail")
@Produces(MediaType.APPLICATION_JSON)
public String detail(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "formulaId") Long formulaId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, ExpressFormulaDTO>().run(getSalaryFormulaWrapper(user)::detail, formulaId);
}
@POST
@Path("/save")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryFormulaSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryFormulaSaveParam, String>().run(getSalaryFormulaWrapper(user)::save, param);
}
}

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctImportTemplateParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.service.SalaryAcctExcelService;
import com.engine.salary.service.impl.SalaryAcctExcelServiceImpl;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -68,9 +69,9 @@ public class SalaryAcctExcelWrapper extends Service {
* @param queryParam
* @return
*/
// public Map<String, Object> exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
// return getSalaryAcctExcelService(user).exportComparisonResult(excelExportParam, queryParam, simpleEmployee, tenantKey, eteamsId);
// }
public XSSFWorkbook exportComparisonResult(SalaryComparisonResultQueryParam queryParam) {
return getSalaryAcctExcelService(user).exportComparisonResult( queryParam);
}
/**
* 薪资核算线下对比结果导入模板导出

View File

@ -19,9 +19,6 @@ import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.ValidUtil;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
import weaver.hrm.User;
import java.util.HashMap;
@ -187,13 +184,13 @@ public class SalaryAcctResultWrapper extends Service {
// .setMessage(StringUtils.EMPTY);
// salaryAcctProgressService.initProgress("" + calculateParam.getSalaryAcctRecordId(), initProgress, simpleEmployee.getEmployeeId(), tenantKey);
// 异步执行薪资核算
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
// LocalRunnable localRunnable = new LocalRunnable() {
// @Override
// public void execute() {
getSalaryAcctResultService(user).calculate(calculateParam, simpleEmployee);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryAcctCalculate", localRunnable);
// }
// };
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryAcctCalculate", localRunnable);
}
/**

View File

@ -22,11 +22,9 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import weaver.hrm.User;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
/**
@ -37,16 +35,13 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Component
public class SalaryArchiveItemWrapper extends Service {
private SalaryArchiveItemService getSalaryArchiveItemService(User user) {
return (SalaryArchiveItemService) ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user);
}
private ExecutorService taskExecutor;
/**
* 构建薪资项目基础信息表单
*

View File

@ -0,0 +1,59 @@
package com.engine.salary.wrapper;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryComparisonResultQueryParam;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.SalaryComparisonResultService;
import com.engine.salary.service.SalarySobEmpFieldService;
import com.engine.salary.service.SalarySobItemService;
import java.util.HashMap;
import java.util.Map;
/**
* 薪资核算线下对比结果
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryComparisonResultWrapper extends Service {
private SalaryComparisonResultService salaryComparisonResultService;
private SalaryAcctRecordService salaryAcctRecordService;
private SalarySobEmpFieldService salarySobEmpFieldService;
private SalarySobItemService salarySobItemService;
/**
* 薪资核算线下对比列表
*
* @param queryParam 列表查询条件
* @return
*/
public Map<String, Object> listPage(SalaryComparisonResultQueryParam queryParam) {
// 查询薪资核算线下对比列表
SalaryComparisonResultListDTO salaryComparisonResultListDTO = salaryComparisonResultService.listPageByParam(queryParam);
WeaTable table = new WeaTable();
table.setColumns(salaryComparisonResultListDTO.getWeaTableColumns());
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
Map<String,Object> datas = new HashMap<>();
datas.put("pageInfo", salaryComparisonResultListDTO.getData());
datas.put("dataKey",result.getResultMap());
return datas;
}
}

View File

@ -0,0 +1,74 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryformula.bo.SalaryFormulaBO;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.RemoteExcelService;
import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.service.impl.RemoteExcelServiceImpl;
import com.engine.salary.service.impl.SalaryFormulaServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryFormulaWrapper extends Service {
private RemoteExcelService getRemoteExcelService(User user) {
return (RemoteExcelService) ServiceUtil.getService(RemoteExcelServiceImpl.class, user);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
/**
* 公式字段列表
*
* @param param 查询参数
* @return
*/
public List<FormulaVar> fieldList(SalaryFormulaFieldQueryParam param) {
return getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam());
}
/**
* 公式字段分类
*
* @param param 查询参数
* @return
*/
public List<Map<String, Object>> fieldGroupList(Map<String, Object> param) {
return getRemoteExcelService(user).fieldGroupList(param);
}
public ExpressFormulaDTO detail(Long formulaId) {
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(Collections.singleton(formulaId));
if (CollectionUtils.isEmpty(expressFormulas)) {
throw new SalaryRunTimeException("获取公式详情失败");
}
return SalaryFormulaBO.convert2DTO(expressFormulas).get(0);
}
public void save(SalaryFormulaSaveParam salaryFormulaSaveParam) {
getSalaryFormulaService(user).save(salaryFormulaSaveParam);
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salarysob.bo.SalarySobCheckRuleBO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleListDTO;
@ -15,7 +16,6 @@ import com.engine.salary.service.SalarySobCheckRuleService;
import com.engine.salary.service.impl.SalarySobCheckRuleServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import weaver.hrm.User;
import java.util.ArrayList;

View File

@ -34,7 +34,7 @@ import java.util.*;
* @author qiantao
* @version 1.0
**/
@Component
public class SalarySobItemWrapper extends Service {
private SalarySobItemService getSalarySobItemService(User user) {

View File

@ -32,7 +32,7 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Component
public class SysSalaryItemWrapper extends Service {