Commit 6727088e authored by 刘凡's avatar 刘凡

新增:框架调整

parent b5d4c681
package com.yeejoin.amos.api.openapi.controller; //package com.yeejoin.amos.api.openapi.controller;
//
import java.util.HashMap; //import java.util.HashMap;
import java.util.Map; //import java.util.Map;
//
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; //import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; //import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.event.RestEventTrigger; //import org.typroject.tyboot.component.event.RestEventTrigger;
import org.typroject.tyboot.core.foundation.enumeration.UserType; //import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; //import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; //import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource; //
//import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseHelper; //import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel; //import com.yeejoin.amos.api.openapi.face.model.ElevatorAlarmModel;
import com.yeejoin.amos.api.openapi.face.model.ElevatorAlarmModel; //import com.yeejoin.amos.api.openapi.face.model.ElevatorAlarmModelList;
import com.yeejoin.amos.api.openapi.face.model.ElevatorAlarmModelList; //import com.yeejoin.amos.api.openapi.face.model.ElevatorStatusModel;
import com.yeejoin.amos.api.openapi.face.model.ElevatorStatusModel; //import com.yeejoin.amos.api.openapi.face.model.ElevatorStatusModelList;
import com.yeejoin.amos.api.openapi.face.model.ElevatorStatusModelList; //import com.yeejoin.amos.api.openapi.face.model.ElevatorVideoModel;
import com.yeejoin.amos.api.openapi.face.model.ElevatorVideoModel; //
import com.yeejoin.amos.api.openapi.face.service.ElevatorAlarmService; //import io.swagger.annotations.Api;
import com.yeejoin.amos.api.openapi.face.service.ElevatorStatusService; //import io.swagger.annotations.ApiOperation;
//import net.sf.json.JSONObject;
import io.swagger.annotations.Api; //
import io.swagger.annotations.ApiOperation; ///**
import net.sf.json.JSONObject; // *
// * <pre>
/** // * 电梯物联对接
* // * </pre>
* <pre> // *
* 电梯物联对接 // * @author gwb
* </pre> // * @version $Id: ElevatorStatusController.java, v 0.1 2021年9月28日 上午9:11:38 gwb Exp $
* // */
* @author gwb //@RestController
* @version $Id: ElevatorStatusController.java, v 0.1 2021年9月28日 上午9:11:38 gwb Exp $ //@RequestMapping(value = "/lift")
*/ //@Api(tags = "lift-电梯物联对接")
@RestController //public class LiftController
@RequestMapping(value = "/lift") //{
@Api(tags = "lift-电梯物联对接") //
public class LiftController // @Autowired
{ // private ElevatorStatusService elevatorStatusService;
//
@Autowired // @Autowired
private ElevatorStatusService elevatorStatusService; // private ElevatorAlarmService elevatorAlarmService;
//
@Autowired // @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
private ElevatorAlarmService elevatorAlarmService; // @ApiOperation(value = "电梯运行状态数据高频上传请求")
// @RequestMapping(value = "upload/{registerCode}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) // @RestEventTrigger(value = "openapiLogEventHandler")
@ApiOperation(value = "电梯运行状态数据高频上传请求") // public ResponseModel<String> highUpload (
@RequestMapping(value = "upload/{registerCode}", method = RequestMethod.GET) // @PathVariable(value = "registerCode") String registerCode) throws Exception
@RestEventTrigger(value = "openapiLogEventHandler") // {
public ResponseModel<String> highUpload ( // elevatorStatusService.highUpload(registerCode);
@PathVariable(value = "registerCode") String registerCode) throws Exception // return ResponseHelper.buildResponse("");
{ // }
elevatorStatusService.highUpload(registerCode); //
return ResponseHelper.buildResponse(""); // @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
} // @ApiOperation(value = "获取最近一次电梯运行状态数据")
// @RequestMapping(value = "status/{registerCode}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) // @RestEventTrigger(value = "openapiLogEventHandler")
@ApiOperation(value = "获取最近一次电梯运行状态数据") // public ResponseModel<ElevatorStatusModel> getLatelyStatus (
@RequestMapping(value = "status/{registerCode}", method = RequestMethod.GET) // @PathVariable(value = "registerCode") String registerCode,
@RestEventTrigger(value = "openapiLogEventHandler") // @RequestParam(value = "highUpload", required = false) Boolean highUpload) throws Exception
public ResponseModel<ElevatorStatusModel> getLatelyStatus ( // {
@PathVariable(value = "registerCode") String registerCode, // //默认状态数据不进行高频上传
@RequestParam(value = "highUpload", required = false) Boolean highUpload) throws Exception // if (ValidationUtil.isEmpty(highUpload))
{ // {
//默认状态数据不进行高频上传 // highUpload = false;
if (ValidationUtil.isEmpty(highUpload)) // }
{ // return ResponseHelper.buildResponse(elevatorStatusService.getLatelyStatus(registerCode, highUpload));
highUpload = false; // }
} //
return ResponseHelper.buildResponse(elevatorStatusService.getLatelyStatus(registerCode, highUpload)); //
} // @SuppressWarnings("rawtypes")
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @ApiOperation(value = "电梯运行状态数据上传")
@SuppressWarnings("rawtypes") // @RequestMapping(value = "run", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) // @RestEventTrigger(value = "openapiLogEventHandler")
@ApiOperation(value = "电梯运行状态数据上传") // public ResponseModel<String> multUploadRunData (
@RequestMapping(value = "run", method = RequestMethod.POST) // @RequestParam(value = "access_token", required = false) String access_token,
@RestEventTrigger(value = "openapiLogEventHandler") // @RequestBody String runStatusData) throws Exception
public ResponseModel<String> multUploadRunData ( // {
@RequestParam(value = "access_token", required = false) String access_token, // JSONObject jsonobject = JSONObject.fromObject(runStatusData);
@RequestBody String runStatusData) throws Exception //
{ // Map<String, Class> classMap = new HashMap<String, Class>();
JSONObject jsonobject = JSONObject.fromObject(runStatusData); // classMap.put("lift", ElevatorStatusModel.class);
//
Map<String, Class> classMap = new HashMap<String, Class>(); // ElevatorStatusModelList elevatorStatusModelList = (ElevatorStatusModelList)JSONObject.toBean(jsonobject,ElevatorStatusModelList.class,classMap);
classMap.put("lift", ElevatorStatusModel.class); // elevatorStatusService.multCreateElevatorStatus(elevatorStatusModelList.getLift());
// return ResponseHelper.buildResponse("");
ElevatorStatusModelList elevatorStatusModelList = (ElevatorStatusModelList)JSONObject.toBean(jsonobject,ElevatorStatusModelList.class,classMap); // }
elevatorStatusService.multCreateElevatorStatus(elevatorStatusModelList.getLift()); //
return ResponseHelper.buildResponse(""); //
} // @SuppressWarnings("rawtypes")
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @ApiOperation(value = "电梯故障数据上传")
@SuppressWarnings("rawtypes") // @RequestMapping(value = "fault", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) // @RestEventTrigger(value = "openapiLogEventHandler")
@ApiOperation(value = "电梯故障数据上传") // public ResponseModel<String> multUploadAlarmData (
@RequestMapping(value = "fault", method = RequestMethod.POST) // @RequestParam(value = "access_token", required = false) String access_token,
@RestEventTrigger(value = "openapiLogEventHandler") // @RequestBody String faultData) throws Exception
public ResponseModel<String> multUploadAlarmData ( // {
@RequestParam(value = "access_token", required = false) String access_token, // JSONObject jsonobject = JSONObject.fromObject(faultData);
@RequestBody String faultData) throws Exception //
{ // Map<String, Class> classMap = new HashMap<String, Class>();
JSONObject jsonobject = JSONObject.fromObject(faultData); // classMap.put("lift", ElevatorAlarmModel.class);
//
Map<String, Class> classMap = new HashMap<String, Class>(); // ElevatorAlarmModelList elevatorAlarmModelList = (ElevatorAlarmModelList)JSONObject.toBean(jsonobject,ElevatorAlarmModelList.class,classMap);
classMap.put("lift", ElevatorAlarmModel.class); // elevatorAlarmService.multCreateElevatorAlarm(elevatorAlarmModelList.getLift());
// return ResponseHelper.buildResponse("");
ElevatorAlarmModelList elevatorAlarmModelList = (ElevatorAlarmModelList)JSONObject.toBean(jsonobject,ElevatorAlarmModelList.class,classMap); // }
elevatorAlarmService.multCreateElevatorAlarm(elevatorAlarmModelList.getLift()); //
return ResponseHelper.buildResponse(""); //
} // @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @ApiOperation(value = "获取电梯视频预览地址")
// @RequestMapping(value = "video/preview/{registerCode}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) // @RestEventTrigger(value = "openapiLogEventHandler")
@ApiOperation(value = "获取电梯视频预览地址") // public ResponseModel<ElevatorVideoModel> videoPreview (
@RequestMapping(value = "video/preview/{registerCode}", method = RequestMethod.GET) // @PathVariable(value = "registerCode") String registerCode) throws Exception
@RestEventTrigger(value = "openapiLogEventHandler") // {
public ResponseModel<ElevatorVideoModel> videoPreview ( //
@PathVariable(value = "registerCode") String registerCode) throws Exception // ElevatorVideoModel elevatorVideoModel = elevatorStatusService.videoPreview(registerCode);
{ // return ResponseHelper.buildResponse(elevatorVideoModel);
// }
ElevatorVideoModel elevatorVideoModel = elevatorStatusService.videoPreview(registerCode); //}
return ResponseHelper.buildResponse(elevatorVideoModel);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment