开发OTA备案工具-车辆升级
This commit is contained in:
+24
-2
@@ -14,11 +14,17 @@ import com.jero.modules.ota.utils.ImportFileUtil;
|
|||||||
import com.jero.modules.system.service.ISysDictService;
|
import com.jero.modules.system.service.ISysDictService;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
||||||
|
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -177,8 +183,24 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
|||||||
return sjyxpg;
|
return sjyxpg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OtaBaSjSjyxpg parseFile(File upFile, String cut) {
|
private OtaBaSjSjyxpg parseFile(File upFile, String cut) throws Exception {
|
||||||
OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg();
|
OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg();
|
||||||
|
InputStream is = new FileInputStream(upFile);
|
||||||
|
XWPFDocument doc = new XWPFDocument(is);
|
||||||
|
List<XWPFTable> tables = doc.getTables();
|
||||||
|
String sjmdStr = tables.get(1).getRow(0).getCell(2).getText();
|
||||||
|
if (StringUtils.isNotEmpty(sjmdStr)) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String[] strs = sjmdStr.split("、");
|
||||||
|
for (int i = 0; i < strs.length; i++) {
|
||||||
|
if (i >= strs.length - 1) {
|
||||||
|
sb.append(sysDictService.queryDictItemByValue("uipgrade_purpose", strs[i], cut));
|
||||||
|
} else {
|
||||||
|
sb.append(sysDictService.queryDictItemByValue("uipgrade_purpose", strs[i], cut)).append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sjyxpg.setSjmd(sb.toString());
|
||||||
|
}
|
||||||
return sjyxpg;
|
return sjyxpg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +208,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
|||||||
public OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
||||||
File upFile = null;
|
File upFile = null;
|
||||||
for (File f : upLoadFiles) {
|
for (File f : upLoadFiles) {
|
||||||
if (f.getName().equals("车型基本信息.xlsx")) {
|
if (f.getName().equals("升级影响评估.docx")) {
|
||||||
upFile = f;
|
upFile = f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user