|
@@ -11,6 +11,7 @@ import org.fouram.core.base.service.RequestService;
|
|
|
import org.fouram.core.plugin.weixin.cp.util.WXCpUserUtil;
|
|
|
import org.fouram.core.util.Base64Util;
|
|
|
import org.fouram.core.util.Tools;
|
|
|
+import org.fouram.entity.SapOrg;
|
|
|
import org.fouram.entity.SapUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
@@ -158,8 +159,8 @@ public class SapUserService extends BaseService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public SapUser selectOne(String userId) throws Exception {
|
|
|
- return (SapUser) findObject("SapUserMapper.selectOne", userId);
|
|
|
+ public SapUser selectByUserId(String userId) throws Exception {
|
|
|
+ return (SapUser) findObject("SapUserMapper.selectByUserId", userId);
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
@@ -198,14 +199,41 @@ public class SapUserService extends BaseService {
|
|
|
return (List<SapUser>) findList("SapUserMapper.selectListByDepartId", departId);
|
|
|
}
|
|
|
|
|
|
- public SapUser toInfoDetail(SapUser sapUser) {
|
|
|
+ public SapUser toInfoDetail(SapUser sapUser) throws Exception {
|
|
|
+ if(sapUser != null) {
|
|
|
+ List<SapUser> users = selectListByPersonId(sapUser.getPersonId());
|
|
|
+ List<List<SapOrg>> departList = Lists.newArrayList();
|
|
|
+ for (int i = 0; i < users.size(); i++) {
|
|
|
+ SapUser user = users.get(i);
|
|
|
+ List<SapOrg> orgs = Lists.newArrayList();
|
|
|
+ if (Tools.notEmpty(user.getFirstOrgId())) {
|
|
|
+ orgs.add(sapOrgService.selectById(user.getFirstOrgId()));
|
|
|
+ }
|
|
|
+ if (Tools.notEmpty(user.getSecondOrgId())) {
|
|
|
+ orgs.add(sapOrgService.selectById(user.getSecondOrgId()));
|
|
|
+ }
|
|
|
+ if (Tools.notEmpty(user.getThirdOrgId())) {
|
|
|
+ orgs.add(sapOrgService.selectById(user.getThirdOrgId()));
|
|
|
+ }
|
|
|
+ if (Tools.notEmpty(user.getFourthOrgId())) {
|
|
|
+ orgs.add(sapOrgService.selectById(user.getFourthOrgId()));
|
|
|
+ }
|
|
|
+ departList.add(orgs);
|
|
|
+ }
|
|
|
+ sapUser.setDepartList(departList);
|
|
|
+ }
|
|
|
return sapUser;
|
|
|
}
|
|
|
|
|
|
- public List<SapUser> toInfoDetails(List<SapUser> sapUsers) {
|
|
|
+ public List<SapUser> toInfoDetails(List<SapUser> sapUsers) throws Exception {
|
|
|
for (SapUser sapUser : sapUsers) {
|
|
|
toInfoDetail(sapUser);
|
|
|
}
|
|
|
return sapUsers;
|
|
|
}
|
|
|
+
|
|
|
+ public SapUser getDetailById(String userId) throws Exception {
|
|
|
+ SapUser sapUser = selectByUserId(userId);
|
|
|
+ return toInfoDetail(sapUser);
|
|
|
+ }
|
|
|
}
|