Commit 5373945b by wangweidong

土工平台修改

parent 92e493b1
......@@ -86,25 +86,9 @@ public class PngReportHandle implements ICollectHandler {
}
public static void main(String[] args) {
try {
SmbFile smbFile = new SmbFile("smb://administrator:www.163.com@192.168.0.115/土工试验数据/202010020/");
SmbFile[] smbFiles= smbFile.listFiles();
for (SmbFile file:smbFiles) {
String name = StringHandleUtils.getFileNameNoEx(file.getName());
if (!name.equals("YP202010426")){
continue;
}
if (file.getName().contains(".png")){
}else if (file.getName().contains(".txt")){
// txt2String(file.getInputStream());
System.out.println(file.getName());
}
}
System.out.println(smbFile);
}catch (Exception e){
e.printStackTrace();
}
//getShareFiles("smb://administrator:www.163.com@192.168.0.115/土工试验数据/202010020/");
getShareFiles("smb://administrator:www.163.com@192.168.0.115@192.168.0.115/土工试验数据/");
}
}
......@@ -736,7 +736,7 @@ public class SoilExperimentController extends ServiceController {
@ApiOperation(value = "界限含水率(联合测定)采集文件批量上传", notes = "附件批量上传")
@PostMapping("/upload_water_jiexian_collect/{entrustId}")
public RestResult<Boolean> uploadWaterJieXianCollect(@PathVariable("entrustId") Long entrustId, MultipartFile httpServletRequest) {
public RestResult<Boolean> uploadWaterJieXianCollect(@PathVariable("entrustId") Long entrustId, MultipartHttpServletRequest httpServletRequest) {
return success(soilExperimentService.uploadWaterJieXianCollect(httpServletRequest, entrustId,getAccount()));
}
......
......@@ -109,7 +109,7 @@ public interface ISoilExperimentService extends IBaseService<SoilExperiment> {
boolean uploadDynamicsCollect(MultipartHttpServletRequest httpServletRequest, Long entrustId, Account account);
boolean uploadWaterJieXianCollect(MultipartFile httpServletRequest, Long entrustId, Account account);
boolean uploadWaterJieXianCollect(MultipartHttpServletRequest httpServletRequest, Long entrustId, Account account);
SoilExpReport seniorTestReport(Long id, Account account);
......
......@@ -391,6 +391,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
boolean attachJIeXianWater = "界限含水率 (碟式液限仪多点法)试验记录表".equals(template.getName());
if (null==template.getMoreSheet() || 0 == template.getMoreSheet()){
logger.error("----------------------3");
......@@ -417,6 +419,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
for (SoilExperimentVO vo:voList) {
List<SoilItemVO> soilItemVOS = sampleSoilItemVOMap.get(vo.getSampleId());
XSSFRow xssfRow = sheetOne.getRow(beginRow);
for (SoilOriginalTemplateConfig config:configList) {
if(null == config.getColumnPlace()){
......@@ -426,7 +430,29 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
if ("sn".equals(config.getDataAttribute())){
continue;
}
cell.setCellValue(StringHandleUtils.getFieldIfNummReturnBlankValueByFieldName(config.getDataAttribute(),vo));
if (null!=config.getDataAttribute()&&config.getDataAttribute().contains("for")){
String name = config.getDataAttribute().replace("for","");
for (int i = 0; i < sampleMergerNum; i++) {
XSSFRow zhuiRow = sheetOne.getRow(beginRow+i);
if (null!=zhuiRow){
XSSFCell cellZhui = zhuiRow.getCell(config.getColumnPlace());
if (null!=cellZhui){
for (SoilItemVO itemVO:soilItemVOS) {
if ((name+(i+1)).equals(itemVO.getName())){
cellZhui.setCellValue(itemVO.getTestValue());
break;
}
}
}
}
}
continue;
}
cell.setCellValue(getFieldValue(config.getDataAttribute(),vo,soilItemVOList));
}
beginRow+=sampleMergerNum;
......@@ -671,6 +697,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
for (SoilExperimentVO vo:voList) {
List<SoilItemVO> soilItemVOS = sampleSoilItemVOMap.get(vo.getSampleId());
XSSFRow xssfRow = sheetOne.getRow(beginRow);
for (SoilOriginalTemplateConfig config:configList) {
......@@ -678,10 +705,37 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
continue;
}
XSSFCell cell = xssfRow.getCell(config.getColumnPlace());
if (null!=config.getDataAttribute()&&config.getDataAttribute().contains("for")){
String name = config.getDataAttribute().replace("for","");
for (int i = 0; i < sampleMergerNum; i++) {
XSSFRow zhuiRow = sheetOne.getRow(beginRow+i);
if (null!=zhuiRow){
XSSFCell cellZhui = zhuiRow.getCell(config.getColumnPlace());
if (null!=cellZhui){
for (SoilItemVO itemVO:soilItemVOS) {
if ((name+(i+1)).equals(itemVO.getName())){
cellZhui.setCellValue(itemVO.getTestValue());
break;
}
}
}
}
}
continue;
}
if ("sn".equals(config.getDataAttribute())){
cell.setCellValue(sn);
}else{
cell.setCellValue(StringHandleUtils.getFieldIfNummReturnBlankValueByFieldName(config.getDataAttribute(),vo));
//cell.setCellValue(StringHandleUtils.getFieldIfNummReturnBlankValueByFieldName(config.getDataAttribute(),vo));
cell.setCellValue(getFieldValue(config.getDataAttribute(),vo,soilItemVOS));
}
}
beginRow+=sampleMergerNum;
......@@ -1351,6 +1405,25 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
return objectKey;
}
private String getFieldValue(String dataAttribute, SoilExperimentVO vo, List<SoilItemVO> soilItemVOList) {
if (StringUtils.isBlank(dataAttribute)){
return "";
}
if (StringHandleUtils.is_alpha(dataAttribute)){
return StringHandleUtils.getFieldIfNummReturnBlankValueByFieldName(dataAttribute,vo);
}else{
if (CollectionUtils.isEmpty(soilItemVOList)){
return "";
}
for (SoilItemVO soilItemVO : soilItemVOList) {
if (dataAttribute.equals(soilItemVO.getName())){
return soilItemVO.getTestValue();
}
}
}
return "";
}
public void GenerateChart(XSSFSheet sheet,String xValue , String yValue) {
......@@ -2847,7 +2920,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
@Transactional(rollbackFor = Exception.class)
@Override
public boolean uploadWaterJieXianCollect(MultipartFile file, Long entrustId, Account account) {
public boolean uploadWaterJieXianCollect(MultipartHttpServletRequest multipartHttpServletRequest, Long entrustId, Account account) {
RestAssert.fail(null == entrustId,"请选则委托单ID");
SoilEntrust entrust = soilEntrustService.getById(entrustId);
......@@ -2856,9 +2929,13 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
if (CollectionUtils.isEmpty(voList)){
RestAssert.fail("检测项目不存在");
}
parseWuxingTxt(file,entrust,voList);
Iterator<String> fileNamesItOk = multipartHttpServletRequest.getFileNames();
while (fileNamesItOk.hasNext()) {
String fileName = fileNamesItOk.next();
// 获取文件
MultipartFile file = multipartHttpServletRequest.getFile(fileName);
parseWuxingTxt(file, entrust, voList);
}
return true;
}
......@@ -3571,7 +3648,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
RestAssert.fail(StringUtils.isBlank(collectDataVO.getExpName()),"试验项目名称不能为空!");
RestAssert.fail(StringUtils.isBlank(collectDataVO.getName()),"指标名称不能为空!");
RestAssert.fail(StringUtils.isBlank(collectDataVO.getTestValue()),"指标值不能为空!");
RestAssert.fail(collectDataVO.getEntrustCode().equals(entrust.getEntrustCode()),"委托编号不匹配!");
RestAssert.fail(!collectDataVO.getEntrustCode().equals(entrust.getEntrustCode()),"委托编号不匹配!");
}
......
......@@ -458,10 +458,15 @@ public class SoilOriginalTemplateServiceImpl extends BaseServiceImpl<SoilOrigina
if (null == itemValueIndex || itemValueIndex ==sampleMergerNum){
XSSFCell itemCell = xssfRow.getCell(collectEntity.getColumnPlace());
String value = "";
if (itemCell.getCellType().equals(CellType.FORMULA)){
value = HSSFWorkbookUtil.getJavaValue(itemCell).toString();
}else {
// if (itemCell.getCellType().equals(CellType.FORMULA)){
// value = HSSFWorkbookUtil.getJavaValue(itemCell).toString();
// }else {
// value = formatter.formatCellValue(itemCell, evaluator);
// }
try {
value = formatter.formatCellValue(itemCell, evaluator);
}catch (Exception e){
value = HSSFWorkbookUtil.getJavaValue(itemCell).toString();
}
......@@ -519,10 +524,10 @@ public class SoilOriginalTemplateServiceImpl extends BaseServiceImpl<SoilOrigina
continue;
}
String value = "";
if (itemCell.getCellType().equals(CellType.FORMULA)){
value = HSSFWorkbookUtil.getJavaValue(itemCell).toString();
}else {
try {
value = formatter.formatCellValue(itemCell, evaluator);
}catch (Exception e){
value = HSSFWorkbookUtil.getJavaValue(itemCell).toString();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment