| | |
| | | //源码上传 |
| | | public Response uploadCode(MultipartFile file, String fileNames) throws IOException { |
| | | String[] nameList=fileNames.split(","); |
| | | String fileName = file.getOriginalFilename(); |
| | | String codeName = file.getOriginalFilename(); |
| | | Date date = new Date(); |
| | | String dateUnion = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date); |
| | | //存储路径 |
| | |
| | | if(!softwareDirFile.exists()){ |
| | | softwareDirFile.mkdirs(); |
| | | } |
| | | String codeUrl=softcodeDir+File.separator+fileName; |
| | | String codeUrl=softcodeDir+File.separator+codeName; |
| | | file.transferTo(new File(codeUrl)); |
| | | if(nameList.length>0){ |
| | | for(String name:nameList){ |
| | | Softcode softcode=new Softcode(); |
| | | softcode.setFileName(name); |
| | | softcode.setCreateTime(new Date()); |
| | | softcode.setCodeUrl(softcodeHttpUrl+File.separator+fileName); |
| | | softcode.setCodeUrl(softcodeHttpUrl+File.separator+codeName); |
| | | softcode.setCodeName(codeName.substring(0,codeName.lastIndexOf("."))); |
| | | //判断是否存在源码,存在修改,不存在添加 |
| | | if(mapper.selectOne(new QueryWrapper<Softcode>().eq("file_name",name))!=null){ |
| | | mapper.update(softcode,new UpdateWrapper<Softcode>().eq("file_name",name)); |