| | |
| | | import com.whyc.dto.FileDirPath; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.SoftwareMapper; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.Software; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | //记录日志 |
| | | DocUser docUser= ActionUtil.getUser(); |
| | | String operationDetail="具体软件名称为:"+software.getFileName(); |
| | | String opreationMsg="执行了软件下载操作"; |
| | | String terminalIp=req.getRemoteAddr(); |
| | | logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail); |
| | | logService.recordOperationLogDownLoad(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_SOFWARE.getType(),new Date(),req.getRemoteAddr() |
| | | ,filename,fileDirName+File.separator+software.getFileUrl(),"",String.valueOf(id),software.getVersion()); |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | public Response upload(MultipartFile file1, MultipartFile file2, String fontUpdateTime, List<Software> softwareList) throws IOException { |
| | | String userName = ActionUtil.getUser().getName(); |
| | | String file1Name = file1.getOriginalFilename(); |
| | | String file2Name = file2.getOriginalFilename(); |
| | | Software software = softwareList.get(0); |
| | |
| | | } |
| | | Date date = new Date(); |
| | | String dateUnion = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date); |
| | | //文件重命名(暂不需要,严格遵守名称规则的情况下不会重名) |
| | | //file1Name = file1Name.substring(0,file1Name.lastIndexOf(".")) + "_" + dateUnion +file1Name.substring(file1Name.lastIndexOf(".")); |
| | | //file2Name = file2Name.substring(0,file2Name.lastIndexOf(".")) + "_" + dateUnion +file2Name.substring(file2Name.lastIndexOf(".")); |
| | | //文件重命名(严格遵守名称规则的情况下不会重名) |
| | | file1Name = file1Name.substring(0,file1Name.lastIndexOf(".")) + "_" + dateUnion +file1Name.substring(file1Name.lastIndexOf(".")); |
| | | file2Name = file2Name.substring(0,file2Name.lastIndexOf(".")) + "_" + dateUnion +file2Name.substring(file2Name.lastIndexOf(".")); |
| | | //存储路径 |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | String softwareDir = rootFile + "software" + File.separator + software.getOwner()+ File.separator + software.getFileName(); |
| | |
| | | software1.setFileUrl(softwareHttpUrl+File.separator+file1Name); |
| | | software1.setExcelUrl(softwareHttpUrl+File.separator+file2Name); |
| | | software1.setCreateTime(date); |
| | | software1.setUploadUser(userName); |
| | | //锁定-专供测试人员才能解锁 |
| | | software1.setLockFlag(-1); |
| | | } |
| | |
| | | UpdateWrapper<Software> update = Wrappers.update(); |
| | | update.eq("file_name",softwareDB.getFileName()); |
| | | mapper.delete(update); |
| | | String fontUpdateTime = softwareDB.getFontUpdateTime(); |
| | | softwareList.forEach(software2 -> { |
| | | software2.setFileUrl(softwareDB.getFileUrl()); |
| | | software2.setExcelUrl(softwareHttpUrl + File.separator + originalFilename); |
| | | software2.setCreateTime(new Date()); |
| | | software2.setLockFlag(-1); |
| | | software2.setFontUpdateTime(fontUpdateTime); |
| | | }); |
| | | mapper.insertBatchSomeColumn(softwareList); |
| | | |
| | |
| | | * 根据软件唯一值字段修改软件锁定状态,这里选取fileUrl |
| | | * |
| | | * @param fileUrl |
| | | * @param lockFlagNow |
| | | * @param lockFlag |
| | | * @param localReason |
| | | * @return |
| | | */ |
| | | public Response updateSoftwareLock(String fileUrl,int lockFlag,String localReason) { |
| | | public Response updateSoftwareLock(String fileUrl, int lockFlagNow, int lockFlag, String localReason) { |
| | | String userName = ActionUtil.getUser().getName(); |
| | | if(lockFlag ==0){ |
| | | //只有李桂华才能解锁 待测试锁定的软件 |
| | |
| | | uwrapper.set("lock_flag",lockFlag); |
| | | uwrapper.set("local_reason",localReason); |
| | | uwrapper.eq("file_url",fileUrl); |
| | | uwrapper.eq("lock_flag",lockFlagNow); |
| | | int flag=mapper.update(null,uwrapper); |
| | | return new Response().set(1,flag>0,"锁定/解锁成功"); |
| | | } |
| | | |
| | | //根据软件名称实现软件删除 |
| | | public Response deleteSoftware(String fileName,String version) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("file_name",fileName); |
| | | wrapper.eq("version",version); |
| | | int flag=mapper.delete(wrapper); |
| | | return new Response().set(1,flag>0,"件id实现软件删除"); |
| | | } |
| | | } |