|
@@ -0,0 +1,77 @@
|
|
|
+package com.xc.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.jfinal.plugin.activerecord.Db;
|
|
|
+import com.jfinal.plugin.activerecord.Record;
|
|
|
+import com.xc.common.ServerResponse;
|
|
|
+import com.xc.service.RiskService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+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.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Controller
|
|
|
+@RequestMapping({"/risk/"})
|
|
|
+public class RiskController {
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(RiskController.class);
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RiskService riskService;
|
|
|
+
|
|
|
+ @RequestMapping({"view.do"})
|
|
|
+ @ResponseBody
|
|
|
+ public ServerResponse<PageInfo> view(
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
|
|
+ ) {
|
|
|
+ PageInfo pageInfo=riskService.getRiskInfoList(pageNum,pageSize);
|
|
|
+ return ServerResponse.createBySuccess(pageInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping({"delete.do"})
|
|
|
+ @ResponseBody
|
|
|
+ public ServerResponse delete(String id) {
|
|
|
+ int data = Db.use("data").update("delete risk_control_formula where id = ? ", id);
|
|
|
+ return ServerResponse.createBySuccessMsg(data == 1 ? "true" : "false");
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping({"save.do"})
|
|
|
+ @ResponseBody
|
|
|
+ public ServerResponse save(String code, // 货币code(LINK)
|
|
|
+ String codeName, // 货币名称(LINK币)
|
|
|
+ String minimumFluctuation, // 最小波动
|
|
|
+ String riskControl, // 风控参数(+-*/)
|
|
|
+ String status, // 状态,0启动、1关闭
|
|
|
+ String tocode // 新币/股 code (GTC)
|
|
|
+ ) {
|
|
|
+
|
|
|
+ int data = Db.use("data").update("insert into risk_control_formula(code,codeName,minimumFluctuation,riskControl,status,tocode) " +
|
|
|
+ "values('" + code + "', '" + codeName + "','" + minimumFluctuation + "','" + riskControl + "','" + status + "','" + tocode + "')");
|
|
|
+ return ServerResponse.createBySuccessMsg(data == 1 ? "true" : "false");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping({"edit.do"})
|
|
|
+ @ResponseBody
|
|
|
+ public ServerResponse edit(String id,
|
|
|
+ String code, // 货币code(LINK)
|
|
|
+ String codeName, // 货币名称(LINK币)
|
|
|
+ String minimumFluctuation, // 最小波动
|
|
|
+ String riskControl, // 风控参数(+-*/)
|
|
|
+ String status, // 状态,0启动、1关闭
|
|
|
+ String tocode // 新币/股 code (GTC)
|
|
|
+ ) {
|
|
|
+
|
|
|
+ int data = Db.use("data").update("UPDATE risk_control_formula SET `code` = ? , `minimumFluctuation` = ?, `riskControl` = ?, " +
|
|
|
+ "`status` = ?, `codeName` = ?, `tocode` = ? WHERE `id` = ? ", code, minimumFluctuation, riskControl, status, codeName, tocode, id);
|
|
|
+
|
|
|
+ return ServerResponse.createBySuccessMsg(data == 1 ? "true" : "false");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|