于紫祥_1901
2020-12-24 f28149d8183a62f87fa9c8df9ae589070d83f612
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
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<Map> getFC(@RequestBody Map<String, Object> parameters) {
        String mac = parameters.get("mac").toString();
        List<Map> fcMap = fluctuationCompensationService.getFc(mac);
        return fcMap;
    }
 
    @PostMapping("update")
    public int updateFC(@RequestBody Map<String, Object> 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;
    }
}