| | |
| | | import com.zy.sc.common.service.GeoService; |
| | | import com.zy.sc.common.web.BaseController; |
| | | import com.zy.sc.manager.controller.param.MobileIssueParam; |
| | | import com.zy.sc.manager.controller.result.AppHostIssueVo; |
| | | import com.zy.sc.manager.controller.result.AppIssueVo; |
| | | import com.zy.sc.manager.entity.Issue; |
| | | import com.zy.sc.manager.entity.IssueType; |
| | | import com.zy.sc.manager.service.IssueService; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by vincent on 2021/12/20 |
| | |
| | | if (Cools.isEmpty(param.getTel())) { |
| | | return R.error("请输入联系方式"); |
| | | } |
| | | if (!param.getTel().matches(REGEX_MOBILE)) { |
| | | return R.error("请输入正确的手机号"); |
| | | } |
| | | if (Cools.isEmpty(param.getTitle())) { |
| | | return R.error("请输入问题概述"); |
| | | } |
| | |
| | | } |
| | | return R.ok("问题上报成功"); |
| | | } |
| | | // |
| | | // @RequestMapping("/sensor/list/auth") |
| | | // @ManagerAuth |
| | | // public R sensorList(@RequestParam(required = false) String condition){ |
| | | // Wrapper<Sensor> wrapper = new EntityWrapper<Sensor>() |
| | | // .like("uuid", condition) |
| | | // .orderBy("sensor_type").orderBy("create_time"); |
| | | // Long hostId = getHostId(); |
| | | // if (hostId != null) { |
| | | // wrapper.eq("host_id", hostId); |
| | | // } |
| | | // List<Sensor> sensors = sensorService.selectList(wrapper); |
| | | // List<AppSensorTypeVo> result = new ArrayList<>(); |
| | | // Set<Long> sensorTypeSet = new HashSet<>(); |
| | | // for (Sensor sensor : sensors) { |
| | | // AppSensorVo sensorVo = new AppSensorVo(); |
| | | // sensorVo.setSensorId(sensor.getId()); |
| | | // sensorVo.setUuid(sensor.getUuid()); |
| | | // String addr = sensor.getProvince()+sensor.getCity()+sensor.getDistrict(); |
| | | //// String addr = sensor.getProvince()+","+sensor.getCity()+","+sensor.getDistrict(); |
| | | // if (Cools.isEmpty(addr)) { |
| | | // addr = "未知定位"; |
| | | // } |
| | | // sensorVo.setAddr(addr); |
| | | // |
| | | // if (!sensorTypeSet.contains(sensor.getSensorType())) { |
| | | // sensorTypeSet.add(sensor.getSensorType()); |
| | | // SensorType sensorType = sensorTypeService.selectById(sensor.getSensorType()); |
| | | // AppSensorTypeVo vo = new AppSensorTypeVo(); |
| | | // vo.setSensorTypeFlag(sensorType.getFlag()); |
| | | // vo.setSensorTypeId(sensor.getSensorType()); |
| | | // vo.setSensorTypeName(sensorType.getName()); |
| | | // result.add(vo); |
| | | // vo.getSensors().add(sensorVo); |
| | | // } else { |
| | | // for (AppSensorTypeVo vo : result) { |
| | | // if (vo.getSensorTypeId().equals(sensor.getSensorType())) { |
| | | // vo.getSensors().add(sensorVo); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // return R.ok().add(result); |
| | | // } |
| | | // |
| | | // @RequestMapping("/sensor/detl/auth") |
| | | // @ManagerAuth |
| | | // public R sensorDetl(@RequestParam Long sensorId){ |
| | | // return R.ok().add(sensorService.selectById(sensorId)); |
| | | // } |
| | | |
| | | @RequestMapping("/issue/list/auth") |
| | | @ManagerAuth |
| | | public R sensorList(@RequestParam(required = false) String condition){ |
| | | Wrapper<Issue> wrapper = new EntityWrapper<Issue>() |
| | | .like("title", condition) |
| | | .orderBy("settle").orderBy("create_time", false); |
| | | Long hostId = getHostId(); |
| | | if (hostId != null) { |
| | | wrapper.eq("host_id", hostId); |
| | | } |
| | | List<Issue> issues = issueService.selectList(wrapper); |
| | | List<AppHostIssueVo> result = new ArrayList<>(); |
| | | Set<Long> hostSet = new HashSet<>(); |
| | | for (Issue issue : issues) { |
| | | AppIssueVo vo = new AppIssueVo(); |
| | | vo.setIssueId(issue.getId()); |
| | | vo.setTitle(issue.getTitle()); |
| | | |
| | | if (!hostSet.contains(issue.getHostId())) { |
| | | hostSet.add(issue.getHostId()); |
| | | Host host = hostService.selectById(issue.getHostId()); |
| | | AppHostIssueVo hostVo = new AppHostIssueVo(); |
| | | hostVo.setHostId(host.getId()); |
| | | hostVo.setHostName(host.getName()); |
| | | result.add(hostVo); |
| | | hostVo.getIssues().add(vo); |
| | | } else { |
| | | for (AppHostIssueVo hostVo : result) { |
| | | if (hostVo.getHostId().equals(issue.getHostId())) { |
| | | hostVo.getIssues().add(vo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok().add(result); |
| | | } |
| | | |
| | | @RequestMapping("/issue/detl/auth") |
| | | @ManagerAuth |
| | | public R issueDetl(@RequestParam Long issueId){ |
| | | return R.ok().add(issueService.selectById(issueId)); |
| | | } |
| | | |
| | | |
| | | |