Commit 505ed1f4 authored by wangqiang's avatar wangqiang

修改采购计划导出是时间是空,并修改导出的时间格式xxxx/xx/xx;修改IED计划管理系统编码是空的问题

parent f844b1c0
......@@ -13,6 +13,7 @@ import lombok.NoArgsConstructor;
import org.apache.poi.ss.usermodel.CellType;
import java.io.File;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
......@@ -48,7 +49,7 @@ public class ExtPuchasePlanExcelVO {
*/
@ExcelProperty(value = {"采购计划","采购技术文件提交时间*"},index = 3)
@ColumnWidth(20)
private LocalDateTime purDesignFileSubmitTime;
private String purDesignFileSubmitTime;
/**
......@@ -56,7 +57,7 @@ public class ExtPuchasePlanExcelVO {
*/
@ExcelProperty(value = {"采购计划","合同签订时间*"},index = 4)
@ColumnWidth(20)
private LocalDateTime contractActualSigningTime;
private String contractActualSigningTime;
/**
......@@ -64,7 +65,7 @@ public class ExtPuchasePlanExcelVO {
*/
@ExcelProperty(value = {"采购计划","合同交付时间*"},index = 5)
@ColumnWidth(20)
private LocalDateTime contractActualDeliveryTime;
private String contractActualDeliveryTime;
/**
* 采购技术文件负责人
......
......@@ -268,7 +268,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
extIEDPlanVO.setPhase(extIEDPlanExcelVO.getPhase());
if (!ObjectUtils.isEmpty(extIEDPlanExcelVO.getAuditTime())) {
try {
LocalDateTime auditTime = LocalDateTime.of(LocalDate.parse(extIEDPlanExcelVO.getAuditTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd")), LocalTime.MIDNIGHT);
LocalDateTime auditTime = LocalDateTime.of(LocalDate.parse(extIEDPlanExcelVO.getAuditTime(), DateTimeFormatter.ofPattern("yyyy/MM/dd")), LocalTime.MIDNIGHT);
extIEDPlanVO.setAuditTime(auditTime);
} catch (Exception e) {
throw new DxBusinessException("-1", "审核时间格式不正确!");
......@@ -277,7 +277,7 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
}
if (!ObjectUtils.isEmpty(extIEDPlanExcelVO.getFileSubmitTime())) {
try {
LocalDateTime submitTime = LocalDateTime.of(LocalDate.parse(extIEDPlanExcelVO.getFileSubmitTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd")), LocalTime.MIDNIGHT);
LocalDateTime submitTime = LocalDateTime.of(LocalDate.parse(extIEDPlanExcelVO.getFileSubmitTime(), DateTimeFormatter.ofPattern("yyyy/MM/dd")), LocalTime.MIDNIGHT);
extIEDPlanVO.setFileSubmitTime(submitTime);
} catch (Exception e) {
throw new DxBusinessException("-1", "文件提交时间格式不正确!");
......@@ -352,22 +352,35 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
* @return
*/
public ExtIEDPlanVO getIEDPlanByFileNumberAndFileCodeAndSystemNumber(String fileNumber, String fileCode, String systemNumber) {
SearchQueryCondition searchQuery = SearchQueryCondition.builder().
searchItems(SearchItems.builder().child(
SearchItems.builder()
.item(new SearchItem("fileNumber", SearchItem.Operator.EQ, fileNumber, (Object) null))
.item(new SearchItem("fileCode", SearchItem.Operator.EQ, fileCode, (Object) null))
.item(new SearchItem("systemNumber", SearchItem.Operator.EQ, systemNumber, (Object) null))
.operator(SearchItems.BooleanOperator.OR).build())
.item(new SearchItem("dxContextId", SearchItem.Operator.EQ, projectId, (Object) null))
.item(new SearchItem("deleted", SearchItem.Operator.EQ, false, (Object) null))
.operator(SearchItems.BooleanOperator.AND)
.build()
).build();
SearchQueryCondition searchQuery = null;
if(StringUtils.isEmpty(systemNumber)){
searchQuery = SearchQueryCondition.builder().
searchItems(SearchItems.builder().child(
SearchItems.builder()
.item(new SearchItem("fileNumber", SearchItem.Operator.EQ, fileNumber, (Object) null))
.item(new SearchItem("fileCode", SearchItem.Operator.EQ, fileCode, (Object) null))
.operator(SearchItems.BooleanOperator.OR).build())
.item(new SearchItem("dxContextId", SearchItem.Operator.EQ, projectId, (Object) null))
.item(new SearchItem("deleted", SearchItem.Operator.EQ, false, (Object) null))
.operator(SearchItems.BooleanOperator.AND)
.build()
).build();
}else {
searchQuery = SearchQueryCondition.builder().
searchItems(SearchItems.builder().child(
SearchItems.builder()
.item(new SearchItem("fileNumber", SearchItem.Operator.EQ, fileNumber, (Object) null))
.item(new SearchItem("fileCode", SearchItem.Operator.EQ, fileCode, (Object) null))
.item(new SearchItem("systemNumber", SearchItem.Operator.EQ, systemNumber, (Object) null))
.operator(SearchItems.BooleanOperator.OR).build())
.item(new SearchItem("dxContextId", SearchItem.Operator.EQ, projectId, (Object) null))
.item(new SearchItem("deleted", SearchItem.Operator.EQ, false, (Object) null))
.operator(SearchItems.BooleanOperator.AND)
.build()
).build();
}
//根据文件编号查询IED计划
// DxPageImpl<ExtIEDPlanVO> IEDPlanPage = extIEDPlanService.findRecursion(SearchUtil.buildQuery("fileNumber", SearchItem.Operator.EQ, fileNumber));
DxPageImpl<ExtIEDPlanVO> IEDPlanPage = extIEDPlanService.findRecursion(searchQuery);
......@@ -471,11 +484,11 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcel
return;
}
//管理系统编码不能为空
if (StringUtils.isEmpty(extIEDPlanExcelVO.getSystemNumber())) {
errorString.append("解析到数据第" + excelDataRow + "行文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的管理信息系统编码不能为空!!");
errorList.add(errorString);
return;
}
// if (StringUtils.isEmpty(extIEDPlanExcelVO.getSystemNumber())) {
// errorString.append("解析到数据第" + excelDataRow + "行文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的管理信息系统编码不能为空!!");
// errorList.add(errorString);
// return;
// }
//文件提交时间不能为空
if (StringUtils.isEmpty(extIEDPlanExcelVO.getFileSubmitTime())) {
errorString.append("解析到数据第" + excelDataRow + "行文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的提交时间不能为空!!");
......
......@@ -29,6 +29,10 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import javax.servlet.ServletContextListener;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -146,9 +150,34 @@ public class PurchasePlanExcelReadListenner extends AnalysisEventListener<ExtPuc
*/
public ExtPuchasePlanAttributeVO transformObject(ExtPuchasePlanAttributeVO extPuchasePlanAttributeVO, ExtPuchasePlanExcelVO extPuchasePlanExcelVO) {
extPuchasePlanAttributeVO.setOutsourceProjectName(extPuchasePlanExcelVO.getOutsourceProjectName());
extPuchasePlanAttributeVO.setPurDesignFileSubmitTime(extPuchasePlanExcelVO.getPurDesignFileSubmitTime());
extPuchasePlanAttributeVO.setContractSigningTime(extPuchasePlanExcelVO.getContractActualSigningTime());
extPuchasePlanAttributeVO.setContractDeliveryTime(extPuchasePlanExcelVO.getContractActualDeliveryTime());
if (!ObjectUtils.isEmpty(extPuchasePlanExcelVO.getPurDesignFileSubmitTime())) {
try {
LocalDateTime purDesignFileSubmitTime = LocalDateTime.of(LocalDate.parse(extPuchasePlanExcelVO.getPurDesignFileSubmitTime(), DateTimeFormatter.ofPattern("yyyy/MM/dd")), LocalTime.MIDNIGHT);
extPuchasePlanAttributeVO.setPurDesignFileSubmitTime(purDesignFileSubmitTime);
} catch (Exception e) {
throw new DxBusinessException("-1", "采购技术文件提交时间格式不正确!");
}
}
if (!ObjectUtils.isEmpty(extPuchasePlanExcelVO.getContractActualSigningTime())) {
try {
LocalDateTime contractActualSigningTime = LocalDateTime.of(LocalDate.parse(extPuchasePlanExcelVO.getContractActualSigningTime(), DateTimeFormatter.ofPattern("yyyy/MM/dd")), LocalTime.MIDNIGHT);
extPuchasePlanAttributeVO.setContractSigningTime(contractActualSigningTime);
} catch (Exception e) {
throw new DxBusinessException("-1", "合同签订时间格式不正确!");
}
}
if (!ObjectUtils.isEmpty(extPuchasePlanExcelVO.getContractActualDeliveryTime())) {
try {
LocalDateTime contractActualDeliveryTime = LocalDateTime.of(LocalDate.parse(extPuchasePlanExcelVO.getContractActualDeliveryTime(), DateTimeFormatter.ofPattern("yyyy/MM/dd")), LocalTime.MIDNIGHT);
extPuchasePlanAttributeVO.setContractDeliveryTime(contractActualDeliveryTime);
} catch (Exception e) {
throw new DxBusinessException("-1", "合同交付时间格式不正确!");
}
}
extPuchasePlanAttributeVO.setPurDesignFileManager(extPuchasePlanExcelVO.getPurDesignFileManager());
extPuchasePlanAttributeVO.setPurchaseBudget(extPuchasePlanExcelVO.getPurchaseBudget());
//获取密级code
......
......@@ -41,6 +41,7 @@ import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
......@@ -177,9 +178,9 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
for (V extPuchasePlanAttribute : content) {
ExtPuchasePlanExcelVO extPuchasePlanExcelVO = new ExtPuchasePlanExcelVO();
extPuchasePlanExcelVO.setOutsourceProjectName(extPuchasePlanAttribute.getOutsourceProjectName());
extPuchasePlanExcelVO.setPurDesignFileSubmitTime(extPuchasePlanAttribute.getPurDesignFileSubmitTime());
extPuchasePlanExcelVO.setContractActualSigningTime(extPuchasePlanAttribute.getContractActualSigningTime());
extPuchasePlanExcelVO.setContractActualDeliveryTime(extPuchasePlanAttribute.getContractActualDeliveryTime());
extPuchasePlanExcelVO.setPurDesignFileSubmitTime(extPuchasePlanAttribute.getPurDesignFileSubmitTime().toLocalDate().format(DateTimeFormatter.ofPattern("yyyy/MM/dd")));
extPuchasePlanExcelVO.setContractActualSigningTime(extPuchasePlanAttribute.getContractSigningTime().toLocalDate().format(DateTimeFormatter.ofPattern("yyyy/MM/dd")));
extPuchasePlanExcelVO.setContractActualDeliveryTime(extPuchasePlanAttribute.getContractDeliveryTime().toLocalDate().format(DateTimeFormatter.ofPattern("yyyy/MM/dd")));
Object purDesignFileManager = extPuchasePlanAttribute.getDynamicAttrs().get("userName");
extPuchasePlanExcelVO.setPurDesignFileManager(purDesignFileManager != null ? purDesignFileManager.toString():null);
extPuchasePlanExcelVO.setPurchaseBudget(extPuchasePlanAttribute.getPurchaseBudget());
......
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