163 lines
6.2 KiB
Java
163 lines
6.2 KiB
Java
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;
|
|
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
|
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
|
|
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
|
|
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
|
|
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.*;
|
|
|
|
/**
|
|
* 薪资账套的薪资项目
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
* <p>Company: 泛微软件</p>
|
|
*
|
|
* @author qiantao
|
|
* @version 1.0
|
|
**/
|
|
@Component
|
|
public class SalarySobItemWrapper extends Service {
|
|
|
|
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;
|
|
|
|
/**
|
|
* 薪资账套可选薪资项目列表
|
|
*
|
|
* @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();
|
|
|
|
|
|
// // 分页查询薪资项目
|
|
// 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;
|
|
|
|
}
|
|
|
|
/**
|
|
* 获取薪资账套的薪资项目详情
|
|
*
|
|
* @param salarySobItemGroupId 薪资账套的薪资项目的id
|
|
* @return
|
|
*/
|
|
public SalarySobItemGroupPO getGroupForm(Long salarySobItemGroupId) {
|
|
return getSalarySobItemGroupService(user).getById(salarySobItemGroupId);
|
|
}
|
|
|
|
/**
|
|
* 获取薪资账套的薪资项目详情
|
|
*
|
|
* @param salarySobId 薪资账套的id
|
|
* @return
|
|
*/
|
|
public SalarySobItemAggregateDTO getForm(Long salarySobId) {
|
|
return getSalarySobItemService(user).getAggregateBySalarySobId(salarySobId);
|
|
}
|
|
|
|
/**
|
|
* 保存
|
|
*
|
|
* @param saveParam 保存参数
|
|
*/
|
|
public void save(SalarySobItemSaveParam saveParam) {
|
|
getSalarySobItemService(user).save(saveParam);
|
|
}
|
|
|
|
|
|
public Collection<Map<String, String>> empFieldList() {
|
|
List<Map<String, String>> list = new ArrayList();
|
|
Map<String, String> taxAgentName = new HashMap<>();
|
|
taxAgentName.put("name", "个税扣缴义务人");
|
|
taxAgentName.put("id", "taxAgentName");
|
|
list.add(taxAgentName);
|
|
Map<String, String> username = new HashMap<>();
|
|
username.put("name", "姓名");
|
|
username.put("id", "username");
|
|
list.add(username);
|
|
Map<String, String> departmentName = new HashMap<>();
|
|
departmentName.put("name", "部门");
|
|
departmentName.put("id", "departmentName");
|
|
list.add(departmentName);
|
|
Map<String, String> email = new HashMap<>();
|
|
email.put("name", "邮件");
|
|
email.put("id", "");
|
|
list.add(email);
|
|
return list;
|
|
}
|
|
}
|