From 714b358764bd68d3022a7e9dab8a45ecd0859131 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期六, 24 八月 2024 11:42:31 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile --- ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/controller/WxPayController.java | 6 .gitignore | 3 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 25 + ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/SSLCipherSuiteUtil.java | 209 ++++++++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/filter/AuthFilter.java | 2 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java | 8 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 97 ++++++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 4 ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/RequestParamGlobalFilter.java | 10 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java | 2 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java | 7 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java | 5 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 59 ++++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserSign.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/UnsupportProtocolException.java | 15 + ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WeixinProperties.java | 6 ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java | 18 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java | 2 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java | 5 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java | 5 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java | 5 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TNotice.java | 9 ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java | 2 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/filter/AuthFilter.java | 3 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/Constant.java | 24 + ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java | 11 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInviteUser.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/filter/AuthFilter.java | 11 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/HostName.java | 17 + ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/ISiteService.java | 2 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java | 6 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/CarBrandUtil.java | 120 ++++++++ ruoyi-service/ruoyi-other/pom.xml | 4 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java | 81 ++--- ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InviteInfoDto.java | 12 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java | 14 ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/service/RedisService.java | 8 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml | 4 40 files changed, 711 insertions(+), 118 deletions(-) diff --git a/.gitignore b/.gitignore index 3e7af20..09e64c6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ target *.yaml -*.yml \ No newline at end of file +*.yml +*.log \ No newline at end of file diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InviteInfoDto.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InviteInfoDto.java new file mode 100644 index 0000000..c4ca8f2 --- /dev/null +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InviteInfoDto.java @@ -0,0 +1,12 @@ +package com.ruoyi.account.api.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class InviteInfoDto { + @ApiModelProperty("已获得积分") + private Integer point; + @ApiModelProperty("已邀请人数") + private Integer inviteNum; +} diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java index 20f36a2..76b4263 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserFallbackFactory.java @@ -1,6 +1,7 @@ package com.ruoyi.account.api.factory; import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.model.TAppCoupon; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.dto.PointChangeDto; @@ -37,6 +38,11 @@ } @Override + public R<TAppCoupon> couponGetById(Long id) { + return R.fail("查询优惠券失败:"+throwable.getMessage()); + } + + @Override public R updateAppUser(TAppUser appUser) { return R.fail("修改用户失败:"+throwable.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java index ea7adc9..20c7d65 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java @@ -1,5 +1,6 @@ package com.ruoyi.account.api.feignClient; +import com.ruoyi.account.api.model.TAppCoupon; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.account.api.factory.AppUserFallbackFactory; @@ -37,6 +38,10 @@ */ @PostMapping(value = "/t-app-user/user/getUserById/{id}") R<TAppUser> getUserById(@PathVariable("id") Long id); + + + @PostMapping(value = "/t-app-user/user/coupon/getById") + R<TAppCoupon> couponGetById(@RequestParam("id")Long id); diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserSign.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserSign.java index d386eec..fddfeb5 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserSign.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TAppUserSign.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.web.domain.BasePojo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -39,6 +40,7 @@ @ApiModelProperty(value = "签到天") @TableField("sign_day") + @JsonFormat(pattern = "dd", timezone = "GMT+8") private LocalDate signDay; @ApiModelProperty(value = "奖励积分") diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInviteUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInviteUser.java index 9a62b6f..5e0fe6c 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInviteUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/TInviteUser.java @@ -30,7 +30,7 @@ private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") - @TableId(value = "id", type = IdType.AUTO) + @TableId(value = "id", type = IdType.NONE) private Integer id; @ApiModelProperty(value = "用户id") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java index e0dc45f..1253444 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/OrderFallbackFactory.java @@ -3,6 +3,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.dto.ExchangeDto; import com.ruoyi.order.api.feignClient.OrderClient; +import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.order.api.query.TActivityStatisticsQuery; import com.ruoyi.order.api.vo.TActivityVO; import org.slf4j.Logger; @@ -50,10 +51,15 @@ } @Override - public R<Long> shopCreate(ExchangeDto exchangeDto) { + public R<TShoppingOrder> shopCreate(ExchangeDto exchangeDto) { return R.fail("订单创建" + cause.getMessage()); } + @Override + public R callBack(String code, String outTradeNo) { + return R.fail("支付回调" + cause.getMessage()); + } + @Override public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java index 6e60d80..fc54b0f 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/OrderClient.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.dto.ExchangeDto; import com.ruoyi.order.api.factory.OrderFallbackFactory; +import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.order.api.query.TActivityStatisticsQuery; import com.ruoyi.order.api.vo.TActivityVO; import org.springframework.cloud.openfeign.FeignClient; @@ -35,7 +36,9 @@ @PostMapping("/t-exchange-order/create") public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); @PostMapping("/t-shopping-order/create") - public R<Long> shopCreate(@RequestBody ExchangeDto exchangeDto); + public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto); + @PostMapping("/t-shopping-order/callBack") + public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo); /** * 管理后台 活动费用统计 diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TNotice.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TNotice.java index 72fa6ff..b1023e7 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TNotice.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TNotice.java @@ -12,6 +12,7 @@ import lombok.EqualsAndHashCode; import java.io.Serializable; +import java.time.LocalDate; import java.time.LocalDateTime; /** @@ -40,13 +41,13 @@ @ApiModelProperty(value = "开始时间") @TableField("start_time") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") - private LocalDateTime startTime; + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private LocalDate startTime; @ApiModelProperty(value = "结束时间") @TableField("end_time") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") - private LocalDateTime endTime; + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private LocalDate endTime; diff --git a/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java b/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java index a998845..b9c18a9 100644 --- a/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java +++ b/ruoyi-api/ruoyi-api-payment/src/main/java/com/ruoyi/payment/api/vo/PaymentOrder.java @@ -29,5 +29,5 @@ /** * 回调地址 */ - private String notifyUrl; + private String notifyUrl ="/"; } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java index 29456ee..b736df9 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/dto/ExchangeDto.java @@ -3,6 +3,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; + @Data public class ExchangeDto { @ApiModelProperty("商品id") @@ -26,5 +28,14 @@ @ApiModelProperty("1微信2支付宝") Integer payMethod; + @ApiModelProperty(hidden =true) + BigDecimal orderPrice; + @ApiModelProperty(hidden =true) + BigDecimal payPrice; + @ApiModelProperty(hidden =true) + BigDecimal discountPrice; + @ApiModelProperty(hidden =true) + BigDecimal vipDiscount; + } diff --git a/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/service/RedisService.java b/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/service/RedisService.java index 435cb6e..5d3ad86 100644 --- a/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/service/RedisService.java +++ b/ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/service/RedisService.java @@ -195,6 +195,14 @@ } } + public <T> void setCacheMap(final String key, final Map<String, T> dataMap, long timeout) + { + if (dataMap != null) { + redisTemplate.opsForHash().putAll(key, dataMap); + redisTemplate.expire(key, timeout, TimeUnit.SECONDS); + } + } + /** * 获得缓存的Map * diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java index 0ec1a71..6aa40ff 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java @@ -39,7 +39,7 @@ // 排除过滤的 uri 地址,nacos自行添加 @Autowired private IgnoreWhiteProperties ignoreWhite; - + @Autowired private RedisService redisService; @@ -100,7 +100,7 @@ } private Mono<Void> unauthorizedResponse(ServerWebExchange exchange, String msg) { - log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath()); + log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath() + "\n" + msg); return ServletUtils.webFluxResponseWriter(exchange.getResponse(), msg, HttpStatus.UNAUTHORIZED); } @@ -146,7 +146,7 @@ if(null == cacheMap){ cacheMap = new HashMap<>(); cacheMap.put(url, timestamp); - redisService.setCacheMap(client, cacheMap); + redisService.setCacheMap(client, cacheMap, 5L); }else{ Object o = cacheMap.get(url); if(null == o){ @@ -155,13 +155,13 @@ Long old_timestamp = Long.valueOf(o.toString()); Long new_timestamp = Long.valueOf(timestamp); //两个请求时间差小于1秒,判定为重复提交 - if((new_timestamp - old_timestamp) <= 1000){ + if((new_timestamp - old_timestamp) <= 500){ throw new RuntimeException("重复提交"); }else{ cacheMap.put(url, timestamp); } } - redisService.setCacheMap(client, cacheMap); + redisService.setCacheMap(client, cacheMap, 5L); } } @@ -181,14 +181,8 @@ if (claims == null) { throw new RuntimeException("令牌已过期或验证不正确!"); } -// String userkey = JwtUtils.getUserKey(claims); -// boolean islogin = redisService.hasKey(getTokenKey(userkey)); -// if (!islogin) { -// throw new RuntimeException("登录状态已过期"); -// } String userid = JwtUtils.getUserId(claims); - String username = JwtUtils.getUserName(claims); - if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) { + if (StringUtils.isEmpty(userid)) { throw new RuntimeException("令牌验证失败"); } } diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/RequestParamGlobalFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/RequestParamGlobalFilter.java index e5afdad..0f92100 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/RequestParamGlobalFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/RequestParamGlobalFilter.java @@ -52,13 +52,13 @@ public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest request = exchange.getRequest(); ServerHttpRequest.Builder mutate = request.mutate(); - HttpMethod method = request.getMethod(); - if(method != HttpMethod.POST){ - return chain.filter(exchange.mutate().request(mutate.build()).build()); - } // 跳过不需要验证的路径 String url = request.getURI().getPath(); if (StringUtils.matches(url, ignoreWhite.getWhites())) { + return chain.filter(exchange); + } + HttpMethod method = request.getMethod(); + if(method != HttpMethod.POST){ return chain.filter(exchange); } ServerHttpRequestDecorator httpRequestDecorator = requestDecorator(exchange); @@ -104,6 +104,6 @@ @Override public int getOrder() { - return HIGHEST_PRECEDENCE; + return -500; } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java index 0443f6c..8cfd00d 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java @@ -201,6 +201,8 @@ @PostMapping("/grantCoupon") public R grantCoupon(@RequestBody GrantCouponDto dto){ List<TAppCoupon> res = new ArrayList<>(); + TCoupon coupon = otherClient.getCouponById(dto.getCouponId()).getData(); + switch (dto.getType()){ case 1: // 根据标签ids 查询用户ids @@ -214,6 +216,7 @@ tAppCoupon.setEndTime(dto.getEndTime()); tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); tAppCoupon.setStatus(1); + tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); res.add(tAppCoupon); } tAppCouponService.saveBatch(res); @@ -230,6 +233,7 @@ tAppCoupon.setEndTime(dto.getEndTime()); tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); tAppCoupon.setStatus(1); + tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); res.add(tAppCoupon); } tAppCouponService.saveBatch(res); @@ -242,6 +246,7 @@ tAppCoupon.setEndTime(dto.getEndTime()); tAppCoupon.setWaysToObtain(dto.getWaysToObtain()); tAppCoupon.setStatus(1); + tAppCoupon.setCouponJson(JSON.toJSONString(coupon)); res.add(tAppCoupon); } tAppCouponService.saveBatch(res); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java index 49fd3af..6db28fa 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java @@ -13,6 +13,7 @@ import com.ruoyi.account.service.*; import com.ruoyi.account.util.PointDetailUtil; import com.ruoyi.account.util.SignDayUtil; +import com.ruoyi.account.util.carBrand.CarBrandUtil; import com.ruoyi.account.wx.model.WeixinProperties; import com.ruoyi.account.util.GiveVipUtil; import com.ruoyi.common.core.constant.Constants; @@ -24,6 +25,7 @@ import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.BasePojo; +import com.ruoyi.common.core.web.page.BasePage; import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.auth.AuthUtil; import com.ruoyi.common.security.service.TokenService; @@ -110,6 +112,8 @@ @Resource private VipClient vipClient; + @Resource + private TInviteUserService inviteUserService; @@ -518,6 +522,13 @@ } + @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) + @PostMapping(value = "/user/coupon/getById") + public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { + TAppCoupon appCoupon = appCouponService.getById(id); + return R.ok(appCoupon); + } + @ApiOperation(value = "赠送会员", tags = {"用户管理-用户列表"}) @@ -539,13 +550,38 @@ } //增加vipDetail giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay); - - appUserService.updateById(nowUser); - //执行一次赠送优惠卷的定时任务 } return R.ok(); } + + @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) + @PostMapping(value = "/user/invite/page") + public R<Page<TInviteUser>> invitePage(@RequestBody BasePage basePage) { + Long userId = tokenService.getLoginUserApplet().getUserId(); + + Page<TInviteUser> page = inviteUserService.lambdaQuery().eq(TInviteUser::getAppUserId, userId).isNotNull(TInviteUser::getAward).orderByDesc(TInviteUser::getCreateTime).page(Page.of(basePage.getPageCurr(), basePage.getPageSize())); + return R.ok(page); + } + + @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) + @PostMapping(value = "/user/invite/info") + public R<InviteInfoDto> inviteInfo() { + Long userId = tokenService.getLoginUserApplet().getUserId(); + Integer point = 0; + List<TInviteUser> list = inviteUserService.lambdaQuery().eq(TInviteUser::getAppUserId, userId).isNotNull(TInviteUser::getAward).orderByDesc(TInviteUser::getCreateTime).list(); + for (TInviteUser tInviteUser : list) { + point = point +tInviteUser.getAward(); + } + InviteInfoDto inviteInfoDto = new InviteInfoDto(); + inviteInfoDto.setPoint(point); + inviteInfoDto.setInviteNum(list.size()); + + + return R.ok(inviteInfoDto); + } + + @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) @PostMapping(value = "/user/updatePhone") @@ -766,5 +802,22 @@ return R.ok(); } + + @ApiOperation(value = "获取车辆品牌", tags = {"小程序-个人中心-车辆"}) + @GetMapping(value = "/user/car/getBrands") + public R getBrands(String name) throws Exception { + String brand = CarBrandUtil.getBrand(); + JSONObject jsonObject = JSON.parseObject(brand); + JSONArray data = jsonObject.getJSONArray("data"); + return R.ok(data); + + } + + @ApiOperation(value = "根据品牌获取车型", tags = {"小程序-个人中心-车辆"}) + @GetMapping(value = "/user/car/getModel") + public R getModel(String id) throws Exception { + String modelById = CarBrandUtil.getModelById(id); + return R.ok(modelById); + } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/filter/AuthFilter.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/filter/AuthFilter.java index 494fa29..a529a5f 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/filter/AuthFilter.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/filter/AuthFilter.java @@ -1,16 +1,13 @@ package com.ruoyi.account.filter; import com.alibaba.fastjson.JSON; -import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.account.service.TAppUserService; import com.ruoyi.common.core.constant.TokenConstants; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.utils.JwtUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; -import io.jsonwebtoken.Claims; import org.apache.logging.log4j.core.config.Order; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,16 +32,16 @@ @Component public class AuthFilter implements Filter { private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); - + @Lazy @Resource private TAppUserService appUserService; - + @Lazy @Resource private SysUserClient sysUserClient; - - + + @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java index a20ac1c..e5fdd18 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java @@ -78,7 +78,7 @@ }else { - nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay)); + nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay).minusDays(1)); //获取detail里结束时间大于当前时间的数据,并将enttime延长 TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/CarBrandUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/CarBrandUtil.java new file mode 100644 index 0000000..350cca0 --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/CarBrandUtil.java @@ -0,0 +1,120 @@ +package com.ruoyi.account.util.carBrand; + +import com.cloud.apigateway.sdk.utils.Client; +import com.cloud.apigateway.sdk.utils.Request; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CarBrandUtil { + private static final Logger LOGGER = LoggerFactory.getLogger(CarBrandUtil.class); + public static String getBrand() throws Exception { + // Create a new request. + Request httpClientRequest = new Request(); + try { + // Set the request parameters. + // AppKey, AppSecrect, Method and Url are required parameters. + // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. + // In this example, the AK/SK are stored in environment variables for identity authentication. + // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. + httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec"); + httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47"); + httpClientRequest.setMethod("POST"); + // Set a request URL in the format of https://{Endpoint}/{URI}. + httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/brand"); + httpClientRequest.addHeader("Content-Type", "text/plain"); + // Set a body for http request. +// httpClientRequest.setBody("put your request body here"); + } catch (Exception e) { +// LOGGER.error(e.getMessage()); + return ""; + } + CloseableHttpClient client = null; + try { + // Sign the request. + HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); + if (Constant.DO_VERIFY) { + // creat httpClient and verify ssl certificate + HostName.setUrlHostName(httpClientRequest.getHost()); + client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL); + } else { + // creat httpClient and do not verify ssl certificate + client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL); + } + HttpResponse response = client.execute(signedRequest); + // Print the body of the response. + HttpEntity resEntity = response.getEntity(); + if (resEntity != null) { +// LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"), +// EntityUtils.toString(resEntity, "UTF-8")); + String string = EntityUtils.toString(resEntity, "UTF-8"); + return string; + } + } catch (Exception e) { + LOGGER.error(e.getMessage()); + } finally { + if (client != null) { + client.close(); + } + } + return ""; + } + + + public static String getModelById(String brandId) throws Exception { + // Create a new request. + Request httpClientRequest = new Request(); + try { + // Set the request parameters. + // AppKey, AppSecrect, Method and Url are required parameters. + // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. + // In this example, the AK/SK are stored in environment variables for identity authentication. + // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. + httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec"); + httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47"); + httpClientRequest.setMethod("POST"); + // Set a request URL in the format of https://{Endpoint}/{URI}. + httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/series"); + httpClientRequest.addHeader("Content-Type", "text/plain"); + httpClientRequest.addQueryStringParam("brandId",brandId); + // Set a body for http request. +// httpClientRequest.setBody("put your request body here"); + } catch (Exception e) { +// LOGGER.error(e.getMessage()); + return ""; + } + CloseableHttpClient client = null; + try { + // Sign the request. + HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); + if (Constant.DO_VERIFY) { + // creat httpClient and verify ssl certificate + HostName.setUrlHostName(httpClientRequest.getHost()); + client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL); + } else { + // creat httpClient and do not verify ssl certificate + client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL); + } + HttpResponse response = client.execute(signedRequest); + // Print the body of the response. + HttpEntity resEntity = response.getEntity(); + if (resEntity != null) { +// LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"), +// EntityUtils.toString(resEntity, "UTF-8")); + String string = EntityUtils.toString(resEntity, "UTF-8"); + return string; + } + } catch (Exception e) { + LOGGER.error(e.getMessage()); + } finally { + if (client != null) { + client.close(); + } + } + return ""; + } +} diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/Constant.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/Constant.java new file mode 100644 index 0000000..a1a8941 --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/Constant.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2023. All rights reserved. + */ + +package com.ruoyi.account.util.carBrand; + +public final class Constant { + // verify ssl certificate (true) or do not verify (false) + public static final boolean DO_VERIFY = false; + + public static final String HTTPS = "HTTPS"; + public static final String TRUST_MANAGER_FACTORY = "SunX509"; + public static final String GM_PROTOCOL = "GMTLS"; + public static final String INTERNATIONAL_PROTOCOL = "TLSv1.2"; + public static final String SIGNATURE_ALGORITHM_SDK_HMAC_SHA256 = "SDK-HMAC-SHA256"; + public static final String SIGNATURE_ALGORITHM_SDK_HMAC_SM3 = "SDK-HMAC-SM3"; + public static final String[] SUPPORTED_CIPHER_SUITES = {"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", + "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"}; + public static final String SECURE_RANDOM_ALGORITHM_NATIVE_PRNG_NON_BLOCKING = "NativePRNGNonBlocking"; + + private Constant() { + } +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/HostName.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/HostName.java new file mode 100644 index 0000000..76c30ce --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/HostName.java @@ -0,0 +1,17 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ + +package com.ruoyi.account.util.carBrand; + +public class HostName { + private static String urlHostName; + + public static void setUrlHostName(String hostName) { + urlHostName = hostName; + } + + public static boolean checkHostName(String SSLHostName) { + return urlHostName.equals(SSLHostName); + } +} diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/SSLCipherSuiteUtil.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/SSLCipherSuiteUtil.java new file mode 100644 index 0000000..2fe11fb --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/SSLCipherSuiteUtil.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2023. All rights reserved. + */ + +package com.ruoyi.account.util.carBrand; + +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.bouncycastle.crypto.BlockCipher; +import org.bouncycastle.crypto.engines.AESEngine; +import org.bouncycastle.crypto.prng.SP800SecureRandomBuilder; +import org.openeuler.BGMProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import okhttp3.OkHttpClient; + +import javax.net.ssl.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.*; +import java.security.cert.X509Certificate; +import java.util.Locale; +import java.util.concurrent.TimeUnit; + +public class SSLCipherSuiteUtil { + private static final Logger LOGGER = LoggerFactory.getLogger(SSLCipherSuiteUtil.class); + private static CloseableHttpClient httpClient; + private static OkHttpClient okHttpClient; + + private static final int CIPHER_LEN = 256; + + private static final int ENTROPY_BITS_REQUIRED = 384; + + public static HttpClient createHttpClient(String protocol) throws Exception { + SSLContext sslContext = getSslContext(protocol); + // create factory + SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, + new String[]{protocol}, Constant.SUPPORTED_CIPHER_SUITES, new TrustAllHostnameVerifier()); + + httpClient = HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build(); + return httpClient; + } + + public static HttpClient createHttpClientWithVerify(String protocol) throws Exception { + SSLContext sslContext = getSslContextWithVerify(protocol); + // create factory + SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, + new String[] {protocol}, Constant.SUPPORTED_CIPHER_SUITES, new TheRealHostnameVerifier()); + + httpClient = HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build(); + return httpClient; + } + + public static OkHttpClient createOkHttpClient(String protocol) throws Exception { + SSLContext sslContext = getSslContext(protocol); + // Create an ssl socket factory with our all-trusting manager + SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); + OkHttpClient.Builder builder = new OkHttpClient.Builder() + .sslSocketFactory(sslSocketFactory, new TrustAllManager()) + .hostnameVerifier(new TrustAllHostnameVerifier()); + okHttpClient = builder.connectTimeout(10, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).build(); + return okHttpClient; + } + + public static OkHttpClient createOkHttpClientWithVerify(String protocol) throws Exception { + SSLContext sslContext = getSslContextWithVerify(protocol); + SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); + + TrustManagerFactory tmf = TrustManagerFactory.getInstance(Constant.TRUST_MANAGER_FACTORY); + tmf.init((KeyStore) null); + TrustManager[] verify = tmf.getTrustManagers(); + OkHttpClient.Builder builder = new OkHttpClient.Builder().sslSocketFactory(sslSocketFactory, + (X509TrustManager) verify[0]).hostnameVerifier(new TheRealHostnameVerifier()); + + okHttpClient = builder.connectTimeout(10, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).build(); + return okHttpClient; + } + + public static HttpURLConnection createHttpsOrHttpURLConnection(URL uUrl, String protocol) throws Exception { + // initial connection + if (uUrl.getProtocol().toUpperCase(Locale.getDefault()).equals(Constant.HTTPS)) { + SSLContext sslContext = getSslContext(protocol); + HttpsURLConnection.setDefaultHostnameVerifier(new TrustAllHostnameVerifier()); + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); + return (HttpsURLConnection) uUrl.openConnection(); + } + return (HttpURLConnection) uUrl.openConnection(); + } + + public static HttpURLConnection createHttpsOrHttpURLConnectionWithVerify(URL uUrl, String protocol) throws Exception { + // initial connection + if (uUrl.getProtocol().toUpperCase(Locale.getDefault()).equals(Constant.HTTPS)) { + SSLContext sslContext = getSslContextWithVerify(protocol); + HttpsURLConnection.setDefaultHostnameVerifier(new TheRealHostnameVerifier()); + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); + return (HttpsURLConnection) uUrl.openConnection(); + } + return (HttpURLConnection) uUrl.openConnection(); + } + + private static SSLContext getSslContext(String protocol) throws UnsupportProtocolException, + NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException { + if (!Constant.GM_PROTOCOL.equals(protocol) && !Constant.INTERNATIONAL_PROTOCOL.equals(protocol)) { + LOGGER.info("Unsupport protocol: {}, Only support GMTLS TLSv1.2", protocol); + throw new UnsupportProtocolException("Unsupport protocol, Only support GMTLS TLSv1.2"); + } + // Create a trust manager that does not validate certificate chains + TrustAllManager[] trust = {new TrustAllManager()}; + KeyManager[] kms = null; + SSLContext sslContext; + + sslContext = SSLContext.getInstance(Constant.INTERNATIONAL_PROTOCOL, "SunJSSE"); + + if (Constant.GM_PROTOCOL.equals(protocol)) { + Security.insertProviderAt(new BGMProvider(), 1); + sslContext = SSLContext.getInstance(Constant.GM_PROTOCOL, "BGMProvider"); + } + SecureRandom secureRandom = getSecureRandom(); + sslContext.init(kms, trust, secureRandom); + sslContext.getServerSessionContext().setSessionCacheSize(8192); + sslContext.getServerSessionContext().setSessionTimeout(3600); + return sslContext; + } + + private static SSLContext getSslContextWithVerify(String protocol) + throws UnsupportProtocolException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException, + KeyStoreException { + if (!Constant.GM_PROTOCOL.equals(protocol) && !Constant.INTERNATIONAL_PROTOCOL.equals(protocol)) { + LOGGER.info("Unsupport protocol: {}, Only support GMTLS TLSv1.2", protocol); + throw new UnsupportProtocolException("Unsupport protocol, Only support GMTLS TLSv1.2"); + } + KeyManager[] kms = null; + SSLContext sslContext = SSLContext.getInstance(Constant.INTERNATIONAL_PROTOCOL, "SunJSSE"); + SecureRandom secureRandom = getSecureRandom(); + + if (Constant.GM_PROTOCOL.equals(protocol)) { + Security.insertProviderAt(new BGMProvider(), 1); + sslContext = SSLContext.getInstance(Constant.GM_PROTOCOL, "BGMProvider"); + } + + TrustManagerFactory tmf = TrustManagerFactory.getInstance(Constant.TRUST_MANAGER_FACTORY); + tmf.init((KeyStore) null); + TrustManager[] verify = tmf.getTrustManagers(); + sslContext.init(kms, verify, secureRandom); + + sslContext.getServerSessionContext().setSessionCacheSize(8192); + sslContext.getServerSessionContext().setSessionTimeout(3600); + return sslContext; + } + + // 不校验域名 + private static class TrustAllHostnameVerifier implements HostnameVerifier { + public boolean verify(String hostname, SSLSession session) { + return true; + } + } + + // 校验域名 + private static class TheRealHostnameVerifier implements HostnameVerifier { + public boolean verify(String hostname, SSLSession session) { + if (HostName.checkHostName(hostname)) { + return true; + } else { + HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier(); + return hv.verify(hostname, session); + } + } + } + + // 不校验服务端证书 + private static class TrustAllManager implements X509TrustManager { + private X509Certificate[] issuers; + + public TrustAllManager() { + this.issuers = new X509Certificate[0]; + } + + public X509Certificate[] getAcceptedIssuers() { + return issuers; + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + } + + private static SecureRandom getSecureRandom() { + SecureRandom source; + try { + source = SecureRandom.getInstance(Constant.SECURE_RANDOM_ALGORITHM_NATIVE_PRNG_NON_BLOCKING); + } catch (NoSuchAlgorithmException e) { + try { + source = SecureRandom.getInstanceStrong(); + } catch (NoSuchAlgorithmException ex) { + LOGGER.error("get SecureRandom failed", e); + throw new RuntimeException("get SecureRandom failed"); + } + } + boolean predictionResistant = true; + BlockCipher cipher = new AESEngine(); + boolean reSeed = false; + return new SP800SecureRandomBuilder(source, predictionResistant).setEntropyBitsRequired( + ENTROPY_BITS_REQUIRED).buildCTR(cipher, CIPHER_LEN, null, reSeed); + } +} \ No newline at end of file diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/UnsupportProtocolException.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/UnsupportProtocolException.java new file mode 100644 index 0000000..033d2e3 --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/carBrand/UnsupportProtocolException.java @@ -0,0 +1,15 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. + */ + +package com.ruoyi.account.util.carBrand; + +public class UnsupportProtocolException extends Exception { + private static final long serialVersionUID = 4312820110480855928L; + private String msgDes; // 异常对应的描述信息 + + public UnsupportProtocolException(String message) { + super(message); + msgDes = message; + } +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java index 34a893d..c0352fe 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/SiteController.java @@ -14,6 +14,7 @@ import com.ruoyi.chargingPile.service.*; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.GeodesyUtil; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.utils.SecurityUtils; @@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.time.LocalTime; import java.util.*; @@ -122,8 +124,9 @@ } @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理-首页"}) @PostMapping("/pageList") - public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query){ - return AjaxResult.success(siteService.pageList(query)); + public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query, HttpServletRequest request){ + int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; + return AjaxResult.success(siteService.pageList(query,isLogin)); } @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/filter/AuthFilter.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/filter/AuthFilter.java index 7383d16..467e29a 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/filter/AuthFilter.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/filter/AuthFilter.java @@ -5,11 +5,9 @@ import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.constant.TokenConstants; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.utils.JwtUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; -import io.jsonwebtoken.Claims; import org.apache.logging.log4j.core.config.Order; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,7 +23,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; /** * @author zhibing.pu diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/ISiteService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/ISiteService.java index e96f7e3..b24a0eb 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/ISiteService.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/ISiteService.java @@ -67,7 +67,7 @@ * @return */ - PageInfo<SiteVO> pageList(SiteQuery query); + PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin); /** * 获取站点详情 diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java index e483d89..1a3a90f 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/SiteServiceImpl.java @@ -19,6 +19,7 @@ import com.ruoyi.chargingPile.service.ISiteService; import com.ruoyi.chargingPile.service.TChargingGunService; import com.ruoyi.chargingPile.service.TChargingPileService; +import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; @@ -224,11 +225,14 @@ } @Override - public PageInfo<SiteVO> pageList(SiteQuery query) { - // 获取当前登录用户id - Long userId = tokenService.getLoginUserApplet().getUserId(); - // 根据id查询用户信息 - TAppUser appUser = appUserClient.getUserById(userId).getData(); + public PageInfo<SiteVO> pageList(SiteQuery query,Integer isLogin) { + TAppUser appUser = null; + if(isLogin == 1){ + // 获取当前登录用户id + Long userId = tokenService.getLoginUserApplet().getUserId(); + // 根据id查询用户信息 + appUser = appUserClient.getUserById(userId).getData(); + } PageInfo<SiteVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); List<SiteVO> list = this.baseMapper.pageList(query,pageInfo); if(Objects.nonNull(appUser) && Objects.nonNull(appUser.getVipId())){ diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java index e7f11c8..10749fc 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java @@ -53,8 +53,6 @@ private PlatformRestartService platformRestartService; @Autowired private PlatformRemoteUpdateService platformRemoteUpdateService; - @Autowired - private MessageConvertUtil messageConvertUtil; /** * 登录认证应答 diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java index 5b448ec..01c381a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TShoppingOrderController.java @@ -88,47 +88,44 @@ return AjaxResult.success(list); } -// @PostMapping("/create") -// public R<Long> shopCreate(@RequestBody ExchangeDto exchangeDto){ -// TShoppingOrder shoppingOrder = new TShoppingOrder(); -// shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); -// shoppingOrder.setAppUserId(exchangeDto.getUserId()); -// shoppingOrder.setOrderType(exchangeDto.getGoodType()); -// if (exchangeDto.getGoodType()==1) { -// shoppingOrder.setGoodsId(exchangeDto.getGoodId()); -// }else { -// shoppingOrder.setCouponId(exchangeDto.getGoodId()); -// } -// shoppingOrder.setPurchaseQuantity(exchangeDto.getNum()); -// shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); -// shoppingOrder.setOrderAmount(new BigDecimal("0")); -// shoppingOrder.setAppCouponId(0L); -// shoppingOrder.setCouponDiscountAmount(new BigDecimal("0")); -// shoppingOrder.setVipDiscount(new BigDecimal("0")); -// shoppingOrder.setVipDiscountAmount(new BigDecimal("0")); -// shoppingOrder.setPaymentAmount(new BigDecimal("0")); -// shoppingOrder.setPaymentStatus(0); -// shoppingOrder.setPaymentType(0); -// shoppingOrder.setSerialNumber(""); -// shoppingOrder.setRemark(""); -// shoppingOrder.setStatus(0); -// shoppingOrder.setExpressCompany(""); -// shoppingOrder.setExpressNumber(""); -// shoppingOrder.setConsignerId(0); -// shoppingOrder.setConsignerTime(LocalDateTime.now()); -// shoppingOrder.setReceivingTime(LocalDateTime.now()); -// shoppingOrder.setCancellationTime(LocalDateTime.now()); -// shoppingOrder.setCancellationId(0); -// shoppingOrder.setRefundCode(""); -// shoppingOrder.setRefundAmount(new BigDecimal("0")); -// shoppingOrder.setRefundStatus(0); -// shoppingOrder.setRefundSerialNumber(""); -// shoppingOrder.setRefundTime(LocalDateTime.now()); -// shoppingOrder.setCreateTime(LocalDateTime.now()); -// shoppingOrder.setDelFlag(false); -// -// -// -// } + @PostMapping("/create") + public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto){ + TShoppingOrder shoppingOrder = new TShoppingOrder(); + shoppingOrder.setCode(OrderCodeUtil.getOrderCode("GW")); + shoppingOrder.setAppUserId(exchangeDto.getUserId()); + shoppingOrder.setOrderType(exchangeDto.getGoodType()); + if (exchangeDto.getGoodType()==1) { + shoppingOrder.setGoodsId(exchangeDto.getGoodId()); + }else { + shoppingOrder.setCouponId(exchangeDto.getGoodId()); + } + shoppingOrder.setPurchaseQuantity(exchangeDto.getNum()); + shoppingOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); + shoppingOrder.setOrderAmount(exchangeDto.getOrderPrice()); + if (exchangeDto.getCouponId()!=null) { + shoppingOrder.setAppCouponId(exchangeDto.getCouponId()); + } + shoppingOrder.setCouponDiscountAmount(exchangeDto.getDiscountPrice()); + shoppingOrder.setVipDiscount(new BigDecimal("0")); + shoppingOrder.setVipDiscountAmount(exchangeDto.getVipDiscount()); + shoppingOrder.setPaymentAmount(exchangeDto.getPayPrice()); + shoppingOrder.setPaymentStatus(1); + shoppingOrder.setPaymentType(exchangeDto.getPayMethod()); + shoppingOrder.setRemark(exchangeDto.getRemark()); + shoppingOrder.setStatus(1); + shoppingOrder.setCreateTime(LocalDateTime.now()); + shoppingOrder.setDelFlag(false); + shoppingOrderService.save(shoppingOrder); + + return R.ok(shoppingOrder); + + } + + @PostMapping("/callBack") + public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo){ + shoppingOrderService.callBack(code,outTradeNo); + return R.ok(); + + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/filter/AuthFilter.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/filter/AuthFilter.java index 9702f6d..6d39f09 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/filter/AuthFilter.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/filter/AuthFilter.java @@ -5,11 +5,9 @@ import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.constant.TokenConstants; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.utils.JwtUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; -import io.jsonwebtoken.Claims; import org.apache.logging.log4j.core.config.Order; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java index c503367..70a4616 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TShoppingOrderService.java @@ -59,4 +59,6 @@ * @return */ List<MyShoppingOrderList> getNoInvoicedOrder(GetNoInvoicedOrder query); + + void callBack(String code,String outTradeNo); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java index b809d8f..172dd2f 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java @@ -1,7 +1,10 @@ package com.ruoyi.order.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.account.api.dto.GrantCouponDto; +import com.ruoyi.account.api.feignClient.AppCouponClient; import com.ruoyi.account.api.feignClient.AppUserAddressClient; import com.ruoyi.account.api.model.TAppUserAddress; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -24,6 +27,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; @@ -50,6 +54,8 @@ @Resource private AppUserAddressClient appUserAddressClient; + @Resource + private AppCouponClient appCouponClient; @@ -309,4 +315,23 @@ } return pageList; } + + @Override + public void callBack(String code,String outTradeNo) { + //改变订单状态 + TShoppingOrder shoppingOrder = this.baseMapper.selectOne(Wrappers.lambdaQuery(TShoppingOrder.class).eq(TShoppingOrder::getCode, code)); + shoppingOrder.setPaymentStatus(2); + shoppingOrder.setSerialNumber(outTradeNo); + this.updateById(shoppingOrder); + //如果是优惠券,赠送优惠券 + if (shoppingOrder.getOrderType()==2){ + GrantCouponDto grantCouponDto = new GrantCouponDto(); + grantCouponDto.setType(3); + grantCouponDto.setUserIds(String.valueOf(shoppingOrder.getAppUserId())); + grantCouponDto.setCouponId(shoppingOrder.getCouponId()); + grantCouponDto.setWaysToObtain(2); + grantCouponDto.setEndTime(LocalDateTime.now()); + appCouponClient.grantCoupon(grantCouponDto); + } + } } diff --git a/ruoyi-service/ruoyi-other/pom.xml b/ruoyi-service/ruoyi-other/pom.xml index a44ba7c..0944dbe 100644 --- a/ruoyi-service/ruoyi-other/pom.xml +++ b/ruoyi-service/ruoyi-other/pom.xml @@ -131,6 +131,10 @@ <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> </dependency> + <dependency> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi-api-payment</artifactId> + </dependency> </dependencies> <build> diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 14de43b..3e7d414 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -1,10 +1,13 @@ package com.ruoyi.other.controller; +import java.math.BigDecimal; import java.time.LocalDateTime; +import com.alibaba.fastjson.JSON; import com.ruoyi.account.api.dto.GrantCouponDto; import com.ruoyi.account.api.feignClient.AppCouponClient; import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.model.TAppCoupon; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.dto.AppGoodQuery; @@ -14,6 +17,7 @@ import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.api.feignClient.OrderClient; +import com.ruoyi.order.api.model.TShoppingOrder; import com.ruoyi.other.api.domain.TCoupon; import com.ruoyi.other.api.domain.TGoods; import com.ruoyi.common.core.dto.ExchangeDto; @@ -22,12 +26,16 @@ import com.ruoyi.other.service.TActivityService; import com.ruoyi.other.service.TCouponService; import com.ruoyi.other.service.TGoodsService; +import com.ruoyi.payment.api.feignClient.WxPaymentClient; +import com.ruoyi.payment.api.vo.PaymentOrder; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.swing.*; import java.util.Arrays; +import java.util.Map; /** * <p> @@ -44,6 +52,7 @@ private TGoodsService goodsService; @Autowired private TActivityService activityService; + @Resource private TokenService tokenService; @Resource @@ -54,6 +63,9 @@ private AppCouponClient appCouponClient; @Resource private TCouponService couponService; + @Resource + private WxPaymentClient wxPaymentClient; + @@ -159,19 +171,78 @@ } -// @ApiOperation(tags = {"小程序-兑换商城"},value = "支付商品") -// @PostMapping(value = "/app/pay") -// public AjaxResult<PageInfo<TGoods>> pay(@RequestBody ExchangeDto exchangeDto) { -// -// //创建订单 -// -// //计算价格 -// -// //调起支付 -// -// -// -// } + @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品") + @PostMapping(value = "/app/pay") + public R<Map<String, Object>> pay(@RequestBody ExchangeDto exchangeDto) { + Long userId = tokenService.getLoginUserApplet().getUserId(); + TAppUser user = appUserClient.getUserById(userId).getData(); + boolean isVip = false; + if (user.getVipEndTime().isAfter(LocalDateTime.now())){ + isVip = true; + } + //计算价格 + BigDecimal orderPrice = new BigDecimal(0); + BigDecimal payPrice = new BigDecimal(0); + BigDecimal discountPrice = new BigDecimal(0); + BigDecimal vipDiscount = new BigDecimal(0); + if (exchangeDto.getGoodType()==1){ + TGoods good = goodsService.getById(exchangeDto.getGoodId()); + BigDecimal originalPrice = good.getPreferentialPrice(); + if (isVip){ + if (good.getVipPrice()!=null){ + vipDiscount = originalPrice.subtract(good.getVipPrice()).multiply(BigDecimal.valueOf(exchangeDto.getNum())); + originalPrice = good.getVipPrice(); + } + } + orderPrice.add(originalPrice.multiply(BigDecimal.valueOf(exchangeDto.getNum()))); + }else { + TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); + BigDecimal originalPrice = coupon.getPaymentAmount(); + if (isVip){ + if (coupon.getVipPaymentAmount()!=null) { + vipDiscount = originalPrice.subtract(coupon.getVipPaymentAmount()).multiply(BigDecimal.valueOf(exchangeDto.getNum())); + originalPrice = coupon.getVipPaymentAmount(); + } + } + orderPrice.add(originalPrice); + } + + exchangeDto.setOrderPrice(orderPrice); + //查看是否使用优惠券 + if(exchangeDto.getCouponId()!=null) { + TAppCoupon appCoupon = appUserClient.couponGetById(exchangeDto.getCouponId()).getData(); + TCoupon coupon = JSON.toJavaObject(JSON.parseObject(appCoupon.getCouponJson()), TCoupon.class); + if (coupon.getValidityPeriodMode()==1){ + if (orderPrice.compareTo(coupon.getMeetTheConditions())<0){ + return R.fail("不满足使用优惠券条件"); + } + + } + payPrice = orderPrice.subtract(coupon.getDiscountAmount()); + discountPrice = coupon.getDiscountAmount(); + } + exchangeDto.setPayPrice(payPrice); + exchangeDto.setDiscountPrice(discountPrice); + exchangeDto.setVipDiscount(vipDiscount); + //创建订单 + TShoppingOrder shopOrder = orderClient.shopCreate(exchangeDto).getData(); + if (exchangeDto.getPayMethod()==1) { + //调起支付 + PaymentOrder paymentOrder = new PaymentOrder(); + paymentOrder.setCode(shopOrder.getCode()); + paymentOrder.setAmount(shopOrder.getPaymentAmount()); + paymentOrder.setOpenId(user.getWxOpenid()); + paymentOrder.setDescription("购买商品"); + return wxPaymentClient.orderPay(paymentOrder); + }else { + //todo 罗 支付宝支付 + return R.ok(); + } + + + + + } /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java index 06ecd0f..4c66c0e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TNoticeController.java @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @@ -86,8 +87,8 @@ @GetMapping(value = "/list") public AjaxResult<List<TNotice>> list() { return AjaxResult.success(noticeService.list(Wrappers.lambdaQuery(TNotice.class) - .ge(TNotice::getStartTime, LocalDateTime.now()) - .le(TNotice::getEndTime,LocalDateTime.now()))); + .le(TNotice::getStartTime, LocalDate.now()) + .ge(TNotice::getEndTime,LocalDate.now()))); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java index 1797317..e0a0fae 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java @@ -130,7 +130,7 @@ .last("LIMIT 1"))); case 2: return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) - .eq(TVip::getReveal,1) + .eq(TVip::getReveal,1).eq(TVip::getType,1) .orderByAsc(TVip::getMonthlyCard) .last("LIMIT 1"))); default: @@ -144,7 +144,7 @@ @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"}) @PostMapping("/vipInfo") - public AjaxResult vipInfo() { + public AjaxResult<VipInfoDto> vipInfo() { List<VipInfoDto> vipInfoDtos = new ArrayList<>(); List<TVip> vips = vipService.lambdaQuery().eq(TVip::getReveal, 1).list(); for (TVip vip : vips) { diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java index 5fab005..d1e25ba 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/filter/AuthFilter.java @@ -5,11 +5,9 @@ import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.common.core.constant.TokenConstants; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.utils.JwtUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; -import io.jsonwebtoken.Claims; import org.apache.logging.log4j.core.config.Order; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml index 4c7d61e..417dd0b 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TGoodsMapper.xml @@ -52,13 +52,13 @@ <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> SELECT - id,name,redeem_points,inventory + id,name,redeem_points,inventory,original_price,preferential_price,vip_price FROM t_goods WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} UNION ALL SELECT - id,name,redeem_points,inventory_quantity as inventory + id,name,redeem_points,inventory_quantity as inventory,payment_amount as preferential_price,vip_payment_amount as vip_price FROM t_coupon WHERE `status`= 1 and del_flag = 0 and type = #{appGoodQuery.type} diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/controller/WxPayController.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/controller/WxPayController.java index f3e7274..6047049 100644 --- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/controller/WxPayController.java +++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/controller/WxPayController.java @@ -87,17 +87,17 @@ public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception { try { Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {}); + log.info("支付回调:{}", params); String outRefundNo = (String) params.get("out_refund_no"); + String out_trade_no = params.get("out_trade_no").toString(); String substring = outRefundNo.substring(0, 2); switch (substring){ //购物订单 case "GW": - //更改订单状态 - //如果是优惠卷赠送优惠卷 + break; } - log.info("支付回调:{}", params); return R.ok(params); } catch (Exception e) { log.error("支付回调异常:{}", e, e); diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WeixinProperties.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WeixinProperties.java index 5c1960b..058480d 100644 --- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WeixinProperties.java +++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WeixinProperties.java @@ -1,5 +1,6 @@ package com.ruoyi.payment.wx.model; +import lombok.Data; import lombok.ToString; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; @@ -13,6 +14,7 @@ @ToString @Component @ConfigurationProperties(prefix = "wx.conf") +@Data public class WeixinProperties { /** * 默认开启 @@ -37,6 +39,10 @@ * @return secret ID */ private String secretId; + /** + * 回调地址 + */ + private String callBackUrl; public String getSecretId() { return secretId; -- Gitblit v1.7.1