Hello World

This commit is contained in:
Alawn
2023-05-16 15:15:22 +08:00
parent fb1e881d7e
commit 95ff7aaa77
5 changed files with 135 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
@@ -0,0 +1,53 @@
package com.murong.ecp.payment.enums;
/**
* @Author: Alawn
* @Description:
* @Date: Create in 16:29 2019-11-07
*/
public enum ResponseMessage {
TIMESPAN_OVERFLOW (400, "100001" , "timespan overflow" , "时间跨度过长"),
HAVE_NO_PERMISSION_WITH_TERM (403, "100002" , "have no permission with term" , "无权操作该终端"),
USERNAME_OR_PASSWORD_CAN_NOT_BE_NULL (400, "400003" , "username or password can't be null" , "用户名或密码不得为空"),
USER_IS_NOT_EXISTS (401, "400004" , "user is not exists" , "用户不存在"),
AUTHENTICATION_REQUIRED (401, "400004" , "authentication required" , "需要身份证明"),
UNAUTHORIZED (401, "400005" , "unauthorized" , "未经授权的"),
JWT_WRONG (400, "400001" , "JWT is wrong" , "JWT有误"),
SYSTEM_BUSY (429, "800001" , "system busy now,try again later" , "系统繁忙,请稍后再试"),
DUPLICATED_PAYMENT_METHOD (430, "800001" , "Duplicated payment method" , "重复的支付方式"),
TRANSACTION_RESTRICTED (431, "800002" , "Transaction Restricted" , "交易受限"),
OTHER_ERROR (500, "999998" , "other error" , "其他错误"),
UNKNOWN_ERROR (500, "999999" , "unknown error" , "未知错误");
private int status;
private String code;
private String message;
private String messageCN;
ResponseMessage(int status, String code, String message, String messageCN) {
this.status = status ;
this.code = code ;
this.message = message ;
this.messageCN = messageCN ;
}
public int getStatus() {
return status;
}
public String getCode() {
return code;
}
public String getMessage() {
return message;
}
public String getMessageCN() {
return messageCN;
}
}
@@ -0,0 +1,28 @@
package com.murong.ecp.payment.exception;
import com.murong.ecp.payment.enums.ResponseMessage;
/**
* @Author: Alawn
* @Description:
* @Date: Create in 17:42 2019-11-07
*/
public class DefaultException extends RuntimeException{
protected String code;
protected String message;
public DefaultException() {
super();
}
public DefaultException(ResponseMessage responseMessage) {
super(responseMessage.getMessage());
this.code = responseMessage.getCode();
this.message = responseMessage.getMessage();
}
public DefaultException(String code,String message) {
super();
this.code = code;
this.message = message;
}
}
@@ -0,0 +1,14 @@
package com.murong.ecp.payment.exception;
import com.murong.ecp.payment.enums.ResponseMessage;
public class RestrictException extends DefaultException {
public RestrictException() {
super(ResponseMessage.TRANSACTION_RESTRICTED);
}
public RestrictException(String message) {
super(ResponseMessage.TRANSACTION_RESTRICTED);
super.message = message;
}
}
@@ -0,0 +1,22 @@
package com.murong.ecp.payment.processor.flow;
import com.murong.ecp.payment.domain.ConsumeOrder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class OrderNotificationProcessor extends OrderDefaultProcessor {
@Override
public boolean checkParams(ConsumeOrder order) {
log.info("RiskProcessor.precheck");
return !order.isNotified() && order.isFinished() ? true : false;
}
@Override
protected void process(ConsumeOrder order) {
/** notification processes */
}
}