| | |
| | | import com.yuanchu.mom.service.*; |
| | | import com.yuanchu.mom.utils.*; |
| | | import com.yuanchu.mom.vo.*; |
| | | import org.apache.poi.ss.usermodel.CellValue; |
| | | import org.apache.poi.xssf.usermodel.XSSFCell; |
| | | import org.apache.poi.xssf.usermodel.XSSFRow; |
| | | import org.apache.poi.xssf.usermodel.XSSFSheet; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | //获取最后一行的num,即总行数。此处从0开始 |
| | | int maxRow = sheet.getLastRowNum(); |
| | | for (int row = 0; row <= maxRow; row++) { |
| | | XSSFRow xssfRow = sheet.getRow(row); |
| | | //获取最后单元格num,即总单元格数 ***注意:此处从1开始计数*** |
| | | int maxRol = sheet.getRow(row).getLastCellNum(); |
| | | StringBuilder aLine = new StringBuilder(); |
| | | for (int rol = 0; rol < maxRol; rol++) { |
| | | /*for (int rol = 0; rol < maxRol; rol++) { |
| | | aLine.append(sheet.getRow(row).getCell(rol)).append(","); |
| | | }*/ |
| | | for (int rol = 0; rol < maxRol; rol++) { |
| | | XSSFCell cell = xssfRow.getCell(rol); |
| | | if (cell == null) { |
| | | aLine.append(","); |
| | | } else { |
| | | switch (cell.getCellType()) { |
| | | case FORMULA: |
| | | // 计算公式并获取结果 |
| | | CellValue cellValue = xssfWorkbook.getCreationHelper().createFormulaEvaluator().evaluate(cell); |
| | | switch (cellValue.getCellType()) { |
| | | case NUMERIC: |
| | | String formattedValue = String.format("%.4f", cellValue.getNumberValue()); |
| | | aLine.append(formattedValue); |
| | | break; |
| | | case STRING: |
| | | aLine.append(cellValue.getStringValue()); |
| | | break; |
| | | case BOOLEAN: |
| | | aLine.append(cellValue.getBooleanValue()); |
| | | break; |
| | | case ERROR: |
| | | aLine.append("#ERR!"); |
| | | break; |
| | | default: |
| | | aLine.append(""); |
| | | break; |
| | | } |
| | | break; |
| | | case NUMERIC: |
| | | String formattedValue = String.format("%.4f", cell.getNumericCellValue()); |
| | | aLine.append(formattedValue); |
| | | break; |
| | | case STRING: |
| | | aLine.append(cell.getStringCellValue()); |
| | | break; |
| | | case BOOLEAN: |
| | | aLine.append(cell.getBooleanCellValue()); |
| | | break; |
| | | case ERROR: |
| | | aLine.append("#ERR!"); |
| | | break; |
| | | default: |
| | | aLine.append(""); |
| | | break; |
| | | } |
| | | aLine.append(","); |
| | | } |
| | | } |
| | | String substring = aLine.substring(0, aLine.length() - 1); |
| | | result.append(substring).append("\n"); |
| | |
| | | info.setCreateUser(insProductMapper.selectUserById(userId).get("name")); |
| | | info.setMessageType("2"); |
| | | info.setTheme("复核通知"); |
| | | info.setContent("您有一条检验任务待复核消息"); |
| | | info.setContent("您有一条检验任务待复核消息,订单号是:" + insOrder.getEntrustCode() + ",样品名称为:"+insSample.getSample()); |
| | | info.setSenderId(userId); |
| | | info.setConsigneeId(submitPlanDto.getVerifyUser()); |
| | | info.setViewStatus(false); |
| | |
| | | map.put("msgtype", "text");//消息类型 text:文本 |
| | | map.put("agentid", 1000517);//应用id |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("content", "您有一条检验任务待复核消息,订单号是:" + insOrder.getEntrustCode() + ",请前往LIMS系统查看。<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | hashMap.put("content", "您有一条检验任务待复核消息,订单号是:" + insOrder.getEntrustCode() + ",样品名称为:"+insSample.getSample()+ |
| | | ",请前往LIMS系统查看。请点击<a href=\"https://ztwxlims.ztt.cn:7443/enter\">中天通信LIMS系统 </a>"); |
| | | map.put("text", hashMap);//消息内容 |
| | | map.put("safe", 0);//是否保密消息.0否 |
| | | map.put("enable_id_trans", 0);//是否开启id转译.0否 |
| | | map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否 |
| | | //qywxApi.send(map); |
| | | qywxApi.send(map); |
| | | //复核人--检验单相关负责人 |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(submitPlanDto.getVerifyUser()); |
| | |
| | | throw new ErrorException("电路试验的站点报告生成有误,请联系开发人员调整!"); |
| | | } |
| | | } |
| | | /*// 删除数采采集次数 |
| | | String key = "frequency" + ":" + submitPlanDto.getEntrustCode() + ":*"; |
| | | RedisUtil.delsLike(key);*/ |
| | | |
| | | /*生成产量工时*/ |
| | | //校验如果这个人这个检测项目已经添加过了则不需要再新增 |