From 058d13bb9835dc04c3da832cac0341d237c3e441 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Fri, 22 Nov 2024 18:11:09 +0800 Subject: [PATCH] =?UTF-8?q?openapi=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/notify/NewLinkNotify.java | 16 +- .../openapi/controller/BsGasController.java | 72 +- .../controller/BsGasOrderController.java | 181 ++ .../gas/newlink/NewLinkGasService.java | 8 +- .../gas/shell/CqShellPetroleumGasService.java | 7 +- .../hfkj/common/pay/util/SignatureUtil.java | 12 +- .../dao/BsAgentApiAccountRecordMapper.java | 159 ++ .../dao/BsAgentApiAccountRecordMapperExt.java | 7 + .../BsAgentApiAccountRecordSqlProvider.java | 444 +++++ .../com/hfkj/dao/BsAgentApiParamMapper.java | 16 +- .../hfkj/dao/BsAgentApiParamMapperExt.java | 18 +- .../hfkj/dao/BsAgentApiParamSqlProvider.java | 28 + .../com/hfkj/dao/BsAgentMerMapperExt.java | 4 + .../java/com/hfkj/dao/BsGasOrderMapper.java | 33 +- .../com/hfkj/dao/BsGasOrderSqlProvider.java | 14 + .../com/hfkj/dao/BsOrderRefundMapper.java | 26 +- .../hfkj/dao/BsOrderRefundSqlProvider.java | 14 + .../hfkj/entity/BsAgentApiAccountRecord.java | 358 ++++ .../BsAgentApiAccountRecordExample.java | 1494 +++++++++++++++++ .../java/com/hfkj/entity/BsAgentApiParam.java | 32 + .../hfkj/entity/BsAgentApiParamExample.java | 140 ++ .../main/java/com/hfkj/entity/BsGasOrder.java | 16 + .../com/hfkj/entity/BsGasOrderExample.java | 60 + .../java/com/hfkj/entity/BsOrderRefund.java | 16 + .../com/hfkj/entity/BsOrderRefundExample.java | 60 + ...riceDetail.java => GasOilPriceDetail.java} | 29 +- .../request/RequestOrderDetailModel.java | 24 + .../model/request/RequestOrderPushModel.java | 40 + .../request/RequestOrderRefundModel.java | 26 + .../request/RequestQueryGasInfoModel.java | 7 - .../request/RequestQueryGasListModel.java | 8 +- .../response/OrderRefundNotifyModel.java | 38 + .../openapi/model/response/QueryGasGun.java | 21 - .../response/ResponseOrderDetailModel.java | 69 + .../response/ResponseOrderPushModel.java | 27 + .../response/ResponseQueryGasInfoModel.java | 22 +- .../openapi/service/ApiGasOrderService.java | 423 +++++ .../hfkj/openapi/service/ApiGasService.java | 64 +- .../agent/BsAgentApiAccountRecordService.java | 24 + .../agent/BsAgentApiAccountService.java | 28 + .../service/agent/BsAgentApiParamService.java | 9 + .../hfkj/service/agent/BsAgentMerService.java | 16 + .../BsAgentApiAccountRecordServiceImpl.java | 92 + .../impl/BsAgentApiAccountServiceImpl.java | 173 +- .../impl/BsAgentApiParamServiceImpl.java | 5 + .../agent/impl/BsAgentMerServiceImpl.java | 57 +- .../merchant/impl/BsMerchantServiceImpl.java | 5 + .../service/order/OrderCreateService.java | 2 + .../order/impl/BsOrderRefundServiceImpl.java | 2 + .../hfkj/sysenum/gas/GasOrderCreateType.java | 59 + .../sysenum/merchant/MerchantStatusEnum.java | 9 + .../hfkj/sysenum/order/OrderPayTypeEnum.java | 4 + 52 files changed, 4338 insertions(+), 180 deletions(-) create mode 100644 openapi/src/main/java/com/openapi/controller/BsGasOrderController.java create mode 100644 service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecord.java create mode 100644 service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecordExample.java rename service/src/main/java/com/hfkj/openapi/model/{response/QueryGasOilPriceDetail.java => GasOilPriceDetail.java} (51%) create mode 100644 service/src/main/java/com/hfkj/openapi/model/request/RequestOrderDetailModel.java create mode 100644 service/src/main/java/com/hfkj/openapi/model/request/RequestOrderPushModel.java create mode 100644 service/src/main/java/com/hfkj/openapi/model/request/RequestOrderRefundModel.java create mode 100644 service/src/main/java/com/hfkj/openapi/model/response/OrderRefundNotifyModel.java delete mode 100644 service/src/main/java/com/hfkj/openapi/model/response/QueryGasGun.java create mode 100644 service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderDetailModel.java create mode 100644 service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderPushModel.java create mode 100644 service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java create mode 100644 service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountRecordService.java create mode 100644 service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountRecordServiceImpl.java create mode 100644 service/src/main/java/com/hfkj/sysenum/gas/GasOrderCreateType.java diff --git a/bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.java b/bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.java index bfee601..4fe7da8 100644 --- a/bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.java +++ b/bweb/src/main/java/com/bweb/controller/notify/NewLinkNotify.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); + } } } diff --git a/openapi/src/main/java/com/openapi/controller/BsGasController.java b/openapi/src/main/java/com/openapi/controller/BsGasController.java index f9c41dc..902d144 100644 --- a/openapi/src/main/java/com/openapi/controller/BsGasController.java +++ b/openapi/src/main/java/com/openapi/controller/BsGasController.java @@ -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 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 ==========="); } } diff --git a/openapi/src/main/java/com/openapi/controller/BsGasOrderController.java b/openapi/src/main/java/com/openapi/controller/BsGasOrderController.java new file mode 100644 index 0000000..13a53f1 --- /dev/null +++ b/openapi/src/main/java/com/openapi/controller/BsGasOrderController.java @@ -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 ==========="); + } + } + +} diff --git a/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java b/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java index 5d766e1..91e47ac 100644 --- a/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java +++ b/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java @@ -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); } } diff --git a/service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumGasService.java b/service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumGasService.java index b1f0285..27e7f6e 100644 --- a/service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumGasService.java +++ b/service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumGasService.java @@ -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("更新油站失败"); } diff --git a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java index a29a56b..56d65bb 100644 --- a/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java +++ b/service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java @@ -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); diff --git a/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapper.java b/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapper.java new file mode 100644 index 0000000..ccf7b93 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapper.java @@ -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 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); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapperExt.java b/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapperExt.java new file mode 100644 index 0000000..a63eb0f --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordMapperExt.java @@ -0,0 +1,7 @@ +package com.hfkj.dao; + +/** + * mapper扩展类 + */ +public interface BsAgentApiAccountRecordMapperExt { +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordSqlProvider.java new file mode 100644 index 0000000..fc8ed05 --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsAgentApiAccountRecordSqlProvider.java @@ -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 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 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 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 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()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapper.java b/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapper.java index 0f637d3..336b185 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapper.java @@ -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},", diff --git a/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapperExt.java b/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapperExt.java index a1a1b95..93ba6b1 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentApiParamMapperExt.java @@ -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 { -} \ No newline at end of file + @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 selectParamListByGasNo(@Param("gasNo") String gasNo); +} diff --git a/service/src/main/java/com/hfkj/dao/BsAgentApiParamSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsAgentApiParamSqlProvider.java index 97f18f2..2d54588 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentApiParamSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentApiParamSqlProvider.java @@ -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}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java b/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java index 3a8ff1e..bb02b67 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java @@ -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 " + " "}) List getAllotList(@Param("param") Map param); + + @Select("") + List getMerNoList(@Param("agentId") Long agentId); } diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java index 1380131..9aed5f0 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java @@ -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},", diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java index 8d13f7c..06e8b27 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java @@ -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}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java b/service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java index 1723bca..cfe0159 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java @@ -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},", diff --git a/service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java index 52dd36a..a697f12 100644 --- a/service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java @@ -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}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecord.java b/service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecord.java new file mode 100644 index 0000000..3995957 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecord.java @@ -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(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecordExample.java b/service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecordExample.java new file mode 100644 index 0000000..532e809 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsAgentApiAccountRecordExample.java @@ -0,0 +1,1494 @@ +package com.hfkj.entity; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsAgentApiAccountRecordExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsAgentApiAccountRecordExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdIsNull() { + addCriterion("agent_api_account_id is null"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdIsNotNull() { + addCriterion("agent_api_account_id is not null"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdEqualTo(Long value) { + addCriterion("agent_api_account_id =", value, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdNotEqualTo(Long value) { + addCriterion("agent_api_account_id <>", value, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdGreaterThan(Long value) { + addCriterion("agent_api_account_id >", value, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdGreaterThanOrEqualTo(Long value) { + addCriterion("agent_api_account_id >=", value, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdLessThan(Long value) { + addCriterion("agent_api_account_id <", value, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdLessThanOrEqualTo(Long value) { + addCriterion("agent_api_account_id <=", value, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdIn(List values) { + addCriterion("agent_api_account_id in", values, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdNotIn(List values) { + addCriterion("agent_api_account_id not in", values, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdBetween(Long value1, Long value2) { + addCriterion("agent_api_account_id between", value1, value2, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentApiAccountIdNotBetween(Long value1, Long value2) { + addCriterion("agent_api_account_id not between", value1, value2, "agentApiAccountId"); + return (Criteria) this; + } + + public Criteria andAgentIdIsNull() { + addCriterion("agent_id is null"); + return (Criteria) this; + } + + public Criteria andAgentIdIsNotNull() { + addCriterion("agent_id is not null"); + return (Criteria) this; + } + + public Criteria andAgentIdEqualTo(Long value) { + addCriterion("agent_id =", value, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdNotEqualTo(Long value) { + addCriterion("agent_id <>", value, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdGreaterThan(Long value) { + addCriterion("agent_id >", value, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdGreaterThanOrEqualTo(Long value) { + addCriterion("agent_id >=", value, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdLessThan(Long value) { + addCriterion("agent_id <", value, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdLessThanOrEqualTo(Long value) { + addCriterion("agent_id <=", value, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdIn(List values) { + addCriterion("agent_id in", values, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdNotIn(List values) { + addCriterion("agent_id not in", values, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdBetween(Long value1, Long value2) { + addCriterion("agent_id between", value1, value2, "agentId"); + return (Criteria) this; + } + + public Criteria andAgentIdNotBetween(Long value1, Long value2) { + addCriterion("agent_id not between", value1, value2, "agentId"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("`type` is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("`type` is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Integer value) { + addCriterion("`type` =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Integer value) { + addCriterion("`type` <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Integer value) { + addCriterion("`type` >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("`type` >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Integer value) { + addCriterion("`type` <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Integer value) { + addCriterion("`type` <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("`type` not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Integer value1, Integer value2) { + addCriterion("`type` between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Integer value1, Integer value2) { + addCriterion("`type` not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTransactionAmountIsNull() { + addCriterion("transaction_amount is null"); + return (Criteria) this; + } + + public Criteria andTransactionAmountIsNotNull() { + addCriterion("transaction_amount is not null"); + return (Criteria) this; + } + + public Criteria andTransactionAmountEqualTo(BigDecimal value) { + addCriterion("transaction_amount =", value, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountNotEqualTo(BigDecimal value) { + addCriterion("transaction_amount <>", value, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountGreaterThan(BigDecimal value) { + addCriterion("transaction_amount >", value, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("transaction_amount >=", value, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountLessThan(BigDecimal value) { + addCriterion("transaction_amount <", value, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountLessThanOrEqualTo(BigDecimal value) { + addCriterion("transaction_amount <=", value, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountIn(List values) { + addCriterion("transaction_amount in", values, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountNotIn(List values) { + addCriterion("transaction_amount not in", values, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("transaction_amount between", value1, value2, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andTransactionAmountNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("transaction_amount not between", value1, value2, "transactionAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountIsNull() { + addCriterion("before_amount is null"); + return (Criteria) this; + } + + public Criteria andBeforeAmountIsNotNull() { + addCriterion("before_amount is not null"); + return (Criteria) this; + } + + public Criteria andBeforeAmountEqualTo(BigDecimal value) { + addCriterion("before_amount =", value, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountNotEqualTo(BigDecimal value) { + addCriterion("before_amount <>", value, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountGreaterThan(BigDecimal value) { + addCriterion("before_amount >", value, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("before_amount >=", value, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountLessThan(BigDecimal value) { + addCriterion("before_amount <", value, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountLessThanOrEqualTo(BigDecimal value) { + addCriterion("before_amount <=", value, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountIn(List values) { + addCriterion("before_amount in", values, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountNotIn(List values) { + addCriterion("before_amount not in", values, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("before_amount between", value1, value2, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andBeforeAmountNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("before_amount not between", value1, value2, "beforeAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountIsNull() { + addCriterion("after_amount is null"); + return (Criteria) this; + } + + public Criteria andAfterAmountIsNotNull() { + addCriterion("after_amount is not null"); + return (Criteria) this; + } + + public Criteria andAfterAmountEqualTo(BigDecimal value) { + addCriterion("after_amount =", value, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountNotEqualTo(BigDecimal value) { + addCriterion("after_amount <>", value, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountGreaterThan(BigDecimal value) { + addCriterion("after_amount >", value, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("after_amount >=", value, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountLessThan(BigDecimal value) { + addCriterion("after_amount <", value, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountLessThanOrEqualTo(BigDecimal value) { + addCriterion("after_amount <=", value, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountIn(List values) { + addCriterion("after_amount in", values, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountNotIn(List values) { + addCriterion("after_amount not in", values, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("after_amount between", value1, value2, "afterAmount"); + return (Criteria) this; + } + + public Criteria andAfterAmountNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("after_amount not between", value1, value2, "afterAmount"); + return (Criteria) this; + } + + public Criteria andSourceTypeIsNull() { + addCriterion("source_type is null"); + return (Criteria) this; + } + + public Criteria andSourceTypeIsNotNull() { + addCriterion("source_type is not null"); + return (Criteria) this; + } + + public Criteria andSourceTypeEqualTo(Integer value) { + addCriterion("source_type =", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotEqualTo(Integer value) { + addCriterion("source_type <>", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeGreaterThan(Integer value) { + addCriterion("source_type >", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("source_type >=", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLessThan(Integer value) { + addCriterion("source_type <", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLessThanOrEqualTo(Integer value) { + addCriterion("source_type <=", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeIn(List values) { + addCriterion("source_type in", values, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotIn(List values) { + addCriterion("source_type not in", values, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeBetween(Integer value1, Integer value2) { + addCriterion("source_type between", value1, value2, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotBetween(Integer value1, Integer value2) { + addCriterion("source_type not between", value1, value2, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceIdIsNull() { + addCriterion("source_id is null"); + return (Criteria) this; + } + + public Criteria andSourceIdIsNotNull() { + addCriterion("source_id is not null"); + return (Criteria) this; + } + + public Criteria andSourceIdEqualTo(Long value) { + addCriterion("source_id =", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotEqualTo(Long value) { + addCriterion("source_id <>", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdGreaterThan(Long value) { + addCriterion("source_id >", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdGreaterThanOrEqualTo(Long value) { + addCriterion("source_id >=", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdLessThan(Long value) { + addCriterion("source_id <", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdLessThanOrEqualTo(Long value) { + addCriterion("source_id <=", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdIn(List values) { + addCriterion("source_id in", values, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotIn(List values) { + addCriterion("source_id not in", values, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdBetween(Long value1, Long value2) { + addCriterion("source_id between", value1, value2, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotBetween(Long value1, Long value2) { + addCriterion("source_id not between", value1, value2, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoIsNull() { + addCriterion("source_order_no is null"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoIsNotNull() { + addCriterion("source_order_no is not null"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoEqualTo(String value) { + addCriterion("source_order_no =", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoNotEqualTo(String value) { + addCriterion("source_order_no <>", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoGreaterThan(String value) { + addCriterion("source_order_no >", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoGreaterThanOrEqualTo(String value) { + addCriterion("source_order_no >=", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoLessThan(String value) { + addCriterion("source_order_no <", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoLessThanOrEqualTo(String value) { + addCriterion("source_order_no <=", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoLike(String value) { + addCriterion("source_order_no like", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoNotLike(String value) { + addCriterion("source_order_no not like", value, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoIn(List values) { + addCriterion("source_order_no in", values, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoNotIn(List values) { + addCriterion("source_order_no not in", values, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoBetween(String value1, String value2) { + addCriterion("source_order_no between", value1, value2, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceOrderNoNotBetween(String value1, String value2) { + addCriterion("source_order_no not between", value1, value2, "sourceOrderNo"); + return (Criteria) this; + } + + public Criteria andSourceContentIsNull() { + addCriterion("source_content is null"); + return (Criteria) this; + } + + public Criteria andSourceContentIsNotNull() { + addCriterion("source_content is not null"); + return (Criteria) this; + } + + public Criteria andSourceContentEqualTo(String value) { + addCriterion("source_content =", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentNotEqualTo(String value) { + addCriterion("source_content <>", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentGreaterThan(String value) { + addCriterion("source_content >", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentGreaterThanOrEqualTo(String value) { + addCriterion("source_content >=", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentLessThan(String value) { + addCriterion("source_content <", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentLessThanOrEqualTo(String value) { + addCriterion("source_content <=", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentLike(String value) { + addCriterion("source_content like", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentNotLike(String value) { + addCriterion("source_content not like", value, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentIn(List values) { + addCriterion("source_content in", values, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentNotIn(List values) { + addCriterion("source_content not in", values, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentBetween(String value1, String value2) { + addCriterion("source_content between", value1, value2, "sourceContent"); + return (Criteria) this; + } + + public Criteria andSourceContentNotBetween(String value1, String value2) { + addCriterion("source_content not between", value1, value2, "sourceContent"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andOpUserTypeIsNull() { + addCriterion("op_user_type is null"); + return (Criteria) this; + } + + public Criteria andOpUserTypeIsNotNull() { + addCriterion("op_user_type is not null"); + return (Criteria) this; + } + + public Criteria andOpUserTypeEqualTo(Integer value) { + addCriterion("op_user_type =", value, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeNotEqualTo(Integer value) { + addCriterion("op_user_type <>", value, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeGreaterThan(Integer value) { + addCriterion("op_user_type >", value, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("op_user_type >=", value, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeLessThan(Integer value) { + addCriterion("op_user_type <", value, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeLessThanOrEqualTo(Integer value) { + addCriterion("op_user_type <=", value, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeIn(List values) { + addCriterion("op_user_type in", values, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeNotIn(List values) { + addCriterion("op_user_type not in", values, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeBetween(Integer value1, Integer value2) { + addCriterion("op_user_type between", value1, value2, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserTypeNotBetween(Integer value1, Integer value2) { + addCriterion("op_user_type not between", value1, value2, "opUserType"); + return (Criteria) this; + } + + public Criteria andOpUserIdIsNull() { + addCriterion("op_user_id is null"); + return (Criteria) this; + } + + public Criteria andOpUserIdIsNotNull() { + addCriterion("op_user_id is not null"); + return (Criteria) this; + } + + public Criteria andOpUserIdEqualTo(Long value) { + addCriterion("op_user_id =", value, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdNotEqualTo(Long value) { + addCriterion("op_user_id <>", value, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdGreaterThan(Long value) { + addCriterion("op_user_id >", value, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("op_user_id >=", value, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdLessThan(Long value) { + addCriterion("op_user_id <", value, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdLessThanOrEqualTo(Long value) { + addCriterion("op_user_id <=", value, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdIn(List values) { + addCriterion("op_user_id in", values, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdNotIn(List values) { + addCriterion("op_user_id not in", values, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdBetween(Long value1, Long value2) { + addCriterion("op_user_id between", value1, value2, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserIdNotBetween(Long value1, Long value2) { + addCriterion("op_user_id not between", value1, value2, "opUserId"); + return (Criteria) this; + } + + public Criteria andOpUserNameIsNull() { + addCriterion("op_user_name is null"); + return (Criteria) this; + } + + public Criteria andOpUserNameIsNotNull() { + addCriterion("op_user_name is not null"); + return (Criteria) this; + } + + public Criteria andOpUserNameEqualTo(String value) { + addCriterion("op_user_name =", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameNotEqualTo(String value) { + addCriterion("op_user_name <>", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameGreaterThan(String value) { + addCriterion("op_user_name >", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameGreaterThanOrEqualTo(String value) { + addCriterion("op_user_name >=", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameLessThan(String value) { + addCriterion("op_user_name <", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameLessThanOrEqualTo(String value) { + addCriterion("op_user_name <=", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameLike(String value) { + addCriterion("op_user_name like", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameNotLike(String value) { + addCriterion("op_user_name not like", value, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameIn(List values) { + addCriterion("op_user_name in", values, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameNotIn(List values) { + addCriterion("op_user_name not in", values, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameBetween(String value1, String value2) { + addCriterion("op_user_name between", value1, value2, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserNameNotBetween(String value1, String value2) { + addCriterion("op_user_name not between", value1, value2, "opUserName"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneIsNull() { + addCriterion("op_user_phone is null"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneIsNotNull() { + addCriterion("op_user_phone is not null"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneEqualTo(String value) { + addCriterion("op_user_phone =", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneNotEqualTo(String value) { + addCriterion("op_user_phone <>", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneGreaterThan(String value) { + addCriterion("op_user_phone >", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneGreaterThanOrEqualTo(String value) { + addCriterion("op_user_phone >=", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneLessThan(String value) { + addCriterion("op_user_phone <", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneLessThanOrEqualTo(String value) { + addCriterion("op_user_phone <=", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneLike(String value) { + addCriterion("op_user_phone like", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneNotLike(String value) { + addCriterion("op_user_phone not like", value, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneIn(List values) { + addCriterion("op_user_phone in", values, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneNotIn(List values) { + addCriterion("op_user_phone not in", values, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneBetween(String value1, String value2) { + addCriterion("op_user_phone between", value1, value2, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andOpUserPhoneNotBetween(String value1, String value2) { + addCriterion("op_user_phone not between", value1, value2, "opUserPhone"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsAgentApiParam.java b/service/src/main/java/com/hfkj/entity/BsAgentApiParam.java index 9c949f8..0e45983 100644 --- a/service/src/main/java/com/hfkj/entity/BsAgentApiParam.java +++ b/service/src/main/java/com/hfkj/entity/BsAgentApiParam.java @@ -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); diff --git a/service/src/main/java/com/hfkj/entity/BsAgentApiParamExample.java b/service/src/main/java/com/hfkj/entity/BsAgentApiParamExample.java index f47da58..6f772b0 100644 --- a/service/src/main/java/com/hfkj/entity/BsAgentApiParamExample.java +++ b/service/src/main/java/com/hfkj/entity/BsAgentApiParamExample.java @@ -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 values) { + addCriterion("mer_info_notify in", values, "merInfoNotify"); + return (Criteria) this; + } + + public Criteria andMerInfoNotifyNotIn(List 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 values) { + addCriterion("order_refund_notify in", values, "orderRefundNotify"); + return (Criteria) this; + } + + public Criteria andOrderRefundNotifyNotIn(List 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; diff --git a/service/src/main/java/com/hfkj/entity/BsGasOrder.java b/service/src/main/java/com/hfkj/entity/BsGasOrder.java index 8db0573..f7c24ae 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsGasOrder.java @@ -280,6 +280,11 @@ public class BsGasOrder implements Serializable { */ private Integer status; + /** + * 创建方式 1:平台下单 2:API下单 + */ + 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); diff --git a/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java b/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java index e09c63b..4d3bac0 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java @@ -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 values) { + addCriterion("create_type in", values, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeNotIn(List 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; diff --git a/service/src/main/java/com/hfkj/entity/BsOrderRefund.java b/service/src/main/java/com/hfkj/entity/BsOrderRefund.java index d8c1ac3..229080c 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderRefund.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderRefund.java @@ -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); diff --git a/service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java b/service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java index c37ef77..8897d16 100644 --- a/service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java +++ b/service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java @@ -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 values) { + addCriterion("create_type in", values, "createType"); + return (Criteria) this; + } + + public Criteria andCreateTypeNotIn(List 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; diff --git a/service/src/main/java/com/hfkj/openapi/model/response/QueryGasOilPriceDetail.java b/service/src/main/java/com/hfkj/openapi/model/GasOilPriceDetail.java similarity index 51% rename from service/src/main/java/com/hfkj/openapi/model/response/QueryGasOilPriceDetail.java rename to service/src/main/java/com/hfkj/openapi/model/GasOilPriceDetail.java index 8d379e1..c95ccec 100644 --- a/service/src/main/java/com/hfkj/openapi/model/response/QueryGasOilPriceDetail.java +++ b/service/src/main/java/com/hfkj/openapi/model/GasOilPriceDetail.java @@ -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 gunNoList; /** * 国标价 */ @@ -35,8 +38,4 @@ public class QueryGasOilPriceDetail { * 油枪价 */ private BigDecimal priceGun; - /** - * 优惠价 - */ - private BigDecimal priceVip; } diff --git a/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderDetailModel.java b/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderDetailModel.java new file mode 100644 index 0000000..7d15e68 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderDetailModel.java @@ -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; + +} diff --git a/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderPushModel.java b/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderPushModel.java new file mode 100644 index 0000000..8fb7520 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderPushModel.java @@ -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; + +} diff --git a/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderRefundModel.java b/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderRefundModel.java new file mode 100644 index 0000000..e06de93 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/model/request/RequestOrderRefundModel.java @@ -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; + +} diff --git a/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasInfoModel.java b/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasInfoModel.java index 512e6ba..69c6d31 100644 --- a/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasInfoModel.java +++ b/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasInfoModel.java @@ -12,13 +12,6 @@ import javax.validation.constraints.NotNull; **/ @Data public class RequestQueryGasInfoModel { - - /** - * appid - */ - @NotBlank(message = "请求id必填项") - private String reqId; - /** * appid */ diff --git a/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasListModel.java b/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasListModel.java index 5a7a00b..3c46a7c 100644 --- a/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasListModel.java +++ b/service/src/main/java/com/hfkj/openapi/model/request/RequestQueryGasListModel.java @@ -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; diff --git a/service/src/main/java/com/hfkj/openapi/model/response/OrderRefundNotifyModel.java b/service/src/main/java/com/hfkj/openapi/model/response/OrderRefundNotifyModel.java new file mode 100644 index 0000000..21adac0 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/model/response/OrderRefundNotifyModel.java @@ -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; + +} diff --git a/service/src/main/java/com/hfkj/openapi/model/response/QueryGasGun.java b/service/src/main/java/com/hfkj/openapi/model/response/QueryGasGun.java deleted file mode 100644 index 8691408..0000000 --- a/service/src/main/java/com/hfkj/openapi/model/response/QueryGasGun.java +++ /dev/null @@ -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; - -} diff --git a/service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderDetailModel.java b/service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderDetailModel.java new file mode 100644 index 0000000..4d82ad0 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderDetailModel.java @@ -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; +} diff --git a/service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderPushModel.java b/service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderPushModel.java new file mode 100644 index 0000000..948cb31 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/model/response/ResponseOrderPushModel.java @@ -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; +} diff --git a/service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasInfoModel.java b/service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasInfoModel.java index e9c0889..fdaaca0 100644 --- a/service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasInfoModel.java +++ b/service/src/main/java/com/hfkj/openapi/model/response/ResponseQueryGasInfoModel.java @@ -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 oilPriceList; - /** - * 油枪信息 - */ - private List gasGunList; - - + private List oilPriceList; } diff --git a/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java b/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java new file mode 100644 index 0000000..4621c50 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/service/ApiGasOrderService.java @@ -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 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 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 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 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 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 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; + } + +} diff --git a/service/src/main/java/com/hfkj/openapi/service/ApiGasService.java b/service/src/main/java/com/hfkj/openapi/service/ApiGasService.java index d04d561..461a0a2 100644 --- a/service/src/main/java/com/hfkj/openapi/service/ApiGasService.java +++ b/service/src/main/java/com/hfkj/openapi/service/ApiGasService.java @@ -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 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; } } diff --git a/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountRecordService.java b/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountRecordService.java new file mode 100644 index 0000000..d4c34d3 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountRecordService.java @@ -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 getList(Map param); +} diff --git a/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountService.java b/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountService.java index ac35e6e..ccfb982 100644 --- a/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountService.java +++ b/service/src/main/java/com/hfkj/service/agent/BsAgentApiAccountService.java @@ -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 otherParam) throws Exception; + + /** + * 退款 + * @param agentId + * @param amount + * @param orderRefund + */ + void refund(Long agentId, BigDecimal amount, BsOrderRefund orderRefund) throws Exception; + + } diff --git a/service/src/main/java/com/hfkj/service/agent/BsAgentApiParamService.java b/service/src/main/java/com/hfkj/service/agent/BsAgentApiParamService.java index 9d0e783..f634eed 100644 --- a/service/src/main/java/com/hfkj/service/agent/BsAgentApiParamService.java +++ b/service/src/main/java/com/hfkj/service/agent/BsAgentApiParamService.java @@ -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 getParamListByGasNo(String gasNo); + /** * 查询参数 * @param appId diff --git a/service/src/main/java/com/hfkj/service/agent/BsAgentMerService.java b/service/src/main/java/com/hfkj/service/agent/BsAgentMerService.java index 7a53976..dfae367 100644 --- a/service/src/main/java/com/hfkj/service/agent/BsAgentMerService.java +++ b/service/src/main/java/com/hfkj/service/agent/BsAgentMerService.java @@ -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 getList(Map param); + /** + * 查询商户号列表 + * @param agentId + * @return + */ + List getMerNoList(Long agentId); + /** * 查询详情 * @param agentId @@ -88,4 +97,11 @@ public interface BsAgentMerService { * @param merNoArray */ void unbindStaff(Long staffId, List merNoArray); + + /** + * 通知代理 + * @param merNo + */ + void agentNotify(String merNo); + } diff --git a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountRecordServiceImpl.java b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountRecordServiceImpl.java new file mode 100644 index 0000000..c8c6c78 --- /dev/null +++ b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountRecordServiceImpl.java @@ -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 getList(Map 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); + } +} diff --git a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountServiceImpl.java b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountServiceImpl.java index 42de848..17666c6 100644 --- a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiAccountServiceImpl.java @@ -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 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 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); + } + } } diff --git a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiParamServiceImpl.java b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiParamServiceImpl.java index 2328742..cc0e396 100644 --- a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiParamServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentApiParamServiceImpl.java @@ -65,6 +65,11 @@ public class BsAgentApiParamServiceImpl implements BsAgentApiParamService { return params.get(0); } + @Override + public List getParamListByGasNo(String gasNo) { + return agentApiParamMapper.selectParamListByGasNo(gasNo); + } + @Override public BsAgentApiParam getParamByAppId(String appId) { // 查询 diff --git a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java index a2bb50c..45bcd4d 100644 --- a/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerServiceImpl.java @@ -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 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 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()); + } + } + }); + } + } + } + } + } diff --git a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java index 3b3ba96..4594845 100644 --- a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java @@ -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 diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 89d053b..96ce243 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -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()); diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java index 65825cc..ea91b66 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java @@ -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); // 资金退款 diff --git a/service/src/main/java/com/hfkj/sysenum/gas/GasOrderCreateType.java b/service/src/main/java/com/hfkj/sysenum/gas/GasOrderCreateType.java new file mode 100644 index 0000000..2eb8247 --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/gas/GasOrderCreateType.java @@ -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; + } +} diff --git a/service/src/main/java/com/hfkj/sysenum/merchant/MerchantStatusEnum.java b/service/src/main/java/com/hfkj/sysenum/merchant/MerchantStatusEnum.java index 66f8ca9..22500e7 100644 --- a/service/src/main/java/com/hfkj/sysenum/merchant/MerchantStatusEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/merchant/MerchantStatusEnum.java @@ -8,8 +8,17 @@ import java.util.Objects; * @date: 2024/3/4 **/ public enum MerchantStatusEnum { + /** + * 删除 + */ status0(0, "删除"), + /** + * 正常 + */ status1(1, "正常"), + /** + * 禁用 + */ status2(2, "禁用"), ; diff --git a/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java b/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java index b8d09b2..501c88d 100644 --- a/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java +++ b/service/src/main/java/com/hfkj/sysenum/order/OrderPayTypeEnum.java @@ -24,6 +24,10 @@ public enum OrderPayTypeEnum { * 云闪付 */ type3(3, "云闪付"), + /** + * API余额 + */ + type4(4, "API余额"), ; private final int code;