记得上下班打卡 | git大法好,push需谨慎

Commit bd7728ef authored by 胡佳晨's avatar 胡佳晨

Merge remote-tracking branch 'origin/dev' into dev

parents 2ee1433a 10cbfc58
......@@ -224,7 +224,8 @@ public class KylinRefundsStatusServiceImpl {
// 更新数据
// 订单状态表 判断是退到正在退款 已付款 部分退款?(取消,完成,失败)
int newStatus = 0;
Integer[] whereRefundingCount = {KylinTableStatusConst.ORDER_STATUS2, KylinTableStatusConst.ORDER_STATUS4, KylinTableStatusConst.ORDER_STATUS6};
// Integer[] whereRefundingCount = {KylinTableStatusConst.ORDER_STATUS2, KylinTableStatusConst.ORDER_STATUS4, KylinTableStatusConst.ORDER_STATUS6};
Integer[] whereRefundingCount = {KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUNDED, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT};
int refundingCount = kylinOrderRefundsMapper.selectCount(
new QueryWrapper<KylinOrderRefunds>().eq("order_tickets_id", orderTicketsId)
.notIn("status", whereRefundingCount)
......
package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.sweet.utils.WechatSignUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
@Api(tags = "公众号动作回调")
@RestController
@RequestMapping("/actionCallback")
public class SweetActionCallbackController {
@GetMapping("record")
@ApiOperation("get")
public void record(
HttpServletResponse response,
@RequestParam() String signature,
@RequestParam() String timestamp,
@RequestParam() String nonce,
@RequestParam() String echostr
) {
try {
if (WechatSignUtils.checkSignature(signature, timestamp, nonce)) {
PrintWriter out = response.getWriter();
out.print(echostr);
out.close();
} else {
System.out.println("这里存在非法请求!");
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@PostMapping("record")
@ApiOperation("post")
public void record() {
System.out.println("这是post方法!");
}
}
......@@ -53,7 +53,6 @@ public class SweetTemplateServiceImpl {
public ResponseDto send(String templateId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_REMIND_ALL;
Set<String> keys = redisTemplate.keys(redisKey);
Object hkeys = redisUtil.hkeys(redisKey);
if (!CollectionUtils.isEmpty(keys)) {
for (String rkey : keys) {
SweetRemindVo remindInfo = (SweetRemindVo) redisUtil.get(rkey);
......
package com.liquidnet.service.sweet.utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
/**
* <p>
* 微信开发者签名验证
* </p>
*
* @author jiangxiulong
* @since 2021-07-29 3:19 下午
*/
public class WechatSignUtils {
// 与接口配置信息中的 Token 要一致
private static String token = "tftipg1427706847";
/**
* 验证签名
*
* @param signature
* @param timestamp
* @param nonce
* @return
*/
public static boolean checkSignature(String signature, String timestamp, String nonce) {
String[] arr = new String[]{token, timestamp, nonce};
// 将 token、timestamp、nonce 三个参数进行字典序排序
Arrays.sort(arr);
StringBuilder content = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
content.append(arr[i]);
}
MessageDigest md = null;
String tmpStr = null;
try {
md = MessageDigest.getInstance("SHA-1");
// 将三个参数字符串拼接成一个字符串进行 sha1 加密
byte[] digest = md.digest(content.toString().getBytes());
tmpStr = byteToStr(digest);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
content = null;
// 将 sha1 加密后的字符串可与 signature 对比,标识该请求来源于微信
return tmpStr != null ? tmpStr.equals(signature.toUpperCase()) : false;
}
/**
* 将字节数组转换为十六进制字符串
*
* @param byteArray
* @return
*/
private static String byteToStr(byte[] byteArray) {
String strDigest = "";
for (int i = 0; i < byteArray.length; i++) {
strDigest += byteToHexStr(byteArray[i]);
}
return strDigest;
}
/**
* 将字节转换为十六进制字符串
*
* @param mByte
* @return
*/
private static String byteToHexStr(byte mByte) {
char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char[] tempArr = new char[2];
tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
tempArr[1] = Digit[mByte & 0X0F];
String s = new String(tempArr);
return s;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment