AI报警-拆分HIDDEN_IDS字段
parent
6e46289973
commit
dd534649e5
|
@ -1,11 +1,14 @@
|
|||
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.JSONObject;
|
||||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.service.bus.ImgFilesService;
|
||||
import com.zcloud.service.keyProjects.AIWarningHiddensService;
|
||||
import com.zcloud.service.keyProjects.AIWarningService;
|
||||
import com.zcloud.service.keyProjects.KeyprojectHiddenService;
|
||||
import com.zcloud.util.*;
|
||||
|
@ -20,6 +23,7 @@ import java.io.InputStream;
|
|||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 说明:AI报警
|
||||
|
@ -37,6 +41,8 @@ public class AppAIWarningController extends BaseController {
|
|||
private KeyprojectHiddenService keyprojectHiddenService;
|
||||
@Autowired
|
||||
private ImgFilesService imgFilesService;
|
||||
@Autowired
|
||||
private AIWarningHiddensService aiwarningHiddensService;
|
||||
/**新增
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -171,7 +177,17 @@ public class AppAIWarningController extends BaseController {
|
|||
}
|
||||
}
|
||||
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);
|
||||
map.put("result", errInfo);
|
||||
|
@ -216,10 +232,12 @@ public class AppAIWarningController extends BaseController {
|
|||
pd.put("NAME",user.getString("name"));
|
||||
}
|
||||
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.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));
|
||||
}
|
||||
map.put("pd", pd);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.zcloud.mapper.dsno2.keyProjects;
|
||||
|
||||
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 说明:AI报警表的Hidden_ids中间表
|
||||
* 官网:www.zcloudchina.com
|
||||
* @Autor:water_xu
|
||||
* @Date:2024-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);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.zcloud.service.keyProjects;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:AI报警表的Hidden_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);
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* 说明:AI报警表的Hidden_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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -184,6 +184,14 @@ public class KeyprojectHiddenServiceImpl implements KeyprojectHiddenService {
|
|||
@Override
|
||||
public List<PageData> listAllInspection(PageData pd) throws Exception {
|
||||
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) {
|
||||
PageData pd2 = new PageData();
|
||||
pd2.put("FOREIGN_KEY",hd.getString("HIDDEN_ID"));
|
||||
|
|
|
@ -1136,6 +1136,10 @@
|
|||
from
|
||||
<include refid="tableName"></include> f
|
||||
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> ht on f.HIDDENTYPE = ht.BIANMA
|
||||
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 !=''" >
|
||||
and f.FOREIGN_ID = #{FOREIGN_ID}
|
||||
</if>
|
||||
<!-- Ai报警信息专查 -->
|
||||
<if test="AI_WARNING != null and AI_WARNING !=''" >
|
||||
and f.HIDDEN_ID in
|
||||
<foreach collection="array" item="item" separator="," open="(" close = ")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
<if test="AIWARNING_ID != null and AIWARNING_ID !=''" >
|
||||
and ai.AIWARNING_ID = #{AIWARNING_ID}
|
||||
</if>
|
||||
|
||||
<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
(
|
||||
|
|
|
@ -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>
|
|
@ -28,7 +28,6 @@
|
|||
f.ISTRUE,
|
||||
f.HASHIDDEN,
|
||||
f.AIWARNING_ID,
|
||||
f.HIDDEN_IDS,
|
||||
f.REMARKS
|
||||
</sql>
|
||||
|
||||
|
@ -126,9 +125,6 @@
|
|||
<if test="OPERATTIME != null and OPERATTIME != ''">
|
||||
,OPERATTIME = #{OPERATTIME}
|
||||
</if>
|
||||
<if test="HIDDEN_IDS != null and HIDDEN_IDS != ''">
|
||||
,HIDDEN_IDS = #{HIDDEN_IDS}
|
||||
</if>
|
||||
where
|
||||
AIWARNING_ID = #{AIWARNING_ID}
|
||||
</update>
|
||||
|
|
Loading…
Reference in New Issue