路维光编制需求
This commit is contained in:
parent
f13dfcb3bb
commit
18e9101c31
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.api.newwaymask.web;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author liang.cheng
|
||||||
|
* @Date 2025/4/22 18:07
|
||||||
|
* @Description:
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public class StaffDutyAction {
|
||||||
|
}
|
||||||
|
|
@ -17,13 +17,9 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class StaffDutyResult {
|
public class StaffDutyResult {
|
||||||
|
|
||||||
private boolean status;
|
private Boolean status;
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
private Integer frozenNums;
|
private StaffPlan staffPlan;
|
||||||
|
|
||||||
private Integer onJobNums;
|
|
||||||
|
|
||||||
private Integer restNums;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,17 @@ public class StaffPlan {
|
||||||
|
|
||||||
private Integer restNums;
|
private Integer restNums;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "StaffPlan{" +
|
||||||
|
"id=" + id +
|
||||||
|
", 岗位id=" + jobId +
|
||||||
|
", 编制归属=" + staffBelong +
|
||||||
|
", 任职类型=" + jobType +
|
||||||
|
", 总编制计划数=" + staffPlanNums +
|
||||||
|
", 冻结编制数=" + frozenNums +
|
||||||
|
", 在编人数=" + onJobNums +
|
||||||
|
", 剩余人数=" + restNums +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,29 @@ public interface StaffDutyService {
|
||||||
* @param: []
|
* @param: []
|
||||||
* @return: com.engine.newwaymask.entity.StaffDutyResult
|
* @return: com.engine.newwaymask.entity.StaffDutyResult
|
||||||
*/
|
*/
|
||||||
StaffDutyResult entryWorkflow(String requestId);
|
StaffDutyResult entryWorkflow(String requestId,String operateType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 离职类型
|
||||||
|
* @Author: liang.cheng
|
||||||
|
* @Date: 2025/4/22 16:04
|
||||||
|
* @param: [requestId, operateType]
|
||||||
|
* @return: com.engine.newwaymask.entity.StaffDutyResult
|
||||||
|
*/
|
||||||
|
StaffDutyResult leaveWorkflow(String requestId,String operateType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 调动类型
|
||||||
|
* @Author: liang.cheng
|
||||||
|
* @Date: 2025/4/22 16:04
|
||||||
|
* @param: [requestId, operateType]
|
||||||
|
* @return: com.engine.newwaymask.entity.StaffDutyResult
|
||||||
|
*/
|
||||||
|
StaffDutyResult transferWorkflow(String requestId,String operateType);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,10 @@ import com.engine.newwaymask.entity.JobRecord;
|
||||||
import com.engine.newwaymask.entity.StaffDutyResult;
|
import com.engine.newwaymask.entity.StaffDutyResult;
|
||||||
import com.engine.newwaymask.entity.StaffPlan;
|
import com.engine.newwaymask.entity.StaffPlan;
|
||||||
import com.engine.newwaymask.service.StaffDutyService;
|
import com.engine.newwaymask.service.StaffDutyService;
|
||||||
|
import com.weaver.general.BaseBean;
|
||||||
import com.weaver.general.Util;
|
import com.weaver.general.Util;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.conn.RecordSetTrans;
|
||||||
import weaver.general.StringUtil;
|
import weaver.general.StringUtil;
|
||||||
import weaver.general.TimeUtil;
|
import weaver.general.TimeUtil;
|
||||||
|
|
||||||
|
|
@ -33,7 +35,7 @@ public class StaffDutyServiceImpl extends Service implements StaffDutyService {
|
||||||
"left join uf_zt c on a.gwzt = c.id \n" +
|
"left join uf_zt c on a.gwzt = c.id \n" +
|
||||||
"where c.on_job = 0 and a.ksrq <= ? and a.jsrq >= ?";
|
"where c.on_job = 0 and a.ksrq <= ? and a.jsrq >= ?";
|
||||||
if (!StringUtil.isEmpty(requestId)) {
|
if (!StringUtil.isEmpty(requestId)) {
|
||||||
sql += " and a.requestid = "+requestId;
|
sql += " and a.lcid = "+requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
String currentDate = TimeUtil.getCurrentDateString();
|
String currentDate = TimeUtil.getCurrentDateString();
|
||||||
|
|
@ -48,6 +50,7 @@ public class StaffDutyServiceImpl extends Service implements StaffDutyService {
|
||||||
.lastId(Util.getIntValue(rs.getString("sydrzid")))
|
.lastId(Util.getIntValue(rs.getString("sydrzid")))
|
||||||
.jobId(Util.getIntValue(rs.getString("gw")))
|
.jobId(Util.getIntValue(rs.getString("gw")))
|
||||||
.staffBelong(Util.getIntValue(rs.getString("gwszbz")))
|
.staffBelong(Util.getIntValue(rs.getString("gwszbz")))
|
||||||
|
.jobType(Util.getIntValue(rs.getString("rzlx")))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +113,164 @@ public class StaffDutyServiceImpl extends Service implements StaffDutyService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StaffDutyResult entryWorkflow(String requestId) {
|
public StaffDutyResult entryWorkflow(String requestId,String operateType) {
|
||||||
|
|
||||||
|
StaffDutyResult result = buildStaffPlan(requestId);
|
||||||
|
if (!result.getStatus()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
StaffPlan staffPlan = result.getStaffPlan();
|
||||||
|
BaseBean bb = new BaseBean();
|
||||||
|
bb.writeLog(String.format("entryWorkflow requestid:%s 更新前编制方案信息: %s",requestId,staffPlan.toString()));
|
||||||
|
|
||||||
|
//4.增加在编数 更新剩余数(业务上说明无脑加减)
|
||||||
|
Integer onJob = staffPlan.getOnJobNums() + 1;
|
||||||
|
LinkedList<Integer> numbers = new LinkedList<>(Arrays.asList(staffPlan.getStaffPlanNums(), staffPlan.getFrozenNums(), onJob));
|
||||||
|
int rest = numbers.stream()
|
||||||
|
.findFirst()
|
||||||
|
.map(first -> first - numbers.stream().skip(1).mapToInt(Integer::intValue).sum())
|
||||||
|
.orElse(0);
|
||||||
|
|
||||||
|
//5.编制计划表更新
|
||||||
|
Boolean flag = updateStaffPlan(onJob, rest, staffPlan.getId());
|
||||||
|
if (flag) {
|
||||||
|
result.setStatus(true);
|
||||||
|
result.setMessage(String.format("编制信息id:%s所对应数据更新成功",staffPlan.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// //4.流程提交
|
||||||
|
// if ("submit".equals(operateType)) {
|
||||||
|
// //1.增加冻结数,更新剩余数
|
||||||
|
// }
|
||||||
|
// //5.流程退回
|
||||||
|
// if ("reject".equals(operateType)) {
|
||||||
|
// //1.减少冻结数,更新剩余数
|
||||||
|
// }
|
||||||
|
// //6.流程归档
|
||||||
|
// if ("".equals(operateType)) {
|
||||||
|
// //1.减少冻结数,增加在编数 更新剩余数
|
||||||
|
// }
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StaffDutyResult leaveWorkflow(String requestId, String operateType) {
|
||||||
|
StaffDutyResult result = buildStaffPlan(requestId);
|
||||||
|
if (!result.getStatus()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
StaffPlan staffPlan = result.getStaffPlan();
|
||||||
|
BaseBean bb = new BaseBean();
|
||||||
|
bb.writeLog(String.format("leaveWorkflow requestid:%s 更新前编制方案信息: %s",requestId,staffPlan.toString()));
|
||||||
|
|
||||||
|
//4.减少在编数 更新剩余数
|
||||||
|
Integer onJob = staffPlan.getOnJobNums() - 1;
|
||||||
|
LinkedList<Integer> numbers = new LinkedList<>(Arrays.asList(staffPlan.getStaffPlanNums(), staffPlan.getFrozenNums(), onJob));
|
||||||
|
int rest = numbers.stream()
|
||||||
|
.findFirst()
|
||||||
|
.map(first -> first - numbers.stream().skip(1).mapToInt(Integer::intValue).sum())
|
||||||
|
.orElse(0);
|
||||||
|
|
||||||
|
//5.编制计划表更新
|
||||||
|
Boolean flag = updateStaffPlan(onJob, rest, staffPlan.getId());
|
||||||
|
if (flag) {
|
||||||
|
result.setStatus(true);
|
||||||
|
result.setMessage(String.format("编制信息id:%s所对应数据更新成功",staffPlan.getId()));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StaffDutyResult transferWorkflow(String requestId, String operateType) {
|
||||||
|
|
||||||
|
StaffDutyResult result = new StaffDutyResult();
|
||||||
|
//1.获取任职数据信息
|
||||||
|
List<JobRecord> jobRecords = selectJobRecords(requestId);
|
||||||
|
if (jobRecords.size() == 0) {
|
||||||
|
result.setMessage(String.format("未查询到requestId:%s所对应的调入后任职记录数据,请检查流程转建模配置",requestId));
|
||||||
|
result.setStatus(false);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//2.获取需要更新的编制执行情况数据
|
||||||
|
JobRecord jobRecord = jobRecords.get(0);
|
||||||
|
List<StaffPlan> staffPlans = selectStaffPlans(jobRecord, false);
|
||||||
|
if (staffPlans.size() == 0) {
|
||||||
|
result.setMessage(String.format("requestId:%s所对应的调入后任职记录数据在当前编制计划中未匹配到,请检查参数",requestId));
|
||||||
|
result.setStatus(false);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//3.若匹配多条数据 获取id 较大的那条数据作为最新数据
|
||||||
|
StaffPlan staffPlanTo = staffPlans.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.max(Comparator.comparing(StaffPlan::getId))
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
BaseBean bb = new BaseBean();
|
||||||
|
bb.writeLog(String.format("transferWorkflow requestid:%s 调入后岗位对应编制方案信息: %s",requestId,staffPlanTo.toString()));
|
||||||
|
|
||||||
|
//调出前岗位信息所对应编制信息
|
||||||
|
JobRecord jobRecordFrom = selectJobRecordById(staffPlanTo.getId());
|
||||||
|
if (Objects.isNull(jobRecordFrom)) {
|
||||||
|
result.setMessage(String.format("未查询到requestId:%s所对应的调出前岗位对应任职记录数据,请检查任职记录表",requestId));
|
||||||
|
result.setStatus(false);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<StaffPlan> staffPlansFrom = selectStaffPlans(jobRecordFrom, false);
|
||||||
|
if (staffPlansFrom.size() == 0) {
|
||||||
|
result.setMessage(String.format("requestId:%s所对应的调出前岗位任职记录数据在当前编制计划中未匹配到,请检查参数",requestId));
|
||||||
|
result.setStatus(false);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
StaffPlan staffPlanFrom = staffPlans.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.max(Comparator.comparing(StaffPlan::getId))
|
||||||
|
.orElse(null);
|
||||||
|
bb.writeLog(String.format("transferWorkflow requestid:%s 调出前岗位对应编制方案信息: %s",requestId,staffPlanFrom.toString()));
|
||||||
|
|
||||||
|
|
||||||
|
//调出前岗位对应编制方案增加在编数 更新剩余数
|
||||||
|
//4.(业务上说明无脑加减)
|
||||||
|
Integer onJobFrom = staffPlanFrom.getOnJobNums() + 1;
|
||||||
|
LinkedList<Integer> numberFrom = new LinkedList<>(Arrays.asList(staffPlanFrom.getStaffPlanNums(), staffPlanFrom.getFrozenNums(), onJobFrom));
|
||||||
|
int restFrom = numberFrom.stream()
|
||||||
|
.findFirst()
|
||||||
|
.map(first -> first - numberFrom.stream().skip(1).mapToInt(Integer::intValue).sum())
|
||||||
|
.orElse(0);
|
||||||
|
|
||||||
|
//4.调入后岗位对应编制方案减少在编数 更新剩余数
|
||||||
|
Integer onJobTo = staffPlanTo.getOnJobNums() - 1;
|
||||||
|
LinkedList<Integer> numberTo = new LinkedList<>(Arrays.asList(staffPlanTo.getStaffPlanNums(), staffPlanTo.getFrozenNums(), onJobTo));
|
||||||
|
int restTo = numberTo.stream()
|
||||||
|
.findFirst()
|
||||||
|
.map(first -> first - numberTo.stream().skip(1).mapToInt(Integer::intValue).sum())
|
||||||
|
.orElse(0);
|
||||||
|
|
||||||
|
RecordSetTrans trans = new RecordSetTrans();
|
||||||
|
try {
|
||||||
|
trans.setAutoCommit(false);
|
||||||
|
|
||||||
|
trans.executeUpdate("update uf_bzjh set zbrs = ?,syrs = ? where id = ?", onJobFrom, restFrom, staffPlanFrom.getId());
|
||||||
|
trans.executeUpdate("update uf_bzjh set zbrs = ?,syrs = ? where id = ?", onJobTo, restTo, staffPlanTo.getId());
|
||||||
|
trans.commit();
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
trans.rollback();
|
||||||
|
result.setMessage("编制信息更新失败,请联系管理员");
|
||||||
|
result.setStatus(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private StaffDutyResult buildStaffPlan(String requestId) {
|
||||||
|
|
||||||
StaffDutyResult result = new StaffDutyResult();
|
StaffDutyResult result = new StaffDutyResult();
|
||||||
//1.获取任职数据信息
|
//1.获取任职数据信息
|
||||||
|
|
@ -118,21 +278,51 @@ public class StaffDutyServiceImpl extends Service implements StaffDutyService {
|
||||||
if (jobRecords.size() == 0) {
|
if (jobRecords.size() == 0) {
|
||||||
result.setMessage(String.format("未查询到requestId:%s所对应的任职记录数据,请检查流程转建模配置",requestId));
|
result.setMessage(String.format("未查询到requestId:%s所对应的任职记录数据,请检查流程转建模配置",requestId));
|
||||||
result.setStatus(false);
|
result.setStatus(false);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//2.获取需要更新的编制执行情况数据
|
//2.获取需要更新的编制执行情况数据
|
||||||
List<StaffPlan> staffPlans = selectStaffPlans(jobRecords.get(0), false);
|
List<StaffPlan> staffPlans = selectStaffPlans(jobRecords.get(0), false);
|
||||||
if (staffPlans.size() == 0) {
|
if (staffPlans.size() == 0) {
|
||||||
result.setMessage(String.format("requestId:%s所对应的任职记录数据在当前编制计划中未匹配,请检查参数",requestId));
|
result.setMessage(String.format("requestId:%s所对应的任职记录数据在当前编制计划中未匹配到,请检查参数",requestId));
|
||||||
result.setStatus(false);
|
result.setStatus(false);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//3.若匹配多条数据 获取id 较大的那条数据作为最新数据
|
//3.若匹配多条数据 获取id 较大的那条数据作为最新数据
|
||||||
|
StaffPlan staffPlan = staffPlans.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.max(Comparator.comparing(StaffPlan::getId))
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
result.setStatus(true);
|
||||||
|
result.setStaffPlan(staffPlan);
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean updateStaffPlan(Integer onJob,Integer rest,Integer id) {
|
||||||
|
//5.编制计划表更新
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
return rs.executeUpdate("update uf_bzjh set zbrs = ?,syrs = ? where id = ?", onJob, rest, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private JobRecord selectJobRecordById(Integer id) {
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
JobRecord jobRecord = null;
|
||||||
|
rs.executeQuery("select a.id,a.rzlx,a.gw,b.gwszbz from uf_rzxxb a left join uf_gwgl b on a.gw = b.id where a.id = ?",id);
|
||||||
|
if (rs.next()) {
|
||||||
|
return JobRecord.builder()
|
||||||
|
.id(Util.getIntValue(rs.getString("id")))
|
||||||
|
.resourceId(Util.getIntValue(rs.getString("rzry")))
|
||||||
|
.lastId(Util.getIntValue(rs.getString("sydrzid")))
|
||||||
|
.jobId(Util.getIntValue(rs.getString("gw")))
|
||||||
|
.staffBelong(Util.getIntValue(rs.getString("gwszbz")))
|
||||||
|
.jobType(Util.getIntValue(rs.getString("rzlx")))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
return jobRecord;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
package weaver.interfaces.newwaymask.action;
|
package weaver.interfaces.newwaymask.action;
|
||||||
|
|
||||||
|
import com.engine.newwaymask.entity.StaffDutyResult;
|
||||||
|
import com.engine.newwaymask.service.impl.StaffDutyServiceImpl;
|
||||||
|
import com.weaver.general.Util;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
import weaver.interfaces.workflow.action.Action;
|
import weaver.interfaces.workflow.action.Action;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author liang.cheng
|
* @Author liang.cheng
|
||||||
* @Date 2025/4/1 11:48
|
* @Date 2025/4/1 11:48
|
||||||
* @Description: 流程更新编制信息(归档 + 退回)
|
* @Description: 流程更新编制信息(归档)
|
||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
public class StaffByEndWorkflowAction implements Action {
|
public class StaffByEndWorkflowAction implements Action {
|
||||||
|
|
@ -14,12 +18,38 @@ public class StaffByEndWorkflowAction implements Action {
|
||||||
@Override
|
@Override
|
||||||
public String execute(RequestInfo requestInfo) {
|
public String execute(RequestInfo requestInfo) {
|
||||||
|
|
||||||
|
String requestid = requestInfo.getRequestid();
|
||||||
|
int formid = Math.abs(requestInfo.getRequestManager().getFormid());
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String mainTable = String.format("%s%s", "formtable_main_", formid);
|
||||||
|
rs.executeQuery("select bzlx from "+mainTable+" where requestid = ?",requestid);
|
||||||
|
rs.next();
|
||||||
|
int bzlx = Util.getIntValue(rs.getString("bzlx"));
|
||||||
|
StaffDutyServiceImpl staffDutyService = new StaffDutyServiceImpl();
|
||||||
|
StaffDutyResult result = new StaffDutyResult();
|
||||||
|
switch(bzlx) {
|
||||||
|
case 0:
|
||||||
|
result = staffDutyService.entryWorkflow(requestid, "");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
result = staffDutyService.transferWorkflow(requestid, "");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
result = staffDutyService.leaveWorkflow(requestid, "");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result.setStatus(false);
|
||||||
|
result.setMessage("流程表单未配置编制类型字段,分类无法匹配");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (result.getStatus()) {
|
||||||
|
requestInfo.getRequestManager().setMessagecontent(result.getMessage());
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}else {
|
||||||
return null;
|
requestInfo.getRequestManager().setMessagecontent(result.getMessage());
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import weaver.soa.workflow.request.RequestInfo;
|
||||||
/**
|
/**
|
||||||
* @Author liang.cheng
|
* @Author liang.cheng
|
||||||
* @Date 2025/4/1 11:48
|
* @Date 2025/4/1 11:48
|
||||||
* @Description: 流程更新编制信息(提交)
|
* @Description: 流程更新编制信息(提交 + 退回)
|
||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
public class StaffBySubmitWorkflowAction implements Action {
|
public class StaffBySubmitWorkflowAction implements Action {
|
||||||
|
|
@ -14,10 +14,6 @@ public class StaffBySubmitWorkflowAction implements Action {
|
||||||
@Override
|
@Override
|
||||||
public String execute(RequestInfo requestInfo) {
|
public String execute(RequestInfo requestInfo) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue