| | |
| | | |
| | | |
| | | //源码上传 |
| | | public Response uploadCode(MultipartFile file, String softIds) throws IOException { |
| | | String[] softList=softIds.split(","); |
| | | public Response uploadCode(MultipartFile file, String fileNames) throws IOException { |
| | | String[] nameList=fileNames.split(","); |
| | | String fileName = file.getOriginalFilename(); |
| | | Date date = new Date(); |
| | | String dateUnion = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date); |
| | |
| | | } |
| | | String codeUrl=softcodeDir+File.separator+fileName; |
| | | file.transferTo(new File(codeUrl)); |
| | | if(softList.length>0){ |
| | | for(String softId:softList){ |
| | | if(nameList.length>0){ |
| | | for(String name:nameList){ |
| | | Softcode softcode=new Softcode(); |
| | | softcode.setSoftId(softId); |
| | | softcode.setFileName(name); |
| | | softcode.setCodeUrl(softcodeHttpUrl+File.separator+fileName); |
| | | //判断是否存在源码,存在修改,不存在添加 |
| | | if(mapper.selectOne(new QueryWrapper<Softcode>().eq("soft_id",softId))!=null){ |
| | | mapper.update(softcode,new UpdateWrapper<Softcode>().eq("soft_id",softId)); |
| | | if(mapper.selectOne(new QueryWrapper<Softcode>().eq("file_name",name))!=null){ |
| | | mapper.update(softcode,new UpdateWrapper<Softcode>().eq("file_name",name)); |
| | | }else{ |
| | | mapper.insert(softcode); |
| | | } |
| | |
| | | |
| | | |
| | | //根据软件id实现源码下载 |
| | | public void downLoadCode(HttpServletRequest req, HttpServletResponse resp, String softId) { |
| | | public void downLoadCode(HttpServletRequest req, HttpServletResponse resp, String fileName) { |
| | | String fileDirName = FileDirPath.getFileDirName(); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("soft_id",softId); |
| | | wrapper.eq("file_name",fileName); |
| | | wrapper.last("limit 1"); |
| | | Softcode softcode=mapper.selectOne(wrapper); |
| | | |
| | |
| | | } |
| | | //记录日志 |
| | | logService.recordOperationLogDownLoad(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_SOFWARE.getType(),new Date(),req.getRemoteAddr() |
| | | ,filename,fileDirName+File.separator+softcode.getCodeUrl(),"",String.valueOf(softId),""); |
| | | ,filename,fileDirName+File.separator+softcode.getCodeUrl(),"",fileName,""); |
| | | } |
| | | } |