From 910ca2f0f8594a1353f822d653c88a7924902217 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Mon, 28 Jun 2021 19:32:18 +0800 Subject: [PATCH] Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop --- gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java | 27 ++++++ gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderItemsMapper.java | 5 + gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java | 7 + gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailsVo.java | 33 ++++++++ gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml | 29 +++++++ gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java | 22 +++++ gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailItemsVo.java | 30 +++++++ gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml | 3 gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java | 5 + gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java | 28 ++++++ gc-order/src/main/java/com/xzx/gc/order/dto/JhyOrderListDto.java | 6 + 11 files changed, 186 insertions(+), 9 deletions(-) diff --git a/gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java b/gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java index 25b69bb..6d6f5c9 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java +++ b/gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java @@ -1,16 +1,21 @@ package com.xzx.gc.order.controller; +import com.github.pagehelper.PageInfo; import com.xzx.gc.common.Result; import com.xzx.gc.common.request.BaseController; import com.xzx.gc.model.JsonResult; import com.xzx.gc.order.dto.AddJhyOrderDto; import com.xzx.gc.order.dto.JhyOrderListDto; import com.xzx.gc.order.service.JhyOrderService; +import com.xzx.gc.order.vo.JhyOrderDetailsVo; import com.xzx.gc.order.vo.JhyOrderListVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @@ -34,10 +39,23 @@ } @ApiOperation("集物员订单列表") + @ApiResponses( + @ApiResponse(code = 200, message = "success", response = JhyOrderListVo.class) + ) @PostMapping(value = "/jhy/order/list") - public JsonResult<JhyOrderListVo> orderList(@RequestBody JhyOrderListDto jhyOrderListDto) { - return null; + public JsonResult<PageInfo<JhyOrderListVo>> orderList(@RequestBody JhyOrderListDto jhyOrderListDto, HttpServletRequest request) { + jhyOrderListDto.setUserId(getUserId(request)); + PageInfo<JhyOrderListVo> result = jhyOrderService.orderList(jhyOrderListDto); + return JsonResult.success(result); } + @ApiOperation("订单明细信息") + @ApiResponses( + @ApiResponse(code = 200, message = "success", response = JhyOrderDetailsVo.class) + ) + @PostMapping(value = "/jhy/order/details/{orderId}") + public JsonResult<Object> orderDetail(@PathVariable("orderId") Long orderId, HttpServletRequest request) { + return JsonResult.success(jhyOrderService.orderDetails(orderId, getUserId(request))); + } } diff --git a/gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java b/gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java index 81ebc3f..1364119 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java +++ b/gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java @@ -11,10 +11,13 @@ @ApiModel(value = "AddJhyOrderDto", description = "小程序下单参数接收类") public class AddJhyOrderDto { + @ApiModelProperty(value = "地址类型") + private String addressType; + @ApiModelProperty(value = "地址ID") private Long addressId; -// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @ApiModelProperty(value = "预约日期") private Date reserveDate; diff --git a/gc-order/src/main/java/com/xzx/gc/order/dto/JhyOrderListDto.java b/gc-order/src/main/java/com/xzx/gc/order/dto/JhyOrderListDto.java index 913648e..e0cafe7 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/dto/JhyOrderListDto.java +++ b/gc-order/src/main/java/com/xzx/gc/order/dto/JhyOrderListDto.java @@ -15,8 +15,12 @@ @ApiModelProperty(value="每页显示记录数") private int pageSize=10; - @ApiModelProperty(value = "状态 1-新任务 2-服务中 3-待入库 4-已完成") + @ApiModelProperty(value = "状态 用户:1-待接单 2-服务中 3-已完成 5-已取消 集物员:1-新任务 2-服务中 3-待入库 4-已完成") private Integer status; + @ApiModelProperty(value = "1-用户 2-集物员") + private Integer type; + @ApiModelProperty(hidden = true) + private String userId; } diff --git a/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderItemsMapper.java b/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderItemsMapper.java index 765f687..3229829 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderItemsMapper.java +++ b/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderItemsMapper.java @@ -2,6 +2,11 @@ import com.xzx.gc.entity.JhyOrderItems; import com.xzx.gc.util.GcMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; public interface JhyOrderItemsMapper extends GcMapper<JhyOrderItems> { + + List<JhyOrderItems> selectOrderItems(@Param("orderId") Long orderId); } diff --git a/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java b/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java index 6ac4580..01156c0 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java +++ b/gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java @@ -1,9 +1,16 @@ package com.xzx.gc.order.mapper; import com.xzx.gc.entity.JhyOrder; +import com.xzx.gc.order.dto.JhyOrderListDto; +import com.xzx.gc.order.vo.JhyOrderListVo; import com.xzx.gc.util.GcMapper; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; + +import java.util.List; @Repository public interface JhyOrderMapper extends GcMapper<JhyOrder> { + + List<JhyOrderListVo> selectJhyOrderList(@Param("record") JhyOrderListDto jhyOrderListDto); } diff --git a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java index 6f646d4..9859109 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java +++ b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java @@ -1,6 +1,9 @@ package com.xzx.gc.order.service; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.xzx.gc.common.constant.Constants; import com.xzx.gc.common.utils.IdUtils; import com.xzx.gc.entity.AddressInfo; @@ -13,6 +16,7 @@ import com.xzx.gc.order.mapper.JhyOrderItemsMapper; import com.xzx.gc.order.mapper.JhyOrderMapper; import com.xzx.gc.order.mapper.SysEnvironmentalInfoMapper; +import com.xzx.gc.order.vo.JhyOrderDetailsVo; import com.xzx.gc.order.vo.JhyOrderListVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -91,7 +95,27 @@ } } - public List<JhyOrderListVo> orderList(JhyOrderListDto orderListDto) { - return null; + public PageInfo<JhyOrderListVo> orderList(JhyOrderListDto orderListDto) { + PageHelper.startPage(orderListDto.getPageNo(), orderListDto.getPageSize()); + List<JhyOrderListVo> data = jhyOrderMapper.selectJhyOrderList(orderListDto); + return new PageInfo<>(data); + } + + public JhyOrderDetailsVo orderDetails(Long orderId, String userId) { + JhyOrder order = jhyOrderMapper.selectByPrimaryKey(orderId); + List<JhyOrderItems> items = jhyOrderItemsMapper.selectOrderItems(orderId); + + BigDecimal total = BigDecimal.ZERO; + for (JhyOrderItems item : items) { + total = total.add(StrUtil.isNotBlank(item.getScore()) ? new BigDecimal(item.getScore()) : BigDecimal.ZERO); + } + + JhyOrderDetailsVo detailsVo = new JhyOrderDetailsVo(); + BeanUtil.copyProperties(order, detailsVo); + + detailsVo.setAddress(order.getArea() + order.getAddress()); + detailsVo.setTotalPrice(total); + detailsVo.setItems(items); + return detailsVo; } } diff --git a/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailItemsVo.java b/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailItemsVo.java new file mode 100644 index 0000000..4621a9e --- /dev/null +++ b/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailItemsVo.java @@ -0,0 +1,30 @@ +package com.xzx.gc.order.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ApiModel(value = "JhyOrderDetailItemsVo", description = "集物员订单详情返回参数类") +public class JhyOrderDetailItemsVo { + + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("明细标题") + private String title; + + @ApiModelProperty("单价") + private BigDecimal price; + + @ApiModelProperty("图片") + private String picture; + + @ApiModelProperty(value = "重量") + private String weight; + + @ApiModelProperty(value = "积分") + private String score; +} diff --git a/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailsVo.java b/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailsVo.java new file mode 100644 index 0000000..6fd9c95 --- /dev/null +++ b/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderDetailsVo.java @@ -0,0 +1,33 @@ +package com.xzx.gc.order.vo; + +import com.xzx.gc.entity.JhyOrderItems; +import com.xzx.gc.entity.OrderItemInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +@ApiModel(value = "JhyOrderDetailsVo", description = "订单详情返回参数类") +public class JhyOrderDetailsVo { + + @ApiModelProperty(value = "地址") + private String address; + + @ApiModelProperty(value = "姓名") + private String username; + + @ApiModelProperty(value = "手机号") + private String phone; + + @ApiModelProperty(value = "订单编号") + private String orderNo; + + @ApiModelProperty(value = "总积分") + private BigDecimal totalPrice; + + @ApiModelProperty(value = "明细") + private List<JhyOrderItems> items; +} diff --git a/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java b/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java index 0d9fdad..6b0b83f 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java +++ b/gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java @@ -15,7 +15,7 @@ private String reserveTime; @ApiModelProperty(value = "姓名") - private String name; + private String username; @ApiModelProperty(value = "手机号") private String phone; @@ -27,14 +27,35 @@ private String address; @ApiModelProperty(value = "经度") - private String lon; + private String longitude; @ApiModelProperty(value = "纬度") - private String lat; + private String latitude; @ApiModelProperty(value = "重量") private String weight; @ApiModelProperty(value = "备注") private String remark; + + @ApiModelProperty(value = "入库时间") + private String storageTime; + + @ApiModelProperty(value = "入库重量") + private String storageWeight; + + @ApiModelProperty(value = "入库积分") + private String storageScore; + + @ApiModelProperty(value = "回收重量") + private String recycleWeight; + + @ApiModelProperty(value = "回收积分") + private String recycleScore; + + @ApiModelProperty(value = "损耗重量") + private int lossWeight; + + @ApiModelProperty(value = "状态") + private Integer status; } \ No newline at end of file diff --git a/gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml b/gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml index 6406d64..f8eb86f 100644 --- a/gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml +++ b/gc-order/src/main/resources/mapper/order/JhyOrderItemsMapper.xml @@ -2,4 +2,7 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xzx.gc.order.mapper.JhyOrderItemsMapper"> + <select id="selectOrderItems" resultType="com.xzx.gc.entity.JhyOrderItems"> + select * from xzx_jhy_order_items where order_id=#{orderId} + </select> </mapper> \ No newline at end of file diff --git a/gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml b/gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml index 423755c..abb1a85 100644 --- a/gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml +++ b/gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml @@ -2,4 +2,33 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xzx.gc.order.mapper.JhyOrderMapper"> + <select id="selectJhyOrderList" resultType="com.xzx.gc.order.vo.JhyOrderListVo"> + select + a.id orderid + ,a.username + ,CONCAT(a.area, a.address) address + ,a.longitude + ,a.latitude + ,a.weight + ,a.status + ,a.remark + ,CONCAT(a.reserve_date, ' ', a.reserve_time) reserveTime + ,GROUP_CONCAT(b.title) items + from xzx_jhy_order a + inner join xzx_jhy_order_items b on a.id=b.order_id + <where> + <if test="record.type == 1"> + and user_id=#{record.userId} + </if> + <if test="record.type == 2"> + <if test="record.status != 1"> + and jhy_id=#{record.userId} + </if> + </if> + <if test="record.status != null and record.status != ''"> + and a.status = #{record.status} + </if> + </where> + group by a.id + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1