package com.moral.controller; import com.moral.service.FluctuationCompensationService; import net.sf.json.JSONObject; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; @RestController @RequestMapping("/page") @CrossOrigin(origins = "*", maxAge = 3600) public class PageController { @Resource private FluctuationCompensationService fluctuationCompensationService; @PostMapping("getFC") public List getFC(@RequestBody Map parameters) { String mac = parameters.get("mac").toString(); List fcMap = fluctuationCompensationService.getFc(mac); return fcMap; } @PostMapping("update") public int updateFC(@RequestBody Map parameters){ Object value = parameters.get("val"); System.out.println(value); JSONObject jsonObject = JSONObject.fromObject(value); String val = jsonObject.get("json").toString(); String mac = jsonObject.get("mac").toString(); int i = fluctuationCompensationService.update(mac, val); return i; } }