|
@@ -1,22 +1,33 @@
|
|
|
package com.fdkankan.fusion.controller;
|
|
|
|
|
|
+import com.fdkankan.fusion.common.PageInfo;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
|
+import com.fdkankan.fusion.entity.Model;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.request.ScenePram;
|
|
|
+import com.fdkankan.fusion.response.SceneVo;
|
|
|
+import com.fdkankan.fusion.service.IModelService;
|
|
|
import com.fdkankan.fusion.service.ISceneService;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping("/api/scene")
|
|
|
public class SceneApiController extends BaseController{
|
|
|
|
|
|
@Autowired
|
|
|
ISceneService sceneService;
|
|
|
+ @Autowired
|
|
|
+ IModelService modelService;
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
public ResultData list(@RequestBody ScenePram param){
|
|
@@ -26,6 +37,24 @@ public class SceneApiController extends BaseController{
|
|
|
param.setPageNum(1);
|
|
|
param.setPageSize(10000);
|
|
|
param.setStatus(2);
|
|
|
- return ResultData.ok(sceneService.pageList(param,getToken()));
|
|
|
+ PageInfo pageInfo = sceneService.pageList(param, getToken());
|
|
|
+ List<SceneVo> listAll = (List<SceneVo>) pageInfo.getList();
|
|
|
+ if(listAll.size() >0){
|
|
|
+ List<String> numList = listAll.parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
|
|
|
+ //设置模型
|
|
|
+ List<Model> modelList = modelService.getListByNum(numList);
|
|
|
+ HashMap<String,Model> map = new HashMap<>();
|
|
|
+ modelList.forEach(entity-> map.put(entity.getNum(),entity));
|
|
|
+ for (SceneVo sceneVo : listAll) {
|
|
|
+ String createTime = sceneVo.getCreateTime();
|
|
|
+ Model model = map.get(sceneVo.getNum());
|
|
|
+ if(model == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(model,sceneVo);
|
|
|
+ sceneVo.setCreateTime(createTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultData.ok();
|
|
|
}
|
|
|
}
|