Commit 2d08394a authored by zhangch's avatar zhangch

文件上传相关

parent 88df379b
...@@ -20,10 +20,12 @@ import com.hungraim.ltc.util.AttachType; ...@@ -20,10 +20,12 @@ import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode; import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -64,7 +66,22 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -64,7 +66,22 @@ public class SrvProgramServiceImpl implements SrvProgramService {
@Override @Override
public ProgramDetailVo getProgramDetail(Long programId) { public ProgramDetailVo getProgramDetail(Long programId) {
return chSrvProgramMapper.getProgramDetail(programId); ProgramDetailVo programDetail = chSrvProgramMapper.getProgramDetail(programId);
// 返回对应的附件列表
Result<List<AttachVo>> listResult = attachFeignService.selectAttachs(programId, AttachType.PROGRAM.getUploadType());
if (!listResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
log.info("请求获取附件列表错误:错误码{},错误信息:{}", listResult.getCode(), listResult.getMsg());
} else {
List<AttachVo> data = listResult.getData();
List<ChFndAttach> attachList = new ArrayList<>();
for (AttachVo attachVo : data) {
ChFndAttach attach = new ChFndAttach();
BeanUtils.copyProperties(attachVo, attach);
attachList.add(attach);
}
programDetail.setFileDataList(attachList);
}
return programDetail;
} }
@Override @Override
...@@ -101,6 +118,7 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -101,6 +118,7 @@ public class SrvProgramServiceImpl implements SrvProgramService {
} }
this.addProgramSet(programDetailVo, date, newProgramId, programSetAndProjectVo); this.addProgramSet(programDetailVo, date, newProgramId, programSetAndProjectVo);
} }
this.updateAttachs(programDetailVo.getFileDataList(), chSrvProgram.getProgramId());
} else { } else {
// 修改操作,修改操作就是对服务方案项目进行修改,两种情况 // 修改操作,修改操作就是对服务方案项目进行修改,两种情况
List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos(); List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos();
...@@ -127,7 +145,9 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -127,7 +145,9 @@ public class SrvProgramServiceImpl implements SrvProgramService {
this.addProgramSet(programDetailVo, date, programId, programSetAndProjectVo); this.addProgramSet(programDetailVo, date, programId, programSetAndProjectVo);
} }
} }
this.updateAttachs(programDetailVo.getFileDataList(), programId);
} }
//修改附件 //修改附件
this.updateAttachs(programDetailVo.getFileDataList(), programId); this.updateAttachs(programDetailVo.getFileDataList(), programId);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment