Browse Source

加入 服务调用信息

wuxw 6 years ago
parent
commit
9cbbedb410

+ 17 - 2
WebService/src/main/java/com/java110/web/core/VcCreateProcessor.java

@@ -134,13 +134,15 @@ public class VcCreateProcessor extends AbstractElementTagProcessor {
             attrKey = types[0].replace(" ", "")
                     .replace("\n", "")
                     .replace("\r", "");
-            if (!tag.hasAttribute(attrKey)) {
+            if (!tag.hasAttribute(attrKey) && !types[1].contains("=")) {
                 String componentName = tag.getAttributeValue("name");
                 logger.error("组件" + componentName + "未配置组件属性 " + attrKey);
                 throw new TemplateProcessingException("组件[" + componentName + "]未配置组件属性" + attrKey);
             }
             String vcType = tag.getAttributeValue(attrKey);
-            if (types[1].contains("vc.propTypes.string")) {
+            if(!tag.hasAttribute(attrKey) && types[1].contains("=")) {
+                vcType = dealJsPropTypesDefault(types[1]);
+            }else if (types[1].contains("vc.propTypes.string")) {
                 vcType = "'" + vcType + "'";
             }
             propsJs.append("$props." + attrKey + "=" + vcType + ";\n");
@@ -157,6 +159,19 @@ public class VcCreateProcessor extends AbstractElementTagProcessor {
         return js;
     }
 
+
+    private String dealJsPropTypesDefault(String typeValue){
+         int startPos = typeValue.indexOf("=") + 1;
+         int endPos = typeValue.length();
+         if(typeValue.contains(",")){
+             endPos = typeValue.indexOf(",");
+         }else if(typeValue.contains("//")){
+             endPos = typeValue.indexOf("//");
+         }
+
+         return typeValue.substring(startPos,endPos);
+    }
+
     /**
      * 处理js 变量和 方法都加入 组件编码
      *

+ 1 - 1
WebService/src/main/resources/components/appPackage/view-app-info/viewAppInfo.html

@@ -7,7 +7,7 @@
                     <button type="button" v-if="viewAppInfo.index != 2" class="btn btn-primary btn-sm" style="margin-right:10px;"  v-on:click="_openSelectAppInfoModel()">
                         <i class="glyphicon glyphicon-search"></i> 选择应用</button>
 
-                    <button type="button" v-if="viewAppInfo.index != 2" class="btn btn-primary btn-sm" v-on:click="_openAddAppInfoModel()">
+                    <button type="button" v-if="viewAppInfo.index != 2 && viewAppInfo.needShowAddAppButton== 'true'" class="btn btn-primary btn-sm" v-on:click="_openAddAppInfoModel()">
                         <i class="glyphicon glyphicon-plus"></i> 添加应用</button>
                 </div>
             </div>

+ 4 - 2
WebService/src/main/resources/components/appPackage/view-app-info/viewAppInfo.js

@@ -6,7 +6,8 @@
     vc.extends({
         propTypes: {
            callBackListener:vc.propTypes.string, //父组件名称
-           callBackFunction:vc.propTypes.string //父组件监听方法
+           callBackFunction:vc.propTypes.string, //父组件监听方法
+           needShowAddAppButton:vc.propTypes.string = 'true' // 是否显示添加应用button
         },
         data:{
             viewAppInfo:{
@@ -17,7 +18,8 @@
                 securityCode:"",
                 whileListIp:"",
                 blackListIp:"",
-                remark:""
+                remark:"",
+                needShowAddAppButton:$props.needShowAddAppButton
             }
         },
         _initMethod:function(){

+ 4 - 1
WebService/src/main/resources/components/floorPackage/unit-select-floor/unitSelectFloor.html

@@ -41,5 +41,8 @@
                emitChooseFloor="unitSelectFloor"
                emitLoadData="unit"
     ></vc:create>
-    <vc:create name="addUnit"></vc:create>
+    <vc:create name="addUnit"
+               callBackListener=""
+               callBackFunction=""
+    ></vc:create>
 </div>

+ 2 - 2
WebService/src/main/resources/components/roomPackage/room-select-floor/roomSelectFloor.html

@@ -6,10 +6,10 @@
                 <div class="ibox-tools" style="top:10px;">
                     <button type="button" class="btn btn-primary btn-sm" v-on:click="openSearchFloorModel()">
                         <i class="glyphicon glyphicon-search"></i> 选择小区楼</button>
-                    <button type="button" class="btn btn-primary btn-sm"
+                    <!--<button type="button" class="btn btn-primary btn-sm"
                             v-if="floorInfo.floorId != null && floorInfo.floorId != ''"
                             style="margin-left:10px" v-on:click="openAddRoomModel()">
-                        <i class="glyphicon glyphicon-plus" ></i> 添加房屋</button>
+                        <i class="glyphicon glyphicon-plus" ></i> 添加房屋</button>-->
                 </div>
             </div>
             <div class="ibox-content">

+ 13 - 0
WebService/src/main/resources/components/servicePackage/app-service/appService.html

@@ -0,0 +1,13 @@
+<div id="component" >
+    <vc:create name="viewAppInfo"
+               callBackListener = "serviceManage"
+               callBackFunction="listService"
+               needShowAddAppButton="false"
+    ></vc:create>
+
+    <vc:create name="serviceManage"
+               needShowAddAppButton="false"
+    ></vc:create>
+
+
+</div>

+ 19 - 0
WebService/src/main/resources/components/servicePackage/app-service/appService.js

@@ -0,0 +1,19 @@
+/**
+    入驻小区
+**/
+(function(vc){
+    vc.extends({
+        data:{
+
+        },
+        _initMethod:function(){
+            //根据请求参数查询 查询 业主信息
+        },
+        _initEvent:function(){
+
+        },
+        methods:{
+
+        }
+    });
+})(window.vc);

+ 3 - 2
WebService/src/main/resources/components/servicePackage/service-manage/serviceManage.html

@@ -9,14 +9,15 @@
                             <div class="form-row">
                                 <div class="col-8 input-group input-group-sm">
                                     <input type="text" placeholder="请填写服务名称" class=" form-control" v-model="serviceManageInfo.name">
+                                    <input type="text" placeholder="请填写服务编码" class=" form-control" v-model="serviceManageInfo.serviceCode">
                                     <div class="input-group-prepend">
                                         <button type="button" class="btn btn-primary btn-sm"  v-on:click="_queryServiceMethod()">
                                             <i class="glyphicon glyphicon-search"></i> 马上查询</button>
                                     </div>
                                 </div>
 
-                                <div class="col">
-                                    <button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddServiceModal()">
+                                <div class="col-2" v-if="serviceManageInfo.needShowAddAppButton=='true'">
+                                    <button type="button"  class="btn btn-primary btn-sm" v-on:click="_openAddServiceModal()">
                                         <i class="glyphicon glyphicon-plus"></i>
                                         添加服务
                                     </button>

+ 10 - 2
WebService/src/main/resources/components/servicePackage/service-manage/serviceManage.js

@@ -5,12 +5,18 @@
     var DEFAULT_PAGE = 1;
     var DEFAULT_ROWS = 10;
     vc.extends({
+        propTypes: {
+           needShowAddAppButton:vc.propTypes.string = 'true' // 是否显示添加应用button
+        },
         data:{
             serviceManageInfo:{
                 services:[],
                 total:0,
                 records:1,
-                name:''
+                name:'',
+                serviceCode:'',
+                appId:'',
+                needShowAddAppButton:$props.needShowAddAppButton
             }
         },
         _initMethod:function(){
@@ -30,7 +36,9 @@
                     params:{
                         page:_page,
                         row:_rows,
-                        name:vc.component.serviceManageInfo.name
+                        appId:vc.component.serviceManageInfo.appId,
+                        name:vc.component.serviceManageInfo.name,
+                        serviceCode:vc.component.serviceManageInfo.serviceCode
                     }
 
                }

+ 37 - 0
WebService/src/main/resources/views/appServiceFlow.html

@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en"
+      xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:th="http://www.thymeleaf.org"
+      xmlns:vc="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8"/>
+    <title>服务调用信息|java110</title>
+    <vc:create name="commonTop"></vc:create>
+</head>
+<body>
+<vc:create name="bodyTop"></vc:create>
+<div id="wrapper">
+    <vc:create name="menu"></vc:create>
+
+
+    <div id="page-wrapper" class="gray-bg dashbard-1">
+        <div class="row border-bottom">
+            <vc:create name="nav"></vc:create>
+        </div>
+
+        <div class="wrapper wrapper-content" style="padding-bottom: 0px;">
+            <vc:create name="breadcrumb"></vc:create>
+        </div>
+        <!-- id="component" -->
+        <div class="wrapper wrapper-content animated fadeInRight">
+            <vc:create name="appService"></vc:create>
+        </div>
+
+        <vc:create name="copyright"></vc:create>
+
+    </div>
+</div>
+
+<vc:create name="commonBottom"></vc:create>
+</body>
+</html>

+ 17 - 0
WebService/src/test/java/com/java110/web/core/VcCreateProcessorTest.java

@@ -0,0 +1,17 @@
+package com.java110.web.core;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class VcCreateProcessorTest {
+
+    @Test
+    public void testDealJsPropTypesDefault(){
+
+        //VcCreateProcessor vcCreateProcessor = new VcCreateProcessor("");
+        //System.out.println(vcCreateProcessor.dealJsPropTypesDefault("vc.propTypes.string = 'true'"));
+
+    }
+
+}

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/service/ServiceDto.java

@@ -27,6 +27,7 @@ private String isInstance;
 private String name;
 private String serviceId;
 private String seq;
+private String appId;
 
 
     private Date createTime;
@@ -123,4 +124,12 @@ public void setSeq(String seq) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
 }

+ 20 - 4
java110-db/src/main/resources/mapper/service/ServiceServiceDaoImplMapper.xml

@@ -115,8 +115,16 @@ business_type_cd,method,provide_app_id,service_code,retry_count,status_cd,messag
     <!-- 查询服务信息 add by wuxw 2018-07-03 -->
     <select id="getServiceInfo" parameterType="Map" resultType="Map">
         select  t.business_type_cd,t.business_type_cd businessTypeCd,t.method,t.provide_app_id,t.provide_app_id provideAppId,t.service_code,t.service_code serviceCode,t.retry_count,t.retry_count retryCount,t.status_cd,t.status_cd statusCd,t.messageQueueName,t.url,t.timeout,t.is_instance,t.is_instance isInstance,t.name,t.service_id,t.service_id serviceId,t.seq 
-from c_service t 
-where 1 =1 
+from c_service t
+        <if test="appId != null and appId != ''">
+            , c_route r
+        </if>
+        where 1 =1
+        <if test="appId != null and appId != ''">
+            and t.service_id = r.service_id
+            and t.status_cd = '0'
+            and t.app_id = #{appId}
+        </if>
 <if test="businessTypeCd !=null and businessTypeCd != ''">
    and t.business_type_cd= #{businessTypeCd}
 </if> 
@@ -212,8 +220,16 @@ and t.service_id= #{serviceId}
     <!-- 查询服务数量 add by wuxw 2018-07-03 -->
      <select id="queryServicesCount" parameterType="Map" resultType="Map">
         select  count(1) count 
-from c_service t 
-where 1 =1 
+from c_service t
+         <if test="appId != null and appId != ''">
+             , c_route r
+         </if>
+where 1 =1
+         <if test="appId != null and appId != ''">
+             and t.service_id = r.service_id
+             and t.status_cd = '0'
+             and t.app_id = #{appId}
+         </if>
 <if test="businessTypeCd !=null and businessTypeCd != ''">
    and t.business_type_cd= #{businessTypeCd}
 </if>