罗元桥
2021-08-30 eda58e0e6d4abdd2b060e28867d103045845aa69
springcloud_k8s_panzhihuazhihuishequ/service_api/src/test/java/com/panzhihua/serviceapi/biz/impl/LcApiServiceImplTest.java
@@ -1,9 +1,15 @@
package com.panzhihua.serviceapi.biz.impl;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
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;
@@ -27,15 +33,12 @@
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)
@@ -65,12 +68,10 @@
        log.info(result);
    }
    @Test
    void automationUploadEventAndFile() {
        lcApiService.automationUploadEventAndFile();
    }
    @Test
    void submitEventRegister() {
@@ -180,29 +181,26 @@
        log.info("结束上传附件图片信息");
    }
    @Test
    void getGridListByAreaId() {
        //jhRxqEQp 代表西区
        List<LcGridData> list = lcApiService.getGridTreeByAreaId("jhRxqEQp");
        String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue,
                SerializerFeature.WriteDateUseDateFormat);
        String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat,
            SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat);
        log.info(pretty);
    }
    @Test
    void getGridDataListByAreaId() {
        //jhRxqEQp 代表西区
        List<LcGridData> list = lcApiService.getGridDataListByAreaId("2Fxq97CC");
        String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue,
                SerializerFeature.WriteDateUseDateFormat);
        String pretty = JSONArray.toJSONString(list, SerializerFeature.PrettyFormat,
            SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat);
        log.info(pretty);
    }
    @Test
    void requestLcFlowPersonVisitRecord() {
    }
    void requestLcFlowPersonVisitRecord() {}
    @Test
    void automationUploadVisitRecord() {
@@ -219,7 +217,8 @@
    void downloadDiction() {
        //获取字典全部大类
        HttpRequest request = HttpUtil.createPost("http://171.217.92.33:53301/dict/getTypeTree");
        request.cookie("SESSION=ZTQ1ZGRmZjktNWU1MC00ZjEyLWJhOGItNDdjZjlmODc1MjQy; UISESSIONMEMBER=C6FE0698B29832B18CBAEB71CCD3A2BA");
        request.cookie(
            "SESSION=ZTQ1ZGRmZjktNWU1MC00ZjEyLWJhOGItNDdjZjlmODc1MjQy; UISESSIONMEMBER=C6FE0698B29832B18CBAEB71CCD3A2BA");
        HttpResponse result = request.execute();
        List<DictionData> remoteData = JSONArray.parseArray(result.body(), DictionData.class);
        remoteData.forEach(dictionData -> {
@@ -242,11 +241,15 @@
                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");
                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);
                List<DictionValueData> dictionValueData =
                    JSONArray.parseArray(remoteDataChild.getData(), DictionValueData.class);
                dictionValueData.forEach(dictionValueData1 -> {
                    BcDictionaryVO dictionaryItemVO = new BcDictionaryVO();
                    dictionaryItemVO.setDictName(dictionValueData1.getDictName());
@@ -255,7 +258,8 @@
                    dictionaryItemVO.setDictId(erparentzId);
                    communityService.insertDictionItem(dictionaryItemVO);
                });
//                String pretty = JSONArray.toJSONString(dictionValueData, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue,
                // String pretty = JSONArray.toJSONString(dictionValueData, SerializerFeature.PrettyFormat,
                // SerializerFeature.WriteMapNullValue,
//                        SerializerFeature.WriteDateUseDateFormat);
//                log.info(pretty);
            });