diff --git a/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java b/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java index 055c511..bf40ada 100644 --- a/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java +++ b/bweb/src/main/java/com/bweb/controller/BsAgentMerController.java @@ -171,6 +171,7 @@ public class BsAgentMerController { @RequestParam(name = "merSourceType", required = false) Long merSourceType, @RequestParam(name = "merNo", required = false) String merNo, @RequestParam(name = "merName", required = false) String merName, + @RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { @@ -180,6 +181,7 @@ public class BsAgentMerController { param.put("merSourceType", merSourceType); param.put("merNo", StringUtils.isNotBlank(merNo)?merNo:null); param.put("merName", StringUtils.isNotBlank(merName)?merName:null); + param.put("status", status); if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { param.put("agentId", agentId); diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index df03869..0498edc 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -1,13 +1,18 @@ package com.bweb.controller; +import com.alibaba.excel.util.CollectionUtils; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hfkj.channel.gas.newlink.NewLinkRequestService; import com.hfkj.channel.gas.shell.CqShellPetroleumRequestService; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; +import com.hfkj.common.pay.util.SignatureUtil; import com.hfkj.common.utils.HttpUtils; import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.MD5Util; @@ -28,6 +33,9 @@ import com.hfkj.service.sec.SecUserLoginLogService; import com.hfkj.service.sec.SecUserService; import com.hfkj.sysenum.SecUserObjectTypeEnum; import com.hfkj.sysenum.SecUserStatusEnum; +import com.hfkj.sysenum.gas.GasOilPriceStatusEnum; +import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum; +import com.hfkj.sysenum.merchant.MerchantStatusEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -38,7 +46,13 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.File; +import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; @Controller @RequestMapping(value="/test") @@ -62,6 +76,46 @@ public class TestController { @Resource private CommonService commonService; + @RequestMapping(value="testApiPush",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "测试api推送") + public ResponseData testApiPush() { + try { + // 最新全量加油站数据 + List gasDataList = new ArrayList<>(); + // 初始化页数 + Integer totalPageNum = 3; + for (int pageIndex = 1; pageIndex <= totalPageNum;pageIndex++) { + Map paramMap = new HashMap<>(); + paramMap.put("appId", "hffeab7fdb44d4f1"); + paramMap.put("pageNum", pageIndex); + paramMap.put("pageSize", 100); + paramMap.put("sign", SignatureUtil.createSign(paramMap, "3a9b2772b9a2d319a9b18e55fa30246d")); + // 查询油站 + JSONObject object = HttpsUtils.doPost("https://oil.dctpay.com/openapi/gas/queryList", JSON.toJSONString(paramMap)); + // 总页数 + totalPageNum = object.getJSONObject("return_data").getInteger("totalPageNum"); + // 加入全量数据集合 + gasDataList.addAll(object.getJSONObject("return_data").getJSONArray("gasInfoList")); + } + return ResponseMsgUtil.success(gasDataList); + /* Map param = new HashMap<>(); + param.put("appId", "hf7356c71fb97ab0"); + param.put("gasNo", "10019"); + param.put("gunNo", "4"); + param.put("oilNo", "95"); + param.put("orderNo", System.currentTimeMillis()); + param.put("refuelingAmount", "100"); + param.put("userPhone", "17726395120"); + param.put("sign", "string"); + return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9805/openapi/gasOrder/push", JSONObject.toJSONString(param))); +*/ + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="test",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "加油站全量缓存") diff --git a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java index f5d1c52..2835fc7 100644 --- a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java +++ b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java @@ -39,14 +39,13 @@ public class SignatureUtil { * @throws Exception */ public static Boolean checkSign(String checkSign,Object param, String key) { - return true; -/* Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class); + Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class); // 去除签名 map.remove("sign"); if (checkSign.equals(createSign(map, key))) { return true; } - return false;*/ + return false; } /** @@ -87,10 +86,11 @@ public class SignatureUtil { public static void main(String[] args) throws Exception { String paramStr = "{\n" + - " \"appId\": \"hf7356c71fb97ab0\",\n" + - " \"orderNo\": \"123456\"" + + " \"appId\": \"hffeab7fdb44d4f1\",\n" + + " \"orderNo\": \"test10021001\",\n" + + " \"refundReason\": \"测试退款\"" + "}"; - String sign = createSign(JSONObject.parseObject(paramStr), "8aef995ff71485dc19b36e35f04c4016"); + String sign = createSign(JSONObject.parseObject(paramStr), "3a9b2772b9a2d319a9b18e55fa30246d"); System.out.println(sign); } diff --git a/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java b/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java index 41315bf..a49c117 100644 --- a/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java +++ b/service/src/main/java/com/hfkj/common/utils/HttpsUtils.java @@ -389,6 +389,42 @@ public class HttpsUtils { return null; } + public static String doApiPost(String apiUrl, JSONObject json) { + CloseableHttpClient httpClient = null; + if (apiUrl.startsWith("https")) { + httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) + .setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); + } else { + httpClient = HttpClients.createDefault(); + } + String httpStr = null; + CloseableHttpResponse response = null; + + try { + HttpPost httpPost = new HttpPost(apiUrl); + httpPost.setConfig(requestConfig); + StringEntity stringEntity = new StringEntity(json.toString(), "UTF-8");// 解决中文乱码问题 + stringEntity.setContentEncoding("UTF-8"); + stringEntity.setContentType("application/json"); + httpPost.setEntity(stringEntity); + response = httpClient.execute(httpPost); + HttpEntity entity = response.getEntity(); + httpStr = EntityUtils.toString(entity, "UTF-8"); + return httpStr; + } catch (Exception e) { + log.error(e.getMessage(),e); + } finally { + if (response != null) { + try { + EntityUtils.consume(response.getEntity()); + } catch (IOException e) { + log.error(e.getMessage(),e); + } + } + } + return null; + } + public static JSONObject doHuiLianTongPost(String apiUrl) { CloseableHttpClient httpClient = null; if (apiUrl.startsWith("https")) { diff --git a/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java b/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java index ad44858..4927e1d 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java @@ -79,6 +79,52 @@ public interface BsAgentMerMapperExt { " and a.agentId is null " + " GROUP BY a.merId " + " "}) +/* @Select("")*/ List getAllotList(@Param("param") Map param); @Select("