2025-03-03 16:16:23 +08:00
|
|
|
|
package weaver.interfaces.hzzx.action;
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.hzzx.conn.DataUtil;
|
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
|
import weaver.interfaces.workflow.action.Action;
|
|
|
|
|
|
import weaver.soa.workflow.request.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 5.2.2.2培训实施申请
|
|
|
|
|
|
* 流程归档,写入建模表
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author:dxfeng
|
|
|
|
|
|
* @createTime: 2025/02/28
|
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public class TrainingApplicationAction implements Action {
|
|
|
|
|
|
|
|
|
|
|
|
private static final String MODE_TABLE_NAME = "uf_pxsssq";
|
|
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String execute(RequestInfo requestInfo) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
|
|
|
|
|
Property[] properties = mainTableInfo.getProperty();
|
|
|
|
|
|
Map<String, String> mainDataMap = new HashMap<>();
|
|
|
|
|
|
for (Property property : properties) {
|
|
|
|
|
|
mainDataMap.put(property.getName(), property.getValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 插入主表数据,并生成ID
|
|
|
|
|
|
int mainId = insertMainTable(mainDataMap);
|
|
|
|
|
|
if (-1 == mainId) {
|
|
|
|
|
|
requestInfo.getRequestManager().setMessagecontent("流程数据写入建模主表失败");
|
|
|
|
|
|
return FAILURE_AND_CONTINUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
|
|
|
|
|
DetailTable[] detailTables = detailTableInfo.getDetailTable();
|
|
|
|
|
|
for (int i = 0; i < detailTables.length; i++) {
|
|
|
|
|
|
String detailTableName = MODE_TABLE_NAME + "_" + (i + 1);
|
|
|
|
|
|
DetailTable table = detailTables[i];
|
|
|
|
|
|
Row[] rows = table.getRow();
|
|
|
|
|
|
for (Row row : rows) {
|
|
|
|
|
|
Map<String, String> detailDataMap = new HashMap<>();
|
|
|
|
|
|
detailDataMap.put("mainid", String.valueOf(mainId));
|
|
|
|
|
|
Cell[] cells = row.getCell();
|
|
|
|
|
|
for (Cell cell : cells) {
|
|
|
|
|
|
detailDataMap.put(cell.getName(), cell.getValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
// 插入明细表数据
|
|
|
|
|
|
insertDetailTable(detailDataMap, detailTableName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
rs.writeLog(e);
|
|
|
|
|
|
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
|
|
|
|
|
|
return FAILURE_AND_CONTINUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 插入主表
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param mainDataMap
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private int insertMainTable(Map<String, String> mainDataMap) {
|
|
|
|
|
|
String operateId = mainDataMap.get("sqr");
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> insertData = new HashMap<>();
|
|
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
|
|
insertData.put("modeuuid", uuid);
|
|
|
|
|
|
int formModeId = DataUtil.getModeIdByTableName(MODE_TABLE_NAME);
|
|
|
|
|
|
insertData.put("formmodeid", String.valueOf(formModeId));
|
2025-03-18 09:16:51 +08:00
|
|
|
|
DataUtil.buildModeInsertFields(insertData, operateId);
|
2025-03-03 16:16:23 +08:00
|
|
|
|
|
|
|
|
|
|
insertData.put("pxrs", mainDataMap.get("pxrs"));
|
|
|
|
|
|
insertData.put("pxdx", mainDataMap.get("pxdx"));
|
|
|
|
|
|
insertData.put("szbm", mainDataMap.get("szbm"));
|
|
|
|
|
|
insertData.put("pxdd", mainDataMap.get("pxdd"));
|
|
|
|
|
|
insertData.put("jssjyc", mainDataMap.get("jssjyc"));
|
|
|
|
|
|
insertData.put("pxsj", mainDataMap.get("pxsj"));
|
|
|
|
|
|
insertData.put("sqr", mainDataMap.get("sqr"));
|
|
|
|
|
|
// insertData.put("pxzt",mainDataMap.get("pxzt"));
|
|
|
|
|
|
insertData.put("sfzndjhn", mainDataMap.get("sfzndjhn"));
|
|
|
|
|
|
insertData.put("pxmc", mainDataMap.get("pxmc"));
|
|
|
|
|
|
insertData.put("xs", mainDataMap.get("xs"));
|
|
|
|
|
|
insertData.put("jf", mainDataMap.get("jf"));
|
|
|
|
|
|
DataUtil.insertData(insertData, MODE_TABLE_NAME);
|
|
|
|
|
|
return DataUtil.refreshRight(uuid, MODE_TABLE_NAME, formModeId, operateId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 插入子表
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param detailDataMap
|
|
|
|
|
|
* @param detailTableName
|
|
|
|
|
|
*/
|
|
|
|
|
|
private void insertDetailTable(Map<String, String> detailDataMap, String detailTableName) {
|
|
|
|
|
|
DataUtil.insertData(detailDataMap, detailTableName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|