提交 fe30d6e5 authored 作者: 133's avatar 133

Merge branch 'master' of git.yfzx.zjtys.com.cn:matrix/device-back into dev

package com.tykj.dev.device.library.subject.vo; package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.misc.base.CustomPage;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -16,10 +17,7 @@ import java.util.List; ...@@ -16,10 +17,7 @@ import java.util.List;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class DeviceSelectIdsVo { public class DeviceSelectIdsVo extends CustomPage {
private Integer page;
private Integer size;
private List<Integer> ids; private List<Integer> ids;
} }
...@@ -8,10 +8,15 @@ package com.tykj.dev.statistical.controller; ...@@ -8,10 +8,15 @@ package com.tykj.dev.statistical.controller;
* @createTime 2020年10月16日 14:53:00 * @createTime 2020年10月16日 14:53:00
*/ */
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.util.ArrayUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.*; import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.DeviceModelSort; import com.tykj.dev.misc.utils.DeviceModelSort;
import com.tykj.dev.misc.utils.PageUtil; import com.tykj.dev.misc.utils.PageUtil;
...@@ -22,9 +27,11 @@ import com.tykj.dev.statistical.vo.DeviceStatistics; ...@@ -22,9 +27,11 @@ import com.tykj.dev.statistical.vo.DeviceStatistics;
import com.tykj.dev.statistical.vo.ScrappedDestroyedRetiredVo; import com.tykj.dev.statistical.vo.ScrappedDestroyedRetiredVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.hibernate.mapping.Array;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -51,6 +58,9 @@ public class StatisticalController { ...@@ -51,6 +58,9 @@ public class StatisticalController {
@Autowired @Autowired
private DeviceLibraryService deviceLibraryService; private DeviceLibraryService deviceLibraryService;
@Autowired
DeviceLibraryDao deviceLibraryDao;
// @Autowired // @Autowired
// private ConfigCache configCache; // private ConfigCache configCache;
...@@ -248,19 +258,22 @@ public class StatisticalController { ...@@ -248,19 +258,22 @@ public class StatisticalController {
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情") @ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
@PostMapping("/selectByIds2") @PostMapping("/selectByIds2")
public List<DeviceLibrary> selectByIds2(@RequestBody DeviceSelectIdsVo deviceSelectIdsVo){ public ResponseEntity selectByIds2(@RequestBody DeviceSelectIdsVo deviceSelectIdsVo){
Page<DeviceLibrary> byIds = deviceLibraryDao.findAll(getFindRetiredSpecification(deviceSelectIdsVo),deviceSelectIdsVo.getPageable()).map(DeviceLibrary::setConfigName);
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds());
byIds.forEach(DeviceLibrary::setConfigName); return ResponseEntity.ok(byIds);
// List<ScrappedVos> scrappedVosArrayList = new ArrayList<>(); }
ScrappedVos scrappedVos = new ScrappedVos();
// byIds.forEach(
// deviceLibrary -> { private Specification<DeviceLibrary> getFindRetiredSpecification(DeviceSelectIdsVo deviceSelectIdsVo) {
// BeanUtils.copyProperties(deviceLibrary,scrappedVos); PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
// scrappedVosArrayList.add(scrappedVos); // List<Integer> leftStatus=new ArrayList<>();
// } // leftStatus.add(com.tykj.dev.config.base.DeviceLifeStatus.RETIRED.id);
// ); if (deviceSelectIdsVo.getIds()!= null&&deviceSelectIdsVo.getIds().size()!=0) {
return byIds; predicateBuilder.in("id",deviceSelectIdsVo.getIds().toArray());
}
return predicateBuilder.build();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论