Commit b3343194 by 林冲

培训计划人员列表

1 parent 1573e541
package cn.com.glsx.dj.riskmanage.remote;
import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List;
@ApiService(value = "学习中心,培训计划人员", owner = "linchong")
public interface LearningCenterTrainingPlanPersonRemote {
@ApiMethod("根据培训计划ID和开单权限查询人员ID集合")
@ApiParams({
@ApiParam(name = "planId", notes = "培训计划ID", dataType = ApiParam.DataTypeEnum.INTEGER, required = true),
@ApiParam(name = "openOrderStatus", notes = "开单权限(0:已锁定, 1:已解锁)", dataType = ApiParam.DataTypeEnum.BYTE)
})
@ApiResponse("人员ID集合")
RpcResponse<List<Integer>> queryPersonIdsByPlanAndStatus(Integer planId, Byte openOrderStatus);
}
......@@ -5,8 +5,6 @@ import cn.com.glsx.framework.core.annotation.*;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List;
@ApiService(value = "学习中心,培训计划", owner = "linchong")
public interface LearningCenterTrainingPlanRemote {
......@@ -14,12 +12,4 @@ public interface LearningCenterTrainingPlanRemote {
@ApiParam(name = "pagination", notes = "分页信息", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("分页查询")
RpcResponse<RpcPagination<TrainingPlanDTO>> listWithPage(RpcPagination<TrainingPlanDTO> pagination);
@ApiMethod("根据培训计划ID和开单权限查询人员ID集合")
@ApiParams({
@ApiParam(name = "planId", notes = "培训计划ID", dataType = ApiParam.DataTypeEnum.INTEGER, required = true)
@ApiParam(name = "openOrderStatus", notes = "开单权限(0:已锁定, 1:已解锁)", dataType = ApiParam.DataTypeEnum.BYTE)
})
@ApiResponse("人员ID集合")
RpcResponse<List<Integer>> queryPersonIdsByPlanAndStatus(Integer planId, Byte openOrderStatus);
}
package cn.com.glsx.dj.riskmanage.remote.learningcenter;
import cn.com.glsx.dj.riskmanage.remote.LearningCenterTrainingPlanPersonRemote;
import cn.com.glsx.dj.riskmanage.service.learningcenter.LearningCenterTrainingPlanPersonService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@DubboService(retries = 0, timeout = 30000)
public class LearningCenterTrainingPlanPersonRemoteImpl implements LearningCenterTrainingPlanPersonRemote {
@Autowired
private LearningCenterTrainingPlanPersonService learningCenterTrainingPlanPersonService;
@Override
public RpcResponse<List<Integer>> queryPersonIdsByPlanAndStatus(Integer planId, Byte openOrderStatus) {
try {
return RpcResponse.success(learningCenterTrainingPlanPersonService.queryPersonIdsByPlanAndStatus(planId, openOrderStatus));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
}
......@@ -10,8 +10,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@DubboService(retries = 0, timeout = 30000)
public class LearningCenterTrainingPlanRemoteImpl implements LearningCenterTrainingPlanRemote {
......@@ -27,14 +25,4 @@ public class LearningCenterTrainingPlanRemoteImpl implements LearningCenterTrain
return RpcResponse.error(e);
}
}
@Override
public RpcResponse<List<Integer>> queryPersonIdsByPlanAndStatus(Integer planId, Byte openOrderStatus) {
try {
return RpcResponse.success(learningCenterTrainingPlanService.queryPersonIdsByPlanAndStatus(planId, openOrderStatus));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
}
package cn.com.glsx.dj.riskmanage.service.learningcenter;
import cn.com.glsx.dj.riskmanage.mapper.learningcenter.LearningCenterTrainingPlanPersonMapper;
import cn.com.glsx.dj.riskmanage.model.learningcenter.LearningCenterTrainingPlanPerson;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
public class LearningCenterTrainingPlanPersonService {
private final LearningCenterTrainingPlanPersonMapper learningCenterTrainingPlanPersonMapper;
/**
* 根据培训计划ID和开单权限查询人员ID集合
*/
public List<Integer> queryPersonIdsByPlanAndStatus(Integer planId, Byte openOrderStatus) {
RpcAssert.assertNotNull(planId, DefaultErrorEnum.PARAMETER_NULL, "planId not be null");
try {
Example example = new Example(LearningCenterTrainingPlanPerson.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("planId", planId);
criteria.andEqualTo("deletedFlag", "N");
if (openOrderStatus != null) {
criteria.andEqualTo("openOrderStatus", openOrderStatus);
}
List<LearningCenterTrainingPlanPerson> persons = learningCenterTrainingPlanPersonMapper.selectByExample(example);
return persons.stream().map(LearningCenterTrainingPlanPerson::getPersonId).collect(Collectors.toList());
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, e.getMessage());
}
}
}
......@@ -2,9 +2,7 @@ package cn.com.glsx.dj.riskmanage.service.learningcenter;
import cn.com.glsx.dj.riskmanage.dto.learningcenter.TrainingPlanDTO;
import cn.com.glsx.dj.riskmanage.mapper.learningcenter.LearningCenterTrainingPlanMapper;
import cn.com.glsx.dj.riskmanage.mapper.learningcenter.LearningCenterTrainingPlanPersonMapper;
import cn.com.glsx.dj.riskmanage.model.learningcenter.LearningCenterTrainingPlan;
import cn.com.glsx.dj.riskmanage.model.learningcenter.LearningCenterTrainingPlanPerson;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
......@@ -28,7 +26,6 @@ import java.util.stream.Collectors;
public class LearningCenterTrainingPlanService {
private final LearningCenterTrainingPlanMapper learningCenterTrainingPlanMapper;
private final LearningCenterTrainingPlanPersonMapper learningCenterTrainingPlanPersonMapper;
public Page<TrainingPlanDTO> listWithPage(RpcPagination<TrainingPlanDTO> pagination) {
......@@ -42,25 +39,4 @@ public class LearningCenterTrainingPlanService {
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, e.getMessage());
}
}
/**
* 根据培训计划ID和开单权限查询人员ID集合
*/
public List<Integer> queryPersonIdsByPlanAndStatus(Integer planId, Byte openOrderStatus) {
RpcAssert.assertNotNull(planId, DefaultErrorEnum.DATA_NULL, "planId not be null");
try {
Example example = new Example(LearningCenterTrainingPlanPerson.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("planId", planId);
criteria.andEqualTo("deletedFlag", "N");
if (openOrderStatus != null) {
criteria.andEqualTo("openOrderStatus", openOrderStatus);
}
List<LearningCenterTrainingPlanPerson> persons = learningCenterTrainingPlanPersonMapper.selectByExample(example);
return persons.stream().map(LearningCenterTrainingPlanPerson::getPersonId).collect(Collectors.toList());
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR, e.getMessage());
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!