提交大爱吗

dev
胡锐 4 months ago
parent c82c470088
commit 36f6e25c07
  1. 30
      bweb/src/main/java/com/bweb/controller/BsMerchantController.java
  2. 8
      cweb/src/main/java/com/cweb/controller/BsGasController.java
  3. 5
      cweb/src/main/java/com/cweb/controller/order/OrderPayController.java
  4. 4
      service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java
  5. 282
      service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumGasService.java
  6. 194
      service/src/main/java/com/hfkj/channel/gas/shell/CqShellPetroleumRequestService.java
  7. 19
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  8. 19
      service/src/main/java/com/hfkj/dao/BsMerchantMapper.java
  9. 8
      service/src/main/java/com/hfkj/dao/BsMerchantMapperExt.java
  10. 14
      service/src/main/java/com/hfkj/dao/BsMerchantSqlProvider.java
  11. 16
      service/src/main/java/com/hfkj/entity/BsMerchant.java
  12. 60
      service/src/main/java/com/hfkj/entity/BsMerchantExample.java
  13. 2
      service/src/main/java/com/hfkj/service/gas/BsGasService.java
  14. 4
      service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java
  15. 17
      service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java
  16. 32
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  17. 20
      service/src/main/java/com/hfkj/service/order/OrderRefundBusiness.java
  18. 4
      service/src/main/java/com/hfkj/sysenum/MerchantSourceTypeEnum.java
  19. 5
      service/src/main/resources/dev/commonConfig.properties
  20. 5
      service/src/main/resources/prod/commonConfig.properties

@ -154,6 +154,30 @@ public class BsMerchantController {
} }
} }
@RequestMapping(value = "/listShow", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "列表展示")
public ResponseData listShow(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("merNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询商户
BsMerchant merchant = merchantService.getMerchant(body.getString("merNo"));
if (merchant == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户");
}
merchant.setListShow(!merchant.getListShow());
merchantService.updateMerchant(merchant);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsMerchantController --> listShow() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/disableMer", method = RequestMethod.POST) @RequestMapping(value = "/disableMer", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "禁用商户") @ApiOperation(value = "禁用商户")
@ -234,6 +258,9 @@ public class BsMerchantController {
public ResponseData queryMerList(@RequestParam(value = "sourceType", required = false) Integer sourceType, public ResponseData queryMerList(@RequestParam(value = "sourceType", required = false) Integer sourceType,
@RequestParam(value = "merNo", required = false) String merNo, @RequestParam(value = "merNo", required = false) String merNo,
@RequestParam(value = "merName", required = false) String merName, @RequestParam(value = "merName", required = false) String merName,
@RequestParam(value = "provinceCode", required = false) String provinceCode,
@RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam(value = "areaCode", required = false) String areaCode,
@RequestParam(value = "pageNum", required = true) Integer pageNum, @RequestParam(value = "pageNum", required = true) Integer pageNum,
@RequestParam(value = "pageSize", required = true) Integer pageSize) { @RequestParam(value = "pageSize", required = true) Integer pageSize) {
try { try {
@ -241,6 +268,9 @@ public class BsMerchantController {
map.put("sourceType", sourceType); map.put("sourceType", sourceType);
map.put("merNo", merNo); map.put("merNo", merNo);
map.put("merName", merName); map.put("merName", merName);
map.put("provinceCode", provinceCode);
map.put("cityCode", cityCode);
map.put("areaCode", areaCode);
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(merchantService.getMerchantList(map))); return ResponseMsgUtil.success(new PageInfo<>(merchantService.getMerchantList(map)));

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hfkj.channel.gas.newlink.NewLinkGasService; import com.hfkj.channel.gas.newlink.NewLinkGasService;
import com.hfkj.channel.gas.newlink.NewLinkRequestService; import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.channel.gas.shell.CqShellPetroleumGasService;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
@ -39,13 +40,16 @@ public class BsGasController {
private BsAgentPriceService agentPriceService; private BsAgentPriceService agentPriceService;
@Resource @Resource
private NewLinkGasService newLinkGasService; private NewLinkGasService newLinkGasService;
@Resource
private CqShellPetroleumGasService cqShellPetroleumGasService;
@RequestMapping(value="/refresh",method = RequestMethod.GET) @RequestMapping(value="/refresh",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "refresh") @ApiOperation(value = "refresh")
public ResponseData refresh() { public ResponseData refresh() {
try { try {
newLinkGasService.refresh(); // newLinkGasService.refresh();
cqShellPetroleumGasService.refresh();
return ResponseMsgUtil.success(""); return ResponseMsgUtil.success("");
@ -99,7 +103,7 @@ public class BsGasController {
try { try {
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
PageInfo<GasListModel> pageInfo = new PageInfo<>(gasService.getGasList(longitude, latitude, oilNo, gasName, distanceLimit)); PageInfo<GasListModel> pageInfo = new PageInfo<>(gasService.getGasList(longitude, latitude, oilNo, gasName, distanceLimit, true));
for (GasListModel gas : pageInfo.getList()) { for (GasListModel gas : pageInfo.getList()) {
BigDecimal discount = new BigDecimal("100"); BigDecimal discount = new BigDecimal("100");

@ -101,9 +101,10 @@ public class OrderPayController {
payMerKey = merPay.getChannelMerKey(); payMerKey = merPay.getChannelMerKey();
ledgerAccountFlag = merPay.getLedgerAccountFlag(); ledgerAccountFlag = merPay.getLedgerAccountFlag();
} else if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type2.getNumber())) { } else if (merchant.getSourceType().equals(MerchantSourceTypeEnum.type2.getNumber())
|| merchant.getSourceType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
// 查询渠道支付配置 // 查询渠道支付配置
BsGasChannelConfig payConfig = gasChannelConfigService.getDetail(MerchantSourceTypeEnum.type2); BsGasChannelConfig payConfig = gasChannelConfigService.getDetail(MerchantSourceTypeEnum.getDataByType(merchant.getSourceType()));
if (payConfig == null) { if (payConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付");
} }

@ -47,6 +47,10 @@ public class NewLinkGasService {
@Resource @Resource
private BsGasOilGunNoService gasOilGunNoService; private BsGasOilGunNoService gasOilGunNoService;
/**
* 刷取全量油站
* @throws Exception
*/
public void refresh() throws Exception { public void refresh() throws Exception {
// 最新全量加油站数据 // 最新全量加油站数据
List<Object> gasDataList = new ArrayList<>(); List<Object> gasDataList = new ArrayList<>();

@ -0,0 +1,282 @@
package com.hfkj.channel.gas.shell;
import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.entity.BsGasOilGunNo;
import com.hfkj.entity.BsGasOilPrice;
import com.hfkj.entity.BsMerchant;
import com.hfkj.service.gas.BsGasOilGunNoService;
import com.hfkj.service.gas.BsGasOilPriceService;
import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.sysenum.MerchantSourceTypeEnum;
import com.hfkj.sysenum.MerchantStatusEnum;
import com.hfkj.sysenum.gas.GasOilPriceStatusEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 重庆壳牌油站服务
* @className: CqShellPetroleumService
* @author: HuRui
* @date: 2024/7/22
**/
@Component
public class CqShellPetroleumGasService {
@Resource
private BsMerchantService merchantService;
@Resource
private BsGasService gasService;
@Resource
private BsGasOilPriceService gasOilPriceService;
@Resource
private BsGasOilGunNoService gasOilGunNoService;
/**
* 刷取全量油站
* @throws Exception
*/
public void refresh() throws Exception {
// 最新全量加油站数据
List<Object> gasDataList = new ArrayList<>();
// 初始化页数
Integer totalPageNum = 3;
// 每页数量
Integer pageSize = 50;
for (int pageIndex = 1; pageIndex <= totalPageNum;pageIndex++) {
// 查询油站
JSONObject object = CqShellPetroleumRequestService.gasPageQueryAllStation(pageIndex, pageSize);
// 总页数
JSONObject pageInfo = JSONObject.parseObject(object.getString("pageInfo"));
totalPageNum = (pageInfo.getInteger("totalCount") + pageSize - 1) / pageSize;
// 加入全量数据集合
gasDataList.addAll(JSONArray.parseArray(object.getString("infoList")));
}
// 设备核心数目
int processorsNum = Runtime.getRuntime().availableProcessors();
Long startTime = System.currentTimeMillis();
System.out.println("本次更新任务开始");
System.out.println("重庆壳牌");
// 初始化线程池
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(
processorsNum * 2,
processorsNum * 2,
4,
TimeUnit.SECONDS,
new ArrayBlockingQueue(processorsNum * 2 * 10),
new ThreadPoolExecutor.DiscardPolicy());
// 大集合拆分成N个小集合,然后用多线程去处理数据,确保不会因为数据量过大导致执行过慢
List<List<Object>> splitNList = splitList(gasDataList, 10);
// 记录单个任务的执行次数
CountDownLatch countDownLatch = new CountDownLatch(splitNList.size());
// 对拆分的集合进行批量处理, 先拆分的集合, 再多线程执行
for (List<Object> singleList : splitNList) {
// 线程池执行
threadPool.execute(new Thread(new Runnable(){
@Override
public void run() {
//模拟执行时间
System.out.println("当前线程:"+Thread.currentThread().getName());
try {
for (Object obj : singleList) {
try {
//组装要执行的批量更新数据
JSONObject gasData = (JSONObject) obj;
// 查询商户
BsMerchant merchant = merchantService.getMerchant(gasData.getString("stationCode"));
if (merchant == null) {
merchant = new BsMerchant();
merchant.setStatus(MerchantStatusEnum.status1.getNumber());
}
merchant.setSourceType(MerchantSourceTypeEnum.type3.getNumber());
merchant.setProvinceCode(gasData.getLong("provinceId"));
merchant.setProvinceName(gasData.getString("provinceName"));
merchant.setCityCode(gasData.getLong("cityId"));
merchant.setCityName(gasData.getString("cityName"));
merchant.setAreaCode(gasData.getLong("districtId"));
merchant.setAreaName(gasData.getString("districtName"));
merchant.setMerNo(gasData.getString("stationCode"));
merchant.setMerName(gasData.getString("stationName"));
merchant.setMerLogo("https://oil.dctpay.com/filesystem/gas_logo_default.jpg");
merchant.setAddress(gasData.getString("stationAddress"));
merchant.setLongitude(gasData.getString("longitude"));
merchant.setLatitude(gasData.getString("latitude"));
merchant.setContactsName(merchant.getMerName());
merchant.setContactsTel(merchant.getMerNo());
merchant.setCustomerServiceTel("400-0236806");
merchant.setMerLabel(null);
if (merchant.getId() == null) {
merchantService.createMerchant(merchant);
} else {
merchantService.updateMerchant(merchant);
}
// 查询油站油价
List<BsGasOilPrice> gasOilPriceList = gasOilPriceService.getGasOilPriceList(merchant.getId());
if (!gasOilPriceList.isEmpty()) {
BsGasOilPrice oilPriceExample = new BsGasOilPrice();
oilPriceExample.setStatus(GasOilPriceStatusEnum.status2.getNumber());
gasOilPriceService.batchUpdate(merchant.getMerNo(), oilPriceExample);
}
// 查询油站抢号
List<BsGasOilGunNo> oilGunNoList = gasOilGunNoService.getOilGunNoList(merchant.getMerNo());
for (BsGasOilGunNo gunNo : oilGunNoList) {
gunNo.setStatus(0);
}
JSONArray oilPriceList = gasData.getJSONArray("oilPriceList");
for (Object oilPrice : oilPriceList) {
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
// 查询油站油价
List<BsGasOilPrice> oilPriceCollect = gasOilPriceList.stream().filter(o -> o.getOilNo().equals(oilPriceObject.getString("goodsCode"))).collect(Collectors.toList());
BsGasOilPrice gasOilPrice = null;
if (oilPriceCollect.isEmpty()) {
gasOilPrice = new BsGasOilPrice();
gasOilPrice.setMerId(merchant.getId());
gasOilPrice.setMerNo(merchant.getMerNo());
gasOilPrice.setOilNo(oilPriceObject.getString("goodsCode"));
gasOilPrice.setOilNoName(oilPriceObject.getString("goodsCode")+"#");
gasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber());
// 油品类型 1:汽油:2:柴油;3:天然气
if (oilPriceObject.getString("goodsGroupType").equals("GASOLINE")) {
gasOilPrice.setOilType(1);
gasOilPrice.setOilTypeName("汽油");
} else if (oilPriceObject.getString("goodsGroupType").equals("DIESEL_OIL")) {
gasOilPrice.setOilType(2);
gasOilPrice.setOilTypeName("柴油");
} else if (oilPriceObject.getString("goodsGroupType").equals("NATURAL_GAS")) {
gasOilPrice.setOilType(3);
gasOilPrice.setOilTypeName("天然气");
}
} else {
gasOilPrice = oilPriceCollect.get(0);
gasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber());
}
// 平台优惠
gasOilPrice.setPreferentialMargin(new BigDecimal("0"));
gasOilPrice.setPriceCost(oilPriceObject.getJSONObject("goodsPrice").getBigDecimal("amount"));
gasOilPrice.setPriceVip(gasOilPrice.getPriceCost());
gasOilPrice.setPriceGun(gasOilPrice.getPriceCost());
gasOilPrice.setPriceOfficial(oilPriceObject.getJSONObject("listedPrice").getBigDecimal("amount"));
// 国标价 - 油站价 = 油站直降
gasOilPrice.setGasStationDrop(gasOilPrice.getPriceOfficial().subtract(gasOilPrice.getPriceCost()));
gasOilPriceService.editOilPrice(gasOilPrice);
for (Object gunNo : oilPriceObject.getJSONArray("oilGunNoList")) {
// 查询抢号
List<BsGasOilGunNo> gunNoCollect = oilGunNoList.stream()
.filter(o -> o.getOilNo().equals(oilPriceObject.getString("goodsCode")) && o.getGunNo().equals(gunNo.toString()))
.collect(Collectors.toList());
// 如果没有找到抢号就新增一个
BsGasOilGunNo gasOilGunNo = null;
if (gunNoCollect.isEmpty()) {
gasOilGunNo = new BsGasOilGunNo();
gasOilGunNo.setGasOilPriceId(gasOilPrice.getId());
gasOilGunNo.setMerId(gasOilPrice.getMerId());
gasOilGunNo.setMerNo(gasOilPrice.getMerNo());
gasOilGunNo.setOilNo(gasOilPrice.getOilNo());
gasOilGunNo.setOilNoName(gasOilPrice.getOilNoName());
gasOilGunNo.setOilType(gasOilPrice.getOilType());
gasOilGunNo.setOilTypeName(gasOilPrice.getOilTypeName());
gasOilGunNo.setGunNo(gunNo.toString());
gasOilGunNo.setStatus(1);
gasOilGunNo.setCreateTime(new Date());
oilGunNoList.add(gasOilGunNo);
} else {
gasOilGunNo = gunNoCollect.get(0);
gasOilGunNo.setStatus(1);
}
}
}
// 添加
gasOilGunNoService.batchInsert(oilGunNoList.stream().filter(o-> o.getId() == null).collect(Collectors.toList()));
// 更新
gasOilGunNoService.batchUpdate(oilGunNoList.stream().filter(o-> o.getId() != null && o.getStatus().equals(0)).collect(Collectors.toList()));
// 删除缓存
gasOilGunNoService.cleanCache(merchant.getMerNo());
// 清除油站缓存
gasService.clean(merchant.getMerNo());
} catch (Exception e) {
System.out.println("更新油站失败");
}
}
} catch (Exception e) {
System.out.println("更新油站出现异常");
System.out.println(e.getMessage());
} finally {
// 任务个数 - 1, 直至为0时唤醒await()
countDownLatch.countDown();
}
}
}));
}
try {
// 让当前线程处于阻塞状态,直到锁存器计数为零
countDownLatch.await();
} catch (Exception e) {
System.out.println("系统出现异常");
}
Long endTime = System.currentTimeMillis();
Long useTime = endTime - startTime;
System.out.println("本次更新任务结束,共计用时"+useTime+"毫秒");
}
/**
* 拆分集合
*
* @param <T> 泛型对象
* @param resList 需要拆分的集合
* @param subListLength 每个子集合的元素个数
* @return 返回拆分后的各个集合组成的列表
**/
public static <T> List<List<T>> splitList(List<T> resList, int subListLength) {
if (CollectionUtils.isEmpty(resList) || subListLength <= 0) {
return new ArrayList<>();
}
List<List<T>> ret = new ArrayList<>();
int size = resList.size();
if (size <= subListLength) {
// 数据量不足 subListLength 指定的大小
ret.add(resList);
} else {
int pre = size / subListLength;
int last = size % subListLength;
// 前面pre个集合,每个大小都是 subListLength 个元素
for (int i = 0; i < pre; i++) {
List<T> itemList = new ArrayList<>(subListLength);
for (int j = 0; j < subListLength; j++) {
itemList.add(resList.get(i * subListLength + j));
}
ret.add(itemList);
}
// last的进行处理
if (last > 0) {
List<T> itemList = new ArrayList<>(last);
for (int i = 0; i < last; i++) {
itemList.add(resList.get(pre * subListLength + i));
}
ret.add(itemList);
}
}
return ret;
}
}

@ -0,0 +1,194 @@
package com.hfkj.channel.gas.shell;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.MD5Util;
import com.hfkj.config.CommonSysConst;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.*;
/**
* 重庆壳牌请求
* @className: CqShellPetroleumConfig
* @author: HuRui
* @date: 2024/7/22
**/
public class CqShellPetroleumRequestService {
/**
* 请求地址
*/
private final static String REQ_URL = CommonSysConst.getSysConfig().getCqShellReqUrl();
/**
* 壳牌合作伙伴id
*/
private final static String PARTNER_ID = CommonSysConst.getSysConfig().getCqShellPartnerId();
/**
* 平台商id
*/
private final static String PLAT_MERCHANT_ID = CommonSysConst.getSysConfig().getCqShellPlatMerchantId();
/**
* 平台商key
*/
private final static String PLAT_MERCHANT_KEY = CommonSysConst.getSysConfig().getCqShellPlatMerchantKey();
/**
* 查询全量加油站
* @param pageNum 当前页码
* @param pageSize 每页数据量最大值50
* @return
*/
public static JSONObject gasPageQueryAllStation(Integer pageNum, Integer pageSize) throws Exception {
Map<String, Object> param = new HashMap<>();
param.put("platMerchantId", PLAT_MERCHANT_ID);
param.put("pageNo", pageNum);
param.put("pageSize", pageSize);
return request(System.currentTimeMillis()+"","gasPageQueryAllStation", param);
}
/**
* 查询单个油站全量信息
* @param stationCode 油站编码
* @return
*/
public static JSONObject gasStationQueryDetail(String stationCode) {
try {
Map<String, Object> param = new HashMap<>();
param.put("platMerchantId", PLAT_MERCHANT_ID);
param.put("stationCode", stationCode);
return request(System.currentTimeMillis()+"","gasPageQueryAllStation", param);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 同步油站付款
* @param orderNo 订单号
* @param stationCode 油站编码
* @param finishTime 完成时间
* @param oilPrice 加油金额
* @param oilCode 油品编码
* @param oilGun 油枪
* @param settlementAmount 支付金额
* @param channelFavourAmount 优惠金额
* @return
*/
public static JSONObject gasSyncPayment(String orderNo,
String stationCode,
Date finishTime,
BigDecimal oilPrice,
String oilCode,
String oilGun,
BigDecimal settlementAmount,
BigDecimal channelFavourAmount) throws Exception {
Map<String, Object> param = new HashMap<>();
param.put("platMerchantId", PLAT_MERCHANT_ID);
param.put("stationCode", stationCode);
param.put("orderType", "OIL");
param.put("finishTime", DateUtil.date2String(finishTime, "yyyy-MM-dd HH:mm:ss"));
param.put("channelFavourAmount", channelFavourAmount);
Map<String, Object> tradeOilOrder = new HashMap<>();
tradeOilOrder.put("amount", oilPrice);
tradeOilOrder.put("code", oilCode);
tradeOilOrder.put("oilGun", oilGun);
tradeOilOrder.put("channelSettlementAmount", settlementAmount);
param.put("tradeOilOrder", JSONObject.toJSONString(tradeOilOrder));
return request(orderNo, "gas_sync_payment_notify", param);
}
/**
* 同步油站退款
* @param finishTime 业务完成时间
* @param tradeNo 交易流水号
* @return
*/
public static JSONObject gasSyncRefund(Date finishTime,String tradeNo) throws Exception {
Map<String, Object> param = new HashMap<>();
param.put("platMerchantId", PLAT_MERCHANT_ID);
param.put("finishTime", DateUtil.date2String(finishTime, "yyyy-MM-dd HH:mm:ss"));
param.put("tradeNo", tradeNo.replace("HF",""));
// 请求接口
return request(System.currentTimeMillis()+"" ,"gas_sync_refund_notify", param);
}
/**
* 接口请求
* @param map
* @return
* @throws Exception
*/
private static JSONObject request(String logSerialNo, String service, Map<String,Object> map) throws Exception {
Map<String, Object> param = new HashMap<>();
param.put("merchantOrderNo", logSerialNo);
param.put("partnerId", PARTNER_ID);
param.put("service", service);
param.put("version", "1.0.0");
param.put("signType", "MD5");
for (Map.Entry<String, Object> entry : map.entrySet()) {
param.put(entry.getKey(), entry.getValue());
}
param.put("sign", MD5Util.encode(generateSignature(param, PLAT_MERCHANT_KEY).getBytes()).toLowerCase());
// 请求接口
JSONObject response = HttpsUtils.doPost(REQ_URL, param);
if (response == null || !response.getString("status").equals("SUCCESS")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response == null?"请求失败":response.getString("message"));
}
return response;
}
/**
* 生成签名
* @param data 数据
* @param key 秘钥app_secret
* @return 加密结果
*/
public static String generateSignature(final Map<String, Object> data, String key) {
Set<String> keySet = data.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray);
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));
}
}
}
sb.append(key);
return sb.toString();
}
/**
* 生成参数
* @param data 数据
* @return 加密结果
*/
public static String generateParam(final Map<String, Object> data) {
Set<String> 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();
}
}

@ -36,6 +36,25 @@ public class CommonSysConfig {
* 能链团油AppSecret * 能链团油AppSecret
*/ */
private String newLinkAppSecret; private String newLinkAppSecret;
/**
* 加好油重庆壳牌请求地址
*/
private String cqShellReqUrl;
/**
* 加好油重庆壳牌壳牌合作伙伴id
*/
private String cqShellPartnerId;
/**
* 加好油重庆壳牌平台商id
*/
private String cqShellPlatMerchantId;
/**
* 加好油重庆壳牌平台商key
*/
private String cqShellPlatMerchantKey;
/** /**
* 惠支付支付渠道回调地址 * 惠支付支付渠道回调地址
*/ */

@ -48,9 +48,10 @@ public interface BsMerchantMapper extends BsMerchantMapperExt {
"contacts_name, contacts_tel, ", "contacts_name, contacts_tel, ",
"customer_service_tel, address, ", "customer_service_tel, address, ",
"longitude, latitude, ", "longitude, latitude, ",
"mer_label, `status`, ", "mer_label, list_show, ",
"create_time, update_time, ", "`status`, create_time, ",
"ext_1, ext_2, ext_3)", "update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{sourceType,jdbcType=INTEGER}, #{provinceCode,jdbcType=BIGINT}, ", "values (#{sourceType,jdbcType=INTEGER}, #{provinceCode,jdbcType=BIGINT}, ",
"#{provinceName,jdbcType=VARCHAR}, #{cityCode,jdbcType=BIGINT}, ", "#{provinceName,jdbcType=VARCHAR}, #{cityCode,jdbcType=BIGINT}, ",
"#{cityName,jdbcType=VARCHAR}, #{areaCode,jdbcType=BIGINT}, ", "#{cityName,jdbcType=VARCHAR}, #{areaCode,jdbcType=BIGINT}, ",
@ -60,9 +61,10 @@ public interface BsMerchantMapper extends BsMerchantMapperExt {
"#{contactsName,jdbcType=VARCHAR}, #{contactsTel,jdbcType=VARCHAR}, ", "#{contactsName,jdbcType=VARCHAR}, #{contactsTel,jdbcType=VARCHAR}, ",
"#{customerServiceTel,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ", "#{customerServiceTel,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ",
"#{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR}, ", "#{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR}, ",
"#{merLabel,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", "#{merLabel,jdbcType=VARCHAR}, #{listShow,jdbcType=BIT}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsMerchant record); int insert(BsMerchant record);
@ -93,6 +95,7 @@ public interface BsMerchantMapper extends BsMerchantMapperExt {
@Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR), @Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR),
@Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR), @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_label", property="merLabel", jdbcType=JdbcType.VARCHAR), @Result(column="mer_label", property="merLabel", jdbcType=JdbcType.VARCHAR),
@Result(column="list_show", property="listShow", jdbcType=JdbcType.BIT),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -107,7 +110,7 @@ public interface BsMerchantMapper extends BsMerchantMapperExt {
"id, source_type, province_code, province_name, city_code, city_name, area_code, ", "id, source_type, province_code, province_name, city_code, city_name, area_code, ",
"area_name, oil_price_zone_id, oil_price_zone_name, mer_no, mer_logo, mer_name, ", "area_name, oil_price_zone_id, oil_price_zone_name, mer_no, mer_logo, mer_name, ",
"contacts_name, contacts_tel, customer_service_tel, address, longitude, latitude, ", "contacts_name, contacts_tel, customer_service_tel, address, longitude, latitude, ",
"mer_label, `status`, create_time, update_time, ext_1, ext_2, ext_3", "mer_label, list_show, `status`, create_time, update_time, ext_1, ext_2, ext_3",
"from bs_merchant", "from bs_merchant",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -132,6 +135,7 @@ public interface BsMerchantMapper extends BsMerchantMapperExt {
@Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR), @Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR),
@Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR), @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR),
@Result(column="mer_label", property="merLabel", jdbcType=JdbcType.VARCHAR), @Result(column="mer_label", property="merLabel", jdbcType=JdbcType.VARCHAR),
@Result(column="list_show", property="listShow", jdbcType=JdbcType.BIT),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@ -171,6 +175,7 @@ public interface BsMerchantMapper extends BsMerchantMapperExt {
"longitude = #{longitude,jdbcType=VARCHAR},", "longitude = #{longitude,jdbcType=VARCHAR},",
"latitude = #{latitude,jdbcType=VARCHAR},", "latitude = #{latitude,jdbcType=VARCHAR},",
"mer_label = #{merLabel,jdbcType=VARCHAR},", "mer_label = #{merLabel,jdbcType=VARCHAR},",
"list_show = #{listShow,jdbcType=BIT},",
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},", "create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},",

@ -26,7 +26,8 @@ public interface BsMerchantMapperExt {
" a.price_official priceOfficial," + " a.price_official priceOfficial," +
" a.price_gun priceGun," + " a.price_gun priceGun," +
" a.price_vip priceVip," + " a.price_vip priceVip," +
" a.gas_station_drop gasStationDrop" + " a.gas_station_drop gasStationDrop," +
" b.list_show listShow" +
" FROM" + " FROM" +
" bs_gas_oil_price a" + " bs_gas_oil_price a" +
" LEFT JOIN bs_merchant b on b.id = a.mer_id" + " LEFT JOIN bs_merchant b on b.id = a.mer_id" +
@ -34,10 +35,13 @@ public interface BsMerchantMapperExt {
" ORDER BY distance asc) a where 1 = 1" + " ORDER BY distance asc) a where 1 = 1" +
"<if test='gasName != null'> and a.merName like concat('%',#{gasName},'%') </if>" + "<if test='gasName != null'> and a.merName like concat('%',#{gasName},'%') </if>" +
"<if test='distanceLimit != null'> <![CDATA[ and a.distance <= #{distanceLimit} ]]> </if>" + "<if test='distanceLimit != null'> <![CDATA[ and a.distance <= #{distanceLimit} ]]> </if>" +
"<if test='distanceLimit != null'> <![CDATA[ and a.distance <= #{distanceLimit} ]]> </if>" +
"<if test='listShow != null'> and a.listShow = #{listShow} </if>" +
"</script>") "</script>")
List<GasListModel> queryGasList(@Param("longitude") String longitude, List<GasListModel> queryGasList(@Param("longitude") String longitude,
@Param("latitude") String latitude, @Param("latitude") String latitude,
@Param("oilNo") String oilNo, @Param("oilNo") String oilNo,
@Param("gasName") String gasName, @Param("gasName") String gasName,
@Param("distanceLimit") Integer distanceLimit); @Param("distanceLimit") Integer distanceLimit,
@Param("listShow") Boolean listShow);
} }

@ -104,6 +104,10 @@ public class BsMerchantSqlProvider {
sql.VALUES("mer_label", "#{merLabel,jdbcType=VARCHAR}"); sql.VALUES("mer_label", "#{merLabel,jdbcType=VARCHAR}");
} }
if (record.getListShow() != null) {
sql.VALUES("list_show", "#{listShow,jdbcType=BIT}");
}
if (record.getStatus() != null) { if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
} }
@ -157,6 +161,7 @@ public class BsMerchantSqlProvider {
sql.SELECT("longitude"); sql.SELECT("longitude");
sql.SELECT("latitude"); sql.SELECT("latitude");
sql.SELECT("mer_label"); sql.SELECT("mer_label");
sql.SELECT("list_show");
sql.SELECT("`status`"); sql.SELECT("`status`");
sql.SELECT("create_time"); sql.SELECT("create_time");
sql.SELECT("update_time"); sql.SELECT("update_time");
@ -260,6 +265,10 @@ public class BsMerchantSqlProvider {
sql.SET("mer_label = #{record.merLabel,jdbcType=VARCHAR}"); sql.SET("mer_label = #{record.merLabel,jdbcType=VARCHAR}");
} }
if (record.getListShow() != null) {
sql.SET("list_show = #{record.listShow,jdbcType=BIT}");
}
if (record.getStatus() != null) { if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
} }
@ -312,6 +321,7 @@ public class BsMerchantSqlProvider {
sql.SET("longitude = #{record.longitude,jdbcType=VARCHAR}"); sql.SET("longitude = #{record.longitude,jdbcType=VARCHAR}");
sql.SET("latitude = #{record.latitude,jdbcType=VARCHAR}"); sql.SET("latitude = #{record.latitude,jdbcType=VARCHAR}");
sql.SET("mer_label = #{record.merLabel,jdbcType=VARCHAR}"); sql.SET("mer_label = #{record.merLabel,jdbcType=VARCHAR}");
sql.SET("list_show = #{record.listShow,jdbcType=BIT}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
@ -404,6 +414,10 @@ public class BsMerchantSqlProvider {
sql.SET("mer_label = #{merLabel,jdbcType=VARCHAR}"); sql.SET("mer_label = #{merLabel,jdbcType=VARCHAR}");
} }
if (record.getListShow() != null) {
sql.SET("list_show = #{listShow,jdbcType=BIT}");
}
if (record.getStatus() != null) { if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}"); sql.SET("`status` = #{status,jdbcType=INTEGER}");
} }

@ -113,6 +113,11 @@ public class BsMerchant implements Serializable {
*/ */
private String merLabel; private String merLabel;
/**
* 列表中展示 0 1
*/
private Boolean listShow;
/** /**
* 状态 0删除 1正常 2禁用 * 状态 0删除 1正常 2禁用
*/ */
@ -296,6 +301,14 @@ public class BsMerchant implements Serializable {
this.merLabel = merLabel; this.merLabel = merLabel;
} }
public Boolean getListShow() {
return listShow;
}
public void setListShow(Boolean listShow) {
this.listShow = listShow;
}
public Integer getStatus() { public Integer getStatus() {
return status; return status;
} }
@ -376,6 +389,7 @@ public class BsMerchant implements Serializable {
&& (this.getLongitude() == null ? other.getLongitude() == null : this.getLongitude().equals(other.getLongitude())) && (this.getLongitude() == null ? other.getLongitude() == null : this.getLongitude().equals(other.getLongitude()))
&& (this.getLatitude() == null ? other.getLatitude() == null : this.getLatitude().equals(other.getLatitude())) && (this.getLatitude() == null ? other.getLatitude() == null : this.getLatitude().equals(other.getLatitude()))
&& (this.getMerLabel() == null ? other.getMerLabel() == null : this.getMerLabel().equals(other.getMerLabel())) && (this.getMerLabel() == null ? other.getMerLabel() == null : this.getMerLabel().equals(other.getMerLabel()))
&& (this.getListShow() == null ? other.getListShow() == null : this.getListShow().equals(other.getListShow()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
@ -408,6 +422,7 @@ public class BsMerchant implements Serializable {
result = prime * result + ((getLongitude() == null) ? 0 : getLongitude().hashCode()); result = prime * result + ((getLongitude() == null) ? 0 : getLongitude().hashCode());
result = prime * result + ((getLatitude() == null) ? 0 : getLatitude().hashCode()); result = prime * result + ((getLatitude() == null) ? 0 : getLatitude().hashCode());
result = prime * result + ((getMerLabel() == null) ? 0 : getMerLabel().hashCode()); result = prime * result + ((getMerLabel() == null) ? 0 : getMerLabel().hashCode());
result = prime * result + ((getListShow() == null) ? 0 : getListShow().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
@ -443,6 +458,7 @@ public class BsMerchant implements Serializable {
sb.append(", longitude=").append(longitude); sb.append(", longitude=").append(longitude);
sb.append(", latitude=").append(latitude); sb.append(", latitude=").append(latitude);
sb.append(", merLabel=").append(merLabel); sb.append(", merLabel=").append(merLabel);
sb.append(", listShow=").append(listShow);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);

@ -1465,6 +1465,66 @@ public class BsMerchantExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andListShowIsNull() {
addCriterion("list_show is null");
return (Criteria) this;
}
public Criteria andListShowIsNotNull() {
addCriterion("list_show is not null");
return (Criteria) this;
}
public Criteria andListShowEqualTo(Boolean value) {
addCriterion("list_show =", value, "listShow");
return (Criteria) this;
}
public Criteria andListShowNotEqualTo(Boolean value) {
addCriterion("list_show <>", value, "listShow");
return (Criteria) this;
}
public Criteria andListShowGreaterThan(Boolean value) {
addCriterion("list_show >", value, "listShow");
return (Criteria) this;
}
public Criteria andListShowGreaterThanOrEqualTo(Boolean value) {
addCriterion("list_show >=", value, "listShow");
return (Criteria) this;
}
public Criteria andListShowLessThan(Boolean value) {
addCriterion("list_show <", value, "listShow");
return (Criteria) this;
}
public Criteria andListShowLessThanOrEqualTo(Boolean value) {
addCriterion("list_show <=", value, "listShow");
return (Criteria) this;
}
public Criteria andListShowIn(List<Boolean> values) {
addCriterion("list_show in", values, "listShow");
return (Criteria) this;
}
public Criteria andListShowNotIn(List<Boolean> values) {
addCriterion("list_show not in", values, "listShow");
return (Criteria) this;
}
public Criteria andListShowBetween(Boolean value1, Boolean value2) {
addCriterion("list_show between", value1, value2, "listShow");
return (Criteria) this;
}
public Criteria andListShowNotBetween(Boolean value1, Boolean value2) {
addCriterion("list_show not between", value1, value2, "listShow");
return (Criteria) this;
}
public Criteria andStatusIsNull() { public Criteria andStatusIsNull() {
addCriterion("`status` is null"); addCriterion("`status` is null");
return (Criteria) this; return (Criteria) this;

@ -50,5 +50,5 @@ public interface BsGasService {
* @param * @param
* @return * @return
*/ */
List<GasListModel> getGasList(String longitude,String latitude,String oilNo,String gasName,Integer distanceLimit); List<GasListModel> getGasList(String longitude,String latitude,String oilNo,String gasName,Integer distanceLimit, Boolean listShow);
} }

@ -184,8 +184,8 @@ public class BsGasServiceImpl implements BsGasService {
} }
@Override @Override
public List<GasListModel> getGasList(String longitude, String latitude, String oilNo, String gasName, Integer distanceLimit) { public List<GasListModel> getGasList(String longitude, String latitude, String oilNo, String gasName, Integer distanceLimit, Boolean listShow) {
return merchantMapper.queryGasList(longitude,latitude,oilNo,gasName,distanceLimit); return merchantMapper.queryGasList(longitude,latitude,oilNo,gasName,distanceLimit,listShow);
} }
} }

@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -66,6 +67,7 @@ public class BsMerchantServiceImpl implements BsMerchantService {
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class}) @Transactional(propagation= Propagation.REQUIRES_NEW,rollbackFor= {RuntimeException.class})
public void createMerchant(BsMerchant merchant) throws Exception { public void createMerchant(BsMerchant merchant) throws Exception {
merchant.setListShow(true);
editData(merchant); editData(merchant);
if (secUserService.getDetailByLoginName(merchant.getContactsTel()) != null) { if (secUserService.getDetailByLoginName(merchant.getContactsTel()) != null) {
@ -169,6 +171,21 @@ public class BsMerchantServiceImpl implements BsMerchantService {
BsMerchantExample example = new BsMerchantExample(); BsMerchantExample example = new BsMerchantExample();
BsMerchantExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(MerchantStatusEnum.status0.getNumber()); BsMerchantExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(MerchantStatusEnum.status0.getNumber());
if (MapUtils.getInteger(param, "sourceType") != null) {
criteria.andSourceTypeEqualTo(MapUtils.getInteger(param, "sourceType"));
}
if (MapUtils.getLong(param, "provinceCode") != null) {
criteria.andProvinceCodeEqualTo(MapUtils.getLong(param, "provinceCode"));
}
if (MapUtils.getLong(param, "cityCode") != null) {
criteria.andCityCodeEqualTo(MapUtils.getLong(param, "cityCode"));
}
if (MapUtils.getLong(param, "areaCode") != null) {
criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "areaCode"));
}
if (MapUtils.getInteger(param, "sourceType") != null) { if (MapUtils.getInteger(param, "sourceType") != null) {
criteria.andSourceTypeEqualTo(MapUtils.getInteger(param, "sourceType")); criteria.andSourceTypeEqualTo(MapUtils.getInteger(param, "sourceType"));
} }

@ -3,6 +3,8 @@ package com.hfkj.service.order;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkGasService; import com.hfkj.channel.gas.newlink.NewLinkGasService;
import com.hfkj.channel.gas.newlink.NewLinkRequestService; import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.channel.gas.shell.CqShellPetroleumRequestService;
import com.hfkj.common.exception.BaseException;
import com.hfkj.entity.BsGasOrder; import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsMerchantUser; import com.hfkj.entity.BsMerchantUser;
import com.hfkj.entity.BsOrderChild; import com.hfkj.entity.BsOrderChild;
@ -96,6 +98,7 @@ public class OrderPaySuccessService {
} }
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) { } else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
try {
// 能链【团油】 // 能链【团油】
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("gasId", gasOrder.getMerNo()); param.put("gasId", gasOrder.getMerNo());
@ -120,6 +123,34 @@ public class OrderPaySuccessService {
gasOrder.setAbnormal(true); gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(pushResult.getString("message")); gasOrder.setAbnormalContent(pushResult.getString("message"));
} }
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("推送订单未知异常!请稍后重新推送");
}
gasOrderService.updateGasOrder(gasOrder);
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
try {
// 推送加好油【重庆壳牌】
CqShellPetroleumRequestService.gasSyncPayment(gasOrder.getOrderNo(),
gasOrder.getMerNo(),
gasOrder.getPayTime(),
order.getTotalPrice(),
gasOrder.getGasOilNo(),
gasOrder.getGasGunNo(),
gasOrder.getPayablePrice(),
gasOrder.getTotalDeductionPrice()
);
gasOrder.setAbnormal(false);
gasOrder.setAbnormalContent(null);
} catch (BaseException e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(e.getErrorMsg());
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("推送订单未知错误!请稍后重新推送");
}
gasOrderService.updateGasOrder(gasOrder); gasOrderService.updateGasOrder(gasOrder);
} }
@ -141,6 +172,7 @@ public class OrderPaySuccessService {
} }
// TODO 赠送积分 // TODO 赠送积分
} }
// 子订单完成 // 子订单完成
orderService.childOrderComplete(gasOrder.getOrderChildNo()); orderService.childOrderComplete(gasOrder.getOrderChildNo());
} }

@ -2,6 +2,11 @@ package com.hfkj.service.order;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hfkj.channel.gas.newlink.NewLinkRequestService; import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.channel.gas.shell.CqShellPetroleumRequestService;
import com.hfkj.common.exception.BaseException;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.entity.BsGasOrder; import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsMerchantAccount; import com.hfkj.entity.BsMerchantAccount;
import com.hfkj.entity.BsOrderChild; import com.hfkj.entity.BsOrderChild;
@ -47,18 +52,33 @@ public class OrderRefundBusiness {
gasOrderService.updateGasOrder(gasOrder); gasOrderService.updateGasOrder(gasOrder);
try { try {
// 订单是否异常 false:无异常 true:有异常
if (gasOrder.getAbnormal().equals(false)) { if (gasOrder.getAbnormal().equals(false)) {
if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) { if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type1.getNumber())) {
// 退回商户额度 // 退回商户额度
merchantAccountService.refund(gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), refund); merchantAccountService.refund(gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), refund);
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) { } else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) {
// 请求团油渠道退款
JSONObject object = NewLinkRequestService.refuelingOrderRefund(gasOrder.getUserPhone(), gasOrder.getOrderNo(), refund.getRefundRemark()); JSONObject object = NewLinkRequestService.refuelingOrderRefund(gasOrder.getUserPhone(), gasOrder.getOrderNo(), refund.getRefundRemark());
if (object == null || !object.getString("code").equals("200")) { if (object == null || !object.getString("code").equals("200")) {
gasOrder.setAbnormal(true); gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("渠道退款失败!原因:" + object.getString("message")); gasOrder.setAbnormalContent("渠道退款失败!原因:" + object.getString("message"));
gasOrderService.updateGasOrder(gasOrder); gasOrderService.updateGasOrder(gasOrder);
} }
} else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type3.getNumber())) {
try {
// 请求重庆壳牌渠道退款
CqShellPetroleumRequestService.gasSyncRefund(gasOrder.getPayTime(), gasOrder.getOrderNo());
} catch (BaseException e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("渠道退款失败!原因:" + e.getErrorMsg());
gasOrderService.updateGasOrder(gasOrder);
} catch (Exception e) {
gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent("渠道退款失败!未知原因");
gasOrderService.updateGasOrder(gasOrder);
}
} }
} }
} catch (Exception e) {} } catch (Exception e) {}

@ -19,6 +19,10 @@ public enum MerchantSourceTypeEnum {
* 能链团油 * 能链团油
*/ */
type2(2, "能链【团油】"), type2(2, "能链【团油】"),
/**
* 加好油重庆壳牌
*/
type3(3, "加好油【重庆壳牌】"),
; ;
private Integer number; private Integer number;

@ -10,3 +10,8 @@ wxMaAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
newLinkReqUrl=https://test01-motorcade-hcs.czb365.com newLinkReqUrl=https://test01-motorcade-hcs.czb365.com
newLinkAppKey=297046381248288 newLinkAppKey=297046381248288
newLinkAppSecret=3ef5320dd36e178ce2502fae1a8acd2b newLinkAppSecret=3ef5320dd36e178ce2502fae1a8acd2b
cqShellReqUrl=http://openapi.ngrok.xinyebang.cn/gateway.html
cqShellPartnerId=S0302207281600105753
cqShellPlatMerchantId=S0302206141000105717
cqShellPlatMerchantKey=wqisfmkzea6mwd7ogbyh3488jv0hqhdj

@ -8,3 +8,8 @@ wxMaAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
newLinkReqUrl=https://hcs.czb365.com newLinkReqUrl=https://hcs.czb365.com
newLinkAppKey=305490138943968 newLinkAppKey=305490138943968
newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8 newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8
cqShellReqUrl=http://api.shenmapay.com/gateway.html
cqShellPartnerId=S0302208021401950202
cqShellPlatMerchantId=S0302206141001919666
cqShellPlatMerchantKey=pic1yj2l3zby5ywpznrtdz7458ce2soj

Loading…
Cancel
Save