openapi业务

master
胡锐 2 months ago
parent 14a6bbce12
commit 058d13bb98
  1. 16
      bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.java
  2. 72
      openapi/src/main/java/com/openapi/controller/BsGasController.java
  3. 181
      openapi/src/main/java/com/openapi/controller/BsGasOrderController.java
  4. 8
      service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java
  5. 7
      service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumGasService.java
  6. 12
      service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
  7. 159
      service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapper.java
  8. 7
      service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapperExt.java
  9. 444
      service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordSqlProvider.java
  10. 16
      service/src/main/java/com/hfkj/dao/BsAgentApiParamMapper.java
  11. 18
      service/src/main/java/com/hfkj/dao/BsAgentApiParamMapperExt.java
  12. 28
      service/src/main/java/com/hfkj/dao/BsAgentApiParamSqlProvider.java
  13. 4
      service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java
  14. 33
      service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java
  15. 14
      service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java
  16. 26
      service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java
  17. 14
      service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java
  18. 358
      service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecord.java
  19. 1494
      service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecordExample.java
  20. 32
      service/src/main/java/com/hfkj/entity/BsAgentApiParam.java
  21. 140
      service/src/main/java/com/hfkj/entity/BsAgentApiParamExample.java
  22. 16
      service/src/main/java/com/hfkj/entity/BsGasOrder.java
  23. 60
      service/src/main/java/com/hfkj/entity/BsGasOrderExample.java
  24. 16
      service/src/main/java/com/hfkj/entity/BsOrderRefund.java
  25. 60
      service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java
  26. 29
      service/src/main/java/com/hfkj/openapi/model/GasOilPriceDetail.java
  27. 24
      service/src/main/java/com/hfkj/openapi/model/request/RequestOrderDetailModel.java
  28. 40
      service/src/main/java/com/hfkj/openapi/model/request/RequestOrderPushModel.java
  29. 26
      service/src/main/java/com/hfkj/openapi/model/request/RequestOrderRefundModel.java
  30. 7
      service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasInfoModel.java
  31. 8
      service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasListModel.java
  32. 38
      service/src/main/java/com/hfkj/openapi/model/response/OrderRefundNotifyModel.java
  33. 21
      service/src/main/java/com/hfkj/openapi/model/response/QueryGasGun.java
  34. 69
      service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderDetailModel.java
  35. 27
      service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderPushModel.java
  36. 22
      service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasInfoModel.java
  37. 423
      service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java
  38. 64
      service/src/main/java/com/hfkj/openapi/service/ApiGasService.java
  39. 24
      service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountRecordService.java
  40. 28
      service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountService.java
  41. 9
      service/src/main/java/com/hfkj/service/agent/BsAgentApiParamService.java
  42. 16
      service/src/main/java/com/hfkj/service/agent/BsAgentMerService.java
  43. 92
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountRecordServiceImpl.java
  44. 173
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountServiceImpl.java
  45. 5
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiParamServiceImpl.java
  46. 57
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java
  47. 5
      service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java
  48. 2
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  49. 2
      service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java
  50. 59
      service/src/main/java/com/hfkj/sysenum/gas/GasOrderCreateType.java
  51. 9
      service/src/main/java/com/hfkj/sysenum/merchant/MerchantStatusEnum.java
  52. 4
      service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java

@ -6,8 +6,11 @@ import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.common.security.AESEncodeUtil;
import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsOrderRefund;
import com.hfkj.openapi.model.request.RequestOrderRefundModel;
import com.hfkj.openapi.service.ApiGasOrderService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
@ -34,6 +37,8 @@ public class NewLinkNotify {
private BsOrderRefundService orderRefundService;
@Resource
private BsGasOrderService gasOrderService;
@Resource
private ApiGasOrderService apiGasOrderService;
@RequestMapping(value="/merChange",method = RequestMethod.POST)
@ResponseBody
@ -72,8 +77,15 @@ public class NewLinkNotify {
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(data.getString("thirdOrderNo"));
if (gasOrder != null) {
// 退款
orderRefundService.tradeOrderChildRefund(gasOrder.getChannelOrderNo(), false,1, data.getString("refundFailReason"));
if (gasOrder.getCreateType().equals(GasOrderCreateType.TYPE1.getNumber())) {
// 退款
orderRefundService.tradeOrderChildRefund(gasOrder.getChannelOrderNo(), false,1, data.getString("refundFailReason"));
} else if (gasOrder.getCreateType().equals(GasOrderCreateType.TYPE2.getNumber())) {
// 退款
RequestOrderRefundModel requestOrderRefund = new RequestOrderRefundModel();
requestOrderRefund.setOrderNo(gasOrder.getOrderNo());
apiGasOrderService.refundOrder(requestOrderRefund);
}
}
}

@ -1,29 +1,22 @@
package com.openapi.controller;
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.pay.util.SignatureUtil;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentApiLogWithBLOBs;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.entity.BsDiscountUser;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.model.request.*;
import com.hfkj.openapi.model.response.*;
import com.hfkj.openapi.service.ApiGasService;
import com.hfkj.service.agent.BsAgentApiLogService;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentDiscountService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.sysenum.discount.DiscountStockCodeObtainTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -36,10 +29,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Controller
@RequestMapping(value = "/gas")
@ -52,8 +47,6 @@ public class BsGasController {
private BsAgentMerService agentMerService;
@Resource
private ApiGasService apiGasService;
@Resource
private BsAgentApiLogService agentApiLogService;
@RequestMapping(value="/queryList",method = RequestMethod.POST)
@ResponseBody
@ -61,94 +54,57 @@ public class BsGasController {
public ResponseData queryList(@Validated @RequestBody RequestQueryGasListModel body) {
log.info("========= Start 分页获取(全量)油站信息 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 验证请求id
if (agentApiLogService.isExist(body.getAppId(), body.getReqId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_ID_ERR, "");
PageHelper.startPage(body.getPageNum(), body.getPageSize());
PageInfo<ResponseQueryGasInfoModel> response = new PageInfo<>(agentMerService.getMerNoList(apiParam.getAgentId()));
for (int i = 0; i < response.getList().size();i++) {
response.getList().set(i, apiGasService.queryGasInfo(response.getList().get(i).getGasNo()));
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("gas/queryList");
apiLog.setRequestParam(JSONObject.toJSONString(body));
ResponseQueryGasListModel response = new ResponseQueryGasListModel();
response.setReqId(body.getReqId());
response.setAppId(body.getAppId());
response.setSign(SignatureUtil.createSign(response, agentApiParamService.getParamByAppId(body.getAppId()).getAppSecret()));
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);
} catch (Exception e) {
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 分页获取(全量)油站信息 END ===========");
}
}
@RequestMapping(value="/queryGasInfoByGasNo",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取油站信息")
public ResponseData queryGasInfoByGasNo(@Validated @RequestBody RequestQueryGasInfoModel body) {
log.info("========= Start 获取油站信息 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
// 验证请求id
if (agentApiLogService.isExist(body.getAppId(), body.getReqId())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_REQ_ID_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestId(body.getReqId());
apiLog.setRequestUrl("gas/queryGasInfoByGasNo");
apiLog.setRequestParam(JSONObject.toJSONString(body));
// 查询油站
BsAgentMer agentMer = agentMerService.getDetailByAgent(apiParam.getAgentId(), body.getGasNo());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未查到加油站信息");
}
ResponseQueryGasInfoModel response = apiGasService.queryGasInfo(apiParam.getAgentId(), body.getGasNo());
ResponseQueryGasInfoModel response = apiGasService.queryGasInfo(body.getGasNo());
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 获取油站信息 END ===========");
}
}

@ -0,0 +1,181 @@
package com.openapi.controller;
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.pay.util.SignatureUtil;
import com.hfkj.common.security.AESEncodeUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentApiAccount;
import com.hfkj.entity.BsAgentApiLogWithBLOBs;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.model.ResponseData;
import com.hfkj.openapi.model.request.*;
import com.hfkj.openapi.model.response.ResponseOrderDetailModel;
import com.hfkj.openapi.model.response.ResponseOrderPushModel;
import com.hfkj.openapi.model.response.ResponseQueryGasInfoModel;
import com.hfkj.openapi.service.ApiGasOrderService;
import com.hfkj.openapi.service.ApiGasService;
import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.service.agent.BsAgentApiLogService;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentMerService;
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.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;
@Controller
@RequestMapping(value = "/gasOrder")
@Api(value = "油站管理")
public class BsGasOrderController {
private static Logger log = LoggerFactory.getLogger(BsGasOrderController.class);
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsAgentMerService agentMerService;
@Resource
private ApiGasOrderService apiGasOrderService;
@Resource
private BsAgentApiAccountService agentApiAccountService;
@Resource
private BsAgentApiLogService agentApiLogService;
@RequestMapping(value="/push",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "推送订单")
public ResponseData push(@Validated @RequestBody RequestOrderPushModel body) {
log.info("========= Start 推送订单 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestUrl("gasOrder/push");
apiLog.setRequestParam(JSONObject.toJSONString(body));
// 查询账户
BsAgentApiAccount account = agentApiAccountService.getAccount(apiParam.getAgentId());
if (account == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易账户");
}
// 余额是否小于消费余额
if (account.getAmount().compareTo(body.getRefuelingAmount()) == -1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "账户余额不足");
}
ResponseOrderPushModel response = apiGasOrderService.pushOrder(apiParam.getAgentId(), body);
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 推送订单 END ===========");
}
}
@RequestMapping(value="/queryOrderDetail",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询订单详情")
public ResponseData queryOrderDetail(@Validated @RequestBody RequestOrderDetailModel body) {
log.info("========= Start 查询订单详情 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestUrl("gasOrder/queryOrderDetail");
apiLog.setRequestParam(JSONObject.toJSONString(body));
ResponseOrderDetailModel response = apiGasOrderService.queryOrderDetail(body);
log.info("返回参数:" + JSONObject.toJSONString(response));
apiLog.setResponseParam(JSONObject.toJSONString(response));
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 查询订单详情 END ===========");
}
}
@RequestMapping(value="/refund",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "退款申请")
public ResponseData refund(@Validated @RequestBody RequestOrderRefundModel body) {
log.info("========= Start 退款申请 Start ===========");
log.info("请求参数:" + JSONObject.toJSONString(body));
BsAgentApiLogWithBLOBs apiLog = new BsAgentApiLogWithBLOBs();
try {
// 验证签名
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(body.getAppId());
if (!SignatureUtil.checkSign(body.getSign(), body, apiParam.getAppSecret())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, "");
}
apiLog.setAppId(body.getAppId());
apiLog.setRequestUrl("gasOrder/refund");
apiLog.setRequestParam(JSONObject.toJSONString(body));
String response = apiGasOrderService.refundOrder(body);
log.info("返回参数:" + response);
apiLog.setResponseParam(response);
return ResponseMsgUtil.success(response);
} catch (Exception e) {
log.info("出现异常:", e);
// 异常内容
ResponseData exception = ResponseMsgUtil.exception(e);
apiLog.setErrorContent(JSONObject.toJSONString(exception));
return exception;
} finally {
// 记录日志
if (apiLog.getAppId() != null) {
agentApiLogService.edit(apiLog);
}
log.info("========= END 退款申请 END ===========");
}
}
}

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.BsGasOilGunNo;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.BsMerchant;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.gas.BsGasService;
@ -42,7 +43,8 @@ public class NewLinkGasService {
private BsGasOilPriceService gasOilPriceService;
@Resource
private BsGasOilGunNoService gasOilGunNoService;
@Resource
private BsAgentMerService agentMerService;
/**
* 刷取全量油站
* @throws Exception
@ -341,6 +343,8 @@ public class NewLinkGasService {
gasOilGunNoService.cleanCache(merchant.getMerNo());
// 清除油站缓存
gasService.clean(merchant.getMerNo());
// 通知代理
agentMerService.agentNotify(merNo);
}
else if ("120000".equals(response.getString("code"))) {
/*** 油站下线 ***/
@ -351,6 +355,8 @@ public class NewLinkGasService {
// 修改商户信息
merchantService.updateMerchant(merchant);
}
// 通知代理
agentMerService.agentNotify(merNo);
}
}

@ -3,9 +3,11 @@ package com.hfkj.channel.gas.shell;
import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.entity.BsGasOilGunNo;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.BsMerchant;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.gas.BsGasService;
@ -43,7 +45,8 @@ public class CqShellPetroleumGasService {
private BsGasOilPriceService gasOilPriceService;
@Resource
private BsGasOilGunNoService gasOilGunNoService;
@Resource
private BsAgentMerService agentMerService;
/**
* 刷取全量油站
* @throws Exception
@ -211,6 +214,8 @@ public class CqShellPetroleumGasService {
gasOilGunNoService.cleanCache(merchant.getMerNo());
// 清除油站缓存
gasService.clean(merchant.getMerNo());
// 通知代理
agentMerService.agentNotify(merchant.getMerNo());
} catch (Exception e) {
System.out.println("更新油站失败");
}

@ -21,9 +21,13 @@ public class SignatureUtil {
* @return
* @throws Exception
*/
public static String createSign(Object param, String key) throws Exception {
public static String createSign(Object param, String key) {
Map map = JSONObject.parseObject(JSONObject.toJSONString(param), Map.class);
return md5Encode(paramSort(map, key).getBytes());
try {
return md5Encode(paramSort(map, key).getBytes());
} catch (Exception e) {
return null;
}
}
/**
@ -82,8 +86,8 @@ public class SignatureUtil {
public static void main(String[] args) throws Exception {
String paramStr = "{\n" +
"\t\"appid\": \"hf7356c71fb97ab0\",\n" +
"\t\"phone\": \"17726395120\"" +
" \"appId\": \"hf7356c71fb97ab0\",\n" +
" \"orderNo\": \"123456\"" +
"}";
String sign = createSign(JSONObject.parseObject(paramStr), "8aef995ff71485dc19b36e35f04c4016");
System.out.println(sign);

@ -0,0 +1,159 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentApiAccountRecord;
import com.hfkj.entity.BsAgentApiAccountRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsAgentApiAccountRecordMapper extends BsAgentApiAccountRecordMapperExt {
@SelectProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="countByExample")
long countByExample(BsAgentApiAccountRecordExample example);
@DeleteProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="deleteByExample")
int deleteByExample(BsAgentApiAccountRecordExample example);
@Delete({
"delete from bs_agent_api_account_record",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_agent_api_account_record (agent_api_account_id, agent_id, ",
"`type`, transaction_amount, ",
"before_amount, after_amount, ",
"source_type, source_id, ",
"source_order_no, source_content, ",
"`status`, create_time, ",
"op_user_type, op_user_id, ",
"op_user_name, op_user_phone, ",
"ext_1, ext_2, ext_3)",
"values (#{agentApiAccountId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{type,jdbcType=INTEGER}, #{transactionAmount,jdbcType=DECIMAL}, ",
"#{beforeAmount,jdbcType=DECIMAL}, #{afterAmount,jdbcType=DECIMAL}, ",
"#{sourceType,jdbcType=INTEGER}, #{sourceId,jdbcType=BIGINT}, ",
"#{sourceOrderNo,jdbcType=VARCHAR}, #{sourceContent,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{opUserType,jdbcType=INTEGER}, #{opUserId,jdbcType=BIGINT}, ",
"#{opUserName,jdbcType=VARCHAR}, #{opUserPhone,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsAgentApiAccountRecord record);
@InsertProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsAgentApiAccountRecord record);
@SelectProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_api_account_id", property="agentApiAccountId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="after_amount", property="afterAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
@Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
@Result(column="source_order_no", property="sourceOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="op_user_phone", property="opUserPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsAgentApiAccountRecord> selectByExample(BsAgentApiAccountRecordExample example);
@Select({
"select",
"id, agent_api_account_id, agent_id, `type`, transaction_amount, before_amount, ",
"after_amount, source_type, source_id, source_order_no, source_content, `status`, ",
"create_time, op_user_type, op_user_id, op_user_name, op_user_phone, ext_1, ext_2, ",
"ext_3",
"from bs_agent_api_account_record",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_api_account_id", property="agentApiAccountId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="after_amount", property="afterAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
@Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
@Result(column="source_order_no", property="sourceOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="op_user_phone", property="opUserPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsAgentApiAccountRecord selectByPrimaryKey(Long id);
@UpdateProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsAgentApiAccountRecord record, @Param("example") BsAgentApiAccountRecordExample example);
@UpdateProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsAgentApiAccountRecord record, @Param("example") BsAgentApiAccountRecordExample example);
@UpdateProvider(type=BsAgentApiAccountRecordSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsAgentApiAccountRecord record);
@Update({
"update bs_agent_api_account_record",
"set agent_api_account_id = #{agentApiAccountId,jdbcType=BIGINT},",
"agent_id = #{agentId,jdbcType=BIGINT},",
"`type` = #{type,jdbcType=INTEGER},",
"transaction_amount = #{transactionAmount,jdbcType=DECIMAL},",
"before_amount = #{beforeAmount,jdbcType=DECIMAL},",
"after_amount = #{afterAmount,jdbcType=DECIMAL},",
"source_type = #{sourceType,jdbcType=INTEGER},",
"source_id = #{sourceId,jdbcType=BIGINT},",
"source_order_no = #{sourceOrderNo,jdbcType=VARCHAR},",
"source_content = #{sourceContent,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"op_user_type = #{opUserType,jdbcType=INTEGER},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",
"op_user_name = #{opUserName,jdbcType=VARCHAR},",
"op_user_phone = #{opUserPhone,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsAgentApiAccountRecord record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsAgentApiAccountRecordMapperExt {
}

@ -0,0 +1,444 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentApiAccountRecord;
import com.hfkj.entity.BsAgentApiAccountRecordExample.Criteria;
import com.hfkj.entity.BsAgentApiAccountRecordExample.Criterion;
import com.hfkj.entity.BsAgentApiAccountRecordExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsAgentApiAccountRecordSqlProvider {
public String countByExample(BsAgentApiAccountRecordExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_agent_api_account_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsAgentApiAccountRecordExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_agent_api_account_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsAgentApiAccountRecord record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_agent_api_account_record");
if (record.getAgentApiAccountId() != null) {
sql.VALUES("agent_api_account_id", "#{agentApiAccountId,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getTransactionAmount() != null) {
sql.VALUES("transaction_amount", "#{transactionAmount,jdbcType=DECIMAL}");
}
if (record.getBeforeAmount() != null) {
sql.VALUES("before_amount", "#{beforeAmount,jdbcType=DECIMAL}");
}
if (record.getAfterAmount() != null) {
sql.VALUES("after_amount", "#{afterAmount,jdbcType=DECIMAL}");
}
if (record.getSourceType() != null) {
sql.VALUES("source_type", "#{sourceType,jdbcType=INTEGER}");
}
if (record.getSourceId() != null) {
sql.VALUES("source_id", "#{sourceId,jdbcType=BIGINT}");
}
if (record.getSourceOrderNo() != null) {
sql.VALUES("source_order_no", "#{sourceOrderNo,jdbcType=VARCHAR}");
}
if (record.getSourceContent() != null) {
sql.VALUES("source_content", "#{sourceContent,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.VALUES("op_user_type", "#{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}");
}
if (record.getOpUserPhone() != null) {
sql.VALUES("op_user_phone", "#{opUserPhone,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsAgentApiAccountRecordExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("agent_api_account_id");
sql.SELECT("agent_id");
sql.SELECT("`type`");
sql.SELECT("transaction_amount");
sql.SELECT("before_amount");
sql.SELECT("after_amount");
sql.SELECT("source_type");
sql.SELECT("source_id");
sql.SELECT("source_order_no");
sql.SELECT("source_content");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("op_user_type");
sql.SELECT("op_user_id");
sql.SELECT("op_user_name");
sql.SELECT("op_user_phone");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_agent_api_account_record");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsAgentApiAccountRecord record = (BsAgentApiAccountRecord) parameter.get("record");
BsAgentApiAccountRecordExample example = (BsAgentApiAccountRecordExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_agent_api_account_record");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getAgentApiAccountId() != null) {
sql.SET("agent_api_account_id = #{record.agentApiAccountId,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getTransactionAmount() != null) {
sql.SET("transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL}");
}
if (record.getBeforeAmount() != null) {
sql.SET("before_amount = #{record.beforeAmount,jdbcType=DECIMAL}");
}
if (record.getAfterAmount() != null) {
sql.SET("after_amount = #{record.afterAmount,jdbcType=DECIMAL}");
}
if (record.getSourceType() != null) {
sql.SET("source_type = #{record.sourceType,jdbcType=INTEGER}");
}
if (record.getSourceId() != null) {
sql.SET("source_id = #{record.sourceId,jdbcType=BIGINT}");
}
if (record.getSourceOrderNo() != null) {
sql.SET("source_order_no = #{record.sourceOrderNo,jdbcType=VARCHAR}");
}
if (record.getSourceContent() != null) {
sql.SET("source_content = #{record.sourceContent,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
}
if (record.getOpUserPhone() != null) {
sql.SET("op_user_phone = #{record.opUserPhone,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_agent_api_account_record");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("agent_api_account_id = #{record.agentApiAccountId,jdbcType=BIGINT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL}");
sql.SET("before_amount = #{record.beforeAmount,jdbcType=DECIMAL}");
sql.SET("after_amount = #{record.afterAmount,jdbcType=DECIMAL}");
sql.SET("source_type = #{record.sourceType,jdbcType=INTEGER}");
sql.SET("source_id = #{record.sourceId,jdbcType=BIGINT}");
sql.SET("source_order_no = #{record.sourceOrderNo,jdbcType=VARCHAR}");
sql.SET("source_content = #{record.sourceContent,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
sql.SET("op_user_phone = #{record.opUserPhone,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsAgentApiAccountRecordExample example = (BsAgentApiAccountRecordExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsAgentApiAccountRecord record) {
SQL sql = new SQL();
sql.UPDATE("bs_agent_api_account_record");
if (record.getAgentApiAccountId() != null) {
sql.SET("agent_api_account_id = #{agentApiAccountId,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getTransactionAmount() != null) {
sql.SET("transaction_amount = #{transactionAmount,jdbcType=DECIMAL}");
}
if (record.getBeforeAmount() != null) {
sql.SET("before_amount = #{beforeAmount,jdbcType=DECIMAL}");
}
if (record.getAfterAmount() != null) {
sql.SET("after_amount = #{afterAmount,jdbcType=DECIMAL}");
}
if (record.getSourceType() != null) {
sql.SET("source_type = #{sourceType,jdbcType=INTEGER}");
}
if (record.getSourceId() != null) {
sql.SET("source_id = #{sourceId,jdbcType=BIGINT}");
}
if (record.getSourceOrderNo() != null) {
sql.SET("source_order_no = #{sourceOrderNo,jdbcType=VARCHAR}");
}
if (record.getSourceContent() != null) {
sql.SET("source_content = #{sourceContent,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}");
}
if (record.getOpUserPhone() != null) {
sql.SET("op_user_phone = #{opUserPhone,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsAgentApiAccountRecordExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -40,11 +40,13 @@ public interface BsAgentApiParamMapper extends BsAgentApiParamMapperExt {
@Insert({
"insert into bs_agent_api_param (agent_id, app_id, ",
"app_secret, `status`, ",
"app_secret, mer_info_notify, ",
"order_refund_notify, `status`, ",
"create_time, update_time, ",
"ext_1, ext_2, ext_3)",
"values (#{agentId,jdbcType=BIGINT}, #{appId,jdbcType=VARCHAR}, ",
"#{appSecret,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{appSecret,jdbcType=VARCHAR}, #{merInfoNotify,jdbcType=VARCHAR}, ",
"#{orderRefundNotify,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@ -61,6 +63,8 @@ public interface BsAgentApiParamMapper extends BsAgentApiParamMapperExt {
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="app_id", property="appId", jdbcType=JdbcType.VARCHAR),
@Result(column="app_secret", property="appSecret", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_info_notify", property="merInfoNotify", jdbcType=JdbcType.VARCHAR),
@Result(column="order_refund_notify", property="orderRefundNotify", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -72,8 +76,8 @@ public interface BsAgentApiParamMapper extends BsAgentApiParamMapperExt {
@Select({
"select",
"id, agent_id, app_id, app_secret, `status`, create_time, update_time, ext_1, ",
"ext_2, ext_3",
"id, agent_id, app_id, app_secret, mer_info_notify, order_refund_notify, `status`, ",
"create_time, update_time, ext_1, ext_2, ext_3",
"from bs_agent_api_param",
"where id = #{id,jdbcType=BIGINT}"
})
@ -82,6 +86,8 @@ public interface BsAgentApiParamMapper extends BsAgentApiParamMapperExt {
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="app_id", property="appId", jdbcType=JdbcType.VARCHAR),
@Result(column="app_secret", property="appSecret", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_info_notify", property="merInfoNotify", jdbcType=JdbcType.VARCHAR),
@Result(column="order_refund_notify", property="orderRefundNotify", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -105,6 +111,8 @@ public interface BsAgentApiParamMapper extends BsAgentApiParamMapperExt {
"set agent_id = #{agentId,jdbcType=BIGINT},",
"app_id = #{appId,jdbcType=VARCHAR},",
"app_secret = #{appSecret,jdbcType=VARCHAR},",
"mer_info_notify = #{merInfoNotify,jdbcType=VARCHAR},",
"order_refund_notify = #{orderRefundNotify,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",

@ -1,7 +1,23 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentApiParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* mapper扩展类
*/
public interface BsAgentApiParamMapperExt {
}
@Select("select " +
"id," +
"agent_id agentId," +
"app_id appId," +
"app_secret appSecret," +
"mer_info_notify merInfoNotify," +
"order_refund_notify orderRefundNotify" +
"from bs_agent_api_param " +
"where agent_id in (select agent_id from bs_agent_mer where mer_no = #{gasNo} and `status` = 1 GROUP BY agent_id)")
List<BsAgentApiParam> selectParamListByGasNo(@Param("gasNo") String gasNo);
}

@ -40,6 +40,14 @@ public class BsAgentApiParamSqlProvider {
sql.VALUES("app_secret", "#{appSecret,jdbcType=VARCHAR}");
}
if (record.getMerInfoNotify() != null) {
sql.VALUES("mer_info_notify", "#{merInfoNotify,jdbcType=VARCHAR}");
}
if (record.getOrderRefundNotify() != null) {
sql.VALUES("order_refund_notify", "#{orderRefundNotify,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
@ -77,6 +85,8 @@ public class BsAgentApiParamSqlProvider {
sql.SELECT("agent_id");
sql.SELECT("app_id");
sql.SELECT("app_secret");
sql.SELECT("mer_info_notify");
sql.SELECT("order_refund_notify");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
@ -116,6 +126,14 @@ public class BsAgentApiParamSqlProvider {
sql.SET("app_secret = #{record.appSecret,jdbcType=VARCHAR}");
}
if (record.getMerInfoNotify() != null) {
sql.SET("mer_info_notify = #{record.merInfoNotify,jdbcType=VARCHAR}");
}
if (record.getOrderRefundNotify() != null) {
sql.SET("order_refund_notify = #{record.orderRefundNotify,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
@ -152,6 +170,8 @@ public class BsAgentApiParamSqlProvider {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("app_id = #{record.appId,jdbcType=VARCHAR}");
sql.SET("app_secret = #{record.appSecret,jdbcType=VARCHAR}");
sql.SET("mer_info_notify = #{record.merInfoNotify,jdbcType=VARCHAR}");
sql.SET("order_refund_notify = #{record.orderRefundNotify,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
@ -180,6 +200,14 @@ public class BsAgentApiParamSqlProvider {
sql.SET("app_secret = #{appSecret,jdbcType=VARCHAR}");
}
if (record.getMerInfoNotify() != null) {
sql.SET("mer_info_notify = #{merInfoNotify,jdbcType=VARCHAR}");
}
if (record.getOrderRefundNotify() != null) {
sql.SET("order_refund_notify = #{orderRefundNotify,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}

@ -2,6 +2,7 @@ package com.hfkj.dao;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.model.AgentMerAllot;
import com.hfkj.openapi.model.response.ResponseQueryGasInfoModel;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -79,4 +80,7 @@ public interface BsAgentMerMapperExt {
" GROUP BY a.merId " +
" </script> "})
List<AgentMerAllot> getAllotList(@Param("param") Map<String,Object> param);
@Select("<script> select mer_no gasNo from bs_agent_mer where agent_id = #{agentId} and agent_staff_id is null and status = 1 GROUP BY mer_no </script>")
List<ResponseQueryGasInfoModel> getMerNoList(@Param("agentId") Long agentId);
}

@ -64,12 +64,12 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt {
"receipt_status, receipt_fail_remark, ",
"pay_type, pay_serial_no, ",
"pay_channel_order_no, `status`, ",
"create_time, cancel_time, ",
"pay_time, refund_time, ",
"refund_remarks, abnormal, ",
"abnormal_content, ext_1, ",
"ext_2, ext_3, ext_4, ",
"ext_5, ext_6)",
"create_type, create_time, ",
"cancel_time, pay_time, ",
"refund_time, refund_remarks, ",
"abnormal, abnormal_content, ",
"ext_1, ext_2, ext_3, ",
"ext_4, ext_5, ext_6)",
"values (#{orderNo,jdbcType=VARCHAR}, #{orderChildNo,jdbcType=VARCHAR}, ",
"#{channelType,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ",
"#{agentId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR}, ",
@ -95,12 +95,12 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt {
"#{receiptStatus,jdbcType=INTEGER}, #{receiptFailRemark,jdbcType=VARCHAR}, ",
"#{payType,jdbcType=INTEGER}, #{paySerialNo,jdbcType=VARCHAR}, ",
"#{payChannelOrderNo,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ",
"#{payTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ",
"#{refundRemarks,jdbcType=VARCHAR}, #{abnormal,jdbcType=BIT}, ",
"#{abnormalContent,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ",
"#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})"
"#{createType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{cancelTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ",
"#{refundTime,jdbcType=TIMESTAMP}, #{refundRemarks,jdbcType=VARCHAR}, ",
"#{abnormal,jdbcType=BIT}, #{abnormalContent,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ",
"#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsGasOrder record);
@ -163,6 +163,7 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt {
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_channel_order_no", property="payChannelOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@ -190,9 +191,9 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt {
"gas_price_platform, gas_price_cost, gas_oil_liters, gas_discount, gas_oil_subsidy, ",
"gas_liters_preferences, gas_price_preferences, gas_class_group_id, gas_class_group_name, ",
"gas_class_group_task_id, gas_staff_id, gas_staff_name, receipt_status, receipt_fail_remark, ",
"pay_type, pay_serial_no, pay_channel_order_no, `status`, create_time, cancel_time, ",
"pay_time, refund_time, refund_remarks, abnormal, abnormal_content, ext_1, ext_2, ",
"ext_3, ext_4, ext_5, ext_6",
"pay_type, pay_serial_no, pay_channel_order_no, `status`, create_type, create_time, ",
"cancel_time, pay_time, refund_time, refund_remarks, abnormal, abnormal_content, ",
"ext_1, ext_2, ext_3, ext_4, ext_5, ext_6",
"from bs_gas_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -249,6 +250,7 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt {
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_channel_order_no", property="payChannelOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@ -327,6 +329,7 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt {
"pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},",
"pay_channel_order_no = #{payChannelOrderNo,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_type = #{createType,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"cancel_time = #{cancelTime,jdbcType=TIMESTAMP},",
"pay_time = #{payTime,jdbcType=TIMESTAMP},",

@ -232,6 +232,10 @@ public class BsGasOrderSqlProvider {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateType() != null) {
sql.VALUES("create_type", "#{createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -345,6 +349,7 @@ public class BsGasOrderSqlProvider {
sql.SELECT("pay_serial_no");
sql.SELECT("pay_channel_order_no");
sql.SELECT("`status`");
sql.SELECT("create_type");
sql.SELECT("create_time");
sql.SELECT("cancel_time");
sql.SELECT("pay_time");
@ -583,6 +588,10 @@ public class BsGasOrderSqlProvider {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateType() != null) {
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -695,6 +704,7 @@ public class BsGasOrderSqlProvider {
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
sql.SET("pay_channel_order_no = #{record.payChannelOrderNo,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
@ -922,6 +932,10 @@ public class BsGasOrderSqlProvider {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateType() != null) {
sql.SET("create_type = #{createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -48,10 +48,11 @@ public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
"refund_pay_channel_order_no, refund_price, ",
"refund_integral, refund_remark, ",
"refund_status, refund_fail_reason, ",
"create_time, update_time, ",
"finish_time, op_user_type, ",
"op_user_id, op_user_name, ",
"ext_1, ext_2, ext_3)",
"create_type, create_time, ",
"update_time, finish_time, ",
"op_user_type, op_user_id, ",
"op_user_name, ext_1, ",
"ext_2, ext_3)",
"values (#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, ",
"#{orderNo,jdbcType=VARCHAR}, #{orderChildNo,jdbcType=VARCHAR}, ",
"#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ",
@ -61,10 +62,11 @@ public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
"#{refundPayChannelOrderNo,jdbcType=VARCHAR}, #{refundPrice,jdbcType=DECIMAL}, ",
"#{refundIntegral,jdbcType=BIGINT}, #{refundRemark,jdbcType=VARCHAR}, ",
"#{refundStatus,jdbcType=INTEGER}, #{refundFailReason,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{finishTime,jdbcType=TIMESTAMP}, #{opUserType,jdbcType=INTEGER}, ",
"#{opUserId,jdbcType=BIGINT}, #{opUserName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{createType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ",
"#{opUserType,jdbcType=INTEGER}, #{opUserId,jdbcType=BIGINT}, ",
"#{opUserName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsOrderRefund record);
@ -94,6 +96,7 @@ public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
@Result(column="refund_remark", property="refundRemark", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_status", property="refundStatus", jdbcType=JdbcType.INTEGER),
@Result(column="refund_fail_reason", property="refundFailReason", jdbcType=JdbcType.VARCHAR),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@ -111,8 +114,9 @@ public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
"id, mer_id, mer_no, order_no, order_child_no, user_id, user_phone, refund_order_no, ",
"account_merchant_no, account_merchant_key, refund_pay_channel, refund_pay_type, ",
"refund_serial_no, refund_pay_channel_order_no, refund_price, refund_integral, ",
"refund_remark, refund_status, refund_fail_reason, create_time, update_time, ",
"finish_time, op_user_type, op_user_id, op_user_name, ext_1, ext_2, ext_3",
"refund_remark, refund_status, refund_fail_reason, create_type, create_time, ",
"update_time, finish_time, op_user_type, op_user_id, op_user_name, ext_1, ext_2, ",
"ext_3",
"from bs_order_refund",
"where id = #{id,jdbcType=BIGINT}"
})
@ -136,6 +140,7 @@ public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
@Result(column="refund_remark", property="refundRemark", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_status", property="refundStatus", jdbcType=JdbcType.INTEGER),
@Result(column="refund_fail_reason", property="refundFailReason", jdbcType=JdbcType.VARCHAR),
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@ -177,6 +182,7 @@ public interface BsOrderRefundMapper extends BsOrderRefundMapperExt {
"refund_remark = #{refundRemark,jdbcType=VARCHAR},",
"refund_status = #{refundStatus,jdbcType=INTEGER},",
"refund_fail_reason = #{refundFailReason,jdbcType=VARCHAR},",
"create_type = #{createType,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"finish_time = #{finishTime,jdbcType=TIMESTAMP},",

@ -100,6 +100,10 @@ public class BsOrderRefundSqlProvider {
sql.VALUES("refund_fail_reason", "#{refundFailReason,jdbcType=VARCHAR}");
}
if (record.getCreateType() != null) {
sql.VALUES("create_type", "#{createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -164,6 +168,7 @@ public class BsOrderRefundSqlProvider {
sql.SELECT("refund_remark");
sql.SELECT("refund_status");
sql.SELECT("refund_fail_reason");
sql.SELECT("create_type");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("finish_time");
@ -266,6 +271,10 @@ public class BsOrderRefundSqlProvider {
sql.SET("refund_fail_reason = #{record.refundFailReason,jdbcType=VARCHAR}");
}
if (record.getCreateType() != null) {
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -329,6 +338,7 @@ public class BsOrderRefundSqlProvider {
sql.SET("refund_remark = #{record.refundRemark,jdbcType=VARCHAR}");
sql.SET("refund_status = #{record.refundStatus,jdbcType=INTEGER}");
sql.SET("refund_fail_reason = #{record.refundFailReason,jdbcType=VARCHAR}");
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
@ -420,6 +430,10 @@ public class BsOrderRefundSqlProvider {
sql.SET("refund_fail_reason = #{refundFailReason,jdbcType=VARCHAR}");
}
if (record.getCreateType() != null) {
sql.SET("create_type = #{createType,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -0,0 +1,358 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* bs_agent_api_account_record
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsAgentApiAccountRecord implements Serializable {
private Long id;
/**
* 代理商API账户id
*/
private Long agentApiAccountId;
/**
* 代理商id
*/
private Long agentId;
/**
* 类型 1进账 2出账
*/
private Integer type;
/**
* 交易金额
*/
private BigDecimal transactionAmount;
/**
* 变更前金额
*/
private BigDecimal beforeAmount;
/**
* 变更后金额
*/
private BigDecimal afterAmount;
/**
* 来源类型 1. 充值金额 2. 订单扣除
*/
private Integer sourceType;
/**
* 来源id
*/
private Long sourceId;
/**
* 来源订单号
*/
private String sourceOrderNo;
/**
* 来源内容
*/
private String sourceContent;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 操作人类型 1管理员 2客户
*/
private Integer opUserType;
/**
* 操作人id
*/
private Long opUserId;
/**
* 操作人名称
*/
private String opUserName;
/**
* 操作人电话
*/
private String opUserPhone;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAgentApiAccountId() {
return agentApiAccountId;
}
public void setAgentApiAccountId(Long agentApiAccountId) {
this.agentApiAccountId = agentApiAccountId;
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public BigDecimal getTransactionAmount() {
return transactionAmount;
}
public void setTransactionAmount(BigDecimal transactionAmount) {
this.transactionAmount = transactionAmount;
}
public BigDecimal getBeforeAmount() {
return beforeAmount;
}
public void setBeforeAmount(BigDecimal beforeAmount) {
this.beforeAmount = beforeAmount;
}
public BigDecimal getAfterAmount() {
return afterAmount;
}
public void setAfterAmount(BigDecimal afterAmount) {
this.afterAmount = afterAmount;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
public String getSourceOrderNo() {
return sourceOrderNo;
}
public void setSourceOrderNo(String sourceOrderNo) {
this.sourceOrderNo = sourceOrderNo;
}
public String getSourceContent() {
return sourceContent;
}
public void setSourceContent(String sourceContent) {
this.sourceContent = sourceContent;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getOpUserType() {
return opUserType;
}
public void setOpUserType(Integer opUserType) {
this.opUserType = opUserType;
}
public Long getOpUserId() {
return opUserId;
}
public void setOpUserId(Long opUserId) {
this.opUserId = opUserId;
}
public String getOpUserName() {
return opUserName;
}
public void setOpUserName(String opUserName) {
this.opUserName = opUserName;
}
public String getOpUserPhone() {
return opUserPhone;
}
public void setOpUserPhone(String opUserPhone) {
this.opUserPhone = opUserPhone;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsAgentApiAccountRecord other = (BsAgentApiAccountRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAgentApiAccountId() == null ? other.getAgentApiAccountId() == null : this.getAgentApiAccountId().equals(other.getAgentApiAccountId()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getTransactionAmount() == null ? other.getTransactionAmount() == null : this.getTransactionAmount().equals(other.getTransactionAmount()))
&& (this.getBeforeAmount() == null ? other.getBeforeAmount() == null : this.getBeforeAmount().equals(other.getBeforeAmount()))
&& (this.getAfterAmount() == null ? other.getAfterAmount() == null : this.getAfterAmount().equals(other.getAfterAmount()))
&& (this.getSourceType() == null ? other.getSourceType() == null : this.getSourceType().equals(other.getSourceType()))
&& (this.getSourceId() == null ? other.getSourceId() == null : this.getSourceId().equals(other.getSourceId()))
&& (this.getSourceOrderNo() == null ? other.getSourceOrderNo() == null : this.getSourceOrderNo().equals(other.getSourceOrderNo()))
&& (this.getSourceContent() == null ? other.getSourceContent() == null : this.getSourceContent().equals(other.getSourceContent()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getOpUserType() == null ? other.getOpUserType() == null : this.getOpUserType().equals(other.getOpUserType()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName()))
&& (this.getOpUserPhone() == null ? other.getOpUserPhone() == null : this.getOpUserPhone().equals(other.getOpUserPhone()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getAgentApiAccountId() == null) ? 0 : getAgentApiAccountId().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getTransactionAmount() == null) ? 0 : getTransactionAmount().hashCode());
result = prime * result + ((getBeforeAmount() == null) ? 0 : getBeforeAmount().hashCode());
result = prime * result + ((getAfterAmount() == null) ? 0 : getAfterAmount().hashCode());
result = prime * result + ((getSourceType() == null) ? 0 : getSourceType().hashCode());
result = prime * result + ((getSourceId() == null) ? 0 : getSourceId().hashCode());
result = prime * result + ((getSourceOrderNo() == null) ? 0 : getSourceOrderNo().hashCode());
result = prime * result + ((getSourceContent() == null) ? 0 : getSourceContent().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getOpUserType() == null) ? 0 : getOpUserType().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode());
result = prime * result + ((getOpUserPhone() == null) ? 0 : getOpUserPhone().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", agentApiAccountId=").append(agentApiAccountId);
sb.append(", agentId=").append(agentId);
sb.append(", type=").append(type);
sb.append(", transactionAmount=").append(transactionAmount);
sb.append(", beforeAmount=").append(beforeAmount);
sb.append(", afterAmount=").append(afterAmount);
sb.append(", sourceType=").append(sourceType);
sb.append(", sourceId=").append(sourceId);
sb.append(", sourceOrderNo=").append(sourceOrderNo);
sb.append(", sourceContent=").append(sourceContent);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", opUserType=").append(opUserType);
sb.append(", opUserId=").append(opUserId);
sb.append(", opUserName=").append(opUserName);
sb.append(", opUserPhone=").append(opUserPhone);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -33,6 +33,16 @@ public class BsAgentApiParam implements Serializable {
*/
private String appSecret;
/**
* 商户信息通知
*/
private String merInfoNotify;
/**
* 订单退款通知
*/
private String orderRefundNotify;
/**
* 状态 0不可用 1可用
*/
@ -88,6 +98,22 @@ public class BsAgentApiParam implements Serializable {
this.appSecret = appSecret;
}
public String getMerInfoNotify() {
return merInfoNotify;
}
public void setMerInfoNotify(String merInfoNotify) {
this.merInfoNotify = merInfoNotify;
}
public String getOrderRefundNotify() {
return orderRefundNotify;
}
public void setOrderRefundNotify(String orderRefundNotify) {
this.orderRefundNotify = orderRefundNotify;
}
public Integer getStatus() {
return status;
}
@ -152,6 +178,8 @@ public class BsAgentApiParam implements Serializable {
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getAppId() == null ? other.getAppId() == null : this.getAppId().equals(other.getAppId()))
&& (this.getAppSecret() == null ? other.getAppSecret() == null : this.getAppSecret().equals(other.getAppSecret()))
&& (this.getMerInfoNotify() == null ? other.getMerInfoNotify() == null : this.getMerInfoNotify().equals(other.getMerInfoNotify()))
&& (this.getOrderRefundNotify() == null ? other.getOrderRefundNotify() == null : this.getOrderRefundNotify().equals(other.getOrderRefundNotify()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
@ -168,6 +196,8 @@ public class BsAgentApiParam implements Serializable {
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode());
result = prime * result + ((getAppSecret() == null) ? 0 : getAppSecret().hashCode());
result = prime * result + ((getMerInfoNotify() == null) ? 0 : getMerInfoNotify().hashCode());
result = prime * result + ((getOrderRefundNotify() == null) ? 0 : getOrderRefundNotify().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
@ -187,6 +217,8 @@ public class BsAgentApiParam implements Serializable {
sb.append(", agentId=").append(agentId);
sb.append(", appId=").append(appId);
sb.append(", appSecret=").append(appSecret);
sb.append(", merInfoNotify=").append(merInfoNotify);
sb.append(", orderRefundNotify=").append(orderRefundNotify);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);

@ -385,6 +385,146 @@ public class BsAgentApiParamExample {
return (Criteria) this;
}
public Criteria andMerInfoNotifyIsNull() {
addCriterion("mer_info_notify is null");
return (Criteria) this;
}
public Criteria andMerInfoNotifyIsNotNull() {
addCriterion("mer_info_notify is not null");
return (Criteria) this;
}
public Criteria andMerInfoNotifyEqualTo(String value) {
addCriterion("mer_info_notify =", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyNotEqualTo(String value) {
addCriterion("mer_info_notify <>", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyGreaterThan(String value) {
addCriterion("mer_info_notify >", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyGreaterThanOrEqualTo(String value) {
addCriterion("mer_info_notify >=", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyLessThan(String value) {
addCriterion("mer_info_notify <", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyLessThanOrEqualTo(String value) {
addCriterion("mer_info_notify <=", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyLike(String value) {
addCriterion("mer_info_notify like", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyNotLike(String value) {
addCriterion("mer_info_notify not like", value, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyIn(List<String> values) {
addCriterion("mer_info_notify in", values, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyNotIn(List<String> values) {
addCriterion("mer_info_notify not in", values, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyBetween(String value1, String value2) {
addCriterion("mer_info_notify between", value1, value2, "merInfoNotify");
return (Criteria) this;
}
public Criteria andMerInfoNotifyNotBetween(String value1, String value2) {
addCriterion("mer_info_notify not between", value1, value2, "merInfoNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyIsNull() {
addCriterion("order_refund_notify is null");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyIsNotNull() {
addCriterion("order_refund_notify is not null");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyEqualTo(String value) {
addCriterion("order_refund_notify =", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyNotEqualTo(String value) {
addCriterion("order_refund_notify <>", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyGreaterThan(String value) {
addCriterion("order_refund_notify >", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyGreaterThanOrEqualTo(String value) {
addCriterion("order_refund_notify >=", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyLessThan(String value) {
addCriterion("order_refund_notify <", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyLessThanOrEqualTo(String value) {
addCriterion("order_refund_notify <=", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyLike(String value) {
addCriterion("order_refund_notify like", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyNotLike(String value) {
addCriterion("order_refund_notify not like", value, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyIn(List<String> values) {
addCriterion("order_refund_notify in", values, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyNotIn(List<String> values) {
addCriterion("order_refund_notify not in", values, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyBetween(String value1, String value2) {
addCriterion("order_refund_notify between", value1, value2, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andOrderRefundNotifyNotBetween(String value1, String value2) {
addCriterion("order_refund_notify not between", value1, value2, "orderRefundNotify");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;

@ -280,6 +280,11 @@ public class BsGasOrder implements Serializable {
*/
private Integer status;
/**
* 创建方式 1平台下单 2API下单
*/
private Integer createType;
/**
* 创建时间
*/
@ -745,6 +750,14 @@ public class BsGasOrder implements Serializable {
this.status = status;
}
public Integer getCreateType() {
return createType;
}
public void setCreateType(Integer createType) {
this.createType = createType;
}
public Date getCreateTime() {
return createTime;
}
@ -913,6 +926,7 @@ public class BsGasOrder implements Serializable {
&& (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo()))
&& (this.getPayChannelOrderNo() == null ? other.getPayChannelOrderNo() == null : this.getPayChannelOrderNo().equals(other.getPayChannelOrderNo()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime()))
&& (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime()))
@ -984,6 +998,7 @@ public class BsGasOrder implements Serializable {
result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode());
result = prime * result + ((getPayChannelOrderNo() == null) ? 0 : getPayChannelOrderNo().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode());
result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode());
@ -1058,6 +1073,7 @@ public class BsGasOrder implements Serializable {
sb.append(", paySerialNo=").append(paySerialNo);
sb.append(", payChannelOrderNo=").append(payChannelOrderNo);
sb.append(", status=").append(status);
sb.append(", createType=").append(createType);
sb.append(", createTime=").append(createTime);
sb.append(", cancelTime=").append(cancelTime);
sb.append(", payTime=").append(payTime);

@ -3416,6 +3416,66 @@ public class BsGasOrderExample {
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() {
addCriterion("create_time is null");
return (Criteria) this;

@ -112,6 +112,11 @@ public class BsOrderRefund implements Serializable {
*/
private String refundFailReason;
/**
* 创建方式
*/
private Integer createType;
/**
* 创建时间
*/
@ -302,6 +307,14 @@ public class BsOrderRefund implements Serializable {
this.refundFailReason = refundFailReason;
}
public Integer getCreateType() {
return createType;
}
public void setCreateType(Integer createType) {
this.createType = createType;
}
public Date getCreateTime() {
return createTime;
}
@ -405,6 +418,7 @@ public class BsOrderRefund implements Serializable {
&& (this.getRefundRemark() == null ? other.getRefundRemark() == null : this.getRefundRemark().equals(other.getRefundRemark()))
&& (this.getRefundStatus() == null ? other.getRefundStatus() == null : this.getRefundStatus().equals(other.getRefundStatus()))
&& (this.getRefundFailReason() == null ? other.getRefundFailReason() == null : this.getRefundFailReason().equals(other.getRefundFailReason()))
&& (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime()))
@ -439,6 +453,7 @@ public class BsOrderRefund implements Serializable {
result = prime * result + ((getRefundRemark() == null) ? 0 : getRefundRemark().hashCode());
result = prime * result + ((getRefundStatus() == null) ? 0 : getRefundStatus().hashCode());
result = prime * result + ((getRefundFailReason() == null) ? 0 : getRefundFailReason().hashCode());
result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getFinishTime() == null) ? 0 : getFinishTime().hashCode());
@ -476,6 +491,7 @@ public class BsOrderRefund implements Serializable {
sb.append(", refundRemark=").append(refundRemark);
sb.append(", refundStatus=").append(refundStatus);
sb.append(", refundFailReason=").append(refundFailReason);
sb.append(", createType=").append(createType);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", finishTime=").append(finishTime);

@ -1376,6 +1376,66 @@ public class BsOrderRefundExample {
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() {
addCriterion("create_time is null");
return (Criteria) this;

@ -1,24 +1,23 @@
package com.hfkj.openapi.model.response;
package com.hfkj.openapi.model;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
* 加油油品
*/
@Data
public class QueryGasOilPriceDetail {
public class GasOilPriceDetail {
/**
* 站编
* 油号
*/
private String gasNo;
private String oilNo;
/**
* 名称
* 名称
*/
private String gasName;
private String oilNoName;
/**
* 油品类型
*/
@ -26,7 +25,11 @@ public class QueryGasOilPriceDetail {
/**
* 油品类型名称
*/
private Integer oilTypeName;
private String oilTypeName;
/**
* 枪号
*/
private List<String> gunNoList;
/**
* 国标价
*/
@ -35,8 +38,4 @@ public class QueryGasOilPriceDetail {
* 油枪价
*/
private BigDecimal priceGun;
/**
* 优惠价
*/
private BigDecimal priceVip;
}

@ -0,0 +1,24 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 推送订单模型
*/
@Data
public class RequestOrderDetailModel {
@NotBlank(message = "appId必填项")
private String appId;
@NotNull(message = "订单号必填项")
private String orderNo;
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,40 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 推送订单模型
*/
@Data
public class RequestOrderPushModel {
@NotBlank(message = "appId必填项")
private String appId;
@NotNull(message = "订单号必填项")
private String orderNo;
@NotNull(message = "加油金额必填项")
private BigDecimal refuelingAmount;
@NotNull(message = "油站编号必填项")
private String gasNo;
@NotNull(message = "油号必填项")
private String oilNo;
@NotNull(message = "枪号必填项")
private String gunNo;
@NotNull(message = "用户手机号必填项")
private String userPhone;
@NotBlank(message = "签名必填项")
private String sign;
}

@ -0,0 +1,26 @@
package com.hfkj.openapi.model.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 推送订单模型
*/
@Data
public class RequestOrderRefundModel {
@NotBlank(message = "appId必填项")
private String appId;
@NotNull(message = "订单号必填项")
private String orderNo;
private String refundReason;
@NotBlank(message = "签名必填项")
private String sign;
}

@ -12,13 +12,6 @@ import javax.validation.constraints.NotNull;
**/
@Data
public class RequestQueryGasInfoModel {
/**
* appid
*/
@NotBlank(message = "请求id必填项")
private String reqId;
/**
* appid
*/

@ -14,12 +14,6 @@ import javax.validation.constraints.NotNull;
@Data
public class RequestQueryGasListModel {
/**
* appid
*/
@NotBlank(message = "请求id必填项")
private String reqId;
/**
* appid
*/
@ -35,7 +29,7 @@ public class RequestQueryGasListModel {
/**
* 每页数量
*/
@Range(min = 1, max = 50,message = "数量必须设置在1至100之内")
@Range(min = 1, max = 100,message = "数量必须设置在1至100之内")
@NotNull(message = "每页数量必填项")
private Integer pageSize;

@ -0,0 +1,38 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
/**
* 订单退款通知
* @className: OrderRefundNotifyModel
* @author: HuRui
* @date: 2024/11/21
**/
@Data
public class OrderRefundNotifyModel {
/**
* 订单号
*/
private String orderNo;
/**
* 渠道类型
*/
private Integer channelType;
/**
* 渠道单号
*/
private String channelOrderNo;
/**
* 退款状态
*/
private boolean refundResult;
/**
* 退款失败原因
*/
private String refundFailReason;
/**
* 签名
*/
private String sign;
}

@ -1,21 +0,0 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
/**
* @className: RequestQueryGasListModel
* @author: HuRui
* @date: 2024/9/18
**/
@Data
public class QueryGasGun {
/**
* 油站编号
*/
private String gasNo;
/**
* 油站名称
*/
private String gasName;
}

@ -0,0 +1,69 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 推送订单模型
*/
@Data
public class ResponseOrderDetailModel {
/**
* 订单号
*/
private String orderNo;
/**
* 用户手机号
*/
private String userPhone;
/**
* 油站编号
*/
private String gasNo;
/**
* 油站名称
*/
private String gasName;
/**
* 加油金额
*/
private BigDecimal refuelPrice;
/**
* 油号
*/
private String oilNo;
/**
* 枪号
*/
private String gunNo;
/**
* 升数
*/
private BigDecimal litre;
/**
* 国标价
*/
private BigDecimal priceOfficial;
/**
* 油枪价
*/
private BigDecimal priceGun;
/**
* 状态
*/
private Integer status;
/**
* 渠道类型
*/
private Integer channelType;
/**
* 渠道单号
*/
private String channelOrderNo;
/**
* 创建时间
*/
private Date createTime;
}

@ -0,0 +1,27 @@
package com.hfkj.openapi.model.response;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 推送订单模型
*/
@Data
public class ResponseOrderPushModel {
/**
* 订单号
*/
private String orderNo;
/**
* 渠道类型
*/
private Integer channelType;
/**
* 渠道单号
*/
private String channelOrderNo;
}

@ -1,10 +1,8 @@
package com.hfkj.openapi.model.response;
import com.hfkj.openapi.model.GasOilPriceDetail;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -25,7 +23,7 @@ public class ResponseQueryGasInfoModel {
/**
* 省份编码
*/
private String provinceCode;
private Long provinceCode;
/**
* 油站所在省份
*/
@ -33,7 +31,7 @@ public class ResponseQueryGasInfoModel {
/**
* 城市编码
*/
private String cityCode;
private Long cityCode;
/**
* 油站所在城市
*/
@ -41,7 +39,7 @@ public class ResponseQueryGasInfoModel {
/**
* 区县码
*/
private String countyCode;
private Long countyCode;
/**
* 油站所在区/
*/
@ -66,18 +64,8 @@ public class ResponseQueryGasInfoModel {
* 油站logo
*/
private String gasLogo;
/**
* 油站图片
*/
private String gasImg;
/**
* 油品信息
*/
private List<QueryGasOilPriceDetail> oilPriceList;
/**
* 油枪信息
*/
private List<QueryGasGun> gasGunList;
private List<GasOilPriceDetail> oilPriceList;
}

@ -0,0 +1,423 @@
package com.hfkj.openapi.service;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.channel.gas.shell.CqShellPetroleumRequestService;
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.pay.util.SignatureUtil;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.RandomUtils;
import com.hfkj.entity.*;
import com.hfkj.model.GasModel;
import com.hfkj.model.GasOilPriceModel;
import com.hfkj.openapi.model.request.RequestOrderDetailModel;
import com.hfkj.openapi.model.request.RequestOrderPushModel;
import com.hfkj.openapi.model.request.RequestOrderRefundModel;
import com.hfkj.openapi.model.response.OrderRefundNotifyModel;
import com.hfkj.openapi.model.response.ResponseOrderDetailModel;
import com.hfkj.openapi.model.response.ResponseOrderPushModel;
import com.hfkj.service.BsDeviceService;
import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantAccountService;
import com.hfkj.service.merchant.BsMerchantChainBrandAccountService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.order.BsOrderRefundService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.sec.SecDictionaryService;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.gas.GasOrderReceiptStatusEnum;
import com.hfkj.sysenum.gas.OrderOilStatus;
import com.hfkj.sysenum.merchant.MerchantAccountRecordSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantChainBrandSettleTypeEnum;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantStatusEnum;
import com.hfkj.sysenum.order.OrderPayTypeEnum;
import com.hfkj.sysenum.order.OrderRefundStatusEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
* @className: ApiGasOrderService
* @author: HuRui
* @date: 2024/11/12
**/
@Component("apiGasOrderService")
public class ApiGasOrderService {
@Resource
private BsAgentMerService agentMerService;
@Resource
private BsAgentService agentService;
@Resource
private BsMerchantService merchantService;
@Resource
private BsMerchantAccountService merchantAccountService;
@Resource
private BsMerchantChainBrandAccountService merchantChainBrandAccountService;
@Resource
private BsGasService gasService;
@Resource
private BsOrderService orderService;
@Resource
private BsGasOrderService gasOrderService;
@Resource
private BsGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private BsDeviceService deviceService;
@Resource
private SecDictionaryService dictionaryService;
@Resource
private BsAgentApiAccountService agentApiAccountService;
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private BsOrderRefundService orderRefundService;
/**
* 推送加油订单
* @param request
* @return
*/
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public ResponseOrderPushModel pushOrder(Long agentId,RequestOrderPushModel request) throws Exception {
// 交易油站权限
BsAgentMer agentMer = agentMerService.getDetailByAgent(agentId, request.getGasNo());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "油站不可用");
}
// 查询油站
GasModel gasDetail = gasService.getGasDetail(request.getGasNo());
if (gasDetail == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到油站信息");
}
if (!gasDetail.getStatus().equals(MerchantStatusEnum.status1.getNumber())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "油站不可用");
}
// 校验油品
List<GasOilPriceModel> gasOilPriceModels = gasDetail.getGasOilPrice().stream().filter(o -> o.getOilNo().equals(request.getOilNo())).collect(Collectors.toList());
if (gasOilPriceModels.isEmpty()) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "油品不可用");
}
// 油价
GasOilPriceModel oilPrice = gasOilPriceModels.get(0);
// 校验枪号
if (oilPrice.getGasOilGunNo().stream().noneMatch(o -> o.getGunNo().equals(request.getGunNo()))) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "枪号不可用");
}
// 交易订单号
if (gasOrderService.getDetailByOrderNo(request.getOrderNo()) != null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "订单号已存在");
}
// 查询代理商
BsAgent agent = agentService.getAgentById(agentId);
if (agent == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未知的接入方");
}
// 创建加油订单
BsGasOrder gasOrder = new BsGasOrder();
gasOrder.setAgentId(agent.getId());
gasOrder.setAgentName(agent.getName());
gasOrder.setAbnormal(false);
gasOrder.setMerNo(gasDetail.getMerNo());
gasOrder.setChannelType(gasDetail.getSourceType());
gasOrder.setOrderNo(request.getOrderNo());
gasOrder.setUserPhone(request.getUserPhone());
gasOrder.setMerChainBrandId(gasDetail.getChainBrandId());
gasOrder.setMerChainBrandName(gasDetail.getChainBrandName());
gasOrder.setMerId(gasDetail.getId());
gasOrder.setMerName(gasDetail.getMerName());
gasOrder.setMerAddress(gasDetail.getAddress());
gasOrder.setStatus(OrderOilStatus.STATUS2.getNumber());
gasOrder.setReceiptStatus(GasOrderReceiptStatusEnum.status0.getStatus());
// 结算信息
gasOrder.setTotalDeductionPrice(new BigDecimal("0"));
gasOrder.setDeductionCouponPrice(new BigDecimal("0"));
gasOrder.setDeductionOilPrice(new BigDecimal("0"));
gasOrder.setPayablePrice(request.getRefuelingAmount());
gasOrder.setPayablePrice(request.getRefuelingAmount());
gasOrder.setGasRefuelPrice(request.getRefuelingAmount());
gasOrder.setGasSettlePrice(gasOrder.getGasRefuelPrice());
gasOrder.setGasAgentSettlePrice(gasOrder.getGasRefuelPrice());
// 油价信息
gasOrder.setGasRefuelPrice(request.getRefuelingAmount());
gasOrder.setGasOilNo(request.getOilNo());
gasOrder.setGasGunNo(request.getGunNo());
gasOrder.setGasOilType(oilPrice.getOilType());
gasOrder.setGasPriceGun(oilPrice.getPriceGun());
gasOrder.setGasPriceVip(oilPrice.getPriceGun());
gasOrder.setGasPriceCost(oilPrice.getPriceGun());
gasOrder.setGasPriceOfficial(oilPrice.getPriceOfficial());
gasOrder.setGasPricePlatform(oilPrice.getPriceGun());
gasOrder.setGasOilLiters(gasOrder.getGasSettlePrice().divide(gasOrder.getGasPriceGun(), 2, BigDecimal.ROUND_HALF_UP));
gasOrder.setGasDiscount(new BigDecimal("0"));
gasOrder.setGasOilSubsidy(new BigDecimal("0"));
gasOrder.setGasLitersPreferences(new BigDecimal("0"));
gasOrder.setGasPricePreferences(new BigDecimal("0"));
gasOrder.setCreateType(GasOrderCreateType.TYPE2.getNumber());
// 油站是否开启班组
BsGasClassGroupTask groupTask = gasClassGroupTaskService.getCurrentTaskByMerId(gasDetail.getId());
if (groupTask != null) {
gasOrder.setGasClassGroupId(groupTask.getGasClassGroupId());
gasOrder.setGasClassGroupName(groupTask.getGasClassGroupName());
gasOrder.setGasClassGroupTaskId(groupTask.getId());
}
gasOrderService.addGasOrder(gasOrder);
// 代理商扣款
Map<String,Object> consumeParam = new HashMap<>();
consumeParam.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeParam.put("sourceOrderNo", gasOrder.getOrderNo());
consumeParam.put("sourceOrderContent", "加油订单:"+gasOrder.getOrderNo());
agentApiAccountService.consume(agentId, gasOrder.getGasAgentSettlePrice(), consumeParam);
// 处理支付后的加油业务
oilHandle(gasOrder);
// 加油业务是否异常
if (gasOrder.getAbnormal().equals(true)) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, gasOrder.getAbnormalContent());
}
ResponseOrderPushModel response = new ResponseOrderPushModel();
response.setOrderNo(gasOrder.getOrderNo());
response.setChannelType(gasOrder.getChannelType());
response.setChannelOrderNo(gasOrder.getChannelOrderNo());
return response;
}
/**
* 退款订单
* @param request
* @return
* @throws Exception
*/
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public String refundOrder(RequestOrderRefundModel request) {
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(request.getOrderNo());
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单号");
}
if (!gasOrder.getStatus().equals(OrderOilStatus.STATUS2.getNumber())
|| gasOrder.getStatus().equals(OrderOilStatus.STATUS6.getNumber())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "订单无法退款");
}
// 创建退款订单
BsOrderRefund orderRefund = new BsOrderRefund();
orderRefund.setMerId(gasOrder.getMerId());
orderRefund.setMerNo(gasOrder.getMerNo());
orderRefund.setOrderNo(gasOrder.getOrderNo());
orderRefund.setUserPhone(gasOrder.getUserPhone());
// 退款订单号 退款标识:R + 时间 + 随机3位数字
orderRefund.setRefundOrderNo("R"+ DateUtil.date2String(new Date(), "yyMMddHHmmss") + RandomUtils.number(3, false));
orderRefund.setRefundPayType(gasOrder.getPayType());
// 全部退款
orderRefund.setRefundPrice(gasOrder.getGasRefuelPrice());
orderRefund.setRefundIntegral(0L);
orderRefund.setRefundRemark(request.getRefundReason());
orderRefund.setRefundStatus(OrderRefundStatusEnum.status1.getCode());
orderRefund.setCreateType(GasOrderCreateType.TYPE2.getNumber());
orderRefundService.editData(orderRefund);
ResponseOrderPushModel response = new ResponseOrderPushModel();
response.setOrderNo(gasOrder.getOrderNo());
response.setChannelType(gasOrder.getChannelType());
response.setChannelOrderNo(gasOrder.getChannelOrderNo());
// 创建一个单线程的线程池
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
// 异步记录登录信息
singleThreadExecutor.submit(new Runnable() {
@Override
public void run() {
if (!gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
try {
// 退款
agentApiAccountService.refund(gasOrder.getAgentId(),gasOrder.getGasRefuelPrice(), orderRefund);
orderRefund.setRefundStatus(OrderRefundStatusEnum.status2.getCode());
orderRefund.setFinishTime(new Date());
orderRefundService.editData(orderRefund);
} catch (Exception e) {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status3.getCode());
orderRefund.setRefundFailReason("退款失败!");
orderRefundService.editData(orderRefund);
}
// 退款通知
// 代理参数
BsAgentApiParam apiParam = agentApiParamService.getParamByAppId(request.getAppId());
if (apiParam != null && StringUtils.isNotBlank(apiParam.getOrderRefundNotify())) {
// 通知数据
OrderRefundNotifyModel refundNotify = new OrderRefundNotifyModel();
refundNotify.setOrderNo(orderRefund.getOrderNo());
refundNotify.setChannelType(gasOrder.getChannelType());
refundNotify.setChannelOrderNo(gasOrder.getChannelOrderNo());
refundNotify.setRefundResult(orderRefund.getRefundStatus() == 2 ? true : false);
refundNotify.setRefundFailReason(orderRefund.getRefundFailReason());
refundNotify.setSign(SignatureUtil.createSign(refundNotify, apiParam.getAppSecret()));
HttpsUtils.doPost(apiParam.getOrderRefundNotify(), JSONObject.toJSONString(refundNotify));
}
}
}
});
return "ok";
}
/**
* 查询订单详情
* @param request
* @return
* @throws Exception
*/
public ResponseOrderDetailModel queryOrderDetail(RequestOrderDetailModel request) throws Exception {
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(request.getOrderNo());
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未找到订单号");
}
ResponseOrderDetailModel response = new ResponseOrderDetailModel();
response.setOrderNo(gasOrder.getOrderNo());
response.setUserPhone(gasOrder.getUserPhone());
response.setRefuelPrice(gasOrder.getGasRefuelPrice());
response.setGasNo(gasOrder.getMerNo());
response.setGasName(gasOrder.getMerName());
response.setOilNo(gasOrder.getGasOilNo());
response.setGunNo(gasOrder.getGasGunNo());
response.setLitre(gasOrder.getGasOilLiters());
response.setPriceOfficial(gasOrder.getGasPriceOfficial());
response.setPriceGun(gasOrder.getGasPriceGun());
response.setStatus(gasOrder.getStatus());
response.setChannelType(gasOrder.getChannelType());
response.setChannelOrderNo(gasOrder.getChannelOrderNo());
response.setCreateTime(gasOrder.getCreateTime());
return response;
}
/**
* 油站业务
* @param gasOrder
*/
public BsGasOrder oilHandle(BsGasOrder gasOrder) throws Exception {
// 查询加油订单
if (gasOrder != null) {
gasOrder.setActualPayPrice(gasOrder.getGasRefuelPrice());
gasOrder.setPayType(OrderPayTypeEnum.type4.getCode());
gasOrder.setPayTime(new Date());
gasOrderService.updateGasOrder(gasOrder);
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
// 自建站
// 打印小票
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
deviceService.printGasOrder(gasOrder.getMerId(), gasOrder, false);
}
// 查询油站
BsMerchant merchant = merchantService.getMerchant(gasOrder.getMerNo());
if (merchant != null) {
// 连锁商户
if (merchant.getChainBrandId() != null) {
if (merchant.getChainBrandSettleType().equals(MerchantChainBrandSettleTypeEnum.type1.getNumber())) {
// 连锁额度
Map<String,Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", gasOrder.getId());
consumeMap.put("sourceOrderNo", gasOrder.getOrderNo());
merchantChainBrandAccountService.consume(merchant.getChainBrandId(), gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap);
} else if (merchant.getChainBrandSettleType().equals(MerchantChainBrandSettleTypeEnum.type2.getNumber())) {
// 商户额度
Map<String,Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", gasOrder.getId());
consumeMap.put("sourceOrderNo", gasOrder.getOrderNo());
merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap);
}
} else {
// 商户额度
Map<String,Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
consumeMap.put("sourceId", gasOrder.getId());
consumeMap.put("sourceOrderNo", gasOrder.getOrderNo());
merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap);
}
}
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
try {
// 能链【团油】
Map<String, Object> param = new HashMap<>();
param.put("gasId", gasOrder.getMerNo());
param.put("oilNo", gasOrder.getGasOilNo());
param.put("gunNo", Integer.parseInt(gasOrder.getGasGunNo()));
param.put("priceGun", gasOrder.getGasPriceGun()); // 油站价
param.put("priceVip", gasOrder.getGasPriceCost()); // 成本价
param.put("driverPhone", gasOrder.getUserPhone());
param.put("thirdSerialNo", gasOrder.getOrderNo());
param.put("refuelingAmount", gasOrder.getGasRefuelPrice());
// 查询账户
SecDictionary newLinkAccount = dictionaryService.getDictionary("NEW_LINK_ACCOUNT", "" + gasOrder.getGasOilType());
if (newLinkAccount != null) {
param.put("accountNo", newLinkAccount.getCodeName());
}
JSONObject pushResult = NewLinkRequestService.refuelingOrderPush(param);
if (pushResult != null && pushResult.getString("code").equals("200")) {
gasOrder.setChannelOrderNo(pushResult.getJSONObject("result").getString("orderNo"));
gasOrder.setAbnormal(false);
gasOrder.setAbnormalContent(null);
} else {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(pushResult.getString("message"));
}
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("推送订单未知异常!请稍后重新推送");
}
gasOrderService.updateGasOrder(gasOrder);
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
try {
// 推送加好油【重庆壳牌】
CqShellPetroleumRequestService.gasSyncPayment(gasOrder.getOrderNo(),
gasOrder.getMerNo(),
gasOrder.getPayTime(),
gasOrder.getGasRefuelPrice(),
gasOrder.getGasOilNo(),
gasOrder.getGasGunNo(),
gasOrder.getPayablePrice(),
gasOrder.getTotalDeductionPrice()
);
gasOrder.setAbnormal(false);
gasOrder.setAbnormalContent(null);
} catch (BaseException e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(e.getErrorMsg());
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("推送订单未知错误!请稍后重新推送");
}
gasOrderService.updateGasOrder(gasOrder);
}
}
return gasOrder;
}
}

@ -3,18 +3,41 @@ package com.hfkj.openapi.service;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.entity.BsMerchant;
import com.hfkj.common.pay.util.SignatureUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.*;
import com.hfkj.model.GasListModel;
import com.hfkj.model.GasModel;
import com.hfkj.model.GasOilPriceModel;
import com.hfkj.openapi.model.GasOilPriceDetail;
import com.hfkj.openapi.model.request.RequestOrderPushModel;
import com.hfkj.openapi.model.response.ResponseOrderPushModel;
import com.hfkj.openapi.model.response.ResponseQueryGasInfoModel;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.agent.BsAgentPriceService;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.gas.BsGasClassGroupTaskService;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPaySuccessService;
import com.hfkj.sysenum.gas.GasOilNoEnum;
import com.hfkj.sysenum.gas.GasOrderReceiptStatusEnum;
import com.hfkj.sysenum.gas.OrderOilStatus;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantStatusEnum;
import com.hfkj.sysenum.order.OrderStatusEnum;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @className: GasService
@ -23,28 +46,49 @@ import java.util.List;
**/
@Component("apiGasService")
public class ApiGasService {
@Resource
private BsAgentMerService agentMerService;
@Resource
private BsAgentPriceService agentPriceService;
@Resource
private BsMerchantService merchantService;
@Resource
private BsGasService gasService;
/**
* 查询油站详情
* @param agentId
* @param gasNo
*/
public ResponseQueryGasInfoModel queryGasInfo(Long agentId, String gasNo) {
public ResponseQueryGasInfoModel queryGasInfo(String gasNo) {
// 油站详情
GasModel gasDetail = gasService.getGasDetail(gasNo);
if (gasDetail == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, "未查到加油站信息");
}
ResponseQueryGasInfoModel response = new ResponseQueryGasInfoModel();
response.setGasNo(gasDetail.getMerNo());
response.setGasName(gasDetail.getMerName());
response.setProvinceCode(gasDetail.getProvinceCode());
response.setProvinceName(gasDetail.getProvinceName());
response.setCityCode(gasDetail.getCityCode());
response.setCityName(gasDetail.getCityName());
response.setCountyCode(gasDetail.getAreaCode());
response.setCountyName(gasDetail.getAreaName());
response.setGasAddress(gasDetail.getAddress());
response.setGasAddressLatitude(gasDetail.getLatitude());
response.setGasAddressLongitude(gasDetail.getLongitude());
response.setGasLogo(gasDetail.getSourceType().equals(MerchantSourceTypeEnum.type1.getNumber()) ? CommonSysConst.getSysConfig().getDomainName()+"/"+gasDetail.getMerLogo() : gasDetail.getMerLogo());
response.setGasStatus(gasDetail.getStatus());
response.setOilPriceList(new ArrayList<>());
return null;
List<GasOilPriceModel> gasOilPrice = gasDetail.getGasOilPrice();
for (GasOilPriceModel oilPrice : gasOilPrice) {
// 油品
GasOilPriceDetail gasOilPriceDetail = new GasOilPriceDetail();
gasOilPriceDetail.setOilNo(oilPrice.getOilNo());
gasOilPriceDetail.setOilNoName(oilPrice.getOilNoName());
gasOilPriceDetail.setOilType(oilPrice.getOilType());
gasOilPriceDetail.setOilTypeName(oilPrice.getOilTypeName());
gasOilPriceDetail.setPriceOfficial(oilPrice.getPriceOfficial());
gasOilPriceDetail.setPriceGun(oilPrice.getPriceGun());
gasOilPriceDetail.setGunNoList(oilPrice.getGasOilGunNo().stream().map(BsGasOilGunNo::getGunNo).collect(Collectors.toList()));
response.getOilPriceList().add(gasOilPriceDetail);
}
return response;
}
}

@ -0,0 +1,24 @@
package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentApiAccountRecord;
import com.hfkj.entity.BsAgentMerAccountRecord;
import java.util.List;
import java.util.Map;
public interface BsAgentApiAccountRecordService {
/**
* 创建
* @param data
*/
void create(BsAgentApiAccountRecord data);
/**
* 查询列表
* @param param
* @return
*/
List<BsAgentApiAccountRecord> getList(Map<String,Object> param);
}

@ -1,6 +1,10 @@
package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentApiAccount;
import com.hfkj.entity.BsOrderRefund;
import java.math.BigDecimal;
import java.util.Map;
/**
* @className: BsAgentApiAccountService
@ -28,4 +32,28 @@ public interface BsAgentApiAccountService {
*/
BsAgentApiAccount getAccount(Long agentId);
/**
* 充值
* @param agentId 代理商id
* @param amount 金额
*/
void recharge(Long agentId, BigDecimal amount) throws Exception;
/**
* 扣除
* @param agentId 代理商id
* @param amount 金额
* @param otherParam 其他参数
*/
void consume(Long agentId, BigDecimal amount, Map<String, Object> otherParam) throws Exception;
/**
* 退款
* @param agentId
* @param amount
* @param orderRefund
*/
void refund(Long agentId, BigDecimal amount, BsOrderRefund orderRefund) throws Exception;
}

@ -2,6 +2,8 @@ package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentApiParam;
import java.util.List;
/**
* @className: BsAgentApiParamService
* @author: HuRui
@ -28,6 +30,13 @@ public interface BsAgentApiParamService {
*/
BsAgentApiParam getParam(Long agentId);
/**
* 通过油站查询代理
* @param gasNo
* @return
*/
List<BsAgentApiParam> getParamListByGasNo(String gasNo);
/**
* 查询参数
* @param appId

@ -1,7 +1,9 @@
package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentApiParam;
import com.hfkj.entity.BsAgentMer;
import com.hfkj.model.AgentMerAllot;
import com.hfkj.openapi.model.response.ResponseQueryGasInfoModel;
import java.util.List;
import java.util.Map;
@ -53,6 +55,13 @@ public interface BsAgentMerService {
*/
List<BsAgentMer> getList(Map<String,Object> param);
/**
* 查询商户号列表
* @param agentId
* @return
*/
List<ResponseQueryGasInfoModel> getMerNoList(Long agentId);
/**
* 查询详情
* @param agentId
@ -88,4 +97,11 @@ public interface BsAgentMerService {
* @param merNoArray
*/
void unbindStaff(Long staffId, List<String> merNoArray);
/**
* 通知代理
* @param merNo
*/
void agentNotify(String merNo);
}

@ -0,0 +1,92 @@
package com.hfkj.service.agent.impl;
import com.hfkj.common.security.UserCenter;
import com.hfkj.dao.BsAgentApiAccountRecordMapper;
import com.hfkj.entity.BsAgentApiAccountRecord;
import com.hfkj.entity.BsAgentApiAccountRecordExample;
import com.hfkj.entity.BsAgentMerAccountRecord;
import com.hfkj.entity.BsAgentMerAccountRecordExample;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.UserSessionObject;
import com.hfkj.service.agent.BsAgentApiAccountRecordService;
import com.hfkj.service.agent.BsAgentMerAccountRecordService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: BsAgentApiAccountRecordServiceImpl
* @author: HuRui
* @date: 2024/11/19
**/
@Service("agentApiAccountRecordService")
public class BsAgentApiAccountRecordServiceImpl implements BsAgentApiAccountRecordService {
@Resource
private BsAgentApiAccountRecordMapper agentApiAccountRecordMapper;
@Resource
private UserCenter userCenter;
@Override
public void create(BsAgentApiAccountRecord data) {
try {
SecUserSessionObject secUserSessionObject = userCenter.getSessionModel(SecUserSessionObject.class);
if (secUserSessionObject != null) {
data.setOpUserType(1);
data.setOpUserId(secUserSessionObject.getAccount().getId());
data.setOpUserName(secUserSessionObject.getAccount().getUserName());
data.setOpUserPhone(secUserSessionObject.getAccount().getTelephone());
}
} catch (Exception e) {
System.out.println("获取管理员信息失败");
}
try {
UserSessionObject userModel = userCenter.getSessionModel(UserSessionObject.class);
if (userModel != null) {
data.setOpUserType(2);
data.setOpUserId(userModel.getUser().getId());
data.setOpUserName(userModel.getUser().getUserName());
data.setOpUserPhone(userModel.getUser().getPhone());
}
} catch (Exception e) {
System.out.println("获取客户信息失败");
}
data.setStatus(1);
data.setCreateTime(new Date());
agentApiAccountRecordMapper.insert(data);
}
@Override
public List<BsAgentApiAccountRecord> getList(Map<String, Object> param) {
BsAgentApiAccountRecordExample example = new BsAgentApiAccountRecordExample();
BsAgentApiAccountRecordExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "agentApiAccountId") != null) {
criteria.andAgentApiAccountIdEqualTo(MapUtils.getLong(param, "agentApiAccountId"));
}
if (MapUtils.getLong(param, "agentId") != null) {
criteria.andAgentIdEqualTo(MapUtils.getLong(param, "agentId"));
}
if (MapUtils.getInteger(param, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(param, "type"));
}
if (MapUtils.getInteger(param, "sourceType") != null) {
criteria.andSourceTypeEqualTo(MapUtils.getInteger(param, "sourceType"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "sourceOrderNo"))) {
criteria.andSourceOrderNoEqualTo(MapUtils.getString(param, "sourceOrderNo"));
}
example.setOrderByClause("create_time desc");
return agentApiAccountRecordMapper.selectByExample(example);
}
}

@ -1,18 +1,25 @@
package com.hfkj.service.agent.impl;
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.utils.DateUtil;
import com.hfkj.dao.BsAgentApiAccountMapper;
import com.hfkj.entity.BsAgentApiAccount;
import com.hfkj.entity.BsAgentApiAccountExample;
import com.hfkj.entity.*;
import com.hfkj.service.agent.BsAgentApiAccountRecordService;
import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.sysenum.merchant.MerchantAccountRecordSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantAccountRecordTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: BsAgentApiAccountServiceImpl
@ -23,7 +30,11 @@ import java.util.List;
public class BsAgentApiAccountServiceImpl implements BsAgentApiAccountService {
@Resource
private BsAgentApiAccountMapper agentApiAccountMapper;
@Resource
private BsAgentApiAccountRecordService agentApiAccountRecordService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
private final String LOCK_KEY = "AGENT_API_ACCOUNT_LOCK_";
@Override
public void create(Long agentId) {
BsAgentApiAccount data = new BsAgentApiAccount();
@ -53,4 +64,160 @@ public class BsAgentApiAccountServiceImpl implements BsAgentApiAccountService {
return list.get(0);
}
@Override
public void recharge(Long agentId, BigDecimal amount) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+agentId;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 查询账户
BsAgentApiAccount account = getAccount(agentId);
if (account == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易账户");
}
// 变更前金额
BigDecimal beforeAmount = account.getAmount();
// 计算金额
account.setAmount(account.getAmount().add(amount));
update(account);
// 变更后金额
BigDecimal afterAmount = account.getAmount();
BsAgentApiAccountRecord record = new BsAgentApiAccountRecord();
record.setAgentApiAccountId(account.getId());
record.setAgentId(account.getAgentId());
record.setType(MerchantAccountRecordTypeEnum.type1.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MerchantAccountRecordSourceTypeEnum.type1.getType());
try {
record.setSourceOrderNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
} catch (Exception e) {
e.printStackTrace();
}
record.setSourceContent("充值金额:" + record.getTransactionAmount());
agentApiAccountRecordService.create(record);
// 释放锁
redisTemplate.delete(lockKey);
} catch (Exception e) {
e.printStackTrace();
// 释放锁
redisTemplate.delete(lockKey);
}
} else {
Thread.sleep(100);
recharge(agentId, amount);
}
}
@Override
public void consume(Long agentId, BigDecimal amount, Map<String, Object> otherParam) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+agentId;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 查询账户
BsAgentApiAccount account = getAccount(agentId);
if (account == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易账户");
}
// 余额是否小于消费余额
if (account.getAmount().compareTo(amount) == -1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "账户余额不足");
}
// 变更前金额
BigDecimal beforeAmount = account.getAmount();
// 计算消费后金额
account.setAmount(account.getAmount().subtract(amount));
// 累积消费金额
account.setAmountConsume(account.getAmountConsume().add(amount));
update(account);
// 变更后金额
BigDecimal afterAmount = account.getAmount();
BsAgentApiAccountRecord record = new BsAgentApiAccountRecord();
record.setAgentApiAccountId(account.getId());
record.setAgentId(account.getAgentId());
record.setType(MerchantAccountRecordTypeEnum.type2.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MapUtils.getInteger(otherParam, "sourceType"));
record.setSourceId(MapUtils.getLong(otherParam, "sourceId"));
record.setSourceOrderNo(MapUtils.getString(otherParam, "sourceOrderNo"));
record.setSourceContent(MapUtils.getString(otherParam, "sourceContent"));
agentApiAccountRecordService.create(record);
// 释放锁
redisTemplate.delete(lockKey);
} catch (BaseException e) {
// 释放锁
redisTemplate.delete(lockKey);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getErrorMsg());
} catch (Exception e) {
// 释放锁
redisTemplate.delete(lockKey);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知错误");
}
} else {
Thread.sleep(100);
consume(agentId, amount, otherParam);
}
}
@Override
public void refund(Long agentId, BigDecimal amount, BsOrderRefund orderRefund) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+agentId;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 查询账户
BsAgentApiAccount account = getAccount(agentId);
// 变更前金额
BigDecimal beforeAmount = account.getAmount();
// 计算退款后的金额
account.setAmount(account.getAmount().add(amount));
// 累积消费金额
account.setAmountConsume(account.getAmountConsume().subtract(amount));
update(account);
// 变更后金额
BigDecimal afterAmount = account.getAmount();
BsAgentApiAccountRecord record = new BsAgentApiAccountRecord();
record.setAgentApiAccountId(account.getId());
record.setAgentId(account.getAgentId());
record.setType(MerchantAccountRecordTypeEnum.type1.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MerchantAccountRecordSourceTypeEnum.type3.getType());
record.setSourceId(orderRefund.getId());
record.setSourceOrderNo(orderRefund.getRefundOrderNo());
agentApiAccountRecordService.create(record);
// 释放锁
redisTemplate.delete(lockKey);
} catch (Exception e) {
e.printStackTrace();
// 释放锁
redisTemplate.delete(lockKey);
}
} else {
Thread.sleep(100);
refund(agentId, amount, orderRefund);
}
}
}

@ -65,6 +65,11 @@ public class BsAgentApiParamServiceImpl implements BsAgentApiParamService {
return params.get(0);
}
@Override
public List<BsAgentApiParam> getParamListByGasNo(String gasNo) {
return agentApiParamMapper.selectParamListByGasNo(gasNo);
}
@Override
public BsAgentApiParam getParamByAppId(String appId) {
// 查询

@ -1,18 +1,26 @@
package com.hfkj.service.agent.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.protobuf.Api;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.pay.util.SignatureUtil;
import com.hfkj.common.utils.HttpUtils;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.dao.BsAgentMerMapper;
import com.hfkj.entity.*;
import com.hfkj.model.AgentMerAllot;
import com.hfkj.service.agent.BsAgentMerAccountService;
import com.hfkj.openapi.model.response.ResponseQueryGasInfoModel;
import com.hfkj.openapi.service.ApiGasService;
import com.hfkj.service.agent.*;
import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.agent.BsAgentStaffService;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -20,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import java.util.stream.LongStream;
@ -42,6 +52,11 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
private BsMerchantService merchantService;
@Resource
private BsAgentMerAccountService agentMerAccountService;
@Resource
private BsAgentApiParamService agentApiParamService;
@Resource
private ApiGasService apiGasService;
@Override
public void editData(BsAgentMer data) {
data.setUpdateTime(new Date());
@ -165,6 +180,11 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
return agentMerMapper.selectByExample(example);
}
@Override
public List<ResponseQueryGasInfoModel> getMerNoList(Long agentId) {
return agentMerMapper.getMerNoList(agentId);
}
@Override
public BsAgentMer getDetailByAgent(Long agentId, String merNo) {
BsAgentMerExample example = new BsAgentMerExample();
@ -247,5 +267,34 @@ public class BsAgentMerServiceImpl implements BsAgentMerService {
agentMerMapper.updateByExampleSelective(agentMer, example);
}
@Override
public void agentNotify(String merNo) {
// 查询油站
ResponseQueryGasInfoModel gasInfo = apiGasService.queryGasInfo(merNo);
if (gasInfo != null) {
List<BsAgentApiParam> list = agentApiParamService.getParamListByGasNo(gasInfo.getGasNo());
for (BsAgentApiParam apiParam : list) {
if (StringUtils.isNotBlank(apiParam.getMerInfoNotify())) {
// 创建一个单线程的线程池
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
// 异步记录登录信息
singleThreadExecutor.submit(new Runnable() {
@Override
public void run() {
try {
// 通知代理
JSONObject notifyParam = JSONObject.parseObject(JSONObject.toJSONString(gasInfo), JSONObject.class);
notifyParam.put("sign", SignatureUtil.createSign(notifyParam, apiParam.getAppSecret()));
HttpsUtils.doPost(apiParam.getMerInfoNotify(), notifyParam);
} catch (Exception e) {
System.out.println("通知代理商:"+apiParam.getAgentId()+"失败"+e.getMessage());
}
}
});
}
}
}
}
}

@ -10,6 +10,7 @@ import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.BsMerchantAccount;
import com.hfkj.entity.BsMerchantExample;
import com.hfkj.entity.SecUser;
import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.merchant.BsMerchantAccountService;
import com.hfkj.service.merchant.BsMerchantQrCodeService;
import com.hfkj.service.merchant.BsMerchantService;
@ -45,6 +46,8 @@ public class BsMerchantServiceImpl implements BsMerchantService {
@Resource
private BsMerchantAccountService merchantAccountService;
@Resource
private BsAgentMerService agentMerService;
@Resource
private RedisUtil redisUtil;
@Resource
private BsGasService gasService;
@ -111,6 +114,8 @@ public class BsMerchantServiceImpl implements BsMerchantService {
redisUtil.set(CACHE_MER_KEY + merchant.getMerNo(), merchant);
// 清除油站缓存
gasService.clean(merchant.getMerNo());
// 通知代理
agentMerService.agentNotify(merchant.getMerNo());
}
@Override

@ -16,6 +16,7 @@ import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.gas.BsGasStaffService;
import com.hfkj.service.sec.SecDictionaryService;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.merchant.MerchantSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantStatusEnum;
import com.hfkj.sysenum.gas.GasOrderReceiptStatusEnum;
@ -202,6 +203,7 @@ public class OrderCreateService {
gasOrder.setGasClassGroupTaskId(groupTask.getId());
}
gasOrder.setCreateType(GasOrderCreateType.TYPE1.getNumber());
gasOrderService.addGasOrder(gasOrder);
orderChild.setMerNo(merchant.getMerNo());

@ -15,6 +15,7 @@ import com.hfkj.pay.HuiPayService;
import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.order.*;
import com.hfkj.sysenum.gas.GasOrderCreateType;
import com.hfkj.sysenum.order.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -208,6 +209,7 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService {
orderRefund.setRefundStatus(OrderRefundStatusEnum.status1.getCode());
orderRefund.setAccountMerchantNo(orderSettle.getSettleMerNo());
orderRefund.setAccountMerchantKey(orderSettle.getSettleMerKey());
orderRefund.setCreateType(GasOrderCreateType.TYPE1.getNumber());
editData(orderRefund);
// 资金退款

@ -0,0 +1,59 @@
package com.hfkj.sysenum.gas;
import java.util.Objects;
public enum GasOrderCreateType {
/**
* 平台创建
*/
TYPE1(1, "平台创建"),
/**
* API创建
*/
TYPE2(2, "API创建"),
;
private Integer number;
private String name;
GasOrderCreateType(int number, String name) {
this.number = number;
this.name = name;
}
/**
* 根据类型查询数据
* @param type
* @return
*/
public static GasOrderCreateType getDataByType(Integer type) {
for (GasOrderCreateType ele : values()) {
if(Objects.equals(type,ele.getNumber())) return ele;
}
return null;
}
public static String getNameByType(Integer type) {
for (GasOrderCreateType ele : values()) {
if(Objects.equals(type,ele.getNumber())) return ele.getName();
}
return null;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -8,8 +8,17 @@ import java.util.Objects;
* @date: 2024/3/4
**/
public enum MerchantStatusEnum {
/**
* 删除
*/
status0(0, "删除"),
/**
* 正常
*/
status1(1, "正常"),
/**
* 禁用
*/
status2(2, "禁用"),
;

@ -24,6 +24,10 @@ public enum OrderPayTypeEnum {
* 云闪付
*/
type3(3, "云闪付"),
/**
* API余额
*/
type4(4, "API余额"),
;
private final int code;

Loading…
Cancel
Save