|
|
|
@ -3,6 +3,7 @@ package com.biutag.supervision.controller.work; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.entity.AlarmNotification; |
|
|
|
import com.biutag.supervision.pojo.entity.AlarmNotification; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.enums.NotificationType; |
|
|
|
import com.biutag.supervision.pojo.param.AlarmParam; |
|
|
|
import com.biutag.supervision.pojo.param.AlarmParam; |
|
|
|
import com.biutag.supervision.service.AlarmNotificationService; |
|
|
|
import com.biutag.supervision.service.AlarmNotificationService; |
|
|
|
import com.biutag.supervision.service.ProblemSourceService; |
|
|
|
import com.biutag.supervision.service.ProblemSourceService; |
|
|
|
@ -14,6 +15,10 @@ 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.RestController; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author kami on 2024-11-16 11:30:34 |
|
|
|
* @author kami on 2024-11-16 11:30:34 |
|
|
|
* @version 0.0.1 |
|
|
|
* @version 0.0.1 |
|
|
|
@ -40,7 +45,7 @@ public class AlarmNotificationController { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 回复内容 |
|
|
|
* 回复内容 |
|
|
|
* @param data 数据 |
|
|
|
* @param data 数据 |
|
|
|
* @return 响应 |
|
|
|
* @return 是否成功 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@PostMapping("/reply") |
|
|
|
@PostMapping("/reply") |
|
|
|
public Result<Void> alarmNotificationReply(@RequestBody AlarmNotification data) { |
|
|
|
public Result<Void> alarmNotificationReply(@RequestBody AlarmNotification data) { |
|
|
|
@ -52,6 +57,34 @@ public class AlarmNotificationController { |
|
|
|
notification.setReplyResultContent(data.getReplyResultContent()); |
|
|
|
notification.setReplyResultContent(data.getReplyResultContent()); |
|
|
|
notification.setReplyState(1); |
|
|
|
notification.setReplyState(1); |
|
|
|
boolean res = notificationService.updateById(notification); |
|
|
|
boolean res = notificationService.updateById(notification); |
|
|
|
|
|
|
|
if(!res) { |
|
|
|
|
|
|
|
return Result.failed(5000, "回复失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Result.success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 新增提醒内容 |
|
|
|
|
|
|
|
* @param data 提交数据 |
|
|
|
|
|
|
|
* @return 是否成功 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@PostMapping("/commit") |
|
|
|
|
|
|
|
public Result<Void> alarmNotificationCommit(@RequestBody AlarmNotification data) { |
|
|
|
|
|
|
|
if(Objects.isNull(data.getAlarmTypeId())) { |
|
|
|
|
|
|
|
return Result.failed(5000, "请选择提醒类型"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(Objects.isNull(data.getNotificationDepartCode())) { |
|
|
|
|
|
|
|
return Result.failed(5000, "请选择要提醒单位"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(Objects.isNull(data.getAlarmContent())) { |
|
|
|
|
|
|
|
return Result.failed(5000, "请填写要提醒内容"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String alarmType = Optional.ofNullable(NotificationType.contains(data.getAlarmTypeId())) |
|
|
|
|
|
|
|
.orElseThrow(() -> new RuntimeException("未知提醒类型")); |
|
|
|
|
|
|
|
data.setAlarmTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
data.setAlarmType(alarmType); |
|
|
|
|
|
|
|
data.setReplyState(0); |
|
|
|
|
|
|
|
boolean res = notificationService.save(data); |
|
|
|
if(!res) { |
|
|
|
if(!res) { |
|
|
|
return Result.failed(5000, "修改失败"); |
|
|
|
return Result.failed(5000, "修改失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|