Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/imagefilemanager/action/UploadImageFileAction.java =================================================================== diff -u -r27810 -r27838 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/imagefilemanager/action/UploadImageFileAction.java (.../UploadImageFileAction.java) (revision 27810) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/imagefilemanager/action/UploadImageFileAction.java (.../UploadImageFileAction.java) (revision 27838) @@ -13,6 +13,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Base64; +import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -45,6 +46,7 @@ import com.forgon.tools.StrutsParamUtils; import com.forgon.tools.StrutsResponseUtils; import com.forgon.tools.conversion.PdfToImageUtil; +import com.forgon.tools.date.DateTools; import com.forgon.tools.hibernate.ObjectDao; import com.forgon.tools.json.JSONUtil; import com.forgon.tools.util.SqlUtils; @@ -715,9 +717,6 @@ // 数据库ImageFile表的图片名称(不包含文件后缀) List allOriginalImagesDB = new ArrayList(); List allThumbnailImagesDB = new ArrayList(); - Map> errorImageMap = new LinkedHashMap>(); - errorImageMap.put("errorOriginalImage", errorOriginalImages); - errorImageMap.put("errorThumbnailImage", errorThumbnailImages); String sql2 = " where (1=1)"; List imageList2 = imageFileManager.getImageFileBySql(sql2); if(CollectionUtils.isNotEmpty(imageList2)){ @@ -747,6 +746,7 @@ } JSONArray errorTousseImageArray = new JSONArray(); + SimpleDateFormat sdf = new SimpleDateFormat(DateTools.COMMON_DATE_HMS); for (TousseDefinition td : tdToErrorOriginalMap.keySet()) { List originnalList = tdToErrorOriginalMap.get(td); List thumbnailList = tdToErrorOriginalMap.get(td); @@ -762,6 +762,10 @@ img.put("imageType", imageFile.getImageType()); img.put("imageName", imageFile.getImageName()); img.put("UUIDImageName", imageFile.getUUIDImageName()); + img.put("uploadDateTime", ""); + if(imageFile.getUploadDateTime() != null){ + img.put("uploadDateTime", sdf.format(imageFile.getUploadDateTime())); + } imageArray.add(img); } } @@ -774,6 +778,10 @@ img.put("imageType", imageFile.getImageType()); img.put("imageName", imageFile.getImageName()); img.put("UUIDAndImageName", imageFile.getUUIDAndImageName()); + img.put("uploadDateTime", ""); + if(imageFile.getUploadDateTime() != null){ + img.put("uploadDateTime", sdf.format(imageFile.getUploadDateTime())); + } imageArray.add(img); } } @@ -798,6 +806,10 @@ img.put("imageType", imageFile.getImageType()); img.put("imageName", imageFile.getImageName()); img.put("UUIDImageName", imageFile.getUUIDImageName()); + img.put("uploadDateTime", ""); + if(imageFile.getUploadDateTime() != null){ + img.put("uploadDateTime", sdf.format(imageFile.getUploadDateTime())); + } imageArray.add(img); } } @@ -810,6 +822,10 @@ img.put("imageType", imageFile.getImageType()); img.put("imageName", imageFile.getImageName()); img.put("UUIDAndImageName", imageFile.getUUIDAndImageName()); + img.put("uploadDateTime", ""); + if(imageFile.getUploadDateTime() != null){ + img.put("uploadDateTime", sdf.format(imageFile.getUploadDateTime())); + } imageArray.add(img); } } @@ -818,7 +834,43 @@ } } - JSONObject errorImage = JSONObject.fromObject(errorImageMap); + JSONObject errorImage = new JSONObject(); + // 原始图片文件夹中,图片文件存在,但是数据库记录不存在的错误图片 + JSONArray errorOriginalImageArr = new JSONArray(); + if(CollectionUtils.isNotEmpty(errorOriginalImages)){ + for (String imageName : errorOriginalImages) { + JSONObject imageJSON = new JSONObject(); + imageJSON.put("imageName", imageName); + File file = new File(originalPath + "\\" + imageName); + imageJSON.put("lastModifyTime", ""); + if(file.exists()){ + Calendar cal = Calendar.getInstance(); + long time = file.lastModified(); + cal.setTimeInMillis(time); + imageJSON.put("lastModifyTime", DateTools.formatTime(cal, DateTools.COMMON_DATE_HMS)); + } + errorOriginalImageArr.add(imageJSON); + } + } + // 缩略图片文件夹中,图片文件存在,但是数据库记录不存在的错误图片 + JSONArray errorThumbnailImageArr = new JSONArray(); + if(CollectionUtils.isNotEmpty(errorThumbnailImages)){ + for (String imageName : errorThumbnailImages) { + JSONObject imageJSON = new JSONObject(); + imageJSON.put("imageName", imageName); + File file = new File(thumbnailPath + "\\" + imageName); + imageJSON.put("lastModifyTime", ""); + if(file.exists()){ + Calendar cal = Calendar.getInstance(); + long time = file.lastModified(); + cal.setTimeInMillis(time); + imageJSON.put("lastModifyTime", DateTools.formatTime(cal, DateTools.COMMON_DATE_HMS)); + } + errorThumbnailImageArr.add(imageJSON); + } + } + errorImage.put("errorOriginalImage", errorOriginalImageArr); + errorImage.put("errorThumbnailImage", errorThumbnailImageArr); JSONObject data = new JSONObject(); data.put("errorTousseImage", errorTousseImageArray);