Browse Source

Merge branch 'master' of http://192.168.1.220:10080/esb/esb

Airhead 8 years ago
parent
commit
db5214de93

+ 6 - 3
hos-admin/src/main/java/com/yihu/hos/system/controller/AppController.java

@ -174,7 +174,8 @@ public class AppController extends BaseController {
    /*  ==================================== 应用服务管理部分 ===================================  */
    @RequestMapping("/initAppService")
    public String AppServiceInit(Model model) {
    public String AppServiceInit(Model model,String appId) {
        model.addAttribute("appId", appId);
        model.addAttribute("contentPage", "system/app/appService");
        return "partView";
    }
@ -188,11 +189,12 @@ public class AppController extends BaseController {
     */
    @RequestMapping("/getAppServiceList")
    @ResponseBody
    public Result getAppServiceList(HttpServletRequest request,String name,String valid) {
    public Result getAppServiceList(HttpServletRequest request,String name,String valid,String appId) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("name", name);
            params.put("valid", valid);
            params.put("appId", appId);
            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
@ -215,7 +217,7 @@ public class AppController extends BaseController {
     * @return
     */
    @RequestMapping("/editorAppService")
    public String editorAppServicePage(Model model, String id) {
    public String editorAppServicePage(Model model, String id,String appId) {
        try {
            SystemServiceEndpoint appService = null;
            if (id != null && id.length() > 0) {
@ -224,6 +226,7 @@ public class AppController extends BaseController {
                appService = new SystemServiceEndpoint();
            }
            model.addAttribute("model", appService);
            model.addAttribute("appId", appId);
            model.addAttribute("contentPage", "/system/app/editorAppService");
        } catch (Exception e) {
            e.printStackTrace();

+ 1 - 1
hos-admin/src/main/java/com/yihu/hos/system/dao/AppDao.java

@ -24,7 +24,7 @@ public class AppDao extends SQLGeneralDAO implements IAppDao {
        }
        Object name = params.get("name");
        if (!StringUtils.isEmpty(name)) {
            sb.append(" and (t.name like '%" + name + "%' or t.englishName like '%" + name + "%')");
            sb.append(" and (t.name like '%" + name + "%' or t.code like '%" + name + "%')");
        }
        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));

+ 4 - 0
hos-admin/src/main/java/com/yihu/hos/system/dao/AppServiceDao.java

@ -23,6 +23,10 @@ public class AppServiceDao extends SQLGeneralDAO implements IAppServiceDao {
            sb.append(" and t.valid = '" + params.get("valid") + "'");
        }
        Object name = params.get("name");
        Object appId = params.get("appId");
        if (!StringUtils.isEmpty(appId)) {
            sb.append(" and t.appId='"+ appId+ "'");
        }
        if (!StringUtils.isEmpty(name)) {
            sb.append(" and (t.name like '%" + name + "%' or t.code like '%" + name + "%')");
        }

+ 1 - 10
hos-admin/src/main/java/com/yihu/hos/system/model/SystemApp.java

@ -9,7 +9,7 @@ public class SystemApp implements java.io.Serializable {
	// Fields
	private String id;
	private String code;
	private String code; //Ó¢ÎÄÃû
	private String name;
	private String appKey;
	private String appType;
@ -18,7 +18,6 @@ public class SystemApp implements java.io.Serializable {
	private String appUrl;
	private String appSecret;
	private String englishName;
	private String icon;
	private String developer;
	// Constructors
@ -117,14 +116,6 @@ public class SystemApp implements java.io.Serializable {
		this.appSecret = appSecret;
	}
	public String getEnglishName() {
		return englishName;
	}
	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}
	public String getIcon() {
		return icon;
	}

+ 9 - 0
hos-admin/src/main/java/com/yihu/hos/system/model/SystemServiceEndpoint.java

@ -10,6 +10,7 @@ public class SystemServiceEndpoint implements java.io.Serializable {
    private String id;
    private String code;
    private String name;
    private String appId;
    private String version;
    private String description;
    private String endpoint;
@ -173,6 +174,14 @@ public class SystemServiceEndpoint implements java.io.Serializable {
    public void setRequestFormat(String requestFormat) {
        this.requestFormat = requestFormat;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
}

+ 9 - 2
hos-admin/src/main/java/com/yihu/hos/system/service/AppManager.java

@ -44,7 +44,7 @@ public class AppManager implements IAppManager {
    public Result updateApp(SystemApp obj) throws Exception {
        SystemApp systemApp = appDao.getEntity(SystemApp.class, obj.getId());
        systemApp.setName(obj.getName());
        systemApp.setEnglishName(obj.getEnglishName());
        systemApp.setCode(obj.getCode());
        systemApp.setAppKey(obj.getAppKey());
        systemApp.setAppSecret(obj.getAppSecret());
        systemApp.setAppUrl(obj.getAppUrl());
@ -74,7 +74,12 @@ public class AppManager implements IAppManager {
    @Override
    public SystemServiceEndpoint getAppServiceById(String id) throws Exception {
        return appServiceDao.getEntity(SystemServiceEndpoint.class,id);
        SystemServiceEndpoint serviceEndpoint = appServiceDao.getEntity(SystemServiceEndpoint.class,id);
        serviceEndpoint.setRequesModule(serviceEndpoint.getRequesModule().replaceAll("\n", "<br>"));
        serviceEndpoint.setResponeResult(serviceEndpoint.getResponeResult().replaceAll("\n", "<br>"));
        serviceEndpoint.setResponeError(serviceEndpoint.getResponeError().replaceAll("\n", "<br>"));
        return serviceEndpoint;
    }
    @Transactional
@ -102,6 +107,8 @@ public class AppManager implements IAppManager {
        systemApp.setHealthReportType(obj.getHealthReportType());
        systemApp.setMetricsEndpoint(obj.getMetricsEndpoint());
        systemApp.setMetricsReportType(obj.getMetricsReportType());
        systemApp.setAppId(obj.getAppId());
        systemApp.setRequestFormat(obj.getRequestFormat());
        return Result.success("更新成功");
    }

+ 0 - 5
hos-admin/src/main/resources/resource/SystemApp.hbm.xml

@ -46,11 +46,6 @@
            </column>
        </property>
        <property name="englishName" type="java.lang.String">
            <column name="english_name" length="50">
                <comment>英文名</comment>
            </column>
        </property>
        <property name="appSecret" type="java.lang.String">
            <column name="app_secret" length="200">
                <comment>app_secret</comment>

+ 5 - 0
hos-admin/src/main/resources/resource/SystemServiceEndpoint.hbm.xml

@ -96,5 +96,10 @@
                <comment>输入格式</comment>
            </column>
        </property>
        <property name="appId" type="java.lang.String">
            <column name="app_id" length="64">
                <comment>应用ID</comment>
            </column>
        </property>
    </class>
</hibernate-mapping>

+ 1 - 1
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/app.jsp

@ -11,7 +11,7 @@
            <div class="m-form-control left">
                <input type="text" id="txtName" class="l-text-field" placeholder="请输入服务名称"/>
                <input type="text" id="statusName" class="l-text-field" placeholder="全部"/>
                <input type="text" id="statusName" class="l-text-field" />
            </div>
            <div class="m-form-control right" >

+ 1 - 1
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appDetail.jsp

@ -18,7 +18,7 @@
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" disabled="disabled" placeholder="请输入英文名称" name="englishName"/>
                <input type="text" class="l-text-field" disabled="disabled" placeholder="请输入英文名称" name="code"/>
            </div>
        </div>
    </div>

+ 1 - 1
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appDetailJs.jsp

@ -20,7 +20,7 @@
               data={
                    id: "${model.id}",
                    name: "${model.name}",
                   englishName: "${model.englishName}",
                   code: "${model.code}",
                   status: "${model.status}",
                   developer: "${model.developer}",
                   icon: "${model.icon}",

+ 15 - 4
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appJs.jsp

@ -5,23 +5,35 @@
    /* *************************** 模块初始化 ***************************** */
    var app = {
        grid: null,
        $searchStatusName: $('#status'),//转台文本匡对象
        $searchBtn: $('.l-trigger-search'),//搜索按钮
        dialog: null,
        init: function () {
            this.bindEvents();
            this.initForm();
        },
        initForm: function () {
            var me = this;
            $('.m-retrieve-area').show();
            $("#txtName").ligerSearch({
                onClick:function(value){
                    me.reloadGrid();
                }});
            var appStatus = liger.get("statusName").value;
            if(appStatus ==undefined || appStatus ==null || appStatus.length<=0){
                liger.get("statusName").selectValue("");
            }
            me.grid = $("#div_grid").ligerGrid({
                url: '${contextRoot}/app/getAppList',
                parms: {
                    name: $('#txtName').val(),
                    status:$('#statusName').val()
                    status:appStatus
                },
                columns: [
                    {display: '应用名称', id: 'id', name: 'name', width: '15%'},
                    {display: '英文名', name: 'englishName', width: '10%'},
                    {display: '英文名', name: 'code', width: '10%'},
                    {display: '图标', name: 'icon', width: '10%',height:'50',align: 'center', render: function (rowdata, rowindex, value) {
                        return ' <div style="vertical-align:middle;"><img  style="width: 50px; height: 50px;"  src="'+rowdata.icon+'" /></div>';
                    }},
@ -52,7 +64,6 @@
                    me.editorDialog(row.id);
                }
            });
            me.bindEvents();
        },
        bindEvents: function () {
@ -102,7 +113,7 @@
        //刷新列表数据
        reloadGrid: function () {
            this.grid.set({
                parms: {name: $('#txtName').val()}
                parms: {name: $('#txtName').val(),status:$('#statusName_val').val()}
            });
            this.grid.reload();
        },

+ 16 - 10
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appServiceJs.jsp

@ -17,10 +17,11 @@
                url: '${contextRoot}/app/getAppServiceList',
                parms: {
                    name: $('#txtName').val(),
                    status:$('#txtValid').val()
                    valid:$('#txtValid_val').val(),
                    appId:'${appId}'
                },
                columns: [
                    {display: '服务名称', id: 'id', name: 'name', width: '15%'},
                    {display: '服务名称', id: 'id', name: 'name', width: '20%'},
                    {display: '版本', name: 'version', width: '10%'},
                    {display: '状态', name: 'valid', width: '10%',align: 'center', render: function (rowdata, rowindex, value) {
                        if(rowdata.valid==1 ){
@ -29,13 +30,13 @@
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>无效 </span></div>';
                        }
                    }},
                    {display: '描述', name: 'description', width: '20%'},
                    {display: '描述', name: 'description', width: '30%'},
                    {
                        display: '操作', name: 'operator', width: '35%', render: function (row) {
                        display: '操作', name: 'operator', width: '30%', render: function (row) {
                        var html = '<div class="m-inline-buttons" style="width:350px;">';
                        html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"appService.dialogDetail('"+row.id+"')\">查看详情</a>";
                        html += "<a class=\"m-btn-edit\" onclick=\"appService.editorDialog('"+row.id+"')\"></a>";
                        html += "<a class=\"m-btn-edit\" onclick=\"appService.editorDialog('"+row.id+"','"+row.appId+"')\"></a>";
                        html += "<a class=\"m-btn-delete\" onclick=\"appService.delete('"+row.id+"')\"></a>";
                        html += '</div>';
                        return html;
@ -43,7 +44,7 @@
                    }
                ],
                onDblClickRow: function (row) {
                    me.editorDialog(row.id);
                    me.editorDialog(row.id,row.appId);
                }
            });
            me.bindEvents();
@ -53,7 +54,8 @@
            var me = this;
            $('#div_new_record').click(function () {
                me.editorDialog();
                var appId= "${appId}";
                me.editorDialog(null,appId);
            });
            $("#txtValid").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
@ -96,12 +98,16 @@
        //刷新列表数据
        reloadGrid: function () {
            this.grid.set({
                parms: {name: $('#txtName').val()}
                parms: {
                    name: $('#txtName').val(),
                    valid:$('#txtValid_val').val(),
                    appId:'${appId}'
                }
            });
            this.grid.reload();
        },
        //编辑弹窗
        editorDialog: function (id) {
        editorDialog: function (id,appId) {
            var me = this;
            var title = "新增服务";
            var params = null;
@ -114,7 +120,7 @@
                height: 800,
                width: 1200,
                title: title,
                url: '${contextRoot}/app/editorAppService',
                url: '${contextRoot}/app/editorAppService?appId='+appId,
                //load: true,
                urlParms: params
            });

+ 1 - 1
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorApp.jsp

@ -18,7 +18,7 @@
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" placeholder="请输入英文名称" name="englishName"/>
                <input type="text" class="l-text-field" placeholder="请输入英文名称" name="code"/>
            </div>
        </div>
    </div>

+ 7 - 10
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorAppJs.jsp

@ -8,9 +8,8 @@
        actionUrl:"${contextRoot}/app/addApp",
        init: function () {
            this.initForm();
            this.bindEvents();
            this.initForm();
        },
        initForm: function () {
            var me = this;
@ -18,11 +17,13 @@
            var modelString = "${model.id}";
            if(modelString!=undefined && modelString!=null && modelString.length>0)
            {
                var status = "${model.status}";
                liger.get("status").selectValue(status);
               data={
                    id: "${model.id}",
                    name: "${model.name}",
                   englishName: "${model.englishName}",
                   status: "${model.status}",
                   code: "${model.code}",
                   status: status,
                   developer: "${model.developer}",
                   icon: "${model.icon}",
                   appUrl: "${model.appUrl}",
@ -31,6 +32,8 @@
                };
                me.actionUrl = "${contextRoot}/app/updateApp";
            }else{
                liger.get("status").selectValue("1");//默认有效
            }
            $("#div_info_form").ligerAutoForm({
@ -81,12 +84,6 @@
            $("#status").ligerComboBox({data : [{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
                cancelable:false,
                onSuccess:function(data){
                    if(data!=null&&data.length>0)
                    {
                        $("#status").val(data[0].code);
                        this.selectValue(data[0].code);
                    }
                    return false;
                }});
        }

+ 18 - 8
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorAppService.jsp

@ -9,14 +9,14 @@
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text" class="l-text-field required" placeholder="请输入服务名称" name="name"/>
                <input type="text" class="l-text-field required" placeholder="请填写服务名称" name="name"/>
            </div>
        </div>
        <label style="width:110px;"><span class="red">*&nbsp;</span>版本:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" style="width:180px;" class="l-text-field" placeholder="请输入版本" name="version"/>
                <input type="text" style="width:180px;" class="l-text-field" placeholder="请填写版本" name="version"/>
            </div>
        </div>
@ -24,7 +24,7 @@
        <div class="m-form-control">
            <div class="l-text">
                <input  type="text" id="txtValid" class="l-text-field required" placeholder="请输入状态内容 " name="valid"/>
                <input  type="text" id="txtValid" class="l-text-field required"  name="valid"/>
            </div>
        </div>
    </div>
@ -35,7 +35,7 @@
        <div class="m-form-control">
            <div class="l-text" style="width:800px;">
                <input type="text"  class="l-text-field" placeholder="请输入端点" name="endpoint"/>
                <input type="text"  class="l-text-field" placeholder="请填写端点" name="endpoint"/>
            </div>
        </div>
    </div>
@ -45,7 +45,7 @@
        <div class="m-form-control">
            <div class="l-text" style="width:800px;">
                <input type="text" class="l-text-field" placeholder="请输入描述内容" name="description"/>
                <input type="text" class="l-text-field" placeholder="请填写描述内容" name="description"/>
            </div>
        </div>
    </div>
@ -76,19 +76,28 @@
        <div class="m-form-control">
            <div class="l-text"  style="width:800px;height:100px;" >
                <textarea  style="width:800px;height:100px;" class="l-text-field required"    placeholder="请输入 输入格式 " name="requesModule"></textarea>
                <textarea  style="width:800px;height:100px;" class="l-text-field required"    placeholder="请填写 输入格式 " name="requesModule"></textarea>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label>参数:</label>
        <div class="m-form-control">
            <input type="text" id="serviceCondition"/>
        </div>
    </div>
    <div class="m-form-group" >
        <label><span class="red">*&nbsp;</span>输出正确格式:</label>
        <div class="m-form-control">
            <div class="l-text"  style="width:800px;height:100px;">
                <textarea style="width:800px;height:100px;"   class="l-text-field required" placeholder="请输入 输出正确格式 " name="responeResult"></textarea>
                <textarea style="width:800px;height:100px;"   class="l-text-field required" placeholder="请填写 输出正确格式 " name="responeResult"></textarea>
            </div>
        </div>
    </div>
@ -98,7 +107,7 @@
        <div class="m-form-control">
            <div class="l-text"  style="width:800px;height:100px;" >
                <textarea style="width:800px;height:100px;"  class="l-text-field required" placeholder="请输入 输出错误格式 " name="responeError"></textarea>
                <textarea style="width:800px;height:100px;"  class="l-text-field required" placeholder="请填写 输出错误格式 " name="responeError"></textarea>
            </div>
        </div>
    </div>
@ -107,6 +116,7 @@
    <!-- 隐藏字段 -->
    <div class="m-form-group" style="display: none;">
        <input name="id" hidden="hidden"/>
        <input name="appId" hidden="hidden"/>
    </div>
    <div class="m-form-bottom">
        <div id="btnCancel" class="l-button l-button-no">

+ 29 - 12
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorAppServiceJs.jsp

@ -1,16 +1,17 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<script type="text/javascript">
    /* *************************** 模块初始化 ***************************** */
    var editorParam = {
    var editorAppService = {
        //form
        actionUrl:"${contextRoot}/app/addAppService",
        $condition: null,
        $valid:"${model.valid}",
        init: function () {
            this.initForm();
            this.bindEvents();
            this.initForm();
        },
        initForm: function () {
            var me = this;
@ -18,25 +19,35 @@
            var modelString = "${model.id}";
            if(modelString!=undefined && modelString!=null && modelString.length>0)
            {
                var valid = "${model.valid}";
                liger.get("txtValid").selectValue(valid);
               data={
                    id: "${model.id}",
                    name: "${model.name}",
                   code: "${model.code}",
                   valid: "${model.valid}",
                   appId: "${model.appId}",
                   valid: valid,
                   version: "${model.version}",
                   description: "${model.description}",
                   endpoint: "${model.endpoint}",
                   requestFormat: "${model.requestFormat}".replace(/<br>/ig,"\n"),
                   requestProtocol: "${model.requestProtocol}",
                   requesModule: "${model.requesModule}",
                   requesModule: "${model.requesModule}".replace(/<br>/ig,"\n"),
                   requestMethod: "${model.requestMethod}",
                   healthReportType: "${model.healthReportType}",
                   healthEndpoint: "${model.healthEndpoint}",
                   responeError: "${model.responeError}",
                   responeResult:"${model.responeResult}".replace(/<br>/ig,"\n"),
                   responeError: "${model.responeError}".replace(/<br>/ig,"\n"),
                   metricsReportType: "${model.metricsReportType}",
                   metricsEndpoint: "${model.metricsEndpoint}"
                };
                me.actionUrl = "${contextRoot}/app/updateAppService";
            }else{
                liger.get("txtValid").selectValue("1");//默认有效
                data={
                    appId: "${appId}"
                };
            }
            $("#div_info_form").ligerAutoForm({
@ -68,7 +79,7 @@
                    cache:false,
                    success :function(data){
                        if(data.successFlg) {
                            parent.app.dialogSuccess(data.message);
                            parent.appService.dialogSuccess(data.message);
                        }
                        else{
                            $.ligerDialog.error(data.message);
@ -81,22 +92,28 @@
            });
            $(".m-form-bottom").on("click","#btnCancel",function () {
                parent.app.dialog.close();
                parent.appService.dialog.close();
            });
            $("#txtValid").ligerComboBox({data : [{"value":"1","code":"1"},{"value":"0","code":"0"}],
            $("#txtValid").ligerComboBox({data : [{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
                cancelable:false,
                onSuccess:function(data){
                }});
            $("#resourceCondition").css("height", (window.screen.height - 200) / 5).css("overflow", "auto");
            editorAppService.$condition = $('#serviceCondition').ligerCondition({
                stdDictUrl: "${contextRoot}/std/getDictByScheme",
            });
        }
    };
    $(function () {
        debugger
        editorParam.init();
        editorAppService.init();
    });
</script>