package com.zcloud.controller.dw; import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.PageData; import com.zcloud.entity.Page; import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.dto.*; import com.zcloud.util.Jurisdiction; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController @RequestMapping(value = "/dingWei") public class DwController extends BaseController { @Resource private DwService dwService; @RequestMapping(value = "getTrace") public Object getTrace() throws Exception { PageData pd = this.getPageData(); TraceGet traceGet = JSONObject.parseObject(JSONObject.toJSONString(pd), TraceGet.class); return dwService.getTrace(traceGet); } @RequestMapping(value = "getMapList") public Object getMapList(Page page) throws Exception { PageData pd = this.getPageData(); MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); if (mapGet.getPage() == null){ mapGet.setPage(new com.zcloud.service.dw.dto.Page()); } mapGet.setCorpId(Jurisdiction.getCORPINFO_ID()); mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getMapList(mapGet); } @RequestMapping(value = "saveOrUpdateMap") public Object saveOrUpdateMap() throws Exception { PageData pd = this.getPageData(); MapInfo mapGet = JSONObject.parseObject(pd.getString("data"), MapInfo.class); return dwService.saveOrUpdateMap(mapGet); } @RequestMapping(value = "deleteMap") public Object deleteMap() throws Exception { PageData pd = this.getPageData(); DeleteDto deleteDto = new DeleteDto(); deleteDto.setId(pd.getString("id")); deleteDto.setOperatorId(Jurisdiction.getUSER_ID()); deleteDto.setOperatorName(Jurisdiction.getName()); return dwService.deleteMap(deleteDto); } @RequestMapping(value = "getAlarmList") public Object getAlarmList(Page page) throws Exception { PageData pd = this.getPageData(); AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); if (mapGet.getPage() == null){ mapGet.setPage(new com.zcloud.service.dw.dto.Page()); } mapGet.getPage().setCurrent(String.valueOf(page.getUrlCurrentPage())); mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getAlarmList(mapGet); } @RequestMapping(value = "manageAlarm") public Object manageAlarm() throws Exception { PageData pd = this.getPageData(); AlarmManageDto mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmManageDto.class); mapGet.setAlarmId(pd.getString("DW_ALARM_ID")); return dwService.manageAlarm(mapGet); } @RequestMapping(value = "getDictionary") public Object getDictionary() throws Exception { return dwService.getDictionary(); } @RequestMapping(value = "getLastProp") public Object getLastProp() throws Exception { PageData pd = this.getPageData(); GetLastPropDto mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), GetLastPropDto.class); return dwService.getLastProp(mapGet); } @RequestMapping(value = "getAllMessage") public Object getAllMessage() throws Exception { PageData pd = this.getPageData(); return dwService.getAllMessage(); } }