Commit dfe8fb4a authored by wangqiang's avatar wangqiang

IED计划导入、增加、删除、更新功能开发(未测试,编译通过);修改模型名称IDE->IED

parent 6df27433
......@@ -402,10 +402,15 @@ public class Constants {
public static final String EXCEL_UPDATE = "更新";
/**
* 采购计划相关属性
* 采购计划相关
*/
public static final String PURCHASE_PLAN_EXCEL_NAME = "\\采购计划列表.xlsx";
public static final String PURCHASE_PLAN_TEMP_FILE_CODE_NAME ="采购计划001模板";
/**
* IED计划相关
*/
public static final String IED_PLAN_EXCEL_NAME = "\\IED计划列表.xlsx";
public static final String IED_PLAN_TEMP_FILE_CODE_NAME ="IED计划001模板";
}
......@@ -36,7 +36,7 @@ import com.yonde.dex.linkdata.plugin.common.DxLinkDataVOHolder;
import com.yonde.dex.linkdata.plugin.common.DxLinkDataVOEmbeddable;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dex.basedata.entity.users.DxUserVO;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
/**
* @description: ExtIEDPlanDocLink-VO
......@@ -50,7 +50,7 @@ import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
@ToString(callSuper = true)
@DexTypeVersionProp(propName = "target", join = @VersionProperty(curVersion = VersionRelationType.NONE, refVersion = VersionRelationType.VERSION))
@DexTypeVersionProp(propName = "source", join = @VersionProperty(curVersion = VersionRelationType.NONE, refVersion = VersionRelationType.VERSION))
public class ExtIEDPlanDocLinkVO extends IdOnlyVO implements IdVO ,DxLinkDataVOHolder<ExtIDEPlanVO, DxDocumentVO>{
public class ExtIEDPlanDocLinkVO extends IdOnlyVO implements IdVO ,DxLinkDataVOHolder<ExtIEDPlanVO, DxDocumentVO>{
public static final String DX_ID_EMBEDDABLE_PROP_NAME = "dxIdEmbeddable";
public static final String DX_LINK_DATA_EMBEDDABLE_PROP_NAME = "dxLinkDataEmbeddable";
......@@ -67,7 +67,7 @@ public class ExtIEDPlanDocLinkVO extends IdOnlyVO implements IdVO ,DxLinkDataVOH
*/
@DexEmbedded()
@JsonIgnore
private DxLinkDataVOEmbeddable<ExtIDEPlanVO, DxDocumentVO> dxLinkDataEmbeddable;
private DxLinkDataVOEmbeddable<ExtIEDPlanVO, DxDocumentVO> dxLinkDataEmbeddable;
}
......
......@@ -87,7 +87,7 @@ public class ExtIEDPlanExcelVO {
*/
@ExcelProperty(value = {"IED计划","文件提交时间*"},index = 9)
@ColumnWidth(15)
private LocalDateTime fileSubmitTimee;
private LocalDateTime fileSubmitTime;
/**
* 编写者
......@@ -138,22 +138,6 @@ public class ExtIEDPlanExcelVO {
@ColumnWidth(15)
private String secretCode;
public static void main(String[] args) {
List<ExtIEDPlanExcelVO> list = new ArrayList<>();
for (int i=0;i<=1;i++){
ExtIEDPlanExcelVO extIEDPlanExcelVO = new ExtIEDPlanExcelVO();
extIEDPlanExcelVO.setNote("测试"+i);
list.add(extIEDPlanExcelVO);
}
EasyExcel.write(
"F:\\yangyi\\项目\\清华核研院\\核研院设计文档及原型\\IED计划导入模板22.xlsx", ExtIEDPlanExcelVO.class)
.sheet("采购计划").doWrite(list);
}
}
package com.yonde.dcs.plan.common.vo;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.ArrayList;
import cn.hutool.core.convert.Convert;
import com.yonde.dex.basedata.entity.annotation.XmlElementProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.math.BigInteger;
import org.springframework.data.annotation.Transient;
import lombok.experimental.Delegate;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.XmlAttribute;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.yonde.dex.basedata.entity.xmladapters.LocalDateTimeXmlAdapter;
import lombok.Data;
import com.yonde.dex.basedata.entity.annotation.*;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.TypeReference;
import com.yonde.dex.basedata.entity.annotation.DexEmbedded;
import com.yonde.dex.basedata.entity.annotation.RelationProperty;
import com.yonde.dex.basedata.entity.annotation.VersionProperty;
import com.yonde.dex.basedata.entity.data.VersionRelationType;
import com.yonde.dex.lcycle.plugin.common.entity.DxLifecycleManageBaseVOHolder;
import com.yonde.dex.lcycle.plugin.common.entity.DxLifecycleManageBaseVOEmbeddable;
import com.yonde.dex.basedata.entity.vo.DxIdVOEmbeddable;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO;
import com.yonde.dex.basedata.entity.vo.IdOnlyVO;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.secretcode.plugin.common.entity.DxSecretVOHolder;
import com.yonde.dex.secretcode.plugin.common.entity.DxSecretVOEmbeddable;
import com.yonde.dex.context.plugin.common.entity.DxContextVOEmbeddable;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import com.yonde.dex.dfs.objfilelink.plugin.common.entity.DxObjFileLinkVOEmbeddable;
import com.yonde.dex.dfs.objfilelink.plugin.common.entity.DxObjFileLinkVOHolder;
import com.yonde.dex.lcycle.plugin.common.entity.DxLifecycleManageBaseVOEmbeddable;
import com.yonde.dex.lcycle.plugin.common.entity.DxLifecycleManageBaseVOHolder;
import com.yonde.dex.logicdelete.plugin.common.entity.DxLogicDeleteVOEmbeddable;
import com.yonde.dex.logicdelete.plugin.common.entity.DxLogicDeleteVOHolder;
import com.yonde.dex.secretcode.plugin.common.entity.DxSecretVOEmbeddable;
import com.yonde.dex.secretcode.plugin.common.entity.DxSecretVOHolder;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOEmbeddable;
import com.yonde.dex.dfs.objfilelink.plugin.common.entity.DxObjFileLinkVOEmbeddable;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder;
import com.yonde.dex.basedata.entity.users.DxUserVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
import java.util.List;
/**
* @description: ExtIDEPlan-VO
* @description: ExtIEDPlan-VO
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
* @date: 2024-9-11 15:49:41
**/
@JsonTypeInfo( use = JsonTypeInfo.Id.CLASS, property = "dxClassname", visible = true, defaultImpl = ExtIDEPlanVO.class)
@JsonTypeInfo( use = JsonTypeInfo.Id.CLASS, property = "dxClassname", visible = true, defaultImpl = ExtIEDPlanVO.class)
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class ExtIDEPlanVO extends IdOnlyVO implements IdVO ,DxLifecycleManageBaseVOHolder ,DxObjFileLinkVOHolder ,DxSecretVOHolder ,DxIterationVOHolder<ExtIDEPlanVO>{
public class ExtIEDPlanVO extends IdOnlyVO implements IdVO ,DxContextVOHolder ,DxLifecycleManageBaseVOHolder ,DxObjFileLinkVOHolder ,DxIterationVOHolder<ExtIEDPlanVO> ,DxLogicDeleteVOHolder ,DxSecretVOHolder{
public static final String DX_CONTEXT_EMBEDDABLE_PROP_NAME = "dxContextEmbeddable";
public static final String DX_OBJ_FILE_LINK_EMBEDDABLE_PROP_NAME = "dxObjFileLinkEmbeddable";
public static final String DX_LIFECYCLE_MANAGE_BASE_EMBEDDABLE_PROP_NAME = "dxLifecycleManageBaseEmbeddable";
public static final String DX_ID_EMBEDDABLE_PROP_NAME = "dxIdEmbeddable";
public static final String DX_LOGIC_DELETE_EMBEDDABLE_PROP_NAME = "dxLogicDeleteEmbeddable";
public static final String DX_SECRET_EMBEDDABLE_PROP_NAME = "dxSecretEmbeddable";
public static final String DX_ITERATION_EMBEDDABLE_PROP_NAME = "dxIterationEmbeddable";
public static final String ACTUAL_COMPLETE_TIME_PROP_NAME = "actualCompleteTime";
......@@ -79,6 +66,13 @@ public class ExtIDEPlanVO extends IdOnlyVO implements IdVO ,DxLifecycleManageBas
public static final String RATIFIER_PROP_NAME = "ratifier";
public static final String SYSTEM_NUMBER_PROP_NAME = "systemNumber";
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxContextVOEmbeddable dxContextEmbeddable;
/**
* 扩展VO属性
*/
......@@ -100,6 +94,13 @@ public class ExtIDEPlanVO extends IdOnlyVO implements IdVO ,DxLifecycleManageBas
@JsonIgnore
private DxIdVOEmbeddable dxIdEmbeddable;
/**
* 扩展VO属性
*/
@DexEmbedded()
@JsonIgnore
private DxLogicDeleteVOEmbeddable dxLogicDeleteEmbeddable;
/**
* 扩展VO属性
*/
......@@ -112,7 +113,7 @@ public class ExtIDEPlanVO extends IdOnlyVO implements IdVO ,DxLifecycleManageBas
*/
@DexEmbedded()
@JsonIgnore
private DxIterationVOEmbeddable<ExtIDEPlanVO> dxIterationEmbeddable;
private DxIterationVOEmbeddable<ExtIEDPlanVO> dxIterationEmbeddable;
/**
* 实际完成时间
......@@ -171,10 +172,15 @@ public class ExtIDEPlanVO extends IdOnlyVO implements IdVO ,DxLifecycleManageBas
*/
private String fileName;
/**
* 文件编号
*/
private String fileNumber;
/**
* 文件提交时间
*/
private LocalDateTime fileSubmitTimee;
private LocalDateTime fileSubmitTime;
/**
* 文件类型
......
package com.yonde.dcs.plan.core.controller;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtIDEPlanService;
import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dcs.plan.core.controller.shadow.ExtIDEPlanControllerShadow;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
/**
* @description: ExtIDEPlan-Controller
* @author: dexadmin
* @version: V
* @date: 2024-8-29 17:14:49
**/
@Api(tags = "ExtIDEPlan管理服务")
@RequestMapping("/ExtIDEPlan")
@ResponseBody()
@Controller(ExtIDEPlanController.BEAN_NAME)
public class ExtIDEPlanController<V extends ExtIDEPlanVO & DxContextVOHolder, S extends ExtIDEPlanService<V>> extends ExtIDEPlanControllerShadow<V, S> {
}
package com.yonde.dcs.plan.core.controller;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.core.controller.shadow.ExtIEDPlanControllerShadow;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* @description: ExtIEDPlan-Controller
* @author: dexadmin
* @version: V
* @date: 2024-9-11 15:49:41
**/
@Api(tags = "ExtIEDPlan管理服务")
@RequestMapping("/ExtIEDPlan")
@ResponseBody()
@Controller(ExtIEDPlanController.BEAN_NAME)
public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanService<V>> extends ExtIEDPlanControllerShadow<V, S> {
@Autowired
private ExtIEDPlanService extIEDPlanService;
/**
* 导入采购计划
*
* @param uploadFile
* @return
* @throws IOException
*/
@ApiOperation("导入采购计划")
@PostMapping(value = "/insertIEDPlan")
public ApiResult insertPlan(@RequestParam("file") MultipartFile uploadFile) throws IOException {
return ApiResult.ok(extIEDPlanService.importIEDPlan(uploadFile.getInputStream()),"采购计划导入成功");
}
}
package com.yonde.dcs.plan.core.controller.shadow;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtIDEPlanService;
import com.yonde.dcs.plan.core.service.impl.ExtIDEPlanServiceImpl;
import com.yonde.dex.basedata.entity.api.ApiResult;
import javax.annotation.Resource;
import com.yonde.dex.basedata.auth.annos.PermissionObject;
import com.yonde.dex.version.plugin.core.controller.AbstractVersionBaseController;
import com.yonde.dex.basedata.auth.annos.SubPermission;
import com.yonde.entity.annotation.SandBoxOpen;
import org.springframework.web.bind.annotation.*;
import com.yonde.dex.dfs.objfilelink.plugin.core.controller.DxObjFileLinkController;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder;
import com.yonde.dex.lcycle.plugin.core.controller.AbstractLifecycleBaseController;
import com.yonde.dex.baseweb.AbstractBaseController;
import com.yonde.dex.basedata.entity.api.ApiResult;
/**
* @description: ExtIDEPlan-Controller
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
**/
public class ExtIDEPlanControllerShadow<V extends ExtIDEPlanVO & DxContextVOHolder, S extends ExtIDEPlanService<V>> implements AbstractBaseController<V, S> ,AbstractLifecycleBaseController<V, S> ,AbstractVersionBaseController<V, S> ,DxObjFileLinkController<V, S>{
public static final String BEAN_NAME = "extIDEPlanController";
/**
* 注入
*/
@Resource(name = ExtIDEPlanServiceImpl.BEAN_NAME)
private ExtIDEPlanService<V> extIDEPlanService;
/**
* getService
*/
@Override
public S getService() {
return (S)this.extIDEPlanService;
}
}
package com.yonde.dcs.plan.core.controller.shadow;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dcs.plan.core.service.impl.ExtIEDPlanServiceImpl;
import com.yonde.dex.baseweb.AbstractBaseController;
import com.yonde.dex.dfs.objfilelink.plugin.core.controller.DxObjFileLinkController;
import com.yonde.dex.lcycle.plugin.core.controller.AbstractLifecycleBaseController;
import com.yonde.dex.version.plugin.core.controller.AbstractVersionBaseController;
import javax.annotation.Resource;
/**
* @description: ExtIEDPlan-Controller
* @author: dexadmin
* @version: V
* @date: 2024-9-11 15:49:41
**/
public class ExtIEDPlanControllerShadow<V extends ExtIEDPlanVO, S extends ExtIEDPlanService<V>> implements AbstractBaseController<V, S> ,AbstractLifecycleBaseController<V, S> ,AbstractVersionBaseController<V, S> ,DxObjFileLinkController<V, S>{
public static final String BEAN_NAME = "extIEDPlanController";
/**
* 注入
*/
@Resource(name = ExtIEDPlanServiceImpl.BEAN_NAME)
private ExtIEDPlanService<V> extIEDPlanService;
/**
* getService
*/
@Override
public S getService() {
return (S)this.extIEDPlanService;
}
}
......@@ -3,25 +3,35 @@ package com.yonde.dcs.plan.core.listener;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.util.StringUtils;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import com.yonde.dcs.plan.common.utils.SearchUtil;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanAttributeVO;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO;
import com.yonde.dcs.plan.core.service.ExtDistributeRecordService;
import com.yonde.dcs.plan.core.service.ExtIDEPlanService;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dcs.plan.core.util.CommonUtils;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dao.service.util.ApplicationContextUtil;
import com.yonde.dex.dao.service.util.DxPageUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Component
@Slf4j
public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIDEPlanVO> {
public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIEDPlanExcelVO> {
@Autowired
private ExtIDEPlanService extIDEPlanService;
private ExtIEDPlanService extIEDPlanService;
/**
* 每隔100条处理下,然后清理list ,方便内存回收
......@@ -31,26 +41,62 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIDEPlanVO> {
/**
* 缓存的数据
*/
private List<ExtPuchasePlanExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private List<ExtIEDPlanExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
/**
* 校验数据的错误信息
*/
List<StringBuffer> errorList = new ArrayList<>();
/**
* excel操作符集合
*/
List<String> operationList = Arrays.asList(Constants.EXCEL_ADD, Constants.EXCEL_UPDATE, Constants.EXCEL_DELETE);
public IEDPlanExcelListenner() {
this.extIEDPlanService = ApplicationContextUtil.getBean(ExtIEDPlanService.class);
}
@Override
public void invoke(ExtIDEPlanVO extIDEPlanVO, AnalysisContext analysisContext) {
log.info("解析到一条数据:{}", extIDEPlanVO);
public void invoke(ExtIEDPlanExcelVO extIEDPlanExcelVO, AnalysisContext analysisContext) {
log.info("解析到一条数据:{}", extIEDPlanExcelVO);
//检查excel数据合法性
checkDataForExcel(extIEDPlanExcelVO);
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
// 收尾工作,处理剩下的缓存数据。。。
log.info("sheet={} 所有数据解析完成!", analysisContext.readSheetHolder().getSheetName());
if (errorList.size() > 0) {
throw new DxBusinessException("-1", "导入采购计划数据有误!!" + errorList.toString());
}
//处理全部检查通过的数据
for (ExtIEDPlanExcelVO extIEDPlanExcelVO : cachedDataList) {
ExtIEDPlanVO extIEDPlanVO = new ExtIEDPlanVO();
//将excel对象转换为po对象
transitionObject(extIEDPlanVO, extIEDPlanExcelVO);
if (Constants.EXCEL_ADD.equals(extIEDPlanExcelVO.getOperation())) {//新增
extIEDPlanVO.setOperator(OperatorType.ADD);
extIEDPlanService.saveRecursion(extIEDPlanVO);
} else if (Constants.EXCEL_UPDATE.equals(extIEDPlanExcelVO.getOperation())) {//更新
extIEDPlanVO.setOperator(OperatorType.MODIFY);
ExtIEDPlanVO extIEDPlanVOForDB = getIEDPlanByFileNumber(extIEDPlanExcelVO.getFileNumber());
transitionObject(extIEDPlanVOForDB,extIEDPlanExcelVO);
extIEDPlanService.saveRecursion(extIEDPlanVOForDB);
} else { //删除
ExtIEDPlanVO extIEDPlanVOForDB = getIEDPlanByFileNumber(extIEDPlanExcelVO.getFileNumber());
extIEDPlanService.remove(extIEDPlanVOForDB.getId());
}
}
}
/**
*
* @param exception
* @param context
* @throws Exception
......@@ -62,6 +108,70 @@ public class IEDPlanExcelListenner extends AnalysisEventListener<ExtIDEPlanVO> {
}
/**
* 校验excel中的数据是否合法
*
* @param extIEDPlanExcelVO excel表格内容对象
*/
public void checkDataForExcel(ExtIEDPlanExcelVO extIEDPlanExcelVO) {
StringBuffer errorString = new StringBuffer();
//校验数据
if (!StringUtils.isEmpty(extIEDPlanExcelVO.getOperation()) && !StringUtils.isEmpty(extIEDPlanExcelVO.getFileNumber())) {
if (operationList.contains(extIEDPlanExcelVO.getOperation())) {
errorString.append("文件编号为:" + extIEDPlanExcelVO.getFileNumber() + "的操作符无法识别!!");
errorList.add(errorString);
}
if (Constants.EXCEL_ADD.equals(extIEDPlanExcelVO.getOperation())) {
//如果是新增,查看一下数据库中是不是已经存在
ExtIEDPlanVO extIEDPlanVO = getIEDPlanByFileNumber(extIEDPlanExcelVO.getFileNumber());
if (!ObjectUtils.isEmpty(extIEDPlanVO)) {
errorString.append("新增IED计划的文件编号:" + extIEDPlanExcelVO.getFileNumber() + "已存在,不能重复添加!");
errorList.add(errorString);
}
}
} else {
errorString.append("文件编号、操作符均不能为空!!");
errorList.add(errorString);
}
cachedDataList.add(extIEDPlanExcelVO);
}
/**
* 转换数据,将EXCEL对象转换为PO对象
*/
private void transitionObject(ExtIEDPlanVO extIEDPlanVO, ExtIEDPlanExcelVO extIEDPlanExcelVO) {
extIEDPlanVO.setFileType(extIEDPlanExcelVO.getFileType());
extIEDPlanVO.setFileClassify(extIEDPlanExcelVO.getFileClassify());
extIEDPlanVO.setFileNumber(extIEDPlanExcelVO.getFileNumber());
extIEDPlanVO.setFileCode(extIEDPlanExcelVO.getFileCode());
extIEDPlanVO.setSystemNumber(extIEDPlanExcelVO.getSystemNumber());
extIEDPlanVO.setDeviceNumber(extIEDPlanExcelVO.getDeviceNumber());
extIEDPlanVO.setPhase(extIEDPlanExcelVO.getPhase());
extIEDPlanVO.setAuditTime(extIEDPlanExcelVO.getAuditTime());
extIEDPlanVO.setFileSubmitTime(extIEDPlanExcelVO.getFileSubmitTime());
extIEDPlanVO.setEditor(extIEDPlanExcelVO.getEditor());
extIEDPlanVO.setChecker(extIEDPlanExcelVO.getChecker());
extIEDPlanVO.setAuditor(extIEDPlanExcelVO.getAuditor());
extIEDPlanVO.setInvestigator(extIEDPlanExcelVO.getInvestigator());
extIEDPlanVO.setRatifier(extIEDPlanExcelVO.getRatifier());
extIEDPlanVO.setNote(extIEDPlanExcelVO.getNote());
//获取密级code
String secretCode = CommonUtils.searchDictDataByDictCode(Constants.SECRET_CODE, extIEDPlanExcelVO.getSecretCode());
extIEDPlanVO.setSecretCode(secretCode);
}
public ExtIEDPlanVO getIEDPlanByFileNumber(String fileNumber) {
//根据文件编号查询IED计划
DxPageImpl<ExtIEDPlanVO> IEDPlanPage = extIEDPlanService.findRecursion(SearchUtil.buildQuery("fileNumber", SearchItem.Operator.EQ, fileNumber));
if (!CollectionUtils.isEmpty(IEDPlanPage.getContent())) {
ExtIEDPlanVO extIEDPlanVOForDB = DxPageUtils.getFirst(IEDPlanPage);
return extIEDPlanVOForDB;
} else {
log.info("根据计划的文件编码:{},未查到相关计划", fileNumber);
}
return null;
}
}
package com.yonde.dcs.plan.core.repository;
import com.yonde.dcs.plan.entity.po.ExtIDEPlan;
import com.yonde.dcs.plan.core.repository.shadow.ExtIDEPlanRepositoryShadow;
/**
* @description: ExtIDEPlan-repository
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
**/
public interface ExtIDEPlanRepository<P extends ExtIDEPlan> extends ExtIDEPlanRepositoryShadow<P> {
}
package com.yonde.dcs.plan.core.repository;
import com.yonde.dcs.plan.core.repository.shadow.ExtIEDPlanRepositoryShadow;
import com.yonde.dcs.plan.entity.po.ExtIEDPlan;
/**
* @description: ExtIEDPlan-repository
* @author: dexadmin
* @version: V
* @date: 2024-9-11 15:49:41
**/
public interface ExtIEDPlanRepository<P extends ExtIEDPlan> extends ExtIEDPlanRepositoryShadow<P> {
}
package com.yonde.dcs.plan.core.repository.shadow;
import com.yonde.dcs.plan.entity.po.ExtIDEPlan;
import com.yonde.dcs.plan.entity.po.ExtIEDPlan;
import org.springframework.data.repository.NoRepositoryBean;
import com.yonde.dex.context.plugin.core.repository.DxContextPluginRepository;
import com.yonde.dex.logicdelete.plugin.core.repository.DxLogicDeleteRepository;
import com.yonde.dex.dao.business.repository.BaseRepository;
import com.yonde.dex.secretcode.plugin.core.repositroy.DxSecretCodePluginRepository;
import com.yonde.dex.version.plugin.core.repository.DxIterationRepository;
import com.yonde.dex.lcycle.plugin.core.repository.DxLifecycleManageBaseRepository;
import com.yonde.dex.dfs.objfilelink.plugin.core.repository.DxObjFileLinkPluginRepository;
/**
* @description: ExtIDEPlan-repository
* @description: ExtIEDPlan-repository
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
* @date: 2024-9-11 15:49:41
**/
@NoRepositoryBean
public interface ExtIDEPlanRepositoryShadow<P extends ExtIDEPlan> extends DxObjFileLinkPluginRepository<P> ,DxLifecycleManageBaseRepository<P> ,BaseRepository<P> ,DxSecretCodePluginRepository<P> ,DxIterationRepository<P> {
public interface ExtIEDPlanRepositoryShadow<P extends ExtIEDPlan> extends DxContextPluginRepository<P> ,DxObjFileLinkPluginRepository<P> ,DxLifecycleManageBaseRepository<P> ,BaseRepository<P> ,DxLogicDeleteRepository<P> ,DxSecretCodePluginRepository<P> ,DxIterationRepository<P> {
String BEAN_NAME = "extIDEPlanRepository";
String BEAN_NAME = "extIEDPlanRepository";
}
package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import com.yonde.dcs.plan.core.service.shadow.ExtIDEPlanServiceShadow;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
/**
* @description: ExtIDEPlan-service
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
**/
public interface ExtIDEPlanService<V extends ExtIDEPlanVO & DxContextVOHolder> extends ExtIDEPlanServiceShadow<V> {
}
package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.core.service.shadow.ExtIEDPlanServiceShadow;
import java.io.InputStream;
/**
* @description: ExtIEDPlan-service
* @author: dexadmin
* @version: V
* @date: 2024-9-11 15:49:41
**/
public interface ExtIEDPlanService<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceShadow<V> {
String importIEDPlan(InputStream inputStream);
}
package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtIDEPlanService;
import com.yonde.dcs.plan.core.repository.ExtIDEPlanRepository;
import com.yonde.dcs.plan.entity.po.ExtIDEPlan;
import javax.annotation.Resource;
/**
* @description: ExtIDEPlan-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
**/
@Slf4j
@Service(ExtIDEPlanServiceImpl.BEAN_NAME)
public class ExtIDEPlanServiceImpl<V extends ExtIDEPlanVO & DxContextVOHolder> implements ExtIDEPlanService<V>{
public static final String BEAN_NAME = "extIDEPlanServiceImpl";
@Autowired
ExtIDEPlanRepository<ExtIDEPlan> extIDEPlanRepository;
}
package com.yonde.dcs.plan.core.service.impl;
import com.alibaba.excel.EasyExcel;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO;
import com.yonde.dcs.plan.core.listener.IEDPlanExcelListenner;
import com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner;
import com.yonde.dcs.plan.core.repository.ExtIEDPlanRepository;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dcs.plan.entity.po.ExtIEDPlan;
import com.yonde.dex.basedata.entity.api.ApiResult;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.io.InputStream;
import java.util.List;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
/**
* @description: ExtIEDPlan-ServiceImpl
* @author: dexadmin
* @version: V
* @date: 2024-9-11 15:49:41
**/
@Slf4j
@Service(ExtIEDPlanServiceImpl.BEAN_NAME)
public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlanService<V> {
public static final String BEAN_NAME = "extIEDPlanServiceImpl";
@Autowired
ExtIEDPlanRepository<ExtIEDPlan> extIEDPlanRepository;
@Override
public String importIEDPlan(InputStream inputStream) {
EasyExcel.read(inputStream, ExtPuchasePlanExcelVO.class,
new IEDPlanExcelListenner())
.sheet()
.doRead();
return ApiResult.SUCCESS;
}
}
......@@ -83,7 +83,7 @@ public class ExtPuchasePlanAttributeServiceImpl<V extends ExtPuchasePlanAttribut
.item(new SearchItem("id", SearchItem.Operator.IN, Ids, null))
.build())
.build();
//根据批量计划编码获取计划集合
//根据批量计划id获取计划集合
DxPageImpl<V> purchasePlanPage = this.findRecursion(condition);
if (CollectionUtils.isNotEmpty(purchasePlanPage.getContent())) {
List<V> content = purchasePlanPage.getContent();
......
package com.yonde.dcs.plan.core.service.shadow;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import com.yonde.dcs.plan.feign.ExtIDEPlanServiceFeign;
import com.yonde.dex.context.plugin.common.entity.DxContextVOHolder;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.feign.ExtIEDPlanServiceFeign;
import com.yonde.dex.dao.service.BaseIdEntityService;
import com.yonde.dex.secretcode.plugin.core.service.SecretCodePluginService;
import com.yonde.dex.version.plugin.core.service.IterationService;
import com.yonde.dex.context.plugin.core.service.ContextPluginService;
import com.yonde.dex.lcycle.plugin.core.service.LifecycleBaseService;
import com.yonde.dex.logicdelete.plugin.core.service.LogicDeleteService;
import com.yonde.dex.dfs.objfilelink.plugin.core.service.ObjFileLinkPluginService;
/**
* @description: ExtIDEPlan-service
* @description: ExtIEDPlan-service
* @author: dexadmin
* @version: V
* @date: 2024-8-30 10:28:37
* @date: 2024-9-11 15:49:41
**/
public interface ExtIDEPlanServiceShadow<V extends ExtIDEPlanVO & DxContextVOHolder> extends ExtIDEPlanServiceFeign<V>, ContextPluginService<V> ,ObjFileLinkPluginService<V> ,LifecycleBaseService<V> ,BaseIdEntityService<V> ,SecretCodePluginService<V> ,IterationService<V> {
public interface ExtIEDPlanServiceShadow<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceFeign<V>, ContextPluginService<V> ,ObjFileLinkPluginService<V> ,LifecycleBaseService<V> ,BaseIdEntityService<V> ,LogicDeleteService<V> ,SecretCodePluginService<V> ,IterationService<V> {
}
......@@ -23,31 +23,41 @@ import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.yonde.dex.lcycle.plugin.entities.DxLifecycleManageBaseEmbeddable;
import com.yonde.dex.dao.entity.base.IdEntity;
import javax.persistence.Column;
import com.yonde.dex.context.plugin.entities.DxContextHolder;
import com.yonde.dex.dfs.objfilelink.plugin.entities.DxObjFileLinkHolder;
import com.yonde.dex.dfs.objfilelink.plugin.entities.DxObjFileLinkEmbeddable;
import com.yonde.dex.context.plugin.entities.DxContextEmbeddable;
import com.yonde.dex.dao.entity.base.IdOnlyEntity;
import com.yonde.dex.version.plugin.entities.DxIterationHolder;
import com.yonde.dex.logicdelete.plugin.entities.DxLogicDeleteHolder;
import com.yonde.dex.dao.entity.base.IdEntity;
import javax.persistence.Column;
import com.yonde.dex.secretcode.plugin.entities.DxSecretHolder;
import com.yonde.dex.lcycle.plugin.entities.DxLifecycleManageBaseHolder;
import com.yonde.dex.dao.entity.base.DxIdEntityEmbeddable;
import com.yonde.dex.secretcode.plugin.entities.DxSecretEmbeddable;
import com.yonde.dex.dao.entity.base.IdOnlyEntity;
import com.yonde.dex.version.plugin.entities.DxIterationHolder;
import com.yonde.dex.logicdelete.plugin.entities.DxLogicDeleteEmbeddable;
import com.yonde.dex.version.plugin.entities.DxIterationEmbeddable;
/**
* @description: ExtIDEPlan-PO实体
* @description: ExtIEDPlan-PO实体
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
* @date: 2024-9-11 15:49:41
**/
@Entity
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@Data
@Table(name = "EXT_IDE_PLAN")
public class ExtIDEPlan extends IdOnlyEntity implements DxObjFileLinkHolder ,DxLifecycleManageBaseHolder ,IdEntity ,DxSecretHolder ,DxIterationHolder{
@Table(name = "EXT_IED_PLAN")
public class ExtIEDPlan extends IdOnlyEntity implements DxContextHolder ,DxObjFileLinkHolder ,DxLifecycleManageBaseHolder ,IdEntity ,DxLogicDeleteHolder ,DxSecretHolder ,DxIterationHolder{
/**
* 扩展PO属性
*/
@DexEmbedded()
@Embedded()
private DxContextEmbeddable dxContextEmbeddable;
/**
* 扩展PO属性
*/
......@@ -71,6 +81,12 @@ public class ExtIDEPlan extends IdOnlyEntity implements DxObjFileLinkHolder ,DxL
*/
@DexEmbedded()
@Embedded()
private DxLogicDeleteEmbeddable dxLogicDeleteEmbeddable;
/**
* 扩展PO属性
*/
@DexEmbedded()
@Embedded()
private DxSecretEmbeddable dxSecretEmbeddable;
/**
* 扩展PO属性
......@@ -118,10 +134,15 @@ public class ExtIDEPlan extends IdOnlyEntity implements DxObjFileLinkHolder ,DxL
* 文件名称
*/
private String fileName;
/**
* 文件编号
*/
private String fileNumber;
/**
* 文件提交时间
*/
private LocalDateTime fileSubmitTimee;
private LocalDateTime fileSubmitTime;
/**
* 文件类型
*/
......
package com.yonde.dcs.plan.feign;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.feign.shadow.ExtIDEPlanServiceFeignShadow;
/**
* @description: ExtIDEPlan-Feign
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
**/
@Api(tags = "ExtIDEPlan-FEIGN")
@FeignClient(value = "${dcs.feign.INET-PLAN}", path = "/ExtIDEPlan")
public interface ExtIDEPlanServiceFeign<V extends ExtIDEPlanVO> extends ExtIDEPlanServiceFeignShadow<V> {
}
package com.yonde.dcs.plan.feign;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.feign.shadow.ExtIEDPlanServiceFeignShadow;
import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
/**
* @description: ExtIEDPlan-Feign
* @author: dexadmin
* @version: V
* @date: 2024-9-11 15:49:41
**/
@Api(tags = "ExtIEDPlan-FEIGN")
@FeignClient(value = "${dcs.feign.INET-PLAN}", path = "/ExtIEDPlan")
public interface ExtIEDPlanServiceFeign<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceFeignShadow<V> {
}
package com.yonde.dcs.plan.feign.shadow;
import com.yonde.dcs.plan.common.vo.ExtIDEPlanVO;
import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.yonde.dex.lcycle.plugin.feign.BaseLifecycleManageFeign;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dex.context.plugin.feign.ContextPluginFeign;
import com.yonde.dex.dao.service.remotes.BaseFeign;
import com.yonde.dex.lcycle.plugin.feign.BaseLifecycleManageFeign;
import com.yonde.dex.logicdelete.plugin.feign.LogicDeleteFeign;
import com.yonde.dex.secretcode.plugin.feign.SecretCodeFeign;
import com.yonde.dex.version.plugin.feign.BaseVersionFeign;
import org.springframework.web.bind.annotation.*;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder;
/**
* @description: ExtIDEPlan-Feign
* @description: ExtIEDPlan-Feign
* @author: dexadmin
* @version: V
* @date: 2024-8-29 9:31:22
* @date: 2024-9-11 15:49:41
**/
public interface ExtIDEPlanServiceFeignShadow<V extends ExtIDEPlanVO> extends BaseLifecycleManageFeign<V> ,BaseFeign<V> ,SecretCodeFeign<V> ,BaseVersionFeign<V> {
public interface ExtIEDPlanServiceFeignShadow<V extends ExtIEDPlanVO> extends ContextPluginFeign<V> ,BaseLifecycleManageFeign<V> ,BaseFeign<V> ,LogicDeleteFeign<V> ,SecretCodeFeign<V> ,BaseVersionFeign<V> {
String BEAN_NAME = "extIDEPlanServiceFeign";
String BEAN_NAME = "extIEDPlanServiceFeign";
}
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