|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
package com.hnac.hzims.fdp.service.impl; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.aliyun.oss.ServiceException; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.hnac.hzims.fdp.dto.FdpSubmitResultDTO; |
|
|
|
|
import com.hnac.hzims.fdp.dto.FdpTaskDTO; |
|
|
|
|
import com.hnac.hzims.fdp.entity.FdpTaskEntity; |
|
|
|
|
import com.hnac.hzims.fdp.mapper.FdpTaskMapper; |
|
|
|
@ -16,6 +18,8 @@ import com.hnac.hzims.fdp.wrapper.FdpTaskWrapper;
|
|
|
|
|
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
|
|
|
|
import com.hnac.hzims.operational.defect.feign.IOperPhenomenonClient; |
|
|
|
|
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO; |
|
|
|
|
import com.hnac.hzims.util.HttpClientUtils; |
|
|
|
|
import com.hnac.hzims.util.pojo.HttpResponse; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
@ -27,6 +31,7 @@ import org.springblade.core.tool.utils.Func;
|
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
@ -47,6 +52,9 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
private IDiagnoseProxy diagnoseProxy; |
|
|
|
|
|
|
|
|
|
@Value("${url.submitResult}") |
|
|
|
|
public String submitResult; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R doSave(FdpTaskDTO req) { |
|
|
|
|
boolean flag = super.save(req); |
|
|
|
@ -76,8 +84,7 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
|
|
|
|
|
detail.setStatus(1); |
|
|
|
|
boolean flag = super.saveOrUpdate(detail); |
|
|
|
|
return flag; |
|
|
|
|
} |
|
|
|
|
catch (NullPointerException e){ |
|
|
|
|
} catch (NullPointerException e) { |
|
|
|
|
throw new ServiceException("该id无法获取到智能诊断任务记录!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -199,6 +206,46 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
|
|
|
|
|
return R.data(pages); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R submitResult(FdpTaskDTO req) { |
|
|
|
|
FdpSubmitResultDTO fdpSubmitResultDTO = new FdpSubmitResultDTO(); |
|
|
|
|
if (4 == req.getStatus()) { |
|
|
|
|
fdpSubmitResultDTO.setSuccess(0); |
|
|
|
|
} |
|
|
|
|
//诊断成功
|
|
|
|
|
if (3 == req.getStatus()) { |
|
|
|
|
fdpSubmitResultDTO.setSuccess(1); |
|
|
|
|
} else if (Func.isNotEmpty(req.getReasonId())) { |
|
|
|
|
fdpSubmitResultDTO.setRootCause(req.getReasonId()); |
|
|
|
|
} else { |
|
|
|
|
return R.fail("诊断传送状态异常"); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(req.getReasonId())) { |
|
|
|
|
fdpSubmitResultDTO.setRootCause(req.getReasonId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(req.getFaultId())) { |
|
|
|
|
fdpSubmitResultDTO.setFaultId(req.getFaultId()); |
|
|
|
|
} else { |
|
|
|
|
return R.fail("数据异常"); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(req.getComment())) { |
|
|
|
|
fdpSubmitResultDTO.setComment(req.getComment()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(req.getStation())) { |
|
|
|
|
fdpSubmitResultDTO.setStationId(req.getStation()); |
|
|
|
|
} |
|
|
|
|
HttpResponse r = HttpClientUtils.post(submitResult, JSONObject.toJSONString(fdpSubmitResultDTO)); |
|
|
|
|
if (200 != r.getCode()) { |
|
|
|
|
throw new ServiceException("智能诊断回传失败"); |
|
|
|
|
} |
|
|
|
|
boolean b = this.updateById(req); |
|
|
|
|
if (b) { |
|
|
|
|
return R.success("保存成功"); |
|
|
|
|
} else { |
|
|
|
|
return R.fail("保存失败,请稍后重试"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static Wrapper<FdpTaskEntity> getFdpTaskEntityWrapper(TaskStatisticsVo statisticsVo) { |
|
|
|
|
Wrapper<FdpTaskEntity> queryWrapper = new LambdaQueryWrapper<FdpTaskEntity>() {{ |
|
|
|
|
if (Func.isNotEmpty(statisticsVo.getStartTime())) { |
|
|
|
@ -243,6 +290,7 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
|
|
|
|
|
res.add(taskStatisticsVo); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获取对应层级占比和数量
|
|
|
|
|
//机构类型需要转换ID为名称
|
|
|
|
|
private void getCount2(String key, Map<Long, List<FdpTaskEntity>> collectByCreateDept, List<FdpTaskEntity> fdpTaskEntities, ArrayList<TaskStatisticsVo> res, Integer level) { |
|
|
|
|