doum
8 天以前 e46bfa3ff94a8a1b4daf37c7fcb79c2fab22a72c
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.doumee.device;
 
import com.doumee.core.annotation.trace.Trace;
import com.doumee.service.business.YwElectricalBizService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@Trace(exclude = true)
@RestController
@RequestMapping("/electronic")
@Slf4j
public class ElectronicNotifyController {
 
    @Autowired
    private YwElectricalBizService ywElectricalBizService;
 
    @PostMapping(value = "/electricalNotify", produces = MediaType.TEXT_PLAIN_VALUE)
    public ResponseEntity<String> electricalNotify(
            @RequestParam("response_content") String responseContent,
            @RequestParam("timestamp") String timestamp,
            @RequestParam("sign") String sign) {
        boolean ok = ywElectricalBizService.handleElectricalNotify(responseContent, timestamp, sign);
        if (!ok) {
            return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("FAIL");
        }
        return ResponseEntity.ok("SUCCESS");
    }
}