diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index 9fa1fb13..0a007c60 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -416,6 +417,91 @@ public class HighOrderController { } } + @RequestMapping(value = "/getOrderListByIdCode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据表示查询订单") + public ResponseData getOrderListByIdCode(@RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "identificationCode", required = false) String identificationCode, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @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 = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("identificationCode", identificationCode); + map.put("orderNo", orderNo); + map.put("paySerialNo", paySerialNo); + map.put("payModel", payModel); + map.put("payType", payType); + map.put("orderStatus", orderStatus); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("payTimeS", payTimeS); + map.put("payTimeE", payTimeE); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderService.getOrderListByIdCode(identificationCode, map))); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderListByIdCode() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/exportOrderListByIdCode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出商品订单列表") + public ResponseData exportOrderListByIdCode(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "merchantId", required = false) Long merchantId, + @RequestParam(name = "identificationCode", required = false) String identificationCode, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "paySerialNo", required = false) String paySerialNo, + @RequestParam(name = "payModel", required = false) Integer payModel, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @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, + HttpServletRequest request) { + try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + Map map = new HashMap<>(); + map.put("orderNo", orderNo); + map.put("paySerialNo", paySerialNo); + map.put("payModel", payModel); + map.put("payType", payType); + map.put("orderStatus", orderStatus); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("payTimeS", payTimeS); + map.put("payTimeE", payTimeE); + + String name = "/goodsOrder/订单列表" + System.currentTimeMillis() + ".xlsx"; + List list = highOrderService.getOrderListByIdCode(identificationCode,map); + String fileName = SysConst.getSysConfig().getFileUrl() + name; + EasyExcel.write(fileName, ExportHighOrderModel.class).sheet("商品订单").doWrite(list); + return ResponseMsgUtil.success(name); + + } catch (Exception e) { + log.error("HighOrderController --> exportGoodsOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getMobileOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询话费充值订单列表") diff --git a/hai-bweb/src/main/java/com/bweb/model/ExportHighOrderModel.java b/hai-bweb/src/main/java/com/bweb/model/ExportHighOrderModel.java index f1f3594d..cd262d5f 100644 --- a/hai-bweb/src/main/java/com/bweb/model/ExportHighOrderModel.java +++ b/hai-bweb/src/main/java/com/bweb/model/ExportHighOrderModel.java @@ -1,5 +1,6 @@ package com.bweb.model; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import java.math.BigDecimal; @@ -7,6 +8,10 @@ import java.util.Date; public class ExportHighOrderModel { + @ExcelIgnore + @ExcelProperty("订单编号") + private String orderId; + @ExcelProperty("商户名称") private String merchantName; @@ -19,7 +24,7 @@ public class ExportHighOrderModel { @ExcelProperty("订单来源") private String giveawayType; - @ExcelProperty("商品名称") + @ExcelProperty("订单号") private String orderNo; @ExcelProperty("用户名称") @@ -34,7 +39,7 @@ public class ExportHighOrderModel { @ExcelProperty("支付方式") private String payType; - @ExcelProperty("支付流水") + @ExcelProperty("第三方订单号") private String paySerialNo; @ExcelProperty("订单总金额") @@ -61,12 +66,20 @@ public class ExportHighOrderModel { @ExcelProperty("生成时间") private Date createTime; - @ExcelProperty("支付") + @ExcelProperty("支付时间") private Date payTime; @ExcelProperty("取消时间") private Date cancelTime; + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + public String getMerchantName() { return merchantName; } diff --git a/hai-bweb/src/main/resources/dev/application.yml b/hai-bweb/src/main/resources/dev/application.yml index 32384420..f799126d 100644 --- a/hai-bweb/src/main/resources/dev/application.yml +++ b/hai-bweb/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource 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 37bd14dc..0a174062 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -103,7 +103,7 @@ public interface HighOrderMapperExt { " b.mem_name memName," + " b.mem_phone memPhone," + " case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " + - " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' end payType," + + " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' when 4 then '工会卡' end payType," + " b.pay_serial_no paySerialNo," + " case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," + " b.mem_discount_name memDiscountName," + @@ -158,7 +158,7 @@ public interface HighOrderMapperExt { " b.mem_name memName," + " b.mem_phone memPhone," + " case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " + - " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' end payType," + + " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' when 4 then '工会卡' end payType," + " b.pay_serial_no paySerialNo," + " case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," + " b.mem_discount_name memDiscountName," + @@ -209,7 +209,7 @@ public interface HighOrderMapperExt { " b.mem_name memName," + " b.mem_phone memPhone," + " case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " + - " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' end payType," + + " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' when 4 then '工会卡' end payType," + " b.pay_serial_no paySerialNo," + " case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," + " b.mem_discount_name memDiscountName," + @@ -261,7 +261,7 @@ public interface HighOrderMapperExt { " b.mem_name memName," + " b.mem_phone memPhone," + " case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " + - " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' end payType," + + " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' when 4 then '工会卡' end payType," + " b.pay_serial_no paySerialNo," + " case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," + " b.mem_discount_name memDiscountName," + @@ -312,7 +312,7 @@ public interface HighOrderMapperExt { " b.mem_name memName," + " b.mem_phone memPhone," + " case b.pay_model when 1 then '金币' when 2 then '第三方' end payModel, " + - " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' end payType," + + " case b.pay_type when 1 then '支付宝' when 2 then '微信' when 3 then '金币' when 4 then '工会卡' end payType," + " b.pay_serial_no paySerialNo," + " case a.giveaway_type when 0 then b.total_price when 1 then 0 end totalPrice," + " b.mem_discount_name memDiscountName," + @@ -350,6 +350,56 @@ public interface HighOrderMapperExt { " GROUP BY a.id ORDER BY b.create_time desc" + ""}) List getMobileOrderList(@Param("map") Map map); + + + @Select({""}) + List getOrderListByIdCode(@Param("map") Map map); /** * 查询处于已经支付和待支付的话费订单 @@ -494,8 +544,8 @@ public interface HighOrderMapperExt { }) List selectAlreadyPaidCinemaOrder(); - @Select("select a.id,a.order_no,TRIM(BOTH '\"' FROM b.transaction_id) pay_serial_no from \n" + - "(select id,order_no from high_order where order_status = 5 and create_time >= '2021-06-21 00:00:00') a\n" + + @Select("select a.id,a.order_no,TRIM(BOTH '\"' FROM b.transaction_id) pay_serial_no from " + + "(select id,order_no from high_order where order_status = 5 and create_time >= '2021-06-21 00:00:00') a" + "LEFT JOIN (select JSON_EXTRACT(body_info,'$.out_trade_no') out_trade_no,JSON_EXTRACT(body_info,'$.transaction_id') transaction_id from high_pay_record where create_time >= '2021-06-21 00:00:00' and res_type = 2 GROUP BY JSON_EXTRACT(body_info,'$.out_trade_no')) b on a.order_no = b.out_trade_no where b.out_trade_no is not null") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), diff --git a/hai-service/src/main/java/com/hai/model/HighOrderModel.java b/hai-service/src/main/java/com/hai/model/HighOrderModel.java index deb7e2bd..30c6f750 100644 --- a/hai-service/src/main/java/com/hai/model/HighOrderModel.java +++ b/hai-service/src/main/java/com/hai/model/HighOrderModel.java @@ -4,7 +4,6 @@ import java.math.BigDecimal; import java.util.Date; public class HighOrderModel { - private Long orderId; private String merchantName; private String goodsType; diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 109e7f6c..038becef 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -168,6 +168,14 @@ public interface HighOrderService { */ List getMobileOrderList(Map map) throws Exception; + /** + * 根据标识码 查询订单 + * @param identificationCode + * @return + * @throws Exception + */ + List getOrderListByIdCode(String identificationCode, Map map) throws Exception; + /** * @Author 胡锐 * @Description 查询需要关闭的订单列表 @@ -177,7 +185,7 @@ public interface HighOrderService { /** * 根据优惠券代理商id 查询已消费的订单 - * @param discountAgentId + * @param discountCodeId * @return */ HighOrder getConsumeOrderByDiscountCode(Long discountCodeId); 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 464410d8..1a4a05df 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 @@ -793,6 +793,29 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapper.getMobileOrderList(map); } + @Override + public List getOrderListByIdCode(String identificationCode, Map map) throws Exception { + map.put("identificationCode", identificationCode); + + if(MapUtils.getLong(map, "createTimeS") != null) { + map.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "createTimeS")), "yyyy-MM-dd HH:mm:ss")); + } + + if(MapUtils.getLong(map, "createTimeE") != null) { + map.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "createTimeE")), "yyyy-MM-dd HH:mm:ss")); + } + + if(MapUtils.getLong(map, "payTimeS") != null) { + map.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeS")), "yyyy-MM-dd HH:mm:ss")); + } + + if(MapUtils.getLong(map, "payTimeE") != null) { + map.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeE")), "yyyy-MM-dd HH:mm:ss")); + } + + return highOrderMapper.getOrderListByIdCode(map); + } + @Override public List getCloseOrder() { return highOrderMapperExt.getCloseOrder();