@ -12,6 +12,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation ;
import io.swagger.annotations.ApiOperation ;
import jdk.jfr.consumer.RecordedObject ;
import jdk.jfr.consumer.RecordedObject ;
import org.apache.commons.collections4.MapUtils ;
import org.apache.commons.collections4.MapUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.slf4j.Logger ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import org.slf4j.LoggerFactory ;
import org.springframework.stereotype.Controller ;
import org.springframework.stereotype.Controller ;
@ -51,6 +52,9 @@ public class RechargeProductController {
@Resource
@Resource
private ApiProductService apiProductService ;
private ApiProductService apiProductService ;
@Resource
private ApiOpenService apiOpenService ;
@RequestMapping ( value = "/getRechargeProduct" , method = RequestMethod . POST )
@RequestMapping ( value = "/getRechargeProduct" , method = RequestMethod . POST )
@ResponseBody
@ResponseBody
@ApiOperation ( value = "获取充值产品" )
@ApiOperation ( value = "获取充值产品" )
@ -70,9 +74,9 @@ public class RechargeProductController {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
}
}
if ( object . getString ( "apiKey" ) = = null | |
if ( StringUtils . isBlank ( object . getString ( "apiKey" ) ) | |
object . getString ( "merchId" ) = = null | |
StringUtils . isBlank ( object . getString ( "merchId" ) ) | |
object . getString ( "sign" ) = = null | |
StringUtils . isBlank ( object . getString ( "sign" ) ) | |
object . getInteger ( "rechargeType" ) = = null
object . getInteger ( "rechargeType" ) = = null
) {
) {
log . error ( "getRechargeProduct error!" , "请求参数校验失败!" ) ;
log . error ( "getRechargeProduct error!" , "请求参数校验失败!" ) ;
@ -89,10 +93,9 @@ public class RechargeProductController {
Map < String , Object > map = new HashMap < > ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "rechargeType" , object . getString ( "type" ) ) ;
map . put ( "rechargeType" , object . getString ( "rechargeType" ) ) ;
map . put ( "sign" , object . getString ( "sign" ) ) ;
if ( ! secConfigService . isSignVerify ( map ) ) {
if ( ! secConfigService . isSignVerify ( map , object . getString ( "sign" ) ) ) {
log . error ( "getRechargeProduct error!" , "签名校验失败!" ) ;
log . error ( "getRechargeProduct error!" , "签名校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
}
}
@ -124,9 +127,9 @@ public class RechargeProductController {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
}
}
if ( object . getString ( "apiKey" ) = = null | |
if ( StringUtils . isBlank ( object . getString ( "apiKey" ) ) | |
object . getString ( "sign" ) = = null | |
StringUtils . isBlank ( object . getString ( "merchId" ) ) | |
object . getString ( "merchId" ) = = null
StringUtils . isBlank ( object . getString ( "sign" ) )
) {
) {
log . error ( "getRechargeProduct error!" , "请求参数校验失败!" ) ;
log . error ( "getRechargeProduct error!" , "请求参数校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR ) ;
@ -142,9 +145,8 @@ public class RechargeProductController {
Map < String , Object > map = new HashMap < > ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "sign" , object . getString ( "sign" ) ) ;
if ( ! secConfigService . isSignVerify ( map ) ) {
if ( ! secConfigService . isSignVerify ( map , object . getString ( "sign" ) ) ) {
log . error ( "getRechargeProduct error!" , "签名校验失败!" ) ;
log . error ( "getRechargeProduct error!" , "签名校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
}
}
@ -176,11 +178,10 @@ public class RechargeProductController {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
}
}
if ( object . getString ( "apiKey" ) = = null | |
if ( StringUtils . isBlank ( object . getString ( "apiKey" ) ) | |
object . getString ( "merchId" ) = = null | |
StringUtils . isBlank ( object . getString ( "merchId" ) ) | |
object . getString ( "sign" ) = = null | |
StringUtils . isBlank ( object . getString ( "sign" ) ) | |
object . getString ( "sourceOrderNo" ) = = null
StringUtils . isBlank ( object . getString ( "sourceOrderNo" ) )
) {
) {
log . error ( "getRechargeProduct error!" , "请求参数校验失败!" ) ;
log . error ( "getRechargeProduct error!" , "请求参数校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR ) ;
@ -197,9 +198,8 @@ public class RechargeProductController {
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "sourceOrderNo" , object . getString ( "sourceOrderNo" ) ) ;
map . put ( "sourceOrderNo" , object . getString ( "sourceOrderNo" ) ) ;
map . put ( "sign" , object . getString ( "sign" ) ) ;
if ( ! secConfigService . isSignVerify ( map ) ) {
if ( ! secConfigService . isSignVerify ( map , object . getString ( "sign" ) ) ) {
log . error ( "getRechargeProduct error!" , "签名校验失败!" ) ;
log . error ( "getRechargeProduct error!" , "签名校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
}
}
@ -252,13 +252,13 @@ public class RechargeProductController {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . IP_ERROR , "非法ip地址,请联系管理人员!" ) ;
}
}
if ( object . getString ( "mobile" ) = = null | |
if ( StringUtils . isBlank ( object . getString ( "mobile" ) ) | |
object . getString ( "goodsId" ) = = null | |
StringUtils . isBlank ( object . getString ( "apiConfigProductId" ) ) | |
object . getString ( "appKey" ) = = null | |
StringUtils . isBlank ( object . getString ( "appKey" ) ) | |
object . getString ( "orderNo" ) = = null | |
StringUtils . isBlank ( object . getString ( "orderNo" ) ) | |
object . getString ( "notifyUrl" ) = = null | |
StringUtils . isBlank ( object . getString ( "notifyUrl" ) ) | |
object . getString ( "sign" ) = = null | |
StringUtils . isBlank ( object . getString ( "sign" ) ) | |
object . getString ( "merchId" ) = = null
StringUtils . isBlank ( object . getString ( "merchId" ) )
) {
) {
log . error ( "createOrder error!" , "请求参数校验失败!" ) ;
log . error ( "createOrder error!" , "请求参数校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR ) ;
@ -273,29 +273,30 @@ public class RechargeProductController {
Map < String , Object > productMap = new HashMap < > ( ) ;
Map < String , Object > productMap = new HashMap < > ( ) ;
productMap . put ( "productI d" , object . getString ( "goods Id" ) ) ;
productMap . put ( "i d" , object . getString ( "apiConfigProduct Id" ) ) ;
productMap . put ( "merchantsId" , apiMerchants . getId ( ) ) ;
productMap . put ( "merchantsId" , apiMerchants . getId ( ) ) ;
if ( apiProductService . findMchProduct ( productMap ) = = null ) {
ApiProductConfig apiProductConfig = apiProductService . findMchProduct ( productMap ) ;
if ( apiProductConfig = = null ) {
log . error ( "createOrder error!" , " 商品错误!" ) ;
log . error ( "createOrder error!" , " 商品错误!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . PRODUCT_ERROR ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . PRODUCT_ERROR ) ;
}
}
Map < String , Object > map = new HashMap < > ( ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "mobile" , object . getString ( "mobile" ) ) ;
map . put ( "mobile" , object . getString ( "mobile" ) ) ;
map . put ( "goodsId" , object . getString ( "goodsId" ) ) ;
map . put ( "goodsId" , apiProductConfig . getProductId ( ) ) ;
map . put ( "orderNo" , object . getString ( "orderNo" ) ) ;
map . put ( "orderNo" , object . getString ( "orderNo" ) ) ;
map . put ( "notifyUrl" , object . getString ( "notifyUrl" ) ) ;
map . put ( "notifyUrl" , object . getString ( "notifyUrl" ) ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "apiKey" , object . getString ( "apiKey" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "merchId" , object . getString ( "merchId" ) ) ;
map . put ( "sign" , object . getString ( "sign" ) ) ;
if ( ! secConfigService . isSignVerify ( map ) ) {
if ( ! secConfigService . isSignVerify ( map , object . getString ( "sign" ) ) ) {
log . error ( "createOrder error!" , "签名校验失败!" ) ;
log . error ( "createOrder error!" , "签名校验失败!" ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
throw ErrorHelp . genException ( SysCode . System , ErrorCode . SIGN_VERIFY ) ;
}
}
return ResponseMsgUtil . success ( apiMerchants . getAmounts ( ) ) ;
return ResponseMsgUtil . success ( apiOpenService . createOrder ( object , apiMerchants , apiProductConfig ) ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
log . error ( "HighOpenApiController --> createOrder() error!" , e ) ;
log . error ( "HighOpenApiController --> createOrder() error!" , e ) ;