From 05f53069a91f979ec3d18e0a7abc8ce67c2656b2 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 04 九月 2025 14:35:01 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java index 5b15bbb..73054d3 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralController.java @@ -39,12 +39,11 @@ import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.ApiOperation; +import org.apache.http.HttpResponse; import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ByteArrayResource; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.mock.web.MockMultipartFile; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -205,8 +204,9 @@ try { String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; Map<String, Object> param = new HashMap<>(); +// param.put("scene", "phone=" + phonenumber); param.put("scene", "phone=" + phonenumber+",amount="+amount); - param.put("path", "chargingPile/payMent/payMent"); + param.put("page", "chargingPile/payMent/payMent"); param.put("check_path", false); param.put("env_version", "trial"); param.put("width", 200); //二维码尺寸 @@ -218,12 +218,14 @@ line_color.put("b", 0); param.put("line_color", line_color); System.err.println("调用生成微信URL接口传参:" + param); - MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity requestEntity = new HttpEntity(param, headers); - ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); + ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class); System.err.println("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody()); byte[] result = entity.getBody(); inputStream = new ByteArrayInputStream(result); + //拿到httpResponse后,在获取里面的图片 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); // 最后上传生成的文件名 String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpg"; @@ -287,7 +289,7 @@ Map<String, Object> dataMap = new LinkedHashMap<String, Object>(); // 使用LinkedHashMap保持顺序 dataMap.put("goods_desc", "积分充值"); dataMap.put("huifu_id", "6666000174575407"); - dataMap.put("notify_url", "http://221.182.45.100:8084/other/wx/integralCallback"); + dataMap.put("notify_url", "http://47.120.5.122:8080/other/wx/integralCallback"); dataMap.put("req_date", date.format(new Date())); dataMap.put("req_seq_id", code); dataMap.put("trade_type", "T_MINIAPP"); @@ -401,7 +403,7 @@ Map<String, Object> dataMap = new LinkedHashMap<String, Object>(); // 使用LinkedHashMap保持顺序 dataMap.put("goods_desc", "积分充值"); dataMap.put("huifu_id", "6666000174575407"); - dataMap.put("notify_url", "http://221.182.45.100:8084/other/wx/integralCallback"); + dataMap.put("notify_url", "http://47.120.5.122:8080/other/wx/integralCallback"); dataMap.put("req_date", date.format(new Date())); dataMap.put("req_seq_id", code); dataMap.put("trade_type", "T_MINIAPP"); @@ -488,7 +490,7 @@ Map<String, Object> dataMap = new LinkedHashMap<String, Object>(); // 使用LinkedHashMap保持顺序 dataMap.put("goods_desc", "积分充值"); dataMap.put("huifu_id", "6666000174575407"); - dataMap.put("notify_url", "http://221.182.45.100:8084/other/wx/integralCallback"); + dataMap.put("notify_url", "http://47.120.5.122:8080/other/wx/integralCallback"); dataMap.put("req_date", date.format(new Date())); dataMap.put("req_seq_id", code); dataMap.put("trade_type", "T_JSAPI"); @@ -503,6 +505,7 @@ // 将dataMap转化为json对象 String signStr = JSON.toJSONString(JSONObject.parseObject(JSON.toJSONString(dataMap), TreeMap.class)); + System.out.println("待签名字符串:" + signStr); @@ -614,7 +617,7 @@ if (data != null ) { if (data.getRoleType() == 1) { // 平台 - SysConfig data1 = sysConfigClient.getInfo(8L).getData(); + SysConfig data1 = sysConfigClient.getInfo(10L).getData(); sysConfigClient.update(data1); TIntegralRule tIntegralRule = new TIntegralRule(); tIntegralRule.setChargeCredit("{\"num1\":"+data1.getConfigValue()+"}"); @@ -647,7 +650,7 @@ SysUser data = sysUserClient.getSysUser(userid).getData(); if (data.getRoleType() == 1) { - SysConfig data1 = sysConfigClient.getInfo(8L).getData(); + SysConfig data1 = sysConfigClient.getInfo(10L).getData(); JSONObject jsonObject = JSONObject.parseObject(dto.getChargeCredit()); Integer num1 = jsonObject.getInteger("num1"); data1.setConfigValue(num1.toString()); -- Gitblit v1.7.1