提交代码

dev
胡锐 4 months ago
parent ec8aefb60b
commit 30c070004a
  1. 44
      bweb/src/main/java/com/bweb/controller/BsDeviceController.java
  2. 34
      bweb/src/main/java/com/bweb/controller/BsGasOrderController.java
  3. 6
      service/src/main/java/com/hfkj/service/gas/BsGasOrderService.java
  4. 19
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOrderServiceImpl.java
  5. 6
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  6. 4
      service/src/main/java/com/hfkj/service/order/OrderRefundBusiness.java
  7. 7
      service/src/main/java/com/hfkj/sysenum/DeviceReceiptOutContentEnum.java

@ -16,6 +16,7 @@ import com.hfkj.service.BsDeviceService;
import com.hfkj.service.merchant.BsMerchantService; import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.sysenum.DeviceReceiptOutContentEnum; import com.hfkj.sysenum.DeviceReceiptOutContentEnum;
import com.hfkj.sysenum.DeviceTypeEnum; import com.hfkj.sysenum.DeviceTypeEnum;
import com.hfkj.sysenum.MerchantSourceTypeEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -95,6 +96,21 @@ public class BsDeviceController {
} }
} }
} }
DeviceReceiptOutContentEnum receiptOutContent = null;
Map<String,Object> param = new HashMap<>();
param.put("type", DeviceTypeEnum.type1.getType());
param.put("merNo", body.getMerNo());
// 查询设备
List<BsDevice> deviceList = deviceService.getDeviceList(param);
if (!deviceList.isEmpty()) {
// 查询设备的设置
receiptOutContent = DeviceReceiptOutContentEnum.getDataByType(deviceList.get(0).getReceiptOutContent());
}
if (receiptOutContent == null) {
receiptOutContent = DeviceReceiptOutContentEnum.content2;
}
device.setMerId(merchant.getId()); device.setMerId(merchant.getId());
device.setMerNo(merchant.getMerNo()); device.setMerNo(merchant.getMerNo());
device.setMerName(merchant.getMerName()); device.setMerName(merchant.getMerName());
@ -104,7 +120,7 @@ public class BsDeviceController {
device.setDeviceKey(body.getDeviceKey()); device.setDeviceKey(body.getDeviceKey());
device.setDeviceImei(body.getDeviceImei()); device.setDeviceImei(body.getDeviceImei());
device.setDeviceIccid(body.getDeviceIccid()); device.setDeviceIccid(body.getDeviceIccid());
device.setReceiptOutContent(body.getReceiptOutContent()==null?DeviceReceiptOutContentEnum.content2.getType():body.getReceiptOutContent()); device.setReceiptOutContent(receiptOutContent.getType());
device.setReceiptTop(body.getReceiptTop()); device.setReceiptTop(body.getReceiptTop());
device.setReceiptSource(body.getReceiptSource()); device.setReceiptSource(body.getReceiptSource());
device.setReceiptBottom(body.getReceiptBottom()); device.setReceiptBottom(body.getReceiptBottom());
@ -206,6 +222,32 @@ public class BsDeviceController {
} }
@RequestMapping(value="/getSettingReceipt",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询小票打印内容")
public ResponseData getSettingReceipt(@RequestParam(name = "merNo", required = true) String merNo) {
try {
DeviceReceiptOutContentEnum receiptOutContent = null;
Map<String,Object> param = new HashMap<>();
param.put("type", DeviceTypeEnum.type1.getType());
param.put("merNo", merNo);
// 查询设备
List<BsDevice> deviceList = deviceService.getDeviceList(param);
if (!deviceList.isEmpty()) {
// 查询设备的设置
receiptOutContent = DeviceReceiptOutContentEnum.getDataByType(deviceList.get(0).getReceiptOutContent());
}
if (receiptOutContent == null) {
receiptOutContent = DeviceReceiptOutContentEnum.content2;
}
return ResponseMsgUtil.success(receiptOutContent.getType());
} catch (Exception e) {
log.error("HighDeviceController -> settingReceipt() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/settingReceipt",method = RequestMethod.POST) @RequestMapping(value="/settingReceipt",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "设置小票打印内容") @ApiOperation(value = "设置小票打印内容")

@ -1,6 +1,7 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.bweb.config.SysConst; import com.bweb.config.SysConst;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -19,6 +20,7 @@ import com.hfkj.model.order.ExportGasOrderModel;
import com.hfkj.service.BsDeviceService; import com.hfkj.service.BsDeviceService;
import com.hfkj.service.gas.BsGasOrderService; import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPaySuccessService;
import com.hfkj.sysenum.MerchantSourceTypeEnum; import com.hfkj.sysenum.MerchantSourceTypeEnum;
import com.hfkj.sysenum.SecUserObjectTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.gas.OrderOilStatus; import com.hfkj.sysenum.gas.OrderOilStatus;
@ -29,10 +31,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
@ -381,6 +380,33 @@ public class BsGasOrderController {
} }
@RequestMapping(value="/repairOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "补单")
public ResponseData repairOrder(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(body.getString("orderNo"));
if (gasOrder == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油的订单");
}
if (!gasOrder.getAbnormal().equals(true)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油订单未处于异常状态,无需补单!");
}
// 补推
gasOrderService.repairOrder(gasOrder.getOrderNo());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/queryOilOrder",method = RequestMethod.GET) @RequestMapping(value="/queryOilOrder",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询加油订单详情") @ApiOperation(value = "查询加油订单详情")

@ -39,6 +39,12 @@ public interface BsGasOrderService {
*/ */
BsGasOrder getDetailByOrderNo(String orderNo); BsGasOrder getDetailByOrderNo(String orderNo);
/**
* 补单
* @param orderNo
*/
BsGasOrder repairOrder(String orderNo) throws Exception;
/** /**
* 查询详情 * 查询详情
* @param paySerialNo * @param paySerialNo

@ -1,10 +1,15 @@
package com.hfkj.service.gas.impl; package com.hfkj.service.gas.impl;
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.DateUtil;
import com.hfkj.dao.BsGasOrderMapper; import com.hfkj.dao.BsGasOrderMapper;
import com.hfkj.entity.BsGasOrder; import com.hfkj.entity.BsGasOrder;
import com.hfkj.entity.BsGasOrderExample; import com.hfkj.entity.BsGasOrderExample;
import com.hfkj.service.gas.BsGasOrderService; import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPaySuccessService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -27,7 +32,10 @@ public class BsGasOrderServiceImpl implements BsGasOrderService {
@Resource @Resource
private BsGasOrderMapper gasOrderMapper; private BsGasOrderMapper gasOrderMapper;
@Resource
private BsOrderService orderService;
@Resource
private OrderPaySuccessService paySuccessService;
@Override @Override
public void addGasOrder(BsGasOrder gasOrder) { public void addGasOrder(BsGasOrder gasOrder) {
gasOrder.setCreateTime(new Date()); gasOrder.setCreateTime(new Date());
@ -61,6 +69,15 @@ public class BsGasOrderServiceImpl implements BsGasOrderService {
return null; return null;
} }
@Override
public BsGasOrder repairOrder(String orderNo) throws Exception {
BsGasOrder result = paySuccessService.oilHandle(orderService.getDetail(orderNo));
if (result.getAbnormal().equals(true)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "补单失败!原因:" + result.getAbnormalContent());
}
return result;
}
@Override @Override
public BsGasOrder getDetailByPaySerialNo(String paySerialNo) { public BsGasOrder getDetailByPaySerialNo(String paySerialNo) {
BsGasOrderExample example = new BsGasOrderExample(); BsGasOrderExample example = new BsGasOrderExample();

@ -69,7 +69,7 @@ public class OrderPaySuccessService {
* 加油业务 * 加油业务
* @param order * @param order
*/ */
public void oilHandle(OrderModel order) throws Exception { public BsGasOrder oilHandle(OrderModel order) throws Exception {
// 查询加油订单 // 查询加油订单
BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(order.getOrderNo()); BsGasOrder gasOrder = gasOrderService.getDetailByOrderNo(order.getOrderNo());
if (gasOrder != null) { if (gasOrder != null) {
@ -114,6 +114,8 @@ public class OrderPaySuccessService {
JSONObject pushResult = NewLinkRequestService.refuelingOrderPush(param); JSONObject pushResult = NewLinkRequestService.refuelingOrderPush(param);
if (pushResult != null && pushResult.getString("code").equals("200")) { if (pushResult != null && pushResult.getString("code").equals("200")) {
gasOrder.setChannelOrderNo(pushResult.getJSONObject("result").getString("orderNo")); gasOrder.setChannelOrderNo(pushResult.getJSONObject("result").getString("orderNo"));
gasOrder.setAbnormal(false);
gasOrder.setAbnormalContent(null);
} else { } else {
gasOrder.setAbnormal(true); gasOrder.setAbnormal(true);
gasOrder.setAbnormalContent(pushResult.getString("message")); gasOrder.setAbnormalContent(pushResult.getString("message"));
@ -142,6 +144,8 @@ public class OrderPaySuccessService {
// 子订单完成 // 子订单完成
orderService.childOrderComplete(gasOrder.getOrderChildNo()); orderService.childOrderComplete(gasOrder.getOrderChildNo());
} }
return gasOrder;
} }
} }

@ -47,6 +47,7 @@ public class OrderRefundBusiness {
gasOrderService.updateGasOrder(gasOrder); gasOrderService.updateGasOrder(gasOrder);
try { try {
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);
@ -55,10 +56,11 @@ public class OrderRefundBusiness {
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("渠道退款失败!"); gasOrder.setAbnormalContent("渠道退款失败!原因:" + object.getString("message"));
gasOrderService.updateGasOrder(gasOrder); gasOrderService.updateGasOrder(gasOrder);
} }
} }
}
} catch (Exception e) {} } catch (Exception e) {}
} }
} }

@ -29,6 +29,13 @@ public enum DeviceReceiptOutContentEnum {
this.name = name; this.name = name;
} }
public static DeviceReceiptOutContentEnum getDataByType(Integer type) {
for (DeviceReceiptOutContentEnum ele : values()) {
if(Objects.equals(type,ele.getType())) return ele;
}
return null;
}
public static String getNameByType(Integer type) { public static String getNameByType(Integer type) {
for (DeviceReceiptOutContentEnum ele : values()) { for (DeviceReceiptOutContentEnum ele : values()) {
if(Objects.equals(type,ele.getType())) return ele.getName(); if(Objects.equals(type,ele.getType())) return ele.getName();

Loading…
Cancel
Save