|
|
|
@ -12,10 +12,14 @@ package com.huoran.nakadai.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.huoran.common.entity.UserAccount; |
|
|
|
|
import com.huoran.common.exception.YamiShopBindException; |
|
|
|
|
import com.huoran.common.response.ServerResponseEntity; |
|
|
|
|
import com.huoran.common.utils.SecurityUtils; |
|
|
|
|
import com.huoran.common.entity.EnterpriseCertification; |
|
|
|
|
import com.huoran.common.entity.UserAuthenticationInformation; |
|
|
|
|
import com.huoran.nakadai.entity.app.dto.MyOrderDto; |
|
|
|
|
import com.huoran.nakadai.entity.app.dto.OrderCountData; |
|
|
|
|
import com.huoran.nakadai.entity.app.dto.OrderItemDto; |
|
|
|
@ -24,7 +28,9 @@ import com.huoran.nakadai.entity.enums.OrderStatus; |
|
|
|
|
import com.huoran.nakadai.entity.model.Order; |
|
|
|
|
import com.huoran.nakadai.entity.model.OrderItem; |
|
|
|
|
import com.huoran.nakadai.entity.model.ShopDetail; |
|
|
|
|
import com.huoran.nakadai.entity.model.UserAddrOrder; |
|
|
|
|
import com.huoran.nakadai.entity.req.OrderPageReq; |
|
|
|
|
import com.huoran.nakadai.mapper.PlatformTeamAccountMapper; |
|
|
|
|
import com.huoran.nakadai.mapper.PlatformTeamClassificationMapper; |
|
|
|
|
import com.huoran.nakadai.service.*; |
|
|
|
|
import com.huoran.nakadai.utils.Arith; |
|
|
|
|
import com.huoran.nakadai.utils.PageParam; |
|
|
|
@ -32,6 +38,7 @@ import io.swagger.annotations.Api; |
|
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
@ -56,6 +63,18 @@ public class MyOrderController { |
|
|
|
|
|
|
|
|
|
private final MyOrderService myOrderService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private PlatformTeamClassificationMapper platformTeamClassificationMapper; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
public EnterpriseCertificationService enterpriseCertificationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
public UserAuthenticationInformationService userAuthenticationInformationService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private PlatformTeamAccountMapper platformTeamAccountMapper; |
|
|
|
|
|
|
|
|
|
private final ShopDetailService shopDetailService; |
|
|
|
|
|
|
|
|
|
private final OrderItemService orderItemService; |
|
|
|
@ -76,9 +95,9 @@ public class MyOrderController { |
|
|
|
|
if (order == null) { |
|
|
|
|
throw new RuntimeException("该订单不存在"); |
|
|
|
|
} |
|
|
|
|
if (!Objects.equals(order.getUserId(), userId)) { |
|
|
|
|
throw new RuntimeException("你没有权限获取该订单信息"); |
|
|
|
|
} |
|
|
|
|
// if (!Objects.equals(order.getUserId(), userId)) {
|
|
|
|
|
// throw new RuntimeException("你没有权限获取该订单信息");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(order.getShopId()); |
|
|
|
|
// UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId());
|
|
|
|
@ -88,6 +107,7 @@ public class MyOrderController { |
|
|
|
|
|
|
|
|
|
orderShopDto.setShopId(shopDetail.getShopId()); |
|
|
|
|
orderShopDto.setShopName(shopDetail.getShopName()); |
|
|
|
|
orderShopDto.setShopLogo(shopDetail.getShopLogo()); |
|
|
|
|
orderShopDto.setActualTotal(order.getActualTotal()); |
|
|
|
|
// orderShopDto.setUserAddrDto(userAddrDto);
|
|
|
|
|
orderShopDto.setOrderItemDtos(orderItemList); |
|
|
|
@ -96,6 +116,7 @@ public class MyOrderController { |
|
|
|
|
orderShopDto.setCreateTime(order.getCreateTime()); |
|
|
|
|
orderShopDto.setRemarks(order.getRemarks()); |
|
|
|
|
orderShopDto.setStatus(order.getStatus()); |
|
|
|
|
orderShopDto.setOrderType(order.getOrderType()); |
|
|
|
|
|
|
|
|
|
double total = 0.0; |
|
|
|
|
Integer totalNum = 0; |
|
|
|
@ -106,6 +127,32 @@ public class MyOrderController { |
|
|
|
|
orderShopDto.setTotal(total); |
|
|
|
|
orderShopDto.setTotalNum(totalNum); |
|
|
|
|
|
|
|
|
|
//获取采购方信息,根据accountId查询
|
|
|
|
|
UserAccount userAccount = platformTeamAccountMapper.selectAccountPlatform(order.getUserId()); |
|
|
|
|
List<UserAccount> userAccountList = platformTeamClassificationMapper.selectAccountList(userAccount.getAppOpenId()); |
|
|
|
|
for (UserAccount account : userAccountList) { |
|
|
|
|
if ("7".equals(account.getPlatformId())){ |
|
|
|
|
QueryWrapper<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("account_id", account.getId()); |
|
|
|
|
UserAuthenticationInformation userAuthenticationInformation = userAuthenticationInformationService.getOne(queryWrapper); |
|
|
|
|
orderShopDto.setPhone(account.getPhone()); |
|
|
|
|
orderShopDto.setPurchasingPerson(account.getAccount()); |
|
|
|
|
if (userAuthenticationInformation!=null){ |
|
|
|
|
orderShopDto.setPurchasingPerson(userAuthenticationInformation.getRealName()); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
QueryWrapper<EnterpriseCertification> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("open_id", account.getAppOpenId()); |
|
|
|
|
EnterpriseCertification enterpriseCertification = enterpriseCertificationService.getOne(queryWrapper); |
|
|
|
|
orderShopDto.setAuthentication("未认证"); |
|
|
|
|
orderShopDto.setKindergarten(account.getAccount()); |
|
|
|
|
if (enterpriseCertification!=null){ |
|
|
|
|
orderShopDto.setAuthentication("已认证"); |
|
|
|
|
orderShopDto.setKindergarten(enterpriseCertification.getCompanyName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ServerResponseEntity.success(orderShopDto); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -115,10 +162,17 @@ public class MyOrderController { |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/myOrder") |
|
|
|
|
@ApiOperation(value = "根据订单状态获取订单列表信息,状态为0时获取所有订单 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败") |
|
|
|
|
public ServerResponseEntity<IPage<MyOrderDto>> myOrder(@RequestParam(value = "status") Integer status, PageParam<MyOrderDto> page) { |
|
|
|
|
String userId = SecurityUtils.getCurrentInfo().getAccountId(); |
|
|
|
|
IPage<MyOrderDto> myOrderDtoIpage = myOrderService.pageMyOrderByUserIdAndStatus(page, userId, status); |
|
|
|
|
return ServerResponseEntity.success(myOrderDtoIpage); |
|
|
|
|
public ServerResponseEntity<IPage<Order>> myOrder(OrderPageReq orderParam) { |
|
|
|
|
PageParam<Order> page = new PageParam<>(); |
|
|
|
|
if (orderParam.getCurrent()!= null){ |
|
|
|
|
page.setCurrent(orderParam.getCurrent()); |
|
|
|
|
} |
|
|
|
|
if (orderParam.getSize()!= null){ |
|
|
|
|
page.setSize(orderParam.getSize()); |
|
|
|
|
} |
|
|
|
|
orderParam.setUserId(SecurityUtils.getCurrentInfo().getAccountId()); |
|
|
|
|
IPage<Order> myOrderDtoPage = myOrderService.pageMyOrderByUserIdAndStatus(page,orderParam); |
|
|
|
|
return ServerResponseEntity.success(myOrderDtoPage); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|