Merge branch 'develop' of https://gitee.com/qlmr/weaver-hrm-salary into develop
This commit is contained in:
commit
e4cdddc005
|
|
@ -660,6 +660,7 @@ public class SIArchivesBiz {
|
|||
|
||||
request.setNeedAuth(param.getNeedAuth());
|
||||
request.setTaxAgentEmployeeIds(param.getTaxAgentEmployeeIds());
|
||||
request.setTaxAgentIds(param.getTaxAgentIds());
|
||||
|
||||
Integer current = param.getCurrent() == null ? 1 : param.getCurrent();
|
||||
Integer pageSize = param.getPageSize() == null ? 10 : param.getPageSize();
|
||||
|
|
@ -705,10 +706,11 @@ public class SIArchivesBiz {
|
|||
PageInfo<InsuranceArchivesEmployeePO> pageInfo = new PageInfo<>(InsuranceArchivesEmployeePO.class);
|
||||
if (needAuth) {
|
||||
Collection<Long> taxAgentEmployeeIds = param.getTaxAgentEmployeeIds();
|
||||
Collection<Long> taxAgentIds = param.getTaxAgentIds();
|
||||
page = socialSchemeMapper.queryEmployeeList(param);
|
||||
page = page.stream().filter(f ->
|
||||
// 作为管理员
|
||||
taxAgentEmployeeIds.contains(f.getEmployeeId())
|
||||
// taxAgentEmployeeIds.contains(f.getEmployeeId())||
|
||||
taxAgentIds.contains(f.getPaymentOrganization())
|
||||
).collect(Collectors.toList());
|
||||
// 填充总数和当页数据
|
||||
// 分页参数
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import com.engine.salary.entity.salaryBill.param.SalarySendDetailQueryParam;
|
|||
import com.engine.salary.entity.salaryBill.param.SalarySendInfoQueryParam;
|
||||
import com.engine.salary.entity.salaryBill.po.SalarySendInfoPO;
|
||||
import com.engine.salary.mapper.salarybill.SalarySendInfoMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
|
|
@ -31,6 +33,7 @@ public class SalarySendInfoBiz {
|
|||
|
||||
/**
|
||||
* 工资单发放
|
||||
*
|
||||
* @param po
|
||||
* @param salarySendId
|
||||
* @param statusList
|
||||
|
|
@ -50,6 +53,7 @@ public class SalarySendInfoBiz {
|
|||
|
||||
/**
|
||||
* 根据现有字段查询
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -76,6 +80,7 @@ public class SalarySendInfoBiz {
|
|||
|
||||
/**
|
||||
* 工资单发放详情列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -106,10 +111,14 @@ public class SalarySendInfoBiz {
|
|||
}
|
||||
|
||||
public void batchInsert(List<SalarySendInfoPO> salarySendInfos) {
|
||||
if (CollectionUtils.isEmpty(salarySendInfos)) {
|
||||
return;
|
||||
}
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
|
||||
mapper.batchInsert(salarySendInfos);
|
||||
List<List<SalarySendInfoPO>> partition = Lists.partition(salarySendInfos, 100);
|
||||
partition.forEach(mapper::batchInsert);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ public class InsuranceArchivesListParam extends BaseQueryParam {
|
|||
|
||||
//分权
|
||||
private Boolean needAuth;
|
||||
//个税扣缴义务人
|
||||
//个税扣缴义务人下人员
|
||||
private Collection<Long> taxAgentEmployeeIds;
|
||||
//个税扣缴义务人
|
||||
private Collection<Long> taxAgentIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,7 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:
|
||||
* @Description:
|
||||
* @Author:罗威
|
||||
* @date:
|
||||
*/
|
||||
|
||||
public class DataType implements Serializable {
|
||||
public final static String STRING="string";
|
||||
public final static String NUMBER="number";
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@
|
|||
t2.name AS tax_agent,
|
||||
d.departmentname AS department,
|
||||
e.mobile,
|
||||
e.workcode,
|
||||
e.workcode as jobNum,
|
||||
t1.send_status,
|
||||
t1.employee_id,
|
||||
t1.salary_month,
|
||||
|
|
@ -322,18 +322,9 @@
|
|||
ORDER BY t1.id DESC
|
||||
</select>
|
||||
<select id="list" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO" databaseId="oracle">
|
||||
SELECT
|
||||
|
||||
t1.id,
|
||||
e.lastname as username,
|
||||
t2.name AS tax_agent,
|
||||
d.departmentname AS department,
|
||||
e.mobile,
|
||||
e.workcode,
|
||||
t1.send_status,
|
||||
t1.employee_id,
|
||||
t1.salary_month,
|
||||
e.email
|
||||
SELECT
|
||||
|
||||
<include refid="salarySendInfoColumn"/>
|
||||
|
||||
FROM
|
||||
hrsa_salary_send_info t1
|
||||
|
|
@ -402,18 +393,9 @@
|
|||
ORDER BY t1.id DESC
|
||||
</select>
|
||||
<select id="list" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO" databaseId="sqlserver">
|
||||
SELECT
|
||||
|
||||
t1.id,
|
||||
e.lastname as username,
|
||||
t2.name AS tax_agent,
|
||||
d.departmentname AS department,
|
||||
e.mobile,
|
||||
e.workcode,
|
||||
t1.send_status,
|
||||
t1.employee_id,
|
||||
t1.salary_month,
|
||||
e.email
|
||||
SELECT
|
||||
|
||||
<include refid="salarySendInfoColumn"/>
|
||||
|
||||
FROM
|
||||
hrsa_salary_send_info t1
|
||||
|
|
@ -499,19 +481,8 @@
|
|||
ORDER BY t1.id DESC
|
||||
</select>
|
||||
<select id="detailList" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO" databaseId="oracle">
|
||||
SELECT
|
||||
|
||||
t1.id,
|
||||
e.lastname as username,
|
||||
t2.name AS tax_agent,
|
||||
d.departmentname AS department,
|
||||
e.mobile,
|
||||
e.workcode,
|
||||
t1.send_status,
|
||||
t1.employee_id,
|
||||
t1.salary_month,
|
||||
e.email
|
||||
|
||||
SELECT
|
||||
<include refid="salarySendInfoColumn"/>
|
||||
FROM
|
||||
hrsa_salary_send_info t1
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
|
|
@ -580,19 +551,8 @@
|
|||
ORDER BY t1.id DESC
|
||||
</select>
|
||||
<select id="detailList" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO" databaseId="sqlserver">
|
||||
SELECT
|
||||
|
||||
t1.id,
|
||||
e.lastname as username,
|
||||
t2.name AS tax_agent,
|
||||
d.departmentname AS department,
|
||||
e.mobile,
|
||||
e.workcode,
|
||||
t1.send_status,
|
||||
t1.employee_id,
|
||||
t1.salary_month,
|
||||
e.email
|
||||
|
||||
SELECT
|
||||
<include refid="salarySendInfoColumn"/>
|
||||
FROM
|
||||
hrsa_salary_send_info t1
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetDataSource;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
|
@ -27,6 +29,10 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private final BaseBean baseBean = new BaseBean();
|
||||
|
||||
private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log"));
|
||||
|
||||
|
||||
@Override
|
||||
public Object run(ExpressFormula expressFormula, List<FormulaVar> formulaVars, DataCollectionEmployee simpleEmployee) throws Exception {
|
||||
|
|
@ -42,37 +48,65 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
}
|
||||
|
||||
private String runSQL(ExpressFormula expressFormula, List<FormulaVar> formulaVars) {
|
||||
log.info("SQL ExpressFormula {}, formulaVars {}", expressFormula, formulaVars);
|
||||
RecordSet rs = new RecordSet();
|
||||
String formulaRunScript = expressFormula.getFormulaRunScript();
|
||||
if (isLog) {
|
||||
log.info("SQL ExpressFormula {}, formulaVars {}", expressFormula, formulaVars);
|
||||
}
|
||||
|
||||
//解析配置,获取返回值、数据源
|
||||
String extendParam = expressFormula.getExtendParam();
|
||||
String sqlReturnKey = "";
|
||||
String datasourceId = "";
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(extendParam);
|
||||
//返回值配置
|
||||
JsonNode sqlReturnKeyNode = jsonNode.get("sqlReturnKey");
|
||||
if (sqlReturnKeyNode != null) {
|
||||
sqlReturnKey = sqlReturnKeyNode.asText();
|
||||
}
|
||||
//数据源配置
|
||||
JsonNode datasourceNode = jsonNode.get("datasource");
|
||||
if (datasourceNode != null) {
|
||||
JsonNode datasourceIdNode = datasourceNode.get("datasourceId");
|
||||
if (datasourceIdNode != null) {
|
||||
datasourceId = datasourceIdNode.asText();
|
||||
}
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("express execute fail, sql extendParam parse fail", e);
|
||||
}
|
||||
|
||||
String sql = formulaRunScript;
|
||||
//解析sql
|
||||
String sql = expressFormula.getFormulaRunScript();
|
||||
for (FormulaVar formulaVar : formulaVars) {
|
||||
sql = sql.replaceAll(formulaVar.getFieldId(), "'" + formulaVar.getContent() + "'");
|
||||
}
|
||||
log.info("sql run {}", sql);
|
||||
if (rs.execute(sql)) {
|
||||
if (rs.next()) {
|
||||
return rs.getString(sqlReturnKey);
|
||||
if (isLog) {
|
||||
log.info("sql run {}", sql);
|
||||
}
|
||||
|
||||
//外部数据源
|
||||
if (StringUtils.isNotBlank(datasourceId)) {
|
||||
RecordSetDataSource rs = new RecordSetDataSource(datasourceId);
|
||||
if (rs.executeSql(sql)) {
|
||||
if (rs.next()) {
|
||||
return rs.getString(sqlReturnKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RecordSet rs = new RecordSet();
|
||||
if (rs.execute(sql)) {
|
||||
if (rs.next()) {
|
||||
return rs.getString(sqlReturnKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
private Object runFormula(ExpressFormula expressFormula, List<FormulaVar> formulaVars) throws Exception {
|
||||
log.info("FORMULA ExpressFormula {}, formulaVars {}", expressFormula, formulaVars);
|
||||
|
||||
if (isLog) {
|
||||
log.info("FORMULA ExpressFormula {}, formulaVars {}", expressFormula, formulaVars);
|
||||
}
|
||||
DefaultContext<String, Object> context = new DefaultContext<String, Object>();
|
||||
formulaVars.forEach(v -> {
|
||||
if (DataType.NUMBER.equals(v.getFieldType()) && NumberUtils.isCreatable(v.getContent())) {
|
||||
|
|
|
|||
|
|
@ -95,7 +95,9 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
if (needAuth) {
|
||||
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(currentEmployeeId);
|
||||
Set<Long> employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId);
|
||||
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getTaxAgentId);
|
||||
param.setTaxAgentEmployeeIds(employeeIds);
|
||||
param.setTaxAgentIds(taxAgentIds);
|
||||
}
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
|
|
|
|||
|
|
@ -407,9 +407,9 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
//查询账套对应的扣缴义务人
|
||||
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||
Long taxAgentId = salarySobPO.getTaxAgentId();
|
||||
//过滤扣税扣缴义务人不包含的人员
|
||||
Collection<Long> employeeIdsInTaxAgent = getTaxAgentService(user).listEmployeeIdsInTaxAgent(taxAgentId);
|
||||
salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> employeeIdsInTaxAgent.contains(salaryEmployee.getEmployeeId())).collect(Collectors.toList());
|
||||
// //过滤扣税扣缴义务人不包含的人员
|
||||
// Collection<Long> employeeIdsInTaxAgent = getTaxAgentService(user).listEmployeeIdsInTaxAgent(taxAgentId);
|
||||
// salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> employeeIdsInTaxAgent.contains(salaryEmployee.getEmployeeId())).collect(Collectors.toList());
|
||||
|
||||
// 查询薪资档案,获取人员的个税扣缴义务人
|
||||
Set<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
private EmployBiz employBiz = new EmployBiz();
|
||||
|
||||
private SalarySobRangeService getSalarySobRangeService(User user) {
|
||||
return (SalarySobRangeService) ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private EmployMapper getEmployMapper() {
|
||||
|
|
@ -96,8 +96,8 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
|
||||
@Override
|
||||
public List<DataCollectionEmployee> getEmployeeByIds(List<Long> simpleEmployeeIds) {
|
||||
if(CollectionUtils.isEmpty(simpleEmployeeIds)){
|
||||
return new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(simpleEmployeeIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<DataCollectionEmployee> employeeList = new ArrayList<>();
|
||||
List<List<Long>> partition = Lists.partition(simpleEmployeeIds, 1000);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -62,5 +63,14 @@ public class SalaryFormulaController {
|
|||
return new ResponseResult<SalaryFormulaSaveParam, FormulaPO>(user).run(getSalaryFormulaWrapper(user)::save, param);
|
||||
}
|
||||
|
||||
//数据源列表
|
||||
@GET
|
||||
@Path("/datasource/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String datasource(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, ArrayList>(user).run(getSalaryFormulaWrapper(user)::datasourceList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@ package com.engine.salary.wrapper;
|
|||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.salaryformula.bo.SalaryFormulaBO;
|
||||
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
|
||||
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
|
||||
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.RemoteExcelService;
|
||||
import com.engine.salary.service.SalaryFormulaService;
|
||||
|
|
@ -16,7 +16,9 @@ import com.engine.salary.service.impl.RemoteExcelServiceImpl;
|
|||
import com.engine.salary.service.impl.SalaryFormulaServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.hrm.User;
|
||||
import weaver.servicefiles.DataSourceXML;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -72,4 +74,10 @@ public class SalaryFormulaWrapper extends Service {
|
|||
public FormulaPO save(SalaryFormulaSaveParam salaryFormulaSaveParam) {
|
||||
return getSalaryFormulaService(user).save(salaryFormulaSaveParam);
|
||||
}
|
||||
|
||||
public ArrayList datasourceList() {
|
||||
DataSourceXML dataSourceXML = new DataSourceXML();
|
||||
ArrayList pointArrayList = dataSourceXML.getPointArrayList();
|
||||
return pointArrayList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue