大屏接口
This commit is contained in:
parent
4351f6b57f
commit
f7d597edce
|
|
@ -1,18 +1,15 @@
|
||||||
package com.bonus.screen.controller;
|
package com.bonus.screen.controller;
|
||||||
|
|
||||||
import com.bonus.base.config.ProjectTypeEnum;
|
|
||||||
import com.bonus.base.service.TbUserPostService;
|
import com.bonus.base.service.TbUserPostService;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.screen.domain.ScreenDeskConfig;
|
||||||
|
import com.bonus.screen.service.ScreenDeskConfigService;
|
||||||
import com.bonus.screen.service.impl.ProjectViewServiceImpl;
|
import com.bonus.screen.service.impl.ProjectViewServiceImpl;
|
||||||
import com.bonus.screen.vo.DeviceWarnRecordVo;
|
import com.bonus.screen.vo.DeviceWarnRecordVo;
|
||||||
import com.bonus.screen.vo.ProjectViewVo;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -32,6 +29,19 @@ public class ProjectViewController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private TbUserPostService tbUserPostService;
|
private TbUserPostService tbUserPostService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScreenDeskConfigService screenDeskConfigService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getDeskConfigList")
|
||||||
|
public AjaxResult getDeskConfigList() {
|
||||||
|
return success(screenDeskConfigService.getAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/setDeskConfig")
|
||||||
|
public AjaxResult setDeskConfig(@RequestBody List<ScreenDeskConfig> list) {
|
||||||
|
return success(screenDeskConfigService.insertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/getProjectModelData")
|
@GetMapping("/getProjectModelData")
|
||||||
public AjaxResult getProjectModelData() {
|
public AjaxResult getProjectModelData() {
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ import com.bonus.base.mapper.TbTeamMapper;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.screen.mapper.TbDeviceDataRecord;
|
import com.bonus.screen.mapper.TbDeviceDataRecord;
|
||||||
import com.bonus.screen.vo.*;
|
import com.bonus.screen.vo.*;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,22 +108,35 @@ public class ProjectViewServiceImpl {
|
||||||
|
|
||||||
public AjaxResult getTeamJoinPersonListByProId(Integer proId){
|
public AjaxResult getTeamJoinPersonListByProId(Integer proId){
|
||||||
List<TeamJoinPersonVo> teamPersonList = tbTeamMapper.getTeamJoinPersonListByProId(proId);
|
List<TeamJoinPersonVo> teamPersonList = tbTeamMapper.getTeamJoinPersonListByProId(proId);
|
||||||
|
List<TeamJoinPersonVo> teamList = new ArrayList<>();
|
||||||
|
|
||||||
// 定义去重集合
|
for (TeamJoinPersonVo teamJoinPersonVo : teamPersonList) {
|
||||||
Map<Integer, List<TeamJoinPersonVo>> teamMap = new HashMap<>();
|
// 查找是否已有此班组
|
||||||
|
TeamJoinPersonVo isExist = findTeamById(teamList, teamJoinPersonVo.getTeamId());
|
||||||
// 循环,把数据分组
|
// NEW一个 TeamJoinPersonVo 对象
|
||||||
for (TeamJoinPersonVo vo : teamPersonList) {
|
TeamJoinPersonVo thisVo = new TeamJoinPersonVo();
|
||||||
// 判断是否已存在
|
// 没有则覆盖
|
||||||
if (teamMap.containsKey(vo.getTeamId())) {
|
if (isExist == null) {
|
||||||
teamMap.get(vo.getTeamId()).add(vo);
|
thisVo.setTeamId(teamJoinPersonVo.getTeamId());
|
||||||
|
thisVo.setTeamName(teamJoinPersonVo.getTeamName());
|
||||||
|
thisVo.getPeopleList().add(teamJoinPersonVo);
|
||||||
|
teamList.add(thisVo);
|
||||||
} else {
|
} else {
|
||||||
List<TeamJoinPersonVo> list = new java.util.ArrayList<>();
|
// 有的话找到对应的对象并添加进去
|
||||||
list.add(vo);
|
isExist.getPeopleList().add(teamJoinPersonVo);
|
||||||
teamMap.put(vo.getTeamId(), list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return AjaxResult.success(teamMap);
|
return AjaxResult.success(teamList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static TeamJoinPersonVo findTeamById(List<TeamJoinPersonVo> teams, int teamId) {
|
||||||
|
for (TeamJoinPersonVo team : teams) {
|
||||||
|
if (team.getTeamId() == teamId) {
|
||||||
|
return team;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null; // 如果未找到,返回 null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ package com.bonus.screen.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : 阮世耀
|
* @author : 阮世耀
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
|
|
@ -22,4 +25,6 @@ public class TeamJoinPersonVo {
|
||||||
|
|
||||||
private String peoplePhone;
|
private String peoplePhone;
|
||||||
|
|
||||||
|
private List<TeamJoinPersonVo> peopleList = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue