8 changed files with 113 additions and 5 deletions
@ -1,25 +1,67 @@ |
|||
package com.hxgk.zxxy.service.impl; |
|||
|
|||
import com.hxgk.zxxy.mapper.ArchivesTypeMapper; |
|||
import com.hxgk.zxxy.mapper.GraphicformMapper; |
|||
import com.hxgk.zxxy.model.entity.ArchivesType; |
|||
import com.hxgk.zxxy.model.entity.UserDetail; |
|||
import com.hxgk.zxxy.service.ArchivesTypeService; |
|||
import com.hxgk.zxxy.service.HrService; |
|||
import com.hxgk.zxxy.service.UserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Iterator; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class ArchivesTypeServiceImpl implements ArchivesTypeService { |
|||
@Autowired |
|||
private ArchivesTypeMapper archivesTypeMapper; |
|||
@Autowired |
|||
private UserService userService; |
|||
@Autowired |
|||
private HrService hrService; |
|||
@Autowired |
|||
private GraphicformMapper graphicformMapper; |
|||
|
|||
|
|||
/** |
|||
* 根据atParentId获取知行学院的navi列表 |
|||
* |
|||
* @param atParentId |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<ArchivesType> getZxxyArchivesType(long atParentId) { |
|||
return archivesTypeMapper.getZxxyArchivesType(atParentId); |
|||
public List<ArchivesType> getZxxyArchivesType(long atParentId, String userkey, String usertoken) { |
|||
String atParentIdStr = Long.toString(atParentId); |
|||
Map<String, String> userInfo = new HashMap<>(); |
|||
userInfo.put("userkey", userkey); |
|||
userInfo.put("usertoken", usertoken); |
|||
UserDetail userDetail = userService.getUserDetailFromRedis(userInfo); |
|||
//去Hr中查询分厂(部门)和工段,工段可能是list(如果该用户层级较高,则拥有多个工段的权限.)当该用户层级低时,需向上查询他的上级机构码
|
|||
List<Long> gBfIdList = hrService.queryGBfId(userDetail.getAdminorg()); |
|||
//工段(list)
|
|||
List<Long> gWsIdList = null; |
|||
try { |
|||
gWsIdList = hrService.queryGWsId(userDetail.getAdminorg()); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
List<ArchivesType> list = archivesTypeMapper.getZxxyArchivesType(atParentId); |
|||
Iterator<ArchivesType> iterator = list.iterator(); |
|||
while (iterator.hasNext()) { |
|||
ArchivesType a = iterator.next(); |
|||
int count = graphicformMapper |
|||
.queryCountByParam(atParentIdStr, a.getAtId(), gBfIdList, gWsIdList, userDetail.getWmKey()); |
|||
if (count > 0) { |
|||
a.setHasCard(true); |
|||
} else { |
|||
a.setHasCard(false); |
|||
iterator.remove();//使用迭代器的删除方法删除
|
|||
} |
|||
} |
|||
return list; |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue