| | |
| | | // 对象复制 |
| | | QualityMonitorDetails monitorDetails = new QualityMonitorDetails(); |
| | | BeanUtils.copyProperties(detailsUpload, monitorDetails); |
| | | monitorDetails.setMonitorWay(normalizeMonitorWay(detailsUpload.getMonitorWay())); |
| | | monitorDetails.setQualityMonitorId(qualityMonitor.getQualityMonitorId()); |
| | | if (!detailsUpload.getCompletionMonth().matches("\\d{4}-\\d{2}")) { |
| | | throw new ErrorException("完成时限格式应为yyyy-MM"); |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | return qualityMonitor; |
| | | } |
| | | |
| | | /** |
| | | * 质控方式统一用“、”分隔,兼容导入模板里常见的逗号/分号写法。 |
| | | */ |
| | | private String normalizeMonitorWay(String value) { |
| | | if (StringUtils.isBlank(value)) { |
| | | return value; |
| | | } |
| | | return java.util.Arrays.stream(value.split("[、,,;;]")) |
| | | .map(String::trim) |
| | | .filter(StringUtils::isNotBlank) |
| | | .distinct() |
| | | .collect(Collectors.joining("、")); |
| | | } |
| | | |
| | | /** |
| | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | "质量监控实施计划", "UTF-8"); |
| | | "质量控制措施", "UTF-8"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | "监控评价", "UTF-8"); |
| | | "质量控制评价记录", "UTF-8"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |