Browse Source

fix:测试校验

master_tdsql
huangrenya 1 year ago
parent
commit
e7709c20bf
  1. 26
      shuili-system/src/main/java/com/kms/yxgh/sz/service/SzSuperviseWayService.java

26
shuili-system/src/main/java/com/kms/yxgh/sz/service/SzSuperviseWayService.java

@ -63,25 +63,25 @@ public class SzSuperviseWayService extends BaseService<SzSuperviseWayMapper, SzS
}
@Transactional(rollbackFor = Exception.class)
public Boolean copyInfo(String id) throws Exception {
public Boolean copyInfo(String id) {
String localPath = ShuiliConfig.getProfile();
try {
// 1.1 查询监督检查办法对象
SzSuperviseWay superviseWay = this.getById(id);
SzSuperviseWay superviseWayNew = BeanCopyUtils.copy(superviseWay, SzSuperviseWay.class);
superviseWay.setName("新建管理办法");
// 1.2 复制文件
if(StringUtils.isNotBlank(superviseWay.getSuperviseCheckWay())){
if (StringUtils.isNotBlank(superviseWay.getSuperviseCheckWay())) {
String checkWayUrl = superviseWay.getSuperviseCheckWay();
String index = checkWayUrl.substring(checkWayUrl.lastIndexOf("."));
String path = DateUtils.datePath() + "/" + IdUtils.fastUUID()+ index;
String path = DateUtils.datePath() + "/" + IdUtils.fastUUID() + index;
System.out.println("-----------test--------------" + localPath + Constants.RESOURCE_PREFIX+ path);
FileDownloadUtils.downloadFile(checkWayUrl,localPath, localPath + Constants.RESOURCE_PREFIX+ path) ;
System.out.println("-----------test--------------" + localPath + Constants.RESOURCE_PREFIX + path);
FileDownloadUtils.downloadFile(checkWayUrl, localPath, localPath + Constants.RESOURCE_PREFIX + path);
String serverUrl = checkWayUrl.substring(0, checkWayUrl.lastIndexOf("/profile"));
superviseWayNew.setSuperviseCheckWay(serverUrl + Constants.RESOURCE_PREFIX +"/" + path);
superviseWayNew.setSuperviseCheckWay(serverUrl + Constants.RESOURCE_PREFIX + "/" + path);
}
// 1.3 查询水闸监督检查办法项目
@ -89,11 +89,11 @@ public class SzSuperviseWayService extends BaseService<SzSuperviseWayMapper, SzS
superviseWay.setId(null);
this.saveOrUpdate(superviseWay);
if (projectList.isEmpty()){
if (projectList.isEmpty()) {
return true;
}
List<SzSuperviseWayProject> list = BeanCopyUtils.copyList(projectList, SzSuperviseWayProject.class);
list.forEach(v->{
list.forEach(v -> {
List<SzSuperviseWayProjectItem> listItem = projectItemMapper.selectList(
Wrappers.<SzSuperviseWayProjectItem>lambdaQuery().eq(SzSuperviseWayProjectItem::getProjectId, v.getId()));
@ -103,15 +103,17 @@ public class SzSuperviseWayService extends BaseService<SzSuperviseWayMapper, SzS
wayProjectService.insert(v);
// 1.4 新增水闸监督检查办法项目内容
if(!listItem.isEmpty()){
listItem.forEach(val->{
if (!listItem.isEmpty()) {
listItem.forEach(val -> {
val.setId(null);
val.setProjectId(v.getId());
projectItemMapper.insert(val);
});
}
});
}catch (Exception e){
e.printStackTrace();
}
return true;
}

Loading…
Cancel
Save