| | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.boying.entity.*; |
| | | import com.boying.service.*; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | Map<String,Object> map = new HashMap<>(); |
| | | try { |
| | | QueryWrapper<InspectionTask> wrapper = new QueryWrapper<>(); |
| | | wrapper.select(" id,is_ok"); |
| | | wrapper.lambda() |
| | | .eq(InspectionTask::getIsOk,1); |
| | | List<InspectionTask> inspectionTasks = inspectionTaskService.list(null); |
| | | QueryWrapper<InspectionTask> wrapper1 = new QueryWrapper<>(); |
| | | wrapper1.select(" id,is_ok"); |
| | | List<InspectionTask> inspectionTasks = inspectionTaskService.list(wrapper1); |
| | | List<InspectionTask> inspectionTasks2 = inspectionTaskService.list(wrapper); |
| | | map.put("count",inspectionTasks.size()); |
| | | map.put("normalCount",inspectionTasks2.size()); |
| | |
| | | public R getTaskInfoById(String id){ |
| | | try { |
| | | QueryWrapper<TaskInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.select(" id,task_id,task_date,is_ok,content"); |
| | | wrapper.lambda() |
| | | .eq(TaskInfo::getTaskId,id); |
| | | List<TaskInfo> infos = taskInfoService.list(wrapper); |
| | |
| | | public R getTaskByDate(String startDate,String endDate){ |
| | | try { |
| | | QueryWrapper<InspectionTask> wrapper = new QueryWrapper<>(); |
| | | wrapper.select(" id,title,start_date"); |
| | | wrapper.lambda() |
| | | .between(InspectionTask::getStartDate,startDate,endDate); |
| | | .between(StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate),InspectionTask::getStartDate,startDate,endDate); |
| | | return R.ok(inspectionTaskService.list(wrapper)); |
| | | } catch (Exception e) { |
| | | return R.failed("出错"); |
| | |
| | | QueryWrapper<WarnLog> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(type != null,WarnLog::getType,type) |
| | | .orderByDesc(WarnLog::getWarnDate) |
| | | .last( " limit 15"); |
| | | .last( " limit 11"); |
| | | List<WarnLog> list = warnService.list(wrapper); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 地图数据 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping("/getMapData") |
| | | public R getMapData(){ |
| | | List<Map<String,Object>> list = new ArrayList<>(); |
| | | Map<String,Object> map1 = new HashMap<>(); |
| | | map1.put("lon","118.14360"); |
| | | map1.put("lat","39.67260"); |
| | | map1.put("address","河北省唐山市路北区长宁道603号"); |
| | | map1.put("health",0); |
| | | |
| | | Map<String,Object> map2 = new HashMap<>(); |
| | | map2.put("lon","118.26958"); |
| | | map2.put("lat","39.68333"); |
| | | map2.put("address","河北省唐山市开平区东西大街199号"); |
| | | map2.put("health",0); |
| | | |
| | | Map<String,Object> map3 = new HashMap<>(); |
| | | map3.put("lon","118.15782"); |
| | | map3.put("lat","39.63102"); |
| | | map3.put("address","河北省唐山市路南区新华西道76号4层"); |
| | | map3.put("health",0); |
| | | |
| | | Map<String,Object> map4 = new HashMap<>(); |
| | | map4.put("lon","118.09289"); |
| | | map4.put("lat","39.58163"); |
| | | map4.put("address","河北省唐山市丰南区正苑大街7号"); |
| | | map4.put("health",0); |
| | | |
| | | Map<String,Object> map5 = new HashMap<>(); |
| | | map5.put("lon","118.14114"); |
| | | map5.put("lat","39.83368"); |
| | | map5.put("address","河北省唐山市丰润区曹雪芹大街17号"); |
| | | map5.put("health",0); |
| | | |
| | | Map<String,Object> map6 = new HashMap<>(); |
| | | map6.put("lon","118.45153"); |
| | | map6.put("lat","39.74049"); |
| | | map6.put("address","河北省唐山市古冶区永盛路"); |
| | | map6.put("health",0); |
| | | list.add(map1); |
| | | list.add(map2); |
| | | list.add(map3); |
| | | list.add(map4); |
| | | list.add(map5); |
| | | list.add(map6); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | @RequestMapping("/upload") |
| | | public R upload(@RequestParam("file") MultipartFile file,@RequestParam("type") Integer type)throws Exception{ |
| | | String name = file.getOriginalFilename(); |
| | | String s = name.split(".")[1]; |
| | | if(!s.equals(".xls")) { |
| | | String[] split = name.split("\\."); |
| | | if(!split[1].equals("xlsx")) { |
| | | throw new Exception("文件格式错误"); |
| | | } |
| | | if(type == 0){ |