|
@@ -160,30 +160,30 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
|
|
mouldOperationDynamicsMapper.insert(dynamics);
|
|
mouldOperationDynamicsMapper.insert(dynamics);
|
|
//添加消息通知记录
|
|
//添加消息通知记录
|
|
Mould mould = mouldMapper.selectById(userVO.getMouldId());
|
|
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()));
|
|
Project project = projectMapper.selectOne(new QueryWrapper<Project>().eq("id", mould.getProjectId()));
|
|
List<ProjectApprove> projectApproves = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("project_id", project.getId()));
|
|
List<ProjectApprove> projectApproves = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("project_id", project.getId()));
|
|
- String content = "";
|
|
|
|
|
|
+ String content = "";
|
|
for (ProjectApprove projectApprove : projectApproves) {
|
|
for (ProjectApprove projectApprove : projectApproves) {
|
|
NewsNotice newsNotice = new NewsNotice();
|
|
NewsNotice newsNotice = new NewsNotice();
|
|
newsNotice.setRefId(projectFile.getId());
|
|
newsNotice.setRefId(projectFile.getId());
|
|
newsNotice.setProjectId(project.getId());
|
|
newsNotice.setProjectId(project.getId());
|
|
newsNotice.setProjectName(project.getProjectName());
|
|
newsNotice.setProjectName(project.getProjectName());
|
|
newsNotice.setNoticeType(Constant.APPROVEL_TYPE);
|
|
newsNotice.setNoticeType(Constant.APPROVEL_TYPE);
|
|
- if(blongType == 0){
|
|
|
|
|
|
+ if (blongType == 0) {
|
|
content = "模具文档";
|
|
content = "模具文档";
|
|
- }else if(blongType==1){
|
|
|
|
|
|
+ } else if (blongType == 1) {
|
|
content = "零件文档";
|
|
content = "零件文档";
|
|
- }else if(blongType==2){
|
|
|
|
|
|
+ } else if (blongType == 2) {
|
|
content = "试模验收文档";
|
|
content = "试模验收文档";
|
|
- }else if(blongType==3){
|
|
|
|
|
|
+ } else if (blongType == 3) {
|
|
content = "保养方案文档";
|
|
content = "保养方案文档";
|
|
- }else if(blongType==4){
|
|
|
|
|
|
+ } else if (blongType == 4) {
|
|
content = "模具更新文档";
|
|
content = "模具更新文档";
|
|
- }else if(blongType==5){
|
|
|
|
|
|
+ } else if (blongType == 5) {
|
|
content = "模具报废文档";
|
|
content = "模具报废文档";
|
|
}
|
|
}
|
|
- newsNotice.setContent("有新的"+content+",待您审批。");
|
|
|
|
|
|
+ newsNotice.setContent("有新的" + content + ",待您审批。");
|
|
newsNoticeMapper.insert(newsNotice);
|
|
newsNoticeMapper.insert(newsNotice);
|
|
NewsNoticeUser newsNoticeUser = new NewsNoticeUser();
|
|
NewsNoticeUser newsNoticeUser = new NewsNoticeUser();
|
|
newsNoticeUser.setUserId(user.getId());
|
|
newsNoticeUser.setUserId(user.getId());
|
|
@@ -365,73 +365,74 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg addPartFile(UserVO userVO, String path, MultipartFile[] files) {
|
|
public HttpRespMsg addPartFile(UserVO userVO, String path, MultipartFile[] files) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
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()));
|
|
User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
|
|
System.out.println("进来了");
|
|
System.out.println("进来了");
|
|
if (user != null) {
|
|
if (user != null) {
|
|
List<Part> partLists = partMapper.selectList(new QueryWrapper<Part>().eq("mould_id", userVO.getMouldId()));
|
|
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 {
|
|
} else {
|
|
msg.setError("用户不存在或者未登录");
|
|
msg.setError("用户不存在或者未登录");
|
|
}
|
|
}
|