From 42813d4068b962388c564be73a9f27375d71f264 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 9 Apr 2024 09:46:49 +0800 Subject: [PATCH] Merge branch 'new-dev' into 2.0-dev # Conflicts: # hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java # hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java --- .../bweb/controller/ApiCouponController.java | 127 +++++++++++------- .../resources/dev/commonConfig.properties | 1 - .../prod-9401/commonConfig.properties | 7 +- .../resources/prod/commonConfig.properties | 7 +- .../com/v1/controller/WxMsgController.java | 28 ---- 5 files changed, 87 insertions(+), 83 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java index a99b997d..0de1398d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.PayloService; import com.hai.config.PetroConfig; +import com.hai.config.PetroCouponConfig; import com.hai.entity.ApiCoupon; import com.hai.model.ResponseData; import com.hai.openApi.service.ApiBlxCouponService; @@ -22,8 +23,11 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.List; @Controller @RequestMapping(value = "/apiCoupon") @@ -64,62 +68,81 @@ public class ApiCouponController { public ResponseData synCouponRule(@RequestParam(name = "type", required = true) Integer type) { try { - - PetroConfig.init(type); - - JSONObject jsonObject = petroConfig.synCouponRule(); - - if (jsonObject.getString("resultCode").equals("0000")) { - String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); - JSONArray jsonArray = JSONArray.parseArray(data); - - System.out.println(jsonArray); - ApiCoupon apiCoupon; - - for (int i = 0; i < jsonArray.size(); i++) { - - JSONObject object = jsonArray.getJSONObject(i); - apiCoupon = apiCouponService.findCoupon(object.getString("alias")); - - if (apiCoupon == null ) { - apiCoupon = new ApiCoupon(); - apiCoupon.setCode(object.getString("alias")); - apiCoupon.setDesc(object.getString("declare")); - apiCoupon.setGoodsType(object.getString("bizType")); - apiCoupon.setName(object.getString("title")); - apiCoupon.setValidType(object.getInteger("validType")); - if (object.getInteger("validType") == 1) { - apiCoupon.setValidDate(object.getDate("validDate")); - } - apiCoupon.setEffectiveDays(object.getInteger("validDate")); - apiCoupon.setImg(object.getString("img")); - apiCoupon.setCreateTime(new Date()); - apiCoupon.setUpdateTime(new Date()); - apiCoupon.setStatus(1); - apiCoupon.setType(type); - apiCoupon.setPrice(object.getInteger("faceValue")); - apiCouponService.insertCoupon(apiCoupon); - } else { - apiCoupon.setCode(object.getString("alias")); - apiCoupon.setDesc(object.getString("declare")); - apiCoupon.setGoodsType(object.getString("bizType")); - apiCoupon.setName(object.getString("title")); - apiCoupon.setValidType(object.getInteger("validType")); - if (object.getInteger("validType") == 1) { - apiCoupon.setValidDate(object.getDate("validDate")); + if (type == 4) { + JSONObject jsonObject = PetroCouponConfig.getCouponList(); + JSONArray array = jsonObject.getJSONArray("data"); + List list = new ArrayList<>(); + + for (int i = 0; i < array.size(); i++) { + JSONObject object = array.getJSONObject(i); + object.put("alias" , object.getString("reqCode")); + object.put("title" , object.getString("tplName")); + object.put("qty" , object.getString("ticketBalance")); + object.put("faceValue" , object.getBigDecimal("tplAmount").divide(new BigDecimal(100))); + object.put("bizTypeDesc" , "汽油券"); + object.put("validDate" , "180"); + list.add(object); + } + return ResponseMsgUtil.success(list); + + } else { + PetroConfig.init(type); + + JSONObject jsonObject = petroConfig.synCouponRule(); + + if (jsonObject.getString("resultCode").equals("0000")) { + String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); + JSONArray jsonArray = JSONArray.parseArray(data); + + ApiCoupon apiCoupon; + + for (int i = 0; i < jsonArray.size(); i++) { + + JSONObject object = jsonArray.getJSONObject(i); + apiCoupon = apiCouponService.findCoupon(object.getString("alias")); + + if (apiCoupon == null ) { + apiCoupon = new ApiCoupon(); + apiCoupon.setCode(object.getString("alias")); + apiCoupon.setDesc(object.getString("declare")); + apiCoupon.setGoodsType(object.getString("bizType")); + apiCoupon.setName(object.getString("title")); + apiCoupon.setValidType(object.getInteger("validType")); + if (object.getInteger("validType") == 1) { + apiCoupon.setValidDate(object.getDate("validDate")); + } + apiCoupon.setEffectiveDays(object.getInteger("validDate")); + apiCoupon.setImg(object.getString("img")); + apiCoupon.setCreateTime(new Date()); + apiCoupon.setUpdateTime(new Date()); + apiCoupon.setStatus(1); + apiCoupon.setType(type); + apiCoupon.setPrice(object.getInteger("faceValue")); + apiCouponService.insertCoupon(apiCoupon); + } else { + apiCoupon.setCode(object.getString("alias")); + apiCoupon.setDesc(object.getString("declare")); + apiCoupon.setGoodsType(object.getString("bizType")); + apiCoupon.setName(object.getString("title")); + apiCoupon.setValidType(object.getInteger("validType")); + if (object.getInteger("validType") == 1) { + apiCoupon.setValidDate(object.getDate("validDate")); + } + apiCoupon.setEffectiveDays(object.getInteger("validDate")); + apiCoupon.setImg(object.getString("img")); + apiCoupon.setUpdateTime(new Date()); + apiCoupon.setStatus(1); + apiCoupon.setType(type); + apiCoupon.setPrice(object.getInteger("faceValue")); + apiCouponService.editCoupon(apiCoupon); } - apiCoupon.setEffectiveDays(object.getInteger("validDate")); - apiCoupon.setImg(object.getString("img")); - apiCoupon.setUpdateTime(new Date()); - apiCoupon.setStatus(1); - apiCoupon.setType(type); - apiCoupon.setPrice(object.getInteger("faceValue")); - apiCouponService.editCoupon(apiCoupon); } - } - return ResponseMsgUtil.success(jsonArray); + return ResponseMsgUtil.success(jsonArray); + } + + } return ResponseMsgUtil.success("请求失败"); diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index a9fc85cb..74547562 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -179,5 +179,4 @@ NdKey= 5df3f620-e269-458d-9556-87e26d30256a #Sph SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry SphMerchant = 355920109860 -SphReqCode = z9zhwgk31j2kkk4b SphSecret = Es9cshhRoDxeFAuGItLZUDi8Qj3PWrje diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index e5fd873d..c232a522 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -156,4 +156,9 @@ NdOrgCode = 414a3d16-30f9-40d1-a2cd-b06066b38708 NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c wxZxjzAppId=wxc872cb59b56681a7 -wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a \ No newline at end of file +wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a + +#Sph +SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry +SphMerchant = 618809656349 +SphSecret = xstEWAhjw74GzMkXcPr2Cf7z00aYXaSy \ No newline at end of file diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index c308b5ae..4de0d04d 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -161,4 +161,9 @@ NdOrgCode = 414a3d16-30f9-40d1-a2cd-b06066b38708 NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c wxZxjzAppId=wxc872cb59b56681a7 -wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a \ No newline at end of file +wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a + +#Sph +SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry +SphMerchant = 618809656349 +SphSecret = xstEWAhjw74GzMkXcPr2Cf7z00aYXaSy \ No newline at end of file diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java index d5598eda..6ccfb75a 100644 --- a/v1/src/main/java/com/v1/controller/WxMsgController.java +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -595,32 +595,4 @@ public class WxMsgController { -// @RequestMapping(value = "/verifyWx", method = RequestMethod.GET) -// @ResponseBody -// @ApiOperation(value = "微信签名") -// public String verifyWx() { -// -// try { -// -// Map params = new HashMap<>(); -// params.put("appid", SysConst.getSysConfig().getWxH5AppId()); -// params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); -// params.put("grant_type", "client_credential"); -// -// JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); -// -// Map map = new HashMap<>(); -// map.put("noncestr","Wm3WZYTPz0wzccnW"); -// map.put("jsapi_ticket",accessTokenObject.getString("ticket")); -// map.put("timestamp","1414587457"); -// map.put("url","http://mp.weixin.qq.com?params=value"); -// -// return WxUtils.getSHA1(map); -// } catch (Exception e) { -// return null; -// } -// -// } - - }