From 66b02aac92f89c9d5df3e75d6d342634092f0dd4 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 10 Nov 2021 15:07:56 +0800
Subject: [PATCH] 20211108

---
 gc-shop/src/test/java/com/xzx/gc/CodeTest.java |  101 +++++++++++++++++++++++++++++++++
 gc-user/src/test/java/CodeTest.java            |   75 +++++++++++++++++--------
 2 files changed, 152 insertions(+), 24 deletions(-)

diff --git a/gc-shop/src/test/java/com/xzx/gc/CodeTest.java b/gc-shop/src/test/java/com/xzx/gc/CodeTest.java
new file mode 100644
index 0000000..bcb5906
--- /dev/null
+++ b/gc-shop/src/test/java/com/xzx/gc/CodeTest.java
@@ -0,0 +1,101 @@
+package com.xzx.gc;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.github.pagehelper.PageHelper;
+import com.xzx.gc.common.constant.Constants;
+import com.xzx.gc.entity.AddressInfo;
+import com.xzx.gc.shop.dto.QueryGoodsListDto;
+import com.xzx.gc.shop.dto.QueryJhyOrderListDto;
+import com.xzx.gc.shop.mapper.JhyOrderItemsMapper;
+import com.xzx.gc.shop.mapper.JhyOrderMapper;
+import com.xzx.gc.shop.mapper.ScoreGoodsMapper;
+import com.xzx.gc.shop.vo.JhyOrderItemsVo;
+import com.xzx.gc.shop.vo.QueryGoodsListVo;
+import com.xzx.gc.shop.vo.QueryJhyOrderListVo;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {GcShopApplication.class})
+@ActiveProfiles("dev")
+public class CodeTest {
+
+    @Autowired
+    private ScoreGoodsMapper scoreGoodsMapper;
+    @Autowired
+    private JhyOrderMapper jhyOrderMapper;
+    @Autowired
+    private JhyOrderItemsMapper jhyOrderItemsMapper;
+
+    @Test
+    public void goodsList(){
+        QueryGoodsListDto model = new QueryGoodsListDto();
+        String name = model.getName() == null ? "":model.getName();
+        int delFlag = model.getDelFlag() == null ? 2:model.getDelFlag();
+        int namePx = model.getNamePx() == null ? 7:model.getNamePx();
+        int typePx = model.getTypePx() == null ? 2:model.getTypePx();
+        PageHelper.startPage(model.getPage(), model.getLimit());
+
+        List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(name,delFlag,1,1,namePx,typePx);
+        System.out.println(maps.toString());
+
+    }
+    @Test
+    public void jhyOrderList(){
+        QueryJhyOrderListDto model = new QueryJhyOrderListDto();
+        List<Integer> status = new ArrayList<>();
+        if(CollUtil.isEmpty(model.getStatus())){
+            status.add(1);
+            status.add(2);
+            status.add(3);
+            status.add(4);
+            status.add(5);
+            status.add(6);
+            model.setStatus(status);
+        }
+
+        List<QueryJhyOrderListVo> maps = jhyOrderMapper.queryOrderList(model);
+        if(CollUtil.isNotEmpty(maps)){
+            for(QueryJhyOrderListVo queryJhyOrderListVo : maps){
+                Long id = queryJhyOrderListVo.getId();
+                List<JhyOrderItemsVo> jhyOrderItemsVos = jhyOrderItemsMapper.selectByOrderId(id);
+                queryJhyOrderListVo.setJhyOrderItemsVos(jhyOrderItemsVos);
+
+                String orderAddr = queryJhyOrderListVo.getAddress();
+                Long userId = queryJhyOrderListVo.getUserId();
+                List<AddressInfo> addressInfos = jhyOrderMapper.selectAddRessInfoByUserId(userId);
+                if(CollUtil.isNotEmpty(addressInfos)){
+                    for(AddressInfo addressInfo : addressInfos){
+                        StringBuffer address = new StringBuffer();
+                        address.append(addressInfo.getDetailAddress());
+                        if (StrUtil.isNotBlank(addressInfo.getTagName())) {
+                            address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : "");
+                            if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) {
+                                address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : "");
+                                address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : "");
+                            }
+                        }
+                        if (orderAddr.equals(addressInfo.getAddressArea() + address)) {
+                            queryJhyOrderListVo.setUnitName(addressInfo.getUnitName());
+                            System.out.println(orderAddr);
+                            queryJhyOrderListVo.setHouseNumber(addressInfo.getHouseNumber());
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
+}
diff --git a/gc-user/src/test/java/CodeTest.java b/gc-user/src/test/java/CodeTest.java
index 64d932f..49e54e8 100644
--- a/gc-user/src/test/java/CodeTest.java
+++ b/gc-user/src/test/java/CodeTest.java
@@ -26,6 +26,8 @@
 import cn.hutool.poi.excel.ExcelUtil;
 import cn.hutool.poi.excel.ExcelWriter;
 import com.aliyuncs.exceptions.ClientException;
+import com.github.pagehelper.PageHelper;
+import com.xzx.gc.GcUserApplication;
 import com.xzx.gc.common.Result;
 import com.xzx.gc.common.constant.Constants;
 import com.xzx.gc.common.constant.OrderEnum;
@@ -38,20 +40,26 @@
 import com.xzx.gc.common.utils.gdmap.GdTraceUtil;
 import com.xzx.gc.common.utils.image.QrCodeBaseUtils;
 import com.xzx.gc.common.utils.image.QrCodeGraphicsUtils;
-import com.xzx.gc.entity.AddressInfo;
-import com.xzx.gc.entity.HomeServiceInfo;
-import com.xzx.gc.entity.PartnerFence;
-import com.xzx.gc.entity.UserInfo;
+import com.xzx.gc.entity.*;
+import com.xzx.gc.user.dto.JhyInfoListDto;
+import com.xzx.gc.user.service.JhyInfoService;
+import com.xzx.gc.user.vo.JhyInfoListVo;
 import com.xzx.gc.util.BeanUtils;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.locationtech.spatial4j.context.SpatialContext;
 import org.locationtech.spatial4j.distance.DistanceUtils;
 import org.locationtech.spatial4j.shape.Rectangle;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
 import sun.misc.Regexp;
+import tk.mybatis.mapper.entity.Example;
 
 import javax.imageio.ImageIO;
 import java.awt.*;
@@ -71,8 +79,25 @@
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+
 @Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {GcUserApplication.class})
+@ActiveProfiles("dev")
 public class CodeTest {
+
+    @Autowired
+    private JhyInfoService jhyInfoService;
+
+    @Test
+    public void jhyList(){
+        JhyInfoListDto jhyInfoListDto = new JhyInfoListDto();
+        jhyInfoListDto.setPage(1);
+        jhyInfoListDto.setLimit(10);
+        jhyInfoListDto.setIsJhy(1);
+        Map<String, Object> stringObjectMap = jhyInfoService.queryList(jhyInfoListDto);
+        System.out.println(stringObjectMap.get("date"));
+    }
 
 
     @Test
@@ -137,30 +162,32 @@
 
     @Test
     public void ex(){
-        Map<String, Object> row1 = new LinkedHashMap<>();
-        row1.put("姓名", "张三");
-        row1.put("年龄", 23);
-        row1.put("成绩", 88.32);
-        row1.put("是否合格", true);
-        row1.put("考试日期", DateUtil.date());
-
-        Map<String, Object> row2 = new LinkedHashMap<>();
-        row2.put("姓名", "李四");
-        row2.put("年龄", 33);
-        row2.put("成绩", 59.50);
-        row2.put("是否合格", false);
-        row2.put("考试日期", DateUtil.date());
-
-        ArrayList<Map<String, Object>> rows = CollUtil.newArrayList(row1, row2);
-
-        System.out.println(rows);
+        ArrayList<Map<String, Object>> rows = new ArrayList<>();
+        String str = null;
+        for(int i = 0;i < 100000;i++){
+            Map<String, Object> row1 = new LinkedHashMap<>();
+//                str = "M0"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M1"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M2"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M3"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M4"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M5"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M6"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M7"+RandomUtil.randomString(8).toUpperCase();
+//                str = "M8"+RandomUtil.randomString(8).toUpperCase();
+                str = "M9"+RandomUtil.randomString(8).toUpperCase();
+            row1.put("编码", str);
+            rows.add(row1);
+        }
+        Set<Map<String, Object>> maps = RandomUtil.randomEleSet(rows, 10000);
+        System.out.println(maps);
 
         // 通过工具类创建writer
-        ExcelWriter writer = ExcelUtil.getWriter("d:/writeMapTest.xlsx");
+        ExcelWriter writer = ExcelUtil.getWriter("d:/编码M9.xlsx");
 // 合并单元格后的标题行,使用默认标题样式
-        writer.merge(row1.size() - 1, "一班成绩单");
+//        writer.merge(maps.size() - 1, "编码");
 // 一次性写出内容,使用默认样式,强制输出标题
-        writer.write(rows, true);
+        writer.write(maps, true);
 // 关闭writer,释放内存
         writer.close();
 

--
Gitblit v1.9.1