From dd6df84346f7cf1ec7f422ba62d55d73ccec0720 Mon Sep 17 00:00:00 2001 From: bynt Date: Thu, 7 Apr 2022 17:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=91=E4=BB=B7=E8=B5=B0?= =?UTF-8?q?=E5=8A=BF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...DataResponse.java => ApiDataResponse.java} | 7 +- .../java/me/zhengjie/utils/ResponseUtil.java | 87 ++++++++++ .../zhengjie/utils/enums/FirstGoldEnums.java | 43 +++++ .../zhengjie/utils/enums/GoldCodeEnums.java | 82 ++++++++++ .../modules/constant/DefaultConstant.java | 12 +- .../impl/StatisticsDmpServiceImpl.java | 6 +- .../gold/dto/AnalyzingGoldResponseDTO.java | 23 +++ .../modules/gold/dto/ApiGoldPriceDTO.java | 24 +++ .../gold/dto/FirstGoldResponseDTO.java | 22 +++ .../modules/gold/dto/GoldRequestDTO.java | 32 ++++ .../gold/dto/TodayGoldResponseDTO.java | 24 +++ .../gold/rest/GoldPriceController.java | 148 ++++++++++++++++++ .../security/config/SecurityConfig.java | 1 + 13 files changed, 505 insertions(+), 6 deletions(-) rename eladmin-common/src/main/java/me/zhengjie/common/json/{AnalyticalDataResponse.java => ApiDataResponse.java} (52%) create mode 100644 eladmin-common/src/main/java/me/zhengjie/utils/ResponseUtil.java create mode 100644 eladmin-common/src/main/java/me/zhengjie/utils/enums/FirstGoldEnums.java create mode 100644 eladmin-common/src/main/java/me/zhengjie/utils/enums/GoldCodeEnums.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/AnalyzingGoldResponseDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/ApiGoldPriceDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/FirstGoldResponseDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/GoldRequestDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/TodayGoldResponseDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/gold/rest/GoldPriceController.java diff --git a/eladmin-common/src/main/java/me/zhengjie/common/json/AnalyticalDataResponse.java b/eladmin-common/src/main/java/me/zhengjie/common/json/ApiDataResponse.java similarity index 52% rename from eladmin-common/src/main/java/me/zhengjie/common/json/AnalyticalDataResponse.java rename to eladmin-common/src/main/java/me/zhengjie/common/json/ApiDataResponse.java index b21d989..359fae1 100644 --- a/eladmin-common/src/main/java/me/zhengjie/common/json/AnalyticalDataResponse.java +++ b/eladmin-common/src/main/java/me/zhengjie/common/json/ApiDataResponse.java @@ -9,10 +9,13 @@ import java.io.Serializable; * @date : 2022/3/3 */ @Data -public class AnalyticalDataResponse implements Serializable { +public class ApiDataResponse implements Serializable { + + private static final long serialVersionUID = -489610332459754084L; + private int status; private String msg; - private Object data; + private T data; } diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/ResponseUtil.java b/eladmin-common/src/main/java/me/zhengjie/utils/ResponseUtil.java new file mode 100644 index 0000000..3c77f45 --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/utils/ResponseUtil.java @@ -0,0 +1,87 @@ +package me.zhengjie.utils; + +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.net.url.UrlBuilder; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import io.netty.util.CharsetUtil; +import me.zhengjie.exception.BadRequestException; +import org.springframework.http.HttpHeaders; + +import java.util.Date; + +/** + * @author Enzo + * @date : 2022/3/30 + */ +public class ResponseUtil { + + private ResponseUtil(){ + + } + + public static JSONObject goldRequest(Long days,String goldCode, Date startDate,Date endDate) { + // 拼接url请求 + String buildUrl = UrlBuilder.create() + .setScheme("https") + .setHost("api.jijinhao.com") + .addPath("/quoteCenter").addPath("history.htm") + .addQuery("style", String.valueOf(3)) + .addQuery("pageSize", String.valueOf(days)).addQuery("code", goldCode) + .addQuery("startDate", cn.hutool.core.date.DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN)) + .addQuery("endDate", DateUtil.format(endDate, DatePattern.NORM_DATE_PATTERN)).build(); + + String body = HttpUtil.createGet(buildUrl) + .header(HttpHeaders.REFERER, + "https://quote.cngold.org/") + .execute() + .charset(CharsetUtil.UTF_8) + .body(); + // 去除不需要数据替换空格 + String resultString = StrUtil.trimToEmpty + (StrUtil.subAfter(body, "=", Boolean.FALSE)); + + if (resultString.contains("true")) { + return JSON.parseObject(resultString); + } + throw new BadRequestException("the request error"); + } + + + + public static JSONObject firstGoldRequest(String bindStr,String vidStr,String rowStr,String pageStr,Date startDate,Date endDate) { + + // 拼接url请求 + String buildUrl = UrlBuilder.create() + .setScheme("http") + .setHost("www.dyhjw.com") + .addPath("/api").addPath("ajax.html") + .addQuery("jindian_getPriceScope[bid]", bindStr) + .addQuery("jindian_getPriceScope[vid]", vidStr) + .addQuery("jindian_getPriceScope[stime]", DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN)) + .addQuery("jindian_getPriceScope[etime]", DateUtil.format(endDate, DatePattern.NORM_DATE_PATTERN)) + .addQuery("jindian_getPriceScope[row]", rowStr) + .addQuery("jindian_getPriceScope[page]", pageStr) + .build(); + + String body = HttpUtil.createGet(buildUrl).execute().charset(CharsetUtil.UTF_8).body(); + // 去除不需要数据替换空格 + String resultString = StrUtil.trimToEmpty(body); + + if (resultString.contains("data") && + JSON.parseObject(JSON.parseObject(resultString).get("jindian_getPriceScope").toString()).get("status").equals("1")) { + + String byLength = + resultString.substring( + resultString.indexOf(StrUtil.DELIM_START, + resultString.indexOf(StrUtil.DELIM_START) + 1), resultString.length() - 1); + return JSON.parseObject(JSON.parseObject(byLength).get("data").toString()); + } + throw new BadRequestException("the request error"); + } + + +} diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/enums/FirstGoldEnums.java b/eladmin-common/src/main/java/me/zhengjie/utils/enums/FirstGoldEnums.java new file mode 100644 index 0000000..999055b --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/utils/enums/FirstGoldEnums.java @@ -0,0 +1,43 @@ +package me.zhengjie.utils.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author Enzo + * @date : 2022/4/7 + */ +@Getter +@AllArgsConstructor +public enum FirstGoldEnums { + + /** + * 周大福 + */ + ZDF("1", "1"), + + /** + * 周大生 + */ + ZDS("10", "48"), + + /** + * 老凤祥 + */ + LFX("2", "8"); + + private final String bid; + + private final String vid; + + static final Map GOLD_ENUMS_MAP = new ConcurrentHashMap<>(); + + static { + GOLD_ENUMS_MAP.put("JO_42660", FirstGoldEnums.ZDF); + GOLD_ENUMS_MAP.put("JO_42657", FirstGoldEnums.LFX); + GOLD_ENUMS_MAP.put("JO_52678", FirstGoldEnums.ZDF); + } +} diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/enums/GoldCodeEnums.java b/eladmin-common/src/main/java/me/zhengjie/utils/enums/GoldCodeEnums.java new file mode 100644 index 0000000..fa3fca5 --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/utils/enums/GoldCodeEnums.java @@ -0,0 +1,82 @@ +package me.zhengjie.utils.enums; + +import cn.hutool.core.util.StrUtil; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author Enzo + * @date : 2022/3/22 + */ +@Getter +@AllArgsConstructor +public enum GoldCodeEnums { + + /** + * 周大福 + */ + ZDF("zdf", "JO_42660"), + + /** + * 老凤祥 + */ + LFX("lfx", "JO_42657"), + + /** + * 周六福 + */ + ZLF("zlf", "JO_42653"), + + /** + * 周生生 + */ + ZSS("zss", "JO_42625"), + + /** + * 六福珠宝 + */ + LFZB("lfzb", "JO_42646"), + + /** + * 菜百 + */ + CB("cb", "JO_42638"), + + /** + * 金至尊 + */ + JZZ("jzz", "JO_42632"), + + /** + * 老庙 + */ + LM("lm", "JO_42634"), + + /** + * 潮宏基 + */ + CHJ("chj", "JO_52670"), + + /** + * 周大生 + */ + ZDS("zds", "JO_52678"), + + /** + * 中国黄金 + */ + ZGHJ("zghj", "JO_9753"); + + private final String code; + + private final String shorthand; + + public static String findCode(String shorthand) { + for (GoldCodeEnums value : GoldCodeEnums.values()) { + if (shorthand.equalsIgnoreCase(value.getCode())) { + return value.getShorthand(); + } + } + return StrUtil.EMPTY; + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/constant/DefaultConstant.java b/eladmin-system/src/main/java/me/zhengjie/modules/constant/DefaultConstant.java index 892be09..121b70c 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/constant/DefaultConstant.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/constant/DefaultConstant.java @@ -6,6 +6,8 @@ package me.zhengjie.modules.constant; */ public class DefaultConstant { + private DefaultConstant() { + } /** @@ -34,6 +36,11 @@ public class DefaultConstant { */ public static final int FIVE_NUMBER = 5; + /** + * 7 + */ + public static final int SEVEN_NUMBER = 7; + /** * 10 */ @@ -54,7 +61,10 @@ public class DefaultConstant { public static final int THIRTEEN_NUMBER = 13; - + /** + * 200 + */ + public static final int TWO_HUNDRED_NUMBER = 200; /** * 999999L diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/dmpMonitor/service/impl/StatisticsDmpServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/dmpMonitor/service/impl/StatisticsDmpServiceImpl.java index 9b13a8f..504d49a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/dmpMonitor/service/impl/StatisticsDmpServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/dmpMonitor/service/impl/StatisticsDmpServiceImpl.java @@ -11,7 +11,7 @@ import cn.hutool.poi.excel.ExcelWriter; import com.alibaba.fastjson.JSON; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import me.zhengjie.common.json.AnalyticalDataResponse; +import me.zhengjie.common.json.ApiDataResponse; import me.zhengjie.constant.SystemConstant; import me.zhengjie.domain.vo.EmailVo; import me.zhengjie.exception.BadRequestException; @@ -114,8 +114,8 @@ public class StatisticsDmpServiceImpl implements StatisticsDmpService { String result = HttpUtil.post (SystemConstant.PARSE_DATA_LINK, jsonStr); if (StringUtils.isNotBlank(result) && result.contains("data")) { - AnalyticalDataResponse response = - JSONUtil.toBean(result, AnalyticalDataResponse.class); + ApiDataResponse response = + JSONUtil.toBean(result, ApiDataResponse.class); if (response.getStatus() == 0) { return Convert.toMap(String.class, List.class, response.getData()); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/AnalyzingGoldResponseDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/AnalyzingGoldResponseDTO.java new file mode 100644 index 0000000..540a541 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/AnalyzingGoldResponseDTO.java @@ -0,0 +1,23 @@ +package me.zhengjie.modules.gold.dto; + +import cn.hutool.core.date.DatePattern; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Enzo + * @date : 2022/3/22 + */ +@Data +public class AnalyzingGoldResponseDTO implements Serializable { + + private static final long serialVersionUID = 342180031344936298L; + + private Double q1; + + @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN, timezone = "GMT+8") + private Date time; +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/ApiGoldPriceDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/ApiGoldPriceDTO.java new file mode 100644 index 0000000..9891a43 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/ApiGoldPriceDTO.java @@ -0,0 +1,24 @@ +package me.zhengjie.modules.gold.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @author Enzo + * @date : 2022/3/22 + */ +@Data +public class ApiGoldPriceDTO { + + private String code; + + private Date endDate; + + private String style; + + private Date startDate; + + private Integer pageSize; + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/FirstGoldResponseDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/FirstGoldResponseDTO.java new file mode 100644 index 0000000..57b7360 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/FirstGoldResponseDTO.java @@ -0,0 +1,22 @@ +package me.zhengjie.modules.gold.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Enzo + * @date : 2022/4/7 + */ +@Data +public class FirstGoldResponseDTO implements Serializable { + private static final long serialVersionUID = -4915817022920042708L; + + private String bname; + + private Double price; + + private Date date; + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/GoldRequestDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/GoldRequestDTO.java new file mode 100644 index 0000000..52fd528 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/GoldRequestDTO.java @@ -0,0 +1,32 @@ +package me.zhengjie.modules.gold.dto; + +import cn.hutool.core.date.DatePattern; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.Date; +import java.util.List; + +/** + * @author Enzo + * @date : 2022/3/22 + */ +@Data +public class GoldRequestDTO { + + @NotEmpty(message = "编号不能为空") + @ApiModelProperty("黄金编号") + private List goldCodeList; + + @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN) + @ApiModelProperty("开始时间") + private Date startDate; + + @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN) + @ApiModelProperty("结束时间") + private Date endDate; + + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/TodayGoldResponseDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/TodayGoldResponseDTO.java new file mode 100644 index 0000000..526a77f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/gold/dto/TodayGoldResponseDTO.java @@ -0,0 +1,24 @@ +package me.zhengjie.modules.gold.dto; + +import cn.hutool.core.date.DatePattern; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Enzo + * @date : 2022/3/30 + */ +@Data +public class TodayGoldResponseDTO implements Serializable { + + private Double q1; + + private String goldCode; + + @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN, timezone = "GMT+8") + private Date time; + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/gold/rest/GoldPriceController.java b/eladmin-system/src/main/java/me/zhengjie/modules/gold/rest/GoldPriceController.java new file mode 100644 index 0000000..388f136 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/gold/rest/GoldPriceController.java @@ -0,0 +1,148 @@ +package me.zhengjie.modules.gold.rest; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.zhengjie.annotation.Log; +import me.zhengjie.common.http.CommonResponse; +import me.zhengjie.exception.BadRequestException; +import me.zhengjie.modules.constant.DefaultConstant; +import me.zhengjie.modules.gold.dto.AnalyzingGoldResponseDTO; +import me.zhengjie.modules.gold.dto.GoldRequestDTO; +import me.zhengjie.modules.gold.dto.TodayGoldResponseDTO; +import me.zhengjie.utils.ResponseUtil; +import me.zhengjie.utils.enums.GoldCodeEnums; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author Enzo + * @date : 2022/3/22 + */ +@Slf4j +@Api("获取咨询类信息") +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/gold") +public class GoldPriceController { + + + @Log("获取咨询类信息") + @ApiOperation("查询金价信息") + @PostMapping("/trend") + public CommonResponse> goldTrend + (@Validated @RequestBody GoldRequestDTO requestDTO) { + if (ObjectUtil.isNull(requestDTO.getStartDate()) + && ObjectUtil.isNull(requestDTO.getEndDate())) { + DateTime date = DateUtil.date(); + requestDTO.setStartDate(DateUtil.beginOfDay + (DateUtil.offsetDay(date, -DefaultConstant.SEVEN_NUMBER))); + requestDTO.setEndDate(DateUtil.beginOfDay(date)); + } + if (requestDTO.getStartDate().after(requestDTO.getEndDate())) { + throw new BadRequestException("开始时间必须大于结束时间"); + } + + Map sortedMap = new LinkedHashMap<>(); + Map map = new HashMap<>(DefaultConstant.TWO_NUMBER); + List goldResponseDTOList = new ArrayList<>(); + Map> historyMap = new HashMap<>(DefaultConstant.TWELVE_NUMBER); + + // 相差多少天用于分页数量 + long betweenDays = DateUtil.between(requestDTO.getStartDate(), requestDTO.getEndDate(), DateUnit.DAY); + DateTime dateTime = DateUtil.beginOfDay(DateUtil.date()); + for (String code : requestDTO.getGoldCodeList()) { + String goldCode = GoldCodeEnums.findCode(code); + // 发送请求 + JSONObject jsonObject = ResponseUtil.goldRequest + (betweenDays, goldCode, requestDTO.getStartDate(), requestDTO.getEndDate()); + // 解析数据 + List dtoArrayList = getAnalyzingGoldResponse(jsonObject); + List todayGoldList = Lists.newArrayList(dtoArrayList); + Iterator iterator = todayGoldList.iterator(); + TodayGoldResponseDTO todayGoldResponseDTO; + // 查看周几 + int dayOfWeek = DateUtil.thisDayOfWeek(); + if (dayOfWeek == DefaultConstant.SEVEN_NUMBER || dayOfWeek == DefaultConstant.ONE_NUMBER) { + dateTime = DateUtil.offsetDay + (dateTime, -(dayOfWeek == DefaultConstant.SEVEN_NUMBER + ? DefaultConstant.ONE_NUMBER : DefaultConstant.TWO_NUMBER)); + } + while (iterator.hasNext()) { + AnalyzingGoldResponseDTO next = iterator.next(); + long betweenDay = DateUtil.betweenDay(dateTime, next.getTime(), Boolean.TRUE); + // 查询当天金价 + if (betweenDay == DefaultConstant.ZERO_NUMBER) { + todayGoldResponseDTO = new TodayGoldResponseDTO(); + BeanUtil.copyProperties(next, todayGoldResponseDTO); + todayGoldResponseDTO.setGoldCode(code); + goldResponseDTOList.add(todayGoldResponseDTO); + break; + } + } + historyMap.put(code, dtoArrayList); + } + // map排序 + Stream>> st = + historyMap.entrySet().stream(); + st.sorted(Comparator.comparing(e -> -(e.getValue().size()))).forEach + (e -> sortedMap.put(e.getKey(), e.getValue())); + map.put("historyGoldPrice", sortedMap); + map.put("todayGoldPrice", goldResponseDTOList); + return CommonResponse.createBySuccess(map); + } + + + @Log("查询当天金价") + @ApiOperation("查询当天金价") + @GetMapping("/dayPrice") + public ResponseEntity> goldTrend(String goldCode) { + Map map = new HashMap<>(DefaultConstant.TWO_NUMBER); + DateTime dateTime = DateUtil.beginOfDay(DateUtil.date()); + String shortCode = GoldCodeEnums.findCode(goldCode); + JSONObject jsonObject = ResponseUtil.goldRequest + (Long.parseLong(String.valueOf(DefaultConstant.ONE_NUMBER)), shortCode, dateTime, dateTime); + List dtoArrayList = getAnalyzingGoldResponse(jsonObject); + if (CollUtil.isNotEmpty(dtoArrayList)) { + Iterator iterator = dtoArrayList.iterator(); + while (iterator.hasNext()) { + AnalyzingGoldResponseDTO next = iterator.next(); + long betweenDay = DateUtil.betweenDay(dateTime, next.getTime(), Boolean.TRUE); + if (betweenDay != DefaultConstant.ZERO_NUMBER) { + iterator.remove(); + } + } + } + map.put(goldCode, dtoArrayList); + return new ResponseEntity<>(map, HttpStatus.OK); + } + + + private List getAnalyzingGoldResponse(JSONObject jsonObject) { + // 解析数据 + List dtoList = + Convert.toList(AnalyzingGoldResponseDTO.class, + jsonObject.get("data")); + // 时间去除 + return dtoList.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection( + () -> new TreeSet<>(Comparator.comparing(AnalyzingGoldResponseDTO::getTime))), ArrayList::new)); + } + +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java index e7c1b06..8494a7d 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java @@ -123,6 +123,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/api/smsConfiguration/detail").permitAll() // 爬取数据请求 用户小程序过审 By Enzo .antMatchers("/api/consult/**").permitAll() + .antMatchers("/api/gold/**").permitAll() // 放行OPTIONS请求 .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() // 自定义匿名访问所有url放行:允许匿名和带Token访问,细腻化到每个 Request 类型