Browse Source

朗通后台产品申请显示接口

wangyu 6 years ago
parent
commit
dfa3822676

+ 13 - 0
diagbotman-service/src/main/java/com/diagbot/entity/ProductOrder.java

@@ -72,6 +72,19 @@ public class ProductOrder implements Serializable {
      */
     private BigDecimal totalPrices;
 
+    /**
+     * 审核状态
+
+     */
+    private Integer auditStatus;
+
+    public Integer getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(Integer auditStatus) {
+        this.auditStatus = auditStatus;
+    }
 
     public Long getId() {
         return id;

+ 49 - 0
diagbotman-service/src/main/java/com/diagbot/entity/ProductOrderIndex.java

@@ -0,0 +1,49 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 订单表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2018-09-18
+ */
+@Getter
+@Setter
+public class ProductOrderIndex implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * 订单编号
+     */
+    private String num;
+
+    /**
+     * 审核状态
+
+     */
+    private Integer auditStatus;
+
+    /**
+     每页显示条数
+     */
+    private Long size;
+
+    /**
+     页数
+     */
+    private Long current;
+
+    /**
+     * 入参页数
+     */
+    private Long index;
+
+}

+ 22 - 0
diagbotman-service/src/main/java/com/diagbot/entity/wrapper/ProductOrderWrapper.java

@@ -0,0 +1,22 @@
+package com.diagbot.entity.wrapper;
+
+import com.diagbot.entity.ProductOrder;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/9/24 19:47
+ */
+@Getter
+@Setter
+public class ProductOrderWrapper extends ProductOrder {
+    private String username;// 用户名
+    private String linkman;//联系人
+    private String email;// 邮箱
+    private Long orgId;//机构ID
+    private String orgName;//机构名称
+    private Integer isReject; //是否通过认证
+    private Integer auStatus;  //认证状态(0:未认证,1:已认证,2:认证中)
+}

+ 54 - 7
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -1,12 +1,5 @@
 package com.diagbot.facade;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.UserServiceClient;
@@ -15,9 +8,12 @@ import com.diagbot.dto.UserOrgDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.OpenedProductsIndex;
 import com.diagbot.entity.OrderDetails;
+import com.diagbot.entity.OrderDetailsIndex;
+import com.diagbot.entity.ProductOrderIndex;
 import com.diagbot.entity.wrapper.LantoneProductWrapper;
 import com.diagbot.entity.wrapper.OpendProductWrapper;
 import com.diagbot.entity.wrapper.OrderDetailsWapper;
+import com.diagbot.entity.wrapper.ProductOrderWrapper;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.LantoneProductServiceImpl;
@@ -25,6 +21,13 @@ import com.diagbot.util.BeanUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.OppendedProductVO;
 import com.diagbot.vo.OrderDetialsVO;
+import com.diagbot.vo.ProductOrderVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description:产品业务层
@@ -209,4 +212,48 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
        }
        return list;
    }
+
+    /**
+     * @Description: 产品申请查询所有订单信息
+     * @Author: wangyu
+     * @Date: 20:23 2018/9/24
+     */
+    public List<ProductOrderWrapper> selectAllProductOrder(ProductOrderVO productOrderVO){
+        ProductOrderIndex productOrderIndex =new ProductOrderIndex();
+        Long curren = productOrderVO.getCurrent();
+        Long size =productOrderVO.getSize();
+        if(curren==null){
+            productOrderVO.setCurrent(1L);
+        }
+        if (size==null){
+            productOrderVO.setSize(10L);
+        }
+        BeanUtil.copyProperties(productOrderVO, productOrderIndex);
+        productOrderIndex.setIndex((productOrderVO.getCurrent().longValue()-1)*productOrderVO.getSize().longValue());
+        List<ProductOrderWrapper> list =productOrderFacade.selectAllProductOrder(productOrderIndex);
+        List<Long> list1 =new ArrayList<>();
+        for (ProductOrderWrapper productOrderWrapper:list) {
+            Long longs = productOrderWrapper.getUserId();
+            list1.add(longs);
+        }
+        RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
+        if(mapRespDTO == null || !"0".equals(mapRespDTO.code) ) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                    "获取用户和机构信息失败");
+        }
+        Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;
+        for(ProductOrderWrapper bean : list) {
+            UserOrgDTO uo = dataMap.get(bean.getUserId());
+            if(uo != null) {
+                bean.setUsername(uo.getUsername());
+                bean.setLinkman(uo.getLinkman());
+                bean.setEmail(uo.getEmail());
+                bean.setOrgId(uo.getOrgId());
+                bean.setOrgName(uo.getOrgName());
+                bean.setIsReject(uo.getIsReject());
+                bean.setAuStatus(uo.getAuStatus());
+            }
+        }
+        return list;
+    }
 }

+ 15 - 2
diagbotman-service/src/main/java/com/diagbot/mapper/ProductOrderMapper.java

@@ -3,6 +3,8 @@ package com.diagbot.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.AuthDetailDTO;
 import com.diagbot.entity.ProductOrder;
+import com.diagbot.entity.ProductOrderIndex;
+import com.diagbot.entity.wrapper.ProductOrderWrapper;
 
 import java.util.List;
 
@@ -15,9 +17,13 @@ import java.util.List;
  * @since 2018-09-18
  */
 public interface ProductOrderMapper extends BaseMapper<ProductOrder> {
-	
+	/**
+	 * @Description: 根据用户id查询订单信息
+	 * @Author: wangyu
+	 * @Date: 19:39 2018/9/20
+	 */
 	List<ProductOrder> getUserProductOrder(Long userId);
-	
+
 	List<AuthDetailDTO> getOrderDetails(String orderNum);
 
 	/**
@@ -32,4 +38,11 @@ public interface ProductOrderMapper extends BaseMapper<ProductOrder> {
 	 * @return
 	 */
 	int waitExamOrderCou();
+
+	/**
+	 * @Description: 订单申请查询所有订单信息接口
+	 * @Author: wangyu
+	 * @Date: 19:39 2018/9/20
+	 */
+	public List<ProductOrderWrapper> selectAllProductOrder(ProductOrderIndex productOrderIndex);
 }

+ 9 - 0
diagbotman-service/src/main/java/com/diagbot/service/impl/ProductOrderServiceImpl.java

@@ -1,11 +1,15 @@
 package com.diagbot.service.impl;
 
 import com.diagbot.entity.ProductOrder;
+import com.diagbot.entity.ProductOrderIndex;
+import com.diagbot.entity.wrapper.ProductOrderWrapper;
 import com.diagbot.mapper.ProductOrderMapper;
 import com.diagbot.service.ProductOrderService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 订单表 服务实现类
@@ -21,4 +25,9 @@ public class ProductOrderServiceImpl extends ServiceImpl<ProductOrderMapper, Pro
     public ProductOrder selctOrderTimeByOrderNum(ProductOrder productOrder) {
         return baseMapper.selctOrderTimeByOrderNum(productOrder);
     }
+
+    @Override
+    public List<ProductOrderWrapper> selectAllProductOrder(ProductOrderIndex productOrderIndex) {
+        return baseMapper.selectAllProductOrder(productOrderIndex);
+    }
 }

+ 24 - 0
diagbotman-service/src/main/java/com/diagbot/vo/ProductOrderVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/9/24 20:15
+ */
+@Getter
+@Setter
+public class ProductOrderVO {
+    @NotBlank(message = "请输入页数!")
+    private Long current;
+    @NotBlank(message = "请输入每页显示条数!")
+    private Long size;
+    @NotBlank(message = "请输入订单审核状态!")
+    private Integer auditStatus;
+    @NotBlank(message = "请输入订单编号!")
+    private Integer num;
+}

+ 14 - 0
diagbotman-service/src/main/java/com/diagbot/web/DiagLantoneProductController.java

@@ -8,10 +8,12 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.LantoneProduct;
 import com.diagbot.entity.wrapper.LantoneProductWrapper;
 import com.diagbot.entity.wrapper.OrderDetailsWapper;
+import com.diagbot.entity.wrapper.ProductOrderWrapper;
 import com.diagbot.facade.LantoneProductFacade;
 import com.diagbot.facade.OpenedProductsFacade;
 import com.diagbot.vo.OppendedProductVO;
 import com.diagbot.vo.OrderDetialsVO;
+import com.diagbot.vo.ProductOrderVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -113,5 +115,17 @@ public class DiagLantoneProductController {
         List<OrderDetailsWapper> list = lantoneProductFacade.getAllOrderDetials(orderDetialsVO);
         return RespDTO.onSuc(list);
     }
+
+    @ApiOperation(value = "产品申请显示所有订单接口",
+            notes =
+                    "current:页数<br>"+
+                            "size:每页显示条数<br>"+
+                            "status:订单状态(0.未付款1.已付款)")
+    @PostMapping("/getAllProductOrder")
+    @SysLogger("getAllProductOrder")
+    public RespDTO getAllProductOrder(ProductOrderVO productOrderVO) {
+        List<ProductOrderWrapper> list = lantoneProductFacade.selectAllProductOrder(productOrderVO);
+        return RespDTO.onSuc(list);
+    }
 }
 

+ 9 - 6
diagbotman-service/src/main/resources/mapper/OrderDetailsMapper.xml

@@ -43,15 +43,18 @@
 
     <select id="seleAllOrderDetials" resultMap="BaseResultWrapper" parameterType="com.diagbot.entity.wrapper.OrderDetailsWapper">
         SELECT
-	      a.*, b.time order_time
+        a.*, b.time order_time,c.`name` product_name
         FROM
-	      diag_order_details a
+        diag_order_details a
         LEFT JOIN diag_product_order b ON a.order_num = b.num
-        WHERE
-	      1=1
-	      <if test="status !=null and status !=''">
+        LEFT JOIN diag_lantone_product c ON a.product_id =c.id
+        WHERE  1=1
+        <if test="status !=null and status !=''">
              AND status = #{status}
-          </if>
+        </if>
+        <if test="productId !=null and productId !=''">
+            AND product_id = #{productId}
+        </if>
         LIMIT #{index},#{size}
     </select>
 </mapper>

+ 25 - 1
diagbotman-service/src/main/resources/mapper/ProductOrderMapper.xml

@@ -15,6 +15,20 @@
         <result column="time" property="time" />
         <result column="total_prices" property="totalPrices" />
     </resultMap>
+
+    <resultMap id="BaseResultWrapper" type="com.diagbot.entity.wrapper.ProductOrderWrapper">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="num" property="num" />
+        <result column="user_id" property="userId" />
+        <result column="time" property="time" />
+        <result column="total_prices" property="totalPrices" />
+        <result column="audit_status" property="auditStatus" />
+    </resultMap>
     
     <select id="getUserProductOrder" parameterType="Long" resultMap="BaseResultMap">
     	select *
@@ -46,6 +60,16 @@
 		from diag_product_order a join diag_order_details b on a.num=b.order_num
 		where b.audit_status is null
     </select>
-    
+
+    <select id="selectAllProductOrder" resultMap="BaseResultWrapper" parameterType="com.diagbot.entity.ProductOrderIndex">
+        SELECT * FROM diag_product_order WHERE is_deleted='N'
+        <if test="num != null and num != ''">
+            AND num=#{num}
+        </if>
+        <if test="auditStatus != null and auditStatus != ''">
+            AND audit_status=#{auditStatus}
+        </if>
+        LIMIT #{index},#{size}
+    </select>
     
 </mapper>