From da705b10bd44f9da0b09dd1b6cec52157b8d6074 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 1 Aug 2022 18:01:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HighGasChannelConfigController.java | 136 ++ .../bweb/controller/HighGasController.java | 16 +- .../HighMerchantStoreController.java | 9 + .../cweb/controller/HighGasController.java | 7 +- .../cweb/controller/HighTestController.java | 2 +- .../cweb/controller/pay/OrderController.java | 104 +- .../java/com/hai/config/CommonSysConfig.java | 11 + .../com/hai/config/ShellGroupService.java | 121 +- .../com/hai/dao/BsTripartiteReqLogMapper.java | 160 +++ .../hai/dao/BsTripartiteReqLogMapperExt.java | 7 + .../dao/BsTripartiteReqLogSqlProvider.java | 380 +++++ .../hai/dao/HighGasChannelConfigMapper.java | 142 ++ .../dao/HighGasChannelConfigMapperExt.java | 7 + .../dao/HighGasChannelConfigSqlProvider.java | 388 +++++ .../com/hai/entity/BsTripartiteReqLog.java | 232 +++ .../hai/entity/BsTripartiteReqLogExample.java | 953 +++++++++++++ .../com/hai/entity/HighGasChannelConfig.java | 297 ++++ .../entity/HighGasChannelConfigExample.java | 1264 +++++++++++++++++ .../java/com/hai/enum_type/GasChannel.java | 46 + .../enum_type/GasChannelPayPlatformType.java | 42 + .../enum_type/MerchantStoreSourceType.java | 2 + .../enum_type/TripartiteReqLogReqType.java | 36 + .../hai/enum_type/TripartiteReqLogType.java | 41 + .../service/BsTripartiteReqLogService.java | 22 + .../service/HighGasChannelConfigService.java | 26 + .../hai/service/HighGasOilGunNoService.java | 8 + .../java/com/hai/service/HighGasService.java | 13 + .../com/hai/service/HighMerchantService.java | 7 + .../hai/service/HighMerchantStoreService.java | 7 + .../impl/BsTripartiteReqLogServiceImpl.java | 36 + .../impl/HighGasChannelConfigServiceImpl.java | 48 + .../HighGasDiscountOilPriceServiceImpl.java | 6 +- .../impl/HighGasOilGunNoServiceImpl.java | 11 + .../hai/service/impl/HighGasServiceImpl.java | 232 +++ .../service/impl/HighMerchantServiceImpl.java | 11 + .../impl/HighMerchantStoreServiceImpl.java | 20 +- .../service/impl/HighOrderServiceImpl.java | 20 +- .../pay/impl/GoodsOrderServiceImpl.java | 59 +- .../resources/dev/commonConfig.properties | 7 +- .../resources/pre/commonConfig.properties | 1 + .../prod-9401/commonConfig.properties | 1 + .../resources/prod/commonConfig.properties | 1 + 42 files changed, 4828 insertions(+), 111 deletions(-) create mode 100644 hai-bweb/src/main/java/com/bweb/controller/HighGasChannelConfigController.java create mode 100644 hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapper.java create mode 100644 hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapperExt.java create mode 100644 hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogSqlProvider.java create mode 100644 hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapper.java create mode 100644 hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapperExt.java create mode 100644 hai-service/src/main/java/com/hai/dao/HighGasChannelConfigSqlProvider.java create mode 100644 hai-service/src/main/java/com/hai/entity/BsTripartiteReqLog.java create mode 100644 hai-service/src/main/java/com/hai/entity/BsTripartiteReqLogExample.java create mode 100644 hai-service/src/main/java/com/hai/entity/HighGasChannelConfig.java create mode 100644 hai-service/src/main/java/com/hai/entity/HighGasChannelConfigExample.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/GasChannel.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/GasChannelPayPlatformType.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogReqType.java create mode 100644 hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java create mode 100644 hai-service/src/main/java/com/hai/service/BsTripartiteReqLogService.java create mode 100644 hai-service/src/main/java/com/hai/service/HighGasChannelConfigService.java create mode 100644 hai-service/src/main/java/com/hai/service/HighGasService.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/BsTripartiteReqLogServiceImpl.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/HighGasChannelConfigServiceImpl.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasChannelConfigController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasChannelConfigController.java new file mode 100644 index 00000000..9106eabf --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasChannelConfigController.java @@ -0,0 +1,136 @@ +package com.bweb.controller; + +import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.pay.util.XmlUtil; +import com.hai.common.pay.util.sdk.WXPayConstants; +import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.common.utils.WxUtils; +import com.hai.entity.HighGasChannelConfig; +import com.hai.entity.HighMerchantTripartitePlatform; +import com.hai.enum_type.GasChannel; +import com.hai.enum_type.GasChannelPayPlatformType; +import com.hai.model.ResponseData; +import com.hai.model.WxSharingReceiversVO; +import com.hai.service.HighGasChannelConfigService; +import com.hai.service.HighMerchantTripartitePlatformService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.SortedMap; + +@Controller +@RequestMapping(value = "/gasChannelConfig") +@Api(value = "加油站渠道商配置") +public class HighGasChannelConfigController { + + private static Logger log = LoggerFactory.getLogger(HighGasChannelConfigController.class); + + @Resource + private HighGasChannelConfigService gasChannelConfigService; + + @RequestMapping(value="/editTripartitePlatform",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "编辑第三方平台") + public ResponseData editTripartitePlatform(@RequestBody JSONObject body) { + try { + if (body == null + || body.getInteger("channelId") == null + || body.getInteger("payPlatformType") == null + || StringUtils.isBlank(body.getString("payPlatformMerName")) + || StringUtils.isBlank(body.getString("payPlatformMerNo")) + || body.getBoolean("profitSharingStatus") == null + ) { + log.error("HighGasChannelConfigController -> editTripartitePlatform() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + if (body.getBoolean("profitSharingStatus") == true && + (body.getBigDecimal("profitSharingRatio") == null || + StringUtils.isBlank(body.getString("profitSharingReceiversNo")) || + StringUtils.isBlank(body.getString("profitSharingReceiversName")))) { + log.error("HighGasChannelConfigController -> editTripartitePlatform() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 查询平台 + HighGasChannelConfig platform = gasChannelConfigService.getConfig( + GasChannel.getChannelByType(body.getInteger("channelId")), + GasChannelPayPlatformType.getPlatformByType(body.getInteger("payPlatformType"))); + + if (platform == null) { + platform = new HighGasChannelConfig(); + } + platform.setChannelId(body.getInteger("channelId")); + platform.setChannelName(GasChannel.getChannelByType(body.getInteger("channelId")).getName()); + platform.setPayPlatformType(body.getInteger("payPlatformType")); + platform.setPayPlatformMerName(body.getString("payPlatformMerName")); + platform.setPayPlatformMerNo(body.getString("payPlatformMerNo")); + platform.setProfitSharingStatus(body.getBoolean("profitSharingStatus")); + platform.setProfitSharingRatio(body.getBigDecimal("profitSharingRatio")); + platform.setProfitSharingReceiversNo(body.getString("profitSharingReceiversNo")); + platform.setProfitSharingReceiversName(body.getString("profitSharingReceiversName")); + + // 微信平台 增加分账关系 + if (platform.getPayPlatformType().equals(1) && platform.getProfitSharingStatus().equals(true)) { + WxSharingReceiversVO receiversVO = new WxSharingReceiversVO(); + receiversVO.setAccount(platform.getProfitSharingReceiversNo()); + receiversVO.setType("MERCHANT_ID"); + receiversVO.setName(platform.getProfitSharingReceiversName()); + receiversVO.setRelation_type("SERVICE_PROVIDER"); + + Map map = new HashMap<>(); + map.put("mch_id" , "1289663601"); // 服务商 + map.put("sub_mch_id" , platform.getPayPlatformMerNo()); + map.put("appid" , "wxa075e8509802f826"); + map.put("nonce_str" , WxUtils.makeNonStr()); + map.put("sign_type" , "HMAC-SHA256"); + map.put("receiver" , JSONObject.toJSONString(receiversVO)); + String sign = WxUtils.generateSignature(map, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); + map.put("sign" , sign); + String notifyXml = HttpsUtils.postData("https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver", WxUtils.mapToXml(map)); + SortedMap postData = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); + if (!postData.get("result_code").equals("SUCCESS")) { + log.error("HighMerchantController -> editTripartitePlatform() error!", postData.get("err_code_des")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, postData.get("err_code_des")); + } + } + + gasChannelConfigService.editConfig(platform); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighGasChannelConfigController -> editTripartitePlatform() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询详情") + public ResponseData getDetail(@RequestParam(value = "channelId" , required = true) Integer channelId, + @RequestParam(value = "payPlatformType" , required = true) Integer payPlatformType, + HttpServletRequest request) { + try { + + return ResponseMsgUtil.success(gasChannelConfigService.getConfig(GasChannel.getChannelByType(channelId), GasChannelPayPlatformType.getPlatformByType(payPlatformType))); + + } catch (Exception e) { + log.error("HighGasChannelConfigController -> getDetail() error!",e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java index 60579f26..e82379b1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasController.java @@ -14,6 +14,7 @@ import com.hai.common.utils.DateUtil; import com.hai.common.utils.PageUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongUnionCardConfig; +import com.hai.config.ShellGroupService; import com.hai.config.TuanYouConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; @@ -69,6 +70,9 @@ public class HighGasController { @Resource private RedisTemplate redisTemplate; + @Resource + private ShellGroupService shellGroupService; + @RequestMapping(value="/getMerGasStatistical",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "查询商户油站统计") @@ -764,7 +768,7 @@ public class HighGasController { } // 来源类型 1:平台自建 2:团油 - if (store.getSourceType().equals(1)) { + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { if (order.getPayType() == 2) { OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getAccountMerchantNum(), order.getPayRealPrice()); @@ -818,7 +822,7 @@ public class HighGasController { order.setRefundContent(body.getString("refundContent")); highOrderService.updateOrderDetail(order); - } else if (store.getSourceType().equals(2)) { + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { JSONObject object = TuanYouConfig.refuelingOrderRefund(order.getMemPhone(), order.getOrderNo(), body.getString("refundContent")); if (object == null || !object.getString("code").equals("200")) { log.error("HighOrderController --> refuelingOrderRefund() error!", "提交退款审核失败," + object.getString("message")); @@ -826,6 +830,14 @@ public class HighGasController { } order.setOrderStatus(6); highOrderService.updateOrderDetail(order); + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + JSONObject object = shellGroupService.gasSyncRefund(order.getPayTime(), order.getOrderNo()); + if (!object.getString("status").equals("SUCCESS")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,原因:" + object.getString("message")); + } + order.setOrderStatus(6); + highOrderService.updateOrderDetail(order); } } return ResponseMsgUtil.success("操作成功"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java index 66b4ad97..ef8318e7 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantStoreController.java @@ -11,6 +11,7 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.CommonSysConst; import com.hai.entity.BsCompany; import com.hai.entity.HighMerchant; import com.hai.entity.HighMerchantStore; @@ -122,6 +123,10 @@ public class HighMerchantStoreController { highMerchantStore.setBrandName(commonService.getDictionaryCodeName("MERCHANT_STORE_BRANCH", highMerchantStore.getBrandId().toString())); } + // 加油站没有设置图片的情况,默认设置 + if (highMerchantStore.getType().equals(1) && StringUtils.isBlank(highMerchantStore.getStoreLogo())) { + highMerchantStore.setStoreLogo(CommonSysConst.getSysConfig().getGasDefaultOilStationImg()); + } highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setStatus(1); // 状态:0:删除,1:正常 @@ -233,6 +238,10 @@ public class HighMerchantStoreController { store.setBrandId(highMerchantStore.getBrandId()); store.setBrandName(commonService.getDictionaryCodeName("MERCHANT_STORE_BRANCH", highMerchantStore.getBrandId().toString())); } + // 加油站没有设置图片的情况,默认设置 + if (highMerchantStore.getType().equals(1) && StringUtils.isBlank(highMerchantStore.getStoreLogo())) { + store.setStoreLogo(CommonSysConst.getSysConfig().getGasDefaultOilStationImg()); + } store.setType(highMerchantStore.getType()); store.setStoreLogo(highMerchantStore.getStoreLogo()); store.setStoreName(highMerchantStore.getStoreName()); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 64903836..72a8576c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -15,6 +15,7 @@ import com.hai.config.TuanYouConfig; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.GasOilPriceStatusEnum; +import com.hai.enum_type.MerchantStoreSourceType; import com.hai.enum_type.OrderPushType; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; @@ -276,7 +277,7 @@ public class HighGasController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站"); } // 来源类型 1:平台自建 2:团油 - if (store.getSourceType().equals(1)) { + if (store.getSourceType().equals(1) || store.getSourceType().equals(3)) { Map param = new HashMap<>(); param.put("provinceName", null); param.put("provinceCode", null); @@ -470,7 +471,7 @@ public class HighGasController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知来源的加油站"); } // 来源类型 1:平台自建 2:团油 - if (store.getSourceType().equals(1)) { + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber()) || store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { Map param = new HashMap<>(); param.put("provinceName", null); param.put("provinceCode", null); @@ -560,7 +561,7 @@ public class HighGasController { return ResponseMsgUtil.success(param); - } else if (store.getSourceType().equals(2)) { + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(MapUtils.getString(station, "storeKey")); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index 5aa44cef..d35e6433 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -1 +1 @@ -package com.cweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionStagingPayConfig unionStagingPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOilCardService oilCardService; @Resource private BaiduVoiceService baiduVoiceService; @Resource private MqttProviderConfig mqttProviderConfig; @Autowired private WebSocket webSocket; @RequestMapping(value = "/wxGasProfitsharing", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "wxGasProfitsharing") public ResponseData wxGasProfitsharing(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { // 查询订单 HighOrder order = highOrderService.getOrderByOrderNo(orderNo); BigDecimal rake = new BigDecimal("0.05"); // 计算微信收取的手续费 支付金额 * 0.002 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 BigDecimal wxHandlingFee = order.getPayRealPrice().multiply(new BigDecimal("0.002")).setScale(2, BigDecimal.ROUND_HALF_DOWN); BigDecimal price = order.getPayRealPrice().subtract(wxHandlingFee); // 计算分账金额 手续费后的价格 * 0.05 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 BigDecimal profitSharingAmount = price.multiply(rake).setScale(2, BigDecimal.ROUND_DOWN); this.wxGasProfitsharing(order.getExt1(), order.getPaySerialNo(), order.getOrderNo(), profitSharingAmount); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } public void wxGasProfitsharing(String appid, String transaction_id, String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", appid); param.put("mch_id", "1289663601"); param.put("sub_mch_id", "1624126902"); // 个体户黎杨珍 param.put("transaction_id", transaction_id); param.put("out_order_no", out_order_no); param.put("nonce_str", WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers", JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(out_order_no); sharingRecord.setTransactionId(transaction_id); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } @RequestMapping(value = "/addPrinter", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡详情") public ResponseData addPrinter(HttpServletRequest request) { try { SpPrinterConfig spPrinterConfig = new SpPrinterConfig(); return ResponseMsgUtil.success( spPrinterConfig.addPrinter( "1540500213", "bxpjpnh4", "丹凤加油站打印机" ) ); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryThirdOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单结果查询") public ResponseData queryThirdOrderDretail(HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryThirdOrderDetail("HF2022051214411536507")); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/spPrint", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发送打印机消息") public ResponseData spPrint(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); new Thread(() -> { try { SpPrinterConfig sp = new SpPrinterConfig(); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilCashierStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); Thread.sleep(6000); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilClientStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); } catch (Exception e) { e.printStackTrace(); } }).start(); } return ResponseMsgUtil.success("发送成功"); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/text2audio", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "文本转语音") public ResponseData text2audio(HttpServletRequest request) { try { JSONObject jsonObject = new JSONObject(); jsonObject.put("type", "tts_dynamic"); jsonObject.put("msgid", System.currentTimeMillis() + ""); // jsonObject.put("txt", "有新的加油站订单,请及时处理".getBytes("GBK")); jsonObject.put("txt", "有新的加油站订单,请及时查看".getBytes("GBK")); // mqttProviderConfig.publish(2, false, "869298051949691", jsonObject.toJSONString()); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getGasDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡详情") public ResponseData getGasDetail(@RequestParam(name = "cardNo", required = true) String cardNo, HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryGasInfoByGasId(cardNo)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoByGasId", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据油站 id 拉取最新的油站数据") public ResponseData queryGasInfoByGasId(@RequestParam(name = "gasId", required = true) String gasId, HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryGasInfoByGasId(gasId)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } // // @RequestMapping(value = "/getMobile", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "话费充值") // public ResponseData getMobile( // @RequestParam(name = "orderNo", required = true) String orderNo, // @RequestParam(name = "amount", required = true) Integer amount, // @RequestParam(name = "phone", required = true) String phone, // HttpServletRequest request) { // try { // return ResponseMsgUtil.success(outRechargeOrderService.getMobile(phone,amount,orderNo)); // // } catch (Exception e) { // log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue(); i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/detectTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "检测加油站") public ResponseData detectTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } Map param = new HashMap<>(); param.put("merchantId", merchant.getId()); List stores = highMerchantStoreService.getMerchantStoreList(param); for (HighMerchantStore store : stores) { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(store.getStoreKey()); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); store.setStatus(result.getInteger("gasStatus")); } else { store.setStatus(0); } highMerchantStoreService.updateMerchantStoreDetail(store); } return ResponseMsgUtil.success("初始化完成"); } /* @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyPriceDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyPriceDetail() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyPriceDetail("LW000115995", "92")); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/couJointDist", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "派发贵州卡券") public ResponseData couJointDist(@RequestParam(name = "token", required = true) String token) { try { return ResponseMsgUtil.success(HuiLianTongConfig.couJointDist(token, "HF2022031509263475105", "20JY000575", 1, "18385214742", "oArhO6QZSIJAcawo1Wwx5cKKZ0ns")); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/tradeQuery", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "派发贵州卡券") public ResponseData tradeQuery(@RequestParam(name = "token", required = true) String token) { try { return ResponseMsgUtil.success(UnionPayConfig.tradeQuery(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, "HF2022031215130820400")); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/zwrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "派发贵州卡券") public ResponseData zwrefund() { try { return ResponseMsgUtil.success(UnionPayConfig.cancel(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, "HF" + System.currentTimeMillis(), "31720220622093814132759")); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联支付") public ResponseData unionPay(HttpServletRequest request) { try { // return ResponseMsgUtil.success(RequestUtils.getIpAddress(request)); return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, "HF" + System.currentTimeMillis(), new BigDecimal("1"), "test", CommonSysConst.getSysConfig().getUnionPayNotifyUrl(), request)); } catch (Exception e) { log.error("HighOrderController --> unionPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getToken", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取贵州中石化token") public ResponseData getToken() { try { return ResponseMsgUtil.success(huiLianTongConfig.getToken()); } catch (Exception e) { log.error("HighOrderController --> getToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionTradeQuery", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联交易查询") public ResponseData unionTradeQuery(@RequestParam(name = "paySerialNo", required = true) String paySerialNo) { try { return ResponseMsgUtil.success(UnionPayConfig.tradeQuery(UnionPayConfig.MER_ID1, UnionPayConfig.TERM_ID1, paySerialNo)); } catch (Exception e) { log.error("HighOrderController --> unionTradeQuery() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrdersPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "星巴克支付") public ResponseData starbucksOrdersPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrdersPay(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payKfcOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "肯德基支付") public ResponseData payKfcOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.payKfcOrder(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { // 汇联通充值 String goodsDesc = "汇联通充值1元"; String tranDesc = ""; String businessType = "ghk_deposit"; // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit("TEST2022334532783", "8800030115015135432", new BigDecimal(1), businessType, "1231231223", tranDesc); return ResponseMsgUtil.success(deposit); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(), orderNo.getPaySerialNo(), orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/unionStagingPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联分期支付") public ResponseData unionStagingPay(HttpServletRequest request) { try { /* String orderNo = DateUtil.format(new Date(), DateUtil.YMDHMS); orderNo += IDGenerator.nextId(28 - orderNo.length());*/ String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(unionStagingPayConfig.advancePay( orgTrace, orgTrace, new BigDecimal("1"), CommonSysConst.getSysConfig().getUnionStagingPayNotifyUrl(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "退款") public ResponseData orderToRefund(HttpServletRequest request) { try { OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund("4200001301202202035413938093", new BigDecimal("30.80"), new BigDecimal("16.90")); return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } }*/ @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mposrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期退款") public ResponseData mposrefund(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.standardRefund(orgTrace, oriOrgTrace, new BigDecimal("1"), "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/mposfindrefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期退款查询") public ResponseData mposfindrefund(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.mposfindrefund(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id, String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id", "1609882817"); // 个体户黎杨珍 param.put("transaction_id", transaction_id); param.put("out_order_no", out_order_no); param.put("nonce_str", WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers", JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception { /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/profitsharing"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e) { throw new RuntimeException(e); } finally { httpClient.close(); } } @RequestMapping(value = "/websocket", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "websocket") public ResponseData websocket(@RequestParam(name = "orderNo", required = true) String orderNo ) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { Map pushMsg = new HashMap<>(); pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId()); Map msgContent = new HashMap<>(); msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo())); msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice())); pushMsg.put("message", JSONObject.toJSONString(msgContent)); HttpsUtils.doPost("http://127.0.0.1:9901/msg/test/websocket", pushMsg, new HashMap<>()); } return ResponseMsgUtil.success("null"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasPageQueryAllStation") public ResponseData gasPageQueryAllStation() { try { return ResponseMsgUtil.success(ShellGroupService.gasPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } public static String hexStringToString(String s) { if (s == null || s.equals("")) { return null; } s = s.replace(" ", ""); byte[] baKeyword = new byte[s.length() / 2]; for (int i = 0; i < baKeyword.length; i++) { try { baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); } catch (Exception e) { e.printStackTrace(); } } try { s = new String(baKeyword, "UTF-8"); } catch (Exception e1) { e1.printStackTrace(); } return s; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final byte[] printText, final int pageCount, String encodingStr) { try { byte[] array = new byte[printText.length + 9]; array[0] = 30; array[1] = 16; array[2] = (byte) pageCount;//打印份数 int num = array.length - 5; array[3] = (byte) (num >> 8); //array[4] = (byte)((uint)num & 0xFFu); array[4] = (byte) (num & 0xFF); for (int i = 0; i < printText.length; i++) { array[i + 5] = printText[i]; } array[array.length - 4] = 27; array[array.length - 3] = 99; byte[] crc16CodeArray = getCRC(printText); array[array.length - 2] = crc16CodeArray[0]; array[array.length - 1] = crc16CodeArray[1]; return array; /* if(encodingStr.equals("")){ encodingStr="UTF-8"; } byte[] msgByte = printText; // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte;*/ } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final String printText, final int pageCount, String encodingStr) { try { if (encodingStr.equals("")) { encodingStr = "UTF-8"; } byte[] msgByte = printText.getBytes(encodingStr); // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte; } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } private static int[] CRC16Table = {0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78}; private static byte[] getCRC(byte[] bytes) { int crc = 0xFFFF; // 初始值 for (byte b : bytes) { crc = (crc >> 8) ^ CRC16Table[(crc ^ b) & 0xff]; } byte[] b = new byte[2]; b[0] = (byte) ((crc >> 8) ^ 0xff); b[1] = (byte) ((crc & 0xff) ^ 0xff); return b; } private static final char[] HEXES = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** * byte数组 转换成 16进制小写字符串 */ private String bytes2Hex(byte[] bytes) { if (bytes == null || bytes.length == 0) { return null; } StringBuilder hex = new StringBuilder(); for (byte b : bytes) { hex.append(HEXES[(b >> 4) & 0x0F]); hex.append(HEXES[b & 0x0F]); } return hex.toString(); } @RequestMapping(value = "/insertV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付") public ResponseData insertV2() { try { String orderNo = "HF" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); JSONObject object = QianZhuConfig.insertV2("PLM100068", orderNo, "18090580471"); object.put("orderNo", orderNo); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/QueryV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单号") public ResponseData QueryV2(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); JSONObject orderObject = QianZhuConfig.QueryV2(orderNo); if (orderObject != null && orderObject.getLong("Code") == 999) { // 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) { // 订单失败 if (order.getOrderStatus() == 2) { highOrderService.thirdOrderToRefund(order.getId()); } else { highOrderService.thirdCancelOrder(order.getId()); } } // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(3); } order.setOrderStatus(3); order.setFinishTime(new Date()); highOrderService.updateOrder(order); } } return ResponseMsgUtil.success(QianZhuConfig.QueryV2(orderNo)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基订单") public ResponseData getKfcOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.getKfcOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克订单") public ResponseData starbucksOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/thirdOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "第三方退款") public ResponseData thirdOrderToRefund(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); highOrderService.thirdOrderToRefund(order.getId()); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇话费充值 ") public ResponseData rechargeOrderByCy() { try { JSONObject object = new JSONObject(); object.put("mobile" , "18090580471"); object.put("productId" , 172); object.put("agentOrderId" , "RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); return ResponseMsgUtil.success(RechargeConfig.rechargeOrderByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryRechargeByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇查询订单") public ResponseData queryRechargeByCy(@RequestParam(name = "orderNo", required = true) String orderNo) { try { JSONObject object = new JSONObject(); object.put("orderNo" , orderNo); return ResponseMsgUtil.success(RechargeConfig.queryRechargeByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/postIp", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求ip地址") public ResponseData postIp() { try { return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsgcs.dctpay.com/brest/openApi/test")); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file +package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOilGunNoService gasOilGunNoService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionStagingPayConfig unionStagingPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOilCardService oilCardService; @Resource private BaiduVoiceService baiduVoiceService; @Resource private MqttProviderConfig mqttProviderConfig; @Autowired private WebSocket webSocket; @Resource private ShellGroupService shellGroupService; @Resource private HighGasService gasService; @RequestMapping(value = "/spPrint", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发送打印机消息") public ResponseData spPrint(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); new Thread(() -> { try { SpPrinterConfig sp = new SpPrinterConfig(); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilCashierStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); Thread.sleep(6000); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilClientStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); } catch (Exception e) { e.printStackTrace(); } }).start(); } return ResponseMsgUtil.success("发送成功"); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoByGasId", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据油站 id 拉取最新的油站数据") public ResponseData queryGasInfoByGasId(@RequestParam(name = "gasId", required = true) String gasId, HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryGasInfoByGasId(gasId)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue(); i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/detectTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "检测加油站") public ResponseData detectTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } Map param = new HashMap<>(); param.put("merchantId", merchant.getId()); List stores = highMerchantStoreService.getMerchantStoreList(param); for (HighMerchantStore store : stores) { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(store.getStoreKey()); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); store.setStatus(result.getInteger("gasStatus")); } else { store.setStatus(0); } highMerchantStoreService.updateMerchantStoreDetail(store); } return ResponseMsgUtil.success("初始化完成"); } /* @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyPriceDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyPriceDetail() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyPriceDetail("LW000115995", "92")); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrdersPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "星巴克支付") public ResponseData starbucksOrdersPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrdersPay(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payKfcOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "肯德基支付") public ResponseData payKfcOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.payKfcOrder(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(), orderNo.getPaySerialNo(), orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "退款") public ResponseData orderToRefund(HttpServletRequest request) { try { OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund("4200001301202202035413938093", new BigDecimal("30.80"), new BigDecimal("16.90")); return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } }*/ @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id, String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id", "1609882817"); // 个体户黎杨珍 param.put("transaction_id", transaction_id); param.put("out_order_no", out_order_no); param.put("nonce_str", WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers", JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception { /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/profitsharing"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e) { throw new RuntimeException(e); } finally { httpClient.close(); } } @RequestMapping(value = "/websocket", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "websocket") public ResponseData websocket(@RequestParam(name = "orderNo", required = true) String orderNo ) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { Map pushMsg = new HashMap<>(); pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId()); Map msgContent = new HashMap<>(); msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo())); msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice())); pushMsg.put("message", JSONObject.toJSONString(msgContent)); HttpsUtils.doPost("http://127.0.0.1:9901/msg/test/websocket", pushMsg, new HashMap<>()); } return ResponseMsgUtil.success("null"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasStationQueryDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasStationQueryDetail") public ResponseData gasStationQueryDetail() { try { return ResponseMsgUtil.success(shellGroupService.gasStationQueryDetail("0001")); } catch (Exception e) { log.error("HighOrderController --> gasStationQueryDetail() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasPageQueryAllStation") public ResponseData gasPageQueryAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncPayment") public ResponseData gasSyncPayment() { try { HighOrder order = highOrderService.getOrderByOrderNo("HF2022071114274054900"); for (HighChildOrder childOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); // 推送壳牌 JSONObject syncPayment = shellGroupService.gasSyncPayment(order.getOrderNo(), // store.getStoreKey(), "0001", new Date(), order.getTotalPrice(), "92", "1", order.getPayRealPrice()); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasSyncRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncRefund") public ResponseData gasSyncRefund() { try { shellGroupService.gasSyncRefund(new Date(1659078708000L), "HF2022071114274054900"); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } public static void main(String[] args) { System.out.println(new BigDecimal("10").divide(new BigDecimal("3"),0,BigDecimal.ROUND_CEILING).intValue()); } public static String hexStringToString(String s) { if (s == null || s.equals("")) { return null; } s = s.replace(" ", ""); byte[] baKeyword = new byte[s.length() / 2]; for (int i = 0; i < baKeyword.length; i++) { try { baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); } catch (Exception e) { e.printStackTrace(); } } try { s = new String(baKeyword, "UTF-8"); } catch (Exception e1) { e1.printStackTrace(); } return s; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final byte[] printText, final int pageCount, String encodingStr) { try { byte[] array = new byte[printText.length + 9]; array[0] = 30; array[1] = 16; array[2] = (byte) pageCount;//打印份数 int num = array.length - 5; array[3] = (byte) (num >> 8); //array[4] = (byte)((uint)num & 0xFFu); array[4] = (byte) (num & 0xFF); for (int i = 0; i < printText.length; i++) { array[i + 5] = printText[i]; } array[array.length - 4] = 27; array[array.length - 3] = 99; byte[] crc16CodeArray = getCRC(printText); array[array.length - 2] = crc16CodeArray[0]; array[array.length - 1] = crc16CodeArray[1]; return array; /* if(encodingStr.equals("")){ encodingStr="UTF-8"; } byte[] msgByte = printText; // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte;*/ } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final String printText, final int pageCount, String encodingStr) { try { if (encodingStr.equals("")) { encodingStr = "UTF-8"; } byte[] msgByte = printText.getBytes(encodingStr); // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte; } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } private static int[] CRC16Table = {0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78}; private static byte[] getCRC(byte[] bytes) { int crc = 0xFFFF; // 初始值 for (byte b : bytes) { crc = (crc >> 8) ^ CRC16Table[(crc ^ b) & 0xff]; } byte[] b = new byte[2]; b[0] = (byte) ((crc >> 8) ^ 0xff); b[1] = (byte) ((crc & 0xff) ^ 0xff); return b; } private static final char[] HEXES = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** * byte数组 转换成 16进制小写字符串 */ private String bytes2Hex(byte[] bytes) { if (bytes == null || bytes.length == 0) { return null; } StringBuilder hex = new StringBuilder(); for (byte b : bytes) { hex.append(HEXES[(b >> 4) & 0x0F]); hex.append(HEXES[b & 0x0F]); } return hex.toString(); } @RequestMapping(value = "/insertV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付") public ResponseData insertV2() { try { String orderNo = "HF" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); JSONObject object = QianZhuConfig.insertV2("PLM100068", orderNo, "18090580471"); object.put("orderNo", orderNo); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/QueryV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单号") public ResponseData QueryV2(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); JSONObject orderObject = QianZhuConfig.QueryV2(orderNo); if (orderObject != null && orderObject.getLong("Code") == 999) { // 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) { // 订单失败 if (order.getOrderStatus() == 2) { highOrderService.thirdOrderToRefund(order.getId()); } else { highOrderService.thirdCancelOrder(order.getId()); } } // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(3); } order.setOrderStatus(3); order.setFinishTime(new Date()); highOrderService.updateOrder(order); } } return ResponseMsgUtil.success(QianZhuConfig.QueryV2(orderNo)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基订单") public ResponseData getKfcOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.getKfcOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克订单") public ResponseData starbucksOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/thirdOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "第三方退款") public ResponseData thirdOrderToRefund(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); highOrderService.thirdOrderToRefund(order.getId()); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇话费充值 ") public ResponseData rechargeOrderByCy() { try { JSONObject object = new JSONObject(); object.put("mobile" , "18090580471"); object.put("productId" , 172); object.put("agentOrderId" , "RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); return ResponseMsgUtil.success(RechargeConfig.rechargeOrderByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryRechargeByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇查询订单") public ResponseData queryRechargeByCy(@RequestParam(name = "orderNo", required = true) String orderNo) { try { JSONObject object = new JSONObject(); object.put("orderNo" , orderNo); return ResponseMsgUtil.success(RechargeConfig.queryRechargeByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/postIp", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求ip地址") public ResponseData postIp() { try { return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsgcs.dctpay.com/brest/openApi/test")); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index f03dbc77..4fced139 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -19,8 +19,7 @@ import com.hai.common.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; -import com.hai.enum_type.GoodsType; -import com.hai.enum_type.PayType; +import com.hai.enum_type.*; import com.hai.model.*; import com.hai.service.*; import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder; @@ -87,6 +86,9 @@ public class OrderController { @Resource private HighMerchantStoreService merchantStoreService; + @Resource + private HighMerchantAccountService merchantAccountService; + @Resource private HighMerchantTripartitePlatformService tripartitePlatformService; @@ -111,6 +113,8 @@ public class OrderController { @Resource private SecConfigService configService; + @Resource + private HighGasChannelConfigService gasChannelConfigService; /** * * @Title: orderToPay @@ -201,7 +205,7 @@ public class OrderController { String profitSharing = "N"; BigDecimal profitSharingRatio = new BigDecimal("1"); - //微信支付 + // 微信支付 String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8"); int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue(); WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); @@ -217,32 +221,65 @@ public class OrderController { weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxGzSubMchId());//商户号 } else if (order.getHighChildOrderList().get(0).getGoodsType() == 3) { - SecConfig wxMerNumber = configService.findByCodeType("OIL_WX_MER"); - if (wxMerNumber == null) { - weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1624126902); // 浩联商户号 - } else { - weChatPayReqInfo.setSub_mch_id(wxMerNumber.getCodeValue()); - } - profitSharing = "N"; - // 查询油站 HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); - if (store != null && store.getSourceType().equals(1)) { - // 预存类型 0:非预存 1:预存门店 - if (store.getPrestoreType().equals(0)) { - profitSharing = "N"; - - // 第三方平台 - HighMerchantTripartitePlatform merTripartitePlatform = tripartitePlatformService.getDetail(store.getMerchantId(), 1); - if (merTripartitePlatform != null) { - weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); - // 是否分账 - profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); + } + + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1,GasChannelPayPlatformType.type1 ); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + + if (store.getSourceType().equals(1)) { + // 预存类型 0:非预存 1:预存门店 + if (store.getPrestoreType().equals(0)) { + // 第三方平台 + HighMerchantTripartitePlatform merTripartitePlatform = tripartitePlatformService.getDetail(store.getMerchantId(), 1); + if (merTripartitePlatform != null) { + weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); + // 是否分账 + profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; + } } } - if (store.getPrestoreType().equals(1)) { - profitSharing = "N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { + + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2,GasChannelPayPlatformType.type1 ); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3,GasChannelPayPlatformType.type1 ); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { + // 查询支付配置 + HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4,GasChannelPayPlatformType.type1 ); + if (gasChannelConfig == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); + } + weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); + profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); } } else { //子商户号 @@ -360,12 +397,27 @@ public class OrderController { if (account.getInteger("energyType") == childOrder.getGasOilType()) { // 支付金额 大于 团油账号余额 if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){ - log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服"); + log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); } } } } + + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + BigDecimal account = new BigDecimal("0"); + // 查询账号余额 + HighMerchantAccount merAccount = merchantAccountService.getStoreAccountDetail(store.getMerchantId()); + if (merAccount != null) { + account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId())); + } + // 客户加油金额 大于 商户账号余额 + if(order.getTotalPrice().compareTo(account) == 1) { + log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); + } + } } } diff --git a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java index f5865753..b7bb0d91 100644 --- a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java +++ b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java @@ -12,6 +12,9 @@ public class CommonSysConfig { // 嗨森逛域名 private String hsgDomainName; + // 加油站默认图片 + private String gasDefaultOilStationImg; + private String tuanYouUrl; private String tuanYouAppKey; private String tuanYouAppSecret; @@ -585,4 +588,12 @@ public class CommonSysConfig { public void setCyPostUrl(String cyPostUrl) { CyPostUrl = cyPostUrl; } + + public String getGasDefaultOilStationImg() { + return gasDefaultOilStationImg; + } + + public void setGasDefaultOilStationImg(String gasDefaultOilStationImg) { + this.gasDefaultOilStationImg = gasDefaultOilStationImg; + } } diff --git a/hai-service/src/main/java/com/hai/config/ShellGroupService.java b/hai-service/src/main/java/com/hai/config/ShellGroupService.java index 89db01b9..28f6b780 100644 --- a/hai-service/src/main/java/com/hai/config/ShellGroupService.java +++ b/hai-service/src/main/java/com/hai/config/ShellGroupService.java @@ -8,20 +8,25 @@ import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.DateUtil; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.MD5Util; -import org.apache.http.NameValuePair; -import org.apache.http.message.BasicNameValuePair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.hai.enum_type.TripartiteReqLogReqType; +import com.hai.enum_type.TripartiteReqLogType; +import com.hai.service.BsTripartiteReqLogService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.math.BigDecimal; +import java.net.URLEncoder; import java.util.*; /** * 壳牌接口服务 */ +@Component public class ShellGroupService { - private static Logger log = LoggerFactory.getLogger(ShellGroupService.class); + @Resource + private BsTripartiteReqLogService reqLogService; /** * 查询全量加油站 @@ -29,12 +34,12 @@ public class ShellGroupService { * @param pageSize 每页数据量。最大值50 * @return */ - public static JSONObject gasPageQueryAllStation(Integer pageNum,Integer pageSize) throws Exception { + public JSONObject gasPageQueryAllStation(Integer pageNum,Integer pageSize) throws Exception { Map param = new HashMap<>(); param.put("platMerchantId", CommonSysConst.getSysConfig().getShellPlatMerchantId()); param.put("pageNo", pageNum); param.put("pageSize", pageSize); - return request("gasPageQueryAllStation", param); + return request(System.currentTimeMillis()+"","gasPageQueryAllStation", param); } /** @@ -42,12 +47,12 @@ public class ShellGroupService { * @param stationCode 油站编码 * @return */ - public static JSONObject gasStationQueryDetail(String stationCode) { + public JSONObject gasStationQueryDetail(String stationCode) { try { Map param = new HashMap<>(); param.put("platMerchantId", CommonSysConst.getSysConfig().getShellPlatMerchantId()); param.put("stationCode", stationCode); - return request("gasPageQueryAllStation", param); + return request(System.currentTimeMillis()+"","gasPageQueryAllStation", param); } catch (Exception e) { e.printStackTrace(); } @@ -57,15 +62,22 @@ public class ShellGroupService { /** * 【同步】油站付款 - * @param stationCode 油站编码 + * @param orderNo 订单号 + * @param stationCode 油站编码 + * @param finishTime 完成时间 + * @param oilPrice 油品金额 + * @param oilCode 油品编码 + * @param oilGun 油枪 + * @param channelSettlementAmount 加油金额 * @return */ - public static JSONObject gasSyncPayment(String stationCode, - Date finishTime, - BigDecimal amount, - String code, - String oilGun, - BigDecimal channelSettlementAmount) { + public JSONObject gasSyncPayment(String orderNo, + String stationCode, + Date finishTime, + BigDecimal oilPrice, + String oilCode, + String oilGun, + BigDecimal channelSettlementAmount) { try { @@ -76,12 +88,12 @@ public class ShellGroupService { param.put("finishTime", DateUtil.date2String(finishTime, "yyyy-MM-dd HH:mm:ss")); Map tradeOilOrder = new HashMap<>(); - tradeOilOrder.put("amount", amount); - tradeOilOrder.put("code", code); + tradeOilOrder.put("amount", oilPrice); + tradeOilOrder.put("code", oilCode); tradeOilOrder.put("oilGun", oilGun); tradeOilOrder.put("channelSettlementAmount", channelSettlementAmount); - param.put("tradeOilOrder", tradeOilOrder); - return request("gas_sync_payment_notify", param); + param.put("tradeOilOrder", JSONObject.toJSONString(tradeOilOrder)); + return request(orderNo, "gas_sync_payment_notify", param); } catch (Exception e) { e.printStackTrace(); } @@ -94,19 +106,13 @@ public class ShellGroupService { * @param tradeNo 交易流水号 * @return */ - public static JSONObject gasSyncRefund(Date finishTime,String tradeNo) { - try { - Map param = new HashMap<>(); - param.put("platMerchantId", CommonSysConst.getSysConfig().getShellPlatMerchantId()); - param.put("finishTime", DateUtil.date2String(finishTime, "yyyy-MM-dd HH:mm:ss")); - param.put("tradeNo", tradeNo); - param.put("sign", MD5Util.encode(generateSignature(param, CommonSysConst.getSysConfig().getShellPlatMerchantKey()).getBytes())); - // 请求接口 - return request("gas_sync_refund_notify", param); - } catch (Exception e) { - e.printStackTrace(); - } - return null; + public JSONObject gasSyncRefund(Date finishTime,String tradeNo) throws Exception { + Map param = new HashMap<>(); + param.put("platMerchantId", CommonSysConst.getSysConfig().getShellPlatMerchantId()); + param.put("finishTime", DateUtil.date2String(finishTime, "yyyy-MM-dd HH:mm:ss")); + param.put("tradeNo", tradeNo); + // 请求接口 + return request(tradeNo,"gas_sync_refund_notify", param); } /** @@ -115,9 +121,9 @@ public class ShellGroupService { * @return * @throws Exception */ - private static JSONObject request(String service,Map map) throws Exception { + private JSONObject request(String logSerialNo, String service, Map map) throws Exception { Map param = new HashMap<>(); - param.put("merchantOrderNo", System.currentTimeMillis()); + param.put("merchantOrderNo", logSerialNo); param.put("partnerId", CommonSysConst.getSysConfig().getShellGroupPartnerId()); param.put("service", service); param.put("version", "1.0.0"); @@ -126,10 +132,19 @@ public class ShellGroupService { for (Map.Entry entry : map.entrySet()) { param.put(entry.getKey(), entry.getValue()); } - param.put("sign", MD5Util.encode(generateSignature(param, CommonSysConst.getSysConfig().getShellPlatMerchantKey()).getBytes())); + param.put("sign", MD5Util.encode(generateSignature(param, CommonSysConst.getSysConfig().getShellPlatMerchantKey()).getBytes()).toLowerCase()); // 请求接口 JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getShellGroupUrl(), param); + reqLogService.insert( + TripartiteReqLogType.type2, + logSerialNo, + TripartiteReqLogReqType.type1, + CommonSysConst.getSysConfig().getShellGroupUrl(), + this.generateParam(param), + object.toString() + ); + if (object == null || !object.getString("status").equals("SUCCESS")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object == null?"请求失败":object.getString("message")); } @@ -142,21 +157,43 @@ public class ShellGroupService { * @param key 秘钥app_secret * @return 加密结果 */ - public static String generateSignature(final Map data, String key){ + public static String generateSignature(final Map data, String key) { Set keySet = data.keySet(); String[] keyArray = keySet.toArray(new String[keySet.size()]); Arrays.sort(keyArray); StringBuilder sb = new StringBuilder(); - sb.append(key); for (String k : keyArray) { - if (k.equals(WXPayConstants.FIELD_SIGN)) { - continue; + if (data.get(k) != null) { + if (StringUtils.isBlank(sb.toString())) { + sb.append(k).append("=").append(data.get(k)); + } else { + sb.append("&").append(k).append("=").append(data.get(k)); + } } - if (data.get(k) != null) // 参数值为空,则不参与签名 - sb.append(k).append(data.get(k)); } sb.append(key); return sb.toString(); } + /** + * 生成参数 + * @param data 数据 + * @return 加密结果 + */ + public static String generateParam(final Map data) { + Set keySet = data.keySet(); + String[] keyArray = keySet.toArray(new String[keySet.size()]); + StringBuilder sb = new StringBuilder(); + for (String k : keyArray) { + if (data.get(k) != null) { + if (StringUtils.isBlank(sb.toString())) { + sb.append(k).append("=").append(data.get(k)); + } else { + sb.append("&").append(k).append("=").append(data.get(k)); + } + } + } + return sb.toString(); + } + } diff --git a/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapper.java b/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapper.java new file mode 100644 index 00000000..baecd27c --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapper.java @@ -0,0 +1,160 @@ +package com.hai.dao; + +import com.hai.entity.BsTripartiteReqLog; +import com.hai.entity.BsTripartiteReqLogExample; +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 BsTripartiteReqLogMapper extends BsTripartiteReqLogMapperExt { + @SelectProvider(type=BsTripartiteReqLogSqlProvider.class, method="countByExample") + long countByExample(BsTripartiteReqLogExample example); + + @DeleteProvider(type=BsTripartiteReqLogSqlProvider.class, method="deleteByExample") + int deleteByExample(BsTripartiteReqLogExample example); + + @Delete({ + "delete from bs_tripartite_req_log", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_tripartite_req_log (log_type, log_type_name, ", + "log_serial_no, request_type, ", + "request_url, request_content, ", + "create_time, ext_1, ", + "ext_2, ext_3, response_content)", + "values (#{logType,jdbcType=INTEGER}, #{logTypeName,jdbcType=VARCHAR}, ", + "#{logSerialNo,jdbcType=VARCHAR}, #{requestType,jdbcType=INTEGER}, ", + "#{requestUrl,jdbcType=VARCHAR}, #{requestContent,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{responseContent,jdbcType=LONGVARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsTripartiteReqLog record); + + @InsertProvider(type=BsTripartiteReqLogSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsTripartiteReqLog record); + + @SelectProvider(type=BsTripartiteReqLogSqlProvider.class, method="selectByExampleWithBLOBs") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="log_type", property="logType", jdbcType=JdbcType.INTEGER), + @Result(column="log_type_name", property="logTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="log_serial_no", property="logSerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="request_type", property="requestType", jdbcType=JdbcType.INTEGER), + @Result(column="request_url", property="requestUrl", jdbcType=JdbcType.VARCHAR), + @Result(column="request_content", property="requestContent", jdbcType=JdbcType.VARCHAR), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @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), + @Result(column="response_content", property="responseContent", jdbcType=JdbcType.LONGVARCHAR) + }) + List selectByExampleWithBLOBs(BsTripartiteReqLogExample example); + + @SelectProvider(type=BsTripartiteReqLogSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="log_type", property="logType", jdbcType=JdbcType.INTEGER), + @Result(column="log_type_name", property="logTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="log_serial_no", property="logSerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="request_type", property="requestType", jdbcType=JdbcType.INTEGER), + @Result(column="request_url", property="requestUrl", jdbcType=JdbcType.VARCHAR), + @Result(column="request_content", property="requestContent", jdbcType=JdbcType.VARCHAR), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @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(BsTripartiteReqLogExample example); + + @Select({ + "select", + "id, log_type, log_type_name, log_serial_no, request_type, request_url, request_content, ", + "create_time, ext_1, ext_2, ext_3, response_content", + "from bs_tripartite_req_log", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="log_type", property="logType", jdbcType=JdbcType.INTEGER), + @Result(column="log_type_name", property="logTypeName", jdbcType=JdbcType.VARCHAR), + @Result(column="log_serial_no", property="logSerialNo", jdbcType=JdbcType.VARCHAR), + @Result(column="request_type", property="requestType", jdbcType=JdbcType.INTEGER), + @Result(column="request_url", property="requestUrl", jdbcType=JdbcType.VARCHAR), + @Result(column="request_content", property="requestContent", jdbcType=JdbcType.VARCHAR), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @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), + @Result(column="response_content", property="responseContent", jdbcType=JdbcType.LONGVARCHAR) + }) + BsTripartiteReqLog selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsTripartiteReqLogSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsTripartiteReqLog record, @Param("example") BsTripartiteReqLogExample example); + + @UpdateProvider(type=BsTripartiteReqLogSqlProvider.class, method="updateByExampleWithBLOBs") + int updateByExampleWithBLOBs(@Param("record") BsTripartiteReqLog record, @Param("example") BsTripartiteReqLogExample example); + + @UpdateProvider(type=BsTripartiteReqLogSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsTripartiteReqLog record, @Param("example") BsTripartiteReqLogExample example); + + @UpdateProvider(type=BsTripartiteReqLogSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsTripartiteReqLog record); + + @Update({ + "update bs_tripartite_req_log", + "set log_type = #{logType,jdbcType=INTEGER},", + "log_type_name = #{logTypeName,jdbcType=VARCHAR},", + "log_serial_no = #{logSerialNo,jdbcType=VARCHAR},", + "request_type = #{requestType,jdbcType=INTEGER},", + "request_url = #{requestUrl,jdbcType=VARCHAR},", + "request_content = #{requestContent,jdbcType=VARCHAR},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR},", + "response_content = #{responseContent,jdbcType=LONGVARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKeyWithBLOBs(BsTripartiteReqLog record); + + @Update({ + "update bs_tripartite_req_log", + "set log_type = #{logType,jdbcType=INTEGER},", + "log_type_name = #{logTypeName,jdbcType=VARCHAR},", + "log_serial_no = #{logSerialNo,jdbcType=VARCHAR},", + "request_type = #{requestType,jdbcType=INTEGER},", + "request_url = #{requestUrl,jdbcType=VARCHAR},", + "request_content = #{requestContent,jdbcType=VARCHAR},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(BsTripartiteReqLog record); +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapperExt.java new file mode 100644 index 00000000..99bee03e --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogMapperExt.java @@ -0,0 +1,7 @@ +package com.hai.dao; + +/** + * mapper扩展类 + */ +public interface BsTripartiteReqLogMapperExt { +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogSqlProvider.java b/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogSqlProvider.java new file mode 100644 index 00000000..7faa312c --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/BsTripartiteReqLogSqlProvider.java @@ -0,0 +1,380 @@ +package com.hai.dao; + +import com.hai.entity.BsTripartiteReqLog; +import com.hai.entity.BsTripartiteReqLogExample.Criteria; +import com.hai.entity.BsTripartiteReqLogExample.Criterion; +import com.hai.entity.BsTripartiteReqLogExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsTripartiteReqLogSqlProvider { + + public String countByExample(BsTripartiteReqLogExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_tripartite_req_log"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsTripartiteReqLogExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_tripartite_req_log"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsTripartiteReqLog record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_tripartite_req_log"); + + if (record.getLogType() != null) { + sql.VALUES("log_type", "#{logType,jdbcType=INTEGER}"); + } + + if (record.getLogTypeName() != null) { + sql.VALUES("log_type_name", "#{logTypeName,jdbcType=VARCHAR}"); + } + + if (record.getLogSerialNo() != null) { + sql.VALUES("log_serial_no", "#{logSerialNo,jdbcType=VARCHAR}"); + } + + if (record.getRequestType() != null) { + sql.VALUES("request_type", "#{requestType,jdbcType=INTEGER}"); + } + + if (record.getRequestUrl() != null) { + sql.VALUES("request_url", "#{requestUrl,jdbcType=VARCHAR}"); + } + + if (record.getRequestContent() != null) { + sql.VALUES("request_content", "#{requestContent,jdbcType=VARCHAR}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + + 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}"); + } + + if (record.getResponseContent() != null) { + sql.VALUES("response_content", "#{responseContent,jdbcType=LONGVARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExampleWithBLOBs(BsTripartiteReqLogExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("log_type"); + sql.SELECT("log_type_name"); + sql.SELECT("log_serial_no"); + sql.SELECT("request_type"); + sql.SELECT("request_url"); + sql.SELECT("request_content"); + sql.SELECT("create_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.SELECT("response_content"); + sql.FROM("bs_tripartite_req_log"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String selectByExample(BsTripartiteReqLogExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("log_type"); + sql.SELECT("log_type_name"); + sql.SELECT("log_serial_no"); + sql.SELECT("request_type"); + sql.SELECT("request_url"); + sql.SELECT("request_content"); + sql.SELECT("create_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_tripartite_req_log"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsTripartiteReqLog record = (BsTripartiteReqLog) parameter.get("record"); + BsTripartiteReqLogExample example = (BsTripartiteReqLogExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_tripartite_req_log"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getLogType() != null) { + sql.SET("log_type = #{record.logType,jdbcType=INTEGER}"); + } + + if (record.getLogTypeName() != null) { + sql.SET("log_type_name = #{record.logTypeName,jdbcType=VARCHAR}"); + } + + if (record.getLogSerialNo() != null) { + sql.SET("log_serial_no = #{record.logSerialNo,jdbcType=VARCHAR}"); + } + + if (record.getRequestType() != null) { + sql.SET("request_type = #{record.requestType,jdbcType=INTEGER}"); + } + + if (record.getRequestUrl() != null) { + sql.SET("request_url = #{record.requestUrl,jdbcType=VARCHAR}"); + } + + if (record.getRequestContent() != null) { + sql.SET("request_content = #{record.requestContent,jdbcType=VARCHAR}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + 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}"); + } + + if (record.getResponseContent() != null) { + sql.SET("response_content = #{record.responseContent,jdbcType=LONGVARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExampleWithBLOBs(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_tripartite_req_log"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("log_type = #{record.logType,jdbcType=INTEGER}"); + sql.SET("log_type_name = #{record.logTypeName,jdbcType=VARCHAR}"); + sql.SET("log_serial_no = #{record.logSerialNo,jdbcType=VARCHAR}"); + sql.SET("request_type = #{record.requestType,jdbcType=INTEGER}"); + sql.SET("request_url = #{record.requestUrl,jdbcType=VARCHAR}"); + sql.SET("request_content = #{record.requestContent,jdbcType=VARCHAR}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + sql.SET("response_content = #{record.responseContent,jdbcType=LONGVARCHAR}"); + + BsTripartiteReqLogExample example = (BsTripartiteReqLogExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_tripartite_req_log"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("log_type = #{record.logType,jdbcType=INTEGER}"); + sql.SET("log_type_name = #{record.logTypeName,jdbcType=VARCHAR}"); + sql.SET("log_serial_no = #{record.logSerialNo,jdbcType=VARCHAR}"); + sql.SET("request_type = #{record.requestType,jdbcType=INTEGER}"); + sql.SET("request_url = #{record.requestUrl,jdbcType=VARCHAR}"); + sql.SET("request_content = #{record.requestContent,jdbcType=VARCHAR}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + + BsTripartiteReqLogExample example = (BsTripartiteReqLogExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsTripartiteReqLog record) { + SQL sql = new SQL(); + sql.UPDATE("bs_tripartite_req_log"); + + if (record.getLogType() != null) { + sql.SET("log_type = #{logType,jdbcType=INTEGER}"); + } + + if (record.getLogTypeName() != null) { + sql.SET("log_type_name = #{logTypeName,jdbcType=VARCHAR}"); + } + + if (record.getLogSerialNo() != null) { + sql.SET("log_serial_no = #{logSerialNo,jdbcType=VARCHAR}"); + } + + if (record.getRequestType() != null) { + sql.SET("request_type = #{requestType,jdbcType=INTEGER}"); + } + + if (record.getRequestUrl() != null) { + sql.SET("request_url = #{requestUrl,jdbcType=VARCHAR}"); + } + + if (record.getRequestContent() != null) { + sql.SET("request_content = #{requestContent,jdbcType=VARCHAR}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + 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}"); + } + + if (record.getResponseContent() != null) { + sql.SET("response_content = #{responseContent,jdbcType=LONGVARCHAR}"); + } + + sql.WHERE("id = #{id,jdbcType=BIGINT}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsTripartiteReqLogExample 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/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapper.java b/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapper.java new file mode 100644 index 00000000..57281c5d --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapper.java @@ -0,0 +1,142 @@ +package com.hai.dao; + +import com.hai.entity.HighGasChannelConfig; +import com.hai.entity.HighGasChannelConfigExample; +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 HighGasChannelConfigMapper extends HighGasChannelConfigMapperExt { + @SelectProvider(type=HighGasChannelConfigSqlProvider.class, method="countByExample") + long countByExample(HighGasChannelConfigExample example); + + @DeleteProvider(type=HighGasChannelConfigSqlProvider.class, method="deleteByExample") + int deleteByExample(HighGasChannelConfigExample example); + + @Delete({ + "delete from high_gas_channel_config", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into high_gas_channel_config (channel_id, channel_name, ", + "pay_platform_type, pay_platform_mer_name, ", + "pay_platform_mer_no, profit_sharing_status, ", + "profit_sharing_receivers_no, profit_sharing_ratio, ", + "profit_sharing_receivers_name, `status`, ", + "create_time, update_time, ", + "ext_1, ext_2, ext_3)", + "values (#{channelId,jdbcType=INTEGER}, #{channelName,jdbcType=VARCHAR}, ", + "#{payPlatformType,jdbcType=INTEGER}, #{payPlatformMerName,jdbcType=VARCHAR}, ", + "#{payPlatformMerNo,jdbcType=VARCHAR}, #{profitSharingStatus,jdbcType=BIT}, ", + "#{profitSharingReceiversNo,jdbcType=VARCHAR}, #{profitSharingRatio,jdbcType=DECIMAL}, ", + "#{profitSharingReceiversName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(HighGasChannelConfig record); + + @InsertProvider(type=HighGasChannelConfigSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(HighGasChannelConfig record); + + @SelectProvider(type=HighGasChannelConfigSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="channel_id", property="channelId", jdbcType=JdbcType.INTEGER), + @Result(column="channel_name", property="channelName", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_platform_type", property="payPlatformType", jdbcType=JdbcType.INTEGER), + @Result(column="pay_platform_mer_name", property="payPlatformMerName", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_platform_mer_no", property="payPlatformMerNo", jdbcType=JdbcType.VARCHAR), + @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), + @Result(column="profit_sharing_receivers_no", property="profitSharingReceiversNo", jdbcType=JdbcType.VARCHAR), + @Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="profit_sharing_receivers_name", property="profitSharingReceiversName", 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), + @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(HighGasChannelConfigExample example); + + @Select({ + "select", + "id, channel_id, channel_name, pay_platform_type, pay_platform_mer_name, pay_platform_mer_no, ", + "profit_sharing_status, profit_sharing_receivers_no, profit_sharing_ratio, profit_sharing_receivers_name, ", + "`status`, create_time, update_time, ext_1, ext_2, ext_3", + "from high_gas_channel_config", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="channel_id", property="channelId", jdbcType=JdbcType.INTEGER), + @Result(column="channel_name", property="channelName", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_platform_type", property="payPlatformType", jdbcType=JdbcType.INTEGER), + @Result(column="pay_platform_mer_name", property="payPlatformMerName", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_platform_mer_no", property="payPlatformMerNo", jdbcType=JdbcType.VARCHAR), + @Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT), + @Result(column="profit_sharing_receivers_no", property="profitSharingReceiversNo", jdbcType=JdbcType.VARCHAR), + @Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL), + @Result(column="profit_sharing_receivers_name", property="profitSharingReceiversName", 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), + @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) + }) + HighGasChannelConfig selectByPrimaryKey(Long id); + + @UpdateProvider(type=HighGasChannelConfigSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") HighGasChannelConfig record, @Param("example") HighGasChannelConfigExample example); + + @UpdateProvider(type=HighGasChannelConfigSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") HighGasChannelConfig record, @Param("example") HighGasChannelConfigExample example); + + @UpdateProvider(type=HighGasChannelConfigSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(HighGasChannelConfig record); + + @Update({ + "update high_gas_channel_config", + "set channel_id = #{channelId,jdbcType=INTEGER},", + "channel_name = #{channelName,jdbcType=VARCHAR},", + "pay_platform_type = #{payPlatformType,jdbcType=INTEGER},", + "pay_platform_mer_name = #{payPlatformMerName,jdbcType=VARCHAR},", + "pay_platform_mer_no = #{payPlatformMerNo,jdbcType=VARCHAR},", + "profit_sharing_status = #{profitSharingStatus,jdbcType=BIT},", + "profit_sharing_receivers_no = #{profitSharingReceiversNo,jdbcType=VARCHAR},", + "profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL},", + "profit_sharing_receivers_name = #{profitSharingReceiversName,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(HighGasChannelConfig record); +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapperExt.java new file mode 100644 index 00000000..1e80d704 --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigMapperExt.java @@ -0,0 +1,7 @@ +package com.hai.dao; + +/** + * mapper扩展类 + */ +public interface HighGasChannelConfigMapperExt { +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigSqlProvider.java new file mode 100644 index 00000000..e15430af --- /dev/null +++ b/hai-service/src/main/java/com/hai/dao/HighGasChannelConfigSqlProvider.java @@ -0,0 +1,388 @@ +package com.hai.dao; + +import com.hai.entity.HighGasChannelConfig; +import com.hai.entity.HighGasChannelConfigExample.Criteria; +import com.hai.entity.HighGasChannelConfigExample.Criterion; +import com.hai.entity.HighGasChannelConfigExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class HighGasChannelConfigSqlProvider { + + public String countByExample(HighGasChannelConfigExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("high_gas_channel_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(HighGasChannelConfigExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("high_gas_channel_config"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(HighGasChannelConfig record) { + SQL sql = new SQL(); + sql.INSERT_INTO("high_gas_channel_config"); + + if (record.getChannelId() != null) { + sql.VALUES("channel_id", "#{channelId,jdbcType=INTEGER}"); + } + + if (record.getChannelName() != null) { + sql.VALUES("channel_name", "#{channelName,jdbcType=VARCHAR}"); + } + + if (record.getPayPlatformType() != null) { + sql.VALUES("pay_platform_type", "#{payPlatformType,jdbcType=INTEGER}"); + } + + if (record.getPayPlatformMerName() != null) { + sql.VALUES("pay_platform_mer_name", "#{payPlatformMerName,jdbcType=VARCHAR}"); + } + + if (record.getPayPlatformMerNo() != null) { + sql.VALUES("pay_platform_mer_no", "#{payPlatformMerNo,jdbcType=VARCHAR}"); + } + + if (record.getProfitSharingStatus() != null) { + sql.VALUES("profit_sharing_status", "#{profitSharingStatus,jdbcType=BIT}"); + } + + if (record.getProfitSharingReceiversNo() != null) { + sql.VALUES("profit_sharing_receivers_no", "#{profitSharingReceiversNo,jdbcType=VARCHAR}"); + } + + if (record.getProfitSharingRatio() != null) { + sql.VALUES("profit_sharing_ratio", "#{profitSharingRatio,jdbcType=DECIMAL}"); + } + + if (record.getProfitSharingReceiversName() != null) { + sql.VALUES("profit_sharing_receivers_name", "#{profitSharingReceiversName,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.getUpdateTime() != null) { + sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); + } + + 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(HighGasChannelConfigExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("channel_id"); + sql.SELECT("channel_name"); + sql.SELECT("pay_platform_type"); + sql.SELECT("pay_platform_mer_name"); + sql.SELECT("pay_platform_mer_no"); + sql.SELECT("profit_sharing_status"); + sql.SELECT("profit_sharing_receivers_no"); + sql.SELECT("profit_sharing_ratio"); + sql.SELECT("profit_sharing_receivers_name"); + sql.SELECT("`status`"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("high_gas_channel_config"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + HighGasChannelConfig record = (HighGasChannelConfig) parameter.get("record"); + HighGasChannelConfigExample example = (HighGasChannelConfigExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("high_gas_channel_config"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getChannelId() != null) { + sql.SET("channel_id = #{record.channelId,jdbcType=INTEGER}"); + } + + if (record.getChannelName() != null) { + sql.SET("channel_name = #{record.channelName,jdbcType=VARCHAR}"); + } + + if (record.getPayPlatformType() != null) { + sql.SET("pay_platform_type = #{record.payPlatformType,jdbcType=INTEGER}"); + } + + if (record.getPayPlatformMerName() != null) { + sql.SET("pay_platform_mer_name = #{record.payPlatformMerName,jdbcType=VARCHAR}"); + } + + if (record.getPayPlatformMerNo() != null) { + sql.SET("pay_platform_mer_no = #{record.payPlatformMerNo,jdbcType=VARCHAR}"); + } + + if (record.getProfitSharingStatus() != null) { + sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); + } + + if (record.getProfitSharingReceiversNo() != null) { + sql.SET("profit_sharing_receivers_no = #{record.profitSharingReceiversNo,jdbcType=VARCHAR}"); + } + + if (record.getProfitSharingRatio() != null) { + sql.SET("profit_sharing_ratio = #{record.profitSharingRatio,jdbcType=DECIMAL}"); + } + + if (record.getProfitSharingReceiversName() != null) { + sql.SET("profit_sharing_receivers_name = #{record.profitSharingReceiversName,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.getUpdateTime() != null) { + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + } + + 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("high_gas_channel_config"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("channel_id = #{record.channelId,jdbcType=INTEGER}"); + sql.SET("channel_name = #{record.channelName,jdbcType=VARCHAR}"); + sql.SET("pay_platform_type = #{record.payPlatformType,jdbcType=INTEGER}"); + sql.SET("pay_platform_mer_name = #{record.payPlatformMerName,jdbcType=VARCHAR}"); + sql.SET("pay_platform_mer_no = #{record.payPlatformMerNo,jdbcType=VARCHAR}"); + sql.SET("profit_sharing_status = #{record.profitSharingStatus,jdbcType=BIT}"); + sql.SET("profit_sharing_receivers_no = #{record.profitSharingReceiversNo,jdbcType=VARCHAR}"); + sql.SET("profit_sharing_ratio = #{record.profitSharingRatio,jdbcType=DECIMAL}"); + sql.SET("profit_sharing_receivers_name = #{record.profitSharingReceiversName,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}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + + HighGasChannelConfigExample example = (HighGasChannelConfigExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(HighGasChannelConfig record) { + SQL sql = new SQL(); + sql.UPDATE("high_gas_channel_config"); + + if (record.getChannelId() != null) { + sql.SET("channel_id = #{channelId,jdbcType=INTEGER}"); + } + + if (record.getChannelName() != null) { + sql.SET("channel_name = #{channelName,jdbcType=VARCHAR}"); + } + + if (record.getPayPlatformType() != null) { + sql.SET("pay_platform_type = #{payPlatformType,jdbcType=INTEGER}"); + } + + if (record.getPayPlatformMerName() != null) { + sql.SET("pay_platform_mer_name = #{payPlatformMerName,jdbcType=VARCHAR}"); + } + + if (record.getPayPlatformMerNo() != null) { + sql.SET("pay_platform_mer_no = #{payPlatformMerNo,jdbcType=VARCHAR}"); + } + + if (record.getProfitSharingStatus() != null) { + sql.SET("profit_sharing_status = #{profitSharingStatus,jdbcType=BIT}"); + } + + if (record.getProfitSharingReceiversNo() != null) { + sql.SET("profit_sharing_receivers_no = #{profitSharingReceiversNo,jdbcType=VARCHAR}"); + } + + if (record.getProfitSharingRatio() != null) { + sql.SET("profit_sharing_ratio = #{profitSharingRatio,jdbcType=DECIMAL}"); + } + + if (record.getProfitSharingReceiversName() != null) { + sql.SET("profit_sharing_receivers_name = #{profitSharingReceiversName,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.getUpdateTime() != null) { + sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); + } + + 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, HighGasChannelConfigExample 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/hai-service/src/main/java/com/hai/entity/BsTripartiteReqLog.java b/hai-service/src/main/java/com/hai/entity/BsTripartiteReqLog.java new file mode 100644 index 00000000..4f941ab4 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/BsTripartiteReqLog.java @@ -0,0 +1,232 @@ +package com.hai.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * bs_tripartite_req_log + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsTripartiteReqLog implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 日志类型 + */ + private Integer logType; + + /** + * 日志类型名称 + */ + private String logTypeName; + + /** + * 日志编号 + */ + private String logSerialNo; + + /** + * 请求类型 + */ + private Integer requestType; + + /** + * 请求URL + */ + private String requestUrl; + + /** + * 请求参数 + */ + private String requestContent; + + /** + * 创建时间 + */ + private Date createTime; + + private String ext1; + + private String ext2; + + private String ext3; + + /** + * 响应内容 + */ + private String responseContent; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Integer getLogType() { + return logType; + } + + public void setLogType(Integer logType) { + this.logType = logType; + } + + public String getLogTypeName() { + return logTypeName; + } + + public void setLogTypeName(String logTypeName) { + this.logTypeName = logTypeName; + } + + public String getLogSerialNo() { + return logSerialNo; + } + + public void setLogSerialNo(String logSerialNo) { + this.logSerialNo = logSerialNo; + } + + public Integer getRequestType() { + return requestType; + } + + public void setRequestType(Integer requestType) { + this.requestType = requestType; + } + + public String getRequestUrl() { + return requestUrl; + } + + public void setRequestUrl(String requestUrl) { + this.requestUrl = requestUrl; + } + + public String getRequestContent() { + return requestContent; + } + + public void setRequestContent(String requestContent) { + this.requestContent = requestContent; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + 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; + } + + public String getResponseContent() { + return responseContent; + } + + public void setResponseContent(String responseContent) { + this.responseContent = responseContent; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + BsTripartiteReqLog other = (BsTripartiteReqLog) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getLogType() == null ? other.getLogType() == null : this.getLogType().equals(other.getLogType())) + && (this.getLogTypeName() == null ? other.getLogTypeName() == null : this.getLogTypeName().equals(other.getLogTypeName())) + && (this.getLogSerialNo() == null ? other.getLogSerialNo() == null : this.getLogSerialNo().equals(other.getLogSerialNo())) + && (this.getRequestType() == null ? other.getRequestType() == null : this.getRequestType().equals(other.getRequestType())) + && (this.getRequestUrl() == null ? other.getRequestUrl() == null : this.getRequestUrl().equals(other.getRequestUrl())) + && (this.getRequestContent() == null ? other.getRequestContent() == null : this.getRequestContent().equals(other.getRequestContent())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (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())) + && (this.getResponseContent() == null ? other.getResponseContent() == null : this.getResponseContent().equals(other.getResponseContent())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getLogType() == null) ? 0 : getLogType().hashCode()); + result = prime * result + ((getLogTypeName() == null) ? 0 : getLogTypeName().hashCode()); + result = prime * result + ((getLogSerialNo() == null) ? 0 : getLogSerialNo().hashCode()); + result = prime * result + ((getRequestType() == null) ? 0 : getRequestType().hashCode()); + result = prime * result + ((getRequestUrl() == null) ? 0 : getRequestUrl().hashCode()); + result = prime * result + ((getRequestContent() == null) ? 0 : getRequestContent().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().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()); + result = prime * result + ((getResponseContent() == null) ? 0 : getResponseContent().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(", logType=").append(logType); + sb.append(", logTypeName=").append(logTypeName); + sb.append(", logSerialNo=").append(logSerialNo); + sb.append(", requestType=").append(requestType); + sb.append(", requestUrl=").append(requestUrl); + sb.append(", requestContent=").append(requestContent); + sb.append(", createTime=").append(createTime); + sb.append(", ext1=").append(ext1); + sb.append(", ext2=").append(ext2); + sb.append(", ext3=").append(ext3); + sb.append(", responseContent=").append(responseContent); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/entity/BsTripartiteReqLogExample.java b/hai-service/src/main/java/com/hai/entity/BsTripartiteReqLogExample.java new file mode 100644 index 00000000..ff2f9c68 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/BsTripartiteReqLogExample.java @@ -0,0 +1,953 @@ +package com.hai.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsTripartiteReqLogExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsTripartiteReqLogExample() { + 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 andLogTypeIsNull() { + addCriterion("log_type is null"); + return (Criteria) this; + } + + public Criteria andLogTypeIsNotNull() { + addCriterion("log_type is not null"); + return (Criteria) this; + } + + public Criteria andLogTypeEqualTo(Integer value) { + addCriterion("log_type =", value, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeNotEqualTo(Integer value) { + addCriterion("log_type <>", value, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeGreaterThan(Integer value) { + addCriterion("log_type >", value, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("log_type >=", value, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeLessThan(Integer value) { + addCriterion("log_type <", value, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeLessThanOrEqualTo(Integer value) { + addCriterion("log_type <=", value, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeIn(List values) { + addCriterion("log_type in", values, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeNotIn(List values) { + addCriterion("log_type not in", values, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeBetween(Integer value1, Integer value2) { + addCriterion("log_type between", value1, value2, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeNotBetween(Integer value1, Integer value2) { + addCriterion("log_type not between", value1, value2, "logType"); + return (Criteria) this; + } + + public Criteria andLogTypeNameIsNull() { + addCriterion("log_type_name is null"); + return (Criteria) this; + } + + public Criteria andLogTypeNameIsNotNull() { + addCriterion("log_type_name is not null"); + return (Criteria) this; + } + + public Criteria andLogTypeNameEqualTo(String value) { + addCriterion("log_type_name =", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameNotEqualTo(String value) { + addCriterion("log_type_name <>", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameGreaterThan(String value) { + addCriterion("log_type_name >", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameGreaterThanOrEqualTo(String value) { + addCriterion("log_type_name >=", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameLessThan(String value) { + addCriterion("log_type_name <", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameLessThanOrEqualTo(String value) { + addCriterion("log_type_name <=", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameLike(String value) { + addCriterion("log_type_name like", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameNotLike(String value) { + addCriterion("log_type_name not like", value, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameIn(List values) { + addCriterion("log_type_name in", values, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameNotIn(List values) { + addCriterion("log_type_name not in", values, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameBetween(String value1, String value2) { + addCriterion("log_type_name between", value1, value2, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogTypeNameNotBetween(String value1, String value2) { + addCriterion("log_type_name not between", value1, value2, "logTypeName"); + return (Criteria) this; + } + + public Criteria andLogSerialNoIsNull() { + addCriterion("log_serial_no is null"); + return (Criteria) this; + } + + public Criteria andLogSerialNoIsNotNull() { + addCriterion("log_serial_no is not null"); + return (Criteria) this; + } + + public Criteria andLogSerialNoEqualTo(String value) { + addCriterion("log_serial_no =", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoNotEqualTo(String value) { + addCriterion("log_serial_no <>", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoGreaterThan(String value) { + addCriterion("log_serial_no >", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoGreaterThanOrEqualTo(String value) { + addCriterion("log_serial_no >=", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoLessThan(String value) { + addCriterion("log_serial_no <", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoLessThanOrEqualTo(String value) { + addCriterion("log_serial_no <=", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoLike(String value) { + addCriterion("log_serial_no like", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoNotLike(String value) { + addCriterion("log_serial_no not like", value, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoIn(List values) { + addCriterion("log_serial_no in", values, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoNotIn(List values) { + addCriterion("log_serial_no not in", values, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoBetween(String value1, String value2) { + addCriterion("log_serial_no between", value1, value2, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andLogSerialNoNotBetween(String value1, String value2) { + addCriterion("log_serial_no not between", value1, value2, "logSerialNo"); + return (Criteria) this; + } + + public Criteria andRequestTypeIsNull() { + addCriterion("request_type is null"); + return (Criteria) this; + } + + public Criteria andRequestTypeIsNotNull() { + addCriterion("request_type is not null"); + return (Criteria) this; + } + + public Criteria andRequestTypeEqualTo(Integer value) { + addCriterion("request_type =", value, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeNotEqualTo(Integer value) { + addCriterion("request_type <>", value, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeGreaterThan(Integer value) { + addCriterion("request_type >", value, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("request_type >=", value, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeLessThan(Integer value) { + addCriterion("request_type <", value, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeLessThanOrEqualTo(Integer value) { + addCriterion("request_type <=", value, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeIn(List values) { + addCriterion("request_type in", values, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeNotIn(List values) { + addCriterion("request_type not in", values, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeBetween(Integer value1, Integer value2) { + addCriterion("request_type between", value1, value2, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestTypeNotBetween(Integer value1, Integer value2) { + addCriterion("request_type not between", value1, value2, "requestType"); + return (Criteria) this; + } + + public Criteria andRequestUrlIsNull() { + addCriterion("request_url is null"); + return (Criteria) this; + } + + public Criteria andRequestUrlIsNotNull() { + addCriterion("request_url is not null"); + return (Criteria) this; + } + + public Criteria andRequestUrlEqualTo(String value) { + addCriterion("request_url =", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlNotEqualTo(String value) { + addCriterion("request_url <>", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlGreaterThan(String value) { + addCriterion("request_url >", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlGreaterThanOrEqualTo(String value) { + addCriterion("request_url >=", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlLessThan(String value) { + addCriterion("request_url <", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlLessThanOrEqualTo(String value) { + addCriterion("request_url <=", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlLike(String value) { + addCriterion("request_url like", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlNotLike(String value) { + addCriterion("request_url not like", value, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlIn(List values) { + addCriterion("request_url in", values, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlNotIn(List values) { + addCriterion("request_url not in", values, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlBetween(String value1, String value2) { + addCriterion("request_url between", value1, value2, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestUrlNotBetween(String value1, String value2) { + addCriterion("request_url not between", value1, value2, "requestUrl"); + return (Criteria) this; + } + + public Criteria andRequestContentIsNull() { + addCriterion("request_content is null"); + return (Criteria) this; + } + + public Criteria andRequestContentIsNotNull() { + addCriterion("request_content is not null"); + return (Criteria) this; + } + + public Criteria andRequestContentEqualTo(String value) { + addCriterion("request_content =", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentNotEqualTo(String value) { + addCriterion("request_content <>", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentGreaterThan(String value) { + addCriterion("request_content >", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentGreaterThanOrEqualTo(String value) { + addCriterion("request_content >=", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentLessThan(String value) { + addCriterion("request_content <", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentLessThanOrEqualTo(String value) { + addCriterion("request_content <=", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentLike(String value) { + addCriterion("request_content like", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentNotLike(String value) { + addCriterion("request_content not like", value, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentIn(List values) { + addCriterion("request_content in", values, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentNotIn(List values) { + addCriterion("request_content not in", values, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentBetween(String value1, String value2) { + addCriterion("request_content between", value1, value2, "requestContent"); + return (Criteria) this; + } + + public Criteria andRequestContentNotBetween(String value1, String value2) { + addCriterion("request_content not between", value1, value2, "requestContent"); + 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 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/hai-service/src/main/java/com/hai/entity/HighGasChannelConfig.java b/hai-service/src/main/java/com/hai/entity/HighGasChannelConfig.java new file mode 100644 index 00000000..640d2019 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/HighGasChannelConfig.java @@ -0,0 +1,297 @@ +package com.hai.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * high_gas_channel_config + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class HighGasChannelConfig implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 渠道id 1:自建站 2:团油 3:加好油 4:金猪加油 + */ + private Integer channelId; + + /** + * 渠道名称 + */ + private String channelName; + + /** + * 平台类型 1:微信 + */ + private Integer payPlatformType; + + /** + * 商户名称 + */ + private String payPlatformMerName; + + /** + * 商户号 + */ + private String payPlatformMerNo; + + /** + * 是否分账 + */ + private Boolean profitSharingStatus; + + /** + * 分账接收方账户 + */ + private String profitSharingReceiversNo; + + /** + * 分账比率 + */ + private BigDecimal profitSharingRatio; + + /** + * 分账接收方名称 + */ + private String profitSharingReceiversName; + + /** + * 状态 0:删除 1:正常 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + 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 Integer getChannelId() { + return channelId; + } + + public void setChannelId(Integer channelId) { + this.channelId = channelId; + } + + public String getChannelName() { + return channelName; + } + + public void setChannelName(String channelName) { + this.channelName = channelName; + } + + public Integer getPayPlatformType() { + return payPlatformType; + } + + public void setPayPlatformType(Integer payPlatformType) { + this.payPlatformType = payPlatformType; + } + + public String getPayPlatformMerName() { + return payPlatformMerName; + } + + public void setPayPlatformMerName(String payPlatformMerName) { + this.payPlatformMerName = payPlatformMerName; + } + + public String getPayPlatformMerNo() { + return payPlatformMerNo; + } + + public void setPayPlatformMerNo(String payPlatformMerNo) { + this.payPlatformMerNo = payPlatformMerNo; + } + + public Boolean getProfitSharingStatus() { + return profitSharingStatus; + } + + public void setProfitSharingStatus(Boolean profitSharingStatus) { + this.profitSharingStatus = profitSharingStatus; + } + + public String getProfitSharingReceiversNo() { + return profitSharingReceiversNo; + } + + public void setProfitSharingReceiversNo(String profitSharingReceiversNo) { + this.profitSharingReceiversNo = profitSharingReceiversNo; + } + + public BigDecimal getProfitSharingRatio() { + return profitSharingRatio; + } + + public void setProfitSharingRatio(BigDecimal profitSharingRatio) { + this.profitSharingRatio = profitSharingRatio; + } + + public String getProfitSharingReceiversName() { + return profitSharingReceiversName; + } + + public void setProfitSharingReceiversName(String profitSharingReceiversName) { + this.profitSharingReceiversName = profitSharingReceiversName; + } + + 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 Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + 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; + } + HighGasChannelConfig other = (HighGasChannelConfig) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getChannelId() == null ? other.getChannelId() == null : this.getChannelId().equals(other.getChannelId())) + && (this.getChannelName() == null ? other.getChannelName() == null : this.getChannelName().equals(other.getChannelName())) + && (this.getPayPlatformType() == null ? other.getPayPlatformType() == null : this.getPayPlatformType().equals(other.getPayPlatformType())) + && (this.getPayPlatformMerName() == null ? other.getPayPlatformMerName() == null : this.getPayPlatformMerName().equals(other.getPayPlatformMerName())) + && (this.getPayPlatformMerNo() == null ? other.getPayPlatformMerNo() == null : this.getPayPlatformMerNo().equals(other.getPayPlatformMerNo())) + && (this.getProfitSharingStatus() == null ? other.getProfitSharingStatus() == null : this.getProfitSharingStatus().equals(other.getProfitSharingStatus())) + && (this.getProfitSharingReceiversNo() == null ? other.getProfitSharingReceiversNo() == null : this.getProfitSharingReceiversNo().equals(other.getProfitSharingReceiversNo())) + && (this.getProfitSharingRatio() == null ? other.getProfitSharingRatio() == null : this.getProfitSharingRatio().equals(other.getProfitSharingRatio())) + && (this.getProfitSharingReceiversName() == null ? other.getProfitSharingReceiversName() == null : this.getProfitSharingReceiversName().equals(other.getProfitSharingReceiversName())) + && (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())) + && (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 + ((getChannelId() == null) ? 0 : getChannelId().hashCode()); + result = prime * result + ((getChannelName() == null) ? 0 : getChannelName().hashCode()); + result = prime * result + ((getPayPlatformType() == null) ? 0 : getPayPlatformType().hashCode()); + result = prime * result + ((getPayPlatformMerName() == null) ? 0 : getPayPlatformMerName().hashCode()); + result = prime * result + ((getPayPlatformMerNo() == null) ? 0 : getPayPlatformMerNo().hashCode()); + result = prime * result + ((getProfitSharingStatus() == null) ? 0 : getProfitSharingStatus().hashCode()); + result = prime * result + ((getProfitSharingReceiversNo() == null) ? 0 : getProfitSharingReceiversNo().hashCode()); + result = prime * result + ((getProfitSharingRatio() == null) ? 0 : getProfitSharingRatio().hashCode()); + result = prime * result + ((getProfitSharingReceiversName() == null) ? 0 : getProfitSharingReceiversName().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()); + 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(", channelId=").append(channelId); + sb.append(", channelName=").append(channelName); + sb.append(", payPlatformType=").append(payPlatformType); + sb.append(", payPlatformMerName=").append(payPlatformMerName); + sb.append(", payPlatformMerNo=").append(payPlatformMerNo); + sb.append(", profitSharingStatus=").append(profitSharingStatus); + sb.append(", profitSharingReceiversNo=").append(profitSharingReceiversNo); + sb.append(", profitSharingRatio=").append(profitSharingRatio); + sb.append(", profitSharingReceiversName=").append(profitSharingReceiversName); + sb.append(", status=").append(status); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + 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/hai-service/src/main/java/com/hai/entity/HighGasChannelConfigExample.java b/hai-service/src/main/java/com/hai/entity/HighGasChannelConfigExample.java new file mode 100644 index 00000000..49af0e58 --- /dev/null +++ b/hai-service/src/main/java/com/hai/entity/HighGasChannelConfigExample.java @@ -0,0 +1,1264 @@ +package com.hai.entity; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class HighGasChannelConfigExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public HighGasChannelConfigExample() { + 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 andChannelIdIsNull() { + addCriterion("channel_id is null"); + return (Criteria) this; + } + + public Criteria andChannelIdIsNotNull() { + addCriterion("channel_id is not null"); + return (Criteria) this; + } + + public Criteria andChannelIdEqualTo(Integer value) { + addCriterion("channel_id =", value, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdNotEqualTo(Integer value) { + addCriterion("channel_id <>", value, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdGreaterThan(Integer value) { + addCriterion("channel_id >", value, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdGreaterThanOrEqualTo(Integer value) { + addCriterion("channel_id >=", value, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdLessThan(Integer value) { + addCriterion("channel_id <", value, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdLessThanOrEqualTo(Integer value) { + addCriterion("channel_id <=", value, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdIn(List values) { + addCriterion("channel_id in", values, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdNotIn(List values) { + addCriterion("channel_id not in", values, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdBetween(Integer value1, Integer value2) { + addCriterion("channel_id between", value1, value2, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelIdNotBetween(Integer value1, Integer value2) { + addCriterion("channel_id not between", value1, value2, "channelId"); + return (Criteria) this; + } + + public Criteria andChannelNameIsNull() { + addCriterion("channel_name is null"); + return (Criteria) this; + } + + public Criteria andChannelNameIsNotNull() { + addCriterion("channel_name is not null"); + return (Criteria) this; + } + + public Criteria andChannelNameEqualTo(String value) { + addCriterion("channel_name =", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameNotEqualTo(String value) { + addCriterion("channel_name <>", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameGreaterThan(String value) { + addCriterion("channel_name >", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameGreaterThanOrEqualTo(String value) { + addCriterion("channel_name >=", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameLessThan(String value) { + addCriterion("channel_name <", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameLessThanOrEqualTo(String value) { + addCriterion("channel_name <=", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameLike(String value) { + addCriterion("channel_name like", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameNotLike(String value) { + addCriterion("channel_name not like", value, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameIn(List values) { + addCriterion("channel_name in", values, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameNotIn(List values) { + addCriterion("channel_name not in", values, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameBetween(String value1, String value2) { + addCriterion("channel_name between", value1, value2, "channelName"); + return (Criteria) this; + } + + public Criteria andChannelNameNotBetween(String value1, String value2) { + addCriterion("channel_name not between", value1, value2, "channelName"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeIsNull() { + addCriterion("pay_platform_type is null"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeIsNotNull() { + addCriterion("pay_platform_type is not null"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeEqualTo(Integer value) { + addCriterion("pay_platform_type =", value, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeNotEqualTo(Integer value) { + addCriterion("pay_platform_type <>", value, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeGreaterThan(Integer value) { + addCriterion("pay_platform_type >", value, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("pay_platform_type >=", value, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeLessThan(Integer value) { + addCriterion("pay_platform_type <", value, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeLessThanOrEqualTo(Integer value) { + addCriterion("pay_platform_type <=", value, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeIn(List values) { + addCriterion("pay_platform_type in", values, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeNotIn(List values) { + addCriterion("pay_platform_type not in", values, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeBetween(Integer value1, Integer value2) { + addCriterion("pay_platform_type between", value1, value2, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformTypeNotBetween(Integer value1, Integer value2) { + addCriterion("pay_platform_type not between", value1, value2, "payPlatformType"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameIsNull() { + addCriterion("pay_platform_mer_name is null"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameIsNotNull() { + addCriterion("pay_platform_mer_name is not null"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameEqualTo(String value) { + addCriterion("pay_platform_mer_name =", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameNotEqualTo(String value) { + addCriterion("pay_platform_mer_name <>", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameGreaterThan(String value) { + addCriterion("pay_platform_mer_name >", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameGreaterThanOrEqualTo(String value) { + addCriterion("pay_platform_mer_name >=", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameLessThan(String value) { + addCriterion("pay_platform_mer_name <", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameLessThanOrEqualTo(String value) { + addCriterion("pay_platform_mer_name <=", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameLike(String value) { + addCriterion("pay_platform_mer_name like", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameNotLike(String value) { + addCriterion("pay_platform_mer_name not like", value, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameIn(List values) { + addCriterion("pay_platform_mer_name in", values, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameNotIn(List values) { + addCriterion("pay_platform_mer_name not in", values, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameBetween(String value1, String value2) { + addCriterion("pay_platform_mer_name between", value1, value2, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNameNotBetween(String value1, String value2) { + addCriterion("pay_platform_mer_name not between", value1, value2, "payPlatformMerName"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoIsNull() { + addCriterion("pay_platform_mer_no is null"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoIsNotNull() { + addCriterion("pay_platform_mer_no is not null"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoEqualTo(String value) { + addCriterion("pay_platform_mer_no =", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoNotEqualTo(String value) { + addCriterion("pay_platform_mer_no <>", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoGreaterThan(String value) { + addCriterion("pay_platform_mer_no >", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoGreaterThanOrEqualTo(String value) { + addCriterion("pay_platform_mer_no >=", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoLessThan(String value) { + addCriterion("pay_platform_mer_no <", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoLessThanOrEqualTo(String value) { + addCriterion("pay_platform_mer_no <=", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoLike(String value) { + addCriterion("pay_platform_mer_no like", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoNotLike(String value) { + addCriterion("pay_platform_mer_no not like", value, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoIn(List values) { + addCriterion("pay_platform_mer_no in", values, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoNotIn(List values) { + addCriterion("pay_platform_mer_no not in", values, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoBetween(String value1, String value2) { + addCriterion("pay_platform_mer_no between", value1, value2, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andPayPlatformMerNoNotBetween(String value1, String value2) { + addCriterion("pay_platform_mer_no not between", value1, value2, "payPlatformMerNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusIsNull() { + addCriterion("profit_sharing_status is null"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusIsNotNull() { + addCriterion("profit_sharing_status is not null"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusEqualTo(Boolean value) { + addCriterion("profit_sharing_status =", value, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusNotEqualTo(Boolean value) { + addCriterion("profit_sharing_status <>", value, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusGreaterThan(Boolean value) { + addCriterion("profit_sharing_status >", value, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusGreaterThanOrEqualTo(Boolean value) { + addCriterion("profit_sharing_status >=", value, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusLessThan(Boolean value) { + addCriterion("profit_sharing_status <", value, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusLessThanOrEqualTo(Boolean value) { + addCriterion("profit_sharing_status <=", value, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusIn(List values) { + addCriterion("profit_sharing_status in", values, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusNotIn(List values) { + addCriterion("profit_sharing_status not in", values, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusBetween(Boolean value1, Boolean value2) { + addCriterion("profit_sharing_status between", value1, value2, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingStatusNotBetween(Boolean value1, Boolean value2) { + addCriterion("profit_sharing_status not between", value1, value2, "profitSharingStatus"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoIsNull() { + addCriterion("profit_sharing_receivers_no is null"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoIsNotNull() { + addCriterion("profit_sharing_receivers_no is not null"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoEqualTo(String value) { + addCriterion("profit_sharing_receivers_no =", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoNotEqualTo(String value) { + addCriterion("profit_sharing_receivers_no <>", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoGreaterThan(String value) { + addCriterion("profit_sharing_receivers_no >", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoGreaterThanOrEqualTo(String value) { + addCriterion("profit_sharing_receivers_no >=", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoLessThan(String value) { + addCriterion("profit_sharing_receivers_no <", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoLessThanOrEqualTo(String value) { + addCriterion("profit_sharing_receivers_no <=", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoLike(String value) { + addCriterion("profit_sharing_receivers_no like", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoNotLike(String value) { + addCriterion("profit_sharing_receivers_no not like", value, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoIn(List values) { + addCriterion("profit_sharing_receivers_no in", values, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoNotIn(List values) { + addCriterion("profit_sharing_receivers_no not in", values, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoBetween(String value1, String value2) { + addCriterion("profit_sharing_receivers_no between", value1, value2, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNoNotBetween(String value1, String value2) { + addCriterion("profit_sharing_receivers_no not between", value1, value2, "profitSharingReceiversNo"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioIsNull() { + addCriterion("profit_sharing_ratio is null"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioIsNotNull() { + addCriterion("profit_sharing_ratio is not null"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio =", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioNotEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio <>", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioGreaterThan(BigDecimal value) { + addCriterion("profit_sharing_ratio >", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio >=", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioLessThan(BigDecimal value) { + addCriterion("profit_sharing_ratio <", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioLessThanOrEqualTo(BigDecimal value) { + addCriterion("profit_sharing_ratio <=", value, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioIn(List values) { + addCriterion("profit_sharing_ratio in", values, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioNotIn(List values) { + addCriterion("profit_sharing_ratio not in", values, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("profit_sharing_ratio between", value1, value2, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingRatioNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("profit_sharing_ratio not between", value1, value2, "profitSharingRatio"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameIsNull() { + addCriterion("profit_sharing_receivers_name is null"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameIsNotNull() { + addCriterion("profit_sharing_receivers_name is not null"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameEqualTo(String value) { + addCriterion("profit_sharing_receivers_name =", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameNotEqualTo(String value) { + addCriterion("profit_sharing_receivers_name <>", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameGreaterThan(String value) { + addCriterion("profit_sharing_receivers_name >", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameGreaterThanOrEqualTo(String value) { + addCriterion("profit_sharing_receivers_name >=", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameLessThan(String value) { + addCriterion("profit_sharing_receivers_name <", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameLessThanOrEqualTo(String value) { + addCriterion("profit_sharing_receivers_name <=", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameLike(String value) { + addCriterion("profit_sharing_receivers_name like", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameNotLike(String value) { + addCriterion("profit_sharing_receivers_name not like", value, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameIn(List values) { + addCriterion("profit_sharing_receivers_name in", values, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameNotIn(List values) { + addCriterion("profit_sharing_receivers_name not in", values, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameBetween(String value1, String value2) { + addCriterion("profit_sharing_receivers_name between", value1, value2, "profitSharingReceiversName"); + return (Criteria) this; + } + + public Criteria andProfitSharingReceiversNameNotBetween(String value1, String value2) { + addCriterion("profit_sharing_receivers_name not between", value1, value2, "profitSharingReceiversName"); + 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 andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + 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/hai-service/src/main/java/com/hai/enum_type/GasChannel.java b/hai-service/src/main/java/com/hai/enum_type/GasChannel.java new file mode 100644 index 00000000..19f5ca7c --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/GasChannel.java @@ -0,0 +1,46 @@ +package com.hai.enum_type; + +import java.util.Objects; + +/** + * 加油站渠道商 + */ +public enum GasChannel { + type1(1 , "自建站"), + type2(2 , "团油"), + type3(3 , "加好油"), + type4(4 , "金猪加油"), + ; + + private Integer type; + private String name; + + GasChannel(int type , String name) { + this.type = type; + this.name = name; + } + + public static GasChannel getChannelByType(Integer type) { + for (GasChannel ele : values()) { + if(Objects.equals(type,ele.getType())) return ele; + } + return null; + } + + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/enum_type/GasChannelPayPlatformType.java b/hai-service/src/main/java/com/hai/enum_type/GasChannelPayPlatformType.java new file mode 100644 index 00000000..df3653a7 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/GasChannelPayPlatformType.java @@ -0,0 +1,42 @@ +package com.hai.enum_type; + +import java.util.Objects; + +/** + * 渠道商支付平台类型 + */ +public enum GasChannelPayPlatformType { + type1(1 , "微信"), + ; + + private Integer type; + private String name; + + GasChannelPayPlatformType(int type , String name) { + this.type = type; + this.name = name; + } + + public static GasChannelPayPlatformType getPlatformByType(Integer type) { + for (GasChannelPayPlatformType ele : values()) { + if(Objects.equals(type,ele.getType())) return ele; + } + return null; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/enum_type/MerchantStoreSourceType.java b/hai-service/src/main/java/com/hai/enum_type/MerchantStoreSourceType.java index 0089476b..a4aa0f53 100644 --- a/hai-service/src/main/java/com/hai/enum_type/MerchantStoreSourceType.java +++ b/hai-service/src/main/java/com/hai/enum_type/MerchantStoreSourceType.java @@ -7,6 +7,8 @@ package com.hai.enum_type; public enum MerchantStoreSourceType { type1(1, "平台自建"), type2(2, "团油门店"), + type3(3, "加好油"), + type4(4, "金猪加油"), ; private Integer number; diff --git a/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogReqType.java b/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogReqType.java new file mode 100644 index 00000000..b406acd5 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogReqType.java @@ -0,0 +1,36 @@ +package com.hai.enum_type; + +/** + * 三方日志 - 请求类型 + */ +public enum TripartiteReqLogReqType { + type1(1, "请求"), + type2(2, "响应"), + ; + + private Integer type; + + private String name; + + TripartiteReqLogReqType(Integer type, String name) { + this.type = type; + this.name = name; + } + + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java b/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java new file mode 100644 index 00000000..89e03579 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java @@ -0,0 +1,41 @@ +package com.hai.enum_type; + +/** + * 三方日志 - 日志类型 + */ +public enum TripartiteReqLogType { + type1(1, "团油"), + type2(2, "壳牌"), + type3(3, "汇联通工会卡"), + type4(4, "贵州中石化"), + type5(5, "千猪肯德基"), + type6(6, "千猪星巴克"), + type7(7, "千猪话费"), + ; + + private Integer type; + + private String name; + + TripartiteReqLogType(Integer type,String name) { + this.type = type; + this.name = name; + } + + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/service/BsTripartiteReqLogService.java b/hai-service/src/main/java/com/hai/service/BsTripartiteReqLogService.java new file mode 100644 index 00000000..930e0584 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/BsTripartiteReqLogService.java @@ -0,0 +1,22 @@ +package com.hai.service; + +import com.hai.enum_type.TripartiteReqLogReqType; +import com.hai.enum_type.TripartiteReqLogType; + +/** + * 三方请求日志 + */ +public interface BsTripartiteReqLogService { + + /** + * 插入日志 + * @param logType 日志类型 + * @param logSerialNo 日志编号 + * @param reqType 请求类型 + * @param reqUrl 请求url + * @param reqContent 请求内容 + * @param respContent 响应内容 + */ + void insert(TripartiteReqLogType logType, String logSerialNo, TripartiteReqLogReqType reqType, String reqUrl, String reqContent, String respContent); + +} diff --git a/hai-service/src/main/java/com/hai/service/HighGasChannelConfigService.java b/hai-service/src/main/java/com/hai/service/HighGasChannelConfigService.java new file mode 100644 index 00000000..f44adbc3 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/HighGasChannelConfigService.java @@ -0,0 +1,26 @@ +package com.hai.service; + +import com.hai.entity.HighGasChannelConfig; +import com.hai.enum_type.GasChannel; +import com.hai.enum_type.GasChannelPayPlatformType; + +/** + * 加油站 渠道商配置 + */ +public interface HighGasChannelConfigService { + + /** + * 编辑配置 + * @param gasChannelConfig + */ + void editConfig(HighGasChannelConfig gasChannelConfig); + + /** + * 查询配置 + * @param channelId 渠道id + * @param payPlatformType 支付平台类型 + * @return + */ + HighGasChannelConfig getConfig(GasChannel channelId, GasChannelPayPlatformType payPlatformType); + +} diff --git a/hai-service/src/main/java/com/hai/service/HighGasOilGunNoService.java b/hai-service/src/main/java/com/hai/service/HighGasOilGunNoService.java index 8a7c6ff5..9fd85c5b 100644 --- a/hai-service/src/main/java/com/hai/service/HighGasOilGunNoService.java +++ b/hai-service/src/main/java/com/hai/service/HighGasOilGunNoService.java @@ -22,6 +22,14 @@ public interface HighGasOilGunNoService { */ HighGasOilGunNo getGunNoById(Long id); + /** + * 根据门店和抢号查询 + * @param storeId + * @param gunNo + * @return + */ + HighGasOilGunNo getDetailByStoreAndGunNo(Long storeId, Integer gunNo); + /** * 查询抢号列表 * @param oilPriceId diff --git a/hai-service/src/main/java/com/hai/service/HighGasService.java b/hai-service/src/main/java/com/hai/service/HighGasService.java new file mode 100644 index 00000000..4f473fa3 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/HighGasService.java @@ -0,0 +1,13 @@ +package com.hai.service; + +/** + * 加油站服务 + */ +public interface HighGasService { + + /** + * 获取渠道商【加好油】全量加油站 + */ + void getJiaHaoYouAllStation() throws Exception; + +} diff --git a/hai-service/src/main/java/com/hai/service/HighMerchantService.java b/hai-service/src/main/java/com/hai/service/HighMerchantService.java index eba34e5d..135f87b7 100644 --- a/hai-service/src/main/java/com/hai/service/HighMerchantService.java +++ b/hai-service/src/main/java/com/hai/service/HighMerchantService.java @@ -46,6 +46,13 @@ public interface HighMerchantService { */ HighMerchant getDetailById(Long id); + /** + * 根据key 查询 + * @param key + * @return + */ + HighMerchantModel getDetailByKey(String key); + /** * 查询列表 * @param map diff --git a/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java b/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java index 4f1b781f..58f3fcf3 100644 --- a/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java +++ b/hai-service/src/main/java/com/hai/service/HighMerchantStoreService.java @@ -63,6 +63,13 @@ public interface HighMerchantStoreService { */ HighMerchantStoreModel getMerchantStoreByKey(String storeKey); + /** + * + * @param storeKey + * @return + */ + HighMerchantStore getMerStoreDetailByKey(String storeKey); + /** * 根据查询 * @param id diff --git a/hai-service/src/main/java/com/hai/service/impl/BsTripartiteReqLogServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsTripartiteReqLogServiceImpl.java new file mode 100644 index 00000000..0f112c70 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/BsTripartiteReqLogServiceImpl.java @@ -0,0 +1,36 @@ +package com.hai.service.impl; + +import com.hai.dao.BsTripartiteReqLogMapper; +import com.hai.entity.BsTripartiteReqLog; +import com.hai.enum_type.TripartiteReqLogReqType; +import com.hai.enum_type.TripartiteReqLogType; +import com.hai.service.BsTripartiteReqLogService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; + +@Service("tripartiteReqLogService") +public class BsTripartiteReqLogServiceImpl implements BsTripartiteReqLogService { + + @Resource + private BsTripartiteReqLogMapper tripartiteReqLogMapper; + + @Override + @Transactional(propagation = Propagation.NOT_SUPPORTED, isolation = Isolation.READ_UNCOMMITTED) + public void insert(TripartiteReqLogType logType, String logSerialNo, TripartiteReqLogReqType reqType, String reqUrl, String reqContent, String respContent) { + BsTripartiteReqLog log = new BsTripartiteReqLog(); + log.setLogType(logType.getType()); + log.setLogTypeName(logType.getName()); + log.setLogSerialNo(logSerialNo); + log.setRequestType(reqType.getType()); + log.setRequestUrl(reqUrl); + log.setRequestContent(reqContent); + log.setResponseContent(respContent); + log.setCreateTime(new Date()); + tripartiteReqLogMapper.insert(log); + } +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasChannelConfigServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasChannelConfigServiceImpl.java new file mode 100644 index 00000000..873819da --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasChannelConfigServiceImpl.java @@ -0,0 +1,48 @@ +package com.hai.service.impl; + +import com.hai.dao.HighGasChannelConfigMapper; +import com.hai.entity.HighGasChannelConfig; +import com.hai.entity.HighGasChannelConfigExample; +import com.hai.enum_type.GasChannel; +import com.hai.enum_type.GasChannelPayPlatformType; +import com.hai.service.HighGasChannelConfigService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@Service("gasChannelConfigService") +public class HighGasChannelConfigServiceImpl implements HighGasChannelConfigService { + + @Resource + private HighGasChannelConfigMapper gasChannelConfigMapper; + + + @Override + public void editConfig(HighGasChannelConfig gasChannelConfig) { + if (gasChannelConfig.getId() == null) { + gasChannelConfig.setStatus(1); + gasChannelConfig.setCreateTime(new Date()); + gasChannelConfig.setUpdateTime(new Date()); + gasChannelConfigMapper.insert(gasChannelConfig); + } else { + gasChannelConfig.setUpdateTime(new Date()); + gasChannelConfigMapper.updateByPrimaryKey(gasChannelConfig); + } + } + + @Override + public HighGasChannelConfig getConfig(GasChannel channelId, GasChannelPayPlatformType payPlatformType) { + HighGasChannelConfigExample example = new HighGasChannelConfigExample(); + example.createCriteria() + .andChannelIdEqualTo(channelId.getType()) + .andPayPlatformTypeEqualTo(payPlatformType.getType()) + .andStatusEqualTo(1); + List list = gasChannelConfigMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java index f511f5ae..55910e14 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java @@ -11,6 +11,7 @@ import com.hai.entity.HighGasDiscountOilPrice; import com.hai.entity.HighGasDiscountOilPriceExample; import com.hai.entity.HighGasOilPrice; import com.hai.entity.HighTyAgentPrice; +import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.GasPayPriceModel; import com.hai.model.HighMerchantStoreModel; import com.hai.service.*; @@ -154,7 +155,8 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri GasPayPriceModel payPriceModel = new GasPayPriceModel(); // 1:平台自建 2:团油 3: 壳牌 - if (store.getSourceType().equals(1)) { + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber()) + || store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { // 嗨森逛平台价 国标价 * 折扣 BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); @@ -207,7 +209,7 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri // 支付价格 加油金额 - 本次优惠 payPriceModel.setPayPrice(oilingPrice.subtract(payPriceModel.getTotalPreferences())); - } else if (store.getSourceType().equals(2)) { + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { // 查询油站油品价格 JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo); if (oilPriceObject == null) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasOilGunNoServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasOilGunNoServiceImpl.java index 1c40ee12..cfd2c2e0 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasOilGunNoServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasOilGunNoServiceImpl.java @@ -32,6 +32,17 @@ public class HighGasOilGunNoServiceImpl implements HighGasOilGunNoService { return gasOilGunNoMapper.selectByPrimaryKey(id); } + @Override + public HighGasOilGunNo getDetailByStoreAndGunNo(Long storeId, Integer gunNo) { + HighGasOilGunNoExample example = new HighGasOilGunNoExample(); + example.createCriteria().andStoreIdEqualTo(storeId).andGunNoEqualTo(gunNo).andStatusEqualTo(1); + List list = gasOilGunNoMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public List getGunNoListByOilPrice(Long oilPriceId) { HighGasOilGunNoExample example = new HighGasOilGunNoExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java new file mode 100644 index 00000000..7b00f701 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java @@ -0,0 +1,232 @@ +package com.hai.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hai.config.CommonSysConst; +import com.hai.config.ShellGroupService; +import com.hai.entity.HighGasOilGunNo; +import com.hai.entity.HighGasOilPrice; +import com.hai.entity.HighMerchantStore; +import com.hai.enum_type.MerchantStoreSourceType; +import com.hai.model.HighMerchantModel; +import com.hai.model.HighMerchantStoreModel; +import com.hai.service.*; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; + +@Service("gasService") +public class HighGasServiceImpl implements HighGasService { + + @Resource + private ShellGroupService shellGroupService; + + @Resource + private HighMerchantService highMerchantService; + + @Resource + private HighMerchantStoreService highMerchantStoreService; + + @Resource + private HighGasOilPriceService highGasOilPriceService; + + @Resource + private HighGasOilGunNoService gasOilGunNoService; + + @Override + public void getJiaHaoYouAllStation() throws Exception { + HighMerchantModel merchant = highMerchantService.getDetailByKey("HF0801103821"); + + JSONObject pObject = shellGroupService.gasPageQueryAllStation(1, 50); + JSONObject pageInfo = JSON.parseObject(pObject.getString("pageInfo"), JSONObject.class); + + // 总页数 + Integer totalPageNo = pageInfo.getBigDecimal("totalCount").divide(pageInfo.getBigDecimal("pageSize"),0, BigDecimal.ROUND_CEILING).intValue(); + for (int pageNum = 1; pageNum <= totalPageNo; pageNum++) { + + // 查询加油站列表 + JSONObject respObject = shellGroupService.gasPageQueryAllStation(pageNum, 50); + JSONArray stationArray = JSONObject.parseObject(respObject.getString("infoList"), JSONArray.class); + for (Object stationObject : stationArray) { + JSONObject station = (JSONObject) stationObject; + + // 查询油站 + HighMerchantStore store = highMerchantStoreService.getMerStoreDetailByKey(station.getString("stationCode")); + + if (store != null) { + store.setPrestoreType(0); + store.setMerchantId(merchant.getId()); + store.setCompanyId(merchant.getCompanyId()); + store.setStoreKey(station.getString("stationCode")); + store.setStoreName(station.getString("stationName")); + store.setStoreLogo(CommonSysConst.getSysConfig().getGasDefaultOilStationImg()); + store.setRegionId(station.getLong("provinceId")); + store.setRegionName(station.getString("provinceName")); + store.setAddress(station.getString("stationAddress")); + store.setLongitude(station.getString("longitude")); + store.setLatitude(station.getString("latitude")); + store.setStatus(station.getString("status").equals("ABLE")?1:2); + store.setOperatorId(0L); + store.setOperatorName("系统创建"); + store.setUpdateTime(new Date()); + highMerchantStoreService.updateMerchantStoreDetail(store); + + JSONArray oilPriceList = station.getJSONArray("oilPriceList"); + for (Object oilPrice : oilPriceList) { + JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); + // 查询门店油号 + HighGasOilPrice highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("goodsCode")); + if (highGasOilPrice == null) { + highGasOilPrice = new HighGasOilPrice(); + highGasOilPrice.setMerchantStoreId(store.getId()); + highGasOilPrice.setOilNo(oilPriceObject.getInteger("goodsCode")); + highGasOilPrice.setOilNoName(oilPriceObject.getString("goodsCode") + "#"); + highGasOilPrice.setGasStationDrop(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount").subtract(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount"))); + highGasOilPrice.setPriceVip(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount")); + highGasOilPrice.setPriceGun(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount")); + highGasOilPrice.setPriceOfficial(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount")); + + // 油品类型 1:汽油:2:柴油;3:天然气 + if (oilPriceObject.getString("goodsGroupType").equals("GASOLINE")) { + highGasOilPrice.setOilType(1); + highGasOilPrice.setOilTypeName("汽油"); + } else if (oilPriceObject.getString("goodsGroupType").equals("DIESEL_OIL")) { + highGasOilPrice.setOilType(2); + highGasOilPrice.setOilTypeName("柴油"); + } else if (oilPriceObject.getString("goodsGroupType").equals("NATURAL_GAS")) { + highGasOilPrice.setOilType(3); + highGasOilPrice.setOilTypeName("天然气"); + } + highGasOilPriceService.editGasOilPrice(highGasOilPrice); + + JSONArray oilGunNoList = oilPriceObject.getJSONArray("oilGunNoList"); + for (Object o : oilGunNoList) { + HighGasOilGunNo gasOilGunNo = gasOilGunNoService.getDetailByStoreAndGunNo(highGasOilPrice.getMerchantStoreId(), Integer.parseInt(o.toString())); + if (gasOilGunNo == null) { + gasOilGunNo = new HighGasOilGunNo(); + gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); + gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); + gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); + gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); + gasOilGunNo.setOilType(highGasOilPrice.getOilType()); + gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); + gasOilGunNo.setGunNo(Integer.parseInt(o.toString())); + gasOilGunNo.setStatus(1); + gasOilGunNoService.editGunNo(gasOilGunNo); + } + } + + } else { + highGasOilPrice.setMerchantStoreId(store.getId()); + highGasOilPrice.setOilNo(oilPriceObject.getInteger("goodsCode")); + highGasOilPrice.setOilNoName(oilPriceObject.getString("goodsCode") + "#"); + highGasOilPrice.setGasStationDrop(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount").subtract(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount"))); + highGasOilPrice.setPriceVip(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount")); + highGasOilPrice.setPriceGun(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount")); + highGasOilPrice.setPriceOfficial(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount")); + + // 油品类型 1:汽油:2:柴油;3:天然气 + if (oilPriceObject.getString("goodsGroupType").equals("GASOLINE")) { + highGasOilPrice.setOilType(1); + highGasOilPrice.setOilTypeName("汽油"); + } else if (oilPriceObject.getString("goodsGroupType").equals("DIESEL_OIL")) { + highGasOilPrice.setOilType(2); + highGasOilPrice.setOilTypeName("柴油"); + } else if (oilPriceObject.getString("goodsGroupType").equals("NATURAL_GAS")) { + highGasOilPrice.setOilType(3); + highGasOilPrice.setOilTypeName("天然气"); + } + highGasOilPriceService.editGasOilPrice(highGasOilPrice); + + JSONArray oilGunNoList = oilPriceObject.getJSONArray("oilGunNoList"); + for (Object o : oilGunNoList) { + HighGasOilGunNo gasOilGunNo = gasOilGunNoService.getDetailByStoreAndGunNo(highGasOilPrice.getMerchantStoreId(), Integer.parseInt(o.toString())); + if (gasOilGunNo == null) { + gasOilGunNo = new HighGasOilGunNo(); + gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); + gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); + gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); + gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); + gasOilGunNo.setOilType(highGasOilPrice.getOilType()); + gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); + gasOilGunNo.setGunNo(Integer.parseInt(o.toString())); + gasOilGunNo.setStatus(1); + gasOilGunNoService.editGunNo(gasOilGunNo); + } + } + } + } + } else { + store = new HighMerchantStore(); + store.setPrestoreType(0); + store.setType(1); + store.setSourceType(MerchantStoreSourceType.type3.getNumber()); + store.setMerchantId(merchant.getId()); + store.setCompanyId(merchant.getCompanyId()); + store.setStoreKey(station.getString("stationCode")); + store.setStoreName(station.getString("stationName")); + store.setStoreLogo(CommonSysConst.getSysConfig().getGasDefaultOilStationImg()); + store.setRegionId(station.getLong("provinceId")); + store.setRegionName(station.getString("provinceName")); + store.setAddress(station.getString("stationAddress")); + store.setLongitude(station.getString("longitude")); + store.setLatitude(station.getString("latitude")); + store.setStatus(station.getString("status").equals("ABLE")?1:2); + store.setOperatorId(0L); + store.setOperatorName("系统创建"); + store.setCreateTime(new Date()); + store.setUpdateTime(new Date()); + + HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); + BeanUtils.copyProperties(store, merchantStoreModel); + highMerchantStoreService.insertMerchantStore(merchantStoreModel); + + JSONArray oilPriceList = station.getJSONArray("oilPriceList"); + for (Object oilPrice : oilPriceList) { + JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); + HighGasOilPrice highGasOilPrice = new HighGasOilPrice(); + highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); + highGasOilPrice.setOilNo(oilPriceObject.getInteger("goodsCode")); + highGasOilPrice.setOilNoName(oilPriceObject.getString("goodsCode") + "#"); + highGasOilPrice.setPreferentialMargin(new BigDecimal("0")); + highGasOilPrice.setGasStationDrop(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount").subtract(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount"))); + highGasOilPrice.setPriceVip(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount")); + highGasOilPrice.setPriceGun(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount")); + highGasOilPrice.setPriceOfficial(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount")); + + // 油品类型 1:汽油:2:柴油;3:天然气 + if (oilPriceObject.getString("goodsGroupType").equals("GASOLINE")) { + highGasOilPrice.setOilType(1); + highGasOilPrice.setOilTypeName("汽油"); + } else if (oilPriceObject.getString("goodsGroupType").equals("DIESEL_OIL")) { + highGasOilPrice.setOilType(2); + highGasOilPrice.setOilTypeName("柴油"); + } else if (oilPriceObject.getString("goodsGroupType").equals("NATURAL_GAS")) { + highGasOilPrice.setOilType(3); + highGasOilPrice.setOilTypeName("天然气"); + } + highGasOilPriceService.editGasOilPrice(highGasOilPrice); + + JSONArray oilGunNoList = oilPriceObject.getJSONArray("oilGunNoList"); + for (Object o : oilGunNoList) { + HighGasOilGunNo gasOilGunNo = new HighGasOilGunNo(); + gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); + gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); + gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); + gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); + gasOilGunNo.setOilType(highGasOilPrice.getOilType()); + gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); + gasOilGunNo.setGunNo(Integer.parseInt(o.toString())); + gasOilGunNo.setStatus(1); + gasOilGunNoService.editGunNo(gasOilGunNo); + } + } + } + } + } + } +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java index 008c1732..6bec4c0c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java @@ -99,6 +99,17 @@ public class HighMerchantServiceImpl implements HighMerchantService { return highMerchantMapper.selectByPrimaryKey(id); } + @Override + public HighMerchantModel getDetailByKey(String key) { + HighMerchantExample example = new HighMerchantExample(); + example.createCriteria().andMerchantKeyEqualTo(key).andStatusEqualTo(1); + List list = highMerchantMapper.selectByExample(example); + if (list.size() > 0) { + return getMerchantById(list.get(0).getId()); + } + return null; + } + @Override public List getMerchantList(Map map) { HighMerchantExample example = new HighMerchantExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java index 6f2f9498..d0808b72 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantStoreServiceImpl.java @@ -45,10 +45,11 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertMerchantStore(HighMerchantStoreModel highMerchantStore) throws Exception { highMerchantStoreMapper.insert(highMerchantStore); - Long storeKey = 11000000 + highMerchantStore.getId(); - highMerchantStore.setStoreKey(storeKey.toString()); - highMerchantStoreMapper.updateByPrimaryKey(highMerchantStore); - + if (StringUtils.isBlank(highMerchantStore.getStoreKey())) { + Long storeKey = 11000000 + highMerchantStore.getId(); + highMerchantStore.setStoreKey(storeKey.toString()); + highMerchantStoreMapper.updateByPrimaryKey(highMerchantStore); + } highMerchantStore.setSecUser(new SecUser()); highMerchantStore.getSecUser().setUserName(highMerchantStore.getStoreName()); highMerchantStore.getSecUser().setLoginName(highMerchantStore.getStoreKey()); @@ -165,6 +166,17 @@ public class HighMerchantStoreServiceImpl implements HighMerchantStoreService { return null; } + @Override + public HighMerchantStore getMerStoreDetailByKey(String storeKey) { + HighMerchantStoreExample example = new HighMerchantStoreExample(); + example.createCriteria().andStoreKeyEqualTo(storeKey); + List list = highMerchantStoreMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public HighMerchantStore getDetailById(Long id) { return highMerchantStoreMapper.selectByPrimaryKey(id); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 18eb196b..480bd22c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -79,7 +79,6 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private ApiProductService apiProductService; - @Resource private HighCouponService highCouponService; @@ -149,7 +148,6 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private MqttProviderConfig mqttProviderConfig; - @Resource private BaiduVoiceService baiduVoiceService; @@ -162,10 +160,12 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private ApiOrderRecordService apiOrderRecordService; - @Resource private ApiMemberProductService apiMemberProductService; + @Resource + private ShellGroupService shellGroupService; + @Override @Transactional( isolation = Isolation.SERIALIZABLE, @@ -408,7 +408,7 @@ public class HighOrderServiceImpl implements HighOrderService { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 来源类型 1:平台自建 2:团油 - if (store.getSourceType().equals(1)) { + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { // 预存类型 0:非预存 1:预存门店 if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) { @@ -424,7 +424,7 @@ public class HighOrderServiceImpl implements HighOrderService { // 扣预存款 this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam); } - } else if (store.getSourceType().equals(2)) { + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); @@ -458,6 +458,16 @@ public class HighOrderServiceImpl implements HighOrderService { if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } + } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + + // 推送壳牌 + JSONObject syncPayment = shellGroupService.gasSyncPayment(highOrder.getOrderNo(), + store.getStoreKey(), + highOrder.getPayTime(), + highChildOrder.getGasPriceGun(), + highChildOrder.getGasOilNo(), + highChildOrder.getGasGunNo(), + highOrder.getTotalPrice()); } } diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index 3c0e777e..3549beda 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -125,6 +125,9 @@ public class GoodsOrderServiceImpl implements PayService { @Resource private BaiduVoiceService baiduVoiceService; + @Resource + private HighGasChannelConfigService gasChannelConfigService; + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void paySuccess(Map map, String payType) throws Exception { @@ -440,15 +443,37 @@ public class GoodsOrderServiceImpl implements PayService { new Thread(() -> { try { Thread.sleep(120*1000); - BigDecimal rake = order.getProfitSharingRatio().divide(new BigDecimal("100")); - // 计算微信收取的手续费 支付金额 * 0.002 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 - BigDecimal wxHandlingFee = order.getPayRealPrice().multiply(new BigDecimal("0.002")).setScale(2,BigDecimal.ROUND_HALF_DOWN); - BigDecimal price = order.getPayRealPrice().subtract(wxHandlingFee); + HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); + if (store != null) { + HighGasChannelConfig gasChannelConfig; + + if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { + gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1,GasChannelPayPlatformType.type1 ); + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { + gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2,GasChannelPayPlatformType.type1 ); + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { + gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3,GasChannelPayPlatformType.type1 ); + + } else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { + gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4,GasChannelPayPlatformType.type1 ); + + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置分账参数"); + } + + BigDecimal rake = order.getProfitSharingRatio().divide(new BigDecimal("100")); - // 计算分账金额 手续费后的价格 * 0.05 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 - BigDecimal profitSharingAmount = price.multiply(rake).setScale(2,BigDecimal.ROUND_DOWN); - this.wxGasProfitsharing(order.getExt1(), order.getAccountMerchantNum(), order.getPaySerialNo(),order.getOrderNo(),profitSharingAmount); + // 计算微信收取的手续费 支付金额 * 0.002 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 + BigDecimal wxHandlingFee = order.getPayRealPrice().multiply(new BigDecimal("0.002")).setScale(2,BigDecimal.ROUND_HALF_DOWN); + BigDecimal price = order.getPayRealPrice().subtract(wxHandlingFee); + + // 计算分账金额 手续费后的价格 * 0.05 注:如果与两个相邻数字的距离相等,则为上舍入的舍入模式。 + BigDecimal profitSharingAmount = price.multiply(rake).setScale(2,BigDecimal.ROUND_DOWN); + this.wxGasProfitsharing(order.getExt1(), order.getAccountMerchantNum(),gasChannelConfig.getProfitSharingReceiversNo(), gasChannelConfig.getProfitSharingReceiversName(), order.getPaySerialNo(),order.getOrderNo(),profitSharingAmount); + } } catch (InterruptedException e) { e.printStackTrace(); } @@ -476,25 +501,13 @@ public class GoodsOrderServiceImpl implements PayService { } } - public static void main(String[] args) { - BigDecimal totalPrice = new BigDecimal("100"); - - BigDecimal wxHandlingFee = totalPrice.multiply(new BigDecimal("0.002")).setScale(2,BigDecimal.ROUND_HALF_DOWN); - System.out.println("手续费:" + wxHandlingFee); - - BigDecimal price = totalPrice.subtract(wxHandlingFee); - System.out.println("扣除手机费后的价格:" + price); - BigDecimal profitSharingAmount = price.multiply(new BigDecimal("0.05")).setScale(2,BigDecimal.ROUND_DOWN); - System.out.println("实际分账价格:" + profitSharingAmount); - } - - public void wxGasProfitsharing(String appid, String subMchId, String transaction_id,String out_order_no, BigDecimal amount) { + public void wxGasProfitsharing(String appid, String subMchId, String receiversAccount, String receiversAccountName,String transaction_id,String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", appid); param.put("mch_id", "1289663601"); - param.put("sub_mch_id" , subMchId); // 渝北区浩联物资经营部 + param.put("sub_mch_id" , subMchId); param.put("transaction_id" , transaction_id); param.put("out_order_no" , out_order_no); param.put("nonce_str" , WxUtils.makeNonStr()); @@ -505,9 +518,9 @@ public class GoodsOrderServiceImpl implements PayService { List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); - receiversMap.put("account", "1603942866"); + receiversMap.put("account", receiversAccount); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); - receiversMap.put("description", "分给商户【惠昕石化】"); + receiversMap.put("description", "分给商户:" + receiversAccountName); receiversList.add(receiversMap); param.put("receivers" , JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 8971db74..511cd56e 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsgcs.dctpay.com +gasDefaultOilStationImg=https://hsgcs.dctpay.com/filesystem/default/default_oil_station.jpg # TuanYou configuration parameters tuanYouUrl=https://test05-motorcade-hcs.czb365.com tuanYouAppKey=231599775566496 @@ -8,9 +9,9 @@ tuanYouGasolineAccount=c009bic04400 # shellGroupUrl=http://openapi.ngrok.xinyebang.cn/gateway.html -shellGroupPartnerId=123 -shellPlatMerchantId=123 -shellPlatMerchantKey=123 +shellGroupPartnerId=S0302207281600105753 +shellPlatMerchantId=S0302206141000105717 +shellPlatMerchantKey=wqisfmkzea6mwd7ogbyh3488jv0hqhdj # ???? qinzhuUrl=https://live-test.qianzhu8.com diff --git a/hai-service/src/main/resources/pre/commonConfig.properties b/hai-service/src/main/resources/pre/commonConfig.properties index 36c74f1d..fcab49b3 100644 --- a/hai-service/src/main/resources/pre/commonConfig.properties +++ b/hai-service/src/main/resources/pre/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsg.dctpay.com +gasDefaultOilStationImg=https://hsgcs.dctpay.com/filesystem/default/default_oil_station.jpg tuanYouUrl=https://hcs.czb365.com tuanYouAppKey=210091174083104 diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index 66af0b15..2fdcb8fe 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsg.dctpay.com +gasDefaultOilStationImg=https://hsg.dctpay.com/filesystem/default/default_oil_station.jpg tuanYouUrl=https://hcs.czb365.com tuanYouAppKey=210091174083104 diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index 36c74f1d..fcab49b3 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -1,4 +1,5 @@ hsgDomainName=https://hsg.dctpay.com +gasDefaultOilStationImg=https://hsgcs.dctpay.com/filesystem/default/default_oil_station.jpg tuanYouUrl=https://hcs.czb365.com tuanYouAppKey=210091174083104