浮动薪酬
This commit is contained in:
parent
ff00de206c
commit
75fb15928a
|
|
@ -0,0 +1,42 @@
|
|||
CREATE TABLE hrsa_variable_archive (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NULL ,
|
||||
salary_month DATE NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NOT NULL,
|
||||
variable_archive_id NUMBER(38,0) NOT NULL,
|
||||
variable_item_id NUMBER(38,0) NOT NULL,
|
||||
item_value varchar2(255) NULL ,
|
||||
create_time DATE NOT NULL ,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL ,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id NUMBER(38,0) NOT NULL ,
|
||||
name varchar2(255) NOT NULL ,
|
||||
code varchar2(255) NOT NULL,
|
||||
data_type varchar2(20) NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL ,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
CREATE TABLE hrsa_variable_archive (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NULL ,
|
||||
salary_month DATE NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NOT NULL,
|
||||
variable_archive_id NUMBER(38,0) NOT NULL,
|
||||
variable_item_id NUMBER(38,0) NOT NULL,
|
||||
item_value varchar2(255) NULL ,
|
||||
create_time DATE NOT NULL ,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL ,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id NUMBER(38,0) NOT NULL ,
|
||||
name varchar2(255) NOT NULL ,
|
||||
code varchar2(255) NOT NULL,
|
||||
data_type varchar2(20) NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL ,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
CREATE TABLE hrsa_variable_archive (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NULL ,
|
||||
salary_month DATE NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NOT NULL,
|
||||
variable_archive_id NUMBER(38,0) NOT NULL,
|
||||
variable_item_id NUMBER(38,0) NOT NULL,
|
||||
item_value varchar2(255) NULL ,
|
||||
create_time DATE NOT NULL ,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL ,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id NUMBER(38,0) NOT NULL ,
|
||||
name varchar2(255) NOT NULL ,
|
||||
code varchar2(255) NOT NULL,
|
||||
data_type varchar2(20) NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL ,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
CREATE TABLE hrsa_variable_archive (
|
||||
id bigint NOT NULL,
|
||||
employee_id bigint NULL ,
|
||||
salary_month datetime NULL,
|
||||
create_time datetime NOT NULL,
|
||||
update_time datetime NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id bigint NOT NULL,
|
||||
employee_id bigint NOT NULL,
|
||||
variable_archive_id bigint NOT NULL,
|
||||
variable_item_id bigint NOT NULL,
|
||||
item_value varchar(255) NULL ,
|
||||
create_time datetime NOT NULL ,
|
||||
update_time datetime NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL ,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
) ;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id bigint NOT NULL,
|
||||
name varchar(255) NOT NULL,
|
||||
code varchar(255) NOT NULL,
|
||||
data_type varchar(20) NULL,
|
||||
create_time datetime NOT NULL,
|
||||
update_time datetime NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
CREATE TABLE hrsa_variable_archive (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NULL ,
|
||||
salary_month DATE NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NOT NULL,
|
||||
variable_archive_id NUMBER(38,0) NOT NULL,
|
||||
variable_item_id NUMBER(38,0) NOT NULL,
|
||||
item_value varchar2(255) NULL ,
|
||||
create_time DATE NOT NULL ,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL ,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
/
|
||||
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id NUMBER(38,0) NOT NULL ,
|
||||
name varchar2(255) NOT NULL ,
|
||||
code varchar2(255) NOT NULL,
|
||||
data_type varchar2(20) NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL ,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
/
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id bigint NOT NULL,
|
||||
employee_id bigint NOT NULL,
|
||||
variable_archive_id bigint NOT NULL,
|
||||
variable_item_id bigint NOT NULL,
|
||||
item_value varchar(255) NULL,
|
||||
create_time timestamp NOT NULL,
|
||||
update_time timestamp NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
) ;
|
||||
|
||||
CREATE TABLE hrsa_variable_archive (
|
||||
id bigint NOT NULL,
|
||||
employee_id bigint NULL,
|
||||
salary_month timestamp NULL ,
|
||||
create_time timestamp NOT NULL,
|
||||
update_time timestamp NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id bigint NOT NULL,
|
||||
name varchar(255) NOT NULL,
|
||||
code varchar(255) NOT NULL,
|
||||
data_type varchar(20)NULL ,
|
||||
create_time timestamp NOT NULL,
|
||||
update_time timestamp NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id bigint NOT NULL,
|
||||
employee_id bigint NOT NULL,
|
||||
variable_archive_id bigint NOT NULL,
|
||||
variable_item_id bigint NOT NULL,
|
||||
item_value varchar(255) NULL,
|
||||
create_time datetime NOT NULL,
|
||||
update_time datetime NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE TABLE hrsa_variable_archive (
|
||||
id bigint NOT NULL,
|
||||
employee_id bigint NULL,
|
||||
salary_month datetime NULL ,
|
||||
create_time datetime NOT NULL,
|
||||
update_time datetime NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id bigint NOT NULL,
|
||||
name varchar(255) NOT NULL,
|
||||
code varchar(255) NOT NULL,
|
||||
data_type varchar(20)NULL ,
|
||||
create_time datetime NOT NULL,
|
||||
update_time datetime NOT NULL,
|
||||
creator bigint NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
GO
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
CREATE TABLE hrsa_variable_archive (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NULL ,
|
||||
salary_month DATE NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_archive_item (
|
||||
id NUMBER(38,0) NOT NULL,
|
||||
employee_id NUMBER(38,0) NOT NULL,
|
||||
variable_archive_id NUMBER(38,0) NOT NULL,
|
||||
variable_item_id NUMBER(38,0) NOT NULL,
|
||||
item_value varchar2(255) NULL ,
|
||||
create_time DATE NOT NULL ,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL ,
|
||||
tenant_key varchar2(10) NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
CREATE TABLE hrsa_variable_item (
|
||||
id NUMBER(38,0) NOT NULL ,
|
||||
name varchar2(255) NOT NULL ,
|
||||
code varchar2(255) NOT NULL,
|
||||
data_type varchar2(20) NULL,
|
||||
create_time DATE NOT NULL,
|
||||
update_time DATE NOT NULL,
|
||||
creator NUMBER(38,0) NOT NULL,
|
||||
delete_type int NOT NULL,
|
||||
tenant_key varchar2(10) NULL ,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
/
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.salary.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/bs/hrmsalary/variableSalary")
|
||||
public class VariableArchiveController extends com.engine.salary.web.VariableArchiveController {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.salary.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/bs/hrmsalary/variableSalaryItem")
|
||||
public class VariableItemController extends com.engine.salary.web.VariableItemController {
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,11 @@ public class SalaryItemConstant {
|
|||
*/
|
||||
public static final String DYNAMIC_SUFFIX = "_salaryItem";
|
||||
|
||||
/**
|
||||
* 列表中浮动薪资项目动态列后缀标识
|
||||
*/
|
||||
public static final String VARIABLE_ITEM_DYNAMIC_SUFFIX = "_variableItem";
|
||||
|
||||
/**
|
||||
* 薪资核算导入缓存表头字段key
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,279 @@
|
|||
package com.engine.salary.entity.datacollection.bo;
|
||||
|
||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.engine.salary.constant.SalaryItemConstant;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 浮动薪资档案
|
||||
* @Author: xzy
|
||||
*/
|
||||
public class VariableArchiveBO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SalaryArchiveBO{}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 构建表格动态列
|
||||
*
|
||||
* @param variableItems
|
||||
*/
|
||||
public static List<WeaTableColumn> buildVariableArchiveTable(List<VariableItemPO> variableItems) {
|
||||
// 表格表头
|
||||
List<WeaTableColumn> columns = new ArrayList<>();
|
||||
WeaTableColumn idColumn = new WeaTableColumn("100px", "id", "id");
|
||||
idColumn.setIsPrimarykey(WeaBoolAttr.TRUE);
|
||||
idColumn.setDisplay(WeaBoolAttr.FALSE);
|
||||
columns.add(idColumn);
|
||||
WeaTableColumn employeeIdColumn = new WeaTableColumn("100px", "人员信息表的主键id", "employeeId");
|
||||
employeeIdColumn.setDisplay(WeaBoolAttr.FALSE);
|
||||
columns.add(employeeIdColumn);
|
||||
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "username"));
|
||||
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "departmentName"));
|
||||
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile"));
|
||||
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86185, "工号"), "workcode"));
|
||||
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86186, "证件号码"), "idNo"));
|
||||
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "入职日期"), "companystartdate"));
|
||||
for (VariableItemPO variableItem : variableItems) {
|
||||
columns.add(new WeaTableColumn("100px", variableItem.getName(), variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX));
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 构建薪资档案数据
|
||||
// *
|
||||
// * @param salaryArchiveList
|
||||
// * @param salaryArchiveItemDataList
|
||||
// * @param localDateRange
|
||||
// * @param allEmployeeIds
|
||||
// * @param isOnlyTaxAgent
|
||||
// * @return
|
||||
// */
|
||||
// public static List<SalaryArchiveDataDTO> buildSalaryArchiveData(List<SalaryArchivePO> salaryArchiveList,
|
||||
// List<SalaryArchiveItemPO> salaryArchiveItemDataList,
|
||||
// LocalDateRange localDateRange,
|
||||
// List<Long> allEmployeeIds,
|
||||
// boolean isOnlyTaxAgent) {
|
||||
// // 开始日期
|
||||
// Date start = localDateRange.getFromDate();
|
||||
// // 结束日期
|
||||
// Date end = localDateRange.getEndDate();
|
||||
//
|
||||
// List<SalaryArchiveDataDTO> list = new ArrayList<>();
|
||||
// allEmployeeIds.forEach(e -> {
|
||||
// // 同一个人的档案数据
|
||||
// List<SalaryArchivePO> salaryArchives = salaryArchiveList.stream().filter(f -> f.getEmployeeId().equals(e)).collect(Collectors.toList());
|
||||
// List<Long> salaryArchiveIds = salaryArchives.stream().map(SalaryArchivePO::getId).collect(Collectors.toList());
|
||||
// // 同一个人的薪资项目调整历史数据
|
||||
// List<SalaryArchiveItemPO> salaryArchiveItems = salaryArchiveItemDataList.stream().filter(d -> salaryArchiveIds.contains(d.getSalaryArchiveId())).collect(Collectors.toList());
|
||||
// List<Long> salaryArchiveItemIds = salaryArchiveItems.stream().map(SalaryArchiveItemPO::getSalaryItemId).distinct().collect(Collectors.toList());
|
||||
//
|
||||
// SalaryArchiveDataDTO salaryArchiveData = new SalaryArchiveDataDTO();
|
||||
// salaryArchiveData.setEmployeeId(e);
|
||||
// List<SalaryArchiveTaxAgentDataDTO> taxAgents = new ArrayList<>();
|
||||
// // 按个税扣缴义务人生效日期时间段切割
|
||||
// for (SalaryArchivePO salaryArchive : salaryArchives) {
|
||||
// Date fromDate = salaryArchive.getPayStartDate();
|
||||
// Date endDate = salaryArchive.getPayEndDate();
|
||||
// // 起始发薪日不为空,且不能比结束日期晚,最后发薪日可空可不空,但是如果不为空,就不能比开始日期早,且起始发薪日不能晚于最后发薪日
|
||||
// boolean isEnable = fromDate != null && !fromDate.after(end) && (endDate == null || (!fromDate.after(endDate) && !endDate.before(start)));
|
||||
// if (isEnable) {
|
||||
// SalaryArchiveTaxAgentDataDTO taxAgent = new SalaryArchiveTaxAgentDataDTO();
|
||||
// taxAgent.setTaxAgentId(salaryArchive.getTaxAgentId());
|
||||
// // taxAgent.setIncomeCategory(salaryArchive.getIncomeCategory());
|
||||
// // taxAgent.setSalarySobIds(salaryArchiveSobList.stream().filter(sob->sob.getSalaryArchiveId().equals(salaryArchive.getId())).map(SalaryArchiveSobPO::getSalarySobId).distinct().collect(Collectors.toList()));
|
||||
// taxAgent.setEffectiveDateRange(LocalDateRange.builder().fromDate((fromDate.before(start) ? start : fromDate)).endDate(endDate == null || endDate.after(end) ? end : endDate).build());
|
||||
// // 薪资项目数据按个税扣缴义务人切割
|
||||
// if (!isOnlyTaxAgent) {
|
||||
// // 开始日期
|
||||
// Date startItem = taxAgent.getEffectiveDateRange().getFromDate();
|
||||
// // 结束日期
|
||||
// Date endItem = taxAgent.getEffectiveDateRange().getEndDate();
|
||||
// Date endTempItem = endItem;
|
||||
// List<SalaryArchiveItemDataDTO> salaryItemValues = new ArrayList<>();
|
||||
// for (Long salaryArchiveItemId : salaryArchiveItemIds) {
|
||||
// boolean flag = false;
|
||||
// for (SalaryArchiveItemPO salaryArchiveItem : salaryArchiveItems) {
|
||||
// if (!salaryArchiveItemId.equals(salaryArchiveItem.getSalaryItemId()) || !salaryArchiveItem.getSalaryArchiveId().equals(salaryArchive.getId())) {
|
||||
// continue;
|
||||
// }
|
||||
// Date fromDateItem = salaryArchiveItem.getEffectiveTime();
|
||||
// if (fromDateItem.after(endTempItem) || endTempItem.before(startItem)) {
|
||||
// continue;
|
||||
// }
|
||||
// if (endTempItem.equals(startItem) && flag) {
|
||||
// continue;
|
||||
// }
|
||||
// SalaryArchiveItemDataDTO salaryArchiveItemData = new SalaryArchiveItemDataDTO();
|
||||
// salaryArchiveItemData.setEffectiveDateRange(LocalDateRange.builder().fromDate((fromDateItem.before(startItem) ? startItem : fromDateItem)).endDate(endTempItem).build());
|
||||
// salaryArchiveItemData.setSalaryItemId(salaryArchiveItem.getSalaryItemId());
|
||||
// salaryArchiveItemData.setValue(salaryArchiveItem.getItemValue());
|
||||
// salaryItemValues.add(salaryArchiveItemData);
|
||||
// flag = true;
|
||||
// endTempItem = fromDateItem;
|
||||
// }
|
||||
// endTempItem = endItem;
|
||||
// }
|
||||
// taxAgent.setSalaryItemValues(salaryItemValues);
|
||||
// }
|
||||
// taxAgents.add(taxAgent);
|
||||
// }
|
||||
// }
|
||||
// salaryArchiveData.setTaxAgents(taxAgents);
|
||||
// list.add(salaryArchiveData);
|
||||
// });
|
||||
//
|
||||
// return list;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 构建增量数据
|
||||
// *
|
||||
// * @param taxAgentEmpChangeList
|
||||
// * @param salaryArchiveList
|
||||
// * @param salaryArchiveItemList
|
||||
// * @param currentEmployeeId
|
||||
// */
|
||||
// public static ChangeData buildChangeData(List<TaxAgentEmpChangePO> taxAgentEmpChangeList, List<SalaryArchivePO> salaryArchiveList, List<SalaryArchiveItemPO> salaryArchiveItemList, Long currentEmployeeId) {
|
||||
// List<Long> changeIds = taxAgentEmpChangeList.stream().map(TaxAgentEmpChangePO::getId).collect(Collectors.toList());
|
||||
// // 根据个税扣缴义务人和人员以及增量类型分组
|
||||
// Map<String, Long> changeTypeMap = taxAgentEmpChangeList.stream().collect(Collectors.groupingBy(change -> change.getTaxAgentId() + "-" + change.getEmployeeId() + "-" + change.getChangeType(), Collectors.counting()));
|
||||
// // 顺序倒转
|
||||
// Collections.reverse(taxAgentEmpChangeList);
|
||||
// // 去重
|
||||
// taxAgentEmpChangeList = taxAgentEmpChangeList.stream()
|
||||
// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getTaxAgentId() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
// List<TaxAgentEmpChangePO> taxAgentEmpChanges = taxAgentEmpChangeList
|
||||
// .stream()
|
||||
// // 不相等则保留,否则忽略
|
||||
// .filter(change -> !Objects.equals(changeTypeMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId() + "-" + TaxAgentEmpChangeTypeEnum.ADD.getValue())
|
||||
// , changeTypeMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId() + "-" + TaxAgentEmpChangeTypeEnum.DEL.getValue())))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// Date now = new Date();
|
||||
// Date today = new Date();
|
||||
// List<String> stopStatus = Arrays.asList(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue(), SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue());
|
||||
// List<SalaryArchivePO> salaryArchiveAddTodoList = Lists.newArrayList();
|
||||
// List<SalaryArchivePO> salaryArchiveUpdateTodoList = Lists.newArrayList();
|
||||
// List<SalaryArchiveItemPO> salaryArchiveItemAddTodos = Lists.newArrayList();
|
||||
//
|
||||
// Map<String, SalaryArchivePO> salaryArchiveListMap = SalaryEntityUtil.convert2Map(salaryArchiveList, k -> k.getTaxAgentId() + "-" + k.getEmployeeId());
|
||||
// taxAgentEmpChanges.forEach(change -> {
|
||||
// SalaryArchivePO salaryArchive = salaryArchiveListMap.get(change.getTaxAgentId() + "-" + change.getEmployeeId());
|
||||
// // 如果是新增 说明:如果没有档案,则新增,如果有档案而且是停薪,就挪到待定薪中,以个税扣缴义务人和人员id判断唯一
|
||||
// if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.ADD.getValue()) {
|
||||
// if (salaryArchive != null) {
|
||||
// // 停薪中跳回待定薪:从a调动到b又调动到a,或者是删除待办后再覆盖
|
||||
// if (stopStatus.contains(salaryArchive.getRunStatus())) {
|
||||
// // 跳回待定薪
|
||||
// salaryArchive.setRunStatus(SalaryArchiveStatusEnum.PENDING.getValue());
|
||||
// if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue())) {
|
||||
// salaryArchive.setPayStartDate(today);
|
||||
// salaryArchive.setPayEndDate(null);
|
||||
// }
|
||||
// salaryArchiveUpdateTodoList.add(salaryArchive);
|
||||
// // 待停薪到停薪的就要复制最新的薪资项目
|
||||
// if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue())) {
|
||||
// // 拷贝最新的薪资项目数据
|
||||
// List<SalaryArchiveItemPO> salaryArchiveItemValuelList = salaryArchiveItemList.stream().filter(i -> i.getSalaryArchiveId().equals(salaryArchive.getId())).collect(Collectors.toList());
|
||||
// salaryArchiveItemValuelList.forEach(i -> {
|
||||
// salaryArchiveItemAddTodos.add(SalaryArchiveItemPO.builder()
|
||||
// .id(IdGenerator.generate())
|
||||
// .salaryArchiveId(salaryArchive.getId())
|
||||
// .employeeId(salaryArchive.getEmployeeId())
|
||||
// .effectiveTime(today)
|
||||
// .adjustReason(SalaryArchiveItemAdjustReasonEnum.INIT.getValue())
|
||||
// .salaryItemId(i.getSalaryItemId())
|
||||
// .itemValue(i.getItemValue())
|
||||
// .description("")
|
||||
// // 不用设置操作人
|
||||
// .operateTime(now)
|
||||
// .createTime(now)
|
||||
// .updateTime(now)
|
||||
// .creator(currentEmployeeId)
|
||||
// .deleteType(NumberUtils.INTEGER_ZERO)
|
||||
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
// .build());
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// salaryArchiveAddTodoList.add(SalaryArchivePO.builder()
|
||||
// .id(IdGenerator.generate())
|
||||
// .employeeId(change.getEmployeeId())
|
||||
// .taxAgentId(change.getTaxAgentId())
|
||||
// .employeeType(change.getEmployeeType())
|
||||
// .runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
|
||||
// // .incomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())
|
||||
// // .modifier(0L)
|
||||
// .createTime(now)
|
||||
// .updateTime(now)
|
||||
// .creator(currentEmployeeId)
|
||||
// .deleteType(NumberUtils.INTEGER_ZERO)
|
||||
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
// .build());
|
||||
// }
|
||||
// // 如果是删除 说明:如果有档案并且是在定薪列表才处理,没档案不用管
|
||||
// } else if (change.getChangeType() == TaxAgentEmpChangeTypeEnum.DEL.getValue()) {
|
||||
// if (salaryArchive != null) {
|
||||
// if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.FIXED.getValue())) {
|
||||
// // 跳到待停薪
|
||||
// salaryArchive.setRunStatus(SalaryArchiveStatusEnum.SUSPEND.getValue());
|
||||
// // salaryArchive.setPayEndDate(today);
|
||||
// salaryArchiveUpdateTodoList.add(salaryArchive);
|
||||
// } else if (salaryArchive.getRunStatus().equals(SalaryArchiveStatusEnum.PENDING.getValue())) {
|
||||
// // 跳到停薪
|
||||
// salaryArchive.setRunStatus(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue());
|
||||
// salaryArchiveUpdateTodoList.add(salaryArchive);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return ChangeData.builder()
|
||||
// .salaryArchiveAddTodoList(salaryArchiveAddTodoList)
|
||||
// .salaryArchiveUpdateTodoList(salaryArchiveUpdateTodoList)
|
||||
// .salaryArchiveItemAddTodos(salaryArchiveItemAddTodos)
|
||||
// .changeIds(changeIds)
|
||||
// .build();
|
||||
// }
|
||||
//
|
||||
// @Data
|
||||
// @Builder
|
||||
// @NoArgsConstructor
|
||||
// @AllArgsConstructor
|
||||
// public static class ChangeData {
|
||||
//
|
||||
// /**
|
||||
// * 批量修改薪资档案
|
||||
// */
|
||||
// private List<SalaryArchivePO> salaryArchiveAddTodoList;
|
||||
//
|
||||
// /**
|
||||
// * 批量新增薪资档案
|
||||
// */
|
||||
// private List<SalaryArchivePO> salaryArchiveUpdateTodoList;
|
||||
//
|
||||
// /**
|
||||
// * 落库处理薪资项目
|
||||
// */
|
||||
// private List<SalaryArchiveItemPO> salaryArchiveItemAddTodos;
|
||||
//
|
||||
// /**
|
||||
// * 删除增量数据
|
||||
// */
|
||||
// private List<Long> changeIds;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
package com.engine.salary.entity.datacollection.bo;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.constant.SalaryArchiveConstant;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveFieldTypeEnum;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 浮动薪资档案-excel
|
||||
* @Author: xzy
|
||||
* @Date: 2024-08-08 10:51
|
||||
*/
|
||||
public class VariableArchiveExcelBO extends Service {
|
||||
|
||||
public static String userNameI18n;
|
||||
public static String departmentI18n;
|
||||
public static String jobNumI18n;
|
||||
public static String hrStatusI18n;
|
||||
public static String repeatMsg;
|
||||
public static String taxAgentI18n;
|
||||
public static String taxAgentRangeMsg;
|
||||
public static String empRepeatMsg;
|
||||
|
||||
public static String notEmptyI18n;
|
||||
|
||||
public static String incomeCategoryI18n;
|
||||
public static String salarySobI18n;
|
||||
public static String effectiveTimeI18n;
|
||||
public static String payStartDateI18n;
|
||||
public static String payEndDateI18n;
|
||||
public static String adjustReasonI18n;
|
||||
public static String listTypeErrMsg;
|
||||
public static String taxAgentNoExist;
|
||||
public static String incomeCategoryNoExist;
|
||||
public static String currSalarySobI18n;
|
||||
public static String noExist;
|
||||
public static String effectiveTimeErr;
|
||||
public static String adjustReasonNoExist;
|
||||
public static String dateErr;
|
||||
public static String payStartUnableAfterEnd;
|
||||
|
||||
public static String salaryItemNoBeforeCurrentEffectiveTime;
|
||||
public static String salaryItemAdjustNoSame;
|
||||
public static String salaryItemAdjustNoSameIneffective;
|
||||
|
||||
public static String salaryArchiveErr;
|
||||
public static String numberErr;
|
||||
|
||||
/**
|
||||
* 初始化i18n
|
||||
*/
|
||||
public static void initI18n() {
|
||||
userNameI18n = SalaryI18nUtil.getI18nLabel(85429, "姓名");
|
||||
departmentI18n = SalaryI18nUtil.getI18nLabel(86185, "部门");
|
||||
jobNumI18n = SalaryI18nUtil.getI18nLabel(86317, "工号");
|
||||
hrStatusI18n = SalaryI18nUtil.getI18nLabel(109332, "人事状态");
|
||||
repeatMsg = "[" + Joiner.on(",").join(new List[]{Arrays.asList(userNameI18n, departmentI18n, jobNumI18n, hrStatusI18n)}) + "]";
|
||||
taxAgentI18n = SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人");
|
||||
taxAgentRangeMsg = SalaryI18nUtil.getI18nLabel(132633, "该员工不在该个税扣缴义务人的人员范围中") + "," + SalaryI18nUtil.getI18nLabel(127308, "请检查") + repeatMsg;
|
||||
empRepeatMsg = SalaryI18nUtil.getI18nLabel(121899, "员工信息重复,请检查") + repeatMsg;
|
||||
|
||||
notEmptyI18n = SalaryI18nUtil.getI18nLabel(100577, "不能为空");
|
||||
|
||||
incomeCategoryI18n = SalaryI18nUtil.getI18nLabel(121908, "收入所得项目");
|
||||
salarySobI18n = SalaryI18nUtil.getI18nLabel(87889, "薪资账套");
|
||||
effectiveTimeI18n = SalaryI18nUtil.getI18nLabel(85904, "生效日期");
|
||||
payStartDateI18n = SalaryI18nUtil.getI18nLabel(109527, "起始发薪日期");
|
||||
payEndDateI18n = SalaryI18nUtil.getI18nLabel(109329, "最后发薪日期");
|
||||
adjustReasonI18n = SalaryI18nUtil.getI18nLabel(85431, "调整原因");
|
||||
|
||||
listTypeErrMsg = SalaryI18nUtil.getI18nLabel(115527, "该条数据不符合当前列表导入要求或其他列表存在该档案,不可导入");
|
||||
|
||||
taxAgentNoExist = SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在");
|
||||
incomeCategoryNoExist = SalaryI18nUtil.getI18nLabel(121923, "收入所得项目不存在");
|
||||
|
||||
currSalarySobI18n = SalaryI18nUtil.getI18nLabel(127213, "该收入所得项目");
|
||||
noExist = SalaryI18nUtil.getI18nLabel(127236, "不存在");
|
||||
|
||||
effectiveTimeErr = SalaryI18nUtil.getI18nLabel(102497, "生效日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
|
||||
adjustReasonNoExist = SalaryI18nUtil.getI18nLabel(100591, "调整原因不存在");
|
||||
|
||||
dateErr = SalaryI18nUtil.getI18nLabel(109819, "日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'");
|
||||
|
||||
payStartUnableAfterEnd = SalaryI18nUtil.getI18nLabel(109214, "起始发薪日期不可晚于最后发薪日");
|
||||
|
||||
salaryItemNoBeforeCurrentEffectiveTime = SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期");
|
||||
salaryItemAdjustNoSame = SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同");
|
||||
salaryItemAdjustNoSameIneffective = SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同");
|
||||
|
||||
salaryArchiveErr = SalaryI18nUtil.getI18nLabel(101723, "该员工的薪资档案记录有误,请检查");
|
||||
numberErr = SalaryI18nUtil.getI18nLabel(100581, "请输入数字");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验单行数据
|
||||
*
|
||||
* @param map
|
||||
* @param headers
|
||||
* @param excelComments
|
||||
* @param errorCount
|
||||
* @param importHandleParam
|
||||
* @return
|
||||
*/
|
||||
public static boolean singleRowCheck(List<String> allTodoVariableArchives,
|
||||
Map<String, Object> map,
|
||||
List<String> headers,
|
||||
List<Map<String, String>> excelComments,
|
||||
int errorCount,
|
||||
VariableArchiveImportHandleParam importHandleParam,
|
||||
User user) {
|
||||
|
||||
boolean isError = false;
|
||||
String rowindex = "第" + map.get("index") + "行";
|
||||
// 1.姓名
|
||||
String userName = Optional.ofNullable(map.get(userNameI18n)).orElse("").toString();
|
||||
String deparmentName = Optional.ofNullable(map.get(departmentI18n)).orElse("").toString();
|
||||
String mobileName = Optional.ofNullable(map.get("手机号")).orElse("").toString();
|
||||
String workcode = Optional.ofNullable(map.get("工号")).orElse("").toString();
|
||||
String idNo = Optional.ofNullable(map.get("证件号码")).orElse("").toString();
|
||||
|
||||
String validType = importHandleParam.getEmpValidType();
|
||||
List<DataCollectionEmployee> emps = new ArrayList<>();
|
||||
if ("0".equals(validType)) {
|
||||
//“0”代表姓名+部门+手机号的匹配原则,“1”代表工号为唯一匹配原则
|
||||
emps = importHandleParam.getEmployees().stream().filter(e ->
|
||||
(StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
|
||||
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
|
||||
&& (StringUtils.isBlank(mobileName) || Objects.equals(e.getMobile(), mobileName))).collect(Collectors.toList());
|
||||
} else if ("1".equals(validType)) {
|
||||
emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(workcode) || Objects.equals(e.getWorkcode(), workcode)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
else if ("2".equals(validType)) {
|
||||
emps = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(idNo) || Objects.equals(e.getIdNo(), idNo)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<Long> employeeSameIds = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
|
||||
employeeSameIds = emps.stream().filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())).map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) {
|
||||
employeeSameIds = emps.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
|
||||
}
|
||||
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 && employeeSameIds.get(0) > 0 ? employeeSameIds.get(0) : null;
|
||||
|
||||
if (employeeId == null) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowindex + "查找人员失败,请确定姓名、部门、手机号正确且唯一");
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
return isError;
|
||||
}
|
||||
|
||||
// 用于初始化导入数据校验
|
||||
map.put("employeeId", employeeId);
|
||||
if (allTodoVariableArchives.contains(employeeId.toString())) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowindex + "存在重复数据");
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
return isError;
|
||||
} else {
|
||||
allTodoVariableArchives.add(employeeId.toString());
|
||||
}
|
||||
|
||||
// 构建薪资档案
|
||||
VariableArchivePO finalVariableArchive = buildVariableArchive(employeeId, importHandleParam);
|
||||
map.put("variableArchiveId", finalVariableArchive.getId());
|
||||
List<Long> needDelArchiveItemIds = new ArrayList<>();
|
||||
for (int j = 0; j < headers.size(); j++) {
|
||||
String header = headers.get(j);
|
||||
Object key = header;
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
String cellVal = Optional.ofNullable(map.get(key.toString())).orElse("").toString();
|
||||
|
||||
|
||||
boolean isNotEmpty = StringUtils.isNotEmpty(cellVal);
|
||||
// 1.姓名列处理
|
||||
if (isNotEmpty && userNameI18n.equals(key.toString())) {
|
||||
if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowindex + header + empRepeatMsg);
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
} else {
|
||||
// 浮动薪资项目数据
|
||||
if (!isError) {
|
||||
Optional<VariableItemPO> optionalVariableItem = importHandleParam.getVariableItems().stream().filter(e -> Util.formatMultiLang(e.getName(), String.valueOf(user.getLanguage())).equals(key)).findFirst();
|
||||
|
||||
if (optionalVariableItem.isPresent()) {
|
||||
VariableItemPO variableItemPO = optionalVariableItem.get();
|
||||
// 数值类型判断
|
||||
boolean isNotNumber = variableItemPO.getDataType().equals(SalaryArchiveFieldTypeEnum.NUMBER.getValue()) && StringUtils.isNotEmpty(cellVal) && !Pattern.matches(SalaryArchiveConstant.NUMBER_REGEX, cellVal);
|
||||
if (isNotNumber) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowindex + key + numberErr);
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}
|
||||
Long variableItemId = variableItemPO.getId();
|
||||
// 已生效
|
||||
List<VariableArchiveItemPO> effectiveList = Optional.ofNullable(importHandleParam.getEffectiveItemListMap().get(finalVariableArchive.getId() + "-" + variableItemId)).orElse(Lists.newArrayList());
|
||||
// 先删除后新增
|
||||
needDelArchiveItemIds.addAll(effectiveList.stream().map(VariableArchiveItemPO::getId).collect(Collectors.toList()));
|
||||
|
||||
// 导入时不需要处理的项目
|
||||
boolean isInitNull = CollectionUtils.isEmpty(effectiveList) && StringUtils.isEmpty(cellVal);
|
||||
if (!isError && !isInitNull && StringUtils.isNotBlank(cellVal)) {
|
||||
importHandleParam.getVariableArchiveItemSaves().add(VariableArchiveItemPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId(finalVariableArchive.getEmployeeId())
|
||||
.variableArchiveId(finalVariableArchive.getId())
|
||||
.variableItemId(variableItemId)
|
||||
.itemValue(cellVal)
|
||||
.creator(importHandleParam.getCurrentEmployeeId())
|
||||
.createTime(importHandleParam.getNowTime())
|
||||
.updateTime(importHandleParam.getNowTime())
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果当前校验行没问题,修改起始发薪日期和最终发薪日期等
|
||||
if (isError) {
|
||||
// 将前面添加好的数据给过滤掉
|
||||
importHandleParam.setVariableArchiveSaves(importHandleParam.getVariableArchiveSaves().stream().filter(f -> !finalVariableArchive.getId().equals(f.getId())).collect(Collectors.toList()));
|
||||
importHandleParam.setVariableArchiveItemSaves(importHandleParam.getVariableArchiveItemSaves().stream().filter(f -> !finalVariableArchive.getId().equals(f.getVariableArchiveId())).collect(Collectors.toList()));
|
||||
} else {
|
||||
importHandleParam.getVariableArchiveItemDelSalaryItemIds().addAll(needDelArchiveItemIds);
|
||||
}
|
||||
|
||||
return isError;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建浮动薪资档案对象
|
||||
*
|
||||
* @param employeeId
|
||||
* @param importHandleParam
|
||||
* @return
|
||||
*/
|
||||
public static VariableArchivePO buildVariableArchive(Long employeeId, VariableArchiveImportHandleParam importHandleParam) {
|
||||
VariableArchivePO variableArchivePO = importHandleParam.getVariableArchivesMap().get(employeeId);
|
||||
if (variableArchivePO == null) {
|
||||
// 新增浮动档案
|
||||
variableArchivePO = VariableArchivePO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId(employeeId)
|
||||
.salaryMonth(importHandleParam.getSalaryMonthDate())
|
||||
.createTime(importHandleParam.getNowTime())
|
||||
.updateTime(importHandleParam.getNowTime())
|
||||
.creator(importHandleParam.getCurrentEmployeeId())
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
importHandleParam.getVariableArchiveSaves().add(variableArchivePO);
|
||||
}
|
||||
return variableArchivePO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SalaryArchiveExcelBO{}";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.engine.salary.entity.datacollection.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 浮动薪酬档案明细
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableArchiveItemDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 浮动项目id
|
||||
*/
|
||||
private Long variableItemId;
|
||||
|
||||
/**
|
||||
* 浮动值
|
||||
*/
|
||||
private String itemValue;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.engine.salary.entity.datacollection.dto;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.salary.annotation.I18n;
|
||||
import com.engine.salary.annotation.SalaryTable;
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 浮动薪资档案列表
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SalaryTable(pageId = "bd985583-f84j-p2aj-p288-2hw3hosy6r6,", tableType = WeaTableType.CHECKBOX)
|
||||
public class VariableArchiveListDTO {
|
||||
|
||||
@TableTitle(title = "id", dataIndex = "id", key = "id")
|
||||
private Long id;
|
||||
|
||||
@TableTitle(title = "人员信息表的主键id", dataIndex = "employeeId", key = "employeeId")
|
||||
private Long employeeId;
|
||||
|
||||
private Date salaryMonth;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
|
||||
@I18n
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 分部
|
||||
*/
|
||||
@TableTitle(title = "分部", dataIndex = "subcompanyName", key = "subcompanyName")
|
||||
@I18n
|
||||
private String subcompanyName;
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
|
||||
@I18n
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
@TableTitle(title = "电话", dataIndex = "mobile", key = "mobile")
|
||||
private String mobile;
|
||||
|
||||
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
@TableTitle(title = "工号", dataIndex = "workcode", key = "workcode")
|
||||
private String workcode;
|
||||
|
||||
/**
|
||||
* 证件号码
|
||||
*/
|
||||
@TableTitle(title = "证件号码", dataIndex = "idNo", key = "idNo")
|
||||
private String idNo;
|
||||
|
||||
/**
|
||||
* 入职日期
|
||||
*/
|
||||
private String companystartdate;
|
||||
|
||||
/**
|
||||
* 离职日期
|
||||
*/
|
||||
private String dismissdate;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.engine.salary.entity.datacollection.dto;
|
||||
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 浮动薪资项目列表
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableItemListDTO {
|
||||
|
||||
@TableTitle(title = "id", dataIndex = "id", key = "id")
|
||||
private Long id;
|
||||
|
||||
@TableTitle(title = "项目名称", dataIndex = "name", key = "name")
|
||||
private String name;
|
||||
|
||||
@TableTitle(title = "字段类型", dataIndex = "dataType", key = "dataType")
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 是否可删除
|
||||
*/
|
||||
private boolean canDelete;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据采集-浮动薪酬导入参数
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableArchiveImportHandleParam {
|
||||
|
||||
// 上传文件id
|
||||
String imageId;
|
||||
|
||||
// 薪资所属月
|
||||
String salaryMonth;
|
||||
|
||||
Date salaryMonthDate;
|
||||
|
||||
// ---------------------------
|
||||
Long currentEmployeeId;
|
||||
|
||||
String tenantKey;
|
||||
|
||||
/**
|
||||
* 人员验证方式
|
||||
*/
|
||||
String empValidType;
|
||||
|
||||
/**
|
||||
* 获取租户下所有的人员
|
||||
*/
|
||||
List<DataCollectionEmployee> employees;
|
||||
|
||||
/**
|
||||
* 获取所有可被引用的浮动薪资项目
|
||||
*/
|
||||
List<VariableItemPO> variableItems;
|
||||
|
||||
/**
|
||||
* 查询已有的浮动薪资档案基本数据
|
||||
*/
|
||||
Map<Long, VariableArchivePO> variableArchivesMap;
|
||||
|
||||
/**
|
||||
* 浮动薪资项目id
|
||||
*/
|
||||
Collection<Long> variableItemIds;
|
||||
|
||||
/**
|
||||
* 查询已生效的浮动薪资项目数据
|
||||
*/
|
||||
Map<String, List<VariableArchiveItemPO>> effectiveItemListMap;
|
||||
|
||||
/**
|
||||
* 当前时间
|
||||
*/
|
||||
Date nowTime = new Date();
|
||||
|
||||
/**
|
||||
* 当天
|
||||
*/
|
||||
Date today = new Date();
|
||||
|
||||
/**
|
||||
* 待保存浮动薪资档案
|
||||
*/
|
||||
List<VariableArchivePO> variableArchiveSaves;
|
||||
|
||||
/**
|
||||
* 待保存浮动薪资档案-浮动薪资项目
|
||||
*/
|
||||
List<VariableArchiveItemPO> variableArchiveItemSaves;
|
||||
|
||||
/**
|
||||
* 待删除浮动薪资档案-浮动薪资项目
|
||||
*/
|
||||
List<Long> variableArchiveItemDelSalaryItemIds;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//数据采集-浮动薪酬查询参数
|
||||
public class VariableArchiveQueryParam extends BaseQueryParam {
|
||||
|
||||
// 主键id
|
||||
private Collection<Long> ids;
|
||||
|
||||
// 主键id
|
||||
private Long id;
|
||||
|
||||
// 薪资年月
|
||||
@DataCheck(require = true,message = "薪资所属月不能为空")
|
||||
private String salaryMonth;
|
||||
|
||||
private Date salaryMonthDate;
|
||||
|
||||
// 姓名
|
||||
private String username;
|
||||
|
||||
// 部门id
|
||||
private List<Long> departmentIds;
|
||||
|
||||
// 工号
|
||||
private String workcode;
|
||||
|
||||
// 下载模板是否带数据
|
||||
private boolean hasData;
|
||||
|
||||
private List<Long> employeeIds;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.VariableArchiveItemDTO;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//数据采集-浮动薪酬档案保存参数
|
||||
public class VariableArchiveSaveParam {
|
||||
|
||||
// 主键id
|
||||
private Long id;
|
||||
|
||||
// 薪资年月
|
||||
@DataCheck(require = true,message = "薪资所属月不能为空")
|
||||
private String salaryMonth;
|
||||
|
||||
private Date salaryMonthDate;
|
||||
|
||||
// 人员id
|
||||
private Long employeeId;
|
||||
|
||||
// 浮动值
|
||||
private List<VariableArchiveItemDTO> itemValueList;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
// 浮动薪酬项目查询参数
|
||||
public class VariableItemQueryParam extends BaseQueryParam {
|
||||
|
||||
/**
|
||||
* 浮动薪酬项目名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ids
|
||||
*/
|
||||
private List<Long> itemIds;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import com.engine.salary.util.valid.RuntimeTypeEnum;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableItemSaveParam {
|
||||
|
||||
//主键id
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "id不允许为空")
|
||||
private Long id;
|
||||
|
||||
//名称
|
||||
@DataCheck(require = true, max = 40, message = "名称不允许为空,名称不能超过40个字符")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字段类型
|
||||
* @see SalaryDataTypeEnum
|
||||
*/
|
||||
@DataCheck(require = true, message = "字段类型不允许为空")
|
||||
private String dataType;
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.engine.salary.entity.datacollection.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchiveItemPO
|
||||
* @date 2024/08/07 9:15
|
||||
* @description 浮动薪酬档案明细
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableArchiveItemPO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Long employeeId;
|
||||
|
||||
/**
|
||||
* 浮动薪资档案主键id
|
||||
*/
|
||||
private Long variableArchiveId;
|
||||
|
||||
/**
|
||||
* 浮动项目id
|
||||
*/
|
||||
private Long variableItemId;
|
||||
|
||||
/**
|
||||
* 浮动值
|
||||
*/
|
||||
private String itemValue;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 是否已删除。0:未删除、1:已删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantKey;
|
||||
|
||||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
private Collection<Long> variableArchiveIds;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.engine.salary.entity.datacollection.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchivePO
|
||||
* @date 2024/08/07 9:16
|
||||
* @description 浮动薪酬档案
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableArchivePO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private Long employeeId;
|
||||
|
||||
/**
|
||||
* 薪资月份
|
||||
*/
|
||||
private Date salaryMonth;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Long creator;
|
||||
|
||||
private Integer deleteType;
|
||||
|
||||
private String tenantKey;
|
||||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.engine.salary.entity.datacollection.po;
|
||||
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableItemPO
|
||||
* @date 2024/08/07 9:14
|
||||
* @description 浮动薪酬项目
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VariableItemPO {
|
||||
|
||||
/**
|
||||
* 浮动项目id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 浮动项目名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 字段类型。string:字符、number:数字
|
||||
*
|
||||
* @see SalaryDataTypeEnum
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Long creator;
|
||||
|
||||
private Integer deleteType;
|
||||
|
||||
private String tenantKey;
|
||||
|
||||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||
import com.engine.salary.annotation.SalaryFormulaVar;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.constant.SalaryFormulaFieldConstant;
|
||||
import com.engine.salary.constant.SalaryItemConstant;
|
||||
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
|
|
@ -95,6 +96,11 @@ public class CalculateFormulaVarBO {
|
|||
*/
|
||||
private List<SalaryAcctResultPO> salaryAcctResultPOS;
|
||||
|
||||
/**
|
||||
* 浮动薪资档案
|
||||
*/
|
||||
private List<Map<String, Object>> variableArchiveList;
|
||||
|
||||
public CalculateFormulaVarBO(List<DataCollectionEmployee> simpleEmployees,
|
||||
List<SalaryArchiveDataDTO> salaryArchiveData,
|
||||
List<AddUpSituation> addUpSituationPOS,
|
||||
|
|
@ -102,7 +108,8 @@ public class CalculateFormulaVarBO {
|
|||
List<OtherDeductionPO> otherDeductionPOS,
|
||||
List<Map<String, Object>> welfareData,
|
||||
List<AttendQuoteDataDTO> attendQuoteDataDTOS,
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS) {
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS,
|
||||
List<Map<String, Object>> variableArchiveList) {
|
||||
this.simpleEmployees = simpleEmployees;
|
||||
this.salaryArchiveData = salaryArchiveData;
|
||||
this.addUpSituationPOS = addUpSituationPOS;
|
||||
|
|
@ -111,6 +118,7 @@ public class CalculateFormulaVarBO {
|
|||
this.welfareData = welfareData;
|
||||
this.attendQuoteDataDTOS = attendQuoteDataDTOS;
|
||||
this.salaryAcctResultPOS = salaryAcctResultPOS;
|
||||
this.variableArchiveList = variableArchiveList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,6 +133,8 @@ public class CalculateFormulaVarBO {
|
|||
handleSalaryAcctResult(salaryAcctCalculateBO, resultMap);
|
||||
// 处理薪资档案
|
||||
handleSalaryArchiveData(salaryAcctCalculateBO, resultMap);
|
||||
// 处理浮动薪资档案
|
||||
handleVariableArchiveData(salaryAcctCalculateBO, resultMap);
|
||||
// 处理往期累计情况
|
||||
handleAddUpSituation(resultMap);
|
||||
// 处理累计专项附加扣除
|
||||
|
|
@ -242,6 +252,31 @@ public class CalculateFormulaVarBO {
|
|||
}
|
||||
}
|
||||
|
||||
private void handleVariableArchiveData(SalaryAcctCalculateBO salaryAcctCalculateBO, Map<String, List<FormulaVarValue>> resultMap) {
|
||||
// 浮动薪资可选字段
|
||||
Map<Long, List<FormulaVarValue>> tempMap = Maps.newHashMapWithExpectedSize(variableArchiveList.size());
|
||||
variableArchiveList.forEach(map -> {
|
||||
Long key = Long.valueOf(map.get("employeeId").toString());
|
||||
List<FormulaVarValue> formulaVarValues = tempMap.computeIfAbsent(key, k -> Lists.newArrayList());
|
||||
formulaVarValues.addAll(salaryAcctCalculateBO.getVariableItems().stream().map(field -> {
|
||||
String fieldId = SalaryFormulaReferenceEnum.VARIABLE_ITEM.getValue()
|
||||
+ SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR
|
||||
+ field.getCode();
|
||||
|
||||
|
||||
String value = map.getOrDefault(field.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, StringUtils.EMPTY) == null ? StringUtils.EMPTY
|
||||
: map.getOrDefault(field.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, StringUtils.EMPTY).toString();
|
||||
return new FormulaVarValue().setFieldId(fieldId).setFieldValue(value);
|
||||
}).collect(Collectors.toList()));
|
||||
});
|
||||
// 填充到返回结果集中
|
||||
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
|
||||
List<FormulaVarValue> formulaVarValues = resultMap.computeIfAbsent(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId(),
|
||||
k -> Lists.newArrayList());
|
||||
formulaVarValues.addAll(tempMap.getOrDefault(salaryAcctEmployeePO.getEmployeeId(), Collections.emptyList()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据调薪计薪规则处理薪资档案的调薪,转换成公式编辑器中的变量
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.entity.salaryacct.bo;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
|
|
@ -125,6 +126,11 @@ public class SalaryAcctCalculateBO {
|
|||
*/
|
||||
private TaxDeclarationFunctionEnum taxDeclarationFunction;
|
||||
|
||||
/**
|
||||
* 浮动薪资字段
|
||||
*/
|
||||
private List<VariableItemPO> variableItems;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class Result {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public enum SalaryFormulaReferenceEnum implements BaseEnum<String> {
|
|||
OTHER_DEDUCTION("otherDeduction", "其他免税扣除", 93849),
|
||||
SALARY_ACCT_EMPLOYEE("salaryAcctEmployee", "核算基本信息", 85368),
|
||||
SALARY_CYCLE("SalaryCycle", "核算日期", 85368),
|
||||
VARIABLE_ITEM("variableItem", "浮动薪资项目", 0),
|
||||
ISSUED("ISSUED", "已发", 0);
|
||||
|
||||
private String value;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
package com.engine.salary.mapper.datacollection;
|
||||
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchiveItemMapper
|
||||
* @date 2024/08/07 9:22
|
||||
* @description 浮动薪酬档案明细
|
||||
*/
|
||||
public interface VariableArchiveItemMapper {
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<VariableArchiveItemPO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<VariableArchiveItemPO> listSome(@Param("param") VariableArchiveItemPO variableArchiveItem);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
VariableArchiveItemPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param variableArchiveItem 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(VariableArchiveItemPO variableArchiveItem);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param variableArchiveItem 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(VariableArchiveItemPO variableArchiveItem);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param variableArchiveItem 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(VariableArchiveItemPO variableArchiveItem);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param variableArchiveItem 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(VariableArchiveItemPO variableArchiveItem);
|
||||
|
||||
/**
|
||||
* 查询浮动薪酬档案中已使用的浮动薪资项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Long> listUsingItems();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param insertList
|
||||
* @return
|
||||
*/
|
||||
int batchInsert(@Param("collection") List<VariableArchiveItemPO> insertList);
|
||||
|
||||
void deleteByIds(@Param("collection")List<Long> part);
|
||||
|
||||
void deleteByArchiveIds(@Param("collection")List<Long> part);
|
||||
}
|
||||
|
|
@ -0,0 +1,349 @@
|
|||
<?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.datacollection.VariableArchiveItemMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
||||
<result column="id" property="id" />
|
||||
<result column="employee_id" property="employeeId" />
|
||||
<result column="variable_archive_id" property="variableArchiveId" />
|
||||
<result column="variable_item_id" property="variableItemId" />
|
||||
<result column="item_value" property="itemValue" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="delete_type" property="deleteType" />
|
||||
<result column="tenant_key" property="tenantKey" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
, t.employee_id
|
||||
, t.variable_archive_id
|
||||
, t.variable_item_id
|
||||
, t.item_value
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_archive_item t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_archive_item t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_archive_item t
|
||||
WHERE delete_type = 0
|
||||
<if test="param.id != null">
|
||||
AND id = #{param.id}
|
||||
</if>
|
||||
<if test="param.employeeId != null">
|
||||
AND employee_id = #{param.employeeId}
|
||||
</if>
|
||||
<if test="param.variableArchiveId != null">
|
||||
AND variable_archive_id = #{param.variableArchiveId}
|
||||
</if>
|
||||
<if test="param.variableItemId != null">
|
||||
AND variable_item_id = #{param.variableItemId}
|
||||
</if>
|
||||
<if test="param.itemValue != null">
|
||||
AND item_value = #{param.itemValue}
|
||||
</if>
|
||||
<if test="param.createTime != null">
|
||||
AND create_time = #{param.createTime}
|
||||
</if>
|
||||
<if test="param.updateTime != null">
|
||||
AND update_time = #{param.updateTime}
|
||||
</if>
|
||||
<if test="param.creator != null">
|
||||
AND creator = #{param.creator}
|
||||
</if>
|
||||
<if test="param.deleteType != null">
|
||||
AND delete_type = #{param.deleteType}
|
||||
</if>
|
||||
<if test="param.tenantKey != null">
|
||||
AND tenant_key = #{param.tenantKey}
|
||||
</if>
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.variableArchiveIds != null and param.variableArchiveIds.size()>0">
|
||||
AND variable_archive_id IN
|
||||
<foreach collection="param.variableArchiveIds" open="(" item="varArchId" separator="," close=")">
|
||||
#{varArchId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<select id="listUsingItems" resultType="java.lang.Long">
|
||||
select distinct variable_item_id
|
||||
from hrsa_variable_archive_item
|
||||
where delete_type = 0
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
||||
INSERT INTO hrsa_variable_archive_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="employeeId != null">
|
||||
employee_id,
|
||||
</if>
|
||||
<if test="variableArchiveId != null">
|
||||
variable_archive_id,
|
||||
</if>
|
||||
<if test="variableItemId != null">
|
||||
variable_item_id,
|
||||
</if>
|
||||
<if test="itemValue != null">
|
||||
item_value,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null" >
|
||||
#{id},
|
||||
</if>
|
||||
<if test="employeeId != null" >
|
||||
#{employeeId},
|
||||
</if>
|
||||
<if test="variableArchiveId != null" >
|
||||
#{variableArchiveId},
|
||||
</if>
|
||||
<if test="variableItemId != null" >
|
||||
#{variableItemId},
|
||||
</if>
|
||||
<if test="itemValue != null" >
|
||||
#{itemValue},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null" >
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null" >
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null" >
|
||||
#{tenantKey},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO hrsa_variable_archive_item (
|
||||
id
|
||||
, employee_id
|
||||
, variable_archive_id
|
||||
, variable_item_id
|
||||
, item_value
|
||||
, create_time
|
||||
, update_time
|
||||
, creator
|
||||
, delete_type
|
||||
, tenant_key
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.employeeId},
|
||||
#{item.variableArchiveId},
|
||||
#{item.variableItemId},
|
||||
#{item.itemValue},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.creator},
|
||||
#{item.deleteType},
|
||||
#{item.tenantKey}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="oracle">
|
||||
INSERT INTO hrsa_variable_archive_item (
|
||||
id
|
||||
, employee_id
|
||||
, variable_archive_id
|
||||
, variable_item_id
|
||||
, item_value
|
||||
, create_time
|
||||
, update_time
|
||||
, creator
|
||||
, delete_type
|
||||
, tenant_key
|
||||
)
|
||||
|
||||
<foreach collection="collection" item="item" separator="union all">
|
||||
select
|
||||
#{item.id,jdbcType=DOUBLE},
|
||||
#{item.employeeId,jdbcType=DOUBLE},
|
||||
#{item.variableArchiveId,jdbcType=DOUBLE},
|
||||
#{item.variableItemId,jdbcType=DOUBLE},
|
||||
#{item.itemValue,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=DATE},
|
||||
#{item.updateTime,jdbcType=DATE},
|
||||
#{item.creator,jdbcType=DOUBLE},
|
||||
#{item.deleteType,jdbcType=INTEGER},
|
||||
#{item.tenantKey,jdbcType=VARCHAR}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="sqlserver">
|
||||
<foreach collection="collection" item="item" separator=";">
|
||||
INSERT INTO hrsa_variable_archive_item (
|
||||
id
|
||||
, employee_id
|
||||
, variable_archive_id
|
||||
, variable_item_id
|
||||
, item_value
|
||||
, create_time
|
||||
, update_time
|
||||
, creator
|
||||
, delete_type
|
||||
, tenant_key
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{item.id},
|
||||
#{item.employeeId},
|
||||
#{item.variableArchiveId},
|
||||
#{item.variableItemId},
|
||||
#{item.itemValue},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.creator},
|
||||
#{item.deleteType},
|
||||
#{item.tenantKey}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
||||
UPDATE hrsa_variable_archive_item
|
||||
<set>
|
||||
employee_id=#{employeeId},
|
||||
variable_archive_id=#{variableArchiveId},
|
||||
variable_item_id=#{variableItemId},
|
||||
item_value=#{itemValue},
|
||||
create_time=#{createTime},
|
||||
update_time=#{updateTime},
|
||||
creator=#{creator},
|
||||
delete_type=#{deleteType},
|
||||
tenant_key=#{tenantKey},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
||||
UPDATE hrsa_variable_archive_item
|
||||
<set>
|
||||
<if test="employeeId != null" >
|
||||
employee_id=#{employeeId},
|
||||
</if>
|
||||
<if test="variableArchiveId != null" >
|
||||
variable_archive_id=#{variableArchiveId},
|
||||
</if>
|
||||
<if test="variableItemId != null" >
|
||||
variable_item_id=#{variableItemId},
|
||||
</if>
|
||||
<if test="itemValue != null" >
|
||||
item_value=#{itemValue},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null" >
|
||||
creator=#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null" >
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null" >
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableArchiveItemPO">
|
||||
UPDATE hrsa_variable_archive_item
|
||||
SET delete_type=1
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
UPDATE hrsa_variable_archive_item
|
||||
SET delete_type=1
|
||||
WHERE delete_type = 0
|
||||
<if test="collection != null and collection.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByArchiveIds">
|
||||
UPDATE hrsa_variable_archive_item
|
||||
SET delete_type=1
|
||||
WHERE delete_type = 0
|
||||
<if test="collection != null and collection.size()>0">
|
||||
AND variable_archive_id IN
|
||||
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.engine.salary.mapper.datacollection;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchiveMapper
|
||||
* @date 2024/08/07 9:18
|
||||
* @description 浮动薪酬档案
|
||||
*/
|
||||
public interface VariableArchiveMapper {
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<VariableArchivePO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<VariableArchivePO> listSome(VariableArchivePO variableArchive);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
VariableArchivePO getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param variableArchive 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(VariableArchivePO variableArchive);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param variableArchive 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(VariableArchivePO variableArchive);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param variableArchive 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(VariableArchivePO variableArchive);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param variableArchive 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(VariableArchivePO variableArchive);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param variableArchiveIds 待删除的记录id
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int deleteByIds(@Param("ids")List<Long> variableArchiveIds);
|
||||
|
||||
List<VariableArchiveListDTO> list(@Param("param")VariableArchiveQueryParam queryParam);
|
||||
}
|
||||
|
|
@ -0,0 +1,366 @@
|
|||
<?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.datacollection.VariableArchiveMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableArchivePO">
|
||||
<result column="id" property="id" />
|
||||
<result column="employee_id" property="employeeId" />
|
||||
<result column="salary_month" property="salaryMonth" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="delete_type" property="deleteType" />
|
||||
<result column="tenant_key" property="tenantKey" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
, t.employee_id
|
||||
, t.salary_month
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_archive t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_archive t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_archive t
|
||||
WHERE delete_type = 0
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="employeeId != null">
|
||||
AND employee_id = #{employeeId}
|
||||
</if>
|
||||
<if test="salaryMonth != null">
|
||||
AND salary_month = #{salaryMonth}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</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>
|
||||
|
||||
|
||||
<sql id="variableArchiveColumn">
|
||||
t.id
|
||||
, t.employee_id
|
||||
, t.salary_month
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, e.mobile
|
||||
, e.workcode
|
||||
, e.certificatenum as idNo
|
||||
, e.lastname as username
|
||||
, e.certificatenum as idNo
|
||||
, e.companystartdate as companystartdate
|
||||
, e.enddate as dismissdate
|
||||
, d.departmentname AS departmentName
|
||||
, c.subcompanyname AS subcompanyName
|
||||
</sql>
|
||||
|
||||
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO">
|
||||
SELECT
|
||||
<include refid="variableArchiveColumn" />
|
||||
FROM hrsa_variable_archive t
|
||||
LEFT JOIN hrmresource e ON e.id = t.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
||||
WHERE delete_type = 0
|
||||
and e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<!-- 薪资所属月 -->
|
||||
<if test="param.salaryMonth != null">
|
||||
AND t.salary_month = #{param.salaryMonthDate}
|
||||
</if>
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 姓名 -->
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like CONCAT('%',#{param.username},'%')
|
||||
</if>
|
||||
<!-- 工号 -->
|
||||
<if test="param.workcode != null and param.workcode != ''">
|
||||
AND e.workcode like CONCAT('%',#{param.workcode},'%')
|
||||
</if>
|
||||
<!-- 部门 -->
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.employeeIds != null and param.employeeIds.size()>0">
|
||||
AND t.employee_id IN
|
||||
<foreach collection="param.employeeIds" open="(" item="empId" separator="," close=")">
|
||||
#{empId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 排序 -->
|
||||
<if test="param.orderRule != null">
|
||||
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||
</if>
|
||||
</select>
|
||||
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO" databaseId="oracle">
|
||||
SELECT
|
||||
<include refid="variableArchiveColumn" />
|
||||
FROM hrsa_variable_archive t
|
||||
LEFT JOIN hrmresource e ON e.id = t.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
||||
WHERE delete_type = 0
|
||||
and e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<!-- 薪资所属月 -->
|
||||
<if test="param.salaryMonth != null">
|
||||
AND t.salary_month = #{param.salaryMonthDate}
|
||||
</if>
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 姓名 -->
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'||#{param.username}||'%'
|
||||
</if>
|
||||
<!-- 工号 -->
|
||||
<if test="param.workcode != null and param.workcode != ''">
|
||||
AND e.workcode like '%'||#{param.workcode}||'%'
|
||||
</if>
|
||||
<!-- 部门 -->
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.employeeIds != null and param.employeeIds.size()>0">
|
||||
AND t.employee_id IN
|
||||
<foreach collection="param.employeeIds" open="(" item="empId" separator="," close=")">
|
||||
#{empId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 排序 -->
|
||||
<if test="param.orderRule != null">
|
||||
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||
</if>
|
||||
</select>
|
||||
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO" databaseId="sqlserver">
|
||||
SELECT
|
||||
<include refid="variableArchiveColumn" />
|
||||
FROM hrsa_variable_archive t
|
||||
LEFT JOIN hrmresource e ON e.id = t.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
||||
WHERE delete_type = 0
|
||||
and e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<!-- 薪资所属月 -->
|
||||
<if test="param.salaryMonth != null">
|
||||
AND t.salary_month = #{param.salaryMonthDate}
|
||||
</if>
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 姓名 -->
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'+#{param.username}+'%'
|
||||
</if>
|
||||
<!-- 工号 -->
|
||||
<if test="param.workcode != null and param.workcode != ''">
|
||||
AND e.workcode like '%'+#{workcode}+'%'
|
||||
</if>
|
||||
<!-- 部门 -->
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.employeeIds != null and param.employeeIds.size()>0">
|
||||
AND t.employee_id IN
|
||||
<foreach collection="param.employeeIds" open="(" item="empId" separator="," close=")">
|
||||
#{empId}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 排序 -->
|
||||
<if test="param.orderRule != null">
|
||||
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
|
||||
INSERT INTO hrsa_variable_archive
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="employeeId != null">
|
||||
employee_id,
|
||||
</if>
|
||||
<if test="salaryMonth != null">
|
||||
salary_month,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null" >
|
||||
#{id},
|
||||
</if>
|
||||
<if test="employeeId != null" >
|
||||
#{employeeId},
|
||||
</if>
|
||||
<if test="salaryMonth != null" >
|
||||
#{salaryMonth},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null" >
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null" >
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null" >
|
||||
#{tenantKey},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
|
||||
UPDATE hrsa_variable_archive
|
||||
<set>
|
||||
employee_id=#{employeeId},
|
||||
salary_month=#{salaryMonth},
|
||||
create_time=#{createTime},
|
||||
update_time=#{updateTime},
|
||||
creator=#{creator},
|
||||
delete_type=#{deleteType},
|
||||
tenant_key=#{tenantKey},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
|
||||
UPDATE hrsa_variable_archive
|
||||
<set>
|
||||
<if test="employeeId != null" >
|
||||
employee_id=#{employeeId},
|
||||
</if>
|
||||
<if test="salaryMonth != null" >
|
||||
salary_month=#{salaryMonth},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null" >
|
||||
creator=#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null" >
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null" >
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<update id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableArchivePO">
|
||||
UPDATE hrsa_variable_archive
|
||||
SET delete_type=1
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<update id="deleteByIds">
|
||||
UPDATE hrsa_variable_archive
|
||||
SET delete_type=1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.engine.salary.mapper.datacollection;
|
||||
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableItemMapper
|
||||
* @date 2024/08/07 9:26
|
||||
* @description 浮动薪酬项目
|
||||
*/
|
||||
public interface VariableItemMapper {
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<VariableItemPO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<VariableItemPO> listSome(VariableItemPO variableItem);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
VariableItemPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param variableItem 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(VariableItemPO variableItem);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param variableItem 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(VariableItemPO variableItem);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param variableItem 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(VariableItemPO variableItem);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param variableItem 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(VariableItemPO variableItem);
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<?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.datacollection.VariableItemMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.VariableItemPO">
|
||||
<result column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="code" property="code" />
|
||||
<result column="data_type" property="dataType" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="delete_type" property="deleteType" />
|
||||
<result column="tenant_key" property="tenantKey" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.id
|
||||
, t.name
|
||||
, t.code
|
||||
, t.data_type
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_item t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_item t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_variable_item t
|
||||
WHERE delete_type = 0
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="code != null">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="dataType != null">
|
||||
AND data_type = #{dataType}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</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.datacollection.po.VariableItemPO">
|
||||
INSERT INTO hrsa_variable_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code,
|
||||
</if>
|
||||
<if test="dataType != null">
|
||||
data_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null" >
|
||||
#{id},
|
||||
</if>
|
||||
<if test="name != null" >
|
||||
#{name},
|
||||
</if>
|
||||
<if test="code != null" >
|
||||
#{code},
|
||||
</if>
|
||||
<if test="dataType != null" >
|
||||
#{dataType},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null" >
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null" >
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null" >
|
||||
#{tenantKey},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
|
||||
UPDATE hrsa_variable_item
|
||||
<set>
|
||||
name=#{name},
|
||||
code=#{code},
|
||||
data_type=#{dataType},
|
||||
create_time=#{createTime},
|
||||
update_time=#{updateTime},
|
||||
creator=#{creator},
|
||||
delete_type=#{deleteType},
|
||||
tenant_key=#{tenantKey},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
|
||||
UPDATE hrsa_variable_item
|
||||
<set>
|
||||
<if test="name != null" >
|
||||
name=#{name},
|
||||
</if>
|
||||
<if test="code != null" >
|
||||
code=#{code},
|
||||
</if>
|
||||
<if test="dataType != null" >
|
||||
data_type=#{dataType},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
<if test="creator != null" >
|
||||
creator=#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null" >
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="tenantKey != null" >
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.VariableItemPO">
|
||||
UPDATE hrsa_variable_item
|
||||
SET delete_type=1
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchiveItemService
|
||||
* @date 2024/08/07 9:29
|
||||
* @description 浮动薪资档案明细值
|
||||
*/
|
||||
public interface VariableArchiveItemService {
|
||||
|
||||
/**
|
||||
* 根据浮动薪资档案id获取
|
||||
*
|
||||
* @param variableArchiveIds
|
||||
* @return
|
||||
*/
|
||||
List<VariableArchiveItemPO> listByVariableArchiveIds(List<Long> variableArchiveIds);
|
||||
|
||||
/**
|
||||
* 查询浮动薪酬档案中已使用的浮动薪资项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Long> listUsingItems();
|
||||
|
||||
int batchInsert(List<VariableArchiveItemPO> variableArchiveItemList);
|
||||
|
||||
void deleteByIds(List<Long> variableArchiveItemIds);
|
||||
|
||||
void deleteByArchiveIds(List<Long> variableArchiveIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveSaveParam;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据采集-浮动薪酬
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface VariableArchiveService {
|
||||
|
||||
/**
|
||||
* 查询浮动薪酬档案(分页)
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
PageInfo<VariableArchiveListDTO> listPage(VariableArchiveQueryParam queryParam);
|
||||
|
||||
List<VariableArchiveListDTO> list(VariableArchiveQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 构建浮动薪资档案数据
|
||||
*
|
||||
* @param variableArchives
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives);
|
||||
|
||||
/**
|
||||
* 创建浮动薪酬档案
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
void createData(VariableArchiveSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 浮动薪资档案明细
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getDetail(VariableArchiveQueryParam queryParam);
|
||||
|
||||
List<VariableItemListDTO> getCreateForm();
|
||||
|
||||
XSSFWorkbook downloadTemplate(VariableArchiveQueryParam param);
|
||||
|
||||
Map<String, Object> preview(VariableArchiveImportHandleParam importParam);
|
||||
|
||||
Map<String, Object> importData(VariableArchiveImportHandleParam importParam);
|
||||
|
||||
XSSFWorkbook export(VariableArchiveQueryParam param);
|
||||
|
||||
void deleteSelectVariableArchive(Collection<Long> deleteIds);
|
||||
|
||||
List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableItemService
|
||||
* @date 2024/08/07 9:30
|
||||
* @description 浮动薪酬项目
|
||||
*/
|
||||
public interface VariableItemService {
|
||||
|
||||
VariableItemPO getById(Long id);
|
||||
|
||||
List<VariableItemPO> listByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取所有的浮动薪酬项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<VariableItemPO> listAll();
|
||||
|
||||
/**
|
||||
* 获取浮动薪资项目列表(分页)
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
PageInfo<VariableItemListDTO> listPage(VariableItemQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新建浮动薪酬项目
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
Integer save(VariableItemSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 更新浮动薪酬项目
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
VariableItemPO update(VariableItemSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 删除浮动薪资项目
|
||||
*
|
||||
* @param itemIds
|
||||
*/
|
||||
void deleteItems(List<Long> itemIds);
|
||||
|
||||
/**
|
||||
* 浮动薪酬项目详细信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
VariableItemListDTO getDetail(Long id);
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|||
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.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaTaxRateDTO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
|
|
@ -77,6 +78,10 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
|
|||
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableItemService getVariableItemService(User user) {
|
||||
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ExcelResult aggregation(AggFunc func, String sourceId, String fieldId, List<FormulaFilterData> filterFormDataList, Map<String, Object> extendParam,
|
||||
// DataCollectionEmployee employee) {
|
||||
|
|
@ -166,6 +171,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
|
|||
case SALARY_CYCLE:
|
||||
vars = convert2FormulaVar(SalarySobCycleDTO.class, referenceEnum.getValue() + "");
|
||||
break;
|
||||
case VARIABLE_ITEM:
|
||||
vars = variableArchives2FormulaVar(referenceEnum, extendParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -251,6 +259,8 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
|
|||
convert2FormulaVar(SalaryAcctEmployeePO.class, SalarySQLReferenceEnum.SALARY_ACCT_EMPLOYEE.getValue() + ""));
|
||||
result.put(SalarySQLReferenceEnum.SALARY_CYCLE.getDefaultLabel(),
|
||||
convert2FormulaVar(SalarySobCycleDTO.class, SalarySQLReferenceEnum.SALARY_CYCLE.getValue() + ""));
|
||||
result.put(SalaryFormulaReferenceEnum.VARIABLE_ITEM.getDefaultLabel(),
|
||||
variableArchives2FormulaVar(SalaryFormulaReferenceEnum.VARIABLE_ITEM, null));
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
|
|
@ -402,6 +412,20 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
|
|||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<FormulaVar> variableArchives2FormulaVar(SalaryFormulaReferenceEnum referenceEnum, Map<String, Object> extendParam) {
|
||||
List<VariableItemPO> variableItems;
|
||||
variableItems = getVariableItemService(user).listAll();
|
||||
return variableItems.stream()
|
||||
.map(e -> {
|
||||
FormulaVar formulaVar = new FormulaVar();
|
||||
formulaVar.setFieldId(referenceEnum.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + e.getCode());
|
||||
formulaVar.setName(e.getName());
|
||||
formulaVar.setSource("" + referenceEnum.getValue());
|
||||
formulaVar.setFieldType(e.getDataType());
|
||||
return formulaVar;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private <T> List<FormulaVar> convert2FormulaVar(Class<T> clazz, String formId) {
|
||||
Field[] declaredFields = clazz.getDeclaredFields();
|
||||
List<FormulaVar> formulaVars = Lists.newArrayListWithExpectedSize(declaredFields.length);
|
||||
|
|
|
|||
|
|
@ -110,6 +110,10 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableArchiveService getVariableArchiveService(User user) {
|
||||
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
|
||||
StopWatch sw = new StopWatch("核算耗时明细,id:" + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId() + "");
|
||||
|
|
@ -158,6 +162,10 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
sw.stop();
|
||||
// 查询浮动薪资
|
||||
sw.start("查询浮动薪资");
|
||||
List<Map<String, Object>> variableArchiveList = getVariableArchiveService(user).listBySalaryMonthAndEmployeeIds(salarySobCycleDTO.getSalaryMonth(), employeeIds);
|
||||
sw.stop();
|
||||
// 薪资回算时回算前的核算结果 (没有回算项)
|
||||
sw.start("查询薪资回算时回算前的核算结果");
|
||||
Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId()));
|
||||
|
|
@ -181,7 +189,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
sw.stop();
|
||||
// 10、转换成公式编辑器中的变量
|
||||
sw.start("转换成公式编辑器中的变量");
|
||||
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS);
|
||||
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList);
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
|
||||
sw.stop();
|
||||
sw.start("数据结构准备");
|
||||
|
|
@ -211,6 +219,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
for (List<Long> salaryItemIds : salaryAcctCalculateBO.getSalaryItemIdWithPriorityList()) {
|
||||
// 同一运算优先级下的薪资项目逐个独立运算
|
||||
for (Long salaryItemId : salaryItemIds) {
|
||||
if (salaryItemId.equals(1723115683903L)) {
|
||||
System.out.println("d");
|
||||
}
|
||||
String resultValue;
|
||||
SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId);
|
||||
ExpressFormula expressFormula;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
|||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.hrm.DeptInfo;
|
||||
import com.engine.salary.entity.hrm.JobCallInfo;
|
||||
import com.engine.salary.entity.hrm.PositionInfo;
|
||||
|
|
@ -191,6 +192,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableItemService getVariableItemService(User user) {
|
||||
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryCheckResultService salaryCheckResultService;
|
||||
|
||||
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
|
||||
|
|
@ -803,6 +808,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
Map<String, String> welfareColumns = getSIAccountService(user).welfareColumns();
|
||||
// 7、查询考勤引用的所有字段
|
||||
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
|
||||
List<VariableItemPO> variableItemPOS = getVariableItemService(user).listAll();
|
||||
|
||||
// 8、查询公式详情
|
||||
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
|
||||
|
|
@ -877,6 +883,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
.setChildMonitor(childMonitor)
|
||||
.setResults(calculateResults)
|
||||
.setCalculateKey(calculateKey)
|
||||
.setVariableItems(variableItemPOS)
|
||||
.setTaxDeclarationFunction(taxDeclarationFunction);
|
||||
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
|
||||
LocalRunnable localRunnable = new LocalRunnable() {
|
||||
|
|
|
|||
|
|
@ -407,6 +407,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listVarByFormulaIds(usingFormulaIds);
|
||||
List<String> itemCode = formulaVars.stream()
|
||||
.map(FormulaVar::getFieldId)
|
||||
.map(v -> v.replaceAll("variableItem_", ""))
|
||||
.map(v -> v.replaceAll("salaryItem_", ""))
|
||||
.map(v -> v.replaceAll("salaryArchives_", ""))
|
||||
.map(v -> v.replaceAll("ISSUED_", ""))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
|
||||
import com.engine.salary.mapper.datacollection.VariableArchiveItemMapper;
|
||||
import com.engine.salary.service.VariableArchiveItemService;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchiveItemServiceImpl
|
||||
* @date 2024/08/07 9:29
|
||||
* @description 浮动薪酬档案明细
|
||||
*/
|
||||
public class VariableArchiveItemServiceImpl extends Service implements VariableArchiveItemService {
|
||||
|
||||
private VariableArchiveItemMapper getVariableArchiveItemMapper(){
|
||||
return MapperProxyFactory.getProxy(VariableArchiveItemMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据浮动薪资档案id获取
|
||||
*
|
||||
* @param variableArchiveIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<VariableArchiveItemPO> listByVariableArchiveIds(List<Long> variableArchiveIds) {
|
||||
if (CollectionUtils.isEmpty(variableArchiveIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询浮动薪酬档案中已使用的浮动薪资项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> listUsingItems() {
|
||||
return getVariableArchiveItemMapper().listUsingItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<VariableArchiveItemPO> insertList) {
|
||||
return getVariableArchiveItemMapper().batchInsert(insertList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByArchiveIds(List<Long> variableArchiveIds) {
|
||||
if (CollectionUtils.isEmpty(variableArchiveIds)) {
|
||||
return;
|
||||
}
|
||||
List<List<Long>> partition = Lists.partition(variableArchiveIds, 500);
|
||||
partition.forEach(part -> getVariableArchiveItemMapper().deleteByArchiveIds(part));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(List<Long> variableArchiveItemIds) {
|
||||
if (CollectionUtils.isEmpty(variableArchiveItemIds)) {
|
||||
return;
|
||||
}
|
||||
List<List<Long>> partition = Lists.partition(variableArchiveItemIds, 500);
|
||||
partition.forEach(part -> getVariableArchiveItemMapper().deleteByIds(part));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,567 @@
|
|||
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.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.constant.SalaryItemConstant;
|
||||
import com.engine.salary.entity.datacollection.bo.VariableArchiveBO;
|
||||
import com.engine.salary.entity.datacollection.bo.VariableArchiveExcelBO;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveSaveParam;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableArchivePO;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveInitImportDTO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.VariableArchiveMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.excel.ExcelComment;
|
||||
import com.engine.salary.util.excel.ExcelParseHelper;
|
||||
import com.engine.salary.util.excel.ExcelSupport;
|
||||
import com.engine.salary.util.excel.ExcelUtilPlus;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
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 org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableArchiveServiceImpl
|
||||
* @date 2024/08/06 17:40
|
||||
* @description 浮动薪酬档案
|
||||
*/
|
||||
public class VariableArchiveServiceImpl extends Service implements VariableArchiveService {
|
||||
|
||||
private VariableArchiveMapper getVariableArchiveMapper(){
|
||||
return MapperProxyFactory.getProxy(VariableArchiveMapper.class);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public SalarySysConfService getSalarySysConfService(User user) {
|
||||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableArchiveItemService getVariableArchiveItemService(User user) {
|
||||
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableItemService getVariableItemService(User user) {
|
||||
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private int deleteByIds(List<Long> deleteIds) {
|
||||
if (CollectionUtils.isEmpty(deleteIds)) {
|
||||
return 0;
|
||||
}
|
||||
return getVariableArchiveMapper().deleteByIds(deleteIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪酬档案列表
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<VariableArchiveListDTO> listPage(VariableArchiveQueryParam queryParam) {
|
||||
List<VariableArchiveListDTO> variableArchiveList = list(queryParam);
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), variableArchiveList, VariableArchiveListDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VariableArchiveListDTO> list(VariableArchiveQueryParam queryParam) {
|
||||
ValidUtil.doValidator(queryParam);
|
||||
Long employeeId = Long.valueOf(user.getUID());
|
||||
// 判断是否是“总管理员”
|
||||
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
|
||||
// 是否开启分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
|
||||
if (BooleanUtils.isTrue(openDevolution) && !isChief && CollectionUtils.isEmpty(taxAgentPOS)) {
|
||||
// 无权限
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 浮动薪酬档案列表
|
||||
if (Objects.nonNull(queryParam.getSalaryMonth())) {
|
||||
queryParam.setSalaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(queryParam.getSalaryMonth()));
|
||||
}
|
||||
//排序配置
|
||||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
queryParam.setOrderRule(orderRule);
|
||||
return getVariableArchiveMapper().list(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建浮动薪资档案数据
|
||||
*
|
||||
* @param variableArchives
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives) {
|
||||
if (CollectionUtils.isEmpty(variableArchives)) {
|
||||
// 无数据
|
||||
}
|
||||
List<Long> variableArchiveIds = variableArchives.stream().map(VariableArchiveListDTO::getId).collect(Collectors.toList());
|
||||
// 获取浮动薪资档案所对应的浮动薪资项目数据
|
||||
List<VariableArchiveItemPO> variableArchiveItemList= getVariableArchiveItemService(user).listByVariableArchiveIds(variableArchiveIds);
|
||||
Map<Long, List<VariableArchiveItemPO>> variableArchiveItemMap = SalaryEntityUtil.group2Map(variableArchiveItemList, VariableArchiveItemPO::getVariableArchiveId);
|
||||
List<Map<String, Object>> variableArchiveItemData = variableArchives.stream().map(m -> {
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
map.put("variableArchiveId", m.getId());
|
||||
List<VariableArchiveItemPO> variableArchiveItemValuelList = variableArchiveItemMap.getOrDefault(m.getId(), Collections.emptyList());
|
||||
variableArchiveItemValuelList.forEach(i -> {
|
||||
map.put(i.getVariableItemId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX, i.getItemValue());
|
||||
});
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
// 组装数据
|
||||
List<Map<String, Object>> listMaps = new ArrayList<>();
|
||||
variableArchives.forEach(e -> {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id", e.getId());
|
||||
map.put("username", e.getUsername());
|
||||
map.put("salaryMonth", SalaryDateUtil.getFormatYearMonth(e.getSalaryMonth()));
|
||||
map.put("employeeId", e.getEmployeeId());
|
||||
map.put("subcompanyName", e.getSubcompanyName());
|
||||
map.put("departmentName", e.getDepartmentName());
|
||||
map.put("mobile", e.getMobile());
|
||||
map.put("workcode", e.getWorkcode());
|
||||
map.put("idNo", e.getIdNo());
|
||||
map.put("companystartdate", e.getCompanystartdate());
|
||||
map.put("dismissdate", e.getDismissdate());
|
||||
|
||||
// 浮动薪资项目动态
|
||||
Optional<Map<String, Object>> optionalItem = variableArchiveItemData.stream().filter(f -> f.get("variableArchiveId").toString().equals(e.getId().toString())).findFirst();
|
||||
optionalItem.ifPresent(map::putAll);
|
||||
|
||||
listMaps.add(map);
|
||||
});
|
||||
return listMaps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建浮动薪酬档案
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
@Override
|
||||
public void createData(VariableArchiveSaveParam saveParam) {
|
||||
ValidUtil.doValidator(saveParam);
|
||||
saveParam.setSalaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(saveParam.getSalaryMonth()));
|
||||
List<VariableArchivePO> variableArchivePOList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().salaryMonth(saveParam.getSalaryMonthDate()).employeeId(saveParam.getEmployeeId()).build());
|
||||
if (CollectionUtils.isNotEmpty(variableArchivePOList)) {
|
||||
// 先删除原有档案
|
||||
List<Long> variableArchiveIds = variableArchivePOList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
|
||||
getVariableArchiveMapper().deleteByIds(variableArchiveIds);
|
||||
}
|
||||
|
||||
// 保存浮动薪资档案信息
|
||||
Date now = new Date();
|
||||
VariableArchivePO variableArchivePO = VariableArchivePO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId(saveParam.getEmployeeId())
|
||||
.salaryMonth(saveParam.getSalaryMonthDate())
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
getVariableArchiveMapper().insertIgnoreNull(variableArchivePO);
|
||||
|
||||
// 保存浮动薪资档案详细信息
|
||||
List<VariableArchiveItemPO> variableArchiveItemList = new ArrayList<>();
|
||||
saveParam.getItemValueList().forEach(e -> {
|
||||
variableArchiveItemList.add(VariableArchiveItemPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId(saveParam.getEmployeeId())
|
||||
.variableArchiveId(variableArchivePO.getId())
|
||||
.variableItemId(e.getVariableItemId())
|
||||
.itemValue(e.getItemValue())
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build());
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(variableArchiveItemList)) {
|
||||
getVariableArchiveItemService(user).batchInsert(variableArchiveItemList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪资档案明细
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getDetail(VariableArchiveQueryParam queryParam) {
|
||||
if (queryParam.getId() == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
List<VariableArchiveListDTO> variableArchiveList = getVariableArchiveMapper().list(queryParam);
|
||||
|
||||
// 获取所有浮动薪酬项目
|
||||
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
|
||||
|
||||
//整合所有的显示列(固定列+薪资项目动态列)
|
||||
List<Map<String, Object>> listMaps = buildVariableArchiveData(variableArchiveList);
|
||||
Map<String, Object> resultMap = listMaps.get(0);
|
||||
|
||||
//动态列组装
|
||||
List<WeaTableColumn> columns = VariableArchiveBO.buildVariableArchiveTable(variableItems);
|
||||
|
||||
columns.add(0,new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "薪资所属月"), "salaryMonth"));
|
||||
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
datas.put("data", resultMap);
|
||||
datas.put("column", columns);
|
||||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VariableItemListDTO> getCreateForm() {
|
||||
List<VariableItemPO> variableItemPOS = getVariableItemService(user).listAll();
|
||||
List<VariableItemListDTO> variableItemDTOList = variableItemPOS.stream()
|
||||
.map(po -> VariableItemListDTO.builder()
|
||||
.id(po.getId())
|
||||
.name(po.getName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
return variableItemDTOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook downloadTemplate(VariableArchiveQueryParam param) {
|
||||
// 名称
|
||||
String nameI18n = SalaryI18nUtil.getI18nLabel(0, "浮动薪酬导入模板");
|
||||
|
||||
// 获取所有可被引用的薪资项目
|
||||
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
|
||||
List<Object> header = Lists.newArrayList();
|
||||
header.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86185, "部门"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(1933, "工号"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86186, "证件号码"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86187, "入职日期"));
|
||||
for (VariableItemPO variableItem : variableItems) {
|
||||
header.add(variableItem.getName());
|
||||
}
|
||||
|
||||
// 2.表头
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(header);
|
||||
// 获取档案信息
|
||||
List<VariableArchiveListDTO> variableArchiveList = list(param);
|
||||
|
||||
if (param.isHasData()) {
|
||||
List<Map<String, Object>> listMaps = buildVariableArchiveData(variableArchiveList);
|
||||
// 组装数据
|
||||
listMaps.forEach(e -> {
|
||||
List<Object> row = new ArrayList<>();
|
||||
row.add(e.get("username").toString());
|
||||
row.add(Optional.ofNullable(e.get("departmentName")).orElse("").toString());
|
||||
row.add(e.get("mobile") == null ? "" : e.get("mobile").toString());
|
||||
row.add(Optional.ofNullable(e.get("workcode")).orElse("").toString());
|
||||
row.add(Util.null2String(e.get("idNo")));
|
||||
row.add(Util.null2String(e.get("companystartdate")));
|
||||
|
||||
// 薪资项目数据
|
||||
for (VariableItemPO variableItem : variableItems) {
|
||||
row.add(e.containsKey(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) ? (e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) == null ? ""
|
||||
: e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX).toString()) : "");
|
||||
}
|
||||
rows.add(row);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 4.注释
|
||||
List<ExcelComment> excelComments = Lists.newArrayList();
|
||||
|
||||
return ExcelUtilPlus.genWorkbookV2(rows, nameI18n, excelComments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> preview(VariableArchiveImportHandleParam importParam) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
|
||||
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
||||
apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
|
||||
apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1, 0));
|
||||
return apidatas;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> importData(VariableArchiveImportHandleParam importParam) {
|
||||
// 初始化国际化标签
|
||||
VariableArchiveExcelBO.initI18n();
|
||||
// 校验参数
|
||||
checkImportParam(importParam);
|
||||
String imageId = importParam.getImageId();
|
||||
// 构建导入处理参数
|
||||
importParam = buildImportHandleParam(importParam);
|
||||
// 导入有重复
|
||||
List<String> allTodoVariableArchives = Lists.newArrayList();
|
||||
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
|
||||
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
||||
int total = 0;
|
||||
//excel数据
|
||||
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
||||
if (data != null) {
|
||||
total += data.size();
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
int successCount = 0;
|
||||
int errorCount = 0;
|
||||
// 用于(初始化导入)的相同employeeId时的处理
|
||||
List<SalaryArchiveInitImportDTO> initImportData = Lists.newArrayList();
|
||||
|
||||
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
||||
|
||||
// 错误提示
|
||||
List<Map<String, String>> excelComments = new ArrayList<>();
|
||||
// 错误sheet数据
|
||||
List<Map<String, Object>> errorData = new ArrayList<>();
|
||||
|
||||
Map<String, Object> map;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
index += 1;
|
||||
map = data.get(i);
|
||||
map.put("index", i + 2);
|
||||
// 3.校验行内容
|
||||
boolean isError = VariableArchiveExcelBO.singleRowCheck(allTodoVariableArchives, map, headers, excelComments, errorCount, importParam, user);
|
||||
if (isError) {
|
||||
errorCount += 1;
|
||||
// 添加错误数据
|
||||
errorData.add(map);
|
||||
} else {
|
||||
successCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 4.数据入库处理
|
||||
handleImportData(importParam);
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
|
||||
apidatas.put("successCount", successCount);
|
||||
apidatas.put("errorCount", errorCount);
|
||||
apidatas.put("errorNotice", excelComments);
|
||||
return apidatas;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkImportParam(VariableArchiveImportHandleParam importParam) {
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
//税款所属期
|
||||
String salaryMonthStr = Util.null2String(importParam.getSalaryMonth());
|
||||
if (StringUtils.isBlank(imageId)) {
|
||||
throw new SalaryRunTimeException("文件不存在");
|
||||
}
|
||||
if (StringUtils.isBlank(salaryMonthStr)) {
|
||||
throw new SalaryRunTimeException("薪资所属月为空");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建导入处理参数
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
private VariableArchiveImportHandleParam buildImportHandleParam(VariableArchiveImportHandleParam param) {
|
||||
// 获取所有可被引用的浮动薪资项目
|
||||
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
|
||||
Collection<Long> variableItemIds = variableItems.stream().map(VariableItemPO::getId).collect(Collectors.toList());
|
||||
List<VariableArchivePO> variableArchiveList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().salaryMonth(SalaryDateUtil.dateStrToLocalYearMonth(param.getSalaryMonth())).build());
|
||||
|
||||
List<Long> variableArchiveIds = variableArchiveList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
|
||||
Map<Long, VariableArchivePO> variableArchivesMap = SalaryEntityUtil.convert2Map(variableArchiveList, k -> k.getEmployeeId());
|
||||
|
||||
// 获取浮动薪资档案明细数据
|
||||
List<VariableArchiveItemPO> variableArchiveItemPOS = getVariableArchiveItemService(user).listByVariableArchiveIds(variableArchiveIds);
|
||||
Map<String, List<VariableArchiveItemPO>> variableArchiveItemMap = SalaryEntityUtil.group2Map(variableArchiveItemPOS, k -> k.getVariableArchiveId() + "-" + k.getVariableItemId());
|
||||
|
||||
return VariableArchiveImportHandleParam.builder()
|
||||
.imageId(param.getImageId())
|
||||
.salaryMonth(param.getSalaryMonth())
|
||||
.salaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(param.getSalaryMonth()))
|
||||
.currentEmployeeId((long) user.getUID())
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
//人员定位方式
|
||||
.empValidType(getSalaryEmployeeService(user).empValidType())
|
||||
// 获取租户下所有的人员
|
||||
.employees(getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG))
|
||||
// 浮动薪资项目
|
||||
.variableItems(variableItems)
|
||||
// 查询已有的浮动薪资档案基本数据
|
||||
.variableArchivesMap(variableArchivesMap)
|
||||
// 浮动薪资项目id
|
||||
.variableItemIds(variableItemIds)
|
||||
// 查询已生效的浮动薪资项目数据
|
||||
.effectiveItemListMap(variableArchiveItemMap)
|
||||
// 当前时间
|
||||
.nowTime(new Date())
|
||||
// 当天
|
||||
.today(new Date())
|
||||
// 待保存浮动薪资档案
|
||||
.variableArchiveSaves(Lists.newArrayList())
|
||||
// 待保存浮动薪资档案-浮动薪资项目
|
||||
.variableArchiveItemSaves(Lists.newArrayList())
|
||||
// 待删除浮动薪资档案-浮动薪资项目
|
||||
.variableArchiveItemDelSalaryItemIds(Lists.newArrayList())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
private void handleImportData(VariableArchiveImportHandleParam importHandleParam) {
|
||||
List<VariableArchivePO> variableArchiveSaves = importHandleParam.getVariableArchiveSaves();
|
||||
List<VariableArchiveItemPO> variableArchiveItemSaves = importHandleParam.getVariableArchiveItemSaves();
|
||||
List<Long> variableArchiveItemDelSalaryItemIds = importHandleParam.getVariableArchiveItemDelSalaryItemIds();
|
||||
|
||||
// 新增档案
|
||||
if (CollectionUtils.isNotEmpty(variableArchiveSaves)) {
|
||||
variableArchiveSaves.stream().forEach(getVariableArchiveMapper()::insertIgnoreNull);
|
||||
}
|
||||
// 薪资档案-薪资项目
|
||||
if (CollectionUtils.isNotEmpty(variableArchiveItemDelSalaryItemIds)) {
|
||||
getVariableArchiveItemService(user).deleteByIds(variableArchiveItemDelSalaryItemIds);
|
||||
}
|
||||
// 薪资档案-薪资项目
|
||||
if (CollectionUtils.isNotEmpty(variableArchiveItemSaves)) {
|
||||
getVariableArchiveItemService(user).batchInsert(variableArchiveItemSaves);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook export(VariableArchiveQueryParam param) {
|
||||
// 名称
|
||||
String nameI18n = SalaryI18nUtil.getI18nLabel(0, "浮动薪酬");
|
||||
|
||||
// 获取所有可被引用的薪资项目
|
||||
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
|
||||
List<Object> header = Lists.newArrayList();
|
||||
header.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86185, "部门"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(1933, "工号"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86186, "证件号码"));
|
||||
header.add(SalaryI18nUtil.getI18nLabel(86187, "入职日期"));
|
||||
for (VariableItemPO variableItem : variableItems) {
|
||||
header.add(variableItem.getName());
|
||||
}
|
||||
|
||||
// 2.表头
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(header);
|
||||
// 获取档案信息
|
||||
List<VariableArchiveListDTO> variableArchiveList = list(param);
|
||||
List<Map<String, Object>> listMaps = buildVariableArchiveData(variableArchiveList);
|
||||
// 组装数据
|
||||
listMaps.forEach(e -> {
|
||||
List<Object> row = new ArrayList<>();
|
||||
row.add(e.get("username").toString());
|
||||
row.add(Optional.ofNullable(e.get("departmentName")).orElse("").toString());
|
||||
row.add(e.get("mobile") == null ? "" : e.get("mobile").toString());
|
||||
row.add(Optional.ofNullable(e.get("workcode")).orElse("").toString());
|
||||
row.add(Util.null2String(e.get("idNo")));
|
||||
row.add(Util.null2String(e.get("companystartdate")));
|
||||
|
||||
// 薪资项目数据
|
||||
for (VariableItemPO variableItem : variableItems) {
|
||||
row.add(e.containsKey(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) ? (e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX) == null ? ""
|
||||
: e.get(variableItem.getId() + SalaryItemConstant.VARIABLE_ITEM_DYNAMIC_SUFFIX).toString()) : "");
|
||||
}
|
||||
rows.add(row);
|
||||
});
|
||||
|
||||
// 4.注释
|
||||
List<ExcelComment> excelComments = Lists.newArrayList();
|
||||
|
||||
return ExcelUtilPlus.genWorkbookV2(rows, nameI18n, excelComments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSelectVariableArchive(Collection<Long> deleteIds) {
|
||||
if (CollectionUtils.isEmpty(deleteIds)) {
|
||||
return;
|
||||
}
|
||||
List<VariableArchivePO> variableArchivePOList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().ids(deleteIds).build());
|
||||
List<Long> archiveIds = variableArchivePOList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
|
||||
deleteByIds(archiveIds);
|
||||
// 删除明细
|
||||
getVariableArchiveItemService(user).deleteByArchiveIds(archiveIds);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds) {
|
||||
VariableArchiveQueryParam queryParam = VariableArchiveQueryParam.builder().employeeIds(employeeIds).salaryMonth(SalaryDateUtil.getFormatYearMonth(salaryMonth)).salaryMonthDate(SalaryDateUtil.toDate(salaryMonth,1)).build();
|
||||
List<VariableArchiveListDTO> variableArchiveListDTO = list(queryParam);
|
||||
return buildVariableArchiveData(variableArchiveListDTO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.VariableItemMapper;
|
||||
import com.engine.salary.service.SalaryFormulaService;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.service.VariableArchiveItemService;
|
||||
import com.engine.salary.service.VariableItemService;
|
||||
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.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.RuntimeTypeEnum;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.conn.util.IdGenerator;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName VariableItemServiceImpl
|
||||
* @date 2024/08/07 9:31
|
||||
* @description 浮动薪酬项目
|
||||
*/
|
||||
public class VariableItemServiceImpl extends Service implements VariableItemService {
|
||||
|
||||
private VariableItemMapper getVariableItemMapper(){
|
||||
return MapperProxyFactory.getProxy(VariableItemMapper.class);
|
||||
}
|
||||
|
||||
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||||
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryItemService getSalaryItemService(User user) {
|
||||
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableArchiveItemService getVariableArchiveItemService(User user) {
|
||||
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableItemPO getById(Long id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
return getVariableItemMapper().getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VariableItemPO> listByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getVariableItemMapper().listSome(VariableItemPO.builder().ids(ids).build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取浮动薪酬项目
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<VariableItemPO> listAll() {
|
||||
return getVariableItemMapper().listAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取浮动薪资项目列表(分页)
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<VariableItemListDTO> listPage(VariableItemQueryParam queryParam) {
|
||||
List<VariableItemPO> variableItemPOS = listAll();
|
||||
if (StringUtils.isNotBlank(queryParam.getItemName())) {
|
||||
variableItemPOS = variableItemPOS.stream().filter(po -> po.getName().contains(queryParam.getItemName())).collect(Collectors.toList());
|
||||
}
|
||||
// 查询不可删除的code、id
|
||||
SalaryItemServiceImpl.UsingItem usingItem = getSalaryItemService(user).getUsingItem();
|
||||
List<String> usingCodes = usingItem.getUsingCodes();
|
||||
List<Long> usingVariableItemIds = getVariableArchiveItemService(user).listUsingItems();
|
||||
|
||||
List<VariableItemListDTO> variableItemDTOList = variableItemPOS.stream()
|
||||
.map(po -> VariableItemListDTO.builder()
|
||||
.id(po.getId())
|
||||
.name(po.getName())
|
||||
.dataType(SalaryDataTypeEnum.parseByValue(po.getDataType()).getDefaultLabel())
|
||||
.canDelete( !(usingCodes.contains(po.getCode()) || usingVariableItemIds.contains(po.getId())) )
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), variableItemDTOList, VariableItemListDTO.class);
|
||||
}
|
||||
|
||||
private List<VariableItemPO> listByName(String name) {
|
||||
return getVariableItemMapper().listSome(VariableItemPO.builder().name(name).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer save(VariableItemSaveParam saveParam) {
|
||||
// 名称不能和已有的自定义薪资项目重名
|
||||
List<VariableItemPO> variableItemPOS = listByName(saveParam.getName());
|
||||
if (CollectionUtils.isNotEmpty(variableItemPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "项目名称已存在,请重新命名"));
|
||||
}
|
||||
Date now = new Date();
|
||||
long id = com.engine.salary.util.db.IdGenerator.generate();
|
||||
VariableItemPO variableItemPO = VariableItemPO.builder()
|
||||
.id(id)
|
||||
.name(saveParam.getName())
|
||||
.code(IdGenerator.getUUID())
|
||||
.dataType(saveParam.getDataType())
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
return getVariableItemMapper().insertIgnoreNull(variableItemPO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableItemPO update(VariableItemSaveParam saveParam) {
|
||||
ValidUtil.doValidator(saveParam, RuntimeTypeEnum.UPDATE);
|
||||
// 查询薪资项目,判断薪资项目是否存在
|
||||
VariableItemPO variableItemPO = getById(saveParam.getId());
|
||||
if (Objects.isNull(variableItemPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误,项目不存在或已被删除"));
|
||||
}
|
||||
// 名称不能和已有的自定义薪资项目重名
|
||||
List<VariableItemPO> variableItemPOS = listByName(saveParam.getName());
|
||||
boolean nameExist = variableItemPOS.stream().anyMatch(e -> !Objects.equals(saveParam.getId(), e.getId()));
|
||||
if (nameExist) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "项目名称已存在,请重新命名"));
|
||||
}
|
||||
|
||||
// 更新薪资项目
|
||||
VariableItemPO newVariableItemPO = new VariableItemPO();
|
||||
BeanUtils.copyProperties(variableItemPO, newVariableItemPO);
|
||||
newVariableItemPO.setName(saveParam.getName());
|
||||
newVariableItemPO.setDataType(saveParam.getDataType());
|
||||
newVariableItemPO.setUpdateTime(new Date());
|
||||
getVariableItemMapper().update(newVariableItemPO);
|
||||
|
||||
//改名后更新公式
|
||||
String oldName = variableItemPO.getName();
|
||||
String newName = saveParam.getName();
|
||||
if (!StringUtils.equals(oldName, newName)) {
|
||||
String itemPrefix = "variableItem_";
|
||||
String fieldNamePrefix = "{浮动薪资项目.%s}";
|
||||
changeName(variableItemPO, oldName, newName, itemPrefix, fieldNamePrefix);
|
||||
}
|
||||
return variableItemPO;
|
||||
}
|
||||
|
||||
private void changeName(VariableItemPO variableItemPO, String oldName, String newName, String itemPrefix, String fieldNamePrefix) {
|
||||
String code = itemPrefix + variableItemPO.getCode();
|
||||
Date now = new Date();
|
||||
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listByCode(code);
|
||||
formulaVars.forEach(v -> {
|
||||
FormulaVar formulaVar = FormulaVar.builder()
|
||||
.id(v.getId())
|
||||
.name(newName)
|
||||
.fieldName(String.format(fieldNamePrefix, newName))
|
||||
.updateTime(now)
|
||||
.build();
|
||||
getSalaryFormulaService(user).updateVar(formulaVar);
|
||||
});
|
||||
|
||||
List<Long> formulaIds = SalaryEntityUtil.properties(formulaVars, FormulaVar::getFormulaId, Collectors.toList());
|
||||
List<FormulaPO> formulaPOS = getSalaryFormulaService(user).listByIds(formulaIds);
|
||||
formulaPOS.forEach(f -> {
|
||||
String formula = f.getFormula();
|
||||
formula = formula.replace(String.format(fieldNamePrefix, oldName), String.format(fieldNamePrefix, newName));
|
||||
FormulaPO formulaPO = FormulaPO.builder()
|
||||
.id(f.getId())
|
||||
.formula(formula)
|
||||
.updateTime(now)
|
||||
.build();
|
||||
getSalaryFormulaService(user).update(formulaPO);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteItems(List<Long> itemIds) {
|
||||
if (CollectionUtils.isEmpty(itemIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SalaryItemServiceImpl.UsingItem usingItem = getSalaryItemService(user).getUsingItem();
|
||||
List<String> usingCodes = usingItem.getUsingCodes();
|
||||
|
||||
// 查询薪资项目
|
||||
List<VariableItemPO> variableItemPOS = listByIds(itemIds);
|
||||
if (CollectionUtils.isEmpty(variableItemPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误,浮动薪资项目不存在或已被删除"));
|
||||
}
|
||||
List<String> codes = SalaryEntityUtil.properties(variableItemPOS, VariableItemPO::getCode, Collectors.toList());
|
||||
if (CollectionUtils.containsAny(usingCodes, codes)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "公式正在使用该浮动薪资项目,不允许删除"));
|
||||
}
|
||||
// 查询浮动薪酬档案中已使用的浮动薪资项目
|
||||
List<Long> usingVariableItemIds = getVariableArchiveItemService(user).listUsingItems();
|
||||
if (CollectionUtils.containsAny(usingVariableItemIds, itemIds)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "浮动薪资档案中正在使用该薪资项目,不允许删除"));
|
||||
}
|
||||
itemIds.stream().forEach(id -> getVariableItemMapper().delete(VariableItemPO.builder().id(id).build()));
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableItemListDTO getDetail(Long id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
VariableItemPO variableItemPO = getVariableItemMapper().getById(id);
|
||||
return VariableItemListDTO.builder()
|
||||
.id(variableItemPO.getId())
|
||||
.name(variableItemPO.getName())
|
||||
.dataType(variableItemPO.getDataType())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveSaveParam;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.wrapper.VariableArchiveWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据采集-浮动薪酬
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class VariableArchiveController {
|
||||
|
||||
private VariableArchiveWrapper getVariableArchiveWrapper(User user) {
|
||||
return ServiceUtil.getService(VariableArchiveWrapper.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪酬列表
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveQueryParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableArchiveQueryParam, Map<String, Object>>(user).run(getVariableArchiveWrapper(user)::list, queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪酬明细
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getDetail")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveQueryParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableArchiveQueryParam, Map<String, Object>>(user).run(getVariableArchiveWrapper(user)::getDetail, queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取创建浮动薪酬档案时项目信息
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getCreateForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getCreateForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableArchiveSaveParam, List<VariableItemListDTO>>(user).run(getVariableArchiveWrapper(user)::getCreateForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建浮动薪酬档案
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param saveParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/createData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String createData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveSaveParam saveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::createData, saveParam);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response downloadTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
VariableArchiveQueryParam param = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getVariableArchiveWrapper(user).downloadTemplate(param);
|
||||
String fileName = "浮动薪酬导入模板" + LocalDate.now();
|
||||
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();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("浮动薪酬导入模板异常", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
VariableArchiveQueryParam param = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getVariableArchiveWrapper(user).export(param);
|
||||
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("浮动薪酬" + LocalDate.now() + ".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();
|
||||
} catch (Exception e) {
|
||||
log.error("浮动薪酬导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private VariableArchiveQueryParam buildParam(HttpServletRequest request) {
|
||||
VariableArchiveQueryParam param = new VariableArchiveQueryParam();
|
||||
|
||||
String salaryMonthStr = request.getParameter("salaryMonth");
|
||||
if (StringUtils.isNotBlank(salaryMonthStr)) {
|
||||
param.setSalaryMonth(salaryMonthStr);
|
||||
param.setSalaryMonthDate(SalaryDateUtil.dateStrToLocalYearMonth(salaryMonthStr));
|
||||
}
|
||||
String username = request.getParameter("username");
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
param.setUsername(username);
|
||||
}
|
||||
|
||||
String departmentIdStr = request.getParameter("departmentIds");
|
||||
if (StringUtils.isNotBlank(departmentIdStr)) {
|
||||
List<Long> departmentIds = Arrays.stream(departmentIdStr.split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||
param.setDepartmentIds(departmentIds);
|
||||
}
|
||||
String workcode = request.getParameter("workcode");
|
||||
if (StringUtils.isNotBlank(workcode)) {
|
||||
param.setWorkcode(workcode);
|
||||
}
|
||||
|
||||
String hasData = request.getParameter("hasData");
|
||||
if (StringUtils.isNotBlank(hasData)) {
|
||||
param.setHasData(hasData.equals("true"));
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/preview")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveImportHandleParam importParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableArchiveImportHandleParam, Map<String, Object>>(user).run(getVariableArchiveWrapper(user)::preview, importParam);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/importData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveImportHandleParam importParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableArchiveImportHandleParam, Map<String, Object>>(user).run(getVariableArchiveWrapper(user)::importData, importParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 删除
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2024/08/08 14:41
|
||||
*/
|
||||
@POST
|
||||
@Path("/deleteSelectData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteSelectVariableArchive(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveQueryParam variableArchiveQueryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Collection<Long>, String>(user).run(getVariableArchiveWrapper(user)::deleteSelectVariableArchive, variableArchiveQueryParam.getIds());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @description 获取其他免税扣除数据
|
||||
// * @return String
|
||||
// * @author Harryxzy
|
||||
// * @date 2022/10/31 13:42
|
||||
// */
|
||||
// @POST
|
||||
// @Path("/getData")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String getOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionParam otherDeductionParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<OtherDeductionParam, OtherDeductionRecordDTO>(user).run(getOtherDeductionWrapper(user)::getOtherDeduction, otherDeductionParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @description 删除所选其他免税扣除
|
||||
// * @return String
|
||||
// * @author Harryxzy
|
||||
// * @date 2022/10/27 14:41
|
||||
// */
|
||||
// @POST
|
||||
// @Path("/deleteSelectData")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam otherDeductionDeleteParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getOtherDeductionWrapper(user)::deleteSelectData, otherDeductionDeleteParam);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,324 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.VariableItemWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据采集-浮动薪酬项目
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author xzy
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class VariableItemController {
|
||||
|
||||
private VariableItemWrapper getVariableItemWrapper(User user) {
|
||||
return ServiceUtil.getService(VariableItemWrapper.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪酬项目列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/listPage")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listPage(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableItemQueryParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<VariableItemQueryParam, PageInfo<VariableItemListDTO>>(user).run(getVariableItemWrapper(user)::listPage, queryParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 浮动薪酬项目详细信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/getDetail")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableItemQueryParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, VariableItemListDTO>(user).run(getVariableItemWrapper(user)::getDetail, queryParam.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存浮动薪资项目
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param saveParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String saveVariableItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableItemSaveParam saveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if (saveParam.getId() == null || saveParam.getId() <= 0) {
|
||||
return new ResponseResult<VariableItemSaveParam, String>(request, response, user).run(getVariableItemWrapper(user)::save, saveParam);
|
||||
} else {
|
||||
return new ResponseResult<VariableItemSaveParam, String>(request, response, user).run(getVariableItemWrapper(user)::update, saveParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除浮动薪资项目
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/delete")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableItemQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<List<Long>, String>(request, response, user).run(getVariableItemWrapper(user)::deleteItems, param.getItemIds());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @GET
|
||||
// @Path("/downloadTemplate")
|
||||
// @Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
// public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
// try {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// OtherDeductionQueryParam param = buildParam(request);
|
||||
//
|
||||
// XSSFWorkbook workbook = getOtherDeductionWrapper(user).downloadTemplate(param);
|
||||
// String fileName = "其他免税扣除导入模板" + LocalDate.now();
|
||||
// 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();
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("其他免税扣除导入模板异常", e);
|
||||
// throw e;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 导出
|
||||
// *
|
||||
// * @param
|
||||
// * @return
|
||||
// */
|
||||
// @GET
|
||||
// @Path("/export")
|
||||
// @Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
// public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
// try {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
//
|
||||
// OtherDeductionQueryParam param = buildParam(request);
|
||||
//
|
||||
// XSSFWorkbook workbook = getOtherDeductionWrapper(user).export(param);
|
||||
//
|
||||
// String fileName = null;
|
||||
// try {
|
||||
// fileName = URLEncoder.encode("其他免税扣除" + LocalDate.now() + ".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();
|
||||
// } catch (Exception e) {
|
||||
// log.error("其他免税扣除导出异常", e);
|
||||
// throw e;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Nullable
|
||||
// private OtherDeductionQueryParam buildParam(HttpServletRequest request) {
|
||||
// OtherDeductionQueryParam param = new OtherDeductionQueryParam();
|
||||
// String ids = request.getParameter("ids");
|
||||
// if (StringUtils.isNotBlank(ids)) {
|
||||
// param.setIds(Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
// }
|
||||
// String keyword = request.getParameter("keyword");
|
||||
// if (StringUtils.isNotBlank(keyword)) {
|
||||
// param.setKeyword(keyword);
|
||||
// }
|
||||
// String id = request.getParameter("id");
|
||||
// if (StringUtils.isNotBlank(id)) {
|
||||
// param.setId(Long.valueOf(id));
|
||||
// }
|
||||
// String declareMonth = request.getParameter("declareMonth");
|
||||
// if (StringUtils.isNotBlank(declareMonth)) {
|
||||
// param.setDeclareMonth(Arrays.stream(declareMonth.split(",")).map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
// param.setDeclareMonthDate(Arrays.stream(declareMonth.split(",")).map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
// }
|
||||
//
|
||||
// String username = request.getParameter("username");
|
||||
// if (StringUtils.isNotBlank(username)) {
|
||||
// param.setUsername(username);
|
||||
// }
|
||||
// String employeeId = request.getParameter("employeeId");
|
||||
// if (StringUtils.isNotBlank(employeeId)) {
|
||||
// param.setEmployeeId(Long.valueOf(employeeId));
|
||||
// }
|
||||
// String taxAgentId = request.getParameter("taxAgentId");
|
||||
// if (StringUtils.isNotBlank(taxAgentId)) {
|
||||
// param.setTaxAgentId(Long.valueOf(taxAgentId));
|
||||
// }
|
||||
// String departmentIds = request.getParameter("departmentIds");
|
||||
// if (StringUtils.isNotBlank(departmentIds)) {
|
||||
// param.setDepartmentIds(Arrays.stream(departmentIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
// }
|
||||
// String jobNum = request.getParameter("jobNum");
|
||||
// if (StringUtils.isNotBlank(jobNum)) {
|
||||
// param.setJobNum(jobNum);
|
||||
// }
|
||||
// String idNo = request.getParameter("idNo");
|
||||
// if (StringUtils.isNotBlank(idNo)) {
|
||||
// param.setIdNo(idNo);
|
||||
// }
|
||||
// String hiredate = request.getParameter("hiredate");
|
||||
// if (StringUtils.isNotBlank(hiredate)) {
|
||||
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// List<Date> dates = Arrays.stream(hiredate.split(",")).map(d -> {
|
||||
// try {
|
||||
// return format.parse(d);
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }).collect(Collectors.toList());
|
||||
// param.setHiredate(dates);
|
||||
// }
|
||||
// String mobile = request.getParameter("mobile");
|
||||
// if (StringUtils.isNotBlank(mobile)) {
|
||||
// param.setMobile(mobile);
|
||||
// }
|
||||
// String otherTaxExemptDeductionId = request.getParameter("otherTaxExemptDeductionId");
|
||||
// if (StringUtils.isNotBlank(otherTaxExemptDeductionId)) {
|
||||
// param.setOtherTaxExemptDeductionId(Long.valueOf(otherTaxExemptDeductionId));
|
||||
// }
|
||||
//
|
||||
// String hasData = request.getParameter("hasData");
|
||||
// if (StringUtils.isNotBlank(hasData)) {
|
||||
// param.setHasData("true".equals(hasData));
|
||||
// }
|
||||
// return param;
|
||||
// }
|
||||
//
|
||||
// @POST
|
||||
// @Path("/preview")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionImportParam importParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<OtherDeductionImportParam, Map<String, Object>>(user).run(getOtherDeductionWrapper(user)::preview, importParam);
|
||||
// }
|
||||
//
|
||||
// @POST
|
||||
// @Path("/importData")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionImportParam importParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<OtherDeductionImportParam, Map<String, Object>>(user).run(getOtherDeductionWrapper(user)::importData, importParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @description 获取其他免税扣除数据
|
||||
// * @return String
|
||||
// * @author Harryxzy
|
||||
// * @date 2022/10/31 13:42
|
||||
// */
|
||||
// @POST
|
||||
// @Path("/getData")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String getOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionParam otherDeductionParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<OtherDeductionParam, OtherDeductionRecordDTO>(user).run(getOtherDeductionWrapper(user)::getOtherDeduction, otherDeductionParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @description 删除所选其他免税扣除
|
||||
// * @return String
|
||||
// * @author Harryxzy
|
||||
// * @date 2022/10/27 14:41
|
||||
// */
|
||||
// @POST
|
||||
// @Path("/deleteSelectData")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam otherDeductionDeleteParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getOtherDeductionWrapper(user)::deleteSelectData, otherDeductionDeleteParam);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.entity.datacollection.bo.VariableArchiveBO;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableArchiveListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableArchiveSaveParam;
|
||||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.service.VariableArchiveService;
|
||||
import com.engine.salary.service.VariableItemService;
|
||||
import com.engine.salary.service.impl.VariableArchiveServiceImpl;
|
||||
import com.engine.salary.service.impl.VariableItemServiceImpl;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 浮动薪酬
|
||||
* @Author: xzy
|
||||
* @Date: 2024/8/6 17:39
|
||||
*/
|
||||
@Slf4j
|
||||
public class VariableArchiveWrapper extends Service {
|
||||
private VariableArchiveService getVariableArchiveService(User user) {
|
||||
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private VariableItemService getVariableItemService(User user) {
|
||||
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集-浮动薪酬列表(分页)
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> list(VariableArchiveQueryParam queryParam) {
|
||||
|
||||
//薪资档案列表
|
||||
PageInfo<VariableArchiveListDTO> pageInfo = getVariableArchiveService(user).listPage(queryParam);
|
||||
Collection<VariableArchiveListDTO> salaryArchives = pageInfo.getList();
|
||||
|
||||
// 获取所有浮动薪酬项目
|
||||
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
|
||||
|
||||
//整合所有的显示列(固定列+薪资项目动态列)
|
||||
List<Map<String, Object>> listMaps = getVariableArchiveService(user).buildVariableArchiveData(salaryArchives);
|
||||
|
||||
PageInfo<Map<String, Object>> pageInfos = new PageInfo<Map<String, Object>>(listMaps);
|
||||
pageInfos.setTotal(pageInfo.getTotal());
|
||||
pageInfos.setPageNum(pageInfo.getPageNum());
|
||||
pageInfos.setPageSize(pageInfo.getPageSize());
|
||||
|
||||
//动态列组装
|
||||
List<WeaTableColumn> columns = VariableArchiveBO.buildVariableArchiveTable(variableItems);
|
||||
|
||||
SalaryWeaTable<VariableArchiveListDTO> table = new SalaryWeaTable<VariableArchiveListDTO>(user, VariableArchiveListDTO.class);
|
||||
table.setColumns(columns);
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
datas.put("pageInfo", pageInfos);
|
||||
datas.put("dataKey", result.getResultMap());
|
||||
|
||||
return datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建浮动薪酬档案
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
public void createData(VariableArchiveSaveParam saveParam) {
|
||||
getVariableArchiveService(user).createData(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪酬档案明细
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getDetail(VariableArchiveQueryParam queryParam) {
|
||||
return getVariableArchiveService(user).getDetail(queryParam);
|
||||
}
|
||||
|
||||
public List<VariableItemListDTO> getCreateForm() {
|
||||
return getVariableArchiveService(user).getCreateForm();
|
||||
}
|
||||
|
||||
public XSSFWorkbook downloadTemplate(VariableArchiveQueryParam param) {
|
||||
return getVariableArchiveService(user).downloadTemplate(param);
|
||||
}
|
||||
|
||||
public Map<String, Object> preview(VariableArchiveImportHandleParam importParam) {
|
||||
return getVariableArchiveService(user).preview(importParam);
|
||||
}
|
||||
|
||||
public Map<String, Object> importData(VariableArchiveImportHandleParam importParam) {
|
||||
return getVariableArchiveService(user).importData(importParam);
|
||||
}
|
||||
|
||||
public XSSFWorkbook export(VariableArchiveQueryParam param) {
|
||||
return getVariableArchiveService(user).export(param);
|
||||
}
|
||||
|
||||
public void deleteSelectVariableArchive(Collection<Long> deleteIds) {
|
||||
getVariableArchiveService(user).deleteSelectVariableArchive(deleteIds);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 导出-其他免税扣除列表
|
||||
// *
|
||||
// * @param queryParam
|
||||
// * @return
|
||||
// */
|
||||
// public XSSFWorkbook export(OtherDeductionQueryParam queryParam) {
|
||||
// return getOtherDeductionService(user).export(queryParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 下载导入模板
|
||||
// *
|
||||
// * @param queryParam
|
||||
// * @return
|
||||
// */
|
||||
// public XSSFWorkbook downloadTemplate(OtherDeductionQueryParam queryParam) {
|
||||
// return getOtherDeductionService(user).downloadTemplate(queryParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 预览
|
||||
// */
|
||||
// public Map<String, Object> preview(OtherDeductionImportParam importParam) {
|
||||
// return getOtherDeductionService(user).preview(importParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 导入数据
|
||||
// */
|
||||
// public Map<String, Object> importData(OtherDeductionImportParam importParam) {
|
||||
// return getOtherDeductionService(user).importData(importParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑数据
|
||||
// */
|
||||
// public void editData(OtherDeductionParam otherDeductionParam) {
|
||||
// getOtherDeductionService(user).editData(otherDeductionParam);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 新增数据
|
||||
// */
|
||||
// public void createData(OtherDeductionParam otherDeductionParam) {
|
||||
// getOtherDeductionService(user).createData(otherDeductionParam);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除所选数据
|
||||
// */
|
||||
// public void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam) {
|
||||
// getOtherDeductionService(user).deleteSelectData(deleteParam);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 获取数据
|
||||
// */
|
||||
// public OtherDeductionRecordDTO getOtherDeduction(OtherDeductionParam otherDeductionParam) {
|
||||
// return getOtherDeductionService(user).getOtherDeduction(otherDeductionParam);
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.datacollection.dto.VariableItemListDTO;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
|
||||
import com.engine.salary.service.VariableItemService;
|
||||
import com.engine.salary.service.impl.VariableItemServiceImpl;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 浮动薪酬项目
|
||||
* @Author: xzy
|
||||
* @Date: 2024/8/6 17:39
|
||||
*/
|
||||
@Slf4j
|
||||
public class VariableItemWrapper extends Service {
|
||||
private VariableItemService getVariableItemService(User user) {
|
||||
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的浮动薪酬项目
|
||||
*
|
||||
* @param queryParam
|
||||
*/
|
||||
public PageInfo<VariableItemListDTO> listPage(VariableItemQueryParam queryParam) {
|
||||
return getVariableItemService(user).listPage(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建浮动薪酬项目
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
public void save(VariableItemSaveParam saveParam) {
|
||||
ValidUtil.doValidator(saveParam);
|
||||
getVariableItemService(user).save(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新浮动薪酬项目
|
||||
*
|
||||
* @param saveParam
|
||||
*/
|
||||
public void update(VariableItemSaveParam saveParam) {
|
||||
ValidUtil.doValidator(saveParam);
|
||||
getVariableItemService(user).update(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除浮动薪资项目
|
||||
*
|
||||
* @param itemIds
|
||||
*/
|
||||
public void deleteItems(List<Long> itemIds) {
|
||||
getVariableItemService(user).deleteItems(itemIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 浮动薪酬项目详细信息
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public VariableItemListDTO getDetail(Long id) {
|
||||
return getVariableItemService(user).getDetail(id);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue