|
|
@@ -1,6 +1,7 @@
|
|
|
package com.cloud.sa.api;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.cloud.sa.flow.commom.aspect.EventProgram;
|
|
|
import com.cloud.sa.flow.commom.common.model.StCodeMsg;
|
|
|
import com.cloud.sa.flow.commom.common.model.StResult;
|
|
|
import com.cloud.sa.flow.commom.common.utils.StString;
|
|
|
@@ -14,6 +15,7 @@ import com.cloud.sa.flow.commom.service.StMenuService;
|
|
|
import com.cloud.sa.flow.commom.service.flow.StTaskItemService;
|
|
|
import com.cloud.sa.flow.commom.service.setting.StSettingService;
|
|
|
import com.cloud.sa.flow.engine.service.StFlowService;
|
|
|
+import com.wx.blink.base.common.annoation.NoNeedLogin;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
|
@@ -60,7 +62,7 @@ public class AppEngineController {
|
|
|
@PostMapping("/instance/savesubmit")
|
|
|
public StResult SaveSubmitInstance(@Validated @RequestBody FlowEnteredParam flowEnteredParam) {
|
|
|
StTaskitem taskitem = null;
|
|
|
- if (flowEnteredParam.getIsBatches() == false) {
|
|
|
+ if (flowEnteredParam.getIsBatches() == false && flowEnteredParam.getTableData() != null && flowEnteredParam.getTableData().length() > 0) {
|
|
|
//如果不是批量的审批通过,则先走一下保存
|
|
|
taskitem = flowService.Save(flowEnteredParam, false);
|
|
|
flowEnteredParam.setTaskid(taskitem.getObjectid());
|
|
|
@@ -70,7 +72,27 @@ public class AppEngineController {
|
|
|
flowEnteredParam.setErrorMessage(errorMessage);
|
|
|
return StResult.success(flowEnteredParam);
|
|
|
} catch (Exception e) {
|
|
|
- settingService.FlowCommonExceptionRecord(e, taskitem.getObjectid(), "提交");
|
|
|
+ settingService.FlowCommonExceptionRecord(e, flowEnteredParam.getTaskid(), "提交");
|
|
|
+ return StResult.error(StCodeMsg.SERVER_EXCEPTION, e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @NoNeedLogin
|
|
|
+ @EventProgram
|
|
|
+ @PostMapping("/instance/autosubmit")
|
|
|
+ public StResult autoSubmitInstance(@Validated @RequestBody FlowEnteredParam flowEnteredParam) {
|
|
|
+ StTaskitem taskitem = null;
|
|
|
+ if (flowEnteredParam.getIsBatches() == false && flowEnteredParam.getTableData() != null && flowEnteredParam.getTableData().length() > 0) {
|
|
|
+ //如果不是批量的审批通过,则先走一下保存
|
|
|
+ taskitem = flowService.Save(flowEnteredParam, false);
|
|
|
+ flowEnteredParam.setTaskid(taskitem.getObjectid());
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String errorMessage = flowService.Submit(flowEnteredParam);
|
|
|
+ flowEnteredParam.setErrorMessage(errorMessage);
|
|
|
+ return StResult.success(flowEnteredParam);
|
|
|
+ } catch (Exception e) {
|
|
|
+ settingService.FlowCommonExceptionRecord(e, flowEnteredParam.getTaskid(), "提交");
|
|
|
return StResult.error(StCodeMsg.SERVER_EXCEPTION, e.getMessage());
|
|
|
}
|
|
|
}
|