Merge branch 'feature/扩展sql字符' into release/2.3.2.2212.01

This commit is contained in:
钱涛 2022-12-08 11:32:03 +08:00
commit 2c1421999b
21 changed files with 700 additions and 173 deletions

View File

@ -0,0 +1,82 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandleParam;
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveListTypeEnum;
import com.engine.salary.service.SalaryArchiveExcelService;
import com.engine.salary.service.impl.SalaryArchiveExcelServiceImpl;
import lombok.extern.slf4j.Slf4j;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class BatEditSalaryExcelAction implements Action {
private SalaryArchiveExcelService getSalaryArchiveExcelService(User user) {
return ServiceUtil.getService(SalaryArchiveExcelServiceImpl.class, user);
}
private String batSalaryExcelField;
public String getBatSalaryExcelField() {
return batSalaryExcelField;
}
public void setBatSalaryExcelField(String batSalaryExcelField) {
this.batSalaryExcelField = batSalaryExcelField;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String docId = fieldMap.get(batSalaryExcelField);
RecordSet rs = new RecordSet();
String queryImageId = "select imagefileid from docimagefile where docid = ?";
rs.executeQuery(queryImageId, docId);
String imagefileid = null;
if (rs.next()) {
imagefileid = rs.getString("imagefileid");
}
SalaryArchiveImportHandleParam param = SalaryArchiveImportHandleParam.builder().imageId(imagefileid)
.listType(SalaryArchiveListTypeEnum.FIXED.getValue())
.importType(SalaryArchiveImportTypeEnum.SALARYITEMADJUST.getValue())
.onlyCheck(false)
.isProcess(true)
.build();
Map<String, Object> map = getSalaryArchiveExcelService(new User()).batchImportEbatch(param);
int errorCount = (int) map.get("errorCount");
if (errorCount > 0) {
log.error("批量调薪存在异常 requestId:{} map:{}",requestInfo.getRequestid(), map);
// List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorNotice");
// StringBuilder message = new StringBuilder();
// for (Map<String, String> comments : excelComments) {
// message.append(comments.get("message")).append("/n");
// }
// requestInfo.getRequestManager().setMessage(message.toString());
// return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("批量调薪异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -0,0 +1,82 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandleParam;
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveListTypeEnum;
import com.engine.salary.service.SalaryArchiveExcelService;
import com.engine.salary.service.impl.SalaryArchiveExcelServiceImpl;
import lombok.extern.slf4j.Slf4j;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class CheckBatEditSalaryExcelAction implements Action {
private SalaryArchiveExcelService getSalaryArchiveExcelService(User user) {
return ServiceUtil.getService(SalaryArchiveExcelServiceImpl.class, user);
}
private String batSalaryExcelField;
public String getBatSalaryExcelField() {
return batSalaryExcelField;
}
public void setBatSalaryExcelField(String batSalaryExcelField) {
this.batSalaryExcelField = batSalaryExcelField;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String docId = fieldMap.get(batSalaryExcelField);
RecordSet rs = new RecordSet();
String queryImageId = "select imagefileid from docimagefile where docid = ?";
rs.executeQuery(queryImageId, docId);
String imagefileid = null;
if (rs.next()) {
imagefileid = rs.getString("imagefileid");
}
SalaryArchiveImportHandleParam param = SalaryArchiveImportHandleParam.builder().imageId(imagefileid)
.listType(SalaryArchiveListTypeEnum.FIXED.getValue())
.importType(SalaryArchiveImportTypeEnum.SALARYITEMADJUST.getValue())
.onlyCheck(true)
.isProcess(true)
.build();
Map<String, Object> map = getSalaryArchiveExcelService(new User()).batchImportEbatch(param);
int errorCount = (int) map.get("errorCount");
if (errorCount > 0) {
log.error("批量调薪检查存在异常 requestId:{} map:{}",requestInfo.getRequestid(), map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorNotice");
StringBuilder message = new StringBuilder("excel中");
for (Map<String, String> comments : excelComments) {
message.append(comments.get("message")).append("\n");
}
requestInfo.getRequestManager().setMessage(message.toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("批量调薪检查异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -0,0 +1,128 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class CheckEditSalaryAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = fieldMap.get(processField);
list.add(new SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue));
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
Map<String, Object> map = getSalaryArchiveWrapper(new User()).checkAdjustmentSalaryArchive(build);
List errorNotice = (List) map.get("errorNotice");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("调薪检查存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorNotice");
StringBuilder message = new StringBuilder("");
for (Map<String, String> comments : excelComments) {
message.append(comments.get("message")).append("\n");
}
requestInfo.getRequestManager().setMessage(message.toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("调薪检查异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
class SalaryField {
private String processField;
private String salaryName;
private String value;
public String getProcessField() {
return processField;
}
public void setProcessField(String processField) {
this.processField = processField;
}
public String getSalaryName() {
return salaryName;
}
public void setSalaryName(String salaryName) {
this.salaryName = salaryName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public SalaryField(String processField, String salaryName, String value) {
this.processField = processField;
this.salaryName = salaryName;
this.value = value;
}
}
}

View File

@ -0,0 +1,128 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
public class EditSalaryAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = fieldMap.get(processField);
list.add(new SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue));
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
Map<String, Object> map = getSalaryArchiveWrapper(new User()).adjustmentSalaryArchive(build);
List errorNotice = (List) map.get("errorNotice");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("调薪存在异常 requestId:{} map:{}",requestInfo.getRequestid(), map);
// List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorNotice");
// StringBuilder message = new StringBuilder("");
// for (Map<String, String> comments : excelComments) {
// message.append(comments.get("message")).append("\n");
// }
// requestInfo.getRequestManager().setMessage(message.toString());
// return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("调薪异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
class SalaryField {
private String processField;
private String salaryName;
private String value;
public String getProcessField() {
return processField;
}
public void setProcessField(String processField) {
this.processField = processField;
}
public String getSalaryName() {
return salaryName;
}
public void setSalaryName(String salaryName) {
this.salaryName = salaryName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public SalaryField(String processField, String salaryName, String value) {
this.processField = processField;
this.salaryName = salaryName;
this.value = value;
}
}
}

View File

@ -13,10 +13,15 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryarchive.*;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentManageRangeService;
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
import com.engine.salary.service.impl.TaxAgentManageRangeServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelComment;
@ -46,6 +51,10 @@ public class SalaryArchiveExcelBO extends Service {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
public TaxAgentManageRangeService getTaxAgentManageRangeService() {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
public static String userNameI18n;
public static String departmentI18n;
public static String jobNumI18n;
@ -180,7 +189,10 @@ public class SalaryArchiveExcelBO extends Service {
List<String> mustHeaders = Lists.newArrayList();
mustHeaders.add(userNameI18n);
if (!importHandleParam.isProcess()) {
//流程中可以使用人员id
mustHeaders.add(userNameI18n);
}
mustHeaders.add(taxAgentI18n);
// mustHeaders.add(incomeCategoryI18n);
// mustHeaders.add(salarySobI18n);
@ -339,6 +351,9 @@ public class SalaryArchiveExcelBO extends Service {
* @return
*/
public static boolean singleRowCheck(List<String> allTodoSalaryArchives, Map<String, Object> map, List<String> headers, int effectiveTimeIndex, List<Map<String, String>> excelComments, int errorCount, SalaryArchiveImportHandleParam importHandleParam) {
//是否是流程
boolean process = importHandleParam.isProcess();
boolean isError = false;
String rowindex = "" + map.get("index") + "";
// 1.姓名
@ -377,6 +392,14 @@ public class SalaryArchiveExcelBO extends Service {
employeeId = Long.valueOf(empId);
}
if (employeeId == null) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "人员存在重复数据,请确定姓名、部门、手机号唯一");
excelComments.add(errorMessageMap);
isError = true;
return isError;
}
// 用于初始化导入数据校验
map.put("employeeId", employeeId);
@ -408,12 +431,27 @@ public class SalaryArchiveExcelBO extends Service {
}
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = optionalTaxAgent.get().getEmployeeList().stream().filter(f -> finalEmployeeSameIds.contains(f.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + taxAgentRangeMsg);
excelComments.add(errorMessageMap);
if (process) {
//定薪流程中自动将人员添加进个税扣缴义务人中
TaxAgentManageRangeSaveParam.TaxAgentSubAdminRangeTargetParam taxAgentSubAdminRangeTargetParam = new TaxAgentManageRangeSaveParam.TaxAgentSubAdminRangeTargetParam();
taxAgentSubAdminRangeTargetParam.setTargetId(employeeId);
taxAgentSubAdminRangeTargetParam.setTargetType(TargetTypeEnum.EMPLOYEE);
TaxAgentRangeSaveParam taxAgentRangeSaveParam = new TaxAgentRangeSaveParam();
taxAgentRangeSaveParam.setTaxAgentId(taxAgentId);
taxAgentRangeSaveParam.setIncludeType(1);
taxAgentRangeSaveParam.setEmployeeStatus(Arrays.asList("0", "1", "2", "3", "4", "5", "6"));
taxAgentRangeSaveParam.setTargetParams(Collections.singletonList(taxAgentSubAdminRangeTargetParam));
taxAgentRangeSaveParam.setSync(true);
importHandleParam.setTaxAgentRanges(Collections.singletonList(taxAgentRangeSaveParam));
} else {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + taxAgentRangeMsg);
excelComments.add(errorMessageMap);
// SalaryArchiveExcelBO.createExcelComment(excelComments, taxAgentRangeMsg, errorCount + 1, errorCount + 1, 0, 0);
isError = true;
return isError;
isError = true;
return isError;
}
} else {
employeeId = optionalTaxAgentEmp.get().getEmployeeId();
// 除了定薪中的初始化其他导入存在相同的取第一条
@ -474,7 +512,7 @@ public class SalaryArchiveExcelBO extends Service {
// 必填判空
boolean isEmpty = StringUtils.isEmpty(cellVal) &&
(userNameI18n.equals(key.toString()) || taxAgentI18n.equals(key.toString()) || incomeCategoryI18n.equals(key.toString()) || salarySobI18n.equals(key.toString())
((userNameI18n.equals(key.toString()) && !process) || taxAgentI18n.equals(key.toString()) || incomeCategoryI18n.equals(key.toString()) || salarySobI18n.equals(key.toString())
// 定薪列表初始化导入必填: 起始发薪日期生效日期
|| ((payStartDateI18n.equals(key.toString()) || effectiveTimeI18n.equals(key.toString())) && importHandleParam.isInit())
// 定薪列表调薪必填: 调整原因生效日期

View File

@ -5,7 +5,9 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveListTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -43,6 +45,11 @@ public class SalaryArchiveImportHandleParam {
* @see SalaryArchiveImportTypeEnum
*/
String importType;
/**
* 列表类型
* @see SalaryArchiveListTypeEnum
*/
String listType;
/**
@ -50,6 +57,11 @@ public class SalaryArchiveImportHandleParam {
*/
boolean onlyCheck;
/**
* 是否是流程
*/
boolean isProcess;
//*****************************************************************/
Long currentEmployeeId;
@ -134,6 +146,11 @@ public class SalaryArchiveImportHandleParam {
*/
List<Long> salaryArchiveItemDelSalaryItemIds;
/**
* 待生成的人员范围
*/
List<TaxAgentRangeSaveParam> taxAgentRanges;
/**
* 薪资账套
*/

View File

@ -19,4 +19,7 @@ public class TaxAgentRangeSaveParam extends TaxAgentManageRangeSaveParam {
*/
@DataCheck(require = true,message = "个税扣缴义务人的id不允许为空")
private Long taxAgentId;
//是否同步/异步执行生成档案
private boolean sync;
}

View File

@ -34,20 +34,6 @@ public class SalaryArchiveActionAPI {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
/**
* 获取薪资档案列表
*
* @return
* @param importType=salaryItemAdjust(调薪),taxAgentAdjust(调整个税扣缴义务人),init(档案初始化)
*/
// @GET
// @Path("/selectSalaryArchiveColumns")
// @Produces(MediaType.APPLICATION_JSON)
// public String selectSalarySobList(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam("importType") String importType) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<String,Map<String,Object>>(user).run(getSalaryArchiveWrapper(user)::selectSalaryArchiveColumns,importType);
// }
/**
* 前置校验列表添加接口
* @param importData

View File

@ -219,4 +219,10 @@ public interface SalaryArchiveService {
* 处理异常数据
*/
Map<String, Object> handleRepeatData();
/**
* 处理增量数据
* @param currentEmployeeId
*/
void handleChangeData(Long currentEmployeeId);
}

View File

@ -167,7 +167,7 @@ public interface TaxAgentService {
* @param ids
* @return
*/
String delete(Collection<Long> ids);
String delete(List<Long> ids);
/**
* 获取个税扣缴义务人下拉列表

View File

@ -96,6 +96,7 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
//外部数据源
if (StringUtils.isNotBlank(datasourceId)) {
RecordSetDataSource rs = new RecordSetDataSource(datasourceId);
log.error("执行外部sql,{},datasourceId{}", sql,datasourceId);
if (rs.executeSql(sql)) {
if (rs.next()) {
result = rs.getString(sqlReturnKey);

View File

@ -16,6 +16,7 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.entity.taxagent.po.TaxAgentEmployeePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
@ -78,6 +79,10 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
public TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
private SalaryArchiveBiz salaryArchiveMapper = new SalaryArchiveBiz();
private EmployBiz employBiz = new EmployBiz();
private SalaryArchiveItemBiz salaryArchiveItemMapper = new SalaryArchiveItemBiz();
@ -433,12 +438,8 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
SalaryArchiveExcelBO.initI18n();
String imageId = param.getImageId();
// 列表类型
String listType = param.getListType();
// 导入类型
String importType = param.getImportType();
// 2.构建导入需要的数据
SalaryArchiveImportHandleParam importHandleParam = buildImportHandleParam(listType, importType);
// 构建导入需要的数据
SalaryArchiveImportHandleParam importHandleParam = buildImportHandleParam(param);
InputStream fileInputStream = null;
try {
@ -547,12 +548,9 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
// 初始化国际化标签
SalaryArchiveExcelBO.initI18n();
// 列表类型
String listType = param.getListType();
// 导入类型
String importType = param.getImportType();
// 2.构建导入需要的数据
SalaryArchiveImportHandleParam importHandleParam = buildImportHandleParam(listType, importType);
// 构建导入需要的数据
SalaryArchiveImportHandleParam importHandleParam = buildImportHandleParam(SalaryArchiveImportHandleParam.builder().isProcess(true).listType(param.getListType()).importType(param.getImportType()).build());
// 设置所有的个税扣缴义务人由于定薪流程调用者不一定是个税扣缴义务人管理员防止出现个税扣缴义务人不存在问题
importHandleParam.setTaxAgentList(getTaxAgentService(user).listAllTaxAgentAndEmployeeTree());
@ -656,16 +654,26 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
/**
* 构建导入处理参数
*
* @param listType
* @param importType
* @param param
* @return
*/
private SalaryArchiveImportHandleParam buildImportHandleParam(String listType, String importType) {
private SalaryArchiveImportHandleParam buildImportHandleParam(SalaryArchiveImportHandleParam param) {
// 列表类型
String listType = param.getListType();
// 导入类型
String importType = param.getImportType();
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItems = salaryArchiveItemService(user).getCanAdjustSalaryItems();
Collection<Long> salaryItemIds = salaryItems.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree((long) user.getUID());
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList;
if (param.isProcess()) {
// 获取所有个税扣缴义务人
taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree();
} else {
taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree((long) user.getUID());
}
// 待定薪列表
boolean isPendingList = listType.equals(SalaryArchiveListTypeEnum.PENDING.getValue());
@ -697,6 +705,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
// List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list(tenantKey);
return SalaryArchiveImportHandleParam.builder()
.isProcess(param.isProcess())
.listType(listType)
.importType(importType)
.currentEmployeeId((long) user.getUID())
@ -738,6 +747,8 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
.salaryArchiveUpdates(Lists.newArrayList())
// 待删除薪资档案-薪资项目
.salaryArchiveItemDelSalaryItemIds(Lists.newArrayList())
//人员范围
.taxAgentRanges(Lists.newArrayList())
// 薪资账套
// .salarySobList(salaryArchiveService.getSalarySobList(employeeId, tenantKey))
// 待保存薪资档案-薪资账套
@ -797,7 +808,10 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
List<SalaryArchivePO> salaryArchiveUpdates = importHandleParam.getSalaryArchiveUpdates();
List<SalaryArchiveItemPO> salaryArchiveItemSaves = importHandleParam.getSalaryArchiveItemSaves();
List<Long> salaryArchiveItemDelSalaryItemIds = importHandleParam.getSalaryArchiveItemDelSalaryItemIds();
List<TaxAgentRangeSaveParam> taxAgentRanges = importHandleParam.getTaxAgentRanges();
// List<SalaryArchiveSobPO> salaryArchiveSobSaves = importHandleParam.getSalaryArchiveSobSaves();
// 新增薪资档案
if (CollectionUtils.isNotEmpty(salaryArchiveSaves)) {
// 去除已经存在的避免重复
@ -828,5 +842,11 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
// if (CollectionUtils.isNotEmpty(salaryArchiveIds) && CollectionUtils.isNotEmpty(salaryArchiveSaves)) {
// this.salaryArchiveSobService.saveBatchBySalaryArchiveIdsAndSaves(salaryArchiveIds, salaryArchiveSobSaves, message.getTenantKey());
// }
//新增人员范围会自动生成人员档案
if (CollectionUtils.isNotEmpty(taxAgentRanges)) {
taxAgentRanges.forEach(getTaxAgentManageRangeService(user)::save);
}
}
}

View File

@ -169,7 +169,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// 2.待停薪自动处理
handleSuspendData(currentEmployeeId);
// 3.增量数据处理
handleChangeData(currentEmployeeId);
// handleChangeData(currentEmployeeId);
Util_DataCache.setObjVal("salaryArchiveHandleable", "1");
}
}.start();
@ -284,10 +284,14 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return;
}
// 当前可以管辖的人员
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
taxAgentEmpChangeList = taxAgentEmpChangeList.stream().filter(f -> taxAgentList.stream().anyMatch(e -> e.getId().equals(f.getTaxAgentId()))).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentEmpChangeList)) {
return;
Collection<TaxAgentPO> taxAgentList = new ArrayList<>();
if (currentEmployeeId != 1L) {
taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
Collection<TaxAgentPO> finalTaxAgentList = taxAgentList;
taxAgentEmpChangeList = taxAgentEmpChangeList.stream().filter(f -> finalTaxAgentList.stream().anyMatch(e -> e.getId().equals(f.getTaxAgentId()))).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentEmpChangeList)) {
return;
}
}
// 所有档案数据
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveMapper().listAll();

View File

@ -20,6 +20,7 @@ import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.taxagent.TaxAgentManageRangeMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.TaxAgentEmpService;
import com.engine.salary.service.TaxAgentManageRangeService;
import com.engine.salary.service.TaxAgentService;
@ -68,6 +69,10 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
return ServiceUtil.getService(TaxAgentEmpServiceImpl.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private EmployMapper getEmployMapper() {
return MapperProxyFactory.getProxy(EmployMapper.class);
}
@ -123,9 +128,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
// 需要排除的人员范围
Set<Long> excludeEmployeeIds = SalaryEntityUtil.properties(excludeSalaryEmployees, DataCollectionEmployee::getEmployeeId);
// 过滤人员
includeSalaryEmployees = includeSalaryEmployees.stream()
.filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId()))
.collect(Collectors.toList());
includeSalaryEmployees = includeSalaryEmployees.stream().filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId())).collect(Collectors.toList());
}
return includeSalaryEmployees;
}
@ -142,32 +145,27 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
}
List<DataCollectionEmployee> salaryEmployeeList = Lists.newArrayList();
for (TaxAgentManageRangePO manageRange : taxAgentManageRanges) {
salaryEmployeeList.addAll(salaryEmployees.stream()
.filter(salaryEmployee -> {
if (StringUtils.isEmpty(manageRange.getEmployeeStatus()) || !manageRange.getEmployeeStatus().contains("\"" + salaryEmployee.getStatus() + "\"")) {
return false;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.ALL.getValue())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue())
&& Objects.equals(manageRange.getTargetId(), salaryEmployee.getEmployeeId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.DEPT.getValue())
&& Objects.equals(manageRange.getTargetId(), salaryEmployee.getDepartmentId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())
&& Objects.equals(manageRange.getTargetId(), salaryEmployee.getSubcompanyid())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.POSITION.getValue())
&& Objects.equals(manageRange.getTargetId(), salaryEmployee.getJobtitleId())) {
return true;
}
return false;
}).collect(Collectors.toList()));
salaryEmployeeList.addAll(salaryEmployees.stream().filter(salaryEmployee -> {
if (StringUtils.isEmpty(manageRange.getEmployeeStatus()) || !manageRange.getEmployeeStatus().contains("\"" + salaryEmployee.getStatus() + "\"")) {
return false;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.ALL.getValue())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getEmployeeId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.DEPT.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getDepartmentId())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getSubcompanyid())) {
return true;
}
if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.POSITION.getValue()) && Objects.equals(manageRange.getTargetId(), salaryEmployee.getJobtitleId())) {
return true;
}
return false;
}).collect(Collectors.toList()));
}
// 去重
salaryEmployeeList = salaryEmployeeList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DataCollectionEmployee::getEmployeeId))), ArrayList::new));
@ -213,30 +211,18 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
private PageInfo<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(List<TaxAgentManageRangePO> taxAgentManageRanges, TaxAgentManageRangeQueryParam queryParam, Integer includeType) {
// 查询人员信息
List<Long> employeeIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<Long> employeeIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
// List<DataCollectionEmployee> employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds);
List<DataCollectionEmployee> employeeComInfos = employBiz.getEmployeeByIdsAll(employeeIds);
// 查询部门信息
List<Long> departmentIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<Long> departmentIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<DeptInfo> departmentComInfos = employBiz.getDeptInfoList(departmentIds);
// 查询分部信息
List<Long> subDepartmentIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<Long> subDepartmentIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<SubCompanyInfo> subDepartmentComInfos = employBiz.getSubCompanyInfoList(subDepartmentIds);
// 查询岗位信息
List<Long> positionIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<Long> positionIds = taxAgentManageRanges.stream().filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())).map(TaxAgentManageRangePO::getTargetId).collect(Collectors.toList());
List<PositionInfo> positionComInfos = employBiz.listPositionInfo(positionIds);
// 分页参数
PageInfo<TaxAgentManageRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class);
@ -247,9 +233,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
List<TaxAgentManageRangeListDTO> taxAgentManageRangeList = TaxAgentBO.convert2ListDTO(taxAgentManageRanges, employeeComInfos, departmentComInfos, subDepartmentComInfos, positionComInfos, hrmStatusList);
// 根据对象名称过滤
if (StringUtils.isNotEmpty(queryParam.getTargetName())) {
taxAgentManageRangeList = taxAgentManageRangeList.stream()
.filter(f -> f.getTargetName().contains(queryParam.getTargetName()))
.collect(Collectors.toList());
taxAgentManageRangeList = taxAgentManageRangeList.stream().filter(f -> f.getTargetName().contains(queryParam.getTargetName())).collect(Collectors.toList());
}
// 填充总数和当页数据
dtoPage.setTotal(taxAgentManageRangeList.size());
@ -310,9 +294,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
allRanges.addAll(result.getNeedInsertTaxAgentManageRanges());
allRanges.addAll(result.getNeedUpdateTaxAgentManageRanges());
// 去重
allRanges = allRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
Comparator.comparing(f -> f.getTaxAgentId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType()))
), ArrayList::new));
allRanges = allRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getTaxAgentId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType()))), ArrayList::new));
List<DataCollectionEmployee> salaryEmployees = getEmployMapper().listAll();
List<DataCollectionEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(saveParam.getTaxAgentId(), allRanges, salaryEmployees);
@ -326,15 +308,21 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
}
/* 同步本地人员范围的关联人员=========================== */
syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, null);
if (saveParam.isSync()) {
//同步执行
syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, null);
} else {
taskExecutor.execute(() -> {
syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, null);
});
}
}
private void syncLocalEmp(Long taxAgentId, List<DataCollectionEmployee> allSalaryEmployees, List<TaxAgentManageRangePO> allSubAdminRanges) {
log.info("开始同步人员step");
taskExecutor.execute(() -> {
syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID());
});
syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID());
//生成档案
getSalaryArchiveService(user).handleChangeData(1L);
}
@ -449,6 +437,9 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId);
// 同步分管理员的人员
// taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId, tenantKey);
//生成档案
getSalaryArchiveService(user).handleChangeData(1L);
}
/**
@ -459,10 +450,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
* @return
*/
private TaxAgentEmpSaveParam getTaxAgentEmpSyncParam(Long taxAgentId, List<DataCollectionEmployee> allSalaryEmployees) {
return TaxAgentEmpSaveParam.builder()
.taxAgentId(taxAgentId)
.salaryEmployeeList(allSalaryEmployees)
.build();
return TaxAgentEmpSaveParam.builder().taxAgentId(taxAgentId).salaryEmployeeList(allSalaryEmployees).build();
}
/**
@ -480,11 +468,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
List<TaxAgentManageRangePO> singSubAdminRanges = allSubAdminRanges.stream().filter(r -> e.equals(r.getTaxAgentSubAdminId())).collect(Collectors.toList());
List<DataCollectionEmployee> subAdminSalaryEmployees = this.getManageRangeSalaryEmployees(taxAgentId, singSubAdminRanges, salaryEmployees);
subAdminEmpSaveParamList.add(TaxAgentSubAdminEmpSaveParam.builder()
.taxAgentId(taxAgentId)
.subAdminId(e)
.salaryEmployeeList(subAdminSalaryEmployees)
.build());
subAdminEmpSaveParamList.add(TaxAgentSubAdminEmpSaveParam.builder().taxAgentId(taxAgentId).subAdminId(e).salaryEmployeeList(subAdminSalaryEmployees).build());
});
return subAdminEmpSaveParamList;
}
@ -519,7 +503,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
* @param taxAgentIds
*/
@Override
public void syncManageRange(List<Long> taxAgentIds,String index) {
public void syncManageRange(List<Long> taxAgentIds, String index) {
// 开始同步
LocalRunnable localRunnable = new LocalRunnable() {
@Override

View File

@ -12,6 +12,7 @@ import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
@ -410,7 +411,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
@Override
public String delete(Collection<Long> ids) {
public String delete(List<Long> ids) {
if (org.springframework.util.CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
@ -421,7 +422,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(85382, "要删除的个税扣缴义务人在不存在或已删除"));
}
// 正在使用的记录不允许删除
boolean checkUsed = checkUsed(ids);
boolean checkUsed = checkUsed(ids.get(0));
if (checkUsed) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100570, "正在使用的记录不允许删除"));
}
@ -448,21 +449,16 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
/**
* 检查正在被使用的记录
*
* @param ids
* @param id
* @return
*/
private boolean checkUsed(Collection<Long> ids) {
//fixme 被薪资档案引用
// List<SalaryArchivePO> salaryArchiveList = new LambdaQueryChainWrapper<>(getSalaryArchiveMapper())
// .eq(SalaryArchivePO::getDeleteType, 0)
// .eq(SalaryArchivePO::getTenantKey)
// .in(SalaryArchivePO::getTaxAgentId, ids)
// .list();
// getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().t);
// if (CollectionUtils.isNotEmpty(salaryArchiveList)) {
// return Boolean.TRUE;
// }
// todo 被社保福利档案引用
private boolean checkUsed(Long id) {
//被薪资档案引用
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().taxAgentId(id).build());
if (CollectionUtils.isNotEmpty(salaryArchiveList)) {
throw new SalaryRunTimeException("存在薪资档案引用");
}
//被社保福利档案引用
// List<InsuranceArchivesSocialSchemePO> socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper)
// .eq(InsuranceArchivesSocialSchemePO::getTenantKey)
// .eq(InsuranceArchivesSocialSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
@ -496,28 +492,28 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
// }
// 被累计专项附加扣除引用
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(ids).build());
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(Collections.singleton(id)).build());
AddUpDeductionEncrypt.decryptAddUpDeductionList(addUpDeductionList);
if (CollectionUtils.isNotEmpty(addUpDeductionList)) {
return Boolean.TRUE;
throw new SalaryRunTimeException("存在累计专项附加扣除引用");
}
// 被其他免税扣除引用
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(ids).build());
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(Collections.singleton(id)).build());
OtherDeductionPOEncrypt.decryptOtherDeductionPOList(otherDeductionList);
if (CollectionUtils.isNotEmpty(otherDeductionList)) {
return Boolean.TRUE;
throw new SalaryRunTimeException("存在其他免税扣除引用");
}
// 被往期累计情况引用
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(ids).build());
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(Collections.singleton(id)).build());
AddUpSituationEncrypt.decryptAddUpSituationList(addUpSituationList);
if (CollectionUtils.isNotEmpty(addUpSituationList)) {
return Boolean.TRUE;
throw new SalaryRunTimeException("存在往期累计情况引用");
}
//账套
List<SalarySobPO> salarySobPOS = getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentIds(ids).build());
List<SalarySobPO> salarySobPOS = getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentId(id).build());
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
return Boolean.TRUE;
throw new SalaryRunTimeException("存在账套引用");
}
return Boolean.FALSE;
@ -552,7 +548,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
*
* @param taxAgents
* @param currentEmployeeId
* @param chiefCanSeeAll 总管理员是否可见所有
* @param chiefCanSeeAll 总管理员是否可见所有
* @return
*/
private List<TaxAgentPO> handleForDevolution(List<TaxAgentPO> taxAgents, Long currentEmployeeId, boolean chiefCanSeeAll) {
@ -646,26 +642,9 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
if (CollectionUtils.isEmpty(allTaxAgents)) {
return taxAgentManageRangeEmployeeList;
}
List<Long> taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<TaxAgentEmployeePO> allEmployees = getTaxAgentMapper().listEmployee();
// 1.判断自己是否是管理员 如果是管理员就是能够操作所属个税扣缴义务人下的所有人的数据
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(taxAgentIds, (long) user.getUID());
// 是管理员的列表
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(adminTaxAgentIds)) {
taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees));
}
// 2.根据作为非管理员查找自己作为分管理员 对应的管理范围人员
List<Long> noAdminTaxAgentIds = allTaxAgents.stream()
.map(TaxAgentPO::getId)
.filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) {
// taxAgentManageRangeEmployeeList.addAll(getTaxAgentSubAdminEmp(allTaxAgents, noAdminTaxAgentIds, allEmployees));
}
taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, taxAgentIds, allEmployees));
return taxAgentManageRangeEmployeeList;
}
@ -763,7 +742,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
@Override
public List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) {
List<TaxAgentEmployeeDTO> taxAgentEmployeeList = Lists.newArrayList();
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId);
taxAgentManageRangeEmployeeList.forEach(m -> {
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> employeeList = m.getEmployeeList();

View File

@ -373,6 +373,15 @@ public class SalaryAcctController {
return new ResponseResult<SalaryAcctResultQueryParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::listPage, param);
}
//合计行
@POST
@Path("/acctresult/sum")
@Produces(MediaType.APPLICATION_JSON)
public String sumSalaryAcctResult(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctResultQueryParam, Map<String, Object>>(user).run(getSalaryAcctResultWrapper(user)::sumSalaryAcctResult, param);
}
//薪资核算结果详情
@GET

View File

@ -1,5 +1,7 @@
package com.engine.salary.web;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
@ -8,7 +10,11 @@ import com.engine.salary.entity.salaryformula.po.FormulaPO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.wrapper.SalaryFormulaWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import lombok.extern.slf4j.Slf4j;
import weaver.conn.RecordSetDataSource;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -18,9 +24,11 @@ import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
public class SalaryFormulaController {
@ -72,5 +80,51 @@ public class SalaryFormulaController {
return new ResponseResult<String, ArrayList>(user).run(getSalaryFormulaWrapper(user)::datasourceList);
}
@GET
@Path("/checkSql")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
String result = "";
Map<String, String> map = new HashMap<>();
try {
String sql = request.getParameter("sql");
String sqlReturnKey = request.getParameter("sqlReturnKey");
String datasourceId = request.getParameter("datasourceId");
RecordSetDataSource rs = new RecordSetDataSource(datasourceId);
log.info("sql run{},datasourceId:{},sqlReturnKey:{}", sql, datasourceId, sqlReturnKey);
map.put("sql",sql);
map.put("sqlReturnKey",sqlReturnKey);
map.put("datasourceId",datasourceId);
if (rs.executeSql(sql)) {
if (rs.next()) {
result = rs.getString(sqlReturnKey);
}
}
map.put("result",result);
} catch (Exception e) {
log.error("sql error", e);
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("status", false);
apidatas.put("errormsg", e.getMessage());
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("status", true);
apidatas.put("data", map);
return getJsonString(apidatas);
}
private static String getJsonString(Object apidatas) {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.writeValueAsString(apidatas);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return "";
}
}

View File

@ -198,9 +198,9 @@ public class TaxAgentController {
@POST
@Path("/delete")
@Produces(MediaType.APPLICATION_JSON)
public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody List<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, String>(user).run(getTaxAgentWrapper(user)::delete, ids);
return new ResponseResult<List<Long>, String>(user).run(getTaxAgentWrapper(user)::delete, ids);
}
/**

View File

@ -18,7 +18,6 @@ import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.enums.OpenEnum;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
@ -105,12 +104,30 @@ public class SalaryAcctResultWrapper extends Service {
datas.put("pageInfo", page);
datas.put("columns", columns);
// //合计
// SalarySysConfPO openSum = getSalarySysConfService(user).getOneByCode(OPEN_ACCT_RESULT_SUM);
// if (openSum != null && StringUtils.isNotBlank(openSum.getConfValue()) && OpenEnum.parseByValue(openSum.getConfValue()) == OpenEnum.OPEN) {
// Map<String, Object> sumRow = getSalaryAcctResultService(user).sumRow(queryParam);
// datas.put("sumRow", sumRow);
// }
return datas;
}
/**
* 合计行
*
* @param queryParam 列表查询条件
* @return
*/
public Map<String, Object> sumSalaryAcctResult(SalaryAcctResultQueryParam queryParam) {
ValidUtil.doValidator(queryParam);
Map<String, Object> datas = new HashMap<>();
//合计
SalarySysConfPO openSum = getSalarySysConfService(user).getOneByCode(OPEN_ACCT_RESULT_SUM);
if (openSum != null && StringUtils.isNotBlank(openSum.getConfValue()) && OpenEnum.parseByValue(openSum.getConfValue()) == OpenEnum.OPEN) {
Map<String, Object> sumRow = getSalaryAcctResultService(user).sumRow(queryParam);
datas.put("sumRow", sumRow);
}
Map<String, Object> sumRow = getSalaryAcctResultService(user).sumRow(queryParam);
datas.put("sumRow", sumRow);
return datas;
}
@ -241,6 +258,7 @@ public class SalaryAcctResultWrapper extends Service {
}
/**
* 薪资核算-校验
*

View File

@ -36,7 +36,6 @@ import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.RecordSet;
import weaver.hrm.User;
import java.util.*;
@ -466,17 +465,6 @@ public class SalaryArchiveWrapper extends Service {
return getSalaryArchiveService(user).exportList(queryParam);
}
public Map<String, Object> checkImportSalaryArchive(SalaryArchiveImportHandleParam param) {
String queryImageId = "select imagefileid from docimagefile where docid = ?";
if (param.getImageId() != null && !"".equals(param.getImageId())) {
RecordSet rs = new RecordSet();
rs.executeQuery(queryImageId, param.getImageId());
if (rs.next()) {
param.setImageId(rs.getString("imagefileid"));
}
}
return getSalaryArchiveExcelService(user).batchImportEbatch(param);
}
/**

View File

@ -277,7 +277,7 @@ public class TaxAgentWrapper extends Service {
* @param ids
* @return
*/
public String delete(Collection<Long> ids) {
public String delete(List<Long> ids) {
return getTaxAgentService(user).delete(ids);
}