|
@@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -28,6 +29,7 @@ import java.util.List;
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
public class VersionService extends ServiceImpl<VersionMapper, Version> {
|
|
public class VersionService extends ServiceImpl<VersionMapper, Version> {
|
|
private final AssoFunctionModuleService assoFunctionModuleService;
|
|
private final AssoFunctionModuleService assoFunctionModuleService;
|
|
|
|
+// private final FileManagerService fileManagerService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 新增
|
|
* 新增
|
|
@@ -41,7 +43,7 @@ public class VersionService extends ServiceImpl<VersionMapper, Version> {
|
|
String versionNum = version.getVersionNum();
|
|
String versionNum = version.getVersionNum();
|
|
List<AssoFunctionModuleDTO> assoFunctionModuleDTOS = new ArrayList<>();
|
|
List<AssoFunctionModuleDTO> assoFunctionModuleDTOS = new ArrayList<>();
|
|
List<AssoFunctionCodeDTO> codeDTOS = versionDTO.getAssoFunctionCodeDTOS();
|
|
List<AssoFunctionCodeDTO> codeDTOS = versionDTO.getAssoFunctionCodeDTOS();
|
|
- if (!codeDTOS.isEmpty()) {
|
|
|
|
|
|
+ if (codeDTOS != null && !codeDTOS.isEmpty()) {
|
|
for (AssoFunctionCodeDTO codeDTO : codeDTOS) {
|
|
for (AssoFunctionCodeDTO codeDTO : codeDTOS) {
|
|
AssoFunctionModuleDTO assoFunctionModuleDTO = new AssoFunctionModuleDTO();
|
|
AssoFunctionModuleDTO assoFunctionModuleDTO = new AssoFunctionModuleDTO();
|
|
// 代码和功能赋值
|
|
// 代码和功能赋值
|
|
@@ -78,20 +80,25 @@ public class VersionService extends ServiceImpl<VersionMapper, Version> {
|
|
|
|
|
|
public Records queryVersionList(QueryVersionListDTO queryVersionListDTO){
|
|
public Records queryVersionList(QueryVersionListDTO queryVersionListDTO){
|
|
Records records = new Records();
|
|
Records records = new Records();
|
|
- Long current = queryVersionListDTO.getPageNum();
|
|
|
|
- Long size = queryVersionListDTO.getPageSize();
|
|
|
|
|
|
+ Long current = queryVersionListDTO.getCurrent();
|
|
|
|
+ Long size = queryVersionListDTO.getSize();
|
|
String versionName = queryVersionListDTO.getVersionName();
|
|
String versionName = queryVersionListDTO.getVersionName();
|
|
String versionNum = queryVersionListDTO.getVersionNum();
|
|
String versionNum = queryVersionListDTO.getVersionNum();
|
|
|
|
|
|
LambdaQueryWrapper<Version> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<Version> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ if (versionName != null) {
|
|
|
|
+ queryWrapper.like(Version::getVersionName, versionName);
|
|
|
|
+ }
|
|
|
|
+ if (versionNum != null) {
|
|
|
|
+ queryWrapper.like(Version::getVersionNum, versionNum);
|
|
|
|
+ }
|
|
IPage<Version> versions = this.page(new Page<>(current, size), queryWrapper);
|
|
IPage<Version> versions = this.page(new Page<>(current, size), queryWrapper);
|
|
- List<Version> retrieveRecordList = versions.getRecords();
|
|
|
|
|
|
+ List<Version> versionList = versions.getRecords();
|
|
|
|
|
|
records.setCurrent(current);
|
|
records.setCurrent(current);
|
|
records.setSize(current);
|
|
records.setSize(current);
|
|
records.setTotal(versions.getTotal());
|
|
records.setTotal(versions.getTotal());
|
|
-
|
|
|
|
- records.setRecords(retrieveRecordList);
|
|
|
|
|
|
+ records.setRecords(versionList);
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -101,8 +108,8 @@ public class VersionService extends ServiceImpl<VersionMapper, Version> {
|
|
Integer versionId = queryVersionInfoDTO.getId();
|
|
Integer versionId = queryVersionInfoDTO.getId();
|
|
Version version = this.getById(versionId);
|
|
Version version = this.getById(versionId);
|
|
if (version != null) {
|
|
if (version != null) {
|
|
- versionVO.setVersion(version.getVersionNum());
|
|
|
|
- versionVO.setVersionId(version.getId());
|
|
|
|
|
|
+ versionVO.setVersionNum(version.getVersionNum());
|
|
|
|
+ versionVO.setId(version.getId());
|
|
versionVO.setVersionName(version.getVersionName());
|
|
versionVO.setVersionName(version.getVersionName());
|
|
versionVO.setRemark(version.getRemark());
|
|
versionVO.setRemark(version.getRemark());
|
|
versionVO.setFileGuid(version.getFileGuid());
|
|
versionVO.setFileGuid(version.getFileGuid());
|
|
@@ -121,17 +128,51 @@ public class VersionService extends ServiceImpl<VersionMapper, Version> {
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
|
|
|
|
- public Records queryById(Integer id){
|
|
|
|
|
|
+ public Records queryById(Integer id) throws IOException {
|
|
Records records = new Records();
|
|
Records records = new Records();
|
|
VersionVO versionVO = new VersionVO();
|
|
VersionVO versionVO = new VersionVO();
|
|
Version version = this.getById(id);
|
|
Version version = this.getById(id);
|
|
- BeanUtils.copyProperties(version, versionVO);
|
|
|
|
|
|
+ if (version != null) {
|
|
|
|
+ versionVO.setVersionNum(version.getVersionNum());
|
|
|
|
+ versionVO.setId(version.getId());
|
|
|
|
+ versionVO.setVersionName(version.getVersionName());
|
|
|
|
+ versionVO.setRemark(version.getRemark());
|
|
|
|
+ versionVO.setFileGuid(version.getFileGuid());
|
|
|
|
+// List<String> fileGuids = new ArrayList<>();
|
|
|
|
+// fileGuids.add(version.getFileGuid());
|
|
|
|
+// List<SystemFile> systemFiles = new ArrayList<>();
|
|
|
|
+// if (fileGuids.size() != 0) {
|
|
|
|
+// String res = fileManagerService.getSystemFileFromFMS(fileGuids);
|
|
|
|
+// systemFiles = JSONObject.parseArray(res, SystemFile.class);
|
|
|
|
+// }
|
|
|
|
+// if (!systemFiles.isEmpty()) {
|
|
|
|
+// versionVO.setSystemFileList(systemFiles);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<AssoFunctionModule> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(AssoFunctionModule::getVersionId, id);
|
|
|
|
+ AssoFunctionModule assoFunctionModule = assoFunctionModuleService.getOne(queryWrapper, false);
|
|
|
|
+ if (assoFunctionModule != null) {
|
|
|
|
+ versionVO.setAuthType(assoFunctionModule.getAuthType());
|
|
|
|
+ versionVO.setFunctionId(assoFunctionModule.getFunctionId());
|
|
|
|
+ versionVO.setCode(assoFunctionModule.getCode());
|
|
|
|
+ versionVO.setCreateUser(assoFunctionModule.getCreateUser());
|
|
|
|
+ versionVO.setCreateTime(assoFunctionModule.getCreateTime());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
records.setRecords(versionVO);
|
|
records.setRecords(versionVO);
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
|
|
|
|
- public Records delete(List<Integer> ids){
|
|
|
|
- Records records = new Records();
|
|
|
|
- return records;
|
|
|
|
|
|
+ public void delete(List<Integer> ids){
|
|
|
|
+ for (Integer id : ids) {
|
|
|
|
+ Version version = this.getById(id);
|
|
|
|
+ if (version != null) {
|
|
|
|
+ LambdaQueryWrapper<AssoFunctionModule> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(AssoFunctionModule::getVersionId, id);
|
|
|
|
+ assoFunctionModuleService.remove(queryWrapper);
|
|
|
|
+ this.removeById(id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|