| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.matrix.component.asyncmessage.AsyncMessageManager; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | | import com.matrix.system.hive.dao.SysOrderItemDao; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.service.MoneyCardUseService; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.matrix.system.hive.service.SysShopInfoService; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.dto.PadShowListDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import com.matrix.system.shopXcx.mqTask.AsyncMessageRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | //默认排序 |
| | | if (StringUtils.isBlank(pageVo.getSort())) { |
| | | pageVo.setSort("order_time"); |
| | | } |
| | | if (StringUtils.isBlank(pageVo.getOrder())) { |
| | | pageVo.setOrder("desc"); |
| | | } |
| | | if (!DataAuthUtil.hasAllShopAuth()) { |
| | | orderListDto.setShopId(user.getShopId()); |
| | | orderListDto.setShopId(getMe().getShopId()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(orderListDto); |
| | | return AjaxResult.buildSuccessInstance(sysOrderService.findPadApiOrderListInPage(orderListDto, pageVo), |
| | | sysOrderService.findPadApiOrderListTotal(orderListDto)); |
| | | |
| | | SysOrder sysOrder = new SysOrder(); |
| | | sysOrder.setShopId(orderListDto.getShopId()); |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getOrderStatus())){ |
| | | sysOrder.setStatu(orderListDto.getStatus()); |
| | | } |
| | | |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getBeginTimeVo())){ |
| | | sysOrder.setBeginTimeVo(orderListDto.getBeginTimeVo()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getEndTimeVo())){ |
| | | sysOrder.setEndTimeVo(orderListDto.getEndTimeVo()); |
| | | } |
| | | |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getVipId())){ |
| | | sysOrder.setVipId(orderListDto.getVipId()); |
| | | } |
| | | if(StrUtil.isNotEmpty(orderListDto.getQueryKey())){ |
| | | sysOrder.setKeyWordVo(orderListDto.getQueryKey()); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, orderService.findInPage(sysOrder, pageVo), |
| | | orderService.findTotal(sysOrder)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取订单详情", notes = "获取订单详情") |
| | |
| | | @ApiOperation(value = "取消订单", notes = "取消订单") |
| | | @GetMapping(value = "/cancelOrder/{id}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult cancelOrder(Long id) { |
| | | public AjaxResult cancelOrder(@PathVariable Long id) { |
| | | |
| | | SysOrder order = orderService.findById(id); |
| | | if (ObjectUtil.isEmpty(order)) { |
| | |
| | | |
| | | @ApiOperation(value = "获取用户的可用充值卡", notes = "获取用户的可用充值卡") |
| | | @GetMapping(value = "getUseMoneyCard/{vipId}") |
| | | public AjaxResult getUseMoneyCard(Long vipId) { |
| | | public AjaxResult getUseMoneyCard(@PathVariable Long vipId) { |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(vipId); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | |
| | | |
| | | @ApiOperation(value = "列表显示搜索项目绑定的产品信息", notes = "列表显示搜索项目绑定的产品信息") |
| | | @PostMapping(value = "/showList") |
| | | public AjaxResult showList(@RequestBody ShoppingGoods shoppingGoods,@RequestBody PaginationVO pageVo) { |
| | | public AjaxResult showList(@RequestBody PadShowListDto padShowListDto) { |
| | | |
| | | int offset = (pageVo.getOffset() - 1) * pageVo.getLimit(); |
| | | int offset = (padShowListDto.getPageNum() - 1) * padShowListDto.getPageSize(); |
| | | int limit = padShowListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | QueryUtil.setQueryLimit(shoppingGoods); |
| | | pageVo.setLimit(limit); |
| | | |
| | | ShoppingGoods shoppingGoods = new ShoppingGoods(); |
| | | if(StrUtil.isNotEmpty(padShowListDto.getName())){ |
| | | shoppingGoods.setName(padShowListDto.getName()); |
| | | } |
| | | if(StrUtil.isNotEmpty(padShowListDto.getGoodType())){ |
| | | shoppingGoods.setGoodType(padShowListDto.getGoodType()); |
| | | } |
| | | // QueryUtil.setQueryLimit(shoppingGoods); |
| | | if(StringUtils.isBlank(pageVo.getSort())){ |
| | | pageVo.setOrder("desc"); |
| | | pageVo.setSort("createTime"); |
| | | } |
| | | //2表示查询总部产品 |
| | | if (shoppingGoods.getHeadquarters()!=null && 2==shoppingGoods.getHeadquarters()) { |
| | | //仅查询本店产品 |
| | | SysShopInfo zbShop = shopInfoDao.selectZbShop(getMe().getCompanyId()); |
| | | //如果是总部自己查询自己的库存则不需加入这个调价 |
| | | if (getMe().getShopId().equals(zbShop.getId())){ |
| | | // if (shoppingGoods.getHeadquarters()!=null && 2==shoppingGoods.getHeadquarters()) { |
| | | // //仅查询本店产品 |
| | | // SysShopInfo zbShop = shopInfoDao.selectZbShop(getMe().getCompanyId()); |
| | | // //如果是总部自己查询自己的库存则不需加入这个调价 |
| | | // if (getMe().getShopId().equals(zbShop.getId())){ |
| | | // shoppingGoods.setHeadquarters(1); |
| | | // } |
| | | // } |
| | | SysShopInfo zbShop = shopInfoDao.selectZbShop(getMe().getCompanyId()); |
| | | if (getMe().getShopId().equals(zbShop.getId())){ |
| | | shoppingGoods.setHeadquarters(1); |
| | | } |
| | | } |
| | | shoppingGoods.setIsDel(ShoppingGoods.NORMAL); |
| | | List<ShoppingGoods> dataList = shoppingGoodsService.findInPage(shoppingGoods, pageVo); |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Autowired |
| | | private SysOrderItemService orderItemService; |
| | | |
| | | @Autowired |
| | | private AchieveNewService achieveNewService; |
| | | |
| | | @Autowired |
| | | private SysVipInfoService sysVipInfoService; |
| | | |
| | | @Autowired |
| | | private SysOrderFlowService sysOrderFlowService; |
| | | |
| | | @ApiOperation(value = "列表进入详情", notes = "列表进入详情") |
| | | @PostMapping(value = "/findOrderDetailByIdOrNo") |
| | | public AjaxResult findOrderDetailByIdOrNo(@RequestBody SysOrder orderVo) { |
| | | // 根据id查到对应的订单信息 |
| | | SysOrder order = null; |
| | | if (orderVo.getId() != null) { |
| | | order = orderService.findById(orderVo.getId()); |
| | | } else if (StringUtils.isNotBlank(orderVo.getOrderNo())) { |
| | | List<SysOrder> byModel = orderService.findByModel(orderVo); |
| | | if (byModel.size() == 1) { |
| | | order = orderService.findById(byModel.get(0).getId()); |
| | | } |
| | | } |
| | | List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(order.getId()); |
| | | order.setItems(sysOrderItems); |
| | | |
| | | SysVipInfo vipInfo = sysVipInfoService.findById(order.getVipId()); |
| | | // 根据会员Id查到会员有效的会员卡 |
| | | // 根据订单号查找订单条目 |
| | | List<SysOrderItem> orderItems = orderItemService.findByOrderId(order.getId()); |
| | | |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(order.getVipId()); |
| | | List<MoneyCardUse> cards = cardUseService.findByModel(moneyCardUse); |
| | | |
| | | List<SysOrderFlow> flows = sysOrderFlowService.findByOrderId(order.getId()); |
| | | order.setFlows(flows); |
| | | |
| | | List<SysOrderFlow> payMethods = sysOrderFlowService.findPayMethodsAmount(order.getId()); |
| | | |
| | | List<AchieveNew> achieveList = achieveNewService.findOrderItemAchieve(order.getId()); |
| | | |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); |
| | | ajaxResult.putInMap("orderItems", orderItems); |
| | | ajaxResult.putInMap("order", order); |
| | | ajaxResult.putInMap("cards", cards); |
| | | ajaxResult.putInMap("vipInfo", vipInfo); |
| | | ajaxResult.putInMap("payMethods", payMethods); |
| | | ajaxResult.putInMap("achieveList", achieveList); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | |
| | | } |