|
@@ -2,6 +2,7 @@ package cn.cslg.pas.controller;
|
|
|
|
|
|
import cn.cslg.pas.common.core.base.Constants;
|
|
|
import cn.cslg.pas.common.dto.business.EventDTO;
|
|
|
+import cn.cslg.pas.common.dto.business.UpdateEventDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.GroupVO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
|
import cn.cslg.pas.common.model.request.StringGroupRequest;
|
|
@@ -39,29 +40,26 @@ public class EventController {
|
|
|
@PostMapping("/queryEvent")
|
|
|
public Response queryEvent(@RequestBody StringRequest stringRequest) throws Exception {
|
|
|
Business business = businessFactory.getClass("eventService");
|
|
|
- Records records = (Records)business.queryMessage(stringRequest);
|
|
|
+ Records records = (Records) business.queryMessage(stringRequest);
|
|
|
return Response.success(records);
|
|
|
}
|
|
|
|
|
|
|
|
|
@Operation(summary = "添加事件")
|
|
|
@PostMapping("/addEvent")
|
|
|
- public Response addEvent(String event,List<MultipartFile> files) throws Exception {
|
|
|
+ public Response addEvent(String event, List<MultipartFile> files) throws Exception {
|
|
|
if (event != null) {
|
|
|
EventDTO eventDTO = JSONObject.parseObject(event, EventDTO.class);
|
|
|
Business business = businessFactory.getClass("eventService");
|
|
|
- Integer id =null;
|
|
|
+ Integer id = null;
|
|
|
try {
|
|
|
- id = (Integer) business.addMessage(eventDTO, files);
|
|
|
- }
|
|
|
- catch (Exception e){
|
|
|
- if(e instanceof XiaoShiException) {
|
|
|
+ id = (Integer) business.addMessage(eventDTO, files);
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (e instanceof XiaoShiException) {
|
|
|
return Response.error(e.getMessage());
|
|
|
- }
|
|
|
- else if (e instanceof UnLoginException) {
|
|
|
+ } else if (e instanceof UnLoginException) {
|
|
|
return Response.unLogin(e.getMessage());
|
|
|
- }
|
|
|
- else if (e instanceof ConditionException) {
|
|
|
+ } else if (e instanceof ConditionException) {
|
|
|
return Response.conditionError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
@@ -75,11 +73,12 @@ public class EventController {
|
|
|
@PostMapping("/updateEvent")
|
|
|
public Response updateEvent(String event, List<MultipartFile> files) throws Exception {
|
|
|
if (event != null) {
|
|
|
- EventDTO eventDTO = JSONObject.parseObject(event, EventDTO.class);
|
|
|
+ UpdateEventDTO updateEventDTO = JSONObject.parseObject(event, UpdateEventDTO.class);
|
|
|
Business business = businessFactory.getClass("eventService");
|
|
|
- business.updateMessage(eventDTO, files);
|
|
|
+ business.updateMessage(updateEventDTO, files);
|
|
|
return Response.success(1);
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return Response.error("网络异常");
|
|
|
}
|
|
|
}
|