列表添加id

This commit is contained in:
钱涛 2022-03-23 18:41:38 +08:00
parent e66445ce20
commit b3d7123401
43 changed files with 2081 additions and 398 deletions

View File

@ -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<PositionInfo> listPositionInfo(List<Long> list) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listPositionInfo(list);
} finally {
sqlSession.close();
}
}
}

View File

@ -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<SalarySobItemPO> 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<SalarySobItemPO> 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<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -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<SalarySobItemGroupPO> 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<SalarySobItemGroupPO> 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<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemGroupMapper mapper = sqlSession.getMapper(SalarySobItemGroupMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.entity.hrm;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 部门基本信息
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DeptInfo {
private Long id;
/**
* 名称
*/
private String name;
}

View File

@ -0,0 +1,30 @@
package com.engine.salary.entity.hrm;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 岗位基本信息
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PositionInfo {
private Long id;
/**
* 名称
*/
private String name;
}

View File

@ -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;

View File

@ -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<Long> 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<Long> 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;
}
}

View File

@ -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;
/**
* 将薪资账套的员工信息薪资项目副本薪资项目分类聚合在一起
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@AllArgsConstructor
public class SalarySobItemAggregateBO {
/**
* 薪资账套
*/
private SalarySobPO salarySob;
/**
* 薪资账套的员工信息
*/
private List<SalarySobEmpFieldPO> salarySobEmpFields;
/**
* 薪资账套的薪资项目分类
*/
private List<SalarySobItemGroupPO> salarySobItemGroups;
/**
* 薪资账套的薪资项目副本
*/
private List<SalarySobItemPO> salarySobItems;
/**
* 薪资账套的薪资项目副本所用公式详情
*/
private List<ExpressFormula> expressFormulas;
/**
* 薪资账套的薪资项目副本所关联的薪资项目
*/
private List<SalaryItemPO> salaryItems;
/**
* 转换成聚合dto
*
* @return
*/
public SalarySobItemAggregateDTO convert2AggregateDTO() {
List<SalarySobItemDTO> itemsWithoutGroup = Lists.newArrayList();
// 薪资账套的薪资项目分类po转换成dto
List<SalarySobItemGroupDTO> salarySobItemGroupDTOS = salarySobItemGroups.stream()
.map(e -> SalarySobItemGroupDTO.builder()
.id(e.getId())
.salarySobId(e.getSalarySobId())
.name(e.getName())
.sortedIndex(e.getSortedIndex())
.build())
.collect(Collectors.toList());
Map<Long, SalarySobItemGroupDTO> salarySobItemGroupDTOMap = SalaryEntityUtil.convert2Map(salarySobItemGroupDTOS, SalarySobItemGroupDTO::getId);
Map<Long, SalaryItemPO> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
Map<Long, List<SalarySobItemPO>> salarySobItemMap = SalaryEntityUtil.group2Map(salarySobItems, SalarySobItemPO::getSalarySobItemGroupId);
Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
// 薪资账套的薪资项目副本po转换成dto
salarySobItemMap.forEach((k, v) -> {
List<SalarySobItemDTO> 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<SalarySobEmpFieldDTO> 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<SalarySobEmpFieldDTO> buildEmpField(Collection<SalarySobEmpFieldPO> salarySobEmpFields) {
// if (CollectionUtils.isEmpty(salarySobEmpFields)) {
// return Collections.emptyList();
// }
// Field[] declaredFields = SalaryFormulaEmployeeDTO.class.getDeclaredFields();
// Map<String, String> 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<SalarySobItemDTO> sortItem(Collection<SalarySobItemDTO> 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<SalarySobItemGroupDTO> sortItemGroup(Collection<SalarySobItemGroupDTO> itemGroups) {
if (CollectionUtils.isEmpty(itemGroups)) {
return Collections.emptyList();
}
return itemGroups.stream().sorted(Comparator.comparingInt(SalarySobItemGroupDTO::getSortedIndex)).collect(Collectors.toList());
}
}

View File

@ -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;
/**
* 薪资账套的薪资项目副本保存
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<SalarySobItemSaveParam.SalarySobItemParam> 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<SalarySobEmpFieldPO> needInsertSalarySobEmpFields;
/**
* 薪资账套中需要新增的薪资项目副本
*/
private Collection<SalarySobItemPO> needInsertSalarySobItems;
/**
* 薪资账套中需要新增的薪资项目分组
*/
private Collection<SalarySobItemGroupPO> needInsertSalarySobItemGroups;
}
}

View File

@ -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<SalarySobRangeListDTO> convert2ListDTO(List<SalarySobRangePO> salarySobRanges,
// List<HrmEmployeeComInfo> employeeComInfos,
// List<HrmDepartmentComInfo> departmentComInfos,
// List<HrmPositionComInfo> positionComInfos) {
// if (CollectionUtils.isEmpty(salarySobRanges)) {
// return Collections.emptyList();
// }
// Map<Long, String> employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, HrmEmployeeComInfo::getId, HrmEmployeeComInfo::getUsername);
// Map<Long, String> departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName);
// Map<Long, String> 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<SalarySobRangeListDTO> convert2ListDTO(List<SalarySobRangePO> salarySobRanges,
List<DataCollectionEmployee> employeeComInfos,
List<DeptInfo> departmentComInfos,
List<PositionInfo> positionComInfos) {
if (CollectionUtils.isEmpty(salarySobRanges)) {
return Collections.emptyList();
}
Map<Long, String> employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername);
Map<Long, String> departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, DeptInfo::getId, DeptInfo::getName);
Map<Long, String> 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());
}
/**
* 解析薪资账套人员范围中对象的名称可能是人员名称部门名称岗位名称

View File

@ -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;
/**
* 薪资账套薪资项目-员工信息字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}

View File

@ -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;
/**
* 薪资账套薪资项目详情
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//薪资账套薪资项目详情
public class SalarySobItemAggregateDTO {
//薪资账套的id
@JsonSerialize(using = ToStringSerializer.class)
private Long salarySobId;
//薪资账套的薪资项目详情-员工信息
private List<SalarySobEmpFieldDTO> empFields;
//薪资账套的薪资项目详情-薪资项目分类
private List<SalarySobItemGroupDTO> itemGroups;
//薪资账套的薪资项目详情-薪资项目未分类
private List<SalarySobItemDTO> items;
}

View File

@ -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;
/**
* 薪资账套的薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}

View File

@ -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;
/**
* 薪资账套的薪资项目分组
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<SalarySobItemDTO> items;
}

View File

@ -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;
/**
* 薪资账套薪资项目分组表单
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}

View File

@ -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")

View File

@ -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;
}

View File

@ -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
*/
* 薪资账套人员范围保存参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<SalarySobRangeTargetParam> 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;
}
}

View File

@ -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;
/**
* 薪资账套薪资项目分组
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<Long> ids;
}

View File

@ -83,5 +83,11 @@ public class SalarySobItemPO {
*/
private Date updateTime;
//in
Collection<Long> ids;
Collection<Long> salarySobIds;
//not in
Collection<Long> salaryItemIds;
}

View File

@ -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<Integer> {
}
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 "";
}
}

View File

@ -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<Integer> {
}
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 "";
}
}

View File

@ -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
*/
* 进位规则枚举
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum RententionRuleEnum implements BaseEnum<Integer> {
ROUND(BigDecimal.ROUND_HALF_UP, "四舍五入", 84505),
CEIL(BigDecimal.ROUND_UP, "向上舍入", 84506),
@ -42,4 +45,17 @@ public enum RententionRuleEnum implements BaseEnum<Integer> {
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 "";
}
}

View File

@ -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<DataCollectionEmployee> getEmployeeByIdsAll(@Param("collection") List<Long> ids);
List<PositionInfo> listPositionInfo(@Param("collection") List<Long> ids);
}

View File

@ -47,4 +47,18 @@
</select>
<select id="listPositionInfo" resultType="com.engine.salary.entity.hrm.PositionInfo">
select t.id,
t.jobtitlename as name
from hrmjobtitles t
where 1=1
<if test="collection != null and collection.size()>0">
AND t.id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
</mapper>

View File

@ -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<SalarySobItemGroupPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalarySobItemGroupPO> 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<Long> salarySobIds);
/**
* 根据主键id删除
*
* @param ids
* @param tenantKey
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
/**
* 批量保存
*
* @param salarySobItemGroups
*/
void batchInsert(@Param("collection") Collection<SalarySobItemGroupPO> salarySobItemGroups);
}

View File

@ -0,0 +1,304 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.salarysob.SalarySobItemGroupMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
<result column="id" property="id"/>
<result column="salary_sob_id" property="salarySobId"/>
<result column="name" property="name"/>
<result column="sorted_index" property="sortedIndex"/>
<result column="description" property="description"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.salary_sob_id
, t.name
, t.sorted_index
, t.description
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_item_group t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_item_group t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_item_group t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="name != null and name != ''">
AND name = #{name}
</if>
<if test="sortedIndex != null and sortedIndex != ''">
AND sorted_index = #{sortedIndex}
</if>
<if test="description != null and description != ''">
AND description = #{description}
</if>
<if test="createTime != null and createTime != ''">
AND create_time = #{createTime}
</if>
<if test="updateTime != null and updateTime != ''">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_salary_sob_item_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="salarySobId != null">
salary_sob_id,
</if>
<if test="name != null">
name,
</if>
<if test="sortedIndex != null">
sorted_index,
</if>
<if test="description != null">
description,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="salarySobId != null">
#{salarySobId},
</if>
<if test="name != null">
#{name},
</if>
<if test="sortedIndex != null">
#{sortedIndex},
</if>
<if test="description != null">
#{description},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
UPDATE hrsa_salary_sob_item_group
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
UPDATE hrsa_salary_sob_item_group
<set>
<if test="salarySobId != null">
salary_sob_id=#{salarySobId},
</if>
<if test="name != null">
name=#{name},
</if>
<if test="sortedIndex != null">
sorted_index=#{sortedIndex},
</if>
<if test="description != null">
description=#{description},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO">
UPDATE hrsa_salary_sob_item_group
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<update id="deleteBySalarySobIds">
UPDATE hrsa_salary_sob_item_group
SET delete_type = 1
WHERE delete_type = 0
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</update>
<update id="deleteByIds">
UPDATE hrsa_salary_sob_item_group
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_item_group( salary_sob_id, name, sorted_index, description, create_time,
update_time, creator, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.name},
#{item.sortedIndex},
#{item.description},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_item_group( salary_sob_id, name, sorted_index, description, create_time,
update_time, creator, tenant_key)
<foreach collection="collection" item="item" separator="union all">
select
#{item.salarySobId},
#{item.name},
#{item.sortedIndex},
#{item.description},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
INSERT INTO hrsa_salary_sob_item_group( salary_sob_id, name, sorted_index, description, create_time,
update_time, creator, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.name},
#{item.sortedIndex},
#{item.description},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
</mapper>

View File

@ -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<Long> salarySobIds);
/**
* 根据主键id删除
*
* @param ids
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
/**
* 批量保存
*
* @param salarySobItems
*/
void batchInsert(@Param("collection") Collection<SalarySobItemPO> salarySobItems);
}

View File

@ -59,37 +59,37 @@
<if test="createTime != null and createTime != ''">
AND create_time = #{createTime}
</if>
<if test="creator != null and creator != ''">
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null and deleteType != ''">
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="description != null and description != ''">
AND description = #{description}
</if>
<if test="formulaId != null and formulaId != ''">
<if test="formulaId != null">
AND formula_id = #{formulaId}
</if>
<if test="id != null and id != ''">
AND id = #{id}
</if>
<if test="salaryItemId != null and salaryItemId != ''">
<if test="salaryItemId != null">
AND salary_item_id = #{salaryItemId}
</if>
<if test="salarySobId != null and salarySobId != ''">
<if test="salarySobId != null ">
AND salary_sob_id = #{salarySobId}
</if>
<if test="salarySobItemGroupId != null and salarySobItemGroupId != ''">
<if test="salarySobItemGroupId != null ">
AND salary_sob_item_group_id = #{salarySobItemGroupId}
</if>
<if test="sortedIndex != null and sortedIndex != ''">
<if test="sortedIndex != null ">
AND sorted_index = #{sortedIndex}
</if>
<if test="tenantKey != null and tenantKey != ''">
<if test="tenantKey != null ">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null and updateTime != ''">
<if test="updateTime != null ">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
@ -98,6 +98,18 @@
#{id}
</foreach>
</if>
<if test="salarySobIds != null and salarySobIds.size()>0">
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</if>
<if test="salaryItemIds != null and salaryItemIds.size()>0">
AND salary_item_id IN
<foreach collection="salaryItemIds" open="(" item="salaryItemId" separator="," close=")">
#{salaryItemId}
</foreach>
</if>
ORDER BY id DESC
</select>
@ -257,4 +269,86 @@
</delete>
<update id="deleteBySalarySobIds">
UPDATE hrsa_salary_sob_item
SET delete_type = 1
WHERE delete_type = 0
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</update>
<update id="deleteByIds">
UPDATE hrsa_salary_sob_item
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<insert id="batchInsert">
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
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.salaryItemId},
#{item.salarySobItemGroupId},
#{item.formulaId},
#{item.sortedIndex},
#{item.description},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
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)
<foreach collection="collection" item="item" separator="union all">
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
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
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
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.salaryItemId},
#{item.salarySobItemGroupId},
#{item.formulaId},
#{item.sortedIndex},
#{item.description},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
</mapper>

View File

@ -70,7 +70,7 @@
<if test="employeeStatus != null and employeeStatus != ''">
AND employee_status = #{employeeStatus}
</if>
<if test="includeType != null and includeType != ''">
<if test="includeType != null">
AND include_type = #{includeType}
</if>
<if test="creator != null and creator != ''">

View File

@ -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;
/**
* 薪资账套的员工信息字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobEmpFieldService {
/**
* 根据薪资账套id查询薪资账套的员工信息字段
*
* @param salarySobId 薪资账套id
* @return
*/
List<SalarySobEmpFieldPO> listBySalarySobId(Long salarySobId);
/**
* 批量保存
*
* @param salarySobEmpFieldPOS 薪资账套的员工信息字段
*/
void batchSave(Collection<SalarySobEmpFieldPO> salarySobEmpFieldPOS);
/**
* 根据薪资账套的id删除薪资账套的员工信息字段
*
* @param salarySobIds 薪资账套id
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -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;
/**
* 薪资账套的薪资项目分类
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobItemGroupService {
/**
* 根据主键id获取单个薪资账套的薪资项目分类
*
* @param id 薪资账套的薪资项目分类的主键id
* @return
*/
SalarySobItemGroupPO getById(Long id);
/**
* 根据薪资账套id查询薪资账套的薪资项目分类
*
* @param salarySobId 薪资账套id
* @return
*/
List<SalarySobItemGroupPO> listBySalarySobId(Long salarySobId);
/**
* 批量保存
*
* @param salarySobItemGroupPOS 薪资账套的薪资项目分类po集合
*/
void batchSave(Collection<SalarySobItemGroupPO> salarySobItemGroupPOS);
/**
* 根据薪资账套id删除薪资账套的薪资项目分类
*
* @param salarySobIds 薪资账套id
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -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<SalarySobItemPO> listBySalarySobId(Long salarySobId, String tenantKey);
List<SalarySobItemPO> listBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id查询薪资账套的薪资项目副本
*
* @param salarySobIds 薪资账套的id
* @param tenantKey 租户key
* @return
*/
// List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds);
/**
* 根据薪资账套id薪资项目id查询薪资账套的薪资项目副本
*
* @param salarySobId 薪资账套id
* @param salaryItemIds 薪资项目id
* @param tenantKey 租户key
* @return
*/
// List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> salaryItemIds, String tenantKey);
List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> salaryItemIds);
/**
* 根据薪资项目id查询薪资账套的薪资项目副本
@ -61,41 +61,35 @@ public interface SalarySobItemService {
* 根据薪资账套id查询薪资账套的薪资项目副本所关联的薪资项目
*
* @param salarySobId 薪资账套id
* @param tenantKey 租户key
* @return
*/
// List<SalaryItemPO> listBySalarySobId4SalaryItem(Long salarySobId, String tenantKey);
List<SalaryItemPO> 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<SalarySobItemPO> salarySobItemPOS);
void batchSave(Collection<SalarySobItemPO> salarySobItemPOS);
/**
* 根据薪资账套id删除薪资账套的薪资项目副本
*
* @param salarySobIds 薪资账套的id
* @param tenantKey 租户key
*/
// void deleteBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -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<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType);
PageInfo<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType);
/**
* 保存

View File

@ -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;
/**
* 薪资账套中的薪资项目分类
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<SalarySobItemGroupPO> listBySalarySobId(Long salarySobId) {
return salarySobItemGroupMapper.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).build());
}
@Override
public void batchSave(Collection<SalarySobItemGroupPO> salarySobItemGroupPOS) {
salarySobItemGroupMapper.batchInsert(salarySobItemGroupPOS);
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobItemGroupMapper.deleteBySalarySobIds(salarySobIds);
}
}

View File

@ -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<SalarySobItemPO> 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<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds, String tenantKey) {
// return new LambdaQueryChainWrapper<>(salarySobItemMapper)
// .eq(SalarySobItemPO::getTenantKey, tenantKey)
// .eq(SalarySobItemPO::getDeleteType, 0)
// .in(SalarySobItemPO::getSalarySobId, salarySobIds)
// .list();
// }
//
// @Override
// public List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> 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<SalarySobItemPO> listBySalarySobId(Long salarySobId) {
return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds) {
return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobIds(salarySobIds).build());
}
@Override
public List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> salaryItemIds) {
return salarySobItemMapper.listSome(SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemIds(salaryItemIds).build());
}
@Override
public List<SalarySobItemPO> listBySalaryItemIds(Collection<Long> 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<SalaryItemPO> listBySalarySobId4SalaryItem(Long salarySobId, String tenantKey) {
// // 查询薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId, tenantKey);
// if (CollectionUtils.isEmpty(salarySobItemPOS)) {
// return Collections.emptyList();
// }
// // 查询薪资项目
// Set<Long> 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<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salarySobId, tenantKey);
// // 查询薪资账套的薪资项目分类
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salarySobId, tenantKey);
// // 查询薪资账套的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId, tenantKey);
// // 薪资账套的薪资项目副本所用的公式id
// Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
// // 查询公式详情
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 查询薪资账套的薪资项目副本所关联的薪资项目
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
// List<SalaryItemPO> salaryItemPOS = salaryItemService.listByIds(salaryItemIds, tenantKey);
// // 转换成聚合dto
// SalarySobItemAggregateBO salarySobItemAggregateBO = new SalarySobItemAggregateBO(salarySobPO, salarySobEmpFieldPOS,
// salarySobItemGroupPOS, salarySobItemPOS, expressFormulas, salaryItemPOS);
// 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<SalaryItemPO> listBySalarySobId4SalaryItem(Long salarySobId) {
// 查询薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId);
if (CollectionUtils.isEmpty(salarySobItemPOS)) {
return Collections.emptyList();
}
// 查询薪资项目
Set<Long> 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<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目分类
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salarySobId);
// 查询薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId);
// 薪资账套的薪资项目副本所用的公式id
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
// 查询公式详情
List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds);
// 查询薪资账套的薪资项目副本所关联的薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> 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<SalarySobPO> 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<SalarySobItemPO> salarySobItemPOS) {
// salarySobItemMapper.batchInsert(salarySobItemPOS);
// }
//
// @Override
// public void deleteBySalarySobIds(Collection<Long> salarySobIds, String tenantKey) {
// salarySobItemMapper.deleteBySalarySobIds(salarySobIds, tenantKey);
// }
}
@Override
public void batchSave(Collection<SalarySobItemPO> salarySobItemPOS) {
salarySobItemMapper.batchInsert(salarySobItemPOS);
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobItemMapper.deleteBySalarySobIds(salarySobIds);
}
}

View File

@ -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<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType) {
public PageInfo<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType) {
// 查询人员范围
List<SalarySobRangePO> salarySobRangePOS = listBySalarySobIdAndIncludeType(queryParam.getSalarySobId(), includeType);
// 查询人员信息
List<Object> employeeIds = salarySobRangePOS.stream()
List<Long> employeeIds = salarySobRangePOS.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()))
.map(SalarySobRangePO::getTargetId)
.collect(Collectors.toList());
// todo 缓存获取人员信息 List<HrmEmployeeComInfo> employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds);
//1获取人员信息
List<DataCollectionEmployee> empInfos = employBiz.getEmployeeByIds(employeeIds);
// 查询部门信息
Map<Long, String> deptMap = new HashMap<>();
salarySobRangePOS.stream()
List<DeptInfo> 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<HrmDepartmentComInfo> 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<Object> positionIds = salarySobRangePOS.stream()
// .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue()))
// .map(SalarySobRangePO::getTargetId)
// .collect(Collectors.toList());
// List<HrmPositionComInfo> positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds);
// // 分页参数
// Page<SalarySobRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// // 薪资账套的人员范围po转换成列表dto
// List<SalarySobRangeListDTO> 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<Long> positionIds = salarySobRangePOS.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue()))
.map(SalarySobRangePO::getTargetId)
.collect(Collectors.toList());
List<PositionInfo> positionInfos = employBiz.listPositionInfo(positionIds);
// 薪资账套的人员范围po转换成列表dto
List<SalarySobRangeListDTO> 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<SalarySobRangeListDTO> pageInfo = new PageInfo<SalarySobRangeListDTO>(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)) {

View File

@ -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));
}
}

View File

@ -26,6 +26,9 @@ public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
public List<Column> getColumns() {
if(clazz==null){
return new ArrayList<>();
}
Field[] fields = clazz.getDeclaredFields();
for (Field f : fields) {
boolean isanno = f.isAnnotationPresent(TableTitle.class);

View File

@ -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<SalarySobDuplicateParam, Map<String, Object>>().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<SalarySobRangeQueryParam, PageInfo<SalarySobRangeListDTO>>().run(getSalarySobRangeWrapper(user)::listPage4Include, queryParam);
}
// @PostMapping("/range/listExclude")
// @ApiOperation("薪资账套人员范围(排除)列表")
// @WeaPermission
// public WeaResult<WeaTable<SalarySobRangeListDTO>> listExcludeSalarySobRange(@RequestBody @Validated SalarySobRangeQueryParam queryParam) {
// WeaTable<SalarySobRangeListDTO> 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<SalarySobRangeQueryParam, PageInfo<SalarySobRangeListDTO>>().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<Object> saveSalarySobRange(@RequestBody @Validated SalarySobRangeSaveParam saveParam) {
// salarySobRangeWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/range/delete")
// @ApiOperation("删除薪资账套人员范围")
// @WeaPermission
// public WeaResult<Object> deleteSalarySobRange(@RequestBody Collection<Long> 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<SalarySobRangeSaveParam, String>().run(getSalarySobRangeWrapper(user)::save, saveParam);
}
/**
* 删除薪资账套人员范围
*/
@POST
@Path("/range/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalarySobRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>().run(getSalarySobRangeWrapper(user)::delete, ids);
}
/**********************************薪资账套的人员范围 end*********************************/
/**********************************薪资账套的薪资项目 start*********************************/
// @PostMapping("/item/listSalaryItem")
// @ApiOperation("薪资账套可选薪资项目")
// @WeaPermission

View File

@ -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<Long> 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;
}
/**
* 可以删除的薪资项目列表

View File

@ -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;
/**
* 薪资账套的薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<String, Object> listPage4SalaryItem(SalaryItemSearchParam queryParam) {
SalaryWeaTable<SalaryItemListDTO> table = new SalaryWeaTable<SalaryItemListDTO>(user, SalaryItemListDTO.class);
String fields = " t.id" +
" , t.name" +
" , t.code" +
" , t.system_type" +
" , t.sys_salary_item_id" +
" , t.category" +
" , t.item_type as itemType" +
" , t.use_default as useDefault" +
" , t.use_in_employee_salary as useInEmployeeSalary" +
" , t.rounding_mode as roundingMode" +
" , t.pattern" +
" , t.value_type as valueType" +
" , t.datasource" +
" , t.formula_id" +
" , t.description" +
" , t.can_edit" +
" , t.can_delete";
String from = "from hrsa_salary_item t";
table.setBackfields(fields);
table.setSqlform(from);
table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(queryParam));
table.setSqlorderby("t.id DESC");
table.setSqlprimarykey("t.id");
table.setSqlisdistinct("false");
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
// // 分页查询薪资项目
// Page<SalaryItemPO> page = salaryItemService.listPageByParam(queryParam);
// Page<SalaryItemListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
// if (CollectionUtils.isNotEmpty(page.getRecords())) {
// // 查询公式
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalaryItemPO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 转换成薪资项目列表dto
// dtoPage.setRecords(SalaryItemBO.convert2ListDTO(page.getRecords(), expressFormulas));
// }
// // 构建前端所需的数据格式
// WeaTable<SalaryItemListDTO> weaTable = SalaryFormatUtil.<SalaryItemListDTO>getInstance().buildTable(SalaryItemListDTO.class, dtoPage);
// // 列表可勾选但是不需要操作列
// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX);
// weaTable.setOperates(Collections.emptyList());
// weaTable.setOperatesPermission(Collections.emptyList());
// return weaTable;
}
/**
* 获取薪资账套的薪资项目详情
*
* @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);
}
}

View File

@ -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<SalarySobRangeListDTO> listPage4Include(SalarySobRangeQueryParam queryParam) {
// // 分页查询薪资账套的人员范围列表dto
// Page<SalarySobRangeListDTO> dtoPage = salarySobRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE);
// // 转换成前端所需的数据格式
// WeaTable<SalarySobRangeListDTO> weaTable = SalaryFormatUtil.<SalarySobRangeListDTO>getInstance().buildTable(SalarySobRangeListDTO.class, dtoPage);
// weaTable.setPageUid("includeSalarySobRangeList");
// return weaTable;
// }
/**
* 薪资账套的人员范围列表关联人员范围
*
* @param queryParam 列表查询条件
* @return
*/
public PageInfo<SalarySobRangeListDTO> listPage4Include(SalarySobRangeQueryParam queryParam) {
return getSalarySobRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE);
}
// /**
// * 薪资账套的人员范围列表从范围中排除
// *
// * @param queryParam 列表查询条件
// * @param tenantKey 租户key
// * @return
// */
// public WeaTable<SalarySobRangeListDTO> listPage4Exclude(SalarySobRangeQueryParam queryParam, String tenantKey) {
// // 分页查询薪资账套的人员范围列表dto
// Page<SalarySobRangeListDTO> dtoPage = salarySobRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey);
// // 转换成前端所需的数据格式
// WeaTable<SalarySobRangeListDTO> weaTable = SalaryFormatUtil.<SalarySobRangeListDTO>getInstance().buildTable(SalarySobRangeListDTO.class, dtoPage);
// weaTable.setPageUid("excludeSalarySobRangeList");
// return weaTable;
// }
//
// /**
// * 获取薪资账套的人员范围列表添加人员的表单
// *
// * @return
// */
/**
* 薪资账套的人员范围列表从范围中排除
*
* @param queryParam 列表查询条件
* @return
*/
public PageInfo<SalarySobRangeListDTO> listPage4Exclude(SalarySobRangeQueryParam queryParam) {
return getSalarySobRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO);
}
/**
* 获取薪资账套的人员范围列表添加人员的表单
*
* @return
*/
// public WeaForm getForm() {
// return SalaryFormatUtil.<SalarySobRangeFormDTO>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<Long> ids, String tenantKey) {
salarySobRangeService.deleteByIds(ids);
public void delete(Collection<Long> ids) {
getSalarySobRangeService(user).deleteByIds(ids);
}
}