ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/dto/InfoCouponDto.java
@@ -20,6 +20,7 @@ @TableField("name") private String name; private Integer type; private Integer couponId; @ApiModelProperty(value = "优惠方式(1=满减,2=抵扣)") @TableField("preferential_mode") private Integer preferentialMode; ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -639,6 +639,7 @@ InfoCouponDto infoCouponDto = new InfoCouponDto(); BeanUtils.copyProperties(coupon, infoCouponDto); infoCouponDto.setId(tAppCoupon.getId().toString()); infoCouponDto.setCouponId(coupon.getId()); infoCouponDto.setEndTime(tAppCoupon.getEndTime()); couponDtos1.add(infoCouponDto); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WxLoginController.java
@@ -38,6 +38,7 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -64,6 +65,9 @@ private WeixinProperties wxConfig; @Autowired private RestTemplate wxRestTemplate; @Resource private RedisService redisService; /** * 上传文件存储在本地的根路径 */ @@ -77,7 +81,7 @@ @PostMapping("/openIdByJsCode") public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserEncrypteData data) { log.info("<<<<<<<<换取openid开始<<<<<<<<:{}", data.getCode()); WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); Code2SessionRespBody body = appletTools.getOpenIdByJscode2session(new Code2SessionResqBody().build(data.getCode())); String openid = body.getOpenid(); String sessionKey = body.getSessionKey(); @@ -114,7 +118,7 @@ public AjaxResult getQRCode() { InputStream inputStream = null; OutputStream outputStream = null; WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); String accessToken = appletTools.getAccessToken(""); try { String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; @@ -171,7 +175,7 @@ */ @PostMapping("/getWXToken") public R<String> getWXToken(){ WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); String accessToken = appletTools.getAccessToken(""); return R.ok(accessToken); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/wx/tools/WxAppletTools.java
@@ -4,12 +4,14 @@ import com.ruoyi.account.wx.body.resp.Code2SessionRespBody; import com.ruoyi.account.wx.body.resq.Code2SessionResqBody; import com.ruoyi.account.wx.model.WeixinProperties; import com.ruoyi.common.redis.service.RedisService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; import java.text.MessageFormat; import java.util.concurrent.TimeUnit; /** * @author xiaochen @@ -57,11 +59,12 @@ public static String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"; private WeixinProperties wxConfig; private RestTemplate wxRestTemplate; private WxCacheTemplate<String> wxCacheTemplate; private RedisService redisService; public WxAppletTools(RestTemplate wxRestTemplate, WeixinProperties wxConfig) { public WxAppletTools(RestTemplate wxRestTemplate, WeixinProperties wxConfig, RedisService redisService) { this.wxRestTemplate = wxRestTemplate; this.wxConfig = wxConfig; this.redisService = redisService; } /** @@ -101,7 +104,7 @@ * @return */ public String getAccessToken(String version) { String accessToken = wxCacheTemplate.getKey(ACCESSTOKEN_CACHE_KEY + version); String accessToken = redisService.getCacheObject(ACCESSTOKEN_CACHE_KEY + version); if (StringUtils.hasLength(accessToken)) { return accessToken; } @@ -113,7 +116,7 @@ // 抛出错误 throw new WxException(accessTokenRespBody.getErrorCode() + ":" + accessTokenRespBody.getErrorMsg()); } wxCacheTemplate.setKey(ACCESSTOKEN_CACHE_KEY + version, accessTokenRespBody.getAccessToken()); redisService.setCacheObject(ACCESSTOKEN_CACHE_KEY + version, accessTokenRespBody.getAccessToken(), 7200L, TimeUnit.SECONDS); return accessTokenRespBody.getAccessToken(); } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -262,7 +262,7 @@ //调用华为Iot删除设备 if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); if(null != deviceResp && deviceResp.getHttpStatusCode() == 201){ if(null != deviceResp && deviceResp.getHttpStatusCode() == 0){ this.removeById(chargingPile); } } ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/WxPayController.java
@@ -123,7 +123,7 @@ */ @PostMapping("pay/notify") @ApiOperation("订单回调") public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception { public void payNotify(HttpServletRequest request) throws Exception { try { Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {}); log.info("支付回调:{}", params); @@ -147,13 +147,10 @@ break; } wxV3Pay.ack(); return R.ok(params); } catch (Exception e) { log.error("支付回调异常:{}", e, e); wxV3Pay.ack(false, e.getMessage()); return R.fail("回调异常"); } } /**