格式化代码

This commit is contained in:
2022-03-12 15:07:20 +08:00
parent 7690f14c0d
commit a995d08f6f
7 changed files with 52 additions and 61 deletions

View File

@ -1,6 +1,7 @@
package com.xkrs.service.impl;
import com.xkrs.dao.FileDao;
import com.xkrs.dao.QcSourceDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.FileEntity;
import com.xkrs.model.qo.FileQo;
@ -29,8 +30,8 @@ public class FileServiceImpl implements FileService {
@Resource
private FileDao fileDao;
// @Resource
// private DataSourceQuery dataSourceQuery;
@Resource
private QcSourceDao qcSourceDao;
/**
* 添加模板信息
@ -75,29 +76,28 @@ public class FileServiceImpl implements FileService {
@Transactional(rollbackOn = Exception.class)
@Override
public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException {
return null;
// String lotNo = fileQo.getLotNo();
// String machineNo = fileQo.getMachineNo();
// String materialNo = fileQo.getMaterialNo();
// String modelNo = fileQo.getModelNo();
// String machineTypeNo = fileQo.getMachineTypeNo();
// String craftItemName = fileQo.getCraftItemName();
// Locale locale = LocaleContextHolder.getLocale();
// Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
// if (fileEntity.isEmpty()) {
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
// }
// String fileUploadPath = fileEntity.get().getFileUploadPath();
// List<DataSource> dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
// if (dataSources == null || dataSources.size() == 0) {
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
// }
// Map<String, String> map = new HashMap<>();
// for (DataSource dataSource : dataSources) {
// map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue());
// }
// String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
// fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
// return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
String lotNo = fileQo.getLotNo();
String machineNo = fileQo.getMachineNo();
String materialNo = fileQo.getMaterialNo();
String modelNo = fileQo.getModelNo();
String machineTypeNo = fileQo.getMachineTypeNo();
String craftItemName = fileQo.getCraftItemName();
Locale locale = LocaleContextHolder.getLocale();
Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
if (fileEntity.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
}
String fileUploadPath = fileEntity.get().getFileUploadPath();
List<Map<String, Object>> resultList = qcSourceDao.queryQcSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo);
if (resultList == null || resultList.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
}
Map<String, String> map = new HashMap<>();
for (Map<String, Object> result : resultList) {
map.put((String) result.get("qcItemNo"), (String) result.get("qcValue"));
}
String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
}
}