Преглед изворни кода

修复新建栏目负责部门继承

创建栏目时,保留从上级栏目自动继承负责部门的行为,但将继承范围收口到栏目负责对象中的部门记录,避免发布对象和抄送对象被一并复制。

新增继承前清理当前栏目的同类负责部门记录,防止重复写入。

Validation:

- javac -encoding UTF-8 -cp "WebRoot/WEB-INF/classes:WebRoot/WEB-INF/lib/*" -d WebRoot/WEB-INF/classes src/space/apps/moudules/website/services/NavigationService.java

- 同步 NavigationService.class 到本地运行副本并重启本地 Tomcat

- 本地事务验证:父栏目三类部门各 3 个,临时子栏目只继承 wnmcode=10020/mtcode=10000 的 3 个负责部门,随后 rollback 清理
非繁 пре 5 месеци
родитељ
комит
9422b4e25e
1 измењених фајлова са 15 додато и 4 уклоњено
  1. 15 4
      src/space/apps/moudules/website/services/NavigationService.java

+ 15 - 4
src/space/apps/moudules/website/services/NavigationService.java

@@ -38,6 +38,8 @@ public class NavigationService extends BaseTransaction {
 	private static final String COLLEGE_HOME_GROUP_IDCARD = "FFKJ_COLLEGE_HOME_GROUP";
 	private static final String COLLEGE_TOP_CUSTOM_IDCARD = "FFKJ_COLLEGE_SCHOOL_HOME";
 	private static final String COLLEGE_BOTTOM_CUSTOM_IDCARD = "FFKJ_COLLEGE_FOOTER_LINKS";
+	private static final Long NAVIGATION_CHARGE_MANAGE_CODE = 10020L;
+	private static final Long DEPARTMENT_MANAGE_TYPE_CODE = 10000L;
 	
 	static Logger log = LogManager.getLogger(NavigationService.class);
 	
@@ -63,7 +65,7 @@ public class NavigationService extends BaseTransaction {
 		AppNavigationUtil.generateNavURI(gdba, wn);
 		
 		gdba.insertByBean(wn);
-		inheritManageFromParent(gdba, wn);
+		inheritChargeDepartmentFromParent(gdba, wn);
 		normalizeCollegeRedHomeNavigationSort(gdba, wn.getWebsiteid(), wn.getParentNid(), null);
 		gdba.commit();
 		clearWebsiteFrontCache(wn);
@@ -72,14 +74,23 @@ public class NavigationService extends BaseTransaction {
 		return DEFAULT_FORWARD;
 	}
 
-	private void inheritManageFromParent(GeneralDBAccess gdba, WebsiteNavigation wn) throws Exception {
+	private void inheritChargeDepartmentFromParent(GeneralDBAccess gdba, WebsiteNavigation wn) throws Exception {
 		if (StringUtil.isNull(wn.getParentNid()) || StringUtil.isNull(wn.getNavigationid())) {
 			return;
 		}
 
-		String sql = " select * from website_navigation_manage where navigationid = :parentNid ";
+		String deleteSql = " delete from website_navigation_manage "
+				+ " where navigationid = :navigationid and wnmcode = :wnmcode and mtcode = :mtcode ";
+		SqlCommandImpl deleteCmd = new SqlCommandImpl(deleteSql);
+		deleteCmd.setString("navigationid", wn.getNavigationid()).setString("wnmcode", NAVIGATION_CHARGE_MANAGE_CODE)
+				.setString("mtcode", DEPARTMENT_MANAGE_TYPE_CODE);
+		gdba.modify(deleteCmd);
+
+		String sql = " select * from website_navigation_manage "
+				+ " where navigationid = :parentNid and wnmcode = :wnmcode and mtcode = :mtcode ";
 		SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
-		sqlCmd.setString("parentNid", wn.getParentNid());
+		sqlCmd.setString("parentNid", wn.getParentNid()).setString("wnmcode", NAVIGATION_CHARGE_MANAGE_CODE)
+				.setString("mtcode", DEPARTMENT_MANAGE_TYPE_CODE);
 		List<WebsiteNavigationManage> manageList = gdba.selectAsList(sqlCmd, WebsiteNavigationManage.class);
 
 		for (WebsiteNavigationManage manage : manageList) {