薪资账套

This commit is contained in:
钱涛 2022-03-25 18:05:07 +08:00
parent 24c50f7f17
commit 1db71a97ff
34 changed files with 2332 additions and 223 deletions

View File

@ -0,0 +1,44 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.mapper.salarysob.SalarySobAdjustRuleMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobAdjustRuleBiz {
public List<SalarySobAdjustRulePO> listBySalarySobId(Long salarySobId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobAdjustRuleMapper mapper = sqlSession.getMapper(SalarySobAdjustRuleMapper.class);
return mapper.listSome(SalarySobAdjustRulePO.builder().salarySobId(salarySobId).build());
} finally {
sqlSession.close();
}
}
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobAdjustRuleMapper mapper = sqlSession.getMapper(SalarySobAdjustRuleMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchInsert(Collection<SalarySobAdjustRulePO> salarySobAdjustRulePOS) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobAdjustRuleMapper mapper = sqlSession.getMapper(SalarySobAdjustRuleMapper.class);
mapper.batchInsert(salarySobAdjustRulePOS);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -5,6 +5,7 @@ import com.engine.salary.mapper.salarysob.SalarySobMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobBiz {
@ -61,4 +62,15 @@ public class SalarySobBiz {
}
}
public void deleteByIds(Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
mapper.deleteByIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,88 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.mapper.salarysob.SalarySobCheckRuleMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobCheckRuleBiz {
public SalarySobCheckRulePO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
public List<SalarySobCheckRulePO> listSome(SalarySobCheckRulePO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
public void deleteByIds(Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.deleteByIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateById(SalarySobCheckRulePO newSalarySobCheckRulePO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.updateIgnoreNull(newSalarySobCheckRulePO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchInsert(Collection<SalarySobCheckRulePO> salarySobCheckRulePOS) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.batchInsert(salarySobCheckRulePOS);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void insert(SalarySobCheckRulePO salarySobCheckRulePO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.insertIgnoreNull(salarySobCheckRulePO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,23 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobDefaultItemGroupPO;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.mapper.salarysob.SalarySobDefaultItemGroupMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalarySobDefaultItemGroupBiz {
public List<SalarySobDefaultItemGroupPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobDefaultItemGroupMapper mapper = sqlSession.getMapper(SalarySobDefaultItemGroupMapper.class);
return mapper.listSome(SalarySobDefaultItemGroupPO.builder().incomeCategory(incomeCategory.getValue()).build());
} finally {
sqlSession.close();
}
}
}

View File

@ -1,6 +1,8 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobDefaultEmpFieldPO;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
import com.engine.salary.mapper.salarysob.SalarySobDefaultEmpFieldMapper;
import com.engine.salary.mapper.salarysob.SalarySobEmpFieldMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
@ -44,4 +46,20 @@ public class SalarySobEmpFieldBiz {
sqlSession.close();
}
}
//---------------------------系统默认员工信息字段-----------------------------------
public List<SalarySobDefaultEmpFieldPO> listDefaultEmpField() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobDefaultEmpFieldMapper mapper = sqlSession.getMapper(SalarySobDefaultEmpFieldMapper.class);
return mapper.listAll();
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,99 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalaryItemBaseDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobAdjustRuleListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobAdjustRuleSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.util.SalaryEntityUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 调薪规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobAdjustRuleBO {
/**
* 调薪计薪规则po转换成调薪计薪规则列表dto
*
* @param salarySobAdjustRules 调薪计薪规则po
* @param salaryItems 薪资项目po
* @return
*/
public static List<SalarySobAdjustRuleListDTO> convert2ListDTO(List<SalarySobAdjustRulePO> salarySobAdjustRules, List<SalaryItemPO> salaryItems) {
if (CollectionUtils.isEmpty(salarySobAdjustRules)) {
return Collections.emptyList();
}
// key薪资项目idvalue薪资项目的名称
Map<Long, String> salaryItemNameMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId, SalaryItemPO::getName);
return salarySobAdjustRules.stream()
.map(e -> SalarySobAdjustRuleListDTO.builder()
.id(e.getId())
.salaryItemId(e.getSalaryItemId())
.salaryItemName(salaryItemNameMap.getOrDefault(e.getSalaryItemId(), ""))
.dayOfMonth(e.getDayOfMonth())
.beforeAdjustmentType(e.getBeforeAdjustmentType())
.afterAdjustmentType(e.getAfterAdjustmentType())
.build())
.collect(Collectors.toList());
}
/**
* 转换成调薪计薪规则可选的薪资项目dto
* 只有开启了"薪资档案引用"的薪资项目才可选
*
* @param salaryItems 薪资项目po
* @return
*/
public static List<SalaryItemBaseDTO> convertItemBaseDTO(List<SalaryItemPO> salaryItems) {
if (CollectionUtils.isEmpty(salaryItems)) {
return Collections.emptyList();
}
// 过滤开启了"薪资档案引用"的薪资项目
return salaryItems.stream()
.filter(salaryItemPO -> Objects.equals(salaryItemPO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE))
.map(salaryItemPO -> new SalaryItemBaseDTO()
.setSalaryItemId(salaryItemPO.getId())
.setSalaryItemName(salaryItemPO.getName()))
.collect(Collectors.toList());
}
/**
* 保存参数转换成薪资账套的调薪计薪规则po
*
* @param saveParam 保存参数
* @param employeeId 人员id
* @return
*/
public static List<SalarySobAdjustRulePO> convert2PO(SalarySobAdjustRuleSaveParam saveParam, Long employeeId) {
if (CollectionUtils.isEmpty(saveParam.getRuleParams())) {
return Collections.emptyList();
}
Date now = new Date();
return saveParam.getRuleParams().stream()
.map(ruleParam -> new SalarySobAdjustRulePO()
// .setId(IdGenerator.generate())
.setSalarySobId(saveParam.getSalarySobId())
.setSalaryItemId(ruleParam.getSalaryItemId())
.setDayOfMonth(ruleParam.getDayOfMonth())
.setBeforeAdjustmentType(ruleParam.getBeforeAdjustmentType())
.setAfterAdjustmentType(ruleParam.getAfterAdjustmentType())
.setCreator(employeeId)
.setCreateTime(now)
.setUpdateTime(now)
.setDeleteType(NumberUtils.INTEGER_ZERO)
.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
).collect(Collectors.toList());
}
}

View File

@ -0,0 +1,95 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资账套的校验规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobCheckRuleBO {
/**
* 保存参数转换成薪资账套的校验规则po
*
* @param saveParam 保存参数
* @param employeeId 人员id
* @return
*/
public static SalarySobCheckRulePO convert2PO(SalarySobCheckRuleSaveParam saveParam, Long employeeId) {
if (Objects.isNull(saveParam)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, " 参数错误"));
}
Date now = new Date();
return SalarySobCheckRulePO.builder()
// .id(IdGenerator.generate())
.salarySobId(saveParam.getSalarySobId())
.name(saveParam.getName())
.formulaId(saveParam.getFormulaId())
.description(saveParam.getDescription())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.deleteType(NumberUtils.INTEGER_ZERO)
.build();
}
/**
* 薪资账套的校验规则po转换成校验规则列表dto
*
* @param salarySobCheckRulePOS 薪资账套的校验规则po
* @param expressFormulas 公式详情
* @return
*/
public static List<SalarySobCheckRuleListDTO> convert2ListDTO(List<SalarySobCheckRulePO> salarySobCheckRulePOS, List<ExpressFormula> expressFormulas) {
if (CollectionUtils.isEmpty(salarySobCheckRulePOS)) {
return Collections.emptyList();
}
// key:公式idvalue:公式详情
Map<Long, String> formulaMap = SalaryEntityUtil.convert2Map(expressFormulas, ExpressFormula::getId, ExpressFormula::getFormula);
return salarySobCheckRulePOS.stream()
.map(salarySobCheckRulePO -> new SalarySobCheckRuleListDTO()
.setId(salarySobCheckRulePO.getId())
.setName(salarySobCheckRulePO.getName())
.setSalarySobId(salarySobCheckRulePO.getSalarySobId())
.setFormulaId(salarySobCheckRulePO.getFormulaId())
.setFormulaContent(formulaMap.getOrDefault(salarySobCheckRulePO.getFormulaId(), StringUtils.EMPTY))
.setDescription(salarySobCheckRulePO.getDescription())
).collect(Collectors.toList());
}
/**
* 转换成校验规则详情dto
*
* @param salarySobCheckRulePO 校验规则po
* @param expressFormula 公式详情
* @return
*/
public static SalarySobCheckRuleFormDTO convert2FormDTO(SalarySobCheckRulePO salarySobCheckRulePO, ExpressFormula expressFormula) {
return new SalarySobCheckRuleFormDTO()
.setId(salarySobCheckRulePO.getId())
.setName(salarySobCheckRulePO.getName())
.setSalarySobId(salarySobCheckRulePO.getSalarySobId())
.setFormulaId(salarySobCheckRulePO.getFormulaId())
.setFormulaContent(Optional.ofNullable(expressFormula).map(ExpressFormula::getFormula).orElse(StringUtils.EMPTY))
.setDescription(salarySobCheckRulePO.getDescription());
}
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.util.SalaryEntityUtil;
@ -33,10 +34,9 @@ public class SalarySobItemBO {
* @param salarySobId 薪资账套id
* @param defaultEmpFieldList 默认包含的员工信息字段
* @param employeeId 当前登陆人员id
* @param tenantKey 当前登陆人员的租户key
* @return
*/
public static List<SalarySobEmpFieldPO> convert2EmpFieldPO(Long salarySobId, List<SalarySobDefaultEmpFieldPO> defaultEmpFieldList, Long employeeId, String tenantKey) {
public static List<SalarySobEmpFieldPO> convert2EmpFieldPO(Long salarySobId, List<SalarySobDefaultEmpFieldPO> defaultEmpFieldList, Long employeeId) {
Date now = new Date();
return defaultEmpFieldList.stream()
.map(field -> new SalarySobEmpFieldPO()
@ -49,7 +49,7 @@ public class SalarySobItemBO {
.setCreateTime(now)
.setUpdateTime(now)
.setDeleteType(0)
.setTenantKey(tenantKey))
.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY))
.collect(Collectors.toList());
}
@ -98,6 +98,7 @@ public class SalarySobItemBO {
.collect(Collectors.toMap(SalaryItemPO::getSysSalaryItemId, Function.identity(), (a, b) -> a));
for (SalarySobDefaultItemPO salarySobDefaultItemPO : salarySobDefaultItemPOS) {
SalaryItemPO salaryItemPO = salaryItemPOMap.get(salarySobDefaultItemPO.getSysSalaryItemId());
if (salaryItemPO==null)continue;
salarySobItems.add(SalarySobItemPO.builder()
// .id(IdGenerator.generate())
.salarySobId(salarySobId)

View File

@ -0,0 +1,26 @@
package com.engine.salary.entity.salarysob.dto;
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 SalaryItemBaseDTO {
//薪资项目id
private Long salaryItemId;
//薪资项目名称
private String salaryItemName;
}

View File

@ -0,0 +1,48 @@
package com.engine.salary.entity.salarysob.dto;
import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 调薪规则列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobAdjustRuleListDTO {
//主键id
private Long id;
//薪资项目的id
private Long salaryItemId;
//薪资项目的名称
private String salaryItemName;
//生效日期
private Integer dayOfMonth;
/**
* 在生效日期之前调薪如何调整
*
* @see SalarySobAdjustRuleTypeEnum
*/
private Integer beforeAdjustmentType;
/**
* 在生效日期之后调薪如何调整
*
* @see SalarySobAdjustRuleTypeEnum
*/
private Integer afterAdjustmentType;
}

View File

@ -0,0 +1,53 @@
package com.engine.salary.entity.salarysob.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* 薪资账套校验规则表单
*/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobCheckRuleFormDTO {
//主键id")
private Long id;
//薪资账套id")
// @NotNull(message = "薪资账套id不允许为空")
private Long salarySobId;
// @SalaryForm(
// label = "规则名称",
// labelId = 100173,
// items = @SalaryFormItem(itemType = WeaFormItemType.INPUT, required = true, maxLength = "15")
// )
//规则名称")
// @NotEmpty(message = "规则名称不允许为空")
private String name;
//公式id")
// @NotNull(message = "校验规则不允许为空")
// @Positive(message = "校验规则不允许为空")
private Long formulaId;
// @SalaryForm(
// label = "校验规则",
// labelId = 86126,
// items = @SalaryFormItem(itemType = WeaFormItemType.INPUT, required = true)
// )
//校验规则")
private String formulaContent;
// @SalaryForm(
// label = "备注",
// labelId = 84961,
// items = @SalaryFormItem(itemType = WeaFormItemType.INPUT, maxLength = "20")
// )
//备注")
private String description;
}

View File

@ -0,0 +1,47 @@
package com.engine.salary.entity.salarysob.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
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
@SalaryTable(pageId = "a4f85287-e3f9-4d11-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX, operates = {
@SalaryTableOperate(index = "0", text = "编辑"),
@SalaryTableOperate(index = "1", text = "删除"),
})
public class SalarySobCheckRuleListDTO {
//主键id
private Long id;
//薪资账套id
private Long salarySobId;
@SalaryTableColumn(text = "名称", width = "10%", column = "name")
private String name;
//公式id
private Long formulaId;
@SalaryTableColumn(text = "校验规则", width = "10%", column = "formulaContent")
private String formulaContent;
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
private String description;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -18,10 +19,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class SalarySobAdjustRuleQueryParam {
/**
* 薪资账套的ID不允许为空
*/
// //@NotNull(message = "LABEL:86575")
// //薪资账套的id")
@DataCheck(require = true, message = "薪资账套的ID不允许为空")
private Long salarySobId;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -21,14 +22,11 @@ import java.util.List;
@AllArgsConstructor
public class SalarySobAdjustRuleSaveParam {
/**
* 薪资账套的ID不允许为空
*/
// //@NotNull(message = "LABEL:86575")
// //薪资账套的id")
//薪资账套的id
@DataCheck(require = true, message = "薪资账套的ID不允许为空")
private Long salarySobId;
//规则参数")
//规则参数
private List<RuleParam> ruleParams;
@Data
@ -37,16 +35,24 @@ public class SalarySobAdjustRuleSaveParam {
@AllArgsConstructor
public static class RuleParam {
//薪资项目的id")
//薪资项目的id
private Long salaryItemId;
//生效日期")
//生效日期
private Integer dayOfMonth;
//在生效日期之前调薪如何调整")
private SalarySobAdjustRuleTypeEnum beforeAdjustmentType;
/**
* 在生效日期之前调薪如何调整
*
* @see SalarySobAdjustRuleTypeEnum
*/
private Integer beforeAdjustmentType;
//在生效日期之后调薪如何调整")
private SalarySobAdjustRuleTypeEnum afterAdjustmentType;
/**
* 在生效日期之后调薪如何调整
*
* @see SalarySobAdjustRuleTypeEnum
*/
private Integer afterAdjustmentType;
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.salarysob.po;
import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@ -21,6 +22,7 @@ import java.util.Date;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
//hrsa_salary_sob_adjust_rule
public class SalarySobAdjustRulePO {

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salarysob.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@ -17,6 +18,7 @@ import java.util.Date;
* @version 1.0
**/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor

View File

@ -12,6 +12,9 @@ alter table hrsa_salary_item modify id bigint auto_increment;
alter table hrsa_salary_sob modify id bigint auto_increment;
alter table hrsa_salary_sob_range modify id bigint auto_increment;
alter table hrsa_salary_sob_item_group modify id bigint auto_increment;
alter table hrsa_salary_sob_emp_field modify id bigint auto_increment;
alter table hrsa_salary_sob_adjust_rule modify id bigint auto_increment;
--

View File

@ -0,0 +1,82 @@
package com.engine.salary.mapper.salarysob;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface SalarySobAdjustRuleMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalarySobAdjustRulePO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalarySobAdjustRulePO> listSome(SalarySobAdjustRulePO salarySobAdjustRule);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalarySobAdjustRulePO getById(Long id);
/**
* 新增忽略null字段
*
* @param salarySobAdjustRule 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalarySobAdjustRulePO salarySobAdjustRule);
/**
* 修改修改所有字段
*
* @param salarySobAdjustRule 修改的记录
* @return 返回影响行数
*/
int update(SalarySobAdjustRulePO salarySobAdjustRule);
/**
* 修改忽略null字段
*
* @param salarySobAdjustRule 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalarySobAdjustRulePO salarySobAdjustRule);
/**
* 删除记录
*
* @param salarySobAdjustRule 待删除的记录
* @return 返回影响行数
*/
int delete(SalarySobAdjustRulePO salarySobAdjustRule);
/**
* 批量插入
*
* @param salaryAdjustmentRules
*/
void batchInsert(@Param("collection") Collection<SalarySobAdjustRulePO> salaryAdjustmentRules);
/**
* 根据账套id批量删除
*
* @param salarySobIds
*/
void deleteBySalarySobIds(@Param("salarySobIds") Collection<Long> salarySobIds);
}

View File

@ -0,0 +1,321 @@
<?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.SalarySobAdjustRuleMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO">
<result column="id" property="id"/>
<result column="salary_sob_id" property="salarySobId"/>
<result column="salary_item_id" property="salaryItemId"/>
<result column="day_of_month" property="dayOfMonth"/>
<result column="before_adjustment_type" property="beforeAdjustmentType"/>
<result column="after_adjustment_type" property="afterAdjustmentType"/>
<result column="creator" property="creator"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.salary_sob_id
, t.salary_item_id
, t.day_of_month
, t.before_adjustment_type
, t.after_adjustment_type
, t.creator
, t.create_time
, t.update_time
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_adjust_rule t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_adjust_rule t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_adjust_rule t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="salaryItemId != null">
AND salary_item_id = #{salaryItemId}
</if>
<if test="dayOfMonth != null">
AND day_of_month = #{dayOfMonth}
</if>
<if test="beforeAdjustmentType != null">
AND before_adjustment_type = #{beforeAdjustmentType}
</if>
<if test="afterAdjustmentType != null">
AND after_adjustment_type = #{afterAdjustmentType}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="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.SalarySobAdjustRulePO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_salary_sob_adjust_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="salarySobId != null">
salary_sob_id,
</if>
<if test="salaryItemId != null">
salary_item_id,
</if>
<if test="dayOfMonth != null">
day_of_month,
</if>
<if test="beforeAdjustmentType != null">
before_adjustment_type,
</if>
<if test="afterAdjustmentType != null">
after_adjustment_type,
</if>
<if test="creator != null">
creator,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="salarySobId != null">
#{salarySobId},
</if>
<if test="salaryItemId != null">
#{salaryItemId},
</if>
<if test="dayOfMonth != null">
#{dayOfMonth},
</if>
<if test="beforeAdjustmentType != null">
#{beforeAdjustmentType},
</if>
<if test="afterAdjustmentType != null">
#{afterAdjustmentType},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO">
UPDATE hrsa_salary_sob_adjust_rule
<set>
salary_sob_id=#{salarySobId},
salary_item_id=#{salaryItemId},
day_of_month=#{dayOfMonth},
before_adjustment_type=#{beforeAdjustmentType},
after_adjustment_type=#{afterAdjustmentType},
creator=#{creator},
create_time=#{createTime},
update_time=#{updateTime},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO">
UPDATE hrsa_salary_sob_adjust_rule
<set>
<if test="salarySobId != null">
salary_sob_id=#{salarySobId},
</if>
<if test="salaryItemId != null">
salary_item_id=#{salaryItemId},
</if>
<if test="dayOfMonth != null">
day_of_month=#{dayOfMonth},
</if>
<if test="beforeAdjustmentType != null">
before_adjustment_type=#{beforeAdjustmentType},
</if>
<if test="afterAdjustmentType != null">
after_adjustment_type=#{afterAdjustmentType},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO">
UPDATE hrsa_salary_sob_adjust_rule
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_adjust_rule
( salary_sob_id, salary_item_id, day_of_month,
before_adjustment_type, after_adjustment_type, creator, create_time, update_time,
delete_type, tenant_key)
VALUES
<foreach collection="collection" separator="," item="item">
(
#{item.salarySobId},
#{item.salaryItemId},
#{item.dayOfMonth},
#{item.beforeAdjustmentType},
#{item.afterAdjustmentType},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_adjust_rule
( salary_sob_id, salary_item_id, day_of_month,
before_adjustment_type, after_adjustment_type, creator, create_time, update_time,
delete_type, tenant_key)
<foreach collection="collection" separator="union all" item="item">
select
#{item.salarySobId},
#{item.salaryItemId},
#{item.dayOfMonth},
#{item.beforeAdjustmentType},
#{item.afterAdjustmentType},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
INSERT INTO hrsa_salary_sob_adjust_rule
(salary_sob_id, salary_item_id, day_of_month,
before_adjustment_type, after_adjustment_type, creator, create_time, update_time,
delete_type, tenant_key)
VALUES
<foreach collection="collection" separator="," item="item">
(
#{item.salarySobId},
#{item.salaryItemId},
#{item.dayOfMonth},
#{item.beforeAdjustmentType},
#{item.afterAdjustmentType},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<update id="deleteBySalarySobIds">
UPDATE hrsa_salary_sob_adjust_rule
SET delete_type = 1
WHERE delete_type = 0
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,87 @@
package com.engine.salary.mapper.salarysob;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface SalarySobCheckRuleMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalarySobCheckRulePO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalarySobCheckRulePO> listSome(SalarySobCheckRulePO salarySobCheckRule);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalarySobCheckRulePO getById(Long id);
/**
* 新增忽略null字段
*
* @param salarySobCheckRule 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalarySobCheckRulePO salarySobCheckRule);
/**
* 修改修改所有字段
*
* @param salarySobCheckRule 修改的记录
* @return 返回影响行数
*/
int update(SalarySobCheckRulePO salarySobCheckRule);
/**
* 修改忽略null字段
*
* @param salarySobCheckRule 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalarySobCheckRulePO salarySobCheckRule);
/**
* 删除记录
*
* @param salarySobCheckRule 待删除的记录
* @return 返回影响行数
*/
int delete(SalarySobCheckRulePO salarySobCheckRule);
/**
* 根据主键id删除
*
* @param ids
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
/**
* 根据薪资账套id删除
*
* @param salarySobIds
*/
void deleteBySalarySobIds(@Param("salarySobIds") Collection<Long> salarySobIds);
/**
* 批量保存
*
* @param salarySobCheckRules
*/
void batchInsert(@Param("collection") Collection<SalarySobCheckRulePO> salarySobCheckRules);
}

View File

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

View File

@ -0,0 +1,47 @@
package com.engine.salary.service;
import com.engine.salary.entity.salarysob.param.SalarySobAdjustRuleSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import java.util.Collection;
import java.util.List;
/**
* 调薪计薪规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobAdjustRuleService {
/**
* 根据薪资账套id查询薪资账套的调薪计薪规则
*
* @param salarySobId 薪资账套id
* @return
*/
List<SalarySobAdjustRulePO> listBySalarySobId(Long salarySobId);
/**
* 保存调薪计薪酬规则
*
* @param saveParam
*/
void save(SalarySobAdjustRuleSaveParam saveParam);
/**
* 批量保存
*
* @param salarySobAdjustRulePOS 薪资账套的调薪计薪规则
*/
void batchSave(Collection<SalarySobAdjustRulePO> salarySobAdjustRulePOS);
/**
* 根据薪资账套id删除调薪计薪酬规则
*
* @param salarySobIds 薪资账套id
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -0,0 +1,102 @@
package com.engine.salary.service;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.param.UpdateCheckRuleFormulaParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import java.util.Collection;
import java.util.List;
/**
* 薪资账套的校验规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobCheckRuleService {
/**
* 根据主键id获取单个薪资账套的校验规则
*
* @param id 主键id
* @return
*/
SalarySobCheckRulePO getById(Long id);
/**
* 根据主键id查询薪资账套的校验规则
*
* @param ids 主键id
* @return
*/
List<SalarySobCheckRulePO> listByIds(Collection<Long> ids);
/**
* 根据薪资账套id查询薪资账套的校验规则
*
* @param salarySobId 薪资账套的id
* @return
*/
List<SalarySobCheckRulePO> listBySalarySobId(Long salarySobId);
/**
* 根据薪资账套id名称精确匹配查询薪资账套的校验规则
*
* @param salarySobId 薪资账套的id
* @param name 名称
* @return
*/
List<SalarySobCheckRulePO> listBySalarySobIdAndName(Long salarySobId, String name);
/**
* 根据列表搜索条件查询薪资账套的校验规则分页
*
* @param queryParam 搜索条件
* @return
*/
// Page<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam queryParam);
/**
* 保存
*
* @param saveParam 保存
*/
void save(SalarySobCheckRuleSaveParam saveParam);
/**
* 批量保存
*
* @param salarySobCheckRulePOS 薪资账套的校验规则
*/
void batchSave(Collection<SalarySobCheckRulePO> salarySobCheckRulePOS);
/**
* 更新
*
* @param updateParam 更新参数
*/
void update(SalarySobCheckRuleSaveParam updateParam);
/**
* 更新校验规则的公式
*
* @param updateParam 更新参数
*/
void updateFormulaId(UpdateCheckRuleFormulaParam updateParam);
/**
* 根据主键id删除薪资账套的校验规则
*
* @param ids 主键id
*/
void deleteByIds(Collection<Long> ids);
/**
* 根据薪资账套id删除薪资账套的校验规则
*
* @param salarySobIds 薪资账套id
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -9,10 +9,10 @@ package com.engine.salary.service;
*/
public interface SalarySobDefaultEmpFieldService {
/**
* 获取所有的薪资账套默认的员工信息字段
*
* @return
*/
// /**
// * 获取所有的薪资账套默认的员工信息字段
// *
// * @return
// */
// List<SalarySobDefaultEmpFieldPO> list();
}

View File

@ -0,0 +1,85 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobAdjustRuleBiz;
import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.entity.salarysob.bo.SalarySobAdjustRuleBO;
import com.engine.salary.entity.salarysob.param.SalarySobAdjustRuleSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalarySobAdjustRuleService;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* 调薪计薪规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobAdjustRuleServiceImpl extends Service implements SalarySobAdjustRuleService {
private SalarySobBiz salarySobBiz = new SalarySobBiz();
private SalarySobAdjustRuleBiz salarySobAdjustRuleMapper = new SalarySobAdjustRuleBiz();
// private LoggerTemplate salarySobLoggerTemplate;
@Override
public List<SalarySobAdjustRulePO> listBySalarySobId(Long salarySobId) {
if (salarySobId == null) {
return Collections.emptyList();
}
return salarySobAdjustRuleMapper.listBySalarySobId(salarySobId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(SalarySobAdjustRuleSaveParam saveParam) {
ValidUtil.doValidator(saveParam);
// 查询薪资账套
SalarySobPO salarySobPO = salarySobBiz.getById(saveParam.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 删除之前的调薪计薪规则
salarySobAdjustRuleMapper.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId()));
// 保存参数转换成薪资账套的调薪计薪规则po
List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = SalarySobAdjustRuleBO.convert2PO(saveParam, (long) user.getUID());
// 保存
if (CollectionUtils.isNotEmpty(salarySobAdjustRulePOS)) {
salarySobAdjustRuleMapper.batchInsert(salarySobAdjustRulePOS);
}
// 记录日志
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId(String.valueOf(salarySobPO.getId()));
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98614, "保存调薪计薪规则"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98614, "保存调薪计薪规则"));
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public void batchSave(Collection<SalarySobAdjustRulePO> salarySobAdjustRulePOS) {
salarySobAdjustRuleMapper.batchInsert(salarySobAdjustRulePOS);
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobAdjustRuleMapper.deleteBySalarySobIds(salarySobIds);
}
}

View File

@ -0,0 +1,191 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobCheckRuleBiz;
import com.engine.salary.entity.salarysob.bo.SalarySobCheckRuleBO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.param.UpdateCheckRuleFormulaParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalarySobCheckRuleService;
import com.engine.salary.service.SalarySobService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import weaver.hrm.User;
import java.util.*;
/**
* 薪资账套的校验规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobCheckRuleServiceImpl extends Service implements SalarySobCheckRuleService {
private SalarySobCheckRuleBiz salarySobCheckRuleMapper;
private SalarySobService getSalarySobService(User user) {
return (SalarySobService) ServiceUtil.getService(AttendQuoteFieldSettingServiceImpl.class, user);
}
// private LoggerTemplate salarySobLoggerTemplate;
@Override
public SalarySobCheckRulePO getById(Long id) {
return salarySobCheckRuleMapper.getById(id);
}
@Override
public List<SalarySobCheckRulePO> listByIds(Collection<Long> ids) {
return salarySobCheckRuleMapper.listSome(SalarySobCheckRulePO.builder().ids(ids).build());
}
@Override
public List<SalarySobCheckRulePO> listBySalarySobId(Long salarySobId) {
return salarySobCheckRuleMapper.listSome(SalarySobCheckRulePO.builder().salarySobId(salarySobId).build());
}
@Override
public List<SalarySobCheckRulePO> listBySalarySobIdAndName(Long salarySobId, String name) {
return salarySobCheckRuleMapper.listSome(SalarySobCheckRulePO.builder().salarySobId(salarySobId).name(name).build());
}
// @Override
// public Page<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam queryParam) {
// // 分页参数
// Page<SalarySobCheckRulePO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// // 查询薪资账套的校验规则
// return new LambdaQueryChainWrapper<>(salarySobCheckRuleMapper)
// .eq(SalarySobCheckRulePO::getTenantKey, tenantKey)
// .eq(SalarySobCheckRulePO::getDeleteType, 0)
// .eq(SalarySobCheckRulePO::getSalarySobId, queryParam.getSalarySobId())
// .like(SalaryEntityUtil.isNotNullOrEmpty(queryParam.getName()), SalarySobCheckRulePO::getName, queryParam.getName())
// .orderByDesc(SalarySobCheckRulePO::getId)
// .page(page);
// }
@Override
public void save(SalarySobCheckRuleSaveParam saveParam) {
// 查询薪资账套的校验规则
List<SalarySobCheckRulePO> salarySobCheckRulePOS = listBySalarySobIdAndName(saveParam.getSalarySobId(), saveParam.getName());
if (CollectionUtils.isNotEmpty(salarySobCheckRulePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98629, "名称已经存在"));
}
// 查询薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 保存参数转换成薪资账套的校验规则po
SalarySobCheckRulePO salarySobCheckRulePO = SalarySobCheckRuleBO.convert2PO(saveParam, (long) user.getUID());
// 保存
salarySobCheckRuleMapper.insert(salarySobCheckRulePO);
//todo 记录日志
// LoggerContext<SalarySobCheckRulePO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(93872, "添加校验规则"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(93872, "添加校验规则") + ": " + salarySobCheckRulePO.getName());
// loggerContext.setNewValues(salarySobCheckRulePO);
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public void batchSave(Collection<SalarySobCheckRulePO> salarySobCheckRulePOS) {
salarySobCheckRuleMapper.batchInsert(salarySobCheckRulePOS);
}
@Override
public void update(SalarySobCheckRuleSaveParam updateParam) {
// 名称不允许重复
List<SalarySobCheckRulePO> salarySobCheckRulePOS = listBySalarySobIdAndName(updateParam.getSalarySobId(), updateParam.getName());
boolean nameExist = salarySobCheckRulePOS.stream().anyMatch(salarySobCheckRulePO -> !Objects.equals(salarySobCheckRulePO.getId(), updateParam.getId()));
if (nameExist) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98629, "名称已经存在"));
}
// 查询薪资账套的校验规则
SalarySobCheckRulePO salarySobCheckRulePO = getById(updateParam.getId());
if (Objects.isNull(salarySobCheckRulePO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98636, "校验规则不存在或者已被删除"));
}
// 查询薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(updateParam.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 更新
SalarySobCheckRulePO newSalarySobCheckRulePO = new SalarySobCheckRulePO();
BeanUtils.copyProperties(salarySobCheckRulePO, newSalarySobCheckRulePO);
newSalarySobCheckRulePO.setName(updateParam.getName());
newSalarySobCheckRulePO.setFormulaId(updateParam.getFormulaId());
newSalarySobCheckRulePO.setUpdateTime(new Date());
salarySobCheckRuleMapper.updateById(newSalarySobCheckRulePO);
//todo 记录日志
// LoggerContext<SalarySobCheckRulePO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(93870, "编辑校验规则"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(93870, "编辑校验规则") + ": " + newSalarySobCheckRulePO.getName());
// loggerContext.setOldValues(salarySobCheckRulePO);
// loggerContext.setNewValues(newSalarySobCheckRulePO);
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public void updateFormulaId(UpdateCheckRuleFormulaParam updateParam) {
// 查询薪资账套的校验规则
SalarySobCheckRulePO salarySobCheckRulePO = getById(updateParam.getId());
if (Objects.isNull(salarySobCheckRulePO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98636, "校验规则不存在或者已被删除"));
}
// 更新
SalarySobCheckRuleSaveParam salarySobCheckRuleSaveParam = new SalarySobCheckRuleSaveParam()
.setId(updateParam.getId())
.setName(salarySobCheckRulePO.getName())
.setSalarySobId(salarySobCheckRulePO.getSalarySobId())
.setFormulaId(updateParam.getFormulaId())
.setDescription(salarySobCheckRulePO.getDescription());
update(salarySobCheckRuleSaveParam);
}
@Override
public void deleteByIds(Collection<Long> ids) {
// 查询薪资账套的校验规则
List<SalarySobCheckRulePO> salarySobCheckRulePOS = listByIds(ids);
if (CollectionUtils.isEmpty(salarySobCheckRulePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98636, "校验规则不存在或者已被删除"));
}
// 删除薪资账套的考验规则
ids = SalaryEntityUtil.properties(salarySobCheckRulePOS, SalarySobCheckRulePO::getId);
salarySobCheckRuleMapper.deleteByIds(ids);
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobCheckRulePOS, SalarySobCheckRulePO::getSalarySobId);
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByIds(salarySobIds);
// 将薪资账套list转换成map
Map<Long, SalarySobPO> salarySobPOMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getId);
//todo 记录日志
// salarySobCheckRulePOS.forEach(salarySobCheckRulePO -> {
// SalarySobPO salarySobPO = salarySobPOMap.get(salarySobCheckRulePO.getSalarySobId());
// LoggerContext<SalarySobCheckRulePO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98646, "删除校验规则"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98646, "删除校验规则") + ": " + salarySobCheckRulePO.getName());
// loggerContext.setOldValues(salarySobCheckRulePO);
// salarySobLoggerTemplate.write(loggerContext);
// });
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobCheckRuleMapper.deleteBySalarySobIds(salarySobIds);
}
}

View File

@ -8,7 +8,6 @@ import com.engine.salary.biz.SalarySobItemGroupBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemSaveBO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO;
@ -122,16 +121,48 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
@Override
public void save(SalarySobItemSaveParam saveParam) {
long employeeId = (long)user.getUID();
Date now = new Date();
Long salarySobId = saveParam.getSalarySobId();
// 查询薪资账套
// 校验
validSaveParam(salarySobId);
//清除原数据
cleanOldData(salarySobId);
//保存
saveSobItem(saveParam);
//todo 记录日志
// 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);
}
/**
* 校验
* @param salarySobId
*/
private void validSaveParam(Long salarySobId) {
//1账套存在
SalarySobPO salarySobPO = salarySobBiz.getById(salarySobId);
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// todo 2分类名称唯一
}
/**
* 清楚原相关数据
* @param salarySobId
*/
private void cleanOldData(Long salarySobId) {
//todo
// 删除薪资账套的员工信息字段
getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
@ -139,17 +170,39 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
deleteBySalarySobIds(Collections.singleton(salarySobId));
// 删除薪资账套的薪资项目分类
getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
}
/**
* 保存项目信息
* @param saveParam
*/
private void saveSobItem(SalarySobItemSaveParam saveParam) {
long employeeId = (long) user.getUID();
Date now = new Date();
Long salarySobId = saveParam.getSalarySobId();
// 处理保存参数
SalarySobItemSaveBO.Result result = SalarySobItemSaveBO.handle(saveParam,(long)user.getUID());
// 保存薪资账套的员工信息字段
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobEmpFields())) {
// getSalarySobEmpFieldService(user).batchSave(result.getNeedInsertSalarySobEmpFields());
Collection<SalarySobEmpFieldPO> needInsertSalarySobEmpFields = new ArrayList<>();
for (SalarySobItemSaveParam.SalarySobEmpFieldParam salarySobEmpFieldParam : saveParam.getEmpFields()) {
SalarySobEmpFieldPO salarySobEmpFieldPO = SalarySobEmpFieldPO.builder()
// .id(IdGenerator.generate())
.salarySobId(saveParam.getSalarySobId())
.fieldCode(salarySobEmpFieldParam.getFieldId())
.sortedIndex(salarySobEmpFieldParam.getSortedIndex())
.canDelete(NumberUtils.INTEGER_ONE)
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
needInsertSalarySobEmpFields.add(salarySobEmpFieldPO);
}
getSalarySobEmpFieldService(user).batchSave(needInsertSalarySobEmpFields);
Collection<SalarySobItemPO> salarySobItems = new ArrayList<>();
//先保存项目分类获取分类id
//先保存项目分类获取分类id
Collection<SalarySobItemPO> salarySobItems = new ArrayList<>();
int sortedIndex = 0;
for (SalarySobItemSaveParam.SalarySobItemGroupParam itemGroupParam : saveParam.getItemGroups()) {
SalarySobItemGroupPO salarySobItemGroupPO = SalarySobItemGroupPO.builder()
@ -163,7 +216,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
//保存分类
salarySobItemGroupBiz.insert(salarySobItemGroupPO);
//获取分类id
List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupBiz.listSome(SalarySobItemGroupPO.builder().salarySobId(salarySobId).name(itemGroupParam.getName()).build());
Long salarySobItemGroupId = salarySobItemGroupPOS.get(0).getId();
@ -204,23 +259,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
salarySobItems.add(salarySobItemPO);
}
// 保存薪资账套的薪资项目副本
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) {
batchSave(salarySobItems);
}
// 保存薪资账套的薪资项目分类
// if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) {
// getSalarySobItemGroupService(user).batchSave(result.getNeedInsertSalarySobItemGroups());
// }
//todo 记录日志
// 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);
batchSave(salarySobItems);
}
@Override

View File

@ -44,7 +44,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
private SalarySobRangeBiz salarySobRangeBiz = new SalarySobRangeBiz();
private EmployBiz employBiz = new EmployBiz();
OrganizationShowSetBiz orgBiz = new OrganizationShowSetBiz();
private OrganizationShowSetBiz orgBiz = new OrganizationShowSetBiz();
private SalarySobService getSalarySobService(User user) {

View File

@ -1,31 +1,39 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.biz.*;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobBO;
import com.engine.salary.entity.salarysob.bo.SalarySobCycleBO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemBO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam;
import com.engine.salary.entity.salarysob.param.SalarySobDisableParam;
import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.SalarySobDefaultItemService;
import com.engine.salary.service.SalarySobService;
import com.engine.salary.service.SysSalaryItemService;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import weaver.hrm.User;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资账套
@ -39,25 +47,22 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
private SalarySobBiz salarySobMapper = new SalarySobBiz();
// private SalarySobRangeService salarySobRangeService;
// private SalarySobDefaultEmpFieldService salarySobDefaultEmpFieldService;
// private SalarySobEmpFieldService salarySobEmpFieldService;
//
private SalarySobDefaultItemService salarySobDefaultItemService;
private SalarySobRangeBiz salarySobRangeService = new SalarySobRangeBiz();
private SalarySobEmpFieldBiz empFieldBiz = new SalarySobEmpFieldBiz();
private SalarySobDefaultItemGroupBiz defaultItemGroupBiz = new SalarySobDefaultItemGroupBiz();
private SalarySobEmpFieldBiz salarySobEmpFieldService = new SalarySobEmpFieldBiz();
private SalarySobDefaultItemBiz salarySobDefaultItemService = new SalarySobDefaultItemBiz();
private SalarySobItemBiz salarySobItemService = new SalarySobItemBiz();
private SalarySobItemGroupBiz salarySobItemGroupService = new SalarySobItemGroupBiz();
private SalaryItemService getSalaryItemService(User user) {
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
//
// private SalarySobItemService salarySobItemService;
//
private SalaryItemService salaryItemService;
//
private SysSalaryItemService sysSalaryItemService;
//
// private SalarySobItemGroupService salarySobItemGroupService;
private SysSalaryItemService getSysSalaryItemService(User user) {
return (SysSalaryItemService) ServiceUtil.getService(SysSalaryItemServiceImpl.class, user);
}
//
// private SalarySobAdjustRuleService salarySobAdjustRuleService;
//
@ -157,16 +162,15 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
* @param salarySobPO 薪资账套
*/
private void saveDefaultEmpField(SalarySobPO salarySobPO) {
// // 查询薪资账套默认的员工信息字段
// List<SalarySobDefaultEmpFieldPO> salarySobDefaultEmpFieldPOS = salarySobDefaultEmpFieldService.list();
// // 转换成薪资账套员工信息字段po
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = SalarySobItemBO.convert2EmpFieldPO(salarySobPO.getId(), salarySobDefaultEmpFieldPOS, employeeId, tenantKey);
// // 保存
// salarySobEmpFieldService.batchSave(salarySobEmpFieldPOS);
// 查询薪资账套默认的员工信息字段
List<SalarySobDefaultEmpFieldPO> salarySobDefaultEmpFieldPOS = empFieldBiz.listDefaultEmpField();
// 转换成薪资账套员工信息字段po
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = SalarySobItemBO.convert2EmpFieldPO(salarySobPO.getId(), salarySobDefaultEmpFieldPOS, (long) user.getUID());
// 保存
empFieldBiz.batchInsert(salarySobEmpFieldPOS);
}
/**
* todo
* 新建薪资账套时保存默认的薪资项目
* 1薪资账套默认引用的系统薪资项目
* 2自定义薪资项目中开启了"默认使用"的薪资项目
@ -174,39 +178,44 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
* @param salarySobPO 薪资账套
*/
private void saveDefaultItem(SalarySobPO salarySobPO) {
// // 1根据薪资类型查询薪资账套默认引用的系统薪资项目
// List<SalarySobDefaultItemPO> salarySobDefaultItemPOS = salarySobDefaultItemService.listByIncomeCategory(IncomeCategoryEnum.parseByValue(salarySobPO.getIncomeCategory()));
// // 2薪资账套默认引用的系统薪资项目如果没有添加到薪资项目中这里要给添加保存
// // 2.1查询已经添加到薪资项目中的系统薪资项目
// Set<Long> defaultSysSalaryItemIds = SalaryEntityUtil.properties(salarySobDefaultItemPOS, SalarySobDefaultItemPO::getSysSalaryItemId);
// List<SalaryItemPO> salaryItemPOS = salaryItemService.listBySysSalaryItemIds(defaultSysSalaryItemIds, tenantKey);
// Set<Long> sysSalaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getSysSalaryItemId);
// // 2.2需要添加进薪资项目中的系统薪资项目id
// Set<Long> needAddSysSalaryItemIds = salarySobDefaultItemPOS.stream()
// .filter(salarySobDefaultItemPO -> !sysSalaryItemIds.contains(salarySobDefaultItemPO.getSysSalaryItemId()))
// .map(SalarySobDefaultItemPO::getSysSalaryItemId)
// .collect(Collectors.toSet());
// List<SysSalaryItemPO> needAddSysSalaryItemPOS = sysSalaryItemService.listByIds(needAddSysSalaryItemIds);
// // 2.3需要保存的薪资项目
// List<SalaryItemPO> needInsertSalaryItemPOS = SysSalaryItemBO.convert2SalaryItemPO(needAddSysSalaryItemPOS, (long)user.getUID());
// if (CollectionUtils.isNotEmpty(needInsertSalaryItemPOS)) {
// salaryItemService.batchSave(needInsertSalaryItemPOS);
// }
//
// // 3查询开启了"默认使用"的自定义薪资项目
// List<SalaryItemPO> useDefaultSalaryItemPOS = salaryItemService.listBySystemTypeAndUseDefault(SalarySystemTypeEnum.CUSTOM, NumberUtils.INTEGER_ONE);
//
// // 4默认引用的薪资项目=薪资账套默认引用的系统薪资项目(已添加进薪资项目中的) + 薪资账套默认引用的系统薪资项目(待添加进薪资项目中的) + 自定义薪资项目中开启了"默认使用"的薪资项目
// List<SalaryItemPO> defaultSalaryItemPOS = Lists.newArrayListWithExpectedSize(salaryItemPOS.size() + needInsertSalaryItemPOS.size() + useDefaultSalaryItemPOS.size());
// defaultSalaryItemPOS.addAll(salaryItemPOS);
// defaultSalaryItemPOS.addAll(needInsertSalaryItemPOS);
// defaultSalaryItemPOS.addAll(useDefaultSalaryItemPOS);
//
// // 5保存
// List<SalarySobItemPO> salarySobItemPOS = SalarySobItemBO.convert2ItemPO(salarySobPO.getId(), defaultSalaryItemPOS, employeeId);
// if (CollectionUtils.isNotEmpty(salarySobItemPOS)) {
// salarySobItemService.batchSave(salarySobItemPOS);
// }
// 1根据薪资类型查询薪资账套默认使用的薪资项目分类以及薪资项目
IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(salarySobPO.getIncomeCategory());
List<SalarySobDefaultItemGroupPO> salarySobDefaultItemGroupPOS = defaultItemGroupBiz.listByIncomeCategory(incomeCategoryEnum);
List<SalarySobDefaultItemPO> salarySobDefaultItemPOS = salarySobDefaultItemService.listByIncomeCategory(SalarySobDefaultItemPO.builder().incomeCategory(incomeCategoryEnum.getValue()).build());
// 2薪资账套默认引用的系统薪资项目如果没有添加到薪资项目中这里要给添加保存
// 2.1查询已经添加到薪资项目中的系统薪资项目
Set<Long> defaultSysSalaryItemIds = SalaryEntityUtil.properties(salarySobDefaultItemPOS, SalarySobDefaultItemPO::getSysSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listBySysSalaryItemIds(defaultSysSalaryItemIds);
Set<Long> sysSalaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getSysSalaryItemId);
// 2.2需要添加进薪资项目中的系统薪资项目id
Set<Long> needAddSysSalaryItemIds = salarySobDefaultItemPOS.stream()
.map(SalarySobDefaultItemPO::getSysSalaryItemId)
.filter(sysSalaryItemId -> !sysSalaryItemIds.contains(sysSalaryItemId))
.collect(Collectors.toSet());
List<SysSalaryItemPO> needAddSysSalaryItemPOS = getSysSalaryItemService(user).listByIds(needAddSysSalaryItemIds);
// 2.3需要保存的薪资项目
List<SalaryItemPO> needInsertSalaryItemPOS = SysSalaryItemBO.convert2SalaryItemPO(needAddSysSalaryItemPOS, (long) user.getUID());
if (CollectionUtils.isNotEmpty(needInsertSalaryItemPOS)) {
getSalaryItemService(user).batchSave(needInsertSalaryItemPOS);
}
// 3查询开启了"默认使用"的自定义薪资项目
List<SalaryItemPO> useDefaultSalaryItemPOS = getSalaryItemService(user).listBySystemTypeAndUseDefault(SalarySystemTypeEnum.CUSTOM, NumberUtils.INTEGER_ONE);
// 4默认引用的薪资项目=薪资账套默认引用的系统薪资项目(已添加进薪资项目中的) + 薪资账套默认引用的系统薪资项目(待添加进薪资项目中的) + 自定义薪资项目中开启了"默认使用"的薪资项目
List<SalaryItemPO> defaultSalaryItemPOS = Lists.newArrayListWithExpectedSize(salaryItemPOS.size() + needInsertSalaryItemPOS.size() + useDefaultSalaryItemPOS.size());
defaultSalaryItemPOS.addAll(salaryItemPOS);
defaultSalaryItemPOS.addAll(needInsertSalaryItemPOS);
defaultSalaryItemPOS.addAll(useDefaultSalaryItemPOS);
// 5保存
SalarySobItemBO.Result result = SalarySobItemBO.initSalarySobItem(salarySobPO.getId(), salarySobDefaultItemGroupPOS, salarySobDefaultItemPOS, defaultSalaryItemPOS, (long) user.getUID(), SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) {
salarySobItemService.batchInsert(result.getNeedInsertSalarySobItems());
}
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) {
salarySobItemGroupService.batchInsert(result.getNeedInsertSalarySobItemGroups());
}
}
@Override
@ -290,17 +299,17 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
// if (CollectionUtils.isNotEmpty(salaryAcctRecordPOS)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99713, "账套已用于薪资核算,不能删除"));
// }
// // 删除薪资账套
// salarySobMapper.deleteByIds(ids, tenantKey);
// // 删除薪资账套的人员范围
// salarySobRangeService.deleteBySalarySobIds(ids, tenantKey);
// // 删除薪资账套的人员信息字段
// salarySobEmpFieldService.deleteBySalarySobIds(ids, tenantKey);
// // 删除薪资账套的薪资项目
// salarySobItemService.deleteBySalarySobIds(ids, tenantKey);
// // 删除薪资账套的薪资项目分类
// salarySobItemGroupService.deleteBySalarySobIds(ids, tenantKey);
// // 删除薪资账套的调薪计薪规则
// 删除薪资账套
salarySobMapper.deleteByIds(ids);
// 删除薪资账套的人员范围
salarySobRangeService.deleteBySalarySobIds(ids);
// 删除薪资账套的人员信息字段
salarySobEmpFieldService.deleteBySalarySobIds(ids);
// 删除薪资账套的薪资项目
salarySobItemService.deleteBySalarySobIds(ids);
// 删除薪资账套的薪资项目分类
salarySobItemGroupService.deleteBySalarySobIds(ids);
// 删除薪资账套的调薪计薪规则
// salarySobAdjustRuleService.deleteBySalarySobIds(ids, tenantKey);
// // 删除薪资账套的校验规则
// salarySobCheckRuleService.deleteBySalarySobIds(ids, tenantKey);
@ -334,12 +343,12 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
// // 查询薪资账套的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalarySobId(duplicateParam.getId());
// // 查询薪资账套的薪资项目分类
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(duplicateParam.getId(), tenantKey);
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(duplicateParam.getId());
// // 查询薪资账套的调薪计薪规则
// List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = salarySobAdjustRuleService.listBySalarySobId(duplicateParam.getId(), tenantKey);
// List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = salarySobAdjustRuleService.listBySalarySobId(duplicateParam.getId());
// // 查询薪资账套的校验规则
// List<SalarySobCheckRulePO> salarySobCheckRulePOS = salarySobCheckRuleService.listBySalarySobId(duplicateParam.getId(), tenantKey);
//
// List<SalarySobCheckRulePO> salarySobCheckRulePOS = salarySobCheckRuleService.listBySalarySobId(duplicateParam.getId());
// // 复制
// SalarySobDuplicateBO salarySobDuplicateBO = new SalarySobDuplicateBO(salarySobPO, salarySobEmpFieldPOS, salarySobItemPOS,
// salarySobItemGroupPOS, salarySobAdjustRulePOS, salarySobCheckRulePOS);

View File

@ -141,5 +141,4 @@ public class ResponseResult<T, R> {
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
}

View File

@ -2,17 +2,14 @@ package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.dto.*;
import com.engine.salary.entity.salarysob.param.*;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalarySobItemWrapper;
import com.engine.salary.wrapper.SalarySobRangeWrapper;
import com.engine.salary.wrapper.SalarySobWrapper;
import com.engine.salary.wrapper.*;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -28,6 +25,7 @@ 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;
/**
@ -53,9 +51,13 @@ public class SalarySobController {
return ServiceUtil.getService(SalarySobItemWrapper.class, user);
}
// private SalarySobAdjustRuleWrapper salarySobAdjustRuleWrapper;
// private SalarySobCheckRuleWrapper salarySobCheckRuleWrapper;
private SalarySobAdjustRuleWrapper getSalarySobAdjustRuleWrapper(User user) {
return ServiceUtil.getService(SalarySobAdjustRuleWrapper.class, user);
}
private SalarySobCheckRuleWrapper getSalarySobCheckRuleWrapper(User user) {
return ServiceUtil.getService(SalarySobCheckRuleWrapper.class, user);
}
/**********************************薪资账套 start*********************************/
@ -218,7 +220,7 @@ public class SalarySobController {
User user = HrmUserVarify.getUser(request, response);
String idStr = request.getParameter("id");
Long id = null;
if(StringUtils.isNotBlank(idStr)){
if (StringUtils.isNotBlank(idStr)) {
id = Long.valueOf(idStr);
}
return new ResponseResult<Long, SalarySobItemGroupPO>().run(getSalarySobItemWrapper(user)::getGroupForm, id);
@ -234,7 +236,7 @@ public class SalarySobController {
User user = HrmUserVarify.getUser(request, response);
String salarySobIdStr = request.getParameter("salarySobId");
Long salarySobId = null;
if(StringUtils.isNotBlank(salarySobIdStr)){
if (StringUtils.isNotBlank(salarySobIdStr)) {
salarySobId = Long.valueOf(salarySobIdStr);
}
return new ResponseResult<Long, SalarySobItemAggregateDTO>().run(getSalarySobItemWrapper(user)::getForm, salarySobId);
@ -243,92 +245,127 @@ public class SalarySobController {
/**
* 保存薪资账套薪资项目
*/
@POST
@Path("/item/save")
@GET
@Path("/empField/list")
@Produces(MediaType.APPLICATION_JSON)
public String saveSalarySobItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobItemSaveParam saveParam) {
public String empFieldList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobItemSaveParam, String>().run(getSalarySobItemWrapper(user)::save, saveParam);
return new ResponseResult<String, Collection<Map<String, String>>>().run(getSalarySobItemWrapper(user)::empFieldList);
}
// /**********************************薪资账套的薪资项目 end*********************************/
//
// /**********************************调薪计薪规则 start*********************************/
//
// @PostMapping("/adjustmentrule/list")
// @ApiOperation("调薪计薪规则列表")
// @WeaPermission
// public WeaResult<List<SalarySobAdjustRuleListDTO>> listAdjustmentRule(@RequestBody @Validated SalarySobAdjustRuleQueryParam queryParam) {
// List<SalarySobAdjustRuleListDTO> salarySobAdjustRuleListDTOS = salarySobAdjustRuleWrapper.list(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(salarySobAdjustRuleListDTOS);
/**********************************薪资账套的薪资项目 end*********************************/
/**********************************调薪计薪规则 start*********************************/
/**
* 调薪计薪规则列表
*/
@POST
@Path("/adjustmentrule/list")
@Produces(MediaType.APPLICATION_JSON)
public String listAdjustmentRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobAdjustRuleQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobAdjustRuleQueryParam, List<SalarySobAdjustRuleListDTO>>().run(getSalarySobAdjustRuleWrapper(user)::list, queryParam);
}
/**
* 调薪计薪规则保存
*/
@POST
@Path("/adjustmentrule/save")
@Produces(MediaType.APPLICATION_JSON)
public String saveAdjustmentRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobAdjustRuleSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobAdjustRuleSaveParam, String>().run(getSalarySobAdjustRuleWrapper(user)::save, saveParam);
}
/**
* 调薪计薪规则可选的薪资项目列表
*/
@POST
@Path("/adjustmentrule/listSalarySobItem")
@Produces(MediaType.APPLICATION_JSON)
public String listSalarySobItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobAdjustRuleItemQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobAdjustRuleItemQueryParam, List<SalaryItemBaseDTO>>().run(getSalarySobAdjustRuleWrapper(user)::list4SalarySobItem, queryParam);
}
/**********************************调薪计薪规则 end*********************************/
/**********************************校验规则 start*********************************/
/**
* 薪资账套校验规则列表
*/
// @POST
// @Path("/checkrule/list")
// @Produces(MediaType.APPLICATION_JSON)
// public String listSalarySobCheckRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobCheckRuleQueryParam queryParam) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<SalarySobCheckRuleQueryParam, Map<String, Object>>().run(getSalarySobCheckRuleWrapper(user)::listPage, queryParam);
// }
//
// @PostMapping("/adjustmentrule/save")
// @ApiOperation("调薪计薪规则保存")
// @WeaPermission
// public WeaResult<Object> saveAdjustmentRule(@RequestBody @Validated SalarySobAdjustRuleSaveParam saveParam) {
// salarySobAdjustRuleWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/adjustmentrule/listSalarySobItem")
// @ApiOperation("调薪计薪规则列表")
// @WeaPermission
// public WeaResult<List<SalaryItemBaseDTO>> listSalarySobItem(@RequestBody @Validated SalarySobAdjustRuleItemQueryParam queryParam) {
// List<SalaryItemBaseDTO> salaryItemBaseDTOS = salarySobAdjustRuleWrapper.list4SalarySobItem(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(salaryItemBaseDTOS);
// }
//
// /**********************************调薪计薪规则 end*********************************/
//
// /**********************************校验规则 start*********************************/
//
// @PostMapping("/checkrule/list")
// @ApiOperation("薪资账套校验规则列表")
// @WeaPermission
// public WeaResult<WeaTable<SalarySobCheckRuleListDTO>> listSalarySobCheckRule(@RequestBody SalarySobCheckRuleQueryParam queryParam) {
// WeaTable<SalarySobCheckRuleListDTO> weaTable = salarySobCheckRuleWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @GetMapping("/checkrule/getForm")
// @ApiOperation("薪资账套校验规则表单")
// @WeaPermission
// public WeaResult<WeaForm> getSalarySobCheckRuleForm(@RequestParam(name = "id", required = false) Long id) {
// WeaForm weaForm = salarySobCheckRuleWrapper.getForm(id, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaForm);
// }
//
// @PostMapping("/checkrule/save")
// @ApiOperation("保存薪资账套校验规则")
// @WeaPermission
// public WeaResult<Object> saveSalarySobCheckRule(@RequestBody @Validated SalarySobCheckRuleSaveParam saveParam) {
// if (saveParam.getId() == null || saveParam.getId() <= 0) {
// salarySobCheckRuleWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// } else {
// salarySobCheckRuleWrapper.update(saveParam, TenantContext.getCurrentTenantKey());
// }
// return WeaResult.success(null);
// }
//
// @PostMapping("/checkrule/formula/update")
// @ApiOperation("编辑薪资账套校验规则公式")
// @WeaPermission
// public WeaResult<Object> updateSalarySobCheckRuleFormula(@RequestBody @Validated UpdateCheckRuleFormulaParam updateParam) {
// salarySobCheckRuleWrapper.updateFormulaId(updateParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/checkrule/delete")
// @ApiOperation("删除薪资账套校验规则")
// @WeaPermission
// public WeaResult<Object> deleteSalarySobCheckRule(@RequestBody Collection<Long> ids) {
// if (CollectionUtils.isEmpty(ids)) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
// }
// salarySobCheckRuleWrapper.delete(ids, TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// /**********************************校验规则 end*********************************/
/**
* 薪资账套校验规则表单
*/
@POST
@Path("/checkrule/getForm")
@Produces(MediaType.APPLICATION_JSON)
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
String idStr = request.getParameter("id");
Long id = null;
if (StringUtils.isNotBlank(idStr)) {
id = Long.valueOf(idStr);
}
return new ResponseResult<Long, SalarySobCheckRuleFormDTO>().run(getSalarySobCheckRuleWrapper(user)::getForm, id);
}
/**
* 保存薪资账套校验规则
*/
@POST
@Path("/checkrule/save")
@Produces(MediaType.APPLICATION_JSON)
public String saveSalarySobCheckRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobCheckRuleSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
if (saveParam.getId() == null || saveParam.getId() <= 0) {
return new ResponseResult<SalarySobCheckRuleSaveParam, String>().run(getSalarySobCheckRuleWrapper(user)::save, saveParam);
} else {
return new ResponseResult<SalarySobCheckRuleSaveParam, String>().run(getSalarySobCheckRuleWrapper(user)::update, saveParam);
}
}
/**
* 编辑薪资账套校验规则公式
*/
@POST
@Path("/checkrule/formula/update")
@Produces(MediaType.APPLICATION_JSON)
public String updateSalarySobCheckRuleFormula(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody UpdateCheckRuleFormulaParam updateParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<UpdateCheckRuleFormulaParam, String>().run(getSalarySobCheckRuleWrapper(user)::updateFormulaId, updateParam);
}
/**
* 删除薪资账套校验规则
*/
@POST
@Path("/checkrule/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalarySobCheckRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
return new ResponseResult<Collection<Long>, String>().run(getSalarySobCheckRuleWrapper(user)::delete, ids);
}
/**********************************校验规则 end*********************************/
}

View File

@ -0,0 +1,96 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobAdjustRuleBO;
import com.engine.salary.entity.salarysob.dto.SalaryItemBaseDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobAdjustRuleListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobAdjustRuleItemQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobAdjustRuleQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobAdjustRuleSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.SalarySobAdjustRuleService;
import com.engine.salary.service.SalarySobItemService;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
import com.engine.salary.service.impl.SalarySobAdjustRuleServiceImpl;
import com.engine.salary.service.impl.SalarySobItemServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.valid.ValidUtil;
import weaver.hrm.User;
import java.util.List;
import java.util.Set;
/**
* 薪资账套的调薪计薪规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobAdjustRuleWrapper extends Service {
private SalarySobAdjustRuleService getSalarySobAdjustRuleService(User user) {
return (SalarySobAdjustRuleService) ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
}
private SalaryItemService getSalaryItemService(User user) {
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
/**
* 薪资账套的调薪计薪规则列表
*
* @param queryParam 查询参数
* @return
*/
public List<SalarySobAdjustRuleListDTO> list(SalarySobAdjustRuleQueryParam queryParam) {
ValidUtil.doValidator(queryParam);
// 查询调薪计薪规则po
List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = getSalarySobAdjustRuleService(user).listBySalarySobId(queryParam.getSalarySobId());
// 查询薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobAdjustRulePOS, SalarySobAdjustRulePO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 转换成dto
return SalarySobAdjustRuleBO.convert2ListDTO(salarySobAdjustRulePOS, salaryItemPOS);
}
/**
* 查询调薪计薪规则可选的薪资项目
*
* @param queryParam 查询条件
* @return
*/
public List<SalaryItemBaseDTO> list4SalarySobItem(SalarySobAdjustRuleItemQueryParam queryParam) {
ValidUtil.doValidator(queryParam);
// 查询薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobIdAndSalaryItemIdNotIn(queryParam.getSalarySobId(), queryParam.getExcludeSalaryItemIds());
// 查询薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
// 转换成dto
return SalarySobAdjustRuleBO.convertItemBaseDTO(salaryItemPOS);
}
/**
* 保存调薪计薪规则
*
* @param saveParam 保存参数
*/
public void save(SalarySobAdjustRuleSaveParam saveParam) {
getSalarySobAdjustRuleService(user).save(saveParam);
}
}

View File

@ -0,0 +1,118 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salarysob.bo.SalarySobCheckRuleBO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.param.UpdateCheckRuleFormulaParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.service.SalarySobCheckRuleService;
import com.engine.salary.service.impl.SalarySobCheckRuleServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import weaver.hrm.User;
import java.util.Collection;
import java.util.Objects;
/**
* 薪资账套的校验规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobCheckRuleWrapper extends Service {
private SalarySobCheckRuleService getSalarySobCheckRuleService(User user) {
return (SalarySobCheckRuleService) ServiceUtil.getService(SalarySobCheckRuleServiceImpl.class, user);
}
private SalaryFormulaService salaryFormulaService;
/**
* 薪资账套的校验规则列表
*
* @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return
*/
// public WeaTable<SalarySobCheckRuleListDTO> listPage(SalarySobCheckRuleQueryParam queryParam, String tenantKey) {
// // 分页查询薪资账套的校验规则
// Page<SalarySobCheckRulePO> page = salarySobCheckRuleService.listPageByParam(queryParam, tenantKey);
// // 查询公式详情
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalarySobCheckRulePO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 转换成dto
// List<SalarySobCheckRuleListDTO> salarySobCheckRuleListDTOS = SalarySobCheckRuleBO.convert2ListDTO(page.getRecords(), expressFormulas);
// // 转换成前端所需的数据格式
// Page<SalarySobCheckRuleListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
// dtoPage.setRecords(salarySobCheckRuleListDTOS);
// return SalaryFormatUtil.<SalarySobCheckRuleListDTO>getInstance().buildTable(SalarySobCheckRuleListDTO.class, dtoPage);
// }
/**
* 薪资账套的校验规则详情
*
* @param id 校验规则的id
* @return
*/
public SalarySobCheckRuleFormDTO getForm(Long id) {
SalarySobCheckRuleFormDTO checkRuleFormDTO = new SalarySobCheckRuleFormDTO();
if (!Objects.isNull(id)) {
// 查询校验规则
SalarySobCheckRulePO salarySobCheckRulePO = getSalarySobCheckRuleService(user).getById(id);
if (Objects.isNull(salarySobCheckRulePO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98636, "校验规则不存在或者已被删除"));
}
// 查询公式详情
ExpressFormula expressFormula = salaryFormulaService.getExpressFormula(salarySobCheckRulePO.getFormulaId());
// 转换成详情dto
checkRuleFormDTO = SalarySobCheckRuleBO.convert2FormDTO(salarySobCheckRulePO, expressFormula);
}
// 转换成前端所需的数据格式
return checkRuleFormDTO;
}
/**
* 保存
*
* @param saveParam 保存参数
*/
public void save(SalarySobCheckRuleSaveParam saveParam) {
getSalarySobCheckRuleService(user).save(saveParam);
}
/**
* 更新
*
* @param updateParam 更新参数
*/
public void update(SalarySobCheckRuleSaveParam updateParam) {
getSalarySobCheckRuleService(user).update(updateParam);
}
/**
* 更新校验规则的公式
*
* @param updateParam 更新参数
*/
public void updateFormulaId(UpdateCheckRuleFormulaParam updateParam) {
getSalarySobCheckRuleService(user).updateFormulaId(updateParam);
}
/**
* 删除
*
* @param ids 校验规则的id
*/
public void delete(Collection<Long> ids) {
getSalarySobCheckRuleService(user).deleteByIds(ids);
}
}

View File

@ -19,7 +19,7 @@ import com.engine.salary.service.impl.SalarySobItemServiceImpl;
import org.springframework.stereotype.Component;
import weaver.hrm.User;
import java.util.Map;
import java.util.*;
/**
* 薪资账套的薪资项目
@ -132,9 +132,31 @@ public class SalarySobItemWrapper extends Service {
/**
* 保存
*
* @param saveParam 保存参数
* @param saveParam 保存参数
*/
public void save(SalarySobItemSaveParam saveParam) {
getSalarySobItemService(user).save(saveParam);
}
public Collection<Map<String, String>> empFieldList() {
List<Map<String, String>> list = new ArrayList();
Map<String, String> taxAgentName = new HashMap<>();
taxAgentName.put("name", "个税扣缴义务人");
taxAgentName.put("id", "taxAgentName");
list.add(taxAgentName);
Map<String, String> username = new HashMap<>();
username.put("name", "姓名");
username.put("id", "username");
list.add(username);
Map<String, String> departmentName = new HashMap<>();
departmentName.put("name", "部门");
departmentName.put("id", "departmentName");
list.add(departmentName);
Map<String, String> email = new HashMap<>();
email.put("name", "邮件");
email.put("id", "");
list.add(email);
return list;
}
}