|
@@ -4,9 +4,11 @@ package com.abi.qms.platform.service.impl;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.abi.qms.platform.dao.entity.FlowQueryRecord;
|
|
import com.abi.qms.platform.dao.entity.FlowQueryRecord;
|
|
|
|
+import com.abi.qms.platform.dao.entity.FlowQueryRecordFlow;
|
|
import com.abi.qms.platform.dao.enums.FlowQueryTypeEnum;
|
|
import com.abi.qms.platform.dao.enums.FlowQueryTypeEnum;
|
|
import com.abi.qms.platform.dao.enums.FlowStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.FlowStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.ReqChannelTypeEnum;
|
|
import com.abi.qms.platform.dao.enums.ReqChannelTypeEnum;
|
|
|
|
+import com.abi.qms.platform.dao.mapper.FlowQueryRecordFlowMapper;
|
|
import com.abi.qms.platform.dao.mapper.FlowQueryRecordMapper;
|
|
import com.abi.qms.platform.dao.mapper.FlowQueryRecordMapper;
|
|
import com.abi.qms.platform.dao.vo.result.FlowQueryRecordInfoVo;
|
|
import com.abi.qms.platform.dao.vo.result.FlowQueryRecordInfoVo;
|
|
import com.abi.qms.platform.dao.vo.result.ListFlowQueryRecordVO;
|
|
import com.abi.qms.platform.dao.vo.result.ListFlowQueryRecordVO;
|
|
@@ -16,10 +18,12 @@ import com.abi.qms.platform.dto.res.GetFlowQueryRecordInfo;
|
|
import com.abi.qms.platform.dto.res.PageListFlowQueryRecordRes;
|
|
import com.abi.qms.platform.dto.res.PageListFlowQueryRecordRes;
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
|
|
+import com.abi.qms.platform.service.FlowQueryRecordFlowService;
|
|
import com.abi.qms.platform.service.IFlowQueryRecordService;
|
|
import com.abi.qms.platform.service.IFlowQueryRecordService;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -36,6 +40,9 @@ public class FlowQueryRecordServiceImpl implements IFlowQueryRecordService {
|
|
@Autowired
|
|
@Autowired
|
|
private FlowQueryRecordMapper flowQueryRecordMapper;
|
|
private FlowQueryRecordMapper flowQueryRecordMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private FlowQueryRecordFlowMapper queryRecordFlowMapper;
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页查询列表
|
|
* 分页查询列表
|
|
@@ -84,6 +91,7 @@ public class FlowQueryRecordServiceImpl implements IFlowQueryRecordService {
|
|
* @param addReq 新增请求
|
|
* @param addReq 新增请求
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void addFlowQueryRecord(AddFlowQueryRecordReq addReq) {
|
|
public void addFlowQueryRecord(AddFlowQueryRecordReq addReq) {
|
|
//校验请求内容
|
|
//校验请求内容
|
|
validatedFlowQueryRecordReq(addReq);
|
|
validatedFlowQueryRecordReq(addReq);
|
|
@@ -92,21 +100,28 @@ public class FlowQueryRecordServiceImpl implements IFlowQueryRecordService {
|
|
FlowQueryRecord flowQueryRecord = new FlowQueryRecord();
|
|
FlowQueryRecord flowQueryRecord = new FlowQueryRecord();
|
|
BeanUtil.copyProperties(addReq, flowQueryRecord);
|
|
BeanUtil.copyProperties(addReq, flowQueryRecord);
|
|
|
|
|
|
- //PC查询地址信息处理
|
|
|
|
- Integer queryPlatform = addReq.getQueryPlatform();
|
|
|
|
- String queryAddress = addReq.getQueryAddress();
|
|
|
|
- if (ReqChannelTypeEnum.BACKSTAGE.is(queryPlatform)) {
|
|
|
|
- //根据ip查询地址
|
|
|
|
- String ip = addReq.getQueryIp();
|
|
|
|
- queryAddress = this.getAddressByIP(ip);
|
|
|
|
- }
|
|
|
|
- flowQueryRecord.setQueryAddress(queryAddress);
|
|
|
|
-
|
|
|
|
//保存信息
|
|
//保存信息
|
|
flowQueryRecordMapper.insert(flowQueryRecord);
|
|
flowQueryRecordMapper.insert(flowQueryRecord);
|
|
|
|
|
|
|
|
+ //保存关联流向信息
|
|
|
|
+ Long flowQueryRecordId = flowQueryRecord.getId();
|
|
|
|
+ List<AddFlowQueryRecordReq.FlowBean> flowList = addReq.getFlowList();
|
|
|
|
+
|
|
|
|
+ //转换类型
|
|
|
|
+ List<FlowQueryRecordFlow> flowQueryRecordFlows = flowList.stream()
|
|
|
|
+ .parallel().map(s -> {
|
|
|
|
+ FlowQueryRecordFlow flowQueryRecordFlow = new FlowQueryRecordFlow();
|
|
|
|
+ BeanUtil.copyProperties(s, flowQueryRecordFlow);
|
|
|
|
+ flowQueryRecordFlow.setFlowQueryRecordId(flowQueryRecordId);
|
|
|
|
+ return flowQueryRecordFlow;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ queryRecordFlowMapper.insertBatch(flowQueryRecordFlows);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据ID获取记录详情
|
|
* 根据ID获取记录详情
|
|
*
|
|
*
|
|
@@ -131,16 +146,6 @@ public class FlowQueryRecordServiceImpl implements IFlowQueryRecordService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 根据IP查询地址信息
|
|
|
|
- *
|
|
|
|
- * @param ip 请求IP
|
|
|
|
- * @return ip对应地址信息
|
|
|
|
- */
|
|
|
|
- private String getAddressByIP(String ip) {
|
|
|
|
- //TODO 根据IP查询地址
|
|
|
|
- return "江苏南京";
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -155,7 +160,7 @@ public class FlowQueryRecordServiceImpl implements IFlowQueryRecordService {
|
|
|
|
|
|
//查询平台
|
|
//查询平台
|
|
Integer queryPlatform = addReq.getQueryPlatform();
|
|
Integer queryPlatform = addReq.getQueryPlatform();
|
|
- AssertUtil.isNull(flowStatus, "请指明 查询平台!");
|
|
|
|
|
|
+ AssertUtil.isNull(queryPlatform, "请指明 查询平台!");
|
|
|
|
|
|
//查询类型
|
|
//查询类型
|
|
Integer queryType = addReq.getQueryType();
|
|
Integer queryType = addReq.getQueryType();
|
|
@@ -177,27 +182,13 @@ public class FlowQueryRecordServiceImpl implements IFlowQueryRecordService {
|
|
|
|
|
|
//异常节点
|
|
//异常节点
|
|
if (FlowStatusEnum.ABNORMAL.is(flowStatus)) {
|
|
if (FlowStatusEnum.ABNORMAL.is(flowStatus)) {
|
|
- String nodeIn = addReq.getAbnormalNodeIn();
|
|
|
|
- AssertUtil.isMeets(nodeIn, StrUtil::isNotBlank, "流向状态为异常时 必须指明异常流入节点!");
|
|
|
|
|
|
+ Long nodeIn = addReq.getAbnormalInNodeCode();
|
|
|
|
+ AssertUtil.isNull(nodeIn, "流向状态为异常时 必须指明异常流入节点!");
|
|
|
|
|
|
- String nodeOut = addReq.getAbnormalNodeOut();
|
|
|
|
- AssertUtil.isMeets(nodeOut, StrUtil::isNotBlank, "流向状态为异常时 必须指明异常流出节点!");
|
|
|
|
|
|
+ Long nodeOut = addReq.getAbnormalOutNodeCode();
|
|
|
|
+ AssertUtil.isNull(nodeOut, "流向状态为异常时 必须指明异常流出节点!");
|
|
}
|
|
}
|
|
|
|
|
|
- //查询地址
|
|
|
|
- if (ReqChannelTypeEnum.WECHAT.is(queryPlatform)) {
|
|
|
|
- String queryAddress = addReq.getQueryAddress();
|
|
|
|
- AssertUtil.isMeets(queryAddress, StrUtil::isNotBlank, "微信查询 必须指明请求地址!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //查询请求IP
|
|
|
|
- if (ReqChannelTypeEnum.BACKSTAGE.is(queryPlatform)) {
|
|
|
|
- String queryIp = addReq.getQueryIp();
|
|
|
|
- AssertUtil.isMeets(queryIp, StrUtil::isNotBlank, "后台查询 必须指明请求IP!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|