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

This commit is contained in:
zyx.net
2023-04-02 18:25:10 +08:00
38 changed files with 179 additions and 49 deletions
@@ -214,7 +214,7 @@ public class OtaBaCxAqcsController extends JeroController<OtaBaCxAqcs, IOtaBaCxA
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -213,7 +213,7 @@ public class OtaBaCxJbxxController extends JeroController<OtaBaCxJbxx, IOtaBaCxJ
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -210,7 +210,7 @@ public class OtaBaCxJsfzbacsController extends JeroController<OtaBaCxJsfzbacs, I
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -211,7 +211,7 @@ public class OtaBaCxKsjjsmccsController extends JeroController<OtaBaCxKsjjsmccs,
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -213,7 +213,7 @@ public class OtaBaCxKsjxtmccsController extends JeroController<OtaBaCxKsjxtmccs,
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -245,7 +245,7 @@ public class OtaBaCxListController extends JeroController<OtaBaCxList, IOtaBaCxL
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
@ApiOperation(value = "车型及功能备案列表-数据导出") @ApiOperation(value = "车型及功能备案列表-数据导出")
@@ -209,7 +209,7 @@ public class OtaBaCxZxsjyqController extends JeroController<OtaBaCxZxsjyq, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -213,7 +213,7 @@ public class OtaBaSjGgnrfsController extends JeroController<OtaBaSjGgnrfs, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -241,7 +241,7 @@ public class OtaBaSjListController extends JeroController<OtaBaSjList, IOtaBaSjL
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
@ApiOperation(value = "升级备案-数据导出") @ApiOperation(value = "升级备案-数据导出")
@@ -211,7 +211,7 @@ public class OtaBaSjSjfzbhController extends JeroController<OtaBaSjSjfzbh, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -207,6 +207,6 @@ public class OtaBaSjSjmbclController extends JeroController<OtaBaSjSjmbcl, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -208,7 +208,7 @@ public class OtaBaSjSjmbcxController extends JeroController<OtaBaSjSjmbcx, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -213,7 +213,7 @@ public class OtaBaSjSjxtbhController extends JeroController<OtaBaSjSjxtbh, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -213,7 +213,7 @@ public class OtaBaSjSjyxpgController extends JeroController<OtaBaSjSjyxpg, IOtaB
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
return Result.error(errMsg.toString()); return Result.OK().success(errMsg.toString());
} }
} }
@@ -73,4 +73,6 @@ public interface IOtaBaCxAqcsService extends IService<OtaBaCxAqcs> {
OtaBaCxAqcs parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; OtaBaCxAqcs parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
void exportData(File file, File attFile, String otaId, String cut) throws Exception; void exportData(File file, File attFile, String otaId, String cut) throws Exception;
void deleteByOtaId(String id);
} }
@@ -73,4 +73,6 @@ public interface IOtaBaCxJsfzbacsService extends IService<OtaBaCxJsfzbacs> {
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -73,4 +73,6 @@ public interface IOtaBaCxKsjjsmccsService extends IService<OtaBaCxKsjjsmccs> {
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
void exportData(File file, File attFile, String otaId, String cut) throws Exception; void exportData(File file, File attFile, String otaId, String cut) throws Exception;
void deleteByOtaId(String id);
} }
@@ -73,4 +73,6 @@ public interface IOtaBaCxKsjxtmccsService extends IService<OtaBaCxKsjxtmccs> {
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
void exportData(File file, File attFile, String otaId, String cut) throws Exception; void exportData(File file, File attFile, String otaId, String cut) throws Exception;
void deleteByOtaId(String id);
} }
@@ -74,4 +74,6 @@ public interface IOtaBaCxZxsjyqService extends IService<OtaBaCxZxsjyq> {
OtaBaCxZxsjyq parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception; OtaBaCxZxsjyq parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) throws Exception;
void exportData(File file, File attFile,String otaId, String cut) throws Exception; void exportData(File file, File attFile,String otaId, String cut) throws Exception;
void deleteByOtaId(String id);
} }
@@ -73,4 +73,6 @@ public interface IOtaBaSjGgnrfsService extends IService<OtaBaSjGgnrfs> {
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -74,4 +74,6 @@ public interface IOtaBaSjSjfzbhService extends IService<OtaBaSjSjfzbh> {
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -74,4 +74,6 @@ public interface IOtaBaSjSjmbclService extends IService<OtaBaSjSjmbcl> {
OtaBaSjSjmbcl importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -75,4 +75,6 @@ public interface IOtaBaSjSjmbcxService extends IService<OtaBaSjSjmbcx> {
OtaBaSjSjmbcx parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -72,4 +72,6 @@ public interface IOtaBaSjSjxtbhService extends IService<OtaBaSjSjxtbh> {
void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -74,4 +74,6 @@ public interface IOtaBaSjSjyxpgService extends IService<OtaBaSjSjyxpg> {
OtaBaSjSjyxpg parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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;
void deleteByOtaId(String id);
} }
@@ -64,19 +64,19 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
*/ */
public OtaBaCxJbxx add(OtaBaCxJbxx otaBaCxJbxx) throws Exception { public OtaBaCxJbxx add(OtaBaCxJbxx otaBaCxJbxx) throws Exception {
String ggpc = otaBaCxJbxx.getGgpc(); String ggpc = otaBaCxJbxx.getGgpc();
if (StringUtils.isNotEmpty(ggpc)) {
List<OtaBaCxJbxx> xxList = this.list();
for (OtaBaCxJbxx xx : xxList) {
if (ggpc.equals(xx.getGgpc())) {
throw new JeroBootException("公告批次重复");
}
}
}
//对比填写记录用的 //对比填写记录用的
OtaBaCxJbxx otaBaCxJbxxOld = new OtaBaCxJbxx(); OtaBaCxJbxx otaBaCxJbxxOld = new OtaBaCxJbxx();
Date now = new Date(); Date now = new Date();
OtaBaCxList otaBaCxList; OtaBaCxList otaBaCxList;
if (StringUtils.isEmpty(otaBaCxJbxx.getOtaId())) { if (StringUtils.isEmpty(otaBaCxJbxx.getOtaId())) {
if (StringUtils.isNotEmpty(ggpc)) {
List<OtaBaCxJbxx> xxList = this.list();
for (OtaBaCxJbxx xx : xxList) {
if (ggpc.equals(xx.getGgpc())) {
throw new JeroBootException("公告批次重复");
}
}
}
//在保存的时候设置一个id 并返回前端 下次保存的时候判断是否为更新 //在保存的时候设置一个id 并返回前端 下次保存的时候判断是否为更新
otaBaCxList = new OtaBaCxList(); otaBaCxList = new OtaBaCxList();
otaBaCxList.setId(UUID.randomUUID().toString().replace("-", "")); otaBaCxList.setId(UUID.randomUUID().toString().replace("-", ""));
@@ -86,6 +86,14 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
otaBaCxJbxx.setCreateTime(now); otaBaCxJbxx.setCreateTime(now);
} else { } else {
otaBaCxJbxxOld = this.getByOtaId(otaBaCxJbxx.getOtaId()); otaBaCxJbxxOld = this.getByOtaId(otaBaCxJbxx.getOtaId());
if (StringUtils.isNotEmpty(ggpc)) {
List<OtaBaCxJbxx> xxList = this.list();
for (OtaBaCxJbxx xx : xxList) {
if (xx.getOtaId() != otaBaCxJbxx.getOtaId() && ggpc.equals(xx.getGgpc())) {
throw new JeroBootException("公告批次重复");
}
}
}
otaBaCxJbxx.setId(otaBaCxJbxx.getId()); otaBaCxJbxx.setId(otaBaCxJbxx.getId());
otaBaCxList = otaBaCxListService.queryById(otaBaCxJbxx.getOtaId()); otaBaCxList = otaBaCxListService.queryById(otaBaCxJbxx.getOtaId());
otaBaCxList.updateData(otaBaCxJbxx); otaBaCxList.updateData(otaBaCxJbxx);
@@ -128,9 +136,11 @@ public class OtaBaCxJbxxServiceImpl extends ServiceImpl<OtaBaCxJbxxMapper, OtaBa
@Override @Override
public void deleteByOtaId(String id) { public void deleteByOtaId(String id) {
LambdaQueryWrapper<OtaBaCxJbxx> queryWrapper = new LambdaQueryWrapper<>(); if (StringUtils.isNotEmpty(id)) {
queryWrapper.eq(OtaBaCxJbxx::getOtaId, id); LambdaQueryWrapper<OtaBaCxJbxx> queryWrapper = new LambdaQueryWrapper<>();
remove(queryWrapper); queryWrapper.eq(OtaBaCxJbxx::getOtaId, id);
remove(queryWrapper);
}
} }
/** /**
@@ -244,6 +244,15 @@ public class OtaBaCxJsfzbacsServiceImpl extends ServiceImpl<OtaBaCxJsfzbacsMappe
return res; return res;
} }
@Override
public void deleteByOtaId(String id) {
if (StringUtils.isNotEmpty(id)) {
LambdaQueryWrapper<OtaBaCxJsfzbacs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxJsfzbacs::getOtaId, id);
remove(queryWrapper);
}
}
private OtaBaCxJsfzbacs getByOtaId(String otaId) { private OtaBaCxJsfzbacs getByOtaId(String otaId) {
if (StringUtils.isEmpty(otaId)) { if (StringUtils.isEmpty(otaId)) {
return null; return null;
@@ -215,7 +215,7 @@ public class OtaBaCxKsjjsmccsServiceImpl extends ServiceImpl<OtaBaCxKsjjsmccsMap
private List<OtaBaCxKsjjsmccs> getByOtaId(String otaId) { private List<OtaBaCxKsjjsmccs> getByOtaId(String otaId) {
if (StringUtils.isEmpty(otaId)) { if (StringUtils.isEmpty(otaId)) {
return null; return new ArrayList<>();
} }
LambdaQueryWrapper<OtaBaCxKsjjsmccs> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaBaCxKsjjsmccs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxKsjjsmccs::getOtaId, otaId); queryWrapper.eq(OtaBaCxKsjjsmccs::getOtaId, otaId);
@@ -286,7 +286,7 @@ public class OtaBaCxKsjxtmccsServiceImpl extends ServiceImpl<OtaBaCxKsjxtmccsMap
private List<OtaBaCxKsjxtmccs> getByOtaId(String otaId) { private List<OtaBaCxKsjxtmccs> getByOtaId(String otaId) {
if (org.apache.commons.lang3.StringUtils.isEmpty(otaId)) { if (org.apache.commons.lang3.StringUtils.isEmpty(otaId)) {
return null; return new ArrayList<>();
} }
LambdaQueryWrapper<OtaBaCxKsjxtmccs> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OtaBaCxKsjxtmccs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxKsjxtmccs::getOtaId, otaId); queryWrapper.eq(OtaBaCxKsjxtmccs::getOtaId, otaId);
@@ -105,8 +105,15 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
*/ */
@Override @Override
public void deleteById(String id) { public void deleteById(String id) {
removeById(id); if(StringUtils.isNotEmpty(id)){
otaBaCxJbxxService.deleteByOtaId(id); removeById(id);
otaBaCxJbxxService.deleteByOtaId(id);
otaBaCxZxsjyqService.deleteByOtaId(id);
otaBaCxAqcsService.deleteByOtaId(id);
otaBaCxKsjxtmccsService.deleteByOtaId(id);
otaBaCxKsjjsmccsService.deleteByOtaId(id);
otaBaCxJsfzbacsService.deleteByOtaId(id);
}
} }
/** /**
@@ -185,6 +192,7 @@ public class OtaBaCxListServiceImpl extends ServiceImpl<OtaBaCxListMapper, OtaBa
otaBaCxKsjjsmccsService.parseFileList(fileList, otaId, cut, errMsg); otaBaCxKsjjsmccsService.parseFileList(fileList, otaId, cut, errMsg);
otaBaCxJsfzbacsService.parseFileList(fileList, otaId, cut, errMsg); otaBaCxJsfzbacsService.parseFileList(fileList, otaId, cut, errMsg);
} else { } else {
this.deleteById(otaId);
throw new JeroBootException("导入失败"); throw new JeroBootException("导入失败");
} }
} }
@@ -8,6 +8,7 @@ import com.jero.common.util.oss.CosBootUtil;
import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.ota.entity.AttachmentEO; import com.jero.modules.ota.entity.AttachmentEO;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaCxTxjl; import com.jero.modules.ota.entity.OtaBaCxTxjl;
import com.jero.modules.ota.entity.OtaBaCxZxsjyq; import com.jero.modules.ota.entity.OtaBaCxZxsjyq;
import com.jero.modules.ota.enums.OtaModuleEnum; import com.jero.modules.ota.enums.OtaModuleEnum;
@@ -195,6 +196,15 @@ public class OtaBaCxZxsjyqServiceImpl extends ServiceImpl<OtaBaCxZxsjyqMapper, O
return this.getOne(queryWrapper, false); return this.getOne(queryWrapper, false);
} }
@Override
public void deleteByOtaId(String id) {
if (StringUtils.isNotEmpty(id)) {
LambdaQueryWrapper<OtaBaCxZxsjyq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaCxZxsjyq::getOtaId, id);
remove(queryWrapper);
}
}
@Override @Override
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) { public void exportTemplate(HttpServletResponse response, HttpServletRequest request) {
ImportFileUtil.exportTemplate(response, templatePath + "在线升级要求.zip"); ImportFileUtil.exportTemplate(response, templatePath + "在线升级要求.zip");
@@ -194,13 +194,13 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
} }
@Override @Override
public void importData(MultipartFile file, String otaId, String cut, StringBuilder errMsg) 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,errMsg); parseFileList(upLoadFiles, otaId, cut, errMsg);
} }
@Override @Override
public void parseFileList(List<File> upLoadFiles, String otaId, String cut, StringBuilder errMsg) 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,errMsg); OtaBaSjGgnrfs fs = parseFile(attFile, otaId, cut, errMsg);
add(fs); add(fs);
} }
private OtaBaSjGgnrfs parseFile(File attFile, String otaId, String cut, StringBuilder errMsg) 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, "");
@@ -223,19 +223,42 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
} }
StringBuilder attStr1 = new StringBuilder(); StringBuilder attStr1 = new StringBuilder();
File[] attFiles1 = attFile.listFiles(); File[] attFiles1 = attFile.listFiles();
//已导入文件数,用于判断超过20
int inFile = 0;
for (int i = 0; i < attFiles1.length; i++) { for (int i = 0; i < attFiles1.length; i++) {
if (inFile >= 20) {
errMsg.append("用户告知方式 仅支持上传20个文件,超出部分文件忽略, ");
break;
}
if (!attFiles1[i].isDirectory() && (attFiles1[i].getName().contains(".doc") || attFiles1[i].getName().contains(".docx") || attFiles1[i].getName().contains(".pdf"))) { if (!attFiles1[i].isDirectory() && (attFiles1[i].getName().contains(".doc") || attFiles1[i].getName().contains(".docx") || attFiles1[i].getName().contains(".pdf"))) {
if (attFiles1[i].length() > 50 * 1024 * 1024) {
errMsg.append("用户告知方式 上传文件不可以超过50MB, ");
continue;
}
if (i >= attFiles1.length - 1) { if (i >= attFiles1.length - 1) {
attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService)); attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService));
} else { } else {
attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService)).append(","); attStr1.append(ImportFileUtil.uploadFiles(attFiles1[i], ossFileService)).append(",");
} }
inFile++;
} else {
errMsg.append("用户告知方式 只支持doc/docx/pdf格式, ");
continue;
} }
} }
fs.setXgwj(attStr1.toString()); fs.setXgwj(attStr1.toString());
return fs; return fs;
} }
@Override
public void deleteByOtaId(String id) {
if (StringUtils.isNotEmpty(id)) {
LambdaQueryWrapper<OtaBaSjGgnrfs> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjGgnrfs::getOtaId, id);
remove(queryWrapper);
}
}
@Override @Override
public void exportData(File file, File attFile, String otaId, String cut) throws Exception { public void exportData(File file, File attFile, String otaId, String cut) throws Exception {
OtaBaSjGgnrfs fs = this.getByOtaId(otaId); OtaBaSjGgnrfs fs = this.getByOtaId(otaId);
@@ -277,7 +300,7 @@ public class OtaBaSjGgnrfsServiceImpl extends ServiceImpl<OtaBaSjGgnrfsMapper, O
cell.setCellValue(ComparisonUtil.queryDictTextByKey("user_notification_mode", fs.getGzyhfs(), sysDictService)); cell.setCellValue(ComparisonUtil.queryDictTextByKey("user_notification_mode", fs.getGzyhfs(), sysDictService));
String attStr = fs.getXgwj(); String attStr = fs.getXgwj();
if(StringUtils.isNotEmpty(attStr)){ if (StringUtils.isNotEmpty(attStr)) {
String[] strs = attStr.split(","); String[] strs = attStr.split(",");
for (String str : strs) { for (String str : strs) {
List<OSSFile> ossFileList = ossFileService.getFileInfos(str); List<OSSFile> ossFileList = ossFileService.getFileInfos(str);
@@ -2,14 +2,13 @@ package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.modules.ota.entity.OtaBaCxJbxx;
import com.jero.modules.ota.entity.OtaBaSjList; import com.jero.modules.ota.entity.OtaBaSjList;
import com.jero.modules.ota.entity.OtaBaSjLsjl; import com.jero.modules.ota.entity.OtaBaSjLsjl;
import com.jero.modules.ota.entity.OtaBaSjSjmbcx; import com.jero.modules.ota.entity.OtaBaSjSjmbcx;
import com.jero.modules.ota.mapper.OtaBaSjListMapper; import com.jero.modules.ota.mapper.OtaBaSjListMapper;
import com.jero.modules.ota.service.*; import com.jero.modules.ota.service.*;
import com.jero.modules.ota.utils.ImportFileUtil; import com.jero.modules.ota.utils.ImportFileUtil;
import com.jero.modules.system.util.StringUtils; import org.apache.commons.lang3.StringUtils;
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;
@@ -100,7 +99,15 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
*/ */
@Override @Override
public void deleteById(String id) { public void deleteById(String id) {
removeById(id); if (StringUtils.isNotEmpty(id)) {
removeById(id);
otaBaSjSjmbcxService.deleteByOtaId(id);
otaBaSjSjmbclService.deleteByOtaId(id);
otaBaSjSjyxpgService.deleteByOtaId(id);
otaBaSjSjxtbhService.deleteByOtaId(id);
otaBaSjSjfzbhService.deleteByOtaId(id);
otaBaSjGgnrfsService.deleteByOtaId(id);
}
} }
/** /**
@@ -174,12 +181,12 @@ public class OtaBaSjListServiceImpl extends ServiceImpl<OtaBaSjListMapper, OtaBa
String otaId = mbcx.getOtaId(); String otaId = mbcx.getOtaId();
if (StringUtils.isNotEmpty(otaId)) { if (StringUtils.isNotEmpty(otaId)) {
otaBaSjSjmbclService.parseFileList(fileList, otaId, cut, errMsg); otaBaSjSjmbclService.parseFileList(fileList, otaId, cut, errMsg);
otaBaSjSjmbcxService.parseFileList(fileList, otaId, cut, errMsg);
otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut, errMsg); otaBaSjSjyxpgService.parseFileList(fileList, otaId, cut, errMsg);
otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut, errMsg); otaBaSjSjxtbhService.parseFileList(fileList, otaId, cut, errMsg);
otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut, errMsg); otaBaSjSjfzbhService.parseFileList(fileList, otaId, cut, errMsg);
otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut, errMsg); otaBaSjGgnrfsService.parseFileList(fileList, otaId, cut, errMsg);
} else { } else {
this.deleteById(otaId);
throw new JeroBootException("导入失败"); throw new JeroBootException("导入失败");
} }
} }
@@ -197,6 +197,15 @@ public class OtaBaSjSjmbclServiceImpl extends ServiceImpl<OtaBaSjSjmbclMapper, O
return mbcl; return mbcl;
} }
@Override
public void deleteByOtaId(String id) {
if (StringUtils.isNotEmpty(id)) {
LambdaQueryWrapper<OtaBaSjSjmbcl> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjSjmbcl::getOtaId, id);
remove(queryWrapper);
}
}
private OtaBaSjSjmbcl parseFile(File upFile, String otaId, String cut, StringBuilder errMsg) 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, "");
@@ -249,6 +249,15 @@ public class OtaBaSjSjmbcxServiceImpl extends ServiceImpl<OtaBaSjSjmbcxMapper, O
return mbcx; return mbcx;
} }
@Override
public void deleteByOtaId(String id) {
if (StringUtils.isNotEmpty(id)) {
LambdaQueryWrapper<OtaBaSjSjmbcx> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjSjmbcx::getOtaId, id);
remove(queryWrapper);
}
}
@Override @Override
public void exportData(File file, String otaId, String cut) throws Exception { public void exportData(File file, String otaId, String cut) throws Exception {
OtaBaSjSjmbcx cx = this.getByOtaId(otaId); OtaBaSjSjmbcx cx = this.getByOtaId(otaId);
@@ -290,6 +290,15 @@ public class OtaBaSjSjyxpgServiceImpl extends ServiceImpl<OtaBaSjSjyxpgMapper, O
return sjyxpg; return sjyxpg;
} }
@Override
public void deleteByOtaId(String id) {
if (StringUtils.isNotEmpty(id)) {
LambdaQueryWrapper<OtaBaSjSjyxpg> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(OtaBaSjSjyxpg::getOtaId, id);
remove(queryWrapper);
}
}
@Override @Override
public void exportData(File file, File attFile1, File attFile2, String otaId, String cut) throws Exception { public void exportData(File file, File attFile1, File attFile2, String otaId, String cut) throws Exception {
OtaBaSjSjyxpg pg = this.getByOtaId(otaId); OtaBaSjSjyxpg pg = this.getByOtaId(otaId);
@@ -180,7 +180,7 @@ public class ComparisonUtil<T> {
public void checkAttError(String[] strs, StringBuilder errMsg, String title, String cut) { public void checkAttError(String[] strs, StringBuilder errMsg, String title, String cut) {
for (String str : strs) { for (String str : strs) {
if (!str.endsWith(".doc") && !str.endsWith(".docx") && !str.endsWith(".pdf") && !str.endsWith(".DOC") && !str.endsWith(".DOCX") && !str.endsWith(".PDF")) { if (!str.endsWith(".doc") && !str.endsWith(".docx") && !str.endsWith(".pdf") && !str.endsWith(".DOC") && !str.endsWith(".DOCX") && !str.endsWith(".PDF")) {
errMsg.append(title + " 支持doc/docx/pdf格式 , "); errMsg.append(title + " 支持doc/docx/pdf格式, ");
} }
} }
} }
@@ -205,12 +205,12 @@ public class ComparisonUtil<T> {
} }
} else if ("1".equals(ote.getType())) { } else if ("1".equals(ote.getType())) {
if (!"1".equals(str) && !"2".equals(str)) { if (!"1".equals(str) && !"2".equals(str)) {
errMsg.append(title + " 必须填写有或无 , "); errMsg.append(title + " 必须填写有或无, ");
field.set(clazz, ""); field.set(clazz, "");
} }
} else if ("2".equals(ote.getType())) { } else if ("2".equals(ote.getType())) {
if (!"1".equals(str) && !"2".equals(str)) { if (!"1".equals(str) && !"2".equals(str)) {
errMsg.append(title + " 必须填写是或否 , "); errMsg.append(title + " 必须填写是或否, ");
field.set(clazz, ""); field.set(clazz, "");
} }
} else if ("3".equals(ote.getType())) { } else if ("3".equals(ote.getType())) {
@@ -220,7 +220,7 @@ public class ComparisonUtil<T> {
for (String s : strs) { for (String s : strs) {
String res = sysDictService.queryDictTextByKeyEn(ote.getType(), s, cut); String res = sysDictService.queryDictTextByKeyEn(ote.getType(), s, cut);
if (StringUtils.isEmpty(res)) { if (StringUtils.isEmpty(res)) {
errMsg.append(title + " 填写了无法识别的选项 , "); errMsg.append(title + " 填写了无法识别的选项, ");
field.set(clazz, ""); field.set(clazz, "");
} }
} }
@@ -315,25 +315,32 @@ public class ImportFileUtil {
public static List<OSSFile> uploadFiles1(File attFile, String[] strs, IOSSFileService ossFileService, StringBuilder errMsg, String title, String cut) throws Exception { public static List<OSSFile> uploadFiles1(File attFile, String[] strs, IOSSFileService ossFileService, StringBuilder errMsg, String title, String cut) throws Exception {
List<OSSFile> res = new ArrayList<>(); List<OSSFile> res = new ArrayList<>();
//已导入文件数,用于判断超过20
int inFile = 0;
for (int i = 0; i < strs.length; i++) { for (int i = 0; i < strs.length; i++) {
if (inFile >= 20) {
errMsg.append(title + " 仅支持上传20个文件,超出部分文件忽略, ");
break;
}
if (StringUtils.isNotEmpty(strs[i])) { if (StringUtils.isNotEmpty(strs[i])) {
File file = ImportFileUtil.findFile(attFile, strs[i]); File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) { if (null == file) {
errMsg.append(title + " 找不到文件 , "); errMsg.append(title + " 找不到文件, ");
continue; continue;
} }
if (!file.getName().endsWith(".doc") && !file.getName().endsWith(".docx") && !file.getName().endsWith(".pdf") 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")) { && !file.getName().endsWith(".DOC") && !file.getName().endsWith(".DOCX") && !file.getName().endsWith(".PDF")) {
errMsg.append(title + " 只支持doc/docx/pdf格式 , "); errMsg.append(title + " 只支持doc/docx/pdf格式, ");
continue; continue;
} }
if (file.length() > 50 * 1024 * 1024) { if (file.length() > 50 * 1024 * 1024) {
errMsg.append(title + " 上传文件不可以超过50MB , "); errMsg.append(title + " 上传文件不可以超过50MB, ");
continue; continue;
} }
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null); OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
if (ObjectUtils.isNotEmpty(ossFile)) { if (ObjectUtils.isNotEmpty(ossFile)) {
res.add(ossFile); res.add(ossFile);
inFile++;
} }
} }
} }
@@ -351,20 +358,26 @@ public class ImportFileUtil {
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) throws Exception {
String res = ""; String res = "";
//已导入文件数,用于判断超过20
int inFile = 0;
for (int i = 0; i < strs.length; i++) { for (int i = 0; i < strs.length; i++) {
if (inFile >= 20) {
errMsg.append(title + " 仅支持上传20个文件,超出部分文件忽略, ");
break;
}
if (StringUtils.isNotEmpty(strs[i])) { if (StringUtils.isNotEmpty(strs[i])) {
File file = ImportFileUtil.findFile(attFile, strs[i]); File file = ImportFileUtil.findFile(attFile, strs[i]);
if (null == file) { if (null == file) {
errMsg.append(title + " 找不到文件 , "); errMsg.append(title + " 找不到文件, ");
continue; continue;
} }
if (!file.getName().endsWith(".doc") && !file.getName().endsWith(".docx") && !file.getName().endsWith(".pdf") 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")) { && !file.getName().endsWith(".DOC") && !file.getName().endsWith(".DOCX") && !file.getName().endsWith(".PDF")) {
errMsg.append(title + " 只支持doc/docx/pdf格式 , "); errMsg.append(title + " 只支持doc/docx/pdf格式, ");
continue; continue;
} }
if (file.length() > 50 * 1024 * 1024) { if (file.length() > 50 * 1024 * 1024) {
errMsg.append(title + " 上传文件不可以超过50MB , "); errMsg.append(title + " 上传文件不可以超过50MB, ");
continue; continue;
} }
OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null); OSSFile ossFile = ossFileService.uploadLocalOfCos(ImportFileUtil.createMfileByFile(file), "", null, null);
@@ -374,6 +387,7 @@ public class ImportFileUtil {
} else { } else {
res += ossFile.getId() + ","; res += ossFile.getId() + ",";
} }
i++;
} }
} }
} }