AI报警-拆分HIDDEN_IDS字段

626相关方人员数据对接
water_xu 2024-05-29 16:20:33 +08:00
parent 6e46289973
commit dd534649e5
8 changed files with 256 additions and 13 deletions

View File

@ -1,11 +1,14 @@
package com.zcloud.controller.keyProjects.app; package com.zcloud.controller.keyProjects.app;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.service.bus.ImgFilesService; import com.zcloud.service.bus.ImgFilesService;
import com.zcloud.service.keyProjects.AIWarningHiddensService;
import com.zcloud.service.keyProjects.AIWarningService; import com.zcloud.service.keyProjects.AIWarningService;
import com.zcloud.service.keyProjects.KeyprojectHiddenService; import com.zcloud.service.keyProjects.KeyprojectHiddenService;
import com.zcloud.util.*; import com.zcloud.util.*;
@ -20,6 +23,7 @@ import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* AI * AI
@ -37,6 +41,8 @@ public class AppAIWarningController extends BaseController {
private KeyprojectHiddenService keyprojectHiddenService; private KeyprojectHiddenService keyprojectHiddenService;
@Autowired @Autowired
private ImgFilesService imgFilesService; private ImgFilesService imgFilesService;
@Autowired
private AIWarningHiddensService aiwarningHiddensService;
/** /**
* @param * @param
* @throws Exception * @throws Exception
@ -171,7 +177,17 @@ public class AppAIWarningController extends BaseController {
} }
} }
if (!hiddenIdList.isEmpty()) { if (!hiddenIdList.isEmpty()) {
pd.put("HIDDEN_IDS", hiddenIdList.toString().replace("[","").replace("]","").replace(" ","")); PageData finalPd = pd;
hiddenIdList.forEach(e -> {
PageData pageData = new PageData();
pageData.put("AIWARNING_HIDDEN_ID", this.get32UUID());
pageData.put("AIWARNING_ID", finalPd.getString("AIWARNING_ID"));
pageData.put("HIDDEN_ID", e);
aiwarningHiddensService.save(pageData);
});
} }
aiwarningService.edit(pd); aiwarningService.edit(pd);
map.put("result", errInfo); map.put("result", errInfo);
@ -216,10 +232,12 @@ public class AppAIWarningController extends BaseController {
pd.put("NAME",user.getString("name")); pd.put("NAME",user.getString("name"));
} }
pd.put("FOREIGN_ID", pd.getString("OUTSOURCED_ID")); pd.put("FOREIGN_ID", pd.getString("OUTSOURCED_ID"));
if (Tools.notEmpty(pd.getString("HIDDEN_IDS"))){ List<PageData> hiddens = aiwarningHiddensService.findByAiId(pd);
if (CollUtil.isNotEmpty(hiddens)){
PageData pageData = new PageData(); PageData pageData = new PageData();
pageData.put("AI_WARNING","Y"); pageData.put("AI_WARNING","Y");
pageData.put("array",pd.getString("HIDDEN_IDS").split(",")); pageData.put("AIWARNING_ID", Assert.notBlank(pd.getString("AIWARNING_ID")));
pageData.put("array",hiddens.stream().map(e -> e.getString("HIDDEN_ID")).collect(Collectors.toList()));
pd.put("hiddenList", keyprojectHiddenService.listAllInspection(pageData)); pd.put("hiddenList", keyprojectHiddenService.listAllInspection(pageData));
} }
map.put("pd", pd); map.put("pd", pd);

View File

@ -0,0 +1,51 @@
package com.zcloud.mapper.dsno2.keyProjects;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* AIHidden_ids
* www.zcloudchina.com
* @Autorwater_xu
* @Date2024-05-29
*/
public interface AIWarningHiddensMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**AiId
* @param pd
* @throws Exception
*/
List<PageData> findByAiId(PageData pd);
/**HiddenId
* @param pd
* @throws Exception
*/
PageData findByHiddenId(PageData pd);
}

View File

@ -0,0 +1,48 @@
package com.zcloud.service.keyProjects;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* AIHidden_ids
* www.zcloudchina.com
* @Autor water_xu
* @Date 2024.05.29
*/
public interface AIWarningHiddensService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd);
/**
* id
*
* @param pd
* @throws Exception
*/
public List<PageData> findByAiId(PageData pd);
/**id
* @param pd
* @throws Exception
*/
public PageData findByHiddenId(PageData pd);
}

View File

@ -0,0 +1,59 @@
package com.zcloud.service.keyProjects.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.keyProjects.AIWarningHiddensMapper;
import com.zcloud.service.keyProjects.AIWarningHiddensService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* AIHidden_ids
* www.zcloudchina.com
* @Autor water_xu
* @Date 2024.05.29
*/
@Service
public class AIWarningHiddensServiceImpl implements AIWarningHiddensService {
@Autowired
private AIWarningHiddensMapper aiWarningHiddensMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd){
aiWarningHiddensMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd){
aiWarningHiddensMapper.edit(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd){
return aiWarningHiddensMapper.findById(pd);
}
@Override
public List<PageData> findByAiId(PageData pd){
return aiWarningHiddensMapper.findByAiId(pd);
}
@Override
public PageData findByHiddenId(PageData pd){
return aiWarningHiddensMapper.findByHiddenId(pd);
}
}

View File

@ -184,6 +184,14 @@ public class KeyprojectHiddenServiceImpl implements KeyprojectHiddenService {
@Override @Override
public List<PageData> listAllInspection(PageData pd) throws Exception { public List<PageData> listAllInspection(PageData pd) throws Exception {
List<PageData> hiddenList = hiddenMapper.listAllInspection(pd); List<PageData> hiddenList = hiddenMapper.listAllInspection(pd);
/**
* 100
* @Autor water_xu
* @Date 2024/05/29
*/
if (hiddenList.size() >= 100){
throw new RuntimeException("参数异常-listAllInspection查询结果记录数为" + hiddenList.size());
}
for (PageData hd : hiddenList) { for (PageData hd : hiddenList) {
PageData pd2 = new PageData(); PageData pd2 = new PageData();
pd2.put("FOREIGN_KEY",hd.getString("HIDDEN_ID")); pd2.put("FOREIGN_KEY",hd.getString("HIDDEN_ID"));

View File

@ -1136,6 +1136,10 @@
from from
<include refid="tableName"></include> f <include refid="tableName"></include> f
left join `qa-gwj-prevention`.bus_hiddenregion hr on hr.HIDDENREGION_ID = f.HIDDENPART left join `qa-gwj-prevention`.bus_hiddenregion hr on hr.HIDDENREGION_ID = f.HIDDENPART
<if test="AIWARNING_ID != null and AIWARNING_ID !=''" >
left join `qa-gwj-regulatory`.bus_aiwarning_hiddens aih on aih.HIDDEN_ID = f.HIDDEN_ID
left join `qa-gwj-regulatory`.bus_aiwarning ai on ai.AIWARNING_ID = aih.AIWARNING_ID
</if>
left join <include refid="dicTableName"></include> lv on f.HIDDENLEVEL = lv.BIANMA left join <include refid="dicTableName"></include> lv on f.HIDDENLEVEL = lv.BIANMA
left join <include refid="dicTableName"></include> ht on f.HIDDENTYPE = ht.BIANMA left join <include refid="dicTableName"></include> ht on f.HIDDENTYPE = ht.BIANMA
left join <include refid="dicTableName"></include> ht2 on f.HIDDENTYPE2 = ht2.BIANMA and ht2.PARENT_ID = '18c0a9aea6e54feab9f4ab3f46e0bc86' left join <include refid="dicTableName"></include> ht2 on f.HIDDENTYPE2 = ht2.BIANMA and ht2.PARENT_ID = '18c0a9aea6e54feab9f4ab3f46e0bc86'
@ -1148,13 +1152,11 @@
<if test="FOREIGN_ID != null and FOREIGN_ID !=''" > <if test="FOREIGN_ID != null and FOREIGN_ID !=''" >
and f.FOREIGN_ID = #{FOREIGN_ID} and f.FOREIGN_ID = #{FOREIGN_ID}
</if> </if>
<!-- Ai报警信息专查 -->
<if test="AI_WARNING != null and AI_WARNING !=''" > <if test="AIWARNING_ID != null and AIWARNING_ID !=''" >
and f.HIDDEN_ID in and ai.AIWARNING_ID = #{AIWARNING_ID}
<foreach collection="array" item="item" separator="," open="(" close = ")">
#{item}
</foreach>
</if> </if>
<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 --> <if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
and and
( (

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.keyProjects.AIWarningHiddensMapper">
<!--表名 -->
<sql id="tableName">
BUS_AIWARNING_HIDDENS
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
AIWARNING_HIDDEN_ID,AIWARNING_ID,HIDDEN_ID
) values (
#{AIWARNING_HIDDEN_ID},#{AIWARNING_ID},#{HIDDEN_ID}
)
</insert>
<!-- 删除用bus_aiwarning的ISDELETE字段就可以 -->
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
AIWARNING_ID = #{AIWARNING_ID},HIDDEN_ID = #{HIDDEN_ID}
where
AIWARNING_HIDDEN_ID = #{AIWARNING_HIDDEN_ID}
</update>
<!-- 通过AiID获取数据 -->
<select id="findByAiId" parameterType="pd" resultType="pd">
select
AIWARNING_HIDDEN_ID,AIWARNING_ID,HIDDEN_ID
from
<include refid="tableName"></include>
where
AIWARNING_ID = #{AIWARNING_ID}
</select>
<!-- 通过HiddenID获取数据 -->
<select id="findByHiddenId" parameterType="pd" resultType="pd">
select
AIWARNING_HIDDEN_ID,AIWARNING_ID,HIDDEN_ID
from
<include refid="tableName"></include>
where
HIDDEN_ID = #{HIDDEN_ID}
</select>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
AIWARNING_HIDDEN_ID,AIWARNING_ID,HIDDEN_ID
from
<include refid="tableName"></include>
where
AIWARNING_HIDDEN_ID = #{AIWARNING_HIDDEN_ID}
</select>
</mapper>

View File

@ -28,7 +28,6 @@
f.ISTRUE, f.ISTRUE,
f.HASHIDDEN, f.HASHIDDEN,
f.AIWARNING_ID, f.AIWARNING_ID,
f.HIDDEN_IDS,
f.REMARKS f.REMARKS
</sql> </sql>
@ -126,9 +125,6 @@
<if test="OPERATTIME != null and OPERATTIME != ''"> <if test="OPERATTIME != null and OPERATTIME != ''">
,OPERATTIME = #{OPERATTIME} ,OPERATTIME = #{OPERATTIME}
</if> </if>
<if test="HIDDEN_IDS != null and HIDDEN_IDS != ''">
,HIDDEN_IDS = #{HIDDEN_IDS}
</if>
where where
AIWARNING_ID = #{AIWARNING_ID} AIWARNING_ID = #{AIWARNING_ID}
</update> </update>