This commit is contained in:
parent
b1b086caf1
commit
cb30e24e95
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salarysob.dto.*;
|
||||
import com.engine.salary.entity.salarysob.param.*;
|
||||
|
|
@ -206,7 +207,7 @@ public class SalarySobController {
|
|||
@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<SalaryItemSearchParam, Map<String, Object>>().run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam);
|
||||
return new ResponseResult<SalaryItemSearchParam, PageInfo<SalaryItemListDTO> >().run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
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.annotation.SalaryFormulaVar;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
|
||||
|
|
@ -15,12 +16,15 @@ 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.SalaryFormulaServiceImpl;
|
||||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.service.impl.SalarySobItemGroupServiceImpl;
|
||||
import com.engine.salary.service.impl.SalarySobItemServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
|
@ -50,7 +54,9 @@ public class SalarySobItemWrapper extends Service {
|
|||
}
|
||||
|
||||
|
||||
private SalaryFormulaService salaryFormulaService;
|
||||
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||||
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪资账套可选薪资项目列表
|
||||
|
|
@ -58,59 +64,60 @@ public class SalarySobItemWrapper extends Service {
|
|||
* @param queryParam 列表查询条件
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage4SalaryItem(SalaryItemSearchParam queryParam) {
|
||||
SalaryWeaTable<SalaryItemListDTO> table = new SalaryWeaTable<SalaryItemListDTO>(user, SalaryItemListDTO.class);
|
||||
|
||||
String fields = " t.id" +
|
||||
" , t.name" +
|
||||
" , t.code" +
|
||||
" , t.system_type" +
|
||||
" , t.sys_salary_item_id" +
|
||||
" , t.category" +
|
||||
" , t.item_type as itemType" +
|
||||
" , t.use_default as useDefault" +
|
||||
" , t.use_in_employee_salary as useInEmployeeSalary" +
|
||||
" , t.rounding_mode as roundingMode" +
|
||||
" , t.pattern" +
|
||||
" , t.value_type as valueType" +
|
||||
" , t.datasource" +
|
||||
" , t.formula_id" +
|
||||
" , t.description" +
|
||||
" , t.can_edit" +
|
||||
" , t.can_delete";
|
||||
|
||||
String from = "from hrsa_salary_item t";
|
||||
|
||||
table.setBackfields(fields);
|
||||
table.setSqlform(from);
|
||||
table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(queryParam));
|
||||
table.setSqlorderby("t.id DESC");
|
||||
table.setSqlprimarykey("t.id");
|
||||
table.setSqlisdistinct("false");
|
||||
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
return result.getResultMap();
|
||||
public PageInfo<SalaryItemListDTO> listPage4SalaryItem(SalaryItemSearchParam queryParam) {
|
||||
// SalaryWeaTable<SalaryItemListDTO> table = new SalaryWeaTable<SalaryItemListDTO>(user, SalaryItemListDTO.class);
|
||||
//
|
||||
// String fields = " t.id" +
|
||||
// " , t.name" +
|
||||
// " , t.code" +
|
||||
// " , t.system_type" +
|
||||
// " , t.sys_salary_item_id" +
|
||||
// " , t.category" +
|
||||
// " , t.item_type as itemType" +
|
||||
// " , t.use_default as useDefault" +
|
||||
// " , t.use_in_employee_salary as useInEmployeeSalary" +
|
||||
// " , t.rounding_mode as roundingMode" +
|
||||
// " , t.pattern" +
|
||||
// " , t.value_type as valueType" +
|
||||
// " , t.datasource" +
|
||||
// " , t.formula_id" +
|
||||
// " , t.description" +
|
||||
// " , t.can_edit" +
|
||||
// " , t.can_delete";
|
||||
//
|
||||
// String from = "from hrsa_salary_item t";
|
||||
//
|
||||
// table.setBackfields(fields);
|
||||
// table.setSqlform(from);
|
||||
// table.setSqlwhere(SalaryItemSearchParam.makeSqlWhere(queryParam));
|
||||
// table.setSqlorderby("t.id DESC");
|
||||
// table.setSqlprimarykey("t.id");
|
||||
// table.setSqlisdistinct("false");
|
||||
//
|
||||
// WeaResultMsg result = new WeaResultMsg(false);
|
||||
// result.putAll(table.makeDataResult());
|
||||
// result.success();
|
||||
// return result.getResultMap();
|
||||
|
||||
|
||||
// // 分页查询薪资项目
|
||||
// Page<SalaryItemPO> page = salaryItemService.listPageByParam(queryParam);
|
||||
// Page<SalaryItemListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
||||
// if (CollectionUtils.isNotEmpty(page.getRecords())) {
|
||||
// // 查询公式
|
||||
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalaryItemPO::getFormulaId);
|
||||
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
|
||||
// // 转换成薪资项目列表dto
|
||||
// dtoPage.setRecords(SalaryItemBO.convert2ListDTO(page.getRecords(), expressFormulas));
|
||||
// }
|
||||
// // 构建前端所需的数据格式
|
||||
// WeaTable<SalaryItemListDTO> weaTable = SalaryFormatUtil.<SalaryItemListDTO>getInstance().buildTable(SalaryItemListDTO.class, dtoPage);
|
||||
// // 列表可勾选但是不需要操作列
|
||||
// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX);
|
||||
// weaTable.setOperates(Collections.emptyList());
|
||||
// weaTable.setOperatesPermission(Collections.emptyList());
|
||||
// return weaTable;
|
||||
// 分页查询薪资项目
|
||||
PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(queryParam);
|
||||
|
||||
List<SalaryItemPO> salaryItemList = page.getList();
|
||||
|
||||
//最终返回的分页对象
|
||||
PageInfo<SalaryItemListDTO> dtoPage = new PageInfo<>(SalaryItemListDTO.class);
|
||||
dtoPage.setPageSize(page.getPageSize());
|
||||
dtoPage.setPageNum(page.getPageNum());
|
||||
dtoPage.setTotal(page.getTotal());
|
||||
if (CollectionUtils.isNotEmpty(salaryItemList)) {
|
||||
// 查询公式
|
||||
Set<Long> formulaIds = SalaryEntityUtil.properties(salaryItemList, SalaryItemPO::getFormulaId);
|
||||
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
|
||||
// 转换成薪资项目列表dto
|
||||
dtoPage.setList(SalaryItemBO.convert2ListDTO(salaryItemList, expressFormulas));
|
||||
}
|
||||
return dtoPage;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue