| | |
| | | package com.xzx.gc.shop.controller; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.dto.log.OperationAppLog; |
| | | import com.xzx.gc.common.exception.RestException; |
| | | import com.xzx.gc.common.request.BaseController; |
| | | import com.xzx.gc.entity.JhyInfo; |
| | | import com.xzx.gc.entity.JhyOrder; |
| | | import com.xzx.gc.model.JsonResult; |
| | | import com.xzx.gc.shop.dto.QueryGoodsListDto; |
| | | import com.xzx.gc.shop.dto.QueryJhyOrderListDto; |
| | | import com.xzx.gc.shop.dto.ViewGoodsDto; |
| | | import com.xzx.gc.shop.dto.ViewJhyOrderDto; |
| | | import com.xzx.gc.shop.dto.*; |
| | | import com.xzx.gc.shop.mapper.JhyOrderMapper; |
| | | import com.xzx.gc.shop.service.JhyService; |
| | | import com.xzx.gc.shop.vo.*; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @Resource |
| | | JhyService jhyService; |
| | | |
| | | @Resource |
| | | JhyOrderMapper jhyOrderMapper; |
| | | |
| | | /** |
| | | * 订单列表 |
| | |
| | | return JsonResult.success(viewJhyOrderVo); |
| | | } |
| | | |
| | | /** |
| | | * 取消订单 |
| | | */ |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/score/jhy/cancelJhyOrder.json") |
| | | @ApiOperation(value="集物员订单管理-取消订单", notes="test: 仅0有正确返回") |
| | | public JsonResult cancelJhyOrder(@RequestBody CancelJhyOrderDto model, HttpServletRequest request) { |
| | | long id = model.getId(); |
| | | JhyOrder jhyOrder = jhyOrderMapper.selectByPrimaryKey(id); |
| | | if(ObjectUtil.isEmpty(jhyOrder)){ |
| | | return JsonResult.failMessage("当前记录不存在!"); |
| | | } |
| | | Integer status = jhyOrder.getStatus(); |
| | | if(JhyOrder.ORDER_STATUS_WAITING != status){ |
| | | return JsonResult.failMessage("订单不是待接单状态,不允许取消!"); |
| | | } |
| | | jhyService.cancelJhyOrder(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("集物员管理-取消订单-" + id).build(); |
| | | mqUtil.sendApp(build); |
| | | return JsonResult.success("操作成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 指派订单 |
| | | */ |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/score/jhy/assignJhyOrder.json") |
| | | @ApiOperation(value="集物员订单管理-指派订单", notes="test: 仅0有正确返回") |
| | | public JsonResult assignJhyOrder(@RequestBody AssignJhyOrderDto model, HttpServletRequest request) { |
| | | long orderId = model.getOrderId(); |
| | | JhyOrder jhyOrder = jhyOrderMapper.selectByPrimaryKey(orderId); |
| | | if(ObjectUtil.isEmpty(jhyOrder)){ |
| | | return JsonResult.failMessage("当前记录不存在!"); |
| | | } |
| | | Integer status = jhyOrder.getStatus(); |
| | | if(JhyOrder.ORDER_STATUS_WAITING != status){ |
| | | return JsonResult.failMessage("订单不是待接单状态,不允许指派!"); |
| | | } |
| | | long jhyId = model.getJhyId(); |
| | | JhyInfo jhyInfo = jhyOrderMapper.selectJhyInfoByUserId(jhyId); |
| | | if (jhyInfo == null || !JhyInfo.CHECK_PASS.equals(jhyInfo.getStatus())) { |
| | | return JsonResult.failMessage("不是集货员!"); |
| | | } |
| | | jhyService.assignJhyOrder(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("集物员管理-指派订单-" + orderId).build(); |
| | | mqUtil.sendApp(build); |
| | | return JsonResult.success("操作成功!"); |
| | | } |
| | | |
| | | |
| | | } |