whycxzp
2022-09-21 386249a71cdfab885ece64c0442fe366ac661392
src/main/java/com/whyc/service/SoftwareService.java
@@ -9,7 +9,6 @@
import com.whyc.dto.FileDirPath;
import com.whyc.dto.Response;
import com.whyc.mapper.SoftwareMapper;
import com.whyc.pojo.AttachLock;
import com.whyc.pojo.DocUser;
import com.whyc.pojo.Software;
import com.whyc.util.ActionUtil;
@@ -101,7 +100,21 @@
            //取第3列,第5列
            Cell cell = sheet.getRow(8 + i).getCell(2);
            cell.setCellType(Cell.CELL_TYPE_STRING);
            software.setApplyMaterialCode(cell.getStringCellValue());
            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");
                }
                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());
            softwareList.add(software);
@@ -163,7 +176,7 @@
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
    }
    public Response upload(MultipartFile file1, MultipartFile file2, List<Software> softwareList) throws IOException {
    public Response upload(MultipartFile file1, MultipartFile file2, String fontUpdateTime, List<Software> softwareList) throws IOException {
        String file1Name = file1.getOriginalFilename();
        String file2Name = file2.getOriginalFilename();
        Software software = softwareList.get(0);
@@ -191,6 +204,7 @@
        file2.transferTo(new File(softwareDir+File.separator+file2Name));
        //设置路径
        for (Software software1:softwareList){
            software1.setFontUpdateTime(fontUpdateTime);
            software1.setFileUrl(softwareHttpUrl+File.separator+file1Name);
            software1.setExcelUrl(softwareHttpUrl+File.separator+file2Name);
            software1.setCreateTime(date);