From f3ad14f8af7fb651426d1ee617e7ecb9d3fc9aab Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期四, 28 三月 2024 11:15:52 +0800
Subject: [PATCH] 新增产品节点上设置关系,可设置项为“无/旁联/表决”

---
 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java |   61 +++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java
index dd90610..77253f9 100644
--- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java
+++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/controller/ModelLineController.java
@@ -27,32 +27,58 @@
 /**
  * model_line
  *
- * @author zt generator 
+ * @author zt generator
  * @since 1.0.0 2024-02-28
  */
 @RestController
 @RequestMapping("/taskReliability/ModelLine/")
-@Api(tags="model_line")
+@Api(tags = "model_line")
 public class ModelLineController {
+
+    private static final String URL_REPLACE_STR = "URL_PREFIX_URL";
+    private static final String TOKEN_REPLACE_STR = "MY_TOKEN_MY";
+    private static final String TOKEN_REPLACE_REGEX = "token=[0-9a-zA-Z]+&";
+
     @Autowired
     private ModelLineService modelLineService;
+
+//    @Autowired
+//    private PythonLib pythonLib;
+
+/*
+    @GetMapping("callPythonCalc")
+    @ApiOperation("淇℃伅")
+    public Result callPythonCalc() {
+        pythonLib.callPython();
+
+        return Result.ok();
+    }
+
+    @GetMapping("getPythonCalcResult")
+    @ApiOperation("淇℃伅")
+    public Result<String> getPythonCalcResult() {
+        String result = pythonLib.getPythonCalcResult();
+
+        return Result.ok(result);
+    }
+*/
 
     @GetMapping("page")
     @ApiOperation("鍒嗛〉")
     @ApiImplicitParams({
-        @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
-        @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
-        @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING),
-        @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING),
+            @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT),
+            @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT),
+            @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING),
+            @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING),
     })
-    public PageResult<ModelLine> page(@ApiIgnore @QueryParam QueryFilter queryFilter){
+    public PageResult<ModelLine> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
 
         return PageResult.ok(modelLineService.page(queryFilter));
     }
 
     @GetMapping("{id}")
     @ApiOperation("淇℃伅")
-    public Result<ModelLine> get(@PathVariable("id") Long id){
+    public Result<ModelLine> get(@PathVariable("id") Long id) {
         ModelLine data = modelLineService.get(id);
 
         return Result.ok(data);
@@ -60,18 +86,23 @@
 
     @GetMapping("getDiagram")
     @ApiOperation("淇℃伅")
-    public Result<ModelRbd> getDiagram(Long modelId){
+    public Result<ModelRbd> getDiagram(Long modelId, String urlPref, String token) {
         ModelRbd data = modelLineService.getDiagram(modelId);
-
+        if (data.getContent() != null) {
+            data.setContent(data.getContent().replace(URL_REPLACE_STR, urlPref));
+            data.setContent(data.getContent().replace(TOKEN_REPLACE_STR, "token="+token+"&"));
+        }
         return Result.ok(data);
     }
 
     @PostMapping
     @ApiOperation("鏂板")
     @LogOperation("鏂板")
-    public Result insert(@RequestBody ModelRbd modelRbd){
+    public Result insert(@RequestBody ModelRbd modelRbd) {
         //鏁堥獙鏁版嵁
         ValidatorUtils.validateEntity(modelRbd, AddGroup.class, DefaultGroup.class);
+        modelRbd.setContent(modelRbd.getContent().replace(modelRbd.getUrlPref(), URL_REPLACE_STR));
+        modelRbd.setContent(modelRbd.getContent().replaceAll(TOKEN_REPLACE_REGEX, TOKEN_REPLACE_STR));
         modelLineService.insert(modelRbd);
 
         return Result.ok();
@@ -80,9 +111,11 @@
     @PutMapping
     @ApiOperation("淇敼")
     @LogOperation("淇敼")
-    public Result update(@RequestBody ModelRbd modelRbd){
+    public Result update(@RequestBody ModelRbd modelRbd) {
         //鏁堥獙鏁版嵁
         ValidatorUtils.validateEntity(modelRbd, UpdateGroup.class, DefaultGroup.class);
+        modelRbd.setContent(modelRbd.getContent().replace(modelRbd.getUrlPref(), URL_REPLACE_STR));
+        modelRbd.setContent(modelRbd.getContent().replaceAll(TOKEN_REPLACE_REGEX, TOKEN_REPLACE_STR));
         modelLineService.update(modelRbd);
 
         return Result.ok();
@@ -91,7 +124,7 @@
     @DeleteMapping
     @ApiOperation("鍒犻櫎")
     @LogOperation("鍒犻櫎")
-    public Result delete(@RequestBody Long[] ids){
+    public Result delete(@RequestBody Long[] ids) {
         //鏁堥獙鏁版嵁
         AssertUtils.isArrayEmpty(ids, "id");
         modelLineService.delete(ids);
@@ -102,7 +135,7 @@
     @PostMapping("analyze")
     @ApiOperation("瑙f瀽")
     @LogOperation("瑙f瀽")
-    public Result analyze(@RequestBody ModelRbd modelRbd){
+    public Result analyze(@RequestBody ModelRbd modelRbd) {
         modelLineService.update(modelRbd);
         boolean result = modelLineService.analyze(modelRbd);
         return result ? Result.ok() : Result.error("瑙f瀽澶辫触");

--
Gitblit v1.9.1