manailin
2021-06-22 3fe94d6b0570c6ecb28a9659127b7dedbb872815
[修改]添加请求返回对象判断,日志记录返回请求返回数据
2个文件已修改
1个文件已添加
66 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/api/LcReturnObject.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/service_api/biz/impl/LcApiServiceImplTest.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/api/LcReturnObject.java
New file
@@ -0,0 +1,28 @@
package com.panzhihua.common.api;
import lombok.Data;
/**
 * 攀枝花综治网格化-事件接口请求返回的对象
 * des
 * @author manailin
 * @date 2021/06/20
 */
@Data
public class LcReturnObject {
    /**
     * 返回code
     */
    private String code;
    /**
     *返回消息信息
     */
    private String message;
    /**
     *返回对象信息
     */
    private Object data;
    /**
     *返回的是否成功标识
     */
    private Boolean success;
}
springcloud_k8s_panzhihuazhihuishequ/service_api/src/main/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImpl.java
@@ -4,9 +4,12 @@
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonObject;
import com.panzhihua.common.api.LangchaoApiConstants;
import com.panzhihua.common.api.LcReturnObject;
import com.panzhihua.common.constants.TokenConstant;
import com.panzhihua.common.enums.LocalEventToLangChaoEventTypeEnum;
import com.panzhihua.common.model.dtos.api.EventFile;
@@ -102,7 +105,7 @@
            log.info("方法submitEventRegister发生错误:{}", e.getMessage());
        }
        HttpResponse result = request.execute();
        log.info(result.body());
        log.info("submit上传浪潮事件信息:{}",result.body());
        return result.body();
    }
@@ -190,17 +193,21 @@
                eventInfo.setHandleTime(String.valueOf(eventInfoVo.getProcessDate().getTime()));
            }
            eventInfo.setCaseName(gridData.getGridName().concat(caseTypeName).concat(eventInfoVo.getEventTitle()));
            submitEventRegister(eventInfo);
            log.info("定时向浪潮服务器提交网格事件登记结束");
            log.info("开始上传附件信息");
            List<EventResourceVO> picsList = eventInfoVo.getPics();
            uploadLcApiEventFile(eventInfoVo, picsList, "png");
            List<EventResourceVO> audiosList = eventInfoVo.getAudios();
            uploadLcApiEventFile(eventInfoVo, audiosList, "mp3");
            List<EventResourceVO> videoList = eventInfoVo.getVideos();
            uploadLcApiEventFile(eventInfoVo, videoList, "mp4");
            log.info("结束上传附件信息");
            gridService.updateLcUploadFlag(eventInfoVo.getId());
            String remoteData = submitEventRegister(eventInfo);
            LcReturnObject lcReturnObject=JSONObject.parseObject(remoteData, LcReturnObject.class);
            log.info("提交浪潮服务器,接口返回结果为:{}",remoteData);
            if(lcReturnObject.getSuccess()){
                log.info("定时向浪潮服务器提交网格事件登记结束");
                log.info("开始上传附件信息");
                List<EventResourceVO> picsList = eventInfoVo.getPics();
                uploadLcApiEventFile(eventInfoVo, picsList, "png");
                List<EventResourceVO> audiosList = eventInfoVo.getAudios();
                uploadLcApiEventFile(eventInfoVo, audiosList, "mp3");
                List<EventResourceVO> videoList = eventInfoVo.getVideos();
                uploadLcApiEventFile(eventInfoVo, videoList, "mp4");
                log.info("结束上传附件信息");
                gridService.updateLcUploadFlag(eventInfoVo.getId());
            }
        });
    }
springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/service_api/biz/impl/LcApiServiceImplTest.java
@@ -100,7 +100,7 @@
    @Test
    void submitEventRegisterJobTest() {
        log.info("定时向浪潮服务器提交网格事件登记开始");
        R<EventDetailsVO> event = gridService.eventDetails(1111113L);
        R<EventDetailsVO> event = gridService.eventDetails(1111999L);
        EventDetailsVO eventInfoVo = event.getData();
        EventInfo eventInfo = new EventInfo();
        String lcGrid = gridService.getLcGridIdByLocal(eventInfoVo.getGridId());
@@ -110,7 +110,8 @@
        EventGridDataDetailsVO gridData = (EventGridDataDetailsVO) grid.getData();
        eventInfo.setGridName(gridData.getGridName());
        eventInfo.setCaseTypeCode(LocalEventToLangChaoEventTypeEnum.getCodeByName(eventInfoVo.getEventType()));
        eventInfo.setCaseTypeName(LocalEventToLangChaoEventTypeEnum.getEventNameByCode(eventInfoVo.getEventType()));
        String caseTypeName= LocalEventToLangChaoEventTypeEnum.getEventNameByCode(eventInfoVo.getEventType());
        eventInfo.setCaseTypeName(caseTypeName);
        eventInfo.setHappenTime(String.valueOf(eventInfoVo.getHappenTime().getTime()));
        eventInfo.setHappenAddress(eventInfoVo.getHappenAddress());
        String[] data = eventInfoVo.getHappentLatLng().split(",");
@@ -124,7 +125,7 @@
        //获取系统网格员映射的浪潮网格员对于的用户ID
        eventInfo.setUserId(lcGridUserId);
        eventInfo.setHandleTime(String.valueOf(eventInfoVo.getHappenTime().getTime()));
        eventInfo.setCaseName(eventInfoVo.getEventTitle());
        eventInfo.setCaseName(gridData.getGridName().concat(caseTypeName).concat(eventInfoVo.getEventTitle()));
        lcApiService.submitEventRegister(eventInfo);
        log.info("定时向浪潮服务器提交网格事件登记结束");
        log.info("开始上传附件图片信息");