فهرست منبع

Merge branch 'master' of demon/esb into master

zlf 8 سال پیش
والد
کامیت
49f28a1618
24فایلهای تغییر یافته به همراه1798 افزوده شده و 6 حذف شده
  1. 17 0
      hos-admin/src/main/java/com/yihu/hos/config/WebMvcConfig.java
  2. 14 0
      hos-admin/src/main/java/com/yihu/hos/filter/HibernateFilter.java
  3. 271 4
      hos-admin/src/main/java/com/yihu/hos/system/controller/AppController.java
  4. 29 0
      hos-admin/src/main/java/com/yihu/hos/system/controller/ProcessController.java
  5. 9 0
      hos-admin/src/main/java/com/yihu/hos/system/dao/AppDao.java
  6. 31 0
      hos-admin/src/main/java/com/yihu/hos/system/dao/AppServiceDao.java
  7. 16 0
      hos-admin/src/main/java/com/yihu/hos/system/dao/intf/IAppServiceDao.java
  8. 35 0
      hos-admin/src/main/java/com/yihu/hos/system/model/SystemApp.java
  9. 178 0
      hos-admin/src/main/java/com/yihu/hos/system/model/SystemServiceEndpoint.java
  10. 93 1
      hos-admin/src/main/java/com/yihu/hos/system/service/AppManager.java
  11. 23 0
      hos-admin/src/main/java/com/yihu/hos/system/service/intf/IAppManager.java
  12. 21 0
      hos-admin/src/main/resources/resource/SystemApp.hbm.xml
  13. 100 0
      hos-admin/src/main/resources/resource/SystemServiceEndpoint.hbm.xml
  14. 1 1
      hos-admin/src/main/resources/spring/applicationContext.xml
  15. 29 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/app.jsp
  16. 89 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appDetail.jsp
  17. 75 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appDetailJs.jsp
  18. 164 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appJs.jsp
  19. 35 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appService.jsp
  20. 155 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appServiceJs.jsp
  21. 91 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorApp.jsp
  22. 101 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorAppJs.jsp
  23. 119 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorAppService.jsp
  24. 102 0
      hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/editorAppServiceJs.jsp

+ 17 - 0
hos-admin/src/main/java/com/yihu/hos/config/WebMvcConfig.java

@ -1,5 +1,6 @@
package com.yihu.hos.config;
import com.yihu.hos.filter.HibernateFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
@ -51,4 +52,20 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
        return tilesConfigurer;
    }
    @Bean
    public HibernateFilter filterConfig() {
        return new HibernateFilter();
    }
    /* hibernate配置 */
//    @Bean
//    public LocalSessionFactoryBean localSessionFactoryBean(){
//        LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean();
//        localSessionFactoryBean.setConfigLocation(new ClassPathResource("hibernate.cfg.xml"));
//        return localSessionFactoryBean;
//
//    }
}

+ 14 - 0
hos-admin/src/main/java/com/yihu/hos/filter/HibernateFilter.java

@ -0,0 +1,14 @@
package com.yihu.hos.filter;
import org.springframework.orm.hibernate5.support.OpenSessionInViewFilter;
import javax.servlet.annotation.WebFilter;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/12.
 */
@WebFilter(filterName="SpringOpenSessionInViewFilter",urlPatterns="/*")
public class HibernateFilter extends OpenSessionInViewFilter {
}

+ 271 - 4
hos-admin/src/main/java/com/yihu/hos/system/controller/AppController.java

@ -1,9 +1,13 @@
package com.yihu.hos.system.controller;
import com.yihu.hos.system.model.SystemApp;
import com.yihu.hos.system.model.SystemServiceEndpoint;
import com.yihu.hos.system.service.intf.IAppManager;
import com.yihu.hos.web.framework.model.Result;
import com.yihu.hos.web.framework.util.controller.BaseController;
import com.yihu.hos.system.service.intf.IAppManager;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -22,25 +26,288 @@ public class AppController extends BaseController {
    @Resource(name = "appManager")
    private IAppManager appManager;
    /**
     *  应用管理管理界面
     *
     * @param model
     * @return
     */
    @RequestMapping("/initial")
    public String appInitial(Model model) {
        model.addAttribute("contentPage", "system/app/app");
        return "partView";
    }
    /**
     * 系统参数列表
     * 应用列表
     *
     * @param request
     * @return
     */
    @RequestMapping("/getAppList")
    @ResponseBody
    public Result getAppList(HttpServletRequest request) {
    public Result getAppList(HttpServletRequest request,String name,String status) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("name", name);
            params.put("status", status);
            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
            params.put("page", page);
            params.put("rows", rows);
            Result result = appManager.getAppList(params);
            return result;
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    /**
     * 应用-新增/修改页面
     * @param model
     * @param id
     * @param categoryId
     * @return
     */
    @RequestMapping("/editorApp")
    public String editorAppTemplate(Model model, String id,  String categoryId) {
        try {
            SystemApp app = null;
            if (id != null && id.length() > 0) {
                app = appManager.getAppById(id);
            }  else {
                app = new SystemApp();
            }
            model.addAttribute("model", app);
            model.addAttribute("categoryId", categoryId);
            model.addAttribute("contentPage", "/system/app/editorApp");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "pageView";
    }
    /**
     * 应用详情页
     * @param model
     * @param id
     * @return
     */
    @RequestMapping("/appDetail")
    public String appDetail(Model model, String id) {
        try {
            SystemApp app = null;
            if (id != null && id.length() > 0) {
                app = appManager.getAppById(id);
            }  else {
                app = new SystemApp();
            }
            model.addAttribute("model", app);
            model.addAttribute("contentPage", "/system/app/appDetail");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "pageView";
    }
    /**
     * 新增应用信息
     * @param request
     * @return
     */
    @RequestMapping("addApp")
    @ResponseBody
    public Result addApp(HttpServletRequest request) {
        try {
            SystemApp obj = new SystemApp();
            BeanUtils.populate(obj, request.getParameterMap());
            return appManager.addApp(obj);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    /**
     * 删除应用信息
     * @param request
     * @return
     */
    @RequestMapping("/deleteApp")
    @ResponseBody
    public Result deleteApp(HttpServletRequest request) {
        try {
            String id = request.getParameter("id");
            appManager.deleteApp(id);
            return Result.success("删除成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error("删除失败!");
        }
    }
    /**
     * 修改应用信息
     */
    @RequestMapping("updateApp")
    @ResponseBody
    public Result updateApp(HttpServletRequest request) {
        try {
            SystemApp obj = new SystemApp();
            BeanUtils.populate(obj, request.getParameterMap());
            return appManager.updateApp(obj);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    /*  ==================================== 应用服务管理部分 ===================================  */
    @RequestMapping("/initAppService")
    public String AppServiceInit(Model model) {
        model.addAttribute("contentPage", "system/app/appService");
        return "partView";
    }
    /**
     * 应用管理
     *   -服务管理页面
     *
     * @param request
     * @return
     */
    @RequestMapping("/getAppServiceList")
    @ResponseBody
    public Result getAppServiceList(HttpServletRequest request,String name,String valid) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("name", name);
            params.put("valid", valid);
            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
            params.put("page", page);
            params.put("rows", rows);
            return appManager.getAppList(params);
            Result result = appManager.getAppServiceList(params);
            return result;
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    /**
     * 服务修改页面
     * @param model
     * @param id
     * @return
     */
    @RequestMapping("/editorAppService")
    public String editorAppServicePage(Model model, String id) {
        try {
            SystemServiceEndpoint appService = null;
            if (id != null && id.length() > 0) {
                appService = appManager.getAppServiceById(id);
            }  else {
                appService = new SystemServiceEndpoint();
            }
            model.addAttribute("model", appService);
            model.addAttribute("contentPage", "/system/app/editorAppService");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "pageView";
    }
    /**
     * 服务详情页
     * @param model
     * @param id
     * @returnServiceS
     */
    @RequestMapping("/appServiceDetail")
    public String appServiceDetail(Model model, String id) {
        try {
            SystemServiceEndpoint app = null;
            if (id != null && id.length() > 0) {
                app = appManager.getAppServiceById(id);
            }  else {
                app = new SystemServiceEndpoint();
            }
            model.addAttribute("model", app);
            model.addAttribute("contentPage", "/system/app/appServiceDetail");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "pageView";
    }
    /**
     * 新增服务信息
     * @param request
     * @return
     */
    @RequestMapping("addAppService")
    @ResponseBody
    public Result addAppService(HttpServletRequest request) {
        try {
            SystemServiceEndpoint obj = new SystemServiceEndpoint();
            BeanUtils.populate(obj, request.getParameterMap());
            return appManager.addAppService(obj);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
    /**
     * 删除服务信息
     * @param request
     * @return
     */
    @RequestMapping("/deleteAppService")
    @ResponseBody
    public Result deleteAppService(HttpServletRequest request) {
        try {
            String id = request.getParameter("id");
            appManager.deleteAppService(id);
            return Result.success("删除成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error("删除失败!");
        }
    }
    /**
     * 修改服务信息
     */
    @RequestMapping("updateAppService")
    @ResponseBody
    public Result updateAppService(HttpServletRequest request) {
        try {
            SystemServiceEndpoint obj = new SystemServiceEndpoint();
            BeanUtils.populate(obj, request.getParameterMap());
            return appManager.updateAppService(obj);
        } catch (Exception ex) {
            ex.printStackTrace();
            return Result.error(ex.getMessage());
        }
    }
}

+ 29 - 0
hos-admin/src/main/java/com/yihu/hos/system/controller/ProcessController.java

@ -0,0 +1,29 @@
package com.yihu.hos.system.controller;
import com.yihu.hos.web.framework.util.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 *  流程管理
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/12.
 */
@RequestMapping("/process")
@Controller
public class ProcessController  extends BaseController {
    /**
     *  流程管理界面
     *
     * @param model
     * @return
     */
    @RequestMapping("/initial")
    public String roleInitial(Model model) {
        model.addAttribute("contentPage", "system/process/process");
        return "partView";
    }
}

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

@ -5,6 +5,7 @@ import com.yihu.hos.system.model.SystemApp;
import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
import com.yihu.hos.web.framework.model.Result;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
@ -17,6 +18,14 @@ public class AppDao extends SQLGeneralDAO implements IAppDao {
    @Override
    public Result getAppList(Map<String, Object> params) throws Exception {
        StringBuilder sb = new StringBuilder("from SystemApp t where 1=1 ");
        if (!StringUtils.isEmpty(params.get("status"))) //是否有效
        {
            sb.append(" and t.status = '" + params.get("status") + "'");
        }
        Object name = params.get("name");
        if (!StringUtils.isEmpty(name)) {
            sb.append(" and (t.name like '%" + name + "%' or t.englishName like '%" + name + "%')");
        }
        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));

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

@ -0,0 +1,31 @@
package com.yihu.hos.system.dao;
import com.yihu.hos.system.dao.intf.IAppServiceDao;
import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
import com.yihu.hos.web.framework.model.Result;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/16.
 */
@Repository("appServiceDao")
public class AppServiceDao extends SQLGeneralDAO implements IAppServiceDao {
    @Override
    public Result getAppServiceList(Map<String, Object> params) throws Exception {
        StringBuilder sb = new StringBuilder("from SystemServiceEndpoint t where 1=1 ");
        if (!StringUtils.isEmpty(params.get("valid"))) //是否有效
        {
            sb.append(" and t.valid = '" + params.get("valid") + "'");
        }
        Object name = params.get("name");
        if (!StringUtils.isEmpty(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()));    }
}

+ 16 - 0
hos-admin/src/main/java/com/yihu/hos/system/dao/intf/IAppServiceDao.java

@ -0,0 +1,16 @@
package com.yihu.hos.system.dao.intf;
import com.yihu.hos.web.framework.dao.XSQLGeneralDAO;
import com.yihu.hos.web.framework.model.Result;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/16.
 */
public interface IAppServiceDao extends XSQLGeneralDAO {
    Result getAppServiceList(Map<String, Object> params) throws Exception;
}

+ 35 - 0
hos-admin/src/main/java/com/yihu/hos/system/model/SystemApp.java

@ -17,6 +17,10 @@ public class SystemApp implements java.io.Serializable {
	private String status;
	private String appUrl;
	private String appSecret;
	private String englishName;
	private String icon;
	private String developer;
	// Constructors
	/** default constructor */
@ -105,4 +109,35 @@ public class SystemApp implements java.io.Serializable {
		this.appUrl = appUrl;
	}
	public String getAppSecret() {
		return appSecret;
	}
	public void setAppSecret(String appSecret) {
		this.appSecret = appSecret;
	}
	public String getEnglishName() {
		return englishName;
	}
	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	public String getDeveloper() {
		return developer;
	}
	public void setDeveloper(String developer) {
		this.developer = developer;
	}
}

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

@ -0,0 +1,178 @@
package com.yihu.hos.system.model;
/**
 *
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/16.
 */
public class SystemServiceEndpoint implements java.io.Serializable {
    private String id;
    private String code;
    private String name;
    private String version;
    private String description;
    private String endpoint;
    private String requestProtocol;
    private String requestParameterList;
    private String requesModule;
    private String requestMethod;
    private String responeResult;
    private String responeError;
    private Integer healthReportType;
    private String healthEndpoint;
    private Integer metricsReportType;
    private String metricsEndpoint;
    private Integer valid;
    private String requestFormat;
    public SystemServiceEndpoint() {
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getEndpoint() {
        return endpoint;
    }
    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }
    public String getRequestProtocol() {
        return requestProtocol;
    }
    public void setRequestProtocol(String requestProtocol) {
        this.requestProtocol = requestProtocol;
    }
    public String getRequestParameterList() {
        return requestParameterList;
    }
    public void setRequestParameterList(String requestParameterList) {
        this.requestParameterList = requestParameterList;
    }
    public String getRequesModule() {
        return requesModule;
    }
    public void setRequesModule(String requesModule) {
        this.requesModule = requesModule;
    }
    public String getRequestMethod() {
        return requestMethod;
    }
    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }
    public String getResponeResult() {
        return responeResult;
    }
    public void setResponeResult(String responeResult) {
        this.responeResult = responeResult;
    }
    public String getResponeError() {
        return responeError;
    }
    public void setResponeError(String responeError) {
        this.responeError = responeError;
    }
    public Integer getHealthReportType() {
        return healthReportType;
    }
    public void setHealthReportType(Integer healthReportType) {
        this.healthReportType = healthReportType;
    }
    public String getHealthEndpoint() {
        return healthEndpoint;
    }
    public void setHealthEndpoint(String healthEndpoint) {
        this.healthEndpoint = healthEndpoint;
    }
    public Integer getMetricsReportType() {
        return metricsReportType;
    }
    public void setMetricsReportType(Integer metricsReportType) {
        this.metricsReportType = metricsReportType;
    }
    public String getMetricsEndpoint() {
        return metricsEndpoint;
    }
    public void setMetricsEndpoint(String metricsEndpoint) {
        this.metricsEndpoint = metricsEndpoint;
    }
    public Integer getValid() {
        return valid;
    }
    public void setValid(Integer valid) {
        this.valid = valid;
    }
    public String getRequestFormat() {
        return requestFormat;
    }
    public void setRequestFormat(String requestFormat) {
        this.requestFormat = requestFormat;
    }
}

+ 93 - 1
hos-admin/src/main/java/com/yihu/hos/system/service/AppManager.java

@ -1,9 +1,13 @@
package com.yihu.hos.system.service;
import com.yihu.hos.web.framework.model.Result;
import com.yihu.hos.system.dao.intf.IAppDao;
import com.yihu.hos.system.dao.intf.IAppServiceDao;
import com.yihu.hos.system.model.SystemApp;
import com.yihu.hos.system.model.SystemServiceEndpoint;
import com.yihu.hos.system.service.intf.IAppManager;
import com.yihu.hos.web.framework.model.Result;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Map;
@ -17,8 +21,96 @@ public class AppManager implements IAppManager {
    @Resource(name = "appDao")
    private IAppDao appDao;
    @Resource(name = "appServiceDao")
    private IAppServiceDao appServiceDao;
    @Override
    public Result getAppList(Map<String, Object> params) throws Exception {
        return appDao.getAppList(params);
    }
    @Override
    public SystemApp getAppById(String id) throws Exception {
        return appDao.getEntity(SystemApp.class,id);
    }
    @Transactional
    public Result addApp(SystemApp obj) throws Exception {
        appDao.saveEntity(obj);
        return Result.success("保存成功");
    }
    @Transactional
    public Result updateApp(SystemApp obj) throws Exception {
        SystemApp systemApp = appDao.getEntity(SystemApp.class, obj.getId());
        systemApp.setName(obj.getName());
        systemApp.setEnglishName(obj.getEnglishName());
        systemApp.setAppKey(obj.getAppKey());
        systemApp.setAppSecret(obj.getAppSecret());
        systemApp.setAppUrl(obj.getAppUrl());
        systemApp.setDeveloper(obj.getDeveloper());
        systemApp.setIcon(obj.getIcon());
        systemApp.setStatus(obj.getStatus());
        return Result.success("更新成功");
    }
    @Transactional
    public Result deleteApp(String id) throws Exception {
        SystemApp systemApp = appDao.getEntity(SystemApp.class, id);
        appDao.deleteEntity(systemApp);
        return Result.success("删除成功");
    }
    /* ==============================服务模块=================================  */
    @Override
    public Result getAppServiceList(Map<String, Object> params) throws Exception {
        return appServiceDao.getAppServiceList(params);
    }
    @Override
    public SystemServiceEndpoint getAppServiceById(String id) throws Exception {
        return appServiceDao.getEntity(SystemServiceEndpoint.class,id);
    }
    @Transactional
    public Result addAppService(SystemServiceEndpoint obj) throws Exception {
        appServiceDao.saveEntity(obj);
        return Result.success("保存成功");
    }
    @Transactional
    public Result updateAppService(SystemServiceEndpoint obj) throws Exception {
        SystemServiceEndpoint systemApp = appServiceDao.getEntity(SystemServiceEndpoint.class, obj.getId());
        systemApp.setName(obj.getName());
        systemApp.setCode(obj.getCode());
        systemApp.setValid(obj.getValid());
        systemApp.setVersion(obj.getVersion());
        systemApp.setDescription(obj.getDescription());
        systemApp.setEndpoint(obj.getEndpoint());
        systemApp.setRequesModule(obj.getRequesModule());
        systemApp.setRequestProtocol(obj.getRequestProtocol());
        systemApp.setResponeError(obj.getResponeError());
        systemApp.setResponeResult(obj.getResponeResult());
        systemApp.setRequestMethod(obj.getRequestMethod());
        systemApp.setRequestParameterList(obj.getRequestParameterList());
        systemApp.setHealthEndpoint(obj.getHealthEndpoint());
        systemApp.setHealthReportType(obj.getHealthReportType());
        systemApp.setMetricsEndpoint(obj.getMetricsEndpoint());
        systemApp.setMetricsReportType(obj.getMetricsReportType());
        return Result.success("更新成功");
    }
    @Transactional
    public Result deleteAppService(String id) throws Exception {
        SystemServiceEndpoint systemApp = appServiceDao.getEntity(SystemServiceEndpoint.class, id);
        appServiceDao.deleteEntity(systemApp);
        return Result.success("删除成功");
    }
}

+ 23 - 0
hos-admin/src/main/java/com/yihu/hos/system/service/intf/IAppManager.java

@ -1,5 +1,7 @@
package com.yihu.hos.system.service.intf;
import com.yihu.hos.system.model.SystemApp;
import com.yihu.hos.system.model.SystemServiceEndpoint;
import com.yihu.hos.web.framework.model.Result;
import java.util.Map;
@ -9,4 +11,25 @@ import java.util.Map;
 */
public interface IAppManager {
    Result getAppList(Map<String, Object> params) throws Exception;
    SystemApp getAppById(String id) throws Exception;
    Result addApp(SystemApp obj) throws Exception;
    Result updateApp(SystemApp obj) throws Exception;
    Result deleteApp(String id) throws Exception;
    /* =============服务管理模块================= */
    Result getAppServiceList(Map<String, Object> params) throws Exception;
    SystemServiceEndpoint getAppServiceById(String id) throws Exception;
    Result addAppService(SystemServiceEndpoint obj) throws Exception;
    Result updateAppService(SystemServiceEndpoint obj) throws Exception;
    Result deleteAppService(String id) throws Exception;
}

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

@ -45,5 +45,26 @@
                <comment>回调地址</comment>
            </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>
            </column>
        </property>
        <property name="icon" type="java.lang.String">
            <column name="icon" length="200">
                <comment>应用图标</comment>
            </column>
        </property>
        <property name="developer" type="java.lang.String">
            <column name="developer" length="50">
                <comment>开发者</comment>
            </column>
        </property>
    </class>
</hibernate-mapping>

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

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- 
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="com.yihu.hos.system.model.SystemServiceEndpoint" table="system_service_endpoint">
        <id name="id" type="java.lang.String">
            <column name="id" length="50" />
            <generator class="uuid" />
        </id>
        <property name="code" type="java.lang.String">
            <column name="code" length="50">
                <comment>服务编码</comment>
            </column>
        </property>
        <property name="name" type="java.lang.String">
            <column name="name" length="50" not-null="true">
                <comment>服务名称</comment>
            </column>
        </property>
        <property name="version" type="java.lang.String">
            <column name="version" length="50">
                <comment>版本</comment>
            </column>
        </property>
        <property name="description" type="java.lang.String">
            <column name="description" length="200">
                <comment>描述</comment>
            </column>
        </property>
        <property name="endpoint" type="java.lang.String">
            <column name="endpoint" length="50">
                <comment>端点</comment>
            </column>
        </property>
        <property name="requestProtocol" type="java.lang.String">
            <column name="request_protocol" length="10">
                <comment>调用协议</comment>
            </column>
        </property>
        <property name="requestParameterList" type="java.lang.String">
            <column name="request_parameter_list" length="200">
                <comment>请求参数</comment>
            </column>
        </property>
        <property name="requesModule" type="java.lang.String">
            <column name="request_module" length="50">
                <comment>请求模块,用于RPC</comment>
            </column>
        </property>
        <property name="requestMethod" type="java.lang.String">
            <column name="request_method" length="200">
                <comment>请求方法</comment>
            </column>
        </property>
        <property name="responeResult" type="java.lang.String">
            <column name="respone_result" length="200">
                <comment>返回值结果说明</comment>
            </column>
        </property>
        <property name="responeError" type="java.lang.String">
            <column name="respone_error" length="50">
                <comment>返回值错误说明</comment>
            </column>
        </property>
        <property name="healthReportType" type="java.lang.Integer">
            <column name="health_report_type" length="11">
                <comment></comment>
            </column>
        </property>
        <property name="healthEndpoint" type="java.lang.String">
            <column name="health_endpoint" length="50">
                <comment></comment>
            </column>
        </property>
        <property name="metricsReportType" type="java.lang.Integer">
            <column name="metrics_report_type" length="11">
                <comment></comment>
            </column>
        </property>
        <property name="metricsEndpoint" type="java.lang.String">
            <column name="metrics_endpoint" length="50">
                <comment></comment>
            </column>
        </property>
        <property name="valid" type="java.lang.Integer">
            <column name="valid" length="11">
                <comment>是否有效</comment>
            </column>
        </property>
        <property name="requestFormat" type="java.lang.String">
            <column name="request_format" length="255">
                <comment>输入格式</comment>
            </column>
        </property>
    </class>
</hibernate-mapping>

+ 1 - 1
hos-admin/src/main/resources/spring/applicationContext.xml

@ -61,7 +61,7 @@
        <property name="hibernateProperties">
            <value>
                hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
                hibernate.show_sql=true
                hibernate.show_sql=false
                hibernate.format_sql=true
            </value>
        </property>

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

@ -0,0 +1,29 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!--######用户管理页面Title设置######-->
<!-- ####### 页面部分 ####### -->
<div class="m-content">
    <!-- ####### 查询条件部分 ####### -->
    <div class="m-form-inline">
        <div class="m-form-group">
            <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="全部"/>
            </div>
            <div class="m-form-control right" >
                <div id="div_new_record" class="l-button">
                    <span><spring:message code="btn.create"/></span>
                </div>
            </div>
        </div>
    </div>
    <!--######菜单信息表######-->
    <div id="div_grid">
    </div>
</div>

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

@ -0,0 +1,89 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<!--######应用管理页面 > 应用详情模板页######-->
<div id="div_info_form" class="m-form-inline" style="padding-top:10px;" data-role-form>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>应用名称:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text" class="l-text-field required" disabled="disabled" placeholder="请输入应用名称" name="name"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>英文名称:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" disabled="disabled" placeholder="请输入英文名称" name="englishName"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>图标:</label>
        <div class="m-form-control">
                <img src="${model.icon}" style="width: 50px; height: 50px;"   name="icon">
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>回调URL:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field required" disabled="disabled" placeholder="请输入回调URL" name="appUrl"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>开发者:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" disabled="disabled" placeholder="请输入开发者名称" name="developer"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>appKey:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field required" disabled="disabled" placeholder="请输入appKey" name="appKey"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label>appSecret:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text"  class="l-text-field required" disabled="disabled"  name="appSecret">
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label>状态:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text" id="status"  class="l-text-field required" disabled="disabled" name="status">
            </div>
        </div>
    </div>
    <!-- 隐藏字段 -->
    <div class="m-form-group" style="display: none;">
        <input name="id" hidden="hidden"/>
    </div>
    <div class="m-form-bottom">
        <div id="btnCancel" class="l-button l-button-no">
            <span>关闭</span>
        </div>
        <div id="btnEditor" class="l-button">
            <span>编辑</span>
        </div>
    </div>
</div>

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

@ -0,0 +1,75 @@
<%@ 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 = {
        //form
        init: function () {
            this.initForm();
            this.bindEvents();
        },
        initForm: function () {
            var me = this;
           var data;
            var modelString = "${model.id}";
            if(modelString!=undefined && modelString!=null && modelString.length>0)
            {
               data={
                    id: "${model.id}",
                    name: "${model.name}",
                   englishName: "${model.englishName}",
                   status: "${model.status}",
                   developer: "${model.developer}",
                   icon: "${model.icon}",
                   appUrl: "${model.appUrl}",
                   appKey: "${model.appKey}",
                   appSecret: "${model.appSecret}",
                };
            }
            $("#div_info_form").ligerAutoForm({
                data:data,
                validate:{
                    name:"required",
                    appUrl:"required",
                    appKey:"required",
                    appSecret: {
                        required:true
                    }
                },
            });
        },
        bindEvents: function () {
            var me = this;
            $(".m-form-bottom").on("click","#btnCancel",function () {
                parent.app.dialog.close();
            });
            $(".m-form-bottom").on("click","#btnEditor",function () {
                //TODO 详情页面变编辑
            });
            $("#status").ligerComboBox({data : [{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
                cancelable:false,
                onSuccess:function(data){
                }});
            liger.get("status")._setValue(${model.status});
        }
    };
    $(function () {
        editorParam.init();
    });
</script>

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

@ -0,0 +1,164 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<script>
    /* *************************** 模块初始化 ***************************** */
    var app = {
        grid: null,
        dialog: null,
        init: function () {
            var me = this;
            $('.m-retrieve-area').show();
            $("#txtName").ligerSearch({
                onClick:function(value){
                    me.reloadGrid();
                }});
            me.grid = $("#div_grid").ligerGrid({
                url: '${contextRoot}/app/getAppList',
                parms: {
                    name: $('#txtName').val(),
                    status:$('#statusName').val()
                },
                columns: [
                    {display: '应用名称', id: 'id', name: 'name', width: '15%'},
                    {display: '英文名', name: 'englishName', 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>';
                    }},
                    {display: '开发者', name: 'developer', width: '10%'},
                    {display: '状态', name: 'status', width: '10%',align: 'center', render: function (rowdata, rowindex, value) {
                        if(rowdata.status==1 ){
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>有效  </span></div>';
                        }else if(rowdata.status==0){
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>无效 </span></div>';
                        }
                    }},
                    {display: '应用地址', name: 'appUrl', width: '15%'},
                    {
                        display: '操作', name: 'operator', width: '35%', render: function (row) {
                        var html = '<div class="m-inline-buttons" style="width:350px;">';
                        html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"app.dialogDetail('"+row.id+"')\">查看详情</a>";
                        html += "<a class=\"m-btn\" style=\"padding-right:10px\" onclick=\"app.appServiceManage('"+row.id+"')\">服务管理</a>";
                        html += "<a class=\"m-btn\"  onclick=\"app.dialogDetail('"+row.id+"')\">应用标准</a>";
                        html += "<a class=\"m-btn-edit\" onclick=\"app.editorDialog('"+row.id+"')\"></a>";
                        html += "<a class=\"m-btn-delete\" onclick=\"app.delete('"+row.id+"')\"></a>";
                        html += '</div>';
                        return html;
                    }
                    }
                ],
                onDblClickRow: function (row) {
                    me.editorDialog(row.id);
                }
            });
            me.bindEvents();
        },
        bindEvents: function () {
            var me = this;
            $('#div_new_record').click(function () {
                me.editorDialog();
            });
            $("#statusName").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
                cancelable:false,
                onSuccess:function(data){
            }});
            $(".l-text").css("display","inline-block");
            $(".l-text-wrapper").css("display","inline-block");
        },
        delete:function(id){
            var message = "确定要删除该应用信息吗?";
            jQuery.ligerDialog.confirm(message, function (confirm) {
                if (confirm)
                {
                    $.ajax({ //ajax处理
                        type: "POST",
                        url : "${contextRoot}/app/deleteApp",
                        dataType : "json",
                        data:{id:id},
                        cache:false,
                        success :function(data){
                            if(data.successFlg) {
                                $.ligerDialog.success(data.message);
                                app.grid.reload();
                            }
                            else{
                                $.ligerDialog.error(data.message);
                            }
                        },
                        error :function(data){
                            $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
                        }
                    });
                }
            });
        },
        //刷新列表数据
        reloadGrid: function () {
            this.grid.set({
                parms: {name: $('#txtName').val()}
            });
            this.grid.reload();
        },
        //编辑弹窗
        editorDialog: function (id) {
            var me = this;
            var title = "新增应用";
            var params = null;
            if (id != undefined && id != null) {
                title = "编辑应用";
                params = {"id": id};
            }
            me.dialog = $.ligerDialog.open({
                height: 500,
                width: 500,
                title: title,
                url: '${contextRoot}/app/editorApp',
                //load: true,
                urlParms: params
            });
        },
        dialogDetail: function (id) {
            var me = this;
            var title = "应用详情";
            var params = null;
            if (id != undefined && id != null) {
                params = {"id": id};
            }
            me.dialog = $.ligerDialog.open({
                height: 500,
                width: 500,
                title: title,
                url: '${contextRoot}/app/appDetail',
                //load: true,
                urlParms: params
            });
        },
        appServiceManage: function (id) {
            indexPage.openChildPage("",'${contextRoot}/app/initAppService?appId='+id);
        },
    anthorize: function (id) {
        },
        //弹窗返回
        dialogSuccess: function (message) {
            $.ligerDialog.success(message);
            this.reloadGrid();
            this.dialog.close();
        }
    };
    $(function () {
        app.init();
    });
</script>

+ 35 - 0
hos-admin/src/main/webapp/WEB-INF/ehr/jsp/system/app/appService.jsp

@ -0,0 +1,35 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!--######用户管理页面Title设置######-->
<!-- ####### 页面部分 ####### -->
<div class="m-content">
    <!-- ####### 查询条件部分 ####### -->
    <div class="m-form-inline">
        <div class="m-form-group">
            <%--<div class="m-form-control right" >--%>
                <%--<div id="div_back" class="l-button">--%>
                    <%--<span>返回</span>--%>
                <%--</div>--%>
            <%--</div>--%>
            <div class="m-form-control left">
                <input type="text" id="txtName" class="l-text-field" placeholder="请输入服务名称"/>
                <input type="text" id="txtValid" class="l-text-field" placeholder="全部"/>
            </div>
            <div class="m-form-control right" >
                <div id="div_new_record" class="l-button">
                    <span><spring:message code="btn.create"/></span>
                </div>
            </div>
        </div>
    </div>
    <!--######菜单信息表######-->
    <div id="div_grid">
    </div>
</div>

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

@ -0,0 +1,155 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<script>
    /* *************************** 模块初始化 ***************************** */
    var appService = {
        grid: null,
        dialog: null,
        init: function () {
            var me = this;
            $('.m-retrieve-area').show();
            $("#txtName").ligerSearch({
                onClick:function(value){
                    me.reloadGrid();
                }});
            me.grid = $("#div_grid").ligerGrid({
                url: '${contextRoot}/app/getAppServiceList',
                parms: {
                    name: $('#txtName').val(),
                    status:$('#txtValid').val()
                },
                columns: [
                    {display: '服务名称', id: 'id', name: 'name', width: '15%'},
                    {display: '版本', name: 'version', width: '10%'},
                    {display: '状态', name: 'valid', width: '10%',align: 'center', render: function (rowdata, rowindex, value) {
                        if(rowdata.valid==1 ){
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>有效  </span></div>';
                        }else if(rowdata.valid==0){
                            return ' <div style="vertical-align:middle;margin-top: 10px;"><span>无效 </span></div>';
                        }
                    }},
                    {display: '描述', name: 'description', width: '20%'},
                    {
                        display: '操作', name: 'operator', width: '35%', 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-delete\" onclick=\"appService.delete('"+row.id+"')\"></a>";
                        html += '</div>';
                        return html;
                    }
                    }
                ],
                onDblClickRow: function (row) {
                    me.editorDialog(row.id);
                }
            });
            me.bindEvents();
        },
        bindEvents: function () {
            var me = this;
            $('#div_new_record').click(function () {
                me.editorDialog();
            });
            $("#txtValid").ligerComboBox({data : [{"value":"全部","code":""},{"value":"有效","code":"1"},{"value":"无效","code":"0"}],
                cancelable:false,
                onSuccess:function(data){
            }});
            $(".l-text").css("display","inline-block");
            $(".l-text-wrapper").css("display","inline-block");
        },
        delete:function(id){
            var message = "服务删除后无法恢复,是否确认删除?";
            jQuery.ligerDialog.confirm(message, function (confirm) {
                if (confirm)
                {
                    $.ajax({ //ajax处理
                        type: "POST",
                        url : "${contextRoot}/app/deleteAppService",
                        dataType : "json",
                        data:{id:id},
                        cache:false,
                        success :function(data){
                            if(data.successFlg) {
                                $.ligerDialog.success(data.message);
                                appService.grid.reload();
                            }
                            else{
                                $.ligerDialog.error(data.message);
                            }
                        },
                        error :function(data){
                            $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
                        }
                    });
                }
            });
        },
        //刷新列表数据
        reloadGrid: function () {
            this.grid.set({
                parms: {name: $('#txtName').val()}
            });
            this.grid.reload();
        },
        //编辑弹窗
        editorDialog: function (id) {
            var me = this;
            var title = "新增服务";
            var params = null;
            if (id != undefined && id != null) {
                title = "编辑服务";
                params = {"id": id};
            }
            me.dialog = $.ligerDialog.open({
                height: 800,
                width: 1200,
                title: title,
                url: '${contextRoot}/app/editorAppService',
                //load: true,
                urlParms: params
            });
        },
        dialogDetail: function (id) {
            var me = this;
            var title = "服务详情";
            var params = null;
            if (id != undefined && id != null) {
                params = {"id": id};
            }
            me.dialog = $.ligerDialog.open({
                height: 800,
                width: 1200,
                title: title,
                url: '${contextRoot}/app/appServiceDetail',
                //load: true,
                urlParms: params
            });
        },
        anthorize: function (id) {
        },
        //弹窗返回
        dialogSuccess: function (message) {
            $.ligerDialog.success(message);
            this.reloadGrid();
            this.dialog.close();
        }
    };
    $(function () {
        appService.init();
    });
</script>

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

@ -0,0 +1,91 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<!--######应用管理页面 > 应用详情模板页######-->
<div id="div_info_form" class="m-form-inline" style="padding-top:10px;" data-role-form>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>应用名称:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text" class="l-text-field required" placeholder="请输入应用名称" name="name"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>英文名称:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" placeholder="请输入英文名称" name="englishName"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>图标:</label>
        <div class="m-form-control">
            <div class="l-text">
                <img src="${model.icon}" style="width: 50px; height: 50px;"   name="icon">
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>回调URL:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field required" placeholder="请输入回调URL" name="appUrl"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>开发者:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field" placeholder="请输入开发者名称" name="developer"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label><span class="red">*&nbsp;</span>appKey:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input type="text" class="l-text-field required" placeholder="请输入appKey" name="appKey"/>
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label>appSecret:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text"  class="l-text-field required"  name="appSecret">
            </div>
        </div>
    </div>
    <div class="m-form-group">
        <label>状态:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <input type="text" id="status"  class="l-text-field required" name="status">
            </div>
        </div>
    </div>
    <!-- 隐藏字段 -->
    <div class="m-form-group" style="display: none;">
        <input name="id" hidden="hidden"/>
    </div>
    <div class="m-form-bottom">
        <div id="btnCancel" class="l-button l-button-no">
            <span>关闭</span>
        </div>
        <div id="btnSave" class="l-button">
            <span>保存</span>
        </div>
    </div>
</div>

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

@ -0,0 +1,101 @@
<%@ 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 = {
        //form
        actionUrl:"${contextRoot}/app/addApp",
        init: function () {
            this.initForm();
            this.bindEvents();
        },
        initForm: function () {
            var me = this;
           var data;
            var modelString = "${model.id}";
            if(modelString!=undefined && modelString!=null && modelString.length>0)
            {
               data={
                    id: "${model.id}",
                    name: "${model.name}",
                   englishName: "${model.englishName}",
                   status: "${model.status}",
                   developer: "${model.developer}",
                   icon: "${model.icon}",
                   appUrl: "${model.appUrl}",
                   appKey: "${model.appKey}",
                   appSecret: "${model.appSecret}",
                };
                me.actionUrl = "${contextRoot}/app/updateApp";
            }
            $("#div_info_form").ligerAutoForm({
                data:data,
                validate:{
                    name:"required",
                    appUrl:"required",
                    appKey:"required",
                    appSecret: {
                        required:true
                    }
                },
            });
        },
        bindEvents: function () {
            var me = this;
            $(".m-form-bottom").on("click","#btnSave",function () {
                if(!$("#div_info_form").ligerAutoForm("validate")){
                    return;
                }
                var data = $("#div_info_form").ligerAutoForm("getData");
                $.ajax({ //ajax处理
                    type: "POST",
                    url : me.actionUrl,
                    dataType : "json",
                    data:data,
                    cache:false,
                    success :function(data){
                        if(data.successFlg) {
                            parent.app.dialogSuccess(data.message);
                        }
                        else{
                            $.ligerDialog.error(data.message);
                        }
                    },
                    error :function(data){
                        $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
                    }
                });
            });
            $(".m-form-bottom").on("click","#btnCancel",function () {
                parent.app.dialog.close();
            });
            $("#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;
                }});
        }
    };
    $(function () {
        editorParam.init();
    });
</script>

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

@ -0,0 +1,119 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
<!--######应用管理页面 > 应用详情模板页######-->
<div id="div_info_form" class="m-form-inline" style="padding-top:10px;" data-role-form>
    <div class="m-form-group" >
        <label><span class="red">*&nbsp;</span>服务名称:</label>
        <div class="m-form-control ">
            <div class="l-text">
                <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"/>
            </div>
        </div>
        <label style="width:110px;"><span class="red">*&nbsp;</span>状态:</label>
        <div class="m-form-control">
            <div class="l-text">
                <input  type="text" id="txtValid" class="l-text-field required" placeholder="请输入状态内容 " name="valid"/>
            </div>
        </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;">
                <input type="text"  class="l-text-field" placeholder="请输入端点" name="endpoint"/>
            </div>
        </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;">
                <input type="text" class="l-text-field" placeholder="请输入描述内容" name="description"/>
            </div>
        </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;">
                <input type="text"  class="l-text-field required" placeholder="请选择监控类型 " name="healthReportType"/>
            </div>
        </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;">
                <input type="text" class="l-text-field required" placeholder="请选择监控类型 " name="metricsReportType"/>
            </div>
        </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="requesModule"></textarea>
            </div>
        </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>
            </div>
        </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="responeError"></textarea>
            </div>
        </div>
    </div>
    <!-- 隐藏字段 -->
    <div class="m-form-group" style="display: none;">
        <input name="id" hidden="hidden"/>
    </div>
    <div class="m-form-bottom">
        <div id="btnCancel" class="l-button l-button-no">
            <span>关闭</span>
        </div>
        <div id="btnSave" class="l-button">
            <span>保存</span>
        </div>
    </div>
</div>

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

@ -0,0 +1,102 @@
<%@ 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 = {
        //form
        actionUrl:"${contextRoot}/app/addAppService",
        init: function () {
            this.initForm();
            this.bindEvents();
        },
        initForm: function () {
            var me = this;
           var data;
            var modelString = "${model.id}";
            if(modelString!=undefined && modelString!=null && modelString.length>0)
            {
               data={
                    id: "${model.id}",
                    name: "${model.name}",
                   code: "${model.code}",
                   valid: "${model.valid}",
                   version: "${model.version}",
                   description: "${model.description}",
                   endpoint: "${model.endpoint}",
                   requestProtocol: "${model.requestProtocol}",
                   requesModule: "${model.requesModule}",
                   requestMethod: "${model.requestMethod}",
                   healthReportType: "${model.healthReportType}",
                   healthEndpoint: "${model.healthEndpoint}",
                   responeError: "${model.responeError}",
                   metricsReportType: "${model.metricsReportType}",
                   metricsEndpoint: "${model.metricsEndpoint}"
                };
                me.actionUrl = "${contextRoot}/app/updateAppService";
            }
            $("#div_info_form").ligerAutoForm({
                data:data,
                validate:{
                    name:"required",
                    version:"required",
                    valid:"required",
                    endpoint: {
                        required:true
                    }
                },
            });
        },
        bindEvents: function () {
            var me = this;
            $(".m-form-bottom").on("click","#btnSave",function () {
                if(!$("#div_info_form").ligerAutoForm("validate")){
                    return;
                }
                var data = $("#div_info_form").ligerAutoForm("getData");
                $.ajax({ //ajax处理
                    type: "POST",
                    url : me.actionUrl,
                    dataType : "json",
                    data:data,
                    cache:false,
                    success :function(data){
                        if(data.successFlg) {
                            parent.app.dialogSuccess(data.message);
                        }
                        else{
                            $.ligerDialog.error(data.message);
                        }
                    },
                    error :function(data){
                        $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")");
                    }
                });
            });
            $(".m-form-bottom").on("click","#btnCancel",function () {
                parent.app.dialog.close();
            });
            $("#txtValid").ligerComboBox({data : [{"value":"1","code":"1"},{"value":"0","code":"0"}],
                cancelable:false,
                onSuccess:function(data){
                }});
        }
    };
    $(function () {
        debugger
        editorParam.init();
    });
</script>