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] =?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({"