feat: 重新提交de修改

This commit is contained in:
zhaopeng 2026-02-02 11:20:22 +08:00
parent 6e4882bde3
commit c2a46f48d4
1639 changed files with 0 additions and 251807 deletions

View File

@ -1,53 +0,0 @@
package com.api.salary.listener;
import com.sun.jersey.api.model.AbstractResourceModelContext;
import com.sun.jersey.api.model.AbstractResourceModelListener;
import com.weaver.upgrade.FunctionUpgradeUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.system.License;
import javax.ws.rs.ext.Provider;
@Provider
public class InitListener implements AbstractResourceModelListener {
@Override
public void onLoaded(AbstractResourceModelContext abstractResourceModelContext) {
int menuid = 100118;
BaseBean bb = new BaseBean();
String cId = new License().getCId();
String defaultCloseNonStandard149 = bb.getPropValue("hrmSalary", "defaultCloseNonStandard149");
if (StringUtils.isNotBlank(cId) && "true".equals(defaultCloseNonStandard149)) {
if (cId.length() > 7) {
cId = cId.substring(cId.length() - 7);
}
int cid = Integer.parseInt(cId);
if (!hasMenuInfo(cid, "left", menuid)) {
bb.writeLog("149新薪酬管理 添加默认菜单控制");
insertMenuInfo(cid, "left", menuid);
}
}
}
private void insertMenuInfo(int cid, String type, int id) {
RecordSet rs = new RecordSet();
BaseBean bb = new BaseBean();
bb.writeLog("FunctionUpgradeUtil.getMenuId(cid,id):" + FunctionUpgradeUtil.getMenuId(cid, id));
String sql = "INSERT INTO menucontrollist (type,menuid,isopen) VALUES('" + type + "','" + FunctionUpgradeUtil.getMenuId(cid, id) + "','" + FunctionUpgradeUtil.getMenuStatus(id, -1, cid) + "')";
rs.execute(sql);
}
private boolean hasMenuInfo(int cid, String type, int id) {
RecordSet rs = new RecordSet();
String sql = "select count(1) as count from menucontrollist where type = ? and menuid = ?";
rs.executeQuery(sql, type, FunctionUpgradeUtil.getMenuId(cid, id));
if (rs.next()) {
int count = rs.getInt("count");
if (count > 0) {
return true;
}
}
return false;
}
}

View File

@ -1,9 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/addUpDeduction")
public class AddUpDeductionController extends com.engine.salary.web.AddUpDeductionController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/addUpSituation")
public class AddUpSituationController extends com.engine.salary.web.AddUpSituationController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/attendQuote")
public class AttendQuoteController extends com.engine.salary.web.AttendQuoteController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/auth")
public class AuthController extends com.engine.salary.web.AuthController {
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/extEmp")
public class ExtEmpController extends com.engine.salary.web.ExtEmpController{
}

View File

@ -1,9 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/maintainer")
public class MaintainerController extends com.engine.salary.maintainer.MaintainerController{
}

View File

@ -1,13 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* @Description: 我的薪资福利显示设置
* @Author: wangxiangzhong
* @Date: 2021-12-08 14:44
*/
@Path("/bs/hrmsalary/mySalaryShowSet")
public class MySalaryShowSetController extends com.engine.salary.web.MySalaryShowSetController {
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/otherDeduction")
public class OtherDeductionController extends com.engine.salary.web.OtherDeductionController {
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/process")
public class ProcessController extends com.engine.salary.web.ProcessController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/push")
public class PushController extends com.engine.salary.web.PushController{
}

View File

@ -1,13 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/4/11
* @Version V1.0
**/
@Path("/bs/hrmsalary/siaccount")
public class SIAccountController extends com.engine.salary.web.SIAccountController {
}

View File

@ -1,14 +0,0 @@
package com.api.salary.web;
import com.engine.salary.process.siArchives.SIArchiveActionAPI;
import javax.ws.rs.Path;
/**
* @Author: sy
* @Description:
* @Date: 2022/11/11
**/
@Path("/bs/hrmsalary/siArchiveAction")
public class SIArchiveActionAPIController extends SIArchiveActionAPI {
}

View File

@ -1,13 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/3/11
* @Version V1.0
**/
@Path("/bs/hrmsalary/archives")
public class SIArchivesController extends com.engine.salary.web.SIArchivesController {
}

View File

@ -1,13 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/3/9
* @Version V1.0
**/
@Path("/bs/hrmsalary/sicategory")
public class SICategoryController extends com.engine.salary.web.SICategoryController {
}

View File

@ -1,13 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/4/20
* @Version V1.0
**/
@Path("/bs/hrmsalary/welfare")
public class SIExportController extends com.engine.salary.web.SIExportController {
}

View File

@ -1,16 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* 福利报表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Path("/bs/hrmsalary/report")
public class SIReportController extends com.engine.salary.web.SIReportController {
}

View File

@ -1,13 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/3/7
* @Version V1.0
**/
@Path("/bs/hrmsalary/scheme")
public class SISchemeController extends com.engine.salary.web.SISchemeController {
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryacct")
public class SalaryAcctController extends com.engine.salary.web.SalaryAcctController {
}

View File

@ -1,10 +0,0 @@
package com.api.salary.web;
import com.engine.salary.process.salaryArchive.SalaryArchiveActionAPI;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryArchiveAction")
public class SalaryArchiveActionAPIController extends SalaryArchiveActionAPI {
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryArchive")
public class SalaryArchiveController extends com.engine.salary.web.SalaryArchiveController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryBill")
public class SalaryBillController extends com.engine.salary.web.SalaryBillController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/common")
public class SalaryCommonController extends com.engine.salary.web.SalaryCommonController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryField")
public class SalaryFieldController extends com.engine.salary.web.SalaryFieldController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/formula")
public class SalaryFormulaController extends com.engine.salary.web.SalaryFormulaController {
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryitem")
public class SalaryItemController extends com.engine.salary.web.SalaryItemController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/progress")
public class SalaryProgressController extends com.engine.salary.web.SalaryProgressController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/salaryBill/send/range/")
public class SalarySendRangeController extends com.engine.salary.web.SalarySendRangeController{
}

View File

@ -1,15 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
/**
* 薪资账套
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Path("/bs/hrmsalary/salarysob")
public class SalarySobController extends com.engine.salary.web.SalarySobController {
}

View File

@ -1,9 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/report/statistics/dimension")
public class SalaryStatisticsDimensionController extends com.engine.salary.report.web.SalaryStatisticsDimensionController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/report/statistics/echarts")
public class SalaryStatisticsEchartsController extends com.engine.salary.report.web.SalaryStatisticsEchartsController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/report/statistics/employee")
public class SalaryStatisticsEmployeeController extends com.engine.salary.report.web.SalaryStatisticsEmployeeController{
}

View File

@ -1,9 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/report/statistics/item")
public class SalaryStatisticsItemController extends com.engine.salary.report.web.SalaryStatisticsItemController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/salaryreport/salary/statistics/push")
public class SalaryStatisticsPushController extends com.engine.salary.report.web.SalaryStatisticsPushController{
}

View File

@ -1,9 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/report/statistics/report")
public class SalaryStatisticsReportController extends com.engine.salary.report.web.SalaryStatisticsReportController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/sys")
public class SalarySystemConfigController extends com.engine.salary.web.SalarySystemConfigController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/specialAddDeduction")
public class SpecialAddDeductionController extends com.engine.salary.web.SpecialAddDeductionController {
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/taxAgent")
public class TaxAgentController extends com.engine.salary.web.TaxAgentController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/taxdeclaration")
public class TaxDeclarationController extends com.engine.salary.web.TaxDeclarationController{
}

View File

@ -1,7 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/taxrate")
public class TaxRateController extends com.engine.salary.web.TaxRateController{
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/variableSalary")
public class VariableArchiveController extends com.engine.salary.web.VariableArchiveController {
}

View File

@ -1,8 +0,0 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/variableSalaryItem")
public class VariableItemController extends com.engine.salary.web.VariableItemController {
}

View File

@ -1,112 +0,0 @@
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 org.apache.commons.lang3.StringUtils;
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;
}
private String operatorField;
public String getOperatorField() {
return operatorField;
}
public void setOperatorField(String operatorField) {
this.operatorField = operatorField;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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();
//操作人
String uid = fieldMap.getOrDefault(operatorField, "1");
Map<String, Object> map = getSalaryArchiveExcelService(new User(Integer.parseInt(uid))).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

@ -1,111 +0,0 @@
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 org.apache.commons.lang3.StringUtils;
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;
}
private String operatorField;
public String getOperatorField() {
return operatorField;
}
public void setOperatorField(String operatorField) {
this.operatorField = operatorField;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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();
//操作人
String uid = fieldMap.getOrDefault(operatorField, "1");
Map<String, Object> map = getSalaryArchiveExcelService(new User(Integer.parseInt(uid))).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

@ -1,153 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @Author: sy
* @Description: 编辑福利档案的前置校验
* @Date: 2023/8/21
**/
@Slf4j
public class CheckEditSIArchiveAction implements Action {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<CheckEditSIArchiveAction.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 CheckEditSIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, CheckEditSIArchiveAction.SalaryField::getSalaryName, CheckEditSIArchiveAction.SalaryField::getValue));
//福利执行状态
String runStatus = list.stream().filter(f -> f.salaryName.equals("档案状态")).findFirst().map(CheckEditSIArchiveAction.SalaryField::getValue).orElse("1");
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(CheckEditSIArchiveAction.SalaryField::getValue).orElse("1");
Map<String, Object> map = getSISchemeService(new User(Integer.parseInt(uid))).checkSIArchiveAdd(build);
List errorNotice = (List) map.get("errorData");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("福利档案编辑内容检查存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorData");
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

@ -1,147 +0,0 @@
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 org.apache.commons.lang3.StringUtils;
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;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(SalaryField::getValue).orElse("1");
Map<String, Object> map = getSalaryArchiveWrapper(new User(Integer.parseInt(uid))).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

@ -1,208 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
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.*;
import java.util.stream.Collectors;
@Slf4j
public class CheckInitSalaryAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private SalaryArchiveMapper getSalaryArchiveMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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));
}
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue);
return doSalaryArchiveInit(requestInfo, importDataMap);
} catch (Exception e) {
log.error("定薪检查异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
}
public String doSalaryArchiveInit(RequestInfo requestInfo, Map<String, Object> importDataMap) {
User user = new User();
user.setLoginid("sysadmin");
user.setUid(1);
List<Map<String, Object>> importData = new ArrayList<>();
if(!importDataMap.containsKey("生效日期")){
importDataMap.put("生效日期", SalaryDateUtil.getFormatDate(new Date()));
}
if(!importDataMap.containsKey("最后发薪日期")){
importDataMap.put("最后发薪日期", "");
}
importData.add(importDataMap);
// 首先判断是否已经存在薪资档案且薪资档案状态为待定薪
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
String empIdStr = importDataMap.getOrDefault("员工id", "").toString();
if (StringUtils.isBlank(taxAgentName)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不能为空");
return FAILURE_AND_CONTINUE;
}
// 获取义务人信息
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(taxAgentName).build());
if (CollectionUtils.isEmpty(taxAgentPOS)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = taxAgentPOS.get(0).getId();
// 获取员工id
if (NumberUtils.isCreatable(empIdStr)) {
List<SalaryArchivePO> salaryArchivePOList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(Long.valueOf(empIdStr)).build());
if (CollectionUtils.isNotEmpty(salaryArchivePOList) && !salaryArchivePOList.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.PENDING.getValue())) {
// 存在薪资档案且薪资档案状态不是待定薪修改状态为待定薪
salaryArchivePOList.get(0).setRunStatus(SalaryArchiveStatusEnum.PENDING.getValue());
salaryArchivePOList.get(0).setPayEndDate(null);
getSalaryArchiveMapper().update(salaryArchivePOList.get(0));
}
}
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
//操作人
Map<String, Object> map = getSalaryArchiveWrapper(user).checkSalaryArchiveInit(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;
}
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

@ -1,161 +0,0 @@
package com.engine.salary.action;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @Author: sy
* @Description: 福利档案增员action的前置校验
* @Date: 2023/8/22
**/
@Slf4j
public class CheckStayAddToPaySIArchiveAction implements Action {
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<CheckStayAddToPaySIArchiveAction.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 CheckStayAddToPaySIArchiveAction.SalaryField(processField, salaryName, value));
}
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, CheckStayAddToPaySIArchiveAction.SalaryField::getSalaryName, CheckStayAddToPaySIArchiveAction.SalaryField::getValue);
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
// 获取福利档案
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待增员,无法进行增员操作,请检查后重试!");
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

@ -1,160 +0,0 @@
package com.engine.salary.action;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @Author: sy
* @Description: 福利档案减员action的前置校验
* @Date: 2023/8/22
**/
@Slf4j
public class CheckStayDelToStopSIArchiveAction implements Action {
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<CheckStayDelToStopSIArchiveAction.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 CheckStayDelToStopSIArchiveAction.SalaryField(processField, salaryName, value));
}
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, CheckStayDelToStopSIArchiveAction.SalaryField::getSalaryName, CheckStayDelToStopSIArchiveAction.SalaryField::getValue);
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
// 获取福利档案
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待减员,无法进行减员操作,请检查后重试!");
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

@ -1,177 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
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;
/**
* @author Harryxzy
* @ClassName stopSalaryAction
* @date 2023/06/15 9:17
* @description 校验停薪参数
*/
@Slf4j
public class CheckStopSalaryAction implements Action {
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<CheckStopSalaryAction.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 CheckStopSalaryAction.SalaryField(processField, salaryName, value));
}
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, CheckStopSalaryAction.SalaryField::getSalaryName, CheckStopSalaryAction.SalaryField::getValue);
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentName + "个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
if( importDataMap.get("最后发薪日期") == null || StringUtils.isBlank(importDataMap.get("最后发薪日期").toString())){
requestInfo.getRequestManager().setMessage("缺少最后发薪日期字段!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), "缺少最后发薪日期字段!");
return FAILURE_AND_CONTINUE;
}else if(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()) == null){
requestInfo.getRequestManager().setMessage("最后发薪日期格式错误格式为yyyy-MM-dd");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), "最后发薪日期格式错误格式为yyyy-MM-dd" + importDataMap.get("最后发薪日期").toString());
return FAILURE_AND_CONTINUE;
}
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
// 获取薪资档案
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).deleteType(NumberUtils.INTEGER_ZERO).build());
if(CollectionUtils.isEmpty(salaryArchiveList)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
if(salaryArchiveList.size() > 1){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
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

@ -1,170 +0,0 @@
package com.engine.salary.action;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @Author: sy
* @Description: 拷贝福利档案并置为在缴
* @Date: 2024/1/29
**/
@Slf4j
public class CopyToPaySIArchiveAction implements Action {
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<CopyToPaySIArchiveAction.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 CopyToPaySIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, CopyToPaySIArchiveAction.SalaryField::getSalaryName, CopyToPaySIArchiveAction.SalaryField::getValue));
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(CopyToPaySIArchiveAction.SalaryField::getValue).orElse("1");
//增员
String toCopyTaxAgentName = importData.get(0).get("待复制个税扣缴义务人").toString();
String toUpdateTaxAgentName = importData.get(0).get("待更新个税扣缴义务人").toString();
String payStartYearMonth = importData.get(0).getOrDefault("起始缴纳月", "").toString();
if (StrUtil.isNotBlank(payStartYearMonth) && !SalaryDateUtil.checkYearMonth(payStartYearMonth)) {
requestInfo.getRequestManager().setMessage("起始缴纳月格式有误,正确格式示例为'2021-01'");
return FAILURE_AND_CONTINUE;
}
List<TaxAgentPO> toCopyTaxAgentPOS = getTaxAgentMapper().listByName(toCopyTaxAgentName);
List<TaxAgentPO> toUpdateTaxAgentPOS = getTaxAgentMapper().listByName(toUpdateTaxAgentName);
if(CollectionUtils.isEmpty(toCopyTaxAgentPOS)){
requestInfo.getRequestManager().setMessage("待复制个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
if(CollectionUtils.isEmpty(toUpdateTaxAgentPOS)){
requestInfo.getRequestManager().setMessage("待更新个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long toCopyTaxAgentId = toCopyTaxAgentPOS.get(0).getId();
Long toUpdateTaxAgentId = toUpdateTaxAgentPOS.get(0).getId();
Long employeeId = Long.valueOf(list.stream().filter(f -> "员工id".equals(f.salaryName)).findFirst().map(CopyToPaySIArchiveAction.SalaryField::getValue).orElse("-1"));
User user = new User(Integer.parseInt(uid));
user.setLanguage(7);
//拷贝福利档案并置为在缴
Map<String, Object> resultMap = getSIArchivesService(user).copyToPay(toCopyTaxAgentId, toUpdateTaxAgentId, employeeId, payStartYearMonth);
if (!"success".equals(resultMap.get("type").toString())) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").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

@ -1,152 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @Author: sy
* @Description: 编辑福利档案
* @Date: 2023/8/21
**/
@Slf4j
public class EditSIArchiveAction implements Action {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<EditSIArchiveAction.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 EditSIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, EditSIArchiveAction.SalaryField::getSalaryName, EditSIArchiveAction.SalaryField::getValue));
//福利执行状态
String runStatus = list.stream().filter(f -> f.salaryName.equals("档案状态")).findFirst().map(EditSIArchiveAction.SalaryField::getValue).orElse("1");
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(EditSIArchiveAction.SalaryField::getValue).orElse("1");
Map<String, Object> map = getSISchemeService(new User(Integer.parseInt(uid))).addSIArchive(build);
List errorNotice = (List) map.get("errorData");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("福利档案编辑存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorData");
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

@ -1,147 +0,0 @@
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 org.apache.commons.lang3.StringUtils;
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;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(SalaryField::getValue).orElse("1");
Map<String, Object> map = getSalaryArchiveWrapper(new User(Integer.parseInt(uid))).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

@ -1,198 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 编辑并增员福利档案
* @Date: 2023/9/8
**/
@Slf4j
public class EditToPaySIArchiveAction implements Action {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<EditToPaySIArchiveAction.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 EditToPaySIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, EditToPaySIArchiveAction.SalaryField::getSalaryName, EditToPaySIArchiveAction.SalaryField::getValue));
//福利执行状态
String runStatus = EmployeeStatusEnum.STAY_ADD.getValue();
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(EditToPaySIArchiveAction.SalaryField::getValue).orElse("1");
//更新/新建档案数据
Map<String, Object> map = getSISchemeService(new User(Integer.parseInt(uid))).addSIArchive(build);
List errorNotice = (List) map.get("errorData");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("福利档案编辑并增员存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorData");
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;
}
//增员
String taxAgentName = importData.get(0).get("个税扣缴义务人").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf(taxAgentPOS.get(0).getId());
Long employeeId = Long.valueOf(list.stream().filter(f -> f.salaryName.equals("员工id")).findFirst().map(EditToPaySIArchiveAction.SalaryField::getValue).orElse("-1"));
User user = new User(Integer.parseInt(uid));
// 获取福利档案基础信息
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待增员,无法进行增员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//增员
Map<String, Object> resultMap = getSIArchivesService(user).stayAddToPay(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").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

@ -1,201 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 编辑并减员福利档案
* @Date: 2023/9/8
**/
@Slf4j
public class EditToStopSIArchiveAction implements Action {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<EditToStopSIArchiveAction.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 EditToStopSIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, EditToStopSIArchiveAction.SalaryField::getSalaryName, EditToStopSIArchiveAction.SalaryField::getValue));
//福利执行状态
String runStatus = EmployeeStatusEnum.PAYING.getValue();
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(EditToStopSIArchiveAction.SalaryField::getValue).orElse("1");
User user = new User(Integer.parseInt(uid));
//更新/新建档案数据
Map<String, Object> map = getSISchemeService(new User(Integer.parseInt(uid))).addSIArchive(build);
List errorNotice = (List) map.get("errorData");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("福利档案编辑并减员存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorData");
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;
}
//刷新福利档案状态
getSIArchivesService(user).handleStayDelData(Integer.parseInt(uid));
//减员
String taxAgentName = importData.get(0).get("个税扣缴义务人").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf(taxAgentPOS.get(0).getId());
Long employeeId = Long.valueOf(list.stream().filter(f -> f.salaryName.equals("员工id")).findFirst().map(EditToStopSIArchiveAction.SalaryField::getValue).orElse("-1"));
// 获取福利档案
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待减员,无法进行减员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//减员
Map<String, Object> resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").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

@ -1,83 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.impl.SalaryAcctRecordServiceImpl;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.general.BaseBean;
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;
/**
* @author Harryxzy
* @ClassName FileSalaryAcctRecordAction
* @date 2023/12/13 9:17
* @description 薪资核算记录归档action
*/
@Slf4j
public class FileSalaryAcctRecordAction implements Action {
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String recordIdFieldName;
public String getRecordIdFieldName() {
return recordIdFieldName;
}
public void setRecordIdFieldName(String recordIdFieldName) {
this.recordIdFieldName = recordIdFieldName;
}
@Override
public String execute(RequestInfo requestInfo) {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String salaryAcctRecordId = fieldMap.get(recordIdFieldName);
if (StringUtils.isBlank(salaryAcctRecordId)) {
requestInfo.getRequestManager().setMessage("薪资核算记录不存在");
return FAILURE_AND_CONTINUE;
}
User user = new User();
user.setUid(1);
Long acctRecordId = Long.valueOf(salaryAcctRecordId);
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(acctRecordId);
if (salaryAcctRecordPO == null) {
requestInfo.getRequestManager().setMessage("薪资核算记录不存在,或已被删除");
return FAILURE_AND_CONTINUE;
}
if (salaryAcctRecordPO.getStatus() > 1) {
BaseBean baseBean = new BaseBean();
baseBean.writeLog("核算记录归档action 该核算记录已经归档:" + salaryAcctRecordPO.getId());
return SUCCESS;
}
try {
getSalaryAcctRecordService(user).file(acctRecordId);
} catch (Exception e) {
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -1,216 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
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.*;
import java.util.stream.Collectors;
@Slf4j
public class InitSalaryAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private SalaryArchiveMapper getSalaryArchiveMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
}
private String tableName;
private String archiveStatus;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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));
}
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue);
return doSalaryArchiveInit(requestInfo, importDataMap);
} catch (Exception e) {
log.error("定薪异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
}
public String doSalaryArchiveInit(RequestInfo requestInfo, Map<String, Object> importDataMap) {
User user = new User();
user.setLoginid("sysadmin");
user.setUid(1);
List<Map<String, Object>> importData = new ArrayList<>();
if(!importDataMap.containsKey("生效日期")){
importDataMap.put("生效日期", SalaryDateUtil.getFormatDate(new Date()));
}
if(!importDataMap.containsKey("最后发薪日期")){
importDataMap.put("最后发薪日期", "");
}
importData.add(importDataMap);
// 首先判断是否已经存在薪资档案且薪资档案状态为待定薪
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
String empIdStr = importDataMap.getOrDefault("员工id", "").toString();
if (StringUtils.isBlank(taxAgentName)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不能为空");
return FAILURE_AND_CONTINUE;
}
// 获取义务人信息
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(taxAgentName).build());
if (CollectionUtils.isEmpty(taxAgentPOS)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = taxAgentPOS.get(0).getId();
// 获取员工id
if (NumberUtils.isCreatable(empIdStr)) {
List<SalaryArchivePO> salaryArchivePOList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(Long.valueOf(empIdStr)).build());
if (CollectionUtils.isNotEmpty(salaryArchivePOList) && !salaryArchivePOList.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.PENDING.getValue())) {
// 存在薪资档案且薪资档案状态不是待定薪修改状态为待定薪
salaryArchivePOList.get(0).setRunStatus(SalaryArchiveStatusEnum.PENDING.getValue());
salaryArchivePOList.get(0).setPayEndDate(null);
getSalaryArchiveMapper().update(salaryArchivePOList.get(0));
}
}
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
if (StringUtils.isNotBlank(archiveStatus) && archiveStatus.equals(SalaryArchiveStatusEnum.PENDING.getValue())) {
build.setKeepStatus(true);
}
//操作人
String uid = importDataMap.getOrDefault("操作人", "1").toString();
Map<String, Object> map = getSalaryArchiveWrapper(new User(Integer.parseInt(uid))).importSalaryArchiveInit(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;
}
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

@ -1,261 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.TaxAgentManageRangeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
import com.engine.salary.service.impl.TaxAgentManageRangeServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.*;
import java.util.stream.Collectors;
@Slf4j
public class RehireAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private SalaryArchiveMapper getSalaryArchiveMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
User user = new User(1);
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
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));
}
Map<String, Object> salaryFieldMap = SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue);
String taxAgentName = salaryFieldMap.getOrDefault("个税扣缴义务人", "").toString();
String empIdStr = salaryFieldMap.getOrDefault("员工id", "").toString();
if (StringUtils.isBlank(taxAgentName) || StringUtils.isBlank(empIdStr)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人、或员工id不能为空");
return FAILURE_AND_CONTINUE;
}
// 获取义务人信息
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(taxAgentName).build());
if (CollectionUtils.isEmpty(taxAgentPOS)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在");
return FAILURE_AND_CONTINUE;
}
// 先获取该个税扣缴义务人下该员工的薪资档案
Long taxAgentId = taxAgentPOS.get(0).getId();
Long employeeId = Long.valueOf(empIdStr);
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).build());
if (CollectionUtils.isEmpty(salaryArchivePOS) || salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.PENDING.getValue())){
// 直接走定薪action生成档案
InitSalaryAction initSalaryAction = new InitSalaryAction();
return initSalaryAction.doSalaryArchiveInit(requestInfo, salaryFieldMap);
// requestInfo.getRequestManager().setMessage("该个税扣缴义务人下,该员工不存在薪资档案!");
// return FAILURE_AND_CONTINUE;
} else if (salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue())) {
// 先把状态变成待定薪然后走定薪action
salaryArchivePOS.get(0).setRunStatus(SalaryArchiveStatusEnum.PENDING.getValue());
salaryArchivePOS.get(0).setPayEndDate(null);
getSalaryArchiveMapper().update(salaryArchivePOS.get(0));
InitSalaryAction initSalaryAction = new InitSalaryAction();
return initSalaryAction.doSalaryArchiveInit(requestInfo, salaryFieldMap);
// requestInfo.getRequestManager().setMessage("该个税扣缴义务人下,该员工没有发过薪。需取消停薪后,申请定薪流程!");
// return FAILURE_AND_CONTINUE;
} else {
if (salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue())) {
// 停薪来自待停薪 1取消停薪
getSalaryArchiveWrapper(user).cancelStop(Collections.singletonList(salaryArchivePOS.get(0).getId()));
}
if (salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()) ||
salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.SUSPEND.getValue())) {
// 1如果不在人员范围内则把他加入义务人的人员范围2删除待办
addTaxAgentRangeIfNotExist(taxAgentId, employeeId, user);
getSalaryArchiveWrapper(user).deleteSuspendTodo(Collections.singletonList(salaryArchivePOS.get(0).getId()));
}
// 调薪
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue));
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(RehireAction.SalaryField::getValue).orElse("1");
Map<String, Object> map = getSalaryArchiveWrapper(new User(Integer.parseInt(uid))).adjustmentSalaryArchive(build);
List errorNotice = (List) map.get("errorNotice");
if (CollectionUtils.isNotEmpty(errorNotice)) {
// 回滚档案状态
getSalaryArchiveMapper().update(salaryArchivePOS.get(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;
}
// 如果有起始发薪日期字段则更新档案的起始发薪日期
String startPayDate = salaryFieldMap.getOrDefault("起始发薪日期", "").toString();
if (StringUtils.isNotBlank(startPayDate)) {
Date date = SalaryDateUtil.dateStrToLocalDate(startPayDate);
if (date != null) {
Long salaryArchiveId = salaryArchivePOS.get(0).getId();
getSalaryArchiveMapper().updatePayStartDateById(salaryArchiveId, date);
}
}
}
} catch (Exception e) {
log.error("返聘调薪异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
private void addTaxAgentRangeIfNotExist(Long taxAgentId, Long employeeId, User user){
// 获取该义务人下人员范围
Collection<Long> empIds = getTaxAgentService(user).listEmployeeIdsInTaxAgent(taxAgentId);
if (!empIds.contains(employeeId)) {
//将人员添加进个税扣缴义务人中
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);
getTaxAgentManageRangeService(user).save(taxAgentRangeSaveParam);
}
}
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

@ -1,64 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.impl.SalaryAcctRecordServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
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;
/**
* @Author: sy
* @Description: 通过薪资核算id归档台账记录
* @Date: 2023/7/18
**/
@Slf4j
public class SalaryAcctFileByIdAction implements Action {
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private String acctRecordId;
public String getAcctRecordId() {
return acctRecordId;
}
public void setAcctRecordId(String acctRecordId) {
this.acctRecordId = acctRecordId;
}
@Override
public String execute(RequestInfo requestInfo) {
User user = requestInfo.getRequestManager().getUser();
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
Long salaryAcctId = StringUtils.isNotBlank(fieldMap.get(acctRecordId)) ? Long.parseLong(fieldMap.get(acctRecordId)) : 0L;
if (!salaryAcctId.equals(0L)) {
try {
getSalaryAcctRecordService(user).file(salaryAcctId);
} catch (Exception e) {
log.error("薪资核算归档异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
} else {
requestInfo.getRequestManager().setMessage(SalaryI18nUtil.getI18nLabel(542300, "薪资核算记录不存在或已被删除"));
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -1,136 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.biz.SalarySendInfoBiz;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import com.engine.salary.entity.salaryBill.po.SalarySendPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.SalaryBillService;
import com.engine.salary.service.SalarySendService;
import com.engine.salary.service.SalaryTemplateService;
import com.engine.salary.service.impl.SalaryAcctRecordServiceImpl;
import com.engine.salary.service.impl.SalaryBillServiceImpl;
import com.engine.salary.service.impl.SalarySendServiceImpl;
import com.engine.salary.service.impl.SalaryTemplateServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @author Harryxzy
* @ClassName FileSalaryAcctRecordAction
* @date 2023/12/13 9:17
* @description 工资单发放action
*/
@Slf4j
public class SendSalaryAction implements Action {
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private SalarySendService getSalarySendService(User user) {
return ServiceUtil.getService(SalarySendServiceImpl.class, user);
}
private SalaryTemplateService getSalaryTemplateService(User user) {
return ServiceUtil.getService(SalaryTemplateServiceImpl.class, user);
}
private SalarySendInfoBiz salarySendInfoMapper = new SalarySendInfoBiz();
private SalaryBillService getSalaryBillService(User user) {
return ServiceUtil.getService(SalaryBillServiceImpl.class, user);
}
/**
* 发放id核算记录id工资单id流程字段名
*/
private String idFieldName;
/**
* 根据什么id核算记录id工资单id发工资单
*/
private String sendBy;
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@Override
public String execute(RequestInfo requestInfo) {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
String idStr = fieldMap.get(idFieldName);
if (StringUtils.isBlank(idStr)) {
requestInfo.getRequestManager().setMessage("核算记录id或工资单id不能为空");
return FAILURE_AND_CONTINUE;
}
User user = new User();
user.setUid(1);
Long id = Long.valueOf(idStr);
SalarySendPO salarySendPO;
if(!org.h2.util.StringUtils.isNullOrEmpty(sendBy) && sendBy.equals("salaryAcctRecordId")) {
// 根据核算记录id发
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(id);
if (salaryAcctRecordPO == null) {
requestInfo.getRequestManager().setMessage("薪资核算记录不存在,或已被删除");
return FAILURE_AND_CONTINUE;
}
if (salaryAcctRecordPO.getStatus() == 1) {
requestInfo.getRequestManager().setMessage("核算记录还未归档,请先归档");
return FAILURE_AND_CONTINUE;
}
// 获取工资单id
List<SalarySendPO> salarySendPOList = getSalarySendService(user).listSome(SalarySendPO.builder().salaryAccountingId(id).sendStatus(0).build());
salarySendPO = salarySendPOList.get(0);
} else if (!org.h2.util.StringUtils.isNullOrEmpty(sendBy) && sendBy.equals("salarySendId")) {
// 根据工资单发
salarySendPO = getSalarySendService(user).getById(id);
} else {
requestInfo.getRequestManager().setMessage("请先维护根据什么id发放工资单的sendBy参数");
return FAILURE_AND_CONTINUE;
}
if (salarySendPO == null || salarySendPO.getId() == null) {
requestInfo.getRequestManager().setMessage("工资单不存在或已被删除!");
return FAILURE_AND_CONTINUE;
}
try {
// 全部发放
getSalaryBillService(user).grant(SalarySendGrantParam.builder().salarySendId(salarySendPO.getId()).build());
} catch (Exception e) {
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -1,171 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 福利档案增员action
* @Date: 2023/8/22
**/
@Slf4j
public class StayAddToPaySIArchiveAction implements Action {
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<StayAddToPaySIArchiveAction.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 StayAddToPaySIArchiveAction.SalaryField(processField, salaryName, value));
}
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, StayAddToPaySIArchiveAction.SalaryField::getSalaryName, StayAddToPaySIArchiveAction.SalaryField::getValue);
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf(taxAgentPOS.get(0).getId());
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
// 获取福利档案基础信息
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待增员,无法进行增员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//增员
Map<String, Object> resultMap = getSIArchivesService(user).stayAddToPay(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").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

@ -1,196 +0,0 @@
package com.engine.salary.action;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 福利档案减员action
* @Date: 2023/8/22
**/
@Slf4j
public class StayDelToStopSIArchiveAction implements Action {
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<StayDelToStopSIArchiveAction.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 StayDelToStopSIArchiveAction.SalaryField(processField, salaryName, value));
}
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, StayDelToStopSIArchiveAction.SalaryField::getSalaryName, StayDelToStopSIArchiveAction.SalaryField::getValue);
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
String payEndYearMonth = importDataMap.getOrDefault("最后缴纳月", "").toString();
// 如果只有一个最后缴纳月 代表社保公积金其他均使用同一个最后缴纳月
String fundEndYearMonth = importDataMap.getOrDefault("公积金最后缴纳月", "").toString();
String otherEndYearMonth = importDataMap.getOrDefault("其他福利最后缴纳月", "").toString();
if (StrUtil.isNotBlank(payEndYearMonth) && !SalaryDateUtil.checkYearMonth(payEndYearMonth)) {
requestInfo.getRequestManager().setMessage("最后缴纳月格式有误,正确格式示例为'2021-01'");
return FAILURE_AND_CONTINUE;
}
if (StrUtil.isNotBlank(fundEndYearMonth) && !SalaryDateUtil.checkYearMonth(fundEndYearMonth)) {
requestInfo.getRequestManager().setMessage("公积金最后缴纳月格式有误,正确格式示例为'2021-01'");
return FAILURE_AND_CONTINUE;
}
if (StrUtil.isNotBlank(otherEndYearMonth) && !SalaryDateUtil.checkYearMonth(otherEndYearMonth)) {
requestInfo.getRequestManager().setMessage("其他福利最后缴纳月格式有误,正确格式示例为'2021-01'");
return FAILURE_AND_CONTINUE;
}
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
// 获取福利档案
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(StrUtil.isBlank(payEndYearMonth) && !insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待减员,无法进行减员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//减员
Map<String, Object> resultMap = new HashMap<>();
if (StrUtil.isBlank(payEndYearMonth)) {
resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
} else {
resultMap = getSIArchivesService(user).stopWithoutLimit(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()), payEndYearMonth, fundEndYearMonth, otherEndYearMonth);
}
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").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

@ -1,203 +0,0 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.mzlion.core.utils.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
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.*;
import java.util.stream.Collectors;
/**
* @author Harryxzy
* @ClassName stopSalaryAction
* @date 2023/06/15 9:17
* @description 停薪处理
*/
@Slf4j
public class StopSalaryAction implements Action {
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private SalaryArchiveMapper getSalaryArchiveMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@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 enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<StopSalaryAction.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 StopSalaryAction.SalaryField(processField, salaryName, value));
}
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, StopSalaryAction.SalaryField::getSalaryName, StopSalaryAction.SalaryField::getValue);
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
String taxAgentName = importDataMap.getOrDefault("个税扣缴义务人", "").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentName + "个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
if( importDataMap.get("最后发薪日期") == null || StringUtils.isBlank(importDataMap.get("最后发薪日期").toString())){
requestInfo.getRequestManager().setMessage("缺少最后发薪日期字段!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), "缺少最后发薪日期字段!");
return FAILURE_AND_CONTINUE;
}else if(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()) == null){
requestInfo.getRequestManager().setMessage("最后发薪日期格式错误格式为yyyy-MM-dd");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), "最后发薪日期格式错误格式为yyyy-MM-dd" + importDataMap.get("最后发薪日期").toString());
return FAILURE_AND_CONTINUE;
}
// 获取薪资档案
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).deleteType(NumberUtils.INTEGER_ZERO).build());
if(CollectionUtils.isEmpty(salaryArchiveList)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
if(salaryArchiveList.size() > 1){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
// 设置最后发薪日期
SalaryArchivePO salaryArchivePO = salaryArchiveList.get(0);
SalaryArchivePO updatePO = new SalaryArchivePO();
BeanUtils.copyProperties(salaryArchivePO,updatePO);
if(StringUtils.equals(salaryArchivePO.getRunStatus(), SalaryArchiveStatusEnum.FIXED.getValue()) || StringUtils.equals(salaryArchivePO.getRunStatus(), SalaryArchiveStatusEnum.SUSPEND.getValue())){
// 发薪待停薪员工设置最后发薪日期
updatePO.setRunStatus(SalaryArchiveStatusEnum.SUSPEND.getValue());
updatePO.setPayEndDate(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()));
updatePO.setUpdateTime(new Date());
getSalaryArchiveMapper().update(updatePO);
// 停薪
getSalaryArchiveService(user).gotoStop(Collections.singletonList(updatePO.getId()));
}else{
// 待定薪员工保存最后发薪日期
updatePO.setPayEndDate(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()));
updatePO.setUpdateTime(new Date());
getSalaryArchiveMapper().update(updatePO);
getSalaryArchiveService(user).deletePendingTodo(Collections.singletonList(updatePO.getId()));
}
} 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

@ -1,272 +0,0 @@
package com.engine.salary.action;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.enums.sicategory.IsUseEnum;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;
import weaver.workflow.request.RequestManager;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 更新福利方案明细信息action
* @Date: 2023/9/18
**/
@Slf4j
public class UpdateSISchemeDetailAction implements Action {
private EncryptUtil encryptUtil = new EncryptUtil();
private InsuranceSchemeMapper getInsuranceSchemeMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private ICategoryMapper getICategoryMapper() {
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
// 是否执行action的字段, 0代表不执行其余代表执行
private String enableField;
public String getEnableField() {
return enableField;
}
public void setEnableField(String enableField) {
this.enableField = enableField;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
RequestManager requestManager = requestInfo.getRequestManager();
User user = requestManager.getUser();
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String enable = fieldMap.get(enableField);
if (StringUtils.isNotBlank(enable) && enable.equals("0")) {
// 不执行action
return SUCCESS;
}
DetailTable[] detailTables = requestInfo.getDetailTableInfo().getDetailTable();
List<Map<String, String>> detailList = new ArrayList<>();
if (detailTables.length > 0) {
for(DetailTable dt : detailTables) {
Row[] s = dt.getRow();
for (Row r : s) {
Cell[] c = r.getCell();
Map<String, String> detailMap = Arrays.stream(c).collect(Collectors.toMap(Cell::getName,
property -> Util.null2String(property.getValue())));
detailList.add(detailMap);
}
}
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
//遍历取出明细表中对应数据
int detailNo = 0;
List<ICategoryPO> listAll = getICategoryMapper().listAll().stream().filter(f -> f.getIsUse().equals(IsUseEnum.START.getValue())).collect(Collectors.toList());
List<InsuranceSchemePO> schemeList = getInsuranceSchemeMapper().listAll();
List<InsuranceSchemeDetailPO> updateSchemeDetails = new ArrayList<>();
for (Map<String, String> map : detailList) {
detailNo++;
List<UpdateSISchemeDetailAction.SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = map.get(processField);
list.add(new UpdateSISchemeDetailAction.SalaryField(processField, salaryName, value));
}
rs.beforFirst();
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, UpdateSISchemeDetailAction.SalaryField::getSalaryName, UpdateSISchemeDetailAction.SalaryField::getValue);
//设置更新对象元素
String schemeId = importDataMap.getOrDefault("福利方案id", "").toString();
String schemeName = importDataMap.getOrDefault("福利方案名称", "").toString();
//查询福利方案
InsuranceSchemePO targetSchemePO = new InsuranceSchemePO();
if (StringUtils.isNotBlank(schemeId)) {
targetSchemePO = schemeList.stream().filter(f -> f.getId().equals(Long.valueOf(schemeId))).findFirst().orElse(null);
} else if (StringUtils.isNotBlank(schemeName)) {
targetSchemePO = schemeList.stream().filter(f -> f.getSchemeName().equals(schemeName)).findFirst().orElse(null);
} else {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利方案id和福利方案名称至少填写一个");
return FAILURE_AND_CONTINUE;
}
if (targetSchemePO == null) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利方案id和福利方案名称信息有误无法匹配到已有福利方案");
return FAILURE_AND_CONTINUE;
}
//查询福利方案下的福利项明细
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(targetSchemePO.getId());
if (insuranceSchemeDetailPOS.size() > 0) {
encryptUtil.decryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
} else {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "该福利方案不存在福利项明细,无法进行修改!");
return FAILURE_AND_CONTINUE;
}
String paymentScope = importDataMap.getOrDefault("缴纳对象", "").toString();
if (StringUtils.isBlank(paymentScope)) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "缴纳对象必填!");
return FAILURE_AND_CONTINUE;
}
String insuranceId = importDataMap.getOrDefault("福利项id", "").toString();
String insuranceName = importDataMap.getOrDefault("福利项名称", "").toString();
InsuranceSchemeDetailPO targetSchemeDetailPO = new InsuranceSchemeDetailPO();
if (StringUtils.isNotBlank(insuranceId)) {
targetSchemeDetailPO = insuranceSchemeDetailPOS.stream()
.filter(f -> f.getInsuranceId().equals(Long.valueOf(insuranceId)) && f.getPaymentScope().equals(Integer.valueOf(paymentScope)))
.findFirst().orElse(null);
} else if (StringUtils.isNotBlank(insuranceName)) {
List<ICategoryPO> targetCategoryPOs = listAll.stream().filter(f -> f.getInsuranceName().equals(insuranceName)).collect(Collectors.toList());
if (targetCategoryPOs .size() == 1) {
targetSchemeDetailPO = insuranceSchemeDetailPOS.stream()
.filter(f -> f.getInsuranceId().equals(targetCategoryPOs.get(0).getId()) && f.getPaymentScope().equals(Integer.valueOf(paymentScope)))
.findFirst().orElse(null);
} else if (targetCategoryPOs.size() > 1) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利项名称匹配到多个福利项!");
return FAILURE_AND_CONTINUE;
}
} else {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利项id和福利项名称至少填写一个");
return FAILURE_AND_CONTINUE;
}
if (targetSchemeDetailPO == null) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利项id和福利项名称信息有误无法匹配到方案已有福利项");
return FAILURE_AND_CONTINUE;
}
String isPayment = importDataMap.getOrDefault("是否缴费", "").toString();
if (StringUtils.isNotBlank(isPayment)) {
targetSchemeDetailPO.setIsPayment(Integer.valueOf(isPayment));
}
String upperLimit = importDataMap.getOrDefault("基数上限", "").toString();
if (StringUtils.isNotBlank(upperLimit)) {
targetSchemeDetailPO.setUpperLimit(upperLimit);
}
String lowerLimit = importDataMap.getOrDefault("基数下限", "").toString();
if (StringUtils.isNotBlank(lowerLimit)) {
targetSchemeDetailPO.setLowerLimit(lowerLimit);
}
String paymentProportion = importDataMap.getOrDefault("缴纳比例", "").toString();
if (StringUtils.isNotBlank(paymentProportion)) {
targetSchemeDetailPO.setPaymentProportion(paymentProportion);
}
String fixedCost = importDataMap.getOrDefault("固定费用", "").toString();
if (StringUtils.isNotBlank(fixedCost)) {
targetSchemeDetailPO.setFixedCost(fixedCost);
}
String validNum = importDataMap.getOrDefault("有效小数位", "").toString();
if (StringUtils.isNotBlank(validNum)) {
targetSchemeDetailPO.setValidNum(Integer.valueOf(validNum));
}else {
targetSchemeDetailPO.setValidNum(2);
}
String rententionRule = importDataMap.getOrDefault("进位规则", "").toString();
if (StringUtils.isNotBlank(rententionRule)) {
targetSchemeDetailPO.setRententionRule(Integer.valueOf(rententionRule));
}
targetSchemeDetailPO.setUpdateTime(new Date());
updateSchemeDetails.add(targetSchemeDetailPO);
}
//更新方案明细
if (updateSchemeDetails.size() > 0) {
encryptUtil.encryptList(updateSchemeDetails, InsuranceSchemeDetailPO.class);
updateSchemeDetails.forEach(getInsuranceSchemeDetailMapper()::updateAll);
}
} 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

@ -1,78 +0,0 @@
package com.engine.salary.action;
import cn.hutool.core.util.NumberUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
import com.engine.salary.service.SalaryAcctRecordService;
import com.engine.salary.service.impl.SalaryAcctRecordServiceImpl;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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;
/**
* @ClassName updateSalaryApprovalStatusAction
* @author Harryxzy
* @date 2024/4/24 15:44
* @description 跟新薪资核算审批状态
*/
@Slf4j
public class updateSalaryApprovalStatusAction implements Action {
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
private SalaryAcctRecordMapper getSalaryAcctRecordMapper() {
return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class);
}
// 记录薪资核算记录id的字段
private String salaryAcctRecordIdField;
// 修改为对应的状态
private String status;
@Override
public String execute(RequestInfo requestInfo) {
try {
if (StringUtils.isEmpty(salaryAcctRecordIdField)) {
requestInfo.getRequestManager().setMessage("薪资核算记录id字段不能为空");
return FAILURE_AND_CONTINUE;
}
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
String salaryAcctRecordId = fieldMap.get(salaryAcctRecordIdField);
if (!NumberUtil.isNumber(salaryAcctRecordId)) {
requestInfo.getRequestManager().setMessage("核算记录id不为数字");
return FAILURE_AND_CONTINUE;
}
User user = new User();
user.setUid(1);
user.setLoginid("sysadmin");
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(Long.valueOf(salaryAcctRecordId));
if (salaryAcctRecordPO == null) {
requestInfo.getRequestManager().setMessage("核算记录不存在或已被删除");
return FAILURE_AND_CONTINUE;
}
salaryAcctRecordPO.setApprovalStatus(status);
getSalaryAcctRecordMapper().updateIgnoreNull(salaryAcctRecordPO);
} catch (Exception e) {
log.error("审批状态更新失败", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
}

View File

@ -1,29 +0,0 @@
package com.engine.salary.annotation;
import com.engine.salary.enums.auth.AuthCheckTypeEnum;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 权限验证字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Auth {
String page();
AuthCheckTypeEnum checkType() default AuthCheckTypeEnum.TAX_EMP;
String taxAgentIdField() default "taxAgentId";
String employeeIdField() default "employeeId";
String sobIdField() default "salarySobId";
String optsField() default "opts";
}

View File

@ -1,22 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 权限验证字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthField {
String fieldType();
}

View File

@ -1,20 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 权限验证字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthOpt {
}

View File

@ -1,20 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 加密字段用于标注需加解密的字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Encrypt {
}

View File

@ -1,20 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 国际化标识
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface I18n {
}

View File

@ -1,27 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 薪资公式计算器-变量
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface SalaryFormulaVar {
int labelId();
String defaultLabel();
String dataType();
String fieldId() default "";
}

View File

@ -1,69 +0,0 @@
package com.engine.salary.annotation;
import com.cloudstore.eccom.pc.table.WeaTableType;
import java.lang.annotation.*;
/**
* 数据列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SalaryTable {
String pageId() default "";
/**
* 数据库字段','分割,例如:"id, name, description"
*/
String fields() default "";
/**
* 表名 ,例如:"FROM hrsa_tax_agent"
*/
String fromSql() default "";
/**
* 条件
*/
String where() default "";
/**
* 分组
*/
String groupby() default "";
/**
* 排序
*/
String orderby() default "";
/**
* 主键
*/
String primarykey() default "";
/**
* 去重
*/
boolean distinct() default false;
/**
* 操作按钮
*/
SalaryTableOperate[] operates() default {};
/**
* 列表选择框
*/
WeaTableType tableType() default WeaTableType.NONE;
}

View File

@ -1,34 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.*;
/**
* 数据列表表头
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SalaryTableColumn {
String text() default "";
int labelId() default -1;
String width() default "";
String column() default "";
boolean display() default true;
String orderkey() default "";
String transmethod() default "";
// 额外参数
String otherPara() default "";
}

View File

@ -1,27 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.*;
/**
* 列表操作按钮
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target({ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SalaryTableOperate {
String text() default "";
int labelId() default -1;
String href() default "";
String index() default "0";
}

View File

@ -1,13 +0,0 @@
package com.engine.salary.annotation;
import java.lang.annotation.*;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface TableTitle {
String title();
String dataIndex();
String key();
boolean display() default true;
}

View File

@ -1,171 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import java.util.ArrayList;
import java.util.List;
public class AddUpDeductionBiz extends BaseBean {
private final EncryptUtil encryptUtil = new EncryptUtil();
/**
* 关联查询查询列表
*
* @param param
* @return
*/
public List<AddUpDeductionDTO> list(AddUpDeductionQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
List<AddUpDeductionDTO> list = mapper.list(param);
encryptUtil.decryptList(list, AddUpDeductionDTO.class);
SalaryI18nUtil.i18nList(list);
return list;
} finally {
sqlSession.close();
}
}
/**
* 条件查询
*
* @param param
* @return
*/
public List<AddUpDeduction> listSome(AddUpDeduction param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
if (CollectionUtils.isNotEmpty(param.getEmployeeIds())) {
List<AddUpDeduction> addUpDeductions = new ArrayList<>();
List<List<Long>> partition = Lists.partition(param.getEmployeeIds(), 500);
partition.forEach(l -> {
param.setEmployeeIds(l);
addUpDeductions.addAll(mapper.listSome(param));
});
return encryptUtil.decryptList(addUpDeductions, AddUpDeduction.class);
} else {
List<AddUpDeduction> addUpDeductions = mapper.listSome(param);
return encryptUtil.decryptList(addUpDeductions, AddUpDeduction.class);
}
} finally {
sqlSession.close();
}
}
/**
* 根据id获取
*
* @param id
* @return
*/
public AddUpDeduction getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
AddUpDeduction byId = mapper.getById(id);
return encryptUtil.decrypt(byId, AddUpDeduction.class);
} finally {
sqlSession.close();
}
}
/**
* 详情列表
*
* @param param
* @return
*/
public List<AddUpDeductionRecordDTO> recordList(AddUpDeductionQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
List<AddUpDeductionRecordDTO> addUpDeductionRecordStrDTOS = mapper.recordList(param);
encryptUtil.decryptList(addUpDeductionRecordStrDTOS, AddUpDeductionRecordDTO.class);
SalaryI18nUtil.i18nList(addUpDeductionRecordStrDTOS);
return addUpDeductionRecordStrDTOS;
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchSave(List<AddUpDeduction> param) {
if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
encryptUtil.encryptList(param, AddUpDeduction.class);
List<List<AddUpDeduction>> partition = Lists.partition(param, 100);
partition.forEach(mapper::insertData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchUpdate(List<AddUpDeduction> param) {
if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
encryptUtil.encryptList(param, AddUpDeduction.class);
List<List<AddUpDeduction>> partition = Lists.partition(param, 100);
partition.forEach(mapper::updateData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchDeleteByIDS(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
List<List<Long>> partition = Lists.partition(ids, 100);
partition.forEach(mapper::deleteData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,191 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import java.util.*;
import java.util.stream.Collectors;
public class AddUpSituationBiz extends BaseBean {
private EncryptUtil encryptUtil = new EncryptUtil();
/**
* 条件查询
*
* @param param
* @return
*/
public List<AddUpSituation> listSome(AddUpSituation param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
if (CollectionUtils.isNotEmpty(param.getEmployeeIds())) {
List<AddUpSituation> addUpSituations = new ArrayList<>();
List<List<Long>> partition = Lists.partition((List<Long>) param.getEmployeeIds(), 500);
partition.forEach(l -> {
param.setEmployeeIds(l);
addUpSituations.addAll(mapper.listSome(param));
});
return encryptUtil.decryptList(addUpSituations, AddUpSituation.class);
} else {
List<AddUpSituation> addUpSituations = mapper.listSome(param);
return encryptUtil.decryptList(addUpSituations, AddUpSituation.class);
}
} finally {
sqlSession.close();
}
}
/**
* 根据id获取
*
* @param id
* @return
*/
public AddUpSituation getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
AddUpSituation byId = mapper.getById(id);
return encryptUtil.decrypt(byId, AddUpSituation.class);
} finally {
sqlSession.close();
}
}
/**
* 详情列表
*
* @param param
* @return
*/
public List<AddUpSituationRecordDTO> recordList(AddUpSituationQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
List<AddUpSituationRecordDTO> addUpSituationRecordDTOS = mapper.recordList(param);
return encryptUtil.decryptList(addUpSituationRecordDTOS, AddUpSituationRecordDTO.class);
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchSave(List<AddUpSituation> param) {
if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
encryptUtil.encryptList(param, AddUpSituation.class);
List<List<AddUpSituation>> partition = Lists.partition(param, 50);
partition.forEach(mapper::insertData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchUpdate(List<AddUpSituation> param) {
if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
encryptUtil.encryptList(param, AddUpSituation.class);
List<List<AddUpSituation>> partition = Lists.partition(param, 50);
partition.forEach(mapper::updateData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void handleImportData(List<AddUpSituation> pos) {
if (CollectionUtils.isEmpty(pos)) {
return;
}
AddUpSituation po = pos.get(0);
// 多条相同人的则以第一条为准如果逆序排列用于重复的则以最后一条为准Collections.reverse(pos);
// 去重通过记录的唯一条件(申报月份人员id个税扣缴义务人id)拼接
List<AddUpSituation> finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
// 查询已有数据
List<AddUpSituation> list = listSome(AddUpSituation.builder().taxYearMonth(po.getTaxYearMonth()).build());
// 待修改的 本地已存在则更新交集
List<AddUpSituation> updateList = list.stream().map(m -> {
Optional<AddUpSituation> optional = finalPos.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
AddUpSituation temp = null;
if (optional.isPresent()) {
temp = optional.get();
// 换成本地库的id
temp.setId(m.getId());
}
return temp;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 待新增的 导入比本地多则新增差集(导入 - local)
List<AddUpSituation> saveList = finalPos.stream().map(m -> {
Optional<AddUpSituation> optional = list.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
AddUpSituation temp = null;
if (!optional.isPresent()) {
temp = m;
}
return temp;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 修改
if (CollectionUtils.isNotEmpty(updateList)) {
batchUpdate(updateList);
}
// 保存
if (CollectionUtils.isNotEmpty(saveList)) {
batchSave(saveList);
}
}
/**
* @return void
* @description 批量删除数据
* @author Harryxzy
* @date 2022/10/27 22:39
*/
public void batchDeleteByIDS(List<Long> deleteIds) {
if (CollectionUtils.isEmpty(deleteIds)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
List<List<Long>> partition = Lists.partition(deleteIds, 100);
partition.forEach(mapper::deleteData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,66 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
import com.engine.salary.entity.datacollection.po.AttendQuotePO;
import com.engine.salary.mapper.datacollection.AttendQuoteMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class AttendQuoteBiz {
public List<AttendQuoteListDTO> list(AttendQuoteQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteMapper mapper = sqlSession.getMapper(AttendQuoteMapper.class);
return mapper.list(param);
} finally {
sqlSession.close();
}
}
public void deleteByIds(List<Long> unAccountingIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteMapper mapper = sqlSession.getMapper(AttendQuoteMapper.class);
mapper.deleteByIds(unAccountingIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<AttendQuotePO> listSome(AttendQuotePO param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteMapper mapper = sqlSession.getMapper(AttendQuoteMapper.class);
return mapper.listSome(param);
} finally {
sqlSession.close();
}
}
public void updateById(AttendQuotePO attendQuote) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteMapper mapper = sqlSession.getMapper(AttendQuoteMapper.class);
mapper.updateIgnoreNull(attendQuote);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void insert(AttendQuotePO attendQuote) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteMapper mapper = sqlSession.getMapper(AttendQuoteMapper.class);
mapper.insertIgnoreNull(attendQuote);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,67 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.dto.AttendQuoteDataBaseDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteDataQueryParam;
import com.engine.salary.entity.datacollection.po.AttendQuoteDataPO;
import com.engine.salary.mapper.datacollection.AttendQuoteDataMapper;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class AttendQuoteDataBiz {
public List<AttendQuoteDataBaseDTO> list(AttendQuoteDataQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataMapper mapper = sqlSession.getMapper(AttendQuoteDataMapper.class);
List<AttendQuoteDataBaseDTO> list = mapper.list(param);
return SalaryI18nUtil.i18nList(list);
} finally {
sqlSession.close();
}
}
public List<AttendQuoteDataPO> listSome(AttendQuoteDataQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataMapper mapper = sqlSession.getMapper(AttendQuoteDataMapper.class);
return mapper.listSome(param);
} finally {
sqlSession.close();
}
}
public void deleteByAttendQuoteIds(List<Long> unAccountingIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataMapper mapper = sqlSession.getMapper(AttendQuoteDataMapper.class);
mapper.deleteByAttendQuoteIds(unAccountingIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void insertData(List<AttendQuoteDataPO> pos) {
if(CollectionUtils.isEmpty(pos)){
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataMapper mapper = sqlSession.getMapper(AttendQuoteDataMapper.class);
List<List<AttendQuoteDataPO>> partition = Lists.partition(pos, 100);
partition.forEach(mapper::insertData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,93 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.po.AttendQuoteDataValuePO;
import com.engine.salary.mapper.datacollection.AttendQuoteDataValueMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.ArrayList;
import java.util.List;
public class AttendQuoteDataValueBiz {
/**
* 根据考勤引用字段表的主键id删除
*
* @param attendQuoteDataIds
*/
public void deleteByAttendQuoteDataIds(List<Long> attendQuoteDataIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
List<List<Long>> partition = Lists.partition(attendQuoteDataIds, 500);
partition.forEach(mapper::deleteByAttendQuoteDataIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<AttendQuoteDataValuePO> listSome(AttendQuoteDataValuePO param) {
List<AttendQuoteDataValuePO> list = new ArrayList<>();
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
List<Long> employeeIds = param.getEmployeeIds();
if (CollectionUtils.isNotEmpty(employeeIds)) {
List<List<Long>> partition = Lists.partition(employeeIds, 100);
partition.forEach(empIds -> {
param.setEmployeeIds(empIds);
list.addAll(mapper.listSome(param));
});
} else {
list.addAll(mapper.listSome(param));
}
} finally {
sqlSession.close();
}
return list;
}
public void insertData(List<AttendQuoteDataValuePO> values) {
if (CollectionUtils.isEmpty(values)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
List<List<AttendQuoteDataValuePO>> partition = Lists.partition(values, 100);
partition.forEach(mapper::insertData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteByAttendQuoteIds(List<Long> quoteIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
mapper.deleteByAttendIds(quoteIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateDataValue(AttendQuoteDataValuePO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteDataValueMapper mapper = sqlSession.getMapper(AttendQuoteDataValueMapper.class);
mapper.updateDataValueByFiledIdAndEmployeeId(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,108 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO;
import com.engine.salary.mapper.datacollection.AttendQuoteFieldMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class AttendQuoteFieldBiz {
public List<AttendQuoteFieldPO> listSome(AttendQuoteFieldPO param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
return mapper.listSome(param);
} finally {
sqlSession.close();
}
}
public void save(AttendQuoteFieldPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
mapper.insertIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public AttendQuoteFieldPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
public void update(AttendQuoteFieldPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
mapper.updateIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<AttendQuoteFieldListDTO> list(AttendQuoteFieldQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
return mapper.list(param);
} finally {
sqlSession.close();
}
}
public void deleteByIds(Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
mapper.deleteByIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void saveBatch(List<AttendQuoteFieldPO> saves) {
if(CollectionUtils.isEmpty(saves)){
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
List<List<AttendQuoteFieldPO>> partition = Lists.partition(saves, 100);
partition.forEach(mapper::saveBatch);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteAttendByCode(AttendQuoteFieldQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteFieldMapper mapper = sqlSession.getMapper(AttendQuoteFieldMapper.class);
mapper.deleteAttendByCode(param);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,46 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.po.AttendQuoteFieldSettingPO;
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
import com.engine.salary.mapper.datacollection.AttendQuoteSyncSetMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class AttendQuoteFieldSettingBiz {
public List<AttendQuoteFieldSettingPO> getAttendQuoteFieldSetting(AttendQuoteSourceTypeEnum sourceType) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteSyncSetMapper mapper = sqlSession.getMapper(AttendQuoteSyncSetMapper.class);
return mapper.listSome(AttendQuoteFieldSettingPO.builder().sourceType(sourceType.getValue()).build());
} finally {
sqlSession.close();
}
}
public void insert(AttendQuoteFieldSettingPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteSyncSetMapper mapper = sqlSession.getMapper(AttendQuoteSyncSetMapper.class);
mapper.insertIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateById(AttendQuoteFieldSettingPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AttendQuoteSyncSetMapper mapper = sqlSession.getMapper(AttendQuoteSyncSetMapper.class);
mapper.updateIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,247 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class EmployBiz extends BaseBean {
public List<DataCollectionEmployee> listAll(){
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listAll();
} finally {
sqlSession.close();
}
}
/**
* 查询人员列表
*
* @return
*/
public List<DataCollectionEmployee> listEmployee() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listEmployee();
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> getEmployeeByIds(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<DataCollectionEmployee> dataList = new ArrayList<>();
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<List<Long>> partition = Lists.partition(list, 1000);
for (List<Long> longs : partition) {
dataList.addAll(mapper.getEmployeeByIds(longs));
}
return dataList;
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> getEmployeeByIdsIncludeAccountType(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<DataCollectionEmployee> dataList = new ArrayList<>();
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<List<Long>> partition = Lists.partition(list, 1000);
for (List<Long> longs : partition) {
dataList.addAll(mapper.getEmployeeByIdsIncludeAccountType(longs));
}
return dataList;
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> getEmployeeByIdsAll(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<DataCollectionEmployee> employeeList = new ArrayList<>();
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<List<Long>> partition = Lists.partition(list, 1000);
partition.forEach(e->{
List<DataCollectionEmployee> employeeByIdsAll = mapper.getEmployeeByIdsAll(e);
employeeList.addAll(employeeByIdsAll);
});
return employeeList;
} finally {
sqlSession.close();
}
}
/**
* 岗位信息
*
* @param list
* @return
*/
public List<PositionInfo> listPositionInfo(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listPositionInfo(list);
} finally {
sqlSession.close();
}
}
public PositionInfo getPositionInfoById(Long positionId) {
if (positionId == null) {
return null;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getPositionInfoById(positionId);
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<DataCollectionEmployee> emps = new ArrayList<>();
List<List<SalarySobRangeEmpQueryParam>> partition = Lists.partition(includeQueryParams, 100);
partition.forEach(list->{
emps.addAll(mapper.listByParams(list));
});
return emps;
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> listByVirtualParams(List<SalarySobRangeEmpQueryParam> virtualQueryParams) {
if (CollectionUtils.isEmpty(virtualQueryParams)) {
return Collections.emptyList();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
List<DataCollectionEmployee> emps = new ArrayList<>();
List<List<SalarySobRangeEmpQueryParam>> partition = Lists.partition(virtualQueryParams, 100);
partition.forEach(list->{
emps.addAll(mapper.listByVirtualParams(list));
});
return emps;
} finally {
sqlSession.close();
}
}
public DataCollectionEmployee getEmployeeById(Long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getEmployeeById(employeeId);
} finally {
sqlSession.close();
}
}
public List<DeptInfo> getDeptInfoList(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getDeptInfoList(list);
} finally {
sqlSession.close();
}
}
public List<SubCompanyInfo> getSubCompanyInfoList(List<Long> list) {
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getSubCompanyInfoList(list);
} finally {
sqlSession.close();
}
}
public SubCompanyInfo getSubCompanyInfoById(Long subCompanyId) {
if (subCompanyId == null) {
return null;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getSubCompanyInfoById(subCompanyId);
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> listAllForReport() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listAllForReport();
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> listByDismissDate(String dismissDate) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listByDismissDate(dismissDate);
} finally {
sqlSession.close();
}
}
public DeptInfo getDeptInfoById(Long departmentId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getDeptInfoById(departmentId);
} finally {
sqlSession.close();
}
}
}

View File

@ -1,226 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
public class OtherDeductionBiz extends BaseBean {
private EncryptUtil encryptUtil = new EncryptUtil();
/**
* 条件查询
*
* @param param
* @return
*/
public List<OtherDeductionPO> listSome(OtherDeductionPO param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
if (CollectionUtils.isNotEmpty(param.getEmployeeIds())) {
List<List<Long>> partition = Lists.partition(param.getEmployeeIds(), 500);
List<OtherDeductionPO> otherDeductionPOS = new ArrayList<>();
partition.forEach(l -> {
param.setEmployeeIds(l);
otherDeductionPOS.addAll(mapper.listSome(param));
});
return encryptUtil.decryptList(otherDeductionPOS, OtherDeductionPO.class);
}else {
List<OtherDeductionPO> otherDeductionPOS = mapper.listSome(param);
return encryptUtil.decryptList(otherDeductionPOS, OtherDeductionPO.class);
}
} finally {
sqlSession.close();
}
}
/**
* 根据id获取
*
* @param id
* @return
*/
public OtherDeductionPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
OtherDeductionPO byId = mapper.getById(id);
return encryptUtil.decrypt(byId, OtherDeductionPO.class);
} finally {
sqlSession.close();
}
}
/**
* 详情列表
*
* @param param
* @return
*/
public List<OtherDeductionRecordDTO> recordList(OtherDeductionQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
List<OtherDeductionRecordDTO> otherDeductionRecordDTOS = mapper.recordList(param);
return encryptUtil.decryptList(otherDeductionRecordDTOS, OtherDeductionRecordDTO.class);
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchSave(List<OtherDeductionPO> param) {
if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
encryptUtil.encryptList(param, OtherDeductionPO.class);
List<List<OtherDeductionPO>> partition = Lists.partition(param, 100);
partition.forEach(mapper::insertData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchUpdate(List<OtherDeductionPO> param) {
if (CollectionUtils.isEmpty(param)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
encryptUtil.encryptList(param, OtherDeductionPO.class);
List<List<OtherDeductionPO>> partition = Lists.partition(param, 100);
partition.forEach(mapper::updateData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 处理导入数据
*
* @param pos
*/
public void handleImportData(List<OtherDeductionPO> pos, User user) {
if (CollectionUtils.isEmpty(pos)) {
return;
}
OtherDeductionPO po = pos.get(0);
// 多条相同人的则以第一条为准如果逆序排列用于重复的则以最后一条为准Collections.reverse(pos);
// 去重通过记录的唯一条件(申报月份人员id个税扣缴义务人id)拼接
List<OtherDeductionPO> finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
// 查询已有数据
List<OtherDeductionPO> list = listSome(OtherDeductionPO.builder().declareMonth(po.getDeclareMonth()).build());
// 待修改的 本地已存在则更新交集
List<OtherDeductionPO> updateList = list.stream().map(m -> {
Optional<OtherDeductionPO> optional = finalPos.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
OtherDeductionPO temp = null;
if (optional.isPresent()) {
temp = optional.get();
// 换成本地库的id
temp.setId(m.getId());
}
return temp;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 待新增的 导入比本地多则新增差集(导入 - local)
List<OtherDeductionPO> saveList = finalPos.stream().map(m -> {
Optional<OtherDeductionPO> optional = list.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
OtherDeductionPO temp = null;
if (!optional.isPresent()) {
temp = m;
}
return temp;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 修改
if (CollectionUtils.isNotEmpty(updateList)) {
batchUpdate(updateList);
}
// 保存
if (CollectionUtils.isNotEmpty(saveList)) {
batchSave(saveList);
}
// 记录日志
// 根据月份人员id查出保存的数据
List<Long> empIds = saveList.stream().map(OtherDeductionPO::getEmployeeId).collect(Collectors.toList());
List<OtherDeductionPO> insertList = listSome(OtherDeductionPO.builder().declareMonth(po.getDeclareMonth()).employeeIds(empIds).build());
Map<String, OtherDeductionPO> insertMap = SalaryEntityUtil.convert2Map(insertList, p -> p.getTaxAgentId() + "-" + SalaryDateUtil.getFormatYearMonth(p.getDeclareMonth()) + "-" + p.getEmployeeId());
saveList.forEach(save -> {
OtherDeductionPO otherDeductionPO = insertMap.get(save.getTaxAgentId() + "-" + SalaryDateUtil.getFormatYearMonth(save.getDeclareMonth()) + "-" + save.getEmployeeId());
if (otherDeductionPO != null) {
updateList.add(otherDeductionPO);
}
});
if (CollectionUtils.isNotEmpty(updateList)) {
String name = SalaryDateUtil.getFormatYearMonth(po.getDeclareMonth());
LoggerContext loggerContext = new LoggerContext<>();
loggerContext.setUser(user);
loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel( 0, "其他免税扣除 ") + name);
loggerContext.setOperateType(OperateTypeEnum.EXCEL_IMPORT.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel( 0, "导入"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel( 0, "其他免税扣除") + name);
loggerContext.setNewValueList(updateList);
SalaryElogConfig.otherDeductionLoggerTemplate.write(loggerContext);
}
}
/**
* @return void
* @description 批量删除
* @author Harryxzy
* @date 2022/10/27 16:07
*/
public void batchDeleteByIDS(List<Long> deleteIds) {
if (CollectionUtils.isEmpty(deleteIds)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
List<List<Long>> partition = Lists.partition(deleteIds, 100);
partition.forEach(mapper::deleteData);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,184 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.sicategory.bo.ICategoryBO;
import com.engine.salary.entity.sicategory.dto.ICategoryFormDTO;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.enums.sicategory.IsPaymentEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.util.SalaryEnumUtil;
import com.mzlion.core.utils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/3/9
* @Version V1.0
**/
public class SICategoryBiz {
/**
* 自定义福利表单
* id == null ? 新建表单 查看已有数据内容表单
* @param id 自定义福利主键
* @return 表单
*/
public ICategoryFormDTO getForm(Long id) {
if (id != null) {
ICategoryPO iCategoryPO = getByID(id);
ICategoryFormDTO iCategoryFormDTO = new ICategoryFormDTO();
if (Objects.isNull(iCategoryPO)) {
throw new SalaryRunTimeException("数据不存在");
}
BeanUtils.copyProperties(iCategoryPO,iCategoryFormDTO);
iCategoryFormDTO.setWelfareType(SalaryEnumUtil.enumMatchByValue(iCategoryPO.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class));
iCategoryFormDTO.setPaymentScope(SalaryEnumUtil.stringToEnums(iCategoryPO.getPaymentScope(), ","));
return iCategoryFormDTO;
}
return ICategoryFormDTO.builder().welfareType(WelfareTypeEnum.SOCIAL_SECURITY).build();
}
/**
* 根据id获取
* @param id
* @return
*/
public ICategoryPO getByID(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
ICategoryPO iCategoryPO = iCategoryMapper.getById(id);
return iCategoryPO;
} finally {
sqlSession.close();
}
}
/**
* 保存
* @param iCategoryFormDTO
* @param employeeId DataTypeEnum.SYSTEM.getValue()
*/
public void save(ICategoryFormDTO iCategoryFormDTO, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
iCategoryFormDTO.setInsuranceName(StringUtils.trim(iCategoryFormDTO.getInsuranceName()));
List<ICategoryPO> iCategoryPOS = listByName(iCategoryFormDTO.getInsuranceName());
if (CollectionUtils.isNotEmpty(iCategoryPOS)) {
throw new SalaryRunTimeException("福利名称不允许重复");
}
ICategoryPO iCategoryPO = ICategoryBO.convertToInsuranceCategoryPO(iCategoryFormDTO, employeeId);
iCategoryMapper.insert(iCategoryPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 根据名称获取
* @param insuranceName
* @return
*/
public List<ICategoryPO> listByName(String insuranceName) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try{
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
List<ICategoryPO> iCategoryPOS = iCategoryMapper.listByName(insuranceName);
return iCategoryPOS;
} finally {
sqlSession.close();
}
}
/**
* 更新
* @param iCategoryFormDTO
* @param employeeId
*/
public void update(ICategoryFormDTO iCategoryFormDTO, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try{
if (iCategoryFormDTO.getId() == null) {
throw new SalaryRunTimeException("id is required");
}
ICategoryPO iCategoryPO = getByID(iCategoryFormDTO.getId());
if (Objects.isNull(iCategoryPO)) {
throw new SalaryRunTimeException("数据不存在");
}
List<ICategoryPO> iCategoryPOS = listByName(iCategoryFormDTO.getInsuranceName());
if (CollectionUtils.isNotEmpty(iCategoryPOS)) {
throw new SalaryRunTimeException("福利名称不允许重复");
}
iCategoryPO.setInsuranceName(iCategoryFormDTO.getInsuranceName());
// iCategoryPO.setWelfareType(iCategoryFormDTO.getWelfareType().getValue());
// iCategoryPO.setPaymentScope(SalaryEnumUtil.enumArrToString(iCategoryFormDTO.getPaymentScope()));
iCategoryPO.setUpdateTime(new Date());
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
iCategoryMapper.update(iCategoryPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 更新状态
* @param id
* @param isUse
* @param employeeId
*/
public void updateStatusById(Long id, Integer isUse, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
if(id == null) {
throw new SalaryRunTimeException("id is required");
}
if (isUse == null) {
throw new SalaryRunTimeException("isUse is required");
}
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = new SISchemeBiz().queryListByInsuranceIdIsPayment(id, IsPaymentEnum.YES.getValue());
if(CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS) && isUse == 0) {
throw new SalaryRunTimeException("该福利开启缴费,不可删除(或停用)");
}
ICategoryPO iCategoryPO = getByID(id);
if (Objects.isNull(iCategoryPO)) {
throw new SalaryRunTimeException("数据记录不存在");
}
iCategoryPO.setIsUse(isUse);
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
iCategoryMapper.updateById(iCategoryPO);
sqlSession.commit();
}finally {
sqlSession.close();
}
}
}

View File

@ -1,497 +0,0 @@
package com.engine.salary.biz;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.bo.InsuranceSchemeBO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDTO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeDetailDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeReqParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.sischeme.vo.InsuranceSchemeFormVO;
import com.engine.salary.enums.SalaryRoundingModeEnum;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siaccount.SIAccountUtilMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEnumUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
* @Date 2022/3/7
* @Version V1.0
**/
public class SISchemeBiz {
private SIAccountUtilMapper getSIAccountUtilMapper() {
return SqlProxyHandle.getProxy(SIAccountUtilMapper.class);
}
private EncryptUtil encryptUtil = new EncryptUtil();
/**
* 获取社保方案
*
* @param id
* @param welfareTypeEnum
* @return
*/
public InsuranceSchemeFormVO getForm(Long id, WelfareTypeEnum welfareTypeEnum) {
InsuranceSchemeDTO insuranceSchemeDTO = getSchemeFormDTO(welfareTypeEnum, id);
List<InsuranceSchemeDetailDTO> insuranceSchemeDetailDTOList = getSchemeDetailFormDTO(welfareTypeEnum, id);
return InsuranceSchemeFormVO.builder().schemeBatch(insuranceSchemeDTO).schemeDetailList(insuranceSchemeDetailDTOList).build();
}
/**
* 获取方案明细表集合 新建|详情
*
* @param welfareTypeEnum 福利类型
* @param id 方案主键id
* @return form
*/
public List<InsuranceSchemeDetailDTO> getSchemeDetailFormDTO(WelfareTypeEnum welfareTypeEnum, Long id) {
List<ICategoryPO> insuranceCategoryPOS = listByWelfareType(welfareTypeEnum.getValue());
List<InsuranceSchemeDetailDTO> insuranceSchemeDetailDTOList = new ArrayList<>();
insuranceCategoryPOS.forEach(item -> {
PaymentScopeEnum[] paymentScopeEnums = SalaryEnumUtil.stringToEnums(item.getPaymentScope(), ",");
Arrays.stream(paymentScopeEnums).forEach(e -> {
InsuranceSchemeDetailDTO insuranceSchemeDetailDTO = InsuranceSchemeDetailDTO.builder().build();
InsuranceSchemeDetailPO insuranceSchemeDetailPO = getByPPI(id, e.getValue(), item.getId());
if (insuranceSchemeDetailPO == null) {
insuranceSchemeDetailDTO = InsuranceSchemeDetailDTO.builder()
.id((long) (Math.random() * 10000))
.insuranceId(item.getId())
.insuranceName(item.getInsuranceName())
.paymentScope(e.getDefaultLabel())
.rententionRule(String.valueOf(SalaryRoundingModeEnum.ROUNDING.getValue()))
.validNum(2)
.cycleSetting("000000000000")
.paymentCycle("0")
.accountType("0")
.build();
if (Objects.equals(item.getDataType(), DataTypeEnum.SYSTEM.getValue())) {
insuranceSchemeDetailDTO.setIsPayment(true);
} else {
insuranceSchemeDetailDTO.setIsPayment(false);
}
} else {
//BeanUtils.copyProperties(insuranceSchemeDetailPO, insuranceSchemeDetailDTO);
insuranceSchemeDetailDTO.setEffectiveTime(insuranceSchemeDetailPO.getEffectiveTime());
insuranceSchemeDetailDTO.setExpirationTime(insuranceSchemeDetailPO.getExpirationTime());
insuranceSchemeDetailDTO.setId(insuranceSchemeDetailPO.getId());
insuranceSchemeDetailDTO.setInsuranceId(insuranceSchemeDetailPO.getInsuranceId());
insuranceSchemeDetailDTO.setPaymentScopeValue(insuranceSchemeDetailPO.getPaymentScope());
insuranceSchemeDetailDTO.setPrimaryId(insuranceSchemeDetailPO.getPrimaryId());
insuranceSchemeDetailDTO.setValidNum(insuranceSchemeDetailPO.getValidNum() == null ? 2 : insuranceSchemeDetailPO.getValidNum());
if (insuranceSchemeDetailPO.getIsPayment() != null) {
insuranceSchemeDetailDTO.setIsPayment(Objects.equals(insuranceSchemeDetailPO.getIsPayment(), IsPaymentEnum.YES.getValue()));
}
if (insuranceSchemeDetailPO.getPaymentCycle() != null) {
insuranceSchemeDetailDTO.setPaymentCycle(insuranceSchemeDetailPO.getPaymentCycle() + "");
} else {
insuranceSchemeDetailDTO.setPaymentCycle("0");
}
if (insuranceSchemeDetailPO.getAccountType() != null) {
insuranceSchemeDetailDTO.setAccountType(insuranceSchemeDetailPO.getAccountType() + "");
} else {
insuranceSchemeDetailDTO.setAccountType("0");
}
if (insuranceSchemeDetailPO.getCycleSetting() == null) {
insuranceSchemeDetailDTO.setCycleSetting("000000000000");
} else {
insuranceSchemeDetailDTO.setCycleSetting(insuranceSchemeDetailPO.getCycleSetting());
}
if (StringUtils.isNotBlank(insuranceSchemeDetailPO.getUpperLimit())) {
BigDecimal bigDecimal = new BigDecimal(insuranceSchemeDetailPO.getUpperLimit());
insuranceSchemeDetailDTO.setUpperLimit(numberCheck(bigDecimal.toPlainString()) ? null : bigDecimal);
}
if (StringUtils.isNotBlank(insuranceSchemeDetailPO.getLowerLimit())) {
BigDecimal bigDecimal = new BigDecimal(insuranceSchemeDetailPO.getLowerLimit());
insuranceSchemeDetailDTO.setLowerLimit(numberCheck(bigDecimal.toPlainString()) ? null : bigDecimal);
}
if (StringUtils.isNotBlank(insuranceSchemeDetailPO.getPaymentProportion())) {
BigDecimal bigDecimal = new BigDecimal(insuranceSchemeDetailPO.getPaymentProportion());
insuranceSchemeDetailDTO.setPaymentProportion(numberCheck(bigDecimal.toPlainString()) ? null : bigDecimal);
}
if (StringUtils.isNotBlank(insuranceSchemeDetailPO.getFixedCost())) {
BigDecimal bigDecimal = new BigDecimal(insuranceSchemeDetailPO.getFixedCost());
insuranceSchemeDetailDTO.setFixedCost(numberCheck(bigDecimal.toPlainString()) ? null : bigDecimal);
}
insuranceSchemeDetailDTO.setInsuranceName(item.getInsuranceName());
insuranceSchemeDetailDTO.setRententionRule(String.valueOf(insuranceSchemeDetailPO.getRententionRule()));
insuranceSchemeDetailDTO.setPaymentScope(e.getDefaultLabel());
}
insuranceSchemeDetailDTO.setPaymentScopeValue(e.getValue());
insuranceSchemeDetailDTOList.add(insuranceSchemeDetailDTO);
});
});
return insuranceSchemeDetailDTOList;
}
/**
* 根据福利类型获取
*
* @param welfareType
* @return
*/
public List<ICategoryPO> listByWelfareType(Integer welfareType) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
ICategoryMapper iCategoryMapper = sqlSession.getMapper(ICategoryMapper.class);
List<ICategoryPO> insuranceCategoryPOS = iCategoryMapper.listByWelfareType(welfareType, null);
return insuranceCategoryPOS;
} finally {
sqlSession.close();
}
}
public boolean numberCheck(String number) {
return Pattern.compile("^0\\.[0]*").matcher(number).matches();
}
private InsuranceSchemeDetailPO getByPPI(Long primaryId, Integer paymentScope, Long insuranceId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
InsuranceSchemeDetailPO insuranceSchemeDetailPO = insuranceSchemeDetailMapper.getByPPI(primaryId, paymentScope, insuranceId);
encryptUtil.decrypt(insuranceSchemeDetailPO, InsuranceSchemeDetailPO.class);
return insuranceSchemeDetailPO;
} finally {
sqlSession.close();
}
}
/**
* 获取方案主表信息 新建|详情
*
* @param welfareTypeEnum 福利类型
* @param id 方案主键id
* @return form
*/
private InsuranceSchemeDTO getSchemeFormDTO(WelfareTypeEnum welfareTypeEnum, Long id) {
InsuranceSchemeDTO insuranceSchemeDTO = InsuranceSchemeDTO.builder().paymentType(PaymentTypeEnum.SCHEME_TOWN).welfareType(welfareTypeEnum).build();
if (id != null) {
InsuranceSchemePO insuranceSchemePO = getById(id);
SalaryAssert.notNull(insuranceSchemePO, "福利方案不存在");
//BeanUtils.copyProperties(insuranceSchemePO, insuranceSchemeDTO);
insuranceSchemeDTO.setId(insuranceSchemePO.getId());
insuranceSchemeDTO.setPaymentArea(insuranceSchemePO.getPaymentArea());
insuranceSchemeDTO.setRemarks(insuranceSchemePO.getRemarks());
insuranceSchemeDTO.setSchemeName(insuranceSchemePO.getSchemeName());
insuranceSchemeDTO.setPaymentType(SalaryEnumUtil.enumMatchByValue(insuranceSchemePO.getPaymentType(), PaymentTypeEnum.values(), PaymentTypeEnum.class));
insuranceSchemeDTO.setWelfareType(welfareTypeEnum);
insuranceSchemeDTO.setSharedType(StringUtils.isBlank(insuranceSchemePO.getSharedType()) ? "0" : insuranceSchemePO.getSharedType());
insuranceSchemeDTO.setTaxAgentIds(insuranceSchemePO.getTaxAgentIds());
}
return insuranceSchemeDTO;
}
/**
* 社保方案基础信息主表
*
* @param id
* @return
*/
public InsuranceSchemePO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
InsuranceSchemePO insuranceSchemePO = insuranceSchemeMapper.getById(id);
return insuranceSchemePO;
} finally {
sqlSession.close();
}
}
/**
* 获取所有方案
*
* @return
*/
public List<InsuranceSchemePO> listAll(){
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
List<InsuranceSchemePO> insuranceSchemePOList = insuranceSchemeMapper.listAll();
return insuranceSchemePOList;
} finally {
sqlSession.close();
}
}
/**
* 社保方案基础信息明细表
*
* @param primaryId
* @return
*/
public List<InsuranceSchemeDetailPO> listByPrimaryId(Long primaryId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = insuranceSchemeDetailMapper.queryListBySchemeId(primaryId);
encryptUtil.decryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
// return decryptSchemeDetailList(insuranceSchemeDetailPOS);
return insuranceSchemeDetailPOS;
} finally {
sqlSession.close();
}
}
/**
* 新增
*
* @param saveParam
* @param employeeId
*/
public void save(InsuranceSchemeReqParam saveParam, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
//保存福利项目主表
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
saveParam.getInsuranceScheme().setSchemeName(StringUtils.trim(saveParam.getInsuranceScheme().getSchemeName()));
List<InsuranceSchemePO> listResult = insuranceSchemeMapper.listByName(saveParam.getInsuranceScheme().getSchemeName());
SalaryAssert.isEmpty(listResult, "该福利名称已经存在,福利名称系统全局唯一");
InsuranceSchemePO insuranceSchemePO = InsuranceSchemeBO.convert2BatchPO(saveParam.getInsuranceScheme(), employeeId);
if (insuranceSchemePO.getSharedType() == null) {
insuranceSchemePO.setSharedType(SharedTypeEnum.PUBLIC.getValue());
} else {
if (insuranceSchemePO.getSharedType().equals(SharedTypeEnum.PRIVATE.getValue()) && StringUtils.isBlank(insuranceSchemePO.getTaxAgentIds())) {
throw new SalaryRunTimeException("方案可见性为私有时,未设置可见范围");
}
}
insuranceSchemeMapper.insert(insuranceSchemePO);
//保存福利项目明细表
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = InsuranceSchemeBO.convertToInsuranceSchemeDetailPoList(saveParam.getInsuranceSchemeDetailList(), employeeId, insuranceSchemePO.getId());
encryptUtil.encryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
insuranceSchemeDetailPOS.forEach(insuranceSchemeDetailMapper::insert);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 更新
*
* @param updateParam
* @param employeeId
*/
public void update(InsuranceSchemeReqParam updateParam, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
//查询是否存在福利方案
InsuranceSchemePO insuranceSchemePO = getById(updateParam.getInsuranceScheme().getId());
if (Objects.isNull(insuranceSchemePO)) {
throw new SalaryRunTimeException("福利方案不存在");
}
//去除入参中方案名称的空格
updateParam.getInsuranceScheme().setSchemeName(StringUtils.trim(updateParam.getInsuranceScheme().getSchemeName()));
//福利方案名称重复
List<InsuranceSchemePO> insuranceSchemePOList = insuranceSchemeMapper.listByName(updateParam.getInsuranceScheme().getSchemeName());
if (CollectionUtils.isNotEmpty(insuranceSchemePOList)) {
boolean repeat = insuranceSchemePOList.stream().anyMatch(item -> !Objects.equals(item.getId(), updateParam.getInsuranceScheme().getId()));
SalaryAssert.isTrue(!repeat, "福利方案名称重复");
}
if (insuranceSchemePO.getSharedType() == null) {
insuranceSchemePO.setSharedType(SharedTypeEnum.PUBLIC.getValue());
} else {
if (insuranceSchemePO.getSharedType().equals(SharedTypeEnum.PRIVATE.getValue()) && StringUtils.isBlank(insuranceSchemePO.getTaxAgentIds())) {
throw new SalaryRunTimeException("方案可见性为私有时,未设置可见范围");
}
}
//更新福利方案主表
InsuranceSchemePO insuranceSchemePO1 = InsuranceSchemeBO.buildInsuranceSchemePO(insuranceSchemePO, updateParam.getInsuranceScheme());
insuranceSchemeMapper.update(insuranceSchemePO1);
//更新福利方案明细表 先删后插
insuranceSchemeDetailMapper.batchDeleteByPrimaryIds(Collections.singleton(updateParam.getInsuranceScheme().getId()));
//更新明细表
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = InsuranceSchemeBO.convertToInsuranceSchemeDetailPoList(updateParam.getInsuranceSchemeDetailList(), employeeId, insuranceSchemePO.getId());
encryptUtil.encryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
insuranceSchemeDetailPOS.forEach(insuranceSchemeDetailMapper::insert);
//记录操作日志
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 复制方案
*
* @param id
* @param schemeName
* @param employeeId
*/
public void copy(Long id, String schemeName, long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
//去除入参中方案名称的空格
schemeName = StringUtils.trim(schemeName);
List<InsuranceSchemePO> listResult = insuranceSchemeMapper.listByName(schemeName);
SalaryAssert.isEmpty(listResult, "方案名称重复");
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
if (Objects.isNull(id)) {
throw new SalaryRunTimeException("方案id为空");
}
if (Objects.isNull(schemeName)) {
throw new SalaryRunTimeException("复制方案名为空");
}
InsuranceSchemePO insuranceSchemePO = getById(id);
if (Objects.isNull(insuranceSchemePO)) {
throw new SalaryRunTimeException("方案不存在");
}
if (insuranceSchemePO.getSchemeName().equals(schemeName)) {
throw new SalaryRunTimeException("方案名称重复");
}
InsuranceSchemePO batchPO = InsuranceSchemePO.builder()
.creator(employeeId)
.createTime(new Date())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.schemeName(schemeName)
.paymentArea(insuranceSchemePO.getPaymentArea())
.updateTime(new Date())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.paymentType(insuranceSchemePO.getPaymentType())
.remarks(insuranceSchemePO.getRemarks())
.welfareType(insuranceSchemePO.getWelfareType())
.isUse(insuranceSchemePO.getIsUse())
.build();
insuranceSchemeMapper.insert(batchPO);
List<InsuranceSchemeDetailPO> detailList = insuranceSchemeDetailMapper.queryListBySchemeId(id);
detailList = encryptUtil.decryptList(detailList,InsuranceSchemeDetailPO.class);
if (CollectionUtils.isNotEmpty(detailList)) {
List<InsuranceSchemeDetailPO> detailPOS = detailList.stream().map(item -> InsuranceSchemeDetailPO.builder()
.creator(employeeId)
.createTime(new Date())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.effectiveTime(item.getEffectiveTime())
.expirationTime(item.getExpirationTime())
.fixedCost(item.getFixedCost())
.insuranceId(item.getInsuranceId())
.isPayment(item.getIsPayment())
.lowerLimit(item.getLowerLimit())
.paymentScope(item.getPaymentScope())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.paymentProportion(item.getPaymentProportion())
.updateTime(new Date())
.primaryId(batchPO.getId())
.rententionRule(item.getRententionRule())
.upperLimit(item.getUpperLimit())
.validNum(item.getValidNum()==null?2:item.getValidNum())
.build()
).collect(Collectors.toList());
encryptUtil.encryptList(detailPOS, InsuranceSchemeDetailPO.class);
detailPOS.forEach(insuranceSchemeDetailMapper::insert);
}
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 根据险种id和是否缴费查询社保方案明细表
*
* @param insuranceId 险种id
* @param isPayment 是否缴费
* @return list
*/
public List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(Long insuranceId, Integer isPayment) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOList = insuranceSchemeDetailMapper.queryListByInsuranceIdIsPayment(insuranceId, isPayment);
encryptUtil.decryptList(insuranceSchemeDetailPOList, InsuranceSchemeDetailPO.class);
return insuranceSchemeDetailPOList;
} finally {
sqlSession.close();
}
}
public int checkBeforeDeleteSocialscheme(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteSocialscheme((Collection<Long>) params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteAccumulationfund(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteAccumulationfund((Collection<Long>) params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteOtherscheme(Map<String, Object> params) {
return getSIAccountUtilMapper().checkBeforeDeleteOtherscheme((Collection<Long>) params.get("ids")).get(0).getNum();
}
public int checkBeforeDeleteBill(Map<String, Object> params, Integer welfareTypeId) {
return getSIAccountUtilMapper().checkBeforeDeleteBill((Collection<Long>) params.get("ids"), welfareTypeId).get(0).getNum();
}
public void deleteSocialscheme(Map<String, Object> params) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
InsuranceSchemeDetailMapper insuranceSchemeDetailMapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
InsuranceSchemeMapper insuranceSchemeMapper = sqlSession.getMapper(InsuranceSchemeMapper.class);
insuranceSchemeMapper.deleteByIds((Collection<Long>) params.get("ids"));
insuranceSchemeDetailMapper.deleteByIds((Collection<Long>) params.get("ids"));
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,66 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalaryArchiveBiz {
public SalaryArchivePO getById(Long salaryArchiveId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveMapper mapper = sqlSession.getMapper(SalaryArchiveMapper.class);
return mapper.getById(salaryArchiveId);
} finally {
sqlSession.close();
}
}
public void batchInsert(List<SalaryArchivePO> salaryArchiveSaves) {
if (CollectionUtils.isEmpty(salaryArchiveSaves)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveMapper mapper = sqlSession.getMapper(SalaryArchiveMapper.class);
List<List<SalaryArchivePO>> partition = Lists.partition(salaryArchiveSaves, 100);
partition.forEach(mapper::batchInsert);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchDeleteHistoryData(SalaryArchivePO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveMapper mapper = sqlSession.getMapper(SalaryArchiveMapper.class);
mapper.batchDeleteHistoryData(build);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchUpdate(List<SalaryArchivePO> list) {
if (CollectionUtils.isEmpty(list)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveMapper mapper = sqlSession.getMapper(SalaryArchiveMapper.class);
List<List<SalaryArchivePO>> partition = Lists.partition(list, 100);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,42 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
import com.engine.salary.mapper.archive.SalaryArchiveDimissionMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalaryArchiveDimissionBiz {
public List<SalaryArchiveDimissionPO> dimissionSets() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveDimissionMapper mapper = sqlSession.getMapper(SalaryArchiveDimissionMapper.class);
return mapper.listAll();
} finally {
sqlSession.close();
}
}
public void updateById(SalaryArchiveDimissionPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveDimissionMapper mapper = sqlSession.getMapper(SalaryArchiveDimissionMapper.class);
mapper.updateIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void insert(SalaryArchiveDimissionPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveDimissionMapper mapper = sqlSession.getMapper(SalaryArchiveDimissionMapper.class);
mapper.insertIgnoreNull(build);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,251 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveItemQueryParam;
import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustRecordQueryParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.SalaryLoggerUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class SalaryArchiveItemBiz {
public EncryptUtil encryptUtil = new EncryptUtil();
public List<SalaryArchiveItemPO> getCurrentEffectiveItemList(SalaryArchiveItemQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
List<SalaryArchiveItemPO> salaryArchiveItemPOS = mapper.listByParam(build);
return encryptUtil.decryptList(salaryArchiveItemPOS, SalaryArchiveItemPO.class);
} finally {
sqlSession.close();
}
}
public List<SalaryArchiveItemPO> listByParam(SalaryArchiveItemQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
if (CollectionUtils.isNotEmpty(build.getEmployeeIds())) {
List<SalaryArchiveItemPO> salaryArchiveItemPOS = new ArrayList<>();
List<List<Long>> partition = Lists.partition((List<Long>) build.getEmployeeIds(), 500);
partition.forEach(l -> {
build.setEmployeeIds(l);
salaryArchiveItemPOS.addAll(mapper.listByParam(build));
});
return encryptUtil.decryptList(salaryArchiveItemPOS, SalaryArchiveItemPO.class);
} else {
List<SalaryArchiveItemPO> salaryArchiveItemPOS = mapper.listByParam(build);
return encryptUtil.decryptList(salaryArchiveItemPOS, SalaryArchiveItemPO.class);
}
} finally {
sqlSession.close();
}
}
public SalaryArchiveItemPO getById(Long salaryArchiveItemId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
return encryptUtil.decrypt(mapper.getById(salaryArchiveItemId), SalaryArchiveItemPO.class);
} finally {
sqlSession.close();
}
}
public List<SalaryArchiveItemPO> getIneffectiveSalaryItems(SalaryArchiveItemQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
List<SalaryArchiveItemPO> ineffectiveSalaryItems = new ArrayList<>();
if (CollectionUtils.isNotEmpty(build.getSalaryArchivesIds())) {
List<Long> salaryArchivesIds = (List<Long>) build.getSalaryArchivesIds();
List<List<Long>> partition = Lists.partition(salaryArchivesIds, 1000);
partition.forEach(list -> {
build.setSalaryArchivesIds(list);
ineffectiveSalaryItems.addAll(mapper.getIneffectiveSalaryItems(build));
});
}
return encryptUtil.decryptList(ineffectiveSalaryItems, SalaryArchiveItemPO.class);
} finally {
sqlSession.close();
}
}
public List<SalaryArchiveItemPO> getEffectiveSalaryItems(SalaryArchiveItemQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
List<SalaryArchiveItemPO> effectiveSalaryItems = mapper.getEffectiveSalaryItems(build);
return encryptUtil.decryptList(effectiveSalaryItems, SalaryArchiveItemPO.class);
} finally {
sqlSession.close();
}
}
public void deleteBatchIds(List<Long> effectiveSalaryItemDels) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
List<List<Long>> partition = Lists.partition(effectiveSalaryItemDels, 999);
partition.forEach(mapper::deleteBatchIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchInsert(List<SalaryArchiveItemPO> salaryArchiveItemNews, User user) {
if (CollectionUtils.isEmpty(salaryArchiveItemNews)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
encryptUtil.encryptList(salaryArchiveItemNews, SalaryArchiveItemPO.class);
List<List<SalaryArchiveItemPO>> partition = Lists.partition(salaryArchiveItemNews, 100);
partition.forEach(mapper::batchInsert);
sqlSession.commit();
// 记录日志
List<Long> archiveIdList = salaryArchiveItemNews.stream().map(SalaryArchiveItemPO::getSalaryArchiveId).distinct().collect(Collectors.toList());
List<Long> itemIdList = salaryArchiveItemNews.stream().map(SalaryArchiveItemPO::getSalaryItemId).distinct().collect(Collectors.toList());
// 查出保存的id
List<SalaryArchiveItemPO> savePO = getIneffectiveSalaryItems(SalaryArchiveItemQueryParam.builder().salaryArchivesIds(archiveIdList).salaryItemIds(itemIdList).build());
Map<String, SalaryArchiveItemPO> saveMap = SalaryEntityUtil.convert2Map(savePO, p -> p.getSalaryArchiveId() + p.getSalaryItemId() + SalaryDateUtil.getFormatDate(p.getEffectiveTime()));
String operateName = SalaryI18nUtil.getI18nLabel(0, "新增调薪记录");
salaryArchiveItemNews.forEach(e -> {
SalaryArchiveItemPO archive = saveMap.getOrDefault(e.getSalaryArchiveId() + e.getSalaryItemId() + SalaryDateUtil.getFormatDate(e.getEffectiveTime()), SalaryArchiveItemPO.builder().build());
SalaryLoggerUtil.recordAddSingleLog(SalaryElogConfig.salaryArchiveItemAdjustLoggerTemplate,
archive.getId(),
operateName + ":" + archive.getId(),
operateName,
operateName,
archive,
user);
});
} finally {
sqlSession.close();
}
}
public void updateById(SalaryArchiveItemPO salaryArchiveItem) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
encryptUtil.encrypt(salaryArchiveItem, SalaryArchiveItemPO.class);
mapper.update(salaryArchiveItem);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateIgnoreNull(SalaryArchiveItemPO salaryArchiveItem) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
encryptUtil.encrypt(salaryArchiveItem, SalaryArchiveItemPO.class);
mapper.updateIgnoreNull(salaryArchiveItem);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam queryParam, List<Long> salaryItemIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
List<Long> salaryArchiveIds = queryParam.getSalaryArchiveIds();
if (CollectionUtils.isEmpty(salaryArchiveIds)) {
List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordListDTOS = mapper.salaryItemAdjustRecordList(queryParam, salaryItemIds);
return encryptUtil.decryptList(salaryItemAdjustRecordListDTOS, SalaryItemAdjustRecordListDTO.class);
} else {
List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordListDTOS = new ArrayList<>();
List<List<Long>> salaryArchiveIdsPartition = Lists.partition(salaryArchiveIds, 500);
salaryArchiveIdsPartition.forEach(l -> {
queryParam.setSalaryArchiveIds(l);
salaryItemAdjustRecordListDTOS.addAll(mapper.salaryItemAdjustRecordList(queryParam, salaryItemIds));
});
return encryptUtil.decryptList(salaryItemAdjustRecordListDTOS, SalaryItemAdjustRecordListDTO.class);
}
} finally {
sqlSession.close();
}
}
public void deleteBySalaryArchiveId(List<Long> salaryArchiveIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
mapper.deleteBySalaryArchiveId(salaryArchiveIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public PageInfo<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordListPage(SalaryItemAdjustRecordQueryParam queryParam, List<Long> salaryItemIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
List<Long> salaryArchiveIds = queryParam.getSalaryArchiveIds();
if (CollectionUtils.isEmpty(salaryArchiveIds)) {
List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordListDTOS = mapper.salaryItemAdjustRecordList(queryParam, salaryItemIds);
PageInfo<SalaryItemAdjustRecordListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
salaryItemAdjustRecordListDTOS,
SalaryItemAdjustRecordListDTO.class);
encryptUtil.decryptList(page.getList(), SalaryItemAdjustRecordListDTO.class);
return page;
} else {
List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordListDTOS = new ArrayList<>();
List<List<Long>> salaryArchiveIdsPartition = Lists.partition(salaryArchiveIds, 500);
salaryArchiveIdsPartition.forEach(l -> {
queryParam.setSalaryArchiveIds(l);
salaryItemAdjustRecordListDTOS.addAll(mapper.salaryItemAdjustRecordList(queryParam, salaryItemIds));
});
PageInfo<SalaryItemAdjustRecordListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
salaryItemAdjustRecordListDTOS,
SalaryItemAdjustRecordListDTO.class);
encryptUtil.decryptList(page.getList(), SalaryItemAdjustRecordListDTO.class);
return page;
}
} finally {
sqlSession.close();
}
}
public void batchDeleteHistoryData(SalaryArchiveItemPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
mapper.batchDeleteHistoryData(build);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,93 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveTaxAgentQueryParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO;
import com.engine.salary.mapper.archive.SalaryArchiveTaxAgentMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalaryArchiveTaxAgentBiz {
public List<SalaryArchiveTaxAgentPO> listByParam(SalaryArchiveTaxAgentQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
return mapper.listByParam(build);
} finally {
sqlSession.close();
}
}
public void deleteBySalaryArchiveId(List<Long> salaryArchiveIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
mapper.deleteBySalaryArchiveId(salaryArchiveIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<SalaryArchiveTaxAgentPO> getEffectiveTaxAgentList(SalaryArchiveTaxAgentQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
return mapper.getEffectiveTaxAgentList(build);
} finally {
sqlSession.close();
}
}
public List<SalaryArchiveTaxAgentPO> getIneffectiveTaxAgentList(SalaryArchiveTaxAgentQueryParam build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
return mapper.getIneffectiveTaxAgentList(build);
} finally {
sqlSession.close();
}
}
public void deleteBatchIds(List<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
mapper.deleteBatchIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchInsert(List<SalaryArchiveTaxAgentPO> salaryArchiveTaxAgentSaves) {
if (CollectionUtils.isEmpty(salaryArchiveTaxAgentSaves)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
List<List<SalaryArchiveTaxAgentPO>> partition = Lists.partition(salaryArchiveTaxAgentSaves, 100);
partition.forEach(mapper::batchInsert);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchDeleteHistoryData(SalaryArchiveTaxAgentPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryArchiveTaxAgentMapper mapper = sqlSession.getMapper(SalaryArchiveTaxAgentMapper.class);
mapper.batchDeleteHistoryData(build);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,157 +0,0 @@
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.enums.SalaryOnOffEnum;
import com.engine.salary.mapper.salaryitem.SalaryItemMapper;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalaryItemBiz {
public SalaryItemPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
public List<SalaryItemPO> listAll() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
return mapper.listAll();
} finally {
sqlSession.close();
}
}
public List<SalaryItemPO> listSome(SalaryItemPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
public void batchSave(Collection<SalaryItemPO> salaryItems) {
if (CollectionUtils.isEmpty(salaryItems)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
List<List<SalaryItemPO>> partition = Lists.partition((List) salaryItems, 100);
partition.forEach(mapper::batchInsert);
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);
List<SalaryItemPO> salaryItemPOList = mapper.listByParam(searchParam);
return SalaryPageUtil.buildPage(searchParam.getCurrent(), searchParam.getPageSize(),
salaryItemPOList, SalaryItemPO.class);
} 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();
}
}
public List<SalaryItemPO> getCanAdjustSalaryItems() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
return mapper.listSome(SalaryItemPO.builder().useInEmployeeSalary(SalaryOnOffEnum.ON.getValue()).build());
} finally {
sqlSession.close();
}
}
public void batchUpdateSortedIndex(List<SalaryItemPO> list) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
List<List<SalaryItemPO>> partition = (List<List<SalaryItemPO>>)Lists.partition(list, 100);
partition.forEach(mapper::batchUpdateSortedIndex);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<SalaryItemPO> listByParamOrderById(SalaryItemSearchParam searchParam) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class);
return mapper.listByParamOrderById(searchParam);
} finally {
sqlSession.close();
}
}
}

View File

@ -1,121 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salaryBill.dto.SalarySendListDTO;
import com.engine.salary.entity.salaryBill.param.SalarySendQueryParam;
import com.engine.salary.entity.salaryBill.po.SalarySendPO;
import com.engine.salary.mapper.salarybill.SalarySendMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
import java.util.Map;
public class SalarySendBiz {
/**
* 根据id获取数据
* @param id
* @return
*/
public SalarySendPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
/**
* 更新
* @param salarySendNew
*/
public void updateById(SalarySendPO salarySendNew) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
mapper.updateIgnoreNull(salarySendNew);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 根据查询条件查询
* @param condition
*/
public List<SalarySendPO> listSomeWithCondition(Map<String, Object> condition) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
return mapper.listSomeWithCondition(condition);
} finally {
sqlSession.close();
}
}
/**
* 根据现有字段查询
* @return
*/
public List<SalarySendPO> listSome(SalarySendPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
return mapper.listSome(po);
} finally {
sqlSession.close();
}
}
/**
* 工资单发放列表分页
* @param queryParam
* @return
*/
public List<SalarySendListDTO> list(SalarySendQueryParam queryParam) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
return mapper.list(queryParam);
} finally {
sqlSession.close();
}
}
public void insert(SalarySendPO salarySend) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
mapper.insertIgnoreNull(salarySend);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchHandleSendStatusHistory() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
mapper.batchHandleSendStatusHistory();
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchHandleSalaryAcctTypeHistory() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendMapper mapper = sqlSession.getMapper(SalarySendMapper.class);
mapper.batchHandleSalaryAcctTypeHistory();
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,148 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salaryBill.dto.SalaryMySalaryBillListDTO;
import com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO;
import com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO;
import com.engine.salary.entity.salaryBill.param.SalaryBillQueryParam;
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.engine.salary.util.SalaryI18nUtil;
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;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
public class SalarySendInfoBiz {
/**
* 查询工资单发放信息列表
*/
public List<SalarySendInfoListDTO> list(SalarySendInfoQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
List<SalarySendInfoListDTO> list = mapper.list(param);
return SalaryI18nUtil.i18nList(list);
} finally {
sqlSession.close();
}
}
/**
* 工资单发放
*
* @param po
* @param salarySendId
* @param statusList
* @param ids
*/
public void updateGrantWithdraw(SalarySendInfoPO po, Long salarySendId, List<Integer> statusList, Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
mapper.updateGrantWithdraw(po, salarySendId, statusList, ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 根据现有字段查询
*
* @param params
* @return
*/
public List<SalarySendInfoPO> listSome(@Param("param") SalarySendInfoPO params) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
return mapper.listSome(params);
} finally {
sqlSession.close();
}
}
public void updateById(SalarySendInfoPO po) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
mapper.updateIgnoreNull(po);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 工资单发放详情列表
*
* @param param
* @param otherSalaryAccRecordIds
* @return
*/
public List<SalarySendDetailListDTO> detailList(@Param("param") SalarySendDetailQueryParam param,
@Param("otherSalaryAccRecordIds") Set<Long> otherSalaryAccRecordIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
List<SalarySendDetailListDTO> detailList = mapper.detailList(param, otherSalaryAccRecordIds);
SalaryI18nUtil.i18nList(detailList);
return detailList;
} finally {
sqlSession.close();
}
}
/**
* 我的工资单列表详情
*
* @param queryParam
* @return
*/
public List<SalaryMySalaryBillListDTO> mySalaryBillList(SalaryBillQueryParam queryParam) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
return mapper.mySalaryBillList(queryParam);
} finally {
sqlSession.close();
}
}
public void batchInsert(List<SalarySendInfoPO> salarySendInfos) {
if (CollectionUtils.isEmpty(salarySendInfos)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
List<List<SalarySendInfoPO>> partition = Lists.partition(salarySendInfos, 100);
partition.forEach(mapper::batchInsert);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<Long> listSalaryAccRecordIds(SalarySendDetailQueryParam queryParam) {
if (null == queryParam) {
return Collections.emptyList();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySendInfoMapper mapper = sqlSession.getMapper(SalarySendInfoMapper.class);
return mapper.listSalaryAccRecordIds(queryParam);
} finally {
sqlSession.close();
}
}
}

View File

@ -1,83 +0,0 @@
package com.engine.salary.biz;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryBill.dto.SalarySendUserInfoDTO;
import com.engine.salary.entity.salaryBill.po.SalarySendRangeObj;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
public class SalarySendRangeObjBiz {
private TaxAgentService getTaxAgentService() {
return ServiceUtil.getService(TaxAgentServiceImpl.class);
}
private SalarySendRangeObjMapper getSalarySendRangeObjMapper() {
return MapperProxyFactory.getProxy(SalarySendRangeObjMapper.class);
}
public <R> R applyMapper(Function<SalarySendRangeObjMapper, R> mapper) {
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class);
R apply = mapper.apply(salarySendRangeObjMapper);
sqlSession.commit();
return apply;
}
}
public void runMapper(Consumer<SalarySendRangeObjMapper> mapper) {
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class);
mapper.accept(salarySendRangeObjMapper);
sqlSession.commit();
}
}
public List<SalarySendUserInfoDTO> getSalarySendUserInfoDTOs(List<Long> employees) {
List<SalarySendUserInfoDTO> userDTOs = new ArrayList<>();
List<List<Long>> partition = Lists.partition(employees, 500);
partition.forEach(l->{
List<SalarySendUserInfoDTO> userInfos = getSalarySendRangeObjMapper().getUserInfoByEmployeeIds(l);
userDTOs.addAll(userInfos);
});
Map<Long, SalarySendUserInfoDTO> userMap = userDTOs.stream()
.collect(Collectors.toMap(SalarySendUserInfoDTO::getResourceId, Function.identity()));
List<Long> employeeIds = userDTOs.stream()
.map(SalarySendUserInfoDTO::getResourceId)
.collect(Collectors.toList());
Collection<TaxAgentEmployeeTaxAgentDTO> employeeAgents
= getTaxAgentService().listAllTaxAgentsAsRange(employeeIds);
for (TaxAgentEmployeeTaxAgentDTO employeeAgent : employeeAgents) {
SalarySendUserInfoDTO info = userMap.get(employeeAgent.getEmployeeId());
if (info != null) {
if (CollectionUtils.isEmpty(info.getTaxAgentIds())) {
info.setTaxAgentIds(new ArrayList<>());
}
info.getTaxAgentIds().addAll(Optional.ofNullable(employeeAgent.getTaxAgentIds()).orElse(Collections.emptyList()));
}
}
return userDTOs;
}
public void replaceAllByRangeId(Long rangeId, List<SalarySendRangeObj> rangeObjs) {
runMapper(mapper -> {
mapper.deleteByRangeIds(Collections.singletonList(rangeId), DEFAULT_TENANT_KEY);
mapper.batchInsert(rangeObjs);
});
}
}

View File

@ -1,50 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO;
import com.engine.salary.mapper.salarysob.SalarySobAdjustRuleMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobAdjustRuleBiz {
public List<SalarySobAdjustRulePO> listBySalarySobId(Long salarySobId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobAdjustRuleMapper mapper = sqlSession.getMapper(SalarySobAdjustRuleMapper.class);
return mapper.listSome(SalarySobAdjustRulePO.builder().salarySobId(salarySobId).build());
} finally {
sqlSession.close();
}
}
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobAdjustRuleMapper mapper = sqlSession.getMapper(SalarySobAdjustRuleMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchInsert(Collection<SalarySobAdjustRulePO> salarySobAdjustRulePOS) {
if (CollectionUtils.isEmpty(salarySobAdjustRulePOS)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobAdjustRuleMapper mapper = sqlSession.getMapper(SalarySobAdjustRuleMapper.class);
List<List<SalarySobAdjustRulePO>> partition = Lists.partition((List) salarySobAdjustRulePOS, 100);
partition.forEach(mapper::batchInsert);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -1,86 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.mapper.salarysob.SalarySobMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobBiz {
public SalarySobPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
public List<SalarySobPO> listSome(SalarySobPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
public List<SalarySobPO> listByParam(SalarySobPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.listByParam(build);
} finally {
sqlSession.close();
}
}
public void insert(SalarySobPO salarySobPO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
mapper.insertIgnoreNull(salarySobPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateById(SalarySobPO newSalarySobPO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
mapper.updateIgnoreNull(newSalarySobPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteByIds(Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
mapper.deleteByIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public List<SalarySobPO> listByName(SalarySobPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobMapper mapper = sqlSession.getMapper(SalarySobMapper.class);
return mapper.listByName(build);
} finally {
sqlSession.close();
}
}
}

View File

@ -1,109 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.mapper.salarysob.SalarySobCheckRuleMapper;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
public class SalarySobCheckRuleBiz {
public SalarySobCheckRulePO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
public List<SalarySobCheckRulePO> listSome(SalarySobCheckRulePO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
public void deleteByIds(Collection<Long> ids) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.deleteByIds(ids);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void updateById(SalarySobCheckRulePO newSalarySobCheckRulePO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.updateIgnoreNull(newSalarySobCheckRulePO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void batchInsert(Collection<SalarySobCheckRulePO> salarySobCheckRulePOS) {
if(CollectionUtils.isEmpty(salarySobCheckRulePOS)){
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
List<List<SalarySobCheckRulePO>> partition = Lists.partition((List) salarySobCheckRulePOS, 100);
partition.forEach(mapper::batchInsert);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void insert(SalarySobCheckRulePO salarySobCheckRulePO) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.insertIgnoreNull(salarySobCheckRulePO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
mapper.deleteBySalarySobIds(salarySobIds);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
public PageInfo<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
List<SalarySobCheckRulePO> list = mapper.listByParam(param);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(),
list, SalarySobCheckRulePO.class);
} finally {
sqlSession.close();
}
}
}

View File

@ -1,22 +0,0 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.po.SalarySobDefaultItemPO;
import com.engine.salary.mapper.salarysob.SalarySobDefaultItemMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.List;
public class SalarySobDefaultItemBiz {
public List<SalarySobDefaultItemPO> listByIncomeCategory(SalarySobDefaultItemPO build) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobDefaultItemMapper mapper = sqlSession.getMapper(SalarySobDefaultItemMapper.class);
return mapper.listSome(build);
} finally {
sqlSession.close();
}
}
}

Some files were not shown because too many files have changed in this diff Show More