| | |
| | | Cell cell = sheet.getRow(8 + i).getCell(2); |
| | | cell.setCellType(Cell.CELL_TYPE_STRING); |
| | | String stringCellValue = cell.getStringCellValue(); |
| | | int length = stringCellValue.length(); |
| | | if(length == 9){ |
| | | stringCellValue = "0"+stringCellValue; |
| | | }else if(length < 9){ |
| | | int centerZeroNum = 10 - length -1; |
| | | StringBuilder centerZeroStr = new StringBuilder(); |
| | | for (int j = 0; j < centerZeroNum; j++) { |
| | | centerZeroStr.append("0"); |
| | | if(!stringCellValue.equals("")) { |
| | | int length = stringCellValue.length(); |
| | | if (length == 9) { |
| | | stringCellValue = "0" + stringCellValue; |
| | | } else if (length < 9) { |
| | | int centerZeroNum = 10 - length - 1; |
| | | StringBuilder centerZeroStr = new StringBuilder(); |
| | | for (int j = 0; j < centerZeroNum; j++) { |
| | | centerZeroStr.append("0"); |
| | | } |
| | | String strFront = stringCellValue.substring(0, 3); |
| | | String strBehind = stringCellValue.substring(3); |
| | | stringCellValue = "0" + strFront + centerZeroStr + strBehind; |
| | | } |
| | | String strFront = stringCellValue.substring(0, 3); |
| | | String strBehind = stringCellValue.substring(3); |
| | | stringCellValue = "0"+strFront+centerZeroStr+strBehind; |
| | | } |
| | | software.setApplyMaterialCode(stringCellValue); |
| | | software.setApplyModel(sheet.getRow(8+i).getCell(4).getStringCellValue()); |
| | |
| | | wrapper.eq("id",id); |
| | | wrapper.last("limit 1"); |
| | | Software software=mapper.selectOne(wrapper); |
| | | |
| | | String filename=software.getFileUrl().substring(software.getFileUrl().lastIndexOf("\\")+1); |
| | | try { |
| | | // 转码防止乱码 |
| | | //resp.addHeader("Content-Disposition", "attachment;filename=" + new String(softwareName.getBytes("UTF-8"), "ISO8859-1")); |
| | | resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode ( software.getFileName()+".zip", "utf-8")); |
| | | resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode (filename, "utf-8")); |
| | | OutputStream out = resp.getOutputStream(); |
| | | FileInputStream in = new FileInputStream(fileDirName+File.separator+software.getFileUrl()); |
| | | int len=0; |
| | |
| | | logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail); |
| | | } |
| | | |
| | | @Transactional |
| | | public Response upload(MultipartFile file1, MultipartFile file2, String fontUpdateTime, List<Software> softwareList) throws IOException { |
| | | String file1Name = file1.getOriginalFilename(); |
| | | String file2Name = file2.getOriginalFilename(); |
| | |
| | | software1.setExcelUrl(softwareHttpUrl+File.separator+file2Name); |
| | | software1.setCreateTime(date); |
| | | } |
| | | //锁定原来的所有版本:根据版号和软件类型 |
| | | List<String> materialCodeList = softwareList.stream().map(Software::getApplyMaterialCode).collect(Collectors.toList()); |
| | | lockByBoardNumberAndTypeAndMaterialCode(software.getBoardNumber(),software.getType(),materialCodeList); |
| | | //写入数据库 |
| | | insertBatch(softwareList); |
| | | return new Response().set(1,true,"上传完成"); |
| | | } |
| | | |
| | | private void lockByBoardNumberAndTypeAndMaterialCode(String boardNumber, String type, List<String> materialCodeList) { |
| | | UpdateWrapper<Software> update = Wrappers.update(); |
| | | update.set("lock_flag",1) |
| | | .set("local_reason","软件版本升级") |
| | | .eq("board_number",boardNumber) |
| | | .eq("type",type) |
| | | .in("apply_material_code",materialCodeList); |
| | | mapper.update(null,update); |
| | | } |
| | | |
| | | private Software getByFilename(String fileName) { |
| | |
| | | int flag=mapper.update(null,uwrapper); |
| | | return new Response().set(1,flag>0,"锁定/解锁成功"); |
| | | } |
| | | |
| | | } |