diff --git a/src/com/engine/salary/biz/SalarySobEmpFieldBiz.java b/src/com/engine/salary/biz/SalarySobEmpFieldBiz.java new file mode 100644 index 000000000..d75a75040 --- /dev/null +++ b/src/com/engine/salary/biz/SalarySobEmpFieldBiz.java @@ -0,0 +1,47 @@ +package com.engine.salary.biz; + +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; +import com.engine.salary.mapper.salarysob.SalarySobEmpFieldMapper; +import org.apache.ibatis.session.SqlSession; +import weaver.conn.mybatis.MyBatisFactory; + +import java.util.Collection; +import java.util.List; + +public class SalarySobEmpFieldBiz { + + + public List listSome(SalarySobEmpFieldPO build) { + + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobEmpFieldMapper mapper = sqlSession.getMapper(SalarySobEmpFieldMapper.class); + return mapper.listSome(build); + + } finally { + sqlSession.close(); + } + } + + public void batchInsert(Collection salarySobEmpFieldPOS) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobEmpFieldMapper mapper = sqlSession.getMapper(SalarySobEmpFieldMapper.class); + mapper.batchInsert(salarySobEmpFieldPOS); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } + + public void deleteBySalarySobIds(Collection salarySobIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + SalarySobEmpFieldMapper mapper = sqlSession.getMapper(SalarySobEmpFieldMapper.class); + mapper.deleteBySalarySobIds(salarySobIds); + sqlSession.commit(); + } finally { + sqlSession.close(); + } + } +} diff --git a/src/com/engine/salary/cmd/TaxRate/TaxRateListCmd.java b/src/com/engine/salary/cmd/TaxRate/TaxRateListCmd.java index 66a2bd3b1..d28be93c9 100644 --- a/src/com/engine/salary/cmd/TaxRate/TaxRateListCmd.java +++ b/src/com/engine/salary/cmd/TaxRate/TaxRateListCmd.java @@ -67,6 +67,7 @@ public class TaxRateListCmd extends AbstractCommonCommand> { table.setCheckboxList(checkboxpopedomList); table.setCheckboxpopedom(null); + WeaResultMsg result = new WeaResultMsg(false); result.putAll(table.makeDataResult()); result.success(); diff --git a/src/com/engine/salary/entity/salaryitem/dto/SysSalaryItemListDTO.java b/src/com/engine/salary/entity/salaryitem/dto/SysSalaryItemListDTO.java index 33c177821..65d29d7d9 100644 --- a/src/com/engine/salary/entity/salaryitem/dto/SysSalaryItemListDTO.java +++ b/src/com/engine/salary/entity/salaryitem/dto/SysSalaryItemListDTO.java @@ -23,7 +23,7 @@ import lombok.NoArgsConstructor; @NoArgsConstructor @AllArgsConstructor @SalaryTable(pageId = "a4f85287-6111-7721-adn9-7d06e54y6rj9", - fields = " t.id, t.name, t.category, t.item_type, t.rounding_mode, t.pattern, t.value_type", + fields = " t.id, t.name, t.category, t.item_type as itemType, t.rounding_mode as roundingMode, t.pattern, t.value_type as valueType", fromSql = " FROM hrsa_sys_salary_item t", tableType = WeaTableType.CHECKBOX) public class SysSalaryItemListDTO { @@ -39,16 +39,16 @@ public class SysSalaryItemListDTO { @SalaryTableColumn(text = "属性", width = "10%", column = "category") private String category; - @SalaryTableColumn(text = "类型", width = "10%", column = "itemType") + @SalaryTableColumn(text = "类型", width = "10%", column = "itemType",transmethod = "com.engine.salary.transmethod.TransMethod.valueType") private String itemType; - @SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode") + @SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode",transmethod = "com.engine.salary.transmethod.TransMethod.roundingMode") private String roundingMode; @SalaryTableColumn(text = "保留小数位", width = "10%", column = "pattern") private Integer pattern; - @SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType") + @SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType",transmethod = "com.engine.salary.transmethod.TransMethod.datasource") private String valueType; @SalaryTableColumn(text = "操作", width = "20%", column = "operate") diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java index eb0f48e69..62b8a4c19 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobItemSaveBO.java @@ -31,7 +31,6 @@ public class SalarySobItemSaveBO { * * @param saveParam * @param employeeId - * @param tenantKey * @return */ public static Result handle(SalarySobItemSaveParam saveParam, Long employeeId) { diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobEmpFieldMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobEmpFieldMapper.java new file mode 100644 index 000000000..8221abb24 --- /dev/null +++ b/src/com/engine/salary/mapper/salarysob/SalarySobEmpFieldMapper.java @@ -0,0 +1,95 @@ +package com.engine.salary.mapper.salarysob; + +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface SalarySobEmpFieldMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(SalarySobEmpFieldPO SalarySobEmpFieldPO); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + SalarySobEmpFieldPO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param SalarySobEmpFieldPO 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(SalarySobEmpFieldPO SalarySobEmpFieldPO); + + /** + * 修改,修改所有字段 + * + * @param SalarySobEmpFieldPO 修改的记录 + * @return 返回影响行数 + */ + int update(SalarySobEmpFieldPO SalarySobEmpFieldPO); + + /** + * 修改,忽略null字段 + * + * @param SalarySobEmpFieldPO 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(SalarySobEmpFieldPO SalarySobEmpFieldPO); + + /** + * 删除记录 + * + * @param SalarySobEmpFieldPO 待删除的记录 + * @return 返回影响行数 + */ + int delete(SalarySobEmpFieldPO SalarySobEmpFieldPO); + + + /** + * 批量插入 + * + * @param salarySobEmpFields + */ + void batchInsert(@Param("collection") Collection salarySobEmpFields); + + /** + * 批量更新 + * + * @param salarySobEmpFields + */ + void batchUpdate(@Param("collection") Collection salarySobEmpFields); + + /** + * 根据主键id删除 + * + * @param ids + */ + void deleteByIds(@Param("ids") Collection ids); + + /** + * 根据薪资账套id删除 + * + * @param salarySobIds + */ + void deleteBySalarySobIds(@Param("salarySobIds") Collection salarySobIds); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobEmpFieldMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobEmpFieldMapper.xml new file mode 100644 index 000000000..a58db1f1c --- /dev/null +++ b/src/com/engine/salary/mapper/salarysob/SalarySobEmpFieldMapper.xml @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + t + . + id + , t.salary_sob_id + , t.field_code + , t.sorted_index + , t.can_delete + , t.creator + , t.create_time + , t.update_time + , t.delete_type + , t.tenant_key + + + + + + + + + + + + + + + INSERT INTO hrsa_salary_sob_emp_field + + + + id, + + + salary_sob_id, + + + field_code, + + + sorted_index, + + + can_delete, + + + creator, + + + create_time, + + + update_time, + + + delete_type, + + + tenant_key, + + + + + #{id}, + + + #{salarySobId}, + + + #{fieldCode}, + + + #{sortedIndex}, + + + #{canDelete}, + + + #{creator}, + + + #{createTime}, + + + #{updateTime}, + + + #{deleteType}, + + + #{tenantKey}, + + + + + + + UPDATE hrsa_salary_sob_emp_field + + salary_sob_id=#{salarySobId}, + field_code=#{fieldCode}, + sorted_index=#{sortedIndex}, + can_delete=#{canDelete}, + creator=#{creator}, + create_time=#{createTime}, + update_time=#{updateTime}, + delete_type=#{deleteType}, + tenant_key=#{tenantKey}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_salary_sob_emp_field + + + salary_sob_id=#{salarySobId}, + + + field_code=#{fieldCode}, + + + sorted_index=#{sortedIndex}, + + + can_delete=#{canDelete}, + + + creator=#{creator}, + + + create_time=#{createTime}, + + + update_time=#{updateTime}, + + + delete_type=#{deleteType}, + + + tenant_key=#{tenantKey}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_salary_sob_emp_field + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + + + INSERT INTO + hrsa_salary_sob_emp_field(salary_sob_id, field_code, sorted_index, creator, create_time, update_time, + delete_type, tenant_key) + VALUES + + ( + #{item.salarySobId}, + #{item.fieldCode}, + #{item.sortedIndex}, + #{item.creator}, + #{item.createTime}, + #{item.updateTime}, + 0, + #{item.tenantKey} + ) + + + + INSERT INTO + hrsa_salary_sob_emp_field( salary_sob_id, field_code, sorted_index, creator, create_time, update_time, + delete_type, tenant_key) + + + select + #{item.salarySobId}, + #{item.fieldCode}, + #{item.sortedIndex}, + #{item.creator}, + #{item.createTime}, + #{item.updateTime}, + 0, + #{item.tenantKey} + from dual + + + + INSERT INTO + hrsa_salary_sob_emp_field(salary_sob_id, field_code, sorted_index, creator, create_time, update_time, + delete_type, tenant_key) + VALUES + + ( + #{item.salarySobId}, + #{item.fieldCode}, + #{item.sortedIndex}, + #{item.creator}, + #{item.createTime}, + #{item.updateTime}, + 0, + #{item.tenantKey} + ) + + + + + UPDATE hrsa_salary_sob_emp_field + + + + WHEN id = #{item.id} THEN #{item.sortedIndex} + + + + + WHEN id = #{item.id} THEN #{item.updateTime} + + + + WHERE delete_type = 0 + AND id IN + + #{item.id} + + + + + UPDATE hrsa_salary_sob_emp_field + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + UPDATE hrsa_salary_sob_emp_field + SET delete_type = 1 + WHERE delete_type = 0 + AND salary_sob_id IN + + #{salarySobId} + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/impl/SalarySobEmpFieldServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobEmpFieldServiceImpl.java new file mode 100644 index 000000000..bdc47daa0 --- /dev/null +++ b/src/com/engine/salary/service/impl/SalarySobEmpFieldServiceImpl.java @@ -0,0 +1,36 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.biz.SalarySobEmpFieldBiz; +import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; +import com.engine.salary.service.SalarySobEmpFieldService; + +import java.util.Collection; +import java.util.List; + +/** + * @description: 薪资账套的员工信息字段 + * @author: xiajun + * @modified By: xiajun + * @date: Created in 1/18/22 5:43 PM + * @version:v1.0 + */ +public class SalarySobEmpFieldServiceImpl extends Service implements SalarySobEmpFieldService { + + private SalarySobEmpFieldBiz salarySobEmpFieldMapper = new SalarySobEmpFieldBiz(); + + @Override + public List listBySalarySobId(Long salarySobId) { + return salarySobEmpFieldMapper.listSome(SalarySobEmpFieldPO.builder().salarySobId(salarySobId).build()); + } + + @Override + public void batchSave(Collection salarySobEmpFieldPOS) { + salarySobEmpFieldMapper.batchInsert(salarySobEmpFieldPOS); + } + + @Override + public void deleteBySalarySobIds(Collection salarySobIds) { + salarySobEmpFieldMapper.deleteBySalarySobIds(salarySobIds); + } +} diff --git a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java index 83fc0f2f4..61e568491 100644 --- a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.SalarySobBiz; import com.engine.salary.biz.SalarySobItemBiz; @@ -18,6 +19,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.weaver.excel.formula.api.entity.ExpressFormula; import org.apache.commons.collections4.CollectionUtils; +import weaver.hrm.User; import java.util.*; @@ -33,8 +35,15 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe private SalarySobItemBiz salarySobItemMapper = new SalarySobItemBiz(); private SalarySobBiz salarySobBiz = new SalarySobBiz(); - private SalarySobEmpFieldService salarySobEmpFieldService; - private SalarySobItemGroupService salarySobItemGroupService; + + private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) { + return (SalarySobEmpFieldService) ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user); + } + + private SalarySobItemGroupService getSalarySobItemGroupService(User user) { + return (SalarySobItemGroupService) ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user); + } + private SalaryFormulaService salaryFormulaService; private SalaryItemService salaryItemService; // private LoggerTemplate salarySobLoggerTemplate; @@ -87,9 +96,9 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); } // 查询薪资账套的员工信息字段 - List salarySobEmpFieldPOS = salarySobEmpFieldService.listBySalarySobId(salarySobId); + List salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId); // 查询薪资账套的薪资项目分类 - List salarySobItemGroupPOS = salarySobItemGroupService.listBySalarySobId(salarySobId); + List salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salarySobId); // 查询薪资账套的薪资项目副本 List salarySobItemPOS = listBySalarySobId(salarySobId); // 薪资账套的薪资项目副本所用的公式id @@ -112,26 +121,27 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe if (Objects.isNull(salarySobPO)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除")); } - // 删除薪资账套的员工信息字段 - salarySobEmpFieldService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); - // 删除薪资账套的薪资项目副本 - deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); - // 删除薪资账套的薪资项目分类 - salarySobItemGroupService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); + //todo +// // 删除薪资账套的员工信息字段 +// salarySobEmpFieldService.deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); +// // 删除薪资账套的薪资项目副本 +// deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); +// // 删除薪资账套的薪资项目分类 +// getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singleton(saveParam.getSalarySobId())); // 处理保存参数 SalarySobItemSaveBO.Result result = SalarySobItemSaveBO.handle(saveParam,(long)user.getUID()); // 保存薪资账套的员工信息字段 - if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobEmpFields())) { - salarySobEmpFieldService.batchSave(result.getNeedInsertSalarySobEmpFields()); - } +// if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobEmpFields())) { +// salarySobEmpFieldService.batchSave(result.getNeedInsertSalarySobEmpFields()); +// } // 保存薪资账套的薪资项目副本 if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItems())) { batchSave(result.getNeedInsertSalarySobItems()); } // 保存薪资账套的薪资项目分类 if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobItemGroups())) { - salarySobItemGroupService.batchSave(result.getNeedInsertSalarySobItemGroups()); + getSalarySobItemGroupService(user).batchSave(result.getNeedInsertSalarySobItemGroups()); } //todo 记录日志 // LoggerContext loggerContext = new LoggerContext<>(); diff --git a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java index 925d4fe56..197bada7e 100644 --- a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java @@ -42,7 +42,7 @@ import java.util.stream.Collectors; **/ public class SalarySobRangeServiceImpl extends Service implements SalarySobRangeService { - private SalarySobRangeBiz salarySobRangeMapper = new SalarySobRangeBiz(); + private SalarySobRangeBiz salarySobRangeBiz = new SalarySobRangeBiz(); private EmployBiz employBiz = new EmployBiz(); OrganizationShowSetBiz orgBiz = new OrganizationShowSetBiz(); @@ -60,12 +60,12 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange if (CollectionUtils.isEmpty(ids)) { return Collections.emptyList(); } - return salarySobRangeMapper.listSome(SalarySobRangePO.builder().ids(ids).build()); + return salarySobRangeBiz.listSome(SalarySobRangePO.builder().ids(ids).build()); } @Override public List listBySalarySobIdAndIncludeType(Long salarySobId, Integer includeType) { - return salarySobRangeMapper.listSome(SalarySobRangePO.builder().salarySobId(salarySobId).includeType(includeType).build()); + return salarySobRangeBiz.listSome(SalarySobRangePO.builder().salarySobId(salarySobId).includeType(includeType).build()); } @Override @@ -128,10 +128,10 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange SalarySobRangeSaveBO.Result result = SalarySobRangeSaveBO.handle(salarySobRangePOS, saveParam, (long) user.getUID()); // 保存 if (CollectionUtils.isNotEmpty(result.getNeedInsertSalarySobRanges())) { - salarySobRangeMapper.batchInsert(result.getNeedInsertSalarySobRanges()); + salarySobRangeBiz.batchInsert(result.getNeedInsertSalarySobRanges()); } if (CollectionUtils.isNotEmpty(result.getNeedUpdateSalarySobRanges())) { - result.getNeedUpdateSalarySobRanges().forEach(e -> salarySobRangeMapper.updateById(e)); + result.getNeedUpdateSalarySobRanges().forEach(e -> salarySobRangeBiz.updateById(e)); } // todo 记录日志 // String operateTypeName = Objects.equals(saveParam.getIncludeType(), NumberUtils.INTEGER_ONE) ? @@ -155,7 +155,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange } ids = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getId); // 删除薪资账套的人员范围 - salarySobRangeMapper.deleteByIds(ids); + salarySobRangeBiz.deleteByIds(ids); // 查询薪资账套 Set salarySobIds = SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getSalarySobId); List salarySobPOS = getSalarySobService(user).listByIds(salarySobIds); @@ -176,6 +176,6 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange @Override public void deleteBySalarySobIds(Collection salarySobIds) { - salarySobRangeMapper.deleteBySalarySobIds(salarySobIds); + salarySobRangeBiz.deleteBySalarySobIds(salarySobIds); } } diff --git a/src/com/engine/salary/web/SalarySobController.java b/src/com/engine/salary/web/SalarySobController.java index 23e34f281..8c9230ba7 100644 --- a/src/com/engine/salary/web/SalarySobController.java +++ b/src/com/engine/salary/web/SalarySobController.java @@ -1,21 +1,27 @@ package com.engine.salary.web; import com.engine.common.util.ServiceUtil; +import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; +import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; import com.engine.salary.entity.salarysob.param.*; +import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; +import com.engine.salary.wrapper.SalarySobItemWrapper; import com.engine.salary.wrapper.SalarySobRangeWrapper; import com.engine.salary.wrapper.SalarySobWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; 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; @@ -43,8 +49,10 @@ public class SalarySobController { return ServiceUtil.getService(SalarySobRangeWrapper.class, user); } -// private SalarySobRangeWrapper salarySobRangeWrapper; -// private SalarySobItemWrapper salarySobItemWrapper; + private SalarySobItemWrapper getSalarySobItemWrapper(User user) { + return ServiceUtil.getService(SalarySobItemWrapper.class, user); + } + // private SalarySobAdjustRuleWrapper salarySobAdjustRuleWrapper; // private SalarySobCheckRuleWrapper salarySobCheckRuleWrapper; @@ -189,38 +197,61 @@ public class SalarySobController { /**********************************薪资账套的薪资项目 start*********************************/ -// @PostMapping("/item/listSalaryItem") -// @ApiOperation("薪资账套可选薪资项目") -// @WeaPermission -// public WeaResult> listSalaryItem(@RequestBody SalaryItemSearchParam queryParam) { -// WeaTable weaTable = salarySobItemWrapper.listPage4SalaryItem(queryParam, TenantContext.getCurrentTenantKey()); -// return WeaResult.success(weaTable); -// } -// -// @GetMapping("/item/group/getForm") -// @ApiOperation("薪资账套项目分组的详情") -// @WeaPermission -// public WeaResult 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 getSalarySobItemForm(@RequestParam(name = "salarySobId") Long salarySobId) { -// SalarySobItemAggregateDTO form = salarySobItemWrapper.getForm(salarySobId, TenantContext.getCurrentTenantKey()); -// return WeaResult.success(form); -// } -// -// @PostMapping("/item/save") -// @ApiOperation("保存薪资账套薪资项目") -// @WeaPermission -// public WeaResult saveSalarySobItem(@RequestBody @Validated SalarySobItemSaveParam saveParam) { -// salarySobItemWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); -// return WeaResult.success(null); -// } -// + /** + * 薪资账套可选薪资项目 + */ + @POST + @Path("/item/listSalaryItem") + @Produces(MediaType.APPLICATION_JSON) + public String listSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>().run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam); + } + + + /** + * 薪资账套可选薪资项目分类 + */ + @GET + @Path("/item/group/getForm") + @Produces(MediaType.APPLICATION_JSON) + public String getSalarySobItemGroupForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + String idStr = request.getParameter("id"); + Long id = null; + if(StringUtils.isNotBlank(idStr)){ + id = Long.valueOf(idStr); + } + return new ResponseResult().run(getSalarySobItemWrapper(user)::getGroupForm, id); + } + + /** + * 薪资账套薪资项目详情 + */ + @GET + @Path("/item/getForm") + @Produces(MediaType.APPLICATION_JSON) + public String getSalarySobItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + String salarySobIdStr = request.getParameter("salarySobId"); + Long salarySobId = null; + if(StringUtils.isNotBlank(salarySobIdStr)){ + salarySobId = Long.valueOf(salarySobIdStr); + } + return new ResponseResult().run(getSalarySobItemWrapper(user)::getForm, salarySobId); + } + + /** + * 保存薪资账套薪资项目 + */ + @POST + @Path("/item/save") + @Produces(MediaType.APPLICATION_JSON) + public String saveSalarySobItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobItemSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult().run(getSalarySobItemWrapper(user)::save, saveParam); + } + // /**********************************薪资账套的薪资项目 end*********************************/ // // /**********************************调薪计薪规则 start*********************************/ diff --git a/src/com/engine/salary/wrapper/SalarySobItemWrapper.java b/src/com/engine/salary/wrapper/SalarySobItemWrapper.java index 7144f7c73..d5a07f9b0 100644 --- a/src/com/engine/salary/wrapper/SalarySobItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobItemWrapper.java @@ -1,6 +1,7 @@ package com.engine.salary.wrapper; import com.cloudstore.eccom.result.WeaResultMsg; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.component.SalaryWeaTable; import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; @@ -12,7 +13,11 @@ import com.engine.salary.service.SalaryFormulaService; import com.engine.salary.service.SalaryItemService; import com.engine.salary.service.SalarySobItemGroupService; import com.engine.salary.service.SalarySobItemService; +import com.engine.salary.service.impl.SalaryItemServiceImpl; +import com.engine.salary.service.impl.SalarySobItemGroupServiceImpl; +import com.engine.salary.service.impl.SalarySobItemServiceImpl; import org.springframework.stereotype.Component; +import weaver.hrm.User; import java.util.Map; @@ -27,9 +32,19 @@ import java.util.Map; @Component public class SalarySobItemWrapper extends Service { - private SalarySobItemService salarySobItemService; - private SalarySobItemGroupService salarySobItemGroupService; - private SalaryItemService salaryItemService; + private SalarySobItemService getSalarySobItemService(User user) { + return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user); + } + + private SalarySobItemGroupService getSalarySobItemGroupService(User user) { + return (SalarySobItemGroupService) ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user); + } + + private SalaryItemService getSalaryItemService(User user) { + return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user); + } + + private SalaryFormulaService salaryFormulaService; /** @@ -101,7 +116,7 @@ public class SalarySobItemWrapper extends Service { * @return */ public SalarySobItemGroupPO getGroupForm(Long salarySobItemGroupId) { - return salarySobItemGroupService.getById(salarySobItemGroupId); + return getSalarySobItemGroupService(user).getById(salarySobItemGroupId); } /** @@ -111,7 +126,7 @@ public class SalarySobItemWrapper extends Service { * @return */ public SalarySobItemAggregateDTO getForm(Long salarySobId) { - return salarySobItemService.getAggregateBySalarySobId(salarySobId); + return getSalarySobItemService(user).getAggregateBySalarySobId(salarySobId); } /** @@ -120,6 +135,6 @@ public class SalarySobItemWrapper extends Service { * @param saveParam 保存参数 */ public void save(SalarySobItemSaveParam saveParam) { - salarySobItemService.save(saveParam); + getSalarySobItemService(user).save(saveParam); } }