yantian yue
2023-10-24 47eb81eebc9a87af5f64dd765dc1a1267317d9a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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;
 
 
@Controller
@RequestMapping("/kb/formulaView")
public class FormulaKbController {
    private String PREFIX = "/modular/kb/formula";
 
    @Autowired
    private FormulaChildInfoService formulaChildInfoService;
 
    /**
     * 跳转到主页面
     *
     * @author ruimin
     * @Date 2023-08-26
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/formulaView.html";
    }
 
    /**
     * 新增接口
     *
     * @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();
    }
 
}