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();
|
}
|
|
}
|