From 22f497b1a3287d5a9b2a589d815bc6d335e01b00 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 29 Jan 2024 16:26:41 +0800 Subject: [PATCH 1/2] =?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 --- .../business/OrderOilCardController.java | 211 ++++++++++++++++++ .../com/hai/config/ChongQingCNPCService.java | 12 + .../java/com/hai/dao/HighOrderMapperExt.java | 38 ++++ .../com/hai/order/service/OrderService.java | 7 + .../order/service/impl/OrderServiceImpl.java | 29 +++ 5 files changed, 297 insertions(+) create mode 100644 hai-order/src/main/java/com/web/controller/business/OrderOilCardController.java diff --git a/hai-order/src/main/java/com/web/controller/business/OrderOilCardController.java b/hai-order/src/main/java/com/web/controller/business/OrderOilCardController.java new file mode 100644 index 00000000..674543a2 --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/business/OrderOilCardController.java @@ -0,0 +1,211 @@ +package com.web.controller.business; + +import com.alibaba.excel.EasyExcel; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighGasOrder; +import com.hai.enum_type.MerchantStoreSourceType; +import com.hai.enum_type.UserObjectTypeEnum; +import com.hai.enum_type.UserRoleTypeEnum; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.order.model.ExportGasOrderModel; +import com.hai.order.service.OrderService; +import com.hai.order.service.OrderServiceExt; +import com.hai.order.type.OrderOilStatus; +import com.hai.order.type.OrderPayType; +import com.hai.service.HighGasOrderService; +import com.web.config.SysConst; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections4.MapUtils; +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.RequestMapping; +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 java.io.File; +import java.math.BigDecimal; +import java.util.*; + +@Controller +@RequestMapping(value = "oilCard") +@Api(value = "油卡充值业务") +public class OrderOilCardController { + + private static Logger log = LoggerFactory.getLogger(OrderOilCardController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private OrderService orderService; + + @Resource + private OrderServiceExt orderServiceExt; + + @RequestMapping(value="/getOilCardOrderList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询油卡充值订单列表") + public ResponseData getOilCardOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "oilCardNo", required = false) String oilCardNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, + @RequestParam(name = "refundTimeE", required = false) Long refundTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize + ) { + try { + Map param = new HashMap<>(); + param.put("orderNo", orderNo); + param.put("memPhone", memPhone); + param.put("oilCardNo", oilCardNo); + param.put("payType", payType); + param.put("status", status); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); + param.put("refundTimeS", refundTimeS); + param.put("refundTimeE", refundTimeE); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(orderService.getOilCardOrderList(param))); + + } catch (Exception e) { + log.error("OrderOilCardController -> getOilCardOrderList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getOrderDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询订单详情") + public ResponseData getOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) { + try { + + return ResponseMsgUtil.success(orderService.getOrderDetailByNo(orderNo)); + + } catch (Exception e) { + log.error("OrderExtController -> getGasOrderDetail() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/exportOilCardOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出油卡充值订单") + public ResponseData exportOilCardOrder(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "oilCardNo", required = false) String oilCardNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, + @RequestParam(name = "refundTimeE", required = false) Long refundTimeE) { + try { + + Map param = new HashMap<>(); + param.put("orderNo", orderNo); + param.put("memPhone", memPhone); + param.put("oilCardNo", oilCardNo); + param.put("payType", payType); + param.put("status", status); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); + param.put("refundTimeS", refundTimeS); + param.put("refundTimeE", refundTimeE); + + // 查询数据 + List> orderList = orderService.getOilCardOrderList(param); + + List> dataList = new ArrayList<>(); + List data; + + for (Map order : orderList) { + data = new ArrayList<>(); + data.add(MapUtils.getString(order, "orderNo")); + data.add(MapUtils.getString(order, "memPhone")); + data.add(MapUtils.getString(order, "oildCard")); + data.add(MapUtils.getString(order, "goodsActualPrice")); + data.add(MapUtils.getString(order, "givePrice")); + data.add(MapUtils.getString(order, "goodsPrice")); + data.add(MapUtils.getString(order, "payRealPrice")); + data.add(MapUtils.getString(order, "createTime")); + data.add(MapUtils.getString(order, "payTime")); + data.add(MapUtils.getString(order, "refundTime")); + data.add(MapUtils.getString(order, "orderStatus")); + dataList.add(data); + } + + List headList = new ArrayList<>();; + headList.add("交易单号"); + headList.add("客户电话"); + headList.add("油卡卡号"); + headList.add("充值金额"); + headList.add("赠送金额"); + headList.add("实际到账金额"); + headList.add("支付金额"); + headList.add("创建时间"); + headList.add("支付时间"); + headList.add("退款时间"); + headList.add("交易状态"); + + String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; + String pathName = System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + + EasyExcel.write(fileUrl+pathName) + .head(generationHead(headList)) + .sheet("交易订单") + .doWrite(dataList); + return ResponseMsgUtil.success(pathName); + + } catch (Exception e) { + log.error("OrderExtController -> exportGasOrderList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + /** + * 生成头部 + * @param headList + * @return + */ + private List> generationHead(List headList) { + List> list = new ArrayList<>(); + List head; + for (String headStr : headList) { + head = new ArrayList<>(); + head.add(headStr); + list.add(head); + } + return list; + } + +} diff --git a/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java b/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java index ea2f58cc..4428168b 100644 --- a/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java +++ b/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java @@ -54,6 +54,18 @@ public class ChongQingCNPCService { return request("sendCNPCTicket", map); } + /** + * 电子券作废 + * @param couponNo 电子券编号 + * @param random 随机数 + */ + public static JSONObject invalidCoupon(String couponNo, String random) throws Exception { + Map map = new HashMap<>(); + map.put("couponNo", couponNo); + map.put("random", random); + return request("invalidCoupon", map); + } + /** * 获取中石油跨界券核销码 * @param couponNo diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 82a3303e..049f79b8 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1231,4 +1231,42 @@ public interface HighOrderMapperExt { }) Map HltCardNoTopUpStatistic(); + + @Select("") + List> getOilCardOrderList(@Param("param") Map param); + } diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java index 1621eff3..3539fcdc 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java @@ -146,4 +146,11 @@ public interface OrderService { * @Return com.alibaba.fastjson.JSONObject */ JSONObject createOrderCombine(CreateCombine createCombine) throws Exception; + + /** + * 查询油卡充值订单 + * @param param + * @return + */ + List> getOilCardOrderList(Map param) throws Exception; } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 18445eeb..95740730 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -1097,4 +1097,33 @@ public class OrderServiceImpl implements OrderService { return null; } + + @Override + public List> getOilCardOrderList(Map param) throws Exception { + if (MapUtils.getLong(param, "createTimeS") != null) { + param.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeS")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "createTimeE") != null) { + param.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeE")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "payTimeS") != null) { + param.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeS")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "payTimeE") != null) { + param.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeE")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "refundTimeS") != null) { + param.put("refundTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "refundTimeS")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "refundTimeE") != null) { + param.put("refundTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "refundTimeE")), DateUtil.Y_M_D_HMS)); + } + + return orderMapper.getOilCardOrderList(param); + } } From bc4969d8718c341c375092acd0ed5b428463795d Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 31 Jan 2024 14:44:37 +0800 Subject: [PATCH 2/2] =?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 --- .../src/main/java/com/cweb/controller/HighTestController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fa15801c..d24be5d5 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.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.security.UserCenter; 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 PayloService payloService; @Resource private HighGasService gasService; @RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单退款") public ResponseData ycShellPageQueryAllStation() { try { return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) { try { JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo); if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); return ResponseMsgUtil.success(data); } else { log.error("getRechargeProduct error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); } } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "paylo油站") public ResponseData getPayloAllStation(HttpServletRequest request) { try { gasService.getPayloAllStation(); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() 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.security.UserCenter; 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 PayloService payloService; @Resource private HighGasService gasService; @RequestMapping(value = "/invalidCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆CNPC电子券作废") public ResponseData invalidCoupon(@RequestParam(name = "couponNo", required = true) String couponNo, @RequestParam(name = "random", required = false) String random) { try { return ResponseMsgUtil.success(ChongQingCNPCService.invalidCoupon(couponNo, null)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单退款") public ResponseData ycShellPageQueryAllStation() { try { return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) { try { JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo); if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); return ResponseMsgUtil.success(data); } else { log.error("getRechargeProduct error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); } } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "paylo油站") public ResponseData getPayloAllStation(HttpServletRequest request) { try { gasService.getPayloAllStation(); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file