Commit ada8bd82 authored by wangqiang's avatar wangqiang

ExtDistributeRecordController:业务代码迁入(2.x版本->4.1版本)

parent 18ebc712
package com.yonde.dcs.plan.core.controller;
import com.yonde.dcs.plan.core.service.AutoTaskService;
import com.yonde.dex.user.common.vo.DxOrganizationVO;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
......@@ -27,7 +29,37 @@ import org.springframework.stereotype.Controller;
@Controller(ExtDistributeRecordController.BEAN_NAME)
public class ExtDistributeRecordController<V extends ExtDistributeRecordVO, S extends ExtDistributeRecordService<V>> extends ExtDistributeRecordControllerShadow<V, S> {
@Autowired
private ExtDistributeRecordService distributeRecordService;
@Autowired
private AutoTaskService autoTaskService;
/**
* 收发记录接口
*
* @param id
* @return
*/
@ApiOperation("获取收发记录接口")
@GetMapping("/getDisRecord")
public ApiResult getDisRecord(@RequestParam("id") Long id) {
List<ExtDistributeRecordVO> disRecord = distributeRecordService.getDisRecord(id);
return ApiResult.ok(disRecord, "查询成功");
}
/**
* 通过用户id和code查询组织
*
* @param userId
* @param code
* @return
*/
@ApiOperation("通过用户id和code查询组织")
@GetMapping("/searchOrgByUserId")
public ApiResult searchOrgByUserId(@RequestParam("userId") Long userId, @RequestParam("code") String code) {
List<DxOrganizationVO> organizationVOS = autoTaskService.searchOrgNameByUserId(userId, code);
return ApiResult.ok(organizationVOS, "查询成功");
}
}
package com.yonde.dcs.plan.core.service;
import com.yonde.dex.user.common.vo.DxOrganizationVO;
import java.util.List;
import java.util.Map;
/**
* @program: inet-pdm-service
* @description: 自动任务服务接口
* @author: dang wei
* @create: 2021-09-27 09:41
*/
public interface AutoTaskService {
List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code);
}
......@@ -2,6 +2,9 @@ package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtDistributeRecordVO;
import com.yonde.dcs.plan.core.service.shadow.ExtDistributeRecordServiceShadow;
import java.util.List;
/**
* @description: ExtDistributeRecord-service
* @author: dexadmin
......@@ -10,4 +13,10 @@ import com.yonde.dcs.plan.core.service.shadow.ExtDistributeRecordServiceShadow;
**/
public interface ExtDistributeRecordService<V extends ExtDistributeRecordVO> extends ExtDistributeRecordServiceShadow<V> {
/**
* 获取收发记录接口
* @param id
*/
List<ExtDistributeRecordVO> getDisRecord(Long id);
}
......@@ -2,6 +2,10 @@ package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dcs.plan.core.service.shadow.ExtPlanServiceShadow;
import com.yonde.dex.user.common.vo.DxOrganizationVO;
import java.util.List;
/**
* @description: ExtPlan-service
* @author: dexadmin
......@@ -10,4 +14,12 @@ import com.yonde.dcs.plan.core.service.shadow.ExtPlanServiceShadow;
**/
public interface ExtPlanService<V extends ExtPlanVO> extends ExtPlanServiceShadow<V> {
/**
* 通过userId和组织code获取组织信息
*
* @param userId
* @return
*/
List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code);
}
package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dcs.plan.core.service.AutoTaskService;
import com.yonde.dcs.plan.core.service.ExtPlanService;
import com.yonde.dex.user.common.vo.DxOrganizationVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @program: inet-pdm-service
* @description: 自动任务服务接口
* @author: dang wei
* @create: 2021-09-27 09:42
*/
@Service
@Slf4j
public class AutoTaskServiceImpl implements AutoTaskService {
@Autowired
private ExtPlanService extPlanService;
/**
* 通过userId获取组织名
*
* @param userId
* @return
*/
@Override
public List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code) {
return extPlanService.searchOrgNameByUserId(userId, code);
}
}
package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dcs.plan.common.vo.ExtDisReocredLinkVO;
import com.yonde.dcs.plan.core.service.ExtDisReocredLinkService;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.yonde.dcs.plan.common.vo.ExtDistributeRecordVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import com.yonde.dcs.plan.core.service.ExtDistributeRecordService;
import com.yonde.dcs.plan.core.repository.ExtDistributeRecordRepository;
......@@ -28,6 +38,38 @@ public class ExtDistributeRecordServiceImpl<V extends ExtDistributeRecordVO> imp
@Autowired
ExtDistributeRecordRepository<ExtDistributeRecord> extDistributeRecordRepository;
@Autowired
private ExtDisReocredLinkService disRecordLink;
@Override
public List<ExtDistributeRecordVO> getDisRecord(Long id) {
//通过id查询分发记录Link
List<ExtDisReocredLinkVO> disReocredLinkVOS = this.recursionDisRecordLinks(id);
List<ExtDistributeRecordVO> list = new ArrayList<>();
disReocredLinkVOS.stream().forEach(item -> {
list.add(item.getSource());
});
return list;
}
/**
* 通过id查询分发记录Link
*
* @param id
*/
private List<ExtDisReocredLinkVO> recursionDisRecordLinks(Long id) {
SearchQueryCondition condition = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source")
.openProp(SearchQueryCondition.builder().name("objFileLinks")
.openProp(SearchQueryCondition.builder().name("target").build()).build()).build())
.searchItems(SearchItems.builder()
.item(new SearchItem("targetId", SearchItem.Operator.EQ, id, null)).build()).build();
DxPageImpl recursion = disRecordLink.findRecursion(condition);
if (!ObjectUtils.isEmpty(recursion)) {
return recursion.getContent();
}
return null;
}
}
......
package com.yonde.dcs.plan.core.service.impl;
import com.yonde.dex.user.common.vo.DxOrganizationVO;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,6 +35,38 @@ public class ExtPlanServiceImpl<V extends ExtPlanVO> implements ExtPlanService<V
@Autowired
ExtPlanRepository<ExtPlan> extPlanRepository;
/**
* 通过userId获取组织名
*
* @param userId
* @return
*/
@Override
public List<DxOrganizationVO> searchOrgNameByUserId(Long userId, String code) {
//todo 4.1中未找到对应的userservice,业务逻辑暂时注释
// UserVO user = this.userService.get(userId);
// List<UserGroupRefVO> vos = this.userGroupRefService.findAllByUserAccount(user.getUserAccount());
// List<Long> groupIds = (List) vos.stream().filter((o) -> {
// return Objects.nonNull(o.getGroupId());
// }).map((vo) -> {
// return vo.getGroupId();
// }).collect(Collectors.toList());
// if (org.apache.commons.collections.CollectionUtils.isNotEmpty(groupIds)) {
// List<DxOrganizationVO> orgs = this.organizationService.getAllById(groupIds);
// if (org.apache.commons.collections.CollectionUtils.isEmpty(orgs)) {
// return user.getOrganizations();
// }
// List<DxOrganizationVO> organizationVOS = (List) orgs.stream().filter((org) -> {
// return OrgType.ORGANIZATION.equals(org.getOrgType());
// }).collect(Collectors.toList());
// user.setOrganizations(orgs);
// }
// List<OrganizationVO> organizationVO = this.searchOrganization(user, code);
// return organizationVO;
return null;
}
}
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