浏览代码

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 年之前
父节点
当前提交
75a91678a6

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldController.java

@@ -167,7 +167,7 @@ public class MouldController {
         return msg;
     }
     /**
-     * 需要保养的模具列表
+     * 报废提醒的模具列表
      * 参数 token 用户凭证
      */
     @ApiOperation("报废提醒的模具列表")

+ 35 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldEquipmentController.java

@@ -5,16 +5,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.cloudmodel.entity.MouldEquipment;
 import com.hssx.cloudmodel.entity.User;
 import com.hssx.cloudmodel.entity.vo.MouldEquipmentVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.service.MouldEquipmentService;
 import com.hssx.cloudmodel.service.UserService;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.PageUtil;
 import io.swagger.annotations.ApiOperation;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
 
 
 /**
@@ -46,6 +52,23 @@ public class MouldEquipmentController {
         msg = mouldEquipmentService.addAndUpdateMouldEquipment(mouldEquipment,user);
         return msg;
     }
+    /**
+     * 批量零件 Excel 导入
+     * file excel文件 token 用户身份凭证
+     *
+     * @param file
+     * @throws Exception
+     */
+    @ApiOperation("云模盒的excel批量导入")
+    @RequestMapping(value = "/importMouldEquipmentExcel")
+    @ResponseBody
+    public HttpRespMsg importMouldEquipmentExcel(
+            @RequestParam(value = "file", required = false) MultipartFile file,
+            UserVO userVO) throws IOException, InvalidFormatException {
+        HttpRespMsg msg = new HttpRespMsg();
+        msg = mouldEquipmentService.importMouldEquipmentExcel(file, userVO);
+        return msg;
+    }
 
     /**
      * 启用设备
@@ -94,5 +117,17 @@ public class MouldEquipmentController {
         msg = mouldEquipmentService.getList(user,page,companyId,keyName);
         return msg;
     }
+
+    /**
+     * 模具设备(云模盒)温度/低电量告警
+     */
+    @ApiOperation("模具设备(云模盒)温度/低电量告警")
+    @RequestMapping("/alarm")
+    @ResponseBody
+    @Scheduled(cron = "0 0 12 * * ?")//配置时间点触发(每日中午12点)
+    public HttpRespMsg MouldEquipmentAlarm() throws Exception {
+        HttpRespMsg msg = mouldEquipmentService.MouldEquipmentAlarm();
+        return msg;
+    }
 }
 

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

@@ -40,6 +40,7 @@ import java.util.zip.ZipOutputStream;
  */
 @Controller
 @Slf4j
+@CrossOrigin
 @RequestMapping("/mouldfile")
 public class MouldFileController {
 

+ 3 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/controller/ProjectFileController.java

@@ -9,6 +9,7 @@ import com.hssx.cloudmodel.util.HttpRespMsg;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.web.multipart.MultipartFile;
@@ -26,7 +27,8 @@ import java.util.UUID;
  * @author 吴涛涛
  * @since 2019-07-30
  */
-@RestController
+@Controller
+@CrossOrigin
 @RequestMapping("/projectfile")
 public class ProjectFileController {
 

+ 52 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/filter/CORSFilter.java

@@ -0,0 +1,52 @@
+//package com.hssx.cloudmodel.filter;
+//
+//import org.springframework.stereotype.Component;
+//
+//import javax.servlet.*;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import java.io.IOException;
+//
+///**
+// * Author: 薛骏强
+// * Date : 2019 - 06 - 05 17:36
+// * Description:<描述>
+// * Version: 1.0
+// */
+////拦截器添加跨域支持(如果是web.xml配置拦截器,请将@component删除)
+//@Component
+//public class CORSFilter implements Filter {
+//    @Override
+//    public void init(FilterConfig filterConfig) throws ServletException {
+//
+//    }
+//
+//    @Override
+//    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException, IOException {
+////        HttpServletRequest request = (HttpServletRequest) request;
+////        HttpServletResponse response = (HttpServletResponse) response;
+//////        response.setHeader("Access-Control-Allow-Origin", "*");
+////        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+////        response.setHeader("Access-Control-Max-Age", "3600");
+////        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
+////        response.setHeader("Access-Control-Allow-Credentials", "true"); //是否支持cookie跨域
+////        filterChain.doFilter(servletRequest, servletResponse);
+////
+////    }
+//        HttpServletResponse res = (HttpServletResponse) response;
+//        res.addHeader("Access-Control-Allow-Credentials", "true");//是否支持cookie跨域
+//        res.addHeader("Access-Control-Allow-Origin", "*");
+//        res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
+//        res.addHeader("Access-Control-Allow-Headers", "Content-Type,X-CAF-Authorization-Token,sessionToken,X-TOKEN");
+//        if (((HttpServletRequest) request).getMethod().equals("OPTIONS")) {
+//            response.getWriter().println("ok");
+//            return;
+//        }
+//        filterChain.doFilter(request, response);
+//    }
+//
+//    @Override
+//    public void destroy() {
+//
+//    }
+//}

+ 6 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldEquipmentService.java

@@ -4,8 +4,10 @@ import com.hssx.cloudmodel.entity.MouldEquipment;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.hssx.cloudmodel.entity.User;
 import com.hssx.cloudmodel.entity.vo.MouldEquipmentVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.PageUtil;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * <p>
@@ -24,4 +26,8 @@ public interface MouldEquipmentService extends IService<MouldEquipment> {
     HttpRespMsg getList(User user,PageUtil page,Integer companyId,String keyName);
 
     HttpRespMsg getListByCompanyId(MouldEquipmentVO mouldEquipmentVO);
+
+    HttpRespMsg MouldEquipmentAlarm();
+
+    HttpRespMsg importMouldEquipmentExcel(MultipartFile file, UserVO userVO);
 }

+ 3 - 5
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -405,11 +405,9 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
                         .collect(Collectors.toList()));
                 String keyName = null;
                 List<ProjectVO> projects = projectMapper.getProjectListByUidInProjectIds(keyName, projectIds);
-                String cIds = projects.stream().map(Project::getOwnerCompanyName).collect(Collectors.joining(","));
-                if(cIds.length()>0){
-                    List<Integer> ides = ListUtil.convertIntegerIdsArrayToList(cIds);
-                    companies = companyMapper.selectList(new QueryWrapper<Company>().in("id",ides));
-                }
+                List<Integer> ids = projects.stream().map(Project::getOwnerCompany).collect(Collectors.toList());
+                    ids.add(-1);
+                    companies = companyMapper.selectList(new QueryWrapper<Company>().in("id",ids));
             }
             msg.data = companies;
         }

+ 122 - 15
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldEquipmentServiceImpl.java

@@ -6,22 +6,36 @@ import com.github.pagehelper.PageInfo;
 import com.hssx.cloudmodel.constant.Constant;
 import com.hssx.cloudmodel.entity.Mould;
 import com.hssx.cloudmodel.entity.MouldEquipment;
+import com.hssx.cloudmodel.entity.Part;
 import com.hssx.cloudmodel.entity.User;
 import com.hssx.cloudmodel.entity.vo.MouldEquipmentVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.mapper.MouldEquipmentMapper;
 import com.hssx.cloudmodel.mapper.MouldMapper;
+import com.hssx.cloudmodel.mapper.UserMapper;
 import com.hssx.cloudmodel.service.MouldEquipmentService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.PageUtil;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -37,6 +51,8 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
     MouldEquipmentMapper mouldEquipmentMapper;
     @Resource
     MouldMapper mouldMapper;
+    @Resource
+    UserMapper userMapper;
 
     @Override
     public HttpRespMsg addAndUpdateMouldEquipment(MouldEquipment mouldEquipment, User user) {
@@ -85,12 +101,12 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
     }
 
     @Override
-    public HttpRespMsg getList(User user, PageUtil page,Integer companyId,String keyName) {
+    public HttpRespMsg getList(User user, PageUtil page, Integer companyId, String keyName) {
         HttpRespMsg msg = new HttpRespMsg();
         if (user != null) {
             if (Constant.SYS_PARENT_ID == user.getParentId()) {
                 PageHelper.startPage(page.getPageNum(), page.getPageSize());
-                List<MouldEquipmentVO> mouldEquipments = mouldEquipmentMapper.getList(companyId,keyName);
+                List<MouldEquipmentVO> mouldEquipments = mouldEquipmentMapper.getList(companyId, keyName);
                 PageInfo<MouldEquipmentVO> pageInfo = new PageInfo<>(mouldEquipments);
                 msg.data = pageInfo;
             } else {
@@ -103,21 +119,112 @@ public class MouldEquipmentServiceImpl extends ServiceImpl<MouldEquipmentMapper,
     @Override
     public HttpRespMsg getListByCompanyId(MouldEquipmentVO mouldEquipmentVO) {
         HttpRespMsg msg = new HttpRespMsg();
-        List<Integer> ides = new ArrayList<>();
-        List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("company_id", mouldEquipmentVO.getBelongCompanyId()));
-        if(null == mouldEquipmentVO.getMouldId()){
-            mouldEquipmentVO.setMouldId(-1);
-        }
-        for (Mould mould : moulds) {
-            if(mould.getId() != mouldEquipmentVO.getMouldId()){
-                ides.add(mould.getEquipmentId());
+        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())).stream().map(MouldEquipment::getId).collect(Collectors.toList());
+        equipmentIds.add(-1);
+        equipmentIds.removeAll(mouldsEquipmentIds);//把已经使用的设备剔除
+        List<MouldEquipmentVO> list = mouldEquipmentMapper.getListByCompanyId(mouldEquipmentVO.getBelongCompanyId(), equipmentIds);
+        msg.data = list;
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg MouldEquipmentAlarm() {
+        return null;
+    }
+
+    @Override
+    public HttpRespMsg importMouldEquipmentExcel(MultipartFile file, UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        if (user != null) {
+            List<MouldEquipment> mouldEquipments = mouldEquipmentMapper.selectList(new QueryWrapper<MouldEquipment>());
+            try {
+                File f = null;
+                if ("".equals(file) || file.getSize() <= 0) {
+                    file = null;
+                } else {
+                    //获取输入流
+                    InputStream ins = file.getInputStream();
+                    //新建一个文件
+                    f = new File(file.getOriginalFilename());
+                    //输入流转file
+                    inputStreamToFile(ins, f);
+                }
+                //根据文件创建工作簿
+                XSSFWorkbook wookbook = new XSSFWorkbook(f);
+                XSSFSheet sheet = wookbook.getSheetAt(0);
+                int s = sheet.getLastRowNum();
+                // 遍历当前sheet中的所有行,第一行是数据对应的字段,不是数据,
+                // 故从第二行开始遍历拿数据(如果有标题的话,则从第三行开始拿数据)
+                for (int j = 1; j < sheet.getLastRowNum() + 1; j++) {
+                    XSSFRow row = sheet.getRow(j);
+                    //新建云模盒对象
+                    MouldEquipment mouldEquipment = new MouldEquipment();
+                    // 遍历所有的列,下面的10是excle表格里共有10列即对应了10个字段
+                    for (int y = 0; y < 3; y++) {
+                        XSSFCell cell = row.getCell(y);
+                        cell.setCellType(Cell.CELL_TYPE_STRING);
+                        //取出当前列的值
+                        String value = cell.getStringCellValue();
+                        //判断第几列插入数据,后面就是从列中取数据往对象里放,然后插入到数据库里
+                        if (value == null && "".equals(value)) {
+                            log.error("数据不可为空");
+                            msg.setError("数据不可为空");
+                            return msg;
+                        } else if (y == 0) {
+                            //云模编号
+                            for (MouldEquipment p : mouldEquipments) {
+                                if (value.equals(p.getEquipmentNo())) {
+                                    msg.setError("第" + j + "行的云模盒编号:" + value + "已被占用,请修改后重新上传");
+                                    return msg;
+                                }
+                            }
+                            mouldEquipment.setEquipmentNo(value);
+                        } else if (y == 1) {
+                            //使用年限
+                            mouldEquipment.setUseLife(Integer.parseInt(value));
+                        } else if (y == 2) {
+                            //代理商
+                            mouldEquipment.setAgent(value);
+                        }
+                    }
+                    mouldEquipmentMapper.insert(mouldEquipment);
+                }
+                //用完后删除临时文件
+                if (!f.isDirectory()) {
+                    f.delete();
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                msg.setError(e.getMessage());
+                return msg;
             }
+        } else {
+            msg.setError("用户不存在或者未登录");
         }
-        if (ides.size() == 0) {
-            ides.add(-1);
-        }
-        List<MouldEquipmentVO> list = mouldEquipmentMapper.getListByCompanyId(mouldEquipmentVO.getBelongCompanyId(), ides);
-        msg.data = list;
         return msg;
     }
+
+    /**
+     * 输入流转file
+     *
+     * @param ins
+     * @param file
+     */
+    public static void inputStreamToFile(InputStream ins, File file) {
+        try {
+            OutputStream os = new FileOutputStream(file);
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            ins.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }

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

@@ -458,9 +458,9 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
 //        }else{
             list = mouldFileMapper.selectList(new QueryWrapper<MouldFile>().eq("model_id", mouldId).eq("blong_type", blongType).orderByDesc("id"));
 //        }
-        for (MouldFile mouldFile : list) {
-            mouldFile.setFileUrl(path+mouldFile.getFileUrl().substring("/upload/".length()));
-        }
+//        for (MouldFile mouldFile : list) {
+//            mouldFile.setFileUrl(path+mouldFile.getFileUrl().substring("/upload/".length()));
+//        }
         msg.data = list;
         return msg;
     }
@@ -729,7 +729,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         //mouldFiles为根据前台传过来的信息,通过数据库查询所得出的pdf文件路径集合(具体到后缀),此处省略
         File[] files = new File[mouldFiles.size()];//
         for (int i = 0; i < mouldFiles.size(); i++) {
-            files[i] = new File(oldFilePath + mouldFiles.get(i).getFileUrl().substring(0, oldFilePath.length() - "/upload/".length()));//获取所有需要下载的文件
+            files[i] = new File(mouldFiles.get(i).getFileUrl());//获取所有需要下载的文件
         }
         // 创建临时压缩文件
         try {

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

@@ -408,7 +408,7 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
     public HttpRespMsg delMoule(Mould mould) {
         HttpRespMsg msg = new HttpRespMsg();
         Mould newMould = mouldMapper.selectById(mould.getId());
-        if (null != mould.getProjectId()) {
+        if (null != newMould.getProjectId()) {
             msg.setError("该模具已被应用到项目,不提供删除操作");
         } else {
             mouldMapper.deleteById(newMould.getId());

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

@@ -206,9 +206,9 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
         List<ProjectFile> list = projectFileMapper.selectList(new QueryWrapper<ProjectFile>().eq("project_id", userVO.getProjectId()).orderByDesc("id"));
-        for (ProjectFile projectFile : list) {
-            projectFile.setUrl(path+projectFile.getUrl().substring("/upload/".length()));
-        }
+//        for (ProjectFile projectFile : list) {
+//            projectFile.setUrl(path+projectFile.getUrl().substring("/upload/".length()));
+//        }
         msg.data = list;
         return msg;
     }

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java

@@ -520,6 +520,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             companyId = admin.getCompanyId();
 //            qw.eq("company_id", admin.getCompanyId());
         }
+//        List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("company_id", companyId).isNull("project_id"));
         msg.data = mouldMapper.selectListByCompanyId(companyId);
         return msg;
     }

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

@@ -94,13 +94,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 uIds.add(-1);
                 users = userMapper.selectUserListByCondition(roleType, companyId, flag, keyName, uIds,user);
             } 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);
-                uIds = projectMapper.selectList(new QueryWrapper<Project>().in("id", projectIds)).stream().map(Project::getManagerId).collect(Collectors.toList());
-                List<Integer> projectUserIds = projectUserMapper.selectList(new QueryWrapper<ProjectUser>().in("project_id", projectIds)).stream().map(ProjectUser::getUserId).collect(Collectors.toList());
-                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);
+
+//                List<Integer> projectIds = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>().eq("company_id", user.getCompanyId())).stream().map(CustomCompany::getProjectId).collect(Collectors.toList());
+//                projectIds.add(-1);
+//                uIds = projectMapper.selectList(new QueryWrapper<Project>().in("id", projectIds)).stream().map(Project::getManagerId).collect(Collectors.toList());
+//                List<Integer> projectUserIds = projectUserMapper.selectList(new QueryWrapper<ProjectUser>().in("project_id", projectIds)).stream().map(ProjectUser::getUserId).collect(Collectors.toList());
+//                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);
+                uIds = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId())).stream().map(User::getId).collect(Collectors.toList());
                 uIds.add(-1);
                 users = userMapper.selectUserListByCondition(roleType, companyId, flag, keyName, uIds,user);
                 //去除项目经理自己
@@ -340,7 +342,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 int count = userMapper.selectCount(qw);
                 if (count > 0) {
                     User existingUser = userMapper.selectOne(qw);
-                    if (existingUser.getParentId() == parentUser.getId()) {
+                    List<Integer> uids = userMapper.selectList(new QueryWrapper<User>().eq("parent_id", parentUser.getId())).stream().map(User::getId).collect(Collectors.toList());
+                    Integer countUser = userMapper.selectCount(new QueryWrapper<User>().in("parent_id", uids));
+                    if (existingUser.getParentId() == parentUser.getId()||countUser>0) {
                         msg.setError("该账号已存在,请勿重新创建");
                         return msg;
                     } else {
@@ -429,12 +433,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                     User existingUser = userMapper.selectOne(qw);
                     //查询该账号是否已参与创建项目经理的admin公司下的项目
                     //得到admin公司下的所有项目
-                    List<Project> projects = projectMapper.selectList(new QueryWrapper<Project>().eq("owner_company", managerParent.getCompanyId()));
-                    List<Integer> ids = new ArrayList<>();
+                    List<Integer> ids  = projectMapper.selectList(new QueryWrapper<Project>().eq("owner_company", managerParent.getCompanyId())).stream().map(Project::getId).collect(Collectors.toList());
                     ids.add(-1);
-                    for (Project project : projects) {
-                        ids.add(project.getId());
-                    }
                     List<ProjectUser> projectUsers = projectUserMapper.selectList(new QueryWrapper<ProjectUser>().in("project_id", ids).eq("user_id", existingUser.getId()));
                     if (projectUsers.size() > 0) {
                         msg.setError("该账号已参与本资产方公司下的其他项目,请前往本项目详情添加即可");
@@ -445,7 +445,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                         msg.setError("该账号已参与本资产方公司下的其他项目,请前往本项目详情添加即可");
                         return msg;
                     }
-                    //此时用户已经有了,创建人不是该之前参与过的项目的公司下的项目经理创建,则建立一条合作公司的关系
+                    //此时用户已经有了,创建人不是该之前参与过的项目的公司下的项目经理创建,则建立一条合作公司的关系
                     UserCompany userCompany = new UserCompany();
                     userCompany.setUserId(existingUser.getId());
                     userCompany.setBelongCompanyId(existingUser.getCompanyId());

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

@@ -35,10 +35,10 @@ spring.thymeleaf.prefix=classpath:/static/
 #spring.redis.port=6379
 ######################################################################################################
 # 文件上传路径
-upload.path=E:/staticproject/cloudmodel
+upload.path=E:/staticproject/cloudmodel/upload/
 ######################################################################################################
 # 文件下载路径
-download.path=E:/mould/download/
+download.path=E:/staticproject/cloudmodel/download/
 # 邀请人员链接前缀
 invitation.url.prefix=http://118.190.47.230:9098/#/invite/
 #######################################################################################################

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

@@ -219,7 +219,8 @@ select
         tbco.id = tbm.produce_company_id
         where
           tbm.company_id = #{companyId}
-          AND tbm.pre_update_id = 0
+          AND tbm.equipment_id is not null
+          AND tbm.project_id is null
     </select>
     
     <update id="updateModelProjectIdAndEquipmentIdToNullById">

+ 1 - 1
cloud-model/src/main/resources/mapper/ProjectMapper.xml

@@ -181,7 +181,7 @@
         on
           pu.user_id = u.id
         where
-          pu.project_id = #{id} and pu.role_type != 1
+          pu.project_id = #{id} and pu.role_type IS NULL
     </select>
 
     <resultMap id="BaseResultMapPowerList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">