From d5c8dd2a4c83718a3b7230587021d9539a83538d Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 10 十二月 2021 10:07:38 +0800
Subject: [PATCH] 发布事件添加经纬度上报
---
springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/CommonEventApi.java | 107 ++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 72 insertions(+), 35 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/CommonEventApi.java b/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/CommonEventApi.java
index a5f4f78..a5190b1 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/CommonEventApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/CommonEventApi.java
@@ -1,23 +1,22 @@
package com.panzhihua.grid_app.api;
+import javax.annotation.Resource;
+
+import com.panzhihua.common.model.vos.grid.GridMemberPositionDTO;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.model.vos.community.ComMngPopulationVO;
-import com.panzhihua.common.model.vos.grid.EventDetailsVO;
import com.panzhihua.common.model.vos.grid.EventVO;
import com.panzhihua.common.service.grid.GridService;
import com.panzhihua.common.utlis.ClazzUtils;
-import com.panzhihua.common.utlis.IdCardUtil;
+
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
/**
*
@@ -25,7 +24,7 @@
* @version 1.0
* @since 1.0
* @date 2021-05-26
- * */
+ */
@Slf4j
@RestController
@RequestMapping("/event/common")
@@ -35,98 +34,119 @@
@Resource
private GridService gridService;
- private boolean isCommonType(Integer eventType){
- if(eventType==null){
+ private boolean isCommonType(Integer eventType) {
+ if (eventType == null) {
return false;
}
- boolean inType = eventType==1 | eventType==2 |eventType==3| eventType==4| eventType==5;
+ boolean inType =
+ eventType == 1 | eventType == 2 | eventType == 3 | eventType == 4 | eventType == 5 | eventType == 6;
return inType;
}
/**
* 事件列表
- * @param pageEventDTO 查找事件
+ *
+ * @param pageEventDTO
+ * 查找事件
* @return 查找结果
*/
@GetMapping("/usersList")
- @ApiOperation(value = "事件列表", response= EventVO.class)
- R usersList(@Validated @ModelAttribute PageEventDTO pageEventDTO){
+ @ApiOperation(value = "事件列表", response = EventVO.class)
+ R usersList(@Validated @ModelAttribute PageEventDTO pageEventDTO) {
ClazzUtils.setIfStringIsEmpty(pageEventDTO);
- if(!isCommonType(pageEventDTO.getEventType())){
+ if (!isCommonType(pageEventDTO.getEventType())) {
return R.fail(400, "事件类型错误");
}
LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
pageEventDTO.setUserId(loginUserInfoVO.getUserId());
+ pageEventDTO.setRevokeType(1);
return gridService.query(pageEventDTO);
}
/**
* 新增并发布事件事件
- * @param commonEventAddDTO 添加事件传递对象
+ *
+ * @param commonEventAddDTO
+ * 添加事件传递对象
* @return 新增结果
*/
@PostMapping("/release")
@ApiOperation(value = "新增并发布事件", response = R.class)
- R add(@Validated @RequestBody CommonEventAddDTO commonEventAddDTO){
+ R add(@Validated @RequestBody CommonEventAddDTO commonEventAddDTO) {
ClazzUtils.setIfStringIsEmpty(commonEventAddDTO);
- if(!isCommonType(commonEventAddDTO.getEventType())){
+ if (!isCommonType(commonEventAddDTO.getEventType())) {
return R.fail(400, "事件类型错误");
}
LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
commonEventAddDTO.setUserId(loginUserInfoVO.getUserId());
- commonEventAddDTO.setUserName(loginUserInfoVO.getName());
+ commonEventAddDTO.setUserName(loginUserInfoVO.getNickName());
commonEventAddDTO.setPhone(loginUserInfoVO.getPhone());
- return gridService.addCommon(commonEventAddDTO);
+ R r = gridService.addCommon(commonEventAddDTO);
+ if(R.isOk(r)){
+ GridMemberPositionDTO memberPositionDTO = new GridMemberPositionDTO();
+ memberPositionDTO.setGridMemberId(loginUserInfoVO.getUserId());
+ memberPositionDTO.setPositionAddress(commonEventAddDTO.getHappenAddress());
+ String []lngLatString = commonEventAddDTO.getHappentLatLng().split(",");
+ memberPositionDTO.setLngLat(lngLatString[1] + "," + lngLatString[0]);
+ gridService.gridReportPosition(memberPositionDTO);
+ }
+ return r;
}
/**
* 保存草稿
- * @param commonEventEditDTO 保存草稿传递对象
+ *
+ * @param commonEventEditDTO
+ * 保存草稿传递对象
* @return 新增结果
*/
@PostMapping("/draft")
@ApiOperation(value = "保存草稿", response = R.class)
- R saveDraft(@Validated @RequestBody CommonEventEditDTO commonEventEditDTO){
+ R saveDraft(@Validated @RequestBody CommonEventEditDTO commonEventEditDTO) {
ClazzUtils.setIfStringIsEmpty(commonEventEditDTO);
ClazzUtils.setIfStringIsEmpty(commonEventEditDTO);
- if(!isCommonType(commonEventEditDTO.getEventType())){
+ if (!isCommonType(commonEventEditDTO.getEventType())) {
return R.fail(400, "事件类型错误");
}
LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
commonEventEditDTO.setUserId(loginUserInfoVO.getUserId());
- commonEventEditDTO.setUserName(loginUserInfoVO.getName());
+ commonEventEditDTO.setUserName(loginUserInfoVO.getNickName());
commonEventEditDTO.setPhone(loginUserInfoVO.getPhone());
return gridService.saveDraft(commonEventEditDTO);
}
/**
* 上报社区
- * @param commonEventReportDTO 上报社区传递对象
+ *
+ * @param commonEventReportDTO
+ * 上报社区传递对象
* @return 上报结果
*/
@PutMapping("/report")
@ApiOperation(value = "上报社区", response = R.class)
- R report(@Validated @RequestBody CommonEventReportDTO commonEventReportDTO){
+ R report(@Validated @RequestBody CommonEventReportDTO commonEventReportDTO) {
LoginUserInfoVO loginUserInfoVO = getLoginUserInfo();
ClazzUtils.setIfStringIsEmpty(commonEventReportDTO);
commonEventReportDTO.setUserId(loginUserInfoVO.getUserId());
- commonEventReportDTO.setUserName(loginUserInfoVO.getName());
+ commonEventReportDTO.setUserName(loginUserInfoVO.getNickName());
commonEventReportDTO.setCommunityId(loginUserInfoVO.getCommunityId());
return gridService.report(commonEventReportDTO);
}
/**
* 处理事件
- * @param commonEventDealDTO 修改事件传递对象
+ *
+ * @param commonEventDealDTO
+ * 修改事件传递对象
* @return 处理结果
*/
@PutMapping("/deal")
@ApiOperation(value = "处理事件", response = R.class)
- R deal(@Validated @RequestBody CommonEventDealDTO commonEventDealDTO){
+ R deal(@Validated @RequestBody CommonEventDealDTO commonEventDealDTO) {
ClazzUtils.setIfStringIsEmpty(commonEventDealDTO);
LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
commonEventDealDTO.setUserId(loginUserInfoVO.getUserId());
- commonEventDealDTO.setUserName(loginUserInfoVO.getName());
+ commonEventDealDTO.setUserName(loginUserInfoVO.getNickName());
commonEventDealDTO.setOperateType(0);
commonEventDealDTO.setCommunityId(loginUserInfoVO.getCommunityId());
commonEventDealDTO.setCommunityName(loginUserInfoVO.getCommunityName());
@@ -135,20 +155,37 @@
/**
* 验证事件
- * @param commonEventVerifyDTO 验证事件传递对象
+ *
+ * @param commonEventVerifyDTO
+ * 验证事件传递对象
* @return 验证结果
*/
@PutMapping("/verify")
@ApiOperation(value = "验证事件", response = R.class)
- R verify(@Validated @RequestBody CommonEventVerifyDTO commonEventVerifyDTO){
+ R verify(@Validated @RequestBody CommonEventVerifyDTO commonEventVerifyDTO) {
ClazzUtils.setIfStringIsEmpty(commonEventVerifyDTO);
LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
commonEventVerifyDTO.setUserId(loginUserInfoVO.getUserId());
- commonEventVerifyDTO.setUserName(loginUserInfoVO.getName());
+ commonEventVerifyDTO.setUserName(loginUserInfoVO.getNickName());
return gridService.verifyEvent(commonEventVerifyDTO);
}
-
-
+ /**
+ * 直接上报社区
+ *
+ * @param commonEventDirectReportDTO
+ * 上报社区传递对象
+ * @return 上报结果
+ */
+ @PostMapping("/reportDirect")
+ @ApiOperation(value = "直接上报社区", response = R.class)
+ R reportDirect(@Validated @RequestBody CommonEventDirectReportDTO commonEventDirectReportDTO) {
+ LoginUserInfoVO loginUserInfoVO = getLoginUserInfo();
+ ClazzUtils.setIfStringIsEmpty(commonEventDirectReportDTO);
+ commonEventDirectReportDTO.setUserId(loginUserInfoVO.getUserId());
+ commonEventDirectReportDTO.setUserName(loginUserInfoVO.getNickName());
+ commonEventDirectReportDTO.setCommunityId(loginUserInfoVO.getCommunityId());
+ return gridService.reportDirect(commonEventDirectReportDTO);
+ }
}
\ No newline at end of file
--
Gitblit v1.7.1