Merge remote-tracking branch 'origin/main' into main

main
rong.liu 11 months ago
commit bf5c8be499
  1. 2
      common/src/main/java/com/huoran/common/entity/EnterpriseCertification.java
  2. 8
      common/src/main/java/com/huoran/common/entity/UserAccount.java
  3. 2
      common/src/main/java/com/huoran/common/entity/UserAuthenticationInformation.java
  4. 4
      nakadai/src/main/java/com/huoran/nakadai/controller/AliRealNameAuthenticationController.java
  5. 2
      nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java
  6. 70
      nakadai/src/main/java/com/huoran/nakadai/controller/MyOrderController.java
  7. 24
      nakadai/src/main/java/com/huoran/nakadai/controller/OrderController.java
  8. 11
      nakadai/src/main/java/com/huoran/nakadai/controller/PlatformOrderController.java
  9. 2
      nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java
  10. 37
      nakadai/src/main/java/com/huoran/nakadai/controller/ProductController.java
  11. 19
      nakadai/src/main/java/com/huoran/nakadai/entity/app/dto/OrderShopDto.java
  12. 4
      nakadai/src/main/java/com/huoran/nakadai/entity/app/param/OrderParam.java
  13. 12
      nakadai/src/main/java/com/huoran/nakadai/entity/model/Order.java
  14. 28
      nakadai/src/main/java/com/huoran/nakadai/entity/req/OrderPageReq.java
  15. 21
      nakadai/src/main/java/com/huoran/nakadai/entity/req/ProductPageReq.java
  16. 14
      nakadai/src/main/java/com/huoran/nakadai/entity/vo/ProductCount.java
  17. 4
      nakadai/src/main/java/com/huoran/nakadai/listener/SubmitOrderListener.java
  18. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/EnterpriseCertificationMapper.java
  19. 10
      nakadai/src/main/java/com/huoran/nakadai/mapper/OrderMapper.java
  20. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/ProductMapper.java
  21. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/ShopDetailMapper.java
  22. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/UserAuthenticationInformationMapper.java
  23. 4
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml
  24. 137
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/OrderMapper.xml
  25. 14
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamAccountMapper.xml
  26. 5
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ProductMapper.xml
  27. 2
      nakadai/src/main/java/com/huoran/nakadai/service/BasketService.java
  28. 2
      nakadai/src/main/java/com/huoran/nakadai/service/EnterpriseCertificationService.java
  29. 6
      nakadai/src/main/java/com/huoran/nakadai/service/MyOrderService.java
  30. 3
      nakadai/src/main/java/com/huoran/nakadai/service/OrderService.java
  31. 3
      nakadai/src/main/java/com/huoran/nakadai/service/ProductService.java
  32. 2
      nakadai/src/main/java/com/huoran/nakadai/service/UserAuthenticationInformationService.java
  33. 66
      nakadai/src/main/java/com/huoran/nakadai/service/impl/BasketServiceImpl.java
  34. 2
      nakadai/src/main/java/com/huoran/nakadai/service/impl/EnterpriseCertificationServiceImpl.java
  35. 7
      nakadai/src/main/java/com/huoran/nakadai/service/impl/MyOrderServiceImpl.java
  36. 8
      nakadai/src/main/java/com/huoran/nakadai/service/impl/OrderServiceImpl.java
  37. 6
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ProductServiceImpl.java
  38. 21
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ShopDetailServiceImpl.java
  39. 2
      nakadai/src/main/java/com/huoran/nakadai/service/impl/UserAuthenticationInformationServiceImpl.java
  40. 35
      nakadai/src/main/java/com/huoran/nakadai/utils/PageParam.java

@ -1,4 +1,4 @@
package com.huoran.nakadai.entity; package com.huoran.common.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;

@ -90,4 +90,12 @@ public class UserAccount implements Serializable {
@ApiModelProperty(value = "班级id") @ApiModelProperty(value = "班级id")
@TableField(exist = false) @TableField(exist = false)
private String userName; private String userName;
@ApiModelProperty(value = "企业认证")
@TableField(exist = false)
private EnterpriseCertification enterpriseCertification;
@ApiModelProperty(value = "个人认证")
@TableField(exist = false)
private UserAuthenticationInformation userAuthenticationInformation;
} }

@ -1,4 +1,4 @@
package com.huoran.nakadai.entity; package com.huoran.common.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;

@ -6,9 +6,9 @@ import com.huoran.common.entity.UserAccount;
import com.huoran.common.response.R; import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils; import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.config.AliRealNameAuthenticationConfig; import com.huoran.nakadai.config.AliRealNameAuthenticationConfig;
import com.huoran.nakadai.entity.EnterpriseCertification; import com.huoran.common.entity.EnterpriseCertification;
import com.huoran.nakadai.entity.UserAuthenticationInformation;
import com.huoran.nakadai.entity.UserInfo; import com.huoran.nakadai.entity.UserInfo;
import com.huoran.common.entity.UserAuthenticationInformation;
import com.huoran.nakadai.entity.res.BusinessLicenseOCRResp; import com.huoran.nakadai.entity.res.BusinessLicenseOCRResp;
import com.huoran.nakadai.entity.res.CreditCodeResp; import com.huoran.nakadai.entity.res.CreditCodeResp;
import com.huoran.nakadai.entity.res.IdCardOCRResp; import com.huoran.nakadai.entity.res.IdCardOCRResp;

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huoran.common.entity.UserAccount; import com.huoran.common.entity.UserAccount;
import com.huoran.common.response.R; import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils; import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.EnterpriseCertification; import com.huoran.common.entity.EnterpriseCertification;
import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq; import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq;
import com.huoran.nakadai.entity.vo.WxMssVo; import com.huoran.nakadai.entity.vo.WxMssVo;
import com.huoran.nakadai.service.EnterpriseCertificationService; import com.huoran.nakadai.service.EnterpriseCertificationService;

@ -12,10 +12,14 @@ package com.huoran.nakadai.controller;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huoran.common.entity.UserAccount;
import com.huoran.common.exception.YamiShopBindException; import com.huoran.common.exception.YamiShopBindException;
import com.huoran.common.response.ServerResponseEntity; import com.huoran.common.response.ServerResponseEntity;
import com.huoran.common.utils.SecurityUtils; 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.MyOrderDto;
import com.huoran.nakadai.entity.app.dto.OrderCountData; import com.huoran.nakadai.entity.app.dto.OrderCountData;
import com.huoran.nakadai.entity.app.dto.OrderItemDto; 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.Order;
import com.huoran.nakadai.entity.model.OrderItem; import com.huoran.nakadai.entity.model.OrderItem;
import com.huoran.nakadai.entity.model.ShopDetail; 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.service.*;
import com.huoran.nakadai.utils.Arith; import com.huoran.nakadai.utils.Arith;
import com.huoran.nakadai.utils.PageParam; import com.huoran.nakadai.utils.PageParam;
@ -32,6 +38,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Collections; import java.util.Collections;
@ -56,6 +63,18 @@ public class MyOrderController {
private final MyOrderService myOrderService; 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 ShopDetailService shopDetailService;
private final OrderItemService orderItemService; private final OrderItemService orderItemService;
@ -76,9 +95,9 @@ public class MyOrderController {
if (order == null) { if (order == null) {
throw new RuntimeException("该订单不存在"); throw new RuntimeException("该订单不存在");
} }
if (!Objects.equals(order.getUserId(), userId)) { // if (!Objects.equals(order.getUserId(), userId)) {
throw new RuntimeException("你没有权限获取该订单信息"); // throw new RuntimeException("你没有权限获取该订单信息");
} // }
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(order.getShopId()); ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(order.getShopId());
// UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId()); // UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId());
@ -88,6 +107,7 @@ public class MyOrderController {
orderShopDto.setShopId(shopDetail.getShopId()); orderShopDto.setShopId(shopDetail.getShopId());
orderShopDto.setShopName(shopDetail.getShopName()); orderShopDto.setShopName(shopDetail.getShopName());
orderShopDto.setShopLogo(shopDetail.getShopLogo());
orderShopDto.setActualTotal(order.getActualTotal()); orderShopDto.setActualTotal(order.getActualTotal());
// orderShopDto.setUserAddrDto(userAddrDto); // orderShopDto.setUserAddrDto(userAddrDto);
orderShopDto.setOrderItemDtos(orderItemList); orderShopDto.setOrderItemDtos(orderItemList);
@ -96,6 +116,7 @@ public class MyOrderController {
orderShopDto.setCreateTime(order.getCreateTime()); orderShopDto.setCreateTime(order.getCreateTime());
orderShopDto.setRemarks(order.getRemarks()); orderShopDto.setRemarks(order.getRemarks());
orderShopDto.setStatus(order.getStatus()); orderShopDto.setStatus(order.getStatus());
orderShopDto.setOrderType(order.getOrderType());
double total = 0.0; double total = 0.0;
Integer totalNum = 0; Integer totalNum = 0;
@ -106,6 +127,32 @@ public class MyOrderController {
orderShopDto.setTotal(total); orderShopDto.setTotal(total);
orderShopDto.setTotalNum(totalNum); 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); return ServerResponseEntity.success(orderShopDto);
} }
@ -115,10 +162,17 @@ public class MyOrderController {
*/ */
@GetMapping("/myOrder") @GetMapping("/myOrder")
@ApiOperation(value = "根据订单状态获取订单列表信息,状态为0时获取所有订单 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败") @ApiOperation(value = "根据订单状态获取订单列表信息,状态为0时获取所有订单 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败")
public ServerResponseEntity<IPage<MyOrderDto>> myOrder(@RequestParam(value = "status") Integer status, PageParam<MyOrderDto> page) { public ServerResponseEntity<IPage<Order>> myOrder(OrderPageReq orderParam) {
String userId = SecurityUtils.getCurrentInfo().getAccountId(); PageParam<Order> page = new PageParam<>();
IPage<MyOrderDto> myOrderDtoIpage = myOrderService.pageMyOrderByUserIdAndStatus(page, userId, status); if (orderParam.getCurrent()!= null){
return ServerResponseEntity.success(myOrderDtoIpage); 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);
} }
/** /**

@ -10,7 +10,6 @@
package com.huoran.nakadai.controller; package com.huoran.nakadai.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
@ -19,7 +18,6 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.huoran.common.exception.YamiShopBindException; import com.huoran.common.exception.YamiShopBindException;
import com.huoran.common.response.ServerResponseEntity; import com.huoran.common.response.ServerResponseEntity;
@ -32,14 +30,12 @@ import com.huoran.nakadai.entity.app.param.SubmitOrderParam;
import com.huoran.nakadai.entity.enums.OrderStatus; import com.huoran.nakadai.entity.enums.OrderStatus;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.model.OrderItem; import com.huoran.nakadai.entity.model.OrderItem;
import com.huoran.nakadai.entity.model.UserAddr;
import com.huoran.nakadai.entity.model.UserAddrOrder; import com.huoran.nakadai.entity.model.UserAddrOrder;
import com.huoran.nakadai.entity.param.DeliveryOrderParam; import com.huoran.nakadai.entity.param.DeliveryOrderParam;
import com.huoran.nakadai.event.ConfirmOrderEvent; import com.huoran.nakadai.event.ConfirmOrderEvent;
import com.huoran.nakadai.service.*; import com.huoran.nakadai.service.*;
import com.huoran.nakadai.utils.Arith; import com.huoran.nakadai.utils.Arith;
import com.huoran.nakadai.utils.PageParam;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -59,7 +55,6 @@ import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static com.huoran.nakadai.utils.SpringContextUtils.applicationContext;
/** /**
* @author lgh on 2018/09/15. * @author lgh on 2018/09/15.
@ -97,6 +92,7 @@ public class OrderController {
// 组装获取用户提交的购物车商品项 // 组装获取用户提交的购物车商品项
List<ShopCartItemDto> shopCartItems = basketService.getShopCartItemsByOrderItems(orderParam.getBasketIds(),orderParam.getOrderItem(),userId); List<ShopCartItemDto> shopCartItems = basketService.getShopCartItemsByOrderItems(orderParam.getBasketIds(),orderParam.getOrderItem(),userId);
// List<ShopCartItemDto> shopCartItems = basketService.getShopCartItems(userId);
if (CollectionUtil.isEmpty(shopCartItems)) { if (CollectionUtil.isEmpty(shopCartItems)) {
throw new YamiShopBindException("请选择您需要的商品加入购物车"); throw new YamiShopBindException("请选择您需要的商品加入购物车");
@ -229,18 +225,6 @@ public class OrderController {
return ServerResponseEntity.success(new OrderNumbersDto(orderNumbers.toString())); return ServerResponseEntity.success(new OrderNumbersDto(orderNumbers.toString()));
} }
/**
* 分页获取
*/
// @GetMapping("/page")
// @ApiOperation(value = "商机线索列表")
// public ServerResponseEntity<IPage<Order>> page(OrderParam orderParam, PageParam<Order> page, HttpServletRequest request) {
// Integer shopId = TokenUtils.getShopIdByJwtToken(request);
// orderParam.setShopId(SecurityUtils.getCurrentInfo().getShopId());
// IPage<Order> orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam);
// return ServerResponseEntity.success(orderPage);
// }
/** /**
* 获取信息 * 获取信息
*/ */
@ -248,9 +232,9 @@ public class OrderController {
public ServerResponseEntity<Order> info(@PathVariable("orderNumber") String orderNumber,HttpServletRequest request) { public ServerResponseEntity<Order> info(@PathVariable("orderNumber") String orderNumber,HttpServletRequest request) {
Integer shopId = TokenUtils.getShopIdByJwtToken(request); Integer shopId = TokenUtils.getShopIdByJwtToken(request);
Order order = orderService.getOrderByOrderNumber(orderNumber); Order order = orderService.getOrderByOrderNumber(orderNumber);
if (!Objects.equal(shopId, order.getShopId())) { // if (!Objects.equal(shopId, order.getShopId())) {
throw new YamiShopBindException("您没有权限获取该订单信息"); // throw new YamiShopBindException("您没有权限获取该订单信息");
} // }
List<OrderItem> orderItems = orderItemService.getOrderItemsByOrderNumber(orderNumber); List<OrderItem> orderItems = orderItemService.getOrderItemsByOrderNumber(orderNumber);
order.setOrderItems(orderItems); order.setOrderItems(orderItems);
// UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId()); // UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId());

@ -26,9 +26,11 @@ import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.enums.OrderStatus; import com.huoran.nakadai.entity.enums.OrderStatus;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.model.OrderItem; import com.huoran.nakadai.entity.model.OrderItem;
import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.model.UserAddrOrder; import com.huoran.nakadai.entity.model.UserAddrOrder;
import com.huoran.nakadai.entity.param.DeliveryOrderParam; import com.huoran.nakadai.entity.param.DeliveryOrderParam;
import com.huoran.nakadai.entity.param.OrderParam; import com.huoran.nakadai.entity.param.OrderParam;
import com.huoran.nakadai.entity.req.OrderPageReq;
import com.huoran.nakadai.service.*; import com.huoran.nakadai.service.*;
import com.huoran.nakadai.utils.PageParam; import com.huoran.nakadai.utils.PageParam;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -76,7 +78,14 @@ public class PlatformOrderController {
*/ */
@GetMapping("/page") @GetMapping("/page")
@ApiOperation(value = "商机线索列表") @ApiOperation(value = "商机线索列表")
public ServerResponseEntity<IPage<Order>> page(OrderParam orderParam, PageParam<Order> page, HttpServletRequest request) { public ServerResponseEntity<IPage<Order>> page(OrderPageReq orderParam) {
PageParam<Order> page = new PageParam<>();
if (orderParam.getCurrent()!= null){
page.setCurrent(orderParam.getCurrent());
}
if (orderParam.getSize()!= null){
page.setSize(orderParam.getSize());
}
orderParam.setShopId(SecurityUtils.getCurrentInfo().getShopId()); orderParam.setShopId(SecurityUtils.getCurrentInfo().getShopId());
IPage<Order> orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam); IPage<Order> orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam);
return ServerResponseEntity.success(orderPage); return ServerResponseEntity.success(orderPage);

@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -246,6 +247,7 @@ public class PlatformTeamAccountController {
@ApiOperation(value = "小程序团队信息维护") @ApiOperation(value = "小程序团队信息维护")
@PostMapping("/updateTeamInfo") @PostMapping("/updateTeamInfo")
@CacheEvict(cacheNames = "shop_detail", key = "#teamInfo.id")
public R updateTeamInfo(@RequestBody TeamInfo teamInfo) { public R updateTeamInfo(@RequestBody TeamInfo teamInfo) {
PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification();
BeanUtils.copyProperties(teamInfo, platformTeamClassification); BeanUtils.copyProperties(teamInfo, platformTeamClassification);

@ -14,14 +14,18 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huoran.common.exception.YamiShopBindException; import com.huoran.common.exception.YamiShopBindException;
import com.huoran.common.response.R;
import com.huoran.common.response.ServerResponseEntity; import com.huoran.common.response.ServerResponseEntity;
import com.huoran.common.utils.TokenUtils; import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.model.Sku; import com.huoran.nakadai.entity.model.Sku;
import com.huoran.nakadai.entity.param.ProductParam; import com.huoran.nakadai.entity.param.ProductParam;
import com.huoran.nakadai.entity.req.ProductPageReq;
import com.huoran.nakadai.entity.res.PlatformTeamAccountResp; import com.huoran.nakadai.entity.res.PlatformTeamAccountResp;
import com.huoran.nakadai.entity.vo.ProductCount;
import com.huoran.nakadai.service.BasketService; import com.huoran.nakadai.service.BasketService;
import com.huoran.nakadai.service.ProdTagReferenceService; import com.huoran.nakadai.service.ProdTagReferenceService;
import com.huoran.nakadai.service.ProductService; import com.huoran.nakadai.service.ProductService;
@ -36,6 +40,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -58,17 +63,41 @@ public class ProductController {
@Autowired @Autowired
private BasketService basketService; private BasketService basketService;
@GetMapping("/list")
@ApiOperation(value = "采购查询店铺中所有产品规则列表展示")
public ServerResponseEntity<List<Sku>> list(@RequestParam("shopId") Integer shopId) {
List<Product> productList = productService.list(
new QueryWrapper<Product>().eq("shop_id", shopId).eq("status", 1));
List<Sku> skuList = new ArrayList<>();
for (Product product : productList) {
List<Sku> list = skuService.list(new QueryWrapper<Sku>().eq("prod_id", product.getProdId()).
eq("is_delete", 0));
for (Sku sku : list) {
sku.setProdName(product.getProdName());
}
skuList.addAll(list);
}
return ServerResponseEntity.success(skuList);
}
@GetMapping("/page") @GetMapping("/page")
@ApiOperation(value = "分页获取商品信息", response = Product.class) @ApiOperation(value = "分页获取商品信息", response = Product.class)
public ServerResponseEntity<IPage<Product>> page(ProductParam product,HttpServletRequest request) { public R page(ProductPageReq productPageReq, HttpServletRequest request) {
PageParam<Product> page = new PageParam<>(); PageParam<Product> page = new PageParam<>();
if (productPageReq.getCurrent()!= null){
page.setCurrent(productPageReq.getCurrent());
}
if (productPageReq.getSize()!= null){
page.setSize(productPageReq.getSize());
}
IPage<Product> products = productService.page(page, IPage<Product> products = productService.page(page,
new LambdaQueryWrapper<Product>() new LambdaQueryWrapper<Product>()
.like(StrUtil.isNotBlank(product.getProdName()), Product::getProdName, product.getProdName()) .like(StrUtil.isNotBlank(productPageReq.getProdName()), Product::getProdName, productPageReq.getProdName())
.eq(Product::getShopId, TokenUtils.getShopIdByJwtToken(request)) .eq(Product::getShopId, TokenUtils.getShopIdByJwtToken(request))
.eq(product.getStatus() != null, Product::getStatus, product.getStatus()) .eq(productPageReq.getStatus() != null, Product::getStatus, productPageReq.getStatus())
.orderByDesc(Product::getPutawayTime)); .orderByDesc(Product::getPutawayTime));
return ServerResponseEntity.success(products); List<ProductCount> productCount = productService.selectCount(TokenUtils.getShopIdByJwtToken(request));
return R.ok().put("page", products).put("productCount", productCount);
} }

@ -11,6 +11,7 @@
package com.huoran.nakadai.entity.app.dto; package com.huoran.nakadai.entity.app.dto;
import com.huoran.common.entity.UserAccount;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -33,6 +34,24 @@ public class OrderShopDto implements Serializable {
@ApiModelProperty(value = "店铺id" , required = true) @ApiModelProperty(value = "店铺id" , required = true)
private Integer shopId; private Integer shopId;
@ApiModelProperty(value = "采购人" , hidden = true)
private String purchasingPerson;
@ApiModelProperty(value = "采购人联系方式" , hidden = true)
private String phone;
@ApiModelProperty(value = "幼儿园" , hidden = true)
private String kindergarten;
@ApiModelProperty(value = "是否认证" , hidden = true)
private String authentication;
@ApiModelProperty(value = "店铺logo" , hidden = true)
private String shopLogo;
@ApiModelProperty(value = "订单类型:1为个人、2为组织")
private Integer orderType;
/** /**
* 店铺名称 * 店铺名称
**/ **/

@ -24,11 +24,11 @@ import java.util.List;
public class OrderParam { public class OrderParam {
@ApiModelProperty(value = "购物车id 数组" ) @ApiModelProperty(value = "购物车id 数组" ,hidden = true)
private List<Integer> basketIds; private List<Integer> basketIds;
@ApiModelProperty(value = "立即购买时提交的商品项" ) @ApiModelProperty(value = "立即购买时提交的商品项" )
private OrderItemParam orderItem; private List<OrderItemParam> orderItem;
// @ApiModelProperty(value = "地址ID,0为默认地址" ,required=true) // @ApiModelProperty(value = "地址ID,0为默认地址" ,required=true)
// @NotNull(message = "地址不能为空") // @NotNull(message = "地址不能为空")

@ -188,6 +188,18 @@ public class Order implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String shopName; private String shopName;
@TableField(exist = false)
private String content;
@TableField(exist = false)
private String num;
@TableField(exist = false)
private String purchasingPerson;
@TableField(exist = false)
private String logo;
@TableField(exist = false) @TableField(exist = false)
private List<OrderItem> orderItems; private List<OrderItem> orderItems;

@ -0,0 +1,28 @@
package com.huoran.nakadai.entity.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OrderPageReq {
@ApiModelProperty(value = "每页大小,默认10")
private Integer size = 10;
@ApiModelProperty(value = "当前页,默认1")
private Integer current = 1;
@ApiModelProperty(value = "订单类型:1为个人、2为组织")
private Integer orderType;
@ApiModelProperty(value = "查询条件")
private String queryCriteria;
//商机线索查询店铺订单
@ApiModelProperty(hidden = true)
private Integer shopId;
//我的采购查询个人订单
@ApiModelProperty(hidden = true)
private String userId;
}

@ -0,0 +1,21 @@
package com.huoran.nakadai.entity.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ProductPageReq {
@ApiModelProperty(value = "每页大小,默认10")
private Integer size = 10;
@ApiModelProperty(value = "当前页,默认1")
private Integer current = 1;
@ApiModelProperty(value = "默认是0,表示上架, 2下架,3草稿,4审核")
private Integer status;
@ApiModelProperty(value = "商品名称")
private String prodName;
}

@ -0,0 +1,14 @@
package com.huoran.nakadai.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ProductCount {
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "数量")
private Integer count;
}

@ -282,11 +282,11 @@ public class SubmitOrderListener {
} }
if (sku.getStatus() != 1) { if (sku.getStatus() != 1) {
throw new YamiShopBindException("商品[" + sku.getProdName() + "]已下架"); throw new YamiShopBindException("商品[" + sku.getSkuName() + "]已下架");
} }
// -1为无限库存 // -1为无限库存
if (sku.getStocks() != -1 && shopCartItem.getProdCount() > sku.getStocks()) { if (sku.getStocks() != -1 && shopCartItem.getProdCount() > sku.getStocks()) {
throw new YamiShopBindException("商品:[" + sku.getProdName() + "]库存不足"); throw new YamiShopBindException("商品:[" + sku.getSkuName() + "]库存不足");
} }
if (sku.getStocks() != -1) { if (sku.getStocks() != -1) {

@ -3,7 +3,7 @@ package com.huoran.nakadai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huoran.common.entity.UserAccount; import com.huoran.common.entity.UserAccount;
import com.huoran.nakadai.entity.EnterpriseCertification; import com.huoran.common.entity.EnterpriseCertification;
import com.huoran.nakadai.entity.UserInfo; import com.huoran.nakadai.entity.UserInfo;
import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq; import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

@ -12,12 +12,15 @@ package com.huoran.nakadai.mapper;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.nakadai.entity.app.dto.MyOrderDto; import com.huoran.nakadai.entity.app.dto.MyOrderDto;
import com.huoran.nakadai.entity.app.dto.OrderCountData; import com.huoran.nakadai.entity.app.dto.OrderCountData;
import com.huoran.nakadai.entity.distribution.UserShoppingDataDto; import com.huoran.nakadai.entity.distribution.UserShoppingDataDto;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.param.OrderParam; import com.huoran.nakadai.entity.param.OrderParam;
import com.huoran.nakadai.entity.req.OrderPageReq;
import com.huoran.nakadai.utils.PageAdapter; import com.huoran.nakadai.utils.PageAdapter;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -80,14 +83,14 @@ public interface OrderMapper extends BaseMapper<Order> {
* @param orderParam 订单参数 * @param orderParam 订单参数
* @return * @return
*/ */
List<Order> listOrdersDetailByOrderParam(@Param("adapter") PageAdapter adapter, @Param("orderParam") OrderParam orderParam); List<Order> listOrdersDetailByOrderParam(@Param("adapter") PageAdapter adapter, @Param("orderParam") OrderPageReq orderParam);
/** /**
* 根据订单参数获取订单数 * 根据订单参数获取订单数
* @param orderParam * @param orderParam
* @return * @return
*/ */
Long countOrderDetail(@Param("orderParam") OrderParam orderParam); Long countOrderDetail(@Param("orderParam") OrderPageReq orderParam);
/** /**
* 根据店铺id和用户id获取购买过的商品id列表 * 根据店铺id和用户id获取购买过的商品id列表
@ -135,4 +138,7 @@ public interface OrderMapper extends BaseMapper<Order> {
*/ */
OrderCountData getOrderCount(String userId); OrderCountData getOrderCount(String userId);
IPage<Order> listOrdersByOrderParam(Page<Order> orderPage,@Param("orderParam") OrderPageReq orderParam);
IPage<Order> listOrdersByUserId(Page<Order> orderPage,@Param("orderParam") OrderPageReq orderParam);
} }

@ -17,6 +17,7 @@ import com.huoran.nakadai.entity.app.dto.ProductDto;
import com.huoran.nakadai.entity.app.dto.TagProductDto; import com.huoran.nakadai.entity.app.dto.TagProductDto;
import com.huoran.nakadai.entity.dto.SearchProdDto; import com.huoran.nakadai.entity.dto.SearchProdDto;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.vo.ProductCount;
import com.huoran.nakadai.utils.PageParam; import com.huoran.nakadai.utils.PageParam;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -129,4 +130,5 @@ public interface ProductMapper extends BaseMapper<Product> {
*/ */
IPage<ProductDto> collectionProds(@Param("page") PageParam page, @Param("userId") String userId); IPage<ProductDto> collectionProds(@Param("page") PageParam page, @Param("userId") String userId);
List<ProductCount> selectCountByShopId(@Param("shopId")Integer shopIdByJwtToken);
} }

@ -12,9 +12,11 @@ package com.huoran.nakadai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huoran.nakadai.entity.model.ShopDetail; import com.huoran.nakadai.entity.model.ShopDetail;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author lanhai * @author lanhai
*/ */
@Mapper
public interface ShopDetailMapper extends BaseMapper<ShopDetail> { public interface ShopDetailMapper extends BaseMapper<ShopDetail> {
} }

@ -1,7 +1,7 @@
package com.huoran.nakadai.mapper; package com.huoran.nakadai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huoran.nakadai.entity.UserAuthenticationInformation; import com.huoran.common.entity.UserAuthenticationInformation;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

@ -17,7 +17,7 @@
<select id="selectEnterpriseCertificationList" <select id="selectEnterpriseCertificationList"
resultType="com.huoran.nakadai.entity.EnterpriseCertification"> resultType="com.huoran.common.entity.EnterpriseCertification">
SELECT SELECT
t.* t.*
FROM FROM
@ -105,7 +105,7 @@
and t.city=#{req.province,jdbcType=VARCHAR} and t.city=#{req.province,jdbcType=VARCHAR}
</if> </if>
</select> </select>
<select id="enterpriseCertificationDetails" resultType="com.huoran.nakadai.entity.EnterpriseCertification"> <select id="enterpriseCertificationDetails" resultType="com.huoran.common.entity.EnterpriseCertification">
SELECT SELECT
t.* t.*
FROM FROM

@ -263,28 +263,39 @@
ON o.addr_order_id = uao.addr_order_id ON o.addr_order_id = uao.addr_order_id
</select> </select>
<!-- <select id="countOrderDetail" resultType="long">-->
<!-- SELECT COUNT(0) FROM tz_order-->
<!-- <where>-->
<!-- <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">-->
<!-- and order_number = #{orderParam.orderNumber}-->
<!-- </if>-->
<!-- <if test="orderParam.status != null">-->
<!-- and status = #{orderParam.status}-->
<!-- </if>-->
<!-- <if test="orderParam.shopId != null">-->
<!-- and shop_id = #{orderParam.shopId}-->
<!-- </if>-->
<!-- <if test="orderParam.isPayed != null">-->
<!-- and is_payed = #{orderParam.isPayed}-->
<!-- and status != 6-->
<!-- </if>-->
<!-- <if test="orderParam.startTime != null">-->
<!-- and create_time &gt; #{orderParam.startTime}-->
<!-- </if>-->
<!-- <if test="orderParam.endTime != null">-->
<!-- and create_time &lt; #{orderParam.endTime}-->
<!-- </if>-->
<!-- </where>-->
<!-- </select> -->
<select id="countOrderDetail" resultType="long"> <select id="countOrderDetail" resultType="long">
SELECT COUNT(0) FROM tz_order SELECT COUNT(0) FROM tz_order
<where> <where>
<if test="orderParam.orderNumber != null and orderParam.orderNumber != ''"> <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
and order_number = #{orderParam.orderNumber} and order_number = #{orderParam.orderNumber}
</if> </if>
<if test="orderParam.status != null">
and status = #{orderParam.status}
</if>
<if test="orderParam.shopId != null"> <if test="orderParam.shopId != null">
and shop_id = #{orderParam.shopId} and shop_id = #{orderParam.shopId}
</if> </if>
<if test="orderParam.isPayed != null">
and is_payed = #{orderParam.isPayed}
and status != 6
</if>
<if test="orderParam.startTime != null">
and create_time &gt; #{orderParam.startTime}
</if>
<if test="orderParam.endTime != null">
and create_time &lt; #{orderParam.endTime}
</if>
</where> </where>
</select> </select>
@ -351,5 +362,105 @@
FROM tz_order o FROM tz_order o
WHERE o.user_id =#{userId} WHERE o.user_id =#{userId}
</select> </select>
<select id="listOrdersByOrderParam" resultType="com.huoran.nakadai.entity.model.Order">
SELECT
o.order_id,
o.order_number,
o.create_time,
o.order_type,
GROUP_CONCAT( oi.sku_name ) AS content,
sum( oi.prod_count ) AS num,
CASE
WHEN o.order_type = 2 THEN
IFNULL( ec.company_name, ua.account )
WHEN o.order_type = 1 THEN
IFNULL( uai.real_name, ua.account )
END AS purchasingPerson,
CASE
WHEN o.order_type = 2 THEN
kpt.logo_url
WHEN o.order_type = 1 THEN
ui.user_avatars
END AS logo
FROM
tz_order o
LEFT JOIN hr_user_account ua ON ua.id = o.user_id
LEFT JOIN hr_user_info ui ON ui.user_id = ua.user_id
LEFT JOIN tz_order_item oi ON o.order_number = oi.order_number
LEFT JOIN hr_enterprise_certification ec ON o.order_type = 2
AND ua.app_open_id = ec.open_id
LEFT JOIN hr_user_authentication_information uai ON o.order_type = 1
AND ua.app_open_id = uai.open_id
LEFT JOIN k_platform_team_account pta ON pta.account_id = ua.id
LEFT JOIN k_platform_team kp ON kp.manage_id = pta.manage_id
LEFT JOIN k_platform_team_classification kpt ON kpt.id = kp.classification_id
WHERE
o.shop_id = #{orderParam.shopId}
<if test="orderParam.queryCriteria != null and orderParam.queryCriteria != ''">
and (o.order_number like CONCAT('%',#{orderParam.queryCriteria},'%') OR (CASE
WHEN o.order_type = 2 THEN
IFNULL( ec.company_name, ua.account )
WHEN o.order_type = 1 THEN
IFNULL( uai.real_name, ua.account )
END) LIKE CONCAT('%', #{orderParam.queryCriteria} ,'%'))
</if>
<if test="orderParam.orderType != null">
and o.order_type = #{orderParam.orderType}
</if>
GROUP BY
o.order_id
ORDER BY
o.update_time DESC
</select>
<select id="listOrdersByUserId" resultType="com.huoran.nakadai.entity.model.Order">
SELECT
o.order_id,
o.order_number,
o.create_time,
o.order_type,
GROUP_CONCAT( oi.sku_name ) AS content,
sum( oi.prod_count ) AS num,
CASE
WHEN o.order_type = 2 THEN
IFNULL( ec.company_name, ua.account )
WHEN o.order_type = 1 THEN
IFNULL( uai.real_name, ua.account )
END AS purchasingPerson,
CASE
WHEN o.order_type = 2 THEN
kpt.logo_url
WHEN o.order_type = 1 THEN
ui.user_avatars
END AS logo
FROM
tz_order o
LEFT JOIN hr_user_account ua ON ua.id = o.user_id
LEFT JOIN hr_user_info ui ON ui.user_id = ua.user_id
LEFT JOIN tz_order_item oi ON o.order_number = oi.order_number
LEFT JOIN hr_enterprise_certification ec ON o.order_type = 2
AND ua.app_open_id = ec.open_id
LEFT JOIN hr_user_authentication_information uai ON o.order_type = 1
AND ua.app_open_id = uai.open_id
LEFT JOIN k_platform_team_account pta ON pta.account_id = ua.id
LEFT JOIN k_platform_team kp ON kp.manage_id = pta.manage_id
LEFT JOIN k_platform_team_classification kpt ON kpt.id = kp.classification_id
WHERE
o.user_id = #{orderParam.userId}
<if test="orderParam.queryCriteria != null and orderParam.queryCriteria != ''">
and (o.order_number like CONCAT('%',#{orderParam.queryCriteria},'%') OR (CASE
WHEN o.order_type = 2 THEN
IFNULL( ec.company_name, ua.account )
WHEN o.order_type = 1 THEN
IFNULL( uai.real_name, ua.account )
END) LIKE CONCAT('%', #{orderParam.queryCriteria} ,'%'))
</if>
<if test="orderParam.orderType != null">
and o.order_type = #{orderParam.orderType}
</if>
GROUP BY
o.order_id
ORDER BY
o.update_time DESC
</select>
</mapper> </mapper>

@ -126,6 +126,18 @@
AND ua.app_open_id = a.app_open_id AND ua.app_open_id = a.app_open_id
AND ua.platform_id = 7 AND ua.platform_id = 7
) AS userName, ) AS userName,
(
SELECT
u.user_avatars
FROM
hr_user_account ua
INNER JOIN hr_user_info u ON u.user_id = ua.user_id
AND u.is_del = 0
WHERE
ua.is_del = 0
AND ua.app_open_id = a.app_open_id
AND ua.platform_id = 7
) AS userAvatars,
u.last_login_time, u.last_login_time,
u.login_number, u.login_number,
a.work_number, a.work_number,
@ -136,7 +148,7 @@
pc.classification_name as teamName, pc.classification_name as teamName,
pc.id as partnerClassificationId, pc.id as partnerClassificationId,
pc.is_team, pc.is_team,
u.user_avatars,pc.parent_id, pc.parent_id,
pc.create_time as joinTime, pc.create_time as joinTime,
CASE CASE
WHEN count(ai.id) > 0 THEN '已认证' WHEN count(ai.id) > 0 THEN '已认证'

@ -223,5 +223,10 @@
(SELECT uc.`prod_id` FROM tz_user_collection uc (SELECT uc.`prod_id` FROM tz_user_collection uc
WHERE uc.user_id = #{userId}) WHERE uc.user_id = #{userId})
</select> </select>
<select id="selectCountByShopId" resultType="com.huoran.nakadai.entity.vo.ProductCount">
SELECT status, COUNT(*) AS count
FROM tz_prod where shop_id = #{shopId}
GROUP BY status;
</select>
</mapper> </mapper>

@ -107,6 +107,6 @@ public interface BasketService extends IService<Basket> {
* @param basketId 购物车id * @param basketId 购物车id
* @return 所有的商品购物项 * @return 所有的商品购物项
*/ */
List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Integer> basketId, OrderItemParam orderItem, String userId); List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Integer> basketId, List<OrderItemParam> orderItem, String userId);
} }

@ -3,7 +3,7 @@ package com.huoran.nakadai.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.common.entity.UserAccount; import com.huoran.common.entity.UserAccount;
import com.huoran.common.response.R; import com.huoran.common.response.R;
import com.huoran.nakadai.entity.EnterpriseCertification; import com.huoran.common.entity.EnterpriseCertification;
import com.huoran.nakadai.entity.UserInfo; import com.huoran.nakadai.entity.UserInfo;
import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq; import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq;

@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.nakadai.entity.app.dto.MyOrderDto; import com.huoran.nakadai.entity.app.dto.MyOrderDto;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.req.OrderPageReq;
/** /**
* 我的订单 * 我的订单
@ -24,10 +25,7 @@ public interface MyOrderService extends IService<Order> {
/** /**
* 通过用户id和订单状态分页获取订单信息 * 通过用户id和订单状态分页获取订单信息
* @param page 分页参数
* @param userId 用户id
* @param status 订单状态
* @return * @return
*/ */
IPage<MyOrderDto> pageMyOrderByUserIdAndStatus(Page<MyOrderDto> page, String userId, Integer status); IPage<Order> pageMyOrderByUserIdAndStatus(Page<Order> orderPage,OrderPageReq orderParam);
} }

@ -18,6 +18,7 @@ import com.huoran.nakadai.entity.app.dto.OrderCountData;
import com.huoran.nakadai.entity.app.dto.ShopCartOrderMergerDto; import com.huoran.nakadai.entity.app.dto.ShopCartOrderMergerDto;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.param.OrderParam; import com.huoran.nakadai.entity.param.OrderParam;
import com.huoran.nakadai.entity.req.OrderPageReq;
import java.util.Date; import java.util.Date;
@ -105,7 +106,7 @@ public interface OrderService extends IService<Order> {
* @param orderParam * @param orderParam
* @return * @return
*/ */
IPage<Order> pageOrdersDetailByOrderParam(Page<Order> page, OrderParam orderParam); IPage<Order> pageOrdersDetailByOrderParam(Page<Order> page, OrderPageReq orderParam);
/** /**
* 删除订单 * 删除订单

@ -17,6 +17,7 @@ import com.huoran.nakadai.entity.app.dto.ProductDto;
import com.huoran.nakadai.entity.app.dto.TagProductDto; import com.huoran.nakadai.entity.app.dto.TagProductDto;
import com.huoran.nakadai.entity.dto.SearchProdDto; import com.huoran.nakadai.entity.dto.SearchProdDto;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.vo.ProductCount;
import com.huoran.nakadai.utils.PageParam; import com.huoran.nakadai.utils.PageParam;
@ -115,4 +116,6 @@ public interface ProductService extends IService<Product> {
* @return * @return
*/ */
IPage<ProductDto> collectionProds(PageParam page, String userId); IPage<ProductDto> collectionProds(PageParam page, String userId);
List<ProductCount> selectCount(Integer shopIdByJwtToken);
} }

@ -1,7 +1,7 @@
package com.huoran.nakadai.service; package com.huoran.nakadai.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.nakadai.entity.UserAuthenticationInformation; import com.huoran.common.entity.UserAuthenticationInformation;
/** /**
* <p> * <p>

@ -37,10 +37,7 @@ import org.springframework.cache.annotation.CacheEvict;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -165,40 +162,43 @@ public class BasketServiceImpl extends ServiceImpl<BasketMapper, Basket> impleme
} }
@Override @Override
public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Integer> basketId, OrderItemParam orderItem, String userId) { public List<ShopCartItemDto> getShopCartItemsByOrderItems(List<Integer> basketId, List<OrderItemParam> orderItemList, String userId) {
if (orderItem == null && CollectionUtil.isEmpty(basketId)) { if (orderItemList == null && CollectionUtil.isEmpty(basketId)) {
return Collections.emptyList(); return Collections.emptyList();
} }
// 当立即购买时,没有提交的订单是没有购物车信息的 // 当立即购买时,没有提交的订单是没有购物车信息的
if (CollectionUtil.isEmpty(basketId) && orderItem != null) { if (CollectionUtil.isEmpty(basketId) && orderItemList != null) {
List<ShopCartItemDto> shopCartItemDtoList = new ArrayList<>();
Sku sku = skuService.getSkuBySkuId(orderItem.getSkuId()); for (OrderItemParam orderItem : orderItemList) {
if (sku == null) { Sku sku = skuService.getSkuBySkuId(orderItem.getSkuId());
throw new RuntimeException("订单包含无法识别的商品"); if (sku == null) {
} throw new RuntimeException("订单包含无法识别的商品");
Product prod = productService.getProductByProdId(orderItem.getProdId()); }
if (prod == null) { Product prod = productService.getProductByProdId(orderItem.getProdId());
throw new RuntimeException("订单包含无法识别的商品"); if (prod == null) {
} throw new RuntimeException("订单包含无法识别的商品");
}
// 拿到购物车的所有item
ShopCartItemDto shopCartItemDto = new ShopCartItemDto(); // 拿到购物车的所有item
shopCartItemDto.setBasketId(-1); ShopCartItemDto shopCartItemDto = new ShopCartItemDto();
shopCartItemDto.setSkuId(orderItem.getSkuId()); shopCartItemDto.setBasketId(-1);
shopCartItemDto.setProdCount(orderItem.getProdCount()); shopCartItemDto.setSkuId(orderItem.getSkuId());
shopCartItemDto.setProdId(orderItem.getProdId()); shopCartItemDto.setProdCount(orderItem.getProdCount());
shopCartItemDto.setSkuName(sku.getSkuName()); shopCartItemDto.setProdId(orderItem.getProdId());
shopCartItemDto.setPic(StrUtil.isBlank(sku.getPic())? prod.getPic() : sku.getPic()); shopCartItemDto.setSkuName(sku.getSkuName());
shopCartItemDto.setProdName(sku.getProdName()); shopCartItemDto.setPic(StrUtil.isBlank(sku.getPic())? prod.getPic() : sku.getPic());
shopCartItemDto.setProductTotalAmount(Arith.mul(sku.getPrice(),orderItem.getProdCount())); shopCartItemDto.setProdName(sku.getProdName());
shopCartItemDto.setPrice(sku.getPrice()); shopCartItemDto.setProductTotalAmount(Arith.mul(sku.getPrice(),orderItem.getProdCount()));
shopCartItemDto.setPrice(sku.getPrice());
// shopCartItemDto.setDistributionCardNo(orderItem.getDistributionCardNo()); // shopCartItemDto.setDistributionCardNo(orderItem.getDistributionCardNo());
shopCartItemDto.setBasketDate(new Date()); shopCartItemDto.setBasketDate(new Date());
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(orderItem.getShopId()); ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(orderItem.getShopId());
shopCartItemDto.setShopId(shopDetail.getShopId()); shopCartItemDto.setShopId(shopDetail.getShopId());
shopCartItemDto.setShopName(shopDetail.getShopName()); shopCartItemDto.setShopName(shopDetail.getShopName());
return Collections.singletonList(shopCartItemDto); shopCartItemDtoList.add(shopCartItemDto);
}
return shopCartItemDtoList;
} }
List<ShopCartItemDto> dbShopCartItems = getShopCartItems(userId); List<ShopCartItemDto> dbShopCartItems = getShopCartItems(userId);

@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.common.entity.UserAccount; import com.huoran.common.entity.UserAccount;
import com.huoran.common.response.R; import com.huoran.common.response.R;
import com.huoran.nakadai.entity.EnterpriseCertification; import com.huoran.common.entity.EnterpriseCertification;
import com.huoran.nakadai.entity.UserInfo; import com.huoran.nakadai.entity.UserInfo;
import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq; import com.huoran.nakadai.entity.req.EnterpriseCertificationLIstReq;
import com.huoran.nakadai.mapper.EnterpriseCertificationMapper; import com.huoran.nakadai.mapper.EnterpriseCertificationMapper;

@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.nakadai.entity.app.dto.MyOrderDto; import com.huoran.nakadai.entity.app.dto.MyOrderDto;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.req.OrderPageReq;
import com.huoran.nakadai.mapper.OrderMapper; import com.huoran.nakadai.mapper.OrderMapper;
import com.huoran.nakadai.service.MyOrderService; import com.huoran.nakadai.service.MyOrderService;
import com.huoran.nakadai.utils.PageAdapter; import com.huoran.nakadai.utils.PageAdapter;
@ -32,10 +33,8 @@ public class MyOrderServiceImpl extends ServiceImpl<OrderMapper, Order> implemen
private OrderMapper orderMapper; private OrderMapper orderMapper;
@Override @Override
public IPage<MyOrderDto> pageMyOrderByUserIdAndStatus(Page<MyOrderDto> page, String userId, Integer status) { public IPage<Order> pageMyOrderByUserIdAndStatus(Page<Order> orderPage,OrderPageReq orderParam) {
page.setRecords(orderMapper.listMyOrderByUserIdAndStatus(new PageAdapter(page), userId, status)); return orderMapper.listOrdersByUserId(orderPage, orderParam);
page.setTotal(orderMapper.countMyOrderByUserIdAndStatus(userId, status));
return page;
} }
} }

@ -21,6 +21,8 @@ import com.huoran.nakadai.entity.app.dto.ShopCartOrderMergerDto;
import com.huoran.nakadai.entity.model.Order; import com.huoran.nakadai.entity.model.Order;
import com.huoran.nakadai.entity.model.OrderItem; import com.huoran.nakadai.entity.model.OrderItem;
import com.huoran.nakadai.entity.param.OrderParam; import com.huoran.nakadai.entity.param.OrderParam;
import com.huoran.nakadai.entity.req.OrderPageReq;
import com.huoran.nakadai.entity.res.GoodsRes;
import com.huoran.nakadai.event.CancelOrderEvent; import com.huoran.nakadai.event.CancelOrderEvent;
import com.huoran.nakadai.event.ReceiptOrderEvent; import com.huoran.nakadai.event.ReceiptOrderEvent;
import com.huoran.nakadai.event.SubmitOrderEvent; import com.huoran.nakadai.event.SubmitOrderEvent;
@ -155,10 +157,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
} }
@Override @Override
public IPage<Order> pageOrdersDetailByOrderParam(Page<Order> page, OrderParam orderParam) { public IPage<Order> pageOrdersDetailByOrderParam(Page<Order> orderPage, OrderPageReq orderParam) {
page.setRecords(orderMapper.listOrdersDetailByOrderParam(new PageAdapter(page), orderParam)); return orderMapper.listOrdersByOrderParam(orderPage, orderParam);
page.setTotal(orderMapper.countOrderDetail(orderParam));
return page;
} }
@Override @Override

@ -22,6 +22,7 @@ import com.huoran.nakadai.entity.dto.SearchProdDto;
import com.huoran.nakadai.entity.model.ProdTagReference; import com.huoran.nakadai.entity.model.ProdTagReference;
import com.huoran.nakadai.entity.model.Product; import com.huoran.nakadai.entity.model.Product;
import com.huoran.nakadai.entity.model.Sku; import com.huoran.nakadai.entity.model.Sku;
import com.huoran.nakadai.entity.vo.ProductCount;
import com.huoran.nakadai.mapper.ProdTagReferenceMapper; import com.huoran.nakadai.mapper.ProdTagReferenceMapper;
import com.huoran.nakadai.mapper.ProductMapper; import com.huoran.nakadai.mapper.ProductMapper;
import com.huoran.nakadai.mapper.SkuMapper; import com.huoran.nakadai.mapper.SkuMapper;
@ -197,5 +198,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
return productMapper.collectionProds(page, userId); return productMapper.collectionProds(page, userId);
} }
@Override
public List<ProductCount> selectCount(Integer shopIdByJwtToken) {
return baseMapper.selectCountByShopId(shopIdByJwtToken);
}
} }

@ -12,7 +12,9 @@ package com.huoran.nakadai.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.nakadai.entity.PlatformTeamClassification;
import com.huoran.nakadai.entity.model.ShopDetail; import com.huoran.nakadai.entity.model.ShopDetail;
import com.huoran.nakadai.mapper.PlatformTeamClassificationMapper;
import com.huoran.nakadai.mapper.ShopDetailMapper; import com.huoran.nakadai.mapper.ShopDetailMapper;
import com.huoran.nakadai.service.ShopDetailService; import com.huoran.nakadai.service.ShopDetailService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -30,6 +32,9 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
@Autowired @Autowired
private ShopDetailMapper shopDetailMapper; private ShopDetailMapper shopDetailMapper;
@Autowired
private PlatformTeamClassificationMapper platformTeamClassificationMapper;
// @Autowired // @Autowired
// private AttachFileService attachFileService; // private AttachFileService attachFileService;
@ -69,7 +74,21 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet
@Override @Override
@Cacheable(cacheNames = "shop_detail", key = "#shopId") @Cacheable(cacheNames = "shop_detail", key = "#shopId")
public ShopDetail getShopDetailByShopId(Integer shopId) { public ShopDetail getShopDetailByShopId(Integer shopId) {
return shopDetailMapper.selectById(shopId); // return shopDetailMapper.selectById(shopId);
PlatformTeamClassification platformTeamClassification = platformTeamClassificationMapper.selectById(shopId);
ShopDetail shopDetail = new ShopDetail();
shopDetail.setShopId(platformTeamClassification.getId());
shopDetail.setShopName(platformTeamClassification.getClassificationName());
shopDetail.setShopAddress(platformTeamClassification.getAddress());
shopDetail.setIntro(platformTeamClassification.getBriefIntroduction());
shopDetail.setCity(platformTeamClassification.getCity());
shopDetail.setProvince(platformTeamClassification.getProvince());
shopDetail.setMobile(platformTeamClassification.getPhone());
shopDetail.setTel(platformTeamClassification.getPhone());
shopDetail.setShopLogo(platformTeamClassification.getLogoUrl());
shopDetail.setCreateTime(platformTeamClassification.getCreateTime());
shopDetail.setUpdateTime(platformTeamClassification.getUpdateTime());
return shopDetail;
} }
@Override @Override

@ -1,7 +1,7 @@
package com.huoran.nakadai.service.impl; package com.huoran.nakadai.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huoran.nakadai.entity.UserAuthenticationInformation; import com.huoran.common.entity.UserAuthenticationInformation;
import com.huoran.nakadai.mapper.UserAuthenticationInformationMapper; import com.huoran.nakadai.mapper.UserAuthenticationInformationMapper;
import com.huoran.nakadai.service.UserAuthenticationInformationService; import com.huoran.nakadai.service.UserAuthenticationInformationService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

@ -12,6 +12,7 @@ package com.huoran.nakadai.utils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ -24,19 +25,19 @@ public class PageParam<T> extends Page<T> {
/** /**
* 每页显示条数默认 10 * 每页显示条数默认 10
*/ */
// @Schema(description = "每页大小,默认10") @ApiModelProperty(value = "每页大小,默认10")
private long size = 10; private long size = 10;
/** /**
* 当前页 * 当前页
*/ */
// @Schema(description = "当前页,默认1") @ApiModelProperty(value = "当前页,默认1")
private long current = 1; private long current = 1;
/** /**
* 查询数据列表 * 查询数据列表
*/ */
// @Hidden @ApiModelProperty(hidden = true)
private List<T> records; private List<T> records;
/** /**
* 总数 * 总数
@ -44,20 +45,6 @@ public class PageParam<T> extends Page<T> {
// @Hidden // @Hidden
private long total = 0; private long total = 0;
/**
* 是否进行 count 查询
*/
@JsonIgnore
private boolean isSearchCount = true;
@JsonIgnore
private String countId;
@JsonIgnore
private Long maxLimit;
@JsonIgnore
private boolean optimizeCountSql;
@Override @Override
public List<T> getRecords() { public List<T> getRecords() {
return this.records; return this.records;
@ -80,20 +67,6 @@ public class PageParam<T> extends Page<T> {
return this; return this;
} }
@JsonIgnore
public boolean getSearchCount() {
if (total < 0) {
return false;
}
return isSearchCount;
}
// @Override
// public Page<T> setSearchCount(boolean isSearchCount) {
// this.isSearchCount = isSearchCount;
// return this;
// }
@Override @Override
public long getSize() { public long getSize() {
return this.size; return this.size;

Loading…
Cancel
Save