单独调薪action
This commit is contained in:
parent
11d1ee1a21
commit
b39587e19d
|
|
@ -0,0 +1,127 @@
|
|||
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 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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -180,7 +180,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);
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
|
|||
|
||||
|
||||
// 构建导入需要的数据
|
||||
SalaryArchiveImportHandleParam importHandleParam = buildImportHandleParam(SalaryArchiveImportHandleParam.builder().listType(param.getListType()).importType(param.getImportType()).build());
|
||||
SalaryArchiveImportHandleParam importHandleParam = buildImportHandleParam(SalaryArchiveImportHandleParam.builder().isProcess(true).listType(param.getListType()).importType(param.getImportType()).build());
|
||||
|
||||
|
||||
int total = 0;
|
||||
|
|
@ -698,6 +698,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
|
|||
// List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list(tenantKey);
|
||||
|
||||
return SalaryArchiveImportHandleParam.builder()
|
||||
.isProcess(true)
|
||||
.listType(listType)
|
||||
.importType(importType)
|
||||
.currentEmployeeId((long) user.getUID())
|
||||
|
|
|
|||
|
|
@ -492,19 +492,19 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
|||
// }
|
||||
|
||||
// 被累计专项附加扣除引用
|
||||
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentId(id).build());
|
||||
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(Collections.singleton(id)).build());
|
||||
AddUpDeductionEncrypt.decryptAddUpDeductionList(addUpDeductionList);
|
||||
if (CollectionUtils.isNotEmpty(addUpDeductionList)) {
|
||||
throw new SalaryRunTimeException("存在累计专项附加扣除引用");
|
||||
}
|
||||
// 被其他免税扣除引用
|
||||
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentId(id).build());
|
||||
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(Collections.singleton(id)).build());
|
||||
OtherDeductionPOEncrypt.decryptOtherDeductionPOList(otherDeductionList);
|
||||
if (CollectionUtils.isNotEmpty(otherDeductionList)) {
|
||||
throw new SalaryRunTimeException("存在其他免税扣除引用");
|
||||
}
|
||||
// 被往期累计情况引用
|
||||
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentId(id).build());
|
||||
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(Collections.singleton(id)).build());
|
||||
AddUpSituationEncrypt.decryptAddUpSituationList(addUpSituationList);
|
||||
if (CollectionUtils.isNotEmpty(addUpSituationList)) {
|
||||
throw new SalaryRunTimeException("存在往期累计情况引用");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue