Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH

This commit is contained in:
wangzhijiang
2023-04-14 09:23:54 +08:00
31 changed files with 196 additions and 89 deletions
@@ -214,7 +214,11 @@ public class OtaBaCxAqcsController extends JeroController<OtaBaCxAqcs, IOtaBaCxA
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -213,7 +213,11 @@ public class OtaBaCxJbxxController extends JeroController<OtaBaCxJbxx, IOtaBaCxJ
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK(res).success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -210,7 +210,11 @@ public class OtaBaCxJsfzbacsController extends JeroController<OtaBaCxJsfzbacs, I
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -211,7 +211,11 @@ public class OtaBaCxKsjjsmccsController extends JeroController<OtaBaCxKsjjsmccs,
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -213,7 +213,11 @@ public class OtaBaCxKsjxtmccsController extends JeroController<OtaBaCxKsjxtmccs,
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -245,7 +245,11 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
@ApiOperation(value = "车型及功能备案列表-数据导出")
@@ -209,7 +209,10 @@ public class OtaBaCxZxsjyqController extends JeroController<OtaBaCxZxsjyq, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -213,7 +213,11 @@ public class OtaBaSjGgnrfsController extends JeroController<OtaBaSjGgnrfs, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -241,7 +241,11 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
@ApiOperation(value = "升级备案-数据导出")
@@ -211,7 +211,11 @@ public class OtaBaSjSjfzbhController extends JeroController<OtaBaSjSjfzbh, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -207,6 +207,10 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -208,7 +208,11 @@ public class OtaBaSjSjmbcxController extends JeroController<OtaBaSjSjmbcx, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -213,7 +213,11 @@ public class OtaBaSjSjxtbhController extends JeroController<OtaBaSjSjxtbh, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -188,14 +188,14 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
return super.importExcel(request, response, OtaBaSjSjyxpg.class);
}
@ApiOperation(value = "车型备案-安全措施-模板下载")
@ApiOperation(value = "升级备案-升级影响评估-模板下载")
@GetMapping(value = "/exportTemplate")
// @RequiresPermissions("otaBaCx:exportTemplate")
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
this.otaBaSjSjyxpgService.exportTemplate(response, request);
}
@ApiOperation(value = "车型备案-安全措施-数据导入")
@ApiOperation(value = "升级备案-升级影响评估-数据导入")
@PostMapping(value = "/importData")
// @RequiresPermissions("otaBaCx:importData")
public Result<?> importData(@RequestParam(value = "file", required = false) MultipartFile file,
@@ -213,7 +213,11 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
e.printStackTrace();
return Result.error(e.getMessage());
}
return Result.OK().success(errMsg.toString());
String errMsgStr = errMsg.toString();
if (errMsgStr.endsWith(", ")) {
errMsgStr = errMsgStr.substring(0, errMsgStr.lastIndexOf(","));
}
return Result.OK().success(errMsgStr);
}
}
@@ -110,11 +110,13 @@ public class OtaBaCxJbxx implements Serializable {
/**车辆动力类型1*/
@Excel(name = "车辆动力类型1", width = 15)
@ApiModelProperty(value = "车辆动力类型1")
@Dict(dicCode = "vehicle_dynamic_type")
private java.lang.String dllx1;
/**车辆动力类型2*/
@Excel(name = "车辆动力类型2", width = 15)
@ApiModelProperty(value = "车辆动力类型2")
@Dict(dicCode = "vehicle_dynamic_type1")
private java.lang.String dllx2;
/**通信终端*/
@@ -104,11 +104,13 @@ public class OtaBaSjSjmbcx implements Serializable {
/**车辆动力类型1*/
@Excel(name = "车辆动力类型1", width = 15)
@ApiModelProperty(value = "车辆动力类型1")
@Dict(dicCode = "vehicle_dynamic_type")
private java.lang.String dllx1;
/**车辆动力类型2*/
@Excel(name = "车辆动力类型2", width = 15)
@ApiModelProperty(value = "车辆动力类型2")
@Dict(dicCode = "vehicle_dynamic_type1")
private java.lang.String dllx2;
}
@@ -17,8 +17,8 @@ public enum OtaTitleEnum {
// QYMC("qymc", "企业名称", "0","enterprise name ",0),
DJBH("djbh", "产品登记编号", "0", "Product Registration Number ", 500),
CPLB("cplb", "产品类别", "product_category", "Product category", 0),
DLLX1("dllx1", "车辆动力类型", "0", "Vehicle Power Type", 50),
DLLX2("dllx2", "车辆动力类型", "0", "Vehicle Power Type", 50),
DLLX1("dllx1", "车辆动力类型", "vehicle_dynamic_type", "Vehicle Power Type", 50),
DLLX2("dllx2", "车辆动力类型", "vehicle_dynamic_type1", "Vehicle Power Type", 50),
TXZD("txzd", "通信终端", "communication_terminal", "communication terminal", 0),
CDOTASJ("cdotasj", "车端OTA升级管理系统", "0", "OTA Upgrade Management System", 500),
@@ -257,7 +257,7 @@ public class OtaBaCxAqcsServiceImpl extends ServiceImpl<OtaBaCxAqcsMapper, OtaBa
aqcs.setXxaqjz(ImportFileUtil.getCellValueDict(cell, wb, "Information_security_mechanism", sysDictService, cut));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(aqcs, errMsg, sysDictService, cut);
cu.checkError(aqcs, errMsg, sysDictService, cut, 0);
row = s.getRow(2);
cell = row.getCell(3);
@@ -268,10 +268,10 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
jbxx.setCpxh(ImportFileUtil.getCellValue(cell, wb));
row = s.getRow(8);
cell = row.getCell(1);
jbxx.setDllx1(ImportFileUtil.getCellValue(cell, wb));
jbxx.setDllx1(ImportFileUtil.getCellValueDict(cell, wb, "vehicle_dynamic_type", sysDictService, cut));
row = s.getRow(9);
cell = row.getCell(1);
jbxx.setDllx2(ImportFileUtil.getCellValue(cell, wb));
jbxx.setDllx2(ImportFileUtil.getCellValueDict(cell, wb, "vehicle_dynamic_type1", sysDictService, cut));
row = s.getRow(10);
cell = row.getCell(1);
jbxx.setTxzd(ImportFileUtil.getCellValueDict(cell, wb, "communication_terminal", sysDictService, cut));
@@ -280,7 +280,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
jbxx.setCdotasj(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(jbxx, errMsg, sysDictService, cut);
cu.checkError(jbxx, errMsg, sysDictService, cut, 0);
return jbxx;
}
@@ -301,7 +301,7 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
row = s.getRow(3);
cell = row.getCell(1);
cell.setCellValue(jbxx.getCplb());
cell.setCellValue(ComparisonUtil.queryDictTextByKey("product_category", jbxx.getCplb(), sysDictService));
row = s.getRow(4);
cell = row.getCell(1);
cell.setCellValue(jbxx.getGgpc());
@@ -316,10 +316,10 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
cell.setCellValue(jbxx.getCpxh());
row = s.getRow(8);
cell = row.getCell(1);
cell.setCellValue(jbxx.getDllx1());
cell.setCellValue(ComparisonUtil.queryDictTextByKey("vehicle_dynamic_type", jbxx.getDllx1(), sysDictService));
row = s.getRow(9);
cell = row.getCell(1);
cell.setCellValue(jbxx.getDllx2());
cell.setCellValue(ComparisonUtil.queryDictTextByKey("vehicle_dynamic_type1", jbxx.getDllx2(), sysDictService));
row = s.getRow(10);
cell = row.getCell(1);
String str = jbxx.getTxzd();
@@ -343,7 +343,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
cell = row.getCell(7);
sjmk.setBzwz(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(sjmk, errMsg, sysDictService, cut);
cu.checkError(sjmk, errMsg, sysDictService, cut, i + 1);
sjmkList.add(sjmk);
}
}
@@ -608,7 +608,7 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
cell = row.getCell(4);
bass.setEdrScqy(ImportFileUtil.getCellValue(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(bass, errMsg, sysDictService, cut);
cu.checkError(bass, errMsg, sysDictService, cut, 0);
return bass;
}
@@ -288,7 +288,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
cell = row.getCell(1);
str = ImportFileUtil.getCellValue(cell, wb);
String[] strs = str.split(",");
otaBaCxList.setZxsjjsfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut));
otaBaCxList.setZxsjjsfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut, i + 1));
otaBaCxListService.editById(otaBaCxList);
}
break;
@@ -328,7 +328,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
mssc.setCreateTime(now);
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mssc, errMsg, sysDictService, cut);
cu.checkError(mssc, errMsg, sysDictService, cut, i + 1);
mccsList.add(mssc);
}
}
@@ -351,7 +351,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
cell = row.createCell(2);
cell.setCellValue(ImportFileUtil.getCellValueYesOrNo(mccs.getSfksj()));
cell = row.createCell(3);
cell.setCellValue(mccs.getJszdhjb());
cell.setCellValue(ComparisonUtil.queryDictTextByKey("driving_automation_level", mccs.getJszdhjb(), sysDictService));
cell = row.createCell(4);
cell.setCellValue(mccs.getSjggcs());
cell = row.createCell(5);
@@ -357,7 +357,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
cell = row.getCell(1);
str = ImportFileUtil.getCellValue(cell, wb);
String[] strs = str.split(",");
otaBaCxList.setZxsjxtfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut));
otaBaCxList.setZxsjxtfj(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "证明材料", cut, i + 1));
otaBaCxListService.editById(otaBaCxList);
}
break;
@@ -374,7 +374,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
mssc.setSjbgcs(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(3);
String[] strs = ImportFileUtil.getCellValue(cell, wb).split(",");
mssc.setTpt(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "系统电子控制器架构拓扑图", cut));
mssc.setTpt(ImportFileUtil.uploadFiles(attFile, strs, ossFileService, errMsg, "系统电子控制器架构拓扑图", cut, i + 1));
cell = row.getCell(4);
mssc.setKzqmc(ImportFileUtil.getCellValue(cell, wb));
cell = row.getCell(5);
@@ -401,7 +401,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
mssc.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mssc, errMsg, sysDictService, cut);
cu.checkError(mssc, errMsg, sysDictService, cut, i + 1);
mccsList.add(mssc);
}
}
@@ -152,6 +152,7 @@ public class OtaBaCxQtServiceImpl extends ServiceImpl<OtaBaCxQtMapper, OtaBaCxQt
Row row = s.getRow(0);
Cell cell = row.getCell(1);
cell.setCellValue(qt.getSjbbhcs());
wb.write(new FileOutputStream(file));
wb.close();
}
}
@@ -273,7 +273,7 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
otaBaCxZxsjyq.setSjzt(ImportFileUtil.getCellValueYesOrNo(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(otaBaCxZxsjyq, errMsg, sysDictService, cut);
cu.checkError(otaBaCxZxsjyq, errMsg, sysDictService, cut, 0);
row = s.getRow(2);
cell = row.getCell(3);
@@ -168,7 +168,6 @@ public class OtaBaSjQtsjxxServiceImpl extends ServiceImpl<OtaBaSjQtsjxxMapper, O
js = sdf.format(qt.getSjjzsj());
}
cell.setCellValue(js);
cell.setCellValue(ks);
wb.write(new FileOutputStream(file));
wb.close();
}
@@ -115,6 +115,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
}
}
public List<OtaBaSjSjfzbh> setDefault(String otaId) {
List<OtaBaSjSjfzbh> list = this.getByOtaId(otaId);
Date now = new Date();
@@ -224,7 +225,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
@Override
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) throws Exception {
List<File> upLoadFiles = ImportFileUtil.importZip(file, cut, uploadPath);
parseFileList(upLoadFiles, otaId, cut,errMsg);
parseFileList(upLoadFiles, otaId, cut, errMsg);
}
@Override
@@ -243,7 +244,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
if (ObjectUtils.isEmpty(oldList)) {
oldList = new ArrayList<>();
}
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut,errMsg);
List<OtaBaSjSjfzbh> newList = parseFile(upFile, otaId, cut, errMsg);
ComparisonUtil cu = new ComparisonUtil();
List<OtaBaCxTxjl> reList = cu.comparisonListRecord(otaId, OtaModuleEnum.SJ_SJJSMCBH, OtaTitleEnum.GNMC.getName(), oldList, newList, sysDictService);
deleteByOtaId(otaId);
@@ -283,7 +284,7 @@ public class OtaBaSjSjfzbhServiceImpl extends ServiceImpl<OtaBaSjSjfzbhMapper, O
fzbh.setCreateTime(now);
fzbh.setUpdateTime(now);
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(fzbh, errMsg, sysDictService, cut);
cu.checkError(fzbh, errMsg, sysDictService, cut, i + 1);
fzbhList.add(fzbh);
}
@@ -246,7 +246,7 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
mbcx.setDllx2(jbxx.getDllx2());
}
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(mbcx, errMsg, sysDictService, cut);
cu.checkError(mbcx, errMsg, sysDictService, cut, 0);
return mbcx;
}
@@ -271,7 +271,7 @@ public class OtaBaSjSjxtbhServiceImpl extends ServiceImpl<OtaBaSjSjxtbhMapper, O
cell = row.getCell(10);
xtbh.setSfcfsj(ImportFileUtil.getCellValueYesOrNo(cell, wb));
ComparisonUtil cu = new ComparisonUtil();
cu.checkError(xtbh, errMsg, sysDictService, cut);
cu.checkError(xtbh, errMsg, sysDictService, cut, i + 1);
if (xtbh.isNull()) {
break;
}
@@ -185,7 +185,7 @@ public class ComparisonUtil<T> {
}
}
public void checkError(T clazz, StringBuilder errMsg, ISysDictService sysDictService, String cut) {
public void checkError(T clazz, StringBuilder errMsg, ISysDictService sysDictService, String cut,int row) {
Field[] fields = clazz.getClass().getDeclaredFields();
for (Field field : fields) {
OtaTitleEnum ote = OtaTitleEnum.getOtaTitleEnum(field.getName());
@@ -200,17 +200,29 @@ public class ComparisonUtil<T> {
String str = val.toString();
if ("0".equals(ote.getType())) {
if (str.length() > ote.getLen()) {
errMsg.append(title + " 的长度超过了 " + ote.getLen() + ", ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 的长度超过了 " + ote.getLen() + ", ");
} else {
errMsg.append(title + " 的长度超过了 " + ote.getLen() + ", ");
}
field.set(clazz, null);
}
} else if ("1".equals(ote.getType())) {
if (!"1".equals(str) && !"2".equals(str)) {
errMsg.append(title + " 必须填写有或无, ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 必须填写有或无, ");
}else{
errMsg.append(title + " 必须填写有或无, ");
}
field.set(clazz, null);
}
} else if ("2".equals(ote.getType())) {
if (!"1".equals(str) && !"2".equals(str)) {
errMsg.append(title + " 必须填写是或否, ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 必须填写是或否, ");
}else{
errMsg.append(title + " 必须填写是或否, ");
}
field.set(clazz, null);
}
} else if ("3".equals(ote.getType())) {
@@ -220,7 +232,11 @@ public class ComparisonUtil<T> {
for (String s : strs) {
String res = sysDictService.queryDictTextByKeyEn(ote.getType(), s, cut);
if (StringUtils.isEmpty(res)) {
errMsg.append(title + " 填写了无法识别的选项, ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 填写了无法识别的选项, ");
}else{
errMsg.append(title + " 填写了无法识别的选项, ");
}
field.set(clazz, null);
}
}
@@ -71,7 +71,7 @@ public class ImportFileUtil {
throw new JeroBootException("Please upload a zip file or rar file");
}
}
String path = uploadPath + File.separator + "modal" + File.separator + System.currentTimeMillis()+ File.separator + filenameorg;
String path = uploadPath + File.separator + "modal" + File.separator + System.currentTimeMillis() + File.separator + filenameorg;
File saveDirectory = new File(path);
if (!saveDirectory.isDirectory()) {
saveDirectory.mkdir();
@@ -166,7 +166,7 @@ public class ImportFileUtil {
public static String getCellValueHaveOrNot(Cell cell, Workbook workbook) throws Exception {
String res = "3";
String res = "";
String str = getCellValue(cell, workbook);
if (StringUtils.isNotEmpty(str)) {
if (str.equals("")) {
@@ -179,7 +179,7 @@ public class ImportFileUtil {
}
public static String getCellValueHaveOrNotInt(Integer val) throws Exception {
String res = "3";
String res = "";
if (ObjectUtils.isNotEmpty(val)) {
if (val.equals(1)) {
res = "";
@@ -191,7 +191,7 @@ public class ImportFileUtil {
}
public static String getCellValueYesOrNo(Cell cell, Workbook workbook) throws Exception {
String res = "3";
String res = "";
String str = getCellValue(cell, workbook);
if (StringUtils.isNotEmpty(str)) {
if (str.equals("")) {
@@ -204,7 +204,7 @@ public class ImportFileUtil {
}
public static String getCellValueYesOrNoInt(Integer val) throws Exception {
String res = "3";
String res = "";
if (ObjectUtils.isNotEmpty(val)) {
if (val.equals(1)) {
res = "";
@@ -216,7 +216,7 @@ public class ImportFileUtil {
}
public static String getCellValueHaveOrNot(String str) throws Exception {
String res = "3";
String res = "";
if (StringUtils.isNotEmpty(str)) {
if (str.equals("1")) {
res = "";
@@ -228,7 +228,7 @@ public class ImportFileUtil {
}
public static String getCellValueYesOrNo(String str) throws Exception {
String res = "3";
String res = "";
if (StringUtils.isNotEmpty(str)) {
if (str.equals("1")) {
res = "";
@@ -356,7 +356,7 @@ public class ImportFileUtil {
return res;
}
public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService, StringBuilder errMsg, String title, String cut) throws Exception {
public static String uploadFiles(File attFile, String[] strs, IOSSFileService ossFileService, StringBuilder errMsg, String title, String cut, int row) throws Exception {
String res = "";
//已导入文件数,用于判断超过20
int inFile = 0;
@@ -368,16 +368,28 @@ public class ImportFileUtil {
if (StringUtils.isNotEmpty(strs[i])) {
File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) {
errMsg.append(title + " 找不到文件:" + strs[i] + ", ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 找不到文件:" + strs[i] + ", ");
} else {
errMsg.append(title + " 找不到文件:" + strs[i] + ", ");
}
continue;
}
if (!file.getName().endsWith(".doc") && !file.getName().endsWith(".docx") && !file.getName().endsWith(".pdf")
&& !file.getName().endsWith(".DOC") && !file.getName().endsWith(".DOCX") && !file.getName().endsWith(".PDF")) {
errMsg.append(title + " 只支持doc/docx/pdf格式, ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 只支持doc/docx/pdf格式, ");
} else {
errMsg.append(title + " 只支持doc/docx/pdf格式, ");
}
continue;
}
if (file.length() > 50 * 1024 * 1024) {
errMsg.append(title + " 上传文件不可以超过50MB, ");
if (row > 0) {
errMsg.append("" + row + "" + title + " 上传文件不可以超过50MB, ");
} else {
errMsg.append(title + " 上传文件不可以超过50MB, ");
}
continue;
}
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);