package com.newfiber.api.pc.controller.app; import com.alibaba.fastjson.JSON; import com.newfiber.api.config.FileVisitProperty; import com.newfiber.api.core.annotation.SysLog; import com.newfiber.api.core.bean.ReqBodyObj; import com.newfiber.api.core.commons.ResultCode; import com.newfiber.api.core.commons.ResultObj; import com.newfiber.api.pc.model.entity.BlackRiverRelevance; import com.newfiber.api.pc.model.meet.MeetAlter; import com.newfiber.api.pc.model.vo.MediaDescribeVo; import com.newfiber.api.pc.model.vo.MediaPicPathVo; import com.newfiber.api.pc.service.BlackRiverRelevanceService; import com.newfiber.api.pc.service.MeetAlterService; import com.newfiber.api.pc.service.TaskService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; /** * 封装app的请求 * @ClassName AppRequestController * @Description TODO * @Author 张鸿志 * @Date 2021年5月20日14:23:16 14:23 * Version 1.0 **/ @RestController @RequestMapping("/app") public class AppRequestController { @Autowired private MeetAlterService meetAlterService; @Autowired private FileVisitProperty fileVisitProperty; @Autowired private TaskService taskService; @Autowired private BlackRiverRelevanceService blackRiverRelevanceService; @PostMapping("/siteInfo/waterLevel") @ApiOperation("获取站点的报警水位信息") @SysLog(actionType = "4",value = "获取站点的报警水位信息") public ResultObj<List<BlackRiverRelevance>> waterLevel(){ return new ResultObj<List<BlackRiverRelevance>>(ResultCode.OK,blackRiverRelevanceService.waterLevel()); } @PostMapping("/meet/alert/view") @ApiOperation("根据警情编号查看详细信息") @SysLog(actionType = "4",value = "app中根据警情编号查看详细信息") public ResultObj<MeetAlter> viewDetail(@RequestParam("aId")Integer aId){ MeetAlter meetAlter = meetAlterService.viewDetail(aId); meetAlter.getMedias().stream().forEach(s ->{ List<MediaPicPathVo> mediaPicPathVos = JSON.parseArray(s.getPicFilePath(), MediaPicPathVo.class); for(MediaPicPathVo mediaPicPathVo : mediaPicPathVos){ List<String> pics = mediaPicPathVo.getPics(); for(int i = 0; i < pics.size(); i++){ pics.set(i,fileVisitProperty.getAppPic() + pics.get(i)); } } s.setPicPathVoList(mediaPicPathVos); s.setDescribeList(JSON.parseArray(s.getDescribes(), MediaDescribeVo.class)); s.setPicFilePath(null); s.setDescribes(null); }); return new ResultObj<MeetAlter>(ResultCode.OK,meetAlter); } @ApiOperation(value = "app列表") @PostMapping(value="/task/taskList") @ResponseBody @SysLog(actionType = "4",value = "app查询任务列表") public ResultObj taskList(HttpServletRequest request, @RequestBody ReqBodyObj<Map<String, Object>> params){ Integer pageSize = params.getSize(); Integer pageNo = params.getCurrent(); Integer type = StringUtils.isEmpty(params.getData().get("taskState"))?null:Integer.valueOf(params.getData().get("taskState").toString()); String userNo = request.getHeader("userNo"); return new ResultObj<>(ResultCode.OK, taskService.taskAppList(type,userNo,pageNo,pageSize)); } @ApiOperation(value = "app查看详情") @PostMapping(value="/task/taskInfo") @ResponseBody @SysLog(actionType = "4",value = "app查看详情") public ResultObj taskInfo(HttpServletRequest request, @RequestBody ReqBodyObj<Map<String, Object>> params){ Long taskId = Long.valueOf(params.getData().get("taskId").toString()); Long unitId = Long.valueOf(params.getData().get("unitId").toString()); Integer userType = StringUtils.isEmpty(params.getData().get("userType"))?null:Integer.valueOf(params.getData().get("userType").toString()); String taskUserNo = StringUtils.isEmpty(params.getData().get("taskUserNo"))?null:params.getData().get("taskUserNo").toString(); String userNo = request.getHeader("userNo"); return new ResultObj<>(ResultCode.OK, taskService.taskAppInfo(userNo,taskUserNo,userType,taskId,unitId)); } @ApiOperation(value = "任务详情") @PostMapping(value="/task/taskDetailList") @ResponseBody @SysLog(actionType = "4",value = "任务详情") public ResultObj taskDetail(@RequestBody ReqBodyObj<Map<String, Object>> params,HttpServletRequest request){ Integer pageSize = params.getSize(); Integer pageNo = params.getCurrent(); String userNo = request.getHeader("userNo"); Integer taskId = Integer.valueOf(params.getData().get("taskId").toString()); Integer type = StringUtils.isEmpty(params.getData().get("type"))?null:Integer.valueOf(params.getData().get("type").toString()); Integer orgType = StringUtils.isEmpty(params.getData().get("orgType"))?null:Integer.valueOf(params.getData().get("orgType").toString()); //String userNo = request.getHeader("userNo"); return new ResultObj<>(ResultCode.OK, taskService.taskAppDetail(userNo,taskId,type,orgType,pageNo,pageSize)); } }