排序规则
This commit is contained in:
parent
b464240ff7
commit
830e099b57
|
|
@ -13,7 +13,6 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
|||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
|
||||
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
|
||||
|
|
@ -28,7 +27,6 @@ import com.engine.salary.util.page.PageInfo;
|
|||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -480,10 +478,11 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
|
||||
/**
|
||||
* 筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
* @param employeeList 人力资源池
|
||||
*
|
||||
* @param employeeList 人力资源池
|
||||
* @param userName 姓名
|
||||
* @param deparmentName 部门
|
||||
* @param mobile 手机号
|
||||
* @param mobile 手机号
|
||||
* @param workcode 工号
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -493,10 +492,10 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
List<DataCollectionEmployee> employees = new ArrayList<>();
|
||||
//“0”代表姓名+部门+手机号的匹配原则,“1”代表工号为唯一匹配原则
|
||||
if ("0".equals(salarySysConfPO.getConfValue())) {
|
||||
if (salarySysConfPO == null || "0".equals(salarySysConfPO.getConfValue())) {
|
||||
employees = employeeList.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
|
||||
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
|
||||
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
|
||||
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
|
||||
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
|
||||
.collect(Collectors.toList());
|
||||
} else if ("1".equals(salarySysConfPO.getConfValue())) {
|
||||
employees = employeeList.stream().filter(e -> (StringUtils.isBlank(workcode) || Objects.equals(e.getWorkcode(), workcode)))
|
||||
|
|
|
|||
|
|
@ -17,4 +17,8 @@ public class SalarySysConstant {
|
|||
* 排序规则标识
|
||||
*/
|
||||
public static final String ORDER_RULE_CODE = "orderRule";
|
||||
/**
|
||||
* 顺序标识
|
||||
*/
|
||||
public static final String ASCORDESC_CODE = "ascOrDesc";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.engine.salary.sys.entity.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 保存排序规则参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderRuleParam {
|
||||
/**
|
||||
* 排序规则
|
||||
*/
|
||||
private String orderRule;
|
||||
|
||||
/**
|
||||
* 正序或者倒序
|
||||
*/
|
||||
private String ascOrDesc;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.engine.salary.sys.entity.vo;
|
||||
|
||||
import com.engine.salary.sys.enums.AscOrDescEnum;
|
||||
import com.engine.salary.sys.enums.OrderRuleEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderRuleVO {
|
||||
/**
|
||||
* 排序规则
|
||||
*/
|
||||
private OrderRuleEnum orderRule;
|
||||
|
||||
/**
|
||||
* 正序或者倒序
|
||||
*/
|
||||
private AscOrDescEnum ascOrDesc;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
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 AscOrDescEnum implements BaseEnum<String> {
|
||||
|
||||
ASC("asc", "正序", 1),
|
||||
DESC("desc", "倒序", 1);
|
||||
|
||||
private String value;
|
||||
|
||||
private String defaultLabel;
|
||||
|
||||
private int labelId;
|
||||
|
||||
|
||||
AscOrDescEnum(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 AscOrDescEnum parseByValue(String value) {
|
||||
for (AscOrDescEnum taxDeclarationFunctionEnum : AscOrDescEnum.values()) {
|
||||
if (StringUtils.equals(taxDeclarationFunctionEnum.getValue(), value)) {
|
||||
return taxDeclarationFunctionEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.engine.salary.sys.service;
|
||||
|
||||
import com.engine.salary.sys.entity.param.OrderRuleParam;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -36,6 +38,9 @@ public interface SalarySysConfService {
|
|||
|
||||
void updateByCode(SalarySysConfPO salarySysConfPO);
|
||||
|
||||
String orderRule();
|
||||
OrderRuleVO orderRule();
|
||||
|
||||
void updateOrderRule(OrderRuleParam param);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ import com.api.formmode.mybatis.util.SqlProxyHandle;
|
|||
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.param.OrderRuleParam;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.AscOrDescEnum;
|
||||
import com.engine.salary.sys.enums.OrderRuleEnum;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
|
|
@ -13,8 +16,7 @@ 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;
|
||||
import static com.engine.salary.sys.constant.SalarySysConstant.*;
|
||||
|
||||
/**
|
||||
* 薪酬系统配置类
|
||||
|
|
@ -120,12 +122,70 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public String orderRule() {
|
||||
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(ORDER_RULE_CODE);
|
||||
if (sysConfPO == null) {
|
||||
return OrderRuleEnum.DSPORDER.getValue();
|
||||
public OrderRuleVO orderRule() {
|
||||
SalarySysConfPO rulePO = getSalarySysConfMapper().getOneByCode(ORDER_RULE_CODE);
|
||||
SalarySysConfPO orderPO = getSalarySysConfMapper().getOneByCode(ASCORDESC_CODE);
|
||||
OrderRuleVO orderRuleVO = OrderRuleVO.builder().build();
|
||||
if (rulePO == null) {
|
||||
orderRuleVO.setOrderRule(OrderRuleEnum.DSPORDER);
|
||||
} else {
|
||||
orderRuleVO.setOrderRule(OrderRuleEnum.parseByValue(rulePO.getConfValue()));
|
||||
}
|
||||
if (orderPO == null) {
|
||||
orderRuleVO.setAscOrDesc(AscOrDescEnum.ASC);
|
||||
} else {
|
||||
orderRuleVO.setAscOrDesc(AscOrDescEnum.parseByValue(orderPO.getConfValue()));
|
||||
}
|
||||
return orderRuleVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrderRule(OrderRuleParam param) {
|
||||
if (param == null || OrderRuleEnum.parseByValue(param.getOrderRule()) == null || AscOrDescEnum.parseByValue(param.getAscOrDesc()) == null) {
|
||||
throw new SalaryRunTimeException("配置内容异常!");
|
||||
}
|
||||
|
||||
//更新排序规则
|
||||
SalarySysConfPO orderRulePo = getSalarySysConfMapper().getOneByCode(ORDER_RULE_CODE);
|
||||
if (orderRulePo == null) {
|
||||
SalarySysConfPO build = SalarySysConfPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.confKey(ORDER_RULE_CODE)
|
||||
.confValue(param.getOrderRule())
|
||||
.title("排序规则")
|
||||
.orderWeight(0)
|
||||
.module("basic")
|
||||
.updateTime(new Date())
|
||||
.createTime(new Date())
|
||||
.deleteType(0)
|
||||
.build();
|
||||
getSalarySysConfMapper().insertIgnoreNull(build);
|
||||
} else {
|
||||
orderRulePo.setConfValue(param.getOrderRule());
|
||||
orderRulePo.setUpdateTime(new Date());
|
||||
getSalarySysConfMapper().updateIgnoreNull(orderRulePo);
|
||||
}
|
||||
|
||||
//更新顺序配置
|
||||
SalarySysConfPO ascOrDescPo = getSalarySysConfMapper().getOneByCode(ASCORDESC_CODE);
|
||||
if (ascOrDescPo == null) {
|
||||
SalarySysConfPO build = SalarySysConfPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.confKey(ASCORDESC_CODE)
|
||||
.confValue(param.getAscOrDesc())
|
||||
.title("排序顺序")
|
||||
.orderWeight(0)
|
||||
.module("basic")
|
||||
.updateTime(new Date())
|
||||
.createTime(new Date())
|
||||
.deleteType(0)
|
||||
.build();
|
||||
getSalarySysConfMapper().insertIgnoreNull(build);
|
||||
} else {
|
||||
ascOrDescPo.setConfValue(param.getAscOrDesc());
|
||||
ascOrDescPo.setUpdateTime(new Date());
|
||||
getSalarySysConfMapper().updateIgnoreNull(ascOrDescPo);
|
||||
}
|
||||
return sysConfPO.getConfValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.sys.entity.param.OrderRuleParam;
|
||||
import com.engine.salary.sys.entity.param.SalarySysConfQueryParam;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
|
@ -150,4 +152,20 @@ public class SalarySystemConfigController {
|
|||
return new ResponseResult<SalarySysConfPO, String>(user).run(getSalarySystemConfigWrapper(user)::updateByCode, param);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/updateOrderRule")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateOrderRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OrderRuleParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<OrderRuleParam, String>(user).run(getSalarySystemConfigWrapper(user)::updateOrderRule, param);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/orderRule")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updateOrderRule(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<OrderRuleParam, OrderRuleVO>(user).run(getSalarySystemConfigWrapper(user)::orderRule);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ package com.engine.salary.wrapper;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.sys.entity.param.OrderRuleParam;
|
||||
import com.engine.salary.sys.entity.param.SalarySysConfQueryParam;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
|
|
@ -96,10 +98,18 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
}
|
||||
|
||||
public SalarySysConfPO detail(Long id) {
|
||||
return getSalarySysConfService(user).getById(id);
|
||||
return getSalarySysConfService(user).getById(id);
|
||||
}
|
||||
|
||||
public void updateByCode(SalarySysConfPO salarySysConfPO) {
|
||||
getSalarySysConfService(user).updateByCode(salarySysConfPO);
|
||||
}
|
||||
|
||||
public void updateOrderRule(OrderRuleParam param) {
|
||||
getSalarySysConfService(user).updateOrderRule(param);
|
||||
}
|
||||
|
||||
public OrderRuleVO orderRule() {
|
||||
return getSalarySysConfService(user).orderRule();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue