jinlin
2024-11-02 b42429445c22164e951d514348115ee593379026
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java
@@ -38,6 +38,8 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
@@ -936,4 +938,30 @@
        return baseDao.getAssessDataList(productId);
    }
    public void downloadXml(HttpServletRequest request, HttpServletResponse response, Long productId, Long taskId, Long itemId, Integer xml) {
        Long assessId = baseDao.getAssessId(itemId, productId, taskId);
        String json="";
        if (xml == 1) {
            json = baseDao.getxml(assessId);
        } else {
            String filePath = path + "/" + assessId + "/" + "result.xml";
            InputStream in = null;
            File file = new File(filePath);
            if (file.exists()) {
                try {
                    in = new FileInputStream(filePath);
                    json = IOUtils.toString(in);
                } catch (IOException e) {
                    throw new RenException("文件不存在或者文件打不开");
                } finally {
                    try {
                        in.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        simulatAssessService.writeToTxt(request, response, json, "评定");
    }
}