From 71ce3e468c2dc0ea58fa207567a4181b9d0f3320 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 1 Nov 2022 15:20:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=8F=90=E4=BA=A4diam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/web/controller/OrderController.java | 9 ++++++++- .../com/web/controller/OrderPayController.java | 2 +- .../web/controller/OrderRefundController.java | 18 ++++++++++++------ .../com/web/controller/TestController.java | 2 +- .../business/OrderOilController.java | 2 +- .../rocketmq/consumer/OrderCancelConsumer.java | 2 +- .../com/hai/order/service/OrderService.java | 8 ++++---- .../order/service/impl/OrderServiceImpl.java | 8 ++++---- 8 files changed, 32 insertions(+), 19 deletions(-) diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index b27a712a..f6e70131 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -20,6 +20,7 @@ import com.hai.order.service.OrderService; import com.hai.order.type.OrderChildGoodsType; import com.hai.order.type.OrderChildStatus; import com.hai.order.type.OrderPayType; +import com.hai.order.type.OrderStatus; import com.hai.order.utils.OrderUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -132,7 +133,13 @@ public class OrderController { String orderNo = body.getString("orderNo"); String remarks = body.getString("remarks"); - return ResponseMsgUtil.success(orderService.cancelOrder(orderNo, remarks)); + + // 查询订单 + HighOrder order = orderService.getOrderDetailByNo(orderNo); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); + } + return ResponseMsgUtil.success(orderService.cancelOrder(order, remarks)); } catch (Exception e) { log.error("OrderController -> cancel() error!",e); diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index 4de25d6c..1828ad0d 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -55,7 +55,7 @@ import java.util.concurrent.ThreadLocalRandom; @Controller @RequestMapping("/orderPay") @Api(value = "订单支付") -public class OrderPayController { +public class OrderPayController { private static Logger log = LoggerFactory.getLogger(OrderPayController.class); diff --git a/hai-order/src/main/java/com/web/controller/OrderRefundController.java b/hai-order/src/main/java/com/web/controller/OrderRefundController.java index fd48b246..5d1ae6e7 100644 --- a/hai-order/src/main/java/com/web/controller/OrderRefundController.java +++ b/hai-order/src/main/java/com/web/controller/OrderRefundController.java @@ -12,6 +12,7 @@ import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.entity.HighOrderRefund; +import com.hai.enum_type.OrderStatusEnum; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderChildModel; @@ -21,10 +22,7 @@ import com.hai.order.model.ExportOrderRefundModel; import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderService; -import com.hai.order.type.OrderChildGoodsType; -import com.hai.order.type.OrderChildStatus; -import com.hai.order.type.OrderPayType; -import com.hai.order.type.OrderRefundStatus; +import com.hai.order.type.*; import com.hai.order.utils.OrderUtil; import com.web.config.SysConst; import io.swagger.annotations.Api; @@ -72,7 +70,16 @@ public class OrderRefundController { if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); } - orderService.refundOrder(body.getString("orderNo"), body.getString("remarks")); + // 查询订单 + HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); + } + if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) + && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); + } + orderService.refundOrder(order, body.getString("remarks")); return ResponseMsgUtil.success("退款成功"); @@ -122,7 +129,6 @@ public class OrderRefundController { if (userModel == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.USE_VISIT_ILLEGAL, ""); } - return ResponseMsgUtil.success(orderRefundService.getRefundByRefundNo(refundOrderNo)); } catch (Exception e) { diff --git a/hai-order/src/main/java/com/web/controller/TestController.java b/hai-order/src/main/java/com/web/controller/TestController.java index 26f9fbf9..58b9019d 100644 --- a/hai-order/src/main/java/com/web/controller/TestController.java +++ b/hai-order/src/main/java/com/web/controller/TestController.java @@ -1 +1 @@ -package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.*; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import com.hai.order.type.OrderStatus; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; 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.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file +package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.*; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import com.hai.order.type.OrderStatus; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; 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.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { // orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file diff --git a/hai-order/src/main/java/com/web/controller/business/OrderOilController.java b/hai-order/src/main/java/com/web/controller/business/OrderOilController.java index 07418301..f143fba6 100644 --- a/hai-order/src/main/java/com/web/controller/business/OrderOilController.java +++ b/hai-order/src/main/java/com/web/controller/business/OrderOilController.java @@ -311,7 +311,7 @@ public class OrderOilController { model.setDeductionCouponPrice(gasOrder.getDeductionCouponPrice()); model.setDeductionProductPrice(gasOrder.getDeductionProductPrice()); model.setPayablePrice(gasOrder.getPayablePrice()); - model.setPayGold(gasOrder.getPayGold()/100); + model.setPayGold(gasOrder.getPayGold()==null?null:gasOrder.getPayGold()/100); model.setPayPrice(gasOrder.getPayPrice()!=null?gasOrder.getPayPrice().toString():"未支付"); model.setStatus(OrderOilStatus.getNameByType(gasOrder.getStatus())); model.setCreateTime(gasOrder.getCreateTime()); diff --git a/hai-order/src/main/java/com/web/rocketmq/consumer/OrderCancelConsumer.java b/hai-order/src/main/java/com/web/rocketmq/consumer/OrderCancelConsumer.java index 3d83c4d7..a0acf6f0 100644 --- a/hai-order/src/main/java/com/web/rocketmq/consumer/OrderCancelConsumer.java +++ b/hai-order/src/main/java/com/web/rocketmq/consumer/OrderCancelConsumer.java @@ -23,7 +23,7 @@ public class OrderCancelConsumer implements RocketMQListener { HighOrder highOrder = orderService.getOrderDetailByNo(order.getOrderNo()); if (highOrder != null && highOrder.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { // 取消订单 - orderService.cancelOrder(order.getOrderNo(), null); + orderService.cancelOrder(highOrder, null); } } } 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 2488c41f..469ee012 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 @@ -38,19 +38,19 @@ public interface OrderService { /** * 订单取消 - * @param orderNo 订单号 + * @param order 订单 * @param remarks 备注 * @return */ - HighOrder cancelOrder(String orderNo,String remarks); + HighOrder cancelOrder(HighOrder order,String remarks); /** * 订单退款 - * @param orderNo + * @param order * @param remarks * @return */ - HighOrder refundOrder(String orderNo,String remarks) throws Exception; + HighOrder refundOrder(HighOrder order,String remarks) 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 26f2cff9..8b0c65ad 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 @@ -443,8 +443,8 @@ public class OrderServiceImpl implements OrderService { isolation = Isolation.READ_COMMITTED, timeout = 10, rollbackFor = Exception.class) - public HighOrder cancelOrder(String orderNo,String remarks) { - HighOrder order = getOrderDetailByNo(orderNo); + @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") + public HighOrder cancelOrder(HighOrder order,String remarks) { if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } @@ -497,8 +497,8 @@ public class OrderServiceImpl implements OrderService { isolation = Isolation.READ_COMMITTED, timeout = 10, rollbackFor = Exception.class) - public HighOrder refundOrder(String orderNo, String remarks) throws Exception { - HighOrder order = getOrderDetailByNo(orderNo); + @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") + public HighOrder refundOrder(HighOrder order, String remarks) throws Exception { if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); From 52ec76f5a7be5967a4461f2c6b826daf181466b6 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 1 Nov 2022 16:06:24 +0800 Subject: [PATCH 2/5] =?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 --- .../java/com/web/controller/OrderPayNotifyController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java index bbd7abae..4186d970 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java @@ -78,6 +78,10 @@ public class OrderPayNotifyController { } log.info("处理业务完成"); + // 通知微信.异步确认成功.必写.不然会一直通知后台.八次之后就认为交易失败了 + resXml = "" + "" + + "" + " "; + BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); out.write(resXml.getBytes()); out.flush(); From 8effa3270b3629348310dee440f24d20b5f12dd9 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 1 Nov 2022 17:47:14 +0800 Subject: [PATCH 3/5] =?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 --- .../controller/OrderPayNotifyController.java | 3 +- .../com/hai/dao/HighOrderRefundMapper.java | 39 ++++++----- .../hai/dao/HighOrderRefundSqlProvider.java | 14 ++++ .../java/com/hai/entity/HighOrderRefund.java | 16 +++++ .../hai/entity/HighOrderRefundExample.java | 70 +++++++++++++++++++ .../impl/OrderPaySuccessServiceImpl.java | 8 ++- .../order/service/impl/OrderServiceImpl.java | 9 +-- 7 files changed, 136 insertions(+), 23 deletions(-) diff --git a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java index 4186d970..633390eb 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayNotifyController.java @@ -72,7 +72,8 @@ public class OrderPayNotifyController { if (order != null && order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { // 处理订单业务 paySuccessService.orderPaySuccessHandle(map.get("out_trade_no"), - OrderPayType.PAY_TYPE2, map.get("out_trade_no"), + OrderPayType.PAY_TYPE2, + map.get("transaction_id"), new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100")), null); } diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java b/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java index 0d36b8fe..b7100049 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderRefundMapper.java @@ -46,13 +46,14 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "goods_name, goods_desc, ", "goods_img, goods_spec_name, ", "goods_count, refund_order_no, ", - "return_total_price, refund_goods_num, ", - "refund_price, refund_integral, ", - "refund_remark, refund_status, ", - "refund_fail_reason, create_time, ", - "refund_time, update_time, ", - "ext_1, ext_2, ext_3, ", - "ext_4, ext_5, ext_6)", + "third_party_refund_order_no, return_total_price, ", + "refund_goods_num, refund_price, ", + "refund_integral, refund_remark, ", + "refund_status, refund_fail_reason, ", + "create_time, refund_time, ", + "update_time, ext_1, ", + "ext_2, ext_3, ext_4, ", + "ext_5, ext_6)", "values (#{orderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ", "#{orderChildId,jdbcType=BIGINT}, #{orderChildNo,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ", @@ -60,13 +61,14 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "#{goodsName,jdbcType=VARCHAR}, #{goodsDesc,jdbcType=VARCHAR}, ", "#{goodsImg,jdbcType=VARCHAR}, #{goodsSpecName,jdbcType=VARCHAR}, ", "#{goodsCount,jdbcType=INTEGER}, #{refundOrderNo,jdbcType=VARCHAR}, ", - "#{returnTotalPrice,jdbcType=DECIMAL}, #{refundGoodsNum,jdbcType=INTEGER}, ", - "#{refundPrice,jdbcType=DECIMAL}, #{refundIntegral,jdbcType=INTEGER}, ", - "#{refundRemark,jdbcType=VARCHAR}, #{refundStatus,jdbcType=INTEGER}, ", - "#{refundFailReason,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{refundTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{thirdPartyRefundOrderNo,jdbcType=VARCHAR}, #{returnTotalPrice,jdbcType=DECIMAL}, ", + "#{refundGoodsNum,jdbcType=INTEGER}, #{refundPrice,jdbcType=DECIMAL}, ", + "#{refundIntegral,jdbcType=INTEGER}, #{refundRemark,jdbcType=VARCHAR}, ", + "#{refundStatus,jdbcType=INTEGER}, #{refundFailReason,jdbcType=VARCHAR}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", + "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighOrderRefund record); @@ -93,6 +95,7 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { @Result(column="goods_spec_name", property="goodsSpecName", jdbcType=JdbcType.VARCHAR), @Result(column="goods_count", property="goodsCount", jdbcType=JdbcType.INTEGER), @Result(column="refund_order_no", property="refundOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="third_party_refund_order_no", property="thirdPartyRefundOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="return_total_price", property="returnTotalPrice", jdbcType=JdbcType.DECIMAL), @Result(column="refund_goods_num", property="refundGoodsNum", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @@ -116,9 +119,9 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "select", "id, order_id, order_no, order_child_id, order_child_no, mem_id, mem_name, mem_phone, ", "goods_type, goods_id, goods_name, goods_desc, goods_img, goods_spec_name, goods_count, ", - "refund_order_no, return_total_price, refund_goods_num, refund_price, refund_integral, ", - "refund_remark, refund_status, refund_fail_reason, create_time, refund_time, ", - "update_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", + "refund_order_no, third_party_refund_order_no, return_total_price, refund_goods_num, ", + "refund_price, refund_integral, refund_remark, refund_status, refund_fail_reason, ", + "create_time, refund_time, update_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from high_order_refund", "where id = #{id,jdbcType=BIGINT}" }) @@ -139,6 +142,7 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { @Result(column="goods_spec_name", property="goodsSpecName", jdbcType=JdbcType.VARCHAR), @Result(column="goods_count", property="goodsCount", jdbcType=JdbcType.INTEGER), @Result(column="refund_order_no", property="refundOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="third_party_refund_order_no", property="thirdPartyRefundOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="return_total_price", property="returnTotalPrice", jdbcType=JdbcType.DECIMAL), @Result(column="refund_goods_num", property="refundGoodsNum", jdbcType=JdbcType.INTEGER), @Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL), @@ -184,6 +188,7 @@ public interface HighOrderRefundMapper extends HighOrderRefundMapperExt { "goods_spec_name = #{goodsSpecName,jdbcType=VARCHAR},", "goods_count = #{goodsCount,jdbcType=INTEGER},", "refund_order_no = #{refundOrderNo,jdbcType=VARCHAR},", + "third_party_refund_order_no = #{thirdPartyRefundOrderNo,jdbcType=VARCHAR},", "return_total_price = #{returnTotalPrice,jdbcType=DECIMAL},", "refund_goods_num = #{refundGoodsNum,jdbcType=INTEGER},", "refund_price = #{refundPrice,jdbcType=DECIMAL},", diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java index dd868b96..0667e007 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderRefundSqlProvider.java @@ -88,6 +88,10 @@ public class HighOrderRefundSqlProvider { sql.VALUES("refund_order_no", "#{refundOrderNo,jdbcType=VARCHAR}"); } + if (record.getThirdPartyRefundOrderNo() != null) { + sql.VALUES("third_party_refund_order_no", "#{thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); + } + if (record.getReturnTotalPrice() != null) { sql.VALUES("return_total_price", "#{returnTotalPrice,jdbcType=DECIMAL}"); } @@ -177,6 +181,7 @@ public class HighOrderRefundSqlProvider { sql.SELECT("goods_spec_name"); sql.SELECT("goods_count"); sql.SELECT("refund_order_no"); + sql.SELECT("third_party_refund_order_no"); sql.SELECT("return_total_price"); sql.SELECT("refund_goods_num"); sql.SELECT("refund_price"); @@ -274,6 +279,10 @@ public class HighOrderRefundSqlProvider { sql.SET("refund_order_no = #{record.refundOrderNo,jdbcType=VARCHAR}"); } + if (record.getThirdPartyRefundOrderNo() != null) { + sql.SET("third_party_refund_order_no = #{record.thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); + } + if (record.getReturnTotalPrice() != null) { sql.SET("return_total_price = #{record.returnTotalPrice,jdbcType=DECIMAL}"); } @@ -362,6 +371,7 @@ public class HighOrderRefundSqlProvider { sql.SET("goods_spec_name = #{record.goodsSpecName,jdbcType=VARCHAR}"); sql.SET("goods_count = #{record.goodsCount,jdbcType=INTEGER}"); sql.SET("refund_order_no = #{record.refundOrderNo,jdbcType=VARCHAR}"); + sql.SET("third_party_refund_order_no = #{record.thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); sql.SET("return_total_price = #{record.returnTotalPrice,jdbcType=DECIMAL}"); sql.SET("refund_goods_num = #{record.refundGoodsNum,jdbcType=INTEGER}"); sql.SET("refund_price = #{record.refundPrice,jdbcType=DECIMAL}"); @@ -448,6 +458,10 @@ public class HighOrderRefundSqlProvider { sql.SET("refund_order_no = #{refundOrderNo,jdbcType=VARCHAR}"); } + if (record.getThirdPartyRefundOrderNo() != null) { + sql.SET("third_party_refund_order_no = #{thirdPartyRefundOrderNo,jdbcType=VARCHAR}"); + } + if (record.getReturnTotalPrice() != null) { sql.SET("return_total_price = #{returnTotalPrice,jdbcType=DECIMAL}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java b/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java index 3bab2d54..5459b65c 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderRefund.java @@ -104,6 +104,11 @@ public class HighOrderRefund implements Serializable { */ private String refundOrderNo; + /** + * 退款订单号第三方 + */ + private String thirdPartyRefundOrderNo; + /** * 退款总金额 */ @@ -299,6 +304,14 @@ public class HighOrderRefund implements Serializable { this.refundOrderNo = refundOrderNo; } + public String getThirdPartyRefundOrderNo() { + return thirdPartyRefundOrderNo; + } + + public void setThirdPartyRefundOrderNo(String thirdPartyRefundOrderNo) { + this.thirdPartyRefundOrderNo = thirdPartyRefundOrderNo; + } + public BigDecimal getReturnTotalPrice() { return returnTotalPrice; } @@ -455,6 +468,7 @@ public class HighOrderRefund implements Serializable { && (this.getGoodsSpecName() == null ? other.getGoodsSpecName() == null : this.getGoodsSpecName().equals(other.getGoodsSpecName())) && (this.getGoodsCount() == null ? other.getGoodsCount() == null : this.getGoodsCount().equals(other.getGoodsCount())) && (this.getRefundOrderNo() == null ? other.getRefundOrderNo() == null : this.getRefundOrderNo().equals(other.getRefundOrderNo())) + && (this.getThirdPartyRefundOrderNo() == null ? other.getThirdPartyRefundOrderNo() == null : this.getThirdPartyRefundOrderNo().equals(other.getThirdPartyRefundOrderNo())) && (this.getReturnTotalPrice() == null ? other.getReturnTotalPrice() == null : this.getReturnTotalPrice().equals(other.getReturnTotalPrice())) && (this.getRefundGoodsNum() == null ? other.getRefundGoodsNum() == null : this.getRefundGoodsNum().equals(other.getRefundGoodsNum())) && (this.getRefundPrice() == null ? other.getRefundPrice() == null : this.getRefundPrice().equals(other.getRefundPrice())) @@ -493,6 +507,7 @@ public class HighOrderRefund implements Serializable { result = prime * result + ((getGoodsSpecName() == null) ? 0 : getGoodsSpecName().hashCode()); result = prime * result + ((getGoodsCount() == null) ? 0 : getGoodsCount().hashCode()); result = prime * result + ((getRefundOrderNo() == null) ? 0 : getRefundOrderNo().hashCode()); + result = prime * result + ((getThirdPartyRefundOrderNo() == null) ? 0 : getThirdPartyRefundOrderNo().hashCode()); result = prime * result + ((getReturnTotalPrice() == null) ? 0 : getReturnTotalPrice().hashCode()); result = prime * result + ((getRefundGoodsNum() == null) ? 0 : getRefundGoodsNum().hashCode()); result = prime * result + ((getRefundPrice() == null) ? 0 : getRefundPrice().hashCode()); @@ -534,6 +549,7 @@ public class HighOrderRefund implements Serializable { sb.append(", goodsSpecName=").append(goodsSpecName); sb.append(", goodsCount=").append(goodsCount); sb.append(", refundOrderNo=").append(refundOrderNo); + sb.append(", thirdPartyRefundOrderNo=").append(thirdPartyRefundOrderNo); sb.append(", returnTotalPrice=").append(returnTotalPrice); sb.append(", refundGoodsNum=").append(refundGoodsNum); sb.append(", refundPrice=").append(refundPrice); diff --git a/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java b/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java index 3e6740c1..0908b192 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrderRefundExample.java @@ -1176,6 +1176,76 @@ public class HighOrderRefundExample { return (Criteria) this; } + public Criteria andThirdPartyRefundOrderNoIsNull() { + addCriterion("third_party_refund_order_no is null"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoIsNotNull() { + addCriterion("third_party_refund_order_no is not null"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoEqualTo(String value) { + addCriterion("third_party_refund_order_no =", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotEqualTo(String value) { + addCriterion("third_party_refund_order_no <>", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoGreaterThan(String value) { + addCriterion("third_party_refund_order_no >", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoGreaterThanOrEqualTo(String value) { + addCriterion("third_party_refund_order_no >=", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoLessThan(String value) { + addCriterion("third_party_refund_order_no <", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoLessThanOrEqualTo(String value) { + addCriterion("third_party_refund_order_no <=", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoLike(String value) { + addCriterion("third_party_refund_order_no like", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotLike(String value) { + addCriterion("third_party_refund_order_no not like", value, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoIn(List values) { + addCriterion("third_party_refund_order_no in", values, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotIn(List values) { + addCriterion("third_party_refund_order_no not in", values, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoBetween(String value1, String value2) { + addCriterion("third_party_refund_order_no between", value1, value2, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + + public Criteria andThirdPartyRefundOrderNoNotBetween(String value1, String value2) { + addCriterion("third_party_refund_order_no not between", value1, value2, "thirdPartyRefundOrderNo"); + return (Criteria) this; + } + public Criteria andReturnTotalPriceIsNull() { addCriterion("return_total_price is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 2e76ea33..c1398d32 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -101,7 +101,13 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { order.setPayRealPrice(payRealPrice); order.setPayTime(new Date()); order.setPayType(payType != null?payType.getNumber():null); - order.setOrderStatus(OrderStatusEnum.type2.getType()); + + if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { + order.setOrderStatus(OrderStatusEnum.type3.getType()); + } else { + order.setOrderStatus(OrderStatusEnum.type2.getType()); + } + if (userCard != null) { order.setMemCardId(userCard.getId()); order.setMemCardNo(userCard.getCardNo()); 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 8b0c65ad..1cfac1d2 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 @@ -532,13 +532,13 @@ public class OrderServiceImpl implements OrderService { order.setRefundTime(new Date()); order.setOrderStatus(OrderStatus.STATUS4.getNumber()); - // todo 退款金额,原路返回 + // 退回金额,原路返回 RefundPriceModel refundPrice = orderRefundService.refundPrice(refundOrderNo , order , OrderPayType.getDataByType(order.getPayType()) , order.getPayRealPrice() , order.getPayGold()); - if (refundPrice.getRefundSuccess() == true) { + if (refundPrice.getRefundSuccess() == false) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); } @@ -546,6 +546,7 @@ public class OrderServiceImpl implements OrderService { for (HighOrderRefund orderRefund : refundList) { orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber()); orderRefund.setRefundTime(new Date()); + orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo()); orderRefundService.update(orderRefund); rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_REFUND_SUCCESS.getTopic(), orderRefund); @@ -580,13 +581,13 @@ public class OrderServiceImpl implements OrderService { orderChild.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); } - // todo 退款金额,原路返回 + // 退回金额,原路返回 RefundPriceModel refundPrice = orderRefundService.refundPrice(orderRefund.getRefundOrderNo() , order , OrderPayType.getDataByType(order.getPayType()) , orderRefund.getRefundPrice() , orderRefund.getRefundIntegral()); - if (!refundPrice.getRefundSuccess() == true) { + if (refundPrice.getRefundSuccess() == false) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); } From 58fbeb01ad2540bb12ebb71cc9af7ae18b592e23 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 2 Nov 2022 11:27:52 +0800 Subject: [PATCH 4/5] =?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/OrderCouponController.java | 59 +++++++++++++------ .../com/hai/dao/order/OrderMapperExt.java | 7 +++ .../com/hai/order/model/OrderCouponModel.java | 12 ++++ .../impl/OrderCreateHandleServiceImpl.java | 2 +- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java b/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java index 90572cb4..4122c717 100644 --- a/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java +++ b/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java @@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; +import java.lang.reflect.Field; import java.math.BigDecimal; import java.util.*; @@ -60,20 +61,23 @@ public class OrderCouponController { @RequestMapping(value = "/getOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询卡券订单列表") - public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "memPhone", required = false) String memPhone, - @RequestParam(name = "couponName", required = false) String couponName, - @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 = "finishTimeS", required = false) Long finishTimeS, - @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + public ResponseData getOrderList(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "couponKey", required = false) String couponKey, + @RequestParam(name = "couponName", required = false) String couponName, + @RequestParam(name = "couponSource", required = false) String couponSource, + @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 = "finishTimeS", required = false) Long finishTimeS, + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); @@ -83,16 +87,20 @@ public class OrderCouponController { Map map = new HashMap<>(); if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + map.put("companyId", companyId); } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { - map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); + map.put("companyId", userInfoModel.getBsCompany().getId()); + } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); } map.put("orderNo", orderNo); map.put("memPhone", memPhone); + map.put("couponKey", couponKey); map.put("couponName", couponName); + map.put("couponSource", couponSource); map.put("payType", payType); map.put("orderStatus", orderStatus); map.put("createTimeS", createTimeS); @@ -116,9 +124,12 @@ public class OrderCouponController { @RequestMapping(value = "/exportOrderCouponExcel", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "导出卡券订单") - public ResponseData exportOrderCouponExcel(@RequestParam(name = "orderNo", required = false) String orderNo, + public ResponseData exportOrderCouponExcel(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "orderNo", required = false) String orderNo, @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "couponKey", required = false) String couponKey, @RequestParam(name = "couponName", required = false) String couponName, + @RequestParam(name = "couponSource", required = false) String couponSource, @RequestParam(name = "payType", required = false) Integer payType, @RequestParam(name = "orderStatus", required = false) Integer orderStatus, @RequestParam(name = "createTimeS", required = false) Long createTimeS, @@ -136,15 +147,20 @@ public class OrderCouponController { } Map map = new HashMap<>(); if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + map.put("companyId", companyId); } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { - map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); + map.put("companyId", userInfoModel.getBsCompany().getId()); + } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); } + map.put("orderNo", orderNo); map.put("memPhone", memPhone); + map.put("couponKey", couponKey); map.put("couponName", couponName); + map.put("couponSource", couponSource); map.put("payType", payType); map.put("orderStatus", orderStatus); map.put("createTimeS", createTimeS); @@ -156,8 +172,17 @@ public class OrderCouponController { List list = orderServiceExt.getOrderCouponList(map); + Set includeColumnFiledNames = new HashSet(); + for (Field field : OrderCouponModel.class.getDeclaredFields()) { + includeColumnFiledNames.add(field.getName()); + } + if (!userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + includeColumnFiledNames.remove("companyName"); + } + String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; EasyExcel.write(SysConst.getSysConfig().getFileUrl() + fileName, OrderCouponModel.class) + .includeColumnFiledNames(includeColumnFiledNames) .sheet("卡券订单") .doWrite(list); diff --git a/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java index c9600008..a0d47fcf 100644 --- a/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java @@ -26,8 +26,11 @@ public interface OrderMapperExt { @Select({"