Browse Source

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 years ago
parent
commit
e45e844427

+ 11 - 11
.idea/yunsu.iml

@@ -32,9 +32,18 @@
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.6.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.6.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
     <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
     <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.26" level="project" />
@@ -44,10 +53,10 @@
     <orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.11.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.5.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
     <orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.6.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9" level="project" />
@@ -62,16 +71,9 @@
     <orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
     <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: net.lingala.zip4j:zip4j:1.3.2" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:2.1.6.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.6.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.16" level="project" />
     <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.8" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.6.RELEASE" level="project" />
@@ -82,17 +84,15 @@
     <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.9.13" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.13" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
     <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.15" level="project" />

+ 4 - 0
cloud-model/pom.xml

@@ -127,6 +127,10 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <fork>true</fork>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
             </plugin>
         </plugins>
     </build>

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

@@ -15,22 +15,16 @@ import lombok.extern.slf4j.Slf4j;
 import net.lingala.zip4j.core.ZipFile;
 import net.lingala.zip4j.model.ZipParameters;
 import net.lingala.zip4j.util.Zip4jConstants;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
-import java.net.URLEncoder;
-import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -70,8 +64,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     NewsNoticeMapper newsNoticeMapper;
     @Resource
     NewsNoticeUserMapper newsNoticeUserMapper;
-    @Autowired
-    private OpenOfficeService openOfficeService;
     @Resource
     PdfFileMapper pdfFileMapper;
 
@@ -93,6 +85,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                 if (!dir.exists()) {
                     dir.mkdirs();
                 }
+                OpenOfficeService openOfficeService = new OpenOfficeService();
                 String fileName = "";
                 if (file != null && !file.isEmpty()) {
                     fileName = file.getOriginalFilename();
@@ -142,8 +135,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                             projectFile = null;
                         }
                     }
-                    //关闭openOffice
-                    openOfficeService.shutdown();
                     //零件文档时存上零件id
                     if (blongType == 1 && null != userVO.getPartId()) {
                         projectFile.setPartId(userVO.getPartId());
@@ -181,6 +172,8 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         pdfFile.setSourceFileUrl(projectFile.getFileUrl2());
                         pdfFileMapper.insert(pdfFile);
                     }
+                    //关闭openOffice
+                    openOfficeService.shutdown();
                     Project project = projectMapper.selectById(mould.getProjectId());
                     Integer count = projectApproveMapper.selectCount(new QueryWrapper<ProjectApprove>().eq("approver_id", user.getId()).eq("project_id", project.getId()));
 //                    if(count>0){
@@ -541,14 +534,18 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     @Override
     public HttpRespMsg delFile(MouldFile mouldFile, String token) {
         HttpRespMsg msg = new HttpRespMsg();
+
         User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
         if (currentUser == null) {
             msg.setError("用户不存在或者未登录");
         } else {
+            MouldFile file = mouldFileMapper.selectById(mouldFile.getId());
             if (Constant.SYS_ID.equals(currentUser.getParentId())) {
                 //判断是不是资产方管理员
                 msg.data = mouldFileMapper.deleteById(mouldFile.getId());
-            } else {
+            } else if(file.getUplodtorId().equals(currentUser.getId())){
+                msg.data = mouldFileMapper.deleteById(mouldFile.getId());
+            }else{
                 msg.setError("您没有该权限!");
             }
         }
@@ -712,6 +709,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         Mould mould = mouldMapper.selectById(userVO.getMouldId());
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
         if (user != null) {
+            OpenOfficeService openOfficeService = new OpenOfficeService();
             List<Part> partLists = partMapper.selectList(new QueryWrapper<Part>().eq("mould_id", userVO.getMouldId()));
             openOfficeService.start();
             for (MultipartFile file : files) {

+ 1 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectFileServiceImpl.java

@@ -42,8 +42,6 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
     ProjectOperationDynamicsMapper projectOperationDynamicsMapper;
     @Resource
     ProjectMapper projectMapper;
-    @Autowired
-    private OpenOfficeService openOfficeService;
     @Resource
     PdfFileMapper pdfFileMapper;
 
@@ -81,6 +79,7 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
                         saveFile.createNewFile();
                         file.transferTo(saveFile);
                         //上传完,需要生成pdf
+                        OpenOfficeService openOfficeService = new OpenOfficeService();
                         String dFile1 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
                         openOfficeService.start();
                         File newFile = new File(dFile1);

+ 1 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/util/OpenOfficeService.java

@@ -9,9 +9,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.artofsolving.jodconverter.OfficeDocumentConverter;
 import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
 import org.artofsolving.jodconverter.office.OfficeManager;
-import org.springframework.stereotype.Service;
+
 @Slf4j
-@Service("openOfficeService")
 public class OpenOfficeService {
 	//64位windows系统默认安装路径
 	public static String OpenOffice_HOME_64 = "C://Program Files (x86)/OpenOffice 4/";

+ 4 - 1
cloud-model/src/main/resources/application-prod.properties

@@ -13,7 +13,10 @@ spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
 # ####################################################################################################
 # 数据源配置
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 云模服务器对应的数据库
+#spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 我们测试的自己服务器数据库
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/new_cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
 spring.datasource.username=root
 spring.datasource.password=p011430seya1026
 #spring.datasource.druid.test-on-borrow=true

BIN
cloud-model/src/main/resources/lib/jodconverter-2.2.2.jar


BIN
cloud-model/src/main/resources/lib/jodconverter-cli-2.2.2.jar