Explorar o código

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
%!s(int64=5) %!d(string=hai) anos
pai
achega
5a68f79f9e

+ 1 - 0
.idea/yunsu.iml

@@ -48,6 +48,7 @@
     <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" />

+ 36 - 36
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldFileController.java

@@ -55,41 +55,41 @@ public class MouldFileController {
 
 
 
-    /**
-     * 模具文档的下载
-     * id 所要下载的文件id ,
-     * @return
-     */
-    @GetMapping("/download/{id}")
-    public HttpRespMsg download(@PathVariable("id") Integer id,
-                         HttpServletRequest request,HttpServletResponse resp) throws IOException {
-        HttpRespMsg msg = new HttpRespMsg();
-        MouldFile model = mouldFileService.getById(id);// 文件实体
-        msg.data = model;
-        FileInputStream fis = null;
-        try {
-            String fileName = model.getFileName();
-            String filePath = path+model.getFileUrl().substring("/upload/".length());
-            fis = new FileInputStream(filePath);
-            resp.setContentType("application/vnd.ms-excel;charset=UTF-8");
-            resp.setCharacterEncoding("UTF-8");
-            resp.setHeader("Content-Disposition",
-                    "attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
-            byte[] b = new byte[1024];
-            int len;
-            while ((len = fis.read(b)) > 0) {
-                resp.getOutputStream().write(b, 0, len);
-            }
-        } catch (Exception e) {
-
-            msg.setError("文件[ {} ]下载错误");
-        } finally {
-            resp.getOutputStream().flush();
-            resp.getOutputStream().close();
-            fis.close();
-        }
-        return msg;
-    }
+//    /**
+//     * 模具文档的下载
+//     * id 所要下载的文件id ,
+//     * @return
+//     */
+//    @GetMapping("/download/{id}")
+//    public HttpRespMsg download(@PathVariable("id") Integer id,
+//                         HttpServletRequest request,HttpServletResponse resp) throws IOException {
+//        HttpRespMsg msg = new HttpRespMsg();
+//        MouldFile model = mouldFileService.getById(id);// 文件实体
+//        msg.data = model;
+//        FileInputStream fis = null;
+//        try {
+//            String fileName = model.getFileName();
+//            String filePath = path+model.getFileUrl().substring("/upload/".length());
+//            fis = new FileInputStream(filePath);
+//            resp.setContentType("application/vnd.ms-excel;charset=UTF-8");
+//            resp.setCharacterEncoding("UTF-8");
+//            resp.setHeader("Content-Disposition",
+//                    "attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
+//            byte[] b = new byte[1024];
+//            int len;
+//            while ((len = fis.read(b)) > 0) {
+//                resp.getOutputStream().write(b, 0, len);
+//            }
+//        } catch (Exception e) {
+//
+//            msg.setError("文件[ {} ]下载错误");
+//        } finally {
+//            resp.getOutputStream().flush();
+//            resp.getOutputStream().close();
+//            fis.close();
+//        }
+//        return msg;
+//    }
     /**
      * 模具文档的上传
      * 参数: token 用户身份凭证,
@@ -232,7 +232,7 @@ public class MouldFileController {
 
     /**
      * 文档勾选批量下载
-     * 参数: ids 模具ids 如“1,2,3”,dwgType 文档类型 0 所有文档 1-模具3D 2-模具2D 3-零件3D 4-零件2D 5-保养方案
+     * 参数: ids 模具ids 如“1,2,3”,dwgType 文档类型 0 所有文档 1-模具3D 2-模具2D 3-零件3D 4-零件2D 5-保养方案,token
      *
      * @return
      */

+ 17 - 22
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -110,32 +110,24 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
             if (companyVO.getCompanyType() == 0) {
                 //修改资产方
                 BeanUtils.copyProperties(companyVO, company);
-
                 List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
                 //判断所关联的生产方是否已被应用到项目
                 List<Integer> cousIds = list.stream().map(AssetCustomCompany::getCustomId).collect(Collectors.toList());
                 cousIds.add(-1);
+                List<Integer> noMouldCompanyIds = new ArrayList<>();
+                noMouldCompanyIds = mouldMapper.selectList(new QueryWrapper<Mould>().in("produce_company_id", cousIds).eq("company_id",company.getId())).stream().map(Mould::getProduceCompanyId).collect(Collectors.toList());
+                noMouldCompanyIds.add(-1);
                 List<Integer> ides = new ArrayList<>();
                 if (companyIds != null && !"".equals(companyIds)) {
                     ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                    ides.add(-1);
                 }
-                if (!ides.containsAll(cousIds)) {
-                    msg.setError("当前公司所关联的生产方公司已被用用到项目,不可执行修改操作。");
+                ides.add(-1);
+                if (!ides.containsAll(noMouldCompanyIds)) {
+                    msg.setError("当前公司所关联的生产方公司中已被用用到项目,不可执行修改操作。");
                     return msg;
                 }
-                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("assert_id", companyVO.getId()));
-
-//                List<Integer> idess = new ArrayList<>();
-//                idess.add(-1);
-//                for (AssetCustomCompany assetCustomCompany : list) {
-//                    idess.add(assetCustomCompany.getCustomId());
-//                }
-//                Integer count = customCompanyMapper.selectCount(new QueryWrapper<CustomCompany>().in("company_id", idess));
-//                if (count > 0) {
-//
-//                }
                 //删除之前的关联公司
+                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
                 if (companyIds != null && !"".equals(companyIds)) {
                     ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
                     for (Integer ide : ides) {
@@ -151,7 +143,6 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
             } else if (companyVO.getCompanyType() == 1) {
                 //生产方
                 BeanUtils.copyProperties(companyVO, company);
-                companyMapper.updateById(company);
                 QueryWrapper<LngLatCompany> qw = new QueryWrapper<>();
                 qw.eq("company_id", companyVO.getId());
                 LngLatCompany lngLatCompany = lngLatCompanyMapper.selectOne(qw);
@@ -161,17 +152,20 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
                 factory.setCompanyId(company.getId());
                 factory.setId(lngLatCompany.getId());
                 lngLatCompanyMapper.updateById(factory);
-                List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
+                List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("custom_id", company.getId()));
                 //判断所关联的生产方是否已被应用到项目
                 List<Integer> cousIds = list.stream().map(AssetCustomCompany::getAssertId).collect(Collectors.toList());
                 cousIds.add(-1);
+                List<Integer> noMouldCompanyIds = new ArrayList<>();
+                noMouldCompanyIds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("produce_company_id", company.getId()).in("company_id",cousIds)).stream().map(Mould::getCompanyId).collect(Collectors.toList());
+                noMouldCompanyIds.add(-1);
                 List<Integer> ides = new ArrayList<>();
                 if (companyIds != null && !"".equals(companyIds)) {
                     ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                    ides.add(-1);
                 }
-                if (!ides.containsAll(cousIds)) {
-                    msg.setError("当前公司所关联的生产方公司已被用用到项目,不可执行修改操作。");
+                ides.add(-1);
+                if (!ides.containsAll(noMouldCompanyIds)) {
+                    msg.setError("当前公司所关联的资产方公司已被用用到项目,不可执行修改操作。");
                     return msg;
                 }
                 //删除之前的关联公司
@@ -181,12 +175,13 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
                     for (Integer ide : ides) {
                         if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
                             AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
-                            assetCustomCompany.setAssertId(company.getId());
-                            assetCustomCompany.setCustomId(ide);
+                            assetCustomCompany.setAssertId(ide);
+                            assetCustomCompany.setCustomId(company.getId());
                             assetCustomCompanyMapper.insert(assetCustomCompany);
                         }
                     }
                 }
+                companyMapper.updateById(company);
             }
             msg.data = company;
         }

+ 6 - 5
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -82,10 +82,11 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
                 }
             } else {
                 //修改设备
+                MouldEquipment mouldEqu = mouldEquipmentMapper.selectById(mouldEquipment.getId());
                 MouldEquipment m = mouldEquipmentMapper.selectOne(new QueryWrapper<MouldEquipment>().eq("equipment_no", mouldEquipment.getEquipmentNo()));
-                if ((m != null && m.getId() == mouldEquipment.getId()) || m == null) {
+                if (mouldEqu.getEquipmentNo().equals(mouldEquipment.getEquipmentNo()) || m==null) {
                     mouldEquipmentMapper.updateById(mouldEquipment);
-                } else {
+                } else{
                     msg.setError("当前设备编号已存在,请重新输入其他模具编号");
                 }
             }
@@ -140,8 +141,8 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
         List<Integer> mouldsEquipmentIds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("company_id", mouldEquipmentVO.getBelongCompanyId()).isNotNull("equipment_id")).stream().map(Mould::getEquipmentId).collect(Collectors.toList());
         mouldsEquipmentIds.add(-1);
         List<Integer> equipmentIds = mouldEquipmentMapper.selectList(new QueryWrapper<MouldEquipment>().eq("belong_company_id", mouldEquipmentVO.getBelongCompanyId()).eq("stage", 0)).stream().map(MouldEquipment::getId).collect(Collectors.toList());
-        equipmentIds.add(-1);
         equipmentIds.removeAll(mouldsEquipmentIds);//把已经使用的设备剔除
+        equipmentIds.add(-1);
         List<MouldEquipmentVO> list = mouldEquipmentMapper.getListByCompanyId(mouldEquipmentVO.getBelongCompanyId(), equipmentIds);
         msg.data = list;
         return msg;
@@ -163,7 +164,7 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
             if (Constant.ELECTRICITY_THRESHOLD >= Double.parseDouble(mouldEquipment.getHillNumber())) {
                 if (0 == mouldEquipment.getStage()) {
                     mouldEquipment.setStage(2);
-                }else{
+                } else {
                     mouldEquipment.setStage(3);
                 }
                 mouldEquipmentMapper.updateById(mouldEquipment);
@@ -225,7 +226,7 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
             if (Constant.TEMPERATURE_THRESHOLD <= mouldEquipment.getTemperature()) {
                 if (0 == mouldEquipment.getStage()) {
                     mouldEquipment.setStage(1);
-                }else{
+                } else {
                     mouldEquipment.setStage(3);
                 }
                 mouldEquipmentMapper.updateById(mouldEquipment);

+ 61 - 3
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -11,6 +11,10 @@ import com.hssx.cloudmodel.mapper.*;
 import com.hssx.cloudmodel.service.MouldFileService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.cloudmodel.util.*;
+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.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -41,6 +45,7 @@ import java.util.zip.ZipOutputStream;
  * @since 2019-08-07
  */
 @Service
+@Slf4j
 public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile> implements MouldFileService {
 
 
@@ -538,10 +543,11 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         if (null != userVO.getIds()) {
             List<Integer> ids = ListUtil.convertIntegerIdsArrayToList(userVO.getIds());
             List<MouldFile> mouldFiles = new ArrayList<>();
+            List<String> newFolders = new ArrayList<>();
             for (Integer id : ids) {
                 Mould mould = mouldMapper.selectById(id);
                 if (0 == userVO.getDwgType()) {
-                    mouldFiles = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().eq("model_id", id).eq("state", 3));
+                    mouldFiles = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().eq("model_id", id).eq("state", 3).ne("blong_type", 4));
                 } else if (1 == userVO.getDwgType()) {
                     //模具2D
                     mouldFiles = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().eq("model_id", id).eq("state", 3).isNull("part_id").eq("dwg_type", 0).eq("blong_type", 0));
@@ -558,9 +564,59 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     mouldFiles = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().eq("model_id", id).eq("state", 3).eq("blong_type", 3));
                 }
 //                feedBackDirectMultiDownload(request, response, downloadPath, mould, mouldFiles, path);
-                String filePath = this.download(downloadPath, mould, mouldFiles, path, currentUser);
-                msg.data = filePath;
+                String folderPath = path + mould.getModelNo() + mould.getModelName();
+                List<String> sourceFileUrls = new ArrayList<>();
+                for (MouldFile mouldFile : mouldFiles) {
+                    sourceFileUrls.add(path.substring(0, path.length() - "/upload/".length()) + mouldFile.getFileUrl());
+                    //添加下载动态
+                    MouldOperationDynamics mod = new MouldOperationDynamics();
+                    mod.setApplicantId(mouldFile.getUplodtorId());
+                    mod.setApplicantName(mouldFile.getUploadtor());
+                    mod.setFileName(mouldFile.getFileName());
+                    mod.setOperatorId(currentUser.getId());
+                    mod.setOperatorName(currentUser.getUsername());
+                    mod.setContent(Constant.DOWNLOAD);
+                    mod.setFileId(mouldFile.getId());
+                    mod.setMouldId(mould.getId());
+                    mod.setBelongType(mouldFile.getBlongType());
+                    mouldOperationDynamicsMapper.insert(mod);
+                }
+                if (sourceFileUrls.size() > 0) {
+                    String folder = FileCopyToFolderUtil.copy(sourceFileUrls, folderPath);
+                    newFolders.add(folder);
+                }
+            }
+            // 生成的压缩文件
+            ZipFile zipFile = null;
+            SimpleDateFormat dateSdf2 = new SimpleDateFormat("yyyy年MM月dd+HH时mm分ss秒");
+            String fileName = dateSdf2.format(new Date()) + ".zip";
+            try {
+                zipFile = new ZipFile(path + fileName);
+                ZipParameters parameters = new ZipParameters();
+                // 压缩方式
+                parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
+                // 压缩级别
+                parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
+                // 要打包的文件夹
+                if(newFolders.size()>0){
+                    for (String newFolder : newFolders) {
+                        zipFile.addFolder(newFolder, parameters);
+                    }
+                }
+                msg.data = "/upload/"+fileName;
+//                File[] fs = currentFile.listFiles();
+//                // 遍历test文件夹下所有的文件、文件夹
+//                for (File f : fs) {
+//                    if (f.isDirectory()) {
+//                        zipFile.addFolder(f.getPath(), parameters);
+//                    } else {
+//                        zipFile.addFile(f, parameters);
+//                    }
+//                }
+            } catch (Exception e) {
+                e.printStackTrace();
             }
+//            String filePath = this.download(downloadPath, mould, mouldFiles, path, currentUser);
         }
         return msg;
     }
@@ -754,6 +810,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
             //构造最终压缩包的输出流
             zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
             if (mouldFiles.size() > 0) {
+                log.info("mouldFiles------------->" + mouldFiles);
                 for (int i = 0; i < mouldFiles.size(); i++) {
                     //添加下载动态
                     MouldOperationDynamics mod = new MouldOperationDynamics();
@@ -768,6 +825,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     mod.setBelongType(mouldFiles.get(i).getBlongType());
                     mouldOperationDynamicsMapper.insert(mod);
                     File file = new File(oldFilePath.substring(0, oldFilePath.length() - "/upload/".length()) + mouldFiles.get(i).getFileUrl());
+                    log.info("file=========>" + oldFilePath.substring(0, oldFilePath.length() - "/upload/".length()) + mouldFiles.get(i).getFileUrl());
                     //将需要压缩的文件格式化为输入流
                     zipSource = new FileInputStream(file);
                     //压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样

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

@@ -66,8 +66,9 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
         HttpRespMsg msg = new HttpRespMsg();
         if (mould.getId() != null) {
             //修改
+            Mould mou = mouldMapper.selectById(mould.getId());
             Mould m = mouldMapper.selectOne(new QueryWrapper<Mould>().eq("model_no", mould.getModelNo()));
-            if ((m != null && m.getId() == mould.getId()) || m == null) {
+            if (mou.getModelNo().equals(mould.getModelNo())  || m == null){
                 if (mould.getProduceCompanyId() != null) {
                     Company company = companyMapper.selectById(mould.getProduceCompanyId());
                     mould.setProduceCompanyName(company.getCompanyName());

+ 12 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/PartServiceImpl.java

@@ -104,6 +104,10 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, Part> implements Pa
                         part.setPartName(value);
                     } else if (y == 2) {
                         //零件寿命
+                        if(Integer.parseInt(value)>=100000000){
+                            msg.setError("第" + j + "行的零件寿命:" + value + "数字过长,请修改后重试");
+                            return msg;
+                        }
                         part.setPartLife(Integer.parseInt(value));
                         if (Integer.parseInt(value) < mould.getSettingLife()) {
                             part.setIsVulnerable(1);
@@ -137,8 +141,15 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, Part> implements Pa
         HttpRespMsg msg = new HttpRespMsg();
         if (part.getId() != null) {
             //修改
+            Part newPart = partMapper.selectById(part.getId());
+            Mould mould = mouldMapper.selectById(newPart.getMouldId());
             Part m = partMapper.selectOne(new QueryWrapper<Part>().eq("part_no", part.getPartNo()));
-            if ((m != null && m.getId() == part.getId()) || m == null) {
+            if (newPart.getPartNo().equals(part.getPartNo()) || m == null) {
+                if (part.getPartLife() < mould.getSettingLife()) {
+                    part.setIsVulnerable(1);
+                }else{
+                    part.setIsVulnerable(0);
+                }
                 partMapper.updateById(part);
             } else {
                 msg.setError("当前模具编号已存在,请重新输入其他模具编号");

+ 16 - 5
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/UserServiceImpl.java

@@ -82,7 +82,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         } else if (Constant.SYS_ID == user.getParentId()) {
             if (user.getSubordinateType() == 0) {
                 QueryWrapper<Project> qwr = new QueryWrapper<>();
-                //资产方管理员,看到自己创建的项目下的所有人
+                //资产方管理员,看到自己创建的项目下的所有人以及和自己公司建立联系的人
                 qwr.select("id").eq("creator_id", user.getId());
                 uIds = projectMapper.selectList(qwr).stream().map(Project::getManagerId).collect(Collectors.toList());
                 List<Integer> projectIds = projectMapper.selectList(qwr).stream().map(Project::getId).collect(Collectors.toList());
@@ -91,6 +91,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 uIds.addAll(projectUserIds);
                 List<Integer> projectApproveIds = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().in("project_id", projectIds)).stream().map(ProjectApprove::getApproverId).collect(Collectors.toList());
                 uIds.addAll(projectApproveIds);
+                //与本公司合作的用户ids
+                List<Integer> cooperationUids = userCompanyMapper.selectList(new QueryWrapper<UserCompany>().eq("cooperation_company_id", user.getCompanyId())).stream().map(UserCompany::getUserId).collect(Collectors.toList());
+                uIds.addAll(cooperationUids);
                 uIds.add(-1);
                 users = userMapper.selectUserListByCondition(roleType, companyId, flag, keyName, uIds,user);
             } else if (user.getSubordinateType() == 1) {
@@ -173,7 +176,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                     } else if (user.getSubordinateType() == 1) {
                         List<Integer> projectIds = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>().eq("company_id", user.getCompanyId())).stream().map(CustomCompany::getProjectId).collect(Collectors.toList());
                         projectIds.add(-1);
-                        if (user.getSubordinateType() == 0) {
+//                        if (user.getSubordinateType() == 0) {
                             //看到该人参与的所有项目
                             QueryWrapper<Project> qwPro = new QueryWrapper<>();
                             qwPro.eq("manager_id", userVO.getId());
@@ -196,12 +199,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                             qw.in("id", set);
                             projects = projectMapper.selectList(qw);
                             userVO.setProjects(projects);
-                        }
+//                        }
                     }
                 }else{
                         List<Integer> pIds = projectMapper.selectList(new QueryWrapper<Project>().eq("manager_id", user.getId())).stream().map(Project::getId).collect(Collectors.toList());
                         pIds.add(-1);
-                        if (user.getSubordinateType() == 0) {
+//                        if (user.getSubordinateType() == 0) {
                             //看到该人参与的所有项目
                             QueryWrapper<Project> qwPro = new QueryWrapper<>();
                             qwPro.eq("manager_id", userVO.getId());
@@ -224,7 +227,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                             qw.in("id", set);
                             projects = projectMapper.selectList(qw);
                             userVO.setProjects(projects);
-                        }
+//                        }
                     }
             } else {
                 msg.setError("当前用户未登录,或者用户不存在");
@@ -341,6 +344,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 int count = userMapper.selectCount(qw);
                 if (count > 0) {
                     User existingUser = userMapper.selectOne(qw);
+                    if(user.getCompanyId() != existingUser.getCompanyId()){
+                        msg.setError("该账号已存在,请勿重新创建");
+                        return msg;
+                    }
                     List<Integer> pIds  = projectMapper.selectList(new QueryWrapper<Project>().eq("owner_company", parentUser.getCompanyId())).stream().map(Project::getId).collect(Collectors.toList());
                     pIds.add(-1);
                     List<Integer> managerIds = projectMapper.selectList(new QueryWrapper<Project>().eq("owner_company", parentUser.getCompanyId())).stream().map(Project::getManagerId).collect(Collectors.toList());
@@ -443,6 +450,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 if (count > 0) {
                     //当前账号已被创建
                     User existingUser = userMapper.selectOne(qw);
+                    if(user.getCompanyId() != existingUser.getCompanyId()){
+                        msg.setError("该账号已存在,请勿重新创建");
+                        return msg;
+                    }
                     //查询该账号是否已参与创建项目经理的admin公司下的项目
                     //得到admin公司下的所有项目
                     List<Integer> ids  = projectMapper.selectList(new QueryWrapper<Project>().eq("owner_company", managerParent.getCompanyId())).stream().map(Project::getId).collect(Collectors.toList());

+ 72 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/util/FileCopyToFolderUtil.java

@@ -0,0 +1,72 @@
+package com.hssx.cloudmodel.util;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 08 - 30 13:59
+ * Description:<描述>
+ * Version: 1.0
+ */
+public class FileCopyToFolderUtil {
+    public static void main(String[] args) throws IOException {
+        Date date = new Date();
+        long time1 = date.getTime();
+        List<String>  sourceFileUrls = new ArrayList<>();
+        sourceFileUrls.add("D:\\软件\\ideaIU-2018.1.5.exe");
+        copy(sourceFileUrls, "D:\\775");
+        date = new Date();
+        long time2 = date.getTime();
+        System.out.println("耗时===》"+(time2-time1)/1000);
+        File file = new File("D:\\776");
+        if (file.exists()) {
+            file.delete();
+            //创建文件夹
+            file.mkdirs();
+        } else {
+            file.mkdirs();
+        }
+        System.out.println(file.getPath());
+    }
+    public static String copy(List<String>  sourceFileUrls, String destinationFolder) throws IOException {
+        //新文件夾
+        File file = new File(destinationFolder);
+        if (file.exists()) {
+            file.delete();
+            //创建文件夹
+            file.mkdirs();
+        } else {
+            file.mkdirs();
+        }
+        //如果源文件存在就复制
+        for (String sourceFileUrl : sourceFileUrls) {
+            //目标源文件夹
+            File source = new File(sourceFileUrl);
+            if (source.exists()) {
+                //新文件夹的路径
+                File newFile = new File(file + File.separator + source.getName());
+                if (source.isFile()) {
+                    FileInputStream in = new FileInputStream(source);
+                    BufferedInputStream bis= new BufferedInputStream(in);
+                    FileOutputStream out = new FileOutputStream(newFile);
+                    BufferedOutputStream bos= new BufferedOutputStream(out);
+                    byte[] bs = new byte[4096*10];
+                    int count = 0;
+//循环把源文件的内容写入新文件
+                    while ((count = bis.read(bs, 0, bs.length)) != -1) {
+                        bos.write(bs, 0, count);
+                    }
+//关闭流
+                    out.flush();
+                    out.close();
+                    in.close();
+                }
+            }
+        }
+        return file.getPath();
+    }
+
+}

+ 101 - 64
cloud-model/src/main/java/com/hssx/cloudmodel/util/MD5Util.java

@@ -1,5 +1,9 @@
 package com.hssx.cloudmodel.util;
 
+import net.lingala.zip4j.core.ZipFile;
+import net.lingala.zip4j.exception.ZipException;
+import net.lingala.zip4j.model.ZipParameters;
+import net.lingala.zip4j.util.Zip4jConstants;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.util.DigestUtils;
 
@@ -23,82 +27,115 @@ import java.util.zip.ZipOutputStream;
  */
 public class MD5Util {
 
-    public static String getPassword(String password){
+    public static String getPassword(String password) {
         return DigestUtils.md5DigestAsHex(password.getBytes());
     }
 
     public static void main(String[] args) throws ParseException {
+        zip4jDemo();
 
 //        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 ////        LocalDateTime parse = LocalDateTime.parse("2019-07-31T16:00:00.000Z", formatter);
 //        System.out.println(parse);
 
-        String start = "2019-07-31T16:00:00.000Z".replace("Z", " UTC");//是空格+UTC
-        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
-        Date date1 = df.parse(start);
-        SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
-        Date startDate = df1.parse(date1.toString());
-        System.out.println("date1.toString()"+date1.toString()+"=====startDate"+startDate);
-        String substring = "D:/mould/upload/".substring(0, "D:/mould/upload/".length() - "/upload/".length());
-        System.out.println("substring"+substring);
-        List<Integer>ids = new ArrayList<>();
-        ids.add(-1);
-        List<String> list1 = new ArrayList<String>();
-        List<String> list2 = new ArrayList<String>();
-        list1.add("g");
-        list1.add("s");
-        list1.add("a");
-        list1.add("f");
-        list2.add("g");
-        list2.add("c");
-        list2.add("b");
-        list2.add("a");
-        list1.retainAll(list2);
-        System.out.print(list1);
+//        String start = "2019-07-31T16:00:00.000Z".replace("Z", " UTC");//是空格+UTC
+//        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
+//        Date date1 = df.parse(start);
+//        SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
+//        Date startDate = df1.parse(date1.toString());
+//        System.out.println("date1.toString()"+date1.toString()+"=====startDate"+startDate);
+//        String substring = "D:/mould/upload/".substring(0, "D:/mould/upload/".length() - "/upload/".length());
+//        System.out.println("substring"+substring);
+//        List<Integer>ids = new ArrayList<>();
+//        ids.add(-1);
+//        List<String> list1 = new ArrayList<String>();
+//        List<String> list2 = new ArrayList<String>();
+//        list1.add("g");
+//        list1.add("s");
+//        list1.add("a");
+//        list1.add("f");
+//        list2.add("g");
+//        list2.add("c");
+//        list2.add("b");
+//        list2.add("a");
+//        list1.retainAll(list2);
+//        System.out.print(list1);
 //        String password = "000000";
 //        System.out.println(MD5Util.getPassword(password));
 //        System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));;
+
+
+    }
+
+    public void zipDemo() {
         //需要压缩的文件--包括文件地址和文件名
-//        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.jpg", "D:\\777.jpg"};
+        // 要生成的压缩文件地址和文件名称
+        String desPath = "D:\\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 = 0; i < path.length; i++) {
+                File file = new File(path[i]);
+                //将需要压缩的文件格式化为输入流
+                zipSource = new FileInputStream(file);
+                //压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样
+                ZipEntry zipEntry = new ZipEntry(i + "2222.jpg");//"2222.jpg"是添加到压缩包里的源文件的名字加i是防止名字相同出错
+                //定位该压缩条目位置,开始写入文件到压缩包中
+                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();
+            }
+        }
+    }
+
+    public static void zip4jDemo(){
+// 生成的压缩文件
+        ZipFile zipFile = null;
+        try {
+            zipFile = new ZipFile("D:\\aa.zip");
+
+        ZipParameters parameters = new ZipParameters();
+        // 压缩方式
+        parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
+        // 压缩级别
+        parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
+        // 要打包的文件夹
+        File currentFile = new File("D:\\666");
+        File[] fs = currentFile.listFiles();
+        // 遍历test文件夹下所有的文件、文件夹
+        for (File f : fs) {
+            if (f.isDirectory()) {
+                zipFile.addFolder(f.getPath(), parameters);
+            } else {
+                zipFile.addFile(f, parameters);
+            }
+        }
+            zipFile.addFolder("D:\\666", parameters);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 }

+ 3 - 2
cloud-model/src/main/resources/application-prod.properties

@@ -4,6 +4,7 @@ server.port=9099
 server.servlet.context-path=/
 server.tomcat.uri-encoding=UTF-8
 server.tomcat.max-http-post-size=-1
+server.connection-timeout=18000000s
 # ####################################################################################################
 # thymeleaf 配置
 spring.thymeleaf.cache=false
@@ -42,8 +43,8 @@ invitation.url.prefix=http://118.190.47.230:9098/#/invite/
 #######################################################################################################
 # 配置上传文件的大小设置
 # Single file max size  即单个文件大小
-spring.servlet.multipart.max-file-size=10MB
-spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.max-file-size=1000MB
+spring.servlet.multipart.max-request-size=10000MB
 ##################SpringBoot连接池配置########
 spring.datasource.hikari.minimum-idle=3
 spring.datasource.hikari.maximum-pool-size=10

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

@@ -4,6 +4,7 @@ server.port=8099
 server.servlet.context-path=/
 server.tomcat.uri-encoding=UTF-8
 server.tomcat.max-http-post-size=-1
+server.connection-timeout=18000000s
 # ####################################################################################################
 # thymeleaf ÅäÖÃ
 spring.thymeleaf.cache=false

+ 2 - 2
cloud-model/src/main/resources/mapper/CompanyMapper.xml

@@ -77,9 +77,9 @@
       SELECT
         t.id, t.company_name,t.company_type
         from
-        tb_company t
-        left join
         tb_asset_custom_company tbcc
+        left join
+        tb_company t
         <if test="companyType == 0">
             on t.id = tbcc.custom_id
         </if>

+ 8 - 5
pom.xml

@@ -32,11 +32,14 @@
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
 
-        <!--<dependency>-->
-        <!--<groupId>com.github.pagehelper</groupId>-->
-        <!--<artifactId>pagehelper-spring-boot-starter</artifactId>-->
-        <!--<version>1.2.5</version>-->
-        <!--</dependency>-->
+
+
+
+        <dependency>
+            <groupId>net.lingala.zip4j</groupId>
+            <artifactId>zip4j</artifactId>
+            <version>1.3.2</version>
+        </dependency>
 
         <dependency>
             <groupId>org.springframework.boot</groupId>