|
|
@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
@@ -51,14 +52,18 @@ public class QueryAccidentCardListService { |
|
|
|
|
|
|
|
public JsonResult getList(QueryAccidentCardListRequest request) { |
|
|
|
// log.info("进入查询事件列表业务"); |
|
|
|
String tenantId = CurrentUserUtil.getTenantId(); |
|
|
|
request.setTenantId(tenantId); |
|
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
|
String tenantId = user.getTenantId(); |
|
|
|
|
|
|
|
JsonResult result = this.check(tenantId, request); |
|
|
|
if (0 != result.getCode()) { |
|
|
|
log.info("进入查询事故卡片列表业务:校验失败:{}", result.getMsg()); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
List<String> deptIdList = this.getDeptIdList(user); |
|
|
|
request.setDeptIdList(deptIdList); |
|
|
|
request.setTenantId(tenantId); |
|
|
|
List<Accident> accidentList = accidentMapper.selectAccidentCardList(request); |
|
|
|
|
|
|
|
// 构造返回结果对象 |
|
|
@@ -78,6 +83,24 @@ public class QueryAccidentCardListService { |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据用户自己的数据权限,查询对应部门的数据 |
|
|
|
* |
|
|
|
* @param user |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<String> getDeptIdList(User user) { |
|
|
|
List<String> deptIdList = new ArrayList<>(); |
|
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { |
|
|
|
return null; |
|
|
|
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { |
|
|
|
deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); |
|
|
|
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
|
deptIdList.add(user.getDeptId()); |
|
|
|
} |
|
|
|
return deptIdList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param accidentList |
|
|
|
* @return |