|
|
@@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.pms.service.qhse.danger;
|
|
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.danger.vo.IotDangerSourcePageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.danger.vo.IotDangerSourceSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.stat.DeptUtil;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.danger.IotDangerSourceDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.qhse.danger.IotDangerSourceMapper;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
@@ -13,7 +15,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-
|
|
|
import java.util.HashSet;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
@@ -33,6 +34,8 @@ public class IotDangerSourceServiceImpl implements IotDangerSourceService {
|
|
|
private IotDangerSourceMapper iotDangerSourceMapper;
|
|
|
@Autowired
|
|
|
private DeptService deptService;
|
|
|
+ @Autowired
|
|
|
+ private DeptUtil deptUtil;
|
|
|
|
|
|
@Override
|
|
|
public Long createIotDangerSource(IotDangerSourceSaveReqVO createReqVO) {
|
|
|
@@ -74,10 +77,20 @@ public class IotDangerSourceServiceImpl implements IotDangerSourceService {
|
|
|
|
|
|
@Override
|
|
|
public PageResult<IotDangerSourceDO> getIotDangerSourcePage(IotDangerSourcePageReqVO pageReqVO) {
|
|
|
+ Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
+ String companyCode = deptUtil.getCompanyCode(loginUserDeptId);
|
|
|
Set<Long> ids = new HashSet<>();
|
|
|
- if (Objects.nonNull(pageReqVO.getDeptId())) {
|
|
|
- ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
- ids.add(pageReqVO.getDeptId());
|
|
|
+ if ("rh".equals(companyCode)) {
|
|
|
+ ids.add(157L);
|
|
|
+ } else if ("ry".equals(companyCode)) {
|
|
|
+ ids.add(158L);
|
|
|
+ } else if ("rd".equals(companyCode)) {
|
|
|
+ ids.add(163L);
|
|
|
+ } else {
|
|
|
+ if (Objects.nonNull(pageReqVO.getDeptId())) {
|
|
|
+ ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
+ ids.add(pageReqVO.getDeptId());
|
|
|
+ }
|
|
|
}
|
|
|
return iotDangerSourceMapper.selectPage(pageReqVO, ids);
|
|
|
}
|