排序规则

This commit is contained in:
钱涛 2022-09-19 13:41:09 +08:00
parent 8492c2097b
commit a7bd4a43d6
8 changed files with 145 additions and 2 deletions

View File

@ -60,4 +60,9 @@ public class SalaryArchiveQueryParam extends BaseQueryParam {
* SalaryArchiveStatusEnum
*/
private String archiveStatus;
/**
* 排序配置
*/
private String orderRule;
}

View File

@ -32,6 +32,8 @@ import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.service.SalaryAcctEmployeeService;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -100,7 +102,11 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
}
private SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
@Override
@ -128,6 +134,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
List<TaxAgentManageRangeEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
Map<Long, List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee>> taxAgentEmployeesMap = SalaryEntityUtil.convert2Map(taxAgentEmployeeDTOS, TaxAgentManageRangeEmployeeDTO::getTaxAgentId, TaxAgentManageRangeEmployeeDTO::getEmployeeList);
//排序配置
getSalarySysConfService(user).orderRule();
if (needAuth) {
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId);

View File

@ -0,0 +1,20 @@
package com.engine.salary.sys.constant;
/**
* 系统常量
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySysConstant {
/**
* 自定义配置
*/
public static final String CUSTOM_CODE = "custom";
/**
* 排序规则标识
*/
public static final String ORDER_RULE_CODE = "orderRule";
}

View File

@ -0,0 +1,59 @@
package com.engine.salary.sys.enums;
import com.engine.salary.enums.BaseEnum;
import org.apache.commons.lang3.StringUtils;
/**
* 排序规则枚举
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum OrderRuleEnum implements BaseEnum<String> {
DSPORDER("dspOrder", "人员显示顺序", 1),
DEPTSHOWORDER("deptShowOrder", "部门显示顺序", 1),
SUBCOMSHOWORDER("subcomShowOrder", "分部显示顺序", 1),
LASTNAME("lastName", "人员名称", 1),
DEPTNAME("deptName", "部门名称", 1),
SUBCOMNAME("subcomName", "分部名称", 1),
SHOWORDEROFDEPTTREE("showOrderOfDeptTree", "组织", 1);
private String value;
private String defaultLabel;
private int labelId;
OrderRuleEnum(String value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
@Override
public String getValue() {
return value;
}
@Override
public String getDefaultLabel() {
return defaultLabel;
}
@Override
public Integer getLabelId() {
return labelId;
}
public static OrderRuleEnum parseByValue(String value) {
for (OrderRuleEnum taxDeclarationFunctionEnum : OrderRuleEnum.values()) {
if (StringUtils.equals(taxDeclarationFunctionEnum.getValue(), value)) {
return taxDeclarationFunctionEnum;
}
}
return null;
}
}

View File

@ -33,4 +33,9 @@ public interface SalarySysConfService {
void update(SalarySysConfPO salarySysConfPO);
SalarySysConfPO getById(Long id);
void updateByCode(SalarySysConfPO salarySysConfPO);
String orderRule();
}

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.enums.OrderRuleEnum;
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
import com.engine.salary.sys.service.SalarySysConfService;
import dm.jdbc.util.IdGenerator;
@ -12,6 +13,9 @@ import dm.jdbc.util.IdGenerator;
import java.util.Date;
import java.util.List;
import static com.engine.salary.sys.constant.SalarySysConstant.CUSTOM_CODE;
import static com.engine.salary.sys.constant.SalarySysConstant.ORDER_RULE_CODE;
/**
* 薪酬系统配置类
* <p>Copyright: Copyright (c) 2022</p>
@ -79,7 +83,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
salarySysConfPO.setCreateTime(new Date());
salarySysConfPO.setDeleteType(0);
salarySysConfPO.setOrderWeight(0);
salarySysConfPO.setModule("custom");
salarySysConfPO.setModule(CUSTOM_CODE);
getSalarySysConfMapper().insertIgnoreNull(salarySysConfPO);
}
@ -103,4 +107,25 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return po;
}
@Override
public void updateByCode(SalarySysConfPO po) {
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey());
if (sysConfPO == null) {
throw new SalaryRunTimeException("系统配置不存在");
}
sysConfPO.setConfValue(po.getConfValue());
sysConfPO.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(sysConfPO);
}
@Override
public String orderRule() {
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(ORDER_RULE_CODE);
if (sysConfPO == null) {
return OrderRuleEnum.DSPORDER.getValue();
}
return sysConfPO.getConfValue();
}
}

View File

@ -135,4 +135,19 @@ public class SalarySystemConfigController {
return new ResponseResult<SalarySysConfPO, String>(user).run(getSalarySystemConfigWrapper(user)::update, param);
}
/**
* 单个规则配置
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/updateByCode")
@Produces(MediaType.APPLICATION_JSON)
public String updateByCode(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySysConfPO param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySysConfPO, String>(user).run(getSalarySystemConfigWrapper(user)::updateByCode, param);
}
}

View File

@ -98,4 +98,8 @@ public class SalarySystemConfigWrapper extends Service {
public SalarySysConfPO detail(Long id) {
return getSalarySysConfService(user).getById(id);
}
public void updateByCode(SalarySysConfPO salarySysConfPO) {
getSalarySysConfService(user).updateByCode(salarySysConfPO);
}
}