IntelligentRecognition/ah-jjsp-service/.svn/pristine/84/84a316f74cec761e829732ab0d3...

733 lines
29 KiB
Plaintext

package com.sercurityControl.proteam.dutyTask.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Maps;
import com.securityControl.common.core.utils.StringUtils;
import com.securityControl.common.core.utils.aes.DateTimeHelper;
import com.securityControl.common.core.utils.aes.StringHelper;
import com.securityControl.common.core.web.domain.AjaxResult;
import com.securityControl.common.log.annotation.Log;
import com.securityControl.common.log.enums.BusinessType;
import com.securityControl.common.log.enums.OperationType;
import com.securityControl.common.redis.service.RedisService;
import com.securityControl.common.security.utils.SecurityUtils;
import com.sercurityControl.proteam.dutyTask.domain.*;
import com.sercurityControl.proteam.dutyTask.service.TodayTaskService;
import com.sercurityControl.proteam.util.*;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
/**
* 值班任务-今日任务控制层
*/
@RestController
@RequestMapping("/pot/todayTask/")
@Slf4j
public class TodayTaskController {
Logger logger = LoggerFactory.getLogger(TodayTaskController.class);
@Resource(name = "TodayTaskService")
private TodayTaskService service;
@Value("${file.upload_path}")
private String upload_path;
@Resource
private RedisService redisService;
/**
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author cw chen
* @description 值班任务-今日任务表格数据
* @Param params
* @Param page
* @Param limit
* @date 2022-12-14 14:58
*/
@ApiOperation(value = "值班任务-今日任务表格数据")
@PostMapping(value = "getTodayTaskList")
@Log(title = "今日任务", menu = "值班任务->今日任务", businessType = BusinessType.QUERY, details = "今日任务列表")
public Map<String, Object> getTodayTaskList(TodayTaskDto todayTaskDto) {
if (StringUtils.isBlank(todayTaskDto.getWorkDay())) {
todayTaskDto.setStartTime(DateTimeHelper.getNowDate());
todayTaskDto.setEndTime(DateTimeHelper.getNowDate());
} else {
String[] dateArr = todayTaskDto.getWorkDay().split(" - ");
todayTaskDto.setStartTime(dateArr[0]);
todayTaskDto.setEndTime(dateArr[1]);
}
// String jsonStr = com.alibaba.fastjson2.JSON.toJSONString(todayTaskDto);
PageHelper.startPage(Integer.parseInt(todayTaskDto.getPage()), Integer.parseInt(todayTaskDto.getLimit()));
Map<String, Object> map = new HashMap<String, Object>(16);
PageInfo<TodayTaskVo> pageInfo = null;
try {
pageInfo = service.getJJTaskList(todayTaskDto);
map.put("code", 200);
map.put("msg", "获取数据成功");
map.put("count", pageInfo.getTotal());
map.put("curr", Integer.parseInt(todayTaskDto.getPage()));
map.put("limit", Integer.parseInt(todayTaskDto.getLimit()));
map.put("data", pageInfo.getList());
} catch (Exception e) {
map.put("code", 500);
map.put("msg", "获取数据失败");
map.put("count", 0);
map.put("curr", Integer.parseInt(todayTaskDto.getPage()));
map.put("limit", Integer.parseInt(todayTaskDto.getLimit()));
map.put("data", null);
logger.error("今日任务列表", e);
}
return map;
}
/**
* @return void
* @author cw chen
* @description 今日任务-导出
* @Param response
* @Param params
* @date 2022-12-23 14:16
*/
@GetMapping(value = "exportData")
@Log(title = "今日任务", menu = "值班任务->今日任务", businessType = BusinessType.EXPORT, details = "今日任务导出", grade = OperationType.EXPORT_BUSINESS)
public void exportData(HttpServletRequest request, HttpServletResponse response, TodayTaskDto todayTaskDto) {
if (StringUtils.isBlank(todayTaskDto.getWorkDay())) {
todayTaskDto.setStartTime(DateTimeHelper.getNowDate());
todayTaskDto.setEndTime(DateTimeHelper.getNowDate());
} else {
String[] dateArr = todayTaskDto.getWorkDay().split(" - ");
todayTaskDto.setStartTime(dateArr[0]);
todayTaskDto.setEndTime(dateArr[1]);
}
List<TodayTaskVo> list = new ArrayList<>();
try {
PageInfo<TodayTaskVo> pageInfo = service.getJJTaskList(todayTaskDto);
list = pageInfo.getList();
for (int i = 0; i < list.size(); i++) {
list.get(i).setId((i + 1) + "");
String status = "";
if (StringUtils.isNotBlank(list.get(i).getEarlyWarningStatus())) {
String earlyWarningStatus = list.get(i).getEarlyWarningStatus();
String[] earlyWarningStatusArr = earlyWarningStatus.split(",");
for (String o : earlyWarningStatusArr) {
if (StringUtils.isNotBlank(o)) {
status += o + "\r\n";
}
}
} else {
status = "正常施工";
}
list.get(i).setEarlyWarningStatus(status);
list.get(i).setEvaluationStatus(Objects.equals("0", list.get(i).getEvaluationStatus()) ? "未评价" : "已评价");
list.get(i).setForemanAndPhone(list.get(i).getForeman() + "\r\n" + list.get(i).getForemanPhone());
list.get(i).setDuty("业主:" + list.get(i).getYzDuty() + "\r\n" + "监理:" + list.get(i).getJlDuty() + "\r\n" + "施工:" + list.get(i).getSgDuty());
String inspector = list.get(i).getInspector();
list.get(i).setInspector(Objects.equals("3", todayTaskDto.getIsSup()) ? "建设部安全管控" : inspector);
}
ExportParams exportParams = new ExportParams("今日任务", "今日任务", ExcelType.XSSF);
exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TodayTaskVo.class, list);
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("今日任务" + ".xlsx", "UTF-8"));
response.reset();
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
logger.error("今日任务导出", e);
}
}
/**
* 球机上线时长分页处理
*/
@PostMapping("getBallTimeList")
//@Log(title = "远程巡视", menu = "值班任务->今日任务", businessType = BusinessType.QUERY, details = "远程巡视详情查看")
public Map<String, Object> getBallTimeList(DeviceUpDownVo deviceUpDownVo) {
Map<String, Object> map = Maps.newHashMap();
try {
map = service.getBallTimeList(deviceUpDownVo);
} catch (Exception e) {
map.put("code", 500);
map.put("msg", "参数解析异常");
map.put("count", 0);
map.put("data", new ArrayList<DeviceUpDownVo>());
}
return map;
}
/**
* 站班会的风险到岗到位数据人员履职
*
* @param peopleVo
* @return
*/
@PostMapping("getClassMettingSign")
public Map<String, Object> getClassMettingSign(ClassMettingPeopleVo peopleVo) {
Map<String, Object> map = Maps.newHashMap();
try {
map = service.getClassMettingSign(peopleVo);
} catch (Exception e) {
map.put("code", 500);
map.put("msg", "参数解析异常");
map.put("count", 0);
map.put("data", new ArrayList<DeviceUpDownVo>());
}
return map;
}
/**
* 站班会详情 信息
*
* @param
* @return
*/
@PostMapping("getZbhDetail")
public String getClassMettingDetails(ClassMettingVo classMettingVo) {
try {
ClassMettingVo vo = service.getClassMettingDetails(classMettingVo);
return com.alibaba.fastjson2.JSON.toJSONString(vo);
} catch (Exception e) {
return com.alibaba.fastjson2.JSON.toJSONString(new ClassMettingVo());
}
}
@PostMapping("getTeamLabels")
@ApiOperation("班组标签")
public AjaxResult getTeamLabels(ClassMettingVo classMettingVo) {
return service.getTeamLabels(classMettingVo);
}
/**
* 获取关键措施点照片
*
* @param
* @return
*/
@PostMapping("getZbhImage")
//@Log(title = "站班会", businessType = BusinessType.QUERY, details = "获取关键措施点照片")
public String getZbhImage(ClassMettingImageVo imagesVo) {
try {
List<ClassMettingImageVo> list = service.getZbhImage(imagesVo);
return com.alibaba.fastjson2.JSON.toJSONString(list);
} catch (Exception e) {
return com.alibaba.fastjson2.JSON.toJSONString(new ArrayList<ClassMettingImageVo>());
}
}
/**
* 获取施工方案
*
* @param sgFaVo
* @return
*/
@PostMapping("getSgFa")
public String getSgFa(SgFaVo sgFaVo) {
try {
// JSONArray list = service.getSgFa(sgFaVo);
return com.alibaba.fastjson2.JSON.toJSONString(null);
} catch (Exception e) {
return com.alibaba.fastjson2.JSON.toJSONString(new ArrayList<ClassMettingImageVo>());
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 根据id获取施工方案
* @Param fileId
* @date 2023-04-18 15:10
*/
@PostMapping("getSgProgramById")
public AjaxResult getSgProgramById(SgFaVo sgFaVo) {
try {
String base64Url = InterfaceUtil.getSgfaFileData(sgFaVo.getFileId());
return AjaxResult.success("success", base64Url);
} catch (Exception e) {
logger.error("施工方案", e);
return AjaxResult.error("error");
}
}
/**
* 查询站班会人员接口
*
* @param
* @return
*/
@PostMapping("getZbhPeople")
public String getZbhPeople(ClassMettingPeopleVo peopleVo) {
Map<String, Object> map = Maps.newHashMap();
try {
map = service.getZbhPeople(peopleVo);
return com.alibaba.fastjson2.JSON.toJSONString(map);
} catch (Exception e) {
map.put("code", "201");
map.put("msg", "参数解析异常");
map.put("sgPeople", new ArrayList<ClassMettingPeopleVo>());
map.put("lsPeople", new ArrayList<ClassMettingPeopleVo>());
return com.alibaba.fastjson2.JSON.toJSONString(map);
}
}
/**
* 获取站班会预警信息标签接口
*
* @param
* @return
*/
@PostMapping("getZbhWarn")
public AjaxResult getZbhWarn(ClassMettingWarnVo warnVo) {
try {
String warnInfo = service.getZbhWarnInfo(warnVo);
return AjaxResult.success("success", warnInfo);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("服务异常,请稍后重试", null);
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 异常报备
* @Param request
* @Param files
* @date 2022-12-16 12:36
*/
@PostMapping(value = "uploadExceptionReport", headers = "content-type=multipart/form-data")
@ResponseBody
//@Log(title = "异常报备", businessType = BusinessType.INSERT, details = "新增异常报备", grade = OperationType.ADD_BUSINESS)
public AjaxResult uploadExceptionReport(HttpServletRequest request, @RequestParam("file[]") MultipartFile[] files) {
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
MultipartHttpServletRequest multiReq = multipartResolver.resolveMultipart(request);
String params = multiReq.getParameter("params");
ExceptionReportEntity entity = com.alibaba.fastjson2.JSON.parseObject(params, ExceptionReportEntity.class);
entity.setUploadTime(DateTimeHelper.getNowTime());
entity.setUploadUserId(SecurityUtils.getUserId() + "");
List<ExceptionReportImageEntity> list = new ArrayList<>();
try {
for (MultipartFile item : files) {
ExceptionReportImageEntity imageEntity = new ExceptionReportImageEntity();
// String imgPath = ossUtil.fileUpload(item);
String imgPath = uploadPath(item);
imageEntity.setImagePath(imgPath);
list.add(imageEntity);
}
// 添加站班会异常报备记录
service.addClassMeetingReqAndImg(entity, list);
} catch (Exception e) {
logger.error("异常报备", e);
return AjaxResult.error("error");
}
return AjaxResult.success("success");
}
public String uploadPath(MultipartFile item) {
String imgPath = "";
try {
String fileName = IDUtils.createID() + ".jpg";
String mkdirsName = "exceptionReport"; // 异常报备
String imageFiles = upload_path + File.separator + mkdirsName;
String path = imageFiles + File.separator + DateTimeHelper.getYear(new Date()) + File.separator + DateTimeHelper.getMonth(new Date()) + File.separator + fileName;
File file = new File(path);
//生成文件夹
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
// 存入临时文件
item.transferTo(file);
imgPath = mkdirsName + File.separator + DateTimeHelper.getYear(new Date()) + File.separator + DateTimeHelper.getMonth(new Date()) + File.separator + fileName;
} catch (Exception e) {
logger.error("异常报备", e);
}
return imgPath;
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 违章下发
* @Param request
* @Param files
* @date 2022-12-16 15:27
*/
@PostMapping(value = "uploadNoticeVio", headers = "content-type=multipart/form-data")
@ResponseBody
//@Log(title = "违章下发", businessType = BusinessType.INSERT, details = "新增违章下发", grade = OperationType.ADD_BUSINESS)
public AjaxResult uploadNoticeVio(HttpServletRequest request, @RequestParam("file[]") MultipartFile[] files) {
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
MultipartHttpServletRequest multiReq = multipartResolver.resolveMultipart(request);
String params = multiReq.getParameter("params");
NoticeVioEntity entity = com.alibaba.fastjson2.JSON.parseObject(params, NoticeVioEntity.class);
entity.setCreateDay(DateTimeHelper.getNowDate());
entity.setIssTime(DateTimeHelper.getNowTime());
entity.setIssUser(SecurityUtils.getUserId() + "");
String isSup = SecurityUtils.getLoginUser().getSysUser().getIsSup();
if(StringUtils.isNotEmpty(isSup) && Objects.equals("3",isSup)){
// 地市自查
if(StringHelper.isEmpty(entity.getSupType())){
entity.setSupType("2");
}
entity.setStatus("1");
}else{
// 地市自查
if(StringHelper.isEmpty(entity.getSupType())){
entity.setSupType("1");
}
// 值班员督查 - 违章单状态 待下发
entity.setStatus("7");
}
List<NoticeVioImgEntity> list = new ArrayList<>();
try {
for (MultipartFile item : files) {
NoticeVioImgEntity imageEntity = new NoticeVioImgEntity();
// String imgId = ossUtil.fileUpload(item);
// imageEntity.setImagePath(imgId);
String imgPath = uploadWzImage(item);
imageEntity.setImagePath(imgPath);
imageEntity.setImageType("1");
list.add(imageEntity);
}
// 添加违章通知记录
service.addNoticeVioAndImg(entity, list);
} catch (Exception e) {
logger.error("违章下发", e);
return AjaxResult.error("error");
}
return AjaxResult.success("success");
}
/**
* @param
* @return
*/
public String uploadWzImage(MultipartFile item) {
String imgPath = "";
try {
NoticeVioImgEntity imageEntity = new NoticeVioImgEntity();
String fileName = IDUtils.createID() + ".jpg";
String mkdirsName = "noticeVio"; // 违章下发
String imageFiles = upload_path + File.separator + mkdirsName;
String path = imageFiles + File.separator + DateTimeHelper.getYear(new Date()) + File.separator + DateTimeHelper.getMonth(new Date()) + File.separator + fileName;
File file = new File(path);
//生成文件夹
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
// 存入临时文件
item.transferTo(file);
imgPath = mkdirsName + File.separator + DateTimeHelper.getYear(new Date()) + File.separator + DateTimeHelper.getMonth(new Date()) + File.separator + fileName;
return imgPath;
} catch (Exception e) {
logger.error("违章下发", e);
}
return imgPath;
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 根据站班会id获取异常上报数据
* @Param params
* @date 2022-12-19 9:39
*/
@PostMapping("getExceptionReportList")
public AjaxResult getExceptionReportList(String classId) {
try {
List<ExceptionReportEntity> list = service.getExceptionReportList(classId);
/*list.forEach(item -> {
String imgPath = item.getImgPath();
item.setBase64List(ossUtil.getBase64List(imgPath, 1));
});*/
return AjaxResult.success("success", list);
} catch (Exception e) {
logger.error("数据获取失败", e);
return AjaxResult.success("error", null);
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 根据站班会id和关键字查询班组人员
* @Param params
* @date 2022-12-19 10:13
*/
@PostMapping("getPersonList")
public AjaxResult getPersonList(ClassMettingPeopleVo vo) {
try {
List<ClassMettingPeopleVo> list = service.getPersonList(vo);
return AjaxResult.success("success", list);
} catch (Exception e) {
logger.error("数据获取失败", e);
return AjaxResult.error("error", null);
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 根据违章类别,获取违章依据
* @Param params
* @date 2022-12-19 11:27
*/
@PostMapping("getVioInfoList")
public AjaxResult getVioInfoList(NoticeVoiInfoVo vo) {
try {
List<NoticeVoiInfoVo> list = service.getVioInfoList(vo);
return AjaxResult.success("success", list);
} catch (Exception e) {
logger.error("数据获取失败", e);
return AjaxResult.error("error", null);
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 更新是否重点关注班组
* @Param params
* @date 2022-12-19 13:39
*/
@PostMapping("updateImportTeam")
//@Log(title = "远程巡视", businessType = BusinessType.UPDATE, details = "修改重点关注班组", grade = OperationType.UPDATE_BUSINESS)
public AjaxResult updateImportTeam(String importTeam, String idNumber) {
try {
service.updateImportTeam(importTeam, idNumber);
return AjaxResult.success("success");
} catch (Exception e) {
logger.error("更新失败", e);
return AjaxResult.error("服务异常,请稍后重试");
}
}
/**
* @return void
* @author cw chen
* @description 下载作业票文件
* @Param request
* @Param response
* @Param ticketFileName
* @date 2022-10-26 14:27
*/
@GetMapping("downloadTicketFile")
//@Log(title = "远程巡视", businessType = BusinessType.EXPORT, details = "作业票文件导出", grade = OperationType.EXPORT_BUSINESS)
public void downloadTicketFile(HttpServletRequest request, HttpServletResponse response, String fileName, String ticketFileName) {
try {
WordUtils.exportPDF(request, response, fileName, upload_path + File.separator + ticketFileName);
} catch (IOException e) {
logger.error("作业票文件下载失败", e);
}
}
/**
* @return void
* @author cw chen
* @description 施工方案下载
* @Param request
* @Param response
* @Param fileId
* @Param fileName
* @date 2023-05-06 16:43
*/
@GetMapping("downLoadSgFile")
public void downLoadSgFile(HttpServletRequest request, HttpServletResponse response, String fileId, String fileName) {
try {
String base64Url = InterfaceUtil.getSgfaFileData(fileId);
byte[] decode = new BASE64Decoder().decodeBuffer(base64Url);
WordUtils.exportFile(request, response, fileName, decode);
} catch (Exception e) {
logger.error("作业票文件下载失败", e);
}
}
public static String encodeBase64File(String path) throws Exception {
File file = new File(path);
FileInputStream inputFile = new FileInputStream(file);
byte[] buffer = new byte[inputFile.available()];
inputFile.read(buffer);
inputFile.close();
return new BASE64Encoder().encode(buffer);
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 地市站班会数量和占比
* @Param params
* @date 2023-01-13 10:51
*/
@PostMapping(value = "getOrgNumAndRate")
public AjaxResult getOrgNumAndRate(TodayTaskDto todayTaskDto) {
if (StringUtils.isBlank(todayTaskDto.getWorkDay())) {
todayTaskDto.setStartTime(DateTimeHelper.getNowDate());
todayTaskDto.setEndTime(DateTimeHelper.getNowDate());
} else {
String[] dateArr = todayTaskDto.getWorkDay().split(" - ");
todayTaskDto.setStartTime(dateArr[0]);
todayTaskDto.setEndTime(dateArr[1]);
}
try {
List<Map<String, Object>> list = service.getOrgNumAndRate(todayTaskDto);
return AjaxResult.success(list);
} catch (Exception e) {
e.printStackTrace();
logger.error("地市站班会数量和占比", e);
return AjaxResult.success(null);
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 获取告警信息
* @Param vo
* @date 2023-05-15 10:17
*/
@PostMapping(value = "getWarnInfo")
public AjaxResult getWarnInfo(ClassMettingWarnVo vo) {
try {
HashMap<String, Object> map = new HashMap<>(16);
List<String> curWarnList = new ArrayList<>(); // 当前的告警信息
List<String> delWarnList = new ArrayList<>(); // 删除的告警信息
ClassMettingWarnVo o = service.getWarnInfo(vo);
if (o == null) { // 预警信息记录为空
vo.setUpdateTime(DateTimeHelper.getNowTime());
service.addWarnInfo(vo);
} else {
String remark = o.getRemark();
String warnType = o.getWarnType();
if (StringUtils.isNotBlank(warnType)) {
String[] warnTypeArr = warnType.split(",");
if (StringUtils.isNotBlank(remark)) {
String[] warnRemarkArr = remark.split(",");
for (String warn : warnTypeArr) {
boolean flag = false;
for (String warnRemark : warnRemarkArr) {
if (Objects.equals(warn, warnRemark.substring(2, warnRemark.lastIndexOf("@"))) && Objects.equals("1", warnRemark.substring(0, 1))) {
curWarnList.add(warnRemark.substring(2, warnRemark.length()));
flag = true;
} else if (Objects.equals(warn, warnRemark.substring(2, warnRemark.lastIndexOf("@"))) && Objects.equals("2", warnRemark.substring(0, 1))) {
flag = true;
}
}
if (!flag) {
curWarnList.add(warn);
}
}
} else {
for (String warn : warnTypeArr) {
curWarnList.add(warn);
}
}
}
if (StringUtils.isNotBlank(remark)) {
String[] warnRemarkArr = remark.split(",");
for (String warnRemark : warnRemarkArr) {
if (Objects.equals("2", warnRemark.substring(0, 1))) {
delWarnList.add(warnRemark.substring(2, warnRemark.length()));
}
}
}
}
map.put("curWarnList", curWarnList);
map.put("delWarnList", delWarnList);
return AjaxResult.success("success", map);
} catch (Exception e) {
logger.error("获取告警信息失败", e);
return AjaxResult.error("服务异常,请稍后重试");
}
}
/**
* @return com.securityControl.common.core.web.domain.AjaxResult
* @author cw chen
* @description 更新告警信息
* @Param vo
* @date 2023-05-15 10:17
*/
@PostMapping(value = "updateWarnInfoByClassId")
public AjaxResult updateWarnInfoByClassId(ClassMettingWarnVo vo) {
try {
if (StringUtils.isNotBlank(vo.getWarnType())) {
int num = 0;
String[] warnInfoArr = vo.getWarnType().split(",");
for (String warnInfo : warnInfoArr) {
if (StringUtils.isNotBlank(warnInfo)) {
num++;
}
}
vo.setNum(num + "");
} else {
vo.setNum("0");
}
service.updateWarnInfoByClassId(vo);
return AjaxResult.success("更新成功");
} catch (Exception e) {
logger.error("更新失败", e);
return AjaxResult.error("服务异常,请稍后重试");
}
}
@PostMapping(value = "updeWarnConfirm")
public AjaxResult updeWarnConfirm(String classId, Integer num, String confirm) {
try {
service.updeWarnConfirm(classId, num, confirm);
return AjaxResult.success("更新成功");
} catch (Exception e) {
logger.error("更新失败", e);
return AjaxResult.error("服务异常,请稍后重试");
}
}
/**
* @param vo
* @return AjaxResult
* @description 获取作业票文件的base64地址
* @author cwchen
* @date 2023/12/28 9:34
*/
@PostMapping(value = "getTicketBase64")
public AjaxResult getTicketBase64(ClassMettingVo vo) {
return service.getTicketBase64(vo);
}
}