开发OTA备案工具-导入导出
This commit is contained in:
+3
-2
@@ -233,13 +233,14 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
|
|||||||
// @RequiresPermissions("otaBaCx:importData")
|
// @RequiresPermissions("otaBaCx:importData")
|
||||||
public Result<?> importData(@RequestParam(value = "file", required = false) MultipartFile file,
|
public Result<?> importData(@RequestParam(value = "file", required = false) MultipartFile file,
|
||||||
@RequestParam(value = "cut", required = false) String cut) throws Exception {
|
@RequestParam(value = "cut", required = false) String cut) throws Exception {
|
||||||
|
StringBuilder errMsg = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
this.otaBaSjListService.importData(file, cut);
|
this.otaBaSjListService.importData(file, cut, errMsg);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return Result.error(e.getMessage());
|
return Result.error(e.getMessage());
|
||||||
}
|
}
|
||||||
return Result.OK("导入成功");
|
return Result.error(errMsg.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "升级备案-数据导出")
|
@ApiOperation(value = "升级备案-数据导出")
|
||||||
|
|||||||
+40
-39
@@ -12,64 +12,65 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @Description: 升级备案-用户告知内容及方式
|
* @Description: 升级备案-用户告知内容及方式
|
||||||
* @Author: jero-boot
|
* @Author: jero-boot
|
||||||
* @Date: 2023-03-17
|
* @Date: 2023-03-17
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface IOtaBaSjGgnrfsService extends IService<OtaBaSjGgnrfs> {
|
public interface IOtaBaSjGgnrfsService extends IService<OtaBaSjGgnrfs> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*
|
*
|
||||||
* @param otaBaSjGgnrfs
|
* @param otaBaSjGgnrfs
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void add(OtaBaSjGgnrfs otaBaSjGgnrfs);
|
void add(OtaBaSjGgnrfs otaBaSjGgnrfs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新
|
* 更新
|
||||||
*
|
*
|
||||||
* @param otaBaSjGgnrfs
|
* @param otaBaSjGgnrfs
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void editById(OtaBaSjGgnrfs otaBaSjGgnrfs);
|
void editById(OtaBaSjGgnrfs otaBaSjGgnrfs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void deleteById(String id);
|
void deleteById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void deleteByIds(List<String> ids);
|
void deleteByIds(List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
OtaBaSjGgnrfs queryById(String id);
|
OtaBaSjGgnrfs queryById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OtaBaSjGgnrfs> queryList();
|
List<OtaBaSjGgnrfs> queryList();
|
||||||
|
|
||||||
OtaBaSjGgnrfs queryByOtaId(String otaId, String otaIdT);
|
OtaBaSjGgnrfs queryByOtaId(String otaId, String otaIdT);
|
||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
void importData(MultipartFile file, String otaId, String cut) throws Exception;
|
void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
|
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(File file, File fsAttFile, String otaId, String cut) throws Exception;}
|
void exportData(File file, File fsAttFile, String otaId, String cut) throws Exception;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ public interface IOtaBaSjListService extends IService<OtaBaSjList> {
|
|||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
void importData(MultipartFile file, String cut) throws Exception;
|
void importData(MultipartFile file, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportData(String otaId, HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -69,9 +69,9 @@ public interface IOtaBaSjSjfzbhService extends IService<OtaBaSjSjfzbh> {
|
|||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
void importData(MultipartFile file, String otaId, String cut) throws Exception;
|
void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
|
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(File file, String otaId, String cut) throws Exception;
|
void exportData(File file, String otaId, String cut) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -69,9 +69,9 @@ public interface IOtaBaSjSjmbclService extends IService<OtaBaSjSjmbcl> {
|
|||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
OtaBaSjSjmbcl parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
|
OtaBaSjSjmbcl parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut) throws Exception;
|
OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(File file, File mbclAttFile, String otaId, String cut) throws Exception;
|
void exportData(File file, File mbclAttFile, String otaId, String cut) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -70,9 +70,9 @@ public interface IOtaBaSjSjmbcxService extends IService<OtaBaSjSjmbcx> {
|
|||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut) throws Exception;
|
OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
|
OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(File file, String otaId, String cut) throws Exception;
|
void exportData(File file, String otaId, String cut) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -67,9 +67,9 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
|
|||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
void importData(MultipartFile file, String otaId, String cut) throws Exception;
|
void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
|
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(File file, String otaId, String cut) throws Exception;
|
void exportData(File file, String otaId, String cut) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -69,9 +69,9 @@ public interface IOtaBaSjSjyxpgService extends IService<OtaBaSjSjyxpg> {
|
|||||||
|
|
||||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut) throws Exception;
|
OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception;
|
OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
|
||||||
|
|
||||||
void exportData(File file, File attFile, File attFile2, String otaId, String cut) throws Exception;
|
void exportData(File file, File attFile, File attFile2, String otaId, String cut) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -194,13 +194,13 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importData(MultipartFile file, String otaId, String cut) throws Exception {
|
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception{
|
||||||
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
parseFileList(upLoadFiles, otaId, cut);
|
parseFileList(upLoadFiles, otaId, cut,errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception{
|
||||||
File attFile = null;
|
File attFile = null;
|
||||||
for (File f : upLoadFiles) {
|
for (File f : upLoadFiles) {
|
||||||
if (f.isDirectory() && f.getName().equals("用户告知内容及方式")) {
|
if (f.isDirectory() && f.getName().equals("用户告知内容及方式")) {
|
||||||
@@ -210,11 +210,11 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
|
|||||||
if (null == attFile) {
|
if (null == attFile) {
|
||||||
throw new JeroBootException("请上传正确的文件");
|
throw new JeroBootException("请上传正确的文件");
|
||||||
}
|
}
|
||||||
OtaBaSjGgnrfs fs = parseFile(attFile, otaId, cut);
|
OtaBaSjGgnrfs fs = parseFile(attFile, otaId, cut,errMsg);
|
||||||
add(fs);
|
add(fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OtaBaSjGgnrfs parseFile(File attFile, String otaId, String cut) throws Exception {
|
private OtaBaSjGgnrfs parseFile(File attFile, String otaId, String cut, StringBuilder errMsg) throws Exception{
|
||||||
OtaBaSjGgnrfs fs = new OtaBaSjGgnrfs();
|
OtaBaSjGgnrfs fs = new OtaBaSjGgnrfs();
|
||||||
fs.setOtaId(otaId);
|
fs.setOtaId(otaId);
|
||||||
OtaBaSjSjyxpg pg = otaBaSjSjyxpgService.queryByOtaId(otaId, "");
|
OtaBaSjSjyxpg pg = otaBaSjSjyxpgService.queryByOtaId(otaId, "");
|
||||||
|
|||||||
+8
-8
@@ -168,17 +168,17 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importData(MultipartFile file, String cut) throws Exception {
|
public void importData(MultipartFile file, String cut, StringBuilder errMsg) throws Exception {
|
||||||
List<File> fileList = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> fileList = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.parseFileList(fileList, "", cut);
|
OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.parseFileList(fileList, "", cut, errMsg);
|
||||||
String otaId = mbcx.getOtaId();
|
String otaId = mbcx.getOtaId();
|
||||||
if (StringUtils.isNotEmpty(otaId)) {
|
if (StringUtils.isNotEmpty(otaId)) {
|
||||||
otaBaSjSjmbclService.parseFileList(fileList, otaId, cut);
|
otaBaSjSjmbclService.parseFileList(fileList, otaId, cut, errMsg);
|
||||||
otaBaSjSjmbcxService.parseFileList(fileList, otaId, cut);
|
otaBaSjSjmbcxService.parseFileList(fileList, otaId, cut, errMsg);
|
||||||
otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut);
|
otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut, errMsg);
|
||||||
otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut);
|
otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut, errMsg);
|
||||||
otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut);
|
otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut, errMsg);
|
||||||
otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut);
|
otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut, errMsg);
|
||||||
} else {
|
} else {
|
||||||
throw new JeroBootException("导入失败");
|
throw new JeroBootException("导入失败");
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-5
@@ -204,13 +204,13 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importData(MultipartFile file, String otaId, String cut) throws Exception {
|
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
parseFileList(upLoadFiles, otaId, cut);
|
parseFileList(upLoadFiles, otaId, cut,errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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("本次升级的驾驶辅助功能与参数变化.xlsx")) {
|
||||||
@@ -225,7 +225,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
|
|||||||
if (ObjectUtils.isEmpty(oldList)) {
|
if (ObjectUtils.isEmpty(oldList)) {
|
||||||
oldList = new ArrayList<>();
|
oldList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut);
|
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut,errMsg);
|
||||||
ComparisonUtil cu = new ComparisonUtil();
|
ComparisonUtil cu = new ComparisonUtil();
|
||||||
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
|
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
|
||||||
deleteByOtaId(otaId);
|
deleteByOtaId(otaId);
|
||||||
@@ -233,7 +233,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
|
|||||||
otaBaCxTxjlService.saveBatch(reList);
|
otaBaCxTxjlService.saveBatch(reList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OtaBaSjSjfzbh> parseFile(File upFile, String otaId, String cut) throws Exception {
|
private List<OtaBaSjSjfzbh> parseFile(File upFile, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
List<OtaBaSjSjfzbh> fzbhList = new ArrayList<>();
|
List<OtaBaSjSjfzbh> fzbhList = new ArrayList<>();
|
||||||
Workbook wb = ImportFileUtil.readExcel(upFile);
|
Workbook wb = ImportFileUtil.readExcel(upFile);
|
||||||
@@ -264,6 +264,9 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
|
|||||||
fzbh.setOtaId(otaId);
|
fzbh.setOtaId(otaId);
|
||||||
fzbh.setCreateTime(now);
|
fzbh.setCreateTime(now);
|
||||||
fzbh.setUpdateTime(now);
|
fzbh.setUpdateTime(now);
|
||||||
|
ComparisonUtil cu = new ComparisonUtil();
|
||||||
|
cu.checkError(fzbh, errMsg, sysDictService, cut);
|
||||||
|
|
||||||
fzbhList.add(fzbh);
|
fzbhList.add(fzbh);
|
||||||
}
|
}
|
||||||
return fzbhList;
|
return fzbhList;
|
||||||
|
|||||||
+5
-5
@@ -181,7 +181,7 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjmbcl parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public OtaBaSjSjmbcl parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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("本次升级涉及的目标车辆.xlsx")) {
|
||||||
@@ -191,13 +191,13 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
|
|||||||
if (null == upFile) {
|
if (null == upFile) {
|
||||||
throw new JeroBootException("请上传正确的文件");
|
throw new JeroBootException("请上传正确的文件");
|
||||||
}
|
}
|
||||||
OtaBaSjSjmbcl mbcl = parseFile(upFile, otaId, cut);
|
OtaBaSjSjmbcl mbcl = parseFile(upFile, otaId, cut, errMsg);
|
||||||
mbcl.setOtaId(otaId);
|
mbcl.setOtaId(otaId);
|
||||||
add(mbcl);
|
add(mbcl);
|
||||||
return mbcl;
|
return mbcl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OtaBaSjSjmbcl parseFile(File upFile, String otaId, String cut) throws Exception {
|
private OtaBaSjSjmbcl parseFile(File upFile, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
OtaBaSjSjmbcl mbcl = new OtaBaSjSjmbcl();
|
OtaBaSjSjmbcl mbcl = new OtaBaSjSjmbcl();
|
||||||
OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.queryByOtaId(otaId, "");
|
OtaBaSjSjmbcx mbcx = otaBaSjSjmbcxService.queryByOtaId(otaId, "");
|
||||||
if (ObjectUtils.isNotEmpty(mbcx) && StringUtils.isNotEmpty(mbcx.getCpxh())) {
|
if (ObjectUtils.isNotEmpty(mbcx) && StringUtils.isNotEmpty(mbcx.getCpxh())) {
|
||||||
@@ -269,9 +269,9 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut) throws Exception {
|
public OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
OtaBaSjSjmbcl mbcl = parseFileList(upLoadFiles, otaId, cut);
|
OtaBaSjSjmbcl mbcl = parseFileList(upLoadFiles, otaId, cut, errMsg);
|
||||||
return mbcl;
|
return mbcl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -179,14 +179,14 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut) throws Exception {
|
public OtaBaSjSjmbcx importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
OtaBaSjSjmbcx mbcx = parseFileList(upLoadFiles, otaId, cut);
|
OtaBaSjSjmbcx mbcx = parseFileList(upLoadFiles, otaId, cut, errMsg);
|
||||||
return mbcx;
|
return mbcx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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("升级目标车型.xlsx")) {
|
||||||
@@ -196,13 +196,13 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
|
|||||||
if (null == upFile) {
|
if (null == upFile) {
|
||||||
throw new JeroBootException("请上传正确的文件");
|
throw new JeroBootException("请上传正确的文件");
|
||||||
}
|
}
|
||||||
OtaBaSjSjmbcx mbcx = parseFile(upFile, cut);
|
OtaBaSjSjmbcx mbcx = parseFile(upFile, cut, errMsg);
|
||||||
mbcx.setOtaId(otaId);
|
mbcx.setOtaId(otaId);
|
||||||
add(mbcx);
|
add(mbcx);
|
||||||
return mbcx;
|
return mbcx;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OtaBaSjSjmbcx parseFile(File upFile, String cut) throws Exception {
|
private OtaBaSjSjmbcx parseFile(File upFile, String cut, StringBuilder errMsg) throws Exception {
|
||||||
OtaBaSjSjmbcx mbcx = new OtaBaSjSjmbcx();
|
OtaBaSjSjmbcx mbcx = new OtaBaSjSjmbcx();
|
||||||
Workbook wb = ImportFileUtil.readExcel(upFile);
|
Workbook wb = ImportFileUtil.readExcel(upFile);
|
||||||
Sheet s = wb.getSheetAt(0);
|
Sheet s = wb.getSheetAt(0);
|
||||||
@@ -233,6 +233,8 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
|
|||||||
mbcx.setCpxh(jbxx.getCpxh());
|
mbcx.setCpxh(jbxx.getCpxh());
|
||||||
mbcx.setDllx1(jbxx.getDllx1());
|
mbcx.setDllx1(jbxx.getDllx1());
|
||||||
mbcx.setDllx2(jbxx.getDllx2());
|
mbcx.setDllx2(jbxx.getDllx2());
|
||||||
|
ComparisonUtil cu = new ComparisonUtil();
|
||||||
|
cu.checkError(mbcx, errMsg, sysDictService, cut);
|
||||||
return mbcx;
|
return mbcx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -204,13 +204,13 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importData(MultipartFile file, String otaId, String cut) throws Exception {
|
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception{
|
||||||
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
parseFileList(upLoadFiles, otaId, cut);
|
parseFileList(upLoadFiles, otaId, cut,errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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("本次升级的系统名称与变更参数.xlsx")) {
|
||||||
@@ -221,7 +221,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
|
|||||||
throw new JeroBootException("请上传正确的文件");
|
throw new JeroBootException("请上传正确的文件");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OtaBaSjSjxtbh> newList = parseFile(upFile, otaId, cut);
|
List<OtaBaSjSjxtbh> newList = parseFile(upFile, otaId, cut,errMsg);
|
||||||
List<OtaBaSjSjxtbh> oldList = getByOtaId(otaId);
|
List<OtaBaSjSjxtbh> oldList = getByOtaId(otaId);
|
||||||
if (ObjectUtils.isEmpty(oldList)) {
|
if (ObjectUtils.isEmpty(oldList)) {
|
||||||
oldList = new ArrayList<>();
|
oldList = new ArrayList<>();
|
||||||
@@ -233,7 +233,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
|
|||||||
otaBaCxTxjlService.saveBatch(reList);
|
otaBaCxTxjlService.saveBatch(reList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OtaBaSjSjxtbh> parseFile(File upFile, String otaId, String cut) throws Exception {
|
private List<OtaBaSjSjxtbh> parseFile(File upFile, String otaId, String cut, StringBuilder errMsg) throws Exception{
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
List<OtaBaSjSjxtbh> list = new ArrayList<>();
|
List<OtaBaSjSjxtbh> list = new ArrayList<>();
|
||||||
Workbook wb = ImportFileUtil.readExcel(upFile);
|
Workbook wb = ImportFileUtil.readExcel(upFile);
|
||||||
@@ -271,6 +271,8 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
|
|||||||
xtbh.setSjbdx(ImportFileUtil.getCellValue(cell, wb));
|
xtbh.setSjbdx(ImportFileUtil.getCellValue(cell, wb));
|
||||||
cell = row.getCell(10);
|
cell = row.getCell(10);
|
||||||
xtbh.setSfcfsj(ImportFileUtil.getCellValue(cell, wb));
|
xtbh.setSfcfsj(ImportFileUtil.getCellValue(cell, wb));
|
||||||
|
ComparisonUtil cu = new ComparisonUtil();
|
||||||
|
cu.checkError(xtbh, errMsg, sysDictService, cut);
|
||||||
if (xtbh.isNull()) {
|
if (xtbh.isNull()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -201,13 +201,13 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut) throws Exception {
|
public OtaBaSjSjyxpg importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
|
||||||
OtaBaSjSjyxpg sjyxpg = parseFileList(upLoadFiles, otaId, cut);
|
OtaBaSjSjyxpg sjyxpg = parseFileList(upLoadFiles, otaId, cut, errMsg);
|
||||||
return sjyxpg;
|
return sjyxpg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OtaBaSjSjyxpg parseFile(File upFile, File attFile1, File attFile2, String cut) throws Exception {
|
private OtaBaSjSjyxpg parseFile(File upFile, File attFile1, File attFile2, String cut, StringBuilder errMsg) throws Exception {
|
||||||
OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg();
|
OtaBaSjSjyxpg sjyxpg = new OtaBaSjSjyxpg();
|
||||||
InputStream is = new FileInputStream(upFile);
|
InputStream is = new FileInputStream(upFile);
|
||||||
XWPFDocument doc = new XWPFDocument(is);
|
XWPFDocument doc = new XWPFDocument(is);
|
||||||
@@ -253,7 +253,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut) throws Exception {
|
public OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception {
|
||||||
File upFile = null;
|
File upFile = null;
|
||||||
File attFile = null;
|
File attFile = null;
|
||||||
File attFile1 = null;
|
File attFile1 = null;
|
||||||
@@ -284,7 +284,7 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OtaBaSjSjyxpg sjyxpg = parseFile(upFile, attFile1, attFile2, cut);
|
OtaBaSjSjyxpg sjyxpg = parseFile(upFile, attFile1, attFile2, cut, errMsg);
|
||||||
sjyxpg.setOtaId(otaId);
|
sjyxpg.setOtaId(otaId);
|
||||||
add(sjyxpg);
|
add(sjyxpg);
|
||||||
return sjyxpg;
|
return sjyxpg;
|
||||||
|
|||||||
Reference in New Issue
Block a user