Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2
This commit is contained in:
commit
a1ca799520
@ -67,6 +67,7 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
whiteList.add("/api/mapFunction/oldDataHandle");
|
whiteList.add("/api/mapFunction/oldDataHandle");
|
||||||
whiteList.add("/api/v2/paper/composition/oldData/handle");
|
whiteList.add("/api/v2/paper/composition/oldData/handle");
|
||||||
whiteList.add("/api/user/sync");
|
whiteList.add("/api/user/sync");
|
||||||
|
whiteList.add("/dataHandle");
|
||||||
|
|
||||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
package club.joylink.rtss.controller;
|
||||||
|
|
||||||
|
import club.joylink.rtss.controller.org.OrgProjectController;
|
||||||
|
import club.joylink.rtss.controller.paper.PaperCompositionController;
|
||||||
|
import club.joylink.rtss.controller.publish.MapFunctionController;
|
||||||
|
import club.joylink.rtss.controller.user.UserController;
|
||||||
|
import club.joylink.rtss.dao.MapDataDAO;
|
||||||
|
import club.joylink.rtss.dao.MapInfoDAO;
|
||||||
|
import club.joylink.rtss.entity.MapData;
|
||||||
|
import club.joylink.rtss.entity.MapDataExample;
|
||||||
|
import club.joylink.rtss.entity.MapInfo;
|
||||||
|
import club.joylink.rtss.entity.MapInfoExample;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2023.01.10版本处理接口数据
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dataHandle")
|
||||||
|
public class DataHandleController {
|
||||||
|
@Autowired
|
||||||
|
private MapInfoDAO mapInfoDAO;
|
||||||
|
@Autowired
|
||||||
|
private MapDataDAO mapDataDAO;
|
||||||
|
@Autowired
|
||||||
|
private OrgProjectController orgProjectController;
|
||||||
|
@Autowired
|
||||||
|
private MapFunctionController mapFunctionController;
|
||||||
|
@Autowired
|
||||||
|
private PaperCompositionController paperCompositionController;
|
||||||
|
@Autowired
|
||||||
|
private UserController userController;
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@PostMapping
|
||||||
|
public List<String> handle(HttpServletResponse response) {
|
||||||
|
correctMapVersion();
|
||||||
|
|
||||||
|
orgProjectController.oldDataHandle();
|
||||||
|
|
||||||
|
List<String> msgList = new ArrayList<>(mapFunctionController.oldDataHandle());
|
||||||
|
|
||||||
|
msgList.addAll(paperCompositionController.oldDataHandle());
|
||||||
|
|
||||||
|
userController.sync(response);
|
||||||
|
return msgList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纠正地图信息表的版本字段,使用地图数据的最后一个版本
|
||||||
|
*/
|
||||||
|
private void correctMapVersion() {
|
||||||
|
MapInfoExample mapInfoExample = new MapInfoExample();
|
||||||
|
mapInfoExample.createCriteria().andStatusEqualTo("1");
|
||||||
|
List<MapInfo> onlineMaps = mapInfoDAO.selectByExample(mapInfoExample);
|
||||||
|
Map<Long, MapInfo> onlineMapMap = onlineMaps.stream().collect(Collectors.toMap(MapInfo::getId, Function.identity()));
|
||||||
|
MapDataExample mapDataExample = new MapDataExample();
|
||||||
|
mapDataExample.createCriteria().andMapIdIn(new ArrayList<>(onlineMapMap.keySet()));
|
||||||
|
|
||||||
|
List<MapData> onlineMapDataList = mapDataDAO.selectByExample(mapDataExample);
|
||||||
|
onlineMapDataList.stream()
|
||||||
|
.collect(Collectors.toMap(MapData::getMapId, MapData::getVersion, (d1, d2) -> {
|
||||||
|
float v1 = Float.parseFloat(d1);
|
||||||
|
float v2 = Float.parseFloat(d2);
|
||||||
|
return v1 > v2 ? d1 : d2;
|
||||||
|
})).forEach((mapId, version) -> {
|
||||||
|
MapInfo mapInfo = onlineMapMap.get(mapId);
|
||||||
|
mapInfo.setVersion(version);
|
||||||
|
mapInfoDAO.updateByPrimaryKey(mapInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -181,8 +181,9 @@ public class PaperCompositionController {
|
|||||||
lsLessonExample.createCriteria().andMapIdIn(new ArrayList<>(onlineMaps.keySet())).andStatusEqualTo("1");
|
lsLessonExample.createCriteria().andMapIdIn(new ArrayList<>(onlineMaps.keySet())).andStatusEqualTo("1");
|
||||||
List<Long> validLessonIds = lsLessonDAO.selectByExample(lsLessonExample)
|
List<Long> validLessonIds = lsLessonDAO.selectByExample(lsLessonExample)
|
||||||
.stream().map(LsLesson::getId).collect(Collectors.toList());
|
.stream().map(LsLesson::getId).collect(Collectors.toList());
|
||||||
//所有项目-组织对应关系
|
//所有项目-组织对应关系(目前仅教学通用项目
|
||||||
Map<String, Long> projectCode_orgId_map = orgProjectDAO.selectByExample(null).stream().collect(Collectors.toMap(OrgProject::getProjectCode, OrgProject::getOrgId));
|
Map<String, Long> projectCode_orgId_map = orgProjectDAO.selectByExample(null).stream()
|
||||||
|
.collect(Collectors.toMap(OrgProject::getProjectCode, OrgProject::getOrgId, (oId1, oId2) -> oId1));
|
||||||
//转化试卷并记录试卷id变化
|
//转化试卷并记录试卷id变化
|
||||||
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
|
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
|
||||||
examDefinitionExample.createCriteria().andStatusEqualTo("1").andLessonIdIn(validLessonIds);
|
examDefinitionExample.createCriteria().andStatusEqualTo("1").andLessonIdIn(validLessonIds);
|
||||||
|
@ -47,7 +47,7 @@ public class MapFunctionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询地图系统(新)
|
* 列表查询地图功能(新)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public List<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO) {
|
public List<RtsMapFunctionVO> listQuery(RtsMapFunctionQueryVO queryVO) {
|
||||||
@ -55,7 +55,7 @@ public class MapFunctionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询地图系统(新)
|
* 分页查询地图功能(新)
|
||||||
*/
|
*/
|
||||||
@GetMapping("/paged")
|
@GetMapping("/paged")
|
||||||
public PageVO<RtsMapFunctionVO> pagedQuery(RtsMapFunctionQueryVO queryVO) {
|
public PageVO<RtsMapFunctionVO> pagedQuery(RtsMapFunctionQueryVO queryVO) {
|
||||||
@ -63,7 +63,7 @@ public class MapFunctionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除地图系统(新)
|
* 删除地图功能(新)
|
||||||
*/
|
*/
|
||||||
@Role(RoleEnum.Admin)
|
@Role(RoleEnum.Admin)
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@ -81,7 +81,7 @@ public class MapFunctionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新地图系统(新)
|
* 更新地图功能(新)
|
||||||
*/
|
*/
|
||||||
@Role(RoleEnum.Admin)
|
@Role(RoleEnum.Admin)
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@ -90,7 +90,7 @@ public class MapFunctionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID获取地图系统信息
|
* 根据ID获取地图功能信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public RtsMapFunctionVO queryOne(@PathVariable Long id) {
|
public RtsMapFunctionVO queryOne(@PathVariable Long id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user