|
@@ -27,6 +27,7 @@ import com.jeeplus.finance.projectReport.service.mapstruct.CwProjectReportFileWr
|
|
|
import com.jeeplus.finance.projectReportArchive.domain.CwProjectReportArchive;
|
|
|
import com.jeeplus.finance.projectReportArchive.mapper.CwProjectReportArchiveMapper;
|
|
|
import com.jeeplus.finance.projectReportArchive.service.dto.CwProjectReportArchiveDTO;
|
|
|
+import com.jeeplus.finance.utils.FileUtil;
|
|
|
import com.jeeplus.finance.utils.Global;
|
|
|
import com.jeeplus.finance.workClientInfo.domain.CwWorkClientBase;
|
|
|
import com.jeeplus.finance.workClientInfo.service.dto.CwWorkClientBaseDTO;
|
|
@@ -55,6 +56,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
+
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
|
/**
|
|
@@ -681,12 +683,44 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
li.setSigReason(sigById.getReason());
|
|
|
li.setTaskSigId(sigById.getTaskId());
|
|
|
}
|
|
|
+
|
|
|
+ //如果质控审核已经完成且审核通过时间存在,则判断审核时间是否已经超过一天,若不超过,则可以重复发起质控审核
|
|
|
+ if (null != li.getAuditTime() && "5".equals(li.getReviewStatus())){
|
|
|
+ li.setRepetitionReviewFlag(getRepetitionReviewFlag(li.getAuditTime()));
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 计算两时间是否超过一天(秒)
|
|
|
+ * @param auditTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean getRepetitionReviewFlag(Date auditTime){
|
|
|
+ // 创建一个Calendar对象,表示当前时间
|
|
|
+ Calendar currentTime = Calendar.getInstance();
|
|
|
+ // 获取当前时间的毫秒数
|
|
|
+ long currentTimeInMillis = currentTime.getTimeInMillis();
|
|
|
+ // 获取质控审核已经完成的毫秒数
|
|
|
+ long targetTimeInMillis = auditTime.getTime();
|
|
|
+ // 计算时间差异(以毫秒为单位)
|
|
|
+ long timeDifferenceInMillis = currentTimeInMillis - targetTimeInMillis;
|
|
|
+ // 将时间差异转换为秒
|
|
|
+ long timeDifferenceInMinutes = timeDifferenceInMillis / (1000);
|
|
|
+ if(timeDifferenceInMinutes > 86400){
|
|
|
+ //若超过86400, 则超过一天,即不可进行重新复核操作
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ //可进行重复质控操作
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 修改状态
|
|
|
* @param data
|
|
|
* @return
|
|
@@ -702,6 +736,11 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
|
|
|
CwProjectReportData reportData = reportMapper.queryById(id);
|
|
|
|
|
|
+ //如果质控审核已经完成且审核通过时间存在,则判断审核时间是否已经超过一天,若不超过,则可以重复发起质控审核
|
|
|
+ if (null != reportData && null != reportData.getAuditTime() && "5".equals(reportData.getReviewStatus())){
|
|
|
+ reportData.setRepetitionReviewFlag(getRepetitionReviewFlag(reportData.getAuditTime()));
|
|
|
+ }
|
|
|
+
|
|
|
//将新增行数据查询出来放入到cwProjectInfoList中
|
|
|
CwProjectInfoData cwProjectInfoData = infoMapper.selectByReportId(id);
|
|
|
if (null != cwProjectInfoData){
|
|
@@ -879,6 +918,12 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
if (null != review) {
|
|
|
reportData = reportMapper.queryById(review.getReportId());
|
|
|
if ( null != reportData){
|
|
|
+
|
|
|
+ //如果质控审核已经完成且审核通过时间存在,则判断审核时间是否已经超过一天,若不超过,则可以重复发起质控审核
|
|
|
+ if (null != reportData.getAuditTime() && "5".equals(reportData.getReviewStatus())){
|
|
|
+ reportData.setRepetitionReviewFlag(getRepetitionReviewFlag(reportData.getAuditTime()));
|
|
|
+ }
|
|
|
+
|
|
|
List<ProjectReportWorkAttachmentDTO> dtos = attachmentMapper.selectByInfoId(reportData.getId());
|
|
|
if (null != dtos){
|
|
|
|
|
@@ -3843,4 +3888,104 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
|
|
|
|
|
|
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 根据报告id查询已签章文件信息
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ProjectReportWorkAttachmentDTO> getSignatureFileInfoList (String id) {
|
|
|
+ List<ProjectReportWorkAttachmentDTO> signatureList = new ArrayList<>();
|
|
|
+
|
|
|
+ List<ProjectReportWorkAttachmentDTO> dtos = attachmentMapper.selectByInfoId(id);
|
|
|
+ if (null != dtos){
|
|
|
+
|
|
|
+ Iterator<ProjectReportWorkAttachmentDTO> it = dtos.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ ProjectReportWorkAttachmentDTO d = it.next();
|
|
|
+ //已签章附件
|
|
|
+ CwProjectReportFile signatureFile = attachmentMapper.selectInfoByFileId(d.getId(),"1");
|
|
|
+ if (null != signatureFile){
|
|
|
+ d.setFileType(signatureFile.getFileType());
|
|
|
+ d.setSealType(signatureFile.getSealType());
|
|
|
+ d.setSealedFile(signatureFile.getSealedFile());
|
|
|
+ d.setSealUser(signatureFile.getSealUser());
|
|
|
+ d.setSealDate(signatureFile.getSealDate());
|
|
|
+ d.setRemarks(signatureFile.getRemarks());
|
|
|
+ UserDTO userDTO2 = new UserDTO();
|
|
|
+ //根据创建人id查出创建人名称
|
|
|
+ String name2 = reportMapper.getUserNameById(signatureFile.getCreateById());
|
|
|
+ userDTO2.setId(signatureFile.getCreateById());
|
|
|
+ userDTO2.setName(name2);
|
|
|
+ d.setCreateBy(userDTO2);
|
|
|
+ d.setCreateTime(signatureFile.getCreateTime());
|
|
|
+ signatureList.add(d);
|
|
|
+ it.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return signatureList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 已盖章文件下载并压缩
|
|
|
+ * @param listAll
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getSignatureFileZipUrl (List<ProjectReportWorkAttachmentDTO> listAll) {
|
|
|
+ long timestamp = System.currentTimeMillis();
|
|
|
+ UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken ( ));
|
|
|
+ String filePath = null;
|
|
|
+ if(System.getProperty("os.name").toLowerCase().contains("win")){
|
|
|
+ filePath = "D:/attachment-file/" + userDTO.getName() + timestamp;
|
|
|
+ }else{
|
|
|
+ filePath = "/attachment-file/" + userDTO.getName() + timestamp;
|
|
|
+ }
|
|
|
+
|
|
|
+ File folder = new File(filePath);
|
|
|
+ if (!folder.exists()) {
|
|
|
+ if (folder.mkdirs()) {
|
|
|
+ System.out.println("文件夹创建成功!");
|
|
|
+ } else {
|
|
|
+ System.out.println("文件夹创建失败!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ System.out.println("文件夹已存在!");
|
|
|
+ }
|
|
|
+ String path = filePath + "/";
|
|
|
+
|
|
|
+ try{
|
|
|
+ //文件下载到指定文件夹
|
|
|
+ for (ProjectReportWorkAttachmentDTO info : listAll) {
|
|
|
+ String aliyunUrl = "http://cdn.gangwaninfo.com";
|
|
|
+ String aliDownloadUrl = "http://oss.gangwaninfo.com";
|
|
|
+
|
|
|
+
|
|
|
+ String file = aliyunUrl + info.getUrl();
|
|
|
+ file = file.replace("amp;","");
|
|
|
+ String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
|
|
|
+ String cons = "";
|
|
|
+ if (file.contains(aliyunUrl)){
|
|
|
+ cons = aliyunUrl;
|
|
|
+ }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
|
|
|
+ cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
|
|
|
+ }else {
|
|
|
+ cons = aliDownloadUrl;
|
|
|
+ }
|
|
|
+ String ossKey = file.split(cons+"/")[1];
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).downByStreamSaveLocal(ossKey,fileName,path+fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ //文件打包压缩成zip
|
|
|
+ FileUtil.zipFolder(filePath, filePath+".zip");
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return filePath;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|