|
@@ -13,6 +13,7 @@ import org.apache.logging.log4j.Logger;
|
|
|
import apps.pojo.Website;
|
|
import apps.pojo.Website;
|
|
|
import apps.pojo.WebsiteNavigation;
|
|
import apps.pojo.WebsiteNavigation;
|
|
|
import apps.pojo.WebsiteVisitLog;
|
|
import apps.pojo.WebsiteVisitLog;
|
|
|
|
|
+import space.apps.moudules.basic.util.SortOrderUtil;
|
|
|
import space.core.apps.common.BaseTransaction;
|
|
import space.core.apps.common.BaseTransaction;
|
|
|
import space.core.apps.listener.ModuleInitListener;
|
|
import space.core.apps.listener.ModuleInitListener;
|
|
|
import space.core.apps.util.CloneUtil;
|
|
import space.core.apps.util.CloneUtil;
|
|
@@ -40,6 +41,19 @@ public class WebsiteService extends BaseTransaction {
|
|
|
|
|
|
|
|
static Logger log = LogManager.getLogger(WebsiteService.class);
|
|
static Logger log = LogManager.getLogger(WebsiteService.class);
|
|
|
|
|
|
|
|
|
|
+ public String info() throws Exception {
|
|
|
|
|
+ Website website = new Website();
|
|
|
|
|
+ website.setWebsiteid(getParameterToLong("websiteid"));
|
|
|
|
|
+
|
|
|
|
|
+ GeneralDBAccess gdba = getGdbaInstance();
|
|
|
|
|
+ gdba.selectById(website);
|
|
|
|
|
+
|
|
|
|
|
+ setRequestAttribute("website", website);
|
|
|
|
|
+ setRequestAttribute("sortNumber", getWebsiteSortNumber(gdba, website.getWebsiteid()));
|
|
|
|
|
+
|
|
|
|
|
+ return DEFAULT_FORWARD;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public String add() throws Exception {
|
|
public String add() throws Exception {
|
|
|
|
|
|
|
|
Website website = (Website) PojoUtil.formatRequest(getRequest(), Website.class);
|
|
Website website = (Website) PojoUtil.formatRequest(getRequest(), Website.class);
|
|
@@ -50,6 +64,7 @@ public class WebsiteService extends BaseTransaction {
|
|
|
}
|
|
}
|
|
|
website.setCatalogUri("/");
|
|
website.setCatalogUri("/");
|
|
|
gdba.insertByBean(website);
|
|
gdba.insertByBean(website);
|
|
|
|
|
+ saveWebsiteSortNumber(gdba, website.getWebsiteid(), false);
|
|
|
|
|
|
|
|
initWtNavigationList(gdba, website.getWtid(), website.getWebsiteid(), getUnit().getUnitid(),
|
|
initWtNavigationList(gdba, website.getWtid(), website.getWebsiteid(), getUnit().getUnitid(),
|
|
|
getAppUser().getUserId());
|
|
getAppUser().getUserId());
|
|
@@ -68,6 +83,7 @@ public class WebsiteService extends BaseTransaction {
|
|
|
|
|
|
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
|
gdba.updateById(website, getRequest());
|
|
gdba.updateById(website, getRequest());
|
|
|
|
|
+ saveWebsiteSortNumber(gdba, website.getWebsiteid(), true);
|
|
|
|
|
|
|
|
gdba.commit();
|
|
gdba.commit();
|
|
|
|
|
|
|
@@ -77,6 +93,24 @@ public class WebsiteService extends BaseTransaction {
|
|
|
return DEFAULT_FORWARD;
|
|
return DEFAULT_FORWARD;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void saveWebsiteSortNumber(GeneralDBAccess gdba, Long websiteid, boolean allowBlank) throws Exception {
|
|
|
|
|
+ if (!allowBlank && StringUtil.isNull(getParameter("sortNumber"))) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ SortOrderUtil.updateSortNumber(gdba, "website", "websiteid", websiteid,
|
|
|
|
|
+ SortOrderUtil.parseSortNumber(getParameter("sortNumber")));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Object getWebsiteSortNumber(GeneralDBAccess gdba, Long websiteid) throws Exception {
|
|
|
|
|
+ if (StringUtil.isNull(websiteid)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ SqlCommandImpl sqlCmd = new SqlCommandImpl(" select sort_number from website where websiteid = :websiteid ");
|
|
|
|
|
+ sqlCmd.setString("websiteid", websiteid);
|
|
|
|
|
+ Map<String, Object> websiteMap = gdba.selectAsMap(sqlCmd);
|
|
|
|
|
+ return websiteMap == null ? null : websiteMap.get("sort_number");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void initWtNavigationList(GeneralDBAccess gdba, Long wtId, Long websiteId, Long unitId, Long appUserId)
|
|
private void initWtNavigationList(GeneralDBAccess gdba, Long wtId, Long websiteId, Long unitId, Long appUserId)
|
|
|
throws Exception {
|
|
throws Exception {
|
|
|
|
|
|
|
@@ -181,13 +215,13 @@ public class WebsiteService extends BaseTransaction {
|
|
|
String sql = " insert into article ( "
|
|
String sql = " insert into article ( "
|
|
|
+ " dcode, websiteid, unitid, ascode, navigationid, title, ajtcode, `desc`, source, thumbnail, "
|
|
+ " dcode, websiteid, unitid, ascode, navigationid, title, ajtcode, `desc`, source, thumbnail, "
|
|
|
+ " sticktop, sticktop_end_time, sticktop_schedulesid, `release`, release_time, release_task_schedulesid, "
|
|
+ " sticktop, sticktop_end_time, sticktop_schedulesid, `release`, release_time, release_task_schedulesid, "
|
|
|
- + " content, edit_content, url, read_count, create_time, last_change_time, create_pid, last_change_pid "
|
|
|
|
|
|
|
+ + " content, edit_content, url, read_count, sort_number, create_time, last_change_time, create_pid, last_change_pid "
|
|
|
+ " ) "
|
|
+ " ) "
|
|
|
+ " select 61, :websiteId1, :unitId, a.ascode, target_nav.navigationid, "
|
|
+ " select 61, :websiteId1, :unitId, a.ascode, target_nav.navigationid, "
|
|
|
+ " replace(case when a.source = :topLinkSource1 then a.title when a.title like :initialTitlePattern then a.title else concat(substring(a.title, 1, 252), :initialSuffix) end, reference_website.name, target_website.name), "
|
|
+ " replace(case when a.source = :topLinkSource1 then a.title when a.title like :initialTitlePattern then a.title else concat(substring(a.title, 1, 252), :initialSuffix) end, reference_website.name, target_website.name), "
|
|
|
+ " a.ajtcode, replace(a.`desc`, reference_website.name, target_website.name), a.source, a.thumbnail, "
|
|
+ " a.ajtcode, replace(a.`desc`, reference_website.name, target_website.name), a.source, a.thumbnail, "
|
|
|
+ " a.sticktop, a.sticktop_end_time, a.sticktop_schedulesid, a.`release`, a.release_time, a.release_task_schedulesid, "
|
|
+ " a.sticktop, a.sticktop_end_time, a.sticktop_schedulesid, a.`release`, a.release_time, a.release_task_schedulesid, "
|
|
|
- + " a.content, a.edit_content, a.url, a.read_count, now(), now(), :appUserId1, :appUserId2 "
|
|
|
|
|
|
|
+ + " a.content, a.edit_content, a.url, a.read_count, a.sort_number, now(), now(), :appUserId1, :appUserId2 "
|
|
|
+ " from article a "
|
|
+ " from article a "
|
|
|
+ " join website reference_website on reference_website.websiteid = :referenceWebsiteId1 "
|
|
+ " join website reference_website on reference_website.websiteid = :referenceWebsiteId1 "
|
|
|
+ " join website target_website on target_website.websiteid = :websiteId2 "
|
|
+ " join website target_website on target_website.websiteid = :websiteId2 "
|
|
@@ -282,7 +316,8 @@ public class WebsiteService extends BaseTransaction {
|
|
|
Long unitId = getUnit().getUnitid();
|
|
Long unitId = getUnit().getUnitid();
|
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
|
|
|
|
|
|
- String sql = " select websiteid, name from website where unitid = :unitid and dcode = 61 and parent_wid is null ";
|
|
|
|
|
|
|
+ String sql = " select websiteid, name from website where unitid = :unitid and dcode = 61 and parent_wid is null "
|
|
|
|
|
+ + " order by " + SortOrderUtil.manualSort("", "sort_number", "create_time", "websiteid");
|
|
|
SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
|
sqlCmd.setString("unitid", unitId);
|
|
sqlCmd.setString("unitid", unitId);
|
|
|
|
|
|
|
@@ -297,7 +332,8 @@ public class WebsiteService extends BaseTransaction {
|
|
|
void getWebsiteListApi(GeneralDBAccess gdba, Map<String, Object> websiteMap, Long unitId, Long parWebsiteId)
|
|
void getWebsiteListApi(GeneralDBAccess gdba, Map<String, Object> websiteMap, Long unitId, Long parWebsiteId)
|
|
|
throws SQLException, Exception {
|
|
throws SQLException, Exception {
|
|
|
|
|
|
|
|
- String sql = " select websiteid, name from website where unitid = :unitid and dcode = 61 and parent_wid = :parWebsiteId ";
|
|
|
|
|
|
|
+ String sql = " select websiteid, name from website where unitid = :unitid and dcode = 61 and parent_wid = :parWebsiteId "
|
|
|
|
|
+ + " order by " + SortOrderUtil.manualSort("", "sort_number", "create_time", "websiteid");
|
|
|
SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
|
sqlCmd.setString("unitid", unitId).setString("parWebsiteId", parWebsiteId);
|
|
sqlCmd.setString("unitid", unitId).setString("parWebsiteId", parWebsiteId);
|
|
|
List<Map<String, Object>> websiteList = gdba.selectAsMapList(sqlCmd);
|
|
List<Map<String, Object>> websiteList = gdba.selectAsMapList(sqlCmd);
|
|
@@ -397,7 +433,8 @@ public class WebsiteService extends BaseTransaction {
|
|
|
|
|
|
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
GeneralDBAccess gdba = getGdbaInstance();
|
|
|
|
|
|
|
|
- String sql = " select websiteid as 'id', name, logo as 'icon_path' from website where dcode = 61 order by websiteid asc ";
|
|
|
|
|
|
|
+ String sql = " select websiteid as 'id', name, logo as 'icon_path' from website where dcode = 61 order by "
|
|
|
|
|
+ + SortOrderUtil.manualSort("", "sort_number", "create_time", "websiteid");
|
|
|
SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
|
|
|
|
|
|
|
|
List<Map<String, Object>> websiteList = gdba.selectAsMapList(sqlCmd);
|
|
List<Map<String, Object>> websiteList = gdba.selectAsMapList(sqlCmd);
|