| | |
| | | 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; |
| | |
| | | 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, "评定"); |
| | | } |
| | | } |