Commit ca390023 by 范富荣

添加查询督导任务管理模块接口

1 parent f230c1b1
package cn.com.glsx.dj.supervisor.config;
import cn.com.glsx.dj.supervisor.remote.ExcellentCaseReviewRemote;
import cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemote;
import cn.com.glsx.dj.supervisor.remote.SupervisorWarningBaselineConfigRemote;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,4 +41,11 @@ public class DubboConfig {
return factory.builder(ExcellentCaseReviewRemote.class).check(false).timeout(30000).build();
}
@Bean
public SupervisorTaskInfoRemote supervisorTaskInfoRemote(){
return factory.builder(SupervisorTaskInfoRemote.class).check(false).timeout(30000).build();
}
}
package cn.com.glsx.dj.supervisor.controller;
import cn.com.glsx.dj.supervisor.dto.AudioReceptionDTO;
import cn.com.glsx.dj.supervisor.dto.AudioSummaryDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskDTO;
import cn.com.glsx.dj.supervisor.dto.SupervisorTaskQueryDTO;
import cn.com.glsx.dj.supervisor.model.SupervisorAudioReviewInfo;
import cn.com.glsx.dj.supervisor.remote.SupervisorTaskInfoRemote;
import cn.com.glsx.dj.supervisor.request.SupervisorTaskQueryRequest;
import cn.com.glsx.dj.supervisor.utils.CommonUtil;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.AbstractRopRequest;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("督导任务接口")
public class SupervisorTaskInfoController {
@Autowired
private SupervisorTaskInfoRemote supervisorTaskInfoRemote;
@Autowired
private Environment environment;
/**
* 根据ID查询督导任务详情
*/
@ServiceMethod(method = "dj.api.supervisor.getTaskDetailById", needInSession = NeedInSessionType.YES)
@ApiOperation("根据ID查询督导任务详情")
public RopResponse<SupervisorTaskDTO> getTaskDetailById(SupervisorTaskQueryRequest request) {
RpcResponse<SupervisorTaskDTO> response = supervisorTaskInfoRemote.getTaskDetailById(request.getId());
if (response.hasError()) {
return RopResponse.error(response.getError(), response.getMessage());
} else {
return RopResponse.success(response.getResult());
}
}
/**
* 查询督导任务分页列表
*/
@ServiceMethod(method = "dj.api.supervisor.page.task", needInSession = NeedInSessionType.YES)
@ApiOperation("查询督导任务分页列表")
public RopResponse<RpcPagination<SupervisorTaskDTO>> pageTask(SupervisorTaskQueryRequest request) {
RpcPagination<SupervisorTaskQueryDTO> pagination = CommonUtil.getRpcPagination(SupervisorTaskQueryDTO.class);
pagination.getCondition().setCalculateAudioDetailFlag(1);
RpcResponse<RpcPagination<SupervisorTaskDTO>> response = supervisorTaskInfoRemote.pageTask(pagination);
if (response.hasError()) {
return RopResponse.error(response.getError(), response.getMessage());
} else {
return RopResponse.success(response.getResult());
}
}
/**
* 分页查询录音复盘列表
*/
@ServiceMethod(method = "dj.api.supervisor.page.audioReview", needInSession = NeedInSessionType.YES)
@ApiOperation("分页查询录音复盘列表")
public RopResponse<RpcPagination<AudioReceptionDTO>> pageAudioReview(SupervisorTaskQueryRequest request) {
RpcPagination<SupervisorTaskQueryDTO> pagination = CommonUtil.getRpcPagination(SupervisorTaskQueryDTO.class);
RpcResponse<RpcPagination<AudioReceptionDTO>> response = supervisorTaskInfoRemote.pageAudioReception(pagination);
if (response.hasError()) {
return RopResponse.error(response.getError(), response.getMessage());
} else {
return RopResponse.success(response.getResult());
}
}
/**
* 查询录音复盘汇总信息
*/
@ServiceMethod(method = "dj.api.supervisor.mini.summary.audioReview", needInSession = NeedInSessionType.YES)
@ApiOperation("查询录音复盘汇总信息")
public RopResponse<AudioSummaryDTO> summaryAudioReview(SupervisorTaskQueryRequest request) {
SupervisorTaskQueryDTO param = CommonUtil.convertRequest(SupervisorTaskQueryDTO.class);
RpcResponse<AudioSummaryDTO> response = supervisorTaskInfoRemote.getAudioSummary(param);
if (response.hasError()) {
return RopResponse.error(response.getError(), response.getMessage());
} else {
return RopResponse.success(response.getResult());
}
}
/**
* 生成最近一年所有周一到周日
*
* @return
*/
@ApiOperation(value = "生成最近一年所有周一到周日")
@ServiceMethod(method = "dj.api.supervisor.get.generateWeeklyRanges", needInSession = NeedInSessionType.NO)
public RopResponse<List<Map>> generateWeeklyRanges(AbstractRopRequest request) {
LocalDate now = LocalDate.now();
LocalDate thisMonday = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
LocalDate oneYearAgo = now.minusYears(3);
LocalDate oneYearAgoMonday = oneYearAgo.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
List<Map> result = new ArrayList<>();
LocalDate currentMonday = thisMonday;
while (!currentMonday.isBefore(oneYearAgoMonday)) {
LocalDate sunday = currentMonday.plusDays(6);
Map<String, String> weekRange = new HashMap<>();
weekRange.put("startDate", currentMonday.toString()); // 周一
weekRange.put("endDate", sunday.toString()); // 周日
result.add(weekRange); // Map 是 Object 的子类
currentMonday = currentMonday.minusWeeks(1); // 上一周
}
return RopResponse.success(result);
}
}
package cn.com.glsx.dj.supervisor.request;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.List;
@ToString
@Data
public class SupervisorTaskQueryRequest extends AbstractRopRequest {
/**
* 任务id
*/
@ApiModelProperty(notes = "任务id")
private Long id;
@ApiModelProperty(notes = "督导手机号")
private String supervisorPhone;
@ApiModelProperty(notes = "分页页码")
private Integer pageNum;
@ApiModelProperty(notes = "分页每页数量")
private Integer pageSize;
@ApiModelProperty(notes = "督导任务类型列表, 0-日报 1-周报,2-月报, 3-录音,4-专项,5-带教")
private List<Integer> taskTypeList;
@ApiModelProperty(notes = "开始时间,格式yyyy-MM-dd")
private String startDate;
@ApiModelProperty(notes = "结束时间,格式yyyy-MM-dd")
private String endDate;
@ApiModelProperty(notes = "任务状态 0-待完成 1-进行中,2-已完成")
private Integer taskStatus;
@ApiModelProperty(notes = "更新人")
private String updatedBy;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!