懒羊羊
2023-10-17 92cffc135581ce2cf4aecac745ddb88e739c17de
提交 | 用户 | 时间
4779be 1 package cn.stylefeng.guns.modular.zsx.kb.formula.controller;
2
92cffc 3 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.entity.FormulaChildInfo;
4 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.model.params.FormulaChildInfoParam;
5 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.FormulaChildInfoService;
6 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.impl.FormulaChildInfoServiceImpl;
4779be 7 import cn.stylefeng.guns.modular.zsx.kb.utils.IPUtil;
8 import cn.stylefeng.guns.modular.zsx.pm.salesOrder.service.SalesOrderService;
92cffc 9 import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
10 import cn.stylefeng.roses.kernel.model.response.ResponseData;
11 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4779be 12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Controller;
14 import org.springframework.web.bind.annotation.RequestMapping;
92cffc 15 import org.springframework.web.bind.annotation.ResponseBody;
4779be 16
17 import javax.servlet.http.HttpServletRequest;
18 import java.net.*;
19 import java.util.Enumeration;
92cffc 20 import java.util.List;
4779be 21 import java.util.Set;
22
23
24 @Controller
25 @RequestMapping("/kb/formulaView")
26 public class FormulaKbController {
27     private String PREFIX = "/modular/kb/formula";
92cffc 28
29     @Autowired
30     private FormulaChildInfoService formulaChildInfoService;
4779be 31
32     /**
33      * 跳转到主页面
34      *
35      * @author ruimin
36      * @Date 2023-08-26
37      */
38     @RequestMapping("")
39     public String index() {
40         return PREFIX + "/formulaView.html";
41     }
42
92cffc 43     /**
44      * 新增接口
45      *
46      * @author ruimin
47      * @Date 2023-10-09
48      */
49     @RequestMapping("/addFormulaState")
50     @ResponseBody
51     @DataSource(name = "self")
52     public ResponseData addFormulaState(FormulaChildInfoParam formulaChildInfoParam) {
53         List<FormulaChildInfo> list = this.formulaChildInfoService.list(new QueryWrapper<FormulaChildInfo>()
54                 .eq("formula_code", formulaChildInfoParam.getFormulaCode())
55                 .eq("spare_field_1","")
56                 .orderByAsc("step_sort")
57         );
58         if(list.size()>0){
59             FormulaChildInfo formulaChildInfo = list.get(0);
60             formulaChildInfo.setSpareField1("3");
61             this.formulaChildInfoService.saveOrUpdate(formulaChildInfo);
4779be 62         }
92cffc 63         return ResponseData.success();
4779be 64     }
92cffc 65
66     /**
67      * 新增接口
68      *
69      * @author ruimin
70      * @Date 2023-10-09
71      */
72     @RequestMapping("/clear")
73     @ResponseBody
74     @DataSource(name = "self")
75     public ResponseData clear(FormulaChildInfoParam formulaChildInfoParam) {
76         List<FormulaChildInfo> list = this.formulaChildInfoService.list(new QueryWrapper<FormulaChildInfo>()
77                 .eq("formula_code", formulaChildInfoParam.getFormulaCode())
78         );
79         for (int i = 0; i < list.size(); i++) {
80             FormulaChildInfo formulaChildInfo = list.get(i);
81             formulaChildInfo.setSpareField1("");
82             this.formulaChildInfoService.saveOrUpdate(formulaChildInfo);
83         }
84         return ResponseData.success();
85     }
86
4779be 87 }