|
@@ -6,18 +6,18 @@ import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.sunxung.factoring.component.exception.ServiceException;
|
|
|
import com.sunxung.factoring.component.exception.ValidatorException;
|
|
|
-import com.sunxung.factoring.component.util.BeanUtilsProxy;
|
|
|
-import com.sunxung.factoring.component.util.ThreadLocalUtil;
|
|
|
+import com.sunxung.factoring.component.util.*;
|
|
|
import com.sunxung.factoring.entity.CommonVO;
|
|
|
import com.sunxung.factoring.entity.GridPage;
|
|
|
-import com.sunxung.factoring.entity.sys.ClientUserDO;
|
|
|
-import com.sunxung.factoring.entity.sys.User;
|
|
|
+import com.sunxung.factoring.entity.sys.*;
|
|
|
import com.sunxung.factoring.entity.sys.request.ClientUserQueryRequest;
|
|
|
import com.sunxung.factoring.entity.sys.request.DistributePMRequest;
|
|
|
import com.sunxung.factoring.entity.sys.request.DistributeRMRequest;
|
|
|
import com.sunxung.factoring.entity.sys.vo.ClientUserVO;
|
|
|
import com.sunxung.factoring.mapper.sys.ClientUserMapper;
|
|
|
import com.sunxung.factoring.service.sys.ClientUserService;
|
|
|
+import com.sunxung.factoring.service.sys.OrgService;
|
|
|
+import com.sunxung.factoring.service.sys.PermissionService;
|
|
|
import com.sunxung.factoring.service.sys.UserService;
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -31,6 +31,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@Service
|
|
@@ -41,9 +42,59 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OrgService orgService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PermissionService permissionService;
|
|
|
+
|
|
|
@Override
|
|
|
public GridPage<ClientUserVO> pageList(ClientUserQueryRequest clientUserQueryRequest) {
|
|
|
|
|
|
+ List<Role> roles = ThreadLocalUtil.getUser().getRoles();
|
|
|
+ Long userId = ThreadLocalUtil.getUserId();
|
|
|
+ clientUserQueryRequest.setCurrentUserId(userId);
|
|
|
+ String roleType = null;
|
|
|
+ List<Long> orgIds = Lists.newArrayList();
|
|
|
+ List<Long> userIds= Lists.newArrayList();
|
|
|
+ orgIds.add(-1L);
|
|
|
+ userIds.add(-1L);
|
|
|
+
|
|
|
+ Permission per = permissionService.getByEname(ConstantConversionUtil.VIEW_ALL_CLIENT_USER);
|
|
|
+ List<Long> pers = permissionService.getPermissionIdByUserId(ThreadLocalUtil.getUserId());
|
|
|
+ boolean showAllData = false;
|
|
|
+ if (pers.contains(per.getId())
|
|
|
+ || ThreadLocalUtil.getUser().getLoginName().equals(ConstantConversionUtil.ADMINISTORIES)) {
|
|
|
+ showAllData = true;
|
|
|
+ }
|
|
|
+ if(!showAllData){
|
|
|
+ //如果不是查看全员 则需要判断用户的角色
|
|
|
+ List<UserOrgRel> userOrgRelList = userService.findOrgRelByUserId(userId);
|
|
|
+ for (UserOrgRel userOrgRel : userOrgRelList) {
|
|
|
+ if (userOrgRel.isUserIdentity()) {
|
|
|
+ roleType = "projectCapital";
|
|
|
+ orgIds.add(userOrgRel.getOrgId());
|
|
|
+ // 如果是部门负责人,获取部门下所有人员Id
|
|
|
+ List<Long> userIdList = userService.findUserIdByOrgId(userOrgRel.getOrgId());
|
|
|
+ userIds.addAll(userIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtil.isEmpty(roleType)){
|
|
|
+ for(Role role:roles){
|
|
|
+ if(role.getName().equals("业务经理")){
|
|
|
+ roleType = "projectManager";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(role.getName().equals("风控经理")){
|
|
|
+ roleType = "riskManager";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ clientUserQueryRequest.setRoleType(roleType);
|
|
|
+ clientUserQueryRequest.setUserIds(userIds);
|
|
|
+ clientUserQueryRequest.setOrgIds(orgIds);
|
|
|
+ }
|
|
|
Page<Object> objects = PageHelper.startPage(clientUserQueryRequest.getPage(),
|
|
|
clientUserQueryRequest.getRows());
|
|
|
List<ClientUserVO> clientUserVOS = this.baseMapper.pageList(clientUserQueryRequest);
|
|
@@ -139,7 +190,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
|
|
|
@Override
|
|
|
public List<CommonVO> getPMs(Long clientUserId) {
|
|
|
if(clientUserId==null){
|
|
|
- List<User> userByRoleId = userService.findUserByRoleId(17L);
|
|
|
+ List<User> userByRoleId = userService.findUserByRoleName("业务经理");
|
|
|
List<CommonVO> commonVOs = BeanUtilsProxy.copyPropertiesList(userByRoleId, CommonVO.class);
|
|
|
return commonVOs;
|
|
|
}
|
|
@@ -153,7 +204,7 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
|
|
|
if(orgId!=null){
|
|
|
userIdByOrgId = userService.findUserIdByOrgId(orgId);
|
|
|
}
|
|
|
- List<User> userByRoleId = userService.findUserByRoleId(17L);
|
|
|
+ List<User> userByRoleId = userService.findUserByRoleName("业务经理");
|
|
|
if(!CollectionUtils.isEmpty(userIdByOrgId)){
|
|
|
for(User u:userByRoleId){
|
|
|
if(userIdByOrgId.indexOf(u.getId())<0){
|
|
@@ -187,10 +238,13 @@ public class ClientUserServiceImpl extends ServiceImpl<ClientUserMapper, ClientU
|
|
|
List<Long> list1 = com.google.common.collect.Lists.newArrayList(896L,914L,144L,1037L,1279L,1402L,1175L);
|
|
|
List<Long> list2 = com.google.common.collect.Lists.newArrayList(2066L,2285L,2425L,2850L,2747L,1787L,1916L);
|
|
|
|
|
|
- Long xayyzx = 2L; //西安运营中心
|
|
|
- Long zcglzx = 8L; //资产管理中心
|
|
|
- Long shyyzx = 3L; //上海运营中心
|
|
|
- Long szyyzx = 14L; //深圳运营中心
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Long xayyzx = orgService.findByName("西安运营中心").getId(); //西安运营中心
|
|
|
+ Long zcglzx = orgService.findByName("资产管理中心").getId(); //资产管理中心
|
|
|
+ Long shyyzx = orgService.findByName("上海运营中心").getId(); //上海运营中心
|
|
|
+ Long szyyzx = orgService.findByName("深圳运营中心").getId();; //深圳运营中心
|
|
|
|
|
|
List<ClientUserDO> userList = new ArrayList<>();
|
|
|
List<ClientUserDO> userList1 = new ArrayList<>();
|