|
@@ -1,11 +1,16 @@
|
|
|
package com.qmth.sop.server.api;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
-import com.qmth.sop.common.annotation.OperationLog;
|
|
|
import com.qmth.sop.business.bean.params.DeviceInOutSubmitParam;
|
|
|
import com.qmth.sop.business.bean.result.DeviceInOutResult;
|
|
|
+import com.qmth.sop.business.bean.result.SearchResult;
|
|
|
+import com.qmth.sop.business.entity.SysUser;
|
|
|
+import com.qmth.sop.business.entity.TBDeviceInOut;
|
|
|
+import com.qmth.sop.business.service.SysUserService;
|
|
|
import com.qmth.sop.business.service.TBDeviceInOutService;
|
|
|
+import com.qmth.sop.common.annotation.OperationLog;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.DeviceStatusEnum;
|
|
|
import com.qmth.sop.common.enums.DeviceUsageTypeEnum;
|
|
@@ -13,6 +18,7 @@ import com.qmth.sop.common.enums.LogTypeEnum;
|
|
|
import com.qmth.sop.common.util.Result;
|
|
|
import com.qmth.sop.common.util.ResultUtil;
|
|
|
import io.swagger.annotations.*;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -20,6 +26,10 @@ import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.Max;
|
|
|
import javax.validation.constraints.Min;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -35,6 +45,8 @@ import javax.validation.constraints.Min;
|
|
|
public class TBDeviceInOutController {
|
|
|
@Resource
|
|
|
private TBDeviceInOutService tbDeviceInOutService;
|
|
|
+ @Resource
|
|
|
+ private SysUserService sysUserService;
|
|
|
|
|
|
@ApiOperation(value = "sop管理 - 设备出入库登记查询")
|
|
|
@RequestMapping(value = "/sop_page", method = RequestMethod.POST)
|
|
@@ -106,4 +118,33 @@ public class TBDeviceInOutController {
|
|
|
usageType, SystemConstant.convertIdToLong(userId), deviceStatus, inOutTimeStart, inOutTimeEnd, deviceNo, customName, location, address, serialNo,
|
|
|
pageNumber, pageSize));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "资源保障-设备保障-出入库登记查询-查询登记人列表")
|
|
|
+ @RequestMapping(value = "/registrant_list", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = SearchResult.class)})
|
|
|
+ public Result findDeviceInOutPageBySource() {
|
|
|
+ List<SearchResult> resultList = new ArrayList<>();
|
|
|
+ List<Long> userIdList = tbDeviceInOutService.list(new QueryWrapper<TBDeviceInOut>()
|
|
|
+ .lambda()
|
|
|
+ .select(TBDeviceInOut::getUserId))
|
|
|
+ .stream()
|
|
|
+ .map(TBDeviceInOut::getUserId)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(userIdList)) {
|
|
|
+ resultList = sysUserService.list(new QueryWrapper<SysUser>()
|
|
|
+ .lambda()
|
|
|
+ .select(SysUser::getId, SysUser::getRealName)
|
|
|
+ .in(SysUser::getId, userIdList))
|
|
|
+ .stream()
|
|
|
+ .flatMap(e -> {
|
|
|
+ SearchResult searchResult = new SearchResult();
|
|
|
+ searchResult.setId(e.getId());
|
|
|
+ searchResult.setValue(e.getRealName());
|
|
|
+ return Stream.of(searchResult);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(resultList);
|
|
|
+ }
|
|
|
}
|