Commit 8c98e03c authored by wangqiang's avatar wangqiang

创建IED计划任务、和更新计划状态的功能开发

parent a47d4a9c
...@@ -165,6 +165,10 @@ public class Constants { ...@@ -165,6 +165,10 @@ public class Constants {
* 已完成 * 已完成
*/ */
public static final String COMPLETED = "completed"; public static final String COMPLETED = "completed";
/**
* 已完成
*/
public static final String COMPLETE = "Complete";
/** /**
* 未完成 * 未完成
......
...@@ -55,6 +55,23 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe ...@@ -55,6 +55,23 @@ public class ExtIEDPlanController<V extends ExtIEDPlanVO, S extends ExtIEDPlanSe
public ApiResult exportPlan(HttpServletResponse response, @RequestParam("ids") List<Long> ids) throws IOException { public ApiResult exportPlan(HttpServletResponse response, @RequestParam("ids") List<Long> ids) throws IOException {
return ApiResult.ok(extIEDPlanService.exportIEDPlan(response, ids),"IED计划导出成功"); return ApiResult.ok(extIEDPlanService.exportIEDPlan(response, ids),"IED计划导出成功");
} }
/**
*
* @param extIEDPlanVO
* @return
*/
@ApiOperation(value = "创建IED计划任务", notes = "创建IED计划任务")
@PostMapping(value = "/createIEDPlanTask")
public ApiResult createIEDPlanTask(@RequestBody ExtIEDPlanVO extIEDPlanVO){
return ApiResult.ok(extIEDPlanService.createIEDPlanTask(extIEDPlanVO),"成功创建IED计划任务");
}
@ApiOperation(value = "修改IED计划状态", notes = "修改IED计划状态")
@GetMapping(value = "/updatePlanState")
public ApiResult updatePlanState(@RequestParam("id") Long id,@RequestParam("planState")String planState){
return ApiResult.ok(extIEDPlanService.updatePlanState(id,planState),"更新状态成功");
}
} }
...@@ -18,4 +18,6 @@ public interface ExtIEDPlanService<V extends ExtIEDPlanVO> extends ExtIEDPlanSer ...@@ -18,4 +18,6 @@ public interface ExtIEDPlanService<V extends ExtIEDPlanVO> extends ExtIEDPlanSer
String importIEDPlan(InputStream inputStream,String projectId); String importIEDPlan(InputStream inputStream,String projectId);
String exportIEDPlan(HttpServletResponse response, List<String> ids) throws IOException; String exportIEDPlan(HttpServletResponse response, List<String> ids) throws IOException;
String createIEDPlanTask(ExtIEDPlanVO extIEDPlanVO);
String updatePlanState(Long id,String planState);
} }
package com.yonde.dcs.plan.core.service.impl; package com.yonde.dcs.plan.core.service.impl;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONPObject;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.expand.entity.DxDocumentVOExpand;
import com.yonde.dcs.feign.expand.ExtDxDocumentServiceFeign;
import com.yonde.dcs.plan.common.constants.Constants; import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO; import com.yonde.dcs.plan.common.vo.ExtIEDPlanExcelVO;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO; import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO; import com.yonde.dcs.plan.common.vo.ExtPuchasePlanExcelVO;
import com.yonde.dcs.plan.core.listener.IEDPlanExcelListenner; import com.yonde.dcs.plan.core.listener.IEDPlanExcelListenner;
import com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner; import com.yonde.dcs.plan.core.listener.PurchasePlanExcelReadListenner;
import com.yonde.dcs.plan.core.repository.ExtIEDPlanRepository; import com.yonde.dcs.plan.core.repository.ExtIEDPlanRepository;
import com.yonde.dcs.plan.core.service.ExtIEDPlanDocLinkService;
import com.yonde.dcs.plan.core.service.ExtIEDPlanService; import com.yonde.dcs.plan.core.service.ExtIEDPlanService;
import com.yonde.dcs.plan.core.util.CommonUtils; import com.yonde.dcs.plan.core.util.CommonUtils;
import com.yonde.dcs.plan.core.util.FileUtils; import com.yonde.dcs.plan.core.util.FileUtils;
import com.yonde.dcs.plan.core.util.ResourceHelper; import com.yonde.dcs.plan.core.util.ResourceHelper;
import com.yonde.dcs.plan.entity.po.ExtIEDPlan; import com.yonde.dcs.plan.entity.po.ExtIEDPlan;
import com.yonde.dcs.plan.entity.po.ExtIEDPlanDocLink;
import com.yonde.dex.basedata.data.search.SearchItem; import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems; import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.api.ApiResult; import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.basedata.entity.api.CustomMultipartFile; import com.yonde.dex.basedata.entity.api.CustomMultipartFile;
import com.yonde.dex.basedata.entity.data.DxPageImpl; 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.basedata.exception.DxBusinessException;
import com.yonde.dex.dfs.feign.FileManagerFeignService; import com.yonde.dex.dfs.feign.FileManagerFeignService;
import com.yonde.dex.systemfile.feign.SystemFileFeignService; import com.yonde.dex.systemfile.feign.SystemFileFeignService;
...@@ -32,8 +43,11 @@ import java.io.ByteArrayInputStream; ...@@ -32,8 +43,11 @@ import java.io.ByteArrayInputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -61,6 +75,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -61,6 +75,10 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
private SystemFileFeignService systemFileFeignService; private SystemFileFeignService systemFileFeignService;
@Autowired @Autowired
private FileManagerFeignService fileManagerFeignService; private FileManagerFeignService fileManagerFeignService;
@Autowired
private ExtDxDocumentServiceFeign<DxDocumentVO> extDxDocumentServiceFeign;
@Autowired
private ExtIEDPlanDocLinkService extIEDPlanDocLinkService;
@Override @Override
public String importIEDPlan(InputStream inputStream,String projectId) { public String importIEDPlan(InputStream inputStream,String projectId) {
...@@ -120,6 +138,8 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -120,6 +138,8 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
return ApiResult.SUCCESS; return ApiResult.SUCCESS;
} }
private List<ExtIEDPlanExcelVO> transformationObject(List<V> extIEDPlanList) { private List<ExtIEDPlanExcelVO> transformationObject(List<V> extIEDPlanList) {
List<ExtIEDPlanExcelVO> extIEDPlanExcelVOList = new ArrayList<>(); List<ExtIEDPlanExcelVO> extIEDPlanExcelVOList = new ArrayList<>();
for (ExtIEDPlanVO extIEDPlanVO : extIEDPlanList) { for (ExtIEDPlanVO extIEDPlanVO : extIEDPlanList) {
...@@ -147,6 +167,68 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan ...@@ -147,6 +167,68 @@ public class ExtIEDPlanServiceImpl<V extends ExtIEDPlanVO> implements ExtIEDPlan
} }
return extIEDPlanExcelVOList; return extIEDPlanExcelVOList;
} }
/**
* 创建IED计划任务
* @param extIEDPlanVO
* @return
*/
@Override
public String createIEDPlanTask(ExtIEDPlanVO extIEDPlanVO) {
System.out.println(JSONUtil.toJsonStr(extIEDPlanVO));
DxDocumentVO dxDocumentVO = new DxDocumentVO();
DxDocumentVOExpand dxDocumentExpand = new DxDocumentVOExpand();
//文件类型 --文件、图册
//文件分类--需要取英文
dxDocumentVO.setSubTypeName(extIEDPlanVO.getFileClassify());
//文件编号
dxDocumentVO.setNumber(extIEDPlanVO.getFileNumber());
Map<String, Object> dynamicAttrs = new HashMap<>();
//文件代号
dynamicAttrs.put("fileNumber",extIEDPlanVO.getFileCode());
//管理信息系统编码
dynamicAttrs.put("systemCode",extIEDPlanVO.getSystemNumber());
//阶段
dynamicAttrs.put("phase",extIEDPlanVO.getPhase());
//设置动态属性
dxDocumentVO.setDynamicAttrs(dynamicAttrs);
//设备号
dxDocumentExpand.setOwnedEquipment(extIEDPlanVO.getDeviceNumber());
//创建时间
dxDocumentVO.setCreateTime(LocalDateTime.now());
//设置扩展属性
dxDocumentVO.setDxDocumentExpand(dxDocumentExpand);
dxDocumentVO.setOperator(OperatorType.ADD);
DxDocumentVO dxDocumentVOForDB = extDxDocumentServiceFeign.saveRecursion(dxDocumentVO);
//保存文档与IED计划的关系
ExtIEDPlanDocLinkVO extIEDPlanDocLinkVO = new ExtIEDPlanDocLinkVO();
extIEDPlanDocLinkVO.setTargetId(dxDocumentVOForDB.getId());
extIEDPlanDocLinkVO.setSourceId(extIEDPlanVO.getId());
extIEDPlanDocLinkVO.setCreateTime(LocalDateTime.now());
extIEDPlanDocLinkVO.setOperator(OperatorType.ADD);
extIEDPlanDocLinkService.saveRecursion(extIEDPlanDocLinkVO);
return ApiResult.SUCCESS;
}
/**
* 更新计划状态
* @param planState
* @return
*/
@Override
public String updatePlanState(Long id,String planState) {
if(!StringUtils.isEmpty(planState)){
this.changeStatus(id,planState,true);
}else {
throw new DxBusinessException("500","参数不能为空");
}
return ApiResult.SUCCESS;
}
} }
...@@ -3,8 +3,12 @@ package com.yonde.dcs.plan.feign; ...@@ -3,8 +3,12 @@ package com.yonde.dcs.plan.feign;
import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO; import com.yonde.dcs.plan.common.vo.ExtIEDPlanVO;
import com.yonde.dcs.plan.feign.shadow.ExtIEDPlanServiceFeignShadow; import com.yonde.dcs.plan.feign.shadow.ExtIEDPlanServiceFeignShadow;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
...@@ -17,4 +21,9 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -17,4 +21,9 @@ import org.springframework.cloud.openfeign.FeignClient;
@FeignClient(value = "${dcs.feign.INET-PLAN}", path = "/ExtIEDPlan") @FeignClient(value = "${dcs.feign.INET-PLAN}", path = "/ExtIEDPlan")
public interface ExtIEDPlanServiceFeign<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceFeignShadow<V> { public interface ExtIEDPlanServiceFeign<V extends ExtIEDPlanVO> extends ExtIEDPlanServiceFeignShadow<V> {
@ApiOperation(value = "修改IED计划状态", notes = "修改IED计划状态")
@GetMapping(value = "/updatePlanState")
public String updatePlanState(@RequestParam(name = "IED计划id",value = "id") Long id, @RequestParam(value = "planState")String planState);
} }
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