liupeng 5 vuotta sitten
vanhempi
commit
031f4ae2a7

+ 4 - 4
code/sapparent/sapservice/src/main/java/org/fouram/constants/WebConstants.java

@@ -1,5 +1,5 @@
-package org.fouram.constants;
-
-public final class WebConstants {
-
+package org.fouram.constants;
+
+public final class WebConstants {
+	public static final String TOP_DEPART = "0";
 }

+ 3 - 2
code/sapparent/sapservice/src/main/java/org/fouram/service/SapOrgService.java

@@ -4,6 +4,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.fouram.constants.WebConstants;
 import org.fouram.core.base.service.BaseService;
 import org.fouram.core.base.service.RequestService;
 import org.fouram.core.plugin.weixin.cp.util.WXCpDepartUtil;
@@ -94,7 +95,7 @@ public class SapOrgService extends BaseService {
 				String firstOrgId = null;
 				if (Tools.notEmpty(businessUnitCode)) {
 					sapUser.setFirstOrgName(businessUnitMap.get(businessUnitCode));
-					firstOrgId = saveOrUpdateSapOrg("0", businessUnitCode, sapUser.getFirstOrgName(), "1");
+					firstOrgId = saveOrUpdateSapOrg(WebConstants.TOP_DEPART, businessUnitCode, sapUser.getFirstOrgName(), "1");
 					sapUser.setFirstOrgId(firstOrgId);
 				}
 				String secondOrgId = null;
@@ -122,7 +123,7 @@ public class SapOrgService extends BaseService {
 
 	public Map<String, Long> updateAllWxDepartId() throws Exception {
 		Map<String, Long> result = Maps.newHashMap();
-		List<SapOrg> firstOrgs = findListByParentId("0");
+		List<SapOrg> firstOrgs = findListByParentId(WebConstants.TOP_DEPART);
 		List<SapOrg> allOrgs = Lists.newArrayList();
 		for (SapOrg firstOrg : firstOrgs) {
 			firstOrg.setWxDepartId(WXCpDepartUtil.createOrUpdate(firstOrg.getWxDepartId(), 1L, firstOrg.getSapName()));