增加第三方账户配置接口;修改地图数据导入bug
This commit is contained in:
parent
7442082a7a
commit
6e6e3f7114
@ -478,8 +478,10 @@ public class SimulationV1Controller {
|
||||
return groupSimulationService.getAllPaTimedPlayInfo(group, stationCode);
|
||||
}
|
||||
|
||||
/* ----------------------- 仿真新接口 ----------------------- */
|
||||
|
||||
/**
|
||||
* 新仿真创建接口(新)
|
||||
* 仿真创建接口(新)
|
||||
*/
|
||||
@PostMapping("/new/{mapId}")
|
||||
public String createSimulation(@PathVariable long mapId, @RequestBody @Validated SimulationWorkParamVO paramVO,
|
||||
|
@ -1,12 +1,16 @@
|
||||
package club.joylink.rtss.controller.user;
|
||||
|
||||
import club.joylink.rtss.services.thridAccount.ThirdAccountConfigService;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdAccountConfigVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 第三方配置接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/thirdAccountConfig")
|
||||
public class ThirdAccountConfigController {
|
||||
@ -14,9 +18,27 @@ public class ThirdAccountConfigController {
|
||||
@Autowired
|
||||
private ThirdAccountConfigService thirdAccountConfigService;
|
||||
|
||||
/**
|
||||
* 分页查询所有配置
|
||||
*/
|
||||
@GetMapping("/paged")
|
||||
public PageVO<ThirdAccountConfigVO> pagedQuery(PageQueryVO queryVO) {
|
||||
return this.thirdAccountConfigService.pagedQuery(queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或更新
|
||||
*/
|
||||
@PostMapping("")
|
||||
public void saveOrUpdate(@RequestBody @Validated ThirdAccountConfigVO configVO, @RequestAttribute AccountVO user) {
|
||||
public void saveOrUpdate(@RequestBody @Validated ThirdAccountConfigVO configVO) {
|
||||
this.thirdAccountConfigService.saveOrUpdateConfig(configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public void delete(@PathVariable long id) {
|
||||
this.thirdAccountConfigService.delete(id);
|
||||
}
|
||||
}
|
||||
|
@ -448,6 +448,7 @@ public class ReleaseService implements IReleaseService {
|
||||
rtsMapSystem.setUpdateTime(now);
|
||||
rtsMapSystemDAO.updateByPrimaryKeyWithBLOBs(rtsMapSystem);
|
||||
} else {
|
||||
rtsMapSystem.setMapId(mapId);
|
||||
rtsMapSystem.setCreateTime(now);
|
||||
rtsMapSystem.setCreatorId(user.getId());
|
||||
rtsMapSystemDAO.insert(rtsMapSystem);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package club.joylink.rtss.services.thridAccount;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdAccountConfigVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdInterfaceConfig;
|
||||
|
||||
@ -8,4 +10,8 @@ public interface ThirdAccountConfigService {
|
||||
void saveOrUpdateConfig(ThirdAccountConfigVO configVO);
|
||||
|
||||
ThirdInterfaceConfig getInterfaceConfigByAccountId(String account);
|
||||
|
||||
PageVO<ThirdAccountConfigVO> pagedQuery(PageQueryVO queryVO);
|
||||
|
||||
void delete(long id);
|
||||
}
|
||||
|
@ -5,8 +5,12 @@ import club.joylink.rtss.entity.SysThirdAccountConfig;
|
||||
import club.joylink.rtss.entity.SysThirdAccountConfigExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.cache.ICacheService;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdAccountConfigVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdInterfaceConfig;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -51,6 +55,19 @@ public class ThirdAccountConfigServiceImpl implements ThirdAccountConfigService
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<ThirdAccountConfigVO> pagedQuery(PageQueryVO queryVO) {
|
||||
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
List<SysThirdAccountConfig> list = sysThirdAccountConfigDAO.selectByExampleWithBLOBs(null);
|
||||
List<ThirdAccountConfigVO> voList = ThirdAccountConfigVO.convert(list);
|
||||
return PageVO.convert(page, voList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(long id) {
|
||||
sysThirdAccountConfigDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
private String buildInterfaceConfigCacheKey(String account) {
|
||||
return String.format(String.format("%s%s", InterfaceConfigCacheKeyPre, account));
|
||||
}
|
||||
|
@ -6,10 +6,14 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -39,6 +43,22 @@ public class ThirdAccountConfigVO {
|
||||
@NotNull(message = "接口配置不能为空")
|
||||
private ThirdInterfaceConfig interfaceConfig;
|
||||
|
||||
public ThirdAccountConfigVO(SysThirdAccountConfig config) {
|
||||
this.id = config.getId();
|
||||
this.account = config.getAccount();
|
||||
this.createTime = config.getCreateTime();
|
||||
this.updateTime = config.getUpdateTime();
|
||||
this.interfaceConfig = readInterfaceConfig(config.getInterfaceConfig());
|
||||
}
|
||||
|
||||
public static List<ThirdAccountConfigVO> convert(List<SysThirdAccountConfig> configList) {
|
||||
if (!CollectionUtils.isEmpty(configList)) {
|
||||
return configList.stream().map(ThirdAccountConfigVO::new).collect(Collectors.toList());
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public static ThirdInterfaceConfig readInterfaceConfig(String interfaceConfig) {
|
||||
return JsonUtils.read(interfaceConfig, ThirdInterfaceConfig.class);
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package club.joylink.rtss.vo.thirdAccount;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ThirdInterfaceConfig {
|
||||
/**
|
||||
* 用户仿真使用记录同步第三方url
|
||||
|
@ -31,6 +31,7 @@ public class MapServiceTest {
|
||||
|
||||
@Test
|
||||
void copyMapData() {
|
||||
long mapId = 59L;
|
||||
String mapName = "单元测试地图" + new Random().nextInt(100);
|
||||
|
||||
MapCopyOption mapCopyOption = new MapCopyOption();
|
||||
@ -40,7 +41,7 @@ public class MapServiceTest {
|
||||
mapCopyOption.setCopyDataConfig(releaseConfigVO);
|
||||
AccountVO accountVO = new AccountVO();
|
||||
accountVO.setId(10086L);
|
||||
mapService.copyMapData(59L, mapCopyOption, accountVO);
|
||||
mapService.copyMapData(mapId, mapCopyOption, accountVO);
|
||||
|
||||
//验证
|
||||
List<MapVO> onlineMapInfos = mapService.queryOnlineMapInfos();
|
||||
|
@ -1,153 +0,0 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@SpringBootTest(classes = {QRCodeManagerTest.class})
|
||||
class QRCodeManagerTest {
|
||||
@Autowired
|
||||
private QRCodeManager qrCodeManager;
|
||||
|
||||
@Autowired
|
||||
private OtherConfig otherConfig;
|
||||
|
||||
@Test
|
||||
void getLoginCode() {
|
||||
String[] envArr = new String[]{"dev", "test", "prd"};
|
||||
for (String env : envArr) {
|
||||
otherConfig.setEnv(env);
|
||||
for (Project project : Project.values()) {
|
||||
String result = qrCodeManager.getLoginCode(null, project.name(), null);
|
||||
switch (env) {
|
||||
case "dev":
|
||||
assertEquals("", result);
|
||||
break;
|
||||
case "test": {
|
||||
String[] split = result.split("__");
|
||||
assertEquals(Project.TEST.name(), split[split.length - 1]);
|
||||
break;
|
||||
}
|
||||
case "prd":
|
||||
String[] split = result.split("__");
|
||||
assertEquals(project.name(), split[split.length - 1]);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + env);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDistributeCode() {
|
||||
String[] envArr = new String[]{"dev", "test", "prd"};
|
||||
for (String env : envArr) {
|
||||
otherConfig.setEnv(env);
|
||||
for (Project project : Project.values()) {
|
||||
String result = qrCodeManager.getDistributeCode(1, project.name());
|
||||
switch (env) {
|
||||
case "dev":
|
||||
assertEquals("", result);
|
||||
break;
|
||||
case "test": {
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=1__TEST");
|
||||
break;
|
||||
}
|
||||
case "prd":
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=1__" + project.name());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + env);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSimulationCode() {
|
||||
String[] envArr = new String[]{"dev", "test", "prd"};
|
||||
for (String env : envArr) {
|
||||
otherConfig.setEnv(env);
|
||||
for (Project project : Project.values()) {
|
||||
String result = qrCodeManager.getSimulationCode("42-10086", project.name());
|
||||
switch (env) {
|
||||
case "dev":
|
||||
assertEquals("", result);
|
||||
break;
|
||||
case "test": {
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=42-10086__TEST");
|
||||
break;
|
||||
}
|
||||
case "prd":
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=42-10086__" + project.name());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + env);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getWeChatBindUrl() {
|
||||
String[] envArr = new String[]{"dev", "test", "prd"};
|
||||
for (String env : envArr) {
|
||||
otherConfig.setEnv(env);
|
||||
for (Project project : Project.values()) {
|
||||
String result = qrCodeManager.getWeChatBindUrl(1, project.name());
|
||||
switch (env) {
|
||||
case "dev":
|
||||
assertEquals("", result);
|
||||
break;
|
||||
case "test": {
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=1__TEST");
|
||||
break;
|
||||
}
|
||||
case "prd":
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=1__" + project.name());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + env);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOrgBindCode() {
|
||||
String[] envArr = new String[]{"dev", "test", "prd"};
|
||||
for (String env : envArr) {
|
||||
otherConfig.setEnv(env);
|
||||
for (Project project : Project.values()) {
|
||||
String result = qrCodeManager.getOrgBindCode(1, project.name());
|
||||
switch (env) {
|
||||
case "dev":
|
||||
assertEquals("", result);
|
||||
break;
|
||||
case "test": {
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=1__TEST");
|
||||
break;
|
||||
}
|
||||
case "prd":
|
||||
String[] split = result.split("\\?");
|
||||
assertEquals(split[1], "state=1__" + project.name());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + env);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package club.joylink.rtss.services.project;
|
||||
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.vo.project.ProjectServerVO;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
class ServerServiceImplTest {
|
||||
@Autowired
|
||||
private ServerService serverService;
|
||||
|
||||
@Transactional
|
||||
@Test
|
||||
void getByProject() {
|
||||
//正常取值
|
||||
for (Project project : Project.values()) {
|
||||
serverService.getByProject(project.name());
|
||||
}
|
||||
//参数异常
|
||||
try {
|
||||
serverService.getByProject(null);
|
||||
} catch (Exception e) {
|
||||
assertTrue(e instanceof NullPointerException);
|
||||
}
|
||||
//校验取值结果
|
||||
ProjectServerVO xtyProjectVO = serverService.getByProject("XTY");
|
||||
assertEquals(xtyProjectVO.getDomainName(), "test.joylink.club/jlcloud");
|
||||
assertEquals(xtyProjectVO.getResourcesDomainName(), "joylink.club/oss/joylink");
|
||||
ProjectServerVO drtsProjectVO = serverService.getByProject("DRTS");
|
||||
assertNull(drtsProjectVO);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package club.joylink.rtss.services.thridAccount;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdAccountConfigVO;
|
||||
import club.joylink.rtss.vo.thirdAccount.ThirdInterfaceConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
@Rollback
|
||||
class ThirdAccountConfigServiceImplTest {
|
||||
@Autowired
|
||||
private ThirdAccountConfigServiceImpl thirdAccountConfigService;
|
||||
|
||||
@Test
|
||||
void saveOrUpdateConfig() {
|
||||
String account = "unit test";
|
||||
|
||||
ThirdAccountConfigVO thirdAccountConfigVO = new ThirdAccountConfigVO();
|
||||
thirdAccountConfigVO.setAccount(account);
|
||||
thirdAccountConfigVO.setCreateTime(LocalDateTime.now());
|
||||
ThirdInterfaceConfig thirdInterfaceConfig = new ThirdInterfaceConfig();
|
||||
thirdInterfaceConfig.setUserSimulationRecordSyncUrl("unit test -1");
|
||||
thirdInterfaceConfig.setUserExamRecordSyncUrl("unit test -2");
|
||||
thirdAccountConfigVO.setInterfaceConfig(thirdInterfaceConfig);
|
||||
thirdAccountConfigService.saveOrUpdateConfig(thirdAccountConfigVO);
|
||||
//检验
|
||||
try {
|
||||
thirdAccountConfigService.getInterfaceConfigByAccountId(account);
|
||||
} catch (Exception e) {
|
||||
fail("创建账号配置后查询报错");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getInterfaceConfigByAccountId() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void pagedQuery() {
|
||||
PageVO<ThirdAccountConfigVO> pageVO = thirdAccountConfigService.pagedQuery(new PageQueryVO());
|
||||
}
|
||||
|
||||
@Test
|
||||
void delete() {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user