소스 검색

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 년 전
부모
커밋
1467516f51

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

@@ -138,5 +138,16 @@ public class MouldController {
         HttpRespMsg msg = mouldService.isMaintain(mould);
         return msg;
     }
+    /**
+     * 需要保养的模具列表
+     * 参数 token 用户凭证
+     */
+    @ApiOperation("模具保养提醒")
+    @RequestMapping("/maintainMouldList")
+    @ResponseBody
+    public HttpRespMsg maintainMouldList(UserVO userVO) throws Exception {
+        HttpRespMsg msg = mouldService.maintainMouldList(userVO);
+        return msg;
+    }
 }
 

+ 3 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/MouldService.java

@@ -4,6 +4,7 @@ import com.hssx.cloudmodel.entity.Mould;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.hssx.cloudmodel.entity.User;
 import com.hssx.cloudmodel.entity.vo.MouldVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 
 /**
@@ -25,4 +26,6 @@ public interface MouldService extends IService<Mould> {
     HttpRespMsg delMoule(Mould mould);
 
     HttpRespMsg isMaintain(Mould mould);
+
+    HttpRespMsg maintainMouldList(UserVO userVO);
 }

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

@@ -160,30 +160,30 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                     mouldOperationDynamicsMapper.insert(dynamics);
                     //添加消息通知记录
                     Mould mould = mouldMapper.selectById(userVO.getMouldId());
-                    if(mould.getProjectId() != null){
+                    if (mould.getProjectId() != null) {
                         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 = "";
+                        String content = "";
                         for (ProjectApprove projectApprove : projectApproves) {
                             NewsNotice newsNotice = new NewsNotice();
                             newsNotice.setRefId(projectFile.getId());
                             newsNotice.setProjectId(project.getId());
                             newsNotice.setProjectName(project.getProjectName());
                             newsNotice.setNoticeType(Constant.APPROVEL_TYPE);
-                            if(blongType == 0){
+                            if (blongType == 0) {
                                 content = "模具文档";
-                            }else if(blongType==1){
+                            } else if (blongType == 1) {
                                 content = "零件文档";
-                            }else if(blongType==2){
+                            } else if (blongType == 2) {
                                 content = "试模验收文档";
-                            }else if(blongType==3){
+                            } else if (blongType == 3) {
                                 content = "保养方案文档";
-                            }else if(blongType==4){
+                            } else if (blongType == 4) {
                                 content = "模具更新文档";
-                            }else if(blongType==5){
+                            } else if (blongType == 5) {
                                 content = "模具报废文档";
                             }
-                            newsNotice.setContent("有新的"+content+",待您审批。");
+                            newsNotice.setContent("有新的" + content + ",待您审批。");
                             newsNoticeMapper.insert(newsNotice);
                             NewsNoticeUser newsNoticeUser = new NewsNoticeUser();
                             newsNoticeUser.setUserId(user.getId());
@@ -365,73 +365,74 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     @Override
     public HttpRespMsg addPartFile(UserVO userVO, String path, MultipartFile[] files) {
         HttpRespMsg msg = new HttpRespMsg();
-        System.out.println("files==============="+files);
-        System.out.println("files==============="+files.length);
+        System.out.println("files===============" + files);
+        System.out.println("files===============" + files.length);
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
         System.out.println("进来了");
         if (user != null) {
             List<Part> partLists = partMapper.selectList(new QueryWrapper<Part>().eq("mould_id", userVO.getMouldId()));
-            System.out.println("partLists"+partLists);
-                for (MultipartFile file : files) {
-                    MouldFile partFile = new MouldFile();
-                    partFile.setModelId(userVO.getMouldId());
-                    partFile.setBlongType(1);
-                    File dir = null;
-                    dir = new File(path);
-                    // D://cloud/upload 文件上传后所存储的位置,部署到服务器上时配置服务器地址即可
-                    if (!dir.exists()) {
-                        dir.mkdirs();
-                    }
-                    String fileName = "";
-                    System.out.println(file);
-                    //if (file != null && !file.isEmpty()) {
-                        fileName = file.getOriginalFilename();
-                        String fileNamePrex = fileName.substring(0, fileName.lastIndexOf("."));
-                        String[] split = fileNamePrex.split("\\+");
-                        System.out.println("split"+split);
-                        for (Part part : partLists) {
-                            if (split[0] == part.getPartNo()) {
-                                partFile.setPartId(part.getId());
-                            }
-                            if (Constant.PART_FILE_2D.equals(split[1])) {
-                                partFile.setDwgType(0);
-                            }
-                            if (Constant.PART_FILE_3D.equals(split[1])) {
-                                partFile.setDwgType(1);
-                            }
+            System.out.println("partLists" + partLists);
+            for (MultipartFile file : files) {
+                MouldFile partFile = new MouldFile();
+                partFile.setModelId(userVO.getMouldId());
+                partFile.setBlongType(1);
+                File dir = null;
+                dir = new File(path);
+                // D://cloud/upload 文件上传后所存储的位置,部署到服务器上时配置服务器地址即可
+                if (!dir.exists()) {
+                    dir.mkdirs();
+                }
+                String fileName = "";
+                if (!file.isEmpty()) {
+                    fileName = file.getOriginalFilename();
+                    String fileNamePrex = fileName.substring(0, fileName.lastIndexOf("."));
+                    String[] split = fileNamePrex.split("\\+");
+                    System.out.println("split" + split);
+                    for (Part part : partLists) {
+                        if (split[0] == part.getPartNo()) {
+                            partFile.setPartId(part.getId());
                         }
-                        partFile.setFileName(fileName);
-                        partFile.setFileSize(FileUtil.getReadableFileSize(file.getSize()));
-                        System.out.println("上传文件名称" + file.getName() + ", dir = " + dir.getAbsolutePath());
-                        int pos = fileName.lastIndexOf(".");
-                        String rand = UUID.randomUUID().toString().replaceAll("-", "");
-                        String sufix = fileName.substring(pos);
-                        fileName = rand + sufix;
-                        partFile.setFileType(sufix);//文件后缀
-                        partFile.setFileUrl("/upload/" + fileName);
-                        File saveFile = new File(dir, fileName);
-                        mouldFileMapper.insert(partFile);
-                        try {
-                            saveFile.createNewFile();
-                            file.transferTo(saveFile);
-                        } catch (IOException e) {
-                            e.printStackTrace();
-                            partFile = null;
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                            partFile = null;
+                        if (Constant.PART_FILE_2D.equals(split[1])) {
+                            partFile.setDwgType(0);
+                        }
+                        if (Constant.PART_FILE_3D.equals(split[1])) {
+                            partFile.setDwgType(1);
                         }
-                        //添加上传记录
-                        MouldOperationDynamics dynamics = new MouldOperationDynamics();
-                        dynamics.setContent(Constant.UPLOAD);
-                        dynamics.setFileName(file.getOriginalFilename());
-                        dynamics.setOperatorId(user.getId());
-                        dynamics.setOperatorName(user.getUsername());
-                        dynamics.setMouldId(userVO.getMouldId());
-                        mouldOperationDynamicsMapper.insert(dynamics);
-                    //}
-                    msg.data = partFile;
+                    }
+                    partFile.setFileName(fileName);
+                    partFile.setFileSize(FileUtil.getReadableFileSize(file.getSize()));
+                    System.out.println("上传文件名称" + file.getName() + ", dir = " + dir.getAbsolutePath());
+                    int pos = fileName.lastIndexOf(".");
+                    String rand = UUID.randomUUID().toString().replaceAll("-", "");
+                    String sufix = fileName.substring(pos);
+                    fileName = rand + sufix;
+                    partFile.setFileType(sufix);//文件后缀
+                    partFile.setFileUrl("/upload/" + fileName);
+                    partFile.setUplodtorId(user.getId());
+                    partFile.setUploadtor(user.getUsername());
+                    File saveFile = new File(dir, fileName);
+                    mouldFileMapper.insert(partFile);
+                    try {
+                        saveFile.createNewFile();
+                        file.transferTo(saveFile);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                        partFile = null;
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                        partFile = null;
+                    }
+                    //添加上传记录
+                    MouldOperationDynamics dynamics = new MouldOperationDynamics();
+                    dynamics.setContent(Constant.UPLOAD);
+                    dynamics.setFileName(file.getOriginalFilename());
+                    dynamics.setOperatorId(user.getId());
+                    dynamics.setOperatorName(user.getUsername());
+                    dynamics.setMouldId(userVO.getMouldId());
+                    mouldOperationDynamicsMapper.insert(dynamics);
                 }
+                msg.data = partFile;
+            }
         } else {
             msg.setError("用户不存在或者未登录");
         }

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

@@ -59,7 +59,7 @@ public class MouldMaintainServiceImpl extends ServiceImpl<MouldMaintainMapper, M
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
         //将之前的所有保养提醒消息更新成已读
         if (user != null) {
-            if (file != null && !file.isEmpty()) {
+            if (!file.isEmpty()) {
                 File dir = null;
                 dir = new File(path);
                 // D://cloud/upload 文件上传后所存储的位置,部署到服务器上时配置服务器地址即可
@@ -84,6 +84,11 @@ public class MouldMaintainServiceImpl extends ServiceImpl<MouldMaintainMapper, M
                     }
                     File saveFile = new File(dir, fileName);
                     mouldMaintainMapper.insert(mouldMaintain);
+                    //将模具修改为不需要保养状态
+                    Mould m = new Mould();
+                    m.setId(mouldMaintain.getMouldId());
+                    m.setIsMaintain(0);
+                    mouldMapper.updateById(m);
                     try {
                         saveFile.createNewFile();
                         file.transferTo(saveFile);

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

@@ -8,6 +8,7 @@ import com.hssx.cloudmodel.entity.*;
 import com.hssx.cloudmodel.entity.vo.MouldEquipmentVO;
 import com.hssx.cloudmodel.entity.vo.MouldVO;
 import com.hssx.cloudmodel.entity.vo.ProjectVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.mapper.*;
 import com.hssx.cloudmodel.service.MouldService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -261,6 +262,11 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
         return msg;
     }
 
+    @Override
+    public HttpRespMsg maintainMouldList(UserVO userVO) {
+        return null;
+    }
+
     //告警模板推送通用接口
 
     /**