对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.comment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CreateFlowerCommentBatchDTO { |
| | | |
| | | |
| | | @ApiModelProperty("订单ID") |
| | | @NotEmpty(message = "订单ID不能为空") |
| | | private String orderId; |
| | | |
| | | @NotNull(message = "评论内容不能为空") |
| | | List<CreateFlowerCommentDTO> list; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.comment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class CreateFlowerCommentDTO { |
| | | |
| | | |
| | | /** |
| | | * 订单商品id |
| | | */ |
| | | @ApiModelProperty(value = "订单商品id") |
| | | @NotEmpty(message = "订单id不能为空") |
| | | private String orderItemId; |
| | | |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @ApiModelProperty(value = "等级") |
| | | @NotNull(message = "等级不能为空") |
| | | @Min(value = 1,message = "最小值为5") |
| | | @Max(value = 5,message = "最大值为5") |
| | | private Integer commentGrade; |
| | | |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @ApiModelProperty(value = "内容") |
| | | @NotEmpty(message = "内容不能为空") |
| | | private String comment; |
| | | |
| | | /** |
| | | * 内容图片 |
| | | */ |
| | | @ApiModelProperty(value = "内容图片") |
| | | // @NotEmpty(message = "内容图片不能为空") |
| | | private String commentImages; |
| | | |
| | | /** |
| | | * 匿名标志 0-非匿名 1-匿名 |
| | | */ |
| | | @ApiModelProperty(value = "匿名标志") |
| | | private Integer anonymityFalg; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.comment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class QueryFlowerCommentDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @ApiModelProperty(value = "订单id") |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 订单商品id |
| | | */ |
| | | @ApiModelProperty(value = "订单商品id") |
| | | private String orderItemId; |
| | | |
| | | /** |
| | | * 商户id |
| | | */ |
| | | @ApiModelProperty(value = "商户ID") |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 供应商Id |
| | | */ |
| | | @ApiModelProperty(value = "供应商Id") |
| | | private Long supplierId; |
| | | |
| | | /** |
| | | * 商品id |
| | | */ |
| | | @ApiModelProperty(value = "商品id") |
| | | private Long flowerId; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.comment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class UpdateFlowerCommentDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @ApiModelProperty(value = "等级") |
| | | @NotNull(message = "等级不能为空") |
| | | @Min(value = 1,message = "最小值为5") |
| | | @Max(value = 5,message = "最大值为5") |
| | | private Integer commentGrade; |
| | | |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @ApiModelProperty(value = "内容") |
| | | @NotEmpty(message = "内容不能为空") |
| | | private String comment; |
| | | |
| | | /** |
| | | * 内容图片 |
| | | */ |
| | | @ApiModelProperty(value = "内容图片") |
| | | // @NotEmpty(message = "内容图片不能为空") |
| | | private String commentImages; |
| | | |
| | | /** |
| | | * 匿名标志 0-非匿名 1-匿名 |
| | | */ |
| | | @ApiModelProperty(value = "匿名标志") |
| | | private Integer anonymityFalg; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "下单日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd") |
| | | @NotNull(message = "下单日期不能为空") |
| | | // @NotNull(message = "下单日期不能为空") |
| | | private LocalDate calDate; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.report; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class QueryOrderDetailDTO { |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @NotNull(message = "开始时间不能为空") |
| | | private LocalDateTime startDate; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @NotNull(message = "结束时间不能为空") |
| | | private LocalDateTime endDate; |
| | | |
| | | @ApiModelProperty(value = "合伙人id") |
| | | private Long partnerId; |
| | | |
| | | @ApiModelProperty(value = "下单日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd") |
| | | @NotNull(message = "下单日期不能为空") |
| | | private LocalDate calDate; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.comment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class FlowerCommentStatisVO { |
| | | |
| | | @ApiModelProperty(value = "平均分") |
| | | private BigDecimal avg; |
| | | |
| | | @ApiModelProperty(value = "评论总数") |
| | | private Integer commentAmount; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.comment; |
| | | |
| | | import com.mzl.flower.entity.FlowerCommentDO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class FlowerCommentVO extends FlowerCommentDO { |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String flowerName; |
| | | @ApiModelProperty(value = "商品规格") |
| | | private String flowerUnit; |
| | | @ApiModelProperty(value = "商品颜色") |
| | | private String flowerColor; |
| | | @ApiModelProperty(value = "商品等级") |
| | | private String flowerLevel; |
| | | @ApiModelProperty(value = "商品类别") |
| | | private String flowerCategory; |
| | | @ApiModelProperty(value = "商户名称") |
| | | private String customerName; |
| | | @ApiModelProperty(value = "商户头像") |
| | | private String customerCover; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | |
| | | @ApiModelProperty(value = "供应商ID") |
| | | private Long supplierId;//商品id |
| | | |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @ApiModelProperty(value = "等级") |
| | | private Integer commentGrade; |
| | | |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @ApiModelProperty(value = "内容") |
| | | private String comment; |
| | | |
| | | /** |
| | | * 内容图片 |
| | | */ |
| | | @ApiModelProperty(value = "内容图片") |
| | | private String commentImages; |
| | | |
| | | /** |
| | | * 匿名标志 0-非匿名 1-匿名 |
| | | */ |
| | | @ApiModelProperty(value = "匿名标志") |
| | | private Integer anonymityFalg; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import java.sql.Blob; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * 商品评论表 |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-09-29 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("t_flower_comment") |
| | | public class FlowerCommentDO extends BaseEntity { |
| | | |
| | | |
| | | /** |
| | | * 订单id |
| | | */ |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 订单商品id |
| | | */ |
| | | private String orderItemId; |
| | | |
| | | /** |
| | | * 商户id |
| | | */ |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 商户用户ID |
| | | */ |
| | | private String customerUserId; |
| | | |
| | | /** |
| | | * 供应商Id |
| | | */ |
| | | private Long supplierId; |
| | | |
| | | /** |
| | | * 供应商用户Id |
| | | */ |
| | | private String supplierUserId; |
| | | |
| | | /** |
| | | * 商品id |
| | | */ |
| | | private Long flowerId; |
| | | |
| | | /** |
| | | * 商品图片 |
| | | */ |
| | | private String flowerCover; |
| | | |
| | | /** |
| | | * 等级 |
| | | */ |
| | | private Integer commentGrade; |
| | | |
| | | /** |
| | | * 内容 |
| | | */ |
| | | private String comment; |
| | | |
| | | /** |
| | | * 内容图片 |
| | | */ |
| | | private String commentImages; |
| | | |
| | | /** |
| | | * 匿名标志 0-非匿名 1-匿名 |
| | | */ |
| | | private Integer anonymityFalg; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.comment; |
| | | |
| | | import com.mzl.flower.entity.FlowerCommentDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 商品评论表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-09-29 |
| | | */ |
| | | public interface FlowerCommentMapper extends BaseMapper<FlowerCommentDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.comment; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentVO; |
| | | import com.mzl.flower.entity.FlowerCommentDO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 商品评论表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-09-29 |
| | | */ |
| | | public interface FlowerCommentMapperCustom extends BaseMapper<FlowerCommentDO> { |
| | | |
| | | List<FlowerCommentVO> getPage(Page page,@Param("param") QueryFlowerCommentDTO dto); |
| | | |
| | | List<FlowerCommentVO> getList(@Param("param") QueryFlowerCommentDTO dto); |
| | | |
| | | BigDecimal getSupplierAvgScore(@Param("supplierId") Long supplierId); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.comment; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.comment.CreateFlowerCommentBatchDTO; |
| | | import com.mzl.flower.dto.request.comment.CreateFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.comment.UpdateFlowerCommentDTO; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentStatisVO; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentVO; |
| | | import com.mzl.flower.entity.FlowerCommentDO; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 商品评论表 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-09-29 |
| | | */ |
| | | public interface FlowerCommentService extends IService<FlowerCommentDO> { |
| | | |
| | | boolean createFlowerComment(CreateFlowerCommentDTO dto); |
| | | |
| | | boolean updateFlowerComment(UpdateFlowerCommentDTO dto); |
| | | |
| | | boolean deleteFlowerComment(String id); |
| | | |
| | | FlowerCommentVO getDetailById(String id); |
| | | |
| | | Page<FlowerCommentVO> getPage(Page page, QueryFlowerCommentDTO dto); |
| | | |
| | | List<FlowerCommentVO> getList(QueryFlowerCommentDTO dto); |
| | | |
| | | FlowerCommentVO getByOrderItemId(String orderItemId); |
| | | |
| | | |
| | | /** |
| | | * 获取供应商的评论平均分 |
| | | * @param supplierId 供应商 |
| | | * @return |
| | | */ |
| | | BigDecimal getSupplierAvgScore(Long supplierId); |
| | | |
| | | /** |
| | | * 订单下所有商品的评论 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | boolean createFlowerCommentBatch(CreateFlowerCommentBatchDTO dto); |
| | | |
| | | FlowerCommentStatisVO getSupplierStatis(Long id); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.comment; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.comment.CreateFlowerCommentBatchDTO; |
| | | import com.mzl.flower.dto.request.comment.CreateFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.comment.UpdateFlowerCommentDTO; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentStatisVO; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentVO; |
| | | import com.mzl.flower.entity.FlowerCommentDO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.entity.payment.OrderItem; |
| | | import com.mzl.flower.entity.supplier.Supplier; |
| | | import com.mzl.flower.mapper.comment.FlowerCommentMapper; |
| | | import com.mzl.flower.mapper.comment.FlowerCommentMapperCustom; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.payment.OrderItemMapper; |
| | | import com.mzl.flower.mapper.payment.OrderMapper; |
| | | import com.mzl.flower.mapper.supplier.SupplierMapper; |
| | | import com.mzl.flower.service.comment.FlowerCommentService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 商品评论表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-09-29 |
| | | */ |
| | | @Service |
| | | public class FlowerCommentServiceImpl extends ServiceImpl<FlowerCommentMapper, FlowerCommentDO> implements FlowerCommentService { |
| | | |
| | | @Autowired |
| | | private FlowerCommentMapperCustom flowerCommentMapperCustom; |
| | | |
| | | @Autowired |
| | | private OrderItemMapper orderItemMapper; |
| | | |
| | | @Autowired |
| | | private SupplierMapper supplierMapper; |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | | private OrderMapper orderMapper; |
| | | |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean createFlowerComment(CreateFlowerCommentDTO dto) { |
| | | final FlowerCommentVO byOrderItemId = getByOrderItemId(dto.getOrderItemId()); |
| | | if(null!=byOrderItemId){ |
| | | throw new ValidationException("当前商品已经评论过!"); |
| | | } |
| | | |
| | | FlowerCommentDO flowerCommentDO=new FlowerCommentDO(); |
| | | BeanUtils.copyProperties(dto,flowerCommentDO); |
| | | flowerCommentDO.setId(IdUtil.simpleUUID()); |
| | | flowerCommentDO.create(SecurityUtils.getUserId()); |
| | | |
| | | final OrderItem orderItem = orderItemMapper.selectById(dto.getOrderItemId()); |
| | | if(null==orderItem){ |
| | | throw new ValidationException("当前订单项目不存在!"); |
| | | } |
| | | flowerCommentDO.setOrderId(orderItem.getOrderId()); |
| | | flowerCommentDO.setCustomerUserId(orderItem.getCreateBy()); |
| | | flowerCommentDO.setSupplierId(orderItem.getSupplierId()); |
| | | flowerCommentDO.setFlowerId(orderItem.getFlowerId()); |
| | | flowerCommentDO.setFlowerCover(orderItem.getFlowerCover()); |
| | | |
| | | // 补充商户信息 |
| | | Customer customer = customerMapper.selectOne(new QueryWrapper<Customer>() |
| | | .eq("user_id", orderItem.getCreateBy())); |
| | | if(null!=customer && null!=customer.getId()){ |
| | | flowerCommentDO.setCustomerId(customer.getId()); |
| | | } |
| | | |
| | | |
| | | // 补充供应商信息 |
| | | Supplier supplier = supplierMapper.selectById(orderItem.getSupplierId()); |
| | | if(null!=supplier && StringUtils.isNotBlank(supplier.getUserId())){ |
| | | flowerCommentDO.setSupplierUserId(supplier.getUserId()); |
| | | } |
| | | return baseMapper.insert(flowerCommentDO)>0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean updateFlowerComment(UpdateFlowerCommentDTO dto) { |
| | | FlowerCommentDO flowerCommentDO=baseMapper.selectById(dto.getId()); |
| | | BeanUtils.copyProperties(dto,flowerCommentDO); |
| | | flowerCommentDO.update(SecurityUtils.getUserId()); |
| | | |
| | | return baseMapper.updateById(flowerCommentDO)>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteFlowerComment(String id) { |
| | | return baseMapper.deleteById(id)>0; |
| | | } |
| | | |
| | | @Override |
| | | public FlowerCommentVO getDetailById(String id) { |
| | | QueryFlowerCommentDTO dto=new QueryFlowerCommentDTO(); |
| | | dto.setId(id); |
| | | final List<FlowerCommentVO> list = getList(dto); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Page<FlowerCommentVO> getPage(Page page, QueryFlowerCommentDTO dto) { |
| | | List<FlowerCommentVO> list=flowerCommentMapperCustom.getPage(page,dto); |
| | | return page.setRecords(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<FlowerCommentVO> getList(QueryFlowerCommentDTO dto) { |
| | | return flowerCommentMapperCustom.getList(dto); |
| | | } |
| | | |
| | | @Override |
| | | public FlowerCommentVO getByOrderItemId(String orderItemId) { |
| | | QueryFlowerCommentDTO dto=new QueryFlowerCommentDTO(); |
| | | dto.setOrderItemId(orderItemId); |
| | | final List<FlowerCommentVO> list = getList(dto); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSupplierAvgScore(Long supplierId) { |
| | | return flowerCommentMapperCustom.getSupplierAvgScore(supplierId); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean createFlowerCommentBatch(CreateFlowerCommentBatchDTO dto) { |
| | | if(CollectionUtils.isNotEmpty(dto.getList())){ |
| | | dto.getList().forEach(item->{ |
| | | // 保存评论信息 |
| | | final FlowerCommentVO byOrderItemId = getByOrderItemId(item.getOrderItemId()); |
| | | if(null!=byOrderItemId){ |
| | | // 更新 |
| | | UpdateFlowerCommentDTO updateFlowerCommentDTO=new UpdateFlowerCommentDTO(); |
| | | BeanUtils.copyProperties(item,updateFlowerCommentDTO); |
| | | updateFlowerCommentDTO.setId(byOrderItemId.getId()); |
| | | updateFlowerComment(updateFlowerCommentDTO); |
| | | }else{ |
| | | createFlowerComment(item); |
| | | } |
| | | |
| | | }); |
| | | // 设置订单的评论状态为评论的下个阶段 |
| | | Order order=orderMapper.selectById(dto.getOrderId()); |
| | | |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public FlowerCommentStatisVO getSupplierStatis(Long supplierId) { |
| | | FlowerCommentStatisVO vo=new FlowerCommentStatisVO(); |
| | | |
| | | // 获取平均分 |
| | | final BigDecimal supplierAvgScore = flowerCommentMapperCustom.getSupplierAvgScore(supplierId); |
| | | vo.setAvg(supplierAvgScore); |
| | | |
| | | //当前商家评论总数 |
| | | final Integer amount = baseMapper.selectCount(new QueryWrapper<FlowerCommentDO>().lambda().eq(FlowerCommentDO::getSupplierId, supplierId)); |
| | | vo.setCommentAmount(amount); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.PriceDTO; |
| | | import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.menber.MemberGrowthRecordDTO; |
| | | import com.mzl.flower.dto.request.payment.*; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCartListDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCartListWrapDTO; |
| | |
| | | import com.mzl.flower.mapper.system.UserWechatMapper; |
| | | import com.mzl.flower.mapper.warehouse.WarehouseLocationMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.comment.FlowerCommentService; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.flower.FlowerService; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private FlowerCommentService flowerCommentService; |
| | | |
| | | |
| | | public void changeFlower2Cart(CartSaveDTO dto) { |
| | | String userId = SecurityUtils.getUserId(); |
| | |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId()); |
| | | Integer tmp=completeNumToday+c.getNum(); |
| | | if(null!=tmp && null!=flowerDetail.getLimited() |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | |
| | | |
| | | // 限购 1.首先查看购物车中的数量是否已经超过限售数量 |
| | | if(null!=c.getNum() && null!=flowerDetail.getLimited() |
| | | && c.getNum().compareTo(flowerDetail.getLimited())>0){ |
| | | && c.getNum().compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("数量不能超过限售数量!"); |
| | | } |
| | | |
| | |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId()); |
| | | Integer tmp=completeNumToday+c.getNum(); |
| | | if(null!=tmp && null!=flowerDetail.getLimited() |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | |
| | | new QueryWrapper<OrderItem>().eq("order_id", id)); |
| | | |
| | | Map<Long, String> stationMap = prepareStationMap(); |
| | | Map<String, FlowerCommentVO> commentMap=prepareCommentMap(id); |
| | | |
| | | List<OrderItemListDTO> result = new ArrayList<>(); |
| | | for (OrderItem oi : ls) { |
| | |
| | | |
| | | dto.setStationName(stationMap.get(oi.getStationId())); |
| | | |
| | | // 评论 |
| | | final FlowerCommentVO flowerCommentVO = commentMap.get(oi.getId()); |
| | | copyCommentInfo(dto,flowerCommentVO); |
| | | |
| | | result.add(dto); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private Map<String, FlowerCommentVO> prepareCommentMap(String orderId) { |
| | | QueryFlowerCommentDTO queryFlowerCommentDTO = new QueryFlowerCommentDTO(); |
| | | queryFlowerCommentDTO.setOrderId(orderId); |
| | | final List<FlowerCommentVO> list = flowerCommentService.getList(queryFlowerCommentDTO); |
| | | if (list == null || list.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | // 将 List 转换为 Map,其中 key 为 FlowerCommentVO 的 id |
| | | return list.stream().collect(Collectors.toMap(FlowerCommentVO::getOrderItemId, item -> item)); |
| | | } |
| | | |
| | | |
| | | private void copyCommentInfo(OrderItemListDTO dto,FlowerCommentVO flowerCommentVO){ |
| | | if(null != dto && null!=flowerCommentVO){ |
| | | dto.setCommentGrade(flowerCommentVO.getCommentGrade()); |
| | | dto.setComment(flowerCommentVO.getComment()); |
| | | dto.setCommentImages(flowerCommentVO.getCommentImages()); |
| | | dto.setAnonymityFalg(flowerCommentVO.getAnonymityFalg()); |
| | | } |
| | | } |
| | | |
| | | public List<Order> autoReceive() { |
| | |
| | | // 新增 |
| | | cartMapper.updateById(cart); |
| | | }else{ |
| | | // 更新 |
| | | // 更新 |
| | | cartMapper.insert(cart); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.comment; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.comment.CreateFlowerCommentBatchDTO; |
| | | import com.mzl.flower.dto.request.comment.CreateFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO; |
| | | import com.mzl.flower.dto.request.comment.UpdateFlowerCommentDTO; |
| | | import com.mzl.flower.dto.response.comment.FlowerCommentVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.service.comment.FlowerCommentService; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mzl.flower.entity.FlowerCommentDO; |
| | | |
| | | |
| | | /** |
| | | * 商品评论表前端控制器 |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-09-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/flower-comment") |
| | | @Api(value = "商品评论", tags = "商品评论") |
| | | @Validated |
| | | public class FlowerCommentController extends BaseController { |
| | | |
| | | @Autowired |
| | | private FlowerCommentService flowerCommentService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateFlowerCommentDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | flowerCommentService.createFlowerComment(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PostMapping("/batch") |
| | | @ApiOperation(value = "批量新增", notes = "批量新增") |
| | | public ResponseEntity<ReturnDataDTO> createBatch(@Validated @RequestBody CreateFlowerCommentBatchDTO dto) { |
| | | |
| | | // |
| | | flowerCommentService.createFlowerCommentBatch(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody UpdateFlowerCommentDTO dto) { |
| | | |
| | | // 手动设置id值 |
| | | dto.setId(id); |
| | | flowerCommentService.updateFlowerComment(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | FlowerCommentDO flowerCommentDO = flowerCommentService.getById(id); |
| | | if (null == flowerCommentDO) { |
| | | throw new ValidationException("评论不存在"); |
| | | } |
| | | flowerCommentService.deleteFlowerComment(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | FlowerCommentVO flowerCommentVO = flowerCommentService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(flowerCommentVO, FlowerCommentVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page(Page page, QueryFlowerCommentDTO dto) { |
| | | // 设置只查询活动优惠券的 |
| | | |
| | | Page<FlowerCommentVO> resultPage = flowerCommentService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, FlowerCommentVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryFlowerCommentDTO dto) { |
| | | // 设置只查询活动优惠券的 |
| | | |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(flowerCommentService.getList(dto), FlowerCommentVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/avg/{id}") |
| | | @ApiOperation(value = "平均分", notes = "平均分") |
| | | public ResponseEntity<ReturnDataDTO> getCommentAvg(@PathVariable Long id) { |
| | | return returnData(R.SUCCESS.getCode(), flowerCommentService.getSupplierAvgScore(id)); |
| | | } |
| | | |
| | | @GetMapping("/statis/{id}") |
| | | @ApiOperation(value = "统计", notes = "统计") |
| | | public ResponseEntity<ReturnDataDTO> getStatis(@PathVariable Long id) { |
| | | return returnData(R.SUCCESS.getCode(), flowerCommentService.getSupplierStatis(id)); |
| | | } |
| | | |
| | | private void valid(CreateFlowerCommentDTO dto){ |
| | | |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.comment.FlowerCommentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.FlowerCommentDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="flower_id" property="flowerId" /> |
| | | <result column="flower_cover" property="flowerCover" /> |
| | | <result column="comment_grade" property="commentGrade" /> |
| | | <result column="comment" property="comment" /> |
| | | <result column="comment_images" property="commentImages" /> |
| | | <result column="anonymity_falg" property="anonymityFalg" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.comment.FlowerCommentMapperCustom"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.FlowerCommentDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="order_item_id" property="orderItemId" /> |
| | | |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="customer_user_id" property="customerUserId" /> |
| | | <result column="supplier_id" property="supplierId" /> |
| | | <result column="supplier_user_id" property="supplierUserId" /> |
| | | |
| | | <result column="flower_id" property="flowerId" /> |
| | | <result column="flower_cover" property="flowerCover" /> |
| | | <result column="comment_grade" property="commentGrade" /> |
| | | <result column="comment" property="comment" /> |
| | | <result column="comment_images" property="commentImages" /> |
| | | <result column="anonymity_falg" property="anonymityFalg" /> |
| | | </resultMap> |
| | | <select id="getPage" resultType="com.mzl.flower.dto.response.comment.FlowerCommentVO"> |
| | | <include refid="baseSql" /> |
| | | </select> |
| | | <select id="getList" resultType="com.mzl.flower.dto.response.comment.FlowerCommentVO"> |
| | | <include refid="baseSql" /> |
| | | </select> |
| | | <select id="getSupplierAvgScore" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | COALESCE(ROUND(SUM(c.comment_grade) / NULLIF(COUNT(1), 0), 1), 0) AS average_grade |
| | | FROM t_flower_comment c |
| | | WHERE c.deleted = false |
| | | AND c.supplier_id = #{supplierId} |
| | | </select> |
| | | |
| | | <sql id="baseSql"> |
| | | select c.*, |
| | | oi.flower_name, |
| | | oi.flower_unit, |
| | | oi.flower_color, |
| | | oi.flower_level, |
| | | oi.flower_category, |
| | | ci.name as customer_name, |
| | | ci.cover as customer_cover |
| | | from t_flower_comment c |
| | | left join t_order_item oi |
| | | on c.order_item_id=oi.id |
| | | left join t_customer_info ci |
| | | on c.customer_id=ci.id |
| | | where c.deleted=false |
| | | <if test="param.id != null and param.id != ''"> |
| | | and c.id = #{param.id} |
| | | </if> |
| | | <if test="param.orderId != null and param.orderId != ''"> |
| | | and c.order_id = #{param.orderId} |
| | | </if> |
| | | <if test="param.orderItemId != null and param.orderItemId != ''"> |
| | | and c.order_item_id = #{param.orderItemId} |
| | | </if> |
| | | <if test="param.customerId != null "> |
| | | and c.customer_id = #{param.customerId} |
| | | </if> |
| | | <if test="param.supplierId != null"> |
| | | and c.supplier_id = #{param.supplierId} |
| | | </if> |
| | | <if test="param.flowerId != null"> |
| | | and c.flower_id = #{param.flowerId} |
| | | </if> |
| | | |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="getOrderDateReport" resultType="com.mzl.flower.dto.response.report.OrderReportResultVO"> |
| | | select |
| | | sum(order_total) as order_total, |
| | | sum(order_supplier_price_amount) as order_supplier_price_amount, |
| | | sum(order_markup_one_amount) as order_markup_one_amount, |
| | | sum(order_markup_two_amount) as order_markup_two_amount, |
| | | sum(order_markup_partner_amount) as order_markup_partner_amount, |
| | | sum(order_price_discount_amount) as order_price_discount_amount, |
| | | sum(order_coupon_amount_total) as order_coupon_amount_total, |
| | | sum(order_check_fee) as order_check_fee, |
| | | sum(order_lack_fee_supplier) as order_lack_fee_supplier, |
| | | sum(order_replace_fee) as order_replace_fee, |
| | | sum(order_fee_supplier) as order_fee_supplier, |
| | | sum(order_fee_partner) as order_fee_partner, |
| | | sum(order_fee_platform) as order_fee_platform, |
| | | sum(order_fee_platform_pack) as order_fee_platform_pack, |
| | | sum(order_fee_platform_check) as order_fee_platform_check, |
| | | sum(order_fee_platform_transport) as order_fee_platform_transport, |
| | | sum(order_total_fee) as order_total_fee, |
| | | sum(order_fee_packing_transport) as order_fee_packing_transport, |
| | | sum(order_num) as order_num, |
| | | sum(order_replace_num) as order_replace_num, |
| | | sum(order_reduce_num) as order_reduce_num, |
| | | sum(order_lack_num) as order_lack_num, |
| | | sum(order_num)-sum(order_lack_num) as real_sale_num |
| | | from ( |
| | | select |
| | | o.order_no,o.payment_time,o.status_backend,vor.* |
| | | from t_order o |
| | | left join ( |
| | | <include refid="baseSql"></include> |
| | | ) vor |
| | | on o.id =vor.order_id |
| | | where o.deleted=0 |
| | | and o.status_backend not in ('PENDING','CANCEL','REFUND') |
| | | <if test="dto.startDate != null"> |
| | | and o.payment_time > #{dto.startDate} |
| | | </if> |
| | | <if test="dto.endDate != null"> |
| | | and o.payment_time <= #{dto.endDate} |
| | | </if> |
| | | <if test="dto.partnerId != null"> |
| | | and o.create_by in ( |
| | | select user_id from t_customer_info where partner_id=#{dto.partnerId} |
| | | ) |
| | | </if> |
| | | ) t |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="getOrderDateReport2" resultType="com.mzl.flower.dto.response.report.OrderReportResultVO"> |
| | | select |
| | | sum(order_total) as order_total, |
| | | sum(order_supplier_price_amount) as order_supplier_price_amount, |
| | | sum(order_markup_one_amount) as order_markup_one_amount, |
| | |
| | | vor.order_num-vor.order_lack_num as real_sale_num, |
| | | vor.* |
| | | from t_order o |
| | | left join ( |
| | | <include refid="baseSql"></include> |
| | | ) vor |
| | | on o.id =vor.order_id |
| | | where o.deleted=0 |
| | | and o.status_backend not in ('PENDING','CANCEL','REFUND') |
| | | <if test="dto.startDate != null"> |
| | | and o.payment_time > #{dto.startDate} |
| | | </if> |
| | | <if test="dto.endDate != null"> |
| | | and o.payment_time <= #{dto.endDate} |
| | | </if> |
| | | <if test="dto.partnerId != null"> |
| | | and o.create_by in ( |
| | | select user_id from t_customer_info where partner_id=#{dto.partnerId} |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getOrderDetailReport2" resultType="com.mzl.flower.dto.response.report.OrderDetailReportResultVO"> |
| | | select |
| | | o.order_no, |
| | | o.customer, |
| | | CONCAT( o.customer_province, ' ', o.customer_city, ' ', o.customer_region, ' ', o.customer_address ) AS address, |
| | | o.partner_name, |
| | | o.create_time as orderDate, |
| | | o.payment_time, |
| | | o.status_backend as settleStatus, |
| | | vor.order_num-vor.order_lack_num as real_sale_num, |
| | | vor.* |
| | | from t_order o |
| | | left join v_order_report vor |
| | | on o.id =vor.order_id |
| | | where o.deleted=0 |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <sql id="baseSql"> |
| | | select t2.*, |
| | | IFNULL(t3.fee_supplier,0) as order_fee_supplier, |
| | | IFNULL(t3.fee_partner,0) as order_fee_partner, |
| | | IFNULL(t3.fee_platform,0) as order_fee_platform, |
| | | IFNULL(t3.fee_platform_pack,0) as order_fee_platform_pack, |
| | | IFNULL(t3.fee_platform_check,0) as order_fee_platform_check, |
| | | IFNULL(t3.fee_platform_transport,0) as order_fee_platform_transport, |
| | | IFNULL(t3.total_fee,0) as order_total_fee, |
| | | IFNULL(t3.fee_packing_transport,0) as order_fee_packing_transport |
| | | from ( |
| | | select |
| | | t1.order_id,sum(t1.num) as order_num , sum(t1.total) as order_total, sum(t1.supplier_price_amount) as order_supplier_price_amount, sum(t1.markup_one_amount) as order_markup_one_amount,sum(t1.markup_two_amount) as order_markup_two_amount, sum(t1.markup_partner_amount) as order_markup_partner_amount,sum(t1.price_amount) as order_price_amount,sum(t1.original_price_amount) as order_original_price_amount,sum(t1.price_discount_amount) as order_price_discount_amount,sum(t1.coupon_amount_total) as order_coupon_amount_total,sum(t1.check_fee) as order_check_fee,sum(t1.lack_fee_supplier) as order_lack_fee_supplier,sum(t1.replace_fee) as order_replace_fee, |
| | | sum(replace_num) as order_replace_num,sum(reduce_num) as order_reduce_num,sum(lack_num) as order_lack_num |
| | | from ( |
| | | SELECT |
| | | oi.order_id, |
| | | oi.id, |
| | | IFNULL(oi.num,0) as num, |
| | | IFNULL(oi.total,0) as total, |
| | | IFNULL(oi.supplier_price,0) as supplier_price, |
| | | IFNULL(oi.supplier_price,0) * IFNULL(oi.num,0) as supplier_price_amount, |
| | | |
| | | IFNULL(oi.markup_one,0) as markup_one, |
| | | IFNULL(oi.markup_one,0)* IFNULL(oi.num,0) as markup_one_amount, |
| | | |
| | | IFNULL(oi.markup_two,0) as markup_two, |
| | | IFNULL(oi.markup_two,0)* IFNULL(oi.num,0) as markup_two_amount, |
| | | |
| | | IFNULL(oi.markup_partner,0) as markup_partner, |
| | | IFNULL(oi.markup_partner,0)* IFNULL(oi.num,0) as markup_partner_amount, |
| | | IFNULL(oi.price,0) as price, |
| | | IFNULL(oi.price,0)* IFNULL(oi.num,0) as price_amount, |
| | | |
| | | IFNULL(oi.original_price,0) as original_price, |
| | | IFNULL(oi.original_price,0)*IFNULL(oi.num,0) as original_price_amount, |
| | | |
| | | IFNULL(oi.original_price,0)*IFNULL(oi.num,0) - IFNULL(oi.price,0)* IFNULL(oi.num,0) as price_discount_amount, |
| | | |
| | | |
| | | IFNULL(oi.real_price,0) as real_price, |
| | | IFNULL(oi.real_total,0) as real_total, |
| | | |
| | | IFNULL(oi.coupon_amount_total,0) as coupon_amount_total, |
| | | |
| | | IFNULL(ois.check_fee,0) as check_fee, |
| | | IFNULL(ois.lack_fee_supplier,0) as lack_fee_supplier, |
| | | IFNULL(ois.replace_fee,0) as replace_fee |
| | | |
| | | ,IFNULL( (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'replace'),0) as replace_num |
| | | ,IFNULL( (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'reduce'),0) as reduce_num |
| | | ,IFNULL( (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'lack'),0) as lack_num |
| | | FROM t_order o |
| | | left join t_order_item oi |
| | | on oi.order_id=o.id |
| | | left join t_station s on s.id = oi.station_id |
| | | left join t_supplier_info si on si.id = oi.supplier_id |
| | | left join t_order_item_settlement ois on ois.order_item_id = oi.id |
| | | WHERE oi.deleted = 0 |
| | | <if test="dto.startDate != null"> |
| | | and o.payment_time > #{dto.startDate} |
| | | </if> |
| | | <if test="dto.endDate != null"> |
| | | and o.payment_time <= #{dto.endDate} |
| | | </if> |
| | | )t1 |
| | | group by order_id |
| | | ) t2 |
| | | left join ( |
| | | select |
| | | ois.order_id, |
| | | IFNULL(sum(ois.fee_supplier),0) as fee_supplier, |
| | | IFNULL(sum(ois.fee_partner),0) as fee_partner, |
| | | IFNULL(sum(ois.fee_platform),0) as fee_platform, |
| | | IFNULL(sum(ois.fee_platform_pack),0) as fee_platform_pack, |
| | | IFNULL(sum(ois.fee_platform_check),0) as fee_platform_check, |
| | | IFNULL(sum(ois.fee_platform_transport),0) as fee_platform_transport, |
| | | IFNULL(sum(ois.total_fee),0) as total_fee, |
| | | IFNULL(sum(ois.fee_packing_transport),0) as fee_packing_transport |
| | | from t_order_item_sales ois |
| | | group by order_id |
| | | )t3 |
| | | on t2.order_id =t3.order_id |
| | | </sql> |
| | | |
| | | </mapper> |