| | |
| | | |
| | | DistanceSuYuan getSuYuan500Max(@Param("tableName") String tableName, @Param("ids") List<String> ids); |
| | | |
| | | DistanceSuYuan getSuYuan500MaxByFilter(@Param("tableName") String tableName, @Param("filter") String filter); |
| | | |
| | | DistanceSuYuan getSuYuanById(@Param("tableName") String tableName, @Param("id") String id); |
| | | |
| | | List<Temporary> getTemporary(@Param("tableName") String tableName, @Param("ids") List<String> ids); |
| | |
| | | @Resource |
| | | private VocValsService vocValsService; |
| | | |
| | | private SimpleDateFormat ym = new SimpleDateFormat("yyyyMM%"); |
| | | private static HashMap<String, String> filterMap = new HashMap<>(); |
| | | |
| | | @Async("threadPoolTaskExecutor") |
| | | public void insertWarningDetails(List<WarningDetail> warning) throws Exception { |
| | |
| | | |
| | | WarningDetail wd = new WarningDetail(0L, tab, suYuanId, qxsh.getName(), null, 0, qxsh.getValue()); |
| | | DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(tab, suYuanId); |
| | | List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50); |
| | | DistanceSuYuan suMax = suYuanMapper.getSuYuan500Max(tab, ids3d); |
| | | //List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50); |
| | | //DistanceSuYuan suMax = suYuanMapper.getSuYuan500Max(tab, ids3d); |
| | | |
| | | //String filter = CalculateUtils.getFilterByExtend(point, 50); |
| | | String filter = getFilterByPoint(point, 50); |
| | | DistanceSuYuan suMax = suYuanMapper.getSuYuan500MaxByFilter(tab, filter); |
| | | suMax.setAddr(getAddr(suMax.getId())); |
| | | |
| | | Report report = Report.calcReport(wd, suYuan, suMax); |
| | |
| | | return list; |
| | | } |
| | | |
| | | public static String getFilterByPoint(MonitorPointPosition point, int range) { |
| | | String key = String.format("%d_%d_%d", point.getX(), point.getY(), range); |
| | | if (filterMap.containsKey(key)) { |
| | | return filterMap.get(key); |
| | | } |
| | | |
| | | List<String> ids = CalculateUtils.aloneCrosswiseExtend(point, range); |
| | | for (int i = 0, c = ids.size(); i < c; i++) { |
| | | ids.set(i, "'" + ids.get(i) + "'"); |
| | | } |
| | | |
| | | String filter = "id in (" + StringUtils.join(ids, ",") + ")"; |
| | | if (!filterMap.containsKey(key)) { |
| | | filterMap.put(key, filter); |
| | | } |
| | | |
| | | return filter; |
| | | } |
| | | |
| | | private Hashtable<String, Boolean> getExistTabDict(List<Qxsh> rsList) { |
| | | Hashtable<String, Boolean> dict = new Hashtable<>(); |
| | | for (Qxsh qxsh : rsList) { |
| | |
| | | return ids; |
| | | } |
| | | |
| | | /** |
| | | * 根据范围获取查询条件 |
| | | */ |
| | | public static String getFilterByExtend(MonitorPointPosition point, int range) { |
| | | Integer x = point.getX(); |
| | | Integer y = point.getY(); |
| | | |
| | | return String.format("x between %d and %d and y between %d and %d", x - range / 2, x + range / 2, y - range / 2, y + range / 2); |
| | | } |
| | | |
| | | public static List<String> temporary(MonitorPointPosition point, int range) { |
| | | List<String> ids3d = new ArrayList<>(); |
| | | Integer x = point.getX(); |
| | |
| | | limit 1; |
| | | </select> |
| | | |
| | | <select id="getSuYuan500MaxByFilter" resultMap="DistanceSuYuanResult"> |
| | | select id, x, y, format(c, 2) "c", u, v |
| | | from ${tableName} |
| | | where ${filter} |
| | | order by c desc |
| | | limit 1; |
| | | </select> |
| | | |
| | | <select id="getSuYuanById" resultMap="DistanceSuYuanResult"> |
| | | select id, x, y, format(c, 2) "c", u, v |
| | | from ${tableName} |
| | |
| | | </select> |
| | | |
| | | <update id="createTable" parameterType="java.lang.String"> |
| | | CREATE TABLE ${tableName} ( |
| | | `id` varchar(255) NOT NULL COMMENT '主键', |
| | | `x` int(7) NULL DEFAULT NULL, |
| | | `y` int(7) NULL DEFAULT NULL, |
| | | `z` int(7) NULL DEFAULT NULL, |
| | | `u` double NULL DEFAULT NULL, |
| | | `v` double NULL DEFAULT NULL, |
| | | `w` double NULL DEFAULT NULL, |
| | | `c` double NULL DEFAULT NULL, |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; |
| | | create table ${tablename} ( |
| | | `id` varchar(10) not null comment '主键', |
| | | `x` int(3) null default null, |
| | | `y` int(3) null default null, |
| | | `z` int(2) null default null, |
| | | `u` double null default null, |
| | | `v` double null default null, |
| | | `w` double null default null, |
| | | `c` double null default null, |
| | | primary key (`id`) using btree |
| | | ) engine = innodb character set = utf8 collate = utf8_general_ci row_format = dynamic; |
| | | </update> |
| | | |
| | | <update id="update" > |