From 3c00cb133f3b0726ef5047d508b413bebff26677 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 28 Oct 2022 09:31:19 +0800 Subject: [PATCH] 1 --- .../business/OrderThirdPartyController.java | 106 ++++++++++++++++++ .../main/java/com/hai/model/UserModel.java | 2 +- .../order/service/impl/OrderServiceImpl.java | 35 +++++- 3 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java diff --git a/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java b/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java new file mode 100644 index 00000000..546a5ec6 --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java @@ -0,0 +1,106 @@ +package com.web.controller.business; + +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.ResponseMsgUtil; +import com.hai.entity.HighOrder; +import com.hai.enum_type.UserObjectTypeEnum; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.order.service.OrderService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +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 javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping(value = "thirdParty") +@Api(value = "第三方订单业务") +public class OrderThirdPartyController { + + private static Logger log = LoggerFactory.getLogger(OrderOilController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private OrderService orderService; + + + @RequestMapping(value = "/getOrderKfcList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询肯德基订单列表") + public ResponseData getOrderKfcList(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "memCardNo", required = false) String memCardNo, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @RequestParam(name = "companyId", required = false) Long companyId, + @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); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + 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("companyId", userInfoModel.getBsCompany().getId()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + if (createTimeS != null && createTimeE != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } + if (createTimeS != null && createTimeE != null) { + map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS)); + map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); + } + if (createTimeS != null && createTimeE != null) { + map.put("finishTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(finishTimeS)); + map.put("finishTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(finishTimeE)); + } + map.put("orderNo", orderNo); + map.put("memPhone", memPhone); + map.put("memCardNo", memCardNo); + map.put("productType", 2); + map.put("orderStatus", orderStatus); + map.put("payType", payType); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map))); + + } catch (Exception e) { + log.error("OrderCouponController --> getOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-service/src/main/java/com/hai/model/UserModel.java b/hai-service/src/main/java/com/hai/model/UserModel.java index ed71bc41..962f334f 100644 --- a/hai-service/src/main/java/com/hai/model/UserModel.java +++ b/hai-service/src/main/java/com/hai/model/UserModel.java @@ -20,7 +20,7 @@ public class UserModel { // 待支付数量 private Long unpaid; - // 待支付数量 + // 待查看数量 private Long whetherCheckNum; // 支付数量 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 9bc1bcb7..d00e1569 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 @@ -8,6 +8,7 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.AESEncodeUtil; +import com.hai.common.utils.DateUtil; import com.hai.dao.HighChildOrderMapper; import com.hai.dao.HighOrderMapper; import com.hai.entity.*; @@ -204,7 +205,7 @@ public class OrderServiceImpl implements OrderService { List couponOrderList = orderCreateHandleService.thirdPartyOrder(object); childOrderList = couponOrderList; for (HighChildOrder childOrder : couponOrderList) { - if (StringUtils.isBlank(order.getSearchTitle())) { + if (StringUtils.isBlank(order.getTitle())) { order.setTitle(childOrder.getGoodsName()); } else { order.setTitle("+"+childOrder.getGoodsName()); @@ -239,7 +240,7 @@ public class OrderServiceImpl implements OrderService { List couponOrderList = orderCreateHandleService.thirdPartyOrder(object); childOrderList = couponOrderList; for (HighChildOrder childOrder : couponOrderList) { - if (StringUtils.isBlank(order.getSearchTitle())) { + if (StringUtils.isBlank(order.getTitle())) { order.setTitle(childOrder.getGoodsName()); } else { order.setTitle("+"+childOrder.getGoodsName()); @@ -252,7 +253,7 @@ public class OrderServiceImpl implements OrderService { List couponOrderList = orderCreateHandleService.thirdPartyOrder(object); childOrderList = couponOrderList; for (HighChildOrder childOrder : couponOrderList) { - if (StringUtils.isBlank(order.getSearchTitle())) { + if (StringUtils.isBlank(order.getTitle())) { order.setTitle(childOrder.getGoodsName()); } else { order.setTitle("+"+childOrder.getGoodsName()); @@ -630,6 +631,10 @@ public class OrderServiceImpl implements OrderService { criteria.andMemIdEqualTo(MapUtils.getLong(param, "userId")); } + if (MapUtils.getLong(param, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(param, "companyId")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "title"))) { criteria.andTitleEqualTo("%" + MapUtils.getString(param, "title") + "%"); } @@ -645,10 +650,34 @@ public class OrderServiceImpl implements OrderService { if (MapUtils.getInteger(param, "productType") != null) { criteria.andProductTypeEqualTo(MapUtils.getInteger(param, "productType")); } + if (MapUtils.getInteger(param, "payType") != null) { + criteria.andPayTypeEqualTo(MapUtils.getInteger(param, "payType")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "memCardNo"))) { + criteria.andMemCardNoLike("%" + MapUtils.getString(param, "memCardNo") + "%"); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "memPhone"))) { + criteria.andMemPhoneLike("%" + MapUtils.getString(param, "memPhone") + "%"); + } if (MapUtils.getInteger(param, "status") != null) { criteria.andOrderStatusEqualTo(MapUtils.getInteger(param, "status")); } + if (StringUtils.isNotBlank(MapUtils.getString(param, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(param, "createTimeE"))) { + criteria.andCreateTimeBetween( + DateUtil.format(MapUtils.getString(param, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(param, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "payTimeS")) && StringUtils.isNotBlank(MapUtils.getString(param, "payTimeE"))) { + criteria.andPayTimeBetween( + DateUtil.format(MapUtils.getString(param, "payTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(param, "payTimeE"), "yyyy-MM-dd HH:mm:ss")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "finishTimeS")) && StringUtils.isNotBlank(MapUtils.getString(param, "finishTimeE"))) { + criteria.andFinishTimeBetween( + DateUtil.format(MapUtils.getString(param, "finishTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(param, "finishTimeE"), "yyyy-MM-dd HH:mm:ss")); + } example.setOrderByClause("create_time desc"); return orderMapper.selectByExample(example);