liupeng 4 年之前
父節點
當前提交
b0001a9474

+ 3 - 3
code/sapparent/sapcms/src/main/java/org/fouram/controller/ApiController.java

@@ -111,7 +111,7 @@ public class ApiController extends BaseController {
 			Map<String, Object> result = Maps.newHashMap();
 			result.put("departInfo", sapOrg);
 			result.put("departList", sapOrgService.selectListByParentId(departId));
-			result.put("userList", sapUserService.selectListByDepartIdAndLevel(departId));
+			result.put("userList", sapUserService.selectPrimaryListByDepartIdAndLevel(departId));
 			return AppUtil.success(result, null);
 		} catch (Exception e) {
 			LoggerUtil.error(e);
@@ -134,7 +134,7 @@ public class ApiController extends BaseController {
 			String name = getPageData().getString("name");
 			Map<String, Object> result = Maps.newHashMap();
 			result.put("departList", sapOrgService.selectListByName(name));
-			result.put("userList", sapUserService.selectListByName(name));
+			result.put("userList", sapUserService.selectPrimaryListByName(name));
 			return AppUtil.success(result, null);
 		} catch (Exception e) {
 			LoggerUtil.error(e);
@@ -174,7 +174,7 @@ public class ApiController extends BaseController {
 			return AppUtil.error(ResultConstant.NO_TOKEN, ResultConstant.TOKEN_ERR_MSG);
 		}
 		try {
-			return AppUtil.success(sapUserService.selectListByDelFlag(DelFlagEnum.UNABLE.getCode()), null);
+			return AppUtil.success(sapUserService.selectPrimaryListByDelFlag(DelFlagEnum.UNABLE.getCode()), null);
 		} catch (Exception e) {
 			LoggerUtil.error(e);
 			return AppUtil.error(ResultConstant.WEB_ERR_MSG);

+ 1 - 1
code/sapparent/sapservice/src/main/java/org/fouram/entity/SapUser.java

@@ -78,7 +78,7 @@ public class SapUser implements Serializable {
 	@Override
 	public String toString() {
 		StringBuilder sBuilder = new StringBuilder();
-		sBuilder.append(userId).append(personId).append(username).append(name).append(firstOrgName).append(firstOrgId)
+		sBuilder.append(userId).append(personId).append(name).append(firstOrgName).append(firstOrgId)
 				.append(secondOrgName).append(secondOrgId).append(thirdOrgName).append(thirdOrgId).append(fourthOrgName)
 				.append(fourthOrgId).append(position).append(mobile).append(businessPhone).append(gender).append(email)
 				.append(isPrimary);

+ 4 - 4
code/sapparent/sapservice/src/main/java/org/fouram/mapper/SapUserMapper.xml

@@ -62,25 +62,25 @@
 		select * from sap_user where (result != '垃圾数据' or result is null) and delFlag = 0
 	</select>
 	
-	<select id="selectListByName" resultType="SapUser">
+	<select id="selectPrimaryListByName" resultType="SapUser">
 		select * from sap_user 
 		where result = 'SUCCESS' and isPrimary = 1 and delFlag = 0 and name like CONCAT(CONCAT('%', #{name}),'%')
 		order by sortNumber ASC
 	</select>
 	
-	<select id="selectListByResult" resultType="SapUser">
+	<select id="selectPrimaryListByResult" resultType="SapUser">
 		select * from sap_user 
 		where result = #{result} and isPrimary = 1 and delFlag = 0 
 		order by sortNumber ASC
 	</select>
 	
-	<select id="selectListByDelFlag" resultType="SapUser">
+	<select id="selectPrimaryListByDelFlag" resultType="SapUser">
 		select * from sap_user 
 		where isPrimary = 1 and delFlag = #{delFlag} 
 		order by sortNumber ASC
 	</select>
 	
-	<select id="selectListByDepartIdAndLevel" resultType="SapUser">
+	<select id="selectPrimaryListByDepartIdAndLevel" resultType="SapUser">
 		select * from sap_user 
 		where result = 'SUCCESS' and isPrimary = 1 and delFlag = 0 
 		<if test="level == 1">

+ 16 - 15
code/sapparent/sapservice/src/main/java/org/fouram/service/SapUserService.java

@@ -108,7 +108,7 @@ public class SapUserService extends BaseService {
 	 * @throws Exception
 	 */
 	public void updateAbnormalResult() throws Exception {
-		List<SapUser> normalList = selectListByResult(SapUserResultEnum.NORMAL.getCode());
+		List<SapUser> normalList = selectPrimaryListByResult(SapUserResultEnum.NORMAL.getCode());
 		SapUserResultEnum resultEnum = null;
 		for (SapUser sapUser : normalList) {
 			resultEnum = checkSensitiveOrEntryData(sapUser);
@@ -150,8 +150,8 @@ public class SapUserService extends BaseService {
 
 	private String createOrUpdateWXUser(String personId) throws Exception {
 		List<SapUser> sapUsers = selectListByPersonId(personId);
-		SapUser wxSapUser = sapUsers.get(0);
-		String mobile = wxSapUser.getFormatBusinessPhone();
+		SapUser primarySapUser = sapUsers.get(0);
+		String mobile = primarySapUser.getFormatBusinessPhone();
 		// 测试企业微信,手机号码脱敏
 		// fouram wxCp.corpId = ww51602aeb8dab7a95
 		// prod wxCp.corpId = ww911e29458d3a46fd
@@ -177,9 +177,10 @@ public class SapUserService extends BaseService {
 			thirdWxDepartIdList[i] = sapUser.getThirdWxDepartId();
 			fourthWxDepartIdList[i] = sapUser.getFourthWxDepartId();
 		}
-		return WXCpUserUtil.createOrUpdate(personId, wxSapUser.getName(), firstWxDepartIdList, secondWxDepartIdList,
-				thirdWxDepartIdList, fourthWxDepartIdList, wxSapUser.getFormatPosition(), wxSapUser.getFormatMobile(),
-				wxSapUser.getGender(), wxSapUser.getUsername(), mobile, wxSapUser.getFirstOrgName());
+		return WXCpUserUtil.createOrUpdate(personId, primarySapUser.getName(), firstWxDepartIdList,
+				secondWxDepartIdList, thirdWxDepartIdList, fourthWxDepartIdList, primarySapUser.getFormatPosition(),
+				primarySapUser.getFormatMobile(), primarySapUser.getGender(), primarySapUser.getUsername(), mobile,
+				primarySapUser.getFirstOrgName());
 	}
 
 	/**
@@ -230,22 +231,22 @@ public class SapUserService extends BaseService {
 	}
 
 	@SuppressWarnings("unchecked")
-	public List<SapUser> selectListByName(String name) throws Exception {
-		return (List<SapUser>) findList("SapUserMapper.selectListByName", name);
+	public List<SapUser> selectPrimaryListByName(String name) throws Exception {
+		return (List<SapUser>) findList("SapUserMapper.selectPrimaryListByName", name);
 	}
 
 	@SuppressWarnings("unchecked")
-	public List<SapUser> selectListByResult(String result) throws Exception {
-		return (List<SapUser>) findList("SapUserMapper.selectListByResult", result);
+	public List<SapUser> selectPrimaryListByResult(String result) throws Exception {
+		return (List<SapUser>) findList("SapUserMapper.selectPrimaryListByResult", result);
 	}
 
 	@SuppressWarnings("unchecked")
-	public List<SapUser> selectListByDelFlag(Integer delFlag) throws Exception {
-		return (List<SapUser>) findList("SapUserMapper.selectListByDelFlag", delFlag);
+	public List<SapUser> selectPrimaryListByDelFlag(Integer delFlag) throws Exception {
+		return (List<SapUser>) findList("SapUserMapper.selectPrimaryListByDelFlag", delFlag);
 	}
 
 	@SuppressWarnings("unchecked")
-	public List<SapUser> selectListByDepartIdAndLevel(String departId) throws Exception {
+	public List<SapUser> selectPrimaryListByDepartIdAndLevel(String departId) throws Exception {
 		SapOrg sapOrg = sapOrgService.selectById(departId);
 		if (StringUtils.isBlank(departId) || WebConstants.TOP_DEPART.toString().equals(departId)) {
 			departId = WebConstants.TOP_DEPART.toString();
@@ -255,7 +256,7 @@ public class SapUserService extends BaseService {
 		PageData pd = new PageData();
 		pd.put("departId", departId);
 		pd.put("level", sapOrg.getLevel());
-		return (List<SapUser>) findList("SapUserMapper.selectListByDepartIdAndLevel", pd);
+		return (List<SapUser>) findList("SapUserMapper.selectPrimaryListByDepartIdAndLevel", pd);
 	}
 
 	public SapUser toInfoDetail(SapUser sapUser) throws Exception {
@@ -298,7 +299,7 @@ public class SapUserService extends BaseService {
 
 	// 更新用户头像
 	public void updateAvatars() throws Exception {
-		List<SapUser> successUsers = selectListByResult(SapUserResultEnum.SUCCESS.getCode());
+		List<SapUser> successUsers = selectPrimaryListByResult(SapUserResultEnum.SUCCESS.getCode());
 		for (SapUser sapUser : successUsers) {
 			WxCpUser user = WXCpUserUtil.getByIdOrEmail(sapUser.getPersonId(), sapUser.getEmail());
 			if (user != null && StringUtils.isNotBlank(user.getAvatar())) {