ADD-显示关联阶段的数据

This commit is contained in:
dxfeng 2024-07-16 09:09:27 +08:00
parent 9cf81d8cf2
commit 06b2da68fb
3 changed files with 165 additions and 0 deletions

View File

@ -0,0 +1,51 @@
package weaver.formmode.recruit.modeexpand.process;
import cn.hutool.core.convert.Convert;
import org.apache.commons.lang3.StringUtils;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.MainTableInfo;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/07/15
* @version: 1.0
*/
public class DeleteFlowStageModeExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<>();
try {
String billId;
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
if (requestInfo != null) {
billId = requestInfo.getRequestid();
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
Map<String, String> mainDataMap = new HashMap<>();
for (Property property : properties) {
mainDataMap.put(property.getName(), property.getValue());
}
int flowId = Convert.toInt(mainDataMap.get("zplc"), -1);
int hjId = Convert.toInt(mainDataMap.get("hj"), -1);
// 开始阶段
if (-1 != flowId && StringUtils.isNotBlank(billId)) {
// 更新流程表单的阶段ID
StageDataInsert.deleteFlowStageId(flowId, Convert.toInt(billId, -1), hjId);
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
result.put("errmsg", e.getMessage());
result.put("flag", "false");
}
return result;
}
}

View File

@ -1,5 +1,7 @@
package weaver.formmode.recruit.modeexpand.process;
import cn.hutool.core.convert.Convert;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
@ -47,6 +49,74 @@ public class StageDataInsert {
String insertSql = "insert into uf_jcl_zpjdsz (modeuuid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatacreatertype, formmodeid, jdmc, jdms, jdlx, hj, sfqy, zssx, zpjd, " + relateField + ") values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
if (StringUtils.isNotBlank(processIdsStr)) {
insertMainTableData(creator, billId, processIdsStr, insertSql, paramsList);
// 更新流程表单的阶段ID
updateFlowStageId(Integer.parseInt(billId));
}
}
/**
* 更新流程表单的阶段ID
*
* @param flowId
*/
public static void updateFlowStageId(Integer flowId) {
RecordSet rs = new RecordSet();
Integer ksjd = null;
String gcjd = null;
Integer jsjd = null;
rs.executeQuery("select id from uf_jcl_zpjdsz where hj = 0 and zplc = ?", flowId);
if (rs.next()) {
ksjd = Convert.toInt(rs.getString("id"), null);
}
rs.executeQuery("select id from uf_jcl_zpjdsz where hj = 1 and zplc = ? order by hj,zssx", flowId);
List<Integer> gcjdList = new ArrayList<>();
while (rs.next()) {
Integer gcjdId = Convert.toInt(rs.getString("id"), null);
if (null != gcjdId) {
gcjdList.add(gcjdId);
}
}
if (CollectionUtils.isNotEmpty(gcjdList)) {
gcjd = StringUtils.join(gcjdList, ",");
}
rs.executeQuery("select id from uf_jcl_zpjdsz where hj = 2 and zplc = ?", flowId);
if (rs.next()) {
jsjd = Convert.toInt(rs.getString("id"), null);
}
// 插入之后更新流程表的阶段浏览按钮ID
rs.executeUpdate("update uf_jcl_zplc set ksjd = ?, gcjd = ?, jsjd = ? where id = ?", ksjd, gcjd, jsjd, flowId);
}
/**
* 删除流程表单的阶段ID
*
* @param flowId
* @param stageId
* @param hjId
*/
public static void deleteFlowStageId(Integer flowId, Integer stageId, Integer hjId) {
RecordSet rs = new RecordSet();
if (hjId == 0) {
rs.executeUpdate("update uf_jcl_zplc set ksjd = null where id = ?", flowId);
} else if (hjId == 2) {
rs.executeUpdate("update uf_jcl_zplc set jsjd = null where id = ?", flowId);
} else if (hjId == 1) {
String gcjd = null;
rs.executeQuery("select id from uf_jcl_zpjdsz where hj = 1 and zplc = ? order by hj,zssx", flowId);
List<Integer> gcjdList = new ArrayList<>();
while (rs.next()) {
Integer gcjdId = Convert.toInt(rs.getString("id"), null);
if (null != gcjdId && !gcjdId.equals(stageId)) {
gcjdList.add(gcjdId);
}
}
if (CollectionUtils.isNotEmpty(gcjdList)) {
gcjd = StringUtils.join(gcjdList, ",");
}
rs.executeUpdate("update uf_jcl_zplc set gcjd = ? where id = ?", gcjd, flowId);
}
}

View File

@ -0,0 +1,44 @@
package weaver.formmode.recruit.modeexpand.process;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/07/15
* @version: 1.0
*/
public class UpdateFlowStageModeExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<>();
try {
String billId;
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
if (requestInfo != null) {
billId = requestInfo.getRequestid();
int flowId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select zplc from uf_jcl_zpjdsz where id = ? ", billId);
if(rs.next()) {
flowId = rs.getInt("zplc");
}
// 开始阶段
if (-1 != flowId) {
// 更新流程表单的阶段ID
StageDataInsert.updateFlowStageId(flowId);
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
result.put("errmsg", e.getMessage());
result.put("flag", "false");
}
return result;
}
}