|
@@ -61,27 +61,24 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result createDiaMenu(DiagnosticMenuDTO dto) {
|
|
public Result createDiaMenu(DiagnosticMenuDTO dto) {
|
|
|
|
+
|
|
if (BeanUtil.isEmpty(dto)) {
|
|
if (BeanUtil.isEmpty(dto)) {
|
|
throw new BadReqException("数据为空");
|
|
throw new BadReqException("数据为空");
|
|
}
|
|
}
|
|
- List<Integer> clientIds = new ArrayList<>();
|
|
|
|
- try{
|
|
|
|
- clientIds = Arrays.stream(dto.getClientIds().split(","))
|
|
|
|
- .map(Integer::parseInt)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- }catch (Exception e){
|
|
|
|
- throw new BizException("字符串转换数组错误,请检查字符串是否正确");
|
|
|
|
- }
|
|
|
|
|
|
+ List<Integer> clientIds = dto.getClientIds();
|
|
|
|
+
|
|
//查询 客户端id
|
|
//查询 客户端id
|
|
List<Client> clients = clientService.listByIds(clientIds);
|
|
List<Client> clients = clientService.listByIds(clientIds);
|
|
- if (clients.isEmpty()){
|
|
|
|
|
|
+ if (clients.isEmpty()) {
|
|
throw new BadReqException("客户端查询错误");
|
|
throw new BadReqException("客户端查询错误");
|
|
}
|
|
}
|
|
|
|
|
|
DiagnosticMenu diagnosticMenu = BeanUtil.copyProperties(dto, DiagnosticMenu.class);
|
|
DiagnosticMenu diagnosticMenu = BeanUtil.copyProperties(dto, DiagnosticMenu.class);
|
|
diagnosticMenu.setCreateTime(LocalDateTime.now());
|
|
diagnosticMenu.setCreateTime(LocalDateTime.now());
|
|
diagnosticMenu.setUpdateTime(LocalDateTime.now());
|
|
diagnosticMenu.setUpdateTime(LocalDateTime.now());
|
|
-
|
|
|
|
|
|
+ diagnosticMenu.setClientIds(diagnosticMenu.getClientIds()
|
|
|
|
+ .substring(1, diagnosticMenu.getClientIds().length() - 1)
|
|
|
|
+ .replaceAll(" ", ""));
|
|
this.save(diagnosticMenu);
|
|
this.save(diagnosticMenu);
|
|
|
|
|
|
return Result.ok();
|
|
return Result.ok();
|
|
@@ -118,7 +115,7 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
if (BeanUtil.isEmpty(diagnosticMenu)) {
|
|
if (BeanUtil.isEmpty(diagnosticMenu)) {
|
|
throw new BadReqException("该诊断菜单不存在");
|
|
throw new BadReqException("该诊断菜单不存在");
|
|
}
|
|
}
|
|
- //根据id删除
|
|
|
|
|
|
+ //根据id删除
|
|
this.removeById(id);
|
|
this.removeById(id);
|
|
return Result.ok();
|
|
return Result.ok();
|
|
}
|
|
}
|
|
@@ -159,7 +156,7 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
vo.setSize((int) page.getSize());
|
|
vo.setSize((int) page.getSize());
|
|
vo.setPages((int) page.getPages());
|
|
vo.setPages((int) page.getPages());
|
|
vo.setTotal((int) page.getTotal());
|
|
vo.setTotal((int) page.getTotal());
|
|
- if (fileName !=null || versionNum !=null){
|
|
|
|
|
|
+ if (fileName != null || versionNum != null) {
|
|
vo.setSearchCount(true);
|
|
vo.setSearchCount(true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -168,11 +165,13 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
for (DiagnosticMenu diagnosticMenu : records) {
|
|
for (DiagnosticMenu diagnosticMenu : records) {
|
|
DiagnosticMenuVO diagnosticMenuVO = BeanUtil.copyProperties(diagnosticMenu, DiagnosticMenuVO.class);
|
|
DiagnosticMenuVO diagnosticMenuVO = BeanUtil.copyProperties(diagnosticMenu, DiagnosticMenuVO.class);
|
|
List<Integer> clientIds = new ArrayList<>();
|
|
List<Integer> clientIds = new ArrayList<>();
|
|
- try{
|
|
|
|
- clientIds = Arrays.stream(diagnosticMenu.getClientIds().split(","))
|
|
|
|
|
|
+ try {
|
|
|
|
+ clientIds = Arrays.stream(diagnosticMenu.getClientIds()
|
|
|
|
+ .trim()
|
|
|
|
+ .split(","))
|
|
.map(Integer::parseInt)
|
|
.map(Integer::parseInt)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
throw new BizException("字符串转换数组错误,请检查字符串是否正确");
|
|
throw new BizException("字符串转换数组错误,请检查字符串是否正确");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,7 +180,7 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
List<Client> clients = clientService.listByIds(clientIds);
|
|
List<Client> clients = clientService.listByIds(clientIds);
|
|
List<String> clientNames = clients.stream().map(c -> c.getName()).collect(Collectors.toList());
|
|
List<String> clientNames = clients.stream().map(c -> c.getName()).collect(Collectors.toList());
|
|
List<String> clientNums = clients.stream().map(c -> c.getNumber()).collect(Collectors.toList());
|
|
List<String> clientNums = clients.stream().map(c -> c.getNumber()).collect(Collectors.toList());
|
|
- if (clients!=null){
|
|
|
|
|
|
+ if (clients != null) {
|
|
diagnosticMenuVO.setClientNames(clientNames);
|
|
diagnosticMenuVO.setClientNames(clientNames);
|
|
diagnosticMenuVO.setClientNums(clientNums);
|
|
diagnosticMenuVO.setClientNums(clientNums);
|
|
}
|
|
}
|
|
@@ -193,7 +192,7 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result menuUpdate(AppmenuUpdateDTO dto) {
|
|
public Result menuUpdate(AppmenuUpdateDTO dto) {
|
|
- if (BeanUtil.isEmpty(dto)){
|
|
|
|
|
|
+ if (BeanUtil.isEmpty(dto)) {
|
|
return Result.fail("未获取到数据").result(ResultCode.NO_DATA);
|
|
return Result.fail("未获取到数据").result(ResultCode.NO_DATA);
|
|
}
|
|
}
|
|
String version = dto.getVersion();
|
|
String version = dto.getVersion();
|
|
@@ -206,18 +205,18 @@ public class DiagnosticMenuServiceImpl extends ServiceImpl<DiagnosticMenuMapper,
|
|
Client client = clientService.lambdaQuery()
|
|
Client client = clientService.lambdaQuery()
|
|
.eq(Client::getNumber, clientNum)
|
|
.eq(Client::getNumber, clientNum)
|
|
.one();
|
|
.one();
|
|
- if (BeanUtil.isEmpty(client)){
|
|
|
|
|
|
+ if (BeanUtil.isEmpty(client)) {
|
|
throw new BadReqException("该客户端不存在");
|
|
throw new BadReqException("该客户端不存在");
|
|
}
|
|
}
|
|
QueryWrapper<DiagnosticMenu> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<DiagnosticMenu> wrapper = new QueryWrapper<>();
|
|
- wrapper.apply("CONCAT(',', client_ids, ',') LIKE {0}", "%,"+client.getId()+",%");
|
|
|
|
|
|
+ wrapper.apply("CONCAT(',', client_ids, ',') LIKE {0}", "%," + client.getId() + ",%");
|
|
|
|
|
|
DiagnosticMenu diagnosticMenu = this.getOne(wrapper);
|
|
DiagnosticMenu diagnosticMenu = this.getOne(wrapper);
|
|
- if (BeanUtil.isEmpty(diagnosticMenu)){
|
|
|
|
|
|
+ if (BeanUtil.isEmpty(diagnosticMenu)) {
|
|
throw new BadReqException("该菜单不存在");
|
|
throw new BadReqException("该菜单不存在");
|
|
}
|
|
}
|
|
AppMenuVO vo = new AppMenuVO();
|
|
AppMenuVO vo = new AppMenuVO();
|
|
- BeanUtil.copyProperties(diagnosticMenu,vo);
|
|
|
|
|
|
+ BeanUtil.copyProperties(diagnosticMenu, vo);
|
|
vo.setUrl(diagnosticMenu.getSavePath());
|
|
vo.setUrl(diagnosticMenu.getSavePath());
|
|
vo.setVersion(diagnosticMenu.getVersionNum());
|
|
vo.setVersion(diagnosticMenu.getVersionNum());
|
|
|
|
|