Compare commits

...

10 Commits

19 changed files with 1399 additions and 487 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/ecology-develop.iml
/E9-bmj.iml
/out/
/.idea/

View File

@ -0,0 +1,12 @@
package com.api.secret.web;
import javax.ws.rs.Path;
/**
* @author:dxfeng
* @createTime: 2025/04/16
* @version: 1.0
*/
@Path("/secret/auto/number")
public class AutoGenerateNumberController extends com.engine.secret.web.AutoGenerateNumberController{
}

View File

@ -0,0 +1,24 @@
package com.engine.secret.entity.autonumber;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2025/04/16
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AcceptanceNumber {
private Integer id;
private Integer year;
private Integer month;
private Integer monthlySerial;
private Integer globalSerial;
private Integer secretType;
}

View File

@ -0,0 +1,15 @@
package com.engine.secret.entity.unpack;
import lombok.Data;
/**
* @author:dxfeng
* @createTime: 2025/04/30
* @version: 1.0
*/
@Data
public class CheckFields {
private String name;
private String fields;
private String formFields;
}

View File

@ -0,0 +1,24 @@
package com.engine.secret.entity.unpack;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author:dxfeng
* @createTime: 2025/04/30
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UnpackParam {
private String docId;
private String requestId;
private boolean isCorrection;
private List<CheckFields> checkFields;
}

View File

@ -0,0 +1,234 @@
package com.engine.secret.instance;
import cn.hutool.core.convert.Convert;
import com.engine.secret.entity.autonumber.AcceptanceNumber;
import com.engine.secret.exception.CustomizeRunTimeException;
import com.engine.secret.util.ModeUtil;
import weaver.common.DateUtil;
import weaver.conn.RecordSetTrans;
import weaver.formmode.IgnoreCaseHashMap;
import weaver.general.Util;
import weaver.hrm.User;
import java.time.LocalDate;
import java.util.Map;
import java.util.UUID;
/**
* @author:dxfeng
* @createTime: 2025/04/16
* @version: 1.0
*/
public class AutoGenerateNumberInstance {
private static final String TABLE_NAME = "uf_sldh";
private static final String RECORD_TABLE_NAME = "uf_sldh_dt1";
private static final AutoGenerateNumberInstance INSTANCE = new AutoGenerateNumberInstance();
private AutoGenerateNumberInstance() {
// 私有化构造方法
}
public static AutoGenerateNumberInstance getInstance() {
return INSTANCE;
}
/**
* 集成印制受理编号
*
* @param param
* @return
*/
public synchronized String getAcceptanceNumber(User user, Map<String, Object> param) {
RecordSetTrans rs = new RecordSetTrans();
rs.setAutoCommit(false);
try {
Integer secretType = Convert.toInt(param.get("secretType"));
String requestId = Util.null2String(param.get("requestId"));
LocalDate now = LocalDate.now();
int year = now.getYear();
int currentMonth = now.getMonthValue();
AcceptanceNumber yearNumber;
rs.executeQuery("select * from uf_sldh where secret_type= ? and year = ? and month = 0 FOR UPDATE", secretType, year);
if (rs.next()) {
yearNumber = getSelectNum(rs);
} else {
yearNumber = buildNewNum(year, 0, secretType);
}
yearNumber.setGlobalSerial(yearNumber.getGlobalSerial() + 1);
// 更新年度流水号
saveNum(rs, yearNumber);
AcceptanceNumber monthNumber;
rs.executeQuery("select * from uf_sldh where secret_type= ? and year = ? and month = ? FOR UPDATE", secretType, year, currentMonth);
if (rs.next()) {
monthNumber = getSelectNum(rs);
} else {
monthNumber = buildNewNum(year, currentMonth, secretType);
}
monthNumber.setMonthlySerial(monthNumber.getMonthlySerial() + 1);
// 更新月度流水号
saveNum(rs, monthNumber);
// 生成编号
String formattedYear = String.format("%04d", year);
String formattedMonth = String.format("%02d", monthNumber.getMonth());
String formattedMonthlySerial = String.format("%02d", monthNumber.getMonthlySerial());
String formattedGlobalSerial = String.format("%03d", yearNumber.getGlobalSerial());
String num = formattedYear + formattedMonth + formattedMonthlySerial + formattedGlobalSerial;
rs.writeLog("requestId===" + requestId + ",secretType===" + secretType + ",num===" + num);
insertGenerateRecord(rs, requestId, num, user.getUID());
// 插入编号生成记录
rs.commit();
return num;
} catch (Exception e) {
rs.rollback();
rs.writeLog(e);
throw new CustomizeRunTimeException(e.getMessage());
}
}
/**
* 军工受理单号
*
* @param param
* @return
*/
public synchronized String getWarIndustryAcceptanceNumber(User user, Map<String, Object> param) {
RecordSetTrans rs = new RecordSetTrans();
rs.setAutoCommit(false);
try {
Integer secretType = Convert.toInt(param.get("secretType"));
String requestId = Util.null2String(param.get("requestId"));
LocalDate now = LocalDate.now();
int year = now.getYear();
AcceptanceNumber yearNumber;
rs.executeQuery("select * from uf_sldh where secret_type= ? and year = ? and month = 0 FOR UPDATE", secretType, year);
if (rs.next()) {
yearNumber = getSelectNum(rs);
} else {
yearNumber = buildNewNum(year, 0, secretType);
}
yearNumber.setGlobalSerial(yearNumber.getGlobalSerial() + 1);
// 更新年度流水号
saveNum(rs, yearNumber);
// 生成编号
String formattedYear = String.format("%04d", year);
String formattedGlobalSerial = String.format("%03d", yearNumber.getGlobalSerial());
String num = "JS" + formattedYear + formattedGlobalSerial;
rs.writeLog("requestId===" + requestId + ",secretType===" + secretType + ",num===" + num);
insertGenerateRecord(rs, requestId, num, user.getUID());
rs.commit();
return num;
} catch (Exception e) {
rs.rollback();
rs.writeLog(e);
throw new CustomizeRunTimeException(e.getMessage());
}
}
/**
* 构建查询对象
*
* @param rs
* @return
*/
private AcceptanceNumber getSelectNum(RecordSetTrans rs) {
return AcceptanceNumber.builder()
.id(rs.getInt("id"))
.year(rs.getInt("year"))
.month(rs.getInt("month"))
.monthlySerial(rs.getInt("monthly_serial"))
.globalSerial(rs.getInt("global_serial"))
.secretType(rs.getInt("secret_type"))
.build();
}
/**
* 构建新对象
*
* @param year
* @param currentMonth
* @param secretType
* @return
*/
private AcceptanceNumber buildNewNum(Integer year, Integer currentMonth, Integer secretType) {
return AcceptanceNumber.builder()
.year(year)
.month(currentMonth)
.monthlySerial(0)
.globalSerial(0)
.secretType(secretType)
.build();
}
/**
* 保存编号数据
*
* @param rs
* @param number
* @throws Exception
*/
private void saveNum(RecordSetTrans rs, AcceptanceNumber number) throws Exception {
if (null == number.getId()) {
Map<String, Object> insertMap = buildSaveMap(number);
String uuid = UUID.randomUUID().toString();
insertMap.put("modeuuid", uuid);
int formModeId = ModeUtil.getModeIdByTableName(TABLE_NAME);
insertMap.put("formmodeid", formModeId);
ModeUtil.buildModeInsertFields(insertMap, 1);
ModeUtil.insertData(rs, insertMap, TABLE_NAME);
ModeUtil.refreshRight(uuid, TABLE_NAME, formModeId, 1);
} else {
Map<String, Object> updateMap = buildSaveMap(number);
ModeUtil.buildModeUpdateFields(updateMap, 1);
ModeUtil.updateDataById(rs, updateMap, TABLE_NAME);
}
}
/**
* 构建数据库映射关系
*
* @param number
* @return
*/
private IgnoreCaseHashMap<String, Object> buildSaveMap(AcceptanceNumber number) {
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
if (null != number.getId()) {
dataMap.put("id", number.getId());
}
dataMap.put("year", number.getYear());
dataMap.put("month", number.getMonth());
dataMap.put("monthly_serial", number.getMonthlySerial());
dataMap.put("global_serial", number.getGlobalSerial());
dataMap.put("secret_type", number.getSecretType());
return dataMap;
}
/**
* 插入编号生成记录
*
* @param requestId
* @param num
* @param userId
*/
private void insertGenerateRecord(RecordSetTrans rs, String requestId, String num, int userId) throws Exception {
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
dataMap.put("request_id", requestId);
dataMap.put("num", num);
dataMap.put("operate_user", userId);
dataMap.put("operate_time", DateUtil.getFullDate());
ModeUtil.insertData(rs, dataMap, RECORD_TABLE_NAME);
}
}

View File

@ -0,0 +1,18 @@
package com.engine.secret.service;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/04/16
* @version: 1.0
*/
public interface AutoGenerateNumberService {
/**
* 获取受理单号
*
* @param param
* @return
*/
String getAcceptanceNumber(Map<String, Object> param) ;
}

View File

@ -16,4 +16,12 @@ public interface QualificationApplicationService {
* @return
*/
Map<String, Object> parsingFiles(Map<String, Object> param);
/**
* 删除已经解析的数据
*
* @param params
* @return
*/
Map<String, Object> deleteParsedData(Map<String, Object> params);
}

View File

@ -1,5 +1,6 @@
package com.engine.secret.service;
import com.engine.secret.entity.unpack.UnpackParam;
import com.fasterxml.jackson.databind.JsonNode;
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.model.FileHeader;
@ -16,13 +17,13 @@ public interface UnpackZipService {
/**
* 材料收件
*
* @param requestId
* @param unpackParam
* @param rootNode
* @param imageFileMap
* @return
* @throws Exception
*/
Map<String, Object> registerAcceptance(ZipFile zipFile, String requestId, JsonNode rootNode, Map<String, FileHeader> imageFileMap) throws Exception;
Map<String, Object> registerAcceptance(ZipFile zipFile, UnpackParam unpackParam, JsonNode rootNode, Map<String, FileHeader> imageFileMap) throws Exception;
/**
* 材料补正
@ -31,4 +32,12 @@ public interface UnpackZipService {
*/
Map<String, Object> reviewResubmittedMaterials(ZipFile zipFile, String requestId, JsonNode rootNode, Map<String, FileHeader> imageFileMap);
/**
* 删除文件解析数据
*
* @param param
* @return
*/
Map<String, Object> deleteParsedData(Map<String, Object> param);
}

View File

@ -0,0 +1,42 @@
package com.engine.secret.service.impl;
import cn.hutool.core.convert.Convert;
import com.engine.core.impl.Service;
import com.engine.secret.exception.CustomizeRunTimeException;
import com.engine.secret.instance.AutoGenerateNumberInstance;
import com.engine.secret.service.AutoGenerateNumberService;
import weaver.conn.RecordSet;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/04/16
* @version: 1.0
*/
public class AutoGenerateNumberServiceImpl extends Service implements AutoGenerateNumberService {
@Override
public String getAcceptanceNumber(Map<String, Object> param) {
Integer secretType = Convert.toInt(param.get("secretType"));
Integer requestId = Convert.toInt(param.get("requestId"));
if (null == secretType) {
throw new CustomizeRunTimeException("未获取到[保密资质(资格)类型],请检查表单数据");
}
// 查询当前请求是否已经生成单号如已生成过直接取原来单号不重新生成
RecordSet rs = new RecordSet();
rs.executeQuery("select num from uf_sldh_dt1 where request_id = ? ", requestId);
if (rs.next()) {
return rs.getString("num");
}
AutoGenerateNumberInstance instance = AutoGenerateNumberInstance.getInstance();
if (0 == secretType || 1 == secretType) {
// 集成印制
return instance.getAcceptanceNumber(user, param);
} else {
// 军工
return instance.getWarIndustryAcceptanceNumber(user, param);
}
}
}

View File

@ -1,8 +1,11 @@
package com.engine.secret.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.secret.entity.unpack.CheckFields;
import com.engine.secret.entity.unpack.UnpackParam;
import com.engine.secret.exception.CustomizeRunTimeException;
import com.engine.secret.service.QualificationApplicationService;
import com.engine.secret.util.ConfigUtil;
@ -25,6 +28,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -54,6 +58,7 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
String docId = Util.null2String(param.get("docId"));
String requestId = Util.null2String(param.get("requestId"));
String isCorrection = Util.null2String(param.get("isCorrection"));
String checkFields = Util.null2String(param.get("checkFields"));
if (StringUtils.isBlank(docId)) {
throw new CustomizeRunTimeException("文件获取失败,请确认文件是否上传");
}
@ -64,6 +69,18 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
}
baseBean.writeLog("requestId==" + requestId);
List<CheckFields> checkFieldsList = new ArrayList<>();
if (StringUtils.isNotBlank(checkFields)) {
checkFieldsList = JSON.parseObject(checkFields, new TypeReference<List<CheckFields>>() {});
}
UnpackParam unpackParam = UnpackParam.builder()
.docId(docId)
.requestId(requestId)
.isCorrection(Boolean.parseBoolean(isCorrection))
.checkFields(checkFieldsList)
.build();
// docId 转为换imageFileId
DocImageManager imgManger = new DocImageManager();
@ -96,7 +113,7 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
//解压文件处理压缩包
baseBean.writeLog("开始解压文件,处理压缩包");
returnMap = unzipWithPassword(tempZipFile, Paths.get("output"), unzipPwd, requestId, isCorrection);
returnMap = unzipWithPassword(tempZipFile, Paths.get("output"), unzipPwd, unpackParam);
baseBean.writeLog("压缩包处理完成");
return returnMap;
} catch (Exception e) {
@ -105,6 +122,11 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
}
}
@Override
public Map<String, Object> deleteParsedData(Map<String, Object> param) {
return ServiceUtil.getService(OfflineZipUnpackServiceImpl.class, user).deleteParsedData(param);
}
/**
* 解压ZIP文件
*
@ -112,7 +134,7 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
* @param outputDir
* @param password
*/
private Map<String, Object> unzipWithPassword(Path zipFilePath, Path outputDir, String password, String requestId, String isCorrection) {
private Map<String, Object> unzipWithPassword(Path zipFilePath, Path outputDir, String password, UnpackParam unpackParam) {
try {
ZipFile zipFile = new ZipFile(zipFilePath.toFile());
if (zipFile.isEncrypted()) {
@ -136,7 +158,7 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
String fileName = (lastSlashIndex != -1)
? fullPath.substring(lastSlashIndex + 1)
: fullPath;
fileHeaderMap.put(fileName,header);
fileHeaderMap.put(fileName, header);
}
@ -146,7 +168,10 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
// 获取数据文件用于后续数据解析
String jsonFileName="(database)data.json";
String jsonFileName = "(database)data.json";
if (unpackParam.isCorrection()) {
jsonFileName = "(extra)data.json";
}
FileHeader fileHeader = fileHeaderMap.get(jsonFileName);
int dataJsonImageId = generateImageFileId(zipFile, fileHeader, jsonFileName);
@ -154,10 +179,10 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
// 离线端方式
JsonNode rootNode = parseJsonContent(dataJsonImageId);
OfflineZipUnpackServiceImpl offlineZipUnpackService = ServiceUtil.getService(OfflineZipUnpackServiceImpl.class, user);
if ("true".equals(isCorrection)) {
return offlineZipUnpackService.reviewResubmittedMaterials(zipFile,requestId, rootNode, fileHeaderMap);
if (unpackParam.isCorrection()) {
return offlineZipUnpackService.reviewResubmittedMaterials(zipFile, unpackParam.getRequestId(), rootNode, fileHeaderMap);
}
return offlineZipUnpackService.registerAcceptance(zipFile,requestId, rootNode, fileHeaderMap);
return offlineZipUnpackService.registerAcceptance(zipFile, unpackParam, rootNode, fileHeaderMap);
}
// TODO 兼容其他方式
@ -169,7 +194,7 @@ public class QualificationApplicationServiceImpl extends Service implements Qual
throw new CustomizeRunTimeException("数据包解压失败,密码错误");
} else {
baseBean.writeLog(e);
throw new CustomizeRunTimeException(e);
throw new CustomizeRunTimeException(e.getMessage(), e);
}
} finally {
try {

View File

@ -94,11 +94,11 @@ public class FieldConvertUtil {
if (value.contains("")) {
separator = "";
}
String[] split = value.split(",");
String[] split = value.split(separator);
for (String s : split) {
selectValues.add(ModeUtil.getSelectValue(formfield, s));
}
object = StringUtils.join(selectValues, separator);
object = StringUtils.join(selectValues, ",");
if (StringUtils.isBlank(Util.null2String(object))) {
if (isNumberOrCommaSeparatedNumbers(value)) {
object = value;
@ -137,7 +137,13 @@ public class FieldConvertUtil {
*/
public static String executeConvertSql(String convertSql, String value) {
RecordSet rs = new RecordSet();
rs.executeQuery(convertSql, value);
value = Util.null2String(value);
long count = convertSql.chars().filter(c -> c == '?').count();
List<String> paramsList = new ArrayList<>();
for (int i = 0; i < count; i++) {
paramsList.add(value);
}
rs.executeQuery(convertSql, paramsList);
if (rs.next()) {
return rs.getString(1);
}

View File

@ -66,4 +66,16 @@ public class FlowUtil {
bean.writeLog("wri==" + JSON.toJSONString(wri));
return workflowService.submitWorkflowRequest(wri, Util.getIntValue(requestId, 0), creator, "submit", opinions);
}
/**
* 提交流程到下一节点(机器人节点)
*
* @param requestId
* @param opinions
* @return
*/
public static String submitWorkflowRequest(String requestId, String opinions) {
WorkflowServiceImpl workflowService = new WorkflowServiceImpl();
return workflowService.submitWorkflowRequest(null, Util.getIntValue(requestId, 0), 0, "submit", opinions);
}
}

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.IOUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.docs.docs.*;
import weaver.file.ImageFileManager;
import weaver.formmode.IgnoreCaseHashMap;
@ -179,6 +180,25 @@ public class ModeUtil {
}
}
public static void insertData(RecordSetTrans rs,Map<String, Object> dataMap, String tableName) throws Exception {
List<String> fieldList = new ArrayList<>();
List<String> dataList = new ArrayList<>();
List<String> paramList = new ArrayList<>();
dataMap.forEach((key, value) -> {
if (null != value) {
String valueStr = String.valueOf(value);
if (StringUtils.isNotBlank(valueStr)) {
fieldList.add(key);
dataList.add(valueStr);
paramList.add("?");
}
}
});
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
rs.executeUpdate(insertSql, dataList);
}
/**
* 根据ID更新数据
*
@ -204,6 +224,27 @@ public class ModeUtil {
}
}
/**
* 根据ID更新数据
*
* @param dataMap
* @param tableName
*/
public static void updateDataById(RecordSetTrans rs,Map<String, Object> dataMap, String tableName) throws Exception {
List<String> fieldList = new ArrayList<>();
List<Object> dataList = new ArrayList<>();
String id = Util.null2String(dataMap.get("id"));
dataMap.remove("id");
dataMap.forEach((key, value) -> {
fieldList.add(key + " = ? ");
dataList.add(value);
});
dataList.add(id);
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
rs.executeUpdate(updateSql, dataList);
}
/**
* 更新数据
*
@ -388,8 +429,12 @@ public class ModeUtil {
public static String getSelectValue(Formfield formfield, String selectName) {
String selectValue = "";
RecordSet rs = new RecordSet();
String detailTable = formfield.getDetailtable();
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? and detailtable = ? ) and selectname = ?", formfield.getBillid(), formfield.getFieldname(), Util.null2String(detailTable), selectName);
String detailTable = Util.null2String(formfield.getDetailtable());
if (StringUtils.isNotBlank(detailTable)) {
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? and detailtable = ? ) and selectname = ?", formfield.getBillid(), formfield.getFieldname(), Util.null2String(detailTable), selectName);
} else {
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? AND (detailtable IS NULL OR detailtable = '') ) and selectname = ?", formfield.getBillid(), formfield.getFieldname(), selectName);
}
if (rs.next()) {
selectValue = rs.getString("selectvalue");
}

View File

@ -0,0 +1,38 @@
package com.engine.secret.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.secret.service.AutoGenerateNumberService;
import com.engine.secret.service.impl.AutoGenerateNumberServiceImpl;
import com.engine.secret.util.ResponseResult;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2025/04/16
* @version: 1.0
*/
public class AutoGenerateNumberController {
public AutoGenerateNumberService getService(User user) {
return ServiceUtil.getService(AutoGenerateNumberServiceImpl.class, user);
}
@GET
@Path("/getAcceptanceNumber")
@Produces(MediaType.APPLICATION_JSON)
public String getAcceptanceNumber(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, String>(user).run(getService(user)::getAcceptanceNumber, param);
}
}

View File

@ -10,7 +10,7 @@ import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
@ -27,7 +27,7 @@ public class QualificationApplicationController {
return ServiceUtil.getService(QualificationApplicationServiceImpl.class, user);
}
@GET
@POST
@Path("/parsingFiles")
@Produces(MediaType.APPLICATION_JSON)
public String parsingFiles(@Context HttpServletRequest request, @Context HttpServletResponse response) {
@ -36,4 +36,14 @@ public class QualificationApplicationController {
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::parsingFiles, params);
}
@POST
@Path("/deleteParsedData")
@Produces(MediaType.APPLICATION_JSON)
public String deleteParsedData(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::deleteParsedData, params);
}
}

View File

@ -1,8 +1,6 @@
package weaver.interfaces.secret.action;
import com.engine.secret.exception.CustomizeRunTimeException;
import com.engine.secret.util.FlowUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
@ -12,7 +10,6 @@ import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -61,14 +58,11 @@ public class ApprovalReviewEndAction implements Action {
// 更新完成后自动提交流程到下一节点
rs.writeLog("mainRequestId==" + mainRequestId);
List<Integer> currentUserIds = FlowUtil.getCurrentUserIds(mainRequestId);
if (CollectionUtils.isEmpty(currentUserIds)) {
throw new CustomizeRunTimeException("requestId[" + mainRequestId + "],流程提交失败,未获取到当前节点处理人");
}
String options = requestInfo.getCreatorid() + "-自动提交流程-" + DateUtil.getFullDate();
String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, currentUserIds.get(0), options);
String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, options);
if (!"success".equals(submitResult)) {
throw new CustomizeRunTimeException("requestId[" + mainRequestId + "],流程提交失败");
requestInfo.getRequestManager().setMessagecontent("requestId[" + mainRequestId + "],流程提交失败");
return FAILURE_AND_CONTINUE;
}
return SUCCESS;

View File

@ -0,0 +1,119 @@
package weaver.interfaces.secret.action;
import com.engine.secret.util.ConfigUtil;
import com.engine.secret.util.FlowUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;
import java.util.*;
/**
* @author:dxfeng
* @createTime: 2025/04/14
* @version: 1.0
*/
public class MeetingConveningEndAction implements Action {
RecordSet rs = new RecordSet();
private static final String MAIN_FLOW_TABLE = ConfigUtil.getConfig("xqxksqlc_table");
@Override
public String execute(RequestInfo requestInfo) {
try {
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
Map<String, String> mainDataMap = new HashMap<>();
List<Map<String, String>> detailMapList = new ArrayList<>();
for (Property property : properties) {
mainDataMap.put(property.getName(), property.getValue());
}
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
DetailTable detailTable = detailTableInfo.getDetailTable(0);
String detailTableName = detailTable.getTableDBName();
String updateDetailSql = "update " + detailTableName + " set zlctjzt = ? where id = ?";
Row[] rows = detailTable.getRow();
for (Row row : rows) {
Map<String, String> detailDataMap = new HashMap<>(mainDataMap);
Cell[] cells = row.getCell();
String detailId = row.getId();
for (Cell cell : cells) {
detailDataMap.put(cell.getName(), cell.getValue());
}
detailDataMap.put("detailId", detailId);
detailMapList.add(detailDataMap);
}
Set<String> errorMsg = new HashSet<>();
if (CollectionUtils.isNotEmpty(detailMapList)) {
for (Map<String, String> detail : detailMapList) {
dealMainFlow(requestInfo, detail, updateDetailSql, errorMsg);
}
}
// 根据错误信息返回提示
if (CollectionUtils.isNotEmpty(errorMsg)) {
requestInfo.getRequestManager().setMessagecontent(StringUtils.join(errorMsg, "<br/>"));
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
} catch (Exception e) {
rs.writeLog(e);
requestInfo.getRequestManager().setMessagecontent(e.getMessage());
return FAILURE_AND_CONTINUE;
}
}
/**
* 提交主流程
*
* @param requestInfo
* @param detail
* @param updateDetailSql
* @param errorMsg
*/
private void dealMainFlow(RequestInfo requestInfo, Map<String, String> detail, String updateDetailSql, Set<String> errorMsg) {
String mainId = detail.get("xzxksqdh");
String conclusion = detail.get("spfhjl");
String detailId = detail.get("detailId");
String submitStatus = detail.get("zlctjzt");
if ("1".equals(submitStatus)) {
// 已经提交成功的流程不重复处理
return;
}
String mainRequestId = "";
rs.executeQuery("select requestid from " + MAIN_FLOW_TABLE + " where id = ?", mainId);
if (rs.next()) {
mainRequestId = rs.getString("requestid");
}
if (StringUtils.isBlank(mainRequestId)) {
errorMsg.add("主流程ID[" + mainId + "],主流程requestId获取异常请确认");
rs.executeUpdate(updateDetailSql, "2", detailId);
return;
}
rs.writeLog("mainRequestId==" + mainRequestId);
rs.writeLog("conclusion==" + conclusion);
rs.executeUpdate("update " + MAIN_FLOW_TABLE + " set spfhjl = ? where requestid = ?", conclusion, mainRequestId);
// 更新完成后自动提交流程到下一节点
rs.writeLog("mainRequestId==" + mainRequestId);
String options = requestInfo.getCreatorid() + "-自动提交流程-" + DateUtil.getFullDate();
String submitResult = FlowUtil.submitWorkflowRequest(mainRequestId, options);
if (!"success".equals(submitResult)) {
errorMsg.add("requestId[" + mainRequestId + "],流程提交失败");
rs.executeUpdate(updateDetailSql, "2", detailId);
} else {
rs.executeUpdate(updateDetailSql, "1", detailId);
}
}
}