薪资项目&账套

This commit is contained in:
钱涛 2022-03-22 21:01:38 +08:00
parent f94e64b492
commit c01e63040c
55 changed files with 3997 additions and 190 deletions

View File

@ -0,0 +1,15 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* 薪资账套
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Path("/bs/hrmsalary/salarysob")
public class SalarySobController extends com.engine.salary.web.SalarySobController {
}

View File

@ -0,0 +1,64 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.mapper.salarysob.SalarySobMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalarySobBiz {
public SalarySobPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
public List<SalarySobPO> listSome(SalarySobPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
public List<SalarySobPO> listByParam(SalarySobPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.listByParam(build);
} finally {
sqlSession.close();
}
}
public void insert(SalarySobPO salarySobPO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
mapper.insertIgnoreNull(salarySobPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateById(SalarySobPO newSalarySobPO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
mapper.updateIgnoreNull(newSalarySobPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,67 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
import com.engine.salary.mapper.salarysob.SalarySobRangeMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobRangeBiz {
public List<SalarySobRangePO> listSome(SalarySobRangePO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobRangeMapper mapper = sqlSession.getMapper(SalarySobRangeMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
public void batchInsert(Collection<SalarySobRangePO> needInsertSalarySobRanges) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobRangeMapper mapper = sqlSession.getMapper(SalarySobRangeMapper.class);
mapper.batchInsert(needInsertSalarySobRanges);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateById(SalarySobRangePO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobRangeMapper mapper = sqlSession.getMapper(SalarySobRangeMapper.class);
mapper.updateIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteByIds(Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobRangeMapper mapper = sqlSession.getMapper(SalarySobRangeMapper.class);
mapper.deleteByIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobRangeMapper mapper = sqlSession.getMapper(SalarySobRangeMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -4,21 +4,15 @@ import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.PageIdConst;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TaxAgentGetFromCmd extends AbstractCommonCommand<Map<String, Object>> {

View File

@ -145,12 +145,6 @@ public class SalaryItemBO {
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()
@ -159,15 +153,15 @@ public class SalaryItemBO {
.name(saveParam.getName())
.systemType(SalarySystemTypeEnum.CUSTOM.getValue())
.sysSalaryItemId(NumberUtils.LONG_ZERO)
.category(saveParam.getCategory().getValue())
.itemType(saveParam.getItemType().getValue())
.category(saveParam.getCategory())
.itemType(saveParam.getItemType())
.useDefault(saveParam.getUseDefault())
.useInEmployeeSalary(saveParam.getUseInEmployeeSalary())
.roundingMode(Optional.ofNullable(saveParam.getRoundingMode()).map(SalaryRoundingModeEnum::getValue).orElse(SalaryRoundingModeEnum.ROUNDING.getValue()))
.roundingMode(Optional.ofNullable(SalaryRoundingModeEnum.parseByValue(saveParam.getRoundingMode())).map(SalaryRoundingModeEnum::getValue).orElse(SalaryRoundingModeEnum.ROUNDING.getValue()))
.pattern(Optional.ofNullable(saveParam.getPattern()).orElse(2))
.valueType(saveParam.getValueType().getValue())
.datasource(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? SalaryDataSourceEnum.INPUT_IMPORT.getValue() : SalaryDataSourceEnum.CUSTOM_FORMULA.getValue())
.formulaId(saveParam.getValueType() == SalaryValueTypeEnum.FORMULA ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
.valueType(saveParam.getValueType())
.datasource(Objects.equals(saveParam.getValueType(), SalaryValueTypeEnum.INPUT.getValue()) ? SalaryDataSourceEnum.INPUT_IMPORT.getValue() : SalaryDataSourceEnum.CUSTOM_FORMULA.getValue())
.formulaId(Objects.equals(saveParam.getValueType(), SalaryValueTypeEnum.FORMULA.getValue()) ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
.description(saveParam.getDescription())
.canEdit(NumberUtils.INTEGER_ONE)
.canDelete(NumberUtils.INTEGER_ONE)

View File

@ -79,4 +79,7 @@ public class SalaryItemListDTO {
//是否可以编辑
private boolean canEdit;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;
}

View File

@ -50,4 +50,7 @@ public class SysSalaryItemListDTO {
@SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType")
private String valueType;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;
}

View File

@ -33,8 +33,12 @@ public class SalaryItemSaveParam {
@DataCheck(require = true, max = 40, message = "名称不允许为空,名称不能超过40个字符")
private String name;
//是否是系统内置的薪资项目
private SalarySystemTypeEnum systemType;
/**
* 是否是系统内置的薪资项目
*
* @see SalarySystemTypeEnum
*/
private Integer systemType;
//默认使用
private Integer useDefault;
@ -42,24 +46,40 @@ public class SalaryItemSaveParam {
//薪资档案引用
private Integer useInEmployeeSalary;
//属性
/**
* 属性
*
* @see SalaryItemCategoryEnum
*/
@DataCheck(require = true, message = "属性不允许为空")
private SalaryItemCategoryEnum category;
private Integer category;
//类型
/**
* 类型
*
* @see SalaryItemTypeEnum
*/
@DataCheck(require = true, message = "类型不允许为空")
private SalaryItemTypeEnum itemType;
private Integer itemType;
//舍入规则
private SalaryRoundingModeEnum roundingMode;
/**
* 舍入规则
*
* @see SalaryRoundingModeEnum
*/
private Integer roundingMode;
//保留小数位
@DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 5, message = "小数位最多为5")
private Integer pattern;
//取值方式
/**
* 取值方式
*
* @see SalaryValueTypeEnum
*/
@DataCheck(require = true, message = "取值方式不允许为空")
private SalaryValueTypeEnum valueType;
private Integer valueType;
//公式
private Long formulaId;

View File

@ -1,6 +1,10 @@
package com.engine.salary.entity.salaryitem.param;
import com.engine.salary.entity.base.BaseQueryParam;
import com.engine.salary.enums.SalaryItemCategoryEnum;
import com.engine.salary.enums.SalaryItemTypeEnum;
import com.engine.salary.enums.SalaryOnOffEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -22,25 +26,45 @@ import java.util.Collection;
@AllArgsConstructor
public class SalaryItemSearchParam extends BaseQueryParam {
//名称@see
//名称
private String name;
//备注@see
//备注
private String description;
//属性 SalaryItemCategoryEnum
/**
* 属性
*
* @see SalaryItemCategoryEnum
*/
private Integer category;
//分类 @see SalaryItemTypeEnum
/**
* 分类
*
* @see SalaryItemTypeEnum
*/
private Integer itemType;
//是否薪资档案引用@see SalaryOnOffEnum
/**
* 是否薪资档案引用
*
* @see SalaryOnOffEnum
*/
private Integer useInEmployeeSalary;
//是否默认使用@see SalaryOnOffEnum
/**
* 是否默认使用
*
* @see SalaryOnOffEnum
*/
private Integer useDefault;
//取值方式@seeSalaryValueTypeEnum
/**
* 取值方式
*
* @see SalaryValueTypeEnum
*/
private Integer valueType;
//需要排除的系统薪资项目@see

View File

@ -1,6 +1,8 @@
package com.engine.salary.entity.salaryitem.param;
import com.engine.salary.entity.base.BaseQueryParam;
import com.engine.salary.enums.SalaryItemCategoryEnum;
import com.engine.salary.enums.SalaryItemTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -25,10 +27,18 @@ public class SysSalaryItemSearchParam extends BaseQueryParam {
//名称
private String name;
//属性 SalaryItemCategoryEnum
/**
* 属性
*
* @see SalaryItemCategoryEnum
*/
private String category;
//分类 SalaryItemTypeEnum
/**
* 分类
*
* @see SalaryItemTypeEnum
*/
private String itemType;
//需要排除的系统薪资项目

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryitem.po;
import com.engine.salary.enums.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryitem.po;
import com.engine.salary.enums.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

View File

@ -0,0 +1,147 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salarysob.dto.SalarySobBasicFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryI18nUtil;
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 SalarySobBO {
/**
* 薪资账套基础设置保存参数转换成薪资账套基础设置po
*
* @param saveParam 薪资账套基础设置保存参数
* @param employeeId 人员id
* @return
*/
public static SalarySobPO convert2PO(SalarySobBasicSaveParam saveParam, Long employeeId) {
Date now = new Date();
if (saveParam == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
return SalarySobPO.builder()
// .id(IdGenerator.generate())
.name(saveParam.getName())
.incomeCategory(saveParam.getTaxableItems())
.salaryCycleType(saveParam.getSalaryCycleType())
.salaryCycleFromDay(saveParam.getSalaryCycleFromDay())
.taxCycleType(saveParam.getTaxCycleType())
.attendCycleType(saveParam.getAttendCycleType())
.attendCycleFromDay(saveParam.getAttendCycleFromDay())
.socialSecurityCycleType(saveParam.getSocialSecurityCycleType())
.disable(NumberUtils.INTEGER_ZERO)
.creator(employeeId)
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
}
/**
* 薪资账套po转换成列表dto
*
* @param salarySobs 薪资账套po
* @return
*/
public static List<SalarySobListDTO> convert2ListDTO(Collection<SalarySobPO> salarySobs) {
if (CollectionUtils.isEmpty(salarySobs)) {
return Collections.emptyList();
}
return salarySobs.stream()
.map(salarySobPO -> SalarySobListDTO.builder()
.id(salarySobPO.getId())
.name(salarySobPO.getName())
.salaryCycle(buildSalaryCycle(salarySobPO))
.disable(salarySobPO.getDisable())
.description(salarySobPO.getDescription())
.build())
.collect(Collectors.toList());
}
/**
* 解析薪资账套列表的薪资周期
*
* @param salarySobPO
* @return
*/
private static String buildSalaryCycle(SalarySobPO salarySobPO) {
String salaryCycleStr;
SalaryCycleTypeEnum salaryCycleTypeEnum = SalaryCycleTypeEnum.parseByValue(salarySobPO.getSalaryCycleType());
if (salaryCycleTypeEnum == null) {
return StringUtils.EMPTY;
}
Integer salaryCycleFromDay = salarySobPO.getSalaryCycleFromDay();
switch (salaryCycleTypeEnum) {
case BEFORE_LAST_MONTH:
salaryCycleStr = Objects.equals(salaryCycleFromDay, 1) ? SalaryI18nUtil.getI18nLabel(98395, "上上月1号——上上月最后一天")
: SalaryI18nUtil.getI18nLabel(98399, "上上月{0}号——上月{1}号")
.replace("{0}", "" + salaryCycleFromDay)
.replace("{1}", "" + (salaryCycleFromDay - 1));
break;
case LAST_MONTH:
salaryCycleStr = Objects.equals(salaryCycleFromDay, 1) ? SalaryI18nUtil.getI18nLabel(98396, "上月1号——上月最后一天")
: SalaryI18nUtil.getI18nLabel(98400, "上月{0}号——本月{1}号")
.replace("{0}", "" + salaryCycleFromDay)
.replace("{1}", "" + (salaryCycleFromDay - 1));
break;
case THIS_MONTH:
salaryCycleStr = Objects.equals(salaryCycleFromDay, 1) ? SalaryI18nUtil.getI18nLabel(98397, "上月1号——上月最后一天")
: SalaryI18nUtil.getI18nLabel(98401, "本月{0}号——下月{1}号")
.replace("{0}", "" + salaryCycleFromDay)
.replace("{1}", "" + (salaryCycleFromDay - 1));
break;
case NEXT_MONTH:
salaryCycleStr = Objects.equals(salaryCycleFromDay, 1) ? SalaryI18nUtil.getI18nLabel(98398, "下月1号——下月最后一天")
: SalaryI18nUtil.getI18nLabel(98402, "下月{0}号——下下月{1}号")
.replace("{0}", "" + salaryCycleFromDay)
.replace("{1}", "" + (salaryCycleFromDay - 1));
break;
default:
salaryCycleStr = "";
}
return salaryCycleStr;
}
/**
* 薪资账套po转换成薪资账套详情dto
*
* @param salarySobPO 薪资账套po
* @return
*/
public static SalarySobBasicFormDTO convert2FormDTO(SalarySobPO salarySobPO) {
return new SalarySobBasicFormDTO()
.setId(salarySobPO.getId())
.setName(salarySobPO.getName())
.setTaxableItems(IncomeCategoryEnum.parseByValue(salarySobPO.getIncomeCategory()))
.setSalaryCycleType(SalaryCycleTypeEnum.parseByValue(salarySobPO.getSalaryCycleType()))
.setSalaryCycleFromDay(salarySobPO.getSalaryCycleFromDay())
.setTaxCycleType(SalaryCycleTypeEnum.parseByValue(salarySobPO.getTaxCycleType()))
.setAttendCycleType(SalaryCycleTypeEnum.parseByValue(salarySobPO.getAttendCycleType()))
.setAttendCycleFromDay(salarySobPO.getAttendCycleFromDay())
.setSocialSecurityCycleType(SalaryCycleTypeEnum.parseByValue(salarySobPO.getSocialSecurityCycleType()))
.setEmployeeRange("1")
.setDescription(salarySobPO.getDescription());
}
}

View File

@ -0,0 +1,90 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import java.time.LocalDate;
import java.time.Period;
import java.time.YearMonth;
import java.util.Objects;
/**
* 薪资账套的薪资周期税款所属期考勤周期福利台账月份
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobCycleBO {
/**
* 根据薪资所属月计算出薪资账套的薪资周期税款所属期考勤周期福利台账月份
*
* @param salarySob 薪资账套
* @param salaryMonth 薪资所属月
* @return
*/
public static SalarySobCycleDTO buildSalarySobCycle(SalarySobPO salarySob, YearMonth salaryMonth) {
if (salarySob == null) {
return null;
}
return SalarySobCycleDTO.builder()
.salarySobId(salarySob.getId())
.salaryMonth(salaryMonth)
.taxCycle(buildCycle(salaryMonth, salarySob.getTaxCycleType()))
.socialSecurityCycle(buildCycle(salaryMonth, salarySob.getSocialSecurityCycleType()))
.salaryCycle(buildCycleDateRange(salaryMonth, salarySob.getSalaryCycleType(), salarySob.getSalaryCycleFromDay()))
.attendCycle(buildCycleDateRange(salaryMonth, salarySob.getAttendCycleType(), salarySob.getAttendCycleFromDay()))
.build();
}
/**
* 根据薪资所属月薪资账套所设置的税款所属期或福利台账月份计算出税款所属期福利台账的具体月份
*
* @param salaryMonth 薪资所属月
* @param cycleType 薪资账套所设置的税款所属期或福利台账月份
* @return
*/
private static YearMonth buildCycle(YearMonth salaryMonth, Integer cycleType) {
if (Objects.equals(cycleType, SalaryCycleTypeEnum.BEFORE_LAST_MONTH.getValue())) {
return salaryMonth.plus(Period.ofMonths(-2));
}
if (Objects.equals(cycleType, SalaryCycleTypeEnum.LAST_MONTH.getValue())) {
return salaryMonth.plus(Period.ofMonths(-1));
}
if (Objects.equals(cycleType, SalaryCycleTypeEnum.THIS_MONTH.getValue())) {
return salaryMonth;
}
if (Objects.equals(cycleType, SalaryCycleTypeEnum.NEXT_MONTH.getValue())) {
return salaryMonth.plus(Period.ofMonths(1));
}
return null;
}
/**
* 根据薪资所属月薪资账套所设置的薪资周期或考勤周期薪资周期起始日活考勤周期起始日计算出薪资账套的薪资周期考勤周期的具体日期范围
*
* @param salaryMonth 薪资所属月
* @param cycleType 薪资账套所设置的薪资周期或考勤周期
* @param fromDay 薪资账套所设置的薪资周期起始日或考勤周期起始日
* @return
*/
private static LocalDateRange buildCycleDateRange(YearMonth salaryMonth, Integer cycleType, Integer fromDay) {
YearMonth result = buildCycle(salaryMonth, cycleType);
if (result == null) {
return null;
}
LocalDate fromDate = result.atEndOfMonth();
if (fromDate.getDayOfMonth() > fromDay) {
fromDate = result.atDay(fromDay);
}
LocalDate endDate = fromDate.plusMonths(1).plusDays(-1);
return LocalDateRange.builder()
.fromDate(fromDate)
.endDate(endDate)
.build();
}
}

View File

@ -0,0 +1,128 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资账套人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobRangeBO {
/**
* 将薪资账套的人员范围转换成人员查询参数
*
* @param salarySobRanges 薪资账套的人员范围
* @return
*/
public static List<SalarySobRangeEmpQueryParam> convert2EmployeeQueryParam(List<SalarySobRangePO> salarySobRanges) {
if (CollectionUtils.isEmpty(salarySobRanges)) {
return Collections.emptyList();
}
Map<Integer, List<SalarySobRangePO>> rangeMap = SalaryEntityUtil.group2Map(salarySobRanges, SalarySobRangePO::getTargetType);
List<SalarySobRangeEmpQueryParam> resultParams = Lists.newArrayListWithExpectedSize(rangeMap.size());
rangeMap.forEach((targetType, salarySobRangePOS) -> {
List<String> employeeStatus = salarySobRangePOS.stream()
.map(e -> SalaryEmployeeStatusEnum.parseByValue(e.getEmployeeStatus()))
.filter(Objects::nonNull)
.map(e -> e.name().toLowerCase())
.distinct()
.collect(Collectors.toList());
if (employeeStatus.contains(SalaryEmployeeStatusEnum.ALL.name().toLowerCase())) {
employeeStatus = Collections.emptyList();
}
TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(targetType);
SalarySobRangeEmpQueryParam queryParam = SalarySobRangeEmpQueryParam.builder()
.targetType(Optional.ofNullable(targetTypeEnum).map(TargetTypeEnum::name).orElse(StringUtils.EMPTY))
.targetIds(SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getTargetId))
.employeeStatus(employeeStatus)
.build();
resultParams.add(queryParam);
});
return resultParams;
}
/**
* 薪资账套的人员范围po转换成人员范围列表dto
*
* @param salarySobRanges 薪资账套的人员范围
* @param employeeComInfos 人员信息
* @param departmentComInfos 部门信息
* @param positionComInfos 岗位信息
* @return
*/
// public static List<SalarySobRangeListDTO> convert2ListDTO(List<SalarySobRangePO> salarySobRanges,
// List<HrmEmployeeComInfo> employeeComInfos,
// List<HrmDepartmentComInfo> departmentComInfos,
// List<HrmPositionComInfo> positionComInfos) {
// if (CollectionUtils.isEmpty(salarySobRanges)) {
// return Collections.emptyList();
// }
// Map<Long, String> employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, HrmEmployeeComInfo::getId, HrmEmployeeComInfo::getUsername);
// Map<Long, String> departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName);
// Map<Long, String> positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, HrmPositionComInfo::getId, HrmPositionComInfo::getName);
// return salarySobRanges.stream()
// .map(salarySobRangePO -> {
// TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRangePO.getTargetType());
// SalaryEmployeeStatusEnum salaryEmployeeStatusEnum = SalaryEmployeeStatusEnum.parseByValue(salarySobRangePO.getEmployeeStatus());
// return SalarySobRangeListDTO.builder()
// .id(salarySobRangePO.getId())
// .salarySobId(salarySobRangePO.getSalarySobId())
// .targetType(targetTypeEnum)
// .targetTypeName(Optional.ofNullable(targetTypeEnum)
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
// .orElse(StringUtils.EMPTY))
// .targetId(salarySobRangePO.getTargetId())
// .targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, positionComInfoMap))
// .employeeStatus(Optional.ofNullable(salaryEmployeeStatusEnum)
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
// .orElse(StringUtils.EMPTY))
// .build();
// })
// .collect(Collectors.toList());
// }
/**
* 解析薪资账套人员范围中对象的名称可能是人员名称部门名称岗位名称
*
* @param salarySobRange 薪资账套的人员范围
* @param employeeComInfoMap 人员信息
* @param departmentComInfoMap 部门信息
* @param positionComInfoMap 岗位信息
* @return
*/
private static String buildTargetName(SalarySobRangePO salarySobRange,
Map<Long, String> employeeComInfoMap,
Map<Long, String> departmentComInfoMap,
Map<Long, String> positionComInfoMap) {
TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRange.getTargetType());
if (Objects.isNull(targetTypeEnum)) {
return StringUtils.EMPTY;
}
switch (targetTypeEnum) {
case EMPLOYEE:
return employeeComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
case DEPT:
return departmentComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
case POSITION:
return positionComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
default:
return StringUtils.EMPTY;
}
}
}

View File

@ -0,0 +1,90 @@
package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 薪资账套的人员范围保存
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobRangeSaveBO {
/**
* 处理前端传回的保存参数转换成对应的po如果保存参数中的人员部门岗位等之前就已经添加过了就不需要再次保存了
*
* @param salarySobRanges
* @param saveParam
* @param employeeId
* @return
*/
public static Result handle(List<SalarySobRangePO> salarySobRanges, SalarySobRangeSaveParam saveParam, Long employeeId) {
Date now = new Date();
Result handleResult = Result.builder()
.needInsertSalarySobRanges(Lists.newArrayList())
.needUpdateSalarySobRanges(Lists.newArrayList())
.build();
if (CollectionUtils.isEmpty(saveParam.getTargetParams())) {
return handleResult;
}
Map<String, SalarySobRangePO> salarySobRangeMap = SalaryEntityUtil.convert2Map(salarySobRanges, e -> e.getIncludeType() + "-" + e.getTargetType() + "-" + e.getTargetId());
for (SalarySobRangeSaveParam.SalarySobRangeTargetParam targetParam : saveParam.getTargetParams()) {
String key = saveParam.getIncludeType() + "-" + targetParam.getTargetType().getValue() + "-" + targetParam.getTargetId();
if (salarySobRangeMap.containsKey(key)) {
SalarySobRangePO salarySobRangePO = salarySobRangeMap.get(key);
salarySobRangePO.setEmployeeStatus(saveParam.getEmployeeStatus().getValue());
salarySobRangePO.setUpdateTime(now);
handleResult.getNeedUpdateSalarySobRanges().add(salarySobRangePO);
continue;
}
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
// .id(IdGenerator.generate())
.salarySobId(saveParam.getSalarySobId())
.targetType(targetParam.getTargetType().getValue())
.targetId(targetParam.getTargetId())
.employeeStatus(saveParam.getEmployeeStatus().getValue())
.includeType(saveParam.getIncludeType())
.creator(employeeId)
.createTime(now)
.updateTime(now)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.deleteType(0)
.build();
handleResult.getNeedInsertSalarySobRanges().add(salarySobRangePO);
}
return handleResult;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class Result {
/**
* 需要更新的人员范围
*/
private Collection<SalarySobRangePO> needUpdateSalarySobRanges;
/**
* 需要新增的人员范围
*/
private Collection<SalarySobRangePO> needInsertSalarySobRanges;
}
}

View File

@ -0,0 +1,149 @@
package com.engine.salary.entity.salarysob.dto;
import com.engine.salary.component.WeaFormOption;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.SalarySobStatusEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.util.SalaryI18nUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Collections;
import java.util.List;
/**
* 薪资账套基础信息表单
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobBasicFormDTO {
//主键id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
// @SalaryForm(
// label = "账套名称",
// labelId = 93876,
// items = {
// @SalaryFormItem(itemType = WeaFormItemType.INPUT, required = true, maxLength = "40")
// }
// )
// //薪资账套的名称")
private String name;
// @SalaryForm(
// label = "薪资类型",
// labelId = 98380,
// items = @SalaryFormItem(name = "taxableItems", itemType = WeaFormItemType.SELECT, required = true, optionsEnum = IncomeCategoryEnum.class)
// )
//薪资类型")
private IncomeCategoryEnum taxableItems;
// @SalaryForm(
// label = "薪资周期",
// labelId = 86155,
// items = {
// @SalaryFormItem(name = "salaryCycleType", itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryCycleTypeEnum.class),
// @SalaryFormItem(name = "salaryCycleFromDay", itemType = WeaFormItemType.SELECT, required = true, options = "listCycleFromDayOption()")
// }
// )
//薪资周期")
private SalaryCycleTypeEnum salaryCycleType;
//薪资周期的起始日期")
private Integer salaryCycleFromDay;
// @SalaryForm(
// label = "税款所属期",
// labelId = 86176,
// items = {
// @SalaryFormItem(itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryCycleTypeEnum.class)
// }
// )
//税款所属期")
private SalaryCycleTypeEnum taxCycleType;
// @SalaryForm(
// label = "考勤周期",
// labelId = 87616,
// items = {
// @SalaryFormItem(name = "attendCycleType", itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryCycleTypeEnum.class),
// @SalaryFormItem(name = "attendCycleFromDay", itemType = WeaFormItemType.SELECT, required = true, options = "listCycleFromDayOption()")
// }
// )
//考勤周期")
private SalaryCycleTypeEnum attendCycleType;
//考勤周期起始日期")
private Integer attendCycleFromDay;
// @SalaryForm(
// label = "福利台账月份",
// labelId = 91560,
// items = {
// @SalaryFormItem(itemType = WeaFormItemType.SELECT, required = true, optionsEnum = SalaryCycleTypeEnum.class)
// }
// )
//福利台账月份")
private SalaryCycleTypeEnum socialSecurityCycleType;
// @SalaryForm(
// label = "核算人员范围",
// labelId = 95789,
// items = {
// @SalaryFormItem(itemType = WeaFormItemType.CHECKBOX, required = true, options = "listEmployeeRangeOption()")
// }
// )
//核算人员范围")
private String employeeRange;
//目前薪资账套所处的步骤")
private SalarySobStatusEnum status;
// @SalaryForm(
// label = "备注",
// labelId = 84961,
// items = {
// @SalaryFormItem(itemType = WeaFormItemType.TEXTAREA)
// }
// )
//备注")
private String description;
/**
* 薪资账套详情-薪资周期/考勤周期
*
* @return
*/
public List<WeaFormOption> listCycleFromDayOption() {
List<WeaFormOption> resultList = Lists.newArrayListWithExpectedSize(31);
for (int i = 1; i <= 31; i++) {
resultList.add(new WeaFormOption(String.valueOf(i), SalaryI18nUtil.getI18nLabel(98382, "{0}号").replace("{0}", "" + i)));
}
return resultList;
}
/**
* 薪资账套详情-核算人员范围
*
* @return
*/
public List<WeaFormOption> listEmployeeRangeOption() {
WeaFormOption weaFormOption = new WeaFormOption("1", SalaryI18nUtil.getI18nLabel(98381, "【入职日期≤薪资周期止】且【离职日期≥薪资周期起】"));
weaFormOption.setDisabled(true);
return Collections.singletonList(weaFormOption);
}
}

View File

@ -0,0 +1,53 @@
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 com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 薪资账套列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "b4f85287-e3f9-4d11-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX, operates = {
@SalaryTableOperate(index = "0", text = "编辑"),
@SalaryTableOperate(index = "1", text = "复制"),
@SalaryTableOperate(index = "2", text = "操作日志"),
@SalaryTableOperate(index = "3", text = "关联人员"),
@SalaryTableOperate(index = "4", text = "删除")
})
public class SalarySobListDTO {
//主键id
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@SalaryTableColumn(text = "账套名称", width = "10%", column = "name")
private String name;
@SalaryTableColumn(text = "薪资周期", width = "10%", column = "salaryCycle")
private String salaryCycle;
@SalaryTableColumn(text = "启用", width = "10%", column = "disable")
private Integer disable;
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
private String description;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;
}

View File

@ -0,0 +1,51 @@
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.enums.salarysob.TargetTypeEnum;
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
@SalaryTable(pageId = "b4f85287-e3f9-4d11-ad90-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX)
public class SalarySobRangeListDTO {
//主键id
private Long id;
//薪资账套的id
private Long salarySobId;
/**
* 对象类型
*
* @see TargetTypeEnum
*/
private Integer targetType;
@SalaryTableColumn(text = "对象类型", width = "10%", column = "targetTypeName")
private String targetTypeName;
@SalaryTableColumn(text = "对象", width = "10%", column = "targetName")
private String targetName;
//对象
private Long targetId;
@SalaryTableColumn(text = "员工状态", width = "10%", column = "employeeStatus")
private String employeeStatus;
}

View File

@ -0,0 +1,33 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
/**
* 调薪规则查询薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobAdjustRuleItemQueryParam {
/**
* 薪资账套的ID不允许为空
*/
@DataCheck(require = true, message = "薪资账套的ID不允许为空")
private Long salarySobId;
//已经设置了需要排除的账套内的薪资项目副本id
private Collection<Long> excludeSalaryItemIds;
}

View File

@ -0,0 +1,27 @@
package com.engine.salary.entity.salarysob.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 调薪计薪规则查询参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/31/21 1:52 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobAdjustRuleQueryParam {
/**
* 薪资账套的ID不允许为空
*/
// //@NotNull(message = "LABEL:86575")
// //薪资账套的id")
private Long salarySobId;
}

View File

@ -0,0 +1,52 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @description: 调薪计薪规则保存参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/31/21 11:03 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobAdjustRuleSaveParam {
/**
* 薪资账套的ID不允许为空
*/
// //@NotNull(message = "LABEL:86575")
// //薪资账套的id")
private Long salarySobId;
//规则参数")
private List<RuleParam> ruleParams;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RuleParam {
//薪资项目的id")
private Long salaryItemId;
//生效日期")
private Integer dayOfMonth;
//在生效日期之前调薪如何调整")
private SalarySobAdjustRuleTypeEnum beforeAdjustmentType;
//在生效日期之后调薪如何调整")
private SalarySobAdjustRuleTypeEnum afterAdjustmentType;
}
}

View File

@ -2,13 +2,14 @@ package com.engine.salary.entity.salarysob.param;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.util.valid.DataCheck;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 薪资账套保存参数
* <p>Copyright: Copyright (c) 2022</p>
@ -24,60 +25,69 @@ import lombok.NoArgsConstructor;
public class SalarySobBasicSaveParam {
//主键id
@DataCheck(require = true, runtime = RuntimeTypeEnum.UPDATE, message = "id不允许为空")
private Long id;
/**
* 名称不允许为空
* 名称不能超过40个字符长度
*/
//薪资账套的名称
@DataCheck(require = true, max = 40, message = "名称不允许为空且不能超过40个字符长度")
private String name;
/**
* 薪资类型不允许为空
*
* @see IncomeCategoryEnum
*/
//薪资类型
private IncomeCategoryEnum taxableItems;
@DataCheck(require = true, message = "薪资类型不允许为空")
private Integer taxableItems;
/**
* 薪资周期不允许为空
*
* @see SalaryCycleTypeEnum
*/
//薪资周期
private SalaryCycleTypeEnum salaryCycleType;
@DataCheck(require = true, message = "薪资周期不允许为空")
private Integer salaryCycleType;
/**
* 薪资周期的起始日期不允许为空
*/
//薪资周期的起始日期
@DataCheck(require = true, message = "薪资周期的起始日期不允许为空")
private Integer salaryCycleFromDay;
/**
* 税款所属期不允许为空
*
* @see SalaryCycleTypeEnum
*/
//税款所属期
private SalaryCycleTypeEnum taxCycleType;
@DataCheck(require = true, message = "税款所属期不允许为空")
private Integer taxCycleType;
/**
* 考勤周期不允许为空
*
* @see SalaryCycleTypeEnum
*/
//考勤周期
private SalaryCycleTypeEnum attendCycleType;
@DataCheck(require = true, message = "考勤周期不允许为空")
private Integer attendCycleType;
/**
* 考勤周期起始日期不允许为空
*/
//考勤周期起始日期
@DataCheck(require = true, message = "考勤周期起始日期不允许为空")
private Integer attendCycleFromDay;
/**
* 福利台账月份不允许为空
*
* @see SalaryCycleTypeEnum
*/
//福利台账月份
private SalaryCycleTypeEnum socialSecurityCycleType;
@DataCheck(require = true, message = "福利台账月份不允许为空")
private Integer socialSecurityCycleType;
/**
* 备注不能超过80个字符
*/
//备注
@DataCheck(max = 80, message = "备注不能超过80个字符")
private String description;
}

View File

@ -0,0 +1,27 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 薪资账套校验规则查询参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/23/21 7:02 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobCheckRuleQueryParam extends BaseQueryParam {
//薪资账套id")
private Long salarySobId;
//名称")
private String name;
}

View File

@ -0,0 +1,49 @@
package com.engine.salary.entity.salarysob.param;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @description: 薪资账套的校验规则保存参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/20/22 10:31 AM
* @version:v1.0
*/
@Data
@Accessors(chain = true)
public class SalarySobCheckRuleSaveParam {
//主键id")
private Long id;
/**
* 薪资账套的ID不允许为空
*/
//@NotNull(message = "LABEL:86575")
//薪资账套id")
private Long salarySobId;
/**
* 名称不允许为空
*/
//@NotEmpty(message = "LABEL:85607")
//@Length(max = 40, message = "LABEL:98177")
//规则名称")
private String name;
/**
* 校验规则公式不允许为空
*/
//@NotNull(message = "LABEL:98647")
//公式id")
private Long formulaId;
/**
* 备注不能超过80个字符
*/
//@Length(max = 80, message = "LABEL:98588")
//备注")
private String description;
}

View File

@ -0,0 +1,101 @@
package com.engine.salary.entity.salarysob.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @description: 薪资账套薪资项目保存参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/25/21 2:43 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobItemSaveParam {
/**
* 薪资账套的ID不允许为空
*/
//@NotNull(message = "LABEL:86575")
//薪资账套id")
private Long salarySobId;
/**
* 员工信息字段不能为空
*/
//@NotEmpty(message = "LABEL:98610")
//薪资账套薪资项目保存参数-员工信息字段")
private List<SalarySobEmpFieldParam> empFields;
//薪资账套薪资项目保存参数-薪资项目分组")
private List<SalarySobItemGroupParam> itemGroups;
//薪资账套薪资项目保存参数-薪资项目未分类")
private List<SalarySobItemParam> items;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//"薪资账套薪资项目保存参数-员工基本信息字段")
public static class SalarySobEmpFieldParam {
//主键id")
private Long id;
//员工基本信息字段")
private String fieldId;
//显示顺序")
private Integer sortedIndex;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//"薪资账套薪资项目保存参数-薪资项目")
public static class SalarySobItemParam {
//主键id")
private Long id;
//薪资项目的id")
private Long salaryItemId;
//显示顺序")
private Integer sortedIndex;
//公式")
private Long formulaId;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//"薪资账套薪资项目保存参数-薪资项目分类")
public static class SalarySobItemGroupParam {
//主键id")
private Long id;
//@Max(value = 40, message = "LABEL:98177")
//@NotEmpty(message = "LABEL:86266")
//分类名称")
private String name;
//显示顺序")
private Integer sortedIndex;
//分类下的薪资项目")
private List<SalarySobItemParam> items;
}
}

View File

@ -0,0 +1,20 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @description: 薪资账套列表查询参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/18/22 3:04 PM
* @version:v1.0
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SalarySobListQueryParam extends BaseQueryParam {
//薪资账套名称")
private String name;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.salarysob.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
/**
* @description: 薪资账套人员范围-直接查询
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/3/21 1:24 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobRangeEmpQueryParam {
//对象类型")
private String targetType;
//对象id")
private Collection<Long> targetIds;
//人员状态")
private Collection<String> employeeStatus;
}

View File

@ -0,0 +1,29 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 薪资账套人员范围查询条件
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/22/21 11:10 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//薪资账套人员范围查询条件")
public class SalarySobRangeQueryParam extends BaseQueryParam {
//@NotNull(message = "LABEL:90405")
//薪资账套的id")
private Long salarySobId;
//对象名称")
private String targetName;
}

View File

@ -0,0 +1,68 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import lombok.Data;
import java.util.List;
/**
* @description: 薪资账套人员范围保存参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/11/21 10:05 AM
* @version:v1.0
*/
@Data
//薪资账套人员范围保存参数")
public class SalarySobRangeSaveParam {
/**
* 薪资账套的ID不允许为空
*/
//@NotNull(message = "LABEL:86575")
//薪资账套的id")
private Long salarySobId;
/**
* 只能选择 关联人员范围/从范围中排除
*/
//@NotNull(message = "LABEL:84026")
//@Min(message = "LABEL:84026", value = 0)
//@Max(message = "LABEL:84026", value = 1)
//是包含还是排除0排除1包含")
private Integer includeType;
/**
* 对象不能为空
*/
//@NotEmpty(message = "LABEL:98598")
//对象")
private List<SalarySobRangeTargetParam> targetParams;
/**
* 员工状态不允许为空
*/
//@NotNull(message = "LABEL:98599")
//员工状态")
private SalaryEmployeeStatusEnum employeeStatus;
@Data
//薪资账套人员范围保存参数中的对象")
public static class SalarySobRangeTargetParam {
/**
* 对象类型不能为空
*/
//@NotNull(message = "LABEL:98600")
//对象类型")
private TargetTypeEnum targetType;
/**
* 对象不能为空
*/
//@NotNull(message = "LABEL:98598")
//对象id")
private Long targetId;
}
}

View File

@ -0,0 +1,34 @@
package com.engine.salary.entity.salarysob.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 更新校验规则的公式校验规则更新参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/8/21 10:35 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UpdateCheckRuleFormulaParam {
/**
* 校验规则ID不能为空
*/
//@NotNull(message = "LABEL:98648")
//校验规则的id")
private Long id;
/**
* 校验规则公式能为空
*/
//@NotNull(message = "LABEL:98647")
//校验规则的公式id")
private Long formulaId;
}

View File

@ -0,0 +1,87 @@
package com.engine.salary.entity.salarysob.po;
import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Collection;
import java.util.Date;
/**
* 调薪计薪规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_sob_adjust_rule
public class SalarySobAdjustRulePO {
/**
* 主键id
*/
private Long id;
/**
* 薪资账套id
*/
private Long salarySobId;
/**
* 薪资项目id
*/
private Long salaryItemId;
/**
* 生效日期
*/
private Integer dayOfMonth;
/**
* 在生效日期之前调薪如何调整
*
* @see SalarySobAdjustRuleTypeEnum
*/
private Integer beforeAdjustmentType;
/**
* 在生效日期之后调薪如何调整
*
* @see SalarySobAdjustRuleTypeEnum
*/
private Integer afterAdjustmentType;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -0,0 +1,77 @@
package com.engine.salary.entity.salarysob.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* 薪资账套校验规则
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_sob_check_rule")
public class SalarySobCheckRulePO {
/**
* 主键id
*/
private Long id;
/**
* 薪资账套id
*/
private Long salarySobId;
/**
* 名称
*/
private String name;
/**
* 校验规则
*/
private Long formulaId;
/**
* 备注
*/
private String description;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -0,0 +1,72 @@
package com.engine.salary.entity.salarysob.po;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Collection;
import java.util.Date;
/**
* 薪资账套默认的员工信息字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
//hrsa_sob_default_emp_field")
public class SalarySobDefaultEmpFieldPO {
/**
* 主键id
*/
private Long id;
/**
* 字段code
*/
private String fieldCode;
/**
* 排序字段
*/
private Integer sortedIndex;
/**
* 是否可以删除
*/
private Integer canDelete;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -0,0 +1,80 @@
package com.engine.salary.entity.salarysob.po;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* 薪资账套默认包含的薪资项目
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_sob_default_item")
public class SalarySobDefaultItemPO {
/**
* 主键id
*/
private Long id;
/**
* 薪资类型
*
* @see IncomeCategoryEnum
*/
private Integer incomeCategory;
/**
* 系统默认的薪资项目id
*/
private Long sysSalaryItemId;
/**
* 能否编辑
*/
private Integer canEdit;
/**
* 能否删除
*/
private Integer canDelete;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -0,0 +1,79 @@
package com.engine.salary.entity.salarysob.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Collection;
import java.util.Date;
/**
* 薪资账套-薪资项目-员工基本信息
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_sob_emp_field
public class SalarySobEmpFieldPO {
/**
* 主键id
*/
private Long id;
/**
* 薪资账套id
*/
private Long salarySobId;
/**
* 字段code
*/
private String fieldCode;
/**
* 排序字段
*/
private Integer sortedIndex;
/**
* 是否可以删除
*/
private Integer canDelete;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -5,6 +5,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
@ -81,4 +82,6 @@ public class SalarySobItemPO {
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -4,7 +4,9 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Collection;
import java.util.Date;
/**
@ -12,8 +14,10 @@ import java.util.Date;
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_sob
public class SalarySobPO {
/**
* 主键id
@ -80,4 +84,6 @@ public class SalarySobPO {
*/
private String tenantKey;
Collection<Long> ids;
}

View File

@ -0,0 +1,86 @@
package com.engine.salary.entity.salarysob.po;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
* 关联人员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_sob_range", autoResultMap = true)
public class SalarySobRangePO {
/**
* 主键id
*/
private Long id;
/**
* 薪资账套的id
*/
private Long salarySobId;
/**
* 对象类型
* @see TargetTypeEnum
*/
private Integer targetType;
/**
* 对象id
*/
private Long targetId;
/**
* 人员状态
* @see SalaryEmployeeStatusEnum
*/
private Integer employeeStatus;
/**
* 是包含还是排除 0排除1包含
*/
private Integer includeType;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
Collection<Long> ids;
}

View File

@ -6,12 +6,13 @@ import com.engine.salary.enums.BaseEnum;
import java.util.Objects;
/**
* @description:
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/22/21 5:26 PM
* @version:v1.0
*/
* 人员状态
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SalaryEmployeeStatusEnum implements BaseEnum<Integer> {
ALL(0, "全部", 85155),

View File

@ -2,7 +2,7 @@ package com.engine.salary.exception;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SalaryRunTimeException extends RuntimeException {
public SalaryRunTimeException(String message) {
super(message);

View File

@ -1,26 +1,27 @@
--
alter table hrsa_tax_agent modify id bigint auto_increment;
alter table hrsa_tax_rate_base modify id bigint auto_increment;
alter table hrsa_tax_rate_detail modify id bigint auto_increment;
alter table hrsa_add_up_deduction modify id bigint auto_increment;
alter table hrsa_add_up_situation modify id bigint auto_increment;
alter table hrsa_other_deduction modify id bigint auto_increment;
alter table hrsa_attend_quote_field modify id bigint auto_increment;
alter table hrsa_attend_quote_sync_set modify id bigint auto_increment;
alter table hrsa_tax_agent modify id bigint auto_increment;
alter table hrsa_tax_rate_base modify id bigint auto_increment;
alter table hrsa_tax_rate_detail modify id bigint auto_increment;
alter table hrsa_add_up_deduction modify id bigint auto_increment;
alter table hrsa_add_up_situation modify id bigint auto_increment;
alter table hrsa_other_deduction modify id bigint auto_increment;
alter table hrsa_attend_quote_field modify id bigint auto_increment;
alter table hrsa_attend_quote_sync_set modify id bigint auto_increment;
alter table hrsa_salary_item modify id bigint auto_increment;
alter table hrsa_salary_item modify id bigint auto_increment;
alter table hrsa_salary_sob modify id bigint auto_increment;
--
alter table hrsa_social_security_scheme modify id bigint auto_increment;
alter table hrsa_scheme_detail modify id bigint auto_increment;
alter table hrsa_insurance_category modify id bigint auto_increment;
alter table hrsa_social_security_scheme modify id bigint auto_increment;
alter table hrsa_scheme_detail modify id bigint auto_increment;
alter table hrsa_insurance_category modify id bigint auto_increment;
--
alter table hrsa_social_archives modify id bigint auto_increment;
alter table hrsa_fund_archives modify id bigint auto_increment;
alter table hrsa_other_archives modify id bigint auto_increment;
alter table hrsa_social_archives modify id bigint auto_increment;
alter table hrsa_fund_archives modify id bigint auto_increment;
alter table hrsa_other_archives modify id bigint auto_increment;

View File

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

View File

@ -0,0 +1,358 @@
<?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.SalarySobMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salarysob.po.SalarySobPO">
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="income_category" property="incomeCategory"/>
<result column="salary_cycle_type" property="salaryCycleType"/>
<result column="salary_cycle_from_day" property="salaryCycleFromDay"/>
<result column="tax_cycle_type" property="taxCycleType"/>
<result column="attend_cycle_type" property="attendCycleType"/>
<result column="attend_cycle_from_day" property="attendCycleFromDay"/>
<result column="social_security_cycle_type" property="socialSecurityCycleType"/>
<result column="disable" property="disable"/>
<result column="description" property="description"/>
<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.name
, t.income_category
, t.salary_cycle_type
, t.salary_cycle_from_day
, t.tax_cycle_type
, t.attend_cycle_type
, t.attend_cycle_from_day
, t.social_security_cycle_type
, t.disable
, t.description
, 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 t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salarysob.po.SalarySobPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob t
WHERE delete_type = 0
<if test="id != null and id != ''">
AND id = #{id}
</if>
<if test="name != null and name != ''">
AND name = #{name}
</if>
<if test="incomeCategory != null and incomeCategory != ''">
AND income_category = #{incomeCategory}
</if>
<if test="salaryCycleType != null and salaryCycleType != ''">
AND salary_cycle_type = #{salaryCycleType}
</if>
<if test="salaryCycleFromDay != null and salaryCycleFromDay != ''">
AND salary_cycle_from_day = #{salaryCycleFromDay}
</if>
<if test="taxCycleType != null and taxCycleType != ''">
AND tax_cycle_type = #{taxCycleType}
</if>
<if test="attendCycleType != null and attendCycleType != ''">
AND attend_cycle_type = #{attendCycleType}
</if>
<if test="attendCycleFromDay != null and attendCycleFromDay != ''">
AND attend_cycle_from_day = #{attendCycleFromDay}
</if>
<if test="socialSecurityCycleType != null and socialSecurityCycleType != ''">
AND social_security_cycle_type = #{socialSecurityCycleType}
</if>
<if test="disable != null and disable != ''">
AND disable = #{disable}
</if>
<if test="description != null and description != ''">
AND description = #{description}
</if>
<if test="creator != null and creator != ''">
AND creator = #{creator}
</if>
<if test="createTime != null and createTime != ''">
AND create_time = #{createTime}
</if>
<if test="updateTime != null and updateTime != ''">
AND update_time = #{updateTime}
</if>
<if test="deleteType != null and deleteType != ''">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null and tenantKey != ''">
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.SalarySobPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_salary_sob
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="incomeCategory != null">
income_category,
</if>
<if test="salaryCycleType != null">
salary_cycle_type,
</if>
<if test="salaryCycleFromDay != null">
salary_cycle_from_day,
</if>
<if test="taxCycleType != null">
tax_cycle_type,
</if>
<if test="attendCycleType != null">
attend_cycle_type,
</if>
<if test="attendCycleFromDay != null">
attend_cycle_from_day,
</if>
<if test="socialSecurityCycleType != null">
social_security_cycle_type,
</if>
<if test="disable != null">
disable,
</if>
<if test="description != null">
description,
</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="name != null">
#{name},
</if>
<if test="incomeCategory != null">
#{incomeCategory},
</if>
<if test="salaryCycleType != null">
#{salaryCycleType},
</if>
<if test="salaryCycleFromDay != null">
#{salaryCycleFromDay},
</if>
<if test="taxCycleType != null">
#{taxCycleType},
</if>
<if test="attendCycleType != null">
#{attendCycleType},
</if>
<if test="attendCycleFromDay != null">
#{attendCycleFromDay},
</if>
<if test="socialSecurityCycleType != null">
#{socialSecurityCycleType},
</if>
<if test="disable != null">
#{disable},
</if>
<if test="description != null">
#{description},
</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.SalarySobPO">
UPDATE hrsa_salary_sob
<set>
name=#{name},
income_category=#{incomeCategory},
salary_cycle_type=#{salaryCycleType},
salary_cycle_from_day=#{salaryCycleFromDay},
tax_cycle_type=#{taxCycleType},
attend_cycle_type=#{attendCycleType},
attend_cycle_from_day=#{attendCycleFromDay},
social_security_cycle_type=#{socialSecurityCycleType},
disable=#{disable},
description=#{description},
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.SalarySobPO">
UPDATE hrsa_salary_sob
<set>
<if test="name != null">
name=#{name},
</if>
<if test="incomeCategory != null">
income_category=#{incomeCategory},
</if>
<if test="salaryCycleType != null">
salary_cycle_type=#{salaryCycleType},
</if>
<if test="salaryCycleFromDay != null">
salary_cycle_from_day=#{salaryCycleFromDay},
</if>
<if test="taxCycleType != null">
tax_cycle_type=#{taxCycleType},
</if>
<if test="attendCycleType != null">
attend_cycle_type=#{attendCycleType},
</if>
<if test="attendCycleFromDay != null">
attend_cycle_from_day=#{attendCycleFromDay},
</if>
<if test="socialSecurityCycleType != null">
social_security_cycle_type=#{socialSecurityCycleType},
</if>
<if test="disable != null">
disable=#{disable},
</if>
<if test="description != null">
description=#{description},
</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.SalarySobPO">
UPDATE hrsa_salary_sob
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<update id="deleteByIds">
UPDATE hrsa_salary_sob
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<select id="listByParam" resultType="com.engine.salary.entity.salaryitem.po.SalaryItemPO">
SELECT
<include refid="baseColumns"/>
FROM
hrsa_salary_item t
WHERE
delete_type = 0
<include refid="paramSql"/>
</select>
<sql id="paramSql">
<if test="param.name != null and param.name != ''">
AND name like CONCAT('%',#{param.name},'%')
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.name != null and param.name != ''">
AND name like '%'||#{param.name}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.name != null and param.name != ''">
AND name like '%'+#{param.name}+'%'
</if>
</sql>
</mapper>

View File

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

View File

@ -0,0 +1,362 @@
<?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.SalarySobRangeMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salarysob.po.SalarySobRangePO">
<result column="id" property="id"/>
<result column="salary_sob_id" property="salarySobId"/>
<result column="target_type" property="targetType"/>
<result column="target_id" property="targetId"/>
<result column="employee_status" property="employeeStatus"/>
<result column="include_type" property="includeType"/>
<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.target_type
, t.target_id
, t.employee_status
, t.include_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_range t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_range t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobRangePO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_range t
WHERE delete_type = 0
<if test="id != null and id != ''">
AND id = #{id}
</if>
<if test="salarySobId != null and salarySobId != ''">
AND salary_sob_id = #{salarySobId}
</if>
<if test="targetType != null and targetType != ''">
AND target_type = #{targetType}
</if>
<if test="targetId != null and targetId != ''">
AND target_id = #{targetId}
</if>
<if test="employeeStatus != null and employeeStatus != ''">
AND employee_status = #{employeeStatus}
</if>
<if test="includeType != null and includeType != ''">
AND include_type = #{includeType}
</if>
<if test="creator != null and creator != ''">
AND creator = #{creator}
</if>
<if test="createTime != null and createTime != ''">
AND create_time = #{createTime}
</if>
<if test="updateTime != null and updateTime != ''">
AND update_time = #{updateTime}
</if>
<if test="deleteType != null and deleteType != ''">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null and tenantKey != ''">
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.SalarySobRangePO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_salary_sob_range
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="salarySobId != null">
salary_sob_id,
</if>
<if test="targetType != null">
target_type,
</if>
<if test="targetId != null">
target_id,
</if>
<if test="employeeStatus != null">
employee_status,
</if>
<if test="includeType != null">
include_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="targetType != null">
#{targetType},
</if>
<if test="targetId != null">
#{targetId},
</if>
<if test="employeeStatus != null">
#{employeeStatus},
</if>
<if test="includeType != null">
#{includeType},
</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.SalarySobRangePO">
UPDATE hrsa_salary_sob_range
<set>
salary_sob_id=#{salarySobId},
target_type=#{targetType},
target_id=#{targetId},
employee_status=#{employeeStatus},
include_type=#{includeType},
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.SalarySobRangePO">
UPDATE hrsa_salary_sob_range
<set>
<if test="salarySobId != null">
salary_sob_id=#{salarySobId},
</if>
<if test="targetType != null">
target_type=#{targetType},
</if>
<if test="targetId != null">
target_id=#{targetId},
</if>
<if test="employeeStatus != null">
employee_status=#{employeeStatus},
</if>
<if test="includeType != null">
include_type=#{includeType},
</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.SalarySobRangePO">
UPDATE hrsa_salary_sob_range
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_range(salary_sob_id, target_type, target_id, employee_status, include_type,
creator, create_time, update_time, delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.targetType.value},
#{item.targetId},
#{item.employeeStatus.value},
#{item.includeType},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_range(salary_sob_id, target_type, target_id, employee_status, include_type,
creator, create_time, update_time, delete_type, tenant_key)
<foreach collection="collection" item="item" separator="union all">
select
#{item.salarySobId},
#{item.targetType.value},
#{item.targetId},
#{item.employeeStatus.value},
#{item.includeType},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
INSERT INTO hrsa_salary_sob_range( salary_sob_id, target_type, target_id, employee_status, include_type,
creator, create_time, update_time, delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.salarySobId},
#{item.targetType.value},
#{item.targetId},
#{item.employeeStatus.value},
#{item.includeType},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<update id="deleteBySalarySobIds">
UPDATE hrsa_salary_sob_range
SET delete_type = 1
WHERE delete_type = 0
AND salary_sob_id IN
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
#{salarySobId}
</foreach>
</update>
<update id="deleteByIds">
UPDATE hrsa_salary_sob_range
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<select id="listEmployeeIds" resultType="int">
SELECT id FROM hrmresource em
WHERE 1=1
<if test="params != null and params.size() > 0">
AND ( 1=2
<foreach collection="params" item="param">
OR
(
<if test="param.targetType == 'EMPLOYEE'">
em.id IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
#{targetId}
</foreach>
</if>
<if test="param.targetType == 'DEPT'">
em.departmentid IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
#{targetId}
</foreach>
</if>
<if test="param.targetType == 'POSITION'">
em.jobtitle IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
#{targetId}
</foreach>
</if>
<if test="param.employeeStatus != null and param.employeeStatus.size() > 0">
AND em.status IN
<foreach collection="param.employeeStatus" open="(" item="status" separator="," close=")">
#{status}
</foreach>
</if>
)
</foreach>
)
</if>
</select>
</mapper>

View File

@ -0,0 +1,67 @@
package com.engine.salary.service;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
import java.util.Collection;
import java.util.List;
/**
* 薪资账套人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalarySobRangeService {
/**
* 根据主键id查询薪资账套的人员范围
*
* @param ids 薪资账套的人员范围的主键id
* @return
*/
List<SalarySobRangePO> listByIds(Collection<Long> ids);
/**
* 根据薪资账套ID和类型查询薪资账套的人员范围
*
* @param salarySobId 薪资账套id
* @param includeType 0-从范围中排除/1-关联人员范围
* @return
*/
List<SalarySobRangePO> listBySalarySobIdAndIncludeType(Long salarySobId, Integer includeType);
/**
* 根据查询条件查询薪资账套的人员范围
*
* @param queryParam 查询条件
* @param includeType 0-从范围中排除/1-关联人员范围
* @return
*/
List<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType);
/**
* 保存
*
* @param saveParam 保存参数
*/
void save(SalarySobRangeSaveParam saveParam);
/**
* 根据主键id删除薪资账套的人员范围
*
* @param ids 主键id
*/
void deleteByIds(Collection<Long> ids);
/**
* 根据薪资账套id删除薪资账套的人员范围
*
* @param salarySobIds 薪资账套id
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -24,55 +24,49 @@ public interface SalarySobService {
* 根据主键id获取单个薪资账套
*
* @param id 主键id
* @param tenantKey 租户key
* @return
*/
SalarySobPO getById(Long id, String tenantKey);
SalarySobPO getById(Long id);
/**
* 根据主键id查询薪资账套
*
* @param ids 主键id
* @param tenantKey 租户key
* @return
*/
List<SalarySobPO> listByIds(Collection<Long> ids, String tenantKey);
List<SalarySobPO> listByIds(Collection<Long> ids);
/**
* 根据名称精确匹配查询薪资账套
*
* @param name 薪资账套名称
* @param tenantKey 租户key
* @return
*/
List<SalarySobPO> listByName(String name, String tenantKey);
List<SalarySobPO> listByName(String name);
/**
* 根据名称模糊匹配查询薪资账套
*
* @param nameLike 薪资账套名称
* @param tenantKey 租户key
* @return
*/
List<SalarySobPO> listByNameLike(String nameLike, String tenantKey);
List<SalarySobPO> listByNameLike(String nameLike);
/**
* 查询启用/禁用的薪资账套
*
* @param disable 启用/禁用
* @param tenantKey 租户key
* @return
*/
List<SalarySobPO> listByDisable(Integer disable, String tenantKey);
List<SalarySobPO> listByDisable(Integer disable);
/**
* 根据薪资类型查询薪资账套
*
* @param incomeCategory 薪资类型
* @param tenantKey 租户key
* @return
*/
List<SalarySobPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory, String tenantKey);
List<SalarySobPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory);
/**
* 根据列表查询参数查询薪资账套分页
@ -81,52 +75,44 @@ public interface SalarySobService {
* @param tenantKey 租户key
* @return
*/
// Page<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam, String tenantKey);
// Page<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam);
/**
* 保存
*
* @param saveParam 保存参数
* @param employeeId 人员id
* @param tenantKey 租户key
* @return
*/
Long save(SalarySobBasicSaveParam saveParam, Long employeeId, String tenantKey);
Long save(SalarySobBasicSaveParam saveParam);
/**
* 编辑
*
* @param saveParam 更新参数
* @param employeeId 人员id
* @param tenantKey 租户key
* @return
*/
Long update(SalarySobBasicSaveParam saveParam, Long employeeId, String tenantKey);
Long update(SalarySobBasicSaveParam saveParam);
/**
* 更新薪资账套的是否启用
*
* @param disableParam 更新参数
* @param tenantKey 租户key
*/
void updateDisable(SalarySobDisableParam disableParam, String tenantKey);
void updateDisable(SalarySobDisableParam disableParam);
/**
* 根据主键id删除
*
* @param ids 薪资账套的主键id
* @param tenantKey 租户key
*/
void deleteByIds(Collection<Long> ids, String tenantKey);
void deleteByIds(Collection<Long> ids);
/**
* 复制
*
* @param duplicateParam 复制参数
* @param employeeId 人员id
* @param tenantKey 租户key
*/
void duplicate(SalarySobDuplicateParam duplicateParam, Long employeeId, String tenantKey);
void duplicate(SalarySobDuplicateParam duplicateParam);
/**
* 根据薪资所属月计算出薪资账套的薪资周期考勤周期的具体日期范围以及税款所属期福利台账月份的具体月份

View File

@ -154,17 +154,17 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
BeanUtils.copyProperties(salaryItemPO, newSalaryItemPO);
// 系统薪资项目的"属性""类型"不允许编辑
if (Objects.equals(newSalaryItemPO.getSystemType(), SalarySystemTypeEnum.CUSTOM.getValue())) {
newSalaryItemPO.setCategory(saveParam.getCategory().getValue());
newSalaryItemPO.setItemType(saveParam.getItemType().getValue());
newSalaryItemPO.setCategory(saveParam.getCategory());
newSalaryItemPO.setItemType(saveParam.getItemType());
}
newSalaryItemPO.setName(saveParam.getName());
newSalaryItemPO.setUseDefault(saveParam.getUseDefault());
newSalaryItemPO.setUseInEmployeeSalary(saveParam.getUseInEmployeeSalary());
newSalaryItemPO.setRoundingMode(saveParam.getRoundingMode().getValue());
newSalaryItemPO.setRoundingMode(saveParam.getRoundingMode());
newSalaryItemPO.setPattern(saveParam.getPattern());
newSalaryItemPO.setValueType(saveParam.getValueType().getValue());
newSalaryItemPO.setFormulaId(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? 0L : saveParam.getFormulaId());
newSalaryItemPO.setDatasource(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? SalaryDataSourceEnum.INPUT_IMPORT.getValue()
newSalaryItemPO.setValueType(saveParam.getValueType());
newSalaryItemPO.setFormulaId(Objects.equals(saveParam.getValueType(), SalaryValueTypeEnum.INPUT.getValue()) ? 0L : saveParam.getFormulaId());
newSalaryItemPO.setDatasource(Objects.equals(saveParam.getValueType(), SalaryValueTypeEnum.INPUT.getValue()) ? SalaryDataSourceEnum.INPUT_IMPORT.getValue()
: SalaryDataSourceEnum.CUSTOM_FORMULA.getValue());
newSalaryItemPO.setDescription(saveParam.getDescription());
newSalaryItemPO.setUpdateTime(new Date());

View File

@ -0,0 +1,160 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobRangeBiz;
import com.engine.salary.entity.salarysob.bo.SalarySobRangeSaveBO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalarySobRangeService;
import com.engine.salary.service.SalarySobService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
/**
* 薪资账套人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobRangeServiceImpl extends Service implements SalarySobRangeService {
private SalarySobRangeBiz salarySobRangeMapper = new SalarySobRangeBiz();
private SalarySobService getSalarySobService(User user) {
return (SalarySobService) ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
// private ComInfoCache comInfoCache;
// private LoggerTemplate salarySobLoggerTemplate;
@Override
public List<SalarySobRangePO> listByIds(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Collections.emptyList();
}
return salarySobRangeMapper.listSome(SalarySobRangePO.builder().ids(ids).build());
}
@Override
public List<SalarySobRangePO> listBySalarySobIdAndIncludeType(Long salarySobId, Integer includeType) {
return salarySobRangeMapper.listSome(SalarySobRangePO.builder().salarySobId(salarySobId).includeType(includeType).build());
}
@Override
public List<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType) {
// 查询人员范围
List<SalarySobRangePO> salarySobRangePOS = listBySalarySobIdAndIncludeType(queryParam.getSalarySobId(), includeType);
// 查询人员信息
List<Object> employeeIds = salarySobRangePOS.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()))
.map(SalarySobRangePO::getTargetId)
.collect(Collectors.toList());
// todo 缓存获取人员信息 List<HrmEmployeeComInfo> employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds);
// 查询部分信息
List<Object> departmentIds = salarySobRangePOS.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue()))
.map(SalarySobRangePO::getTargetId)
.collect(Collectors.toList());
// todo List<HrmDepartmentComInfo> departmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, departmentIds);
// 查询岗位信息
List<Object> positionIds = salarySobRangePOS.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue()))
.map(SalarySobRangePO::getTargetId)
.collect(Collectors.toList());
// todo List<HrmPositionComInfo> positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds);
// // 分页参数
// Page<SalarySobRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// // 薪资账套的人员范围po转换成列表dto
// List<SalarySobRangeListDTO> salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, employeeComInfos, departmentComInfos, positionComInfos);
// // 根据对象名称过滤
// if (StringUtils.isNotEmpty(queryParam.getTargetName())) {
// salarySobRangeListDTOS = salarySobRangeListDTOS.stream()
// .filter(salarySobRangeListDTO -> salarySobRangeListDTO.getTargetName().contains(queryParam.getTargetName()))
// .collect(Collectors.toList());
// }
// // 填充总数和当页数据
// dtoPage.setTotal(salarySobRangeListDTOS.size());
// dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), salarySobRangeListDTOS));
// return dtoPage;
return null;
}
@Override
public void save(SalarySobRangeSaveParam saveParam) {
// 查询薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(saveParam.getSalarySobId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 查询已有的人员范围
List<SalarySobRangePO> salarySobRangePOS = listBySalarySobIdAndIncludeType(saveParam.getSalarySobId(), saveParam.getIncludeType());
// 处理一下本次的保存参数如果原来添加过对应的人员/部门/岗位那么本次不需要新增只需要更新
SalarySobRangeSaveBO.Result result = SalarySobRangeSaveBO.handle(salarySobRangePOS, saveParam, (long) user.getUID());
// 保存
if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobRanges())) {
salarySobRangeMapper.batchInsert(result.getNeedInsertSalarySobRanges());
}
if (CollectionUtils.isNotEmpty(result.getNeedUpdateSalarySobRanges())) {
result.getNeedUpdateSalarySobRanges().forEach(e -> salarySobRangeMapper.updateById(e));
}
// todo 记录日志
// String operateTypeName = Objects.equals(saveParam.getIncludeType(), NumberUtils.INTEGER_ONE) ?
// SalaryI18nUtil.getI18nLabel(98601, "关联人员范围新增对象") : SalaryI18nUtil.getI18nLabel(98602, "从范围中排除新增对象");
// LoggerContext<SalarySobRangeSaveParam> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// loggerContext.setOperateTypeName(operateTypeName);
// loggerContext.setOperatedesc(operateTypeName);
// loggerContext.setNewValues(saveParam);
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public void deleteByIds(Collection<Long> ids) {
// 查询薪资账套的人员范围
List<SalarySobRangePO> salarySobRangePOS = listByIds(ids);
if (CollectionUtils.isEmpty(salarySobRangePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98604, "数据不存在或已被删除"));
}
ids = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getId);
// 删除薪资账套的人员范围
salarySobRangeMapper.deleteByIds(ids);
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getSalarySobId);
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByIds(salarySobIds);
// "关联人员范围"还是"从范围中排除"
Integer includeType = salarySobRangePOS.get(0).getIncludeType();
// todo 记录日志
String operateTypeName = Objects.equals(includeType, NumberUtils.INTEGER_ONE) ?
SalaryI18nUtil.getI18nLabel(98605, "关联人员范围删除对象") : SalaryI18nUtil.getI18nLabel(98606, "从范围中排除删除对象");
// salarySobPOS.forEach(salarySobPO -> {
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// loggerContext.setOperateTypeName(operateTypeName);
// loggerContext.setOperatedesc(operateTypeName);
// });
}
@Override
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
salarySobRangeMapper.deleteBySalarySobIds(salarySobIds);
}
}

View File

@ -0,0 +1,382 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobBiz;
import com.engine.salary.entity.salarysob.bo.SalarySobBO;
import com.engine.salary.entity.salarysob.bo.SalarySobCycleBO;
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.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalarySobService;
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 org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import java.time.YearMonth;
import java.util.*;
/**
* 薪资账套
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
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 SalarySobItemService salarySobItemService;
//
// private SalaryItemService salaryItemService;
//
// private SysSalaryItemService sysSalaryItemService;
//
// private SalarySobItemGroupService salarySobItemGroupService;
//
// private SalarySobAdjustRuleService salarySobAdjustRuleService;
//
// private SalarySobCheckRuleService salarySobCheckRuleService;
//
// private LoggerTemplate salarySobLoggerTemplate;
//
// private SalaryAcctRecordService salaryAcctRecordService;
@Override
public SalarySobPO getById(Long id) {
return salarySobMapper.getById(id);
}
@Override
public List<SalarySobPO> listByIds(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Collections.emptyList();
}
return salarySobMapper.listSome(SalarySobPO.builder().ids(ids).build());
}
@Override
public List<SalarySobPO> listByName(String name) {
if (StringUtils.isEmpty(name)) {
return Collections.emptyList();
}
return salarySobMapper.listSome(SalarySobPO.builder().name(name).build());
}
@Override
public List<SalarySobPO> listByNameLike(String nameLike) {
if (StringUtils.isEmpty(nameLike)) {
return Collections.emptyList();
}
return salarySobMapper.listByParam(SalarySobPO.builder().name(nameLike).build());
}
@Override
public List<SalarySobPO> listByDisable(Integer disable) {
return salarySobMapper.listSome(SalarySobPO.builder().disable(disable).build());
}
@Override
public List<SalarySobPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory) {
return salarySobMapper.listSome(SalarySobPO.builder().incomeCategory(incomeCategory.getValue()).build());
}
// @Override
// public Page<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam, String tenantKey) {
// // 分页参数
// Page<SalarySobPO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// // 查询薪资账套
// return new LambdaQueryChainWrapper<>(salarySobMapper)
// .eq(SalarySobPO::getTenantKey, tenantKey)
// .eq(SalarySobPO::getDeleteType, 0)
// .like(StringUtils.isNotEmpty(queryParam.getName()), SalarySobPO::getName, queryParam.getName())
// .orderByDesc(SalarySobPO::getId)
// .page(page);
// }
@Override
public Long save(SalarySobBasicSaveParam saveParam) {
ValidUtil.doValidator(saveParam);
// 薪资账套的名称不能重复
List<SalarySobPO> salarySobPOS = listByName(saveParam.getName());
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "薪资账套名称已存在"));
}
// 保存参数转换成薪资账套po
SalarySobPO salarySobPO = SalarySobBO.convert2PO(saveParam, (long) user.getUID());
// 保存薪资账套
salarySobMapper.insert(salarySobPO);
//todo 记录日志
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId(String.valueOf(salarySobPO.getId()));
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98404, "新建薪资账套"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98404, "新建薪资账套") + ": " + salarySobPO.getName());
// loggerContext.setOldValues(salarySobPO);
// salarySobLoggerTemplate.write(loggerContext);
// 新建薪资账套时保存默认的员工信息字段
saveDefaultEmpField(salarySobPO);
// 新建薪资账套时保存默认的薪资项目
saveDefaultItem(salarySobPO);
// 返回薪资账套的主键id
return salarySobPO.getId();
}
/**
* todo
* 新建薪资账套时保存默认的员工信息字段
*
* @param salarySobPO 薪资账套
*/
private void saveDefaultEmpField(SalarySobPO salarySobPO) {
// // 查询薪资账套默认的员工信息字段
// List<SalarySobDefaultEmpFieldPO> salarySobDefaultEmpFieldPOS = salarySobDefaultEmpFieldService.list();
// // 转换成薪资账套员工信息字段po
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = SalarySobItemBO.convert2EmpFieldPO(salarySobPO.getId(), salarySobDefaultEmpFieldPOS);
// // 保存
// salarySobEmpFieldService.batchSave(salarySobEmpFieldPOS);
}
/**
* todo
* 新建薪资账套时保存默认的薪资项目
* 1薪资账套默认引用的系统薪资项目
* 2自定义薪资项目中开启了"默认使用"的薪资项目
*
* @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, employeeId, tenantKey);
// if (CollectionUtils.isNotEmpty(needInsertSalaryItemPOS)) {
// salaryItemService.batchSave(needInsertSalaryItemPOS);
// }
//
// // 3查询开启了"默认使用"的自定义薪资项目
// List<SalaryItemPO> useDefaultSalaryItemPOS = salaryItemService.listBySystemTypeAndUseDefault(SalarySystemTypeEnum.CUSTOM, NumberUtils.INTEGER_ONE, tenantKey);
//
// // 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, tenantKey);
// if (CollectionUtils.isNotEmpty(salarySobItemPOS)) {
// salarySobItemService.batchSave(salarySobItemPOS);
// }
}
@Override
public Long update(SalarySobBasicSaveParam saveParam) {
ValidUtil.doValidator(saveParam, RuntimeTypeEnum.UPDATE);
// 查询薪资账套
SalarySobPO salarySobPO = getById(saveParam.getId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 薪资账套的名称不能重复
List<SalarySobPO> salarySobPOS = listByName(saveParam.getName());
boolean duplicateName = salarySobPOS.stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId()));
if (duplicateName) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "薪资账套名称已存在"));
}
// 更新薪资账套
SalarySobPO newSalarySobPO = new SalarySobPO();
BeanUtils.copyProperties(salarySobPO, newSalarySobPO);
newSalarySobPO.setName(saveParam.getName())
.setIncomeCategory(saveParam.getTaxableItems())
.setSalaryCycleType(saveParam.getSalaryCycleType())
.setSalaryCycleFromDay(saveParam.getSalaryCycleFromDay())
.setTaxCycleType(saveParam.getTaxCycleType())
.setAttendCycleType(saveParam.getAttendCycleType())
.setAttendCycleFromDay(saveParam.getAttendCycleFromDay())
.setSocialSecurityCycleType(saveParam.getSocialSecurityCycleType())
.setDescription(saveParam.getDescription())
.setUpdateTime(new Date());
salarySobMapper.updateById(newSalarySobPO);
// 记录日志
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId(String.valueOf(newSalarySobPO.getId()));
// loggerContext.setTargetName(newSalarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98526, "编辑薪资账套基础设置"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98526, "编辑薪资账套基础设置"));
// loggerContext.setOldValues(salarySobPO);
// loggerContext.setNewValues(newSalarySobPO);
// salarySobLoggerTemplate.write(loggerContext);
// 返回薪资账套的主键id
return salarySobPO.getId();
}
@Override
public void updateDisable(SalarySobDisableParam disableParam) {
// 查询薪资账套
SalarySobPO salarySobPO = getById(disableParam.getId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 启用/禁用 薪资账套
salarySobPO.setDisable(disableParam.getDisable());
salarySobPO.setUpdateTime(new Date());
salarySobMapper.updateById(salarySobPO);
// todo 记录日志
// String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ?
// SalaryI18nUtil.getI18nLabel(98591, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(98592, "启用薪资账套");
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// loggerContext.setOperateTypeName(operateTypeName);
// loggerContext.setOperatedesc(operateTypeName + ": " + salarySobPO.getName());
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public void deleteByIds(Collection<Long> ids) {
// 查询薪资账套
List<SalarySobPO> salarySobPOS = listByIds(ids);
if (CollectionUtils.isEmpty(salarySobPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
//fixme 关联其他的删除
ids = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
// 根据薪资账套id查询薪资核算记录存在薪资核算记录就不能删除账套了
// List<SalaryAcctRecordPO> salaryAcctRecordPOS = salaryAcctRecordService.listBySalarySobIds(ids);
// 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);
// // 删除薪资账套的调薪计薪规则
// salarySobAdjustRuleService.deleteBySalarySobIds(ids, tenantKey);
// // 删除薪资账套的校验规则
// salarySobCheckRuleService.deleteBySalarySobIds(ids, tenantKey);
// // 记录日志
// salarySobPOS.forEach(salarySobPO -> {
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + salarySobPO.getId());
// loggerContext.setTargetName(salarySobPO.getName());
// loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98535, "删除薪资账套"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98535, "删除薪资账套"));
// salarySobLoggerTemplate.write(loggerContext);
// });
}
@Override
@Transactional(rollbackFor = Exception.class)
public void duplicate(SalarySobDuplicateParam duplicateParam) {
// 查询薪资账套
SalarySobPO salarySobPO = getById(duplicateParam.getId());
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 薪资账套名称不能重复
List<SalarySobPO> salarySobPOS = listByName(duplicateParam.getName());
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "薪资账套名称已存在"));
}
// // 查询薪资账套的员工信息字段
// List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(duplicateParam.getId());
// // 查询薪资账套的薪资项目副本
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalarySobId(duplicateParam.getId());
// // 查询薪资账套的薪资项目分类
// List<SalarySobItemGroupPO> salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(duplicateParam.getId(), tenantKey);
// // 查询薪资账套的调薪计薪规则
// List<SalarySobAdjustRulePO> salarySobAdjustRulePOS = salarySobAdjustRuleService.listBySalarySobId(duplicateParam.getId(), tenantKey);
// // 查询薪资账套的校验规则
// List<SalarySobCheckRulePO> salarySobCheckRulePOS = salarySobCheckRuleService.listBySalarySobId(duplicateParam.getId(), tenantKey);
//
// // 复制
// SalarySobDuplicateBO salarySobDuplicateBO = new SalarySobDuplicateBO(salarySobPO, salarySobEmpFieldPOS, salarySobItemPOS,
// salarySobItemGroupPOS, salarySobAdjustRulePOS, salarySobCheckRulePOS);
// SalarySobDuplicateBO.Result result = salarySobDuplicateBO.duplicate(duplicateParam.getName(), employeeId, tenantKey);
// // 复制薪资账套的基础设置
// salarySobMapper.insert(result.getSalarySob());
// // 复制薪资账套的员工信息字段
// if (CollectionUtils.isNotEmpty(result.getSalarySobEmpFields())) {
// salarySobEmpFieldService.batchSave(result.getSalarySobEmpFields());
// }
// // 复制薪资账套的薪资项目副本
// if (CollectionUtils.isNotEmpty(result.getSalarySobItems())) {
// salarySobItemService.batchSave(result.getSalarySobItems());
// }
// // 复制薪资账套的薪资项目分类
// if (CollectionUtils.isNotEmpty(result.getSalarySobItemGroups())) {
// salarySobItemGroupService.batchSave(result.getSalarySobItemGroups());
// }
// // 复制薪资账套的调薪计薪规则
// if (CollectionUtils.isNotEmpty(result.getSalaryAdjustmentRules())) {
// salarySobAdjustRuleService.batchSave(result.getSalaryAdjustmentRules());
// }
// // 复制薪资账套的校验规则
// if (CollectionUtils.isNotEmpty(result.getSalarySobCheckRules())) {
// salarySobCheckRuleService.batchSave(result.getSalarySobCheckRules());
// }
// // 记录日志
// LoggerContext<SalarySobPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId("" + result.getSalarySob().getId());
// loggerContext.setTargetName(result.getSalarySob().getName());
// loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套") + ": " + salarySobPO.getName());
// salarySobLoggerTemplate.write(loggerContext);
}
@Override
public SalarySobCycleDTO getSalarySobCycle(Long id, YearMonth salaryMonth) {
// 查询薪资账套
SalarySobPO salarySobPO = getById(id);
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
return SalarySobCycleBO.buildSalarySobCycle(salarySobPO, salaryMonth);
}
}

View File

@ -0,0 +1,285 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
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.param.SalarySobListQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.wrapper.SalarySobWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.Map;
/**
* 薪资账套
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobController {
private SalarySobWrapper getSalarySobWrapper(User user) {
return ServiceUtil.getService(SalarySobWrapper.class, user);
}
// private SalarySobRangeWrapper salarySobRangeWrapper;
// private SalarySobItemWrapper salarySobItemWrapper;
// private SalarySobAdjustRuleWrapper salarySobAdjustRuleWrapper;
// private SalarySobCheckRuleWrapper salarySobCheckRuleWrapper;
/**********************************薪资账套 start*********************************/
/**
* 薪资账套列表
*/
@POST
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String listSalarySob(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobListQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobListQueryParam, Map<String, Object>>().run(getSalarySobWrapper(user)::listPage, queryParam);
}
/**
* 薪资账套基本信息表单
*/
@POST
@Path("/basic/getForm")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobBasicForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Map<String, Object>>().run(getSalarySobWrapper(user)::getForm, id);
}
/**
* 保存薪资账套基本信息
*/
@POST
@Path("/basic/save")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobBasicForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobBasicSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
Long salarySobId;
if (saveParam.getId() == null || saveParam.getId() <= 0) {
return new ResponseResult<SalarySobBasicSaveParam, Map<String, Object>>().run(getSalarySobWrapper(user)::save, saveParam);
} else {
return new ResponseResult<SalarySobBasicSaveParam, Map<String, Object>>().run(getSalarySobWrapper(user)::update, saveParam);
}
}
/**
* 启用/禁用薪资账套
*/
@POST
@Path("/disable")
@Produces(MediaType.APPLICATION_JSON)
public String updateSalarySobDisable(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobDisableParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobDisableParam, Map<String, Object>>().run(getSalarySobWrapper(user)::updateDisable, saveParam);
}
/**
* 删除薪资账套
*/
@POST
@Path("/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalarySob(@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>, Map<String, Object>>().run(getSalarySobWrapper(user)::delete, ids);
}
/**
* 复制薪资账套
*/
@POST
@Path("/duplicate")
@Produces(MediaType.APPLICATION_JSON)
public String duplicate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobDuplicateParam duplicateParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobDuplicateParam, Map<String, Object>>().run(getSalarySobWrapper(user)::duplicate, duplicateParam);
}
/**********************************薪资账套 end*********************************/
/**********************************薪资账套的人员范围 start*********************************/
// @PostMapping("/range/listInclude")
// @ApiOperation("薪资账套人员范围(包含)列表")
// @WeaPermission
// public WeaResult<WeaTable<SalarySobRangeListDTO>> listIncludeSalarySobRange(@RequestBody @Validated SalarySobRangeQueryParam queryParam) {
// WeaTable<SalarySobRangeListDTO> weaTable = salarySobRangeWrapper.listPage4Include(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @PostMapping("/range/listExclude")
// @ApiOperation("薪资账套人员范围(排除)列表")
// @WeaPermission
// public WeaResult<WeaTable<SalarySobRangeListDTO>> listExcludeSalarySobRange(@RequestBody @Validated SalarySobRangeQueryParam queryParam) {
// WeaTable<SalarySobRangeListDTO> weaTable = salarySobRangeWrapper.listPage4Exclude(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @GetMapping("/range/getForm")
// @ApiOperation("薪资账套人员范围表单")
// @WeaPermission
// public WeaResult<WeaForm> getSalarySobRangeForm() {
// WeaForm weaForm = salarySobRangeWrapper.getForm();
// return WeaResult.success(weaForm);
// }
//
// @PostMapping("/range/save")
// @ApiOperation("保存薪资账套人员范围")
// @WeaPermission
// public WeaResult<Object> saveSalarySobRange(@RequestBody @Validated SalarySobRangeSaveParam saveParam) {
// salarySobRangeWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/range/delete")
// @ApiOperation("删除薪资账套人员范围")
// @WeaPermission
// public WeaResult<Object> deleteSalarySobRange(@RequestBody Collection<Long> ids) {
// salarySobRangeWrapper.delete(ids, TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// /**********************************薪资账套的人员范围 end*********************************/
//
// /**********************************薪资账套的薪资项目 start*********************************/
//
// @PostMapping("/item/listSalaryItem")
// @ApiOperation("薪资账套可选薪资项目")
// @WeaPermission
// public WeaResult<WeaTable<SalaryItemListDTO>> listSalaryItem(@RequestBody SalaryItemSearchParam queryParam) {
// WeaTable<SalaryItemListDTO> weaTable = salarySobItemWrapper.listPage4SalaryItem(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @GetMapping("/item/group/getForm")
// @ApiOperation("薪资账套项目分组的详情")
// @WeaPermission
// public WeaResult<WeaForm> getSalarySobItemGroupForm(@RequestParam(name = "id", required = false) Long id) {
// WeaForm weaForm = salarySobItemWrapper.getGroupForm(id, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaForm);
// }
//
// @GetMapping("/item/getForm")
// @ApiOperation("薪资账套薪资项目详情")
// @WeaPermission
// public WeaResult<SalarySobItemAggregateDTO> getSalarySobItemForm(@RequestParam(name = "salarySobId") Long salarySobId) {
// SalarySobItemAggregateDTO form = salarySobItemWrapper.getForm(salarySobId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(form);
// }
//
// @PostMapping("/item/save")
// @ApiOperation("保存薪资账套薪资项目")
// @WeaPermission
// public WeaResult<Object> saveSalarySobItem(@RequestBody @Validated SalarySobItemSaveParam saveParam) {
// salarySobItemWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// /**********************************薪资账套的薪资项目 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);
// }
//
// @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*********************************/
}

View File

@ -1,84 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.taxrate.param.TaxRateSaveParam;
import com.engine.salary.service.TaxRateBaseService;
import com.engine.salary.service.impl.TaxRateBaseServiceImpl;
import com.engine.salary.util.ResponseResult;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.general.BaseBean;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
public class TaxDeclarationController {
private BaseBean logger = new BaseBean();
private TaxRateBaseService getService(User user) {
return (TaxRateBaseService) ServiceUtil.getService(TaxRateBaseServiceImpl.class, user);
}
//税率表列表
@GET
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::listPage, ParamUtil.request2Map(request));
}
/**
* 新建税率表
*/
@POST
@Path("/save")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxRateSaveParam taxRateSaveParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("taxRateSaveParam",taxRateSaveParam);
return ResponseResult.run(getService(user)::save, map);
}
/**
* 新建税率表
*/
@POST
@Path("/update")
@Produces(MediaType.APPLICATION_JSON)
public String update(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxRateSaveParam taxRateSaveParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("taxRateSaveParam",taxRateSaveParam);
return ResponseResult.run(getService(user)::update, map);
}
/**
* 删除税率表
*/
@POST
@Path("/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteTaxRate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::delete, ParamUtil.request2Map(request));
}
// @PostMapping("/list")
// @ApiOperation("个税申报表列表")
// @WeaPermission

View File

@ -0,0 +1,79 @@
package com.engine.salary.wrapper;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.service.SalarySobRangeService;
import java.util.Collection;
/**
* 薪资账套的人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobRangeWrapper extends Service {
private SalarySobRangeService salarySobRangeService;
// /**
// * 薪资账套的人员范围列表关联人员范围
// *
// * @param queryParam 列表查询条件
// * @param tenantKey 租户key
// * @return
// */
// public WeaTable<SalarySobRangeListDTO> listPage4Include(SalarySobRangeQueryParam queryParam) {
// // 分页查询薪资账套的人员范围列表dto
// Page<SalarySobRangeListDTO> dtoPage = salarySobRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE);
// // 转换成前端所需的数据格式
// WeaTable<SalarySobRangeListDTO> weaTable = SalaryFormatUtil.<SalarySobRangeListDTO>getInstance().buildTable(SalarySobRangeListDTO.class, dtoPage);
// weaTable.setPageUid("includeSalarySobRangeList");
// return weaTable;
// }
//
// /**
// * 薪资账套的人员范围列表从范围中排除
// *
// * @param queryParam 列表查询条件
// * @param tenantKey 租户key
// * @return
// */
// public WeaTable<SalarySobRangeListDTO> listPage4Exclude(SalarySobRangeQueryParam queryParam, String tenantKey) {
// // 分页查询薪资账套的人员范围列表dto
// Page<SalarySobRangeListDTO> dtoPage = salarySobRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey);
// // 转换成前端所需的数据格式
// WeaTable<SalarySobRangeListDTO> weaTable = SalaryFormatUtil.<SalarySobRangeListDTO>getInstance().buildTable(SalarySobRangeListDTO.class, dtoPage);
// weaTable.setPageUid("excludeSalarySobRangeList");
// return weaTable;
// }
//
// /**
// * 获取薪资账套的人员范围列表添加人员的表单
// *
// * @return
// */
// public WeaForm getForm() {
// return SalaryFormatUtil.<SalarySobRangeFormDTO>getInstance().buildForm(SalarySobRangeFormDTO.class, new SalarySobRangeFormDTO());
// }
/**
* 保存
*
* @param saveParam 保存参数
*/
public void save(SalarySobRangeSaveParam saveParam, Long employeeId, String tenantKey) {
salarySobRangeService.save(saveParam);
}
/**
* 删除
*
* @param ids 薪资账套的人员范围的主键id
*/
public void delete(Collection<Long> ids, String tenantKey) {
salarySobRangeService.deleteByIds(ids);
}
}

View File

@ -0,0 +1,170 @@
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.salarysob.bo.SalarySobBO;
import com.engine.salary.entity.salarysob.dto.SalarySobBasicFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobListDTO;
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.param.SalarySobListQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalarySobService;
import com.engine.salary.service.impl.SalarySobServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.DBType;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.User;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* 薪资账套
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobWrapper extends Service {
private SalarySobService getSalarySobService(User user) {
return (SalarySobService) ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
/**
* 薪资账套列表
*
* @param queryParam 列表查询参数
* @return
*/
public Map<String, Object> listPage(SalarySobListQueryParam queryParam) {
SalaryWeaTable<SalarySobListDTO> table = new SalaryWeaTable<SalarySobListDTO>(user, SalarySobListDTO.class);
String fields = " t.id" +
" , t.name" +
" , t.income_category as salaryCycle" +
" , t.salary_cycle_type" +
" , t.salary_cycle_from_day" +
" , t.tax_cycle_type" +
" , t.attend_cycle_type" +
" , t.attend_cycle_from_day" +
" , t.social_security_cycle_type" +
" , t.disable" +
" , t.description";
String from = " from hrsa_salary_sob t";
table.setBackfields(fields);
table.setSqlform(from);
// table.setSqlwhere(makeSqlWhere(queryParam));
table.setSqlorderby("t.id DESC");
table.setSqlprimarykey("t.id");
table.setSqlisdistinct("false");
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
}
private String makeSqlWhere(SalarySobListQueryParam queryParam) {
DBType dbType = DBType.get(new RecordSet().getDBType());
String sqlWhere = " t.delete_type = 0 ";
String name = queryParam.getName();
if (StringUtils.isNotBlank(name)) {
sqlWhere += " AND t.name " + dbType.like(name);
}
return sqlWhere;
}
/**
* 薪资账套详情
*
* @param id 薪资账套id
* @return
*/
public Map<String, Object> getForm(Long id) {
Map<String, Object> data = new HashMap<>(16);
// 薪资账套基础设置详情目前核算人员范围的值固定为"1"
SalarySobBasicFormDTO basicForm = new SalarySobBasicFormDTO()
.setEmployeeRange("1")
.setTaxableItems(IncomeCategoryEnum.WAGES_AND_SALARIES);
if (!Objects.isNull(id)) {
// 查询薪资账套
SalarySobPO salarySobPO = getSalarySobService(user).getById(id);
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 薪资装套po转换成薪资账套详情dto
basicForm = SalarySobBO.convert2FormDTO(salarySobPO);
}
// 转换成前端所需的数据格式
data.put("basicForm", basicForm);
return data;
}
/**
* 保存
*
* @param saveParam 保存参数
* @return
*/
public Long save(SalarySobBasicSaveParam saveParam) {
return getSalarySobService(user).save(saveParam);
}
/**
* 更新薪资账套的基础设置
*
* @param saveParam 更新参数
* @return
*/
public Long update(SalarySobBasicSaveParam saveParam) {
return getSalarySobService(user).update(saveParam);
}
/**
* 启用/禁用薪资账套
*
* @param disableParam 更新参数
*/
public void updateDisable(SalarySobDisableParam disableParam) {
getSalarySobService(user).updateDisable(disableParam);
}
/**
* 删除薪资账套
*
* @param ids 薪资账套的id
*/
public void delete(Collection<Long> ids) {
getSalarySobService(user).deleteByIds(ids);
}
/**
* 复制
*
* @param duplicateParam 复制参数
*/
public void duplicate(SalarySobDuplicateParam duplicateParam) {
getSalarySobService(user).duplicate(duplicateParam);
}
}