This commit is contained in:
parent
5b0374ca42
commit
f8d68fa7bc
|
|
@ -1,10 +1,14 @@
|
|||
package com.engine.salary.biz;
|
||||
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.mapper.salaryitem.SalaryItemMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class SalaryItemBiz {
|
||||
|
|
@ -32,4 +36,72 @@ public class SalaryItemBiz {
|
|||
public List<SalaryItemPO> listSome(SalaryItemPO build) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void batchSave(Collection<SalaryItemPO> salaryItems) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
mapper.batchInsert(salaryItems);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void insert(SalaryItemPO salaryItemPO) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
mapper.insertIgnoreNull(salaryItemPO);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateById(SalaryItemPO newSalaryItemPO) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
mapper.updateIgnoreNull(newSalaryItemPO);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteByIds(Collection<Long> ids) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
mapper.deleteByIds(ids);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public PageInfo<SalaryItemPO> listPageByParam(SalaryItemSearchParam searchParam) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
// PageUtil.start(searchParam.getPageNum(), searchParam.getPageSize());
|
||||
return PageHelper.startPage(searchParam.getPageNum(), searchParam.getPageSize()).doSelectPageInfo(mapper::listAll);
|
||||
// List<SalaryItemPO> salaryItemPOS = mapper.listAll();
|
||||
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<SalaryItemPO> listByParam(SalaryItemSearchParam searchParam) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
|
||||
return mapper.listByParam(searchParam);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.engine.salary.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseQueryParam {
|
||||
|
||||
private Integer pageNum = 1;
|
||||
|
||||
private Integer pageSize = 10;
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
package com.engine.salary.component;
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.binding.MapperMethod;
|
||||
import org.apache.ibatis.executor.parameter.ParameterHandler;
|
||||
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
|
||||
import org.apache.ibatis.executor.statement.StatementHandler;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.ParameterMapping;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.apache.ibatis.scripting.defaults.DefaultParameterHandler;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import javax.xml.bind.PropertyException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
@Intercepts({@Signature(method = "prepare", type = StatementHandler.class, args = {Connection.class,Integer.class})})
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class PageInterceptor implements Interceptor {
|
||||
private static String databaseType = "";// 数据库类型,不同的数据库有不同的分页方法
|
||||
|
||||
/**
|
||||
* 拦截后要执行的方法
|
||||
*/
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
|
||||
RoutingStatementHandler handler = (RoutingStatementHandler) invocation
|
||||
.getTarget();
|
||||
StatementHandler delegate = (StatementHandler) ReflectUtil.getFieldValue(handler, "delegate");
|
||||
BoundSql boundSql = delegate.getBoundSql();
|
||||
Object params = boundSql.getParameterObject();
|
||||
Page page = null;
|
||||
if (params instanceof Page) {
|
||||
page = (Page) params;
|
||||
} else if (params instanceof MapperMethod.ParamMap) {
|
||||
MapperMethod.ParamMap paramMap = (MapperMethod.ParamMap) params;
|
||||
for (Object key : paramMap.keySet()) {
|
||||
if (paramMap.get(key) instanceof Page) {
|
||||
page = (Page) paramMap.get(key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (page != null) {
|
||||
MappedStatement mappedStatement = (MappedStatement) ReflectUtil
|
||||
.getFieldValue(delegate, "mappedStatement");
|
||||
Connection connection = (Connection) invocation.getArgs()[0];
|
||||
String sql = boundSql.getSql();
|
||||
this.setTotalRecord(page, (MapperMethod.ParamMap) params,
|
||||
mappedStatement, connection);
|
||||
String pageSql = this.getPageSql(page, sql);
|
||||
ReflectUtil.setFieldValue(boundSql, "sql", pageSql);
|
||||
}
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 拦截器对应的封装原始对象的方法
|
||||
*/
|
||||
public Object plugin(Object target) {
|
||||
return Plugin.wrap(target, this);
|
||||
}
|
||||
|
||||
public void setProperties(Properties p) {
|
||||
databaseType = p.getProperty("databaseType");
|
||||
if (StringUtils.isEmpty(databaseType)) {
|
||||
try {
|
||||
throw new PropertyException("databaseType is not found!");
|
||||
} catch (PropertyException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getPageSql(Page<?> page, String sql) {
|
||||
StringBuffer sqlBuffer = new StringBuffer(sql);
|
||||
RecordSet recordSet = new RecordSet();
|
||||
|
||||
String dbType = recordSet.getDBType();
|
||||
if ("mysql".equalsIgnoreCase(dbType)) {
|
||||
return getMysqlPageSql(page, sqlBuffer);
|
||||
} else if ("oracle".equalsIgnoreCase(dbType)) {
|
||||
return getOraclePageSql(page, sqlBuffer);
|
||||
} else if ("sqlserver".equalsIgnoreCase(dbType)) {
|
||||
return getSqlserverPageSql(page, sqlBuffer);
|
||||
}
|
||||
return sqlBuffer.toString();
|
||||
}
|
||||
|
||||
private String getSqlserverPageSql(Page<?> page, StringBuffer sqlBuffer) {
|
||||
// 计算第一条记录的位置,Sqlserver中记录的位置是从0开始的。
|
||||
int startRowNum = (page.getPageNum() - 1) * page.getPageSize() + 1;
|
||||
int endRowNum = startRowNum + page.getPageSize();
|
||||
String sql = "select appendRowNum.row,* from (select ROW_NUMBER() OVER (order by (select 0)) AS row,* from ("
|
||||
+ sqlBuffer.toString()
|
||||
+ ") as innerTable"
|
||||
+ ")as appendRowNum where appendRowNum.row >= "
|
||||
+ startRowNum
|
||||
+ " AND appendRowNum.row <= " + endRowNum;
|
||||
return sql;
|
||||
}
|
||||
|
||||
private String getMysqlPageSql(Page<?> page, StringBuffer sqlBuffer) {
|
||||
// 计算第一条记录的位置,Mysql中记录的位置是从0开始的。
|
||||
int offset = (page.getPageNum() - 1) * page.getPageSize();
|
||||
sqlBuffer.append(" limit ").append(offset).append(",").append(page.getPageSize());
|
||||
return sqlBuffer.toString();
|
||||
}
|
||||
|
||||
private String getOraclePageSql(Page<?> page, StringBuffer sqlBuffer) {
|
||||
// 计算第一条记录的位置,Oracle分页是通过rownum进行的,而rownum是从1开始的
|
||||
int offset = (page.getPageNum() - 1) * page.getPageSize() + 1;
|
||||
sqlBuffer.insert(0, "select u.*, rownum r from (").append(") u where rownum < ")
|
||||
.append(offset + page.getPageSize());
|
||||
sqlBuffer.insert(0, "select * from (").append(") where r >= ").append(offset);
|
||||
return sqlBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 给当前的参数对象page设置总记录数
|
||||
*
|
||||
* @param page Mapper映射语句对应的参数对象
|
||||
* @param mappedStatement Mapper映射语句
|
||||
* @param connection
|
||||
*/
|
||||
private void setTotalRecord(Page<?> page, MapperMethod.ParamMap params,
|
||||
MappedStatement mappedStatement, Connection connection) {
|
||||
BoundSql boundSql = mappedStatement.getBoundSql(params);
|
||||
String sql = boundSql.getSql();
|
||||
String countSql = this.getCountSql(sql);
|
||||
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
|
||||
BoundSql countBoundSql = new BoundSql(mappedStatement.getConfiguration(), countSql, parameterMappings, params);
|
||||
ParameterHandler parameterHandler = new DefaultParameterHandler(
|
||||
mappedStatement, params, countBoundSql);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = connection.prepareStatement(countSql);
|
||||
parameterHandler.setParameters(pstmt);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
int totalRecord = rs.getInt(1);
|
||||
// page.setTotalRecord(totalRecord);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) rs.close();
|
||||
if (pstmt != null) pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据原Sql语句获取对应的查询总记录数的Sql语句
|
||||
*
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
private String getCountSql(String sql) {
|
||||
return "select count(*) from (" + sql + ") as countRecord";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
package com.engine.salary.component;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
||||
/**
|
||||
* 利用反射进行操作的一个工具类
|
||||
*/
|
||||
public class ReflectUtil {
|
||||
/**
|
||||
* 利用反射获取指定对象的指定属性
|
||||
*
|
||||
* @param obj
|
||||
* 目标对象
|
||||
* @param fieldName
|
||||
* 目标属性
|
||||
* @return 目标属性的值
|
||||
*/
|
||||
public static Object getFieldValue(Object obj, String fieldName) {
|
||||
Object result = null;
|
||||
Field field = ReflectUtil.getField(obj, fieldName);
|
||||
if (field != null) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
result = field.get(obj);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 利用反射获取指定对象里面的指定属性
|
||||
*
|
||||
* @param obj
|
||||
* 目标对象
|
||||
* @param fieldName
|
||||
* 目标属性
|
||||
* @return 目标字段
|
||||
*/
|
||||
private static Field getField(Object obj, String fieldName) {
|
||||
Field field = null;
|
||||
for (Class<?> clazz = obj.getClass(); clazz != Object.class; clazz = clazz
|
||||
.getSuperclass()) {
|
||||
try {
|
||||
field = clazz.getDeclaredField(fieldName);
|
||||
break;
|
||||
} catch (NoSuchFieldException e) {
|
||||
// 这里不用做处理,子类没有该字段可能对应的父类有,都没有就返回null。
|
||||
}
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
/**
|
||||
* 利用反射设置指定对象的指定属性为指定的值
|
||||
*
|
||||
* @param obj
|
||||
* 目标对象
|
||||
* @param fieldName
|
||||
* 目标属性
|
||||
* @param fieldValue
|
||||
* 目标值
|
||||
*/
|
||||
public static void setFieldValue(Object obj, String fieldName,
|
||||
String fieldValue) {
|
||||
Field field = ReflectUtil.getField(obj, fieldName);
|
||||
if (field != null) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
field.set(obj, fieldValue);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 两者属性名一致时,拷贝source里的属性到dest里
|
||||
*
|
||||
* @return void
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IllegalAccessException
|
||||
* @throws InvocationTargetException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void copyPorperties(Object dest, Object source) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException{
|
||||
Class srcCla = source.getClass();
|
||||
Field[] fsF = srcCla.getDeclaredFields();
|
||||
|
||||
for (Field s : fsF)
|
||||
{
|
||||
String name = s.getName();
|
||||
Object srcObj = invokeGetterMethod(source, name);
|
||||
try
|
||||
{
|
||||
BeanUtils.setProperty(dest, name, srcObj);
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用Getter方法.
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public static Object invokeGetterMethod(Object target, String propertyName) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
|
||||
{
|
||||
String getterMethodName = "get" + StringUtils.capitalize(propertyName);
|
||||
return invokeMethod(target, getterMethodName, new Class[] {},
|
||||
new Object[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接调用对象方法, 无视private/protected修饰符.
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public static Object invokeMethod(final Object object,
|
||||
final String methodName, final Class<?>[] parameterTypes,
|
||||
final Object[] parameters) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException{
|
||||
Method method = getDeclaredMethod(object, methodName, parameterTypes);
|
||||
if (method == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Could not find method ["
|
||||
+ methodName + "] parameterType " + parameterTypes
|
||||
+ " on target [" + object + "]");
|
||||
}
|
||||
|
||||
method.setAccessible(true);
|
||||
return method.invoke(object, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* 循环向上转型, 获取对象的DeclaredMethod.
|
||||
*
|
||||
* 如向上转型到Object仍无法找到, 返回null.
|
||||
*/
|
||||
protected static Method getDeclaredMethod(Object object, String methodName,
|
||||
Class<?>[] parameterTypes)
|
||||
{
|
||||
Assert.notNull(object, "object不能为空");
|
||||
|
||||
for (Class<?> superClass = object.getClass(); superClass != Object.class; superClass = superClass
|
||||
.getSuperclass())
|
||||
{
|
||||
try{
|
||||
return superClass.getDeclaredMethod(methodName, parameterTypes);
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{// NOSONAR
|
||||
// Method不在当前类定义,继续向上转型
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.engine.salary.component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WeaFormOption implements Serializable {
|
||||
private static final long serialVersionUID = -4539753893868901626L;
|
||||
private String id;
|
||||
private String content;
|
||||
private boolean disabled;
|
||||
|
||||
public WeaFormOption() {
|
||||
this.disabled = Boolean.FALSE;
|
||||
}
|
||||
|
||||
public WeaFormOption(String id, String content) {
|
||||
this.disabled = Boolean.FALSE;
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return this.disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,8 +25,9 @@ public class DemoController {
|
|||
|
||||
@GET
|
||||
@Path("/list")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
new BaseBean().writeLog("page in ...");
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ResponseResult.run(getService(user)::list, ParamUtil.request2Map(request));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import com.engine.common.entity.BizLogContext;
|
|||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.salary.mapper.DemoMapper;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -32,10 +33,13 @@ public class DemoPageCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
DemoMapper mapper = sqlSession.getMapper(DemoMapper.class);
|
||||
PageUtil.start(2, 10);
|
||||
List<DemoPo> page = mapper.page();
|
||||
PageInfo<DemoPo> pageInfo = new PageInfo<>(page, DemoPo.class);
|
||||
// PageHelper.startPage(1,5);
|
||||
com.github.pagehelper.PageInfo<DemoPo> objectPageInfo = PageHelper.startPage(1, 1).doSelectPageInfo(mapper::page);
|
||||
List<DemoPo> list = objectPageInfo.getList();
|
||||
PageInfo<DemoPo> pageInfo = new PageInfo<>(list, DemoPo.class);
|
||||
apidatas.put("pageInfo", pageInfo);
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +1,34 @@
|
|||
//package com.engine.salary.entity.salaryitem.bo;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
//import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
//import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
//import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
//import com.engine.salary.enums.SalaryDataSourceEnum;
|
||||
//import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
//import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
//import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
//import com.weaver.excel.formula.api.entity.ExpressFormula;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
//import com.weaver.hrm.salary.enums.*;
|
||||
//import com.weaver.hrm.salary.util.SalaryEntityUtil;
|
||||
//import com.weaver.hrm.salary.util.SalaryI18nUtil;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.apache.commons.lang3.math.NumberUtils;
|
||||
//
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @description: 薪资项目
|
||||
// * @author: xiajun
|
||||
// * @modified By: xiajun
|
||||
// * @date: Created in 10/28/21 4:55 PM
|
||||
// * @version:v1.0
|
||||
// */
|
||||
//public class SalaryItemBO {
|
||||
//
|
||||
// /**
|
||||
// * 构建薪资项目的查询参数
|
||||
// *
|
||||
// * @param searchParam
|
||||
// * @param tenantKey
|
||||
// * @return
|
||||
// */
|
||||
package com.engine.salary.entity.salaryitem.bo;
|
||||
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalaryDataSourceEnum;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @description: 薪资项目
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 10/28/21 4:55 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
public class SalaryItemBO {
|
||||
|
||||
/**
|
||||
* 构建薪资项目的查询参数
|
||||
*
|
||||
* @param searchParam
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
// public static Wrapper<SalaryItemPO> buildQueryWrapper(SalaryItemSearchParam searchParam, String tenantKey) {
|
||||
// LambdaQueryWrapper<SalaryItemPO> wrapper = Wrappers.<SalaryItemPO>lambdaQuery();
|
||||
// wrapper.eq(SalaryItemPO::getTenantKey, tenantKey)
|
||||
|
|
@ -66,14 +54,14 @@
|
|||
// wrapper.orderByDesc(SalaryItemPO::getId);
|
||||
// return wrapper;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 薪资项目po转换成薪资项目列表dto
|
||||
// *
|
||||
// * @param salaryItems 薪资项目po
|
||||
// * @param expressFormulas 公式详情
|
||||
// * @return
|
||||
// */
|
||||
|
||||
/**
|
||||
* 薪资项目po转换成薪资项目列表dto
|
||||
*
|
||||
* @param salaryItems 薪资项目po
|
||||
* @param expressFormulas 公式详情
|
||||
* @return
|
||||
*/
|
||||
// public static List<SalaryItemListDTO> convert2ListDTO(Collection<SalaryItemPO> salaryItems, List<ExpressFormula> expressFormulas) {
|
||||
// if (CollectionUtils.isEmpty(salaryItems)) {
|
||||
// return Collections.emptyList();
|
||||
|
|
@ -120,7 +108,7 @@
|
|||
// }
|
||||
// ).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
|
||||
// /**
|
||||
// * 转换成薪资项目详情dto
|
||||
// *
|
||||
|
|
@ -143,48 +131,47 @@
|
|||
// .setDescription(salaryItemPO.getDescription())
|
||||
// .setCanEdit(salaryItemPO.getCanEdit());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 保存参数/更新参数 转换成薪资项目po
|
||||
// *
|
||||
// * @param saveParam 保存参数/更新参数
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public static SalaryItemPO convert2SalaryItemPO(SalaryItemSaveParam saveParam, Long employeeId) {
|
||||
// Date now = new Date();
|
||||
//// long id = IdGenerator.generate();
|
||||
// SalaryItemPO salaryItemPO = SalaryItemPO.builder()
|
||||
//// .id(id)
|
||||
//// .code(String.valueOf(id))
|
||||
// .name(saveParam.getName())
|
||||
// .systemType(SalarySystemTypeEnum.CUSTOM.getValue())
|
||||
// .sysSalaryItemId(NumberUtils.LONG_ZERO)
|
||||
// .category(saveParam.getCategory().getValue())
|
||||
// .itemType(saveParam.getItemType().getValue())
|
||||
// .useDefault(saveParam.getUseDefault())
|
||||
// .useInEmployeeSalary(saveParam.getUseInEmployeeSalary())
|
||||
// .roundingMode(Optional.ofNullable(saveParam.getRoundingMode()).map(SalaryRoundingModeEnum::getValue).orElse(SalaryRoundingModeEnum.ROUNDING.getValue()))
|
||||
// .pattern(Optional.ofNullable(saveParam.getPattern()).orElse(2))
|
||||
// .valueType(saveParam.getValueType().getValue())
|
||||
// .datasource(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? SalaryDataSourceEnum.INPUT_IMPORT.getValue() : SalaryDataSourceEnum.CUSTOM_FORMULA.getValue())
|
||||
// .formulaId(saveParam.getValueType() == SalaryValueTypeEnum.FORMULA ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
|
||||
// .description(saveParam.getDescription())
|
||||
// .canEdit(NumberUtils.INTEGER_ONE)
|
||||
// .canDelete(NumberUtils.INTEGER_ONE)
|
||||
// .creator(employeeId)
|
||||
// .deleteType(NumberUtils.INTEGER_ZERO)
|
||||
// .createTime(now)
|
||||
// .updateTime(now)
|
||||
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
// .build();
|
||||
// // 开启了"薪资档案引用",取值方式固定为输入,数据来源固定为薪资档案
|
||||
// if (Objects.equals(saveParam.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {
|
||||
// salaryItemPO.setValueType(SalaryValueTypeEnum.INPUT.getValue());
|
||||
// salaryItemPO.setDatasource(SalaryDataSourceEnum.SALARY_ARCHIVES.getValue());
|
||||
// salaryItemPO.setFormulaId(NumberUtils.LONG_ZERO);
|
||||
// }
|
||||
// return salaryItemPO;
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 保存参数/更新参数 转换成薪资项目po
|
||||
*
|
||||
* @param saveParam 保存参数/更新参数
|
||||
* @param employeeId 人员id
|
||||
* @return
|
||||
*/
|
||||
public static SalaryItemPO convert2SalaryItemPO(SalaryItemSaveParam saveParam, Long employeeId) {
|
||||
Date now = new Date();
|
||||
// long id = IdGenerator.generate();
|
||||
SalaryItemPO salaryItemPO = SalaryItemPO.builder()
|
||||
// .id(id)
|
||||
// .code(String.valueOf(id))
|
||||
.name(saveParam.getName())
|
||||
.systemType(SalarySystemTypeEnum.CUSTOM.getValue())
|
||||
.sysSalaryItemId(NumberUtils.LONG_ZERO)
|
||||
.category(saveParam.getCategory().getValue())
|
||||
.itemType(saveParam.getItemType().getValue())
|
||||
.useDefault(saveParam.getUseDefault())
|
||||
.useInEmployeeSalary(saveParam.getUseInEmployeeSalary())
|
||||
.roundingMode(Optional.ofNullable(saveParam.getRoundingMode()).map(SalaryRoundingModeEnum::getValue).orElse(SalaryRoundingModeEnum.ROUNDING.getValue()))
|
||||
.pattern(Optional.ofNullable(saveParam.getPattern()).orElse(2))
|
||||
.valueType(saveParam.getValueType().getValue())
|
||||
.datasource(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? SalaryDataSourceEnum.INPUT_IMPORT.getValue() : SalaryDataSourceEnum.CUSTOM_FORMULA.getValue())
|
||||
.formulaId(saveParam.getValueType() == SalaryValueTypeEnum.FORMULA ? Optional.ofNullable(saveParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO) : NumberUtils.LONG_ZERO)
|
||||
.description(saveParam.getDescription())
|
||||
.canEdit(NumberUtils.INTEGER_ONE)
|
||||
.canDelete(NumberUtils.INTEGER_ONE)
|
||||
.creator(employeeId)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
// 开启了"薪资档案引用",取值方式固定为输入,数据来源固定为薪资档案
|
||||
if (Objects.equals(saveParam.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {
|
||||
salaryItemPO.setValueType(SalaryValueTypeEnum.INPUT.getValue());
|
||||
salaryItemPO.setDatasource(SalaryDataSourceEnum.SALARY_ARCHIVES.getValue());
|
||||
salaryItemPO.setFormulaId(NumberUtils.LONG_ZERO);
|
||||
}
|
||||
return salaryItemPO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,27 @@
|
|||
//package com.engine.salary.entity.salaryitem.bo;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
//import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
//import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
//import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
//import com.engine.salary.enums.SalaryItemCategoryEnum;
|
||||
//import com.engine.salary.enums.SalaryItemTypeEnum;
|
||||
//import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
//import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
//import com.weaver.hrm.salary.constant.SalaryDefaultTenantConstant;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
|
||||
//import com.weaver.hrm.salary.enums.*;
|
||||
//import com.weaver.hrm.salary.util.SalaryEntityUtil;
|
||||
//import com.weaver.hrm.salary.util.SalaryI18nUtil;
|
||||
//import org.apache.commons.collections4.CollectionUtils;
|
||||
//import org.apache.commons.lang3.StringUtils;
|
||||
//import org.apache.commons.lang3.math.NumberUtils;
|
||||
//
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @description: 系统薪资项目
|
||||
// * @author: xiajun
|
||||
// * @modified By: xiajun
|
||||
// * @date: Created in 11/2/21 1:30 PM
|
||||
// * @version:v1.0
|
||||
// */
|
||||
//public class SysSalaryItemBO {
|
||||
//
|
||||
package com.engine.salary.entity.salaryitem.bo;
|
||||
|
||||
import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
import com.engine.salary.enums.*;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description: 系统薪资项目
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 11/2/21 1:30 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
public class SysSalaryItemBO {
|
||||
|
||||
// /**
|
||||
// * 查询参数构建queryWrapper
|
||||
// *
|
||||
|
|
@ -54,43 +43,43 @@
|
|||
// wrapper.orderByDesc(SysSalaryItemPO::getId);
|
||||
// return wrapper;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 系统薪资项目po转换成系统薪资项目列表dto
|
||||
// *
|
||||
// * @param sysSalaryItems 系统薪资项目集合
|
||||
// * @return
|
||||
// */
|
||||
// public static List<SysSalaryItemListDTO> convert2ListDTO(Collection<SysSalaryItemPO> sysSalaryItems) {
|
||||
// if (CollectionUtils.isEmpty(sysSalaryItems)) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// return sysSalaryItems.stream().map(sysSalaryItemPO -> {
|
||||
// SalaryItemCategoryEnum salaryItemCategoryEnum = SalaryItemCategoryEnum.parseByValue(sysSalaryItemPO.getCategory());
|
||||
// SalaryItemTypeEnum salaryItemTypeEnum = SalaryItemTypeEnum.parseByValue(sysSalaryItemPO.getItemType());
|
||||
// SalaryRoundingModeEnum salaryRoundingModeEnum = SalaryRoundingModeEnum.parseByValue(sysSalaryItemPO.getRoundingMode());
|
||||
// SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(sysSalaryItemPO.getValueType());
|
||||
// return SysSalaryItemListDTO.builder()
|
||||
// .id(sysSalaryItemPO.getId())
|
||||
// .name(sysSalaryItemPO.getName())
|
||||
// .category(Optional.ofNullable(salaryItemCategoryEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .itemType(Optional.ofNullable(salaryItemTypeEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .roundingMode(Optional.ofNullable(salaryRoundingModeEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .pattern(sysSalaryItemPO.getPattern())
|
||||
// .valueType(Optional.ofNullable(salaryValueTypeEnum)
|
||||
// .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
// .orElse(StringUtils.EMPTY))
|
||||
// .build();
|
||||
// }
|
||||
// ).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* 系统薪资项目po转换成系统薪资项目列表dto
|
||||
*
|
||||
* @param sysSalaryItems 系统薪资项目集合
|
||||
* @return
|
||||
*/
|
||||
public static List<SysSalaryItemListDTO> convert2ListDTO(Collection<SysSalaryItemPO> sysSalaryItems) {
|
||||
if (CollectionUtils.isEmpty(sysSalaryItems)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return sysSalaryItems.stream().map(sysSalaryItemPO -> {
|
||||
SalaryItemCategoryEnum salaryItemCategoryEnum = SalaryItemCategoryEnum.parseByValue(sysSalaryItemPO.getCategory());
|
||||
SalaryItemTypeEnum salaryItemTypeEnum = SalaryItemTypeEnum.parseByValue(sysSalaryItemPO.getItemType());
|
||||
SalaryRoundingModeEnum salaryRoundingModeEnum = SalaryRoundingModeEnum.parseByValue(sysSalaryItemPO.getRoundingMode());
|
||||
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(sysSalaryItemPO.getValueType());
|
||||
return SysSalaryItemListDTO.builder()
|
||||
.id(sysSalaryItemPO.getId())
|
||||
.name(sysSalaryItemPO.getName())
|
||||
.category(Optional.ofNullable(salaryItemCategoryEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.itemType(Optional.ofNullable(salaryItemTypeEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.roundingMode(Optional.ofNullable(salaryRoundingModeEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.pattern(sysSalaryItemPO.getPattern())
|
||||
.valueType(Optional.ofNullable(salaryValueTypeEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.build();
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 转换成薪资项目详情dto
|
||||
// *
|
||||
|
|
@ -113,62 +102,63 @@
|
|||
// .setFormulaId(sysSalaryItemPO.getFormulaId())
|
||||
// .setDescription(sysSalaryItemPO.getDescription());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 系统薪资项目转换成自定义薪资项目
|
||||
// *
|
||||
// * @param sysSalaryItems 系统薪资项目集合
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public static List<SalaryItemPO> convert2SalaryItemPO(Collection<SysSalaryItemPO> sysSalaryItems, Long employeeId, String tenantKey) {
|
||||
// if (CollectionUtils.isEmpty(sysSalaryItems)) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// return sysSalaryItems.stream()
|
||||
// .map(e -> convert2SalaryItemPO(e, now, employeeId, tenantKey))
|
||||
// .filter(Objects::nonNull)
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 系统薪资项目转换成自定义薪资项目
|
||||
// *
|
||||
// * @param sysSalaryItemPO 系统薪资项目
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// private static SalaryItemPO convert2SalaryItemPO(SysSalaryItemPO sysSalaryItemPO, LocalDateTime now, Long employeeId, String tenantKey) {
|
||||
// if (sysSalaryItemPO == null) {
|
||||
// return null;
|
||||
// }
|
||||
//// long id = IdGenerator.generate();
|
||||
// return SalaryItemPO.builder()
|
||||
//// .id(id)
|
||||
// .code(sysSalaryItemPO.getCode())
|
||||
// .name(sysSalaryItemPO.getName())
|
||||
// .systemType(SalarySystemTypeEnum.SYSTEM.getValue())
|
||||
// .sysSalaryItemId(sysSalaryItemPO.getId())
|
||||
// .category(sysSalaryItemPO.getCategory())
|
||||
// .itemType(sysSalaryItemPO.getItemType())
|
||||
// .useDefault(sysSalaryItemPO.getUseDefault())
|
||||
// .useInEmployeeSalary(sysSalaryItemPO.getUseInEmployeeSalary())
|
||||
// .roundingMode(sysSalaryItemPO.getRoundingMode())
|
||||
// .pattern(sysSalaryItemPO.getPattern())
|
||||
// .valueType(sysSalaryItemPO.getValueType())
|
||||
// .datasource(sysSalaryItemPO.getDatasource())
|
||||
// .formulaId(sysSalaryItemPO.getFormulaId())
|
||||
// .description(sysSalaryItemPO.getDescription())
|
||||
// .canEdit(sysSalaryItemPO.getCanEdit())
|
||||
// .canDelete(sysSalaryItemPO.getCanDelete())
|
||||
// .creator(employeeId)
|
||||
// .deleteType(NumberUtils.INTEGER_ZERO)
|
||||
// .createTime(now)
|
||||
// .updateTime(now)
|
||||
// .tenantKey(tenantKey)
|
||||
// .build();
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 系统薪资项目转换成自定义薪资项目
|
||||
*
|
||||
* @param sysSalaryItems 系统薪资项目集合
|
||||
* @param employeeId 人员id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
public static List<SalaryItemPO> convert2SalaryItemPO(Collection<SysSalaryItemPO> sysSalaryItems, Long employeeId, String tenantKey) {
|
||||
if (CollectionUtils.isEmpty(sysSalaryItems)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return sysSalaryItems.stream()
|
||||
.map(e -> convert2SalaryItemPO(e, employeeId, tenantKey))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统薪资项目转换成自定义薪资项目
|
||||
*
|
||||
* @param sysSalaryItemPO 系统薪资项目
|
||||
* @param employeeId 人员id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
private static SalaryItemPO convert2SalaryItemPO(SysSalaryItemPO sysSalaryItemPO, Long employeeId, String tenantKey) {
|
||||
if (sysSalaryItemPO == null) {
|
||||
return null;
|
||||
}
|
||||
Date now = new Date();
|
||||
// long id = IdGenerator.generate();
|
||||
return SalaryItemPO.builder()
|
||||
// .id(id)
|
||||
.code(sysSalaryItemPO.getCode())
|
||||
.name(sysSalaryItemPO.getName())
|
||||
.systemType(SalarySystemTypeEnum.SYSTEM.getValue())
|
||||
.sysSalaryItemId(sysSalaryItemPO.getId())
|
||||
.category(sysSalaryItemPO.getCategory())
|
||||
.itemType(sysSalaryItemPO.getItemType())
|
||||
.useDefault(sysSalaryItemPO.getUseDefault())
|
||||
.useInEmployeeSalary(sysSalaryItemPO.getUseInEmployeeSalary())
|
||||
.roundingMode(sysSalaryItemPO.getRoundingMode())
|
||||
.pattern(sysSalaryItemPO.getPattern())
|
||||
.valueType(sysSalaryItemPO.getValueType())
|
||||
.datasource(sysSalaryItemPO.getDatasource())
|
||||
.formulaId(sysSalaryItemPO.getFormulaId())
|
||||
.description(sysSalaryItemPO.getDescription())
|
||||
.canEdit(sysSalaryItemPO.getCanEdit())
|
||||
.canDelete(sysSalaryItemPO.getCanDelete())
|
||||
.creator(employeeId)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(tenantKey)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.engine.salary.entity.salaryitem.param;
|
||||
|
||||
import com.engine.salary.enums.SalaryItemCategoryEnum;
|
||||
import com.engine.salary.enums.SalaryItemTypeEnum;
|
||||
import com.engine.salary.enums.SalaryOnOffEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -12,39 +9,40 @@ import lombok.NoArgsConstructor;
|
|||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @description: 薪资项目查询参数
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 12/20/21 4:42 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
* 薪资项目查询参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryItemSearchParam {
|
||||
public class SalaryItemSearchParam extends BaseQueryParam {
|
||||
|
||||
//名称")
|
||||
//名称@see
|
||||
private String name;
|
||||
|
||||
//备注")
|
||||
//备注@see
|
||||
private String description;
|
||||
|
||||
//属性")
|
||||
private SalaryItemCategoryEnum category;
|
||||
//属性 SalaryItemCategoryEnum
|
||||
private Integer category;
|
||||
|
||||
//分类")
|
||||
private SalaryItemTypeEnum itemType;
|
||||
//分类 @see SalaryItemTypeEnum
|
||||
private Integer itemType;
|
||||
|
||||
//是否薪资档案引用")
|
||||
private SalaryOnOffEnum useInEmployeeSalary;
|
||||
//是否薪资档案引用@see SalaryOnOffEnum
|
||||
private Integer useInEmployeeSalary;
|
||||
|
||||
//是否默认使用")
|
||||
private SalaryOnOffEnum useDefault;
|
||||
//是否默认使用@see SalaryOnOffEnum
|
||||
private Integer useDefault;
|
||||
|
||||
//取值方式")
|
||||
private SalaryValueTypeEnum valueType;
|
||||
//取值方式@seeSalaryValueTypeEnum
|
||||
private Integer valueType;
|
||||
|
||||
//需要排除的系统薪资项目")
|
||||
//需要排除的系统薪资项目@see
|
||||
private Collection<Long> excludeIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
package com.engine.salary.entity.salarysob.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description: 薪资账套薪资项目
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 11/9/21 10:50 AM
|
||||
* @version:v1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//hrsa_salary_sob_item
|
||||
public class SalarySobItemPO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 薪资账套的id
|
||||
*/
|
||||
private Long salarySobId;
|
||||
|
||||
/**
|
||||
* 薪资项目的id
|
||||
*/
|
||||
private Long salaryItemId;
|
||||
|
||||
/**
|
||||
* 薪资账套薪资项目分组id
|
||||
*/
|
||||
private Long salarySobItemGroupId;
|
||||
|
||||
/**
|
||||
* 公式
|
||||
*/
|
||||
private Long formulaId;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Integer sortedIndex;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 租户key
|
||||
*/
|
||||
private String tenantKey;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -8,6 +8,9 @@ alter table hrsa_other_deduction modify id bigint auto_increment;
|
|||
alter table hrsa_attend_quote_field modify id bigint auto_increment;
|
||||
alter table hrsa_attend_quote_sync_set modify id bigint auto_increment;
|
||||
|
||||
alter table hrsa_salary_item modify id bigint auto_increment;
|
||||
|
||||
|
||||
--福利方案主键自增增加
|
||||
alter table hrsa_social_security_scheme modify id bigint auto_increment;
|
||||
alter table hrsa_scheme_detail modify id bigint auto_increment;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.mapper.salaryitem;
|
||||
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -59,5 +60,6 @@ public interface SalaryItemMapper {
|
|||
void batchInsert(Collection<SalaryItemPO> salaryItems);
|
||||
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
|
||||
List<SalaryItemPO> listByParam(@Param("param") SalaryItemSearchParam param);
|
||||
}
|
||||
|
|
@ -347,7 +347,7 @@
|
|||
update_time, creator, delete_type, tenant_key)
|
||||
|
||||
<foreach collection="collection" item="item" separator="union all">
|
||||
select #{item.name}, #{item.code}, #{item.systemType}, #{item.sysSalaryItemId},
|
||||
select #{item.name}, #{item.code}, #{item.systemType}, #{item.sysSalaryItemId},
|
||||
#{item.category},
|
||||
#{item.itemType}, #{item.useDefault}, #{item.useInEmployeeSalary}, #{item.roundingMode},
|
||||
#{item.pattern},
|
||||
|
|
@ -381,5 +381,103 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="listByParam" resultType="com.engine.salary.entity.salaryitem.po.SalaryItemPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
hrsa_salary_item t
|
||||
WHERE
|
||||
delete_type = 0
|
||||
<include refid="paramSql"/>
|
||||
</select>
|
||||
|
||||
<sql id="paramSql">
|
||||
<if test="param.name != null and param.name != ''">
|
||||
AND name like CONCAT('%',#{param.name},'%')
|
||||
</if>
|
||||
<if test="param.description != null and param.description != ''">
|
||||
AND description like CONCAT('%',#{param.description},'%')
|
||||
</if>
|
||||
<if test="param.excludeIds != null and param.excludeIds.size()>0">
|
||||
AND id NOT IN
|
||||
<foreach collection="param.excludeIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.category != null">
|
||||
AND category = #{param.category}
|
||||
</if>
|
||||
<if test="param.itemType != null">
|
||||
AND item_type = #{param.itemType}
|
||||
</if>
|
||||
<if test="param.useInEmployeeSalary != null">
|
||||
AND use_in_employee_salary = #{param.useInEmployeeSalary}
|
||||
</if>
|
||||
<if test="param.useDefault != null">
|
||||
AND use_default = #{param.useDefault}
|
||||
</if>
|
||||
<if test="param.valueType != null">
|
||||
AND value_type = #{param.valueType}
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="paramSql" databaseId="oracle">
|
||||
<if test="param.name != null and param.name != ''">
|
||||
AND name like '%'||#{param.name}||'%'
|
||||
</if>
|
||||
<if test="param.description != null">
|
||||
AND description like '%'||#{param.description}||'%'
|
||||
</if>
|
||||
<if test="param.excludeIds != null and param.excludeIds.size()>0">
|
||||
AND id NOT IN
|
||||
<foreach collection="param.excludeIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.category != null">
|
||||
AND category = #{param.category}
|
||||
</if>
|
||||
<if test="param.itemType != null">
|
||||
AND item_type = #{param.itemType}
|
||||
</if>
|
||||
<if test="param.useInEmployeeSalary != null">
|
||||
AND use_in_employee_salary = #{param.useInEmployeeSalary}
|
||||
</if>
|
||||
<if test="param.useDefault != null">
|
||||
AND use_default = #{param.useDefault}
|
||||
</if>
|
||||
<if test="param.valueType != null">
|
||||
AND value_type = #{param.valueType}
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="paramSql" databaseId="sqlserver">
|
||||
<if test="param.name != null and param.name != ''">
|
||||
AND name like '%'+#{param.name}+'%'
|
||||
</if>
|
||||
<if test="param.description != null and param.description != ''">
|
||||
AND description like '%'+#{param.description}+'%'
|
||||
</if>
|
||||
<if test="param.excludeIds != null and param.excludeIds.size()>0">
|
||||
AND id NOT IN
|
||||
<foreach collection="param.excludeIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.category != null">
|
||||
AND category = #{param.category}
|
||||
</if>
|
||||
<if test="param.itemType != null">
|
||||
AND item_type = #{param.itemType}
|
||||
</if>
|
||||
<if test="param.useInEmployeeSalary != null">
|
||||
AND use_in_employee_salary = #{param.useInEmployeeSalary}
|
||||
</if>
|
||||
<if test="param.useDefault != null">
|
||||
AND use_default = #{param.useDefault}
|
||||
</if>
|
||||
<if test="param.valueType != null">
|
||||
AND value_type = #{param.valueType}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
@ -76,41 +79,38 @@ public interface SalaryItemService {
|
|||
* 根据查询参数获取薪资项目(分页)
|
||||
*
|
||||
* @param searchParam 查询参数
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
// Page<SalaryItemPO> listPageByParam(SalaryItemSearchParam searchParam, String tenantKey);
|
||||
List<SalaryItemPO> listByParam(SalaryItemSearchParam searchParam);
|
||||
|
||||
// /**
|
||||
// * 保存
|
||||
// *
|
||||
// * @param saveParam 保存参数
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// */
|
||||
// void save(SalaryItemSaveParam saveParam, Long employeeId, String tenantKey);
|
||||
//
|
||||
// /**
|
||||
// * 批量保存
|
||||
// *
|
||||
// * @param salaryItemPOS 薪资项目
|
||||
// */
|
||||
// void batchSave(Collection<SalaryItemPO> salaryItemPOS);
|
||||
//
|
||||
// /**
|
||||
// * 更新
|
||||
// *
|
||||
// * @param saveParam 更新参数
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// */
|
||||
// void update(SalaryItemSaveParam saveParam, Long employeeId, String tenantKey);
|
||||
//
|
||||
// /**
|
||||
// * 根据主键id删除薪资项目
|
||||
// *
|
||||
// * @param ids 主键id
|
||||
// * @param tenantKey 租户key
|
||||
// */
|
||||
// void deleteByIds(Collection<Long> ids, String tenantKey);
|
||||
PageInfo<SalaryItemPO> listPageByParam(SalaryItemSearchParam searchParam);
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param saveParam 保存参数
|
||||
*/
|
||||
void save(SalaryItemSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 批量保存
|
||||
*
|
||||
* @param salaryItemPOS 薪资项目
|
||||
*/
|
||||
void batchSave(Collection<SalaryItemPO> salaryItemPOS);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param saveParam 更新参数
|
||||
*/
|
||||
void update(SalaryItemSaveParam saveParam);
|
||||
|
||||
/**
|
||||
* 根据主键id删除薪资项目
|
||||
*
|
||||
* @param ids 主键id
|
||||
*/
|
||||
void deleteByIds(Collection<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: 薪资账套的薪资项目副本
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 1/17/22 7:26 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
public interface SalarySobItemService {
|
||||
|
||||
/**
|
||||
* 查询所有薪资账套的薪资项目副本
|
||||
*
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> list();
|
||||
|
||||
/**
|
||||
* 根据薪资账套id查询薪资账套的薪资项目副本
|
||||
*
|
||||
* @param salarySobId 薪资账套的id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalarySobId(Long salarySobId, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id查询薪资账套的薪资项目副本
|
||||
*
|
||||
* @param salarySobIds 薪资账套的id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id、薪资项目id查询薪资账套的薪资项目副本
|
||||
*
|
||||
* @param salarySobId 薪资账套id
|
||||
* @param salaryItemIds 薪资项目id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalarySobIdAndSalaryItemIdNotIn(Long salarySobId, Collection<Long> salaryItemIds, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资项目id查询薪资账套的薪资项目副本
|
||||
*
|
||||
* @param salaryItemIds 薪资项目的主键id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobItemPO> listBySalaryItemIds(Collection<Long> salaryItemIds, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id查询薪资账套的薪资项目副本所关联的薪资项目
|
||||
*
|
||||
* @param salarySobId 薪资账套id
|
||||
* @param tenantKey 租户key
|
||||
* @return
|
||||
*/
|
||||
// List<SalaryItemPO> listBySalarySobId4SalaryItem(Long salarySobId, String tenantKey);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id获取薪资账套的薪资项目聚合(员工信息、薪资项目副本、薪资项目分类)
|
||||
*
|
||||
* @param salarySobId
|
||||
* @param tenantKey
|
||||
* @return
|
||||
*/
|
||||
// SalarySobItemAggregateDTO getAggregateBySalarySobId(Long salarySobId, String tenantKey);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param saveParam 保存参数
|
||||
* @param employeeId 人员id
|
||||
* @param tenantKey 租户key
|
||||
*/
|
||||
// void save(SalarySobItemSaveParam saveParam, Long employeeId, String tenantKey);
|
||||
|
||||
/**
|
||||
* 批量保存
|
||||
*
|
||||
* @param salarySobItemPOS 薪资账套的薪资项目副本
|
||||
*/
|
||||
void batchSave(Collection<SalarySobItemPO> salarySobItemPOS);
|
||||
|
||||
/**
|
||||
* 根据薪资账套id删除薪资账套的薪资项目副本
|
||||
*
|
||||
* @param salarySobIds 薪资账套的id
|
||||
* @param tenantKey 租户key
|
||||
*/
|
||||
void deleteBySalarySobIds(Collection<Long> salarySobIds, String tenantKey);
|
||||
}
|
||||
|
|
@ -2,14 +2,24 @@ package com.engine.salary.service.impl;
|
|||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.SalaryItemBiz;
|
||||
import com.engine.salary.biz.SysSalaryItemBiz;
|
||||
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
import com.engine.salary.enums.SalaryDataSourceEnum;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 薪资项目
|
||||
|
|
@ -21,22 +31,21 @@ import java.util.List;
|
|||
**/
|
||||
public class SalaryItemServiceImpl extends Service implements SalaryItemService {
|
||||
|
||||
SalaryItemBiz salaryItemMapper;
|
||||
// @Autowired
|
||||
private SalaryItemBiz salaryItemBiz = new SalaryItemBiz();
|
||||
// @Autowired
|
||||
// private SalarySobItemService salarySobItemService;
|
||||
// @Autowired
|
||||
// private SysSalaryItemService sysSalaryItemService;
|
||||
private SysSalaryItemBiz sysSalaryItemBiz = new SysSalaryItemBiz();
|
||||
// @Autowired
|
||||
// private LoggerTemplate salaryItemLoggerTemplate;
|
||||
|
||||
@Override
|
||||
public SalaryItemPO getById(Long id) {
|
||||
return salaryItemMapper.getById(id);
|
||||
return salaryItemBiz.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryItemPO> listAll() {
|
||||
return salaryItemMapper.listAll();
|
||||
return salaryItemBiz.listAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -44,7 +53,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return salaryItemMapper.listSome(SalaryItemPO.builder().ids(ids).build());
|
||||
return salaryItemBiz.listSome(SalaryItemPO.builder().ids(ids).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,22 +61,32 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
if (CollectionUtils.isEmpty(sysSalaryItemIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return salaryItemMapper.listSome(SalaryItemPO.builder().sysSalaryItemIds(sysSalaryItemIds).build());
|
||||
return salaryItemBiz.listSome(SalaryItemPO.builder().sysSalaryItemIds(sysSalaryItemIds).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryItemPO> listByName(String name) {
|
||||
return salaryItemMapper.listSome(SalaryItemPO.builder().name(name).build());
|
||||
return salaryItemBiz.listSome(SalaryItemPO.builder().name(name).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryItemPO> listBySystemType(SalarySystemTypeEnum systemType) {
|
||||
return salaryItemMapper.listSome(SalaryItemPO.builder().systemType(systemType.getValue()).build());
|
||||
return salaryItemBiz.listSome(SalaryItemPO.builder().systemType(systemType.getValue()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryItemPO> listBySystemTypeAndUseDefault(SalarySystemTypeEnum systemType, Integer useDefault) {
|
||||
return salaryItemMapper.listSome(SalaryItemPO.builder().systemType(systemType.getValue()).useDefault(useDefault).build());
|
||||
return salaryItemBiz.listSome(SalaryItemPO.builder().systemType(systemType.getValue()).useDefault(useDefault).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryItemPO> listByParam(SalaryItemSearchParam searchParam) {
|
||||
return salaryItemBiz.listByParam(searchParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<SalaryItemPO> listPageByParam(SalaryItemSearchParam searchParam) {
|
||||
return salaryItemBiz.listPageByParam(searchParam);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
|
@ -77,25 +96,25 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
// // 构建查询参数
|
||||
// Wrapper<SalaryItemPO> queryWrapper = SalaryItemBO.buildQueryWrapper(searchParam, tenantKey);
|
||||
// // 返回查询结果
|
||||
// return salaryItemMapper.selectPage(page, queryWrapper);
|
||||
// return SalaryItemBiz.selectPage(page, queryWrapper);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void save(SalaryItemSaveParam saveParam, Long employeeId) {
|
||||
// // 名称不能和已有的自定义薪资项目重名
|
||||
// List<SalaryItemPO> salaryItemPOS = listByName(saveParam.getName());
|
||||
// if (CollectionUtils.isNotEmpty(salaryItemPOS)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "薪资项目名称已存在,请重新命名"));
|
||||
// }
|
||||
// // 名称不能和已有的系统薪资项目重名
|
||||
// List<SysSalaryItemPO> sysSalaryItemPOS = sysSalaryItemService.listByName(saveParam.getName());
|
||||
// if (CollectionUtils.isNotEmpty(sysSalaryItemPOS)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98328, "自定义薪资项目的名称不能和系统薪资项目的名称重名"));
|
||||
// }
|
||||
// // 保存薪资项目
|
||||
// SalaryItemPO salaryItemPO = SalaryItemBO.convert2SalaryItemPO(saveParam, Long.valueOf(user.getUID()));
|
||||
// salaryItemMapper.insert(salaryItemPO);
|
||||
// // 记录日志
|
||||
@Override
|
||||
public void save(SalaryItemSaveParam saveParam) {
|
||||
// 名称不能和已有的自定义薪资项目重名
|
||||
List<SalaryItemPO> salaryItemPOS = listByName(saveParam.getName());
|
||||
if (CollectionUtils.isNotEmpty(salaryItemPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "薪资项目名称已存在,请重新命名"));
|
||||
}
|
||||
// 名称不能和已有的系统薪资项目重名
|
||||
List<SysSalaryItemPO> sysSalaryItemPOS = sysSalaryItemBiz.listSome(SysSalaryItemPO.builder().name(saveParam.getName()).build());
|
||||
if (CollectionUtils.isNotEmpty(sysSalaryItemPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98328, "自定义薪资项目的名称不能和系统薪资项目的名称重名"));
|
||||
}
|
||||
// 保存薪资项目
|
||||
SalaryItemPO salaryItemPO = SalaryItemBO.convert2SalaryItemPO(saveParam, Long.valueOf(user.getUID()));
|
||||
salaryItemBiz.insert(salaryItemPO);
|
||||
// todo 记录日志
|
||||
// LoggerContext<SalaryItemPO> loggerContext = new LoggerContext<>();
|
||||
// loggerContext.setTargetId(String.valueOf(salaryItemPO.getId()));
|
||||
// loggerContext.setTargetName(salaryItemPO.getName());
|
||||
|
|
@ -104,53 +123,53 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98329, "新建薪资项目") + ": " + salaryItemPO.getName());
|
||||
// loggerContext.setNewValues(salaryItemPO);
|
||||
// salaryItemLoggerTemplate.write(loggerContext);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void batchSave(Collection<SalaryItemPO> salaryItemPOS) {
|
||||
// salaryItemMapper.batchInsert(salaryItemPOS);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void update(SalaryItemSaveParam saveParam, Long employeeId, String tenantKey) {
|
||||
// // 查询薪资项目,判断薪资项目是否存在
|
||||
// SalaryItemPO salaryItemPO = getById(saveParam.getId(), tenantKey);
|
||||
// if (Objects.isNull(salaryItemPO)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
// }
|
||||
// // 名称不能和已有的自定义薪资项目重名
|
||||
// List<SalaryItemPO> salaryItemPOS = listByName(saveParam.getName(), tenantKey);
|
||||
// boolean nameExist = salaryItemPOS.stream().anyMatch(e -> !Objects.equals(salaryItemPO.getId(), e.getId()));
|
||||
// if (nameExist) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "薪资项目名称已存在,请重新命名"));
|
||||
// }
|
||||
// // 名称不能和已有的系统薪资项目重名
|
||||
// List<SysSalaryItemPO> sysSalaryItemPOS = sysSalaryItemService.listByName(saveParam.getName());
|
||||
// boolean sysNameExist = sysSalaryItemPOS.stream().anyMatch(e -> !Objects.equals(salaryItemPO.getSysSalaryItemId(), e.getId()));
|
||||
// if (sysNameExist) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98328, "自定义薪资项目的名称不能和系统薪资项目的名称重名"));
|
||||
// }
|
||||
// // 更新薪资项目
|
||||
// SalaryItemPO newSalaryItemPO = new SalaryItemPO();
|
||||
// BeanUtils.copyProperties(salaryItemPO, newSalaryItemPO);
|
||||
// // 系统薪资项目的"属性"和"类型"不允许编辑
|
||||
// if (Objects.equals(newSalaryItemPO.getSystemType(), SalarySystemTypeEnum.CUSTOM.getValue())) {
|
||||
// newSalaryItemPO.setCategory(saveParam.getCategory().getValue());
|
||||
// newSalaryItemPO.setItemType(saveParam.getItemType().getValue());
|
||||
// }
|
||||
// newSalaryItemPO.setName(saveParam.getName());
|
||||
// newSalaryItemPO.setUseDefault(saveParam.getUseDefault());
|
||||
// newSalaryItemPO.setUseInEmployeeSalary(saveParam.getUseInEmployeeSalary());
|
||||
// newSalaryItemPO.setRoundingMode(saveParam.getRoundingMode().getValue());
|
||||
// newSalaryItemPO.setPattern(saveParam.getPattern());
|
||||
// newSalaryItemPO.setValueType(saveParam.getValueType().getValue());
|
||||
// newSalaryItemPO.setFormulaId(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? 0L : saveParam.getFormulaId());
|
||||
// newSalaryItemPO.setDatasource(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? SalaryDataSourceEnum.INPUT_IMPORT.getValue()
|
||||
// : SalaryDataSourceEnum.CUSTOM_FORMULA.getValue());
|
||||
// newSalaryItemPO.setDescription(saveParam.getDescription());
|
||||
// newSalaryItemPO.setUpdateTime(LocalDateTime.now());
|
||||
// salaryItemMapper.updateById(newSalaryItemPO);
|
||||
// // 记录日志
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(Collection<SalaryItemPO> salaryItemPOS) {
|
||||
salaryItemBiz.batchSave(salaryItemPOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(SalaryItemSaveParam saveParam) {
|
||||
// 查询薪资项目,判断薪资项目是否存在
|
||||
SalaryItemPO salaryItemPO = getById(saveParam.getId());
|
||||
if (Objects.isNull(salaryItemPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
}
|
||||
// 名称不能和已有的自定义薪资项目重名
|
||||
List<SalaryItemPO> salaryItemPOS = listByName(saveParam.getName());
|
||||
boolean nameExist = salaryItemPOS.stream().anyMatch(e -> !Objects.equals(salaryItemPO.getId(), e.getId()));
|
||||
if (nameExist) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "薪资项目名称已存在,请重新命名"));
|
||||
}
|
||||
// 名称不能和已有的系统薪资项目重名
|
||||
List<SysSalaryItemPO> sysSalaryItemPOS = sysSalaryItemBiz.listSome(SysSalaryItemPO.builder().name(saveParam.getName()).build());
|
||||
boolean sysNameExist = sysSalaryItemPOS.stream().anyMatch(e -> !Objects.equals(salaryItemPO.getSysSalaryItemId(), e.getId()));
|
||||
if (sysNameExist) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98328, "自定义薪资项目的名称不能和系统薪资项目的名称重名"));
|
||||
}
|
||||
// 更新薪资项目
|
||||
SalaryItemPO newSalaryItemPO = new SalaryItemPO();
|
||||
BeanUtils.copyProperties(salaryItemPO, newSalaryItemPO);
|
||||
// 系统薪资项目的"属性"和"类型"不允许编辑
|
||||
if (Objects.equals(newSalaryItemPO.getSystemType(), SalarySystemTypeEnum.CUSTOM.getValue())) {
|
||||
newSalaryItemPO.setCategory(saveParam.getCategory().getValue());
|
||||
newSalaryItemPO.setItemType(saveParam.getItemType().getValue());
|
||||
}
|
||||
newSalaryItemPO.setName(saveParam.getName());
|
||||
newSalaryItemPO.setUseDefault(saveParam.getUseDefault());
|
||||
newSalaryItemPO.setUseInEmployeeSalary(saveParam.getUseInEmployeeSalary());
|
||||
newSalaryItemPO.setRoundingMode(saveParam.getRoundingMode().getValue());
|
||||
newSalaryItemPO.setPattern(saveParam.getPattern());
|
||||
newSalaryItemPO.setValueType(saveParam.getValueType().getValue());
|
||||
newSalaryItemPO.setFormulaId(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? 0L : saveParam.getFormulaId());
|
||||
newSalaryItemPO.setDatasource(saveParam.getValueType() == SalaryValueTypeEnum.INPUT ? SalaryDataSourceEnum.INPUT_IMPORT.getValue()
|
||||
: SalaryDataSourceEnum.CUSTOM_FORMULA.getValue());
|
||||
newSalaryItemPO.setDescription(saveParam.getDescription());
|
||||
newSalaryItemPO.setUpdateTime(new Date());
|
||||
salaryItemBiz.updateById(newSalaryItemPO);
|
||||
//todo 记录日志
|
||||
// LoggerContext<SalaryItemPO> loggerContext = new LoggerContext<>();
|
||||
// loggerContext.setTargetId(String.valueOf(newSalaryItemPO.getId()));
|
||||
// loggerContext.setTargetName(newSalaryItemPO.getName());
|
||||
|
|
@ -160,24 +179,24 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
// loggerContext.setOldValues(salaryItemPO);
|
||||
// loggerContext.setNewValues(newSalaryItemPO);
|
||||
// salaryItemLoggerTemplate.write(loggerContext);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void deleteByIds(Collection<Long> ids, String tenantKey) {
|
||||
// // 查询薪资项目
|
||||
// List<SalaryItemPO> salaryItemPOS = listByIds(ids, tenantKey);
|
||||
// if (CollectionUtils.isEmpty(salaryItemPOS)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
// }
|
||||
// // 查询薪资账套的薪资项目副本,被薪资账套引用的薪资项目不允许删除
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<Long> ids) {
|
||||
// 查询薪资项目
|
||||
List<SalaryItemPO> salaryItemPOS = listByIds(ids);
|
||||
if (CollectionUtils.isEmpty(salaryItemPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98299, "参数错误,薪资项目不存在或已被删除"));
|
||||
}
|
||||
// todo 查询薪资账套的薪资项目副本,被薪资账套引用的薪资项目不允许删除
|
||||
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.listBySalaryItemIds(ids, tenantKey);
|
||||
// if (CollectionUtils.isNotEmpty(salarySobItemPOS)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98322, "薪资账套正在使用该薪资项目,不允许删除"));
|
||||
// }
|
||||
// // 删除薪资项目
|
||||
// ids = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getId);
|
||||
// salaryItemMapper.deleteByIds(ids, tenantKey);
|
||||
// // 记录删除日志
|
||||
// 删除薪资项目
|
||||
ids = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getId);
|
||||
salaryItemBiz.deleteByIds(ids);
|
||||
//todo 记录删除日志
|
||||
// salaryItemPOS.forEach(salaryItemPO -> {
|
||||
// LoggerContext<SalaryItemPO> loggerContext = new LoggerContext<>();
|
||||
// loggerContext.setTargetId(String.valueOf(salaryItemPO.getId()));
|
||||
|
|
@ -188,5 +207,5 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
// loggerContext.setOldValues(salaryItemPO);
|
||||
// salaryItemLoggerTemplate.write(loggerContext);
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service.impl;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.SalaryItemBiz;
|
||||
import com.engine.salary.biz.SysSalaryItemBiz;
|
||||
import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
|
|
@ -80,8 +81,8 @@ public class SysSalaryItemServiceImpl extends Service implements SysSalaryItemSe
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98350, "已经添加过的系统薪资项目不能重复添加"));
|
||||
}
|
||||
// 保存
|
||||
// List<SalaryItemPO> salaryItems = SysSalaryItemBO.convert2SalaryItemPO(sysSalaryItemPOS, employeeId, tenantKey);
|
||||
// salaryItemService.batchSave(salaryItems);
|
||||
List<SalaryItemPO> salaryItems = SysSalaryItemBO.convert2SalaryItemPO(sysSalaryItemPOS, employeeId, tenantKey);
|
||||
salaryItemService.batchSave(salaryItems);
|
||||
//todo 记录日志
|
||||
// sysSalaryItemPOS.forEach(sysSalaryItemPO -> {
|
||||
// LoggerContext<SalaryItemPO> loggerContext = new LoggerContext<>();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import weaver.general.BaseBean;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
public class ResponseResult<T, R> {
|
||||
|
|
@ -77,6 +79,48 @@ public class ResponseResult<T, R> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一返回方法(有参无返回)
|
||||
*/
|
||||
public String run(Consumer<T> f, T t) {
|
||||
try {
|
||||
f.accept(t);
|
||||
return Ok();
|
||||
} catch (SalaryRunTimeException e) {
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
BaseBean b = new BaseBean();
|
||||
b.writeLog(e);
|
||||
Throwable cause = e.getCause();
|
||||
return Error(cause.getMessage());
|
||||
} catch (Exception e) {
|
||||
BaseBean b = new BaseBean();
|
||||
b.writeLog(e);
|
||||
return Error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统一返回方法(无参有返回)
|
||||
*/
|
||||
public String run(Supplier<R> f) {
|
||||
try {
|
||||
return Ok(f.get());
|
||||
} catch (SalaryRunTimeException e) {
|
||||
return Error(e.getMessage());
|
||||
} catch (ECException e) {
|
||||
BaseBean b = new BaseBean();
|
||||
b.writeLog(e);
|
||||
Throwable cause = e.getCause();
|
||||
return Error(cause.getMessage());
|
||||
} catch (Exception e) {
|
||||
BaseBean b = new BaseBean();
|
||||
b.writeLog(e);
|
||||
return Error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功返回
|
||||
*/
|
||||
|
|
@ -88,4 +132,14 @@ public class ResponseResult<T, R> {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成功返回
|
||||
*/
|
||||
private String Ok() {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
apidatas.put("status", true);
|
||||
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,25 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.component.WeaFormOption;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.wrapper.SalaryItemWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 薪资项目
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
|
|
@ -10,20 +30,26 @@ package com.engine.salary.web;
|
|||
**/
|
||||
public class SalaryItemController {
|
||||
|
||||
// @Autowired
|
||||
// private SalaryItemWrapper salaryItemWrapper;
|
||||
private SalaryItemWrapper getSalaryItemWrapper(User user) {
|
||||
return ServiceUtil.getService(SalaryItemWrapper.class, user);
|
||||
}
|
||||
|
||||
// @Autowired
|
||||
// private SysSalaryItemWrapper sysSalaryItemWrapper;
|
||||
//
|
||||
// /**********************************自定义薪资项目 start*********************************/
|
||||
//
|
||||
// @PostMapping("/list")
|
||||
// @ApiOperation("薪资项目列表")
|
||||
// @WeaPermission
|
||||
// public WeaResult<WeaTable<SalaryItemListDTO>> listSalaryItem(@RequestBody SalaryItemSearchParam searchParam) {
|
||||
// return WeaResult.success(salaryItemWrapper.listPage(searchParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* 薪资项目列表
|
||||
*/
|
||||
@POST
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam searchParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryItemSearchParam, Map<String, Object>>().run(getSalaryItemWrapper(user)::listPage, searchParam);
|
||||
}
|
||||
|
||||
// @PostMapping("/listCanDelete")
|
||||
// @ApiOperation("可删除的薪资项目列表")
|
||||
// @WeaPermission
|
||||
|
|
@ -56,13 +82,19 @@ public class SalaryItemController {
|
|||
// return WeaResult.success(salaryItemWrapper.getForm(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/listSalaryItemTypeOption")
|
||||
// @ApiOperation("获取薪资项目可选的类型(与属性有联动)")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Map<String, List<WeaFormOption>>> listSalaryItemTypeOption() {
|
||||
// Map<String, List<WeaFormOption>> resultMap = salaryItemWrapper.listSalaryItemTypeOption(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// return WeaResult.success(resultMap);
|
||||
// }
|
||||
|
||||
/**
|
||||
* "获取薪资项目可选的类型(与属性有联动)"
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/listSalaryItemTypeOption")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listSalaryItemTypeOption(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Map<String, List<WeaFormOption>>>().run(getSalaryItemWrapper(user)::listSalaryItemTypeOption);
|
||||
}
|
||||
//
|
||||
// @PostMapping("/delete")
|
||||
// @ApiOperation("批量删除薪资项目")
|
||||
|
|
|
|||
|
|
@ -1,71 +1,55 @@
|
|||
//package com.engine.salary.wrapper;
|
||||
//
|
||||
//import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
//import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
//import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
//import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
//import com.google.common.collect.Lists;
|
||||
//import com.weaver.common.component.form.WeaForm;
|
||||
//import com.weaver.common.component.form.item.WeaFormItem;
|
||||
//import com.weaver.common.component.form.item.WeaFormOption;
|
||||
//import com.weaver.common.component.search.WeaSearchCondition;
|
||||
//import com.weaver.common.component.table.WeaTable;
|
||||
//import com.weaver.common.component.table.page.Page;
|
||||
//import com.weaver.common.component.table.permission.Permission;
|
||||
//import com.weaver.common.component.table.type.WeaTableTypeEnum;
|
||||
//import com.weaver.excel.formula.api.entity.ExpressFormula;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.bo.SalaryItemBO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.bo.SysSalaryItemBO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.dto.SalaryItemSearchConditionDTO;
|
||||
//import com.weaver.hrm.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
//import com.weaver.hrm.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
//import com.weaver.hrm.salary.enums.SalaryItemTypeEnum;
|
||||
//import com.weaver.hrm.salary.exception.SalaryRunTimeException;
|
||||
//import com.weaver.hrm.salary.service.SalaryFormulaService;
|
||||
//import com.weaver.hrm.salary.service.SalaryItemService;
|
||||
//import com.weaver.hrm.salary.service.SalarySobItemService;
|
||||
//import com.weaver.hrm.salary.service.SysSalaryItemService;
|
||||
//import com.weaver.hrm.salary.util.SalaryEntityUtil;
|
||||
//import com.weaver.hrm.salary.util.SalaryFormatUtil;
|
||||
//import com.weaver.hrm.salary.util.SalaryI18nUtil;
|
||||
//import org.apache.commons.collections4.CollectionUtils;
|
||||
//import org.apache.commons.lang3.math.NumberUtils;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.*;
|
||||
//
|
||||
///**
|
||||
// * @description: 薪资项目
|
||||
// * @author: xiajun
|
||||
// * @modified By: xiajun
|
||||
// * @date: Created in 1/17/22 4:00 PM
|
||||
// * @version:v1.0
|
||||
// */
|
||||
//@Component
|
||||
//public class SalaryItemWrapper {
|
||||
//
|
||||
// @Autowired
|
||||
// private SalaryItemService salaryItemService;
|
||||
// @Autowired
|
||||
// private SalaryFormulaService salaryFormulaService;
|
||||
// @Autowired
|
||||
// private SalarySobItemService salarySobItemService;
|
||||
// @Autowired
|
||||
// private SysSalaryItemService sysSalaryItemService;
|
||||
//
|
||||
// /**
|
||||
// * 薪资项目列表
|
||||
// *
|
||||
// * @param searchParam 查询参数
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public WeaTable<SalaryItemListDTO> listPage(SalaryItemSearchParam searchParam, Long employeeId, String tenantKey) {
|
||||
// // 查询薪资项目
|
||||
// Page<SalaryItemPO> page = salaryItemService.listPageByParam(searchParam, tenantKey);
|
||||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.WeaFormOption;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalaryItemTypeEnum;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.service.SalarySobItemService;
|
||||
import com.engine.salary.service.SysSalaryItemService;
|
||||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 薪资项目
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class SalaryItemWrapper extends Service {
|
||||
|
||||
private SalaryItemService salaryItemService;
|
||||
private SalaryItemService getSalaryItemService(User user) {
|
||||
return (SalaryItemService)ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
// private SalaryFormulaService salaryFormulaService;
|
||||
private SalarySobItemService salarySobItemService;
|
||||
private SysSalaryItemService sysSalaryItemService;
|
||||
|
||||
/**
|
||||
* 薪资项目列表
|
||||
*
|
||||
* @param searchParam 查询参数
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage(SalaryItemSearchParam searchParam) {
|
||||
// 查询薪资项目
|
||||
PageInfo<SalaryItemPO> page = getSalaryItemService(user).listPageByParam(searchParam);
|
||||
Map<String, Object> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("a",page);
|
||||
return objectObjectHashMap;
|
||||
// Page<SalaryItemListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
||||
// // 被薪资账套引用的薪资项目
|
||||
// List<SalarySobItemPO> salarySobItems = Lists.newArrayListWithExpectedSize((int) page.getSize());
|
||||
|
|
@ -94,8 +78,8 @@
|
|||
// }
|
||||
// }
|
||||
// return weaTable;
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 可以删除的薪资项目列表
|
||||
// *
|
||||
|
|
@ -104,15 +88,15 @@
|
|||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public WeaTable<SalaryItemListDTO> listPage4CanDelete(SalaryItemSearchParam searchParam, Long employeeId, String tenantKey) {
|
||||
// public WeaTable<SalaryItemListDTO> listPage4CanDelete(SalaryItemSearchParam searchParam) {
|
||||
// // 查询所有薪资账套中的薪资项目副本
|
||||
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.list(tenantKey);
|
||||
// List<SalarySobItemPO> salarySobItemPOS = salarySobItemService.list();
|
||||
// // 被引用的薪资项目id
|
||||
// Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
// // 排除被引用的薪资项目(被引用的薪资项目不可以删除)
|
||||
// searchParam.setExcludeIds(salaryItemIds);
|
||||
// // 转换成前端所需的数据格式
|
||||
// WeaTable<SalaryItemListDTO> weaTable = listPage(searchParam, employeeId, tenantKey);
|
||||
// WeaTable<SalaryItemListDTO> weaTable = listPage(searchParam);
|
||||
// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX);
|
||||
// weaTable.setOperates(Collections.emptyList());
|
||||
// weaTable.setPageUid("canDeleteSalaryItemList");
|
||||
|
|
@ -200,49 +184,43 @@
|
|||
// }
|
||||
// return weaForm;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取薪资项目可选的类型(与属性有联动)
|
||||
// *
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// * @return
|
||||
// */
|
||||
// public Map<String, List<WeaFormOption>> listSalaryItemTypeOption(Long employeeId, String tenantKey) {
|
||||
// return SalaryEntityUtil.group2ListMap(Arrays.asList(SalaryItemTypeEnum.values()),
|
||||
// e -> e.getCategory().name(),
|
||||
// e -> new WeaFormOption(e.name(), SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, e.getLabelId(), e.getDefaultLabel())));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 保存薪资项目
|
||||
// *
|
||||
// * @param saveParam 保存参数
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// */
|
||||
// public void save(SalaryItemSaveParam saveParam, Long employeeId, String tenantKey) {
|
||||
// salaryItemService.save(saveParam, employeeId, tenantKey);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑薪资项目
|
||||
// *
|
||||
// * @param saveParam 更新参数
|
||||
// * @param employeeId 人员id
|
||||
// * @param tenantKey 租户key
|
||||
// */
|
||||
// public void update(SalaryItemSaveParam saveParam, Long employeeId, String tenantKey) {
|
||||
// salaryItemService.update(saveParam, employeeId, tenantKey);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除薪资项目
|
||||
// *
|
||||
// * @param ids 主键id
|
||||
// * @param tenantKey 租户key
|
||||
// */
|
||||
// public void delete(Collection<Long> ids, String tenantKey) {
|
||||
// salaryItemService.deleteByIds(ids, tenantKey);
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 获取薪资项目可选的类型(与属性有联动)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, List<WeaFormOption>> listSalaryItemTypeOption() {
|
||||
return SalaryEntityUtil.group2ListMap(Arrays.asList(SalaryItemTypeEnum.values()),
|
||||
e -> e.getCategory().name(),
|
||||
e -> new WeaFormOption(e.name(), SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存薪资项目
|
||||
*
|
||||
* @param saveParam 保存参数
|
||||
*/
|
||||
public void save(SalaryItemSaveParam saveParam) {
|
||||
salaryItemService.save(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑薪资项目
|
||||
*
|
||||
* @param saveParam 更新参数
|
||||
*/
|
||||
public void update(SalaryItemSaveParam saveParam) {
|
||||
salaryItemService.update(saveParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除薪资项目
|
||||
*
|
||||
* @param ids 主键id
|
||||
* @param tenantKey 租户key
|
||||
*/
|
||||
public void delete(Collection<Long> ids, String tenantKey) {
|
||||
salaryItemService.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue