Commit bd6c41e0 authored by wangqiang's avatar wangqiang

2.1代码是直接调用service,需要在4.1中增加fegin接口进行适配。增加 generatePlanDistributeRecord fegin接口

parent 5ff39dc1
package com.yonde.dcs.plan.core.controller; package com.yonde.dcs.plan.core.controller;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dcs.plan.core.service.AutoTaskService; import com.yonde.dcs.plan.core.service.AutoTaskService;
import com.yonde.dex.user.common.vo.DxOrganizationVO; import com.yonde.dex.user.common.vo.DxOrganizationVO;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -32,7 +33,6 @@ public class ExtDistributeRecordController<V extends ExtDistributeRecordVO, S ex ...@@ -32,7 +33,6 @@ public class ExtDistributeRecordController<V extends ExtDistributeRecordVO, S ex
@Autowired @Autowired
private ExtDistributeRecordService distributeRecordService; private ExtDistributeRecordService distributeRecordService;
/** /**
* 收发记录接口 * 收发记录接口
* *
...@@ -58,6 +58,20 @@ public class ExtDistributeRecordController<V extends ExtDistributeRecordVO, S ex ...@@ -58,6 +58,20 @@ public class ExtDistributeRecordController<V extends ExtDistributeRecordVO, S ex
public ApiResult searchOrgByUserId(@RequestParam("userId") Long userId, @RequestParam("code") String code) { public ApiResult searchOrgByUserId(@RequestParam("userId") Long userId, @RequestParam("code") String code) {
return ApiResult.ok(distributeRecordService.searchOrgNameByUserId(userId, code), "查询成功"); return ApiResult.ok(distributeRecordService.searchOrgNameByUserId(userId, code), "查询成功");
} }
/**
* 生成计划分发记录对象方法
*
* @param extPlanVO
* @return
*/
@ApiOperation("生成计划分发记录对象方法")
@GetMapping("/generatePlanDistributeRecord")
public ApiResult generatePlanDistributeRecord(@RequestBody ExtPlanVO extPlanVO)
{
distributeRecordService.generatePlanDistributeRecord(extPlanVO);
return ApiResult.ok("生成计划分发记录成功");
}
} }
package com.yonde.dcs.plan.core.service.impl; package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dcs.plan.common.vo.ExtDisReocredLinkVO; import com.yonde.dcs.plan.common.vo.ExtDisReocredLinkVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dcs.plan.core.service.AutoTaskService; import com.yonde.dcs.plan.core.service.AutoTaskService;
import com.yonde.dcs.plan.core.service.ExtDisReocredLinkService; import com.yonde.dcs.plan.core.service.ExtDisReocredLinkService;
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.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.utils.obj.DxEntityUtils;
import com.yonde.dex.user.common.vo.DxOrganizationVO; import com.yonde.dex.user.common.vo.DxOrganizationVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -18,6 +22,7 @@ import com.yonde.dcs.plan.common.vo.ExtDistributeRecordVO; ...@@ -18,6 +22,7 @@ import com.yonde.dcs.plan.common.vo.ExtDistributeRecordVO;
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;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtDistributeRecordService; import com.yonde.dcs.plan.core.service.ExtDistributeRecordService;
...@@ -83,6 +88,59 @@ public class ExtDistributeRecordServiceImpl<V extends ExtDistributeRecordVO> imp ...@@ -83,6 +88,59 @@ public class ExtDistributeRecordServiceImpl<V extends ExtDistributeRecordVO> imp
public List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code) { public List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code) {
return autoTaskService.searchOrgNameByUserId(userId, code); return autoTaskService.searchOrgNameByUserId(userId, code);
} }
/**
* 生成计划分发记录对象方法
*
* @param extPlanVO
*/
@Override
public void generatePlanDistributeRecord(ExtPlanVO extPlanVO) {
List<ExtDisReocredLinkVO> list = new ArrayList<>();
//创建分发记录对象
ExtDistributeRecordVO recordVO = new ExtDistributeRecordVO();
//分发类型
recordVO.setDistributeType("planFeedback");
//名称
recordVO.setBoTitle("完成计划反馈任务");
//分发时间
recordVO.setDistributTime(LocalDateTime.now());
recordVO.setDistributDepart(null);
//发送者
//todo wq: 暂时将获取用户信息代码注释,后续讨论后更改
Long userId = null;
// Long userId = this.searchUserId(extPlanVO.getPlanExecutor());
// recordVO.setSenderId(extPlanVO.getCreatorId());
// //接收者(计划执行人)
// recordVO.setHandlerId(userId);
//接收时间
recordVO.setReceiveTime(LocalDateTime.now());
List<DxOrganizationVO> organizationVOS = this.searchOrgNameByUserId(userId, "002");
//接收单位
if (CollectionUtils.isEmpty(organizationVOS)) {
recordVO.setReceiver(null);
} else {
for (DxOrganizationVO org : organizationVOS) {
//todo wq:将org.getOrgName() 修改为 org.getName();
//org.getOrgName();
org.getName();
}
recordVO.setReceiver(organizationVOS.get(0).getName());
}
//是否需回复
recordVO.setReplyDistribute("是");
recordVO.setReceiveType("planFeedback");
ExtDisReocredLinkVO disReocredLinkVO = new ExtDisReocredLinkVO();
//disReocredLinkVO.setTarget(DxObjectVo.class.cast(extPlanVO));
disReocredLinkVO.setTargetId(extPlanVO.getId());
disReocredLinkVO.setTargetIdType(DxEntityUtils.getModelName(ExtPlanVO.class));
disReocredLinkVO.setOperator(OperatorType.ADD);
list.add(disReocredLinkVO);
recordVO.setExtDisReocredLink(list);
recordVO.setOperator(OperatorType.ADD);
this.saveRecursion((V) recordVO);
}
} }
package com.yonde.dcs.plan.feign; package com.yonde.dcs.plan.feign;
import com.yonde.dcs.plan.common.vo.ExtDistributeRecordVO; import com.yonde.dcs.plan.common.vo.ExtDistributeRecordVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dex.basedata.entity.api.ApiResult; import com.yonde.dex.basedata.entity.api.ApiResult;
import com.yonde.dex.user.common.vo.DxOrganizationVO; import com.yonde.dex.user.common.vo.DxOrganizationVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -42,4 +43,15 @@ public interface ExtDistributeRecordServiceFeign<V extends ExtDistributeRecordVO ...@@ -42,4 +43,15 @@ public interface ExtDistributeRecordServiceFeign<V extends ExtDistributeRecordVO
@ApiOperation("通过用户id和code查询组织") @ApiOperation("通过用户id和code查询组织")
@GetMapping("/searchOrgByUserId") @GetMapping("/searchOrgByUserId")
List<DxOrganizationVO> searchOrgNameByUserId(@RequestParam("userId") Long userId, @RequestParam("code") String code); List<DxOrganizationVO> searchOrgNameByUserId(@RequestParam("userId") Long userId, @RequestParam("code") String code);
/**
* 生成计划分发记录对象方法
*
* @param extPlanVO
*/
@ApiOperation("生成计划分发记录对象方法")
@GetMapping("/generatePlanDistributeRecord")
void generatePlanDistributeRecord(ExtPlanVO extPlanVO);
} }
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