Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 1 year ago
parent
commit
53dd6b0828
  1. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java
  2. 3
      hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java
  3. 4
      hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java
  4. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpTaskController.java
  5. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java
  6. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java
  7. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpTaskService.java
  8. 3829
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  9. 97
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java
  10. 6
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessDictController.java
  11. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
  12. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzims.fdp.entity.FdpTaskEntity; import com.hnac.hzims.fdp.entity.FdpTaskEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@ -13,8 +14,9 @@ import java.util.Date;
* @created 2023-07-09 * @created 2023-07-09
**/ **/
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class TaskStatisticsVo extends FdpTaskEntity { public class TaskStatisticsVo extends FdpTaskEntity {
private static final long serialVersionUID = 1L;
/** /**
* 开始时间 * 开始时间
*/ */
@ -43,7 +45,7 @@ public class TaskStatisticsVo extends FdpTaskEntity {
@ApiModelProperty(value = "几级菜单") @ApiModelProperty(value = "几级菜单")
private Integer level; private Integer level;
@ApiModelProperty(value = "菜单名称") @ApiModelProperty(value = "菜单名称")
private String name; private String memuName;

3
hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/fallback/ProcessDictFeignServiceFallback.java

@ -21,11 +21,10 @@ public class ProcessDictFeignServiceFallback implements ProcessDictFeignService
* *
* @param staff * @param staff
* @param typeInstrument * @param typeInstrument
* @param createTime
* @return * @return
*/ */
@Override @Override
public String getTicketByCode(String staff, String typeInstrument, LocalDateTime createTime) { public String getTicketByCode(String staff, String typeInstrument) {
log.error("获取工作票工作票唯一ID 熔断措施"); log.error("获取工作票工作票唯一ID 熔断措施");
return null; return null;
} }

4
hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/feign/ProcessDictFeignService.java

@ -21,13 +21,11 @@ public interface ProcessDictFeignService {
* *
* @param staff * @param staff
* @param typeInstrument * @param typeInstrument
* @param createTime
* @return * @return
*/ */
@GetMapping("/process-dict/getTicketByCode") @GetMapping("/process-dict/getTicketByCode")
public String getTicketByCode(@RequestParam("staff") String staff, public String getTicketByCode(@RequestParam("staff") String staff,
@RequestParam("typeInstrument") String typeInstrument, @RequestParam("typeInstrument") String typeInstrument);
@RequestParam("createTime") LocalDateTime createTime);
/** /**

4
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpTaskController.java

@ -145,7 +145,7 @@ public class FdpTaskController extends BladeController {
@PostMapping("/getTaskData") @PostMapping("/getTaskData")
@ApiOperationSupport(order = 90) @ApiOperationSupport(order = 90)
@ApiOperation(value = "获取统计详细数据") @ApiOperation(value = "获取统计详细数据")
public R getTaskData(TaskStatisticsVo statisticsVo){ public R getTaskData(TaskStatisticsVo statisticsVo,Query query){
return service.getTaskData(statisticsVo); return service.getTaskData(statisticsVo,query);
} }
} }

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java

@ -24,7 +24,7 @@ public class FaultStateResp {
// @JSONField(name = "NAME") // @JSONField(name = "NAME")
// private String name; // private String name;
@ApiModelProperty("数据时间") @ApiModelProperty("数据时间")
@JSONField(name = "NAME") @JSONField(name = "ts")
private String ts; private String ts;
@ApiModelProperty("状态") @ApiModelProperty("状态")
@JSONField(name = "STATUS") @JSONField(name = "STATUS")

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/scheduled/ThreadTask.java

@ -208,7 +208,7 @@ public class ThreadTask {
diagnoseFaultReq.setTaskId(req.getId().toString()); diagnoseFaultReq.setTaskId(req.getId().toString());
diagnoseFaultReq.setFaultId(req.getFaultId()); diagnoseFaultReq.setFaultId(req.getFaultId());
diagnoseFaultReq.setConfidence(1.0); diagnoseFaultReq.setConfidence(1.0);
diagnoseFaultReq.setLifeTime(1); diagnoseFaultReq.setLifeTime(24*3);//设置有效期3天
diagnoseFaultReq.setPriority(2); diagnoseFaultReq.setPriority(2);
diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId()); diagnoseFaultReq.setTenantId(fdpFaultEntity.getStationId());
diagnoseFaultReq.setCreateUser(ObjectUtil.isEmpty(AuthUtil.getUser()) ? "告警推送" : AuthUtil.getUser().getUserName()); diagnoseFaultReq.setCreateUser(ObjectUtil.isEmpty(AuthUtil.getUser()) ? "告警推送" : AuthUtil.getUser().getUserName());

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpTaskService.java

@ -31,5 +31,5 @@ public interface IFdpTaskService extends BaseService<FdpTaskEntity> {
R getTaskStatistics(TaskStatisticsVo statisticsVo); R getTaskStatistics(TaskStatisticsVo statisticsVo);
R getTaskData(TaskStatisticsVo statisticsVo); R getTaskData(TaskStatisticsVo statisticsVo,Query query);
} }

3829
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

File diff suppressed because it is too large Load Diff

97
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java

@ -128,46 +128,75 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
return R.success("暂无数据,请稍后重试"); return R.success("暂无数据,请稍后重试");
} }
ArrayList<TaskStatisticsVo> res = new ArrayList<>(); ArrayList<TaskStatisticsVo> res = new ArrayList<>();
TaskStatisticsVo taskStatisticsVo = new TaskStatisticsVo(); int size = fdpTaskEntities.size();
taskStatisticsVo.setCount(fdpTaskEntities.size()); //在第一层去掉为null值数据
taskStatisticsVo.setPercentage("1"); fdpTaskEntities=fdpTaskEntities.stream().filter(s->s.getFdpDeviceName()!=null).collect(Collectors.toList());
taskStatisticsVo.setLevel(0); extracted( res,0,"总计",size,size);
taskStatisticsVo.setName("总计"); Map<String, List<FdpTaskEntity>> collectByFdpDeviceName = fdpTaskEntities.stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName));
res.add(taskStatisticsVo); getCount("",collectByFdpDeviceName, fdpTaskEntities, res, 1);
Map<String, List<FdpTaskEntity>> collectByCreateDept = fdpTaskEntities.stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName));
getCount("",collectByCreateDept, fdpTaskEntities, res, 1);
if (Func.isEmpty(statisticsVo.getName())) { if (Func.isEmpty(statisticsVo.getName())) {
collectByCreateDept.entrySet().forEach(s->{ collectByFdpDeviceName.entrySet().forEach(s->{
Map<String, List<FdpTaskEntity>> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getName)); List<FdpTaskEntity> list=s.getValue().stream().filter(sig->sig.getName()!=null).collect(Collectors.toList());
Map<String, List<FdpTaskEntity>> collectByName = list.stream().collect(Collectors.groupingBy(FdpTaskEntity::getName));
getCount(s.getKey(),collectByName, s.getValue(), res, 2); getCount(s.getKey(),collectByName, s.getValue(), res, 2);
if (list.size()!=s.getValue().size()) {
//值为空单独加进来
extracted( res,1,s.getKey()+"-空",s.getValue().size()-list.size(),s.getValue().size());
}
}); });
} else if (Func.isEmpty(statisticsVo.getFdpDeviceName())){ } else if (Func.isEmpty(statisticsVo.getCreateDept())){
collectByCreateDept.entrySet().forEach(s->{ collectByFdpDeviceName.entrySet().forEach(s->{
Map<String, List<FdpTaskEntity>> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName)); List<FdpTaskEntity> list=s.getValue().stream().filter(sig->sig.getCreateDept()!=null).collect(Collectors.toList());
getCount(s.getKey(),collectByName, s.getValue(), res, 2); Map<Long, List<FdpTaskEntity>> collectByName = list.stream().collect(Collectors.groupingBy(FdpTaskEntity::getCreateDept));
getCount2(s.getKey(),collectByName, s.getValue(), res, 2);
if (list.size()!=s.getValue().size()) {
//值为空单独加进来
extracted( res,1,s.getKey()+"-空",s.getValue().size()-list.size(),s.getValue().size());
}
}); });
}else if (Func.isEmpty(statisticsVo.getFdpOrd())){ }else if (Func.isEmpty(statisticsVo.getFdpOrd())){
collectByCreateDept.entrySet().forEach(s->{ collectByFdpDeviceName.entrySet().forEach(s->{
Map<String, List<FdpTaskEntity>> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpOrd)); List<FdpTaskEntity> list=s.getValue().stream().filter(sig->sig.getFdpOrd()!=null).collect(Collectors.toList());
Map<String, List<FdpTaskEntity>> collectByName = list.stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpOrd));
getCount(s.getKey(),collectByName, s.getValue(), res, 2); getCount(s.getKey(),collectByName, s.getValue(), res, 2);
if (list.size()!=s.getValue().size()) {
//值为空单独加进来
extracted( res,1,s.getKey()+"-空",s.getValue().size()-list.size(),s.getValue().size());
}
}); });
}else if (Func.isEmpty(statisticsVo.getType())){ }else if (Func.isEmpty(statisticsVo.getType())){
collectByCreateDept.entrySet().forEach(s->{ collectByFdpDeviceName.entrySet().forEach(s->{
Map<String, List<FdpTaskEntity>> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getType)); List<FdpTaskEntity> list=s.getValue().stream().filter(sig->sig.getFdpOrd()!=null).collect(Collectors.toList());
Map<String, List<FdpTaskEntity>> collectByName = list.stream().collect(Collectors.groupingBy(FdpTaskEntity::getType));
getCount(s.getKey(),collectByName, s.getValue(), res, 2); getCount(s.getKey(),collectByName, s.getValue(), res, 2);
if (list.size()!=s.getValue().size()) {
//值为空单独加进来
extracted( res,1,s.getKey()+"-空",s.getValue().size()-list.size(),s.getValue().size());
}
}); });
} }
return R.data(res); return R.data(res);
} }
private static void extracted( ArrayList<TaskStatisticsVo> res,Integer level,String name,Integer size,Integer all) {
TaskStatisticsVo taskStatisticsByDeviceName = new TaskStatisticsVo();
taskStatisticsByDeviceName.setCount(size);
BigDecimal bigDecimal=BigDecimal.valueOf(all).divide(BigDecimal.valueOf(size),2,BigDecimal.ROUND_UP);
taskStatisticsByDeviceName.setPercentage(bigDecimal.toString());
taskStatisticsByDeviceName.setLevel(level);
taskStatisticsByDeviceName.setMemuName(name);
res.add(taskStatisticsByDeviceName);
}
@Override @Override
public R getTaskData(TaskStatisticsVo statisticsVo) { public R getTaskData(TaskStatisticsVo statisticsVo,Query query) {
Wrapper<FdpTaskEntity> queryWrapper = getFdpTaskEntityWrapper(statisticsVo); Wrapper<FdpTaskEntity> queryWrapper = getFdpTaskEntityWrapper(statisticsVo);
List<FdpTaskEntity> fdpTaskEntities = super.baseMapper.selectList(queryWrapper); IPage pages = super.baseMapper.selectPage(Condition.getPage(query),queryWrapper);
if (CollectionUtil.isEmpty(fdpTaskEntities)){ if (CollectionUtil.isEmpty(pages.getRecords())){
return R.success("暂无数据,请稍后重试"); return R.success("暂无数据,请稍后重试");
} }
return R.data(fdpTaskEntities); return R.data(pages);
} }
private static Wrapper<FdpTaskEntity> getFdpTaskEntityWrapper(TaskStatisticsVo statisticsVo) { private static Wrapper<FdpTaskEntity> getFdpTaskEntityWrapper(TaskStatisticsVo statisticsVo) {
@ -179,7 +208,7 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
le(FdpTaskEntity::getCreateTime, statisticsVo.getEndTime()); le(FdpTaskEntity::getCreateTime, statisticsVo.getEndTime());
} }
if (Func.isNotEmpty(statisticsVo.getCreateDept())) { if (Func.isNotEmpty(statisticsVo.getCreateDept())) {
in(FdpTaskEntity::getCreateDept, statisticsVo.getCreateDept()); eq(FdpTaskEntity::getCreateDept, statisticsVo.getCreateDept());
} }
if (Func.isNotEmpty(statisticsVo.getName())) { if (Func.isNotEmpty(statisticsVo.getName())) {
like(FdpTaskEntity::getName, statisticsVo.getName()); like(FdpTaskEntity::getName, statisticsVo.getName());
@ -207,10 +236,30 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
collectByCreateDept.entrySet().forEach(s->{ collectByCreateDept.entrySet().forEach(s->{
TaskStatisticsVo taskStatisticsVo = new TaskStatisticsVo(); TaskStatisticsVo taskStatisticsVo = new TaskStatisticsVo();
taskStatisticsVo.setCount(s.getValue().size()); taskStatisticsVo.setCount(s.getValue().size());
BigDecimal bigDecimal=BigDecimal.valueOf(s.getValue().size()).divide(BigDecimal.valueOf(fdpTaskEntities.size()),2,BigDecimal.ROUND_UP);
taskStatisticsVo.setPercentage(bigDecimal.toString());
taskStatisticsVo.setLevel(level);
taskStatisticsVo.setMemuName(key+"-"+s.getKey().toString());
res.add(taskStatisticsVo);
});
}
//获取对应层级占比和数量
//机构类型需要转换ID为名称
private void getCount2(String key,Map<Long, List<FdpTaskEntity>> collectByCreateDept, List<FdpTaskEntity> fdpTaskEntities, ArrayList<TaskStatisticsVo> res,Integer level) {
collectByCreateDept.entrySet().forEach(s->{
TaskStatisticsVo taskStatisticsVo = new TaskStatisticsVo();
taskStatisticsVo.setCount(s.getValue().size());
BigDecimal bigDecimal=BigDecimal.valueOf(s.getValue().size()).divide(BigDecimal.valueOf(fdpTaskEntities.size())); BigDecimal bigDecimal=BigDecimal.valueOf(s.getValue().size()).divide(BigDecimal.valueOf(fdpTaskEntities.size()));
taskStatisticsVo.setPercentage(bigDecimal.toString()); taskStatisticsVo.setPercentage(bigDecimal.toString());
taskStatisticsVo.setLevel(level); taskStatisticsVo.setLevel(level);
taskStatisticsVo.setName(key+"-"+s.getKey().toString()); R<String> deptNameCode = sysClient.getDeptName(s.getKey());
String deptName;
if (deptNameCode.isSuccess()){
deptName=deptNameCode.getData();
}else {
deptName="";
}
taskStatisticsVo.setMemuName(key+"-"+deptName);
res.add(taskStatisticsVo); res.add(taskStatisticsVo);
}); });
} }

6
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessDictController.java

@ -62,14 +62,12 @@ public class ProcessDictController {
* *
* @param staff * @param staff
* @param typeInstrument * @param typeInstrument
* @param createTime
* @return * @return
*/ */
@GetMapping("/getTicketByCode") @GetMapping("/getTicketByCode")
public String getTicketByCode(@RequestParam("staff") String staff, public String getTicketByCode(@RequestParam("staff") String staff,
@RequestParam("typeInstrument") String typeInstrument, @RequestParam("typeInstrument") String typeInstrument) {
@RequestParam("createTime") LocalDateTime createTime) { return processIdWorker.getTicketByCode(staff, typeInstrument, LocalDateTime.now());
return processIdWorker.getTicketByCode(staff, typeInstrument, createTime);
} }

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java

@ -126,7 +126,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
standardTicketInfoVo.setSignage(signage); standardTicketInfoVo.setSignage(signage);
standardTicketInfoVo.setSignageCode(station.getCode()); standardTicketInfoVo.setSignageCode(station.getCode());
//2. 获取编码 //2. 获取编码
String code = processDictFeignService.getTicketByCode(standardTicketInfoVo.getSignage(), this.getTicketWichCode(standardTicketInfoVo.getTicketType()), LocalDateTime.now()); String code = processDictFeignService.getTicketByCode(standardTicketInfoVo.getSignage(), this.getTicketWichCode(standardTicketInfoVo.getTicketType()));
log.info("获取编码: {}", code); log.info("获取编码: {}", code);
if (StringUtils.isBlank(code)) { if (StringUtils.isBlank(code)) {
throw new ServiceException("服务器异常,请联系管理员"); throw new ServiceException("服务器异常,请联系管理员");

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -191,8 +191,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
workTicketVo.getWorkTicket().setSignage(station.getSignage()); workTicketVo.getWorkTicket().setSignage(station.getSignage());
workTicketVo.getWorkTicket().setSignageCode(station.getCode()); workTicketVo.getWorkTicket().setSignageCode(station.getCode());
//2. 获取编码 //2. 获取编码
String code = processDictFeignService.getTicketByCode(signage, this.getTicketWichCode(workTicketVo.getWorkTicket().getType()), String code = processDictFeignService.getTicketByCode(signage, this.getTicketWichCode(workTicketVo.getWorkTicket().getType()));
LocalDateTime.now());
log.info("获取编码: {}", code); log.info("获取编码: {}", code);
if (StringUtils.isBlank(code)) { if (StringUtils.isBlank(code)) {
throw new ServiceException("服务器异常,请联系管理员"); throw new ServiceException("服务器异常,请联系管理员");

Loading…
Cancel
Save