|
@@ -7,7 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
@@ -28,69 +28,69 @@ public class BizDeviceRegisterController {
|
|
private BizDeviceRegisterService bizDeviceRegisterService;
|
|
private BizDeviceRegisterService bizDeviceRegisterService;
|
|
|
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
- public Result add(@RequestParam Map<String, Object> paramsMap) throws ParseException {
|
|
|
|
- String chipId = paramsMap.get("chipId").toString();
|
|
|
|
- String deviceCode = paramsMap.get("deviceCode").toString();
|
|
|
|
- String farmCode = paramsMap.get("farmCode").toString();
|
|
|
|
- String serverIp = paramsMap.get("serverIp").toString();
|
|
|
|
- String serverPort = paramsMap.get("serverPort").toString();
|
|
|
|
- String remark = paramsMap.get("remark").toString();
|
|
|
|
|
|
+ public Result add(@RequestBody Map<String, Object> paramsMap) throws ParseException {
|
|
|
|
+ String chipId = paramsMap.get("chipId")+"";
|
|
|
|
+ String deviceCode = paramsMap.get("deviceCode")+"";
|
|
|
|
+ String farmCode = paramsMap.get("farmCode")+"";
|
|
|
|
+ String serverIp = paramsMap.get("serverIp")+"";
|
|
|
|
+ String serverPort = paramsMap.get("serverPort")+"";
|
|
|
|
+ String remark = paramsMap.get("remark")+"";
|
|
String farmName = "";
|
|
String farmName = "";
|
|
if(paramsMap.get("farmName") != null){
|
|
if(paramsMap.get("farmName") != null){
|
|
- farmName = paramsMap.get("farmName").toString();
|
|
|
|
|
|
+ farmName = paramsMap.get("farmName")+"";
|
|
}
|
|
}
|
|
return bizDeviceRegisterService.add(farmName,farmCode,chipId, deviceCode, serverIp, serverPort, remark);
|
|
return bizDeviceRegisterService.add(farmName,farmCode,chipId, deviceCode, serverIp, serverPort, remark);
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/edit")
|
|
@PostMapping("/edit")
|
|
- public Result edit(@RequestParam Map<String, Object> paramsMap) throws ParseException {
|
|
|
|
- String id = paramsMap.get("id").toString();
|
|
|
|
- String chipId = paramsMap.get("chipId").toString();
|
|
|
|
- String deviceCode = paramsMap.get("deviceCode").toString();
|
|
|
|
- String serverIp = paramsMap.get("serverIp").toString();
|
|
|
|
- String serverPort = paramsMap.get("serverPort").toString();
|
|
|
|
- String remark = paramsMap.get("remark").toString();
|
|
|
|
|
|
+ public Result edit(@RequestBody Map<String, Object> paramsMap) throws ParseException {
|
|
|
|
+ String id = paramsMap.get("id")+"";
|
|
|
|
+ String chipId = paramsMap.get("chipId")+"";
|
|
|
|
+ String deviceCode = paramsMap.get("deviceCode")+"";
|
|
|
|
+ String serverIp = paramsMap.get("serverIp")+"";
|
|
|
|
+ String serverPort = paramsMap.get("serverPort")+"";
|
|
|
|
+ String remark = paramsMap.get("remark")+"";
|
|
return bizDeviceRegisterService.edit( Integer.parseInt(id), chipId, deviceCode, serverIp, serverPort, remark);
|
|
return bizDeviceRegisterService.edit( Integer.parseInt(id), chipId, deviceCode, serverIp, serverPort, remark);
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/remove")
|
|
@PostMapping("/remove")
|
|
- public Result remove(@RequestParam String ids) {
|
|
|
|
|
|
+ public Result remove(@RequestBody String ids) {
|
|
return bizDeviceRegisterService.remove(ids);
|
|
return bizDeviceRegisterService.remove(ids);
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
- public Result list(@RequestParam Map<String, Object> paramsMap) {
|
|
|
|
- String pageNo = paramsMap.get("pageNo").toString();
|
|
|
|
|
|
+ public Result list(@RequestBody Map<String, Object> paramsMap) {
|
|
|
|
+ String pageNo = paramsMap.get("pageNo")+"";
|
|
if (pageNo == null) {
|
|
if (pageNo == null) {
|
|
pageNo = "1";
|
|
pageNo = "1";
|
|
}
|
|
}
|
|
- String pageSize = paramsMap.get("pageSize").toString();
|
|
|
|
|
|
+ String pageSize = paramsMap.get("pageSize")+"";
|
|
if (pageSize == null) {
|
|
if (pageSize == null) {
|
|
pageSize = "10";
|
|
pageSize = "10";
|
|
}
|
|
}
|
|
String chipId = "";
|
|
String chipId = "";
|
|
if (paramsMap.get("chipId") != null) {
|
|
if (paramsMap.get("chipId") != null) {
|
|
- chipId = paramsMap.get("chipId").toString();
|
|
|
|
|
|
+ chipId = paramsMap.get("chipId")+"";
|
|
}
|
|
}
|
|
String deviceCode = "";
|
|
String deviceCode = "";
|
|
if (paramsMap.get("deviceCode") != null) {
|
|
if (paramsMap.get("deviceCode") != null) {
|
|
- deviceCode = paramsMap.get("deviceCode").toString();
|
|
|
|
|
|
+ deviceCode = paramsMap.get("deviceCode")+"";
|
|
}
|
|
}
|
|
String farmName = "";
|
|
String farmName = "";
|
|
if (paramsMap.get("farmName") != null) {
|
|
if (paramsMap.get("farmName") != null) {
|
|
- farmName = paramsMap.get("farmName").toString();
|
|
|
|
|
|
+ farmName = paramsMap.get("farmName")+"";
|
|
}
|
|
}
|
|
String farmCode = "";
|
|
String farmCode = "";
|
|
if (paramsMap.get("farmCode") != null) {
|
|
if (paramsMap.get("farmCode") != null) {
|
|
- farmCode = paramsMap.get("farmCode").toString();
|
|
|
|
|
|
+ farmCode = paramsMap.get("farmCode")+"";
|
|
}
|
|
}
|
|
String startDate = "";
|
|
String startDate = "";
|
|
if (paramsMap.get("startDate") != null) {
|
|
if (paramsMap.get("startDate") != null) {
|
|
- startDate = paramsMap.get("startDate").toString();
|
|
|
|
|
|
+ startDate = paramsMap.get("startDate")+"";
|
|
}
|
|
}
|
|
String endDate = "";
|
|
String endDate = "";
|
|
if (paramsMap.get("endDate") != null) {
|
|
if (paramsMap.get("endDate") != null) {
|
|
- endDate = paramsMap.get("endDate").toString();
|
|
|
|
|
|
+ endDate = paramsMap.get("endDate")+"";
|
|
}
|
|
}
|
|
return bizDeviceRegisterService.listAll(Integer.parseInt(pageNo), Integer.parseInt(pageSize), farmName,farmCode, chipId, deviceCode,startDate, endDate);
|
|
return bizDeviceRegisterService.listAll(Integer.parseInt(pageNo), Integer.parseInt(pageSize), farmName,farmCode, chipId, deviceCode,startDate, endDate);
|
|
}
|
|
}
|