刚到公司接触的一个新的项目,用的是spring进行管理,mybaties进行数据持久化,cxf发布接口整体dao-service-action;和web项目区别是这只写接口由前边c#传入数据,
具体记录一下
1.webservice暴露出来的方法
@WebService(endpointInterface="com.lgt.webservice.action.UniqueAction",targetNamespace="http://www.lgt.com")
private UniqueService uniqueService ;
public UniqueService getUniqueService() {
return uniqueService;
}
public void setUniqueService(UniqueService uniqueService) {
this.uniqueService = uniqueService;
}
public String method(String code,String data){
try {
logger.info("【执行"+code+"模块】-请求来自IP:"+ClientUtil.getRemoteAddr());
String str = this.uniqueService.execute(code, data);
//这里说一下前台传进来的总是字符串形式的两个参数,code为要执行的方法,data为封装类,写一个json工具类将对象,page全部转换为String
return str;} catch (Exception e) {
// TODO: handle exception
return JsonUtil.formatResult(code, MessageCode.CODE_500000,"访问接口出现错误!接口编码:"+code);
}finally{
logger.info("【执行"+code+"模块】-处理来自IP:"+ClientUtil.getLocalAddr());
}
2.service
// TODO Auto-generated method stub
//判断是否为空
if(StringUtils.isNotEmpty(this.getModuleType(code))){
系统管理///
if(ModuleCode.CODE_LL.equalsIgnoreCase(this.getModuleType(code))){//登录模块
logger.debug("进入登录模块......");
return this.loginAction.execute(code, data).toString();
}else if(ModuleCode.CODE_QQ.equalsIgnoreCase(this.getModuleType(code))){//权限模块
logger.debug("进入权限模块......");
return this.authorityAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AI.equalsIgnoreCase(this.getModuleType(code))){//日志模块
logger.debug("进入日志模块......");
return this.loggerAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AK.equalsIgnoreCase(this.getModuleType(code))){//数据字典模块
logger.debug("进入数据字典管理 模块......");
return this.dictionaryAction.execute(code, data).toString();
}else if(ModuleCode.CODE_AM.equalsIgnoreCase(this.getModuleType(code))){//菜单模块管理
logger.debug("进入菜单模块管理模块....");