1、bug修复-系统异常后事务未回滚

2、指定人员打回
liujun0703-新项目开发^2^2
liujun 2024-06-11 17:42:13 +08:00
parent 813fd36a88
commit 4d59fba200
13 changed files with 501 additions and 414 deletions

View File

@ -66,12 +66,13 @@ public class XgfUserController extends BaseController {
@RequestMapping(value = "/approvePlus") @RequestMapping(value = "/approvePlus")
@ResponseBody @ResponseBody
public Object approvePlus(@RequestParam(value = "chengNuoShu", required = false) MultipartFile[] chengNuoShu) throws Exception { public Object approvePlus(@RequestParam(value = "chengNuoShu", required = false) MultipartFile[] chengNuoShu) throws Exception {
PageData request = this.getPageData();
xgfUserService.approvePlus(request,chengNuoShu);
PageData response = new PageData(); PageData response = new PageData();
response.put("result", "success"); response.put("result", "success");
PageData request = this.getPageData();
xgfUserService.approvePlus(request, chengNuoShu);
response.put("data", request); response.put("data", request);
return response; return response;
} }
/** /**
@ -81,10 +82,18 @@ public class XgfUserController extends BaseController {
@ResponseBody @ResponseBody
public Object approveMax(@RequestParam(value = "chengNuoShu", required = false) MultipartFile[] chengNuoShu) throws Exception { public Object approveMax(@RequestParam(value = "chengNuoShu", required = false) MultipartFile[] chengNuoShu) throws Exception {
PageData request = this.getPageData(); PageData request = this.getPageData();
xgfUserService.approveMax(request,chengNuoShu);
PageData response = new PageData(); PageData response = new PageData();
response.put("result", "success"); response.put("result", "success");
response.put("code","0");
response.put("data", request); response.put("data", request);
try {
xgfUserService.approveMax(request, chengNuoShu);
} catch (Exception e) {
e.printStackTrace();
response.put("code", "9999");
response.put("errorMessage", e.getMessage());
return response;
}
return response; return response;
} }

View File

@ -54,6 +54,7 @@ public class GuFenCharge extends NodeSwitchComponent {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -113,11 +114,19 @@ public class GuFenCharge extends NodeSwitchComponent {
xgfUserService.saveLog(info, info.getSTATUS(), "0"); xgfUserService.saveLog(info, info.getSTATUS(), "0");
} }
return "GuFenSupervise"; return "GuFenSupervise";
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
return "";
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "0".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "0".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -50,9 +50,8 @@ public class GuFenSupervise extends NodeComponent {
@Override @Override
public void process() throws Exception { public void process() throws Exception {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -88,11 +87,18 @@ public class GuFenSupervise extends NodeComponent {
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "1"); xgfUserService.saveLog(info, info.getSTATUS(), "1");
} }
} catch (Exception e) {
info.setErrorMsg(e.getMessage());
e.printStackTrace();
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS())) { if ("0".equals(info.getSTATUS())) {
return true; return true;
} }

View File

@ -53,11 +53,9 @@ public class GuFenWeiTuoCharge extends NodeComponent {
@Override @Override
public void process() throws Exception { public void process() throws Exception {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -107,15 +105,20 @@ public class GuFenWeiTuoCharge extends NodeComponent {
// 清空指针 // 清空指针
info.setIterator(""); info.setIterator("");
} }
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "0"); xgfUserService.saveLog(info, info.getSTATUS(), "0");
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "1".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "1".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -56,6 +56,7 @@ public class GuFenWeiTuoSupervise extends NodeComponent {
public void process() throws Exception { public void process() throws Exception {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -91,11 +92,18 @@ public class GuFenWeiTuoSupervise extends NodeComponent {
xgfUserService.saveLog(info, info.getSTATUS(), "1"); xgfUserService.saveLog(info, info.getSTATUS(), "1");
info.setIterator(""); info.setIterator("");
} }
} catch (Exception e) {
info.setErrorMsg(e.getMessage());
e.printStackTrace();
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "2".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "2".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -55,6 +55,7 @@ public class JiTuanCharge extends NodeSwitchComponent {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -113,11 +114,19 @@ public class JiTuanCharge extends NodeSwitchComponent {
xgfUserService.saveLog(info, info.getSTATUS(), "0"); xgfUserService.saveLog(info, info.getSTATUS(), "0");
} }
return "JiTuanSupervise"; return "JiTuanSupervise";
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
return "";
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "1".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "1".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -54,6 +54,7 @@ public class JiTuanSupervise extends NodeComponent {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -88,11 +89,18 @@ public class JiTuanSupervise extends NodeComponent {
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "1"); xgfUserService.saveLog(info, info.getSTATUS(), "1");
} }
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS())) { if ("0".equals(info.getSTATUS())) {
return true; return true;
} }

View File

@ -55,8 +55,8 @@ public class JiTuanWeiTuoCharge extends NodeComponent {
@Override @Override
public void process() throws Exception { public void process() throws Exception {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -92,12 +92,18 @@ public class JiTuanWeiTuoCharge extends NodeComponent {
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "0"); xgfUserService.saveLog(info, info.getSTATUS(), "0");
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "2".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "2".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -55,6 +55,7 @@ public class JiTuanWeiTuoSupervise extends NodeComponent {
System.out.println(getName() + "节点"); System.out.println(getName() + "节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -89,12 +90,19 @@ public class JiTuanWeiTuoSupervise extends NodeComponent {
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "1"); xgfUserService.saveLog(info, info.getSTATUS(), "1");
} }
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())) {
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "3".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "3".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -57,6 +57,7 @@ public class YiBanCharge extends NodeComponent {
public void process() throws Exception { public void process() throws Exception {
System.out.println("YiBanCharge节点"); System.out.println("YiBanCharge节点");
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
PageData flows = xgfFlowsMapper.findById(condition); PageData flows = xgfFlowsMapper.findById(condition);
@ -93,11 +94,18 @@ public class YiBanCharge extends NodeComponent {
} }
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "0"); xgfUserService.saveLog(info, info.getSTATUS(), "0");
}catch (Exception e){
e.printStackTrace();
info.setErrorMsg(e.getMessage());
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())){
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS()) && "0".equals(info.getIterator())) { if ("0".equals(info.getSTATUS()) && "0".equals(info.getIterator())) {
return true; return true;
} }

View File

@ -57,7 +57,7 @@ public class YiBanSupervise extends NodeComponent {
public void process() throws Exception { public void process() throws Exception {
System.out.println(getName()); System.out.println(getName());
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
try {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID", info.getFLOWS_ID()); condition.put("FLOWS_ID", info.getFLOWS_ID());
@ -122,11 +122,18 @@ public class YiBanSupervise extends NodeComponent {
// 保存操作记录 // 保存操作记录
xgfUserService.saveLog(info, info.getSTATUS(), "1"); xgfUserService.saveLog(info, info.getSTATUS(), "1");
} }
} catch (Exception e) {
e.printStackTrace();
info.setErrorMsg(e.getMessage());
}
} }
@Override @Override
public boolean isEnd() { public boolean isEnd() {
XgfFlowDto info = this.getRequestData(); XgfFlowDto info = this.getRequestData();
if (StringUtils.isNotBlank(info.getErrorMsg())){
throw new RuntimeException(info.getErrorMsg());
}
if ("0".equals(info.getSTATUS())) { if ("0".equals(info.getSTATUS())) {
return true; return true;
} }

View File

@ -49,4 +49,6 @@ public class XgfFlowDto {
// 打回节点游标 // 打回节点游标
private String BACK_STEP; private String BACK_STEP;
private String errorMsg;
private String code;
} }

View File

@ -1007,7 +1007,7 @@ public class XgfUserServiceImpl implements XgfUserService {
key.put("OPINION", flows.get("OPINION")); key.put("OPINION", flows.get("OPINION"));
Map result = HttpClientService.doPost(prevention_xgf_url + "openApi/user/approve", key); Map result = HttpClientService.doPost(prevention_xgf_url + "openApi/user/approve", key);
if (result == null || !"succeed".equals(result.get("result"))) { if (result == null || !"succeed".equals(result.get("result"))) {
throw new RuntimeException("请求失败"); info.setErrorMsg("请求失败");
} }
xgfUserMapper.edit(entity); xgfUserMapper.edit(entity);
this.clearInfo(flows); this.clearInfo(flows);
@ -1017,15 +1017,19 @@ public class XgfUserServiceImpl implements XgfUserService {
PageData condition = new PageData(); PageData condition = new PageData();
condition.put("FLOWS_ID",flows.getString("FLOWS_ID")); condition.put("FLOWS_ID",flows.getString("FLOWS_ID"));
PageData flowEntity = xgfFlowsMapper.findById(condition); PageData flowEntity = xgfFlowsMapper.findById(condition);
if (flowEntity != null && flowEntity.size() > 0 && flowEntity.getString("FLOWS_STEP").equals(info.getBACK_STEP())){ if (flowEntity != null && flowEntity.size() > 0 && (flowEntity.get("FLOWS_STEP").toString()).equals(info.getBACK_STEP())){
throw new RuntimeException("不能自己打回到自己"); info.setErrorMsg("不能自己打回到自己");
} }
flowEntity.put("FLOWS_STEP", info.getBACK_STEP()); flowEntity.put("FLOWS_STEP", info.getBACK_STEP());
xgfFlowsMapper.edit(flowEntity); xgfFlowsMapper.edit(flowEntity);
// 2、保存审批记录
this.saveLog(info, "0", "0");
} }
} }
@Override @Override
@Transactional
public void approveMax(PageData request, MultipartFile[] chengNuoShu) throws Exception { public void approveMax(PageData request, MultipartFile[] chengNuoShu) throws Exception {
if (chengNuoShu != null && chengNuoShu.length > 0) { if (chengNuoShu != null && chengNuoShu.length > 0) {
request.put("APPOINT_ANNEX", Warden.saveFile(Warden.createZip(chengNuoShu), Jurisdiction.getCORPINFO_ID())); request.put("APPOINT_ANNEX", Warden.saveFile(Warden.createZip(chengNuoShu), Jurisdiction.getCORPINFO_ID()));
@ -1070,16 +1074,16 @@ public class XgfUserServiceImpl implements XgfUserService {
if (request.get("APPOINT_ANNEX") != null) { if (request.get("APPOINT_ANNEX") != null) {
info.setAPPOINT_ANNEX(request.getString("APPOINT_ANNEX")); info.setAPPOINT_ANNEX(request.getString("APPOINT_ANNEX"));
} }
info.setBACK_STEP(request.getString("BACK_STEP"));
// 进行数据审核 // 进行数据审核
LiteflowResponse response = flowExecutor.execute2Resp("chain1", info); LiteflowResponse response = flowExecutor.execute2Resp("chain1", info);
if (!response.isSuccess()) { if (response.isSuccess()) {
System.out.println("流程信息:" + response.getExecuteStepStrWithTime());
} else {
Exception e = response.getCause(); Exception e = response.getCause();
e.printStackTrace(); e.printStackTrace();
System.out.println(response.getMessage()); throw new RuntimeException(e.getMessage());
throw new RuntimeException("系统异常");
} else {
System.out.println("流程信息:" + response.getExecuteStepStrWithTime());
} }
} }