From 48a703dec596b5d2c1b04b0b4f7ed0f28c1ca898 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期一, 13 十一月 2023 18:00:50 +0800
Subject: [PATCH] 新增社区共建评论模块2
---
springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImplTest.java | 115 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 93 insertions(+), 22 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImplTest.java b/springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImplTest.java
index c7759f4..6e626bf 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImplTest.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImplTest.java
@@ -1,32 +1,44 @@
package com.panzhihua.serviceapi.biz.impl;
-import cn.hutool.core.util.RandomUtil;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.panzhihua.common.api.LcReturnObject;
import com.panzhihua.common.enums.LocalEventToLangChaoEventTypeEnum;
import com.panzhihua.common.model.dtos.api.EventFile;
import com.panzhihua.common.model.dtos.api.EventInfo;
import com.panzhihua.common.model.dtos.api.PartiesBody;
+import com.panzhihua.common.model.vos.BcDictionaryVO;
+import com.panzhihua.common.model.vos.DictionaryVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.grid.EventDetailsVO;
import com.panzhihua.common.model.vos.grid.EventGridDataDetailsVO;
import com.panzhihua.common.model.vos.grid.EventResourceVO;
import com.panzhihua.common.service.api.ApiServiceFeign;
+import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.grid.GridService;
import com.panzhihua.common.utlis.DateUtils;
+import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.serviceapi.ServiceApiApplication;
import com.panzhihua.serviceapi.biz.LcApiService;
+import com.panzhihua.serviceapi.model.dto.GridMemberPageListDTO;
import com.panzhihua.serviceapi.model.dto.LcGridData;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import javax.annotation.Resource;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import lombok.extern.slf4j.Slf4j;
@Slf4j
@SpringBootTest(classes = ServiceApiApplication.class)
@@ -41,6 +53,9 @@
@Resource
private ApiServiceFeign ApiServiceFeign;
+ @Autowired
+ private CommunityService communityService;
+
@Test
void saveTokenFromRemoteRequest() {
String result = lcApiService.saveTokenFromRemoteRequest("18080799023", "123456");
@@ -53,12 +68,10 @@
log.info(result);
}
-
@Test
void automationUploadEventAndFile() {
lcApiService.automationUploadEventAndFile();
}
-
@Test
void submitEventRegister() {
@@ -95,7 +108,6 @@
void submitEventRelationFile() throws URISyntaxException {
EventFile eventFile = new EventFile();
eventFile.setDataId("1111116");
- //eventFile.setFiles("https://www.baidu.com/img/flexible/logo/pc/result@2.png");
eventFile.setFiles("http://image.panzhihua.nhys.cdnhxx.com//idcard/4f843ad2d756456e900d5f24b419aa7c.mp4");
eventFile.setType("mp4");
eventFile.setModule("event");
@@ -114,7 +126,7 @@
String lcGridUserId = gridService.getLcUserIdByLocalUserId(eventInfoVo.getGridMemberId().toString());
eventInfo.setGridId(lcGrid);
R grid = gridService.eventGridDataDetails(eventInfoVo.getGridId());
- EventGridDataDetailsVO gridData = (EventGridDataDetailsVO) grid.getData();
+ EventGridDataDetailsVO gridData = (EventGridDataDetailsVO)grid.getData();
eventInfo.setGridName(gridData.getGridName());
eventInfo.setCaseTypeCode(LocalEventToLangChaoEventTypeEnum.getCodeByName(eventInfoVo.getEventType()));
String caseTypeName = LocalEventToLangChaoEventTypeEnum.getEventNameByCode(eventInfoVo.getEventType());
@@ -129,7 +141,7 @@
eventInfo.setHandleType("REPORT");
eventInfo.setHandleDescription(eventInfoVo.getProcessDesc());
eventInfo.setDataId(eventInfoVo.getId().toString());
- //获取系统网格员映射的浪潮网格员对于的用户ID
+ // 获取系统网格员映射的浪潮网格员对于的用户ID
eventInfo.setUserId(lcGridUserId);
eventInfo.setHandleTime(String.valueOf(eventInfoVo.getHappenTime().getTime()));
eventInfo.setCaseName(gridData.getGridName().concat(caseTypeName).concat(eventInfoVo.getEventTitle()));
@@ -169,19 +181,26 @@
log.info("结束上传附件图片信息");
}
-
@Test
void getGridListByAreaId() {
- //jhRxqEQp 代表西区
- List<LcGridData> list = lcApiService.getGridListByAreaId("jhRxqEQp");
- String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue,
- SerializerFeature.WriteDateUseDateFormat);
+ // jhRxqEQp 代表西区
+ List<LcGridData> list = lcApiService.getGridTreeByAreaId("jhRxqEQp");
+ String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat,
+ SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat);
log.info(pretty);
}
@Test
- void requestLcFlowPersonVisitRecord() {
+ void getGridDataListByAreaId() {
+ // jhRxqEQp 代表西区
+ List<LcGridData> list = lcApiService.getGridDataListByAreaId("2Fxq97CC");
+ String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat,
+ SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat);
+ log.info(pretty);
}
+
+ @Test
+ void requestLcFlowPersonVisitRecord() {}
@Test
void automationUploadVisitRecord() {
@@ -190,8 +209,60 @@
@Test
void getGridMemberListByAreaIdOrName() {
- String data = lcApiService.getGridMemberListByAreaIdOrName("jhRxqEQp");
- log.info(data);
+ List<GridMemberPageListDTO> data = lcApiService.getGridMemberListByAreaIdOrName("jhRxqEQp", "", 1L, 20L);
+ // log.info(data);
}
+ @Test
+ void downloadDiction() {
+ // 获取字典全部大类
+ HttpRequest request = HttpUtil.createPost("http://171.217.92.33:53301/dict/getTypeTree");
+ request.cookie(
+ "SESSION=ZTQ1ZGRmZjktNWU1MC00ZjEyLWJhOGItNDdjZjlmODc1MjQy; UISESSIONMEMBER=C6FE0698B29832B18CBAEB71CCD3A2BA");
+ HttpResponse result = request.execute();
+ List<DictionData> remoteData = JSONArray.parseArray(result.body(), DictionData.class);
+ remoteData.forEach(dictionData -> {
+ DictionaryVO dictionaryVO = new DictionaryVO();
+ long parentzId = Snowflake.getId();
+ dictionaryVO.setId(parentzId);
+ dictionaryVO.setDictName(dictionData.getName());
+ dictionaryVO.setDictKey(dictionData.getValue());
+ dictionaryVO.setLevelIndex(1);
+ dictionaryVO.setParentId(0L);
+ communityService.insertDiction(dictionaryVO);
+ // 获取二级字典项
+ dictionData.getChildren().forEach(children -> {
+ DictionaryVO dictionaryChiVO = new DictionaryVO();
+ long erparentzId = Snowflake.getId();
+ dictionaryChiVO.setId(erparentzId);
+ dictionaryChiVO.setDictName(children.getName());
+ dictionaryChiVO.setDictKey(children.getValue());
+ dictionaryChiVO.setLevelIndex(2);
+ dictionaryChiVO.setParentId(dictionaryVO.getId());
+ communityService.insertDiction(dictionaryChiVO);
+ // 获取字典全部值
+ HttpRequest requestDictionValue =
+ HttpUtil.createPost("http://171.217.92.33:53301/dict/getDictByTypeCodeAndParentId?typeCode="
+ + children.getId() + "&parentId=0");
+ requestDictionValue.cookie(
+ "SESSION=ZTQ1ZGRmZjktNWU1MC00ZjEyLWJhOGItNDdjZjlmODc1MjQy; UISESSIONMEMBER=C6FE0698B29832B18CBAEB71CCD3A2BA");
+ HttpResponse childResult = requestDictionValue.execute();
+ LcReturnObject remoteDataChild = JSONObject.parseObject(childResult.body(), LcReturnObject.class);
+ List<DictionValueData> dictionValueData =
+ JSONArray.parseArray(remoteDataChild.getData(), DictionValueData.class);
+ dictionValueData.forEach(dictionValueData1 -> {
+ BcDictionaryVO dictionaryItemVO = new BcDictionaryVO();
+ dictionaryItemVO.setDictName(dictionValueData1.getDictName());
+ dictionaryItemVO.setDictValue(dictionValueData1.getDictCode());
+ dictionaryItemVO.setCode("");
+ dictionaryItemVO.setDictId(erparentzId);
+ communityService.insertDictionItem(dictionaryItemVO);
+ });
+ // String pretty = JSONArray.toJSONString(dictionValueData, SerializerFeature.PrettyFormat,
+ // SerializerFeature.WriteMapNullValue,
+ // SerializerFeature.WriteDateUseDateFormat);
+ // log.info(pretty);
+ });
+ });
+ }
}
\ No newline at end of file
--
Gitblit v1.7.1