diff --git a/src/com/engine/salary/biz/EmployBiz.java b/src/com/engine/salary/biz/EmployBiz.java index 1b8cac00f..9342681e4 100644 --- a/src/com/engine/salary/biz/EmployBiz.java +++ b/src/com/engine/salary/biz/EmployBiz.java @@ -1,6 +1,7 @@ package com.engine.salary.biz; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.PositionInfo; import com.engine.salary.mapper.datacollection.EmployMapper; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -45,4 +46,20 @@ public class EmployBiz extends BaseBean { sqlSession.close(); } } + + + /** + * 岗位信息 + * @param list + * @return + */ + public List listPositionInfo(List list) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + EmployMapper mapper = sqlSession.getMapper(EmployMapper.class); + return mapper.listPositionInfo(list); + } finally { + sqlSession.close(); + } + } } diff --git a/src/com/engine/salary/biz/SalarySobItemBiz.java b/src/com/engine/salary/biz/SalarySobItemBiz.java index cdc8091ab..19f04f95c 100644 --- a/src/com/engine/salary/biz/SalarySobItemBiz.java +++ b/src/com/engine/salary/biz/SalarySobItemBiz.java @@ -5,6 +5,7 @@ import com.engine.salary.mapper.salarysob.SalarySobItemMapper; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; +import java.util.Collection; import java.util.List; public class SalarySobItemBiz { @@ -18,4 +19,37 @@ public class SalarySobItemBiz { sqlSession.close(); } } + + public List listSome(SalarySobItemPO build) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class); + return mapper.listSome(build); + } finally { + sqlSession.close(); + } + } + + public void batchInsert(Collection salarySobItemPOS) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class); + mapper.batchInsert(salarySobItemPOS); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } + + + public void deleteBySalarySobIds(Collection salarySobIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class); + mapper.deleteBySalarySobIds(salarySobIds); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } } diff --git a/src/com/engine/salary/biz/SalarySobItemGroupBiz.java b/src/com/engine/salary/biz/SalarySobItemGroupBiz.java new file mode 100644 index 000000000..75d36ae3b --- /dev/null +++ b/src/com/engine/salary/biz/SalarySobItemGroupBiz.java @@ -0,0 +1,54 @@ +package com.engine.salary.biz; + +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; +import com.engine.salary.mapper.salarysob.SalarySobItemGroupMapper; +import org.apache.ibatis.session.SqlSession; +import weaver.conn.mybatis.MyBatisFactory; + +import java.util.Collection; +import java.util.List; + +public class SalarySobItemGroupBiz { + + public SalarySobItemGroupPO getById(Long id) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class); + return mapper.getById(id); + } finally { + sqlSession.close(); + } + } + + public List listSome(SalarySobItemGroupPO build) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class); + return mapper.listSome(build); + } finally { + sqlSession.close(); + } + } + + public void batchInsert(Collection salarySobItemGroupPOS) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class); + mapper.batchInsert(salarySobItemGroupPOS); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } + + public void deleteBySalarySobIds(Collection salarySobIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class); + mapper.deleteBySalarySobIds(salarySobIds); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } +} diff --git a/src/com/engine/salary/entity/hrm/DeptInfo.java b/src/com/engine/salary/entity/hrm/DeptInfo.java new file mode 100644 index 000000000..0a6e9d0c8 --- /dev/null +++ b/src/com/engine/salary/entity/hrm/DeptInfo.java @@ -0,0 +1,28 @@ +package com.engine.salary.entity.hrm; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 部门基本信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DeptInfo { + + private Long id; + + /** + * 名称 + */ + private String name; +} diff --git a/src/com/engine/salary/entity/hrm/PositionInfo.java b/src/com/engine/salary/entity/hrm/PositionInfo.java new file mode 100644 index 000000000..b88828139 --- /dev/null +++ b/src/com/engine/salary/entity/hrm/PositionInfo.java @@ -0,0 +1,30 @@ +package com.engine.salary.entity.hrm; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 岗位基本信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PositionInfo { + + private Long id; + + /** + * 名称 + */ + private String name; + + +} diff --git a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java index 4ea3bb5bc..ce1a8c741 100644 --- a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java +++ b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemListDTO.java @@ -34,26 +34,16 @@ public class SalaryItemListDTO { @SalaryTableColumn(text = "名称", width = "10%", column = "name") private String name; - @SalaryTableColumn(text = "属性", width = "10%", column = "category") - private String category; - - @SalaryTableColumn(text = "类型", width = "10%", column = "itemType") - private String itemType; - - //类型 - private SalaryItemTypeEnum itemTypeKey; - //薪资档案引用 @SalaryTableColumn(text = "薪资档案引用", width = "10%", column = "useInEmployeeSalary") private Integer useInEmployeeSalary; - //默认使用 @SalaryTableColumn(text = "默认使用", width = "10%", column = "useDefault") private Integer useDefault; //进位规则 - @SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode") + @SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode",transmethod = "com.engine.salary.transmethod.TransMethod.roundingMode") private String roundingMode; //保留小数位 @@ -61,9 +51,22 @@ public class SalaryItemListDTO { private Integer pattern; //取值方式 - @SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType") + @SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType",transmethod = "com.engine.salary.transmethod.TransMethod.datasource") private String valueType; + @SalaryTableColumn(text = "字段类型", width = "10%", column = "itemType",transmethod = "com.engine.salary.transmethod.TransMethod.valueType") + private String itemType; + + @SalaryTableColumn(text = "属性", width = "10%", column = "category") + private String category; + + //备注 + @SalaryTableColumn(text = "备注", width = "10%", column = "description") + private String description; + + //类型 + private SalaryItemTypeEnum itemTypeKey; + //数据来源 private String datasource; @@ -73,9 +76,6 @@ public class SalaryItemListDTO { //公式内容 private String formulaContent; - //备注 - @SalaryTableColumn(text = "备注", width = "10%", column = "description") - private String description; //是否可以编辑 private boolean canEdit; diff --git a/src/com/engine/salary/entity/salaryitem/param/SalaryItemSearchParam.java b/src/com/engine/salary/entity/salaryitem/param/SalaryItemSearchParam.java index 37f5a4aaa..c9ea0a31c 100644 --- a/src/com/engine/salary/entity/salaryitem/param/SalaryItemSearchParam.java +++ b/src/com/engine/salary/entity/salaryitem/param/SalaryItemSearchParam.java @@ -9,8 +9,11 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import java.util.Collection; +import java.util.stream.Collectors; /** * 薪资项目查询参数 @@ -69,4 +72,47 @@ public class SalaryItemSearchParam extends BaseQueryParam { //需要排除的系统薪资项目@see private Collection excludeIds; + + + + public static String makeSqlWhere(SalaryItemSearchParam searchParam) { + + String sqlWhere = " t.delete_type = 0 "; + + String name = searchParam.getName(); + if (StringUtils.isNotBlank(name)) { + sqlWhere += " AND t.name = " + name; + } + String description = searchParam.getDescription(); + if (StringUtils.isNotBlank(description)) { + sqlWhere += " AND t.description = " + description; + } + Integer category = searchParam.getCategory(); + if (category != null) { + sqlWhere += " AND t.category = " + category; + } + Integer itemType = searchParam.getItemType(); + if (itemType != null) { + sqlWhere += " AND t.item_type = " + itemType; + } + Integer useInEmployeeSalary = searchParam.getUseInEmployeeSalary(); + if (useInEmployeeSalary != null) { + sqlWhere += " AND t.use_in_employee_salary = " + useInEmployeeSalary; + } + Integer useDefault = searchParam.getUseDefault(); + if (useDefault != null) { + sqlWhere += " AND t.use_default = " + useDefault; + } + Integer valueType = searchParam.getValueType(); + if (valueType != null) { + sqlWhere += " AND t.value_type = " + valueType; + } + Collection excludeIds = searchParam.getExcludeIds(); + if (CollectionUtils.isNotEmpty(excludeIds)) { + String idsStr = excludeIds.stream().map(String::valueOf).collect(Collectors.joining(",")); + sqlWhere += " AND t.id NOT IN (" + idsStr + ")"; + } + + return sqlWhere; + } } diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java new file mode 100644 index 000000000..d3d7cf6ba --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemAggregateBO.java @@ -0,0 +1,193 @@ +package com.engine.salary.entity.salarysob.bo; + +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.salarysob.dto.SalarySobEmpFieldDTO; +import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; +import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO; +import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO; +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; +import com.engine.salary.entity.salarysob.po.SalarySobItemPO; +import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.enums.*; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.google.common.collect.Lists; +import com.weaver.excel.formula.api.entity.ExpressFormula; +import lombok.AllArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 将薪资账套的员工信息、薪资项目副本、薪资项目分类聚合在一起 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@AllArgsConstructor +public class SalarySobItemAggregateBO { + + /** + * 薪资账套 + */ + private SalarySobPO salarySob; + + /** + * 薪资账套的员工信息 + */ + private List salarySobEmpFields; + + /** + * 薪资账套的薪资项目分类 + */ + private List salarySobItemGroups; + + /** + * 薪资账套的薪资项目副本 + */ + private List salarySobItems; + + /** + * 薪资账套的薪资项目副本所用公式详情 + */ + private List expressFormulas; + + /** + * 薪资账套的薪资项目副本所关联的薪资项目 + */ + private List salaryItems; + + /** + * 转换成聚合dto + * + * @return + */ + public SalarySobItemAggregateDTO convert2AggregateDTO() { + List itemsWithoutGroup = Lists.newArrayList(); + // 薪资账套的薪资项目分类po转换成dto + List salarySobItemGroupDTOS = salarySobItemGroups.stream() + .map(e -> SalarySobItemGroupDTO.builder() + .id(e.getId()) + .salarySobId(e.getSalarySobId()) + .name(e.getName()) + .sortedIndex(e.getSortedIndex()) + .build()) + .collect(Collectors.toList()); + Map salarySobItemGroupDTOMap = SalaryEntityUtil.convert2Map(salarySobItemGroupDTOS, SalarySobItemGroupDTO::getId); + Map salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId); + Map> salarySobItemMap = SalaryEntityUtil.group2Map(salarySobItems, SalarySobItemPO::getSalarySobItemGroupId); + Map formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula); + // 薪资账套的薪资项目副本po转换成dto + salarySobItemMap.forEach((k, v) -> { + List items = Lists.newArrayList(); + for (int i = 0; i < v.size(); i++) { + SalarySobItemPO salarySobItemPO = v.get(i); + SalaryItemPO salaryItemPO = salaryItemMap.get(salarySobItemPO.getSalaryItemId()); + SalaryItemTypeEnum salaryItemTypeEnum = SalaryItemTypeEnum.parseByValue(salaryItemPO.getItemType()); + SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(salaryItemPO.getValueType()); + SalaryDataSourceEnum salaryDataSourceEnum = SalaryDataSourceEnum.parseByValue(salaryItemPO.getDatasource()); + items.add(SalarySobItemDTO.builder() + .id(salarySobItemPO.getId()) + .salarySobId(salarySob.getId()) + .salaryItemGroupId(k) + .salaryItemId(salaryItemPO.getId()) + .name(salaryItemPO.getName()) + .systemType(SalarySystemTypeEnum.parseByValue(salaryItemPO.getSystemType())) + .useDefault(salaryItemPO.getUseDefault()) + .category(SalaryItemCategoryEnum.parseByValue(salaryItemPO.getCategory())) + .itemTypeId(salaryItemTypeEnum) + .itemType(Optional.ofNullable(salaryItemTypeEnum) + .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) + .orElse(StringUtils.EMPTY)) + .valueType(salaryValueTypeEnum) + .dataSourceId(salaryDataSourceEnum) + .dataSource(Optional.ofNullable(salaryDataSourceEnum) + .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) + .orElse(StringUtils.EMPTY)) + .formulaId(salarySobItemPO.getFormulaId()) + .formulaContent(formulaMap.getOrDefault(salarySobItemPO.getFormulaId(), "")) + .sortedIndex(i) + .canEdit(salaryItemPO.getCanEdit() == 1) + .canDelete(salaryItemPO.getCanDelete() == 1) + .build()); + } + if (!salarySobItemGroupDTOMap.containsKey(k)) { + itemsWithoutGroup.addAll(items); + } else { + SalarySobItemGroupDTO salarySobItemGroupDTO = salarySobItemGroupDTOMap.get(k); + salarySobItemGroupDTO.setItems(sortItem(items)); + } + }); + // 薪资账套的员工信息字段po转换成dto + List salarySobEmpFieldDTOS = buildEmpField(salarySobEmpFields); + return SalarySobItemAggregateDTO.builder() + .salarySobId(salarySob.getId()) + .empFields(salarySobEmpFieldDTOS) + .items(sortItem(itemsWithoutGroup)) + .itemGroups(sortItemGroup(salarySobItemGroupDTOMap.values())) + .build(); + } + + /** + * 薪资账套的员工信息字段po转换成dto + * + * @param salarySobEmpFields 薪资账套的员工信息字段 + * @return + */ + private List buildEmpField(Collection salarySobEmpFields) { +// if (CollectionUtils.isEmpty(salarySobEmpFields)) { +// return Collections.emptyList(); +// } +// Field[] declaredFields = SalaryFormulaEmployeeDTO.class.getDeclaredFields(); +// Map empFieldMap = Maps.newHashMapWithExpectedSize(declaredFields.length); +// for (Field declaredField : declaredFields) { +// if (!declaredField.isAnnotationPresent(SalaryFormulaVar.class)) { +// continue; +// } +// SalaryFormulaVar annotation = declaredField.getAnnotation(SalaryFormulaVar.class); +// empFieldMap.put(declaredField.getName(), SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel())); +// } +// return salarySobEmpFields.stream() +// .map(e -> SalarySobEmpFieldDTO.builder() +// .id(e.getId()) +// .salarySobId(e.getSalarySobId()) +// .fieldId(e.getFieldCode()) +// .fieldName(empFieldMap.getOrDefault(e.getFieldCode(), "")) +// .sortedIndex(e.getSortedIndex()) +// .canDelete(Objects.equals(e.getCanDelete(), NumberUtils.INTEGER_ONE)) +// .build()) +// .collect(Collectors.toList()); + return null; + } + + /** + * 薪资账套的薪资项目按照sortedIndex排序 + * + * @param items 待排序的薪资账套的薪资项目 + * @return + */ + private List sortItem(Collection items) { + if (CollectionUtils.isEmpty(items)) { + return Collections.emptyList(); + } + return items.stream().sorted(Comparator.comparingInt(SalarySobItemDTO::getSortedIndex)).collect(Collectors.toList()); + } + + /** + * 薪资账套的薪资项目分类按照sortedIndex排序 + * + * @param itemGroups 待排序的薪资账套的薪资项目分类 + * @return + */ + private List sortItemGroup(Collection itemGroups) { + if (CollectionUtils.isEmpty(itemGroups)) { + return Collections.emptyList(); + } + return itemGroups.stream().sorted(Comparator.comparingInt(SalarySobItemGroupDTO::getSortedIndex)).collect(Collectors.toList()); + } +} diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java new file mode 100644 index 000000000..eb0f48e69 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java @@ -0,0 +1,137 @@ +package com.engine.salary.entity.salarysob.bo; + +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam; +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; +import com.engine.salary.entity.salarysob.po.SalarySobItemPO; +import lombok.Data; +import lombok.experimental.Accessors; +import org.apache.commons.compress.utils.Lists; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; + +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Optional; + +/** + * 薪资账套的薪资项目副本保存 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class SalarySobItemSaveBO { + + /** + * 处理前端传回的保存参数,转换成po + * + * @param saveParam + * @param employeeId + * @param tenantKey + * @return + */ + public static Result handle(SalarySobItemSaveParam saveParam, Long employeeId) { + Date now = new Date(); + Result result = new Result() + .setNeedInsertSalarySobEmpFields(Lists.newArrayList()) + .setNeedInsertSalarySobItems(Lists.newArrayList()) + .setNeedInsertSalarySobItemGroups(Lists.newArrayList()); + // 处理需要新增的员工信息字段 + for (SalarySobItemSaveParam.SalarySobEmpFieldParam salarySobEmpFieldParam : saveParam.getEmpFields()) { + SalarySobEmpFieldPO salarySobEmpFieldPO = SalarySobEmpFieldPO.builder() +// .id(IdGenerator.generate()) + .salarySobId(saveParam.getSalarySobId()) + .fieldCode(salarySobEmpFieldParam.getFieldId()) + .sortedIndex(salarySobEmpFieldParam.getSortedIndex()) + .canDelete(NumberUtils.INTEGER_ONE) + .creator(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(NumberUtils.INTEGER_ZERO) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); + result.getNeedInsertSalarySobEmpFields().add(salarySobEmpFieldPO); + } + // 处理需要新增的薪资项目和薪资项目分组 + int sortedIndex = 0; + for (SalarySobItemSaveParam.SalarySobItemGroupParam itemGroupParam : saveParam.getItemGroups()) { + SalarySobItemGroupPO salarySobItemGroupPO = SalarySobItemGroupPO.builder() +// .id(IdGenerator.generate()) + .salarySobId(saveParam.getSalarySobId()) + .name(itemGroupParam.getName()) + .sortedIndex(sortedIndex++) + .description(StringUtils.EMPTY) + .creator(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(NumberUtils.INTEGER_ZERO) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); + result.getNeedInsertSalarySobItemGroups().add(salarySobItemGroupPO); + // 处理薪资项目分组中的薪资项目 + handleSalarySobItems(result, saveParam.getSalarySobId(), salarySobItemGroupPO.getId(), itemGroupParam.getItems(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + } + // 处理未进行分组的薪资项目 + handleSalarySobItems(result, saveParam.getSalarySobId(), NumberUtils.LONG_ZERO, saveParam.getItems(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + return result; + } + + /** + * 将前端传递的参数转换成SalarySobItemPO + * + * @param result + * @param salarySobId + * @param salarySobItemGroupId + * @param itemParams + * @param employeeId + * @param tenantKey + */ + private static void handleSalarySobItems(Result result, + Long salarySobId, + Long salarySobItemGroupId, + List itemParams, + Long employeeId, String tenantKey) { + Date now = new Date(); + for (SalarySobItemSaveParam.SalarySobItemParam itemParam : itemParams) { + SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder() +// .id(IdGenerator.generate()) + .salarySobId(salarySobId) + .salaryItemId(itemParam.getSalaryItemId()) + .salarySobItemGroupId(salarySobItemGroupId) + .formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)) + .sortedIndex(itemParam.getSortedIndex()) + .description(StringUtils.EMPTY) + .creator(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(NumberUtils.INTEGER_ZERO) + .tenantKey(tenantKey) + .build(); + result.getNeedInsertSalarySobItems().add(salarySobItemPO); + } + } + + @Data + @Accessors(chain = true) + public static class Result { + + /** + * 薪资账套中需要新增的员工信息字段 + */ + private Collection needInsertSalarySobEmpFields; + + /** + * 薪资账套中需要新增的薪资项目副本 + */ + private Collection needInsertSalarySobItems; + + /** + * 薪资账套中需要新增的薪资项目分组 + */ + private Collection needInsertSalarySobItemGroups; + } +} diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java index 8495077a6..7725b6a98 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java @@ -1,10 +1,15 @@ package com.engine.salary.entity.salarysob.bo; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.DeptInfo; +import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobRangePO; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.enums.salarysob.TargetTypeEnum; import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -64,36 +69,36 @@ public class SalarySobRangeBO { * @param positionComInfos 岗位信息 * @return */ -// public static List convert2ListDTO(List salarySobRanges, -// List employeeComInfos, -// List departmentComInfos, -// List positionComInfos) { -// if (CollectionUtils.isEmpty(salarySobRanges)) { -// return Collections.emptyList(); -// } -// Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, HrmEmployeeComInfo::getId, HrmEmployeeComInfo::getUsername); -// Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); -// Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, HrmPositionComInfo::getId, HrmPositionComInfo::getName); -// return salarySobRanges.stream() -// .map(salarySobRangePO -> { -// TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRangePO.getTargetType()); -// SalaryEmployeeStatusEnum salaryEmployeeStatusEnum = SalaryEmployeeStatusEnum.parseByValue(salarySobRangePO.getEmployeeStatus()); -// return SalarySobRangeListDTO.builder() -// .id(salarySobRangePO.getId()) -// .salarySobId(salarySobRangePO.getSalarySobId()) -// .targetType(targetTypeEnum) -// .targetTypeName(Optional.ofNullable(targetTypeEnum) -// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) -// .orElse(StringUtils.EMPTY)) -// .targetId(salarySobRangePO.getTargetId()) -// .targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, positionComInfoMap)) -// .employeeStatus(Optional.ofNullable(salaryEmployeeStatusEnum) -// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) -// .orElse(StringUtils.EMPTY)) -// .build(); -// }) -// .collect(Collectors.toList()); -// } + public static List convert2ListDTO(List salarySobRanges, + List employeeComInfos, + List departmentComInfos, + List positionComInfos) { + if (CollectionUtils.isEmpty(salarySobRanges)) { + return Collections.emptyList(); + } + Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); + Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, DeptInfo::getId, DeptInfo::getName); + Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, PositionInfo::getId, PositionInfo::getName); + return salarySobRanges.stream() + .map(salarySobRangePO -> { + TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRangePO.getTargetType()); + SalaryEmployeeStatusEnum salaryEmployeeStatusEnum = SalaryEmployeeStatusEnum.parseByValue(salarySobRangePO.getEmployeeStatus()); + return SalarySobRangeListDTO.builder() + .id(salarySobRangePO.getId()) + .salarySobId(salarySobRangePO.getSalarySobId()) + .targetType(targetTypeEnum != null ? targetTypeEnum.getValue() : -1) + .targetTypeName(Optional.ofNullable(targetTypeEnum) + .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) + .orElse(StringUtils.EMPTY)) + .targetId(salarySobRangePO.getTargetId()) + .targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, positionComInfoMap)) + .employeeStatus(Optional.ofNullable(salaryEmployeeStatusEnum) + .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) + .orElse(StringUtils.EMPTY)) + .build(); + }) + .collect(Collectors.toList()); + } /** * 解析薪资账套人员范围中对象的名称(可能是人员名称、部门名称、岗位名称……) diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobEmpFieldDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobEmpFieldDTO.java new file mode 100644 index 000000000..149e2da8a --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobEmpFieldDTO.java @@ -0,0 +1,44 @@ +package com.engine.salary.entity.salarysob.dto; + +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; + +/** + * 薪资账套薪资项目-员工信息字段 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//薪资账套薪资项目-员工信息字段 +public class SalarySobEmpFieldDTO { + + //主键id + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + //薪资账套id + @JsonSerialize(using = ToStringSerializer.class) + private Long salarySobId; + + //字段id + private String fieldId; + + //字段名称 + private String fieldName; + + //排序字段 + private Integer sortedIndex; + + //是否允许删除。false:不允许删除、true:允许删除 + private boolean canDelete; +} diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobItemAggregateDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemAggregateDTO.java new file mode 100644 index 000000000..59eab1bf7 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemAggregateDTO.java @@ -0,0 +1,39 @@ +package com.engine.salary.entity.salarysob.dto; + +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; + +import java.util.List; + +/** + * 薪资账套薪资项目详情 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//薪资账套薪资项目详情 +public class SalarySobItemAggregateDTO { + + //薪资账套的id + @JsonSerialize(using = ToStringSerializer.class) + private Long salarySobId; + + //薪资账套的薪资项目详情-员工信息 + private List empFields; + + //薪资账套的薪资项目详情-薪资项目分类 + private List itemGroups; + + //薪资账套的薪资项目详情-薪资项目(未分类) + private List items; +} diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobItemDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemDTO.java new file mode 100644 index 000000000..fd2e24cbc --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemDTO.java @@ -0,0 +1,84 @@ +package com.engine.salary.entity.salarysob.dto; + +import com.engine.salary.enums.*; +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; + +/** + * 薪资账套的薪资项目 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//薪资账套的薪资项目 +public class SalarySobItemDTO { + + //主键id + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + //薪资账套的id + @JsonSerialize(using = ToStringSerializer.class) + private Long salarySobId; + + //薪资项目的id + @JsonSerialize(using = ToStringSerializer.class) + private Long salaryItemId; + + //薪资项目分组的id + @JsonSerialize(using = ToStringSerializer.class) + private Long salaryItemGroupId; + + //名称 + private String name; + + //是否是系统内置的薪资项目 + private SalarySystemTypeEnum systemType; + + //默认使用 + private Integer useDefault; + + //属性 + private SalaryItemCategoryEnum category; + + //类型(展示名称) + private String itemType; + + //类型 + private SalaryItemTypeEnum itemTypeId; + + //取值方式 + private SalaryValueTypeEnum valueType; + + //数据来源(展示名称) + private String dataSource; + + //数据来源 + private SalaryDataSourceEnum dataSourceId; + + //公式 + @JsonSerialize(using = ToStringSerializer.class) + private Long formulaId; + + //公式内容 + private String formulaContent; + + //排序字段 + private Integer sortedIndex; + + //是否可以编辑 + private boolean canEdit; + + //是否可以删除 + private boolean canDelete; +} diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobItemGroupDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemGroupDTO.java new file mode 100644 index 000000000..8c589c282 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemGroupDTO.java @@ -0,0 +1,43 @@ +package com.engine.salary.entity.salarysob.dto; + +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; + +import java.util.List; + +/** + * 薪资账套的薪资项目分组 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//薪资项目的薪资醒目分组 +public class SalarySobItemGroupDTO { + + //薪资项目分组id") + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + //薪资账套id") + @JsonSerialize(using = ToStringSerializer.class) + private Long salarySobId; + + //薪资项目分组名称") + private String name; + + //薪资项目分组排序字段") + private Integer sortedIndex; + + //薪资项目分组下的薪资项目") + private List items; +} diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobItemGroupFormDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemGroupFormDTO.java new file mode 100644 index 000000000..e1df27cbd --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobItemGroupFormDTO.java @@ -0,0 +1,39 @@ +package com.engine.salary.entity.salarysob.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * 薪资账套薪资项目分组表单 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +//薪资账套薪资项目分组表单 +public class SalarySobItemGroupFormDTO { + + //主键id + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + +// @SalaryForm( +// label = "名称", +// labelId = 84756, +// items = { +// @SalaryFormItem(itemType = WeaFormItemType.INPUT, required = true, maxLength = "40") +// } +// ) +// @ApiModelProperty("名称") +// @NotEmpty(message = "名称不允许为空") + private String name; +} diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java index 197a14d02..b3c87b400 100644 --- a/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java @@ -34,6 +34,7 @@ public class SalarySobListDTO { //主键id @JsonSerialize(using = ToStringSerializer.class) + @SalaryTableColumn(column = "id", display = false) private Long id; @SalaryTableColumn(text = "账套名称", width = "10%", column = "name") diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobRangeListDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobRangeListDTO.java index 97dceb30d..c48b1f5cc 100644 --- a/src/com/engine/salary/entity/salarysob/dto/SalarySobRangeListDTO.java +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobRangeListDTO.java @@ -3,6 +3,7 @@ package com.engine.salary.entity.salarysob.dto; import com.cloudstore.eccom.pc.table.WeaTableType; import com.engine.salary.annotation.SalaryTable; import com.engine.salary.annotation.SalaryTableColumn; +import com.engine.salary.annotation.TableTitle; import com.engine.salary.enums.salarysob.TargetTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -38,14 +39,17 @@ public class SalarySobRangeListDTO { private Integer targetType; @SalaryTableColumn(text = "对象类型", width = "10%", column = "targetTypeName") + @TableTitle(title = "对象类型", dataIndex = "targetTypeName", key = "targetTypeName") private String targetTypeName; @SalaryTableColumn(text = "对象", width = "10%", column = "targetName") + @TableTitle(title = "对象", dataIndex = "targetName", key = "targetName") private String targetName; //对象 private Long targetId; @SalaryTableColumn(text = "员工状态", width = "10%", column = "employeeStatus") + @TableTitle(title = "员工状态", dataIndex = "employeeStatus", key = "employeeStatus") private String employeeStatus; } diff --git a/src/com/engine/salary/entity/salarysob/param/SalarySobRangeSaveParam.java b/src/com/engine/salary/entity/salarysob/param/SalarySobRangeSaveParam.java index b3e4b5f9f..dd3d63cfc 100644 --- a/src/com/engine/salary/entity/salarysob/param/SalarySobRangeSaveParam.java +++ b/src/com/engine/salary/entity/salarysob/param/SalarySobRangeSaveParam.java @@ -2,67 +2,50 @@ package com.engine.salary.entity.salarysob.param; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.enums.salarysob.TargetTypeEnum; +import com.engine.salary.util.valid.DataCheck; +import com.engine.salary.util.valid.ValidTypeEnum; import lombok.Data; import java.util.List; /** - * @description: 薪资账套人员范围保存参数 - * @author: xiajun - * @modified By: xiajun - * @date: Created in 11/11/21 10:05 AM - * @version:v1.0 - */ + * 薪资账套人员范围保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data //薪资账套人员范围保存参数") public class SalarySobRangeSaveParam { - /** - * 薪资账套的ID不允许为空 - */ - //@NotNull(message = "LABEL:86575") - //薪资账套的id") + //薪资账套的id + @DataCheck(require = true, message = "薪资账套的ID不允许为空") private Long salarySobId; - /** - * 只能选择 关联人员范围/从范围中排除 - */ - //@NotNull(message = "LABEL:84026") - //@Min(message = "LABEL:84026", value = 0) - //@Max(message = "LABEL:84026", value = 1) //是包含还是排除。0:排除、1:包含") + @DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 1, min = 0, message = "只能选择 关联人员范围/从范围中排除") private Integer includeType; - /** - * 对象不能为空 - */ - //@NotEmpty(message = "LABEL:98598") - //对象") + //对象 + @DataCheck(require = true, message = "对象不能为空") private List targetParams; - /** - * 员工状态不允许为空 - */ - //@NotNull(message = "LABEL:98599") - //员工状态") + //员工状态 + @DataCheck(require = true, message = "员工状态不允许为空") private SalaryEmployeeStatusEnum employeeStatus; @Data - //薪资账套人员范围保存参数中的对象") + //薪资账套人员范围保存参数中的对象 public static class SalarySobRangeTargetParam { - /** - * 对象类型不能为空 - */ - //@NotNull(message = "LABEL:98600") - //对象类型") + //对象类型 + @DataCheck(require = true, message = "对象类型不能为空") private TargetTypeEnum targetType; - /** - * 对象不能为空 - */ - //@NotNull(message = "LABEL:98598") - //对象id") + //对象id + @DataCheck(require = true, message = "对象不能为空") private Long targetId; } } diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java new file mode 100644 index 000000000..b81df8fa6 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java @@ -0,0 +1,77 @@ +package com.engine.salary.entity.salarysob.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Date; + +/** + * 薪资账套薪资项目分组 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_salary_sob_item_group +public class SalarySobItemGroupPO { + + /** + * 主键id + */ + private Long id; + + /** + * 薪资账套的id + */ + private Long salarySobId; + + /** + * 薪资账套的名称 + */ + private String name; + + /** + * 排序字段 + */ + private Integer sortedIndex; + + /** + * 备注 + */ + private String description; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + Collection ids; +} diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java index 1ec2e8e6d..7d488484e 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java @@ -83,5 +83,11 @@ public class SalarySobItemPO { */ private Date updateTime; + //in Collection ids; + Collection salarySobIds; + + //not in + Collection salaryItemIds; + } diff --git a/src/com/engine/salary/enums/SalaryDataSourceEnum.java b/src/com/engine/salary/enums/SalaryDataSourceEnum.java index 74b53ce35..bdb4cd287 100644 --- a/src/com/engine/salary/enums/SalaryDataSourceEnum.java +++ b/src/com/engine/salary/enums/SalaryDataSourceEnum.java @@ -1,5 +1,6 @@ package com.engine.salary.enums; +import java.util.Arrays; import java.util.Objects; /** @@ -57,4 +58,17 @@ public enum SalaryDataSourceEnum implements BaseEnum { } return null; } + + public static String getDefaultLabelByValue(Integer value) { + if (value == null) { + return ""; + } + SalaryDataSourceEnum[] enumAry = SalaryDataSourceEnum.values(); + for(int i = 0; i < Arrays.asList(enumAry).size(); i++){ + if (Integer.valueOf(enumAry[i].getValue()).equals(value)) { + return enumAry[i].getDefaultLabel(); + } + } + return ""; + } } diff --git a/src/com/engine/salary/enums/SalaryValueTypeEnum.java b/src/com/engine/salary/enums/SalaryValueTypeEnum.java index b6aad297d..775adddb8 100644 --- a/src/com/engine/salary/enums/SalaryValueTypeEnum.java +++ b/src/com/engine/salary/enums/SalaryValueTypeEnum.java @@ -1,6 +1,7 @@ package com.engine.salary.enums; +import java.util.Arrays; import java.util.Objects; /** @@ -50,4 +51,17 @@ public enum SalaryValueTypeEnum implements BaseEnum { } return null; } + + public static String getDefaultLabelByValue(Integer value) { + if (value == null) { + return ""; + } + SalaryValueTypeEnum[] enumAry = SalaryValueTypeEnum.values(); + for(int i = 0; i < Arrays.asList(enumAry).size(); i++){ + if (Integer.valueOf(enumAry[i].getValue()).equals(value)) { + return enumAry[i].getDefaultLabel(); + } + } + return ""; + } } diff --git a/src/com/engine/salary/enums/sicategory/RententionRuleEnum.java b/src/com/engine/salary/enums/sicategory/RententionRuleEnum.java index 11719219d..9f82bc15d 100644 --- a/src/com/engine/salary/enums/sicategory/RententionRuleEnum.java +++ b/src/com/engine/salary/enums/sicategory/RententionRuleEnum.java @@ -4,13 +4,16 @@ package com.engine.salary.enums.sicategory; import com.engine.salary.enums.BaseEnum; import java.math.BigDecimal; +import java.util.Arrays; /** - * @Description: 进位规则枚举 - * @Author: zhangheng - * @CreateDate: 2021/11/16 14:43 - * @Version: v1.0 - */ + * 进位规则枚举 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public enum RententionRuleEnum implements BaseEnum { ROUND(BigDecimal.ROUND_HALF_UP, "四舍五入", 84505), CEIL(BigDecimal.ROUND_UP, "向上舍入", 84506), @@ -42,4 +45,17 @@ public enum RententionRuleEnum implements BaseEnum { public String getDefaultLabel() { return this.defaultLabel; } + + public static String getDefaultLabelByValue(Integer value) { + if (value == null) { + return ""; + } + RententionRuleEnum[] enumAry = RententionRuleEnum.values(); + for(int i = 0; i < Arrays.asList(enumAry).size(); i++){ + if (Integer.valueOf(enumAry[i].getValue()).equals(value)) { + return enumAry[i].getDefaultLabel(); + } + } + return ""; + } } diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.java b/src/com/engine/salary/mapper/datacollection/EmployMapper.java index def5bb42f..f45efa5fa 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.java +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.java @@ -1,6 +1,7 @@ package com.engine.salary.mapper.datacollection; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.PositionInfo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -18,4 +19,5 @@ public interface EmployMapper { List getEmployeeByIdsAll(@Param("collection") List ids); + List listPositionInfo(@Param("collection") List ids); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 05d4c9b79..a61263dbd 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -47,4 +47,18 @@ + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobItemGroupMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobItemGroupMapper.java new file mode 100644 index 000000000..ed074f1fd --- /dev/null +++ b/src/com/engine/salary/mapper/salarysob/SalarySobItemGroupMapper.java @@ -0,0 +1,91 @@ +package com.engine.salary.mapper.salarysob; + +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface SalarySobItemGroupMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(SalarySobItemGroupPO salarySobItemGroup); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + SalarySobItemGroupPO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param salarySobItemGroup 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(SalarySobItemGroupPO salarySobItemGroup); + + /** + * 修改,修改所有字段 + * + * @param salarySobItemGroup 修改的记录 + * @return 返回影响行数 + */ + int update(SalarySobItemGroupPO salarySobItemGroup); + + /** + * 修改,忽略null字段 + * + * @param salarySobItemGroup 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(SalarySobItemGroupPO salarySobItemGroup); + + /** + * 删除记录 + * + * @param salarySobItemGroup 待删除的记录 + * @return 返回影响行数 + */ + int delete(SalarySobItemGroupPO salarySobItemGroup); + + + + /** + * 根据薪资账套id删除 + * + * @param salarySobIds + * @param tenantKey + */ + void deleteBySalarySobIds(@Param("salarySobIds") Collection salarySobIds); + + /** + * 根据主键id删除 + * + * @param ids + * @param tenantKey + */ + void deleteByIds(@Param("ids") Collection ids); + + /** + * 批量保存 + * + * @param salarySobItemGroups + */ + void batchInsert(@Param("collection") Collection salarySobItemGroups); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobItemGroupMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobItemGroupMapper.xml new file mode 100644 index 000000000..63719eccf --- /dev/null +++ b/src/com/engine/salary/mapper/salarysob/SalarySobItemGroupMapper.xml @@ -0,0 +1,304 @@ + + + + + + + + + + + + + + + + + + + t + . + id + , t.salary_sob_id + , t.name + , t.sorted_index + , t.description + , t.create_time + , t.update_time + , t.creator + , t.delete_type + , t.tenant_key + + + + + + + + + + + + + + + INSERT INTO hrsa_salary_sob_item_group + + + + id, + + + salary_sob_id, + + + name, + + + sorted_index, + + + description, + + + create_time, + + + update_time, + + + creator, + + + delete_type, + + + tenant_key, + + + + + #{id}, + + + #{salarySobId}, + + + #{name}, + + + #{sortedIndex}, + + + #{description}, + + + #{createTime}, + + + #{updateTime}, + + + #{creator}, + + + #{deleteType}, + + + #{tenantKey}, + + + + + + + UPDATE hrsa_salary_sob_item_group + + salary_sob_id=#{salarySobId}, + name=#{name}, + sorted_index=#{sortedIndex}, + description=#{description}, + create_time=#{createTime}, + update_time=#{updateTime}, + creator=#{creator}, + delete_type=#{deleteType}, + tenant_key=#{tenantKey}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_salary_sob_item_group + + + salary_sob_id=#{salarySobId}, + + + name=#{name}, + + + sorted_index=#{sortedIndex}, + + + description=#{description}, + + + create_time=#{createTime}, + + + update_time=#{updateTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + tenant_key=#{tenantKey}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_salary_sob_item_group + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + + UPDATE hrsa_salary_sob_item_group + SET delete_type = 1 + WHERE delete_type = 0 + AND salary_sob_id IN + + #{salarySobId} + + + + + UPDATE hrsa_salary_sob_item_group + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + INSERT INTO hrsa_salary_sob_item_group( salary_sob_id, name, sorted_index, description, create_time, + update_time, creator, tenant_key) + VALUES + + ( + #{item.salarySobId}, + #{item.name}, + #{item.sortedIndex}, + #{item.description}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + ) + + + + INSERT INTO hrsa_salary_sob_item_group( salary_sob_id, name, sorted_index, description, create_time, + update_time, creator, tenant_key) + + + select + #{item.salarySobId}, + #{item.name}, + #{item.sortedIndex}, + #{item.description}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + from dual + + + + INSERT INTO hrsa_salary_sob_item_group( salary_sob_id, name, sorted_index, description, create_time, + update_time, creator, tenant_key) + VALUES + + ( + #{item.salarySobId}, + #{item.name}, + #{item.sortedIndex}, + #{item.description}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + ) + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java index 0102524fa..e84ad7e55 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java +++ b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.java @@ -2,7 +2,9 @@ package com.engine.salary.mapper.salarysob; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import java.util.Collection; import java.util.List; @Mapper @@ -58,9 +60,31 @@ public interface SalarySobItemMapper { /** * 删除记录 * - * @param SalarySobItemPO 待删除的记录 + * @param salarySobItemPO 待删除的记录 * @return 返回影响行数 */ int delete(SalarySobItemPO salarySobItemPO); + + + /** + * 根据薪资账套id删除 + * + * @param salarySobIds + */ + void deleteBySalarySobIds(@Param("salarySobIds") Collection salarySobIds); + + /** + * 根据主键id删除 + * + * @param ids + */ + void deleteByIds(@Param("ids") Collection ids); + + /** + * 批量保存 + * + * @param salarySobItems + */ + void batchInsert(@Param("collection") Collection salarySobItems); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml index 41f17c1d1..c59b3e354 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobItemMapper.xml @@ -59,37 +59,37 @@ AND create_time = #{createTime} - + AND creator = #{creator} - + AND delete_type = #{deleteType} AND description = #{description} - + AND formula_id = #{formulaId} AND id = #{id} - + AND salary_item_id = #{salaryItemId} - + AND salary_sob_id = #{salarySobId} - + AND salary_sob_item_group_id = #{salarySobItemGroupId} - + AND sorted_index = #{sortedIndex} - + AND tenant_key = #{tenantKey} - + AND update_time = #{updateTime} @@ -98,6 +98,18 @@ #{id} + + AND salary_sob_id IN + + #{salarySobId} + + + + AND salary_item_id IN + + #{salaryItemId} + + ORDER BY id DESC @@ -257,4 +269,86 @@ + + UPDATE hrsa_salary_sob_item + SET delete_type = 1 + WHERE delete_type = 0 + AND salary_sob_id IN + + #{salarySobId} + + + + + UPDATE hrsa_salary_sob_item + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + INSERT INTO hrsa_salary_sob_item(salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id, + sorted_index, description, create_time, update_time, creator, delete_type, tenant_key) + VALUES + + ( + #{item.salarySobId}, + #{item.salaryItemId}, + #{item.salarySobItemGroupId}, + #{item.formulaId}, + #{item.sortedIndex}, + #{item.description}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + ) + + + + INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id, + sorted_index, description, create_time, update_time, creator, delete_type, tenant_key) + + + select + #{item.salarySobId}, + #{item.salaryItemId}, + #{item.salarySobItemGroupId}, + #{item.formulaId}, + #{item.sortedIndex}, + #{item.description}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + from dual + + + + INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id, + sorted_index, description, create_time, update_time, creator, delete_type, tenant_key) + VALUES + + ( + #{item.salarySobId}, + #{item.salaryItemId}, + #{item.salarySobItemGroupId}, + #{item.formulaId}, + #{item.sortedIndex}, + #{item.description}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + ) + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml index 35a037dcd..33c199b91 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml @@ -70,7 +70,7 @@ AND employee_status = #{employeeStatus} - + AND include_type = #{includeType} diff --git a/src/com/engine/salary/service/SalarySobEmpFieldService.java b/src/com/engine/salary/service/SalarySobEmpFieldService.java new file mode 100644 index 000000000..43e77026c --- /dev/null +++ b/src/com/engine/salary/service/SalarySobEmpFieldService.java @@ -0,0 +1,39 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; + +import java.util.Collection; +import java.util.List; + +/** + * 薪资账套的员工信息字段 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface SalarySobEmpFieldService { + + /** + * 根据薪资账套id查询薪资账套的员工信息字段 + * + * @param salarySobId 薪资账套id + * @return + */ + List listBySalarySobId(Long salarySobId); + + /** + * 批量保存 + * + * @param salarySobEmpFieldPOS 薪资账套的员工信息字段 + */ + void batchSave(Collection salarySobEmpFieldPOS); + + /** + * 根据薪资账套的id删除薪资账套的员工信息字段 + * + * @param salarySobIds 薪资账套id + */ + void deleteBySalarySobIds(Collection salarySobIds); +} diff --git a/src/com/engine/salary/service/SalarySobItemGroupService.java b/src/com/engine/salary/service/SalarySobItemGroupService.java new file mode 100644 index 000000000..d42e63f8b --- /dev/null +++ b/src/com/engine/salary/service/SalarySobItemGroupService.java @@ -0,0 +1,47 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; + +import java.util.Collection; +import java.util.List; + +/** + * 薪资账套的薪资项目分类 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface SalarySobItemGroupService { + + /** + * 根据主键id获取单个薪资账套的薪资项目分类 + * + * @param id 薪资账套的薪资项目分类的主键id + * @return + */ + SalarySobItemGroupPO getById(Long id); + + /** + * 根据薪资账套id查询薪资账套的薪资项目分类 + * + * @param salarySobId 薪资账套id + * @return + */ + List listBySalarySobId(Long salarySobId); + + /** + * 批量保存 + * + * @param salarySobItemGroupPOS 薪资账套的薪资项目分类po集合 + */ + void batchSave(Collection salarySobItemGroupPOS); + + /** + * 根据薪资账套id删除薪资账套的薪资项目分类 + * + * @param salarySobIds 薪资账套id + */ + void deleteBySalarySobIds(Collection salarySobIds); +} diff --git a/src/com/engine/salary/service/SalarySobItemService.java b/src/com/engine/salary/service/SalarySobItemService.java index e341de7aa..318ddaf37 100644 --- a/src/com/engine/salary/service/SalarySobItemService.java +++ b/src/com/engine/salary/service/SalarySobItemService.java @@ -1,5 +1,8 @@ package com.engine.salary.service; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; +import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import java.util.Collection; @@ -25,29 +28,26 @@ public interface SalarySobItemService { * 根据薪资账套id查询薪资账套的薪资项目副本 * * @param salarySobId 薪资账套的id - * @param tenantKey 租户key * @return */ -// List listBySalarySobId(Long salarySobId, String tenantKey); + List listBySalarySobId(Long salarySobId); /** * 根据薪资账套id查询薪资账套的薪资项目副本 * * @param salarySobIds 薪资账套的id - * @param tenantKey 租户key * @return */ -// List listBySalarySobIds(Collection salarySobIds, String tenantKey); + List listBySalarySobIds(Collection salarySobIds); /** * 根据薪资账套id、薪资项目id查询薪资账套的薪资项目副本 * * @param salarySobId 薪资账套id * @param salaryItemIds 薪资项目id - * @param tenantKey 租户key * @return */ -// List listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection salaryItemIds, String tenantKey); + List listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection salaryItemIds); /** * 根据薪资项目id查询薪资账套的薪资项目副本 @@ -61,41 +61,35 @@ public interface SalarySobItemService { * 根据薪资账套id查询薪资账套的薪资项目副本所关联的薪资项目 * * @param salarySobId 薪资账套id - * @param tenantKey 租户key * @return */ -// List listBySalarySobId4SalaryItem(Long salarySobId, String tenantKey); + List listBySalarySobId4SalaryItem(Long salarySobId); /** * 根据薪资账套id获取薪资账套的薪资项目聚合(员工信息、薪资项目副本、薪资项目分类) * * @param salarySobId - * @param tenantKey * @return */ -// SalarySobItemAggregateDTO getAggregateBySalarySobId(Long salarySobId, String tenantKey); + SalarySobItemAggregateDTO getAggregateBySalarySobId(Long salarySobId); /** * 保存 * * @param saveParam 保存参数 - * @param employeeId 人员id - * @param tenantKey 租户key */ -// void save(SalarySobItemSaveParam saveParam, Long employeeId, String tenantKey); + void save(SalarySobItemSaveParam saveParam); /** * 批量保存 * * @param salarySobItemPOS 薪资账套的薪资项目副本 */ -// void batchSave(Collection salarySobItemPOS); + void batchSave(Collection salarySobItemPOS); /** * 根据薪资账套id删除薪资账套的薪资项目副本 * - * @param salarySobIds 薪资账套的id - * @param tenantKey 租户key */ -// void deleteBySalarySobIds(Collection salarySobIds, String tenantKey); + void deleteBySalarySobIds(Collection salarySobIds); } diff --git a/src/com/engine/salary/service/SalarySobRangeService.java b/src/com/engine/salary/service/SalarySobRangeService.java index 8965a23bf..62ac1cd5a 100644 --- a/src/com/engine/salary/service/SalarySobRangeService.java +++ b/src/com/engine/salary/service/SalarySobRangeService.java @@ -4,6 +4,7 @@ import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam; import com.engine.salary.entity.salarysob.po.SalarySobRangePO; +import com.engine.salary.util.page.PageInfo; import java.util.Collection; import java.util.List; @@ -42,7 +43,7 @@ public interface SalarySobRangeService { * @param includeType 0-从范围中排除/1-关联人员范围 * @return */ - List listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType); + PageInfo listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType); /** * 保存 diff --git a/src/com/engine/salary/service/impl/SalarySobItemGroupServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobItemGroupServiceImpl.java new file mode 100644 index 000000000..a46462b91 --- /dev/null +++ b/src/com/engine/salary/service/impl/SalarySobItemGroupServiceImpl.java @@ -0,0 +1,42 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.biz.SalarySobItemGroupBiz; +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; +import com.engine.salary.service.SalarySobItemGroupService; + +import java.util.Collection; +import java.util.List; + +/** + * 薪资账套中的薪资项目分类 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class SalarySobItemGroupServiceImpl extends Service implements SalarySobItemGroupService { + + private SalarySobItemGroupBiz salarySobItemGroupMapper = new SalarySobItemGroupBiz(); + + @Override + public SalarySobItemGroupPO getById(Long id) { + return salarySobItemGroupMapper.getById(id); + } + + @Override + public List listBySalarySobId(Long salarySobId) { + return salarySobItemGroupMapper.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build()); + } + + @Override + public void batchSave(Collection salarySobItemGroupPOS) { + salarySobItemGroupMapper.batchInsert(salarySobItemGroupPOS); + } + + @Override + public void deleteBySalarySobIds(Collection salarySobIds) { + salarySobItemGroupMapper.deleteBySalarySobIds(salarySobIds); + } +} diff --git a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java index 6ac188c73..83fc0f2f4 100644 --- a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java @@ -1,14 +1,25 @@ package com.engine.salary.service.impl; import com.engine.core.impl.Service; +import com.engine.salary.biz.SalarySobBiz; import com.engine.salary.biz.SalarySobItemBiz; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO; +import com.engine.salary.entity.salarysob.bo.SalarySobItemSaveBO; +import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; +import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam; +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; -import com.engine.salary.service.SalarySobItemService; +import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.service.*; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.weaver.excel.formula.api.entity.ExpressFormula; import org.apache.commons.collections4.CollectionUtils; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; /** * 薪资账套的薪资项目副本 @@ -21,17 +32,11 @@ import java.util.List; public class SalarySobItemServiceImpl extends Service implements SalarySobItemService { private SalarySobItemBiz salarySobItemMapper = new SalarySobItemBiz(); -// @Autowired -// private SalarySobService salarySobService; -// @Autowired -// private SalarySobEmpFieldService salarySobEmpFieldService; -// @Autowired -// private SalarySobItemGroupService salarySobItemGroupService; -// @Autowired -// private SalaryFormulaService salaryFormulaService; -// @Autowired -// private SalaryItemService salaryItemService; -// @Autowired + private SalarySobBiz salarySobBiz = new SalarySobBiz(); + private SalarySobEmpFieldService salarySobEmpFieldService; + private SalarySobItemGroupService salarySobItemGroupService; + private SalaryFormulaService salaryFormulaService; + private SalaryItemService salaryItemService; // private LoggerTemplate salarySobLoggerTemplate; @Override @@ -39,115 +44,96 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe return salarySobItemMapper.listAll(); } -// @Override -// public List listBySalarySobId(Long salarySobId, String tenantKey) { -// return new LambdaQueryChainWrapper<>(salarySobItemMapper) -// .eq(SalarySobItemPO::getTenantKey, tenantKey) -// .eq(SalarySobItemPO::getDeleteType, 0) -// .eq(SalarySobItemPO::getSalarySobId, salarySobId) -// .list(); -// } -// -// @Override -// public List listBySalarySobIds(Collection salarySobIds, String tenantKey) { -// return new LambdaQueryChainWrapper<>(salarySobItemMapper) -// .eq(SalarySobItemPO::getTenantKey, tenantKey) -// .eq(SalarySobItemPO::getDeleteType, 0) -// .in(SalarySobItemPO::getSalarySobId, salarySobIds) -// .list(); -// } -// -// @Override -// public List listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection salaryItemIds, String tenantKey) { -// return new LambdaQueryChainWrapper<>(salarySobItemMapper) -// .eq(SalarySobItemPO::getTenantKey, tenantKey) -// .eq(SalarySobItemPO::getDeleteType, 0) -// .eq(SalarySobItemPO::getSalarySobId, salarySobId) -// .notIn(CollectionUtils.isNotEmpty(salaryItemIds), SalarySobItemPO::getSalaryItemId, salaryItemIds) -// .list(); -// } -// + @Override + public List listBySalarySobId(Long salarySobId) { + return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).build()); + } + + @Override + public List listBySalarySobIds(Collection salarySobIds) { + return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobIds(salarySobIds).build()); + } + + @Override + public List listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection salaryItemIds) { + return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemIds(salaryItemIds).build()); + } + @Override public List listBySalaryItemIds(Collection salaryItemIds) { if (CollectionUtils.isEmpty(salaryItemIds)) { return Collections.emptyList(); } - return null; -// return new LambdaQueryChainWrapper<>(salarySobItemMapper) -// .eq(SalarySobItemPO::getTenantKey, tenantKey) -// .eq(SalarySobItemPO::getDeleteType, 0) -// .in(SalarySobItemPO::getSalaryItemId, salaryItemIds) -// .list(); + return salarySobItemMapper.listSome(SalarySobItemPO.builder().salaryItemIds(salaryItemIds).build()); } -// @Override -// public List listBySalarySobId4SalaryItem(Long salarySobId, String tenantKey) { -// // 查询薪资项目副本 -// List salarySobItemPOS = listBySalarySobId(salarySobId, tenantKey); -// if (CollectionUtils.isEmpty(salarySobItemPOS)) { -// return Collections.emptyList(); -// } -// // 查询薪资项目 -// Set salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); -// return salaryItemService.listByIds(salaryItemIds, tenantKey); -// } -// -// @Override -// public SalarySobItemAggregateDTO getAggregateBySalarySobId(Long salarySobId, String tenantKey) { -// // 查询薪资账套 -// SalarySobPO salarySobPO = salarySobService.getById(salarySobId, tenantKey); -// if (Objects.isNull(salarySobPO)) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); -// } -// // 查询薪资账套的员工信息字段 -// List salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salarySobId, tenantKey); -// // 查询薪资账套的薪资项目分类 -// List salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salarySobId, tenantKey); -// // 查询薪资账套的薪资项目副本 -// List salarySobItemPOS = listBySalarySobId(salarySobId, tenantKey); -// // 薪资账套的薪资项目副本所用的公式id -// Set formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId); -// // 查询公式详情 -// List expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey); -// // 查询薪资账套的薪资项目副本所关联的薪资项目 -// Set salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); -// List salaryItemPOS = salaryItemService.listByIds(salaryItemIds, tenantKey); -// // 转换成聚合dto -// SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS, -// salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS); -// return salarySobItemAggregateBO.convert2AggregateDTO(); -// } -// -// @Override -// @Transactional(rollbackFor = Exception.class) -// public void save(SalarySobItemSaveParam saveParam, Long employeeId, String tenantKey) { -// // 查询薪资账套 -// SalarySobPO salarySobPO = salarySobService.getById(saveParam.getSalarySobId(), tenantKey); -// if (Objects.isNull(salarySobPO)) { -// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); -// } -// // 删除薪资账套的员工信息字段 -// salarySobEmpFieldService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()), tenantKey); -// // 删除薪资账套的薪资项目副本 -// deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()), tenantKey); -// // 删除薪资账套的薪资项目分类 -// salarySobItemGroupService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()), tenantKey); -// -// // 处理保存参数 -// SalarySobItemSaveBO.Result result = SalarySobItemSaveBO.handle(saveParam, employeeId, tenantKey); -// // 保存薪资账套的员工信息字段 -// if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobEmpFields())) { -// salarySobEmpFieldService.batchSave(result.getNeedInsertSalarySobEmpFields()); -// } -// // 保存薪资账套的薪资项目副本 -// if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) { -// batchSave(result.getNeedInsertSalarySobItems()); -// } -// // 保存薪资账套的薪资项目分类 -// if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) { -// salarySobItemGroupService.batchSave(result.getNeedInsertSalarySobItemGroups()); -// } -// // 记录日志 + @Override + public List listBySalarySobId4SalaryItem(Long salarySobId) { + // 查询薪资项目副本 + List salarySobItemPOS = listBySalarySobId(salarySobId); + if (CollectionUtils.isEmpty(salarySobItemPOS)) { + return Collections.emptyList(); + } + // 查询薪资项目 + Set salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); + return salaryItemService.listByIds(salaryItemIds); + } + + @Override + public SalarySobItemAggregateDTO getAggregateBySalarySobId(Long salarySobId) { + // 查询薪资账套 + SalarySobPO salarySobPO = salarySobBiz.getById(salarySobId); + if (Objects.isNull(salarySobPO)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); + } + // 查询薪资账套的员工信息字段 + List salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salarySobId); + // 查询薪资账套的薪资项目分类 + List salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salarySobId); + // 查询薪资账套的薪资项目副本 + List salarySobItemPOS = listBySalarySobId(salarySobId); + // 薪资账套的薪资项目副本所用的公式id + Set formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId); + // 查询公式详情 + List expressFormulas = salaryFormulaService.listExpressFormula(formulaIds); + // 查询薪资账套的薪资项目副本所关联的薪资项目 + Set salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); + List salaryItemPOS = salaryItemService.listByIds(salaryItemIds); + // 转换成聚合dto + SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS, + salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS); + return salarySobItemAggregateBO.convert2AggregateDTO(); + } + + @Override + public void save(SalarySobItemSaveParam saveParam) { + // 查询薪资账套 + SalarySobPO salarySobPO = salarySobBiz.getById(saveParam.getSalarySobId()); + if (Objects.isNull(salarySobPO)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); + } + // 删除薪资账套的员工信息字段 + salarySobEmpFieldService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); + // 删除薪资账套的薪资项目副本 + deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); + // 删除薪资账套的薪资项目分类 + salarySobItemGroupService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); + + // 处理保存参数 + SalarySobItemSaveBO.Result result = SalarySobItemSaveBO.handle(saveParam,(long)user.getUID()); + // 保存薪资账套的员工信息字段 + if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobEmpFields())) { + salarySobEmpFieldService.batchSave(result.getNeedInsertSalarySobEmpFields()); + } + // 保存薪资账套的薪资项目副本 + if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) { + batchSave(result.getNeedInsertSalarySobItems()); + } + // 保存薪资账套的薪资项目分类 + if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) { + salarySobItemGroupService.batchSave(result.getNeedInsertSalarySobItemGroups()); + } + //todo 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId("" + salarySobPO.getId()); // loggerContext.setTargetName(salarySobPO.getName()); @@ -155,15 +141,15 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe // loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98613, "编辑薪资账套薪资项目")); // loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98613, "编辑薪资账套薪资项目")); // salarySobLoggerTemplate.write(loggerContext); -// } -// -// @Override -// public void batchSave(Collection salarySobItemPOS) { -// salarySobItemMapper.batchInsert(salarySobItemPOS); -// } -// -// @Override -// public void deleteBySalarySobIds(Collection salarySobIds, String tenantKey) { -// salarySobItemMapper.deleteBySalarySobIds(salarySobIds, tenantKey); -// } + } + + @Override + public void batchSave(Collection salarySobItemPOS) { + salarySobItemMapper.batchInsert(salarySobItemPOS); + } + + @Override + public void deleteBySalarySobIds(Collection salarySobIds) { + salarySobItemMapper.deleteBySalarySobIds(salarySobIds); + } } diff --git a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java index 0cdfad8ee..925d4fe56 100644 --- a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java @@ -5,6 +5,10 @@ import com.engine.core.impl.Service; import com.engine.hrm.biz.OrganizationShowSetBiz; import com.engine.salary.biz.EmployBiz; import com.engine.salary.biz.SalarySobRangeBiz; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.DeptInfo; +import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO; import com.engine.salary.entity.salarysob.bo.SalarySobRangeSaveBO; import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; @@ -17,7 +21,11 @@ import com.engine.salary.service.SalarySobRangeService; import com.engine.salary.service.SalarySobService; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.valid.ValidUtil; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; @@ -61,56 +69,54 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange } @Override - public List listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType) { + public PageInfo listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType) { // 查询人员范围 List salarySobRangePOS = listBySalarySobIdAndIncludeType(queryParam.getSalarySobId(), includeType); // 查询人员信息 - List employeeIds = salarySobRangePOS.stream() + List employeeIds = salarySobRangePOS.stream() .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue())) .map(SalarySobRangePO::getTargetId) .collect(Collectors.toList()); -// todo 缓存获取人员信息 List employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds); - //1、获取人员信息 + List empInfos = employBiz.getEmployeeByIds(employeeIds); // 查询部门信息 - Map deptMap = new HashMap<>(); - salarySobRangePOS.stream() + List deptInfos = salarySobRangePOS.stream() .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue())) .map(SalarySobRangePO::getTargetId) - .forEach(id -> { - deptMap.put(id, orgBiz.getDepartmentShow(String.valueOf(id), "0", "-")); - }); -// todo List departmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, departmentIds); + .map(id -> { + return DeptInfo.builder().id(id).name(orgBiz.getDepartmentShow(String.valueOf(id), "0", "-")).build(); + }) + .collect(Collectors.toList()); -// String departmentShow = orgBiz.getDepartmentShow(departmentIds.stream().map(String::valueOf).collect(Collectors.joining(",")), "0", "-"); -// Arrays.asList(departmentShow.split(",")); -// // 查询岗位信息 -// List positionIds = salarySobRangePOS.stream() -// .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())) -// .map(SalarySobRangePO::getTargetId) -// .collect(Collectors.toList()); -// List positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds); -// // 分页参数 -// Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); -// // 薪资账套的人员范围po转换成列表dto -// List salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, employeeComInfos, departmentComInfos, positionComInfos); -// // 根据对象名称过滤 -// if (StringUtils.isNotEmpty(queryParam.getTargetName())) { -// salarySobRangeListDTOS = salarySobRangeListDTOS.stream() -// .filter(salarySobRangeListDTO -> salarySobRangeListDTO.getTargetName().contains(queryParam.getTargetName())) -// .collect(Collectors.toList()); -// } -// // 填充总数和当页数据 -// dtoPage.setTotal(salarySobRangeListDTOS.size()); -// dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), salarySobRangeListDTOS)); -// return dtoPage; - return null; + // 查询岗位信息 + List positionIds = salarySobRangePOS.stream() + .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())) + .map(SalarySobRangePO::getTargetId) + .collect(Collectors.toList()); + List positionInfos = employBiz.listPositionInfo(positionIds); + + // 薪资账套的人员范围po转换成列表dto + List salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos, positionInfos); + // 根据对象名称过滤 + if (StringUtils.isNotEmpty(queryParam.getTargetName())) { + salarySobRangeListDTOS = salarySobRangeListDTOS.stream() + .filter(salarySobRangeListDTO -> salarySobRangeListDTO.getTargetName().contains(queryParam.getTargetName())) + .collect(Collectors.toList()); + } + // 填充总数和当页数据 + PageInfo pageInfo = new PageInfo(salarySobRangeListDTOS,SalarySobRangeListDTO.class); + pageInfo.setTotal(salarySobRangeListDTOS.size()); + pageInfo.setList(PageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), salarySobRangeListDTOS)); + return pageInfo; } @Override public void save(SalarySobRangeSaveParam saveParam) { + + ValidUtil.doValidator(saveParam); + // 查询薪资账套 SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId()); if (Objects.isNull(salarySobPO)) { diff --git a/src/com/engine/salary/transmethod/TransMethod.java b/src/com/engine/salary/transmethod/TransMethod.java index f964d28b3..ed945fae8 100644 --- a/src/com/engine/salary/transmethod/TransMethod.java +++ b/src/com/engine/salary/transmethod/TransMethod.java @@ -1,8 +1,11 @@ package com.engine.salary.transmethod; +import com.engine.salary.enums.SalaryDataSourceEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.datacollection.AttendQuoteFieldSourceTypeEnum; import com.engine.salary.enums.datacollection.AttendQuoteFieldTypeEnum; import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum; +import com.engine.salary.enums.sicategory.RententionRuleEnum; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -39,14 +42,17 @@ public class TransMethod { /** * 字段来源类型 + * * @param sourceType * @return */ public static String fieldSourceType(String sourceType) { return AttendQuoteFieldSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(sourceType)); } + /** * 字段类型 + * * @param sourceType * @return */ @@ -56,6 +62,7 @@ public class TransMethod { /** * 考勤来源类型 + * * @param sourceType * @return */ @@ -63,5 +70,32 @@ public class TransMethod { return AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(sourceType)); } + /** + * 薪资项目进位规则 + * + * @param roundingMode + * @return + */ + public static String roundingMode(String roundingMode) { + return RententionRuleEnum.getDefaultLabelByValue(Integer.valueOf(roundingMode)); + } + + /** + * 取值方式 + * @param datasource + * @return + */ + public static String datasource(String datasource) { + return SalaryDataSourceEnum.getDefaultLabelByValue(Integer.valueOf(datasource)); + } + + /** + * 字段类型 + * @param valueType + * @return + */ + public static String valueType(String valueType) { + return SalaryValueTypeEnum.getDefaultLabelByValue(Integer.valueOf(valueType)); + } } diff --git a/src/com/engine/salary/util/page/PageInfo.java b/src/com/engine/salary/util/page/PageInfo.java index af8d06447..f74d3e946 100644 --- a/src/com/engine/salary/util/page/PageInfo.java +++ b/src/com/engine/salary/util/page/PageInfo.java @@ -26,6 +26,9 @@ public class PageInfo extends com.github.pagehelper.PageInfo { public List getColumns() { + if(clazz==null){ + return new ArrayList<>(); + } Field[] fields = clazz.getDeclaredFields(); for (Field f : fields) { boolean isanno = f.isAnnotationPresent(TableTitle.class); diff --git a/src/com/engine/salary/web/SalarySobController.java b/src/com/engine/salary/web/SalarySobController.java index f923e3e63..23e34f281 100644 --- a/src/com/engine/salary/web/SalarySobController.java +++ b/src/com/engine/salary/web/SalarySobController.java @@ -1,10 +1,12 @@ package com.engine.salary.web; import com.engine.common.util.ServiceUtil; +import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; import com.engine.salary.entity.salarysob.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; import com.engine.salary.wrapper.SalarySobRangeWrapper; import com.engine.salary.wrapper.SalarySobWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -128,25 +130,29 @@ public class SalarySobController { /**********************************薪资账套的人员范围 start*********************************/ -// /** -// * 薪资账套人员范围(包含)列表 -// */ -// @POST -// @Path("/range/listInclude") -// @Produces(MediaType.APPLICATION_JSON) -// public String duplicate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobRangeQueryParam queryParam) { -// User user = HrmUserVarify.getUser(request, response); -// return new ResponseResult>().run(getSalarySobRangeWrapper(user)::listPage4Include, queryParam); -// } + /** + * 薪资账套人员范围(包含)列表 + */ + @POST + @Path("/range/listInclude") + @Produces(MediaType.APPLICATION_JSON) + public String listPage4Include(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobRangeQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>().run(getSalarySobRangeWrapper(user)::listPage4Include, queryParam); + } -// @PostMapping("/range/listExclude") -// @ApiOperation("薪资账套人员范围(排除)列表") -// @WeaPermission -// public WeaResult> listExcludeSalarySobRange(@RequestBody @Validated SalarySobRangeQueryParam queryParam) { -// WeaTable weaTable = salarySobRangeWrapper.listPage4Exclude(queryParam, TenantContext.getCurrentTenantKey()); -// return WeaResult.success(weaTable); -// } + /** + * 薪资账套人员范围(排除)列表 + */ + @POST + @Path("/range/listExclude") + @Produces(MediaType.APPLICATION_JSON) + public String listPage4Exclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobRangeQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>().run(getSalarySobRangeWrapper(user)::listPage4Exclude, queryParam); + } + // // @GetMapping("/range/getForm") // @ApiOperation("薪资账套人员范围表单") @@ -155,27 +161,34 @@ public class SalarySobController { // WeaForm weaForm = salarySobRangeWrapper.getForm(); // return WeaResult.success(weaForm); // } -// -// @PostMapping("/range/save") -// @ApiOperation("保存薪资账套人员范围") -// @WeaPermission -// public WeaResult saveSalarySobRange(@RequestBody @Validated SalarySobRangeSaveParam saveParam) { -// salarySobRangeWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); -// return WeaResult.success(null); -// } -// -// @PostMapping("/range/delete") -// @ApiOperation("删除薪资账套人员范围") -// @WeaPermission -// public WeaResult deleteSalarySobRange(@RequestBody Collection ids) { -// salarySobRangeWrapper.delete(ids, TenantContext.getCurrentTenantKey()); -// return WeaResult.success(null); -// } -// -// /**********************************薪资账套的人员范围 end*********************************/ -// -// /**********************************薪资账套的薪资项目 start*********************************/ -// + + /** + * 保存薪资账套人员范围 + */ + @POST + @Path("/range/save") + @Produces(MediaType.APPLICATION_JSON) + public String saveSalarySobRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobRangeSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult().run(getSalarySobRangeWrapper(user)::save, saveParam); + } + + /** + * 删除薪资账套人员范围 + */ + @POST + @Path("/range/delete") + @Produces(MediaType.APPLICATION_JSON) + public String deleteSalarySobRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>().run(getSalarySobRangeWrapper(user)::delete, ids); + } + + + /**********************************薪资账套的人员范围 end*********************************/ + + /**********************************薪资账套的薪资项目 start*********************************/ + // @PostMapping("/item/listSalaryItem") // @ApiOperation("薪资账套可选薪资项目") // @WeaPermission diff --git a/src/com/engine/salary/wrapper/SalaryItemWrapper.java b/src/com/engine/salary/wrapper/SalaryItemWrapper.java index 69e7b9c1e..d1cb56420 100644 --- a/src/com/engine/salary/wrapper/SalaryItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryItemWrapper.java @@ -29,11 +29,9 @@ import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.math.NumberUtils; -import org.apache.commons.lang3.StringUtils; import weaver.hrm.User; import java.util.*; -import java.util.stream.Collectors; /** * 薪资项目 @@ -91,7 +89,7 @@ public class SalaryItemWrapper extends Service { table.setBackfields(fields); table.setSqlform(from); - table.setSqlwhere(makeSqlWhere(searchParam)); + table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(searchParam)); table.setSqlorderby("t.id DESC"); table.setSqlprimarykey("t.id"); table.setSqlisdistinct("false"); @@ -140,46 +138,7 @@ public class SalaryItemWrapper extends Service { } - private String makeSqlWhere(SalaryItemSearchParam searchParam) { - String sqlWhere = " t.delete_type = 0 "; - - String name = searchParam.getName(); - if (StringUtils.isNotBlank(name)) { - sqlWhere += " AND t.name = " + name; - } - String description = searchParam.getDescription(); - if (StringUtils.isNotBlank(description)) { - sqlWhere += " AND t.description = " + description; - } - Integer category = searchParam.getCategory(); - if (category != null) { - sqlWhere += " AND t.category = " + category; - } - Integer itemType = searchParam.getItemType(); - if (itemType != null) { - sqlWhere += " AND t.item_type = " + itemType; - } - Integer useInEmployeeSalary = searchParam.getUseInEmployeeSalary(); - if (useInEmployeeSalary != null) { - sqlWhere += " AND t.use_in_employee_salary = " + useInEmployeeSalary; - } - Integer useDefault = searchParam.getUseDefault(); - if (useDefault != null) { - sqlWhere += " AND t.use_default = " + useDefault; - } - Integer valueType = searchParam.getValueType(); - if (valueType != null) { - sqlWhere += " AND t.value_type = " + valueType; - } - Collection excludeIds = searchParam.getExcludeIds(); - if (CollectionUtils.isNotEmpty(excludeIds)) { - String idsStr = excludeIds.stream().map(String::valueOf).collect(Collectors.joining(",")); - sqlWhere += " AND t.id NOT IN (" + idsStr + ")"; - } - - return sqlWhere; - } /** * 可以删除的薪资项目列表 diff --git a/src/com/engine/salary/wrapper/SalarySobItemWrapper.java b/src/com/engine/salary/wrapper/SalarySobItemWrapper.java new file mode 100644 index 000000000..7144f7c73 --- /dev/null +++ b/src/com/engine/salary/wrapper/SalarySobItemWrapper.java @@ -0,0 +1,125 @@ +package com.engine.salary.wrapper; + +import com.cloudstore.eccom.result.WeaResultMsg; +import com.engine.core.impl.Service; +import com.engine.salary.component.SalaryWeaTable; +import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; +import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; +import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; +import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam; +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; +import com.engine.salary.service.SalaryFormulaService; +import com.engine.salary.service.SalaryItemService; +import com.engine.salary.service.SalarySobItemGroupService; +import com.engine.salary.service.SalarySobItemService; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 薪资账套的薪资项目 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Component +public class SalarySobItemWrapper extends Service { + + private SalarySobItemService salarySobItemService; + private SalarySobItemGroupService salarySobItemGroupService; + private SalaryItemService salaryItemService; + private SalaryFormulaService salaryFormulaService; + + /** + * 薪资账套可选薪资项目列表 + * + * @param queryParam 列表查询条件 + * @return + */ + public Map listPage4SalaryItem(SalaryItemSearchParam queryParam) { + SalaryWeaTable table = new SalaryWeaTable(user, SalaryItemListDTO.class); + + String fields = " t.id" + + " , t.name" + + " , t.code" + + " , t.system_type" + + " , t.sys_salary_item_id" + + " , t.category" + + " , t.item_type as itemType" + + " , t.use_default as useDefault" + + " , t.use_in_employee_salary as useInEmployeeSalary" + + " , t.rounding_mode as roundingMode" + + " , t.pattern" + + " , t.value_type as valueType" + + " , t.datasource" + + " , t.formula_id" + + " , t.description" + + " , t.can_edit" + + " , t.can_delete"; + + String from = "from hrsa_salary_item t"; + + table.setBackfields(fields); + table.setSqlform(from); + table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(queryParam)); + table.setSqlorderby("t.id DESC"); + table.setSqlprimarykey("t.id"); + table.setSqlisdistinct("false"); + + WeaResultMsg result = new WeaResultMsg(false); + result.putAll(table.makeDataResult()); + result.success(); + return result.getResultMap(); + + +// // 分页查询薪资项目 +// Page page = salaryItemService.listPageByParam(queryParam); +// Page dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); +// if (CollectionUtils.isNotEmpty(page.getRecords())) { +// // 查询公式 +// Set formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalaryItemPO::getFormulaId); +// List expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey); +// // 转换成薪资项目列表dto +// dtoPage.setRecords(SalaryItemBO.convert2ListDTO(page.getRecords(), expressFormulas)); +// } +// // 构建前端所需的数据格式 +// WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(SalaryItemListDTO.class, dtoPage); +// // 列表可勾选但是不需要操作列 +// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX); +// weaTable.setOperates(Collections.emptyList()); +// weaTable.setOperatesPermission(Collections.emptyList()); +// return weaTable; + + } + + /** + * 获取薪资账套的薪资项目详情 + * + * @param salarySobItemGroupId 薪资账套的薪资项目的id + * @return + */ + public SalarySobItemGroupPO getGroupForm(Long salarySobItemGroupId) { + return salarySobItemGroupService.getById(salarySobItemGroupId); + } + + /** + * 获取薪资账套的薪资项目详情 + * + * @param salarySobId 薪资账套的id + * @return + */ + public SalarySobItemAggregateDTO getForm(Long salarySobId) { + return salarySobItemService.getAggregateBySalarySobId(salarySobId); + } + + /** + * 保存 + * + * @param saveParam 保存参数 + */ + public void save(SalarySobItemSaveParam saveParam) { + salarySobItemService.save(saveParam); + } +} diff --git a/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java b/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java index 8238e9382..9a98e5be1 100644 --- a/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java @@ -1,8 +1,15 @@ package com.engine.salary.wrapper; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; +import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam; import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam; import com.engine.salary.service.SalarySobRangeService; +import com.engine.salary.service.impl.SalarySobRangeServiceImpl; +import com.engine.salary.util.page.PageInfo; +import org.apache.commons.lang.math.NumberUtils; +import weaver.hrm.User; import java.util.Collection; @@ -16,45 +23,35 @@ import java.util.Collection; **/ public class SalarySobRangeWrapper extends Service { - private SalarySobRangeService salarySobRangeService; + private SalarySobRangeService getSalarySobRangeService(User user) { + return (SalarySobRangeService) ServiceUtil.getService(SalarySobRangeServiceImpl.class, user); + } -// /** -// * 薪资账套的人员范围列表(关联人员范围) -// * -// * @param queryParam 列表查询条件 -// * @param tenantKey 租户key -// * @return -// */ -// public WeaTable listPage4Include(SalarySobRangeQueryParam queryParam) { -// // 分页查询薪资账套的人员范围列表dto -// Page dtoPage = salarySobRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); -// // 转换成前端所需的数据格式 -// WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(SalarySobRangeListDTO.class, dtoPage); -// weaTable.setPageUid("includeSalarySobRangeList"); -// return weaTable; -// } + /** + * 薪资账套的人员范围列表(关联人员范围) + * + * @param queryParam 列表查询条件 + * @return + */ + public PageInfo listPage4Include(SalarySobRangeQueryParam queryParam) { + return getSalarySobRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); + } -// /** -// * 薪资账套的人员范围列表(从范围中排除) -// * -// * @param queryParam 列表查询条件 -// * @param tenantKey 租户key -// * @return -// */ -// public WeaTable listPage4Exclude(SalarySobRangeQueryParam queryParam, String tenantKey) { -// // 分页查询薪资账套的人员范围列表dto -// Page dtoPage = salarySobRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey); -// // 转换成前端所需的数据格式 -// WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(SalarySobRangeListDTO.class, dtoPage); -// weaTable.setPageUid("excludeSalarySobRangeList"); -// return weaTable; -// } -// -// /** -// * 获取薪资账套的人员范围列表添加人员的表单 -// * -// * @return -// */ + /** + * 薪资账套的人员范围列表(从范围中排除) + * + * @param queryParam 列表查询条件 + * @return + */ + public PageInfo listPage4Exclude(SalarySobRangeQueryParam queryParam) { + return getSalarySobRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO); + } + + /** + * 获取薪资账套的人员范围列表添加人员的表单 + * + * @return + */ // public WeaForm getForm() { // return SalaryFormatUtil.getInstance().buildForm(SalarySobRangeFormDTO.class, new SalarySobRangeFormDTO()); // } @@ -65,7 +62,7 @@ public class SalarySobRangeWrapper extends Service { * @param saveParam 保存参数 */ public void save(SalarySobRangeSaveParam saveParam) { - salarySobRangeService.save(saveParam); + getSalarySobRangeService(user).save(saveParam); } /** @@ -73,7 +70,7 @@ public class SalarySobRangeWrapper extends Service { * * @param ids 薪资账套的人员范围的主键id */ - public void delete(Collection ids, String tenantKey) { - salarySobRangeService.deleteByIds(ids); + public void delete(Collection ids) { + getSalarySobRangeService(user).deleteByIds(ids); } }