2022-03-22 21:01:38 +08:00
|
|
|
|
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" +
|
2022-05-06 16:01:33 +08:00
|
|
|
|
" , t.income_category" +
|
|
|
|
|
|
" , t.salary_cycle_type as salaryCycle" +
|
2022-04-26 14:44:42 +08:00
|
|
|
|
" , t.salary_cycle_from_day as salaryCycleFromDay" +
|
2022-03-22 21:01:38 +08:00
|
|
|
|
" , 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);
|
2022-03-30 18:00:56 +08:00
|
|
|
|
table.setSqlwhere(makeSqlWhere(queryParam));
|
2022-03-22 21:01:38 +08:00
|
|
|
|
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")
|
2022-03-30 15:58:29 +08:00
|
|
|
|
.setTaxableItems(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue());
|
2022-03-22 21:01:38 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|