浏览代码

提交,签名方式重构,请求方式全部调整为post

wangzaijun 1 年之前
父节点
当前提交
5ae9f3780d

+ 9 - 0
src/main/java/com/smppw/analysis/application/dto/BaseReq.java

@@ -29,4 +29,13 @@ public abstract class BaseReq<R> {
 //    private long timestamp;
 
     public abstract R convert();
+
+    @Setter
+    @Getter
+    public static class DefaultReq extends BaseReq<Object> {
+        @Override
+        public Object convert() {
+            return null;
+        }
+    }
 }

+ 15 - 0
src/main/java/com/smppw/analysis/application/dto/WithSecReq.java

@@ -0,0 +1,15 @@
+package com.smppw.analysis.application.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class WithSecReq extends BaseReq<Object> {
+    private String secId;
+
+    @Override
+    public Object convert() {
+        return null;
+    }
+}

+ 36 - 5
src/main/java/com/smppw/analysis/application/service/position/FundFuturesOptionService.java

@@ -1,5 +1,6 @@
 package com.smppw.analysis.application.service.position;
 
+import cn.hutool.core.map.MapUtil;
 import com.smppw.analysis.domain.manager.position.future.FundFuturesOptionBaseService;
 import com.smppw.common.pojo.ResultVo;
 import com.smppw.common.pojo.enums.status.ResultCode;
@@ -21,27 +22,57 @@ public class FundFuturesOptionService {
     @Autowired
     private FundFuturesOptionBaseService fundFuturesOptionBaseService;
 
-    public ResultVo<Map<String, Object>> fundFuturesOption(Integer userId, String fundId, Integer optionType, Integer shType, String startDate, String endDate) {
+    public ResultVo<Map<String, Object>> fundFuturesOption(Map<String, Object> params) {
+        Integer userId = MapUtil.getInt(params, "userId");
+        String fundId = MapUtil.getStr(params, "fundId");
+        Integer optionType = MapUtil.getInt(params, "optionType");
+        Integer shType = MapUtil.getInt(params, "shType");
+        String startDate = MapUtil.getStr(params, "startDate");
+        String endDate = MapUtil.getStr(params, "endDate");
         Map<String, Object> result = fundFuturesOptionBaseService.fundFuturesOption(userId, fundId, optionType, shType, startDate, endDate);
         return new ResultVo<>(ResultCode.SUCCESS, result);
     }
 
-    public ResultVo<Map<String, Object>> fundPositionAnalysis(Integer userId, String fundId, Integer optionType, Integer shType, String startDate, String endDate) {
+    public ResultVo<Map<String, Object>> fundPositionAnalysis(Map<String, Object> params) {
+        Integer userId = MapUtil.getInt(params, "userId");
+        String fundId = MapUtil.getStr(params, "fundId");
+        Integer optionType = MapUtil.getInt(params, "optionType");
+        Integer shType = MapUtil.getInt(params, "shType");
+        String startDate = MapUtil.getStr(params, "startDate");
+        String endDate = MapUtil.getStr(params, "endDate");
         Map<String, Object> result = fundFuturesOptionBaseService.fundPositionAnalysis(userId, fundId, optionType, shType, startDate, endDate);
         return new ResultVo<>(ResultCode.SUCCESS, result);
     }
 
-    public ResultVo<Map<String, Object>> fundDerivativeLeverageMargin(Integer userId, String fundId, Integer shType, String startDate, String endDate) {
+    public ResultVo<Map<String, Object>> fundDerivativeLeverageMargin(Map<String, Object> params) {
+        Integer userId = MapUtil.getInt(params, "userId");
+        String fundId = MapUtil.getStr(params, "fundId");
+        Integer optionType = MapUtil.getInt(params, "optionType");
+        Integer shType = MapUtil.getInt(params, "shType");
+        String startDate = MapUtil.getStr(params, "startDate");
+        String endDate = MapUtil.getStr(params, "endDate");
         Map<String, Object> result = fundFuturesOptionBaseService.fundDerivativeLeverageMargin(userId, fundId, shType, startDate, endDate);
         return new ResultVo<>(ResultCode.SUCCESS, result);
     }
 
-    public ResultVo<Map<String, Object>> fundPositionAnalysisLine(Integer userId, String fundId, Integer optionType, Integer shType, String startDate, String endDate) {
+    public ResultVo<Map<String, Object>> fundPositionAnalysisLine(Map<String, Object> params) {
+        Integer userId = MapUtil.getInt(params, "userId");
+        String fundId = MapUtil.getStr(params, "fundId");
+        Integer optionType = MapUtil.getInt(params, "optionType");
+        Integer shType = MapUtil.getInt(params, "shType");
+        String startDate = MapUtil.getStr(params, "startDate");
+        String endDate = MapUtil.getStr(params, "endDate");
         Map<String, Object> result = fundFuturesOptionBaseService.fundPositionAnalysisLine(userId, fundId, optionType, shType, startDate, endDate);
         return new ResultVo<>(ResultCode.SUCCESS, result);
     }
 
-    public ResultVo<Map<String, Object>> fundFuturesOptionForBreed(Integer userId, String fundId, Integer optionType, Integer shType, String startDate, String endDate) {
+    public ResultVo<Map<String, Object>> fundFuturesOptionForBreed(Map<String, Object> params) {
+        Integer userId = MapUtil.getInt(params, "userId");
+        String fundId = MapUtil.getStr(params, "fundId");
+        Integer optionType = MapUtil.getInt(params, "optionType");
+        Integer shType = MapUtil.getInt(params, "shType");
+        String startDate = MapUtil.getStr(params, "startDate");
+        String endDate = MapUtil.getStr(params, "endDate");
         Map<String, Object> result = fundFuturesOptionBaseService.fundFuturesOptionForBreed(userId, fundId, optionType, shType, startDate, endDate);
         return new ResultVo<>(ResultCode.SUCCESS, result);
     }

+ 35 - 46
src/main/java/com/smppw/analysis/client/FundApi.java

@@ -1,13 +1,14 @@
 package com.smppw.analysis.client;
 
+import com.smppw.analysis.application.dto.WithSecReq;
 import com.smppw.analysis.application.dto.info.*;
 import com.smppw.analysis.application.service.info.FundInfoService;
 import com.smppw.analysis.application.service.info.GlobalService;
 import com.smppw.analysis.domain.dto.info.*;
 import com.smppw.common.pojo.ResultVo;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -34,8 +35,8 @@ public class FundApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("head-info")
-    public ResultVo<? extends HeadInfoVO> headInfo(HeadInfoReq params) {
+    @PostMapping("head-info")
+    public ResultVo<? extends HeadInfoVO> headInfo(@RequestBody HeadInfoReq params) {
         return ResultVo.ok(this.globalService.headInfo(params));
     }
 
@@ -45,8 +46,8 @@ public class FundApi {
      * @param params /
      * @return /
      */
-    @GetMapping("common-info")
-    public ResultVo<CommonInfoVO> commonInfo(CommonInfoReq params) {
+    @PostMapping("common-info")
+    public ResultVo<CommonInfoVO> commonInfo(@RequestBody CommonInfoReq params) {
         return ResultVo.ok(this.globalService.commonInfo(params));
     }
 
@@ -56,8 +57,8 @@ public class FundApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("head-indicator")
-    public ResultVo<HeadIndicatorVO> headIndicator(HeadIndicatorReq params) {
+    @PostMapping("head-indicator")
+    public ResultVo<HeadIndicatorVO> headIndicator(@RequestBody HeadIndicatorReq params) {
         return ResultVo.ok(this.globalService.headIndicator(params));
     }
 
@@ -67,8 +68,8 @@ public class FundApi {
      * @param params /
      * @return /
      */
-    @GetMapping("similar")
-    public ResultVo<List<FundSimilarVO>> similar(FundSimilarReq params) {
+    @PostMapping("similar")
+    public ResultVo<List<FundSimilarVO>> similar(@RequestBody FundSimilarReq params) {
         return ResultVo.ok(this.service.getFundSimilarList(params));
     }
 
@@ -78,58 +79,50 @@ public class FundApi {
      * @param params 基金id
      * @return 基金公告
      */
-    @GetMapping("notice-info")
-    public ResultVo<List<ManualFundNoticeInfoVO>> noticeInfo(ManualFundNoticeReq params) {
+    @PostMapping("notice-info")
+    public ResultVo<List<ManualFundNoticeInfoVO>> noticeInfo(@RequestBody ManualFundNoticeReq params) {
         return ResultVo.ok(service.noticeList(params));
     }
 
     /**
      * 公募基金投资类信息说明
      *
-     * @param secId  基金id
-     * @param appKey 访问授权码,用于接口验签
      * @return 投资类信息说明
      */
-    @GetMapping("invest-info")
-    public ResultVo<ManualFundInvestInfoVO> investInfo(@RequestParam("secId") String secId, String appKey) {
-        return ResultVo.ok(service.investInfo(secId));
+    @PostMapping("invest-info")
+    public ResultVo<ManualFundInvestInfoVO> investInfo(@RequestBody WithSecReq req) {
+        return ResultVo.ok(service.investInfo(req.getSecId()));
     }
 
     /**
      * 私募基金费率信息
      *
-     * @param secId  基金id
-     * @param appKey 访问授权码,用于接口验签
      * @return 基金费率信息
      */
-    @GetMapping("fee")
-    public ResultVo<FundBaseFeeVO> fee(@RequestParam("secId") String secId, String appKey) {
-        return ResultVo.ok(this.service.getFundFee(secId));
+    @PostMapping("fee")
+    public ResultVo<FundBaseFeeVO> fee(@RequestBody WithSecReq req) {
+        return ResultVo.ok(this.service.getFundFee(req.getSecId()));
     }
 
     /**
      * 公募基金费率信息
      *
-     * @param secId  基金id
-     * @param appKey 访问授权码,用于接口验签
      * @return 基金费率信息
      */
-    @GetMapping("mf-fee")
-    public ResultVo<ManualFundFeeInfoVO> mFFundFee(@RequestParam("secId") String secId, String appKey) {
-        return ResultVo.ok(this.service.getMfFundFee(secId));
+    @PostMapping("mf-fee")
+    public ResultVo<ManualFundFeeInfoVO> mFFundFee(@RequestBody WithSecReq req) {
+        return ResultVo.ok(this.service.getMfFundFee(req.getSecId()));
     }
 
 
     /**
      * 私募基金详情页-基金经理
      *
-     * @param secId  基金id
-     * @param appKey 访问授权码,用于接口验签
      * @return 基金经理信息
      */
-    @GetMapping("manager-info")
-    public ResultVo<List<FundManagerInfoVo>> managerInfo(@RequestParam("secId") String secId, String appKey) {
-        return ResultVo.ok(this.service.getHFManagerInfo(secId));
+    @PostMapping("manager-info")
+    public ResultVo<List<FundManagerInfoVo>> managerInfo(@RequestBody WithSecReq req) {
+        return ResultVo.ok(this.service.getHFManagerInfo(req.getSecId()));
     }
 
     /**
@@ -138,8 +131,8 @@ public class FundApi {
      * @param params 详情请看请求体
      * @return 基金经理信息
      */
-    @GetMapping("mf-manager-info")
-    public ResultVo<List<ManualFundManagerInfoVO>> managerInfo(ManualFundManagerParams params) {
+    @PostMapping("mf-manager-info")
+    public ResultVo<List<ManualFundManagerInfoVO>> managerInfo(@RequestBody ManualFundManagerParams params) {
         return ResultVo.ok(this.service.managerList(params));
     }
 
@@ -149,32 +142,28 @@ public class FundApi {
      * @param params 详情请看请求体
      * @return 公募基金的基金经理变更历史
      */
-    @GetMapping("manager-change")
-    public ResultVo<List<ManualFundManagerChangeVO>> managerChange(ManualFundManagerParams params) {
+    @PostMapping("manager-change")
+    public ResultVo<List<ManualFundManagerChangeVO>> managerChange(@RequestBody ManualFundManagerParams params) {
         return ResultVo.ok(this.service.managerChangeList(params));
     }
 
     /**
      * 私募基金的基本信息
      *
-     * @param secId  基金id
-     * @param appKey 访问授权码,用于接口验签
      * @return 私募基金基本信息
      */
-    @GetMapping("base-info")
-    public ResultVo<PrivatelyFundBaseInfoVO> getFundBaseInfo(@RequestParam("secId") String secId, String appKey) {
-        return ResultVo.ok(this.service.getFundBaseInfo(secId));
+    @PostMapping("base-info")
+    public ResultVo<PrivatelyFundBaseInfoVO> getFundBaseInfo(@RequestBody WithSecReq req) {
+        return ResultVo.ok(this.service.getFundBaseInfo(req.getSecId()));
     }
 
     /**
      * 公募基金的基本信息
      *
-     * @param secId  基金id
-     * @param appKey 访问授权码,用于接口验签
      * @return 私募基金基本信息
      */
-    @GetMapping("mf-base-info")
-    public ResultVo<PubliclyFundBaseInfoVO> getMfFundBaseInfo(@RequestParam("secId") String secId, String appKey) {
-        return ResultVo.ok(this.service.getMfFundBaseInfo(secId));
+    @PostMapping("mf-base-info")
+    public ResultVo<PubliclyFundBaseInfoVO> getMfFundBaseInfo(@RequestBody WithSecReq req) {
+        return ResultVo.ok(this.service.getMfFundBaseInfo(req.getSecId()));
     }
 }

+ 22 - 21
src/main/java/com/smppw/analysis/client/FundPerformanceApi.java

@@ -4,7 +4,8 @@ import com.smppw.analysis.application.dto.performance.*;
 import com.smppw.analysis.application.service.performance.FundPerformanceService;
 import com.smppw.analysis.domain.dto.performance.WinVO;
 import com.smppw.common.pojo.ResultVo;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -24,61 +25,61 @@ public class FundPerformanceApi {
         this.service = service;
     }
 
-    @GetMapping("indicator")
-    public Map<String, Object> indicator(IndicatorReq req) {
+    @PostMapping("indicator")
+    public Map<String, Object> indicator(@RequestBody IndicatorReq req) {
         return this.service.calcIndicator(req);
     }
 
-    @GetMapping("trend")
-    public ResultVo<Map<String, Object>> trend(TrendReq req) {
+    @PostMapping("trend")
+    public ResultVo<Map<String, Object>> trend(@RequestBody TrendReq req) {
         Map<String, Object> data = this.service.trend(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("imf-trend")
-    public ResultVo<Map<String, Object>> imfTrend(ImfTrendReq req) {
+    @PostMapping("imf-trend")
+    public ResultVo<Map<String, Object>> imfTrend(@RequestBody ImfTrendReq req) {
         Map<String, Object> data = this.service.imfTrend(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("dynamic-down")
-    public ResultVo<Map<String, Object>> dynamicDown(DrawdownTrendReq req) {
+    @PostMapping("dynamic-down")
+    public ResultVo<Map<String, Object>> dynamicDown(@RequestBody DrawdownTrendReq req) {
         Map<String, Object> data = this.service.dynamicDown(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("correlation")
-    public ResultVo<Map<String, Object>> cor(CorrelationReq req) {
+    @PostMapping("correlation")
+    public ResultVo<Map<String, Object>> cor(@RequestBody CorrelationReq req) {
         Map<String, Object> data = this.service.cor(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("win")
-    public ResultVo<WinVO> win(WinReq req) {
+    @PostMapping("win")
+    public ResultVo<WinVO> win(@RequestBody WinReq req) {
         WinVO data = this.service.win(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("revenue")
-    public ResultVo<Map<String, Object>> revenue(RevenueReq req) {
+    @PostMapping("revenue")
+    public ResultVo<Map<String, Object>> revenue(@RequestBody RevenueReq req) {
         Map<String, Object> data = this.service.revenue(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("interval")
-    public ResultVo<Map<String, Object>> interval(IntervalReq req) {
+    @PostMapping("interval")
+    public ResultVo<Map<String, Object>> interval(@RequestBody IntervalReq req) {
         Map<String, Object> data = this.service.interval(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("rolling")
-    public ResultVo<Map<String, Object>> rolling(RollingReq req) {
+    @PostMapping("rolling")
+    public ResultVo<Map<String, Object>> rolling(@RequestBody RollingReq req) {
         Map<String, Object> data = this.service.rolling(req);
         return ResultVo.ok(data);
     }
 
-    @GetMapping("rank")
-    public ResultVo<Map<String, Object>> rank(RankReq req) {
+    @PostMapping("rank")
+    public ResultVo<Map<String, Object>> rank(@RequestBody RankReq req) {
         Map<String, Object> data = this.service.rank(req);
         return ResultVo.ok(data);
     }

+ 58 - 133
src/main/java/com/smppw/analysis/client/FundPositionApi.java

@@ -1,5 +1,6 @@
 package com.smppw.analysis.client;
 
+import com.smppw.analysis.application.dto.BaseReq;
 import com.smppw.analysis.application.dto.position.*;
 import com.smppw.analysis.application.service.position.FundFuturesOptionService;
 import com.smppw.analysis.application.service.position.FuturePositionAnalysis;
@@ -14,7 +15,10 @@ import com.smppw.analysis.domain.dto.position.synthesize.PositionInfoVO;
 import com.smppw.analysis.domain.dto.position.synthesize.PositionListVO;
 import com.smppw.analysis.domain.manager.position.bond.BondPositionService;
 import com.smppw.common.pojo.ResultVo;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 import java.util.Map;
@@ -27,7 +31,6 @@ import java.util.Map;
 @RestController
 @RequestMapping("/v1/api/position")
 public class FundPositionApi {
-    //        private final BondPositionAnalysis bond;
     private final StockPositionAnalysis stock;
     private final FuturePositionAnalysis future;
     private final SynthesizePositionAnalysis synthesize;
@@ -50,8 +53,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("asset-allocation")
-    public ResultVo<Map<String, Object>> getAssetAllocation(AssetAllocationReq params) {
+    @PostMapping("asset-allocation")
+    public ResultVo<Map<String, Object>> getAssetAllocation(@RequestBody AssetAllocationReq params) {
         return ResultVo.ok(this.synthesize.getAssetAllocation(params));
     }
 
@@ -61,8 +64,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("leverage-change")
-    public ResultVo<List<LeverageChangeVO>> getLeverageChange(LeverageChangeReq params) {
+    @PostMapping("leverage-change")
+    public ResultVo<List<LeverageChangeVO>> getLeverageChange(@RequestBody LeverageChangeReq params) {
         return ResultVo.ok(this.synthesize.getLeverageChange(params));
     }
 
@@ -72,8 +75,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("position-param")
-    public ResultVo<PositionInfoVO> getPositionParams(PositionInfoReq params) {
+    @PostMapping("position-param")
+    public ResultVo<PositionInfoVO> getPositionParams(@RequestBody PositionInfoReq params) {
         return ResultVo.ok(this.synthesize.getPositionParams(params));
     }
 
@@ -83,8 +86,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("position-list")
-    public ResultVo<List<PositionListVO>> getPosition(PositionListReq params) {
+    @PostMapping("position-list")
+    public ResultVo<List<PositionListVO>> getPosition(@RequestBody PositionListReq params) {
         return ResultVo.ok(this.synthesize.getPosition(params));
     }
 
@@ -94,8 +97,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("holder-info")
-    public ResultVo<List<HolderInfoVO>> getHolderInfo(HolderInfoReq params) {
+    @PostMapping("holder-info")
+    public ResultVo<List<HolderInfoVO>> getHolderInfo(@RequestBody HolderInfoReq params) {
         return ResultVo.ok(this.synthesize.getHolderInfo(params));
     }
 
@@ -105,8 +108,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/major-change")
-    public ResultVo<List<MajorChangeVO>> getMajorChange(MajorChangeReq params) {
+    @PostMapping("stock/major-change")
+    public ResultVo<List<MajorChangeVO>> getMajorChange(@RequestBody MajorChangeReq params) {
         return ResultVo.ok(this.stock.getMajorChangeList(params));
     }
 
@@ -116,8 +119,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/crn")
-    public ResultVo<Map<String, Object>> getStockConcentration(ConcentrationReq params) {
+    @PostMapping("stock/crn")
+    public ResultVo<Map<String, Object>> getStockConcentration(@RequestBody ConcentrationReq params) {
         return ResultVo.ok(this.stock.getConcentration(params));
     }
 
@@ -127,8 +130,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/change-num")
-    public ResultVo<List<ChangeNumberVO>> getStockChangeNumber(ChangeNumberReq params) {
+    @PostMapping("stock/change-num")
+    public ResultVo<List<ChangeNumberVO>> getStockChangeNumber(@RequestBody ChangeNumberReq params) {
         return ResultVo.ok(this.stock.getChangeNumber(params));
     }
 
@@ -138,8 +141,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/industry-allocation")
-    public ResultVo<Map<String, Object>> getStockIndustryAllocation(StockAllocationReq params) {
+    @PostMapping("stock/industry-allocation")
+    public ResultVo<Map<String, Object>> getStockIndustryAllocation(@RequestBody StockAllocationReq params) {
         return ResultVo.ok(this.stock.getIndustryAllocation(params));
     }
 
@@ -149,8 +152,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/industry-allocation-preference")
-    public ResultVo<Map<String, Object>> getStockIndustryAllocationPreference(StockAllocationReq params) {
+    @PostMapping("stock/industry-allocation-preference")
+    public ResultVo<Map<String, Object>> getStockIndustryAllocationPreference(@RequestBody StockAllocationReq params) {
         return ResultVo.ok(this.stock.getIndustryAllocationPreference(params));
     }
 
@@ -160,8 +163,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/style-allocation")
-    public ResultVo<Map<String, Object>> getStockStyleAllocation(StockAllocationReq params) {
+    @PostMapping("stock/style-allocation")
+    public ResultVo<Map<String, Object>> getStockStyleAllocation(@RequestBody StockAllocationReq params) {
         return ResultVo.ok(this.stock.getStyleAllocation(params));
     }
 
@@ -171,8 +174,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/liquidity-allocation")
-    public ResultVo<Map<String, Object>> getStockLiquidityAllocation(StockAllocationReq params) {
+    @PostMapping("stock/liquidity-allocation")
+    public ResultVo<Map<String, Object>> getStockLiquidityAllocation(@RequestBody StockAllocationReq params) {
         return ResultVo.ok(this.stock.getLiquidityAllocation(params));
     }
 
@@ -182,8 +185,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/performance-attribution")
-    public ResultVo<Map<String, Object>> getStockPerformanceAttribution(StockPerformanceAttributionReq params) {
+    @PostMapping("stock/performance-attribution")
+    public ResultVo<Map<String, Object>> getStockPerformanceAttribution(@RequestBody StockPerformanceAttributionReq params) {
         return ResultVo.ok(this.stock.getPerformanceAttribution(params));
     }
 
@@ -193,8 +196,8 @@ public class FundPositionApi {
      * @param params /
      * @return /
      */
-    @GetMapping("stock/barra-sensitivity")
-    public ResultVo<Map<String, Object>> getStockBarraSensitivity(BarraSensitivityReq params) {
+    @PostMapping("stock/barra-sensitivity")
+    public ResultVo<Map<String, Object>> getStockBarraSensitivity(@RequestBody BarraSensitivityReq params) {
         return ResultVo.ok(this.stock.getBarraSensitivity(params));
     }
 
@@ -204,8 +207,8 @@ public class FundPositionApi {
      * @param param /
      * @return /
      */
-    @GetMapping("bond/sort-allocation")
-    public ResultVo<Map<String, Object>> getBondSortAllocation(BondSortAllocationParam param) {
+    @PostMapping("bond/sort-allocation")
+    public ResultVo<Map<String, Object>> getBondSortAllocation(@RequestBody BondSortAllocationParam param) {
         return ResultVo.ok(bondPositionService.getBondSortAllocation(param));
     }
 
@@ -215,8 +218,8 @@ public class FundPositionApi {
      * @param param /
      * @return /
      */
-    @GetMapping("bond/crn")
-    public ResultVo<Map<String, Object>> getBondConcentration(BondSortAllocationParam param) {
+    @PostMapping("bond/crn")
+    public ResultVo<Map<String, Object>> getBondConcentration(@RequestBody BondSortAllocationParam param) {
         return ResultVo.ok(bondPositionService.getBondConcentration(param));
     }
 
@@ -226,75 +229,57 @@ public class FundPositionApi {
      * @param param /
      * @return /
      */
-    @GetMapping("/bond/credit-grading")
-    public ResultVo<Map<String, Object>> getBondCreditGrading(BondSortAllocationParam param) {
+    @PostMapping("/bond/credit-grading")
+    public ResultVo<Map<String, Object>> getBondCreditGrading(@RequestBody BondSortAllocationParam param) {
         return ResultVo.ok(bondPositionService.getBondCreditGrading(param));
     }
 
     /**
-     * @param fundId     基金ID
-     * @param optionType 板块类别
-     * @param shType     投机/套期 1-Speculation,2-Hedging
      * @return
      */
-    @RequestMapping(value = "/fund-futures-option", method = RequestMethod.GET)
-    public ResultVo<Map<String, Object>> fundFuturesOption(@RequestParam("userId") Integer userId, @RequestParam("fundId") String fundId, @RequestParam("optionType") Integer optionType, @RequestParam(value = "shType", defaultValue = "1") Integer shType,
-                                                           @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
-        return fundFuturesOptionService.fundFuturesOption(userId, fundId, optionType, shType, startDate, endDate);
+    @PostMapping(value = "/fund-futures-option")
+    public ResultVo<Map<String, Object>> fundFuturesOption(@RequestBody Map<String, Object> params) {
+        return fundFuturesOptionService.fundFuturesOption(params);
     }
 
 
     /**
-     * @param fundId     基金ID
-     * @param optionType 板块类别
-     * @param shType     投机/套期 1-Speculation,2-Hedging
      * @return
      */
-    @RequestMapping(value = "/fund-futures-option-breed", method = RequestMethod.GET)
-    public ResultVo<Map<String, Object>> fundFuturesOptionForBreed(@RequestParam("userId") Integer userId, @RequestParam("fundId") String fundId, @RequestParam(value = "optionType", required = false) Integer optionType, @RequestParam(value = "shType", defaultValue = "1") Integer shType,
-                                                                   @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
-        return fundFuturesOptionService.fundFuturesOptionForBreed(userId, fundId, optionType, shType, startDate, endDate);
+    @PostMapping(value = "/fund-futures-option-breed")
+    public ResultVo<Map<String, Object>> fundFuturesOptionForBreed(@RequestBody Map<String, Object> params) {
+        return fundFuturesOptionService.fundFuturesOptionForBreed(params);
     }
 
     /**
      * 板块持仓分析
      *
-     * @param fundId
-     * @param optionType
-     * @param shType
      * @return
      */
-    @RequestMapping(value = "/fund-position-analysis", method = RequestMethod.GET)
-    public ResultVo<Map<String, Object>> fundPositionAnalysis(@RequestParam("userId") Integer userId, @RequestParam("fundId") String fundId, @RequestParam("optionType") Integer optionType, @RequestParam(value = "shType", defaultValue = "1") Integer shType,
-                                                              @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
-        return fundFuturesOptionService.fundPositionAnalysis(userId, fundId, optionType, shType, startDate, endDate);
+    @PostMapping(value = "/fund-position-analysis")
+    public ResultVo<Map<String, Object>> fundPositionAnalysis(@RequestBody Map<String, Object> params) {
+        return fundFuturesOptionService.fundPositionAnalysis(params);
     }
 
     /**
      * 板块持仓分析
      *
-     * @param fundId
-     * @param optionType
-     * @param shType
      * @return
      */
-    @RequestMapping(value = "/fund-position-analysis-line", method = RequestMethod.GET)
-    public ResultVo<Map<String, Object>> fundPositionAnalysisLine(@RequestParam("userId") Integer userId, @RequestParam("fundId") String fundId, @RequestParam(value = "optionType", required = false, defaultValue = "0") Integer optionType, @RequestParam(value = "shType", defaultValue = "1", required = false) Integer shType,
-                                                                  @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
-        return fundFuturesOptionService.fundPositionAnalysisLine(userId, fundId, optionType, shType, startDate, endDate);
+    @PostMapping(value = "/fund-position-analysis-line")
+    public ResultVo<Map<String, Object>> fundPositionAnalysisLine(@RequestBody Map<String, Object> params) {
+        return fundFuturesOptionService.fundPositionAnalysisLine(params);
     }
 
 
     /**
      * 衍生品杠杆与保证金
      *
-     * @param fundId
      * @return
      */
-    @RequestMapping(value = "/fund-derivative-leverage-margin", method = RequestMethod.GET)
-    public ResultVo<Map<String, Object>> fundDerivativeLeverageMargin(@RequestParam("userId") Integer userId, @RequestParam("fundId") String fundId, @RequestParam(value = "shType", required = false) Integer shType,
-                                                                      @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
-        return fundFuturesOptionService.fundDerivativeLeverageMargin(userId, fundId, shType, startDate, endDate);
+    @PostMapping(value = "/fund-derivative-leverage-margin")
+    public ResultVo<Map<String, Object>> fundDerivativeLeverageMargin(@RequestBody Map<String, Object> params) {
+        return fundFuturesOptionService.fundDerivativeLeverageMargin(params);
     }
 
 
@@ -304,76 +289,16 @@ public class FundPositionApi {
      * @param params
      * @return
      */
-    @RequestMapping(value = "/fund-marginal-risk-contribution", method = RequestMethod.GET)
-    public ResultVo<Map<String, Object>> getFutureRiskCont(MarginalRiskContributionReq params) {
+    @PostMapping(value = "/fund-marginal-risk-contribution")
+    public ResultVo<Map<String, Object>> getFutureRiskCont(@RequestBody MarginalRiskContributionReq params) {
         return ResultVo.ok(this.future.riskCont(params));
     }
 
     /**
      * @return
      */
-    @RequestMapping(value = "/fund-futures-option-view", method = RequestMethod.GET)
-    public ResultVo<Map<String, List<String>>> fundFuturesOptionView() {
+    @PostMapping(value = "/fund-futures-option-view")
+    public ResultVo<Map<String, List<String>>> fundFuturesOptionView(@RequestBody BaseReq.DefaultReq req) {
         return fundFuturesOptionService.fundFuturesOptionView();
     }
-
-//    /**
-//     * 公募私募,债券-久期分析
-//     *
-//     * @param params /
-//     * @return /
-//     */
-//    @GetMapping("bond/duration-analysis")
-//    public ResultVo<List<DurationAnalysisVO>> getBondDurationAnalysis(DurationAnalysisParams params) {
-//        return null;
-//    }
-//
-//    /**
-//     * 公募私募,债券-收益风险
-//     *
-//     * @param params /
-//     * @return /
-//     */
-//    @GetMapping("bond/profit-risk")
-//    public ResultVo<List<ProfitRiskVO>> getBondProfitRisk(ProfitRiskParams params) {
-//        return null;
-//    }
-//
-//    /**
-//     * 公募私募,债券-业绩归因
-//     *
-//     * @param params /
-//     * @return /
-//     */
-//    @GetMapping("bond/performance-attribution")
-//    public ResultVo<List<BondPerformanceAttributionVO>> getBondPerformanceAttribution(BondPerformanceAttributionParams params) {
-//        return null;
-//    }
-//
-//    /**
-//     * 公募私募,债券-债券分类配置及明细
-//     *
-//     * @param params /
-//     * @return /
-//     */
-//    @GetMapping("bond/asset-allocation")
-//    public ResultVo<List<BondAssetAllocationVO>> getBondAssetAllocation(BondAssetAllocationParams params) {
-//        return null;
-//    }
-//
-//    /**
-//     * 公募私募,债券-集中度
-//     *
-//     * @param params /
-//     * @return /
-//     */
-//    @GetMapping("bond/crn")
-//    public ResultVo<List<ConcentrationVO>> getBondConcentration(ConcentrationParams params) {
-//        return null;
-//    }
-//
-//    @GetMapping("future/risk-cont")
-//    public ResultVo<Map<String, Object>> getFutureRiskCont(MarginalRiskContributionParams params) {
-//        return ResultVo.ok(this.future.riskCont(params));
-//    }
 }

+ 24 - 23
src/main/java/com/smppw/analysis/client/FundStyleApi.java

@@ -3,7 +3,8 @@ package com.smppw.analysis.client;
 import com.smppw.analysis.application.service.style.StyleService;
 import com.smppw.analysis.domain.dto.style.*;
 import com.smppw.common.pojo.ResultVo;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -29,8 +30,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("stock-attribution")
-    public ResultVo<Map<String, Object>> stockAttribution(StockAttributionParams params) {
+    @PostMapping("stock-attribution")
+    public ResultVo<Map<String, Object>> stockAttribution(@RequestBody StockAttributionParams params) {
         return ResultVo.ok(this.service.stockAttribution(params));
     }
 
@@ -40,8 +41,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("bond-attribution")
-    public ResultVo<Map<String, Object>> bondAttribution(BondAttributionParams params) {
+    @PostMapping("bond-attribution")
+    public ResultVo<Map<String, Object>> bondAttribution(@RequestBody BondAttributionParams params) {
         return ResultVo.ok(this.service.bondAttribution(params));
     }
 
@@ -51,8 +52,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("relative-attribution")
-    public ResultVo<Map<String, Object>> relativeAttribution(RelativeAttributionParams params) {
+    @PostMapping("relative-attribution")
+    public ResultVo<Map<String, Object>> relativeAttribution(@RequestBody RelativeAttributionParams params) {
         return ResultVo.ok(this.service.relativeAttribution(params));
     }
 
@@ -62,8 +63,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("growth-value")
-    public ResultVo<FundStyleVO> growthValue(GrowthValueParams params) {
+    @PostMapping("growth-value")
+    public ResultVo<FundStyleVO> growthValue(@RequestBody GrowthValueParams params) {
         return ResultVo.ok(this.service.growthValue(params));
     }
 
@@ -73,8 +74,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("industry-value")
-    public ResultVo<FundStyleVO> industryValue(IndustryValueParams params) {
+    @PostMapping("industry-value")
+    public ResultVo<FundStyleVO> industryValue(@RequestBody IndustryValueParams params) {
         return ResultVo.ok(this.service.industryValue(params));
     }
 
@@ -84,8 +85,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("future-factor")
-    public ResultVo<Map<String, Object>> futureFactor(FutureFactorParams params) {
+    @PostMapping("future-factor")
+    public ResultVo<Map<String, Object>> futureFactor(@RequestBody FutureFactorParams params) {
         return ResultVo.ok(this.service.futureFactor(params));
     }
 
@@ -95,24 +96,24 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("custom-rbsa")
-    public ResultVo<CustomRbsaVO> customRbsa(CustomRbsaParams params) {
+    @PostMapping("custom-rbsa")
+    public ResultVo<CustomRbsaVO> customRbsa(@RequestBody CustomRbsaParams params) {
         return ResultVo.ok(this.service.customRbsa(params));
     }
 
     /**
      * Barra风格概览
      */
-    @GetMapping("/barra-factor-overview")
-    public ResultVo<Map<String, Object>> barraOverview(BarraStyleParams params) {
+    @PostMapping("/barra-factor-overview")
+    public ResultVo<Map<String, Object>> barraOverview(@RequestBody BarraStyleParams params) {
         return ResultVo.ok(this.service.barraOverview(params));
     }
 
     /**
      * Barra 风格归因
      */
-    @GetMapping("/barra-factor-risk-profit")
-    public ResultVo<Map<String, Object>> barraRiskProfit(BarraStyleParams params) {
+    @PostMapping("/barra-factor-risk-profit")
+    public ResultVo<Map<String, Object>> barraRiskProfit(@RequestBody BarraStyleParams params) {
         return ResultVo.ok((this.service.barraRiskProfit(params)));
     }
 
@@ -122,8 +123,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("selection-timing")
-    public ResultVo<Map<String, Object>> selectionTiming(SelectionTimingParams params) {
+    @PostMapping("selection-timing")
+    public ResultVo<Map<String, Object>> selectionTiming(@RequestBody SelectionTimingParams params) {
         return ResultVo.ok(this.service.selectionTiming(params));
     }
 
@@ -133,8 +134,8 @@ public class FundStyleApi {
      * @param params 请求参数
      * @return /
      */
-    @GetMapping("ppw")
-    public ResultVo<Map<String, Object>> rzStyle(RzStyleParams params) {
+    @PostMapping("ppw")
+    public ResultVo<Map<String, Object>> rzStyle(@RequestBody RzStyleParams params) {
         return ResultVo.ok(this.service.rzStyle(params));
     }
 }

+ 11 - 9
src/main/java/com/smppw/analysis/client/TestApi.java

@@ -1,10 +1,12 @@
 package com.smppw.analysis.client;
 
-import cn.hutool.crypto.SignUtil;
+import cn.hutool.core.map.MapUtil;
+import com.smppw.analysis.infrastructure.components.RequestWrapper;
 import com.smppw.analysis.infrastructure.config.AnalysisProperty;
+import com.smppw.analysis.infrastructure.utils.CommonUtils;
 import com.smppw.common.pojo.ResultVo;
 import jakarta.servlet.http.HttpServletRequest;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -26,16 +28,16 @@ public class TestApi {
      * @param request 请求参数,包含appKey
      * @return /
      */
-    @GetMapping("sign")
-    public ResultVo<String> generateSign(HttpServletRequest request) {
-        Map<String, String[]> parameterMap = request.getParameterMap();
-        String[] appKeys = parameterMap.get("appKey");
-        String appKey = appKeys[0];
-        parameterMap.entrySet().removeIf(next -> "appKey".equalsIgnoreCase(next.getKey()));
+    @PostMapping("sign")
+    public ResultVo<String> generateSign(HttpServletRequest request) throws Exception {
+        String body = new RequestWrapper(request).getBodyString();
+        Map<String, Object> params = CommonUtils.str2Map(body);
+        String appKey = MapUtil.getStr(params, "appKey");
+        params.entrySet().removeIf(next -> "appKey".equalsIgnoreCase(next.getKey()));
         List<AnalysisProperty.AppSign> appSigns = this.property.getAppSigns();
         String secret = appSigns.stream().filter(e -> appKey.equalsIgnoreCase(e.getAppKey()))
                 .map(AnalysisProperty.AppSign::getAppSecret).findFirst().orElse(null);
-        String sign = SignUtil.signParamsMd5(parameterMap, secret);
+        String sign = CommonUtils.createSign(params, secret);
         return ResultVo.ok(sign);
     }
 }

+ 12 - 5
src/main/java/com/smppw/analysis/infrastructure/components/ApiSignInterceptor.java

@@ -1,9 +1,10 @@
 package com.smppw.analysis.infrastructure.components;
 
+import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.SignUtil;
 import cn.hutool.json.JSONUtil;
 import com.smppw.analysis.infrastructure.config.AnalysisProperty;
+import com.smppw.analysis.infrastructure.utils.CommonUtils;
 import com.smppw.common.pojo.ResultVo;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
@@ -52,7 +53,14 @@ public class ApiSignInterceptor implements HandlerInterceptor {
             this.writeFailJson(response, "timestamp 参数为空");
             return false;
         }
-        String appKey = request.getParameter("appKey");
+        if (!"post".equalsIgnoreCase(request.getMethod())) {
+            this.writeFailJson(response, "仅支持POST的请求方式");
+            return false;
+        }
+
+        String body = new RequestWrapper(request).getBodyString();
+        Map<String, Object> params = CommonUtils.str2Map(body);
+        String appKey = MapUtil.getStr(params, "appKey");
         AnalysisProperty.AppSign appSign = this.property.getAppSigns().stream()
                 .filter(e -> appKey.equals(e.getAppKey())).findFirst().orElse(null);
         if (appSign == null) {
@@ -68,9 +76,8 @@ public class ApiSignInterceptor implements HandlerInterceptor {
             return false;
         }
         String appSecret = appSign.getAppSecret();
-        Map<String, String[]> parameterMap = request.getParameterMap();
-        parameterMap.entrySet().removeIf(next -> "appKey".equalsIgnoreCase(next.getKey()));
-        String paramsSign = SignUtil.signParamsMd5(parameterMap, appSecret);
+        params.entrySet().removeIf(next -> "appKey".equalsIgnoreCase(next.getKey()));
+        String paramsSign = CommonUtils.createSign(params, appSecret);
         if (!sign.equalsIgnoreCase(paramsSign)) {
             this.writeFailJson(response, "签名验证失败");
             return false;

+ 1 - 1
src/main/java/com/smppw/analysis/infrastructure/components/GlobalResponseBodyAdvice.java

@@ -23,7 +23,7 @@ import java.util.Arrays;
 public class GlobalResponseBodyAdvice implements ResponseBodyAdvice<Object> {
     private static final Class[] ANNOTATIONS = new Class[]{
             RequestMapping.class,
-            GetMapping.class,
+            PostMapping.class,
             PostMapping.class,
             DeleteMapping.class,
             PutMapping.class

+ 19 - 0
src/main/java/com/smppw/analysis/infrastructure/components/RequestFilter.java

@@ -0,0 +1,19 @@
+package com.smppw.analysis.infrastructure.components;
+
+import jakarta.servlet.*;
+import jakarta.servlet.annotation.WebFilter;
+import jakarta.servlet.http.HttpServletRequest;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+@Component
+@WebFilter(urlPatterns = "/*")
+public class RequestFilter implements Filter {
+
+    @Override
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        ServletRequest requestWrapper = new RequestWrapper((HttpServletRequest) request);
+        chain.doFilter(requestWrapper, response);
+    }
+}

+ 117 - 0
src/main/java/com/smppw/analysis/infrastructure/components/RequestWrapper.java

@@ -0,0 +1,117 @@
+package com.smppw.analysis.infrastructure.components;
+
+import jakarta.servlet.ReadListener;
+import jakarta.servlet.ServletInputStream;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequestWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.util.StreamUtils;
+
+import java.io.*;
+import java.nio.charset.Charset;
+
+@Slf4j
+public class RequestWrapper extends HttpServletRequestWrapper {
+    // 存储流的容器
+    private byte[] requestBody = null;
+
+    /**
+     * Constructs a request object wrapping the given request.
+     *
+     * @param request The request to wrap
+     * @throws IllegalArgumentException if the request is null
+     */
+    public RequestWrapper(HttpServletRequest request) throws IOException {
+        super(request);
+        // 将流复制到字节数组 requestBody 中
+        requestBody = StreamUtils.copyToByteArray(request.getInputStream());
+    }
+
+    /**
+     * 获取请求体
+     */
+    public String getBodyString(final ServletRequest request) {
+        try {
+            return inputStream2String(request.getInputStream());
+        } catch (IOException e) {
+            log.error("", e);
+            throw new RuntimeException(e);
+        }
+    }
+
+
+    /**
+     * 获取请求体
+     */
+    public String getBodyString() {
+        final InputStream inputStream = new ByteArrayInputStream(requestBody);
+
+        return inputStream2String(inputStream);
+    }
+
+    /**
+     * 读取inputStream数据,并转换为String
+     */
+    private String inputStream2String(InputStream inputStream) {
+        StringBuilder sb = new StringBuilder();
+        BufferedReader reader = null;
+
+        try {
+            reader = new BufferedReader(new InputStreamReader(inputStream, Charset.defaultCharset()));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line);
+            }
+        } catch (IOException e) {
+            log.error("异常:", e);
+            throw new RuntimeException(e);
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    log.error("", e);
+                }
+            }
+        }
+
+        return sb.toString();
+    }
+
+    @Override
+    public ServletInputStream getInputStream() throws IOException {
+
+        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(requestBody);
+
+        return new ServletInputStream() {
+
+            @Override
+            public int read() throws IOException {
+                return byteArrayInputStream.read();
+            }
+
+            @Override
+            public boolean isFinished() {
+                return false;
+            }
+
+            @Override
+            public boolean isReady() {
+                return false;
+            }
+
+            @Override
+            public void setReadListener(ReadListener readListener) {
+                log.info("保存输入流......");
+            }
+        };
+    }
+
+    @Override
+    public BufferedReader getReader() throws IOException {
+        return new BufferedReader(new InputStreamReader(getInputStream()));
+    }
+
+}
+

+ 50 - 4
src/main/java/com/smppw/analysis/infrastructure/utils/CommonUtils.java

@@ -2,11 +2,15 @@ package com.smppw.analysis.infrastructure.utils;
 
 import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.SignUtil;
+import cn.hutool.crypto.digest.MD5;
+import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -48,13 +52,55 @@ public class CommonUtils {
         return null;
     }
 
-    public static void main(String[] args) {
+    /**
+     * json字符串转Map
+     */
+    public static Map<String, Object> str2Map(String str) {
+        /*先转换为JSON对象*/
+        JSONObject entries = JSONUtil.parseObj(str);
+        Map<String, Object> resMap = new HashMap<>();
+        for (Map.Entry<String, Object> entry : entries.entrySet()) {
+            resMap.put(entry.getKey(), entry.getValue());
+        }
+        return resMap;
+    }
+
+    public static String createSign(Map<String, Object> params, String... others) throws Exception {
+        StringBuilder ketStr = new StringBuilder();
+        Object[] keys = params.keySet().toArray();
+        Arrays.sort(keys);
+        for (Object key : keys) {
+            String valueStr = "";
+            Object value = params.get(key.toString());
+            if (value != "") {
+                valueStr = String.valueOf(value);
+            }
+            ketStr.append(key)
+                    .append("=")
+                    .append(valueStr)
+                    .append(",");
+        }
+        if (others != null && others.length > 0) {
+            for (String other : others) {
+                ketStr.append(other);
+            }
+        }
+        return md5(ketStr.toString());
+    }
+
+    public static String md5(String str) throws Exception {
+        // 指定加密类型
+        MessageDigest messageDigest = MessageDigest.getInstance("MD5");
+        // 将字节数组转换为表示每个字节的十六进制值的字符串
+        return MD5.create().digestHex(messageDigest.digest(str.getBytes(StandardCharsets.UTF_8)));
+    }
+
+    public static void main(String[] args) throws Exception {
         String appSecret = "abcdef";
-        String timestamp = "1691991341095";
         Map<String, Object> params = new HashMap<>();
         params.put("secId", "MF00005JMD");
         params.put("indexIds", ListUtil.of("IN00000008", "IN0000000M"));
-        String sign = SignUtil.signParamsMd5(params, appSecret, timestamp);
+        String sign = createSign(params, appSecret);
         System.out.println(sign);
     }
 }