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 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"); } }