|
|
|
|
@ -7,15 +7,36 @@ import com.ghy.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ghy.common.core.page.TableDataInfo;
|
|
|
|
|
import com.ghy.common.enums.BusinessType;
|
|
|
|
|
import com.ghy.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ghy.customer.domain.Customer;
|
|
|
|
|
import com.ghy.customer.domain.CustomerAddress;
|
|
|
|
|
import com.ghy.customer.service.CustomerAddressService;
|
|
|
|
|
import com.ghy.customer.service.CustomerService;
|
|
|
|
|
import com.ghy.goods.domain.Goods;
|
|
|
|
|
import com.ghy.goods.domain.GoodsStandard;
|
|
|
|
|
import com.ghy.goods.service.GoodsService;
|
|
|
|
|
import com.ghy.goods.service.GoodsStandardService;
|
|
|
|
|
import com.ghy.order.domain.OrderDetail;
|
|
|
|
|
import com.ghy.order.domain.OrderGoods;
|
|
|
|
|
import com.ghy.order.domain.OrderMaster;
|
|
|
|
|
import com.ghy.order.service.OrderDetailService;
|
|
|
|
|
import com.ghy.order.service.OrderGoodsService;
|
|
|
|
|
import com.ghy.order.service.OrderMasterService;
|
|
|
|
|
import com.ghy.payment.domain.FinancialDetail;
|
|
|
|
|
import com.ghy.payment.domain.FinancialMaster;
|
|
|
|
|
import com.ghy.payment.service.FinancialDetailService;
|
|
|
|
|
import com.ghy.web.pojo.vo.OrderListResponse;
|
|
|
|
|
import com.ghy.web.pojo.vo.OrderStandard;
|
|
|
|
|
import com.ghy.worker.domain.Worker;
|
|
|
|
|
import com.ghy.worker.service.WorkerService;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -31,6 +52,22 @@ public class OrderDetailController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderDetailService orderDetailService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private OrderMasterService orderMasterService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CustomerService customerService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WorkerService workerService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private OrderGoodsService orderGoodsService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CustomerAddressService addressService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private GoodsService goodsService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private GoodsStandardService goodsStandardService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private FinancialDetailService financialDetailService;
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("order:detail:view")
|
|
|
|
|
@GetMapping()
|
|
|
|
|
@ -47,6 +84,72 @@ public class OrderDetailController extends BaseController {
|
|
|
|
|
return getDataTable(orderDetailList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/app/list")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public TableDataInfo appList(OrderDetail orderDetail){
|
|
|
|
|
|
|
|
|
|
startPage();
|
|
|
|
|
List<OrderListResponse> orderListResponses = new ArrayList<>();
|
|
|
|
|
List<OrderDetail> list = orderDetailService.selectOrderDetailList(orderDetail);
|
|
|
|
|
list.forEach(detail->{
|
|
|
|
|
|
|
|
|
|
// 主单信息
|
|
|
|
|
OrderMaster orderMaster = orderMasterService.selectById(detail.getOrderMasterId());
|
|
|
|
|
// 初始化属性
|
|
|
|
|
OrderListResponse orderListResponse = new OrderListResponse();
|
|
|
|
|
List<OrderStandard> standardList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// 师傅信息
|
|
|
|
|
Worker worker = workerService.selectById(detail.getWorkerId());
|
|
|
|
|
|
|
|
|
|
// 消费者信息
|
|
|
|
|
Customer customer = customerService.selectByCustomerId(detail.getCustomerId());
|
|
|
|
|
|
|
|
|
|
// 商品规格及信息
|
|
|
|
|
List<OrderGoods> orderStandardList = orderGoodsService.selectByOrderMasterId(detail.getId());
|
|
|
|
|
|
|
|
|
|
// 商品信息
|
|
|
|
|
GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId());
|
|
|
|
|
|
|
|
|
|
Goods goods = goodsService.selectById(goodsStandard.getGoodsId());
|
|
|
|
|
|
|
|
|
|
// 财务信息
|
|
|
|
|
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId());
|
|
|
|
|
|
|
|
|
|
// 地址信息
|
|
|
|
|
CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId());
|
|
|
|
|
|
|
|
|
|
for(OrderGoods orderGoods : orderStandardList){
|
|
|
|
|
OrderStandard orderStandard = new OrderStandard();
|
|
|
|
|
orderStandard.setStandardName(orderGoods.getGoodsName());
|
|
|
|
|
orderStandard.setStandardNum(orderGoods.getGoodsNum());
|
|
|
|
|
standardList.add(orderStandard);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑返回属性
|
|
|
|
|
orderListResponse.setOrderMasterId(detail.getId());
|
|
|
|
|
orderListResponse.setGoodsName(goods.getGoodsName());
|
|
|
|
|
orderListResponse.setGoodsLogoUrl(goods.getGoodsImgUrl());
|
|
|
|
|
orderListResponse.setDiscountMoney(financialDetail.getDiscountMoney());
|
|
|
|
|
orderListResponse.setTotalMoney(financialDetail.getTotalMoney());
|
|
|
|
|
orderListResponse.setPayMoney(financialDetail.getPayMoney());
|
|
|
|
|
orderListResponse.setWorkerName(worker.getName());
|
|
|
|
|
orderListResponse.setWorkerPhone(worker.getPhone());
|
|
|
|
|
orderListResponse.setCustomerName(customer.getName());
|
|
|
|
|
orderListResponse.setCustomerPhone(customer.getPhone());
|
|
|
|
|
orderListResponse.setServerTime(detail.getWorkBeginTime());
|
|
|
|
|
orderListResponse.setOrderStatus(detail.getOrderStatus());
|
|
|
|
|
orderListResponse.setPayStatus(orderMaster.getPayStatus());
|
|
|
|
|
orderListResponse.setPayType(orderMaster.getPayType());
|
|
|
|
|
orderListResponse.setOrderMasterCode(detail.getCode());
|
|
|
|
|
orderListResponse.setStandardList(standardList);
|
|
|
|
|
orderListResponse.setAddress(customerAddress.getAddress());
|
|
|
|
|
orderListResponses.add(orderListResponse);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
return voDataTable(orderListResponses, list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(title = "详细订单管理", businessType = BusinessType.EXPORT)
|
|
|
|
|
@RequiresPermissions("order:detail:export")
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
|