开发OTA备案工具-导入导出
This commit is contained in:
+5
-3
@@ -194,14 +194,16 @@ public class OtaBaCxJbxxController extends JeroController<OtaBaCxJbxx, IOtaBaCxJ
|
||||
@PostMapping(value = "/importData")
|
||||
// @RequiresPermissions("otaBaCx:importData")
|
||||
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,
|
||||
@RequestParam(value = "otaId", required = false) String otaId) throws Exception {
|
||||
OtaBaCxJbxx res;
|
||||
try {
|
||||
this.otaBaCxJbxxService.importData(file, cut);
|
||||
res = this.otaBaCxJbxxService.importData(file, otaId, cut);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("导入成功");
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+37
-37
@@ -11,61 +11,61 @@ import java.util.List;
|
||||
/**
|
||||
* @Description: 车型备案-车型基本信息
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-03-17
|
||||
* @Date: 2023-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IOtaBaCxJbxxService extends IService<OtaBaCxJbxx> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param otaBaCxJbxx
|
||||
* @return
|
||||
*/
|
||||
OtaBaCxJbxx add(OtaBaCxJbxx otaBaCxJbxx);
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param otaBaCxJbxx
|
||||
* @return
|
||||
*/
|
||||
OtaBaCxJbxx add(OtaBaCxJbxx otaBaCxJbxx);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaCxJbxx
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param otaBaCxJbxx
|
||||
* @return
|
||||
*/
|
||||
void editById(OtaBaCxJbxx otaBaCxJbxx);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
OtaBaCxJbxx queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OtaBaCxJbxx> queryList();
|
||||
|
||||
OtaBaCxJbxx queryByOtaId(String otaId, String otaIdT);
|
||||
|
||||
void exportTemplate(HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
void importData(MultipartFile file, String cut);
|
||||
OtaBaCxJbxx importData(MultipartFile file, String otaId, String cut);
|
||||
}
|
||||
|
||||
+4
-3
@@ -166,10 +166,11 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importData(MultipartFile file, String cut) {
|
||||
public OtaBaCxJbxx importData(MultipartFile file, String otaId, String cut) {
|
||||
File upLoadFile = ImportFileUtil.importFile(file, cut, uploadPath, "xlsx");
|
||||
OtaBaCxJbxx jbxx = parseFile(upLoadFile, cut);
|
||||
add(jbxx);
|
||||
jbxx.setOtaId(otaId);
|
||||
return add(jbxx);
|
||||
}
|
||||
|
||||
public static String getCellValue(Cell cell, Workbook workbook) {
|
||||
@@ -220,7 +221,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
|
||||
row = s.getRow(11);
|
||||
cell = row.getCell(1);
|
||||
jbxx.setCdotasj(getCellValue(cell, wb));
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jbxx;
|
||||
|
||||
Reference in New Issue
Block a user