|
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.lemon.lifecenter.scheduler.dto.DeviceInfoDTO;
|
|
@@ -18,61 +19,10 @@ import com.lemon.lifecenter.scheduler.service.PushService;
|
|
|
public class PushController {
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+
|
|
|
@Autowired
|
|
|
private PushService service;
|
|
|
|
|
|
- /**
|
|
|
- * 디바이스 정보 저장
|
|
|
- * @param dto
|
|
|
- * patientIdx : 환자등록 고유번호
|
|
|
- * deviceType : 안드로이드 : AND, 아이폰 : IOS
|
|
|
- * deviceToken : 푸시 수신을 위한 토큰
|
|
|
- * macAddress : 디바이스 맥 어드레스
|
|
|
- */
|
|
|
- @RequestMapping(value="/insertDeviceInfo", method=RequestMethod.POST)
|
|
|
- public Map<String, String> setDeviceInfo(@RequestBody DeviceInfoDTO dto) {
|
|
|
- HashMap<String, String> result = new HashMap<>();
|
|
|
- String code = "99";
|
|
|
-
|
|
|
- int patientIdx = dto.getPatientIdx();
|
|
|
- String deviceType = dto.getDeviceType();
|
|
|
- String deviceToken = dto.getDeviceToken();
|
|
|
- String macAddress = dto.getMacAddress();
|
|
|
-
|
|
|
- if (patientIdx == 0 || deviceType.equals("") || deviceToken.equals("") || macAddress.equals("")) {
|
|
|
- code = "01";
|
|
|
- result.put("code", code);
|
|
|
- result.put("message", "Lack of parameters");
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- int cnt = service.selectDeviceInfoCount(dto);
|
|
|
- int rCnt = 0;
|
|
|
- if (cnt == 0) {
|
|
|
- service.insertDeviceInfo(dto);
|
|
|
- rCnt = dto.getQueryCount();
|
|
|
- } else {
|
|
|
- rCnt = service.updatedeviceInfo(dto);
|
|
|
- }
|
|
|
-
|
|
|
- if (rCnt == 0) {
|
|
|
- code = "02";
|
|
|
- result.put("code", code);
|
|
|
- result.put("message", "Token storage failure");
|
|
|
- } else {
|
|
|
- code = "00";
|
|
|
- result.put("code", code);
|
|
|
- result.put("message", "success");
|
|
|
- }
|
|
|
-
|
|
|
- logger.error("patientIdx -- > " + dto.getPatientIdx());
|
|
|
- logger.error("deviceType -- > " + dto.getDeviceType());
|
|
|
- logger.error("deviceToken -- > " + dto.getDeviceToken());
|
|
|
- logger.error("macAddress -- > " + dto.getMacAddress());
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
@RequestMapping(value = "/selectSendPushList", method = RequestMethod.POST)
|
|
|
public void selectSendPushList() {
|
|
|
|