参数验证类
This commit is contained in:
parent
994a1dbd16
commit
2f8b56e4ac
|
|
@ -9,7 +9,6 @@ import com.api.browser.bean.SearchConditionItem;
|
|||
import com.api.browser.bean.SearchConditionOption;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.demo.DemoPo;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.siarchives.bo.InsuranceArchivesBO;
|
||||
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseDTO;
|
||||
|
|
@ -34,7 +33,10 @@ import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
|||
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||||
import com.engine.salary.util.*;
|
||||
import com.engine.salary.util.SalaryAssert;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryFormItemUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.PageUtil;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
|
|
@ -42,7 +44,6 @@ import weaver.conn.mybatis.MyBatisFactory;
|
|||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,13 @@ public class SalaryItemBiz {
|
|||
}
|
||||
|
||||
public List<SalaryItemPO> listSome(SalaryItemPO build) {
|
||||
return null;
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
return mapper.listSome(build);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void batchSave(Collection<SalaryItemPO> salaryItems) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.engine.salary.biz;
|
||||
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.mapper.salarysob.SalarySobItemMapper;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SalarySobItemBiz {
|
||||
|
||||
public List<SalarySobItemPO> listAll() {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
|
||||
return mapper.listAll();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,20 @@
|
|||
package com.engine.salary.entity.salaryitem.bo;
|
||||
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalaryDataSourceEnum;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.enums.*;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.weaver.excel.formula.api.entity.ExpressFormula;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description: 薪资项目
|
||||
|
|
@ -62,75 +65,75 @@ public class SalaryItemBO {
|
|||
* @param expressFormulas 公式详情
|
||||
* @return
|
||||
*/
|
||||
// public static List<SalaryItemListDTO> convert2ListDTO(Collection<SalaryItemPO> salaryItems, List<ExpressFormula> expressFormulas) {
|
||||
// if (CollectionUtils.isEmpty(salaryItems)) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
|
||||
// return salaryItems.stream().map(salaryItemPO -> {
|
||||
// SalaryItemCategoryEnum salaryItemCategoryEnum = SalaryItemCategoryEnum.parseByValue(salaryItemPO.getCategory());
|
||||
// SalaryItemTypeEnum salaryItemTypeEnum = SalaryItemTypeEnum.parseByValue(salaryItemPO.getItemType());
|
||||
// SalaryRoundingModeEnum salaryRoundingModeEnum = SalaryRoundingModeEnum.parseByValue(salaryItemPO.getRoundingMode());
|
||||
// SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(salaryItemPO.getValueType());
|
||||
// SalaryDataSourceEnum salaryDataSourceEnum = SalaryDataSourceEnum.parseByValue(salaryItemPO.getDatasource());
|
||||
// SalaryItemListDTO dto = SalaryItemListDTO.builder()
|
||||
// .id(salaryItemPO.getId())
|
||||
// .name(salaryItemPO.getName())
|
||||
// .category(Optional.ofNullable(salaryItemCategoryEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .itemTypeKey(salaryItemTypeEnum)
|
||||
// .itemType(Optional.ofNullable(salaryItemTypeEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .useInEmployeeSalary(salaryItemPO.getUseInEmployeeSalary())
|
||||
// .useDefault(salaryItemPO.getUseDefault())
|
||||
// .roundingMode(Optional.ofNullable(salaryRoundingModeEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .pattern(salaryItemPO.getPattern())
|
||||
// .valueType(Optional.ofNullable(salaryValueTypeEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .datasource(Optional.ofNullable(salaryDataSourceEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .formulaId(salaryItemPO.getFormulaId())
|
||||
// .formulaContent(formulaMap.getOrDefault(salaryItemPO.getFormulaId(), ""))
|
||||
// .description(salaryItemPO.getDescription())
|
||||
// .canEdit(Objects.equals(salaryItemPO.getCanEdit(), NumberUtils.INTEGER_ONE))
|
||||
// .build();
|
||||
// if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), 1)) {
|
||||
// dto.setDatasource(SalaryI18nUtil.getI18nLabel(SalaryDataSourceEnum.SALARY_ARCHIVES.getLabelId(),
|
||||
// SalaryDataSourceEnum.SALARY_ARCHIVES.getDefaultLabel()));
|
||||
// }
|
||||
// return dto;
|
||||
// }
|
||||
// ).collect(Collectors.toList());
|
||||
// }
|
||||
public static List<SalaryItemListDTO> convert2ListDTO(Collection<SalaryItemPO> salaryItems, List<ExpressFormula> expressFormulas) {
|
||||
if (CollectionUtils.isEmpty(salaryItems)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
|
||||
return salaryItems.stream().map(salaryItemPO -> {
|
||||
SalaryItemCategoryEnum salaryItemCategoryEnum = SalaryItemCategoryEnum.parseByValue(salaryItemPO.getCategory());
|
||||
SalaryItemTypeEnum salaryItemTypeEnum = SalaryItemTypeEnum.parseByValue(salaryItemPO.getItemType());
|
||||
SalaryRoundingModeEnum salaryRoundingModeEnum = SalaryRoundingModeEnum.parseByValue(salaryItemPO.getRoundingMode());
|
||||
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(salaryItemPO.getValueType());
|
||||
SalaryDataSourceEnum salaryDataSourceEnum = SalaryDataSourceEnum.parseByValue(salaryItemPO.getDatasource());
|
||||
SalaryItemListDTO dto = SalaryItemListDTO.builder()
|
||||
.id(salaryItemPO.getId())
|
||||
.name(salaryItemPO.getName())
|
||||
.category(Optional.ofNullable(salaryItemCategoryEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.itemTypeKey(salaryItemTypeEnum)
|
||||
.itemType(Optional.ofNullable(salaryItemTypeEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.useInEmployeeSalary(salaryItemPO.getUseInEmployeeSalary())
|
||||
.useDefault(salaryItemPO.getUseDefault())
|
||||
.roundingMode(Optional.ofNullable(salaryRoundingModeEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.pattern(salaryItemPO.getPattern())
|
||||
.valueType(Optional.ofNullable(salaryValueTypeEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.datasource(Optional.ofNullable(salaryDataSourceEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.formulaId(salaryItemPO.getFormulaId())
|
||||
.formulaContent(formulaMap.getOrDefault(salaryItemPO.getFormulaId(), ""))
|
||||
.description(salaryItemPO.getDescription())
|
||||
.canEdit(Objects.equals(salaryItemPO.getCanEdit(), NumberUtils.INTEGER_ONE))
|
||||
.build();
|
||||
if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), 1)) {
|
||||
dto.setDatasource(SalaryI18nUtil.getI18nLabel(SalaryDataSourceEnum.SALARY_ARCHIVES.getLabelId(),
|
||||
SalaryDataSourceEnum.SALARY_ARCHIVES.getDefaultLabel()));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 转换成薪资项目详情dto
|
||||
// *
|
||||
// * @param salaryItemPO
|
||||
// * @return
|
||||
// */
|
||||
// public static SalaryItemFormDTO convert2FormDTO(SalaryItemPO salaryItemPO) {
|
||||
// return new SalaryItemFormDTO()
|
||||
// .setId(salaryItemPO.getId())
|
||||
// .setName(salaryItemPO.getName())
|
||||
// .setSystemType(SalarySystemTypeEnum.parseByValue(salaryItemPO.getSystemType()))
|
||||
// .setUseDefault(salaryItemPO.getUseDefault())
|
||||
// .setUseInEmployeeSalary(salaryItemPO.getUseInEmployeeSalary())
|
||||
// .setCategory(SalaryItemCategoryEnum.parseByValue(salaryItemPO.getCategory()))
|
||||
// .setItemType(SalaryItemTypeEnum.parseByValue(salaryItemPO.getItemType()))
|
||||
// .setRoundingMode(SalaryRoundingModeEnum.parseByValue(salaryItemPO.getRoundingMode()))
|
||||
// .setPattern(salaryItemPO.getPattern())
|
||||
// .setValueType(SalaryValueTypeEnum.parseByValue(salaryItemPO.getValueType()))
|
||||
// .setFormulaId(salaryItemPO.getFormulaId())
|
||||
// .setDescription(salaryItemPO.getDescription())
|
||||
// .setCanEdit(salaryItemPO.getCanEdit());
|
||||
// }
|
||||
/**
|
||||
* 转换成薪资项目详情dto
|
||||
*
|
||||
* @param salaryItemPO
|
||||
* @return
|
||||
*/
|
||||
public static SalaryItemFormDTO convert2FormDTO(SalaryItemPO salaryItemPO) {
|
||||
return new SalaryItemFormDTO()
|
||||
.setId(salaryItemPO.getId())
|
||||
.setName(salaryItemPO.getName())
|
||||
.setSystemType(SalarySystemTypeEnum.parseByValue(salaryItemPO.getSystemType()))
|
||||
.setUseDefault(salaryItemPO.getUseDefault())
|
||||
.setUseInEmployeeSalary(salaryItemPO.getUseInEmployeeSalary())
|
||||
.setCategory(SalaryItemCategoryEnum.parseByValue(salaryItemPO.getCategory()))
|
||||
.setItemType(SalaryItemTypeEnum.parseByValue(salaryItemPO.getItemType()))
|
||||
.setRoundingMode(SalaryRoundingModeEnum.parseByValue(salaryItemPO.getRoundingMode()))
|
||||
.setPattern(salaryItemPO.getPattern())
|
||||
.setValueType(SalaryValueTypeEnum.parseByValue(salaryItemPO.getValueType()))
|
||||
.setFormulaId(salaryItemPO.getFormulaId())
|
||||
.setDescription(salaryItemPO.getDescription())
|
||||
.setCanEdit(salaryItemPO.getCanEdit());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存参数/更新参数 转换成薪资项目po
|
||||
|
|
@ -140,6 +143,14 @@ public class SalaryItemBO {
|
|||
* @return
|
||||
*/
|
||||
public static SalaryItemPO convert2SalaryItemPO(SalaryItemSaveParam saveParam, Long employeeId) {
|
||||
|
||||
String name = saveParam.getName();
|
||||
if(StringUtils.isNotBlank(name)){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Date now = new Date();
|
||||
// long id = IdGenerator.generate();
|
||||
SalaryItemPO salaryItemPO = SalaryItemPO.builder()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.salary.entity.salaryitem.bo;
|
||||
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
|
|
@ -80,44 +82,42 @@ public class SysSalaryItemBO {
|
|||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 转换成薪资项目详情dto
|
||||
// *
|
||||
// * @param sysSalaryItemPO
|
||||
// * @return
|
||||
// */
|
||||
// public static SalaryItemFormDTO convert2FormDTO(SysSalaryItemPO sysSalaryItemPO) {
|
||||
// return new SalaryItemFormDTO()
|
||||
// .setId(sysSalaryItemPO.getId())
|
||||
// .setName(sysSalaryItemPO.getName())
|
||||
// .setCanEdit(sysSalaryItemPO.getCanEdit())
|
||||
// .setSystemType(SalarySystemTypeEnum.parseByValue(sysSalaryItemPO.getSystemType()))
|
||||
// .setUseDefault(sysSalaryItemPO.getUseDefault())
|
||||
// .setUseInEmployeeSalary(sysSalaryItemPO.getUseInEmployeeSalary())
|
||||
// .setCategory(SalaryItemCategoryEnum.parseByValue(sysSalaryItemPO.getCategory()))
|
||||
// .setItemType(SalaryItemTypeEnum.parseByValue(sysSalaryItemPO.getItemType()))
|
||||
// .setRoundingMode(SalaryRoundingModeEnum.parseByValue(sysSalaryItemPO.getRoundingMode()))
|
||||
// .setPattern(sysSalaryItemPO.getPattern())
|
||||
// .setValueType(SalaryValueTypeEnum.parseByValue(sysSalaryItemPO.getValueType()))
|
||||
// .setFormulaId(sysSalaryItemPO.getFormulaId())
|
||||
// .setDescription(sysSalaryItemPO.getDescription());
|
||||
// }
|
||||
/**
|
||||
* 转换成薪资项目详情dto
|
||||
*
|
||||
* @param sysSalaryItemPO
|
||||
* @return
|
||||
*/
|
||||
public static SalaryItemFormDTO convert2FormDTO(SysSalaryItemPO sysSalaryItemPO) {
|
||||
return new SalaryItemFormDTO()
|
||||
.setId(sysSalaryItemPO.getId())
|
||||
.setName(sysSalaryItemPO.getName())
|
||||
.setCanEdit(sysSalaryItemPO.getCanEdit())
|
||||
.setSystemType(SalarySystemTypeEnum.parseByValue(sysSalaryItemPO.getSystemType()))
|
||||
.setUseDefault(sysSalaryItemPO.getUseDefault())
|
||||
.setUseInEmployeeSalary(sysSalaryItemPO.getUseInEmployeeSalary())
|
||||
.setCategory(SalaryItemCategoryEnum.parseByValue(sysSalaryItemPO.getCategory()))
|
||||
.setItemType(SalaryItemTypeEnum.parseByValue(sysSalaryItemPO.getItemType()))
|
||||
.setRoundingMode(SalaryRoundingModeEnum.parseByValue(sysSalaryItemPO.getRoundingMode()))
|
||||
.setPattern(sysSalaryItemPO.getPattern())
|
||||
.setValueType(SalaryValueTypeEnum.parseByValue(sysSalaryItemPO.getValueType()))
|
||||
.setFormulaId(sysSalaryItemPO.getFormulaId())
|
||||
.setDescription(sysSalaryItemPO.getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统薪资项目转换成自定义薪资项目
|
||||
*
|
||||
* @param sysSalaryItems 系统薪资项目集合
|
||||
* @param employeeId 人员id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
public static List<SalaryItemPO> convert2SalaryItemPO(Collection<SysSalaryItemPO> sysSalaryItems, Long employeeId, String tenantKey) {
|
||||
public static List<SalaryItemPO> convert2SalaryItemPO(Collection<SysSalaryItemPO> sysSalaryItems, Long employeeId) {
|
||||
if (CollectionUtils.isEmpty(sysSalaryItems)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return sysSalaryItems.stream()
|
||||
.map(e -> convert2SalaryItemPO(e, employeeId, tenantKey))
|
||||
.map(e -> convert2SalaryItemPO(e, employeeId))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -127,10 +127,9 @@ public class SysSalaryItemBO {
|
|||
*
|
||||
* @param sysSalaryItemPO 系统薪资项目
|
||||
* @param employeeId 人员id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
private static SalaryItemPO convert2SalaryItemPO(SysSalaryItemPO sysSalaryItemPO, Long employeeId, String tenantKey) {
|
||||
private static SalaryItemPO convert2SalaryItemPO(SysSalaryItemPO sysSalaryItemPO, Long employeeId) {
|
||||
if (sysSalaryItemPO == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -158,7 +157,7 @@ public class SysSalaryItemBO {
|
|||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(tenantKey)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,160 +1,70 @@
|
|||
//package com.engine.salary.entity.salaryitem.dto;
|
||||
//
|
||||
//import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
//import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
//import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
//import com.google.common.collect.Lists;
|
||||
//import com.weaver.common.component.form.item.WeaFormItemType;
|
||||
//import com.weaver.common.component.form.item.WeaFormOption;
|
||||
//import com.weaver.hrm.salary.annotation.SalaryForm;
|
||||
//import com.weaver.hrm.salary.annotation.SalaryFormItem;
|
||||
//import com.weaver.hrm.salary.enums.*;
|
||||
//import io.swagger.annotations.ApiModel;
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Data;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//import lombok.experimental.Accessors;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * 薪资项目表单
|
||||
// * <p>Copyright: Copyright (c) 2022</p>
|
||||
// * <p>Company: 泛微软件</p>
|
||||
// *
|
||||
// * @author qiantao
|
||||
// * @version 1.0
|
||||
// **/
|
||||
//@Data
|
||||
//@Accessors(chain = true)
|
||||
//@NoArgsConstructor
|
||||
//@AllArgsConstructor
|
||||
//@ApiModel("薪资项目详情")
|
||||
//public class SalaryItemFormDTO {
|
||||
//
|
||||
// //主键id")
|
||||
// @JsonSerialize(using = ToStringSerializer.class)
|
||||
// private Long id;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "名称",
|
||||
// labelId = 84756,
|
||||
// labelSpan = 3,
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.INPUT, required = true, maxLength = "40")
|
||||
// }
|
||||
// )
|
||||
// //名称")
|
||||
// private String name;
|
||||
//
|
||||
// //是否是系统内置的薪资项目")
|
||||
// private SalarySystemTypeEnum systemType;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "默认使用",
|
||||
// labelId = 84760,
|
||||
// labelSpan = 3,
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.SWITCH, tip = "提示:开启后,每个薪资方案都有该薪资项目,可在具体薪资方案中删除", tipLabel = 85266)
|
||||
// }
|
||||
// )
|
||||
// //默认使用")
|
||||
// private Integer useDefault;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "薪资档案引用",
|
||||
// labelId = 84759,
|
||||
// labelSpan = 3,
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.SWITCH, tip = "提示:开启后,该薪资项目不可删除或者设为无效", tipLabel = 85267)
|
||||
// }
|
||||
// )
|
||||
// //薪资档案引用")
|
||||
// private Integer useInEmployeeSalary;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "属性",
|
||||
// labelId = 84757,
|
||||
// layout = "category",
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryItemCategoryEnum.class)
|
||||
// }
|
||||
// )
|
||||
// //属性")
|
||||
// private SalaryItemCategoryEnum category;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "类型",
|
||||
// labelId = 84758,
|
||||
// layout = "category",
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryItemTypeEnum.class)
|
||||
// }
|
||||
// )
|
||||
// //类型")
|
||||
// private SalaryItemTypeEnum itemType;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "舍入规则",
|
||||
// labelId = 85196,
|
||||
// layout = "roundingMode",
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryRoundingModeEnum.class)
|
||||
// }
|
||||
// )
|
||||
// //舍入规则")
|
||||
// private SalaryRoundingModeEnum roundingMode;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "保留小数位",
|
||||
// labelId = 84765,
|
||||
// layout = "roundingMode",
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.SELECT, required = true, options = "listPatternOption()")
|
||||
// }
|
||||
// )
|
||||
// //保留小数位")
|
||||
// private Integer pattern;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "取值方式",
|
||||
// labelId = 84766,
|
||||
// labelSpan = 3,
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.RADIO, required = true, optionsEnum = SalaryValueTypeEnum.class)
|
||||
// }
|
||||
// )
|
||||
// //取值方式")
|
||||
// private SalaryValueTypeEnum valueType;
|
||||
//
|
||||
// //公式")
|
||||
// private Long formulaId;
|
||||
//
|
||||
// //公式内容")
|
||||
// private String formulaContent;
|
||||
//
|
||||
// @SalaryForm(
|
||||
// label = "备注",
|
||||
// labelId = 84961,
|
||||
// labelSpan = 3,
|
||||
// items = {
|
||||
// @SalaryFormItem(itemType = WeaFormItemType.TEXTAREA)
|
||||
// }
|
||||
// )
|
||||
// //备注")
|
||||
// private String description;
|
||||
//
|
||||
// @JsonIgnore
|
||||
// //是否可以编辑")
|
||||
// private Integer canEdit;
|
||||
//
|
||||
// private List<WeaFormOption> listPatternOption() {
|
||||
// List<WeaFormOption> resultList = Lists.newArrayListWithExpectedSize(7);
|
||||
// for (int i = 0; i < 6; i++) {
|
||||
// resultList.add(new WeaFormOption("" + i, "" + i));
|
||||
// }
|
||||
// return resultList;
|
||||
// }
|
||||
//}
|
||||
package com.engine.salary.entity.salaryitem.dto;
|
||||
|
||||
import com.engine.salary.enums.*;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
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 SalaryItemFormDTO {
|
||||
|
||||
//主键id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
//名称")
|
||||
private String name;
|
||||
|
||||
//是否是系统内置的薪资项目")
|
||||
private SalarySystemTypeEnum systemType;
|
||||
|
||||
//默认使用")
|
||||
private Integer useDefault;
|
||||
|
||||
//薪资档案引用")
|
||||
private Integer useInEmployeeSalary;
|
||||
|
||||
//属性")
|
||||
private SalaryItemCategoryEnum category;
|
||||
|
||||
//类型")
|
||||
private SalaryItemTypeEnum itemType;
|
||||
|
||||
//舍入规则")
|
||||
private SalaryRoundingModeEnum roundingMode;
|
||||
|
||||
//保留小数位")
|
||||
private Integer pattern;
|
||||
|
||||
//取值方式")
|
||||
private SalaryValueTypeEnum valueType;
|
||||
|
||||
//公式")
|
||||
private Long formulaId;
|
||||
|
||||
//公式内容")
|
||||
private String formulaContent;
|
||||
|
||||
//备注")
|
||||
private String description;
|
||||
|
||||
@JsonIgnore
|
||||
//是否可以编辑")
|
||||
private Integer canEdit;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,14 +24,13 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SalaryTable(pageId = "a4f85287-e3f9-7721-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX, operates = {@SalaryTableOperate(text = "编辑", index = "0"), @SalaryTableOperate(text = "删除", index = "1")})
|
||||
@SalaryTable(pageId = "a4f85287-e3f9-7721-adn9-7d06e54y6r98", tableType = WeaTableType.CHECKBOX, operates = {@SalaryTableOperate(text = "编辑", index = "0"), @SalaryTableOperate(text = "删除", index = "1")})
|
||||
public class SalaryItemListDTO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@SalaryTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@SalaryTableColumn(text = "名称", width = "10%", column = "name")
|
||||
private String name;
|
||||
|
||||
|
|
@ -44,7 +43,6 @@ public class SalaryItemListDTO {
|
|||
//类型
|
||||
private SalaryItemTypeEnum itemTypeKey;
|
||||
|
||||
|
||||
//薪资档案引用
|
||||
@SalaryTableColumn(text = "薪资档案引用", width = "10%", column = "useInEmployeeSalary")
|
||||
private Integer useInEmployeeSalary;
|
||||
|
|
@ -54,17 +52,14 @@ public class SalaryItemListDTO {
|
|||
@SalaryTableColumn(text = "默认使用", width = "10%", column = "useDefault")
|
||||
private Integer useDefault;
|
||||
|
||||
|
||||
//进位规则
|
||||
@SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode")
|
||||
private String roundingMode;
|
||||
|
||||
|
||||
//保留小数位
|
||||
@SalaryTableColumn(text = "保留小数位", width = "10%", column = "pattern")
|
||||
private Integer pattern;
|
||||
|
||||
|
||||
//取值方式
|
||||
@SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType")
|
||||
private String valueType;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SalaryTable(pageId = "a4f85287-6111-7721-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX)
|
||||
@SalaryTable(pageId = "a4f85287-6111-7721-adn9-7d06e54y6rj9",
|
||||
fields = " t.id, t.name, t.category, t.item_type, t.rounding_mode, t.pattern, t.value_type",
|
||||
fromSql = " FROM hrsa_sys_salary_item t",
|
||||
tableType = WeaTableType.CHECKBOX)
|
||||
public class SysSalaryItemListDTO {
|
||||
|
||||
//主键id")
|
||||
|
|
@ -30,7 +33,6 @@ public class SysSalaryItemListDTO {
|
|||
@SalaryTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
|
||||
@SalaryTableColumn(text = "名称", width = "10%", column = "name")
|
||||
private String name;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package com.engine.salary.entity.salaryitem.param;
|
||||
|
||||
import com.engine.salary.enums.*;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
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>
|
||||
*
|
||||
|
|
@ -16,16 +18,16 @@ import lombok.Data;
|
|||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryItemSaveParam {
|
||||
|
||||
//主键id
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称不允许为空
|
||||
* 名称不能超过40个字符
|
||||
*/
|
||||
//名称
|
||||
@DataCheck(require = true, max = 40, message = "名称不允许为空,名称不能超过40个字符")
|
||||
private String name;
|
||||
|
||||
//是否是系统内置的薪资项目
|
||||
|
|
@ -38,6 +40,7 @@ public class SalaryItemSaveParam {
|
|||
private Integer useInEmployeeSalary;
|
||||
|
||||
//属性
|
||||
@DataCheck(require = true, message = "属性不允许为空")
|
||||
private SalaryItemCategoryEnum category;
|
||||
|
||||
//类型
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.entity.salaryitem.param;
|
||||
|
||||
import com.engine.salary.enums.SalaryItemCategoryEnum;
|
||||
import com.engine.salary.enums.SalaryItemTypeEnum;
|
||||
import com.engine.salary.entity.base.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -10,27 +9,28 @@ import lombok.NoArgsConstructor;
|
|||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @description: 系统薪资项目查询参数
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 12/20/21 4:47 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
* 系统薪资项目查询参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysSalaryItemSearchParam{
|
||||
public class SysSalaryItemSearchParam extends BaseQueryParam {
|
||||
|
||||
//名称")
|
||||
//名称
|
||||
private String name;
|
||||
|
||||
//属性")
|
||||
private SalaryItemCategoryEnum category;
|
||||
//属性 SalaryItemCategoryEnum
|
||||
private String category;
|
||||
|
||||
//分类")
|
||||
private SalaryItemTypeEnum itemType;
|
||||
//分类 SalaryItemTypeEnum
|
||||
private String itemType;
|
||||
|
||||
//需要排除的系统薪资项目")
|
||||
//需要排除的系统薪资项目
|
||||
private Collection<Long> excludeIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@ import lombok.NoArgsConstructor;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description: 薪资账套薪资项目
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 11/9/21 10:50 AM
|
||||
* @version:v1.0
|
||||
*/
|
||||
* 薪资账套薪资项目
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ public interface SalaryItemMapper {
|
|||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
SalaryItemPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<SalaryItemPO> listSome(SalaryItemPO salaryItem);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
|
|
|
|||
|
|
@ -70,6 +70,84 @@
|
|||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salaryitem.po.SalaryItemPO">
|
||||
SELECT
|
||||
<include refid="baseColumns" />
|
||||
FROM hrsa_salary_item t
|
||||
WHERE delete_type = 0
|
||||
<if test="canDelete != null and canDelete != ''">
|
||||
AND can_delete = #{canDelete}
|
||||
</if>
|
||||
<if test="canEdit != null and canEdit != ''">
|
||||
AND can_edit = #{canEdit}
|
||||
</if>
|
||||
<if test="category != null and category != ''">
|
||||
AND category = #{category}
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="datasource != null and datasource != ''">
|
||||
AND datasource = #{datasource}
|
||||
</if>
|
||||
<if test="deleteType != null and deleteType != ''">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
AND description = #{description}
|
||||
</if>
|
||||
<if test="formulaId != null and formulaId != ''">
|
||||
AND formula_id = #{formulaId}
|
||||
</if>
|
||||
<if test="itemType != null and itemType != ''">
|
||||
AND item_type = #{itemType}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="pattern != null and pattern != ''">
|
||||
AND pattern = #{pattern}
|
||||
</if>
|
||||
<if test="roundingMode != null and roundingMode != ''">
|
||||
AND rounding_mode = #{roundingMode}
|
||||
</if>
|
||||
<if test="sysSalaryItemId != null and sysSalaryItemId != ''">
|
||||
AND sys_salary_item_id = #{sysSalaryItemId}
|
||||
</if>
|
||||
<if test="systemType != null and systemType != ''">
|
||||
AND system_type = #{systemType}
|
||||
</if>
|
||||
<if test="tenantKey != null and tenantKey != ''">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="updateTime != null and updateTime != ''">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="useDefault != null and useDefault != ''">
|
||||
AND use_default = #{useDefault}
|
||||
</if>
|
||||
<if test="useInEmployeeSalary != null and useInEmployeeSalary != ''">
|
||||
AND use_in_employee_salary = #{useInEmployeeSalary}
|
||||
</if>
|
||||
<if test="valueType != null and valueType != ''">
|
||||
AND value_type = #{valueType}
|
||||
</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.salaryitem.po.SalaryItemPO"
|
||||
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
|
||||
|
|
@ -374,7 +452,7 @@
|
|||
<update id="deleteByIds">
|
||||
UPDATE hrsa_salary_item
|
||||
SET delete_type = 1
|
||||
WHERE tenant_key = #{tenantKey} AND delete_type = 0
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.engine.salary.mapper.salarysob;
|
||||
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SalarySobItemMapper {
|
||||
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<SalarySobItemPO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<SalarySobItemPO> listSome(SalarySobItemPO salarySobItemPO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
SalarySobItemPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param salarySobItemPO 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(SalarySobItemPO salarySobItemPO);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param salarySobItemPO 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(SalarySobItemPO salarySobItemPO);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param salarySobItemPO 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(SalarySobItemPO salarySobItemPO);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param SalarySobItemPO 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(SalarySobItemPO salarySobItemPO);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
<?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.SalarySobItemMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="formula_id" property="formulaId"/>
|
||||
<result column="id" property="id"/>
|
||||
<result column="salary_item_id" property="salaryItemId"/>
|
||||
<result column="salary_sob_id" property="salarySobId"/>
|
||||
<result column="salary_sob_item_group_id" property="salarySobItemGroupId"/>
|
||||
<result column="sorted_index" property="sortedIndex"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
create_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.description
|
||||
, t.formula_id
|
||||
, t.id
|
||||
, t.salary_item_id
|
||||
, t.salary_sob_id
|
||||
, t.salary_sob_item_group_id
|
||||
, t.sorted_index
|
||||
, t.tenant_key
|
||||
, t.update_time
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sob_item t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sob_item t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sob_item t
|
||||
WHERE delete_type = 0
|
||||
<if test="createTime != null and createTime != ''">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null and deleteType != ''">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
AND description = #{description}
|
||||
</if>
|
||||
<if test="formulaId != null and formulaId != ''">
|
||||
AND formula_id = #{formulaId}
|
||||
</if>
|
||||
<if test="id != null and id != ''">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="salaryItemId != null and salaryItemId != ''">
|
||||
AND salary_item_id = #{salaryItemId}
|
||||
</if>
|
||||
<if test="salarySobId != null and salarySobId != ''">
|
||||
AND salary_sob_id = #{salarySobId}
|
||||
</if>
|
||||
<if test="salarySobItemGroupId != null and salarySobItemGroupId != ''">
|
||||
AND salary_sob_item_group_id = #{salarySobItemGroupId}
|
||||
</if>
|
||||
<if test="sortedIndex != null and sortedIndex != ''">
|
||||
AND sorted_index = #{sortedIndex}
|
||||
</if>
|
||||
<if test="tenantKey != null and tenantKey != ''">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="updateTime != null and updateTime != ''">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemPO"
|
||||
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
|
||||
>
|
||||
INSERT INTO hrsa_salary_sob_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="formulaId != null">
|
||||
formula_id,
|
||||
</if>
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="salaryItemId != null">
|
||||
salary_item_id,
|
||||
</if>
|
||||
<if test="salarySobId != null">
|
||||
salary_sob_id,
|
||||
</if>
|
||||
<if test="salarySobItemGroupId != null">
|
||||
salary_sob_item_group_id,
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
sorted_index,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description},
|
||||
</if>
|
||||
<if test="formulaId != null">
|
||||
#{formulaId},
|
||||
</if>
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="salaryItemId != null">
|
||||
#{salaryItemId},
|
||||
</if>
|
||||
<if test="salarySobId != null">
|
||||
#{salarySobId},
|
||||
</if>
|
||||
<if test="salarySobItemGroupId != null">
|
||||
#{salarySobItemGroupId},
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
#{sortedIndex},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
#{tenantKey},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
|
||||
UPDATE hrsa_salary_sob_item
|
||||
<set>
|
||||
create_time=#{createTime},
|
||||
creator=#{creator},
|
||||
delete_type=#{deleteType},
|
||||
description=#{description},
|
||||
formula_id=#{formulaId},
|
||||
salary_item_id=#{salaryItemId},
|
||||
salary_sob_id=#{salarySobId},
|
||||
salary_sob_item_group_id=#{salarySobItemGroupId},
|
||||
sorted_index=#{sortedIndex},
|
||||
tenant_key=#{tenantKey},
|
||||
update_time=#{updateTime},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
|
||||
UPDATE hrsa_salary_sob_item
|
||||
<set>
|
||||
<if test="createTime != null">
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator=#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description=#{description},
|
||||
</if>
|
||||
<if test="formulaId != null">
|
||||
formula_id=#{formulaId},
|
||||
</if>
|
||||
<if test="salaryItemId != null">
|
||||
salary_item_id=#{salaryItemId},
|
||||
</if>
|
||||
<if test="salarySobId != null">
|
||||
salary_sob_id=#{salarySobId},
|
||||
</if>
|
||||
<if test="salarySobItemGroupId != null">
|
||||
salary_sob_item_group_id=#{salarySobItemGroupId},
|
||||
</if>
|
||||
<if test="sortedIndex != null">
|
||||
sorted_index=#{sortedIndex},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete" parameterType="com.engine.salary.entity.salarysob.po.SalarySobItemPO">
|
||||
UPDATE hrsa_salary_sob_item
|
||||
SET delete_type=1
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.weaver.excel.formula.api.entity.ExpressFormula;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: 薪酬管理公式编辑器
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 12/7/21 5:38 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
public interface SalaryFormulaService {
|
||||
|
||||
/**
|
||||
* 根据公式id获取公式内容
|
||||
*
|
||||
* @param formulaIds
|
||||
* @return
|
||||
*/
|
||||
List<ExpressFormula> listExpressFormula(Collection<Long> formulaIds);
|
||||
|
||||
/**
|
||||
* 根据公式id获取公式内容
|
||||
*
|
||||
* @param formulaId
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
ExpressFormula getExpressFormula(Long formulaId);
|
||||
}
|
||||
|
|
@ -17,7 +17,6 @@ public interface SalarySobItemService {
|
|||
/**
|
||||
* 查询所有薪资账套的薪资项目副本
|
||||
*
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> list();
|
||||
|
|
@ -29,7 +28,7 @@ public interface SalarySobItemService {
|
|||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalarySobId(Long salarySobId, String tenantKey);
|
||||
// List<SalarySobItemPO> listBySalarySobId(Long salarySobId, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id查询薪资账套的薪资项目副本
|
||||
|
|
@ -38,7 +37,7 @@ public interface SalarySobItemService {
|
|||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
|
||||
// List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id、薪资项目id查询薪资账套的薪资项目副本
|
||||
|
|
@ -48,16 +47,15 @@ public interface SalarySobItemService {
|
|||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> salaryItemIds, String tenantKey);
|
||||
// List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> salaryItemIds, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资项目id查询薪资账套的薪资项目副本
|
||||
*
|
||||
* @param salaryItemIds 薪资项目的主键id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalaryItemIds(Collection<Long> salaryItemIds, String tenantKey);
|
||||
List<SalarySobItemPO> listBySalaryItemIds(Collection<Long> salaryItemIds);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id查询薪资账套的薪资项目副本所关联的薪资项目
|
||||
|
|
@ -91,7 +89,7 @@ public interface SalarySobItemService {
|
|||
*
|
||||
* @param salarySobItemPOS 薪资账套的薪资项目副本
|
||||
*/
|
||||
void batchSave(Collection<SalarySobItemPO> salarySobItemPOS);
|
||||
// void batchSave(Collection<SalarySobItemPO> salarySobItemPOS);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id删除薪资账套的薪资项目副本
|
||||
|
|
@ -99,5 +97,5 @@ public interface SalarySobItemService {
|
|||
* @param salarySobIds 薪资账套的id
|
||||
* @param tenantKey 租户key
|
||||
*/
|
||||
void deleteBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
|
||||
// void deleteBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ public interface SysSalaryItemService {
|
|||
* 添加系统薪资项目到自定义薪资项目列表中
|
||||
*
|
||||
* @param ids
|
||||
* @param employeeId
|
||||
* @param tenantKey
|
||||
*/
|
||||
void add2SalaryItem(Collection<Long> ids, Long employeeId, String tenantKey);
|
||||
void add2SalaryItem(Collection<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,169 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.SalarySobItemBiz;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.service.SalarySobItemService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 薪资账套的薪资项目副本
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
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 LoggerTemplate salarySobLoggerTemplate;
|
||||
|
||||
@Override
|
||||
public List<SalarySobItemPO> list() {
|
||||
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> 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();
|
||||
}
|
||||
|
||||
// @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());
|
||||
// }
|
||||
// // 记录日志
|
||||
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
|
||||
// loggerContext.setTargetId("" + salarySobPO.getId());
|
||||
// loggerContext.setTargetName(salarySobPO.getName());
|
||||
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
||||
// 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);
|
||||
// }
|
||||
}
|
||||
|
|
@ -29,8 +29,8 @@ import java.util.Set;
|
|||
**/
|
||||
public class SysSalaryItemServiceImpl extends Service implements SysSalaryItemService {
|
||||
|
||||
private SysSalaryItemBiz sysSalaryItemMapper;
|
||||
private SalaryItemBiz salaryItemService;
|
||||
private SysSalaryItemBiz sysSalaryItemMapper = new SysSalaryItemBiz();
|
||||
private SalaryItemBiz salaryItemService = new SalaryItemBiz();
|
||||
// @Autowired
|
||||
// private LoggerTemplate salaryItemLoggerTemplate;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public class SysSalaryItemServiceImpl extends Service implements SysSalaryItemSe
|
|||
// }
|
||||
|
||||
@Override
|
||||
public void add2SalaryItem(Collection<Long> ids, Long employeeId, String tenantKey) {
|
||||
public void add2SalaryItem(Collection<Long> ids) {
|
||||
// 查询系统薪资项目
|
||||
List<SysSalaryItemPO> sysSalaryItemPOS = listByIds(ids);
|
||||
if (CollectionUtils.isEmpty(sysSalaryItemPOS)) {
|
||||
|
|
@ -81,7 +81,7 @@ public class SysSalaryItemServiceImpl extends Service implements SysSalaryItemSe
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98350, "已经添加过的系统薪资项目不能重复添加"));
|
||||
}
|
||||
// 保存
|
||||
List<SalaryItemPO> salaryItems = SysSalaryItemBO.convert2SalaryItemPO(sysSalaryItemPOS, employeeId, tenantKey);
|
||||
List<SalaryItemPO> salaryItems = SysSalaryItemBO.convert2SalaryItemPO(sysSalaryItemPOS,(long)user.getUID());
|
||||
salaryItemService.batchSave(salaryItems);
|
||||
//todo 记录日志
|
||||
// sysSalaryItemPOS.forEach(sysSalaryItemPO -> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
package com.engine.salary.util.valid;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据参数合法性注解
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataCheck {
|
||||
|
||||
/**
|
||||
* 是否必填
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean require() default false;
|
||||
|
||||
/**
|
||||
* 参数类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ValidTypeEnum type() default ValidTypeEnum.STRING;
|
||||
|
||||
/**
|
||||
* 日期格式(校验String格式的字符是否为日期格式)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String pattern() default "yyyy-MM-dd";
|
||||
|
||||
/**
|
||||
* 最大(String字段验证文本长度,int字段验证大小)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int max() default -1;
|
||||
|
||||
/**
|
||||
* 最小(String字段验证文本长度,int字段验证大小)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int min() default -1;
|
||||
|
||||
//错误信息
|
||||
int labelId() default -1;
|
||||
|
||||
String message();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.engine.salary.util.valid;
|
||||
|
||||
/**
|
||||
* 可验证的字段枚举
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public enum ValidTypeEnum {
|
||||
STRING, DATE, NUMBER
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
package com.engine.salary.util.valid;
|
||||
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数校验
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class ValidUtil {
|
||||
|
||||
/**
|
||||
* 通过反射来获取javaBean上的注解信息,判断属性值信息,然后通过注解元数据
|
||||
* 来返回
|
||||
*
|
||||
* @param t
|
||||
*/
|
||||
public static <T> void doValidator(T t) {
|
||||
Class<?> clazz = t.getClass();
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
DataCheck rule = field.getDeclaredAnnotation(DataCheck.class);
|
||||
if (null != rule) {
|
||||
//字段值
|
||||
Object value = getValue(t, field.getName());
|
||||
|
||||
ValidTypeEnum type = rule.type();
|
||||
|
||||
int labelId = rule.labelId();
|
||||
String message = rule.message();
|
||||
|
||||
boolean require = rule.require();
|
||||
int max = rule.max();
|
||||
int min = rule.min();
|
||||
String pattern = rule.pattern();
|
||||
|
||||
if (require) {
|
||||
if (!notNull(value)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(labelId, message));
|
||||
}
|
||||
}
|
||||
|
||||
if (ValidTypeEnum.STRING == type) {
|
||||
//区间值
|
||||
if (value != null && max != -1) {
|
||||
String s = String.valueOf(value);
|
||||
if (s.length() > max) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(labelId, message));
|
||||
}
|
||||
}
|
||||
|
||||
if (value != null && min != -1) {
|
||||
String s = String.valueOf(value);
|
||||
if (s.length() < min) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(labelId, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ValidTypeEnum.DATE == type) {
|
||||
if (value != null && StringUtils.isNotBlank(value.toString()) && isValidDate(value.toString(), pattern)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(labelId, message));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ValidTypeEnum.NUMBER == type) {
|
||||
if (value instanceof Integer) {
|
||||
int v = (Integer) value;
|
||||
if (max != -1) {
|
||||
if (v > max) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(labelId, message));
|
||||
}
|
||||
}
|
||||
if (min != -1) {
|
||||
if (v < min) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(labelId, message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> Object getValue(T t, String fieldName) {
|
||||
Object value = null;
|
||||
try {
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(t.getClass());
|
||||
PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
|
||||
for (PropertyDescriptor property : props) {
|
||||
if (fieldName.equals(property.getName())) {
|
||||
Method method = property.getReadMethod();
|
||||
value = method.invoke(t, new Object[]{});
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static boolean notNull(Object value) {
|
||||
if (null == value) {
|
||||
return false;
|
||||
}
|
||||
if (value instanceof String && isEmpty((String) value)) {
|
||||
return false;
|
||||
}
|
||||
if (value instanceof List && isEmpty((Collection<?>) value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isEmpty(String str) {
|
||||
return null == str || str.isEmpty();
|
||||
}
|
||||
|
||||
private static boolean isEmpty(Collection<?> list) {
|
||||
return null == list || list.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验日期
|
||||
*/
|
||||
private static boolean isValidDate(String str, String pattern) {
|
||||
boolean convertSuccess = true;
|
||||
if (str != null && str.length() == pattern.length()) {
|
||||
// 指定日期格式为四位年/两位月份/两位日期,注意yyyy/MM/dd区分大小写;
|
||||
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
// 设置lenient为false.
|
||||
// 否则SimpleDateFormat会比较宽松地验证日期,比如2007/02/29会被接受,并转换成2007/03/01
|
||||
format.setLenient(false);
|
||||
Date dateStr = format.parse(str);
|
||||
} catch (Exception e) {
|
||||
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
|
||||
convertSuccess = false;
|
||||
}
|
||||
} else {
|
||||
convertSuccess = false;
|
||||
}
|
||||
return convertSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,10 +2,18 @@ package com.engine.salary.web;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.component.WeaFormOption;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.wrapper.SalaryItemWrapper;
|
||||
import com.engine.salary.wrapper.SysSalaryItemWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -17,6 +25,7 @@ import javax.ws.rs.Path;
|
|||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -34,10 +43,12 @@ public class SalaryItemController {
|
|||
return ServiceUtil.getService(SalaryItemWrapper.class, user);
|
||||
}
|
||||
|
||||
// @Autowired
|
||||
// private SysSalaryItemWrapper sysSalaryItemWrapper;
|
||||
//
|
||||
// /**********************************自定义薪资项目 start*********************************/
|
||||
|
||||
private SysSalaryItemWrapper getSysSalaryItemWrapper(User user) {
|
||||
return ServiceUtil.getService(SysSalaryItemWrapper.class, user);
|
||||
}
|
||||
|
||||
/**********************************自定义薪资项目 start*********************************/
|
||||
|
||||
/**
|
||||
* 薪资项目列表
|
||||
|
|
@ -50,38 +61,55 @@ public class SalaryItemController {
|
|||
return new ResponseResult<SalaryItemSearchParam, Map<String, Object>>().run(getSalaryItemWrapper(user)::listPage, searchParam);
|
||||
}
|
||||
|
||||
// @PostMapping("/listCanDelete")
|
||||
// @ApiOperation("可删除的薪资项目列表")
|
||||
// @WeaPermission
|
||||
// public WeaResult<WeaTable<SalaryItemListDTO>> listCanDeleteSalaryItem(@RequestBody SalaryItemSearchParam searchParam) {
|
||||
// return WeaResult.success(salaryItemWrapper.listPage4CanDelete(searchParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/listSalaryItemDetail")
|
||||
// @ApiOperation("获取多个薪资项目的详情")
|
||||
// @WeaPermission
|
||||
// public WeaResult<List<SalaryItemListDTO>> listSalaryItemDetail(@RequestBody Collection<Long> ids) {
|
||||
// if (CollectionUtils.isEmpty(ids)) {
|
||||
// return WeaResult.success(Collections.emptyList());
|
||||
// }
|
||||
// List<SalaryItemListDTO> salaryItemListDTOS = salaryItemWrapper.listByIds(ids, TenantContext.getCurrentTenantKey());
|
||||
// return WeaResult.success(salaryItemListDTOS);
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* 可删除的薪资项目列表
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param searchParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/listCanDelete")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listCanDeleteSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam searchParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryItemSearchParam, Map<String, Object>>().run(getSalaryItemWrapper(user)::listPage4CanDelete, searchParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多个薪资项目的详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/listSalaryItemDetail")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listSalaryItemDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Collection<Long>, List<SalaryItemListDTO>>().run(getSalaryItemWrapper(user)::listByIds, ids);
|
||||
}
|
||||
|
||||
|
||||
// @GetMapping("/getSearchCondition")
|
||||
// @ApiOperation("薪资项目列表的高级搜索")
|
||||
// @WeaPermission
|
||||
// public WeaResult<WeaSearchCondition> getSearchCondition() {
|
||||
// return WeaResult.success(salaryItemWrapper.getSearchCondition());
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/getSalaryForm")
|
||||
// @ApiOperation("薪资项目的详情")
|
||||
// @WeaPermission
|
||||
// public WeaResult<WeaForm> getSalaryItemForm(@RequestParam(value = "id", required = false) Long id) {
|
||||
// return WeaResult.success(salaryItemWrapper.getForm(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* 薪资项目的详情
|
||||
*/
|
||||
@POST
|
||||
@Path("/getSalaryForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSalaryItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Long id) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, SalaryItemFormDTO>().run(getSalaryItemWrapper(user)::getForm, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* "获取薪资项目可选的类型(与属性有联动)"
|
||||
|
|
@ -95,71 +123,84 @@ public class SalaryItemController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Map<String, List<WeaFormOption>>>().run(getSalaryItemWrapper(user)::listSalaryItemTypeOption);
|
||||
}
|
||||
//
|
||||
// @PostMapping("/delete")
|
||||
// @ApiOperation("批量删除薪资项目")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Object> deleteSalaryItem(@RequestBody Collection<Long> ids) {
|
||||
// Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
// String tenantKey = TenantContext.getCurrentTenantKey();
|
||||
// if (CollectionUtils.isEmpty(ids)) {
|
||||
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84026, "参数错误"));
|
||||
// }
|
||||
// salaryItemWrapper.delete(ids, tenantKey);
|
||||
// return WeaResult.success(null);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/save")
|
||||
// @ApiOperation("保存薪资项目")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Object> saveSalaryItem(@RequestBody @Validated SalaryItemSaveParam saveParam) {
|
||||
// if (saveParam.getId() == null || saveParam.getId() <= 0) {
|
||||
// salaryItemWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// } else {
|
||||
// salaryItemWrapper.update(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// }
|
||||
// return WeaResult.success(null);
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/update")
|
||||
// @ApiOperation("更新薪资项目")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Object> updateSalaryItem(@RequestBody @Validated SalaryItemSaveParam saveParam) {
|
||||
// salaryItemWrapper.update(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// return WeaResult.success(null);
|
||||
// }
|
||||
//
|
||||
// /**********************************自定义薪资项目 end*********************************/
|
||||
//
|
||||
//
|
||||
// /**********************************系统薪资项目 start*********************************/
|
||||
//
|
||||
// @PostMapping("/sysList")
|
||||
// @ApiOperation("系统薪资项目列表")
|
||||
// @WeaPermission
|
||||
// public WeaResult<WeaTable<SysSalaryItemListDTO>> listSysSalaryItem(@RequestBody SysSalaryItemSearchParam searchParam) {
|
||||
// return WeaResult.success(sysSalaryItemWrapper.listPage(searchParam, TenantContext.getCurrentTenantKey()));
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@POST
|
||||
@Path("/delete")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Collection<Long>, String>().run(getSalaryItemWrapper(user)::delete, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存薪资项目
|
||||
*/
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String saveSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSaveParam saveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if (saveParam.getId() == null || saveParam.getId() <= 0) {
|
||||
return new ResponseResult<SalaryItemSaveParam, String>().run(getSalaryItemWrapper(user)::save, saveParam);
|
||||
} else {
|
||||
return new ResponseResult<SalaryItemSaveParam, String>().run(getSalaryItemWrapper(user)::update, saveParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新薪资项目
|
||||
*/
|
||||
@POST
|
||||
@Path("/update")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSaveParam saveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryItemSaveParam, String>().run(getSalaryItemWrapper(user)::update, saveParam);
|
||||
}
|
||||
|
||||
/**********************************自定义薪资项目 end*********************************/
|
||||
|
||||
|
||||
/**********************************系统薪资项目 start*********************************/
|
||||
|
||||
|
||||
/**
|
||||
* 系统薪资项目列表
|
||||
*/
|
||||
@POST
|
||||
@Path("/sysList")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listSysSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SysSalaryItemSearchParam searchParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
return new ResponseResult<SysSalaryItemSearchParam, Map<String, Object>>().run(getSysSalaryItemWrapper(user)::listPage, searchParam);
|
||||
}
|
||||
|
||||
|
||||
// @GetMapping("/getSysSearchCondition")
|
||||
// @ApiOperation("系统薪资项目的高级搜索")
|
||||
// @WeaPermission
|
||||
// public WeaResult<WeaSearchCondition> getSysSearchCondition() {
|
||||
// return WeaResult.success(sysSalaryItemWrapper.getSearchCondition());
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/saveSys")
|
||||
// @ApiOperation("添加系统薪资项目")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Object> saveSysSalaryItem(@RequestBody Collection<Long> sysSalaryItemIds) {
|
||||
// Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
// String tenantKey = TenantContext.getCurrentTenantKey();
|
||||
// if (CollectionUtils.isEmpty(sysSalaryItemIds)) {
|
||||
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84026, "参数错误"));
|
||||
// }
|
||||
// sysSalaryItemWrapper.add2SalaryItem(sysSalaryItemIds, employeeId, tenantKey);
|
||||
// return WeaResult.success(null);
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* 添加系统薪资项目
|
||||
*/
|
||||
@POST
|
||||
@Path("/saveSys")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String saveSysSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> sysSalaryItemIds) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
if (CollectionUtils.isEmpty(sysSalaryItemIds)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
|
||||
}
|
||||
return new ResponseResult<Collection<Long>, Map<String, Object>>().run(getSysSalaryItemWrapper(user)::add2SalaryItem, sysSalaryItemIds);
|
||||
}
|
||||
|
||||
// /**********************************系统薪资项目 end*********************************/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,38 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.component.WeaFormOption;
|
||||
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
|
||||
import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.enums.SalaryItemTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.SalaryFormulaService;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.service.SalarySobItemService;
|
||||
import com.engine.salary.service.SysSalaryItemService;
|
||||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.service.impl.SalarySobItemServiceImpl;
|
||||
import com.engine.salary.service.impl.SysSalaryItemServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 薪资项目
|
||||
|
|
@ -28,15 +44,19 @@ import java.util.*;
|
|||
**/
|
||||
public class SalaryItemWrapper extends Service {
|
||||
|
||||
private SalaryItemService salaryItemService;
|
||||
private SalaryItemService getSalaryItemService(User user) {
|
||||
return (SalaryItemService)ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SysSalaryItemService getSysSalaryItemService(User user) {
|
||||
return (SysSalaryItemService) ServiceUtil.getService(SysSalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// private SalaryFormulaService salaryFormulaService;
|
||||
private SalarySobItemService salarySobItemService;
|
||||
private SysSalaryItemService sysSalaryItemService;
|
||||
private SalaryFormulaService salaryFormulaService;
|
||||
|
||||
private SalarySobItemService getSalarySobItemService(User user) {
|
||||
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪资项目列表
|
||||
|
|
@ -45,24 +65,63 @@ public class SalaryItemWrapper extends Service {
|
|||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage(SalaryItemSearchParam searchParam) {
|
||||
// 查询薪资项目
|
||||
PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(searchParam);
|
||||
Map<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("a",page);
|
||||
return objectObjectHashMap;
|
||||
// Page<SalaryItemListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
||||
// // 被薪资账套引用的薪资项目
|
||||
// List<SalarySobItemPO> salarySobItems = Lists.newArrayListWithExpectedSize((int) page.getSize());
|
||||
// if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
// // 查询公式
|
||||
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalaryItemPO::getFormulaId);
|
||||
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
|
||||
|
||||
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(makeSqlWhere(searchParam));
|
||||
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();
|
||||
|
||||
|
||||
// // 1、查询薪资项目
|
||||
// PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(searchParam);
|
||||
// List<SalaryItemPO> salaryItemList = page.getList();
|
||||
//
|
||||
// //最终返回的分页对象
|
||||
// PageInfo<SalaryItemListDTO> salaryItemListDTOPage = new PageInfo<>();
|
||||
//
|
||||
// if (CollectionUtils.isNotEmpty(salaryItemList)) {
|
||||
// //2、填充公式内容
|
||||
// Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getFormulaId);
|
||||
// // todo 查询公式
|
||||
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds);
|
||||
// // 转换成薪资项目列表dto
|
||||
// dtoPage.setRecords(SalaryItemBO.convert2ListDTO(page.getRecords(), expressFormulas));
|
||||
// salaryItemListDTOPage.setList(SalaryItemBO.convert2ListDTO(salaryItemList, expressFormulas));
|
||||
//
|
||||
// //3、被引用的薪资项目不能删除
|
||||
// // 查询被账套引用的薪资项目
|
||||
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(page.getRecords(), SalaryItemPO::getId);
|
||||
// salarySobItems = salarySobItemService.listBySalaryItemIds(salaryItemIds, tenantKey);
|
||||
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getId);
|
||||
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalaryItemIds(salaryItemIds);
|
||||
// }
|
||||
|
||||
// // 构建前端所需的数据格式
|
||||
// WeaTable<SalaryItemListDTO> weaTable = SalaryFormatUtil.<SalaryItemListDTO>getInstance().buildTable(SalaryItemListDTO.class, dtoPage);
|
||||
// // 被薪资账套引用的薪资项目不可删除
|
||||
|
|
@ -77,51 +136,87 @@ public class SalaryItemWrapper extends Service {
|
|||
// }
|
||||
// }
|
||||
// }
|
||||
// return weaTable;
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 可以删除的薪资项目列表
|
||||
*
|
||||
* @param searchParam 查询人员
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage4CanDelete(SalaryItemSearchParam searchParam) {
|
||||
// 查询所有薪资账套中的薪资项目副本
|
||||
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).list();
|
||||
// 被引用的薪资项目id
|
||||
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
// 排除被引用的薪资项目(被引用的薪资项目不可以删除)
|
||||
searchParam.setExcludeIds(salaryItemIds);
|
||||
// 转换成前端所需的数据格式
|
||||
Map<String, Object> map = listPage(searchParam);
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键id获取薪资项目详情
|
||||
*
|
||||
* @param ids 薪资项目的主键id
|
||||
* @return
|
||||
*/
|
||||
public List<SalaryItemListDTO> listByIds(Collection<Long> ids) {
|
||||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(ids);
|
||||
if (CollectionUtils.isEmpty(salaryItemPOS)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 查询公式详情
|
||||
Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId);
|
||||
// todo List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds);
|
||||
// 转换成薪资项目列表dto
|
||||
return SalaryItemBO.convert2ListDTO(salaryItemPOS, null);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 可以删除的薪资项目列表
|
||||
// *
|
||||
// * @param searchParam 查询人员
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public WeaTable<SalaryItemListDTO> listPage4CanDelete(SalaryItemSearchParam searchParam) {
|
||||
// // 查询所有薪资账套中的薪资项目副本
|
||||
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.list();
|
||||
// // 被引用的薪资项目id
|
||||
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
// // 排除被引用的薪资项目(被引用的薪资项目不可以删除)
|
||||
// searchParam.setExcludeIds(salaryItemIds);
|
||||
// // 转换成前端所需的数据格式
|
||||
// WeaTable<SalaryItemListDTO> weaTable = listPage(searchParam);
|
||||
// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX);
|
||||
// weaTable.setOperates(Collections.emptyList());
|
||||
// weaTable.setPageUid("canDeleteSalaryItemList");
|
||||
// return weaTable;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据主键id获取薪资项目详情
|
||||
// *
|
||||
// * @param ids 薪资项目的主键id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public List<SalaryItemListDTO> listByIds(Collection<Long> ids, String tenantKey) {
|
||||
// List<SalaryItemPO> salaryItemPOS = salaryItemService.listByIds(ids, tenantKey);
|
||||
// if (CollectionUtils.isEmpty(salaryItemPOS)) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// // 查询公式详情
|
||||
// Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId);
|
||||
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
|
||||
// // 转换成薪资项目列表dto
|
||||
// return SalaryItemBO.convert2ListDTO(salaryItemPOS, expressFormulas);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 薪资项目列表的高级搜索
|
||||
// *
|
||||
|
|
@ -134,56 +229,39 @@ public class SalaryItemWrapper extends Service {
|
|||
// searchCondition.getGroups().remove(1);
|
||||
// return searchCondition;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 薪资项目详情
|
||||
// *
|
||||
// * @param id 主键id
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public WeaForm getForm(Long id, Long employeeId, String tenantKey) {
|
||||
// SalaryItemFormDTO salaryItemFormDTO = new SalaryItemFormDTO();
|
||||
// // 默认可以编辑
|
||||
// salaryItemFormDTO.setCanEdit(NumberUtils.INTEGER_ONE);
|
||||
// if (!Objects.isNull(id)) {
|
||||
// // 查询薪资项目
|
||||
// SalaryItemPO salaryItemPO = salaryItemService.getById(id, tenantKey);
|
||||
// // 系统薪资项目
|
||||
// SysSalaryItemPO sysSalaryItemPO = sysSalaryItemService.getById(id);
|
||||
// if (Objects.isNull(salaryItemPO) && Objects.isNull(sysSalaryItemPO)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
// }
|
||||
// // 公式详情
|
||||
|
||||
/**
|
||||
* 薪资项目详情
|
||||
*
|
||||
* @param id 主键id
|
||||
* @return
|
||||
*/
|
||||
public SalaryItemFormDTO getForm(Long id) {
|
||||
SalaryItemFormDTO salaryItemFormDTO = new SalaryItemFormDTO();
|
||||
// 默认可以编辑
|
||||
salaryItemFormDTO.setCanEdit(NumberUtils.INTEGER_ONE);
|
||||
if (!Objects.isNull(id)) {
|
||||
// 查询薪资项目
|
||||
SalaryItemPO salaryItemPO = getSalaryItemService(user).getById(id);
|
||||
// 系统薪资项目
|
||||
SysSalaryItemPO sysSalaryItemPO = getSysSalaryItemService(user).getById(id);
|
||||
if (Objects.isNull(salaryItemPO) && Objects.isNull(sysSalaryItemPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
}
|
||||
//todo 公式详情
|
||||
// ExpressFormula expressFormula;
|
||||
// // 转换成薪资项目详情dto
|
||||
// if (Objects.isNull(salaryItemPO)) {
|
||||
// salaryItemFormDTO = SysSalaryItemBO.convert2FormDTO(sysSalaryItemPO);
|
||||
// expressFormula = salaryFormulaService.getExpressFormula(sysSalaryItemPO.getFormulaId(), tenantKey);
|
||||
// } else {
|
||||
// salaryItemFormDTO = SalaryItemBO.convert2FormDTO(salaryItemPO);
|
||||
// expressFormula = salaryFormulaService.getExpressFormula(salaryItemPO.getFormulaId(), tenantKey);
|
||||
// }
|
||||
if (Objects.isNull(salaryItemPO)) {
|
||||
salaryItemFormDTO = SysSalaryItemBO.convert2FormDTO(sysSalaryItemPO);
|
||||
// expressFormula = salaryFormulaService.getExpressFormula(sysSalaryItemPO.getFormulaId());
|
||||
} else {
|
||||
salaryItemFormDTO = SalaryItemBO.convert2FormDTO(salaryItemPO);
|
||||
// expressFormula = salaryFormulaService.getExpressFormula(salaryItemPO.getFormulaId());
|
||||
}
|
||||
// salaryItemFormDTO.setFormulaContent(Optional.ofNullable(expressFormula).map(ExpressFormula::getFormula).orElse(""));
|
||||
// }
|
||||
// // 转换成前端所需的数据格式
|
||||
// WeaForm weaForm = SalaryFormatUtil.<SalaryItemFormDTO>getInstance().buildForm(SalaryItemFormDTO.class, salaryItemFormDTO);
|
||||
// if (Objects.nonNull(id)) {
|
||||
// for (Map.Entry<String, WeaFormItem> entry : weaForm.getItems().entrySet()) {
|
||||
// // 取值方式是否可以编辑
|
||||
// if (("valueType".equals(entry.getKey()) || "useInEmployeeSalary".equals(entry.getKey()))
|
||||
// && Objects.equals(salaryItemFormDTO.getCanEdit(), NumberUtils.INTEGER_ZERO)) {
|
||||
// entry.getValue().setReadOnly(true);
|
||||
// }
|
||||
// // 属性"、"类型"不允许编辑
|
||||
// if ("category".equals(entry.getKey()) || "itemType".equals(entry.getKey())) {
|
||||
// entry.getValue().setReadOnly(true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return weaForm;
|
||||
// }
|
||||
}
|
||||
return salaryItemFormDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取薪资项目可选的类型(与属性有联动)
|
||||
|
|
@ -202,7 +280,8 @@ public class SalaryItemWrapper extends Service {
|
|||
* @param saveParam 保存参数
|
||||
*/
|
||||
public void save(SalaryItemSaveParam saveParam) {
|
||||
salaryItemService.save(saveParam);
|
||||
ValidUtil.doValidator(saveParam);
|
||||
getSalaryItemService(user).save(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -211,16 +290,15 @@ public class SalaryItemWrapper extends Service {
|
|||
* @param saveParam 更新参数
|
||||
*/
|
||||
public void update(SalaryItemSaveParam saveParam) {
|
||||
salaryItemService.update(saveParam);
|
||||
getSalaryItemService(user).update(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除薪资项目
|
||||
*
|
||||
* @param ids 主键id
|
||||
* @param tenantKey 租户key
|
||||
* @param ids 主键id
|
||||
*/
|
||||
public void delete(Collection<Long> ids, String tenantKey) {
|
||||
salaryItemService.deleteByIds(ids);
|
||||
public void delete(Collection<Long> ids) {
|
||||
getSalaryItemService(user).deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.service.SysSalaryItemService;
|
||||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.service.impl.SysSalaryItemServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 系统薪资项目
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Component
|
||||
public class SysSalaryItemWrapper extends Service {
|
||||
|
||||
|
||||
private SalaryItemService getSalaryItemService(User user) {
|
||||
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SysSalaryItemService getSysSalaryItemService(User user) {
|
||||
return (SysSalaryItemService) ServiceUtil.getService(SysSalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 系统薪资项目列表
|
||||
*
|
||||
* @param searchParam 高级搜索的查询条件
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage(SysSalaryItemSearchParam searchParam) {
|
||||
// 查询已经添加过的系统薪资项目(已经添加过的系统薪资项目不能二次添加)
|
||||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listBySystemType(SalarySystemTypeEnum.SYSTEM);
|
||||
Set<Long> sysSalaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getSysSalaryItemId);
|
||||
searchParam.setExcludeIds(sysSalaryItemIds);
|
||||
|
||||
|
||||
SalaryWeaTable<SysSalaryItemListDTO> table = new SalaryWeaTable<SysSalaryItemListDTO>(user, SysSalaryItemListDTO.class);
|
||||
table.setSqlwhere(makeSqlWhere(searchParam));
|
||||
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();
|
||||
}
|
||||
|
||||
private String makeSqlWhere(SysSalaryItemSearchParam searchParam) {
|
||||
|
||||
String sqlWhere = " t.delete_type = 0 ";
|
||||
|
||||
String name = searchParam.getName();
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
sqlWhere += " AND t.name = " + name;
|
||||
}
|
||||
|
||||
String itemType = searchParam.getItemType();
|
||||
if (StringUtils.isNotBlank(itemType)) {
|
||||
sqlWhere += " AND t.item_type = " + itemType;
|
||||
}
|
||||
|
||||
String category = searchParam.getCategory();
|
||||
if (StringUtils.isNotBlank(category)) {
|
||||
sqlWhere += " AND t.category = " + category;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取高级搜索
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public WeaSearchCondition getSearchCondition() {
|
||||
// WeaSearchCondition searchCondition = SalaryFormatUtil.<SysSalaryItemSearchConditionDTO>getInstance()
|
||||
// .buildCondition(SysSalaryItemSearchConditionDTO.class, new SysSalaryItemSearchConditionDTO(), "sysSalaryItemCondition");
|
||||
// // 其他条件不要
|
||||
// searchCondition.getGroups().remove(1);
|
||||
// return searchCondition;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 添加系统薪资项目到自定义薪资项目列表中
|
||||
*
|
||||
* @param ids 主键id
|
||||
*/
|
||||
public void add2SalaryItem(Collection<Long> ids) {
|
||||
getSysSalaryItemService(user).add2SalaryItem(ids);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package com.weaver.teams.domain.entity;
|
||||
|
||||
public class BaseEntity {
|
||||
}
|
||||
Loading…
Reference in New Issue