From c7dd4a195d8d893d92c49963447cdf6486844584 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Fri, 20 Oct 2023 09:45:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wb' into cjl
---
screen-manage/src/main/java/com/moral/api/controller/GovMonitorPoionController.java | 95 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/screen-manage/src/main/java/com/moral/api/controller/GovMonitorPoionController.java b/screen-manage/src/main/java/com/moral/api/controller/GovMonitorPoionController.java
index 6bfbc14..910fb39 100644
--- a/screen-manage/src/main/java/com/moral/api/controller/GovMonitorPoionController.java
+++ b/screen-manage/src/main/java/com/moral/api/controller/GovMonitorPoionController.java
@@ -3,18 +3,22 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.entity.GovMonitorPoint;
+import com.moral.api.entity.Organization;
import com.moral.api.mapper.GovMonitorPointMapper;
+import com.moral.api.mapper.OrganizationMapper;
import com.moral.api.service.GovMonitorPointService;
import com.moral.constant.Constants;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import com.moral.util.WebUtils;
-import io.swagger.annotations.Api;
+
+import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+
import java.util.List;
import java.util.Map;
@@ -36,34 +40,37 @@
@Resource
private GovMonitorPointMapper govMonitorPointMapper;
+ @Resource
+ private OrganizationMapper organizationMapper;
+
@RequestMapping(value = "getGovMonitorPointByCondition", method = RequestMethod.GET)
@ResponseBody
public ResultMessage getSpecialDeviceByCondition(HttpServletRequest request) {
- Map<String,Object> parameters = WebUtils.getParametersStartingWith(request,null);
- Map<String,Object> resultMap = govMonitorPointService.getDataByCondition(parameters);
- if (!resultMap.containsKey("code")){
+ Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+ Map<String, Object> resultMap = govMonitorPointService.getDataByCondition(parameters);
+ if (!resultMap.containsKey("code")) {
return ResultMessage.ok(resultMap);
}
- return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()),resultMap.get("msg").toString());
+ return ResultMessage.fail(Integer.parseInt(resultMap.get("code").toString()), resultMap.get("msg").toString());
}
@RequestMapping(value = "insert", method = RequestMethod.POST)
@ResponseBody
- public ResultMessage insert(@RequestBody GovMonitorPoint govMonitorPoint){
+ public ResultMessage insert(@RequestBody GovMonitorPoint govMonitorPoint) {
String guid = govMonitorPoint.getGuid();
String name = govMonitorPoint.getName();
double longitude = govMonitorPoint.getLongitude();
double latitude = govMonitorPoint.getLatitude();
String station_level = govMonitorPoint.getStationLevel();
- if (ObjectUtils.isEmpty(guid) && ObjectUtils.isEmpty(name) && ObjectUtils.isEmpty(longitude) && ObjectUtils.isEmpty(latitude) && ObjectUtils.isEmpty(station_level)){
- return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ if (ObjectUtils.isEmpty(guid) && ObjectUtils.isEmpty(name) && ObjectUtils.isEmpty(longitude) && ObjectUtils.isEmpty(latitude) && ObjectUtils.isEmpty(station_level)) {
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
}
QueryWrapper<GovMonitorPoint> wrapper_govMonitorPoint = new QueryWrapper<>();
- wrapper_govMonitorPoint.eq("is_delete",Constants.NOT_DELETE);
- wrapper_govMonitorPoint.eq("guid",guid).or().eq("name",name);
+ wrapper_govMonitorPoint.eq("is_delete", Constants.NOT_DELETE);
+ wrapper_govMonitorPoint.eq("guid", guid).or().eq("name", name);
List<GovMonitorPoint> govMonitorPoints = govMonitorPointMapper.selectList(wrapper_govMonitorPoint);
- if (govMonitorPoints.size()>0){
- return ResultMessage.fail(ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode(),ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg());
+ if (govMonitorPoints.size() > 0) {
+ return ResultMessage.fail(ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode(), ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg());
}
govMonitorPointService.insert(govMonitorPoint);
return ResultMessage.ok();
@@ -71,37 +78,73 @@
@RequestMapping(value = "update", method = RequestMethod.POST)
@ResponseBody
- public ResultMessage update(@RequestBody GovMonitorPoint govMonitorPoint){
+ public ResultMessage update(@RequestBody GovMonitorPoint govMonitorPoint) {
int id = govMonitorPoint.getId();
- if (ObjectUtils.isEmpty(id)){
- return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ if (ObjectUtils.isEmpty(id)) {
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
}
QueryWrapper<GovMonitorPoint> wrapper_govMonitorPoint = new QueryWrapper<>();
- wrapper_govMonitorPoint.eq("is_delete",Constants.NOT_DELETE);
- wrapper_govMonitorPoint.eq("id",id);
+ wrapper_govMonitorPoint.eq("is_delete", Constants.NOT_DELETE);
+ wrapper_govMonitorPoint.eq("id", id);
List<GovMonitorPoint> govMonitorPoints = govMonitorPointMapper.selectList(wrapper_govMonitorPoint);
- if (govMonitorPoints.size()==0){
- return ResultMessage.fail(ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode(),ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg());
+ if (govMonitorPoints.size() == 0) {
+ return ResultMessage.fail(ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode(), ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg());
}
govMonitorPointService.update(govMonitorPoint);
return ResultMessage.ok();
}
+ @GetMapping("updateGuid")
+ @ApiOperation(value = "������������������", notes = "������������������")
+ public ResultMessage updateGuid(@RequestParam @ApiParam(value = "id",name = "������id") Integer id,
+ @RequestParam @ApiParam(value = "guid",name = "������������") String guid) {
+
+ govMonitorPointService.updateList(id,guid);
+ return ResultMessage.ok();
+ }
+
+
@RequestMapping(value = "delete", method = RequestMethod.POST)
@ResponseBody
- public ResultMessage delete(@RequestBody Map map){
+ public ResultMessage delete(@RequestBody Map map) {
int id = Integer.parseInt(map.get("id").toString());
- if (ObjectUtils.isEmpty(id)){
- return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ if (ObjectUtils.isEmpty(id)) {
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
}
QueryWrapper<GovMonitorPoint> wrapper_govMonitorPoint = new QueryWrapper<>();
- wrapper_govMonitorPoint.eq("is_delete",Constants.NOT_DELETE);
- wrapper_govMonitorPoint.eq("id",id);
+ wrapper_govMonitorPoint.eq("is_delete", Constants.NOT_DELETE);
+ wrapper_govMonitorPoint.eq("id", id);
List<GovMonitorPoint> govMonitorPoints = govMonitorPointMapper.selectList(wrapper_govMonitorPoint);
- if (govMonitorPoints.size()==0){
- return ResultMessage.fail(ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode(),ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg());
+ if (govMonitorPoints.size() == 0) {
+ return ResultMessage.fail(ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getCode(), ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg());
}
govMonitorPointService.delete(id);
return ResultMessage.ok();
}
+
+ @ApiOperation(value = "������������������������������/������/������������", notes = "������������������������������/������/������������")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String")
+ })
+ @GetMapping("govMonitorPoints")
+ public ResultMessage selectGovMonitorPoints(String regionCode) {
+ List<Map<String, Object>> response = govMonitorPointService.selectGovMonitorPoints(regionCode);
+ return ResultMessage.ok(response);
+ }
+
+ @RequestMapping(value = "getGovMonitorPointsByOrgId", method = RequestMethod.GET)
+ @ResponseBody
+ public ResultMessage getGovMonitorPointsByOrgId(HttpServletRequest request){
+ Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+ Object orgid = parameters.get("organization_id");
+ if (ObjectUtils.isEmpty(orgid)){
+ return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+ }
+ Organization organization = organizationMapper.selectById(Integer.parseInt(orgid.toString()));
+ if (ObjectUtils.isEmpty(organization)){
+ return ResultMessage.fail(ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getCode(), ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getMsg());
+ }
+ List<GovMonitorPoint> govMonitorPoints = govMonitorPointService.selectGovMonitorPointsByOrgid(parameters);
+ return ResultMessage.ok(govMonitorPoints);
+ }
}
--
Gitblit v1.8.0