From 92cffc135581ce2cf4aecac745ddb88e739c17de Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期二, 17 十月 2023 15:34:57 +0800
Subject: [PATCH] 工单修改

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/kb/formula/controller/FormulaKbController.java |   69 +++++++++++++++++++++++++++-------
 1 files changed, 54 insertions(+), 15 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/kb/formula/controller/FormulaKbController.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/kb/formula/controller/FormulaKbController.java
index e9e5b4b..1a1f63a 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/kb/formula/controller/FormulaKbController.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/zsx/kb/formula/controller/FormulaKbController.java
@@ -1,14 +1,23 @@
 package cn.stylefeng.guns.modular.zsx.kb.formula.controller;
 
+import cn.stylefeng.guns.modular.zsx.bs.formulaChild.entity.FormulaChildInfo;
+import cn.stylefeng.guns.modular.zsx.bs.formulaChild.model.params.FormulaChildInfoParam;
+import cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.FormulaChildInfoService;
+import cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.impl.FormulaChildInfoServiceImpl;
 import cn.stylefeng.guns.modular.zsx.kb.utils.IPUtil;
 import cn.stylefeng.guns.modular.zsx.pm.salesOrder.service.SalesOrderService;
+import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
+import cn.stylefeng.roses.kernel.model.response.ResponseData;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import java.net.*;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.Set;
 
 
@@ -16,6 +25,9 @@
 @RequestMapping("/kb/formulaView")
 public class FormulaKbController {
     private String PREFIX = "/modular/kb/formula";
+
+    @Autowired
+    private FormulaChildInfoService formulaChildInfoService;
 
     /**
      * 璺宠浆鍒颁富椤甸潰
@@ -28,21 +40,48 @@
         return PREFIX + "/formulaView.html";
     }
 
-    public static void main(String[] args) {
-        try {
-            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
-            while (networkInterfaces.hasMoreElements()) {
-                NetworkInterface networkInterface = networkInterfaces.nextElement();
-                Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
-                while (inetAddresses.hasMoreElements()) {
-                    InetAddress inetAddress = inetAddresses.nextElement();
-                    if (inetAddress instanceof Inet4Address) { // 杩囨护IPv4鍦板潃
-                        System.out.println(inetAddress.getHostAddress());
-                    }
-                }
-            }
-        } catch (SocketException e) {
-            throw new RuntimeException(e);
+    /**
+     * 鏂板鎺ュ彛
+     *
+     * @author ruimin
+     * @Date 2023-10-09
+     */
+    @RequestMapping("/addFormulaState")
+    @ResponseBody
+    @DataSource(name = "self")
+    public ResponseData addFormulaState(FormulaChildInfoParam formulaChildInfoParam) {
+        List<FormulaChildInfo> list = this.formulaChildInfoService.list(new QueryWrapper<FormulaChildInfo>()
+                .eq("formula_code", formulaChildInfoParam.getFormulaCode())
+                .eq("spare_field_1","")
+                .orderByAsc("step_sort")
+        );
+        if(list.size()>0){
+            FormulaChildInfo formulaChildInfo = list.get(0);
+            formulaChildInfo.setSpareField1("3");
+            this.formulaChildInfoService.saveOrUpdate(formulaChildInfo);
         }
+        return ResponseData.success();
     }
+
+    /**
+     * 鏂板鎺ュ彛
+     *
+     * @author ruimin
+     * @Date 2023-10-09
+     */
+    @RequestMapping("/clear")
+    @ResponseBody
+    @DataSource(name = "self")
+    public ResponseData clear(FormulaChildInfoParam formulaChildInfoParam) {
+        List<FormulaChildInfo> list = this.formulaChildInfoService.list(new QueryWrapper<FormulaChildInfo>()
+                .eq("formula_code", formulaChildInfoParam.getFormulaCode())
+        );
+        for (int i = 0; i < list.size(); i++) {
+            FormulaChildInfo formulaChildInfo = list.get(i);
+            formulaChildInfo.setSpareField1("");
+            this.formulaChildInfoService.saveOrUpdate(formulaChildInfo);
+        }
+        return ResponseData.success();
+    }
+
 }

--
Gitblit v1.9.3