|
@@ -309,11 +309,68 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
|
|
|
|
|
|
@Override
|
|
|
@DynamicName(spel = "#bo.createTime")
|
|
|
- public void writeImg(String id, List<ZEngineeringInfoBo> infoIdList,ZEngineeringInfoBo bo) {
|
|
|
- Map<String, String> objInfo = baseMapper.getObjInfo(id);
|
|
|
+ public void writeImg(List<ZEngineeringInfoBo> infoIdList,ZEngineeringInfoBo bo) {
|
|
|
+ Map<String, String> objInfo = baseMapper.getObjInfo(bo.getEngInfoId());
|
|
|
System.out.println("-------------节点信息-------------");
|
|
|
System.out.println(objInfo);
|
|
|
System.out.println("--------------------------------");
|
|
|
+ infoIdList.forEach(item -> {
|
|
|
+ item.getzEngiineeringPhotoBoList().forEach(photo -> {
|
|
|
+ if (StringUtils.isNotBlank(photo)) {
|
|
|
+ try {
|
|
|
+ // 创建最外层文件夹
|
|
|
+ byte[] fileNameBytes = filePath.getBytes("UTF-8");
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
+ File file = new File(new String(fileNameBytes, "UTF-8"));
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdirs();
|
|
|
+ }
|
|
|
+ byte[] typeFileNameBytes = (file.getPath() + "/" + objInfo.get("type")).getBytes("UTF-8");
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
+ File typeFile = new File(new String(typeFileNameBytes, "UTF-8"));
|
|
|
+ if (!typeFile.exists()) {
|
|
|
+ typeFile.mkdirs();
|
|
|
+ }
|
|
|
+ byte[] idNameBytes = (typeFile.getPath() + "/" + objInfo.get("id")).getBytes("UTF-8");
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
+ File idFile = new File(new String(idNameBytes, "UTF-8"));
|
|
|
+ if (!idFile.exists()) {
|
|
|
+ idFile.mkdirs();
|
|
|
+ }
|
|
|
+ byte[] enginNameFileNameBytes = (idFile.getPath() + "/" + objInfo.get("engin_name")).getBytes("UTF-8");
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
+ File enginNameFile = new File(new String(enginNameFileNameBytes, "UTF-8"));
|
|
|
+ if (!enginNameFile.exists()) {
|
|
|
+ enginNameFile.mkdirs();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 时间
|
|
|
+ // File CreateTimeFile = new File(Type.getPath() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(zEngineeringInfoBo.getCreateTime()) );
|
|
|
+ byte[] CreateTimeFileNameBytes = (enginNameFile.getPath() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(item.getUpdateTime())).getBytes("UTF-8");
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
+ File CreateTimeFile = new File(new String(CreateTimeFileNameBytes, "UTF-8"));
|
|
|
+ if (!CreateTimeFile.exists()) {
|
|
|
+ CreateTimeFile.mkdirs();
|
|
|
+ }
|
|
|
+ // File CreateByFile = new File(CreateTimeFile.getPath() + "/" + zEngineeringInfoBo.getConstructUser());
|
|
|
+ byte[] CreateByFileNameBytes = (CreateTimeFile.getPath() + "/" + item.getConstructUser()).getBytes("UTF-8");
|
|
|
+ // 使用UTF-8编码创建文件
|
|
|
+ File CreateByFile = new File(new String(CreateByFileNameBytes, "UTF-8"));
|
|
|
+ if (!CreateByFile.exists()) {
|
|
|
+ CreateByFile.mkdirs();
|
|
|
+ }
|
|
|
+ obsService.download(CreateByFile.getPath(), photo.substring(photo.lastIndexOf("/")+1));
|
|
|
+ System.out.println(photo.substring(photo.lastIndexOf("/")+1));
|
|
|
+ System.out.println(photo);
|
|
|
+ System.out.println(CreateByFile.getPath());
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@Override
|