Commit 0a3f566f authored by wangyihao's avatar wangyihao

添加 跳链接

parent 5cd3b049
...@@ -58,6 +58,7 @@ public class IndexController { ...@@ -58,6 +58,7 @@ public class IndexController {
map.put("advertPicUrl", list.getAdvertPicUrl()); map.put("advertPicUrl", list.getAdvertPicUrl());
map.put("advertContent", list.getAdvertContent()); map.put("advertContent", list.getAdvertContent());
map.put("advertTitle", list.getAdvertTitle()); map.put("advertTitle", list.getAdvertTitle());
map.put("linkUrl", list.getLinkUrl());
listQuery.add(map); listQuery.add(map);
} }
resultInfo.setData(listQuery); resultInfo.setData(listQuery);
......
...@@ -63,42 +63,20 @@ public class AdvertController extends BaseController{ ...@@ -63,42 +63,20 @@ public class AdvertController extends BaseController{
advert.setAdvertContent(advertContent); advert.setAdvertContent(advertContent);
} }
if (advert!=null&&advert.getAdvertId()!=null&&!"".equals(advert.getAdvertId())) { if (advert!=null&&advert.getAdvertId()!=null&&!"".equals(advert.getAdvertId())) {
Advert advertQuery = advertService.getAdvertQuery(advert.getUsageSubclass());//判断使用指南子类是否已存在
if(advertQuery != null &&!advertQuery.getAdvertId().equals(advert.getAdvertId())) {
result.setCode("0");
result.setMsg("该子类已存在,请重新添加");
return result;
}
String html = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"><title>"+advert.getAdvertTitle()+"</title></head><body>" + advert.getAdvertContent() + "</body></html>"; String html = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"><title>"+advert.getAdvertTitle()+"</title></head><body>" + advert.getAdvertContent() + "</body></html>";
ECFileUtil.uploadFile(html.getBytes("UTF-8"), storeFilePath, advert.getAdvertId()+".html"); ECFileUtil.uploadFile(html.getBytes("UTF-8"), storeFilePath, advert.getAdvertId()+".html");
advert.setLinkUrl(fileServer+advert.getAdvertId()+".html"); // advert.setLinkUrl(fileServer+advert.getAdvertId()+".html");
result = advertService.updateAdvert(advert, getOperator()); result = advertService.updateAdvert(advert, getOperator());
}else { }else {
if (advert.getAdvertType()==4||advert.getAdvertType()==6) {
Advert advertQuery = new Advert();
advertQuery.setAdvertType(advert.getAdvertType());
List<Advert> advertList = advertService.getAdvertList(new Query(advertQuery));
if (advertList.size()>=1) {
result.setCode("0");
return result;
}
}
if(advert.getUsageSubclass() != null && !"".equals(advert.getUsageSubclass())) {
Advert advertQuery = advertService.getAdvertQuery(advert.getUsageSubclass());//判断使用指南子类是否已存在
if(advertQuery !=null) {
result.setCode("0");
result.setMsg("该子类已存在,请重新添加");
return result;
}
}
advert.setAdvertId(advertService.generatePK()); advert.setAdvertId(advertService.generatePK());
if (advert!=null&&advert.getAdvertContent()!=null&&!"".equals(advert.getAdvertContent())) { if (advert!=null&&advert.getAdvertContent()!=null&&!"".equals(advert.getAdvertContent())) {
String html = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"><title>"+advert.getAdvertTitle()+"</title></head><body>" + advert.getAdvertContent() + "</body></html>"; String html = "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"><title>"+advert.getAdvertTitle()+"</title></head><body>" + advert.getAdvertContent() + "</body></html>";
ECFileUtil.uploadFile(html.getBytes("UTF-8"), storeFilePath, advert.getAdvertId()+".html"); ECFileUtil.uploadFile(html.getBytes("UTF-8"), storeFilePath, advert.getAdvertId()+".html");
} }
advert.setLinkUrl(fileServer+advert.getAdvertId()+".html"); // advert.setLinkUrl(fileServer+advert.getAdvertId()+".html");
result = advertService.addAdvert(advert, getOperator()); result = advertService.addAdvert(advert, getOperator());
} }
return result; return result;
......
...@@ -80,10 +80,10 @@ ADVERT_PIC_URL,CREATE_TIME,UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,USAGE_SUBCLASS ...@@ -80,10 +80,10 @@ ADVERT_PIC_URL,CREATE_TIME,UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,USAGE_SUBCLASS
<if test="advertSubTitle!=null and advertSubTitle!=''"> <if test="advertSubTitle!=null and advertSubTitle!=''">
ADVERT_SUB_TITLE=#{advertSubTitle,jdbcType = VARCHAR}, ADVERT_SUB_TITLE=#{advertSubTitle,jdbcType = VARCHAR},
</if> </if>
<if test="advertContent!=null and advertContent!=''"> <if test="advertContent!=null">
ADVERT_CONTENT=#{advertContent,jdbcType = VARCHAR}, ADVERT_CONTENT=#{advertContent,jdbcType = VARCHAR},
</if> </if>
<if test="linkUrl!=null and linkUrl!=''"> <if test="linkUrl!=null">
LINK_URL=#{linkUrl,jdbcType = VARCHAR}, LINK_URL=#{linkUrl,jdbcType = VARCHAR},
</if> </if>
<if test="isAvailable!=null "> <if test="isAvailable!=null ">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment