| | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import com.google.common.collect.Maps; |
| | | import com.whyc.config.I18nLocaleResolver; |
| | | import com.whyc.dto.BattGroupStationInfoWithFileParam; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.BattgroupData; |
| | |
| | | @Autowired |
| | | private TestParamService testParamService; |
| | | |
| | | @Autowired |
| | | private I18nLocaleResolver i18nLocaleResolver; |
| | | |
| | | public void resTestReport(BattGroupStationInfoWithFileParam info, HttpServletResponse response) throws IOException { |
| | | Locale local = i18nLocaleResolver.getLocal(); |
| | | boolean zhFlag = local.getLanguage().toLowerCase().equals("zh"); |
| | | HashMap<String, Object> map = Maps.newHashMap(); |
| | | //总体评价:内阻/电压/连接条/?容量 |
| | | int resGoodCount = 0; |
| | |
| | | else if(br >= stdRes*resGoodCoeK3/100){ |
| | | if(br >= stdRes*resBadCoeK4/100){ |
| | | // data.setHighResFlag2(true); |
| | | data.setResEvaluation("差"); |
| | | if(zhFlag) { |
| | | data.setResEvaluation("差"); |
| | | }else{ |
| | | data.setResEvaluation("bad"); |
| | | } |
| | | }else{ |
| | | // data.setHighResFlag1(true); |
| | | data.setResEvaluation("良"); |
| | | if(zhFlag) { |
| | | data.setResEvaluation("良"); |
| | | }else { |
| | | data.setResEvaluation("good"); |
| | | } |
| | | } |
| | | }else{ |
| | | resGoodCount +=1; |
| | | data.setResEvaluation("优"); |
| | | if(zhFlag) { |
| | | data.setResEvaluation("优"); |
| | | }else { |
| | | data.setResEvaluation("excellent"); |
| | | } |
| | | } |
| | | /*if(bv!=0.0 && !data.isLowVolFlag() && !data.isHighVolFlag()){ |
| | | volGoodCount +=1; |
| | |
| | | //map.put("resImage","resImage"); |
| | | |
| | | //获取导出模板地址 |
| | | ClassPathResource classPathResource = new ClassPathResource("excel_templates/res_test_report_single_template.xls"); |
| | | ClassPathResource classPathResource; |
| | | if(zhFlag){ |
| | | classPathResource = new ClassPathResource("excel_templates/res_test_report_single_template.xls"); |
| | | }else { |
| | | classPathResource = new ClassPathResource("excel_templates/res_test_report_single_template_en.xls"); |
| | | } |
| | | String path = classPathResource.getPath(); |
| | | TemplateExportParams templateExportParams1 = new TemplateExportParams(path); |
| | | Workbook wb = ExcelExportUtil.exportExcel(templateExportParams1, map); |
| | | String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss")); |
| | | String fileName = "内阻计测试"+time+".xls"; |
| | | String fileName; |
| | | if(zhFlag) { |
| | | fileName = "内阻计测试" + time + ".xls"; |
| | | }else{ |
| | | fileName = "Resistance Meter Test Report" + time + ".xls"; |
| | | } |
| | | try { |
| | | //response.setContentType("application/octet-stream;charset=utf-8"); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | |
| | | } |
| | | |
| | | public void resTestCompareReport(String fileId, String fileId2, BattGroupStationInfoWithFileParam dto, HttpServletResponse response) throws IOException { |
| | | Locale local = i18nLocaleResolver.getLocal(); |
| | | boolean zhFlag = local.getLanguage().toLowerCase().equals("zh"); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | Response comparedList = battGroupDataService.getComparedList(fileId, fileId2); |
| | | List<BattgroupData> dataList = (List<BattgroupData>) comparedList.getData(); |
| | |
| | | } |
| | | else if(!data.isHighResFlag1() && !data.isHighResFlag2() ){ |
| | | resGoodCount +=1; |
| | | data.setResEvaluation("优"); |
| | | if(zhFlag) { |
| | | data.setResEvaluation("优"); |
| | | }else { |
| | | data.setResEvaluation("excellent"); |
| | | } |
| | | }else if(data.isHighResFlag1()){ |
| | | data.setResEvaluation("良"); |
| | | if(zhFlag) { |
| | | data.setResEvaluation("良"); |
| | | }else{ |
| | | data.setResEvaluation("good"); |
| | | } |
| | | }else{ |
| | | data.setResEvaluation("差"); |
| | | if(zhFlag) { |
| | | data.setResEvaluation("差"); |
| | | }else{ |
| | | data.setResEvaluation("bad"); |
| | | } |
| | | } |
| | | if(bv!=0.0 && !data.isLowVolFlag() && !data.isHighVolFlag()){ |
| | | volGoodCount +=1; |
| | |
| | | |
| | | |
| | | //获取导出模板地址 |
| | | ClassPathResource classPathResource = new ClassPathResource("excel_templates/res_test_report_compare_template.xls"); |
| | | ClassPathResource classPathResource; |
| | | if(zhFlag){ |
| | | classPathResource = new ClassPathResource("excel_templates/res_test_report_compare_template.xls"); |
| | | }else{ |
| | | classPathResource = new ClassPathResource("excel_templates/res_test_report_compare_template_en.xls"); |
| | | } |
| | | String path = classPathResource.getPath(); |
| | | TemplateExportParams templateExportParams1 = new TemplateExportParams(path); |
| | | templateExportParams1.setColForEach(true); |
| | | Workbook wb = ExcelExportUtil.exportExcel(templateExportParams1, map); |
| | | String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss")); |
| | | String fileName = "内阻计测试"+time+".xls"; |
| | | String fileName; |
| | | if(zhFlag) { |
| | | fileName = "内阻计测试" + time + ".xls"; |
| | | }else{ |
| | | fileName = "Resistance Meter Test Report" + time + ".xls"; |
| | | } |
| | | try { |
| | | //response.setContentType("application/octet-stream;charset=utf-8"); |
| | | response.setContentType("application/vnd.ms-excel"); |