Browse Source

增加城管上报功能;

dev
luyan 2 years ago
parent
commit
04c937c295
  1. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java
  2. 60
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java
  3. 19
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java
  4. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventReplyEntity.java
  5. 19
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java
  6. 180
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  7. 102
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/utils/IcEventReportUtils.java
  8. 191
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/utils/ReportCityManageData.java

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventListResultDTO.java

@ -202,6 +202,11 @@ public class IcEventListResultDTO implements Serializable {
*/ */
private String difficultPointName; private String difficultPointName;
/**
* 日照:上报城管返回案卷唯一标识
*/
private String taskNum;
/** /**
* 事件附件 * 事件附件
*/ */

60
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/IcEventController.java

@ -34,10 +34,12 @@ import com.epmet.service.IcEventReplyService;
import com.epmet.service.IcEventService; import com.epmet.service.IcEventService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.websocket.server.PathParam;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Date; import java.util.Date;
@ -62,6 +64,7 @@ public class IcEventController {
/** /**
* 事件管理-列表 * 事件管理-列表
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -72,6 +75,7 @@ public class IcEventController {
formDTO.setStaffId(tokenDto.getUserId()); formDTO.setStaffId(tokenDto.getUserId());
return new Result<PageData<IcEventListResultDTO>>().ok(icEventService.list(formDTO)); return new Result<PageData<IcEventListResultDTO>>().ok(icEventService.list(formDTO));
} }
/** /**
* @Author sun * @Author sun
* @Description 工作端小程序-事件管理-列表 * @Description 工作端小程序-事件管理-列表
@ -92,6 +96,7 @@ public class IcEventController {
/** /**
* 事件管理-新增 * 事件管理-新增
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -130,6 +135,7 @@ public class IcEventController {
/** /**
* 事件处理分析-处理状态比例查询 * 事件处理分析-处理状态比例查询
*
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -148,6 +154,7 @@ public class IcEventController {
/** /**
* 事件处理分析-事件列表 * 事件处理分析-事件列表
*
* @param input * @param input
* @return * @return
*/ */
@ -169,6 +176,7 @@ public class IcEventController {
/** /**
* 时间处理分析-阅读增量查询 * 时间处理分析-阅读增量查询
*
* @param input * @param input
* @return * @return
*/ */
@ -190,6 +198,7 @@ public class IcEventController {
/** /**
* 研判分析查询 * 研判分析查询
*
* @param eventId * @param eventId
* @return * @return
*/ */
@ -201,6 +210,7 @@ public class IcEventController {
/** /**
* 组织下分类下的事件列表 * 组织下分类下的事件列表
*
* @param input * @param input
* @return * @return
*/ */
@ -215,6 +225,7 @@ public class IcEventController {
PageData<IcEventResultDTO> page = icEventService.getSameCategoryEvents(orgId, orgType, categroyPid, pageNo, pageSize); PageData<IcEventResultDTO> page = icEventService.getSameCategoryEvents(orgId, orgType, categroyPid, pageNo, pageSize);
return new Result<PageData<IcEventResultDTO>>().ok(page); return new Result<PageData<IcEventResultDTO>>().ok(page);
} }
/** /**
* @Author sun * @Author sun
* @Description 事件管理-回复 * @Description 事件管理-回复
@ -260,6 +271,7 @@ public class IcEventController {
/** /**
* 事件转议题 * 事件转议题
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -327,6 +339,45 @@ public class IcEventController {
ValidatorUtils.validateEntity(formDTO, IcEventListFormDTO.Detail.class); ValidatorUtils.validateEntity(formDTO, IcEventListFormDTO.Detail.class);
return new Result<IcEventListResultDTO>().ok(icEventService.detail(formDTO)); return new Result<IcEventListResultDTO>().ok(icEventService.detail(formDTO));
} }
/**
* 日照事件上报城管
*
* @param formDTO
* @return
*/
@MaskResponse(fieldNames = {"idCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_ID_CARD})
@PostMapping("reportCityManager")
public Result reportCityManager(@LoginUser TokenDto tokenDto, @RequestBody IcEventListFormDTO formDTO) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(formDTO, IcEventListFormDTO.Detail.class);
IcEventListResultDTO data = icEventService.detail(formDTO);
if (null != data && StringUtils.isNotEmpty(data.getTaskNum())) {
return new Result().error(-1, "该事件已上报,请勿重复上报!");
}
return icEventService.reportCityManager(data);
}
/**
* 查询上报城管数据处理状态
*
* @param icEventId 事件ID
* @param taskNum 上报城管返回案卷唯一标识
* @return
*/
@GetMapping("checkReportStatus")
public Result checkReportStatus(@PathParam("icEventId") String icEventId, @PathParam("taskNum") String taskNum) throws IOException {
if (StringUtils.isEmpty(icEventId)) {
return new Result().error(-1, "请确认事件是否存在!");
}
if (StringUtils.isEmpty(taskNum)) {
return new Result().error(-1, "请确认事件是否已经上报!");
}
return icEventService.checkReportStatus(icEventId, taskNum);
}
/** /**
* @Author sun * @Author sun
* @Description 工作端小程序-事件管理-详情 * @Description 工作端小程序-事件管理-详情
@ -342,6 +393,7 @@ public class IcEventController {
/** /**
* 事件分类分析- 饼图2直属下级 事件数量 * 事件分类分析- 饼图2直属下级 事件数量
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -367,6 +419,7 @@ public class IcEventController {
/** /**
* Desc: 定时任务自动评价 * Desc: 定时任务自动评价
*
* @param formDTO * @param formDTO
* @author zxc * @author zxc
* @date 2022/5/18 16:35 * @date 2022/5/18 16:35
@ -390,6 +443,7 @@ public class IcEventController {
/** /**
* Desc: 新增随手拍 * Desc: 新增随手拍
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @author zxc * @author zxc
@ -408,6 +462,7 @@ public class IcEventController {
/** /**
* 居民端小程序我上报的事件-列表+详情 * 居民端小程序我上报的事件-列表+详情
* yapi: http://yapi.elinkservice.cn/project/102/interface/api/7781 * yapi: http://yapi.elinkservice.cn/project/102/interface/api/7781
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -422,6 +477,7 @@ public class IcEventController {
/** /**
* 居民端我上报的事件 消息列表跳转详情 * 居民端我上报的事件 消息列表跳转详情
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -437,6 +493,7 @@ public class IcEventController {
/** /**
* 居民端小程序我上报的事件详情页面-回复列表 * 居民端小程序我上报的事件详情页面-回复列表
* http://yapi.elinkservice.cn/project/102/interface/api/7783 * http://yapi.elinkservice.cn/project/102/interface/api/7783
*
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -451,6 +508,7 @@ public class IcEventController {
* 居民端小程序我上报的事件-处理中 * 居民端小程序我上报的事件-处理中
* 点击事件进入详情页时调用此接口消除红点 * 点击事件进入详情页时调用此接口消除红点
* yapihttp://yapi.elinkservice.cn/project/102/interface/api/7790 * yapihttp://yapi.elinkservice.cn/project/102/interface/api/7790
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -466,6 +524,7 @@ public class IcEventController {
/** /**
* 居民端我上报的事件-回复 * 居民端我上报的事件-回复
* http://yapi.elinkservice.cn/project/102/interface/api/7789 * http://yapi.elinkservice.cn/project/102/interface/api/7789
*
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return * @return
@ -551,6 +610,7 @@ public class IcEventController {
/** /**
* 数据分析-个人档案-上报事件列表,根据epmetUserIdList查询 * 数据分析-个人档案-上报事件列表,根据epmetUserIdList查询
* 模仿gov/project/resieventreply/pageuserreported接口重新查询新表接口 * 模仿gov/project/resieventreply/pageuserreported接口重新查询新表接口
*
* @author sun * @author sun
*/ */
@PostMapping("icevent-pageuserreported") @PostMapping("icevent-pageuserreported")

19
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventEntity.java

@ -1,7 +1,6 @@
package com.epmet.entity; package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -158,11 +157,11 @@ public class IcEventEntity extends BaseEpmetEntity {
/** /**
* 事件审核状态[涉及附件审核需要加的状态]审核中auditing * 事件审核状态[涉及附件审核需要加的状态]审核中auditing
auto_passed: 自动通过 * auto_passed: 自动通过
review结果不确定需要人工审核 * review结果不确定需要人工审核
block: 结果违规 * block: 结果违规
rejected人工审核驳回; * rejected人工审核驳回;
approved人工审核通过 * approved人工审核通过
*/ */
private String auditStatus; private String auditStatus;
@ -176,4 +175,12 @@ public class IcEventEntity extends BaseEpmetEntity {
*/ */
private String difficultPoint; private String difficultPoint;
/**
* 日照上传城管返回的任务ID
*/
private String taskNum;
private String recId;
} }

16
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/IcEventReplyEntity.java

@ -1,7 +1,6 @@
package com.epmet.entity; package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -36,6 +35,21 @@ public class IcEventReplyEntity extends BaseEpmetEntity {
*/ */
private String fromUserId; private String fromUserId;
/**
* 日照城管处理办理人姓名
*/
private String humanName;
/**
* 日照城管办理部门办理经过
*/
private String actDefName;
/**
* 日照城管上报办理时间
*/
private Date actionTime;
/** /**
* 内容 * 内容
*/ */

19
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/IcEventService.java

@ -2,11 +2,13 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcEventDTO; import com.epmet.dto.IcEventDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.IcEventEntity; import com.epmet.entity.IcEventEntity;
import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -73,6 +75,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 事件列表 * 事件列表
*
* @param orgId * @param orgId
* @param orgType * @param orgType
* @param categoryCode * @param categoryCode
@ -88,6 +91,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 月度增量查询 * 月度增量查询
*
* @param orgType * @param orgType
* @param orgId * @param orgId
* @param queryStartTime * @param queryStartTime
@ -98,6 +102,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 研判分析查询 * 研判分析查询
*
* @param eventId * @param eventId
* @return * @return
*/ */
@ -105,6 +110,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 同类事件列表 * 同类事件列表
*
* @param categoryPids * @param categoryPids
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
@ -132,6 +138,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 事件分类分析-一级分类下事件数量 * 事件分类分析-一级分类下事件数量
*
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -145,6 +152,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* Desc: 定时任务自动评价 * Desc: 定时任务自动评价
*
* @param formDTO * @param formDTO
* @author zxc * @author zxc
* @date 2022/5/18 16:35 * @date 2022/5/18 16:35
@ -162,8 +170,10 @@ public interface IcEventService extends BaseService<IcEventEntity> {
* @Description 事件管理-处理进展 * @Description 事件管理-处理进展
**/ **/
LinkedList<IcEventProcessListResultDTO> process(IcEventReplyFormDTO formDTO); LinkedList<IcEventProcessListResultDTO> process(IcEventReplyFormDTO formDTO);
/** /**
* 事件分类分析- 饼图2直属下级 事件数量 * 事件分类分析- 饼图2直属下级 事件数量
*
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -178,6 +188,7 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* Desc: 新增随手拍 * Desc: 新增随手拍
*
* @param formDTO * @param formDTO
* @author zxc * @author zxc
* @date 2022/5/19 13:38 * @date 2022/5/19 13:38
@ -206,12 +217,14 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 居民端我上报的事件-回复 * 居民端我上报的事件-回复
*
* @param formDTO * @param formDTO
*/ */
void resiReply(ResiReplyIcEventFormDTO formDTO); void resiReply(ResiReplyIcEventFormDTO formDTO);
/** /**
* 居民端我上报的事件 消息列表跳转详情 * 居民端我上报的事件 消息列表跳转详情
*
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -228,14 +241,20 @@ public interface IcEventService extends BaseService<IcEventEntity> {
/** /**
* 事件转议题 * 事件转议题
*
* @param formDTO * @param formDTO
*/ */
void icEventToIssue(IcEventToIssueFormDTO formDTO); void icEventToIssue(IcEventToIssueFormDTO formDTO);
/** /**
* 批量查询事件信息 * 批量查询事件信息
*
* @param icEventIds * @param icEventIds
* @return * @return
*/ */
List<IcEventDTO> batchSelectById(List<String> icEventIds); List<IcEventDTO> batchSelectById(List<String> icEventIds);
Result reportCityManager(IcEventListResultDTO data) throws IOException;
Result checkReportStatus(String icEventId, String taskNum) throws IOException;
} }

180
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -1,6 +1,8 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -36,18 +38,31 @@ import com.epmet.enums.ProjectOriginEnum;
import com.epmet.feign.*; import com.epmet.feign.*;
import com.epmet.resi.group.constant.TopicConstant; import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.service.*; import com.epmet.service.*;
import com.epmet.utils.IcEventReportUtils;
import com.epmet.utils.ReportCityManageData;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function; import java.util.function.Function;
@ -187,6 +202,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* 事件管理-新增 * 事件管理-新增
*
* @param formDTO * @param formDTO
*/ */
@Override @Override
@ -452,6 +468,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* 事件管理-批量删除事件 * 事件管理-批量删除事件
*
* @param ids * @param ids
*/ */
@Override @Override
@ -727,6 +744,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* 查询家属 * 查询家属
*
* @param idCard * @param idCard
* @return * @return
*/ */
@ -1206,6 +1224,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* Desc: 定时任务自动评价 * Desc: 定时任务自动评价
*
* @param formDTO * @param formDTO
* @author zxc * @author zxc
* @date 2022/5/18 16:35 * @date 2022/5/18 16:35
@ -1230,6 +1249,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* Desc: 处理未评价的icEvent * Desc: 处理未评价的icEvent
*
* @param customerId * @param customerId
* @author zxc * @author zxc
* @date 2022/5/18 16:52 * @date 2022/5/18 16:52
@ -1402,6 +1422,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* Desc: 新增随手拍 * Desc: 新增随手拍
*
* @param formDTO * @param formDTO
* @author zxc * @author zxc
* @date 2022/5/19 13:38 * @date 2022/5/19 13:38
@ -1477,6 +1498,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* Desc: 给工作人员发送站内信 * Desc: 给工作人员发送站内信
*
* @param agencyId * @param agencyId
* @param customerId * @param customerId
* @param showName * @param showName
@ -1513,6 +1535,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
/** /**
* Desc: 附件处理 * Desc: 附件处理
*
* @param list * @param list
* @param attachmentEntityList * @param attachmentEntityList
* @param id * @param id
@ -1906,4 +1929,161 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
return ConvertUtils.sourceToTarget(list, IcEventDTO.class); return ConvertUtils.sourceToTarget(list, IcEventDTO.class);
} }
@Override
public Result reportCityManager(IcEventListResultDTO data) throws IOException {
ReportCityManageData reportData;
if (null != data) {
reportData = new ReportCityManageData();
//事件问题描述
reportData.setEventDesc(StringUtils.isNotEmpty(data.getEventContent()) ? data.getEventContent() : "");
//事件ID
reportData.setOtherTaskNum(StringUtils.isNotEmpty(data.getIcEventId()) ? data.getIcEventId() : "");
//事件发生地址
reportData.setAddress(StringUtils.isNotEmpty(data.getAddress()) ? data.getAddress() : "");
//X坐标
// reportData.setCoordinateX(Double.valueOf(data.getLongitude())); //先不传
reportData.setLontitude(Double.valueOf(StringUtils.isNotEmpty(data.getLongitude()) ? data.getLongitude() : "0.0"));
//Y坐标
// reportData.setCoordinateY(Double.valueOf(data.getLatitude())); //先不传
reportData.setLatitude(Double.valueOf(StringUtils.isNotEmpty(data.getLatitude()) ? data.getLatitude() : "0.0"));
//上报人
reportData.setHumanName(data.getName());
//上报人电话
reportData.setCellphone(data.getMobile());
//问题来源标示:默认130057
reportData.setEventSrcID(IcEventReportUtils.EVENT_SRC_ID);
//所属社区
if (StringUtils.isNotEmpty(data.getGridName())) {
reportData.setCommunityName(data.getGridName().substring(0, data.getGridName().lastIndexOf("-")));
reportData.setStreetName(data.getGridName().substring(data.getGridName().lastIndexOf("-") + 1));
}
//案卷类型标识 城市管理 1,社会服务类 2
reportData.setRecTypeID(1);
//问题级别标识 按照现场要求默认为1或者2
reportData.setEventLevelID(1);
//问题类型标识 临时采用默认值 1
reportData.setEventTypeCode("1");
List<ReportCityManageData.Media> medias = new ArrayList<>();
if (null != data.getImageList() && data.getImageList().size() > 0) {
data.getImageList().forEach(img -> {
ReportCityManageData.Media media = new ReportCityManageData.Media();
media.setMediaUsage("上报");
media.setMediaType("IMAGE");
media.setMediaURL(img);
media.setMediaName(img.substring(img.lastIndexOf("/") + 1));
// try {
// media.setContent(IcEventReportUtils.getFileByBase64(img));
// } catch (IOException e) {
// throw new EpmetException("下载事件图片文件失败,请联系管理员!");
// }
medias.add(media);
});
reportData.setMedias(medias);
}
if (null != data.getVoiceList() && data.getVoiceList().size() > 0) {
data.getVoiceList().forEach(voice -> {
ReportCityManageData.Media media = new ReportCityManageData.Media();
media.setMediaUsage("上报");
media.setMediaType("VOICE");
media.setMediaURL(voice.getUrl());
media.setMediaName(voice.getUrl().substring(voice.getUrl().lastIndexOf("/") + 1));
// try {
// media.setContent(IcEventReportUtils.getFileByBase64(voice.getUrl()));
// } catch (IOException e) {
// throw new EpmetException("下载事件音频文件失败,请联系管理员!");
// }
medias.add(media);
});
reportData.setMedias(medias);
}
JSONObject result = reportData(reportData);
if (!result.getString("success").equals("false")) {
JSONObject obj = result.getJSONObject("data");
IcEventEntity entity = new IcEventEntity();
entity.setId(data.getIcEventId());
entity.setRecId(obj.getString("recID"));
entity.setTaskNum(obj.getString("taskNum"));
updateById(entity);
return new Result();
} else {
return new Result().error(8000, result.getString("message"));
}
} else {
throw new EpmetException("没有查询到该事件!");
}
}
@Override
public Result checkReportStatus(String icEventId, String taskNum) throws IOException {
CloseableHttpClient client = null;
CloseableHttpResponse response = null;
try {
client = HttpClients.createDefault();
RequestConfig config = RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3000).setSocketTimeout(10000).build();
StringBuilder url = new StringBuilder(IcEventReportUtils.REPORT_STATUS_URL);
url.append("?senderCode=" + IcEventReportUtils.STATUS_CODE).append("&taskNum=").append(taskNum);
HttpGet get = new HttpGet(url.toString());
get.addHeader("Content-Type", "application/json;charset=utf-8");
get.addHeader("Accept", "application/json;charset=utf-8");
get.addHeader("Connection", "keep-alive");
get.setConfig(config);
response = client.execute(get);
JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
if (!json.getString("success").equals("false")) {
JSONArray process = JSONObject.parseObject(json.getString("data")).getJSONArray("recProcess");
if (null != process && process.size() > 0) {
List<IcEventReplyEntity> entityList = new ArrayList<>();
for (int i = 0; i < process.size(); i++) {
JSONObject object = process.getJSONObject(i);
IcEventReplyEntity replyEntity = new IcEventReplyEntity();
replyEntity.setCustomerId(EpmetRequestHolder.getLoginUserCustomerId());
replyEntity.setIcEventId(icEventId);
replyEntity.setHumanName(object.getString("humanName"));
replyEntity.setActDefName(object.getString("actDefName"));
replyEntity.setContent(object.getString("content"));
}
icEventReplyService.saveOrUpdateBatch(entityList);
} else {
return new Result().error(Integer.valueOf(json.getString("code")), json.getString("message"));
}
} else {
return new Result().error(Integer.valueOf(json.getString("code")), json.getString("message"));
}
return new Result();
} catch (Exception e) {
throw new EpmetException(8000, "查询失败,请联系管理员!");
} finally {
if (null != client) {
client.close();
}
response.close();
}
}
private JSONObject reportData(ReportCityManageData reportData) throws IOException {
CloseableHttpClient client = null;
CloseableHttpResponse response = null;
try {
client = HttpClients.createDefault();
HttpPost post = new HttpPost(IcEventReportUtils.REPORT_URL);
RequestConfig config = RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3000).setSocketTimeout(10000).build();
post.setConfig(config);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setCharset(StandardCharsets.UTF_8);
builder.addTextBody("senderCode", IcEventReportUtils.SENDER_CODE);
builder.addTextBody("actionType", IcEventReportUtils.ACTION_TYPE);
builder.addTextBody("data", JSONObject.toJSON(reportData).toString());
HttpEntity entity = builder.build();
post.setEntity(entity);
response = client.execute(post);
return JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
throw new EpmetException("上报失败,请联系管理员!");
} finally {
if (null != client) {
client.close();
}
response.close();
}
}
} }

102
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/utils/IcEventReportUtils.java

@ -0,0 +1,102 @@
package com.epmet.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustAllStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
/**
* @author yan Lu
* @description 日照事件上报城管工具类
* @create 2023/7/3 16:32
*/
@Slf4j
public class IcEventReportUtils {
/**
* 请求地址前缀
*/
private static final String URL_PREFIX = "https://rzzhsq.shuzirizhao.cn/eUrbanMIS/openapi/v2";
/**
* 上报地址
*/
public static final String REPORT_URL = URL_PREFIX + "/upstream";
/**
* 处理状态地址
*/
public static final String REPORT_STATUS_URL = URL_PREFIX + "/downstream/recprocess";
/**
* 调用方法
*/
public static final String ACTION_TYPE = "UP_REC_REPORT";
/**
* 发送方标识
*/
public static final String SENDER_CODE = "130057";
/**
* 处理状态码
*/
public static final String STATUS_CODE = "371100";
/**
* 问题来源标示
*/
public static final Integer EVENT_SRC_ID = 130057;
/**
* 获取多媒体资源并转换为base64编码
*
* @param url
* @return
* @throws IOException
*/
public static String getFileByBase64(String url) throws IOException {
SSLConnectionSocketFactory ssl;
CloseableHttpClient client = null;
ByteArrayOutputStream outputStream = null;
InputStream stream = null;
try {
//忽略服务端证书校验
ssl = new SSLConnectionSocketFactory(SSLContexts.custom().
loadTrustMaterial(null, new TrustAllStrategy()).build(), NoopHostnameVerifier.INSTANCE);
client = HttpClients.custom().setSSLSocketFactory(ssl).build();
HttpResponse response = client.execute(new HttpGet(url));
HttpEntity entity = response.getEntity();
stream = entity.getContent();
outputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int length;
while ((length = stream.read(bytes)) != -1) {
outputStream.write(bytes, 0, length);
}
return Base64.getEncoder().encodeToString(outputStream.toByteArray());
} catch (Exception e) {
client.close();
stream.close();
outputStream.close();
return "";
} finally {
client.close();
stream.close();
outputStream.close();
}
}
}

191
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/utils/ReportCityManageData.java

@ -0,0 +1,191 @@
package com.epmet.utils;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @author yan Lu
* @description 上报城管数据封装对象
* @create 2023/7/3 16:43
*/
@Data
public class ReportCityManageData implements Serializable {
private static final long serialVersionUID = -5492975503443321965L;
/**
* 问题描述
*/
@NotBlank(message = "问题描述不能为空")
private String eventDesc;
/**
* 第三方案件唯一标识
*/
@NotBlank(message = "第三方案件唯一标识不能为空:上报事件ID")
private String otherTaskNum;
/**
* 地址描述
*/
@NotBlank(message = "事件发生地址不能为空")
private String address;
/**
* x坐标
* 跟主业务系统同坐标系
*/
@NotBlank(message = "x坐标不能为空:跟主业务系统同坐标系")
private Double coordinateX;
/**
* y坐标
* 跟主业务系统同坐标系
*/
@NotBlank(message = "y坐标不能为空:跟主业务系统同坐标系")
private Double coordinateY;
/**
* 经度
* 采用在线地图坐标系默认为0
*/
private Double lontitude;
/**
* 纬度
* 采用在线地图坐标系默认为0
*/
private Double latitude;
/**
* 问题来源标示
* 微信举报 56
*/
@NotBlank(message = "问题来源标示,例:微信举报:56")
private Integer eventSrcID;
/**
* 所属区域代码
*/
private String districtCode;
/**
* 所属区域
*/
private String districtName;
/**
* 所属区域代码
*/
private String streetCode;
/**
* 所属区域
*/
private String streetName;
/**
* 所属社区代码
*/
private String communityCode;
/**
* 所属社区
*/
private String communityName;
/**
* 案卷类型标识
*/
@NotBlank(message = "案卷类型标识:城市管理 1,社会服务类 2")
private Integer recTypeID;
/**
* 问题级别标识
* 按照现场要求默认为1或者2
*/
@NotBlank(message = "问题级别标识:按照现场要求默认为1或者2")
private Integer eventLevelID;
/**
* 问题类型标识
* 临时采用默认值 1
*/
@NotBlank(message = "问题类型标识:临时采用默认值 1")
private String eventTypeCode;
/**
* 问题大类标识
*/
private String mainTypeCode;
/**
* 问题小类标识
*/
private String subTypeCode;
/**
* 上报多媒体数量没有多媒体默认0
*/
private Integer mediaNum;
/**
* 上报人
*/
private String humanName;
/**
* 上报人手机号
*/
private String cellphone;
/**
* 多媒体信息
*/
private List<Media> medias;
@Data
public static class Media {
/**
* 案件任务号
*/
private String taskNum;
/**
* 文件名
*/
@NotBlank(message = "文件名不能为空")
private String mediaName;
/**
* 多媒体的完整访问路径优先推荐
*/
private String mediaURL;
/**
* 多媒体用途
* 上报核查核实处置
*/
@NotBlank(message = "多媒体用途不能为空:上报、核查、核实、处置")
private String mediaUsage;
/**
* 多媒体类型
* IMAGEVIDEOVOICEATTACH
*/
@NotBlank(message = "多媒体类型不能为空:IMAGE、VIDEO、VOICE、ATTACH")
private String mediaType;
/**
* 多媒体内容
* base64编码的表示多媒体的二进制数据流
*/
private String content;
}
}
Loading…
Cancel
Save