Browse Source

TaskFeignClientFallback

zhongwei
段飞宇 2 years ago
parent
commit
82fbd8493d
  1. 27
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
  2. 6
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java
  3. 6
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java
  4. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  5. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java

27
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java

@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.Date;
import java.util.List;
@ -63,24 +64,16 @@ public class OperDefectEntity extends TenantEntity {
/**
* 实际开始时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("实际开始时间")
private Date actStartTime;
/**
* 实际结束时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "实际结束时间")
private Date actEndTime;
/**
@ -106,4 +99,14 @@ public class OperDefectEntity extends TenantEntity {
@TableField(exist = false)
@ApiModelProperty(value = "机构编号集合")
private List<Long> deptIds;
/**
* 区域Id
*/
private String areaId;
/**
* 年月
*/
private YearMonth yearMonth;
}

6
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/TaskFeignClient.java

@ -1,6 +1,5 @@
package com.hnac.hzinfo.inspect.areamonthly.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzinfo.inspect.areamonthly.feign.fallback.TaskFeignClientFallback;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
@ -11,8 +10,6 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import static com.hnac.hzinfo.inspect.Constants.APP_NAME;
@ -31,8 +28,7 @@ public interface TaskFeignClient {
@ApiOperation(value = "分页显示任务列表", notes = "传入task")
public R<BladePage<TaskVo>> list(TaskListQuery task, Query query);
@RequestMapping(value = "/task/detail", method = {RequestMethod.GET, RequestMethod.POST})
@GetMapping(value = "/task/detail")
@ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid")
public R<TaskEntity> detail(@RequestParam Long id);
}

6
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzinfo.inspect.areamonthly.feign.TaskFeignClient;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
@ -24,4 +25,9 @@ public class TaskFeignClientFallback implements TaskFeignClient {
return R.fail("远程调用失败");
}
@Override
public R<TaskEntity> detail(Long id) {
return R.fail("远程调用失败");
}
}

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java

@ -70,7 +70,7 @@ public class TaskController extends BladeController {
/**
* 查看任务详情
*/
@RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST})
@GetMapping(value = "/detail")
@ApiOperation(value = "查看,下面列表再调用eventController.list", notes = "传入taskid")
public R<TaskEntity> detail(@RequestParam Long id) {
TaskEntity detail = taskService.getById(id);

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.defect.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.invalid.DictInvalid;
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid;
@ -19,6 +20,7 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.YearMonth;
import java.util.HashMap;
import java.util.Map;
@ -82,6 +85,11 @@ public class OperDefectController extends BladeController {
if (defect.getEndTime() != null) {
queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime());
}
queryWrapper.eq(StringUtils.isNotBlank(defect.getAreaId()), BaseEntity::getCreateDept, defect.getCreateDept());
queryWrapper.apply(defect.getYearMonth() != null,"date_format(CREATE_TIME,'%Y-%m')", defect.getYearMonth());
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime);
IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages);

Loading…
Cancel
Save