// 如果项目状态为"1" if ("1".equals(item.getProjectStatus())) { // 如果竣工时间为空,则抛出异常 if (StringHelper.isEmpty(item.getEndTime())) throw new RuntimeException("竣工时间不能为空!"); // 将竣工时间字符串转换为Date对象 Date endTime = null; try { endTime = formatter.parse(item.getEndTime()); } catch (ParseException e) { throw new RuntimeException("时间转换异常"); } // 如果转换后的竣工时间为空,则抛出异常 if (endTime == null) throw new RuntimeException("时间转换异常"); // 如果项目的开始时间晚于竣工时间,则抛出异常 if (project.getBegineat().after(endTime)) throw new RuntimeException("启动时间不能大于竣工时间"); // 查询项目相关的图片列表 List pics = projectpicMapper.selectTProjectpicList(new TProjectpic().setProjectId(project.getId())); // 提示信息,要求上传建设前、建设中、建设后、项目验收报告的图片 String message = "项目竣工需要上传建设前、建设中、建设后、项目验收报告的图片,请先到项目管理模块上传图片!"; // 如果图片数量为0,则抛出异常 if (pics.size() == 0) throw new RuntimeException(message); // 分别记录建设前、建设中、建设后、项目验收报告的图片数量 int no = 0; int build = 0; int finish = 0; int money = 0; // 遍历图片列表,统计各类型图片的数量 for (TProjectpic pic : pics) { if (pic.getPictype() != null) { if (pic.getPictype() == 1) { no++; } else if (pic.getPictype() == 2) { build++; } else if (pic.getPictype() == 3) { finish++; } else if (pic.getPictype() == 4) { money++; } } } // 如果任何一类图片数量为0,则抛出异常 if (no == 0 || build == 0 || finish == 0 || money == 0) throw new RuntimeException(message); // 设置项目的竣工时间 p.setEndat(endTime); } else { // 如果项目状态不为"1",则将竣工时间置为null p.setEndat(null);

if 1equalsitemgetProjectStatus if StringHelperisEmptyitemgetEndTime throw new RuntimeException竣工时间不能为空!; Date endTime = null; try endTime = formatterp

原文地址: https://www.cveoy.top/t/topic/imBS 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录