Browse Source

返回结果优化

Zhaops 6 years ago
parent
commit
667617fcfa

+ 28 - 3
diagbotman-service/src/main/java/com/diagbot/dto/ProductServiceDTO.java

@@ -15,8 +15,33 @@ import lombok.Setter;
 @Getter
 @Setter
 public class ProductServiceDTO {
-    private ProductService productService;
-    private ServiceToken serviceToken;
+    /*private ProductService productService;
     private LantoneProduct lantoneProduct;
-    private ServiceInfo serviceInfo;
+    private ServiceInfo serviceInfo;*/
+    private ServiceToken serviceToken;
+
+    private Long productId;
+    private Long serviceId;
+
+    /**
+     * 产品名称
+     */
+    private String productName;
+
+    /**
+     * 产品介绍
+     */
+    private String productDecription;
+
+
+    /**
+     * 服务名称
+     */
+    private String serviceName;
+
+    /**
+     * 服务说明
+     */
+    private String serviceDescription;
+
 }

+ 6 - 0
diagbotman-service/src/main/java/com/diagbot/entity/ServiceInfo.java

@@ -48,8 +48,14 @@ public class ServiceInfo implements Serializable {
      */
     private String modifier;
 
+    /**
+     * 服务名称
+     */
     private String name;
 
+    /**
+     * 服务说明
+     */
     private String description;
 
     /**

+ 18 - 7
diagbotman-service/src/main/java/com/diagbot/entity/wrapper/LantoneProductWrapper.java

@@ -20,10 +20,15 @@ public class LantoneProductWrapper extends LantoneProduct {
      */
     private Date endTime;
 
+    /**
+     * 订单申请时间
+     */
+    private Date time;
+
     /**
      * 停用状态
      */
-    private Integer serviceStatus;
+    private Integer openedServiceStatus;
 
     public Date getStartTime() {
         return startTime;
@@ -41,13 +46,19 @@ public class LantoneProductWrapper extends LantoneProduct {
         this.endTime = endTime;
     }
 
-    @Override
-    public Integer getServiceStatus() {
-        return serviceStatus;
+    public Integer getOpenedServiceStatus() {
+        return openedServiceStatus;
+    }
+
+    public void setOpenedServiceStatus(Integer openedServiceStatus) {
+        this.openedServiceStatus = openedServiceStatus;
+    }
+
+    public Date getTime() {
+        return time;
     }
 
-    @Override
-    public void setServiceStatus(Integer serviceStatus) {
-        this.serviceStatus = serviceStatus;
+    public void setTime(Date time) {
+        this.time = time;
     }
 }

+ 9 - 1
diagbotman-service/src/main/java/com/diagbot/facade/ProductServiceFacade.java

@@ -120,7 +120,15 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
         serviceTokenFacade.save(serviceToken);
         productServiceDTO.setServiceToken(serviceToken);
 
-        productServiceDTO.setProductService(productService);
+        //productServiceDTO.setProductService(productService);
+        productServiceDTO.setProductId(productService.getProductId());
+        productServiceDTO.setServiceId(productService.getServiceId());
+
+        productServiceDTO.setServiceName(serviceInfo.getName());
+        productServiceDTO.setServiceDescription(serviceInfo.getDescription());
+
+        productServiceDTO.setProductName(lantoneProduct.getName());
+        productServiceDTO.setProductDecription(lantoneProduct.getDecription());
         return productServiceDTO;
     }
 

+ 8 - 6
diagbotman-service/src/main/resources/mapper/LantoneProductMapper.xml

@@ -38,7 +38,8 @@
         <result column="access_type" property="accessType"/>
         <result column="start_time" property="startTime"/>
         <result column="end_time" property="endTime"/>
-        <result column="service_status" property="serviceStatus"/>
+        <result column="opened_service_status" property="openedServiceStatus"/>
+        <result column="time" property="time"/>
     </resultMap>
 
     <!--根据用户id查询用户是否有开通产品-->
@@ -73,10 +74,11 @@
     </select>
 
     <!--根据用户查询已开通产品-->
-    <select id="opendedProductByUserId" resultMap="BaseResultWrapperMap"
-            parameterType="java.lang.Long">
-        select a.*,b.start_time,b.end_time,b.service_status from diag_lantone_product a,diag_opened_products b
-        where a.id=b.product_id and a.is_deleted='N' and b.is_deleted='N'
-        and b.user_id=#{userId}
+    <select id="opendedProductByUserId" resultMap="BaseResultWrapperMap" parameterType="java.lang.Long">
+        select a.*,b.start_time,b.end_time,b.service_status as opened_service_status,c.time from diag_lantone_product a,diag_opened_products b,diag_product_order c,diag_order_details d
+        where a.id=b.product_id and a.id=d.product_id and c.num=d.order_num
+        and d.audit_status=1
+        and a.is_deleted='N' and b.is_deleted='N' and c.is_deleted='N' and d.is_deleted='N'
+        and b.user_id=#{userId}  and c.user_id=#{userId}  and d.user_id=#{userId}
     </select>
 </mapper>