Browse Source

fix:测试校验

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

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

@ -63,55 +63,57 @@ 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())) {
String checkWayUrl = superviseWay.getSuperviseCheckWay();
String index = checkWayUrl.substring(checkWayUrl.lastIndexOf("."));
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);
String serverUrl = checkWayUrl.substring(0, checkWayUrl.lastIndexOf("/profile"));
superviseWayNew.setSuperviseCheckWay(serverUrl + Constants.RESOURCE_PREFIX + "/" + path);
}
// 1.1 查询监督检查办法对象
SzSuperviseWay superviseWay = this.getById(id);
SzSuperviseWay superviseWayNew = BeanCopyUtils.copy(superviseWay, SzSuperviseWay.class);
superviseWay.setName("新建管理办法");
// 1.2 复制文件
if(StringUtils.isNotBlank(superviseWay.getSuperviseCheckWay())){
String checkWayUrl = superviseWay.getSuperviseCheckWay();
String index = checkWayUrl.substring(checkWayUrl.lastIndexOf("."));
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) ;
String serverUrl = checkWayUrl.substring(0, checkWayUrl.lastIndexOf("/profile"));
superviseWayNew.setSuperviseCheckWay(serverUrl + Constants.RESOURCE_PREFIX +"/" + path);
}
// 1.3 查询水闸监督检查办法项目
List<SzSuperviseWayProjectDto> projectList = listData(superviseWay.getId());
superviseWay.setId(null);
this.saveOrUpdate(superviseWay);
// 1.3 查询水闸监督检查办法项目
List<SzSuperviseWayProjectDto> projectList = listData(superviseWay.getId());
superviseWay.setId(null);
this.saveOrUpdate(superviseWay);
if (projectList.isEmpty()){
return true;
if (projectList.isEmpty()) {
return true;
}
List<SzSuperviseWayProject> list = BeanCopyUtils.copyList(projectList, SzSuperviseWayProject.class);
list.forEach(v -> {
List<SzSuperviseWayProjectItem> listItem = projectItemMapper.selectList(
Wrappers.<SzSuperviseWayProjectItem>lambdaQuery().eq(SzSuperviseWayProjectItem::getProjectId, v.getId()));
// 新增项目
v.setId(null);
v.setWayId(superviseWayNew.getId());
wayProjectService.insert(v);
// 1.4 新增水闸监督检查办法项目内容
if (!listItem.isEmpty()) {
listItem.forEach(val -> {
val.setId(null);
val.setProjectId(v.getId());
projectItemMapper.insert(val);
});
}
List<SzSuperviseWayProject> list = BeanCopyUtils.copyList(projectList, SzSuperviseWayProject.class);
list.forEach(v->{
List<SzSuperviseWayProjectItem> listItem = projectItemMapper.selectList(
Wrappers.<SzSuperviseWayProjectItem>lambdaQuery().eq(SzSuperviseWayProjectItem::getProjectId, v.getId()));
// 新增项目
v.setId(null);
v.setWayId(superviseWayNew.getId());
wayProjectService.insert(v);
// 1.4 新增水闸监督检查办法项目内容
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