|
@@ -1,12 +1,16 @@
|
|
|
package com.chuanghai.smartschool.tuitionpayment.controller;
|
|
package com.chuanghai.smartschool.tuitionpayment.controller;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.chuanghai.smartschool.tuitionpayment.common.utils.CommonResult;
|
|
import com.chuanghai.smartschool.tuitionpayment.common.utils.CommonResult;
|
|
|
import com.chuanghai.smartschool.tuitionpayment.config.WechatConfig;
|
|
import com.chuanghai.smartschool.tuitionpayment.config.WechatConfig;
|
|
|
import com.chuanghai.smartschool.tuitionpayment.config.WeixiaoConfig;
|
|
import com.chuanghai.smartschool.tuitionpayment.config.WeixiaoConfig;
|
|
|
-import com.chuanghai.smartschool.tuitionpayment.entity.*;
|
|
|
|
|
|
|
+import com.chuanghai.smartschool.tuitionpayment.entity.PayItem;
|
|
|
|
|
+import com.chuanghai.smartschool.tuitionpayment.entity.PayOrderEntity;
|
|
|
|
|
+import com.chuanghai.smartschool.tuitionpayment.entity.PayableInfoEntity;
|
|
|
|
|
+import com.chuanghai.smartschool.tuitionpayment.entity.PayableInfoWaterEntity;
|
|
|
import com.chuanghai.smartschool.tuitionpayment.service.PayItemService;
|
|
import com.chuanghai.smartschool.tuitionpayment.service.PayItemService;
|
|
|
import com.chuanghai.smartschool.tuitionpayment.service.PayOrderService;
|
|
import com.chuanghai.smartschool.tuitionpayment.service.PayOrderService;
|
|
|
import com.chuanghai.smartschool.tuitionpayment.service.PayableInfoService;
|
|
import com.chuanghai.smartschool.tuitionpayment.service.PayableInfoService;
|
|
@@ -55,7 +59,6 @@ public class WechatController {
|
|
|
* 用于记录用户的access_token
|
|
* 用于记录用户的access_token
|
|
|
*/
|
|
*/
|
|
|
private String accessTokenPublic = "";
|
|
private String accessTokenPublic = "";
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 用于记录催缴的次数 计时器
|
|
* 用于记录催缴的次数 计时器
|
|
|
*/
|
|
*/
|
|
@@ -110,6 +113,7 @@ public class WechatController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 微校授权回调地址
|
|
* 微校授权回调地址
|
|
|
*
|
|
*
|
|
@@ -133,10 +137,6 @@ public class WechatController {
|
|
|
tokenParams.put("grant_type", "authorization_code");
|
|
tokenParams.put("grant_type", "authorization_code");
|
|
|
tokenParams.put("redirect_uri", state); // 该地址需要与发起授权地址保持一直
|
|
tokenParams.put("redirect_uri", state); // 该地址需要与发起授权地址保持一直
|
|
|
|
|
|
|
|
- System.out.println("======");
|
|
|
|
|
- tokenParams.keySet().forEach(key -> System.out.println(tokenParams.get(key)));
|
|
|
|
|
- System.out.println("======");
|
|
|
|
|
-
|
|
|
|
|
try {
|
|
try {
|
|
|
// wecode换取token
|
|
// wecode换取token
|
|
|
RestTemplate client = new RestTemplate();
|
|
RestTemplate client = new RestTemplate();
|
|
@@ -144,12 +144,9 @@ public class WechatController {
|
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
HttpEntity<Map<String, String>> request = new HttpEntity<>(tokenParams, headers);
|
|
HttpEntity<Map<String, String>> request = new HttpEntity<>(tokenParams, headers);
|
|
|
//ResponseEntity<String> tokenResponse = client.postForEntity(tokenUrl, tokenParams, String.class);
|
|
//ResponseEntity<String> tokenResponse = client.postForEntity(tokenUrl, tokenParams, String.class);
|
|
|
- System.out.println("-----------------------------------------------------------");
|
|
|
|
|
|
|
|
|
|
ResponseEntity<String> tokenResponse = client.postForEntity(tokenUrl, request, String.class);
|
|
ResponseEntity<String> tokenResponse = client.postForEntity(tokenUrl, request, String.class);
|
|
|
- // TODO
|
|
|
|
|
|
|
|
|
|
- System.out.println(tokenResponse.getBody());
|
|
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
Map<String, Object> jsonMap = mapper.readValue(tokenResponse.getBody(), new TypeReference<Map<String, Object>>() {
|
|
Map<String, Object> jsonMap = mapper.readValue(tokenResponse.getBody(), new TypeReference<Map<String, Object>>() {
|
|
|
});
|
|
});
|
|
@@ -174,6 +171,8 @@ public class WechatController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// /**
|
|
// /**
|
|
|
// * 查询用户的基本信息
|
|
// * 查询用户的基本信息
|
|
|
// *
|
|
// *
|
|
@@ -244,7 +243,7 @@ public class WechatController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 实现一键通知下发缴费订单功能
|
|
|
|
|
|
|
+ * 实现同步下发缴费订单功能
|
|
|
*
|
|
*
|
|
|
* @param itemName
|
|
* @param itemName
|
|
|
* @return
|
|
* @return
|
|
@@ -275,6 +274,26 @@ public class WechatController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 实现同步下发缴费订单功能
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param jsonObject
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/oneKeyNotice")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public CommonResult<T> oneKeyNotice(@RequestBody JSONObject jsonObject) {
|
|
|
|
|
+ String itemName = jsonObject.get("itemName").toString();
|
|
|
|
|
+ JSONArray cardNumberList = jsonObject.getJSONArray("cardNumberList");
|
|
|
|
|
+ WeixiaoVO weixiaoVO = new WeixiaoVO();
|
|
|
|
|
+ weixiaoVO.setCardNumberList(cardNumberList);
|
|
|
|
|
+ weixiaoVO.setTitle(itemName + "催缴通知");
|
|
|
|
|
+ weixiaoVO.setSender("财务办公室");
|
|
|
|
|
+ weixiaoVO.setContent("同学你好," + weixiaoVO.getTitle() + "缴费已经开始,请尽快查看缴费详情完成缴费,谢谢合作!");
|
|
|
|
|
+ JSONObject json = (JSONObject) JSONObject.toJSON(weixiaoVO);
|
|
|
|
|
+ return notice(json);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* @param jsonObject 封装了发送微校通知的参数信息
|
|
* @param jsonObject 封装了发送微校通知的参数信息
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|