提交代码

yy_dev
胡锐 2 years ago
parent 0c47196664
commit 367478c18c
  1. 49
      cweb/src/main/java/com/cweb/controller/BsMerPlatformNoController.java
  2. 6
      open-api/src/main/java/com/OpenApiApplication.java
  3. 58
      open-api/src/main/java/com/api/config/AuthConfig.java
  4. 56
      open-api/src/main/java/com/api/config/RestExceptionHandler.java
  5. 60
      open-api/src/main/java/com/api/config/controller/CommonController.java
  6. 112
      open-api/src/main/java/com/api/controller/v1/AuthController.java
  7. 59
      open-api/src/main/java/com/api/controller/v1/BsTradeController.java
  8. 183
      open-api/src/main/java/com/api/controller/v1/TradeController.java
  9. 4
      service/pom.xml
  10. 7
      service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java
  11. 9
      service/src/main/java/com/hfkj/common/StreamGobbler.java
  12. 9
      service/src/main/java/com/hfkj/common/exception/ErrorCode.java
  13. 3
      service/src/main/java/com/hfkj/common/exception/SysCode.java
  14. 29
      service/src/main/java/com/hfkj/common/utils/GenerateUtil.java
  15. 12
      service/src/main/java/com/hfkj/dao/BsMerKeyMapperExt.java
  16. 102
      service/src/main/java/com/hfkj/dao/BsTradeOrderMapper.java
  17. 42
      service/src/main/java/com/hfkj/dao/BsTradeOrderSqlProvider.java
  18. 48
      service/src/main/java/com/hfkj/entity/BsTradeOrder.java
  19. 190
      service/src/main/java/com/hfkj/entity/BsTradeOrderExample.java
  20. 36
      service/src/main/java/com/hfkj/openapi/v1/model/RequestQueryTradeModel.java
  21. 59
      service/src/main/java/com/hfkj/openapi/v1/model/RequestRefundTradeModel.java
  22. 97
      service/src/main/java/com/hfkj/openapi/v1/model/RequestTradePreorderModel.java
  23. 74
      service/src/main/java/com/hfkj/openapi/v1/model/ResponseQueryTradeModel.java
  24. 60
      service/src/main/java/com/hfkj/openapi/v1/model/ResponseRefundTradeModel.java
  25. 52
      service/src/main/java/com/hfkj/openapi/v1/model/TokenGrantType.java
  26. 37
      service/src/main/java/com/hfkj/openapi/v1/model/TokenModel.java
  27. 15
      service/src/main/java/com/hfkj/openapi/v1/model/TradePreorderModel.java
  28. 25
      service/src/main/java/com/hfkj/openapi/v1/service/AuthTokenService.java
  29. 43
      service/src/main/java/com/hfkj/openapi/v1/service/OpenApiTradeOrderService.java
  30. 49
      service/src/main/java/com/hfkj/openapi/v1/service/impl/AuthTokenServiceImpl.java
  31. 97
      service/src/main/java/com/hfkj/openapi/v1/service/impl/OpenApiTradeOrderServiceImpl.java
  32. 31
      service/src/main/java/com/hfkj/openapi/v1/utils/MD5Util.java
  33. 89
      service/src/main/java/com/hfkj/openapi/v1/utils/SignatureUtil.java
  34. 24
      service/src/main/java/com/hfkj/service/BsMerKeyService.java
  35. 7
      service/src/main/java/com/hfkj/service/BsMerService.java
  36. 38
      service/src/main/java/com/hfkj/service/impl/BsMerKeyServiceImpl.java
  37. 11
      service/src/main/java/com/hfkj/service/impl/BsMerServiceImpl.java
  38. 49
      service/src/main/java/com/hfkj/sysenum/TradeOrderCreateTypeEnum.java

@ -0,0 +1,49 @@
package com.cweb.controller;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.service.BsMerPlatformNoService;
import com.hfkj.sysenum.PlatformTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* @className: BsMerPlatformNo
* @author: HuRui
* @date: 2023/5/23
**/
@Controller
@Api(value = "设备管理")
@RequestMapping(value = "/merPlatformNo")
public class BsMerPlatformNoController {
private static Logger log = LoggerFactory.getLogger(BsMerLedgerController.class);
@Resource
private BsMerPlatformNoService merPlatformNoService;
@RequestMapping(value="/getMerPlatformNo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商户分账功能")
public ResponseData getMerPlatformNo(@RequestParam(name = "merId", required = true) Long merId,
@RequestParam(name = "platformType", required = true) Integer platformType) {
try {
return ResponseMsgUtil.success(merPlatformNoService.getPlatformNo(merId, PlatformTypeEnum.getDataByNumber(platformType)));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,5 +1,7 @@
package com; package com;
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import com.hfkj.common.utils.SpringContextUtil; import com.hfkj.common.utils.SpringContextUtil;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
@ -14,9 +16,11 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
// @ComponentScan // @ComponentScan
@EnableTransactionManagement @EnableTransactionManagement
@EnableScheduling @EnableScheduling
@EnableMethodCache(basePackages = "com.hai")
@EnableCreateCacheAnnotation
@ServletComponentScan @ServletComponentScan
@EnableAspectJAutoProxy(proxyTargetClass = true) @EnableAspectJAutoProxy(proxyTargetClass = true)
@MapperScan("com.hfjk.dao") @MapperScan("com.hfkj.dao")
public class OpenApiApplication public class OpenApiApplication
{ {
public static void main( String[] args ) public static void main( String[] args )

@ -1,9 +1,19 @@
package com.api.config; package com.api.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.openapi.v1.service.AuthTokenService;
import com.hfkj.openapi.v1.service.impl.AuthTokenServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -17,8 +27,10 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.util.List; import java.util.List;
@Configuration @Configuration
@ -26,8 +38,8 @@ public class AuthConfig implements WebMvcConfigurer {
private static Logger log = LoggerFactory.getLogger(AuthConfig.class); private static Logger log = LoggerFactory.getLogger(AuthConfig.class);
@Autowired @Resource
private UserCenter userCenter; private RedisUtil redisUtil;
/** /**
* 获取配置文件debug变量 * 获取配置文件debug变量
@ -54,39 +66,41 @@ public class AuthConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new HandlerInterceptorAdapter() { registry.addInterceptor(new HandlerInterceptorAdapter() {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, public boolean preHandle(HttpServletRequest request, HttpServletResponse response,Object handler) throws Exception {
Object handler) throws Exception { if(debug) {
if(debug){
return true; return true;
} }
String token = request.getParameter("Authorization"); /* String merNo = request.getHeader("MerchantNo");
if (StringUtils.isBlank(token)) { String token = request.getHeader("Authorization");
token = request.getHeader("Authorization"); //如果未登录,将无法使用任何接口
} if (StringUtils.isBlank(merNo) || StringUtils.isBlank(token)) {
if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口
userCenter.refreshCookie(request, response);
return true;
} else if(request instanceof StandardMultipartHttpServletRequest) {
StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request;
if(userCenter.isLogin(re.getRequest())){
return true;
} else {
log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL());
response.setStatus(401); response.setStatus(401);
return false; return false;
} }
} else{ // 查询校验token
log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); Object merToken = redisUtil.get(merNo + AuthTokenServiceImpl.OPEN_API_TOKEN);
response.setStatus(401); if (merToken == null) {
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(JSONObject.toJSONString(ResponseMsgUtil.builderResponse(SysCode.OpenApi.getCode()+ErrorCode.OPEN_API_TOKEN_ERR.getCode(), ErrorCode.OPEN_API_TOKEN_ERR.getMsg(),null)).getBytes());
out.flush();
out.close();
return false; return false;
} }
if (!token.equals(merToken.toString())) {
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(JSONObject.toJSONString(ResponseMsgUtil.builderResponse(SysCode.OpenApi.getCode()+ErrorCode.OPEN_API_TOKEN_ERR.getCode(), ErrorCode.OPEN_API_TOKEN_ERR.getMsg(),null)).getBytes());
out.flush();
out.close();
return false;
}*/
return true;
} }
}) })
.addPathPatterns("/**") .addPathPatterns("/**")
.excludePathPatterns("/swagger-resources/**") .excludePathPatterns("/swagger-resources/**")
.excludePathPatterns("/**/api-docs") .excludePathPatterns("/**/api-docs")
.excludePathPatterns("/**/v1/auth/*")
.excludePathPatterns("/**/springfox-swagger-ui/**") .excludePathPatterns("/**/springfox-swagger-ui/**")
.excludePathPatterns("/**/swagger-ui.html") .excludePathPatterns("/**/swagger-ui.html")
; ;

@ -0,0 +1,56 @@
package com.api.config;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.*;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.xml.bind.ValidationException;
import java.util.List;
import java.util.stream.Collectors;
/**
* @className: RestExceptionHandler
* @author: HuRui
* @date: 2023/5/23
**/
@RestControllerAdvice
public class RestExceptionHandler {
/**
* 默认全局异常处理
* @param e the e
* @return ResultData
*/
@ExceptionHandler(value = {BindException.class, ValidationException.class, MethodArgumentNotValidException.class})
public ResponseData handleValidatedException(Exception e) {
if (e instanceof MethodArgumentNotValidException) {
MethodArgumentNotValidException ex =(MethodArgumentNotValidException) e;
ObjectError objectError = ex.getBindingResult().getAllErrors().stream().collect(Collectors.toList()).get(0);
return ResponseMsgUtil.builderResponse(SysCode.OpenApi.getCode()+ErrorCode.OPEN_API_REQ_PARAMS_ERR.getCode(), objectError.getDefaultMessage(),null);
} else if (e instanceof ConstraintViolationException) {
ConstraintViolationException ex = (ConstraintViolationException) e;
ConstraintViolation<?> constraintViolation = ex.getConstraintViolations().stream().collect(Collectors.toList()).get(0);
return ResponseMsgUtil.builderResponse(SysCode.OpenApi.getCode()+ErrorCode.OPEN_API_REQ_PARAMS_ERR.getCode(), constraintViolation.getMessage(),null);
} else if (e instanceof BindException) {
BindException ex = (BindException ) e;
ObjectError objectError = ex.getAllErrors().stream().collect(Collectors.toList()).get(0);
return ResponseMsgUtil.builderResponse(SysCode.OpenApi.getCode()+ErrorCode.OPEN_API_REQ_PARAMS_ERR.getCode(), objectError.getDefaultMessage(),null);
}
return ResponseMsgUtil.builderResponse(SysCode.OpenApi.getCode()+ErrorCode.OPEN_API_REQ_PARAMS_ERR.getCode(), ErrorCode.OPEN_API_REQ_PARAMS_ERR.getMsg(),null);
}
}

@ -1,60 +0,0 @@
package com.api.config.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.channel.lakala.config.LaKaLaConfig;
import com.hfkj.channel.saas.utils.SaasCommon;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsCompany;
import com.hfkj.entity.SecRegion;
import com.hfkj.model.ResponseData;
import com.hfkj.model.StoreModel;
import com.hfkj.service.BsCompanyService;
import com.hfkj.service.BsIndustryService;
import com.hfkj.service.BsLklMccService;
import com.hfkj.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value="/common")
@Api(value="共用接口")
public class CommonController {
Logger log = LoggerFactory.getLogger(CommonController.class);
@Resource
private BsIndustryService industryService;
@RequestMapping(value="/getIndustry",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取行业数据")
public ResponseData getIndustry() {
try {
return ResponseMsgUtil.success(industryService.getCacheIndustry());
} catch (Exception e) {
log.error("CommonController --> getIndustry() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,112 @@
package com.api.controller.v1;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.v1.model.TokenGrantType;
import com.hfkj.openapi.v1.service.AuthTokenService;
import com.hfkj.service.BsMerKeyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Map;
/**
* @className: CommonController
* @author: HuRui
* @date: 2023/5/23
**/
@Controller
@Api(value = "公共")
@RequestMapping(value = "/v1/auth")
public class AuthController {
private static Logger log = LoggerFactory.getLogger(AuthController.class);
@Resource
private BsMerKeyService merKeyService;
@Resource
private AuthTokenService authTokenService;
@RequestMapping(value="/token",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取token")
public ResponseData token(@RequestBody JSONObject body) {
try {
if (body == null
|| StringUtils.isBlank(body.getString("grantType"))
|| StringUtils.isBlank(body.getString("merchantNo"))
|| StringUtils.isBlank(body.getString("merchantKey"))) {
log.error("获取token error!", "参数错误");
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_PARAMS_ERR, "");
}
// 查询授权类型
TokenGrantType tokenGrantType = TokenGrantType.getDataByCode(body.getString("grantType"));
if (tokenGrantType == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_TOKEN_GRANT_TYPE_ERR, "");
}
String merNo = body.getString("merchantNo");
String merKey = body.getString("merchantKey");
// 查询商户秘钥
String key = merKeyService.getKeyByMerNo(merNo);
if (StringUtils.isBlank(key)) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未配置商户秘钥");
}
if (!merKey.equals(key)) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_KEY_ERR, "");
}
return ResponseMsgUtil.success(authTokenService.createToken(merNo));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/refresh",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "刷新token")
public ResponseData refresh(@RequestBody JSONObject body) {
try {
if (body == null
|| StringUtils.isBlank(body.getString("grantType"))
|| StringUtils.isBlank(body.getString("merchantKey"))
|| StringUtils.isBlank(body.getString("merchantKey"))
) {
log.error("获取token error!", "参数错误");
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.REQ_PARAMS_ERROR, "");
}
String merNo = body.getString("merchantNo");
String merKey = body.getString("merchantKey");
// 查询商户秘钥
String key = merKeyService.getKeyByMerNo(merNo);
if (StringUtils.isBlank(key)) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未配置商户秘钥");
}
if (!merKey.equals(key)) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_KEY_ERR, "");
}
return ResponseMsgUtil.success(authTokenService.refresh(merNo));
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,59 +0,0 @@
package com.api.controller.v1;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.hsg.UserDiscountService;
import com.hfkj.entity.*;
import com.hfkj.model.ResponseData;
import com.hfkj.model.UserDiscount;
import com.hfkj.model.UserInfoModel;
import com.hfkj.openapi.v1.model.TradePreorderModel;
import com.hfkj.service.*;
import com.hfkj.sysenum.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
@Controller
@Api(value = "交易订单")
@RequestMapping(value = "/v1/trade")
public class BsTradeController {
private static Logger log = LoggerFactory.getLogger(BsTradeController.class);
@RequestMapping(value="/preorder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "聚合主扫")
public ResponseData preorder(@RequestBody TradePreorderModel body, HttpServletRequest request) {
try {
if (body == null) {
log.error("configStore error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 创建交易订单
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.error(e.getMessage(), e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,183 @@
package com.api.controller.v1;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsMer;
import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.v1.model.RequestQueryTradeModel;
import com.hfkj.openapi.v1.model.RequestRefundTradeModel;
import com.hfkj.openapi.v1.model.RequestTradePreorderModel;
import com.hfkj.openapi.v1.model.ResponseQueryTradeModel;
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService;
import com.hfkj.openapi.v1.utils.SignatureUtil;
import com.hfkj.service.BsMerKeyService;
import com.hfkj.service.BsMerService;
import com.hfkj.sysenum.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Map;
@Controller
@Api(value = "交易订单")
@RequestMapping(value = "/v1/trade")
public class TradeController {
private static Logger log = LoggerFactory.getLogger(TradeController.class);
@Resource
private BsMerKeyService merKeyService;
@Resource
private OpenApiTradeOrderService openApiTradeOrderService;
@Resource
private BsMerService merService;
@RequestMapping(value="/preorder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "聚合主扫")
public ResponseData preorder(@Validated @RequestBody RequestTradePreorderModel body) {
log.info("========= Start 聚合主扫接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
if (!body.getTransType().equals("JSAPI")) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "接入方式错误");
}
// 查询支付方式
TradeOrderPayModeEnum payMode = TradeOrderPayModeEnum.getNameByCode(body.getPayMode());
if (payMode == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "支付方式错误");
}
// 查询商户
BsMer mer = merService.getMer(body.getMerchantNo());
if (mer == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的商户号");
}
if (!mer.getMerStatus().equals(MerStatusEnum.status1.getNumber())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "商户状态异常");
}
// 查询订单号是否存在
BsTradeOrder outTradeNo = openApiTradeOrderService.getOrderByOutTradeNo(body.getOutTradeNo());
if (outTradeNo != null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "商户交易流水重复");
}
BsTradeOrder tradeOrder = new BsTradeOrder();
tradeOrder.setCompanyId(mer.getCompanyId());
tradeOrder.setAgentId(mer.getAgentId());
tradeOrder.setSalesmanId(mer.getSalesmanId());
tradeOrder.setSalesmanName(mer.getSalesmanName());
tradeOrder.setMerId(mer.getId());
tradeOrder.setMerName(mer.getMerName());
tradeOrder.setMerNo(mer.getMerNo());
tradeOrder.setOutTradeNo(body.getOutTradeNo());
tradeOrder.setTradeAmount(new BigDecimal(body.getTotalAmount()));
tradeOrder.setTradeActualAmount(tradeOrder.getTradeAmount());
tradeOrder.setPayMode(payMode.getCode());
tradeOrder.setStatus(TradeOrderStatusEnum.status1.getNumber());
tradeOrder.setProfitSharingStatus(body.getProfitSharing().equals("0")?false:true);
tradeOrder.setCreateType(TradeOrderCreateTypeEnum.type3.getCode());
tradeOrder.setPayAppid(body.getSubAppid());
tradeOrder.setPayUserId(body.getUserId());
tradeOrder.setTimeoutExpress(body.getTimeoutExpress());
// 创建交易订单
Map<String, Object> returnParam = openApiTradeOrderService.createOrder(tradeOrder);
log.info("返回参数:" + JSONObject.toJSONString(returnParam));
return ResponseMsgUtil.success(returnParam);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 聚合主扫接口 END ===========");
}
}
@RequestMapping(value="/queryTrade",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询交易")
public ResponseData queryTrade(@RequestBody RequestQueryTradeModel body) {
log.info("========= Start 查询交易 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 查询交易订单号
BsTradeOrder tradeOrder = openApiTradeOrderService.getOrderByOutTradeNo(body.getOutTradeNo());
if (tradeOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易订单号");
}
ResponseQueryTradeModel responseQueryTradeModel = new ResponseQueryTradeModel();
responseQueryTradeModel.setMerchantNo(tradeOrder.getMerNo());
responseQueryTradeModel.setOutTradeNo(tradeOrder.getOutTradeNo());
responseQueryTradeModel.setAccTradeNo(tradeOrder.getAccTradeNo());
responseQueryTradeModel.setUserId(tradeOrder.getPayUserId());
responseQueryTradeModel.setPayMode(tradeOrder.getPayMode());
responseQueryTradeModel.setTradeAmount(tradeOrder.getTradeAmount());
responseQueryTradeModel.setTradeActualAmount(tradeOrder.getTradeActualAmount());
responseQueryTradeModel.setStatus(tradeOrder.getStatus());
responseQueryTradeModel.setCreateTime(tradeOrder.getCreateTime());
responseQueryTradeModel.setPayTime(tradeOrder.getPayTime());
responseQueryTradeModel.setSign(SignatureUtil.createSign(responseQueryTradeModel, merKeyService.getKeyByMerNo(body.getMerchantNo())));
log.info("响应参数:" + JSONObject.toJSONString(responseQueryTradeModel));
return ResponseMsgUtil.success(responseQueryTradeModel);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 查询交易 END ===========");
}
}
@RequestMapping(value="/refund",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款交易")
public ResponseData refund(@Validated @RequestBody RequestRefundTradeModel body) {
log.info("========= Start 退款交易接口 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
try {
// 验证签名
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 查询退款单号
BsTradeOrderRefund refund = openApiTradeOrderService.getRefundByNo(body.getRefundTradeNo());
if (refund != null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "退款流水重复");
}
openApiTradeOrderService.refund(body);
return ResponseMsgUtil.success(null);
} catch (Exception e) {
log.info("出现异常:", e);
return ResponseMsgUtil.exception(e);
} finally {
log.info("========= END 退款交易接口 END ===========");
}
}
}

@ -47,6 +47,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.integration</groupId> <groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId> <artifactId>spring-integration-mqtt</artifactId>

@ -217,8 +217,15 @@ public class LaKaLaTradeService {
map.put("location_info", locationInfo); map.put("location_info", locationInfo);
Map<String, Object> accBusiFieldsMap = new HashMap<>(); Map<String, Object> accBusiFieldsMap = new HashMap<>();
if (order.getTimeoutExpress() != null) {
accBusiFieldsMap.put("timeout_express", order.getTimeoutExpress());
}
if (order.getPayMode().equals(TradeOrderPayModeEnum.WECHAT.getCode())) { if (order.getPayMode().equals(TradeOrderPayModeEnum.WECHAT.getCode())) {
if (StringUtils.isBlank(order.getPayAppid())) {
accBusiFieldsMap.put("sub_appid", "wxa075e8509802f826"); accBusiFieldsMap.put("sub_appid", "wxa075e8509802f826");
} else {
accBusiFieldsMap.put("sub_appid", order.getPayAppid());
}
} }
accBusiFieldsMap.put("user_id", order.getPayUserId()); accBusiFieldsMap.put("user_id", order.getPayUserId());
map.put("acc_busi_fields", accBusiFieldsMap); map.put("acc_busi_fields", accBusiFieldsMap);

@ -1,9 +0,0 @@
package com.hfkj.common;
/**
* @className: StreamGobbler
* @author: HuRui
* @date: 2023/5/12
**/
public class StreamGobbler {
}

@ -75,6 +75,15 @@ public enum ErrorCode {
REQUEST_TIMED_OUT("3006","请求超时,请稍后重试"), REQUEST_TIMED_OUT("3006","请求超时,请稍后重试"),
SEC_USER_EXPIRED("3007","用户身份错误或已过期"), SEC_USER_EXPIRED("3007","用户身份错误或已过期"),
OPEN_API_COMMON("4000",""),
OPEN_API_REQ_PARAMS_ERR("4001","请求参数校验失败"),
OPEN_API_SIGN_ERR("4002","签名错误"),
OPEN_API_KEY_ERR("4003","商户秘钥错误"),
OPEN_API_TOKEN_ERR("4004","token不存在或已过期"),
OPEN_API_TOKEN_GRANT_TYPE_ERR("4005","token授权类型错误"),
MSG_EVENT_NULL("2999","消息类型为空"), MSG_EVENT_NULL("2999","消息类型为空"),
USE_VISIT_ILLEGAL("4001","用户身份错误"), USE_VISIT_ILLEGAL("4001","用户身份错误"),
RC_VISIT_ERROR("2998",""), RC_VISIT_ERROR("2998",""),

@ -3,7 +3,8 @@ package com.hfkj.common.exception;
public enum SysCode { public enum SysCode {
System("10","System"), System("10","System"),
Auth("20","Auth"), Auth("20","Auth"),
MiniProgram("30","小程序"); MiniProgram("30","小程序"),
OpenApi("40","开发平台");
private String code; private String code;
private String name; private String name;

@ -0,0 +1,29 @@
package com.hfkj.common.utils;
import java.util.Random;
/**
* 生成工具类
* @className: GenerateUtil
* @author: HuRui
* @date: 2023/5/23
**/
public class GenerateUtil {
/**
* 生成随机字符串
* @param length 长度
* @return
*/
public static String generateRandomString(int length) {
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
int index = random.nextInt(chars.length());
sb.append(chars.charAt(index));
}
return sb.toString();
}
}

@ -1,7 +1,19 @@
package com.hfkj.dao; package com.hfkj.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
public interface BsMerKeyMapperExt { public interface BsMerKeyMapperExt {
@Select({
" select mer_no merNo,b.`key` merKey from bs_mer a " +
" LEFT JOIN bs_mer_key b on b.mer_id = a.id " +
" where a.mer_no = #{merNo} and b.status = 1"
})
Map<String, Object> queryKeyByMerNo(@Param("merNo") String merNo);
} }

@ -48,24 +48,26 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"platform_type, platform_mer_no, ", "platform_type, platform_mer_no, ",
"platform_trade_no, platform_log_no, ", "platform_trade_no, platform_log_no, ",
"platform_appid, platform_rate, ", "platform_appid, platform_rate, ",
"platform_commission, pay_user_id, ", "platform_commission, pay_appid, ",
"pay_mode, out_trade_no, ", "pay_user_id, pay_mode, ",
"trade_amount, store_discount_satisfy, ", "out_trade_no, trade_amount, ",
"store_discount_id, store_discount_name, ", "store_discount_satisfy, store_discount_id, ",
"store_discount_type, store_discount_condition, ", "store_discount_name, store_discount_type, ",
"store_discount_price, store_discount_final_cost_price, ", "store_discount_condition, store_discount_price, ",
"store_discount_actual_price, store_discount_profit_price, ", "store_discount_final_cost_price, store_discount_actual_price, ",
"user_id, user_phone, ", "store_discount_profit_price, user_id, ",
"user_discount_id, user_discount_name, ", "user_phone, user_discount_id, ",
"user_discount_type, user_discount_price, ", "user_discount_name, user_discount_type, ",
"user_discount_actual_price, trade_actual_amount, ", "user_discount_price, user_discount_actual_price, ",
"income_amout, acc_trade_no, ", "trade_actual_amount, income_amout, ",
"acc_mdiscount_amount, acc_discount_amount, ", "acc_trade_no, acc_mdiscount_amount, ",
"acc_payment_code, card_type, ", "acc_discount_amount, acc_payment_code, ",
"`status`, profit_sharing_status, ", "card_type, `status`, ",
"pay_time, create_time, ", "profit_sharing_status, pay_time, ",
"cancel_time, update_time, ", "timeout_express, create_type, ",
"ext_1, ext_2, ext_3)", "create_time, cancel_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{companyId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ", "values (#{companyId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{salesmanId,jdbcType=BIGINT}, #{salesmanName,jdbcType=VARCHAR}, ", "#{salesmanId,jdbcType=BIGINT}, #{salesmanName,jdbcType=VARCHAR}, ",
"#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{merNo,jdbcType=VARCHAR}, ", "#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{merNo,jdbcType=VARCHAR}, ",
@ -75,24 +77,26 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"#{platformType,jdbcType=INTEGER}, #{platformMerNo,jdbcType=VARCHAR}, ", "#{platformType,jdbcType=INTEGER}, #{platformMerNo,jdbcType=VARCHAR}, ",
"#{platformTradeNo,jdbcType=VARCHAR}, #{platformLogNo,jdbcType=VARCHAR}, ", "#{platformTradeNo,jdbcType=VARCHAR}, #{platformLogNo,jdbcType=VARCHAR}, ",
"#{platformAppid,jdbcType=VARCHAR}, #{platformRate,jdbcType=DECIMAL}, ", "#{platformAppid,jdbcType=VARCHAR}, #{platformRate,jdbcType=DECIMAL}, ",
"#{platformCommission,jdbcType=DECIMAL}, #{payUserId,jdbcType=VARCHAR}, ", "#{platformCommission,jdbcType=DECIMAL}, #{payAppid,jdbcType=VARCHAR}, ",
"#{payMode,jdbcType=VARCHAR}, #{outTradeNo,jdbcType=VARCHAR}, ", "#{payUserId,jdbcType=VARCHAR}, #{payMode,jdbcType=VARCHAR}, ",
"#{tradeAmount,jdbcType=DECIMAL}, #{storeDiscountSatisfy,jdbcType=BIT}, ", "#{outTradeNo,jdbcType=VARCHAR}, #{tradeAmount,jdbcType=DECIMAL}, ",
"#{storeDiscountId,jdbcType=BIGINT}, #{storeDiscountName,jdbcType=VARCHAR}, ", "#{storeDiscountSatisfy,jdbcType=BIT}, #{storeDiscountId,jdbcType=BIGINT}, ",
"#{storeDiscountType,jdbcType=INTEGER}, #{storeDiscountCondition,jdbcType=DECIMAL}, ", "#{storeDiscountName,jdbcType=VARCHAR}, #{storeDiscountType,jdbcType=INTEGER}, ",
"#{storeDiscountPrice,jdbcType=DECIMAL}, #{storeDiscountFinalCostPrice,jdbcType=DECIMAL}, ", "#{storeDiscountCondition,jdbcType=DECIMAL}, #{storeDiscountPrice,jdbcType=DECIMAL}, ",
"#{storeDiscountActualPrice,jdbcType=DECIMAL}, #{storeDiscountProfitPrice,jdbcType=DECIMAL}, ", "#{storeDiscountFinalCostPrice,jdbcType=DECIMAL}, #{storeDiscountActualPrice,jdbcType=DECIMAL}, ",
"#{userId,jdbcType=INTEGER}, #{userPhone,jdbcType=VARCHAR}, ", "#{storeDiscountProfitPrice,jdbcType=DECIMAL}, #{userId,jdbcType=INTEGER}, ",
"#{userDiscountId,jdbcType=BIGINT}, #{userDiscountName,jdbcType=VARCHAR}, ", "#{userPhone,jdbcType=VARCHAR}, #{userDiscountId,jdbcType=BIGINT}, ",
"#{userDiscountType,jdbcType=INTEGER}, #{userDiscountPrice,jdbcType=DECIMAL}, ", "#{userDiscountName,jdbcType=VARCHAR}, #{userDiscountType,jdbcType=INTEGER}, ",
"#{userDiscountActualPrice,jdbcType=DECIMAL}, #{tradeActualAmount,jdbcType=DECIMAL}, ", "#{userDiscountPrice,jdbcType=DECIMAL}, #{userDiscountActualPrice,jdbcType=DECIMAL}, ",
"#{incomeAmout,jdbcType=DECIMAL}, #{accTradeNo,jdbcType=VARCHAR}, ", "#{tradeActualAmount,jdbcType=DECIMAL}, #{incomeAmout,jdbcType=DECIMAL}, ",
"#{accMdiscountAmount,jdbcType=DECIMAL}, #{accDiscountAmount,jdbcType=DECIMAL}, ", "#{accTradeNo,jdbcType=VARCHAR}, #{accMdiscountAmount,jdbcType=DECIMAL}, ",
"#{accPaymentCode,jdbcType=VARCHAR}, #{cardType,jdbcType=VARCHAR}, ", "#{accDiscountAmount,jdbcType=DECIMAL}, #{accPaymentCode,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{profitSharingStatus,jdbcType=BIT}, ", "#{cardType,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{payTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ", "#{profitSharingStatus,jdbcType=BIT}, #{payTime,jdbcType=TIMESTAMP}, ",
"#{cancelTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", "#{timeoutExpress,jdbcType=INTEGER}, #{createType,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsTradeOrder record); int insert(BsTradeOrder record);
@ -124,6 +128,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
@Result(column="platform_appid", property="platformAppid", jdbcType=JdbcType.VARCHAR), @Result(column="platform_appid", property="platformAppid", jdbcType=JdbcType.VARCHAR),
@Result(column="platform_rate", property="platformRate", jdbcType=JdbcType.DECIMAL), @Result(column="platform_rate", property="platformRate", jdbcType=JdbcType.DECIMAL),
@Result(column="platform_commission", property="platformCommission", jdbcType=JdbcType.DECIMAL), @Result(column="platform_commission", property="platformCommission", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_appid", property="payAppid", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_user_id", property="payUserId", jdbcType=JdbcType.VARCHAR), @Result(column="pay_user_id", property="payUserId", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_mode", property="payMode", jdbcType=JdbcType.VARCHAR), @Result(column="pay_mode", property="payMode", jdbcType=JdbcType.VARCHAR),
@Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR), @Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR),
@ -154,6 +159,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="timeout_express", property="timeoutExpress", jdbcType=JdbcType.INTEGER),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -168,14 +175,15 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"id, company_id, agent_id, salesman_id, salesman_name, mer_id, mer_name, mer_no, ", "id, company_id, agent_id, salesman_id, salesman_name, mer_id, mer_name, mer_no, ",
"store_id, store_name, device_id, device_sn, qr_code_id, qr_code_sn, platform_type, ", "store_id, store_name, device_id, device_sn, qr_code_id, qr_code_sn, platform_type, ",
"platform_mer_no, platform_trade_no, platform_log_no, platform_appid, platform_rate, ", "platform_mer_no, platform_trade_no, platform_log_no, platform_appid, platform_rate, ",
"platform_commission, pay_user_id, pay_mode, out_trade_no, trade_amount, store_discount_satisfy, ", "platform_commission, pay_appid, pay_user_id, pay_mode, out_trade_no, trade_amount, ",
"store_discount_id, store_discount_name, store_discount_type, store_discount_condition, ", "store_discount_satisfy, store_discount_id, store_discount_name, store_discount_type, ",
"store_discount_price, store_discount_final_cost_price, store_discount_actual_price, ", "store_discount_condition, store_discount_price, store_discount_final_cost_price, ",
"store_discount_profit_price, user_id, user_phone, user_discount_id, user_discount_name, ", "store_discount_actual_price, store_discount_profit_price, user_id, user_phone, ",
"user_discount_type, user_discount_price, user_discount_actual_price, trade_actual_amount, ", "user_discount_id, user_discount_name, user_discount_type, user_discount_price, ",
"income_amout, acc_trade_no, acc_mdiscount_amount, acc_discount_amount, acc_payment_code, ", "user_discount_actual_price, trade_actual_amount, income_amout, acc_trade_no, ",
"card_type, `status`, profit_sharing_status, pay_time, create_time, cancel_time, ", "acc_mdiscount_amount, acc_discount_amount, acc_payment_code, card_type, `status`, ",
"update_time, ext_1, ext_2, ext_3", "profit_sharing_status, pay_time, timeout_express, create_type, create_time, ",
"cancel_time, update_time, ext_1, ext_2, ext_3",
"from bs_trade_order", "from bs_trade_order",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -201,6 +209,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
@Result(column="platform_appid", property="platformAppid", jdbcType=JdbcType.VARCHAR), @Result(column="platform_appid", property="platformAppid", jdbcType=JdbcType.VARCHAR),
@Result(column="platform_rate", property="platformRate", jdbcType=JdbcType.DECIMAL), @Result(column="platform_rate", property="platformRate", jdbcType=JdbcType.DECIMAL),
@Result(column="platform_commission", property="platformCommission", jdbcType=JdbcType.DECIMAL), @Result(column="platform_commission", property="platformCommission", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_appid", property="payAppid", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_user_id", property="payUserId", jdbcType=JdbcType.VARCHAR), @Result(column="pay_user_id", property="payUserId", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_mode", property="payMode", jdbcType=JdbcType.VARCHAR), @Result(column="pay_mode", property="payMode", jdbcType=JdbcType.VARCHAR),
@Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR), @Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR),
@ -231,6 +240,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="timeout_express", property="timeoutExpress", jdbcType=JdbcType.INTEGER),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -271,6 +282,7 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"platform_appid = #{platformAppid,jdbcType=VARCHAR},", "platform_appid = #{platformAppid,jdbcType=VARCHAR},",
"platform_rate = #{platformRate,jdbcType=DECIMAL},", "platform_rate = #{platformRate,jdbcType=DECIMAL},",
"platform_commission = #{platformCommission,jdbcType=DECIMAL},", "platform_commission = #{platformCommission,jdbcType=DECIMAL},",
"pay_appid = #{payAppid,jdbcType=VARCHAR},",
"pay_user_id = #{payUserId,jdbcType=VARCHAR},", "pay_user_id = #{payUserId,jdbcType=VARCHAR},",
"pay_mode = #{payMode,jdbcType=VARCHAR},", "pay_mode = #{payMode,jdbcType=VARCHAR},",
"out_trade_no = #{outTradeNo,jdbcType=VARCHAR},", "out_trade_no = #{outTradeNo,jdbcType=VARCHAR},",
@ -301,6 +313,8 @@ public interface BsTradeOrderMapper extends BsTradeOrderMapperExt {
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",
"profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},", "profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},",
"pay_time = #{payTime,jdbcType=TIMESTAMP},", "pay_time = #{payTime,jdbcType=TIMESTAMP},",
"timeout_express = #{timeoutExpress,jdbcType=INTEGER},",
"create_type = #{createType,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},", "create_time = #{createTime,jdbcType=TIMESTAMP},",
"cancel_time = #{cancelTime,jdbcType=TIMESTAMP},", "cancel_time = #{cancelTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},",

@ -108,6 +108,10 @@ public class BsTradeOrderSqlProvider {
sql.VALUES("platform_commission", "#{platformCommission,jdbcType=DECIMAL}"); sql.VALUES("platform_commission", "#{platformCommission,jdbcType=DECIMAL}");
} }
if (record.getPayAppid() != null) {
sql.VALUES("pay_appid", "#{payAppid,jdbcType=VARCHAR}");
}
if (record.getPayUserId() != null) { if (record.getPayUserId() != null) {
sql.VALUES("pay_user_id", "#{payUserId,jdbcType=VARCHAR}"); sql.VALUES("pay_user_id", "#{payUserId,jdbcType=VARCHAR}");
} }
@ -228,6 +232,14 @@ public class BsTradeOrderSqlProvider {
sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}"); sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}");
} }
if (record.getTimeoutExpress() != null) {
sql.VALUES("timeout_express", "#{timeoutExpress,jdbcType=INTEGER}");
}
if (record.getCreateType() != null) {
sql.VALUES("create_type", "#{createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
} }
@ -282,6 +294,7 @@ public class BsTradeOrderSqlProvider {
sql.SELECT("platform_appid"); sql.SELECT("platform_appid");
sql.SELECT("platform_rate"); sql.SELECT("platform_rate");
sql.SELECT("platform_commission"); sql.SELECT("platform_commission");
sql.SELECT("pay_appid");
sql.SELECT("pay_user_id"); sql.SELECT("pay_user_id");
sql.SELECT("pay_mode"); sql.SELECT("pay_mode");
sql.SELECT("out_trade_no"); sql.SELECT("out_trade_no");
@ -312,6 +325,8 @@ public class BsTradeOrderSqlProvider {
sql.SELECT("`status`"); sql.SELECT("`status`");
sql.SELECT("profit_sharing_status"); sql.SELECT("profit_sharing_status");
sql.SELECT("pay_time"); sql.SELECT("pay_time");
sql.SELECT("timeout_express");
sql.SELECT("create_type");
sql.SELECT("create_time"); sql.SELECT("create_time");
sql.SELECT("cancel_time"); sql.SELECT("cancel_time");
sql.SELECT("update_time"); sql.SELECT("update_time");
@ -419,6 +434,10 @@ public class BsTradeOrderSqlProvider {
sql.SET("platform_commission = #{record.platformCommission,jdbcType=DECIMAL}"); sql.SET("platform_commission = #{record.platformCommission,jdbcType=DECIMAL}");
} }
if (record.getPayAppid() != null) {
sql.SET("pay_appid = #{record.payAppid,jdbcType=VARCHAR}");
}
if (record.getPayUserId() != null) { if (record.getPayUserId() != null) {
sql.SET("pay_user_id = #{record.payUserId,jdbcType=VARCHAR}"); sql.SET("pay_user_id = #{record.payUserId,jdbcType=VARCHAR}");
} }
@ -539,6 +558,14 @@ public class BsTradeOrderSqlProvider {
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
} }
if (record.getTimeoutExpress() != null) {
sql.SET("timeout_express = #{record.timeoutExpress,jdbcType=INTEGER}");
}
if (record.getCreateType() != null) {
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
} }
@ -592,6 +619,7 @@ public class BsTradeOrderSqlProvider {
sql.SET("platform_appid = #{record.platformAppid,jdbcType=VARCHAR}"); sql.SET("platform_appid = #{record.platformAppid,jdbcType=VARCHAR}");
sql.SET("platform_rate = #{record.platformRate,jdbcType=DECIMAL}"); sql.SET("platform_rate = #{record.platformRate,jdbcType=DECIMAL}");
sql.SET("platform_commission = #{record.platformCommission,jdbcType=DECIMAL}"); sql.SET("platform_commission = #{record.platformCommission,jdbcType=DECIMAL}");
sql.SET("pay_appid = #{record.payAppid,jdbcType=VARCHAR}");
sql.SET("pay_user_id = #{record.payUserId,jdbcType=VARCHAR}"); sql.SET("pay_user_id = #{record.payUserId,jdbcType=VARCHAR}");
sql.SET("pay_mode = #{record.payMode,jdbcType=VARCHAR}"); sql.SET("pay_mode = #{record.payMode,jdbcType=VARCHAR}");
sql.SET("out_trade_no = #{record.outTradeNo,jdbcType=VARCHAR}"); sql.SET("out_trade_no = #{record.outTradeNo,jdbcType=VARCHAR}");
@ -622,6 +650,8 @@ public class BsTradeOrderSqlProvider {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}");
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
sql.SET("timeout_express = #{record.timeoutExpress,jdbcType=INTEGER}");
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}"); sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
@ -718,6 +748,10 @@ public class BsTradeOrderSqlProvider {
sql.SET("platform_commission = #{platformCommission,jdbcType=DECIMAL}"); sql.SET("platform_commission = #{platformCommission,jdbcType=DECIMAL}");
} }
if (record.getPayAppid() != null) {
sql.SET("pay_appid = #{payAppid,jdbcType=VARCHAR}");
}
if (record.getPayUserId() != null) { if (record.getPayUserId() != null) {
sql.SET("pay_user_id = #{payUserId,jdbcType=VARCHAR}"); sql.SET("pay_user_id = #{payUserId,jdbcType=VARCHAR}");
} }
@ -838,6 +872,14 @@ public class BsTradeOrderSqlProvider {
sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}"); sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}");
} }
if (record.getTimeoutExpress() != null) {
sql.SET("timeout_express = #{timeoutExpress,jdbcType=INTEGER}");
}
if (record.getCreateType() != null) {
sql.SET("create_type = #{createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) { if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
} }

@ -119,6 +119,11 @@ public class BsTradeOrder implements Serializable {
*/ */
private BigDecimal platformCommission; private BigDecimal platformCommission;
/**
* 支付平台appid
*/
private String payAppid;
/** /**
* 支付用户id * 支付用户id
*/ */
@ -273,6 +278,16 @@ public class BsTradeOrder implements Serializable {
*/ */
private Date payTime; private Date payTime;
/**
* 预下单有效期
*/
private Integer timeoutExpress;
/**
* 创建方式 1扫一扫 2被扫 3API
*/
private Integer createType;
/** /**
* 创建时间 * 创建时间
*/ */
@ -464,6 +479,14 @@ public class BsTradeOrder implements Serializable {
this.platformCommission = platformCommission; this.platformCommission = platformCommission;
} }
public String getPayAppid() {
return payAppid;
}
public void setPayAppid(String payAppid) {
this.payAppid = payAppid;
}
public String getPayUserId() { public String getPayUserId() {
return payUserId; return payUserId;
} }
@ -704,6 +727,22 @@ public class BsTradeOrder implements Serializable {
this.payTime = payTime; this.payTime = payTime;
} }
public Integer getTimeoutExpress() {
return timeoutExpress;
}
public void setTimeoutExpress(Integer timeoutExpress) {
this.timeoutExpress = timeoutExpress;
}
public Integer getCreateType() {
return createType;
}
public void setCreateType(Integer createType) {
this.createType = createType;
}
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
@ -785,6 +824,7 @@ public class BsTradeOrder implements Serializable {
&& (this.getPlatformAppid() == null ? other.getPlatformAppid() == null : this.getPlatformAppid().equals(other.getPlatformAppid())) && (this.getPlatformAppid() == null ? other.getPlatformAppid() == null : this.getPlatformAppid().equals(other.getPlatformAppid()))
&& (this.getPlatformRate() == null ? other.getPlatformRate() == null : this.getPlatformRate().equals(other.getPlatformRate())) && (this.getPlatformRate() == null ? other.getPlatformRate() == null : this.getPlatformRate().equals(other.getPlatformRate()))
&& (this.getPlatformCommission() == null ? other.getPlatformCommission() == null : this.getPlatformCommission().equals(other.getPlatformCommission())) && (this.getPlatformCommission() == null ? other.getPlatformCommission() == null : this.getPlatformCommission().equals(other.getPlatformCommission()))
&& (this.getPayAppid() == null ? other.getPayAppid() == null : this.getPayAppid().equals(other.getPayAppid()))
&& (this.getPayUserId() == null ? other.getPayUserId() == null : this.getPayUserId().equals(other.getPayUserId())) && (this.getPayUserId() == null ? other.getPayUserId() == null : this.getPayUserId().equals(other.getPayUserId()))
&& (this.getPayMode() == null ? other.getPayMode() == null : this.getPayMode().equals(other.getPayMode())) && (this.getPayMode() == null ? other.getPayMode() == null : this.getPayMode().equals(other.getPayMode()))
&& (this.getOutTradeNo() == null ? other.getOutTradeNo() == null : this.getOutTradeNo().equals(other.getOutTradeNo())) && (this.getOutTradeNo() == null ? other.getOutTradeNo() == null : this.getOutTradeNo().equals(other.getOutTradeNo()))
@ -815,6 +855,8 @@ public class BsTradeOrder implements Serializable {
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getProfitSharingStatus() == null ? other.getProfitSharingStatus() == null : this.getProfitSharingStatus().equals(other.getProfitSharingStatus())) && (this.getProfitSharingStatus() == null ? other.getProfitSharingStatus() == null : this.getProfitSharingStatus().equals(other.getProfitSharingStatus()))
&& (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) && (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime()))
&& (this.getTimeoutExpress() == null ? other.getTimeoutExpress() == null : this.getTimeoutExpress().equals(other.getTimeoutExpress()))
&& (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime())) && (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
@ -848,6 +890,7 @@ public class BsTradeOrder implements Serializable {
result = prime * result + ((getPlatformAppid() == null) ? 0 : getPlatformAppid().hashCode()); result = prime * result + ((getPlatformAppid() == null) ? 0 : getPlatformAppid().hashCode());
result = prime * result + ((getPlatformRate() == null) ? 0 : getPlatformRate().hashCode()); result = prime * result + ((getPlatformRate() == null) ? 0 : getPlatformRate().hashCode());
result = prime * result + ((getPlatformCommission() == null) ? 0 : getPlatformCommission().hashCode()); result = prime * result + ((getPlatformCommission() == null) ? 0 : getPlatformCommission().hashCode());
result = prime * result + ((getPayAppid() == null) ? 0 : getPayAppid().hashCode());
result = prime * result + ((getPayUserId() == null) ? 0 : getPayUserId().hashCode()); result = prime * result + ((getPayUserId() == null) ? 0 : getPayUserId().hashCode());
result = prime * result + ((getPayMode() == null) ? 0 : getPayMode().hashCode()); result = prime * result + ((getPayMode() == null) ? 0 : getPayMode().hashCode());
result = prime * result + ((getOutTradeNo() == null) ? 0 : getOutTradeNo().hashCode()); result = prime * result + ((getOutTradeNo() == null) ? 0 : getOutTradeNo().hashCode());
@ -878,6 +921,8 @@ public class BsTradeOrder implements Serializable {
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getProfitSharingStatus() == null) ? 0 : getProfitSharingStatus().hashCode()); result = prime * result + ((getProfitSharingStatus() == null) ? 0 : getProfitSharingStatus().hashCode());
result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode());
result = prime * result + ((getTimeoutExpress() == null) ? 0 : getTimeoutExpress().hashCode());
result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode()); result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
@ -914,6 +959,7 @@ public class BsTradeOrder implements Serializable {
sb.append(", platformAppid=").append(platformAppid); sb.append(", platformAppid=").append(platformAppid);
sb.append(", platformRate=").append(platformRate); sb.append(", platformRate=").append(platformRate);
sb.append(", platformCommission=").append(platformCommission); sb.append(", platformCommission=").append(platformCommission);
sb.append(", payAppid=").append(payAppid);
sb.append(", payUserId=").append(payUserId); sb.append(", payUserId=").append(payUserId);
sb.append(", payMode=").append(payMode); sb.append(", payMode=").append(payMode);
sb.append(", outTradeNo=").append(outTradeNo); sb.append(", outTradeNo=").append(outTradeNo);
@ -944,6 +990,8 @@ public class BsTradeOrder implements Serializable {
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", profitSharingStatus=").append(profitSharingStatus); sb.append(", profitSharingStatus=").append(profitSharingStatus);
sb.append(", payTime=").append(payTime); sb.append(", payTime=").append(payTime);
sb.append(", timeoutExpress=").append(timeoutExpress);
sb.append(", createType=").append(createType);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", cancelTime=").append(cancelTime); sb.append(", cancelTime=").append(cancelTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);

@ -1486,6 +1486,76 @@ public class BsTradeOrderExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andPayAppidIsNull() {
addCriterion("pay_appid is null");
return (Criteria) this;
}
public Criteria andPayAppidIsNotNull() {
addCriterion("pay_appid is not null");
return (Criteria) this;
}
public Criteria andPayAppidEqualTo(String value) {
addCriterion("pay_appid =", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidNotEqualTo(String value) {
addCriterion("pay_appid <>", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidGreaterThan(String value) {
addCriterion("pay_appid >", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidGreaterThanOrEqualTo(String value) {
addCriterion("pay_appid >=", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidLessThan(String value) {
addCriterion("pay_appid <", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidLessThanOrEqualTo(String value) {
addCriterion("pay_appid <=", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidLike(String value) {
addCriterion("pay_appid like", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidNotLike(String value) {
addCriterion("pay_appid not like", value, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidIn(List<String> values) {
addCriterion("pay_appid in", values, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidNotIn(List<String> values) {
addCriterion("pay_appid not in", values, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidBetween(String value1, String value2) {
addCriterion("pay_appid between", value1, value2, "payAppid");
return (Criteria) this;
}
public Criteria andPayAppidNotBetween(String value1, String value2) {
addCriterion("pay_appid not between", value1, value2, "payAppid");
return (Criteria) this;
}
public Criteria andPayUserIdIsNull() { public Criteria andPayUserIdIsNull() {
addCriterion("pay_user_id is null"); addCriterion("pay_user_id is null");
return (Criteria) this; return (Criteria) this;
@ -3376,6 +3446,126 @@ public class BsTradeOrderExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTimeoutExpressIsNull() {
addCriterion("timeout_express is null");
return (Criteria) this;
}
public Criteria andTimeoutExpressIsNotNull() {
addCriterion("timeout_express is not null");
return (Criteria) this;
}
public Criteria andTimeoutExpressEqualTo(Integer value) {
addCriterion("timeout_express =", value, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressNotEqualTo(Integer value) {
addCriterion("timeout_express <>", value, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressGreaterThan(Integer value) {
addCriterion("timeout_express >", value, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressGreaterThanOrEqualTo(Integer value) {
addCriterion("timeout_express >=", value, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressLessThan(Integer value) {
addCriterion("timeout_express <", value, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressLessThanOrEqualTo(Integer value) {
addCriterion("timeout_express <=", value, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressIn(List<Integer> values) {
addCriterion("timeout_express in", values, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressNotIn(List<Integer> values) {
addCriterion("timeout_express not in", values, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressBetween(Integer value1, Integer value2) {
addCriterion("timeout_express between", value1, value2, "timeoutExpress");
return (Criteria) this;
}
public Criteria andTimeoutExpressNotBetween(Integer value1, Integer value2) {
addCriterion("timeout_express not between", value1, value2, "timeoutExpress");
return (Criteria) this;
}
public Criteria andCreateTypeIsNull() {
addCriterion("create_type is null");
return (Criteria) this;
}
public Criteria andCreateTypeIsNotNull() {
addCriterion("create_type is not null");
return (Criteria) this;
}
public Criteria andCreateTypeEqualTo(Integer value) {
addCriterion("create_type =", value, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeNotEqualTo(Integer value) {
addCriterion("create_type <>", value, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeGreaterThan(Integer value) {
addCriterion("create_type >", value, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("create_type >=", value, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeLessThan(Integer value) {
addCriterion("create_type <", value, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeLessThanOrEqualTo(Integer value) {
addCriterion("create_type <=", value, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeIn(List<Integer> values) {
addCriterion("create_type in", values, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeNotIn(List<Integer> values) {
addCriterion("create_type not in", values, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeBetween(Integer value1, Integer value2) {
addCriterion("create_type between", value1, value2, "createType");
return (Criteria) this;
}
public Criteria andCreateTypeNotBetween(Integer value1, Integer value2) {
addCriterion("create_type not between", value1, value2, "createType");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() { public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;

@ -0,0 +1,36 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 请求查询交易模型
* @className: TradePreorderModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class RequestQueryTradeModel {
/**
* 商户号
*/
@NotBlank(message = "商户号必填项")
private String merchantNo;
/**
* 商户交易单号
*/
@NotBlank(message = "商户交易单号必填项")
@Length(min = 6, max = 50, message = "商户交易单号长度限制6至50位字符串长度")
private String outTradeNo;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,59 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
/**
* 请求查询交易模型
* @className: TradePreorderModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class RequestRefundTradeModel {
/**
* 商户号
*/
@NotBlank(message = "商户号必填项")
private String merchantNo;
/**
* 商户交易单号
*/
@Length(min = 6, max = 50, message = "商户交易单号长度限制6至50位字符串长度")
@NotBlank(message = "商户交易单号必填项")
private String outTradeNo;
/**
* 退款单号
*/
@Length(min = 6, max = 50, message = "退款单号长度限制6至50位字符串长度")
@NotBlank(message = "退款单号必填项")
private String refundTradeNo;
/**
* 退款金额
*/
@DecimalMax(value = "99999999", message = "交易最大金额99999999元")
@DecimalMin(value = "0.01", message = "交易最小金额0.01元")
@NotBlank(message = "退款金额必填项")
private String refundAmount;
/**
* 退款原因
*/
@Length(max = 30, message = "退款描述最多支持30位字符")
private String refundReason;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,97 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.*;
import java.math.BigDecimal;
/**
* 请求交易聚合主扫模型
* @className: TradePreorderModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class RequestTradePreorderModel {
/**
* 商户号
*/
@NotBlank(message = "商户号必填项")
private String merchantNo;
/**
* 商户交易单号
*/
@NotBlank(message = "商户交易单号必填项")
@Length(min = 6, max = 50, message = "商户交易单号长度限制6至50位字符串长度")
private String outTradeNo;
/**
* 支付方式
*/
@NotBlank(message = "支付方式必填项")
private String payMode;
/**
* 接入方式
*/
@NotBlank(message = "接入方式必填项")
private String transType;
/**
* 交易金额
*/
@DecimalMax(value = "99999999", message = "交易最大金额99999999元")
@DecimalMin(value = "0.01", message = "交易最小金额0.01元")
@NotBlank(message = "交易金额必填项")
private String totalAmount;
/**
* 订单标题
*/
private String subject;
/**
* 通知地址
*/
private String notifyUrl;
/**
* 用户id
*/
@NotBlank(message = "用户标识必填项")
private String userId;
/**
* 子商户公众账号ID
*/
private String subAppid;
/**
* 预下单有效时间
*/
@Range(min = 1, max = 60,message = "预下单有效期可设置在1至60分钟之内")
private Integer timeoutExpress;
/**
* 附加域
*/
private String attach;
/**
* 分账 0不分账 1需分账
*/
@Range(min = 0, max = 1,message = "分账类型错误")
@NotBlank(message = "分账类型必填项")
private String profitSharing;
/**
* 签名参数
*/
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,74 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.Date;
/**
* 响应查询交易模型
* @className: TradePreorderModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class ResponseQueryTradeModel {
/**
* 商户号
*/
private String merchantNo;
/**
* 商户交易单号
*/
private String outTradeNo;
/**
* 账户端交易单号
*/
private String accTradeNo;
/**
* 用户标识
*/
private String userId;
/**
* 支付方式
*/
private String payMode;
/**
* 交易金额
*/
private BigDecimal tradeAmount;
/**
* 交易实付金额
*/
private BigDecimal tradeActualAmount;
/**
* 交易状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 支付时间
*/
private Date payTime;
/**
* 签名参数
*/
private String sign;
}

@ -0,0 +1,60 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 请求查询交易模型
* @className: TradePreorderModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class ResponseRefundTradeModel {
/**
* 商户号
*/
private String merchantNo;
/**
* 商户交易单号
*/
private String outTradeNo;
/**
* 支付方式
*/
private String payMode;
/**
* 退款单号
*/
private String refundTradeNo;
/**
* 退款金额
*/
private String refundAmount;
/**
* 退款原因
*/
private String refundReason;
/**
* 退款时间
*/
private Date refundTime;
/**
* 签名参数
*/
private String sign;
}

@ -0,0 +1,52 @@
package com.hfkj.openapi.v1.model;
import java.util.Objects;
/**
* toekn 授权类型
* @className: TokenGrantType
* @author: HuRui
* @date: 2023/5/23
**/
public enum TokenGrantType {
CLIENT_CREDENTIALS("client_credentials", "客户访问凭证"),
;
private String code;
private String name;
TokenGrantType(String code, String name) {
this.code = code;
this.name = name;
}
/**
* @return
*/
public static TokenGrantType getDataByCode(String code) {
for (TokenGrantType ele : values()) {
if (Objects.equals(code,ele.getCode())) {
return ele;
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,37 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
/**
* @className: TokenModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class TokenModel {
/**
* 授权类型
*/
private String grantType;
/**
* token
*/
private String token;
/**
* 有效期
*/
private Long expiresTime;
public TokenModel(TokenGrantType grantType, String token, Long expiresTime) {
this.grantType = grantType.getCode();
this.token = token;
this.expiresTime = expiresTime;
}
}

@ -1,15 +0,0 @@
package com.hfkj.openapi.v1.model;
import lombok.Data;
/**
* 交易聚合主扫模型
* @className: TradePreorderModel
* @author: HuRui
* @date: 2023/5/23
**/
@Data
public class TradePreorderModel {
}

@ -0,0 +1,25 @@
package com.hfkj.openapi.v1.service;
import com.hfkj.openapi.v1.model.TokenModel;
/**
* @className: AuthTokenService
* @author: HuRui
* @date: 2023/5/23
**/
public interface AuthTokenService {
/**
* 创建token
* @param merNo
* @return
*/
TokenModel createToken(String merNo);
/**
* 刷新token
* @param merNo
* @return
*/
TokenModel refresh(String merNo);
}

@ -0,0 +1,43 @@
package com.hfkj.openapi.v1.service;
import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.openapi.v1.model.RequestRefundTradeModel;
import com.hfkj.openapi.v1.model.ResponseRefundTradeModel;
import java.util.Map;
/**
* @className: TradeOrder
* @author: HuRui
* @date: 2023/5/24
**/
public interface OpenApiTradeOrderService {
/**
* 创建订单
* @return
*/
Map<String, Object> createOrder(BsTradeOrder tradeOrder) throws Exception;
/**
* 根据交易流水查询订单
* @param outTradeNo
* @return
*/
BsTradeOrder getOrderByOutTradeNo(String outTradeNo);
/**
* 退款接口
* @param refundTrade
* @return
*/
ResponseRefundTradeModel refund(RequestRefundTradeModel refundTrade);
/**
* 根据退款单号查询退款信息
* @param refundNo
* @return
*/
BsTradeOrderRefund getRefundByNo(String refundNo);
}

@ -0,0 +1,49 @@
package com.hfkj.openapi.v1.service.impl;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.GenerateUtil;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.openapi.v1.model.TokenGrantType;
import com.hfkj.openapi.v1.model.TokenModel;
import com.hfkj.openapi.v1.service.AuthTokenService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @className: AuthTokenServiceImpl
* @author: HuRui
* @date: 2023/5/23
**/
@Service("authTokenService")
public class AuthTokenServiceImpl implements AuthTokenService {
public static String OPEN_API_TOKEN = "_OPEN_API_TOKEN";
private static Long expiresTime = 7200L;
@Resource
private RedisUtil redisUtil;
@Override
public TokenModel createToken(String merNo) {
// 生成64位字符token;
String token = GenerateUtil.generateRandomString(64);
redisUtil.set(merNo+OPEN_API_TOKEN, token, 7200);
return new TokenModel(TokenGrantType.CLIENT_CREDENTIALS, token, expiresTime);
}
@Override
public TokenModel refresh(String merNo) {
Object token = redisUtil.get(merNo+OPEN_API_TOKEN);
if (token == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_TOKEN_ERR, "");
}
redisUtil.set(merNo+OPEN_API_TOKEN, token.toString(), 7200);
return new TokenModel(TokenGrantType.CLIENT_CREDENTIALS, token.toString(), expiresTime);
}
}

@ -0,0 +1,97 @@
package com.hfkj.openapi.v1.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.lakala.LaKaLaTradeService;
import com.hfkj.entity.BsTradeOrder;
import com.hfkj.entity.BsTradeOrderExample;
import com.hfkj.entity.BsTradeOrderRefund;
import com.hfkj.openapi.v1.model.RequestRefundTradeModel;
import com.hfkj.openapi.v1.model.ResponseRefundTradeModel;
import com.hfkj.openapi.v1.service.OpenApiTradeOrderService;
import com.hfkj.openapi.v1.utils.SignatureUtil;
import com.hfkj.service.BsMerKeyService;
import com.hfkj.service.BsTradeOrderRefundService;
import com.hfkj.service.BsTradeOrderService;
import com.hfkj.sysenum.TradeOrderRefundStatusEnum;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Map;
/**
* @className: TradeOrderServiceImpl
* @author: HuRui
* @date: 2023/5/24
**/
@Service("openApiTradeOrderService")
public class OpenApiTradeOrderServiceImpl implements OpenApiTradeOrderService {
@Resource
private BsTradeOrderService bsTradeOrderService;
@Resource
private BsTradeOrderRefundService bsTradeOrderRefundService;
@Resource
private BsMerKeyService merKeyService;
@Resource
private LaKaLaTradeService laKaLaTradeService;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public Map<String, Object> createOrder(BsTradeOrder tradeOrder) throws Exception {
bsTradeOrderService.editOrder(tradeOrder);
Map<String, Object> preorder = laKaLaTradeService.preorder(tradeOrder.getOutTradeNo());
preorder.put("merchantNo", tradeOrder.getMerNo());
preorder.put("outTradeNo", tradeOrder.getOutTradeNo());
// 取出支付参数
JSONObject payParam = JSONObject.parseObject(MapUtils.getString(preorder, "payParam"));
preorder.put("payParam", payParam.getJSONObject("acc_resp_fields"));
preorder.remove("platformType");
preorder.remove("order");
preorder.put("sign", SignatureUtil.createSign(preorder, merKeyService.getKeyByMerNo(tradeOrder.getMerNo())));
return preorder;
}
@Override
public BsTradeOrder getOrderByOutTradeNo(String outTradeNo) {
return bsTradeOrderService.getOrderByOutTradeNo(outTradeNo);
}
@Override
public ResponseRefundTradeModel refund(RequestRefundTradeModel refundTrade) {
/* BsTradeOrderRefund orderRefund = new BsTradeOrderRefund();
orderRefund.setTradeOrderId(order.getId());
orderRefund.setOutTradeNo(order.getOutTradeNo());
orderRefund.setTradeOrderId(order.getId());
orderRefund.setAgentId(order.getAgentId());
orderRefund.setSalesmanId(order.getSalesmanId());
orderRefund.setMerId(order.getMerId());
orderRefund.setStoreId(order.getStoreId());
orderRefund.setPlatformType(order.getPlatformType());
orderRefund.setRefundNo(refundNo);
orderRefund.setTotalAmount(order.getTradeAmount());
orderRefund.setRefundAmount(body.getBigDecimal("refundAmount"));
orderRefund.setRefundReason(body.getString("refundReason"));
orderRefund.setStatus(TradeOrderRefundStatusEnum.status1.getNumber());
orderRefund.setOperatorId(userInfoModel.getSecUser().getId());
orderRefund.setOperatorName(userInfoModel.getSecUser().getUserName());
bsTradeOrderRefundService.tradeOrderRefund()*/
return null;
}
@Override
public BsTradeOrderRefund getRefundByNo(String refundNo) {
return bsTradeOrderRefundService.getRefundByRefundNo(refundNo);
}
}

@ -1,31 +0,0 @@
package com.hfkj.openapi.v1.utils;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import java.security.MessageDigest;
/**
* MD5 加密
*/
public class MD5Util {
/**
* 加密
* @param data
* @return
* @throws Exception
*/
public static String encode(byte[] data) throws Exception {
// 初始化MessageDigest
MessageDigest md = MessageDigest.getInstance("MD5");
// 执行摘要信息
byte[] digest = md.digest(data);
// 将摘要信息转换为32位的十六进制字符串
return new String(new HexBinaryAdapter().marshal(digest));
}
public static void main(String[] args) throws Exception {
String str = "123456";
System.out.println(MD5Util.encode(str.getBytes("UTF-8")));
//String ee = "29AD0E3FD3DB681FB9F8091C756313F7";
}
}

@ -0,0 +1,89 @@
package com.hfkj.openapi.v1.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import java.security.MessageDigest;
import java.util.Map;
import java.util.Set;
/**
* 签名工具类
*/
public class SignatureUtil {
/**
* 参数签名
* @param param 参数
* @param key 秘钥
* @return
* @throws Exception
*/
public static String createSign(Object param, String key) throws Exception {
Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class);
return md5Encode(paramSort(map, key).getBytes());
}
/**
* 验证签名
* @param checkSign 需验证的签名字符串
* @param param 参数
* @param key 秘钥
* @return
* @throws Exception
*/
public static Boolean checkSign(String checkSign,Object param, String key) throws Exception {
Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class);
// 去除签名
map.remove("sign");
if (checkSign.equals(md5Encode(paramSort(map, key).getBytes()))) {
return true;
}
return false;
}
/**
* 参数排序
* @param param
* @return
*/
public static String paramSort(final Map<String, Object> param, String key) {
Set<String> keySet = param.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (StringUtils.isBlank(sb.toString())) {
sb.append(k).append("=").append(param.get(k));
} else {
sb.append("&").append(k).append("=").append(param.get(k));
}
}
sb.append("&key=").append(key);
return sb.toString();
}
/**
* MD5加密
* @param data
* @return
* @throws Exception
*/
public static String md5Encode(byte[] data) throws Exception {
// 初始化MessageDigest
MessageDigest md = MessageDigest.getInstance("MD5");
// 执行摘要信息
byte[] digest = md.digest(data);
// 将摘要信息转换为32位的十六进制字符串
return new String(new HexBinaryAdapter().marshal(digest));
}
public static void main(String[] args) throws Exception {
String paramStr = "{\n" +
" \"merchantNo\": \"2023030909414450700\",\n" +
" \"outTradeNo\": \"ZF1130202305051459532538978807\"" +
"}";
String sign = createSign(JSONObject.parseObject(paramStr), "LRL9uflTQGeyp9yVWDD6orhBp2VhYDvP");
System.out.println(sign);
}
}

@ -0,0 +1,24 @@
package com.hfkj.service;
import java.util.Map;
/**
* @className: BsMerKeyService
* @author: HuRui
* @date: 2023/5/23
**/
public interface BsMerKeyService {
/**
* 查询详情
* @param merNo
*/
Map<String,Object> getDetailByMerNo(String merNo);
/**
* 查询key
* @param merNo
* @return
*/
String getKeyByMerNo(String merNo);
}

@ -60,6 +60,13 @@ public interface BsMerService {
*/ */
BsMer getMer(Long merId); BsMer getMer(Long merId);
/**
* 查询商户详情
* @param merNo
* @return
*/
BsMer getMer(String merNo);
/** /**
* 复议提交 * 复议提交
* @param merId * @param merId

@ -0,0 +1,38 @@
package com.hfkj.service.impl;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsMerKeyMapper;
import com.hfkj.service.BsMerKeyService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/**
* @className: BsMerKeyServiceImpl
* @author: HuRui
* @date: 2023/5/23
**/
@Service("merKeyService")
public class BsMerKeyServiceImpl implements BsMerKeyService {
@Resource
private BsMerKeyMapper merKeyMapper;
@Override
public Map<String, Object> getDetailByMerNo(String merNo) {
Map<String, Object> key = merKeyMapper.queryKeyByMerNo(merNo);
if (key == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_KEY_ERR, "");
}
return key;
}
@Override
public String getKeyByMerNo(String merNo) {
return MapUtils.getString(getDetailByMerNo(merNo), "merKey");
}
}

@ -423,6 +423,17 @@ public class BsMerServiceImpl implements BsMerService {
return merMapper.selectByPrimaryKey(merId); return merMapper.selectByPrimaryKey(merId);
} }
@Override
public BsMer getMer(String merNo) {
BsMerExample example = new BsMerExample();
example.createCriteria().andMerNoEqualTo(merNo).andMerStatusEqualTo(MerStatusEnum.status1.getNumber());
List<BsMer> merList = merMapper.selectByExample(example);
if (merList.size() > 0) {
return merList.get(0);
}
return null;
}
@Override @Override
public void reconsider(Long merId) throws Exception { public void reconsider(Long merId) throws Exception {
merContractService.reconsider(merId); merContractService.reconsider(merId);

@ -0,0 +1,49 @@
package com.hfkj.sysenum;
import java.util.Objects;
/**
* 交易订单创建类型
* @className: TradeOrderCreateType
* @author: HuRui
* @date: 2023/5/24
**/
public enum TradeOrderCreateTypeEnum {
type1(1, "扫一扫"),
type2(2, "被扫"),
type3(3, "API");
private Integer code;
private String name;
TradeOrderCreateTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static TradeOrderCreateTypeEnum getNameByCode(Integer code) {
for (TradeOrderCreateTypeEnum ele : values()) {
if (Objects.equals(code,ele.getCode())) {
return ele;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Loading…
Cancel
Save