| | |
| | | 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;
|
| | |
| | | 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.*;
|
| | |
| | | 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
|
| | |
| | |
|
| | | @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();
|
| | |
|