Преглед на файлове

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
преди 5 години
родител
ревизия
cf9586d211

+ 9 - 10
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -67,6 +67,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     public HttpRespMsg addFile(UserVO userVO, Integer blongType, MultipartFile file, MultipartFile file2, String path) {
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        Mould mould = mouldMapper.selectById(userVO.getMouldId());
         if (user != null) {
             if (file != null && !file.isEmpty()) {
                 MouldFile projectFile = new MouldFile();
@@ -166,15 +167,14 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     dynamics.setBelongType(blongType);
                     mouldOperationDynamicsMapper.insert(dynamics);
                     //添加消息通知记录
-                    Mould mould = mouldMapper.selectById(userVO.getMouldId());
                     if (mould.getProjectId() != null) {
                         List<ProjectApprove> projectApproves = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("project_id", project.getId()));
                         String content = "";
                         for (ProjectApprove projectApprove : projectApproves) {
                             NewsNotice newsNotice = new NewsNotice();
-                            newsNotice.setRefId(projectFile.getId());
+                            newsNotice.setRefId(projectFile.getModelId());
                             newsNotice.setProjectId(project.getId());
-                            newsNotice.setProjectName(project.getProjectName());
+                            newsNotice.setProjectName(project.getProjectName()+"-"+mould.getModelName());
                             newsNotice.setNoticeType(Constant.APPROVEL_TYPE);
                             if (blongType == 0) {
                                 content = "模具文档";
@@ -213,15 +213,14 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                 dynamics.setMouldId(userVO.getMouldId());
                 dynamics.setBelongType(blongType);
                 mouldOperationDynamicsMapper.insert(dynamics);
-                Mould mould = mouldMapper.selectById(userVO.getMouldId());
                 Project project = projectMapper.selectOne(new QueryWrapper<Project>().eq("id", mould.getProjectId()));
                 List<ProjectApprove> projectApproves = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("project_id", project.getId()));
                 String content = "";
                 for (ProjectApprove projectApprove : projectApproves) {
                     NewsNotice newsNotice = new NewsNotice();
-                    newsNotice.setRefId(projectFile.getId());
+                    newsNotice.setRefId(projectFile.getModelId());
                     newsNotice.setProjectId(project.getId());
-                    newsNotice.setProjectName(project.getProjectName());
+                    newsNotice.setProjectName(project.getProjectName()+"-"+mould.getModelName());
                     newsNotice.setNoticeType(Constant.APPROVEL_TYPE);
                     if (blongType == 4) {
                         content = "模具更新";
@@ -280,7 +279,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     if (count != 0) {
                         return msg;
                     }
-                    dynamics.setMouldId(oldData.getId());
+                    dynamics.setMouldId(oldData.getModelId());
                     dynamics.setBelongType(oldData.getBlongType());
                     dynamics.setContent(Constant.APPROVAL);
                     dynamics.setOperatorId(user.getId());
@@ -288,7 +287,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     mouldOperationDynamicsMapper.insert(dynamics);
                 } else {
                     //添加审批记录
-                    dynamics.setMouldId(oldData.getId());
+                    dynamics.setMouldId(oldData.getModelId());
                     dynamics.setBelongType(oldData.getBlongType());
                     dynamics.setFileId(oldData.getId());
                     if (null != oldData.getFileName2()) {
@@ -331,7 +330,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     if (count != 0) {
                         return msg;
                     }
-                    dynamics.setMouldId(oldData.getId());
+                    dynamics.setMouldId(oldData.getModelId());
                     dynamics.setBelongType(oldData.getBlongType());
                     dynamics.setContent(Constant.APPROVAL);
                     dynamics.setOperatorId(user.getId());
@@ -339,7 +338,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     mouldOperationDynamicsMapper.insert(dynamics);
                 }else{
                     //添加审批记录
-                    dynamics.setMouldId(oldData.getId());
+                    dynamics.setMouldId(oldData.getModelId());
                     dynamics.setBelongType(oldData.getBlongType());
                     dynamics.setFileId(oldData.getId());
                     if (null != oldData.getFileName2()) {

+ 48 - 41
cloud-model/src/main/java/com/hssx/cloudmodel/util/MD5Util.java

@@ -6,6 +6,9 @@ import org.springframework.util.DigestUtils;
 import javax.servlet.ServletOutputStream;
 import java.io.*;
 import java.net.URLEncoder;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Date;
 import java.util.UUID;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -23,50 +26,54 @@ public class MD5Util {
     }
 
     public static void main(String[] args) {
+
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime parse = LocalDateTime.parse("1986-04-08 12:30:00", formatter);
+        System.out.println(parse);
 //        String password = "000000";
 //        System.out.println(MD5Util.getPassword(password));
 //        System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));;
         //需要压缩的文件--包括文件地址和文件名
-        String [] path ={"D:\\666\\1.jpg","D:\\666\\MouldFileMapper.xml"};
-        // 要生成的压缩文件地址和文件名称
-        String desPath = "D:\\666\\new.zip";
-        File zipFile = new File(desPath);
-        ZipOutputStream zipStream = null;
-        FileInputStream zipSource = null;
-        BufferedInputStream bufferStream = null;
-        try {
-            //构造最终压缩包的输出流
-            zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
-            for(int i =1;i<path.length;i++){
-                File file = new File(path[i]);
-                //将需要压缩的文件格式化为输入流
-                zipSource = new FileInputStream(file);
-                //压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样
-                ZipEntry zipEntry = new ZipEntry("2222.jpg");
-                //定位该压缩条目位置,开始写入文件到压缩包中
-                zipStream.putNextEntry(zipEntry);
-                //输入缓冲流
-                bufferStream = new BufferedInputStream(zipSource, 1024 * 10);
-                int read = 0;
-                //创建读写缓冲区
-                byte[] buf = new byte[1024 * 10];
-                while((read = bufferStream.read(buf, 0, 1024 * 10)) != -1)
-                {
-                    zipStream.write(buf, 0, read);
-                }
-            }
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            //关闭流
-            try {
-                if(null != bufferStream) bufferStream.close();
-                if(null != zipStream) zipStream.close();
-                if(null != zipSource) zipSource.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
+//        String [] path ={"D:\\666\\1.jpg","D:\\666\\MouldFileMapper.xml"};
+//        // 要生成的压缩文件地址和文件名称
+//        String desPath = "D:\\666\\new.zip";
+//        File zipFile = new File(desPath);
+//        ZipOutputStream zipStream = null;
+//        FileInputStream zipSource = null;
+//        BufferedInputStream bufferStream = null;
+//        try {
+//            //构造最终压缩包的输出流
+//            zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
+//            for(int i =1;i<path.length;i++){
+//                File file = new File(path[i]);
+//                //将需要压缩的文件格式化为输入流
+//                zipSource = new FileInputStream(file);
+//                //压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样
+//                ZipEntry zipEntry = new ZipEntry("2222.jpg");
+//                //定位该压缩条目位置,开始写入文件到压缩包中
+//                zipStream.putNextEntry(zipEntry);
+//                //输入缓冲流
+//                bufferStream = new BufferedInputStream(zipSource, 1024 * 10);
+//                int read = 0;
+//                //创建读写缓冲区
+//                byte[] buf = new byte[1024 * 10];
+//                while((read = bufferStream.read(buf, 0, 1024 * 10)) != -1)
+//                {
+//                    zipStream.write(buf, 0, read);
+//                }
+//            }
+//
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        } finally {
+//            //关闭流
+//            try {
+//                if(null != bufferStream) bufferStream.close();
+//                if(null != zipStream) zipStream.close();
+//                if(null != zipSource) zipSource.close();
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
     }
 }