Commit 3ccfdb09 by 吕明尚

修改售货柜对接实现类

parent 329c641e
......@@ -94,21 +94,25 @@ public class VendingMachineController {
vendingMachineSrevice.payCallback(payCallback);
}
//获取设备订单
@PostMapping("/orderList")
public String orderList(QueryOrder queryOrder) {
return vendingMachineSrevice.orderList(queryOrder);
}
//微信⽀付宝订单出货成功,主动请求
@PostMapping("/sendOrder")
public String sendOrder(SendOrder sendOrder) {
return vendingMachineSrevice.sendOrder(sendOrder);
}
//取货码第三⽅验证
@PostMapping("/pickupCodeCheck")
public void pickupCodeCheck(String pickupCode, String machineId) {
vendingMachineSrevice.pickupCodeCheck(pickupCode, machineId);
}
//获取单条订单信息
@GetMapping("/queryPayInfo")
public void queryPayInfo(String machineId, String orderSn) {
vendingMachineSrevice.queryPayInfo(machineId, orderSn);
......
package share.framework.aspectj;
import cn.hutool.json.JSONUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@Aspect
@Component
public class VendingMachineSreviceImplAspect {
private static final Logger logger = LoggerFactory.getLogger(VendingMachineSreviceImplAspect.class);
/**
* 切点函数,用于标识需要记录操作日志的方法。
* 切点表达式为:execution(* share.system.service.impl.QPServiceImpl.*(..)),表示匹配所有在share.system.service.impl.QPServiceImpl类中定义的方法。
*/
@Pointcut("execution(* share.system.service.impl.VendingMachineSreviceImpl.*(..))")
public void operLogPoinCut() {
}
@Before("operLogPoinCut()")
public void beforMethod(JoinPoint point) {
}
@Pointcut("execution(* share.system.service.impl.VendingMachineSreviceImpl.*(..))")
public void operExceptionLogPoinCut() {
}
/**
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
*
* @param joinPoint 切入点
* @param result 返回结果
*/
@AfterReturning(value = "operLogPoinCut()", returning = "result")
public void saveMachineOperationLog(JoinPoint joinPoint, Object result) {
try {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) {
logger.warn("无法获取RequestAttributes");
return;
}
HttpServletRequest request = (HttpServletRequest) requestAttributes.resolveReference(RequestAttributes.REFERENCE_REQUEST);
if (request == null) {
logger.warn("无法获取HttpServletRequest");
return;
}
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
String methodName = method.getName();
String[] paramNames = signature.getParameterNames();
String params = argsArrayToString(paramNames, joinPoint.getArgs());
logger.info("请求参数为:{}", params);
logger.info("返回参数为:{}", result);
logger.info("请求地址为:{}", request.getRequestURL());
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
*/
@AfterThrowing(pointcut = "operExceptionLogPoinCut()", throwing = "e")
public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
}
/**
* 参数拼装
*/
private String argsArrayToString(String[] paramNames, Object[] paramsArray) {
Map<String, Object> map = new HashMap<>();
if (paramsArray != null && paramsArray.length > 0) {
for (int i = 0; i < paramsArray.length; i++) {
if (paramsArray[i] != null) {
try {
map.put(paramNames[i], paramsArray[i]);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return JSONUtil.toJsonStr(map);
}
}
......@@ -127,6 +127,9 @@ public class RedisTask {
@Autowired
private PointActivitiesService pointActivitiesService;
// @Resource
// private VendingMachineSrevice vendingMachineSrevice;
//15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15;
......@@ -257,6 +260,10 @@ public class RedisTask {
if (!tiktok) {
tiktokService.clientToken();
}
// Boolean machineToken = redisTemplate.hasKey(ReceiptRdeisEnum.MACHINE_TOKEN.getValue());
// if (!machineToken) {
// vendingMachineSrevice.otherToken();
// }
wechatNewService.getMiniAccessToken();
wechatNewService.getPublicAccessToken();
logger.debug("AutomaticMtSessionKey:自动续期session结束");
......
......@@ -43,4 +43,6 @@ public interface VendingMachineSrevice {
void pickupCodeCheck(String pickupCode, String machineId);
void queryPayInfo(String machineId, String orderSn);
public String obtain();
}
......@@ -527,6 +527,7 @@ public class VendingMachineSreviceImpl implements VendingMachineSrevice {
}
@Override
public String obtain() {
String o;
o = redisUtil.get(ReceiptRdeisEnum.TIKTOK_CLIENT_TOKEN.getValue());
......
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