Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MCMS
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
MCMS
Commits
83c95d79
Commit
83c95d79
authored
Mar 23, 2016
by
killfen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
域名地址问题修复
parent
2498f983
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
281 deletions
+212
-281
src/main/java/com/mingsoft/basic/action/AppAction.java
src/main/java/com/mingsoft/basic/action/AppAction.java
+210
-279
src/main/webapp/manager/app/app.ftl
src/main/webapp/manager/app/app.ftl
+2
-2
No files found.
src/main/java/com/mingsoft/basic/action/AppAction.java
View file @
83c95d79
...
@@ -47,15 +47,15 @@ import com.mingsoft.util.StringUtil;
...
@@ -47,15 +47,15 @@ import com.mingsoft.util.StringUtil;
/**
/**
* 网站基本信息控制层
* 网站基本信息控制层
*
* @author 史爱华
* @author 史爱华
* @version
* @version 版本号:100-000-000<br/>
* 版本号:100-000-000<br/>
* 创建日期:2014-07-14<br/>
* 创建日期:2014-07-14<br/>
* 历史修订:<br/>
* 历史修订:<br/>
*/
*/
@Controller
@Controller
@RequestMapping
(
"/manager/app/"
)
@RequestMapping
(
"/manager/app/"
)
public
class
AppAction
extends
BaseAction
{
public
class
AppAction
extends
BaseAction
{
/**
/**
* appBiz业务层的注入
* appBiz业务层的注入
...
@@ -69,211 +69,140 @@ public class AppAction extends BaseAction{
...
@@ -69,211 +69,140 @@ public class AppAction extends BaseAction{
@Autowired
@Autowired
private
IManagerBiz
managerBiz
;
private
IManagerBiz
managerBiz
;
/**
* 对系统管理进行的查询站点列表信息
* @param request 请求对象
* @param mode ModelMap实体对象
* @param response 响应对象
* @return 站点列表显示页面
*/
@RequestMapping
(
"/list"
)
public
String
queryList
(
HttpServletRequest
request
,
ModelMap
mode
,
HttpServletResponse
response
){
ManagerEntity
managerSession
=
(
ManagerEntity
)
getSession
(
request
,
SessionConst
.
MANAGER_ESSION
);
int
pageNo
=
1
;
//查询总记录数
int
recordCount
=
appBiz
.
queryCount
();
//排序依据字段
String
orderBy
=
"app_id"
;
if
(
request
.
getParameter
(
"pageNo"
)!=
null
){
pageNo
=
Integer
.
parseInt
(
request
.
getParameter
(
"pageNo"
).
toString
());
}
PageUtil
page
=
new
PageUtil
(
pageNo
,
100
,
recordCount
,
getUrl
(
request
)+
"/manager/app/list.do"
);
//保存cookie值
this
.
setCookie
(
request
,
response
,
CookieConst
.
PAGENO_COOKIE
,
String
.
valueOf
(
pageNo
));
//分页查询
List
<
BaseEntity
>
apps
=
appBiz
.
queryByPage
(
page
,
orderBy
,
false
);
mode
.
addAttribute
(
"listApp"
,
apps
);
mode
.
addAttribute
(
"page"
,
page
);
mode
.
addAttribute
(
"managerSession"
,
managerSession
);
return
"/manager/app/app_list"
;
}
/**
* 根据id删除站点信息
* @param basicId 要删除的站点Id
* @param request 请求对象
* @return 返回当前页数
*/
@RequestMapping
(
"/{basicId}/delete"
)
@ResponseBody
public
int
delete
(
@PathVariable
int
basicId
,
HttpServletRequest
request
){
AppEntity
app
=
(
AppEntity
)
appBiz
.
getEntity
(
basicId
);
/*
* 删除对应的站点管理员
*/
if
(
app
!=
null
){
int
managerId
=
app
.
getAppManagerId
();
managerBiz
.
deleteEntity
(
managerId
);
appBiz
.
deleteBasic
(
basicId
);
}
int
pageNo
=
2
;
//保存页面cookie值
int
cookie
=
Integer
.
valueOf
(
this
.
getCookie
(
request
,
CookieConst
.
PAGENO_COOKIE
));
if
(
cookie
>=
1
){
pageNo
=
cookie
;
}
return
pageNo
;
}
/**
* 跳转到站点保存页面
* @param request 请求对象
* @param mode ModelMap实体对象
* @return 站点保存页面
*/
@RequestMapping
(
"/add"
)
public
String
add
(
HttpServletRequest
request
,
ModelMap
mode
){
//超级管理员识别
mode
.
addAttribute
(
"SystemManager"
,
true
);
AppEntity
app
=
new
AppEntity
();
//传入一个空的app
mode
.
addAttribute
(
"app"
,
app
);
return
"/manager/app/app"
;
}
/**
/**
* 跳转到修改页面
* 跳转到修改页面
* @param mode ModelMap实体对象
*
* @param appId 站点id
* @param mode
* @param request 请求对象
* ModelMap实体对象
* @param appId
* 站点id
* @param request
* 请求对象
* @return 站点修改页面
* @return 站点修改页面
*/
*/
@RequestMapping
(
value
=
"/{appId}/edit"
)
@RequestMapping
(
value
=
"/{appId}/edit"
)
public
String
edit
(
ModelMap
mode
,
@PathVariable
int
appId
,
HttpServletRequest
request
)
{
public
String
edit
(
ModelMap
mode
,
@PathVariable
int
appId
,
HttpServletRequest
request
)
{
AppEntity
app
=
null
;
AppEntity
app
=
null
;
if
(
appId
<
0
)
{
if
(
appId
<
0
)
{
app
=
this
.
getApp
(
request
);
app
=
this
.
getApp
(
request
);
}
else
{
}
else
{
app
=
(
AppEntity
)
appBiz
.
getEntity
(
appId
);
app
=
(
AppEntity
)
appBiz
.
getEntity
(
appId
);
}
}
//
判断否是超级管理员,是的话不显示站点风格
//
判断否是超级管理员,是的话不显示站点风格
if
(
this
.
isSystemManager
(
request
)){
if
(
this
.
isSystemManager
(
request
))
{
mode
.
addAttribute
(
"SystemManager"
,
true
);
mode
.
addAttribute
(
"SystemManager"
,
true
);
}
else
{
}
else
{
mode
.
addAttribute
(
"SystemManager"
,
false
);
mode
.
addAttribute
(
"SystemManager"
,
false
);
}
}
mode
.
addAttribute
(
"app"
,
app
);
mode
.
addAttribute
(
"app"
,
app
);
return
"/manager/app/app"
;
return
"/manager/app/app"
;
}
}
/**
/**
* 更新站点信息
* 更新站点信息
* @param mode ModelMap实体对象
*
* @param app 站点对象
* @param mode
* @param request 请求对象
* ModelMap实体对象
* @param response 相应对象
* @param app
* 站点对象
* @param request
* 请求对象
* @param response
* 相应对象
*/
*/
@RequestMapping
(
"/update"
)
@RequestMapping
(
"/update"
)
public
void
update
(
ModelMap
mode
,
@ModelAttribute
AppEntity
app
,
HttpServletRequest
request
,
HttpServletResponse
response
){
public
void
update
(
ModelMap
mode
,
@ModelAttribute
AppEntity
app
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
mode
.
clear
();
mode
.
clear
();
// 获取Session值
// 获取Session值
ManagerEntity
managerSession
=
(
ManagerEntity
)
getManagerBySession
(
request
);
ManagerEntity
managerSession
=
(
ManagerEntity
)
getManagerBySession
(
request
);
if
(
managerSession
==
null
){
if
(
managerSession
==
null
)
{
return
;
return
;
}
}
mode
.
addAttribute
(
"managerSession"
,
managerSession
);
mode
.
addAttribute
(
"managerSession"
,
managerSession
);
//
判断否是超级管理员,不是则不修改应用续费时间和清单
//
判断否是超级管理员,不是则不修改应用续费时间和清单
if
(!
this
.
isSystemManager
(
request
)){
if
(!
this
.
isSystemManager
(
request
))
{
app
.
setAppPayDate
(
null
);
app
.
setAppPayDate
(
null
);
app
.
setAppPay
(
null
);
app
.
setAppPay
(
null
);
// 设置当前的站点id
// 设置当前的站点id
app
.
setAppId
(
this
.
getAppId
(
request
));
app
.
setAppId
(
this
.
getAppId
(
request
));
}
}
int
managerRoleID
=
managerSession
.
getManagerRoleID
();
int
managerRoleID
=
managerSession
.
getManagerRoleID
();
//
判断站点数据的合法性
//
判断站点数据的合法性
// 获取cookie
// 获取cookie
String
cookie
=
this
.
getCookie
(
request
,
CookieConst
.
PAGENO_COOKIE
);
String
cookie
=
this
.
getCookie
(
request
,
CookieConst
.
PAGENO_COOKIE
);
int
pageNo
=
1
;
int
pageNo
=
1
;
//
判断cookies是否为空
//
判断cookies是否为空
if
(!
StringUtil
.
isBlank
(
cookie
)
&&
Integer
.
valueOf
(
cookie
)>
0
){
if
(!
StringUtil
.
isBlank
(
cookie
)
&&
Integer
.
valueOf
(
cookie
)
>
0
)
{
pageNo
=
Integer
.
valueOf
(
cookie
);
pageNo
=
Integer
.
valueOf
(
cookie
);
}
}
mode
.
addAttribute
(
"pageNo"
,
pageNo
);
mode
.
addAttribute
(
"pageNo"
,
pageNo
);
if
(!
checkForm
(
app
,
response
)){
if
(!
checkForm
(
app
,
response
))
{
return
;
return
;
}
}
if
(!
StringUtil
.
isBlank
(
app
.
getAppLogo
()))
{
if
(!
StringUtil
.
isBlank
(
app
.
getAppLogo
()))
{
app
.
setAppLogo
(
app
.
getAppLogo
().
replace
(
"|"
,
""
));
app
.
setAppLogo
(
app
.
getAppLogo
().
replace
(
"|"
,
""
));
}
}
//更新站点信息
// 过滤地址后面的/\符号
appBiz
.
updateEntity
(
app
);
String
url
=
app
.
getAppUrl
();
this
.
outJson
(
response
,
ModelCode
.
APP
,
true
,
String
.
valueOf
(
pageNo
),
String
.
valueOf
(
managerRoleID
));
String
_url
[]
=
url
.
split
(
"\r\n"
);
StringBuffer
sb
=
new
StringBuffer
();
for
(
String
temp:
_url
)
{
String
lastChar
=
temp
.
trim
().
substring
(
temp
.
length
()-
1
);
if
(
lastChar
.
equals
(
"/"
)
||
lastChar
.
equals
(
"\\"
))
{
sb
.
append
(
temp
.
substring
(
0
,
temp
.
trim
().
length
()-
1
)).
append
(
"\r\n"
);
}
}
/**
* 保存站点信息
* @param app 站点实体对象
* @param request 请求对象
* @param response 相应对象
*/
@RequestMapping
(
"/save"
)
public
void
save
(
@ModelAttribute
AppEntity
app
,
HttpServletRequest
request
,
HttpServletResponse
response
){
//验证站点数据的合法性
if
(!
checkForm
(
app
,
response
)){
return
;
}
//问题:由于上传的图片路径后面可能带有|符合。所以要进行将“|”替换空
//空值判断
if
(!
StringUtil
.
isBlank
(
app
.
getAppLogo
()))
{
app
.
setAppLogo
(
app
.
getAppLogo
().
replace
(
"|"
,
""
));
}
//问题:去掉域名后面的"/"
String
appUrl
=
app
.
getAppHostUrl
();
app
.
setAppUrl
(
appUrl
);
appBiz
.
saveEntity
(
app
);
if
(
isSystemManager
(
request
))
{
String
file
=
this
.
getRealPath
(
request
,
IParserRegexConstant
.
REGEX_SAVE_TEMPLATE
+
File
.
separator
+
app
.
getAppId
());
File
fileName
=
new
File
(
file
);
fileName
.
mkdir
();
}
}
this
.
outJson
(
response
,
ModelCode
.
APP
,
true
,
null
);
app
.
setAppUrl
(
sb
.
toString
());
// 更新站点信息
appBiz
.
updateEntity
(
app
);
this
.
outJson
(
response
,
ModelCode
.
APP
,
true
,
String
.
valueOf
(
pageNo
),
String
.
valueOf
(
managerRoleID
));
}
}
/**
/**
* 判断站点域名的合法性
* 判断站点域名的合法性
* @param app 要验证的站点信息
*
* @param response response对象
* @param app
* 要验证的站点信息
* @param response
* response对象
*/
*/
public
boolean
checkForm
(
AppEntity
app
,
HttpServletResponse
response
)
{
public
boolean
checkForm
(
AppEntity
app
,
HttpServletResponse
response
)
{
/*
/*
* 判断数据的合法性
* 判断数据的合法性
*/
*/
if
(!
StringUtil
.
checkLength
(
app
.
getAppKeyword
(),
0
,
1000
)){
if
(!
StringUtil
.
checkLength
(
app
.
getAppKeyword
(),
0
,
1000
))
{
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appKeyword"
),
"0"
,
"1000"
));
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appKeyword"
),
"0"
,
"1000"
));
return
false
;
return
false
;
}
}
if
(!
StringUtil
.
checkLength
(
app
.
getAppCopyright
(),
0
,
1000
)){
if
(!
StringUtil
.
checkLength
(
app
.
getAppCopyright
(),
0
,
1000
))
{
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appCopyright"
),
"0"
,
"1000"
));
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appCopyright"
),
"0"
,
"1000"
));
return
false
;
return
false
;
}
}
if
(!
StringUtil
.
checkLength
(
app
.
getAppDescription
(),
0
,
1000
)){
if
(!
StringUtil
.
checkLength
(
app
.
getAppDescription
(),
0
,
1000
))
{
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appDescrip"
),
"0"
,
"1000"
));
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appDescrip"
),
"0"
,
"1000"
));
return
false
;
return
false
;
}
}
if
(!
StringUtil
.
checkLength
(
app
.
getAppName
(),
1
,
50
)){
if
(!
StringUtil
.
checkLength
(
app
.
getAppName
(),
1
,
50
))
{
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appTitle"
),
"1"
,
"50"
));
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appTitle"
),
"1"
,
"50"
));
return
false
;
return
false
;
}
}
if
(!
StringUtil
.
isBlank
(
app
.
getAppStyle
())
&&
!
StringUtil
.
checkLength
(
app
.
getAppStyle
(),
1
,
30
)){
if
(!
StringUtil
.
isBlank
(
app
.
getAppStyle
())
&&
!
StringUtil
.
checkLength
(
app
.
getAppStyle
(),
1
,
30
))
{
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appStyle"
),
"1"
,
"30"
));
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appStyle"
),
"1"
,
"30"
));
return
false
;
return
false
;
}
}
if
(!
StringUtil
.
checkLength
(
app
.
getAppHostUrl
(),
10
,
150
)){
if
(!
StringUtil
.
checkLength
(
app
.
getAppHostUrl
(),
10
,
150
))
{
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appUrl"
),
"10"
,
"150"
));
this
.
outJson
(
response
,
ModelCode
.
APP
,
false
,
getResString
(
"err.length"
,
this
.
getResString
(
"appUrl"
),
"10"
,
"150"
));
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
@@ -281,19 +210,21 @@ public class AppAction extends BaseAction{
...
@@ -281,19 +210,21 @@ public class AppAction extends BaseAction{
/**
/**
* 判断是否有重复的域名
* 判断是否有重复的域名
* @param request 请求对象
*
* @param request
* 请求对象
* @return true:重复,false:不重复
* @return true:重复,false:不重复
*/
*/
@RequestMapping
(
"/checkUrl"
)
@RequestMapping
(
"/checkUrl"
)
@ResponseBody
@ResponseBody
public
boolean
checkUrl
(
HttpServletRequest
request
)
{
public
boolean
checkUrl
(
HttpServletRequest
request
)
{
if
(
request
.
getParameter
(
"appUrl"
)!=
null
){
if
(
request
.
getParameter
(
"appUrl"
)
!=
null
)
{
if
(
appBiz
.
countByUrl
(
request
.
getParameter
(
"appUrl"
))>
0
){
if
(
appBiz
.
countByUrl
(
request
.
getParameter
(
"appUrl"
))
>
0
)
{
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
...
src/main/webapp/manager/app/app.ftl
View file @
83c95d79
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
<@ms.checkbox name="appMobileStyle" width="200" list=[{"id":"m","value":"启用"}] listKey="id" listValue="value" valueList=["${app.appMobileStyle!('')}"] label="启用移动端"
<@ms.checkbox name="appMobileStyle" width="200" list=[{"id":"m","value":"启用"}] listKey="id" listValue="value" valueList=["${app.appMobileStyle!('')}"] label="启用移动端"
help="启用后手机用户访问网站会显示手机版网页,前提是网站必需提供移动端皮肤,相关教程:<a href='http://ms.ming-soft.com/mbbs/13086/detail.do' target='_blank'>铭飞移动端开发教程</a>"/>
help="启用后手机用户访问网站会显示手机版网页,前提是网站必需提供移动端皮肤,相关教程:<a href='http://ms.ming-soft.com/mbbs/13086/detail.do' target='_blank'>铭飞移动端开发教程</a>"/>
<@ms.textarea name="appUrl" label="域 名" width="400" rows="4" value="${app.appUrl?default('')}"
<@ms.textarea name="appUrl" label="域 名" width="400" rows="4" value="${app.appUrl?default('')}"
placeholder="使用回车换行可以输入多个域名地址,必须要加http://"
placeholder="使用回车换行可以输入多个域名地址,必须要加http://
域名不要以/\\符号结尾
"
help="多个域名回车换行显示,必须以http[s]://打头,
<br/>例如:http://www.a.com <br/> http://a.com
"
help="多个域名回车换行显示,必须以http[s]://打头,
域名不要以/\\符号结尾<br/>例如:<br/>http://www.a.com <br/> http://a.com
"
validation={"maxlength":"150","required":"true","data-bv-notempty-message":"必填项目", "data-bv-stringlength-message":"长度在150个字符以内!"} />
validation={"maxlength":"150","required":"true","data-bv-notempty-message":"必填项目", "data-bv-stringlength-message":"长度在150个字符以内!"} />
<@ms.select name="appStyle" width="300" id="appStyle" label="模板风格" />
<@ms.select name="appStyle" width="300" id="appStyle" label="模板风格" />
<@ms.textarea name="appKeyword" label="关键字" width="700" value="${app.appKeyword?default('')}" rows="4" placeholder="请输入关键字"/>
<@ms.textarea name="appKeyword" label="关键字" width="700" value="${app.appKeyword?default('')}" rows="4" placeholder="请输入关键字"/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment