diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java index 06658914..c1c2ec46 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java @@ -5,9 +5,11 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.AESEncodeUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighDiscount; import com.hai.model.ResponseData; import com.hai.service.HighDiscountAgentRelService; import com.hai.service.HighDiscountCouponRelService; +import com.hai.service.HighDiscountService; import com.hai.service.HighDiscountUserRelService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -37,7 +39,7 @@ public class HighDiscountController { private HighDiscountCouponRelService highDiscountCouponRelService; @Resource - private HighDiscountUserRelService highDiscountUserRelService; + private HighDiscountService highDiscountService; @RequestMapping(value="/getDiscountByQrCode",method = RequestMethod.GET) @ResponseBody @@ -59,6 +61,20 @@ public class HighDiscountController { } } + @RequestMapping(value="/getDiscountById",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id 查询优惠券详情") + public ResponseData getDiscountById(@RequestParam(name = "id", required = true) Long id) { + try { + + return ResponseMsgUtil.success(highDiscountService.getDiscountById(id)); + + } catch (Exception e) { + log.error("HighDiscountController -> getDiscountById() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getCouponByDiscount",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据优惠券查询卡券") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java index e6fbcd4b..715b6516 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java @@ -105,6 +105,21 @@ public class HighUserDiscountController { } } + @RequestMapping(value="/getDiscountByUserDiscountId",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据用户和优惠券关系id 查询优惠券详情") + public ResponseData getDiscountByUserDiscountId(@RequestParam(name = "userDiscountId", required = true) Long userDiscountId) { + try { + + return ResponseMsgUtil.success(highDiscountUserRelService.getRelById(userDiscountId)); + + } catch (Exception e) { + log.error("HighDiscountController -> getDiscountByUserDiscountId() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getUserNormalDiscountList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡券,查询【可以使用】优惠券列表") diff --git a/hai-cweb/src/test/common/RegionTest.java b/hai-cweb/src/test/common/RegionTest.java index e13b25ef..b586481a 100644 --- a/hai-cweb/src/test/common/RegionTest.java +++ b/hai-cweb/src/test/common/RegionTest.java @@ -83,12 +83,11 @@ public class RegionTest { public void test(){ try { - Map tokenMap = new HashMap<>(); + Map tokenMap = new HashMap<>(); tokenMap.put("appId", "jsVpwDoHZfR2rrpjhA"); tokenMap.put("appSecret", "R7yJjinikdPhOlTrVgmdS7cblWMMOf99zEJkfPgaTIoDtKGlX51JKueLV725a6S4"); JSONObject jsonObject = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/api/open/merchant/token", JSON.toJSONString(tokenMap)); - System.out.println(jsonObject.toJSONString()); - if(jsonObject != null && jsonObject.getBoolean("success") == true) { + if (jsonObject != null && jsonObject.getBoolean("success") == true) { JSONObject data = jsonObject.getJSONObject("data"); String token = data.getString("token"); @@ -98,20 +97,21 @@ public class RegionTest { bodyMap.put("pageSize", 10); bodyMap.put("startTime", "2021-3-31 00:00:00"); bodyMap.put("endTime", "2021-3-31 23:00:00"); - bodyMap.put("customerCode", "48464274"); + //bodyMap.put("customerCode", "48464274"); + bodyMap.put("customerCode", "hAFO76ZqXmIqosNw3PTAP4wxGJTN7MPawSU0QFDzzNioLjKMEaVFDlNKRIQX6n0DgyoVMy170T0b13P8uUTAQsbk9UNRPFO5i0fWp1hHOhNdaaQ2BdC0WXQz5QQ5epyK"); String signature = "hAFO76ZqXmIqosNw3PTAP4wxGJTN7MPawSU0QFDzzNioLjKMEaVFDlNKRIQX6n0DgyoVMy170T0b13P8uUTAQsbk9UNRPFO5i0fWp1hHOhNdaaQ2BdC0WXQz5QQ5epyK"; Long date = new Date().getTime(); String sha256 = encodeBySHA256(signature + JSON.toJSONString(bodyMap) + date); - Map headerMap = new HashMap<>(); - headerMap.put("token", token); - headerMap.put("sign", sha256); - headerMap.put("ts", date); +/* Map headerMap = new HashMap<>(); + headerMap.put("token", token); + headerMap.put("sign", sha256); + headerMap.put("ts", date);*/ //map2.put("sign", sha256); - HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token,sha256 ,date); - //System.out.println(jsonObject.toJSONString()); + JSONObject object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); + System.out.println(JSON.toJSONString(object)); } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index 68c564db..ec8b0a5f 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -30,7 +30,7 @@ public class HighCouponSchedule { * @Date 2021/4/4 22:44 **/ // @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 - @Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行 + //@Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行 public void expiredCoupon() { // 查询过期的卡券 List userCoupons = highUserCouponService.getOverdueCoupon(); diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java index b370a79c..8fd41af8 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java @@ -29,7 +29,7 @@ public class HighDiscountSchedule { * @Description 处理过期的优惠券 * @Date 2021/4/4 22:44 **/ - @Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 + //@Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 public void expiredDiscount() { List expiredDiscount = highDiscountUserRelService.getExpiredDiscount(); for (HighDiscountUserRel rel : expiredDiscount) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 789bef83..9573b7d0 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -33,7 +33,7 @@ public class HighOrderSchedule { * @Description 取消订单 15分钟 * @Date 2021/4/4 22:45 **/ - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + //@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void cancelOrder() { List orderList = highOrderService.getCloseOrder(); if (orderList != null && orderList.size() > 0) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java index ba5bc922..9bbdd083 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java +++ b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java @@ -29,7 +29,7 @@ public class SynchronizeCNPC { private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; - //@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void certification() { Map tokenMap = new HashMap<>(); tokenMap.put("appId", "jsVpwDoHZfR2rrpjhA"); @@ -53,10 +53,10 @@ public class SynchronizeCNPC { Long date = new Date().getTime(); String sha256 = encodeBySHA256(signature + JSON.toJSONString(bodyMap) + date); - Map headerMap = new HashMap<>(); +/* Map headerMap = new HashMap<>(); headerMap.put("token", token); headerMap.put("sign", sha256); - headerMap.put("ts", date); + headerMap.put("ts", date);*/ //map2.put("sign", sha256); JSONObject object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); log.error(object.toJSONString()); diff --git a/hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java b/hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java index a9cd8910..cbf115c6 100644 --- a/hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java +++ b/hai-service/src/main/java/com/hai/common/utils/HttpsUtils.java @@ -317,9 +317,9 @@ public class HttpsUtils { try { HttpPost httpPost = new HttpPost(apiUrl); httpPost.setConfig(requestConfig); - httpPost.setHeader("token", token); - httpPost.setHeader("sign", sign); - httpPost.setHeader("ts", ts.toString()); + //httpPost.setHeader("token", token); + //httpPost.setHeader("sign", sign); + //httpPost.setHeader("ts", ts.toString()); StringEntity stringEntity = new StringEntity(str, "UTF-8");// 解决中文乱码问题 stringEntity.setContentEncoding("UTF-8"); stringEntity.setContentType("application/json");