正在显示
143 个修改的文件
包含
3272 行增加
和
608 行删除
lh-jar/lh-jar-device-analysis/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <modelVersion>4.0.0</modelVersion> | ||
| 6 | + <parent> | ||
| 7 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 8 | + <artifactId>lh-jar</artifactId> | ||
| 9 | + <version>1.0-SNAPSHOT</version> | ||
| 10 | + </parent> | ||
| 11 | + | ||
| 12 | + <artifactId>lh-jar-device-analysis</artifactId> | ||
| 13 | + | ||
| 14 | + <properties> | ||
| 15 | + <maven.compiler.source>8</maven.compiler.source> | ||
| 16 | + <maven.compiler.target>8</maven.compiler.target> | ||
| 17 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| 18 | + </properties> | ||
| 19 | + | ||
| 20 | + <dependencies> | ||
| 21 | + <dependency> | ||
| 22 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 23 | + <artifactId>ruoyi-framework</artifactId> | ||
| 24 | + </dependency> | ||
| 25 | + <dependency> | ||
| 26 | + <groupId>org.aspectj</groupId> | ||
| 27 | + <artifactId>aspectjweaver</artifactId> | ||
| 28 | + </dependency> | ||
| 29 | + <dependency> | ||
| 30 | + <groupId>org.aspectj</groupId> | ||
| 31 | + <artifactId>aspectjrt</artifactId> | ||
| 32 | + </dependency> | ||
| 33 | + | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 36 | + <artifactId>lh-jar-device-service</artifactId> | ||
| 37 | + <scope>compile</scope> | ||
| 38 | + </dependency> | ||
| 39 | + </dependencies> | ||
| 40 | +</project> |
| 1 | -package com.zhonglai.luhui.mqtt.comm.agreement; | 1 | +package com.zhonglai.luhui.device.analysis.comm.agreement; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreementFactory; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 3 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreementFactory; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 8 | 8 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.agreement; | 1 | +package com.zhonglai.luhui.device.analysis.comm.agreement; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.clien; | 1 | +package com.zhonglai.luhui.device.analysis.comm.clien; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ApiClientRePlyDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.dto.Message; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ApiClientRePlyDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * 客户端链接 | 8 | * 客户端链接 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.clien.impl; | 1 | +package com.zhonglai.luhui.device.analysis.comm.clien.impl; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.clien.ClienConnection; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.ApiClientRePlyDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 8 | -import com.zhonglai.luhui.mqtt.dto.MessageCodeType; | 4 | +import com.zhonglai.luhui.device.analysis.comm.clien.ClienConnection; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.ApiClientRePlyDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.MessageCodeType; | ||
| 9 | 9 | ||
| 10 | public class ClienConnectionImpl implements ClienConnection { | 10 | public class ClienConnectionImpl implements ClienConnection { |
| 11 | private Message message = new Message(); | 11 | private Message message = new Message(); |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | ||
| 4 | import lombok.Data; | 3 | import lombok.Data; |
| 5 | 4 | ||
| 6 | @Data | 5 | @Data |
| @@ -23,18 +22,18 @@ public class DeviceInfoDto { | @@ -23,18 +22,18 @@ public class DeviceInfoDto { | ||
| 23 | private String sensorType; //设备配置 | 22 | private String sensorType; //设备配置 |
| 24 | private Boolean isadd; //是否添加 | 23 | private Boolean isadd; //是否添加 |
| 25 | 24 | ||
| 26 | - public static DeviceInfoDto newDefaultDeviceInfoDto(String imei, String sensor_number, String device_model, String device_type) | ||
| 27 | - { | ||
| 28 | - DeviceInfoDto deviceInfoDto = new DeviceInfoDto(); | ||
| 29 | - deviceInfoDto.setId(imei+"_"+sensor_number); | ||
| 30 | - deviceInfoDto.setDeviceId(imei); | ||
| 31 | - deviceInfoDto.setSensorNumber(sensor_number); | ||
| 32 | - deviceInfoDto.setDeviceModel(device_model); | ||
| 33 | - deviceInfoDto.setDeviceType(device_type); | ||
| 34 | - deviceInfoDto.setAlarmCode("00"); | ||
| 35 | - deviceInfoDto.setOnline("01"); | ||
| 36 | - deviceInfoDto.setDeviceServiceIp(SysParameter.service_ip); | ||
| 37 | - deviceInfoDto.setIsadd(true); | ||
| 38 | - return deviceInfoDto; | ||
| 39 | - } | 25 | +// public static DeviceInfoDto newDefaultDeviceInfoDto(String imei, String sensor_number, String device_model, String device_type) |
| 26 | +// { | ||
| 27 | +// DeviceInfoDto deviceInfoDto = new DeviceInfoDto(); | ||
| 28 | +// deviceInfoDto.setId(imei+"_"+sensor_number); | ||
| 29 | +// deviceInfoDto.setDeviceId(imei); | ||
| 30 | +// deviceInfoDto.setSensorNumber(sensor_number); | ||
| 31 | +// deviceInfoDto.setDeviceModel(device_model); | ||
| 32 | +// deviceInfoDto.setDeviceType(device_type); | ||
| 33 | +// deviceInfoDto.setAlarmCode("00"); | ||
| 34 | +// deviceInfoDto.setOnline("01"); | ||
| 35 | +// deviceInfoDto.setDeviceServiceIp(SysParameter.service_ip); | ||
| 36 | +// deviceInfoDto.setIsadd(true); | ||
| 37 | +// return deviceInfoDto; | ||
| 38 | +// } | ||
| 40 | } | 39 | } |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.business; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.business; |
| 2 | 2 | ||
| 3 | public class BusinessDtoClassNew { | 3 | public class BusinessDtoClassNew { |
| 4 | public static BusinessDto newBean(String payloadtype,byte[] data ) | 4 | public static BusinessDto newBean(String payloadtype,byte[] data ) |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.business; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.business; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | import lombok.Data; | 4 | import lombok.Data; |
| 6 | import org.apache.commons.lang3.ArrayUtils; | 5 | import org.apache.commons.lang3.ArrayUtils; |
| 7 | 6 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.business; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.business; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | import lombok.Data; | 4 | import lombok.Data; |
| 6 | 5 | ||
| 7 | import java.io.UnsupportedEncodingException; | 6 | import java.io.UnsupportedEncodingException; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs.*; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | * 物模型数据类型,及对应显示解析方案 | 7 | * 物模型数据类型,及对应显示解析方案 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | import com.alibaba.fastjson.annotation.JSONField; | 4 | import com.alibaba.fastjson.annotation.JSONField; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | 7 | ||
| 8 | @Data | 8 | @Data |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | @Data | 6 | @Data |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.EnumItemOutput; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | 3 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.EnumItemOutput; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 6 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
| 8 | 8 |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs; | 1 | +package com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 1 | -package com.zhonglai.luhui.mqtt.comm.factory; | 1 | +package com.zhonglai.luhui.device.analysis.comm.factory; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * mqtt业务协议 | 8 | * mqtt业务协议 |
| 1 | +package com.zhonglai.luhui.device.analysis.comm.factory; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.MyException; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | + | ||
| 9 | +import java.lang.reflect.Field; | ||
| 10 | +import java.util.Optional; | ||
| 11 | + | ||
| 12 | +@Data | ||
| 13 | +public class Topic { | ||
| 14 | + | ||
| 15 | + private String roleid; | ||
| 16 | + private String username; | ||
| 17 | + private String clientid; | ||
| 18 | + private String topicType; | ||
| 19 | + private String messageid; | ||
| 20 | + private String payloadtype; | ||
| 21 | + | ||
| 22 | + public Topic() { | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public Topic(String roleid, String username, String clientid, String topicType, String payloadtype) { | ||
| 26 | + this.roleid = roleid; | ||
| 27 | + this.username = username; | ||
| 28 | + this.clientid = clientid; | ||
| 29 | + this.topicType = topicType; | ||
| 30 | + this.payloadtype = payloadtype; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public Topic(String roleid, String username, String clientid, String topicType, String messageid, String payloadtype) { | ||
| 34 | + this.roleid = roleid; | ||
| 35 | + this.username = username; | ||
| 36 | + this.clientid = clientid; | ||
| 37 | + this.topicType = topicType; | ||
| 38 | + this.messageid = messageid; | ||
| 39 | + this.payloadtype = payloadtype; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +} |
| 1 | -package com.zhonglai.luhui.mqtt.comm.util; | 1 | +package com.zhonglai.luhui.device.analysis.comm.util; |
| 2 | 2 | ||
| 3 | import org.apache.commons.lang3.time.DateFormatUtils; | 3 | import org.apache.commons.lang3.time.DateFormatUtils; |
| 4 | 4 | ||
| @@ -116,7 +116,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils | @@ -116,7 +116,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils | ||
| 116 | } | 116 | } |
| 117 | try | 117 | try |
| 118 | { | 118 | { |
| 119 | - return parseDate(str.toString(), parsePatterns); | 119 | + return DateUtils.parseDate(str.toString(), parsePatterns); |
| 120 | } | 120 | } |
| 121 | catch (ParseException e) | 121 | catch (ParseException e) |
| 122 | { | 122 | { |
| 1 | -package com.zhonglai.luhui.mqtt.comm.util; | 1 | +package com.zhonglai.luhui.device.analysis.comm.util; |
| 2 | 2 | ||
| 3 | import org.springframework.util.AntPathMatcher; | 3 | import org.springframework.util.AntPathMatcher; |
| 4 | 4 | ||
| @@ -327,13 +327,13 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils | @@ -327,13 +327,13 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils | ||
| 327 | */ | 327 | */ |
| 328 | public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) | 328 | public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) |
| 329 | { | 329 | { |
| 330 | - if (isEmpty(cs) || isEmpty(searchCharSequences)) | 330 | + if (StringUtils.isEmpty(cs) || isEmpty(searchCharSequences)) |
| 331 | { | 331 | { |
| 332 | return false; | 332 | return false; |
| 333 | } | 333 | } |
| 334 | for (CharSequence testStr : searchCharSequences) | 334 | for (CharSequence testStr : searchCharSequences) |
| 335 | { | 335 | { |
| 336 | - if (containsIgnoreCase(cs, testStr)) | 336 | + if (StringUtils.containsIgnoreCase(cs, testStr)) |
| 337 | { | 337 | { |
| 338 | return true; | 338 | return true; |
| 339 | } | 339 | } |
| 1 | -package com.zhonglai.luhui.mqtt.comm.util.http; | 1 | +package com.zhonglai.luhui.device.analysis.comm.util.http; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.util.Constants; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | 3 | +import com.zhonglai.luhui.device.analysis.comm.util.Constants; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | 7 |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | 5 | ||
| 6 | public class AddPostDto extends ServerDto { | 6 | public class AddPostDto extends ServerDto { |
| 7 | private JSONObject data; | 7 | private JSONObject data; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | 5 | ||
| 6 | public class AllPostDto extends ServerDto { | 6 | public class AllPostDto extends ServerDto { |
| 7 | private JSONObject data; | 7 | private JSONObject data; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | 5 | ||
| 6 | public class GetDto extends ServerDto { | 6 | public class GetDto extends ServerDto { |
| 7 | private JSONObject data; | 7 | private JSONObject data; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 4 | 4 | ||
| 5 | public class GetReqDto extends ServerDto { | 5 | public class GetReqDto extends ServerDto { |
| 6 | } | 6 | } |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 4 | 4 | ||
| 5 | public class OnlineDto extends ServerDto { | 5 | public class OnlineDto extends ServerDto { |
| 6 | private Integer state; | 6 | private Integer state; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 7 | 5 | ||
| 8 | public class PutReqDto extends ServerDto { | 6 | public class PutReqDto extends ServerDto { |
| 9 | private Integer code; | 7 | private Integer code; |
| 1 | -package com.zhonglai.luhui.mqtt.dto.topic; | 1 | +package com.zhonglai.luhui.device.analysis.dto.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 8 | - | ||
| 9 | -import java.util.HashMap; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 10 | 5 | ||
| 11 | public class ReadReqDto extends ServerDto { | 6 | public class ReadReqDto extends ServerDto { |
| 12 | private Integer code; | 7 | private Integer code; |
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | <modules> | 13 | <modules> |
| 14 | <module>lh-jar-action</module> | 14 | <module>lh-jar-action</module> |
| 15 | <module>lh-jar-chatgpt</module> | 15 | <module>lh-jar-chatgpt</module> |
| 16 | + <module>lh-jar-device-analysis</module> | ||
| 16 | <module>lh-jar-device-service</module> | 17 | <module>lh-jar-device-service</module> |
| 17 | <module>lh-jar-rocketmq</module> | 18 | <module>lh-jar-rocketmq</module> |
| 18 | <module>lh-jar-sys-service</module> | 19 | <module>lh-jar-sys-service</module> |
| @@ -4,6 +4,7 @@ import java.util.*; | @@ -4,6 +4,7 @@ import java.util.*; | ||
| 4 | import javax.servlet.http.HttpServletResponse; | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | ||
| 6 | import com.zhonglai.luhui.action.BaseController; | 6 | import com.zhonglai.luhui.action.BaseController; |
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs.*; | ||
| 7 | import com.zhonglai.luhui.security.utils.SecurityUtils; | 8 | import com.zhonglai.luhui.security.utils.SecurityUtils; |
| 8 | import com.zhonglai.luhui.sys.utils.ExcelUtil; | 9 | import com.zhonglai.luhui.sys.utils.ExcelUtil; |
| 9 | import com.alibaba.fastjson.JSON; | 10 | import com.alibaba.fastjson.JSON; |
| @@ -12,8 +13,7 @@ import com.zhonglai.luhui.device.domain.DistributionCurrencyModel; | @@ -12,8 +13,7 @@ import com.zhonglai.luhui.device.domain.DistributionCurrencyModel; | ||
| 12 | import com.zhonglai.luhui.device.domain.IotProduct; | 13 | import com.zhonglai.luhui.device.domain.IotProduct; |
| 13 | import com.zhonglai.luhui.device.service.IIotProductService; | 14 | import com.zhonglai.luhui.device.service.IIotProductService; |
| 14 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; | 15 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; |
| 15 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 16 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | 16 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 17 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 17 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 18 | import io.swagger.annotations.Api; | 18 | import io.swagger.annotations.Api; |
| 19 | import io.swagger.annotations.ApiOperation; | 19 | import io.swagger.annotations.ApiOperation; |
| @@ -5,14 +5,14 @@ import java.util.List; | @@ -5,14 +5,14 @@ import java.util.List; | ||
| 5 | import javax.servlet.http.HttpServletResponse; | 5 | import javax.servlet.http.HttpServletResponse; |
| 6 | 6 | ||
| 7 | import com.zhonglai.luhui.action.BaseController; | 7 | import com.zhonglai.luhui.action.BaseController; |
| 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.specs.*; | ||
| 8 | import com.zhonglai.luhui.device.service.IIotProductService; | 9 | import com.zhonglai.luhui.device.service.IIotProductService; |
| 9 | import com.zhonglai.luhui.security.utils.SecurityUtils; | 10 | import com.zhonglai.luhui.security.utils.SecurityUtils; |
| 10 | import com.zhonglai.luhui.sys.utils.ExcelUtil; | 11 | import com.zhonglai.luhui.sys.utils.ExcelUtil; |
| 11 | import com.alibaba.fastjson.JSON; | 12 | import com.alibaba.fastjson.JSON; |
| 12 | import com.alibaba.fastjson.JSONObject; | 13 | import com.alibaba.fastjson.JSONObject; |
| 13 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; | 14 | import com.zhonglai.luhui.admin.dto.IotThingsModelAddApi; |
| 14 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 15 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.specs.*; | 15 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; |
| 16 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
| 17 | import io.swagger.annotations.ApiOperation; | 17 | import io.swagger.annotations.ApiOperation; |
| 18 | import org.springframework.security.access.prepost.PreAuthorize; | 18 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -6,9 +6,6 @@ import cn.hutool.extra.ssh.ChannelType; | @@ -6,9 +6,6 @@ import cn.hutool.extra.ssh.ChannelType; | ||
| 6 | import cn.hutool.extra.ssh.JschUtil; | 6 | import cn.hutool.extra.ssh.JschUtil; |
| 7 | import com.jcraft.jsch.ChannelExec; | 7 | import com.jcraft.jsch.ChannelExec; |
| 8 | import com.jcraft.jsch.JSchException; | 8 | import com.jcraft.jsch.JSchException; |
| 9 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 10 | -import org.slf4j.Logger; | ||
| 11 | -import org.slf4j.LoggerFactory; | ||
| 12 | import org.springframework.stereotype.Component; | 9 | import org.springframework.stereotype.Component; |
| 13 | 10 | ||
| 14 | import java.io.*; | 11 | import java.io.*; |
lh-modules/lh-http-service/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <modelVersion>4.0.0</modelVersion> | ||
| 6 | + <parent> | ||
| 7 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 8 | + <artifactId>lh-modules</artifactId> | ||
| 9 | + <version>1.0-SNAPSHOT</version> | ||
| 10 | + </parent> | ||
| 11 | + | ||
| 12 | + <artifactId>lh-http-service</artifactId> | ||
| 13 | + | ||
| 14 | + <properties> | ||
| 15 | + <maven.compiler.source>8</maven.compiler.source> | ||
| 16 | + <maven.compiler.target>8</maven.compiler.target> | ||
| 17 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| 18 | + </properties> | ||
| 19 | + | ||
| 20 | + <dependencies> | ||
| 21 | + <!-- 核心模块--> | ||
| 22 | + <dependency> | ||
| 23 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 24 | + <artifactId>ruoyi-framework</artifactId> | ||
| 25 | + </dependency> | ||
| 26 | + <dependency> | ||
| 27 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 28 | + <artifactId>lh-jar-sys-service</artifactId> | ||
| 29 | + </dependency> | ||
| 30 | + <dependency> | ||
| 31 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 32 | + <artifactId>lh-common-swagger</artifactId> | ||
| 33 | + </dependency> | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 36 | + <artifactId>lh-common-datasource</artifactId> | ||
| 37 | + </dependency> | ||
| 38 | + <dependency> | ||
| 39 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 40 | + <artifactId>lh-public-dao</artifactId> | ||
| 41 | + </dependency> | ||
| 42 | + <dependency> | ||
| 43 | + <groupId>org.aspectj</groupId> | ||
| 44 | + <artifactId>aspectjweaver</artifactId> | ||
| 45 | + </dependency> | ||
| 46 | + <dependency> | ||
| 47 | + <groupId>org.aspectj</groupId> | ||
| 48 | + <artifactId>aspectjrt</artifactId> | ||
| 49 | + </dependency> | ||
| 50 | + <dependency> | ||
| 51 | + <groupId>org.springframework.boot</groupId> | ||
| 52 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| 53 | + </dependency> | ||
| 54 | + <dependency> | ||
| 55 | + <groupId>org.yaml</groupId> | ||
| 56 | + <artifactId>snakeyaml</artifactId> | ||
| 57 | + </dependency> | ||
| 58 | + | ||
| 59 | + <!-- <dependency>--> | ||
| 60 | +<!-- <groupId>com.zhonglai.luhui</groupId>--> | ||
| 61 | +<!-- <artifactId>lh-jar-device-analysis</artifactId>--> | ||
| 62 | +<!-- </dependency>--> | ||
| 63 | + </dependencies> | ||
| 64 | + | ||
| 65 | + <build> | ||
| 66 | + <finalName>lh-http-service</finalName> | ||
| 67 | + <plugins> | ||
| 68 | + <plugin> | ||
| 69 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 70 | + <artifactId>maven-jar-plugin</artifactId> | ||
| 71 | + <version>2.4</version> | ||
| 72 | + <configuration> | ||
| 73 | + <archive> | ||
| 74 | + <!-- | ||
| 75 | + 生成的jar中,不要包含pom.xml和pom.properties这两个文件 | ||
| 76 | + --> | ||
| 77 | + <addMavenDescriptor>false</addMavenDescriptor> | ||
| 78 | + <manifest> | ||
| 79 | + <!-- | ||
| 80 | + 是否要把第三方jar放到manifest的classpath中 | ||
| 81 | + --> | ||
| 82 | + <addClasspath>true</addClasspath> | ||
| 83 | + | ||
| 84 | + <!-- | ||
| 85 | + 生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/ | ||
| 86 | + --> | ||
| 87 | + <classpathPrefix>lib/</classpathPrefix> | ||
| 88 | + <mainClass>com.zhonglai.luhui.http.service.Main</mainClass> | ||
| 89 | + </manifest> | ||
| 90 | + </archive> | ||
| 91 | + </configuration> | ||
| 92 | + </plugin> | ||
| 93 | + | ||
| 94 | + <!-- The configuration of maven-assembly-plugin --> | ||
| 95 | + <plugin> | ||
| 96 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 97 | + <artifactId>maven-assembly-plugin</artifactId> | ||
| 98 | + <version>2.4</version> | ||
| 99 | + <configuration> | ||
| 100 | + <descriptors> | ||
| 101 | + <descriptor>src/main/resources/package.xml</descriptor> | ||
| 102 | + </descriptors> | ||
| 103 | + </configuration> | ||
| 104 | + <executions> | ||
| 105 | + <execution> | ||
| 106 | + <id>make-assembly</id> | ||
| 107 | + <phase>package</phase> | ||
| 108 | + <goals> | ||
| 109 | + <goal>single</goal> | ||
| 110 | + </goals> | ||
| 111 | + </execution> | ||
| 112 | + </executions> | ||
| 113 | + </plugin> | ||
| 114 | + </plugins> | ||
| 115 | + </build> | ||
| 116 | +</project> |
| 1 | +package com.zhonglai.luhui.http.service; | ||
| 2 | + | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 5 | +import org.springframework.boot.SpringApplication; | ||
| 6 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 7 | +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
| 8 | +import org.springframework.context.annotation.ComponentScan; | ||
| 9 | + | ||
| 10 | +@ComponentScan(basePackages = { | ||
| 11 | + "com.ruoyi.common", | ||
| 12 | + "com.ruoyi.framework", | ||
| 13 | + "com.zhonglai.luhui.datasource", | ||
| 14 | + "com.zhonglai.luhui.dao", | ||
| 15 | + "com.zhonglai.luhui.http.service", | ||
| 16 | +} | ||
| 17 | +) | ||
| 18 | +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class}) | ||
| 19 | +public class Main { | ||
| 20 | + private static final Logger logger = LoggerFactory.getLogger(Main.class); | ||
| 21 | + public static void main(String[] args) { | ||
| 22 | + SpringApplication.run(Main.class,args); | ||
| 23 | + logger.info("启动服务"); | ||
| 24 | + } | ||
| 25 | +} |
lh-modules/lh-http-service/src/main/java/com/zhonglai/luhui/http/service/config/SwaggerConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.http.service.config; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.config.RuoYiConfig; | ||
| 4 | +import io.swagger.annotations.ApiOperation; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.context.annotation.Bean; | ||
| 7 | +import org.springframework.context.annotation.Configuration; | ||
| 8 | +import springfox.documentation.builders.ApiInfoBuilder; | ||
| 9 | +import springfox.documentation.builders.PathSelectors; | ||
| 10 | +import springfox.documentation.builders.RequestHandlerSelectors; | ||
| 11 | +import springfox.documentation.service.Contact; | ||
| 12 | +import springfox.documentation.spi.DocumentationType; | ||
| 13 | +import springfox.documentation.spring.web.plugins.Docket; | ||
| 14 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +@Configuration | ||
| 18 | +@EnableSwagger2 | ||
| 19 | +public class SwaggerConfig { | ||
| 20 | + /** 系统基础配置 */ | ||
| 21 | + @Autowired | ||
| 22 | + private RuoYiConfig ruoyiConfig; | ||
| 23 | + @Bean | ||
| 24 | + public Docket createRestApi() { | ||
| 25 | + return new Docket(DocumentationType.SWAGGER_2) | ||
| 26 | + .groupName("设备http服务器") | ||
| 27 | + .apiInfo( | ||
| 28 | + new ApiInfoBuilder().title("标题:设备http服务器") | ||
| 29 | + .description("设备http服务器") | ||
| 30 | + .contact(new Contact(ruoyiConfig.getName(), null, null)) | ||
| 31 | + .version("版本号:" + ruoyiConfig.getVersion()) | ||
| 32 | + .build() | ||
| 33 | + ) | ||
| 34 | + .select() | ||
| 35 | + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) | ||
| 36 | + .paths(PathSelectors.any()) | ||
| 37 | + .build(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +} |
| 1 | +package com.zhonglai.luhui.http.service.controller; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 4 | +import com.ruoyi.common.utils.StringUtils; | ||
| 5 | +import io.swagger.annotations.Api; | ||
| 6 | +import io.swagger.annotations.ApiOperation; | ||
| 7 | +import org.springframework.web.bind.annotation.ModelAttribute; | ||
| 8 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import javax.servlet.http.HttpServletRequest; | ||
| 13 | +import javax.servlet.http.HttpServletResponse; | ||
| 14 | + | ||
| 15 | +@Api(tags = "设备操作") | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("/device") | ||
| 18 | +public class DeviceService { | ||
| 19 | + | ||
| 20 | + private static String authKey = "key"; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 添加校验 | ||
| 24 | + * @return | ||
| 25 | + */ | ||
| 26 | + @ModelAttribute | ||
| 27 | + public void preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) | ||
| 28 | + { | ||
| 29 | + String key = request.getParameter(authKey); | ||
| 30 | + if(StringUtils.isNoneEmpty(key)) | ||
| 31 | + { | ||
| 32 | + response.setStatus(403); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @ApiOperation("更新指定设备的全部数据") | ||
| 37 | + @RequestMapping(value = "putAllData/{deviceid}") | ||
| 38 | + public AjaxResult putAllData(@PathVariable String deviceid) | ||
| 39 | + { | ||
| 40 | + return AjaxResult.success(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @ApiOperation("更新指定设备的部分数据") | ||
| 44 | + @RequestMapping(value = "putPartialData/{deviceid}") | ||
| 45 | + public AjaxResult putPartialData(@PathVariable String deviceid) | ||
| 46 | + { | ||
| 47 | + return AjaxResult.success(); | ||
| 48 | + } | ||
| 49 | +} |
| 1 | +restart.include.json=/com.alibaba.fastjson.*.jar |
| 1 | +# 数据源配置 | ||
| 2 | +spring: | ||
| 3 | + datasource: | ||
| 4 | + type: com.alibaba.druid.pool.DruidDataSource | ||
| 5 | + driverClassName: com.mysql.cj.jdbc.Driver | ||
| 6 | + druid: | ||
| 7 | + # 主库数据源 | ||
| 8 | + master: | ||
| 9 | + url: jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/mqtt_broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | ||
| 10 | + username: luhui | ||
| 11 | + password: Luhui586 | ||
| 12 | + # 从库数据源 | ||
| 13 | + slave: | ||
| 14 | + # 从数据源开关/默认关闭 | ||
| 15 | + enabled: false | ||
| 16 | + url: | ||
| 17 | + username: | ||
| 18 | + password: | ||
| 19 | + # 初始连接数 | ||
| 20 | + initialSize: 5 | ||
| 21 | + # 最小连接池数量 | ||
| 22 | + minIdle: 10 | ||
| 23 | + # 最大连接池数量 | ||
| 24 | + maxActive: 20 | ||
| 25 | + # 配置获取连接等待超时的时间 | ||
| 26 | + maxWait: 60000 | ||
| 27 | + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | ||
| 28 | + timeBetweenEvictionRunsMillis: 60000 | ||
| 29 | + # 配置一个连接在池中最小生存的时间,单位是毫秒 | ||
| 30 | + minEvictableIdleTimeMillis: 300000 | ||
| 31 | + # 配置一个连接在池中最大生存的时间,单位是毫秒 | ||
| 32 | + maxEvictableIdleTimeMillis: 900000 | ||
| 33 | + # 配置检测连接是否有效 | ||
| 34 | + validationQuery: SELECT 1 FROM DUAL | ||
| 35 | + testWhileIdle: true | ||
| 36 | + testOnBorrow: false | ||
| 37 | + testOnReturn: false | ||
| 38 | + webStatFilter: | ||
| 39 | + enabled: true | ||
| 40 | + statViewServlet: | ||
| 41 | + enabled: true | ||
| 42 | + # 设置白名单,不填则允许所有访问 | ||
| 43 | + allow: | ||
| 44 | + url-pattern: /druid/* | ||
| 45 | + # 控制台管理用户名和密码 | ||
| 46 | + login-username: ruoyi | ||
| 47 | + login-password: 123456 | ||
| 48 | + filter: | ||
| 49 | + stat: | ||
| 50 | + enabled: true | ||
| 51 | + # 慢SQL记录 | ||
| 52 | + log-slow-sql: true | ||
| 53 | + slow-sql-millis: 1000 | ||
| 54 | + merge-sql: true | ||
| 55 | + wall: | ||
| 56 | + config: | ||
| 57 | + multi-statement-allow: true |
| 1 | +# 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8065 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* |
| 1 | +#错误消息 | ||
| 2 | +not.null=* 必须填写 | ||
| 3 | +user.jcaptcha.error=验证码错误 | ||
| 4 | +user.jcaptcha.expire=验证码已失效 | ||
| 5 | +user.not.exists=用户不存在/密码错误 | ||
| 6 | +user.password.not.match=用户不存在/密码错误 | ||
| 7 | +user.password.retry.limit.count=密码输入错误{0}次 | ||
| 8 | +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟 | ||
| 9 | +user.password.delete=对不起,您的账号已被删除 | ||
| 10 | +user.blocked=用户已封禁,请联系管理员 | ||
| 11 | +role.blocked=角色已封禁,请联系管理员 | ||
| 12 | +user.logout.success=退出成功 | ||
| 13 | + | ||
| 14 | +length.not.valid=长度必须在{min}到{max}个字符之间 | ||
| 15 | + | ||
| 16 | +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 | ||
| 17 | +user.password.not.valid=* 5-50个字符 | ||
| 18 | + | ||
| 19 | +user.email.not.valid=邮箱格式错误 | ||
| 20 | +user.mobile.phone.number.not.valid=手机号格式错误 | ||
| 21 | +user.login.success=登录成功 | ||
| 22 | +user.register.success=注册成功 | ||
| 23 | +user.notfound=请重新登录 | ||
| 24 | +user.forcelogout=管理员强制退出,请重新登录 | ||
| 25 | +user.unknown.error=未知错误,请重新登录 | ||
| 26 | + | ||
| 27 | +##文件上传消息 | ||
| 28 | +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB! | ||
| 29 | +upload.filename.exceed.length=上传的文件名最长{0}个字符 | ||
| 30 | + | ||
| 31 | +##权限 | ||
| 32 | +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] | ||
| 33 | +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] | ||
| 34 | +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] | ||
| 35 | +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] | ||
| 36 | +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] | ||
| 37 | +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] |
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | +<!DOCTYPE configuration | ||
| 3 | +PUBLIC "-//mybatis.org//DTD Config 3.0//EN" | ||
| 4 | +"http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
| 5 | +<configuration> | ||
| 6 | + <!-- 全局参数 --> | ||
| 7 | + <settings> | ||
| 8 | + <!-- 使全局的映射器启用或禁用缓存 --> | ||
| 9 | + <setting name="cacheEnabled" value="true" /> | ||
| 10 | + <!-- 允许JDBC 支持自动生成主键 --> | ||
| 11 | + <setting name="useGeneratedKeys" value="true" /> | ||
| 12 | + <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 --> | ||
| 13 | + <setting name="defaultExecutorType" value="SIMPLE" /> | ||
| 14 | + <!-- 指定 MyBatis 所用日志的具体实现 --> | ||
| 15 | + <setting name="logImpl" value="SLF4J" /> | ||
| 16 | + <!-- 使用驼峰命名法转换字段 --> | ||
| 17 | + <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> --> | ||
| 18 | + </settings> | ||
| 19 | + | ||
| 20 | +</configuration> |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<assembly> | ||
| 4 | + <id>bin</id> | ||
| 5 | + <!-- 最终打包成一个用于发布的zip文件 --> | ||
| 6 | + <formats> | ||
| 7 | + <format>zip</format> | ||
| 8 | + </formats> | ||
| 9 | + | ||
| 10 | + <!-- Adds dependencies to zip package under lib directory --> | ||
| 11 | + <dependencySets> | ||
| 12 | + <dependencySet> | ||
| 13 | + <!-- | ||
| 14 | + 不使用项目的artifact,第三方jar不要解压,打包进zip文件的lib目录 | ||
| 15 | + --> | ||
| 16 | + <useProjectArtifact>false</useProjectArtifact> | ||
| 17 | + <outputDirectory>lib</outputDirectory> | ||
| 18 | + <unpack>false</unpack> | ||
| 19 | + </dependencySet> | ||
| 20 | + </dependencySets> | ||
| 21 | + | ||
| 22 | + <fileSets> | ||
| 23 | + <!-- 把项目相关的说明文件,打包进zip文件的根目录 --> | ||
| 24 | + <fileSet> | ||
| 25 | + <directory>${project.basedir}</directory> | ||
| 26 | + <outputDirectory>/</outputDirectory> | ||
| 27 | + <includes> | ||
| 28 | + <include>README*</include> | ||
| 29 | + <include>LICENSE*</include> | ||
| 30 | + <include>NOTICE*</include> | ||
| 31 | + </includes> | ||
| 32 | + </fileSet> | ||
| 33 | + | ||
| 34 | + <!-- 把项目的配置文件,打包进zip文件的config目录 --> | ||
| 35 | + <fileSet> | ||
| 36 | + <directory>${project.basedir}\src\main\resources\configs</directory> | ||
| 37 | + <outputDirectory>../configs</outputDirectory> | ||
| 38 | + <includes> | ||
| 39 | + <include>*.properties</include> | ||
| 40 | + </includes> | ||
| 41 | + </fileSet> | ||
| 42 | + | ||
| 43 | + <!-- 把项目的配置文件,提出来 --> | ||
| 44 | + <fileSet> | ||
| 45 | + <directory>${project.basedir}\src\main\resources</directory> | ||
| 46 | + <outputDirectory>/</outputDirectory> | ||
| 47 | + <includes> | ||
| 48 | + <include>*.properties</include> | ||
| 49 | + <include>*.yml</include> | ||
| 50 | + </includes> | ||
| 51 | + </fileSet> | ||
| 52 | + | ||
| 53 | + <!-- 把项目的脚本文件目录( src/main/scripts )中的启动脚本文件,打包进zip文件的跟目录 --> | ||
| 54 | + <fileSet> | ||
| 55 | + <directory>${project.basedir}\bin</directory> | ||
| 56 | + <outputDirectory></outputDirectory> | ||
| 57 | + <includes> | ||
| 58 | + <include>start.*</include> | ||
| 59 | + <include>stop.*</include> | ||
| 60 | + </includes> | ||
| 61 | + </fileSet> | ||
| 62 | + | ||
| 63 | + <!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 --> | ||
| 64 | + <fileSet> | ||
| 65 | + <directory>${project.build.directory}</directory> | ||
| 66 | + <outputDirectory></outputDirectory> | ||
| 67 | + <includes> | ||
| 68 | + <include>*.jar</include> | ||
| 69 | + </includes> | ||
| 70 | + </fileSet> | ||
| 71 | + </fileSets> | ||
| 72 | +</assembly> |
| @@ -174,10 +174,13 @@ | @@ -174,10 +174,13 @@ | ||
| 174 | <dependency> | 174 | <dependency> |
| 175 | <groupId>com.zhonglai.luhui</groupId> | 175 | <groupId>com.zhonglai.luhui</groupId> |
| 176 | <artifactId>lh-jar-device-service</artifactId> | 176 | <artifactId>lh-jar-device-service</artifactId> |
| 177 | - <version>1.0-SNAPSHOT</version> | ||
| 178 | <scope>compile</scope> | 177 | <scope>compile</scope> |
| 179 | </dependency> | 178 | </dependency> |
| 180 | - | 179 | + <dependency> |
| 180 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 181 | + <artifactId>lh-jar-device-analysis</artifactId> | ||
| 182 | + <scope>compile</scope> | ||
| 183 | + </dependency> | ||
| 181 | </dependencies> | 184 | </dependencies> |
| 182 | 185 | ||
| 183 | <build> | 186 | <build> |
| @@ -9,7 +9,7 @@ import org.springframework.context.annotation.ComponentScan; | @@ -9,7 +9,7 @@ import org.springframework.context.annotation.ComponentScan; | ||
| 9 | 9 | ||
| 10 | @ComponentScan(basePackages = { | 10 | @ComponentScan(basePackages = { |
| 11 | "com.zhonglai.luhui.mqtt.comm.config", | 11 | "com.zhonglai.luhui.mqtt.comm.config", |
| 12 | - "com.zhonglai.luhui.mqtt.comm.agreement", | 12 | + "com.zhonglai.luhui.device.analysis", |
| 13 | "com.zhonglai.luhui.mqtt.comm.service", | 13 | "com.zhonglai.luhui.mqtt.comm.service", |
| 14 | "com.zhonglai.luhui.mqtt.comm.rocketMq", | 14 | "com.zhonglai.luhui.mqtt.comm.rocketMq", |
| 15 | "com.zhonglai.luhui.mqtt.config", | 15 | "com.zhonglai.luhui.mqtt.config", |
| @@ -9,18 +9,11 @@ import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator | @@ -9,18 +9,11 @@ import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator | ||
| 9 | import org.springframework.beans.factory.annotation.Value; | 9 | import org.springframework.beans.factory.annotation.Value; |
| 10 | import org.springframework.context.annotation.Bean; | 10 | import org.springframework.context.annotation.Bean; |
| 11 | import org.springframework.context.annotation.Configuration; | 11 | import org.springframework.context.annotation.Configuration; |
| 12 | -import org.springframework.data.redis.connection.RedisConnection; | ||
| 13 | import org.springframework.data.redis.connection.RedisConnectionFactory; | 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| 14 | import org.springframework.data.redis.core.RedisTemplate; | 13 | import org.springframework.data.redis.core.RedisTemplate; |
| 15 | -import org.springframework.data.redis.listener.PatternTopic; | ||
| 16 | -import org.springframework.data.redis.listener.RedisMessageListenerContainer; | ||
| 17 | -import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; | ||
| 18 | -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | ||
| 19 | import org.springframework.data.redis.serializer.StringRedisSerializer; | 14 | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| 20 | -import org.springframework.util.StringUtils; | ||
| 21 | 15 | ||
| 22 | import javax.annotation.PostConstruct; | 16 | import javax.annotation.PostConstruct; |
| 23 | -import java.util.Properties; | ||
| 24 | 17 | ||
| 25 | @Configuration | 18 | @Configuration |
| 26 | public class RedisConfig { | 19 | public class RedisConfig { |
| 1 | package com.zhonglai.luhui.mqtt.comm.config; | 1 | package com.zhonglai.luhui.mqtt.comm.config; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.util.http.HttpUtils; | 4 | +import com.zhonglai.luhui.device.analysis.comm.util.http.HttpUtils; |
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Value; | 7 | import org.springframework.beans.factory.annotation.Value; |
| @@ -2,12 +2,12 @@ package com.zhonglai.luhui.mqtt.comm.dao; | @@ -2,12 +2,12 @@ package com.zhonglai.luhui.mqtt.comm.dao; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | import com.ruoyi.common.annotation.PublicSQLConfig; | 4 | import com.ruoyi.common.annotation.PublicSQLConfig; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 5 | import org.apache.commons.dbutils.*; | 6 | import org.apache.commons.dbutils.*; |
| 6 | import org.apache.commons.dbutils.handlers.BeanHandler; | 7 | import org.apache.commons.dbutils.handlers.BeanHandler; |
| 7 | import org.apache.commons.dbutils.handlers.BeanListHandler; | 8 | import org.apache.commons.dbutils.handlers.BeanListHandler; |
| 8 | import org.apache.commons.dbutils.handlers.MapListHandler; | 9 | import org.apache.commons.dbutils.handlers.MapListHandler; |
| 9 | import org.apache.commons.dbutils.handlers.ScalarHandler; | 10 | import org.apache.commons.dbutils.handlers.ScalarHandler; |
| 10 | -import org.apache.commons.lang3.StringUtils; | ||
| 11 | 11 | ||
| 12 | import java.lang.reflect.Field; | 12 | import java.lang.reflect.Field; |
| 13 | import java.lang.reflect.InvocationTargetException; | 13 | import java.lang.reflect.InvocationTargetException; |
| @@ -56,7 +56,7 @@ public class BaseDao { | @@ -56,7 +56,7 @@ public class BaseDao { | ||
| 56 | } | 56 | } |
| 57 | Method method; | 57 | Method method; |
| 58 | try { | 58 | try { |
| 59 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 59 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 60 | 60 | ||
| 61 | Object value = method.invoke(object); | 61 | Object value = method.invoke(object); |
| 62 | if(null != value) | 62 | if(null != value) |
| @@ -66,7 +66,7 @@ public class BaseDao { | @@ -66,7 +66,7 @@ public class BaseDao { | ||
| 66 | sql += ","; | 66 | sql += ","; |
| 67 | values += ","; | 67 | values += ","; |
| 68 | } | 68 | } |
| 69 | - sql += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"; | 69 | + sql += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"; |
| 70 | values += "?"; | 70 | values += "?"; |
| 71 | valueList.add(value); | 71 | valueList.add(value); |
| 72 | } | 72 | } |
| @@ -126,7 +126,7 @@ public class BaseDao { | @@ -126,7 +126,7 @@ public class BaseDao { | ||
| 126 | String sql = "insert into "; | 126 | String sql = "insert into "; |
| 127 | if(StringUtils.isBlank(tableName)) | 127 | if(StringUtils.isBlank(tableName)) |
| 128 | { | 128 | { |
| 129 | - tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(object.getClass().getSimpleName()); | 129 | + tableName = StringUtils.toUnderScoreCase(object.getClass().getSimpleName()); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | List<Object> valueList = new ArrayList<Object>(); | 132 | List<Object> valueList = new ArrayList<Object>(); |
| @@ -155,7 +155,7 @@ public class BaseDao { | @@ -155,7 +155,7 @@ public class BaseDao { | ||
| 155 | { | 155 | { |
| 156 | attributeStr += ","; | 156 | attributeStr += ","; |
| 157 | } | 157 | } |
| 158 | - attributeStr += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"; | 158 | + attributeStr += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"; |
| 159 | } | 159 | } |
| 160 | attributeStr += ")"; | 160 | attributeStr += ")"; |
| 161 | return attributeStr; | 161 | return attributeStr; |
| @@ -177,7 +177,7 @@ public class BaseDao { | @@ -177,7 +177,7 @@ public class BaseDao { | ||
| 177 | } | 177 | } |
| 178 | Method method; | 178 | Method method; |
| 179 | try { | 179 | try { |
| 180 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 180 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 181 | Object value = method.invoke(object); | 181 | Object value = method.invoke(object); |
| 182 | if(!"(".equals(values) ) | 182 | if(!"(".equals(values) ) |
| 183 | { | 183 | { |
| @@ -253,7 +253,7 @@ public class BaseDao { | @@ -253,7 +253,7 @@ public class BaseDao { | ||
| 253 | } | 253 | } |
| 254 | Method method = null; | 254 | Method method = null; |
| 255 | try { | 255 | try { |
| 256 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 256 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 257 | } catch (NoSuchMethodException e) { | 257 | } catch (NoSuchMethodException e) { |
| 258 | continue; | 258 | continue; |
| 259 | } | 259 | } |
| @@ -264,7 +264,7 @@ public class BaseDao { | @@ -264,7 +264,7 @@ public class BaseDao { | ||
| 264 | { | 264 | { |
| 265 | sql += ","; | 265 | sql += ","; |
| 266 | } | 266 | } |
| 267 | - sql += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+"=?"; | 267 | + sql += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+"=?"; |
| 268 | j++; | 268 | j++; |
| 269 | valueList.add(value); | 269 | valueList.add(value); |
| 270 | } | 270 | } |
| @@ -293,10 +293,10 @@ public class BaseDao { | @@ -293,10 +293,10 @@ public class BaseDao { | ||
| 293 | for(int i =0;i<wheres.length;i++) | 293 | for(int i =0;i<wheres.length;i++) |
| 294 | { | 294 | { |
| 295 | try { | 295 | try { |
| 296 | - Method method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(wheres[i])); | 296 | + Method method = object.getClass().getMethod("get"+ StringUtils.getName(wheres[i])); |
| 297 | Object value = method.invoke(object); | 297 | Object value = method.invoke(object); |
| 298 | sql += " and "; | 298 | sql += " and "; |
| 299 | - sql += com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(wheres[i]) + "=?"; | 299 | + sql += StringUtils.toUnderScoreCase(wheres[i]) + "=?"; |
| 300 | valueList.add(value); | 300 | valueList.add(value); |
| 301 | } catch (IllegalAccessException e) { | 301 | } catch (IllegalAccessException e) { |
| 302 | // TODO Auto-generated catch block | 302 | // TODO Auto-generated catch block |
| @@ -334,7 +334,7 @@ public class BaseDao { | @@ -334,7 +334,7 @@ public class BaseDao { | ||
| 334 | idName = field.getName(); | 334 | idName = field.getName(); |
| 335 | } | 335 | } |
| 336 | } | 336 | } |
| 337 | - method = object.getClass().getMethod("get"+ com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(idName)); | 337 | + method = object.getClass().getMethod("get"+ StringUtils.getName(idName)); |
| 338 | Object value = method.invoke(object); | 338 | Object value = method.invoke(object); |
| 339 | sql += " and "; | 339 | sql += " and "; |
| 340 | 340 | ||
| @@ -369,7 +369,7 @@ public class BaseDao { | @@ -369,7 +369,7 @@ public class BaseDao { | ||
| 369 | { | 369 | { |
| 370 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); | 370 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); |
| 371 | 371 | ||
| 372 | - String tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 372 | + String tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 373 | 373 | ||
| 374 | String sql = "select * from "+tableName+" where 1=1 "; | 374 | String sql = "select * from "+tableName+" where 1=1 "; |
| 375 | try { | 375 | try { |
| @@ -415,7 +415,7 @@ public class BaseDao { | @@ -415,7 +415,7 @@ public class BaseDao { | ||
| 415 | { | 415 | { |
| 416 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); | 416 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); |
| 417 | 417 | ||
| 418 | - String tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 418 | + String tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 419 | 419 | ||
| 420 | String sql = "select * from "+tableName+" where 1=1 "; | 420 | String sql = "select * from "+tableName+" where 1=1 "; |
| 421 | String idName = "id"; | 421 | String idName = "id"; |
| @@ -454,7 +454,7 @@ public class BaseDao { | @@ -454,7 +454,7 @@ public class BaseDao { | ||
| 454 | { | 454 | { |
| 455 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); | 455 | QueryRunner runner = new QueryRunner(dBFactory.getDataSource()); |
| 456 | 456 | ||
| 457 | - String tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 457 | + String tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 458 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; | 458 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; |
| 459 | try { | 459 | try { |
| 460 | List<Object> valueList = new ArrayList<Object>(); | 460 | List<Object> valueList = new ArrayList<Object>(); |
| @@ -487,7 +487,7 @@ public class BaseDao { | @@ -487,7 +487,7 @@ public class BaseDao { | ||
| 487 | 487 | ||
| 488 | if(StringUtils.isBlank(tableName)) | 488 | if(StringUtils.isBlank(tableName)) |
| 489 | { | 489 | { |
| 490 | - tableName = com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(clas.getSimpleName()); | 490 | + tableName = StringUtils.toUnderScoreCase(clas.getSimpleName()); |
| 491 | } | 491 | } |
| 492 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; | 492 | String sql = "DELETE FROM "+tableName+" WHERE 1=1 "; |
| 493 | try { | 493 | try { |
| @@ -745,7 +745,7 @@ public class BaseDao { | @@ -745,7 +745,7 @@ public class BaseDao { | ||
| 745 | } | 745 | } |
| 746 | try { | 746 | try { |
| 747 | Method method; | 747 | Method method; |
| 748 | - method = object.getClass().getMethod("get"+ com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 748 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 749 | Object value = method.invoke(object); | 749 | Object value = method.invoke(object); |
| 750 | if(!(null == value)) | 750 | if(!(null == value)) |
| 751 | { | 751 | { |
| @@ -757,17 +757,17 @@ public class BaseDao { | @@ -757,17 +757,17 @@ public class BaseDao { | ||
| 757 | if("like".equals(s)) | 757 | if("like".equals(s)) |
| 758 | { | 758 | { |
| 759 | value = "%"+value+"%"; | 759 | value = "%"+value+"%"; |
| 760 | - like += " or " + "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther ; | 760 | + like += " or " + "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther ; |
| 761 | valueList.add(value); | 761 | valueList.add(value); |
| 762 | continue; | 762 | continue; |
| 763 | } | 763 | } |
| 764 | if("time".equals(s)) | 764 | if("time".equals(s)) |
| 765 | { | 765 | { |
| 766 | s = ">"; | 766 | s = ">"; |
| 767 | - orther = " and `"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`< '"+whereMap.get("end_"+field.getName())+"'"; | 767 | + orther = " and `"+ StringUtils.toUnderScoreCase(field.getName())+"`< '"+whereMap.get("end_"+field.getName())+"'"; |
| 768 | } | 768 | } |
| 769 | } | 769 | } |
| 770 | - where += " and `"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther; | 770 | + where += " and `"+ StringUtils.toUnderScoreCase(field.getName())+"`"+s+" ?"+orther; |
| 771 | valueList.add(value); | 771 | valueList.add(value); |
| 772 | } | 772 | } |
| 773 | } catch (NoSuchMethodException e) { | 773 | } catch (NoSuchMethodException e) { |
| @@ -819,7 +819,7 @@ public class BaseDao { | @@ -819,7 +819,7 @@ public class BaseDao { | ||
| 819 | { | 819 | { |
| 820 | continue; | 820 | continue; |
| 821 | } | 821 | } |
| 822 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 822 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 823 | Object value = method.invoke(object); | 823 | Object value = method.invoke(object); |
| 824 | if(null != value) | 824 | if(null != value) |
| 825 | { | 825 | { |
| @@ -829,9 +829,9 @@ public class BaseDao { | @@ -829,9 +829,9 @@ public class BaseDao { | ||
| 829 | values += ","; | 829 | values += ","; |
| 830 | update += ","; | 830 | update += ","; |
| 831 | } | 831 | } |
| 832 | - sql += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"; | 832 | + sql += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"; |
| 833 | values += "'"+ value+"'"; | 833 | values += "'"+ value+"'"; |
| 834 | - update += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`)"; | 834 | + update += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+ StringUtils.toUnderScoreCase(field.getName())+"`)"; |
| 835 | } | 835 | } |
| 836 | } catch (NoSuchMethodException e) { | 836 | } catch (NoSuchMethodException e) { |
| 837 | } catch (SecurityException e) { | 837 | } catch (SecurityException e) { |
| @@ -891,8 +891,8 @@ public class BaseDao { | @@ -891,8 +891,8 @@ public class BaseDao { | ||
| 891 | sb.append(","); | 891 | sb.append(","); |
| 892 | update += ","; | 892 | update += ","; |
| 893 | } | 893 | } |
| 894 | - sb.append("`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"); | ||
| 895 | - update += "`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(field.getName())+"`)"; | 894 | + sb.append("`"+ StringUtils.toUnderScoreCase(field.getName())+"`"); |
| 895 | + update += "`"+ StringUtils.toUnderScoreCase(field.getName())+"`"+"=VALUES("+"`"+ StringUtils.toUnderScoreCase(field.getName())+"`)"; | ||
| 896 | } | 896 | } |
| 897 | sb.append(")"); | 897 | sb.append(")"); |
| 898 | sb.append("VALUES "); | 898 | sb.append("VALUES "); |
| @@ -904,7 +904,7 @@ public class BaseDao { | @@ -904,7 +904,7 @@ public class BaseDao { | ||
| 904 | Field field = fields[j]; | 904 | Field field = fields[j]; |
| 905 | Method method; | 905 | Method method; |
| 906 | try { | 906 | try { |
| 907 | - method = object.getClass().getMethod("get"+com.zhonglai.luhui.mqtt.comm.util.StringUtils.getName(field.getName())); | 907 | + method = object.getClass().getMethod("get"+ StringUtils.getName(field.getName())); |
| 908 | Object value = method.invoke(object); | 908 | Object value = method.invoke(object); |
| 909 | if(null == value) | 909 | if(null == value) |
| 910 | { | 910 | { |
| @@ -963,7 +963,7 @@ public class BaseDao { | @@ -963,7 +963,7 @@ public class BaseDao { | ||
| 963 | { | 963 | { |
| 964 | Object value = mapwhere.get(key); | 964 | Object value = mapwhere.get(key); |
| 965 | where += " and "; | 965 | where += " and "; |
| 966 | - where += com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(key) + "=?"; | 966 | + where += StringUtils.toUnderScoreCase(key) + "=?"; |
| 967 | valueList.add(value); | 967 | valueList.add(value); |
| 968 | } | 968 | } |
| 969 | return where; | 969 | return where; |
| @@ -1007,6 +1007,6 @@ public class BaseDao { | @@ -1007,6 +1007,6 @@ public class BaseDao { | ||
| 1007 | e.printStackTrace(); | 1007 | e.printStackTrace(); |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | - return com.zhonglai.luhui.mqtt.comm.util.StringUtils.toUnderScoreCase(tableNmae); | 1010 | + return StringUtils.toUnderScoreCase(tableNmae); |
| 1011 | } | 1011 | } |
| 1012 | } | 1012 | } |
| 1 | -package com.zhonglai.luhui.mqtt.dto; | 1 | +package com.zhonglai.luhui.mqtt.comm.dto; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.zhonglai.luhui.device.analysis.dto.ApiName; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.dto.DeviceCommandApiParameter; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 8 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 9 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 10 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 1 | package com.zhonglai.luhui.mqtt.comm.rocketMq; | 1 | package com.zhonglai.luhui.mqtt.comm.rocketMq; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.service.MqttCallback; | ||
| 5 | -import com.zhonglai.luhui.mqtt.dto.DeviceCommandApi; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | 4 | +import com.zhonglai.luhui.mqtt.comm.dto.DeviceCommandApi; |
| 5 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 7 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 9 | import org.apache.rocketmq.common.message.MessageExt; | 8 | import org.apache.rocketmq.common.message.MessageExt; |
| 10 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; | 9 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.dto.SaveDataDto; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.topic.AddPostDto; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.topic.AllPostDto; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 9 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 10 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 11 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 6 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | 12 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; |
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 10 | -import com.zhonglai.luhui.mqtt.dto.SaveDataDto; | ||
| 11 | -import com.zhonglai.luhui.mqtt.dto.topic.AddPostDto; | ||
| 12 | -import com.zhonglai.luhui.mqtt.dto.topic.AllPostDto; | ||
| 13 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; | 13 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; |
| 14 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 14 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 15 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
| @@ -55,7 +55,7 @@ public class BusinessDataUpdateService { | @@ -55,7 +55,7 @@ public class BusinessDataUpdateService { | ||
| 55 | * @param type | 55 | * @param type |
| 56 | * @param topic | 56 | * @param topic |
| 57 | */ | 57 | */ |
| 58 | - public void updataDta(Type type, Topic topic, ServerDto serverDto,String operationType,boolean isLog) | 58 | + public void updataDta(Type type, Topic topic, ServerDto serverDto, String operationType, boolean isLog) |
| 59 | { | 59 | { |
| 60 | IotDevice olddevice = cacheService.getIotDevice(topic.getClientid()); | 60 | IotDevice olddevice = cacheService.getIotDevice(topic.getClientid()); |
| 61 | 61 |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 5 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 6 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 7 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 缓存业务 | 10 | * 缓存业务 |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.clien.ClienConnection; | ||
| 4 | -import com.zhonglai.luhui.mqtt.comm.clien.impl.ClienConnectionImpl; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.ApiClientRePlyDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.TerminalClientRePlyDto; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.util.ByteUtil; | ||
| 9 | -import com.zhonglai.luhui.mqtt.dto.Message; | 3 | +import com.zhonglai.luhui.device.analysis.comm.clien.ClienConnection; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.clien.impl.ClienConnectionImpl; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.ApiClientRePlyDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.TerminalClientRePlyDto; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.util.ByteUtil; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 10 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; | ||
| 10 | import net.jodah.expiringmap.ExpirationListener; | 11 | import net.jodah.expiringmap.ExpirationListener; |
| 11 | import net.jodah.expiringmap.ExpirationPolicy; | 12 | import net.jodah.expiringmap.ExpirationPolicy; |
| 12 | import net.jodah.expiringmap.ExpiringMap; | 13 | import net.jodah.expiringmap.ExpiringMap; |
| @@ -56,10 +57,10 @@ public class ClienNoticeService { | @@ -56,10 +57,10 @@ public class ClienNoticeService { | ||
| 56 | public Message sendMessage(Topic topic, MqttMessage mqttMessage) throws MqttException, InterruptedException { | 57 | public Message sendMessage(Topic topic, MqttMessage mqttMessage) throws MqttException, InterruptedException { |
| 57 | //设置通知渠道 | 58 | //设置通知渠道 |
| 58 | ClienConnection clienConnection = new ClienConnectionImpl(); | 59 | ClienConnection clienConnection = new ClienConnectionImpl(); |
| 59 | - String key = topic.generateClienKey().replace(topic.getTopicType(),top_return_map.get(topic.getTopicType())); | 60 | + String key = TopicUtil.generateClienKey(topic).replace(topic.getTopicType(),top_return_map.get(topic.getTopicType())); |
| 60 | log.info("设置通知渠道 {} {}",key,clienConnection); | 61 | log.info("设置通知渠道 {} {}",key,clienConnection); |
| 61 | clienConnectionMap.put(key,clienConnection); | 62 | clienConnectionMap.put(key,clienConnection); |
| 62 | - sendMessage(topic.generateSendMessageTopic(),mqttMessage); | 63 | + sendMessage(TopicUtil.generateSendMessageTopic(topic),mqttMessage); |
| 63 | synchronized(clienConnection) | 64 | synchronized(clienConnection) |
| 64 | { | 65 | { |
| 65 | log.info("{}等待通知",topic.getClientid()); | 66 | log.info("{}等待通知",topic.getClientid()); |
| @@ -88,7 +89,7 @@ public class ClienNoticeService { | @@ -88,7 +89,7 @@ public class ClienNoticeService { | ||
| 88 | 89 | ||
| 89 | public ClienConnection getClienConnection(Topic topic) | 90 | public ClienConnection getClienConnection(Topic topic) |
| 90 | { | 91 | { |
| 91 | - return clienConnectionMap.get(topic.generateClienKey()); | 92 | + return clienConnectionMap.get(TopicUtil.generateClienKey(topic)); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | /** | 95 | /** |
| @@ -2,16 +2,16 @@ package com.zhonglai.luhui.mqtt.comm.service; | @@ -2,16 +2,16 @@ package com.zhonglai.luhui.mqtt.comm.service; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceSensorData; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelBase; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 9 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 10 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 11 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 12 | +import com.zhonglai.luhui.device.analysis.dto.SaveDataDto; | ||
| 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; | 13 | import com.zhonglai.luhui.device.domain.IotThingsModel; |
| 6 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 14 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.DeviceSensorData; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelBase; | ||
| 10 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 11 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 12 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 13 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 14 | -import com.zhonglai.luhui.mqtt.dto.SaveDataDto; | ||
| 15 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 15 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 16 | import org.apache.commons.lang3.EnumUtils; | 16 | import org.apache.commons.lang3.EnumUtils; |
| 17 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
| @@ -59,7 +59,7 @@ public class DataModeAnalysisService { | @@ -59,7 +59,7 @@ public class DataModeAnalysisService { | ||
| 59 | /** | 59 | /** |
| 60 | * 解析物模型数据 | 60 | * 解析物模型数据 |
| 61 | */ | 61 | */ |
| 62 | - public SaveDataDto analysisThingsModelValue(String id,String userName ,JSONObject jsData, ServerDto serverDto) | 62 | + public SaveDataDto analysisThingsModelValue(String id, String userName , JSONObject jsData, ServerDto serverDto) |
| 63 | { | 63 | { |
| 64 | if(null != jsData && jsData.size() != 0 ) | 64 | if(null != jsData && jsData.size() != 0 ) |
| 65 | { | 65 | { |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceAlarmInfo; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.util.TableUtil; | ||
| 3 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 4 | import com.zhonglai.luhui.mqtt.comm.dto.*; | 8 | import com.zhonglai.luhui.mqtt.comm.dto.*; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.util.TableUtil; | ||
| 8 | -import org.apache.commons.lang3.StringUtils; | 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; |
| 9 | 10 | ||
| 10 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
| 11 | import java.util.List; | 12 | import java.util.List; |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceSensorData; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.LogDeviceOperation; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.TableGenerateSqlEnum; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; | ||
| 3 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.DeviceSensorData; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.LogDeviceOperation; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.TableGenerateSqlEnum; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 8 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
| 9 | 9 | ||
| 10 | import java.util.List; | 10 | import java.util.List; |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDtoClassNew; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.util.ByteUtil; | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 7 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDtoClassNew; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreementFactory; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 10 | -import com.zhonglai.luhui.mqtt.comm.util.ByteUtil; | 8 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; |
| 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreementFactory; | ||
| 10 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 11 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; | ||
| 11 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 12 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 12 | import lombok.SneakyThrows; | 13 | import lombok.SneakyThrows; |
| 13 | import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; | 14 | import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; |
| @@ -53,7 +54,7 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -53,7 +54,7 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 53 | 54 | ||
| 54 | @Override | 55 | @Override |
| 55 | public void messageArrived(String s, MqttMessage mqttMessage) { | 56 | public void messageArrived(String s, MqttMessage mqttMessage) { |
| 56 | - Topic desttopic = new Topic(s); | 57 | + Topic desttopic = TopicUtil.initTopic(s); |
| 57 | desttopic.setPayloadtype("POST_REQ"); | 58 | desttopic.setPayloadtype("POST_REQ"); |
| 58 | 59 | ||
| 59 | //接收到消息 | 60 | //接收到消息 |
| @@ -70,12 +71,12 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -70,12 +71,12 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 70 | buffer.append("\r\n"); | 71 | buffer.append("\r\n"); |
| 71 | 72 | ||
| 72 | try { | 73 | try { |
| 73 | - Topic topic = new Topic(s); | 74 | + Topic topic = TopicUtil.initTopic(s); |
| 74 | if(null == topic) | 75 | if(null == topic) |
| 75 | { | 76 | { |
| 76 | log.error("消息{},topic为空,不做解析"); | 77 | log.error("消息{},topic为空,不做解析"); |
| 77 | log.error("消息《"+s+"》解析为空 》》》内容:\r\n"+buffer.toString()); | 78 | log.error("消息《"+s+"》解析为空 》》》内容:\r\n"+buffer.toString()); |
| 78 | - terminalService.publish(desttopic.generateSendMessageTopic(),"0"); | 79 | + terminalService.publish(TopicUtil.generateSendMessageTopic(topic),"0"); |
| 79 | return; | 80 | return; |
| 80 | } | 81 | } |
| 81 | 82 | ||
| @@ -88,7 +89,7 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -88,7 +89,7 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 88 | if(null == iotDevice) | 89 | if(null == iotDevice) |
| 89 | { | 90 | { |
| 90 | log.info("设备{}不存在",topic.getClientid()); | 91 | log.info("设备{}不存在",topic.getClientid()); |
| 91 | - terminalService.publish(desttopic.generateSendMessageTopic(),"1"); | 92 | + terminalService.publish(TopicUtil.generateSendMessageTopic(topic),"1"); |
| 92 | return; | 93 | return; |
| 93 | } | 94 | } |
| 94 | if("ONLINE".equals(topic.getTopicType().toUpperCase())) | 95 | if("ONLINE".equals(topic.getTopicType().toUpperCase())) |
| @@ -113,12 +114,12 @@ public class MqttCallback implements MqttCallbackExtended { | @@ -113,12 +114,12 @@ public class MqttCallback implements MqttCallbackExtended { | ||
| 113 | //数据持久化 | 114 | //数据持久化 |
| 114 | dataPersistenceService.persistence(topic,dto); | 115 | dataPersistenceService.persistence(topic,dto); |
| 115 | 116 | ||
| 116 | - terminalService.publish(desttopic.generateSendMessageTopic(),"2"); | 117 | + terminalService.publish(TopicUtil.generateSendMessageTopic(desttopic),"2"); |
| 117 | log.info("{}payload解析完成",s); | 118 | log.info("{}payload解析完成",s); |
| 118 | } catch (Exception e) { | 119 | } catch (Exception e) { |
| 119 | log.error(s+"消息解析异常",e); | 120 | log.error(s+"消息解析异常",e); |
| 120 | try { | 121 | try { |
| 121 | - terminalService.publish(desttopic.generateSendMessageTopic(),"3"); | 122 | + terminalService.publish(TopicUtil.generateSendMessageTopic(desttopic),"3"); |
| 122 | } catch (MqttException ex) { | 123 | } catch (MqttException ex) { |
| 123 | log.error(s+"消息解析异常时返回的执行结果消息异常",ex); | 124 | log.error(s+"消息解析异常时返回的执行结果消息异常",ex); |
| 124 | } | 125 | } |
| 1 | package com.zhonglai.luhui.mqtt.comm.service; | 1 | package com.zhonglai.luhui.mqtt.comm.service; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 3 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | 4 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 5 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; |
| 5 | import org.apache.commons.lang3.StringUtils; | 6 | import org.apache.commons.lang3.StringUtils; |
| 6 | import org.eclipse.paho.client.mqttv3.MqttClient; | 7 | import org.eclipse.paho.client.mqttv3.MqttClient; |
| 7 | import org.eclipse.paho.client.mqttv3.MqttConnectOptions; | 8 | import org.eclipse.paho.client.mqttv3.MqttConnectOptions; |
| @@ -139,7 +140,7 @@ public class TerminalService { | @@ -139,7 +140,7 @@ public class TerminalService { | ||
| 139 | List<String> ts = getCompletionTopics(); | 140 | List<String> ts = getCompletionTopics(); |
| 140 | for(String topicstr:ts) | 141 | for(String topicstr:ts) |
| 141 | { | 142 | { |
| 142 | - Topic topic = new Topic(topicstr); | 143 | + Topic topic = TopicUtil.initTopic(topicstr); |
| 143 | if(null != topic) | 144 | if(null != topic) |
| 144 | { | 145 | { |
| 145 | String rild = topic.getRoleid(); | 146 | String rild = topic.getRoleid(); |
| @@ -3,7 +3,6 @@ package com.zhonglai.luhui.mqtt.comm.service.redis; | @@ -3,7 +3,6 @@ package com.zhonglai.luhui.mqtt.comm.service.redis; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 6 | -import org.springframework.beans.factory.annotation.Value; | ||
| 7 | import org.springframework.data.redis.core.RedisTemplate; | 6 | import org.springframework.data.redis.core.RedisTemplate; |
| 8 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 9 | import org.springframework.util.CollectionUtils; | 8 | import org.springframework.util.CollectionUtils; |
| 1 | -package com.zhonglai.luhui.mqtt.comm.factory; | 1 | +package com.zhonglai.luhui.mqtt.comm.util; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.config.RedisConfig; | 3 | +import com.zhonglai.luhui.device.analysis.comm.dto.MyException; |
| 4 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; | ||
| 4 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; | 6 | import com.zhonglai.luhui.mqtt.comm.config.SysParameter; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.MyException; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.service.MqttCallback; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 8 | -import lombok.Data; | ||
| 9 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 11 | 9 | ||
| 12 | import java.lang.reflect.Field; | 10 | import java.lang.reflect.Field; |
| 13 | import java.util.Optional; | 11 | import java.util.Optional; |
| 14 | 12 | ||
| 15 | -@Data | ||
| 16 | -public class Topic { | ||
| 17 | - private static final Logger log = LoggerFactory.getLogger(Topic.class); | 13 | +public class TopicUtil { |
| 14 | + private static final Logger log = LoggerFactory.getLogger(TopicUtil.class); | ||
| 18 | 15 | ||
| 19 | - private String roleid; | ||
| 20 | - private String username; | ||
| 21 | - private String clientid; | ||
| 22 | - private String topicType; | ||
| 23 | - private String messageid; | ||
| 24 | - private String payloadtype; | ||
| 25 | - | ||
| 26 | - public Topic() { | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - public Topic(String roleid, String username, String clientid, String topicType, String payloadtype) { | ||
| 30 | - this.roleid = roleid; | ||
| 31 | - this.username = username; | ||
| 32 | - this.clientid = clientid; | ||
| 33 | - this.topicType = topicType; | ||
| 34 | - this.payloadtype = payloadtype; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - public Topic(String roleid, String username, String clientid, String topicType, String messageid, String payloadtype) { | ||
| 38 | - this.roleid = roleid; | ||
| 39 | - this.username = username; | ||
| 40 | - this.clientid = clientid; | ||
| 41 | - this.topicType = topicType; | ||
| 42 | - this.messageid = messageid; | ||
| 43 | - this.payloadtype = payloadtype; | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - public Topic(String topic) | 16 | + public static Topic initTopic(String topic) |
| 47 | { | 17 | { |
| 48 | topic = Optional.ofNullable(topic).orElseThrow(()->new MyException("topic为空")); | 18 | topic = Optional.ofNullable(topic).orElseThrow(()->new MyException("topic为空")); |
| 49 | String[] sts = topic.split("/"); | 19 | String[] sts = topic.split("/"); |
| @@ -53,83 +23,85 @@ public class Topic { | @@ -53,83 +23,85 @@ public class Topic { | ||
| 53 | { | 23 | { |
| 54 | number = config.length; | 24 | number = config.length; |
| 55 | } | 25 | } |
| 26 | + Topic topicObject = new Topic(); | ||
| 56 | for(int i=1;i<number;i++) | 27 | for(int i=1;i<number;i++) |
| 57 | { | 28 | { |
| 58 | String cf = config[i].replace("{{","").replace("}}",""); | 29 | String cf = config[i].replace("{{","").replace("}}",""); |
| 59 | try { | 30 | try { |
| 60 | - Field field = this.getClass().getDeclaredField(cf); | ||
| 61 | - field.set(this,sts[i]); | 31 | + Field field = topicObject.getClass().getDeclaredField(cf); |
| 32 | + field.set(topicObject,sts[i]); | ||
| 62 | } catch (NoSuchFieldException e) { | 33 | } catch (NoSuchFieldException e) { |
| 63 | log.info("{}生成topic时没有属性{}",topic,cf); | 34 | log.info("{}生成topic时没有属性{}",topic,cf); |
| 64 | } catch (IllegalAccessException e) { | 35 | } catch (IllegalAccessException e) { |
| 65 | log.info("{}生成topic时无法给{}赋值{}",topic,cf,sts[i]); | 36 | log.info("{}生成topic时无法给{}赋值{}",topic,cf,sts[i]); |
| 66 | } | 37 | } |
| 67 | } | 38 | } |
| 39 | + return topicObject; | ||
| 68 | } | 40 | } |
| 69 | 41 | ||
| 70 | /** | 42 | /** |
| 71 | * 生成缓存关键字 | 43 | * 生成缓存关键字 |
| 72 | * @return | 44 | * @return |
| 73 | */ | 45 | */ |
| 74 | - public String generateRedicKey() | 46 | + public static String generateRedicKey(Topic topic) |
| 75 | { | 47 | { |
| 76 | - return generate(":"); | 48 | + return generate(topic,":"); |
| 77 | } | 49 | } |
| 78 | 50 | ||
| 79 | /** | 51 | /** |
| 80 | * 生成发送消息的topic | 52 | * 生成发送消息的topic |
| 81 | * @return | 53 | * @return |
| 82 | */ | 54 | */ |
| 83 | - public String generateSendMessageTopic() | 55 | + public static String generateSendMessageTopic(Topic topic) |
| 84 | { | 56 | { |
| 85 | - return "/"+generate("/"); | 57 | + return "/"+generate(topic,"/"); |
| 86 | } | 58 | } |
| 87 | 59 | ||
| 88 | /** | 60 | /** |
| 89 | * 生成客户端关键字 | 61 | * 生成客户端关键字 |
| 90 | * @return | 62 | * @return |
| 91 | */ | 63 | */ |
| 92 | - public String generateClienKey() | 64 | + public static String generateClienKey(Topic topic) |
| 93 | { | 65 | { |
| 94 | - return "/"+generate("/"); | 66 | + return "/"+generate(topic,"/"); |
| 95 | } | 67 | } |
| 96 | 68 | ||
| 97 | - private String generate(String division) | 69 | + private static String generate(Topic topic,String division) |
| 98 | { | 70 | { |
| 99 | String str = SysParameter.topicconfig; | 71 | String str = SysParameter.topicconfig; |
| 100 | - if(StringUtils.isEmpty(roleid)) | 72 | + if(StringUtils.isEmpty(topic.getRoleid())) |
| 101 | { | 73 | { |
| 102 | - roleid = "2"; | 74 | + topic.setRoleid("2"); |
| 103 | } | 75 | } |
| 104 | - str = str.replace("/{{roleid}}",roleid+division); | 76 | + str = str.replace("/{{roleid}}",topic.getRoleid()+division); |
| 105 | 77 | ||
| 106 | - if(StringUtils.isEmpty(username)) | 78 | + if(StringUtils.isEmpty(topic.getUsername())) |
| 107 | { | 79 | { |
| 108 | - username = "+"; | 80 | + topic.setUsername("+"); |
| 109 | } | 81 | } |
| 110 | - str = str.replace("/{{username}}",username+division); | 82 | + str = str.replace("/{{username}}",topic.getUsername()+division); |
| 111 | 83 | ||
| 112 | - if(StringUtils.isEmpty(clientid)) | 84 | + if(StringUtils.isEmpty(topic.getClientid())) |
| 113 | { | 85 | { |
| 114 | - clientid = "+"; | 86 | + topic.setClientid( "+"); |
| 115 | } | 87 | } |
| 116 | - str = str.replace("/{{clientid}}",clientid+division); | 88 | + str = str.replace("/{{clientid}}",topic.getClientid()+division); |
| 117 | 89 | ||
| 118 | - if(StringUtils.isEmpty(payloadtype)) | 90 | + if(StringUtils.isEmpty(topic.getPayloadtype())) |
| 119 | { | 91 | { |
| 120 | - payloadtype = "String"; | 92 | + topic.setPayloadtype( "String"); |
| 121 | } | 93 | } |
| 122 | - str = str.replace("/{{payloadtype}}",payloadtype+division); | 94 | + str = str.replace("/{{payloadtype}}",topic.getPayloadtype()+division); |
| 123 | 95 | ||
| 124 | - if(StringUtils.isEmpty(topicType)) | 96 | + if(StringUtils.isEmpty(topic.getTopicType())) |
| 125 | { | 97 | { |
| 126 | - topicType = "PUT"; | 98 | + topic.setTopicType("PUT"); |
| 127 | } | 99 | } |
| 128 | - str = str.replace("/{{topicType}}",topicType+division); | 100 | + str = str.replace("/{{topicType}}",topic.getTopicType()+division); |
| 129 | 101 | ||
| 130 | - if(StringUtils.isNotEmpty(messageid)) | 102 | + if(StringUtils.isNotEmpty(topic.getMessageid())) |
| 131 | { | 103 | { |
| 132 | - str = str.replace("/{{messageid}}",messageid); | 104 | + str = str.replace("/{{messageid}}",topic.getMessageid()); |
| 133 | } | 105 | } |
| 134 | 106 | ||
| 135 | return str; | 107 | return str; |
| @@ -3,8 +3,8 @@ package com.zhonglai.luhui.mqtt.controller; | @@ -3,8 +3,8 @@ package com.zhonglai.luhui.mqtt.controller; | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 3 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | import com.zhonglai.luhui.device.domain.IotTerminal; | 4 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; | 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; |
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; |
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 8 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 9 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 9 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 10 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
| @@ -2,20 +2,18 @@ package com.zhonglai.luhui.mqtt.controller; | @@ -2,20 +2,18 @@ package com.zhonglai.luhui.mqtt.controller; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.util.IOUtils; | 4 | import com.alibaba.fastjson.util.IOUtils; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 6 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 7 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | 5 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 6 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 8 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 9 | import io.swagger.annotations.ApiImplicitParam; | 9 | import io.swagger.annotations.ApiImplicitParam; |
| 10 | import io.swagger.annotations.ApiImplicitParams; | 10 | import io.swagger.annotations.ApiImplicitParams; |
| 11 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
| 12 | -import org.springframework.http.MediaType; | ||
| 13 | import org.springframework.stereotype.Controller; | 12 | import org.springframework.stereotype.Controller; |
| 14 | import org.springframework.web.bind.annotation.PathVariable; | 13 | import org.springframework.web.bind.annotation.PathVariable; |
| 15 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 16 | import org.springframework.web.bind.annotation.RequestMethod; | 15 | import org.springframework.web.bind.annotation.RequestMethod; |
| 17 | 16 | ||
| 18 | -import javax.servlet.ServletOutputStream; | ||
| 19 | import javax.servlet.http.HttpServletResponse; | 17 | import javax.servlet.http.HttpServletResponse; |
| 20 | import java.io.*; | 18 | import java.io.*; |
| 21 | import java.util.Date; | 19 | import java.util.Date; |
| @@ -5,11 +5,11 @@ import com.zhonglai.luhui.device.domain.IotDevice; | @@ -5,11 +5,11 @@ import com.zhonglai.luhui.device.domain.IotDevice; | ||
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 5 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | import com.zhonglai.luhui.mqtt.comm.config.RedisConfig; | 6 | import com.zhonglai.luhui.mqtt.comm.config.RedisConfig; |
| 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 7 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 8 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 9 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 10 | import com.zhonglai.luhui.mqtt.comm.service.CacheService; | 10 | import com.zhonglai.luhui.mqtt.comm.service.CacheService; |
| 11 | import com.zhonglai.luhui.mqtt.comm.service.redis.RedisService; | 11 | import com.zhonglai.luhui.mqtt.comm.service.redis.RedisService; |
| 12 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | 12 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 13 | import com.zhonglai.luhui.mqtt.service.redis.RedisDeleteListener; | 13 | import com.zhonglai.luhui.mqtt.service.redis.RedisDeleteListener; |
| 14 | import com.zhonglai.luhui.mqtt.service.redis.RedisExpiredListener; | 14 | import com.zhonglai.luhui.mqtt.service.redis.RedisExpiredListener; |
| 15 | import org.slf4j.Logger; | 15 | import org.slf4j.Logger; |
| @@ -2,10 +2,10 @@ package com.zhonglai.luhui.mqtt.service; | @@ -2,10 +2,10 @@ package com.zhonglai.luhui.mqtt.service; | ||
| 2 | 2 | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 3 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | import com.zhonglai.luhui.device.domain.IotTerminal; | 4 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.DeviceSensorData; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.LogDeviceOperation; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.DeviceSensorData; |
| 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.LogDeviceOperation; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 9 | import com.zhonglai.luhui.mqtt.comm.service.DataPersistenceService; | 9 | import com.zhonglai.luhui.mqtt.comm.service.DataPersistenceService; |
| 10 | import com.zhonglai.luhui.mqtt.comm.service.DeviceLogService; | 10 | import com.zhonglai.luhui.mqtt.comm.service.DeviceLogService; |
| 11 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 1 | package com.zhonglai.luhui.mqtt.service; | 1 | package com.zhonglai.luhui.mqtt.service; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | 3 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 4 | import org.springframework.context.annotation.Configuration; | 4 | import org.springframework.context.annotation.Configuration; |
| 5 | import org.springframework.scheduling.annotation.EnableScheduling; | 5 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 6 | import org.springframework.scheduling.annotation.Scheduled; | 6 | import org.springframework.scheduling.annotation.Scheduled; |
| @@ -7,19 +7,19 @@ import com.zhonglai.luhui.device.domain.IotDevice; | @@ -7,19 +7,19 @@ import com.zhonglai.luhui.device.domain.IotDevice; | ||
| 7 | import com.zhonglai.luhui.device.domain.IotTerminal; | 7 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 8 | import com.zhonglai.luhui.device.domain.IotThingsModel; | 8 | import com.zhonglai.luhui.device.domain.IotThingsModel; |
| 9 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 9 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 10 | -import com.zhonglai.luhui.mqtt.comm.dto.LogDeviceOperation; | ||
| 11 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelBase; | ||
| 12 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 13 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 14 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 10 | +import com.zhonglai.luhui.device.analysis.comm.dto.LogDeviceOperation; |
| 11 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelBase; | ||
| 12 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 13 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelItemBase; | ||
| 14 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 15 | import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; | 15 | import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; |
| 16 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; | 16 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; |
| 17 | import com.zhonglai.luhui.mqtt.comm.service.DeviceLogService; | 17 | import com.zhonglai.luhui.mqtt.comm.service.DeviceLogService; |
| 18 | import com.zhonglai.luhui.mqtt.comm.service.redis.RedisService; | 18 | import com.zhonglai.luhui.mqtt.comm.service.redis.RedisService; |
| 19 | -import com.zhonglai.luhui.mqtt.comm.util.DateUtils; | ||
| 20 | -import com.zhonglai.luhui.mqtt.dto.Message; | ||
| 21 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 22 | -import com.zhonglai.luhui.mqtt.dto.topic.AddPostDto; | 19 | +import com.zhonglai.luhui.device.analysis.comm.util.DateUtils; |
| 20 | +import com.zhonglai.luhui.device.analysis.dto.Message; | ||
| 21 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 22 | +import com.zhonglai.luhui.device.analysis.dto.topic.AddPostDto; | ||
| 23 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; | 23 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; |
| 24 | import com.zhonglai.luhui.mqtt.service.DataPersistenceServiceImpl; | 24 | import com.zhonglai.luhui.mqtt.service.DataPersistenceServiceImpl; |
| 25 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 25 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 1 | package com.zhonglai.luhui.mqtt.service.redis; | 1 | package com.zhonglai.luhui.mqtt.service.redis; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; | ||
| 4 | import org.slf4j.Logger; | 3 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 4 | import org.slf4j.LoggerFactory; |
| 6 | import org.springframework.data.redis.connection.Message; | 5 | import org.springframework.data.redis.connection.Message; |
| 1 | package com.zhonglai.luhui.mqtt.service.topic; | 1 | package com.zhonglai.luhui.mqtt.service.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 8 | import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; | 8 | import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; |
| 9 | -import com.zhonglai.luhui.mqtt.dto.topic.AddPostDto; | 9 | +import com.zhonglai.luhui.device.analysis.dto.topic.AddPostDto; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 12 | 12 |
| 1 | package com.zhonglai.luhui.mqtt.service.topic; | 1 | package com.zhonglai.luhui.mqtt.service.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 8 | import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; | 8 | import com.zhonglai.luhui.mqtt.comm.service.BusinessDataUpdateService; |
| 9 | -import com.zhonglai.luhui.mqtt.dto.topic.AddPostDto; | ||
| 10 | -import com.zhonglai.luhui.mqtt.dto.topic.AllPostDto; | 9 | +import com.zhonglai.luhui.device.analysis.dto.topic.AllPostDto; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | 12 |
| @@ -4,14 +4,15 @@ import com.alibaba.fastjson.JSONObject; | @@ -4,14 +4,15 @@ import com.alibaba.fastjson.JSONObject; | ||
| 4 | import com.zhonglai.luhui.device.domain.IotDevice; | 4 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 5 | import com.zhonglai.luhui.device.domain.IotTerminal; | 5 | import com.zhonglai.luhui.device.domain.IotTerminal; |
| 6 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; | 6 | import com.zhonglai.luhui.mqtt.comm.dao.BaseDao; |
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.dto.TerminalClientRePlyDto; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 10 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 11 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.TerminalClientRePlyDto; | ||
| 9 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 10 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 11 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 12 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; | 12 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; |
| 13 | -import com.zhonglai.luhui.mqtt.comm.util.StringUtils; | ||
| 14 | -import com.zhonglai.luhui.mqtt.dto.topic.GetDto; | 13 | +import com.zhonglai.luhui.device.analysis.comm.util.StringUtils; |
| 14 | +import com.zhonglai.luhui.device.analysis.dto.topic.GetDto; | ||
| 15 | +import com.zhonglai.luhui.mqtt.comm.util.TopicUtil; | ||
| 15 | import org.springframework.beans.BeanUtils; | 16 | import org.springframework.beans.BeanUtils; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| @@ -113,7 +114,7 @@ public class GetTopic implements BusinessAgreement<GetDto> { | @@ -113,7 +114,7 @@ public class GetTopic implements BusinessAgreement<GetDto> { | ||
| 113 | Topic topic1 = new Topic(); | 114 | Topic topic1 = new Topic(); |
| 114 | BeanUtils.copyProperties(topic,topic1); | 115 | BeanUtils.copyProperties(topic,topic1); |
| 115 | topic1.setTopicType("GET_REQ"); | 116 | topic1.setTopicType("GET_REQ"); |
| 116 | - return topic1.generateSendMessageTopic(); | 117 | + return TopicUtil.generateSendMessageTopic(topic1); |
| 117 | } | 118 | } |
| 118 | }); | 119 | }); |
| 119 | return null; | 120 | return null; |
| 1 | package com.zhonglai.luhui.mqtt.service.topic; | 1 | package com.zhonglai.luhui.mqtt.service.topic; |
| 2 | 2 | ||
| 3 | import com.zhonglai.luhui.device.domain.IotDevice; | 3 | import com.zhonglai.luhui.device.domain.IotDevice; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | ||
| 8 | -import com.zhonglai.luhui.mqtt.dto.topic.OnlineDto; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.dto.topic.OnlineDto; | ||
| 9 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; | 9 | import com.zhonglai.luhui.mqtt.service.CacheServiceImpl; |
| 10 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; | 10 | import com.zhonglai.luhui.mqtt.service.db.DeviceService; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 1 | package com.zhonglai.luhui.mqtt.service.topic; | 1 | package com.zhonglai.luhui.mqtt.service.topic; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 5 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 6 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 4 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 5 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 6 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 7 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 8 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; | 8 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; |
| 9 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 10 | -import com.zhonglai.luhui.mqtt.dto.topic.PutReqDto; | 9 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; |
| 10 | +import com.zhonglai.luhui.device.analysis.dto.topic.PutReqDto; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | 13 |
| @@ -3,15 +3,15 @@ package com.zhonglai.luhui.mqtt.service.topic; | @@ -3,15 +3,15 @@ package com.zhonglai.luhui.mqtt.service.topic; | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; | 5 | import com.zhonglai.luhui.device.domain.IotThingsModel; |
| 6 | -import com.zhonglai.luhui.mqtt.comm.dto.ServerDto; | ||
| 7 | -import com.zhonglai.luhui.mqtt.comm.dto.business.BusinessDto; | ||
| 8 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelBase; | ||
| 9 | -import com.zhonglai.luhui.mqtt.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 10 | -import com.zhonglai.luhui.mqtt.comm.factory.BusinessAgreement; | ||
| 11 | -import com.zhonglai.luhui.mqtt.comm.factory.Topic; | 6 | +import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto; |
| 7 | +import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto; | ||
| 8 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelBase; | ||
| 9 | +import com.zhonglai.luhui.device.analysis.comm.dto.thingsmodels.ThingsModelDataTypeEnum; | ||
| 10 | +import com.zhonglai.luhui.device.analysis.comm.factory.BusinessAgreement; | ||
| 11 | +import com.zhonglai.luhui.device.analysis.comm.factory.Topic; | ||
| 12 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; | 12 | import com.zhonglai.luhui.mqtt.comm.service.ClienNoticeService; |
| 13 | -import com.zhonglai.luhui.mqtt.dto.MessageCode; | ||
| 14 | -import com.zhonglai.luhui.mqtt.dto.topic.ReadReqDto; | 13 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; |
| 14 | +import com.zhonglai.luhui.device.analysis.dto.topic.ReadReqDto; | ||
| 15 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; | 15 | import com.zhonglai.luhui.mqtt.service.db.mode.TerminalDataThingsModeService; |
| 16 | import org.apache.commons.lang3.EnumUtils; | 16 | import org.apache.commons.lang3.EnumUtils; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -37,6 +37,10 @@ | @@ -37,6 +37,10 @@ | ||
| 37 | <artifactId>aspectjrt</artifactId> | 37 | <artifactId>aspectjrt</artifactId> |
| 38 | </dependency> | 38 | </dependency> |
| 39 | 39 | ||
| 40 | + <dependency> | ||
| 41 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 42 | + <artifactId>lh-common-swagger</artifactId> | ||
| 43 | + </dependency> | ||
| 40 | 44 | ||
| 41 | <!-- OpenCV --> | 45 | <!-- OpenCV --> |
| 42 | <dependency> | 46 | <dependency> |
| @@ -55,5 +59,76 @@ | @@ -55,5 +59,76 @@ | ||
| 55 | <version>1.5.4</version> | 59 | <version>1.5.4</version> |
| 56 | </dependency> | 60 | </dependency> |
| 57 | 61 | ||
| 62 | + <!-- WebSocket --> | ||
| 63 | + <dependency> | ||
| 64 | + <groupId>org.springframework.boot</groupId> | ||
| 65 | + <artifactId>spring-boot-starter-websocket</artifactId> | ||
| 66 | + </dependency> | ||
| 67 | + | ||
| 68 | + <!-- 串口开发 --> | ||
| 69 | + <dependency> | ||
| 70 | + <groupId>com.github.purejavacomm</groupId> | ||
| 71 | + <artifactId>purejavacomm</artifactId> | ||
| 72 | + <version>1.0.1.RELEASE</version> | ||
| 73 | + </dependency> | ||
| 74 | + | ||
| 75 | + <dependency> | ||
| 76 | + <groupId>org.ehcache</groupId> | ||
| 77 | + <artifactId>ehcache</artifactId> | ||
| 78 | + <version>3.10.8</version> | ||
| 79 | + </dependency> | ||
| 80 | + | ||
| 58 | </dependencies> | 81 | </dependencies> |
| 82 | + | ||
| 83 | + <build> | ||
| 84 | + <finalName>lh-smart-feeder</finalName> | ||
| 85 | + <plugins> | ||
| 86 | + <plugin> | ||
| 87 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 88 | + <artifactId>maven-jar-plugin</artifactId> | ||
| 89 | + <version>2.4</version> | ||
| 90 | + <configuration> | ||
| 91 | + <archive> | ||
| 92 | + <!-- | ||
| 93 | + 生成的jar中,不要包含pom.xml和pom.properties这两个文件 | ||
| 94 | + --> | ||
| 95 | + <addMavenDescriptor>false</addMavenDescriptor> | ||
| 96 | + <manifest> | ||
| 97 | + <!-- | ||
| 98 | + 是否要把第三方jar放到manifest的classpath中 | ||
| 99 | + --> | ||
| 100 | + <addClasspath>true</addClasspath> | ||
| 101 | + | ||
| 102 | + <!-- | ||
| 103 | + 生成的manifest中classpath的前缀,因为要把第三方jar放到lib目录下,所以classpath的前缀是lib/ | ||
| 104 | + --> | ||
| 105 | + <classpathPrefix>lib/</classpathPrefix> | ||
| 106 | + <mainClass>com.zhonglai.luhui.smart.feeder.Main</mainClass> | ||
| 107 | + </manifest> | ||
| 108 | + </archive> | ||
| 109 | + </configuration> | ||
| 110 | + </plugin> | ||
| 111 | + | ||
| 112 | + <!-- The configuration of maven-assembly-plugin --> | ||
| 113 | + <plugin> | ||
| 114 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 115 | + <artifactId>maven-assembly-plugin</artifactId> | ||
| 116 | + <version>2.4</version> | ||
| 117 | + <configuration> | ||
| 118 | + <descriptors> | ||
| 119 | + <descriptor>src/main/resources/package.xml</descriptor> | ||
| 120 | + </descriptors> | ||
| 121 | + </configuration> | ||
| 122 | + <executions> | ||
| 123 | + <execution> | ||
| 124 | + <id>make-assembly</id> | ||
| 125 | + <phase>package</phase> | ||
| 126 | + <goals> | ||
| 127 | + <goal>single</goal> | ||
| 128 | + </goals> | ||
| 129 | + </execution> | ||
| 130 | + </executions> | ||
| 131 | + </plugin> | ||
| 132 | + </plugins> | ||
| 133 | + </build> | ||
| 59 | </project> | 134 | </project> |
| 1 | package com.zhonglai.luhui.smart.feeder; | 1 | package com.zhonglai.luhui.smart.feeder; |
| 2 | 2 | ||
| 3 | +import com.ruoyi.framework.config.ResourcesConfig; | ||
| 3 | import com.zhonglai.luhui.smart.feeder.config.OpenCVConfig; | 4 | import com.zhonglai.luhui.smart.feeder.config.OpenCVConfig; |
| 4 | -import com.zhonglai.luhui.smart.feeder.service.OpenCVService; | ||
| 5 | import org.springframework.boot.SpringApplication; | 5 | import org.springframework.boot.SpringApplication; |
| 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 7 | 7 | ||
| @@ -9,15 +9,15 @@ import org.slf4j.Logger; | @@ -9,15 +9,15 @@ import org.slf4j.Logger; | ||
| 9 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | 10 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| 11 | import org.springframework.context.annotation.ComponentScan; | 11 | import org.springframework.context.annotation.ComponentScan; |
| 12 | +import org.springframework.context.annotation.FilterType; | ||
| 12 | import org.springframework.scheduling.annotation.EnableScheduling; | 13 | import org.springframework.scheduling.annotation.EnableScheduling; |
| 13 | 14 | ||
| 14 | -import java.io.*; | ||
| 15 | -import java.net.URL; | ||
| 16 | - | ||
| 17 | @ComponentScan(basePackages = { | 15 | @ComponentScan(basePackages = { |
| 18 | "com.ruoyi.common", | 16 | "com.ruoyi.common", |
| 19 | "com.ruoyi.framework", | 17 | "com.ruoyi.framework", |
| 18 | + "com.zhonglai.luhui.smart.feeder", | ||
| 20 | } | 19 | } |
| 20 | + ,excludeFilters = {@ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE,classes = {ResourcesConfig.class})} | ||
| 21 | ) | 21 | ) |
| 22 | @EnableScheduling | 22 | @EnableScheduling |
| 23 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class}) | 23 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class}) |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/config/ResourcesConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.config; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.config.RuoYiConfig; | ||
| 4 | +import com.ruoyi.common.constant.Constants; | ||
| 5 | +import org.springframework.beans.factory.annotation.Value; | ||
| 6 | +import org.springframework.context.annotation.Bean; | ||
| 7 | +import org.springframework.context.annotation.Configuration; | ||
| 8 | +import org.springframework.web.cors.CorsConfiguration; | ||
| 9 | +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
| 10 | +import org.springframework.web.filter.CorsFilter; | ||
| 11 | +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||
| 12 | +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 通用配置 | ||
| 16 | + * | ||
| 17 | + * @author ruoyi | ||
| 18 | + */ | ||
| 19 | +@Configuration | ||
| 20 | +public class ResourcesConfig implements WebMvcConfigurer | ||
| 21 | +{ | ||
| 22 | + @Value("${sys.staticPath}") | ||
| 23 | + private String staticPath; | ||
| 24 | + @Override | ||
| 25 | + public void addResourceHandlers(ResourceHandlerRegistry registry) | ||
| 26 | + { | ||
| 27 | + /** 本地文件上传路径 */ | ||
| 28 | + registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") | ||
| 29 | + .addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); | ||
| 30 | + | ||
| 31 | + registry.addResourceHandler( "/camera/**") | ||
| 32 | + .addResourceLocations(staticPath); | ||
| 33 | + | ||
| 34 | + /** swagger配置 */ | ||
| 35 | + registry.addResourceHandler("/swagger-ui/**") | ||
| 36 | + .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 跨域配置 | ||
| 43 | + */ | ||
| 44 | + @Bean | ||
| 45 | + public CorsFilter corsFilter() | ||
| 46 | + { | ||
| 47 | + CorsConfiguration config = new CorsConfiguration(); | ||
| 48 | + config.setAllowCredentials(true); | ||
| 49 | + // 设置访问源地址 | ||
| 50 | + config.addAllowedOriginPattern("*"); | ||
| 51 | + // 设置访问源请求头 | ||
| 52 | + config.addAllowedHeader("*"); | ||
| 53 | + // 设置访问源请求方法 | ||
| 54 | + config.addAllowedMethod("*"); | ||
| 55 | + // 有效期 1800秒 | ||
| 56 | + config.setMaxAge(1800L); | ||
| 57 | + // 添加映射路径,拦截一切请求 | ||
| 58 | + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
| 59 | + source.registerCorsConfiguration("/**", config); | ||
| 60 | + // 返回新的CorsFilter | ||
| 61 | + return new CorsFilter(source); | ||
| 62 | + } | ||
| 63 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/config/SwaggerConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.config; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.config.RuoYiConfig; | ||
| 4 | +import io.swagger.annotations.ApiOperation; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.context.annotation.Bean; | ||
| 7 | +import org.springframework.context.annotation.Configuration; | ||
| 8 | +import springfox.documentation.builders.ApiInfoBuilder; | ||
| 9 | +import springfox.documentation.builders.PathSelectors; | ||
| 10 | +import springfox.documentation.builders.RequestHandlerSelectors; | ||
| 11 | +import springfox.documentation.service.ApiInfo; | ||
| 12 | +import springfox.documentation.service.Contact; | ||
| 13 | +import springfox.documentation.spi.DocumentationType; | ||
| 14 | +import springfox.documentation.spring.web.plugins.Docket; | ||
| 15 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +@Configuration | ||
| 19 | +@EnableSwagger2 | ||
| 20 | +public class SwaggerConfig { | ||
| 21 | + /** 系统基础配置 */ | ||
| 22 | + @Autowired | ||
| 23 | + private RuoYiConfig ruoyiConfig; | ||
| 24 | + @Bean | ||
| 25 | + public Docket createRestApi() { | ||
| 26 | + return new Docket(DocumentationType.SWAGGER_2) | ||
| 27 | + .apiInfo(apiInfo()) | ||
| 28 | + .select() | ||
| 29 | + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) | ||
| 30 | + .paths(PathSelectors.any()) | ||
| 31 | + .build(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 添加摘要信息 | ||
| 36 | + */ | ||
| 37 | + private ApiInfo apiInfo() | ||
| 38 | + { | ||
| 39 | + // 用ApiInfoBuilder进行定制 | ||
| 40 | + return new ApiInfoBuilder() | ||
| 41 | + // 设置标题 | ||
| 42 | + .title("标题:智能投料机") | ||
| 43 | + // 描述 | ||
| 44 | + .description("描述:智能投料机") | ||
| 45 | + // 作者信息 | ||
| 46 | + .contact(new Contact(ruoyiConfig.getName(), null, null)) | ||
| 47 | + // 版本 | ||
| 48 | + .version("版本号:" + ruoyiConfig.getVersion()) | ||
| 49 | + .build(); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/config/WebSocketClien.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.config; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.smart.feeder.service.WebSocketSever; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 6 | + | ||
| 7 | +import javax.websocket.Session; | ||
| 8 | +import java.io.IOException; | ||
| 9 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 10 | +import java.util.concurrent.CopyOnWriteArraySet; | ||
| 11 | + | ||
| 12 | +public class WebSocketClien { | ||
| 13 | + private static final Logger log = LoggerFactory.getLogger(WebSocketSever.class); | ||
| 14 | + // session集合,存放对应的session | ||
| 15 | + public static ConcurrentHashMap<Integer, Session> sessionPool = new ConcurrentHashMap<>(); | ||
| 16 | + | ||
| 17 | + // concurrent包的线程安全Set,用来存放每个客户端对应的WebSocket对象。 | ||
| 18 | + public static CopyOnWriteArraySet<WebSocketSever> webSocketSet = new CopyOnWriteArraySet<>(); | ||
| 19 | + | ||
| 20 | + public static boolean login(Integer userId) | ||
| 21 | + { | ||
| 22 | + try { | ||
| 23 | + Session historySession = sessionPool.get(userId); | ||
| 24 | + // historySession不为空,说明已经有人登陆账号,应该删除登陆的WebSocket对象 | ||
| 25 | + if (historySession != null) { | ||
| 26 | + webSocketSet.remove(historySession); | ||
| 27 | + historySession.close(); | ||
| 28 | + } | ||
| 29 | + return true; | ||
| 30 | + } catch (IOException e) { | ||
| 31 | + log.error("重复登录异常,错误信息:" + e.getMessage(), e); | ||
| 32 | + return false; | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public static void close(Integer userId) | ||
| 37 | + { | ||
| 38 | + try { | ||
| 39 | + Session historySession = sessionPool.get(userId); | ||
| 40 | + // historySession不为空,说明已经有人登陆账号,应该删除登陆的WebSocket对象 | ||
| 41 | + if (historySession != null) { | ||
| 42 | + webSocketSet.remove(historySession); | ||
| 43 | + historySession.close(); | ||
| 44 | + } | ||
| 45 | + } catch (IOException e) { | ||
| 46 | + log.error("关闭连接,错误信息:" + e.getMessage(), e); | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/config/WebSocketConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.boot.web.servlet.ServletContextInitializer; | ||
| 4 | +import org.springframework.context.annotation.Bean; | ||
| 5 | +import org.springframework.context.annotation.Configuration; | ||
| 6 | +import org.springframework.web.socket.server.standard.ServerEndpointExporter; | ||
| 7 | + | ||
| 8 | +import javax.servlet.ServletContext; | ||
| 9 | +import javax.servlet.ServletException; | ||
| 10 | + | ||
| 11 | +@Configuration | ||
| 12 | +public class WebSocketConfig implements ServletContextInitializer { | ||
| 13 | + /** | ||
| 14 | + * 这个bean的注册,用于扫描带有@ServerEndpoint的注解成为websocket,如果你使用外置的tomcat就不需要该配置文件 | ||
| 15 | + */ | ||
| 16 | + @Bean | ||
| 17 | + public ServerEndpointExporter serverEndpointExporter() { | ||
| 18 | + return new ServerEndpointExporter(); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + public void onStartup(ServletContext servletContext) throws ServletException { | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +package com.zhonglai.luhui.smart.feeder.controller; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.config.WebSocketClien; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.dto.SysConfig; | ||
| 6 | +import com.zhonglai.luhui.smart.feeder.dto.VeiwType; | ||
| 7 | +import com.zhonglai.luhui.smart.feeder.service.CameraService; | ||
| 8 | +import com.zhonglai.luhui.smart.feeder.service.DeviceService; | ||
| 9 | +import com.zhonglai.luhui.smart.feeder.service.FishGroupImageRecognitionService; | ||
| 10 | +import io.swagger.annotations.Api; | ||
| 11 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 12 | +import io.swagger.annotations.ApiImplicitParams; | ||
| 13 | +import io.swagger.annotations.ApiOperation; | ||
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 16 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.RestController; | ||
| 19 | + | ||
| 20 | +import java.io.IOException; | ||
| 21 | + | ||
| 22 | +@Api(tags = "摄像头功能") | ||
| 23 | +@RestController | ||
| 24 | +@RequestMapping("/camera") | ||
| 25 | +public class CameraController { | ||
| 26 | + @Autowired | ||
| 27 | + private CameraService cameraService; | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + private DeviceService deviceService; | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + private FishGroupImageRecognitionService fishGroupImageRecognitionService; | ||
| 34 | + | ||
| 35 | + @ApiOperation("打开鱼群识别") | ||
| 36 | + @GetMapping("/open") | ||
| 37 | + public AjaxResult open() | ||
| 38 | + { | ||
| 39 | + fishGroupImageRecognitionService.start(VeiwType.html); | ||
| 40 | + return AjaxResult.success(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @ApiOperation("关闭鱼群识别") | ||
| 44 | + @GetMapping("/close") | ||
| 45 | + public AjaxResult close() | ||
| 46 | + { | ||
| 47 | + fishGroupImageRecognitionService.stop(); | ||
| 48 | + return AjaxResult.success(); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @ApiOperation("关闭连接") | ||
| 52 | + @GetMapping("/discon/{userId}") | ||
| 53 | + public AjaxResult discon( @PathVariable(value = "userId") Integer userId) | ||
| 54 | + { | ||
| 55 | + WebSocketClien.close(userId); | ||
| 56 | + return AjaxResult.success(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @ApiOperation("设置摄像头usb口编号") | ||
| 60 | + @GetMapping("/setNumber/{number}") | ||
| 61 | + public AjaxResult setNumber(@PathVariable Integer number) | ||
| 62 | + { | ||
| 63 | + SysConfig.captureNumber = number; | ||
| 64 | + return AjaxResult.success(); | ||
| 65 | + } | ||
| 66 | + @ApiOperation("打开串口") | ||
| 67 | + @ApiImplicitParams({ | ||
| 68 | + @ApiImplicitParam(value = "串口名称",name = "portName"), | ||
| 69 | + @ApiImplicitParam(value = "波特率",name = "baudrate"), | ||
| 70 | + @ApiImplicitParam(value = "数据位",name = "dataBits"), | ||
| 71 | + @ApiImplicitParam(value = "停止位",name = "stopBits"), | ||
| 72 | + @ApiImplicitParam(value = "校验位",name = "parity"), | ||
| 73 | + }) | ||
| 74 | + @GetMapping("/openSerial") | ||
| 75 | + public AjaxResult openSerial(String portName, Integer baudrate, Integer dataBits, Integer stopBits,Integer parity) throws Exception { | ||
| 76 | + deviceService.openSerialPort(portName,baudrate,dataBits,stopBits,parity); | ||
| 77 | + return AjaxResult.success(); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @ApiOperation("串口发送指令") | ||
| 81 | + @GetMapping("/sendSerialData") | ||
| 82 | + public AjaxResult sendSerialData(String hexStr) throws IOException { | ||
| 83 | + ; | ||
| 84 | + return AjaxResult.success().put("data",deviceService.sendData(hexStr)); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @ApiOperation("获取所有串口") | ||
| 88 | + @GetMapping("/getAllSerial") | ||
| 89 | + public AjaxResult getAllSerial() { | ||
| 90 | + return AjaxResult.success().put("data",deviceService.getAllSerial()); | ||
| 91 | + } | ||
| 92 | +} |
| 1 | +package com.zhonglai.luhui.smart.feeder.controller; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.Api; | ||
| 4 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | +import org.springframework.web.bind.annotation.RestController; | ||
| 6 | + | ||
| 7 | +@Api(tags = "配置") | ||
| 8 | +@RestController | ||
| 9 | +@RequestMapping("/config") | ||
| 10 | +public class ConfigController { | ||
| 11 | + | ||
| 12 | +} |
| 1 | package com.zhonglai.luhui.smart.feeder.draw; | 1 | package com.zhonglai.luhui.smart.feeder.draw; |
| 2 | 2 | ||
| 3 | +import com.zhonglai.luhui.smart.feeder.service.DisplayVeiwService; | ||
| 3 | import com.zhonglai.luhui.smart.feeder.util.OpenCVUtils; | 4 | import com.zhonglai.luhui.smart.feeder.util.OpenCVUtils; |
| 4 | import org.opencv.core.Mat; | 5 | import org.opencv.core.Mat; |
| 5 | 6 | ||
| @@ -9,8 +10,7 @@ import java.awt.image.BufferedImage; | @@ -9,8 +10,7 @@ import java.awt.image.BufferedImage; | ||
| 9 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
| 10 | import java.util.List; | 11 | import java.util.List; |
| 11 | 12 | ||
| 12 | -public class FishRegionPanel | ||
| 13 | -{ | 13 | +public class FishRegionPanel { |
| 14 | private JFrame frame; | 14 | private JFrame frame; |
| 15 | private JLabel lblImage; | 15 | private JLabel lblImage; |
| 16 | private JLabel srcImage; | 16 | private JLabel srcImage; |
| @@ -47,24 +47,19 @@ public class FishRegionPanel | @@ -47,24 +47,19 @@ public class FishRegionPanel | ||
| 47 | init(); | 47 | init(); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | - public void addFishCount(int size) { | ||
| 51 | - pnlGraph.getFishCountList().add(size); | ||
| 52 | - pnlGraph.repaint(); | 50 | + public JFrame getFrame() { |
| 51 | + return frame; | ||
| 53 | } | 52 | } |
| 54 | 53 | ||
| 55 | - public void displayImage(Mat image) { | ||
| 56 | - lblImage.setIcon(new ImageIcon(convertMatToImage(image))); | ||
| 57 | - frame.repaint(); | 54 | + public JLabel getLblImage() { |
| 55 | + return lblImage; | ||
| 58 | } | 56 | } |
| 59 | 57 | ||
| 60 | - public void dispSrcImage(Mat image) { | ||
| 61 | - srcImage.setIcon(new ImageIcon(convertMatToImage(image))); | ||
| 62 | - frame.repaint(); | 58 | + public JLabel getSrcImage() { |
| 59 | + return srcImage; | ||
| 63 | } | 60 | } |
| 64 | 61 | ||
| 65 | - private Image convertMatToImage(Mat mat) { | ||
| 66 | - BufferedImage bufferedImage = OpenCVUtils.matToBufferedImage(mat); | ||
| 67 | - return bufferedImage.getScaledInstance(300, 300, Image.SCALE_SMOOTH); | 62 | + public GraphPanel getPnlGraph() { |
| 63 | + return pnlGraph; | ||
| 68 | } | 64 | } |
| 69 | - | ||
| 70 | } | 65 | } |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/dto/SysConfig.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.dto; | ||
| 2 | + | ||
| 3 | +public class SysConfig { | ||
| 4 | + public static Integer captureNumber = 0; //摄像头编号 | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * 反光阈值(reflectionThreshold)被设置为100。这意味着所有灰度值低于100的像素都会被设置为0(黑色),灰度值大于或等于100的像素都会被设置为255(白色)。如果你的图像中的对象或区域的灰度值接近或低于这个阈值,它们可能会被排除在二值图像之外。尝试调整这个阈值可能有助于改善结果 | ||
| 8 | + */ | ||
| 9 | + public static int reflectionThreshold = 100; // 反光阈值 | ||
| 10 | + | ||
| 11 | + public static int kernelSize = 3; // 去噪调整内核大小,用来消除小的物体或噪声 | ||
| 12 | + | ||
| 13 | + public static double maxValue = 255; //最大反光阈值 | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/dto/VeiwDto.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.dto; | ||
| 2 | + | ||
| 3 | +import org.opencv.core.Mat; | ||
| 4 | + | ||
| 5 | +public class VeiwDto { | ||
| 6 | + private Mat frame; | ||
| 7 | + private Mat binaryImage; | ||
| 8 | + private Integer size; | ||
| 9 | + | ||
| 10 | + public VeiwDto(Mat frame, Integer size) { | ||
| 11 | + this.frame = frame; | ||
| 12 | + this.size = size; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + public VeiwDto(Mat frame, Mat binaryImage, Integer size) { | ||
| 16 | + this.frame = frame; | ||
| 17 | + this.binaryImage = binaryImage; | ||
| 18 | + this.size = size; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public VeiwDto() { | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public Mat getFrame() { | ||
| 25 | + return frame; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setFrame(Mat frame) { | ||
| 29 | + this.frame = frame; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public Mat getBinaryImage() { | ||
| 33 | + return binaryImage; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setBinaryImage(Mat binaryImage) { | ||
| 37 | + this.binaryImage = binaryImage; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public Integer getSize() { | ||
| 41 | + return size; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setSize(Integer size) { | ||
| 45 | + this.size = size; | ||
| 46 | + } | ||
| 47 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/dto/WebSocketVO.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.dto; | ||
| 2 | + | ||
| 3 | +public class WebSocketVO { | ||
| 4 | + private int size; | ||
| 5 | + private String img; | ||
| 6 | + | ||
| 7 | + public int getSize() { | ||
| 8 | + return size; | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + public void setSize(int size) { | ||
| 12 | + this.size = size; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + public String getImg() { | ||
| 16 | + return img; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setImg(String img) { | ||
| 20 | + this.img = img; | ||
| 21 | + } | ||
| 22 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/opencv/OpenCVUtil.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.opencv; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.utils.DESUtil; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.config.OpenCVConfig; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.dto.VeiwDto; | ||
| 6 | +import com.zhonglai.luhui.smart.feeder.service.impl.HtmllVeiwServiceImpl; | ||
| 7 | +import com.zhonglai.luhui.smart.feeder.service.impl.JFrameVeiwServiceImpl; | ||
| 8 | +import org.opencv.core.*; | ||
| 9 | +import org.opencv.highgui.HighGui; | ||
| 10 | +import org.opencv.videoio.VideoCapture; | ||
| 11 | +import org.opencv.imgproc.Imgproc; | ||
| 12 | + | ||
| 13 | +import java.io.IOException; | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.Collections; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +public class OpenCVUtil { | ||
| 20 | + | ||
| 21 | + public static void main(String[] args) { | ||
| 22 | + System.out.println(DESUtil.decode("5F06AAC657B2E2B287289D25D950A829", "EXU5RUhI1"));; | ||
| 23 | +// OpenCVConfig.loadOpenCv(args); | ||
| 24 | +// VideoCapture videoCapture = OpenCVUtil.readVideoCaptureForVideo(0); | ||
| 25 | +// // 检查视频是否成功打开 | ||
| 26 | +// if (!videoCapture.isOpened()) { | ||
| 27 | +// System.out.println("无法打开视频文件"); | ||
| 28 | +// return; | ||
| 29 | +// } | ||
| 30 | +// | ||
| 31 | +// Mat previousFrame = new Mat(); | ||
| 32 | +// if (!videoCapture.read(previousFrame)) { | ||
| 33 | +// System.out.println("无法读取视频帧"); | ||
| 34 | +// return; | ||
| 35 | +// } | ||
| 36 | +// | ||
| 37 | +// JFrameVeiwServiceImpl dsplayVeiwService = new JFrameVeiwServiceImpl(); | ||
| 38 | +// // 逐帧处理视频 | ||
| 39 | +// Mat frame = new Mat(); | ||
| 40 | +// while (videoCapture.read(frame)) { | ||
| 41 | +// dsplayVeiwService.veiw(new VeiwDto(frame,null,null)); | ||
| 42 | +// try { | ||
| 43 | +// String str = new HtmllVeiwServiceImpl().matToString(frame,"jpg"); | ||
| 44 | +// System.out.println(str); | ||
| 45 | +// } catch (IOException e) { | ||
| 46 | +// throw new RuntimeException(e); | ||
| 47 | +// } | ||
| 48 | +// } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public static VideoCapture readVideoCaptureForVideo(int i) | ||
| 52 | + { | ||
| 53 | + // 创建VideoCapture对象 | ||
| 54 | + VideoCapture videoCapture = new VideoCapture(i); | ||
| 55 | + boolean isopen = videoCapture.isOpened(); | ||
| 56 | + System.out.println(isopen); | ||
| 57 | + return videoCapture; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public static VideoCapture readVideoCaptureForVideo(String videoPath ) | ||
| 61 | + { | ||
| 62 | + // 创建VideoCapture对象 | ||
| 63 | + VideoCapture videoCapture = new VideoCapture(); | ||
| 64 | + boolean isopen = videoCapture.open(videoPath); | ||
| 65 | + System.out.println(isopen); | ||
| 66 | + return videoCapture; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 抠图 | ||
| 71 | + * @param frame | ||
| 72 | + * @param largestContour | ||
| 73 | + * @return | ||
| 74 | + */ | ||
| 75 | + public static Mat matting(Mat frame,MatOfPoint largestContour) | ||
| 76 | + { | ||
| 77 | + // 创建一个与原始图像相同大小的新Mat,用于提取图像区域 | ||
| 78 | + Mat extractedRegion = Mat.zeros(frame.size(), frame.type()); | ||
| 79 | + | ||
| 80 | + // 将指定的轮廓绘制到新的Mat上 | ||
| 81 | + Imgproc.drawContours(extractedRegion, Collections.singletonList(largestContour), 0, new Scalar(255, 255, 255), -1); | ||
| 82 | + | ||
| 83 | + // 使用按位与操作提取对应的图像区域 | ||
| 84 | + Mat extractedImage = new Mat(); | ||
| 85 | + Core.bitwise_and(frame, extractedRegion, extractedImage); | ||
| 86 | + | ||
| 87 | + return extractedImage; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + private static List<MatOfPoint> fishByWater(Mat frame) | ||
| 92 | + { | ||
| 93 | + // 2. 转换为灰度图像 | ||
| 94 | + Mat gray = new Mat(); | ||
| 95 | + Imgproc.cvtColor(frame, gray, Imgproc.COLOR_BGR2GRAY); | ||
| 96 | + | ||
| 97 | + // 3. 进行阈值分割以得到二值图像 | ||
| 98 | + Mat binary = new Mat(); | ||
| 99 | + Imgproc.threshold(gray, binary, 100, 255, Imgproc.THRESH_BINARY); | ||
| 100 | + | ||
| 101 | + // 4. 查找轮廓 | ||
| 102 | + List<MatOfPoint> contours = new ArrayList<>(); | ||
| 103 | + Mat hierarchy = new Mat(); | ||
| 104 | + Imgproc.findContours(binary, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); | ||
| 105 | + | ||
| 106 | + return contours; | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/service/CameraService.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.service; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.smart.feeder.Main; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.dto.SysConfig; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.opencv.OpenCVUtil; | ||
| 6 | +import org.opencv.videoio.VideoCapture; | ||
| 7 | +import org.opencv.videoio.Videoio; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | + | ||
| 13 | +import javax.annotation.PostConstruct; | ||
| 14 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 15 | +import java.util.concurrent.ScheduledFuture; | ||
| 16 | +import java.util.concurrent.TimeUnit; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 摄像头 | ||
| 21 | + */ | ||
| 22 | +@Service | ||
| 23 | +public class CameraService { | ||
| 24 | + private static final Logger logger = LoggerFactory.getLogger(CameraService.class); | ||
| 25 | + | ||
| 26 | + private VideoCapture videoCapture; | ||
| 27 | + private boolean videoIsOpen; | ||
| 28 | + | ||
| 29 | + private ScheduledFuture scheduledFuture; | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + private ScheduledExecutorService scheduledExecutorService; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 初始化摄像头 | ||
| 36 | + */ | ||
| 37 | + private void openCapture() | ||
| 38 | + { | ||
| 39 | + videoCapture = OpenCVUtil.readVideoCaptureForVideo(SysConfig.captureNumber); | ||
| 40 | +// videoCapture.set(Videoio.CAP_PROP_FRAME_WIDTH,640); | ||
| 41 | +// videoCapture.set(Videoio.CAP_PROP_FRAME_HEIGHT,480); | ||
| 42 | +// videoCapture.set(Videoio.CAP_PROP_FOURCC, 0x32595559); | ||
| 43 | +// videoCapture.set(Videoio.CAP_PROP_FPS, 25); | ||
| 44 | + monitorCapture(); | ||
| 45 | + logger.info("初始化摄像头"); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 守护摄像头 | ||
| 50 | + */ | ||
| 51 | + @PostConstruct | ||
| 52 | + private void guardCapture() | ||
| 53 | + { | ||
| 54 | + start(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 检测摄像头是否打开 | ||
| 59 | + */ | ||
| 60 | + private void monitorCapture() | ||
| 61 | + { | ||
| 62 | + // 检查视频是否成功打开 | ||
| 63 | + if (videoCapture.isOpened()) { | ||
| 64 | + videoIsOpen = true; | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + System.out.println("无法打开视频文件"+SysConfig.captureNumber); | ||
| 68 | + videoIsOpen = false; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 开启 | ||
| 73 | + */ | ||
| 74 | + public void start() | ||
| 75 | + { | ||
| 76 | + if(null == scheduledFuture || scheduledFuture.isDone()) | ||
| 77 | + { | ||
| 78 | + scheduledFuture = scheduledExecutorService.scheduleAtFixedRate(() -> { | ||
| 79 | + if(!videoIsOpen) | ||
| 80 | + { | ||
| 81 | + openCapture(); | ||
| 82 | + } | ||
| 83 | + },0,1, TimeUnit.SECONDS); | ||
| 84 | + } | ||
| 85 | + logger.info("启动摄像头"); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 关闭 | ||
| 90 | + */ | ||
| 91 | + public void close() | ||
| 92 | + { | ||
| 93 | + if(scheduledFuture.isDone()) | ||
| 94 | + { | ||
| 95 | + scheduledFuture.cancel(true); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + if(videoIsOpen) | ||
| 99 | + { | ||
| 100 | + videoIsOpen = false; | ||
| 101 | + // 释放资源 | ||
| 102 | + videoCapture.release(); | ||
| 103 | + } | ||
| 104 | + logger.info("关闭摄像头"); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public VideoCapture getVideoCapture() { | ||
| 108 | + return videoCapture; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/service/DeviceService.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.service; | ||
| 2 | + | ||
| 3 | +import com.sun.deploy.net.HttpResponse; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.util.serial.GlobalCache; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.util.serial.SerialResquest; | ||
| 6 | +import com.zhonglai.luhui.smart.feeder.util.serial.SerialTool; | ||
| 7 | +import org.opencv.core.Core; | ||
| 8 | +import org.opencv.core.Mat; | ||
| 9 | +import org.opencv.highgui.HighGui; | ||
| 10 | +import org.opencv.videoio.VideoCapture; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | +import purejavacomm.SerialPort; | ||
| 15 | +import purejavacomm.SerialPortEvent; | ||
| 16 | +import purejavacomm.SerialPortEventListener; | ||
| 17 | + | ||
| 18 | +import javax.servlet.http.HttpServletResponse; | ||
| 19 | +import javax.websocket.Session; | ||
| 20 | +import java.io.IOException; | ||
| 21 | +import java.util.ArrayList; | ||
| 22 | +import java.util.Map; | ||
| 23 | +import java.util.concurrent.BlockingQueue; | ||
| 24 | +import java.util.concurrent.LinkedBlockingQueue; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 设备管理 | ||
| 28 | + */ | ||
| 29 | +@Service | ||
| 30 | +public class DeviceService { | ||
| 31 | + private static Logger logger = LoggerFactory.getLogger(DeviceService.class); | ||
| 32 | + | ||
| 33 | + private SerialPort serialPort; //串口 | ||
| 34 | + | ||
| 35 | + // 锁对象 | ||
| 36 | + private final Object lock = new Object(); | ||
| 37 | + // 用于存储串口返回的数据,使用线程安全的队列 | ||
| 38 | + private BlockingQueue<String> dataQueue = new LinkedBlockingQueue<>(); | ||
| 39 | + | ||
| 40 | + private Double backArea; //上一个大小 | ||
| 41 | + | ||
| 42 | + private Double slope; //斜率 | ||
| 43 | + private Double backSlope; //斜率 | ||
| 44 | + private Double slopeDifference; //斜率差值 | ||
| 45 | + | ||
| 46 | + public void controlDevice(double area) | ||
| 47 | + { | ||
| 48 | + if(null == backArea ) | ||
| 49 | + { | ||
| 50 | + backArea = area; | ||
| 51 | + return; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + slope = area-backArea; | ||
| 55 | + if(null == backSlope) | ||
| 56 | + { | ||
| 57 | + backSlope = slope; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + slopeDifference = slope-backSlope; | ||
| 61 | + | ||
| 62 | + double absValue = Math.abs(slopeDifference); | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 获取所有串口 | ||
| 69 | + * @return | ||
| 70 | + */ | ||
| 71 | + public ArrayList<String> getAllSerial() | ||
| 72 | + { | ||
| 73 | + return SerialTool.findPorts(); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 打开串口 | ||
| 78 | + * @param portName 串口名称 | ||
| 79 | + * @param baudrate 波特率,用于指定每秒传输的位数。 | ||
| 80 | + * @param dataBits 数据位,表示每个字节的位数。常见的值为 5、6、7、8。 | ||
| 81 | + * @param stopBits 停止位,用于指定每个字节的停止位数。 | ||
| 82 | + * @param parity 校验位,用于验证数据的正确性。常见的值有 NONE(无校验)、ODD(奇校验)、EVEN(偶校验)等。 | ||
| 83 | + * @throws Exception | ||
| 84 | + */ | ||
| 85 | + public void openSerialPort(String portName, Integer baudrate, Integer dataBits, Integer stopBits, | ||
| 86 | + Integer parity) throws Exception { | ||
| 87 | + if(null != serialPort) | ||
| 88 | + { | ||
| 89 | + return; | ||
| 90 | + } | ||
| 91 | + serialPort = SerialTool.openPort(portName,baudrate,dataBits,stopBits,parity); | ||
| 92 | + SerialTool.addListener(serialPortEvent -> { | ||
| 93 | + switch (serialPortEvent.getEventType()) | ||
| 94 | + { | ||
| 95 | + case SerialPortEvent.DATA_AVAILABLE: | ||
| 96 | + byte[] readBuffer = null; | ||
| 97 | + int availableBytes = 0; | ||
| 98 | + try { | ||
| 99 | + availableBytes = serialPort.getInputStream().available(); | ||
| 100 | + if (availableBytes > 0) { | ||
| 101 | + try { | ||
| 102 | + readBuffer = SerialTool.readFromPort(serialPort); | ||
| 103 | + String data = SerialTool.bytesToHexString(readBuffer); | ||
| 104 | + dataQueue.offer(data); // 将数据添加到队列中// 处理串口返回的数据 | ||
| 105 | + } catch (Exception e) { | ||
| 106 | + logger.error("读取推送信息异常!"+e); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + } catch (IOException e) { | ||
| 110 | + logger.error("读取流信息异常!"+e); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + }, serialPort); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * 发送数据 | ||
| 118 | + * @param hexStr | ||
| 119 | + * @throws IOException | ||
| 120 | + */ | ||
| 121 | + public String sendData(String hexStr) throws IOException { | ||
| 122 | + synchronized (lock) | ||
| 123 | + { | ||
| 124 | + SerialTool.sendToPort(SerialTool.HexString2Bytes(hexStr),serialPort); | ||
| 125 | + try { | ||
| 126 | + String reStr = dataQueue.take(); | ||
| 127 | + return reStr; | ||
| 128 | + } catch (InterruptedException e) { | ||
| 129 | + logger.error("等待串口返回数据异常!" + e); | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + return null; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/service/EhCacheService.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.service; | ||
| 2 | + | ||
| 3 | +import org.ehcache.Cache; | ||
| 4 | +import org.ehcache.CacheManager; | ||
| 5 | +import org.ehcache.config.CacheConfiguration; | ||
| 6 | +import org.ehcache.config.ResourcePools; | ||
| 7 | +import org.ehcache.config.builders.CacheConfigurationBuilder; | ||
| 8 | +import org.ehcache.config.builders.CacheManagerBuilder; | ||
| 9 | +import org.ehcache.config.builders.ExpiryPolicyBuilder; | ||
| 10 | +import org.ehcache.config.builders.ResourcePoolsBuilder; | ||
| 11 | +import org.ehcache.config.units.MemoryUnit; | ||
| 12 | +import org.springframework.beans.factory.annotation.Value; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | + | ||
| 15 | +import javax.annotation.PostConstruct; | ||
| 16 | +import java.io.File; | ||
| 17 | +import java.time.Duration; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 缓存 | ||
| 21 | + */ | ||
| 22 | +@Service | ||
| 23 | +public class EhCacheService { | ||
| 24 | + private static Cache<String, Object> myCache; | ||
| 25 | + | ||
| 26 | + private static CacheManager cacheManager; | ||
| 27 | + | ||
| 28 | + public static final String MY_CACHE = "myCache"; | ||
| 29 | + | ||
| 30 | + @Value("${sys.cacheFilePath}") | ||
| 31 | + private String cacheFilePath; | ||
| 32 | + | ||
| 33 | + @PostConstruct | ||
| 34 | + public void instance() | ||
| 35 | + { | ||
| 36 | + cacheManager = CacheManagerBuilder.newCacheManagerBuilder() | ||
| 37 | + .with(CacheManagerBuilder.persistence(new File(cacheFilePath))) | ||
| 38 | + .build(true); | ||
| 39 | + // 指定缓存的存储形式,采用多级缓存,并开启缓存持久化操作 | ||
| 40 | + ResourcePools resourcePools = ResourcePoolsBuilder.newResourcePoolsBuilder() | ||
| 41 | + .heap(1, MemoryUnit.MB) | ||
| 42 | + .disk(2, MemoryUnit.MB, true) | ||
| 43 | + .build(); | ||
| 44 | + // 封装缓存配置对象,指定了键值类型、指定了使用TTL与TTI联合的过期淘汰策略 | ||
| 45 | + CacheConfiguration<String, Object> cacheConfiguration = | ||
| 46 | + CacheConfigurationBuilder.newCacheConfigurationBuilder(String.class, Object.class, resourcePools) | ||
| 47 | + .build(); | ||
| 48 | + // 使用给定的配置参数,创建指定名称的缓存对象 | ||
| 49 | + myCache = cacheManager.createCache(MY_CACHE, cacheConfiguration); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void writeToCache(String key, Object value) { | ||
| 53 | + myCache.put(key, value); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public Object readFromCache(String key) { | ||
| 57 | + return myCache.get(key); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public Object writeToDiske(String key, Object value) { | ||
| 61 | + myCache.put(key, value); | ||
| 62 | + return cacheManager.getCache(MY_CACHE,String.class,Object.class).get(key); // 强制将数据同步到磁盘 | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/service/FileLook.java
已删除
100644 → 0
| 1 | -package com.zhonglai.luhui.smart.feeder.service; | ||
| 2 | - | ||
| 3 | -import com.zhonglai.luhui.smart.feeder.config.OpenCVConfig; | ||
| 4 | -import com.zhonglai.luhui.smart.feeder.draw.FishRegionPanel; | ||
| 5 | -import org.opencv.core.*; | ||
| 6 | -import org.opencv.imgproc.Imgproc; | ||
| 7 | -import org.opencv.videoio.VideoCapture; | ||
| 8 | - | ||
| 9 | -import java.util.ArrayList; | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -public class FileLook { | ||
| 13 | - public static void main(String[] args) { | ||
| 14 | - OpenCVConfig.loadOpenCv(args); | ||
| 15 | - VideoCapture videoCapture = new VideoCapture(); | ||
| 16 | - boolean isopen = videoCapture.open("C:/Users/123/Pictures/1.mp4"); | ||
| 17 | - if(isopen) | ||
| 18 | - { | ||
| 19 | - identifyFishRegionOnWaterSurface(videoCapture); | ||
| 20 | - }else { | ||
| 21 | - System.out.println("无法读取视频帧"); | ||
| 22 | - } | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 先识别水面,然后再在水面区域查找鱼群区域 | ||
| 27 | - */ | ||
| 28 | - private static void identifyFishRegionOnWaterSurface(VideoCapture videoCapture) { | ||
| 29 | - // 读取第一帧并获取视频大小 | ||
| 30 | - Mat previousFrame = new Mat(); | ||
| 31 | - if (!videoCapture.read(previousFrame)) { | ||
| 32 | - System.out.println("无法读取视频帧"); | ||
| 33 | - return; | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - FishRegionPanel fishRegionPanel = new FishRegionPanel(); | ||
| 37 | - | ||
| 38 | - // 转换为灰度图像 | ||
| 39 | - Mat previousGray = new Mat(); | ||
| 40 | - Imgproc.cvtColor(previousFrame, previousGray, Imgproc.COLOR_BGR2GRAY); | ||
| 41 | - | ||
| 42 | - // 识别水面区域 | ||
| 43 | - Rect waterSurfaceRegion = identifyWaterSurface(previousGray); | ||
| 44 | - | ||
| 45 | - // 逐帧处理视频 | ||
| 46 | - Mat frame = new Mat(); | ||
| 47 | - while (videoCapture.read(frame)) { | ||
| 48 | - // 在水面区域查找鱼群区域 | ||
| 49 | - Mat fishRegion = findFishRegion(frame, waterSurfaceRegion); | ||
| 50 | - | ||
| 51 | - // 绘制鱼群变化曲线 | ||
| 52 | -// fishRegionPanel.displayImage(fishRegion); | ||
| 53 | - fishRegionPanel.dispSrcImage(frame); | ||
| 54 | - } | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - private static Rect identifyWaterSurface(Mat grayImage) { | ||
| 58 | - // 进行自适应阈值分割,根据水面的亮度特征,将水面与其他区域分离 | ||
| 59 | - Mat binaryImage = new Mat(); | ||
| 60 | - Imgproc.adaptiveThreshold(grayImage, binaryImage, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 11, 5); | ||
| 61 | - | ||
| 62 | - // 进行形态学操作,去除噪点 | ||
| 63 | - int kernelSize = 5; // 调整内核大小 | ||
| 64 | - Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(kernelSize, kernelSize)); | ||
| 65 | - Imgproc.morphologyEx(binaryImage, binaryImage, Imgproc.MORPH_OPEN, kernel); | ||
| 66 | - | ||
| 67 | - // 查找水面区域的轮廓 | ||
| 68 | - List<MatOfPoint> contours = new ArrayList<>(); | ||
| 69 | - Mat hierarchy = new Mat(); | ||
| 70 | - Imgproc.findContours(binaryImage, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); | ||
| 71 | - | ||
| 72 | - // 获取最大的轮廓区域作为水面区域 | ||
| 73 | - double maxContourArea = -1; | ||
| 74 | - Rect waterSurfaceRegion = null; | ||
| 75 | - for (MatOfPoint contour : contours) { | ||
| 76 | - double contourArea = Imgproc.contourArea(contour); | ||
| 77 | - if (contourArea > maxContourArea) { | ||
| 78 | - waterSurfaceRegion = Imgproc.boundingRect(contour); | ||
| 79 | - maxContourArea = contourArea; | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - return waterSurfaceRegion; | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - private static Mat findFishRegion(Mat frame, Rect waterSurfaceRegion) { | ||
| 88 | - // 在水面区域查找鱼群区域 | ||
| 89 | - Mat fishRegion = frame.submat(waterSurfaceRegion); | ||
| 90 | - | ||
| 91 | - // 绘制绿色线框 | ||
| 92 | - Scalar green = new Scalar(0, 255, 0); // 绿色 | ||
| 93 | - Imgproc.rectangle(frame, waterSurfaceRegion, green, 2); // 绘制矩形框 | ||
| 94 | - | ||
| 95 | - // 转换为灰度图像 | ||
| 96 | - Mat grayImage = new Mat(); | ||
| 97 | - Imgproc.cvtColor(fishRegion, grayImage, Imgproc.COLOR_BGR2GRAY); | ||
| 98 | - | ||
| 99 | - // 进行亮度过滤 | ||
| 100 | - double brightnessThreshold = 100; // 亮度阈值 | ||
| 101 | - Mat binaryImage = new Mat(); | ||
| 102 | - Imgproc.threshold(grayImage, binaryImage, brightnessThreshold, 255, Imgproc.THRESH_BINARY); | ||
| 103 | - | ||
| 104 | - // 进行透明度过滤(如果需要) | ||
| 105 | - // 如果图像中有透明度通道(例如RGBA图像),可以提取透明度通道并进行阈值过滤 | ||
| 106 | - // 如果图像中没有透明度通道,则可以跳过这部分代码 | ||
| 107 | - Mat alphaChannel = new Mat(); | ||
| 108 | - if (fishRegion.channels() == 4) { | ||
| 109 | - Core.extractChannel(fishRegion, alphaChannel, 3); // 提取透明度通道 | ||
| 110 | - double alphaThreshold = 100; // 透明度阈值 | ||
| 111 | - Mat filteredImage = new Mat(); | ||
| 112 | - Imgproc.threshold(alphaChannel, filteredImage, alphaThreshold, 255, Imgproc.THRESH_BINARY); | ||
| 113 | - Core.bitwise_and(binaryImage, filteredImage, binaryImage); // 组合亮度过滤和透明度过滤的结果 | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - // 对二值图像进行形态学操作,去除噪点 | ||
| 117 | - int kernelSize = 3; // 调整内核大小 | ||
| 118 | - Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new org.opencv.core.Size(kernelSize, kernelSize)); | ||
| 119 | - Imgproc.morphologyEx(binaryImage, binaryImage, Imgproc.MORPH_OPEN, kernel); | ||
| 120 | - | ||
| 121 | - // 将二值图像转换回BGR图像 | ||
| 122 | - Mat filteredRegion = new Mat(); | ||
| 123 | - Imgproc.cvtColor(binaryImage, filteredRegion, Imgproc.COLOR_GRAY2BGR); | ||
| 124 | - | ||
| 125 | - return filteredRegion; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | -} |
| 1 | package com.zhonglai.luhui.smart.feeder.service; | 1 | package com.zhonglai.luhui.smart.feeder.service; |
| 2 | 2 | ||
| 3 | -import com.zhonglai.luhui.smart.feeder.config.OpenCVConfig; | ||
| 4 | -import com.zhonglai.luhui.smart.feeder.draw.FishRegionPanel; | ||
| 5 | -import org.opencv.core.*; | ||
| 6 | -import org.opencv.videoio.VideoCapture; | 3 | +import com.zhonglai.luhui.smart.feeder.dto.SysConfig; |
| 4 | +import com.zhonglai.luhui.smart.feeder.dto.VeiwDto; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.dto.VeiwType; | ||
| 6 | +import com.zhonglai.luhui.smart.feeder.opencv.OpenCVUtil; | ||
| 7 | +import com.zhonglai.luhui.smart.feeder.service.impl.HtmllVeiwServiceImpl; | ||
| 8 | +import com.zhonglai.luhui.smart.feeder.service.impl.JFrameVeiwServiceImpl; | ||
| 9 | +import org.opencv.core.Mat; | ||
| 10 | +import org.opencv.core.MatOfPoint; | ||
| 11 | +import org.opencv.core.Scalar; | ||
| 12 | +import org.opencv.core.Size; | ||
| 7 | import org.opencv.imgproc.Imgproc; | 13 | import org.opencv.imgproc.Imgproc; |
| 14 | +import org.opencv.videoio.VideoCapture; | ||
| 15 | +import org.slf4j.Logger; | ||
| 16 | +import org.slf4j.LoggerFactory; | ||
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | +import org.springframework.stereotype.Service; | ||
| 8 | 19 | ||
| 9 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
| 10 | import java.util.Arrays; | 21 | import java.util.Arrays; |
| 11 | -import java.util.Collections; | ||
| 12 | import java.util.List; | 22 | import java.util.List; |
| 23 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 24 | +import java.util.concurrent.TimeUnit; | ||
| 13 | 25 | ||
| 14 | -public class OpenCVService { | ||
| 15 | - /** | ||
| 16 | - * 反光阈值(reflectionThreshold)被设置为100。这意味着所有灰度值低于100的像素都会被设置为0(黑色),灰度值大于或等于100的像素都会被设置为255(白色)。如果你的图像中的对象或区域的灰度值接近或低于这个阈值,它们可能会被排除在二值图像之外。尝试调整这个阈值可能有助于改善结果 | 26 | +/** |
| 27 | + * 鱼群图像识别 | ||
| 17 | */ | 28 | */ |
| 18 | - public static int reflectionThreshold = 100; // 反光阈值 | ||
| 19 | - public static int kernelSize = 3; // 去噪调整内核大小,用来消除小的物体或噪声 | 29 | +@Service |
| 30 | +public class FishGroupImageRecognitionService { | ||
| 31 | + private static final Logger logger = LoggerFactory.getLogger(FishGroupImageRecognitionService.class); | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + private CameraService cameraService; | ||
| 35 | + | ||
| 36 | + private DisplayVeiwService dsplayVeiwService; | ||
| 37 | + | ||
| 38 | + private boolean isRun; | ||
| 20 | 39 | ||
| 21 | - public static void main(String[] args) { | ||
| 22 | - OpenCVConfig.loadOpenCv(args); | ||
| 23 | - readVideoCaptureForVideo("C:/Users/123/Pictures/1.mp4"); | 40 | + @Autowired |
| 41 | + private ScheduledExecutorService scheduledExecutorService; | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + public void start(VeiwType veiwType) | ||
| 45 | + { | ||
| 46 | + isRun = true; | ||
| 47 | + switch (veiwType) | ||
| 48 | + { | ||
| 49 | + case html: | ||
| 50 | + dsplayVeiwService = new HtmllVeiwServiceImpl(); | ||
| 51 | + break; | ||
| 52 | + case jfram: | ||
| 53 | + dsplayVeiwService = new JFrameVeiwServiceImpl(); | ||
| 54 | + break; | ||
| 55 | + default: | ||
| 56 | + dsplayVeiwService = new HtmllVeiwServiceImpl(); | ||
| 57 | + break; | ||
| 58 | + } | ||
| 59 | + VideoCapture videoCapture = cameraService.getVideoCapture(); | ||
| 60 | + brightnessIdentifyFishRegion(videoCapture); | ||
| 24 | } | 61 | } |
| 25 | 62 | ||
| 26 | - public static void readVideoCaptureForVideo(String videoPath) | 63 | + public void stop() |
| 27 | { | 64 | { |
| 28 | - // 创建VideoCapture对象 | ||
| 29 | - VideoCapture videoCapture = new VideoCapture(); | ||
| 30 | - boolean isopen = videoCapture.open(videoPath); | ||
| 31 | - System.out.println(isopen); | ||
| 32 | - // 检查视频是否成功打开 | ||
| 33 | - if (!videoCapture.isOpened()) { | ||
| 34 | - System.out.println("无法打开视频文件"); | ||
| 35 | - return; | 65 | + isRun = false; |
| 66 | + cameraService.close(); | ||
| 36 | } | 67 | } |
| 37 | - brightnessIdentifyFishRegion(videoCapture); | ||
| 38 | 68 | ||
| 39 | - // 释放资源 | ||
| 40 | - videoCapture.release(); | 69 | + /** |
| 70 | + * 获取标准水域轮廓 | ||
| 71 | + * @param previousFrame | ||
| 72 | + * @return | ||
| 73 | + */ | ||
| 74 | + private MatOfPoint getDefaultMatOfPoint(Mat previousFrame) | ||
| 75 | + { | ||
| 76 | + Mat firstBinaryImage = waterBybinary(previousFrame,SysConfig.reflectionThreshold); | ||
| 77 | + // 绘制白色区域的轮廓 | ||
| 78 | + List<MatOfPoint> contours = new ArrayList<>(); | ||
| 79 | + Mat hierarchy = new Mat(); | ||
| 80 | + Imgproc.findContours(firstBinaryImage, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); | ||
| 81 | + // 找到最大区域 | ||
| 82 | + double maxArea = 0; | ||
| 83 | + int maxAreaIndex = -1; | ||
| 84 | + for (int i = 0; i < contours.size(); i++) { | ||
| 85 | + double area = Imgproc.contourArea(contours.get(i)); | ||
| 86 | + if (area > maxArea) { | ||
| 87 | + maxArea = area; | ||
| 88 | + maxAreaIndex = i; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + // 获取最大区域的轮廓 | ||
| 92 | + MatOfPoint largestContour = contours.get(maxAreaIndex); | ||
| 93 | + return largestContour; | ||
| 41 | } | 94 | } |
| 42 | 95 | ||
| 96 | + | ||
| 43 | /** | 97 | /** |
| 44 | * 亮度查找水面,透明度过滤鱼群 | 98 | * 亮度查找水面,透明度过滤鱼群 |
| 45 | */ | 99 | */ |
| 46 | - private static void brightnessIdentifyFishRegion(VideoCapture videoCapture) | 100 | + private void brightnessIdentifyFishRegion(VideoCapture videoCapture ) |
| 47 | { | 101 | { |
| 102 | + logger.info("启动鱼群识别"); | ||
| 48 | // 读取第一帧并获取视频大小 | 103 | // 读取第一帧并获取视频大小 |
| 49 | Mat previousFrame = new Mat(); | 104 | Mat previousFrame = new Mat(); |
| 50 | if (!videoCapture.read(previousFrame)) { | 105 | if (!videoCapture.read(previousFrame)) { |
| 51 | System.out.println("无法读取视频帧"); | 106 | System.out.println("无法读取视频帧"); |
| 52 | return; | 107 | return; |
| 53 | } | 108 | } |
| 109 | + logger.info("鱼群识别时检测摄像头"); | ||
| 54 | // 获取水域轮廓 | 110 | // 获取水域轮廓 |
| 55 | MatOfPoint largestContour = getDefaultMatOfPoint(previousFrame); | 111 | MatOfPoint largestContour = getDefaultMatOfPoint(previousFrame); |
| 56 | 112 | ||
| 57 | - //画板 | ||
| 58 | - FishRegionPanel fishRegionPanel = new FishRegionPanel(); | ||
| 59 | - | ||
| 60 | // 逐帧处理视频 | 113 | // 逐帧处理视频 |
| 61 | Mat frame = new Mat(); | 114 | Mat frame = new Mat(); |
| 62 | - while (videoCapture.read(frame)) { | 115 | + scheduledExecutorService.schedule(() -> { |
| 116 | + while (isRun && videoCapture.read(frame)) { | ||
| 117 | + identify(frame,largestContour); | ||
| 118 | + } | ||
| 119 | + },0, TimeUnit.SECONDS); | ||
| 120 | + | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 识别 | ||
| 126 | + * @param frame | ||
| 127 | + * @param largestContour | ||
| 128 | + */ | ||
| 129 | + private void identify(Mat frame, MatOfPoint largestContour) | ||
| 130 | + { | ||
| 63 | //抠图 | 131 | //抠图 |
| 64 | - Mat shuiyu = matting(frame,largestContour); | 132 | + Mat shuiyu = OpenCVUtil.matting(frame,largestContour); |
| 65 | 133 | ||
| 66 | // 2. 转换为灰度图像 | 134 | // 2. 转换为灰度图像 |
| 67 | Mat gray = new Mat(); | 135 | Mat gray = new Mat(); |
| @@ -86,116 +154,61 @@ public class OpenCVService { | @@ -86,116 +154,61 @@ public class OpenCVService { | ||
| 86 | 154 | ||
| 87 | // 显示图像 | 155 | // 显示图像 |
| 88 | // 在图像上显示结果 | 156 | // 在图像上显示结果 |
| 89 | - fishRegionPanel.displayImage(binaryImage); | ||
| 90 | - fishRegionPanel.dispSrcImage(frame); | ||
| 91 | - // 绘制鱼群变化曲线 | ||
| 92 | - fishRegionPanel.addFishCount(new Double(area).intValue()); | ||
| 93 | - | ||
| 94 | - } | ||
| 95 | - | 157 | + dsplayVeiwService.veiw(new VeiwDto(frame,binaryImage,new Double(area).intValue())); |
| 96 | } | 158 | } |
| 97 | 159 | ||
| 98 | /** | 160 | /** |
| 99 | - * 获取标准水域轮廓 | ||
| 100 | - * @param previousFrame | 161 | + * 计算鱼群面积 |
| 162 | + * @param contours | ||
| 101 | * @return | 163 | * @return |
| 102 | */ | 164 | */ |
| 103 | - private static MatOfPoint getDefaultMatOfPoint(Mat previousFrame) | ||
| 104 | - { | ||
| 105 | - Mat firstBinaryImage = waterBybinary(previousFrame); | ||
| 106 | - // 绘制白色区域的轮廓 | ||
| 107 | - List<MatOfPoint> contours = new ArrayList<>(); | ||
| 108 | - Mat hierarchy = new Mat(); | ||
| 109 | - Imgproc.findContours(firstBinaryImage, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); | 165 | + private double getArea(List<MatOfPoint> contours) { |
| 110 | // 找到最大区域 | 166 | // 找到最大区域 |
| 111 | double maxArea = 0; | 167 | double maxArea = 0; |
| 112 | int maxAreaIndex = -1; | 168 | int maxAreaIndex = -1; |
| 169 | + double allArea = 0; | ||
| 113 | for (int i = 0; i < contours.size(); i++) { | 170 | for (int i = 0; i < contours.size(); i++) { |
| 114 | double area = Imgproc.contourArea(contours.get(i)); | 171 | double area = Imgproc.contourArea(contours.get(i)); |
| 115 | if (area > maxArea) { | 172 | if (area > maxArea) { |
| 116 | maxArea = area; | 173 | maxArea = area; |
| 117 | maxAreaIndex = i; | 174 | maxAreaIndex = i; |
| 118 | } | 175 | } |
| 119 | - } | ||
| 120 | - // 获取最大区域的轮廓 | ||
| 121 | - MatOfPoint largestContour = contours.get(maxAreaIndex); | ||
| 122 | - return largestContour; | 176 | + allArea += area; |
| 123 | } | 177 | } |
| 124 | 178 | ||
| 125 | - private static double getArea(List<MatOfPoint> contours) { | ||
| 126 | - // 找到最大区域 | ||
| 127 | - double maxArea = 0; | ||
| 128 | - int maxAreaIndex = -1; | ||
| 129 | - for (int i = 0; i < contours.size(); i++) { | ||
| 130 | - double area = Imgproc.contourArea(contours.get(i)); | ||
| 131 | - if (area > maxArea) { | ||
| 132 | - maxArea = area; | ||
| 133 | - maxAreaIndex = i; | ||
| 134 | - } | ||
| 135 | - } | 179 | + //删除最大 |
| 136 | if(-1 != maxAreaIndex) | 180 | if(-1 != maxAreaIndex) |
| 137 | { | 181 | { |
| 182 | + double area = Imgproc.contourArea(contours.get(maxAreaIndex)); | ||
| 183 | + maxArea = maxArea-area; | ||
| 184 | + | ||
| 138 | contours.remove(maxAreaIndex); | 185 | contours.remove(maxAreaIndex); |
| 139 | } | 186 | } |
| 187 | + | ||
| 140 | // 返回总面积 | 188 | // 返回总面积 |
| 141 | - return maxArea; | 189 | + return allArea; |
| 142 | } | 190 | } |
| 143 | 191 | ||
| 144 | 192 | ||
| 145 | - private static Mat matting(Mat frame,MatOfPoint largestContour) | ||
| 146 | - { | ||
| 147 | - // 创建一个与原始图像相同大小的新Mat,用于提取图像区域 | ||
| 148 | - Mat extractedRegion = Mat.zeros(frame.size(), frame.type()); | ||
| 149 | - | ||
| 150 | - // 将指定的轮廓绘制到新的Mat上 | ||
| 151 | - Imgproc.drawContours(extractedRegion, Collections.singletonList(largestContour), 0, new Scalar(255, 255, 255), -1); | ||
| 152 | - | ||
| 153 | - // 使用按位与操作提取对应的图像区域 | ||
| 154 | - Mat extractedImage = new Mat(); | ||
| 155 | - Core.bitwise_and(frame, extractedRegion, extractedImage); | ||
| 156 | - | ||
| 157 | - return extractedImage; | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | /** | 193 | /** |
| 161 | * 根据反光查找水面 | 194 | * 根据反光查找水面 |
| 162 | * @param frame | 195 | * @param frame |
| 163 | * @return | 196 | * @return |
| 164 | */ | 197 | */ |
| 165 | - private static Mat waterBybinary(Mat frame) { | 198 | + public static Mat waterBybinary(Mat frame,int reflectionThreshold) { |
| 166 | // 将加载的图像转换为灰度图像,以便进行亮度或反光的分析 | 199 | // 将加载的图像转换为灰度图像,以便进行亮度或反光的分析 |
| 167 | Mat grayImage = new Mat(); | 200 | Mat grayImage = new Mat(); |
| 168 | Imgproc.cvtColor(frame, grayImage, Imgproc.COLOR_BGR2GRAY); | 201 | Imgproc.cvtColor(frame, grayImage, Imgproc.COLOR_BGR2GRAY); |
| 169 | 202 | ||
| 170 | // 检测反光 | 203 | // 检测反光 |
| 171 | Mat binaryImage = new Mat(); | 204 | Mat binaryImage = new Mat(); |
| 172 | - double maxValue = 255; | ||
| 173 | - Imgproc.threshold(grayImage, binaryImage, reflectionThreshold, maxValue, Imgproc.THRESH_BINARY); | 205 | + |
| 206 | + Imgproc.threshold(grayImage, binaryImage, reflectionThreshold, SysConfig.maxValue, Imgproc.THRESH_BINARY); | ||
| 174 | 207 | ||
| 175 | // 进行形态学操作,去除噪点 | 208 | // 进行形态学操作,去除噪点 |
| 176 | - Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(kernelSize, kernelSize)); | 209 | + Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(SysConfig.kernelSize, SysConfig.kernelSize)); |
| 177 | Imgproc.morphologyEx(binaryImage, binaryImage, Imgproc.MORPH_OPEN, kernel); | 210 | Imgproc.morphologyEx(binaryImage, binaryImage, Imgproc.MORPH_OPEN, kernel); |
| 178 | 211 | ||
| 179 | return binaryImage; | 212 | return binaryImage; |
| 180 | } | 213 | } |
| 181 | - | ||
| 182 | - private static List<MatOfPoint> fishByWater(Mat frame) | ||
| 183 | - { | ||
| 184 | - // 2. 转换为灰度图像 | ||
| 185 | - Mat gray = new Mat(); | ||
| 186 | - Imgproc.cvtColor(frame, gray, Imgproc.COLOR_BGR2GRAY); | ||
| 187 | - | ||
| 188 | - // 3. 进行阈值分割以得到二值图像 | ||
| 189 | - Mat binary = new Mat(); | ||
| 190 | - Imgproc.threshold(gray, binary, 100, 255, Imgproc.THRESH_BINARY); | ||
| 191 | - | ||
| 192 | - // 4. 查找轮廓 | ||
| 193 | - List<MatOfPoint> contours = new ArrayList<>(); | ||
| 194 | - Mat hierarchy = new Mat(); | ||
| 195 | - Imgproc.findContours(binary, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE); | ||
| 196 | - | ||
| 197 | - return contours; | ||
| 198 | - | ||
| 199 | - } | ||
| 200 | - | ||
| 201 | } | 214 | } |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/service/WebSocketSever.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.service; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.utils.GsonConstructor; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.config.WebSocketClien; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.dto.WebSocketVO; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.stereotype.Component; | ||
| 9 | + | ||
| 10 | +import javax.websocket.*; | ||
| 11 | +import javax.websocket.server.PathParam; | ||
| 12 | +import javax.websocket.server.ServerEndpoint; | ||
| 13 | +import java.io.IOException; | ||
| 14 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 15 | +import java.util.concurrent.CopyOnWriteArraySet; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 会话连接 | ||
| 19 | + */ | ||
| 20 | +@ServerEndpoint("/websocket/{userId}") | ||
| 21 | +@Component | ||
| 22 | +public class WebSocketSever { | ||
| 23 | + private static final Logger log = LoggerFactory.getLogger(WebSocketSever.class); | ||
| 24 | + | ||
| 25 | + // 与某个客户端的连接会话,需要通过它来给客户端发送数据 | ||
| 26 | + private Session session; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 建立WebSocket连接 | ||
| 30 | + * | ||
| 31 | + * @param session | ||
| 32 | + * @param userId 用户ID | ||
| 33 | + */ | ||
| 34 | + @OnOpen | ||
| 35 | + public void onOpen(Session session, @PathParam(value = "userId") Integer userId) { | ||
| 36 | + log.info("WebSocket建立连接中,连接用户ID:{}", userId); | ||
| 37 | + WebSocketClien.login(userId); | ||
| 38 | + // 建立连接 | ||
| 39 | + this.session = session; | ||
| 40 | + WebSocketClien.webSocketSet.add(this); | ||
| 41 | + WebSocketClien.sessionPool.put(userId, session); | ||
| 42 | + log.info("建立连接完成,当前在线人数为:{}", WebSocketClien.webSocketSet.size()); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 发生错误 | ||
| 47 | + * | ||
| 48 | + * @param throwable e | ||
| 49 | + */ | ||
| 50 | + @OnError | ||
| 51 | + public void onError(Throwable throwable) { | ||
| 52 | + throwable.printStackTrace(); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 连接关闭 | ||
| 57 | + */ | ||
| 58 | + @OnClose | ||
| 59 | + public void onClose() { | ||
| 60 | + WebSocketClien.webSocketSet.remove(this); | ||
| 61 | + log.info("连接断开,当前在线人数为:{}", WebSocketClien.webSocketSet.size()); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 接收客户端消息 | ||
| 66 | + * | ||
| 67 | + * @param message 接收的消息 | ||
| 68 | + */ | ||
| 69 | + @OnMessage | ||
| 70 | + public void onMessage(String message) { | ||
| 71 | + log.info("收到客户端发来的消息:{}", message); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * 推送消息到指定用户 | ||
| 76 | + * | ||
| 77 | + * @param userId 用户ID | ||
| 78 | + * @param message 发送的消息 | ||
| 79 | + */ | ||
| 80 | + public void sendMessageByUser(Integer userId, String message) { | ||
| 81 | + log.info("用户ID:" + userId + ",推送内容:" + message); | ||
| 82 | + try { | ||
| 83 | + session.getBasicRemote().sendText(message); | ||
| 84 | + } catch (IOException e) { | ||
| 85 | + log.error("推送消息到指定用户发生错误:" + e.getMessage(), e); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 推送消息到指定用户 | ||
| 91 | + * | ||
| 92 | + * @param webSocketVO 用户ID | ||
| 93 | + */ | ||
| 94 | + public void sendWebSocketVO(WebSocketVO webSocketVO) { | ||
| 95 | + try { | ||
| 96 | + session.getBasicRemote().sendText(GsonConstructor.get().toJson(webSocketVO)); | ||
| 97 | + } catch (IOException e) { | ||
| 98 | + log.error("推送消息到指定用户发生错误:" + e.getMessage(), e); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + /** | ||
| 102 | + * 群发消息 | ||
| 103 | + * | ||
| 104 | + * @param message 发送的消息 | ||
| 105 | + */ | ||
| 106 | + public void sendAllMessage(String message) { | ||
| 107 | + log.info("发送消息:{}", message); | ||
| 108 | + for (WebSocketSever webSocket : WebSocketClien.webSocketSet) { | ||
| 109 | + try { | ||
| 110 | + webSocket.session.getBasicRemote().sendText(message); | ||
| 111 | + } catch (IOException e) { | ||
| 112 | + log.error("群发消息发生错误:" + e.getMessage(), e); | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | +} |
| 1 | +package com.zhonglai.luhui.smart.feeder.service.impl; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.utils.sign.Base64; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.config.WebSocketClien; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.dto.VeiwDto; | ||
| 6 | +import com.zhonglai.luhui.smart.feeder.dto.WebSocketVO; | ||
| 7 | +import com.zhonglai.luhui.smart.feeder.service.DisplayVeiwService; | ||
| 8 | +import com.zhonglai.luhui.smart.feeder.service.WebSocketSever; | ||
| 9 | +import org.apache.commons.lang3.ArrayUtils; | ||
| 10 | +import org.opencv.core.Mat; | ||
| 11 | +import org.opencv.core.MatOfByte; | ||
| 12 | +import org.opencv.imgcodecs.Imgcodecs; | ||
| 13 | + | ||
| 14 | +import javax.imageio.ImageIO; | ||
| 15 | +import java.awt.image.BufferedImage; | ||
| 16 | +import java.io.ByteArrayInputStream; | ||
| 17 | +import java.io.ByteArrayOutputStream; | ||
| 18 | +import java.io.IOException; | ||
| 19 | +import java.io.InputStream; | ||
| 20 | + | ||
| 21 | +public class HtmllVeiwServiceImpl implements DisplayVeiwService { | ||
| 22 | + | ||
| 23 | + private boolean isRun; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Mat转换成BufferedImage | ||
| 27 | + * | ||
| 28 | + * @param matrix 要转换的Mat | ||
| 29 | + * @param fileExtension 格式为 ".jpg", ".png", etc | ||
| 30 | + * @return | ||
| 31 | + */ | ||
| 32 | + public BufferedImage mat2BufImg(Mat matrix, String fileExtension) { | ||
| 33 | + // convert the matrix into a matrix of bytes appropriate for | ||
| 34 | + // this file extension | ||
| 35 | + MatOfByte mob = new MatOfByte(); | ||
| 36 | + Imgcodecs.imencode("."+fileExtension, matrix, mob); | ||
| 37 | + // convert the "matrix of bytes" into a byte array | ||
| 38 | + byte[] byteArray = mob.toArray(); | ||
| 39 | + BufferedImage bufImage = null; | ||
| 40 | + try { | ||
| 41 | + InputStream in = new ByteArrayInputStream(byteArray); | ||
| 42 | + bufImage = ImageIO.read(in); | ||
| 43 | + in.close(); | ||
| 44 | + } catch (Exception e) { | ||
| 45 | + e.printStackTrace(); | ||
| 46 | + } | ||
| 47 | + return bufImage; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * Converts/writes a Mat into a BufferedImage. | ||
| 53 | + * | ||
| 54 | + * @param matrix Mat of type CV_8UC3 or CV_8UC1 | ||
| 55 | + * @return BufferedImage of type TYPE_3BYTE_BGR or TYPE_BYTE_GRAY | ||
| 56 | + */ | ||
| 57 | + public BufferedImage matToBufferedImage(Mat matrix, BufferedImage bimg) | ||
| 58 | + { | ||
| 59 | + if ( matrix != null ) { | ||
| 60 | + int cols = matrix.cols(); | ||
| 61 | + int rows = matrix.rows(); | ||
| 62 | + int elemSize = (int)matrix.elemSize(); | ||
| 63 | + byte[] data = new byte[cols * rows * elemSize]; | ||
| 64 | + int type; | ||
| 65 | + matrix.get(0, 0, data); | ||
| 66 | + switch (matrix.channels()) { | ||
| 67 | + case 1: | ||
| 68 | + type = BufferedImage.TYPE_BYTE_GRAY; | ||
| 69 | + break; | ||
| 70 | + case 3: | ||
| 71 | + type = BufferedImage.TYPE_3BYTE_BGR; | ||
| 72 | + // bgr to rgb | ||
| 73 | + byte b; | ||
| 74 | + for(int i=0; i<data.length; i=i+3) { | ||
| 75 | + b = data[i]; | ||
| 76 | + data[i] = data[i+2]; | ||
| 77 | + data[i+2] = b; | ||
| 78 | + } | ||
| 79 | + break; | ||
| 80 | + default: | ||
| 81 | + return null; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + // Reuse existing BufferedImage if possible | ||
| 85 | + if (bimg == null || bimg.getWidth() != cols || bimg.getHeight() != rows || bimg.getType() != type) { | ||
| 86 | + bimg = new BufferedImage(cols, rows, type); | ||
| 87 | + } | ||
| 88 | + bimg.getRaster().setDataElements(0, 0, cols, rows, data); | ||
| 89 | + } else { // mat was null | ||
| 90 | + bimg = null; | ||
| 91 | + } | ||
| 92 | + return bimg; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * Mat转换成String | ||
| 97 | + * @param frame 要转换的Mat | ||
| 98 | + * @param fileExtension 格式为 ".jpg", ".png", etc | ||
| 99 | + * @return | ||
| 100 | + * @throws IOException | ||
| 101 | + */ | ||
| 102 | + public String matToString(Mat frame, String fileExtension) throws IOException { | ||
| 103 | + BufferedImage bufferedImage = mat2BufImg(frame, fileExtension); | ||
| 104 | + | ||
| 105 | + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | ||
| 106 | + boolean result = ImageIO.write(bufferedImage,fileExtension,outputStream); | ||
| 107 | + if (!result) { | ||
| 108 | + System.out.println("Writing image failed"); | ||
| 109 | + return null; | ||
| 110 | + } | ||
| 111 | + outputStream.flush(); | ||
| 112 | + | ||
| 113 | + byte[] bytes = outputStream.toByteArray(); | ||
| 114 | + outputStream.close(); | ||
| 115 | + if(ArrayUtils.isNotEmpty(bytes)) | ||
| 116 | + { | ||
| 117 | + String base64Img = Base64.encode(bytes); | ||
| 118 | + return base64Img; | ||
| 119 | + } | ||
| 120 | + return null; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @Override | ||
| 124 | + public void veiw(VeiwDto veiwDto) { | ||
| 125 | + try { | ||
| 126 | + String str = matToString(veiwDto.getFrame(),"jpg"); | ||
| 127 | + WebSocketVO webSocketVO = new WebSocketVO(); | ||
| 128 | + webSocketVO.setImg(str); | ||
| 129 | + webSocketVO.setSize(veiwDto.getSize()); | ||
| 130 | + for (WebSocketSever webSocketSever:WebSocketClien.webSocketSet) | ||
| 131 | + { | ||
| 132 | + webSocketSever.sendWebSocketVO(webSocketVO); | ||
| 133 | + } | ||
| 134 | + } catch (IOException e) { | ||
| 135 | + throw new RuntimeException(e); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + } | ||
| 139 | +} |
| 1 | +package com.zhonglai.luhui.smart.feeder.service.impl; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.smart.feeder.draw.FishRegionPanel; | ||
| 4 | +import com.zhonglai.luhui.smart.feeder.dto.VeiwDto; | ||
| 5 | +import com.zhonglai.luhui.smart.feeder.service.DisplayVeiwService; | ||
| 6 | +import com.zhonglai.luhui.smart.feeder.util.OpenCVUtils; | ||
| 7 | +import org.opencv.core.Mat; | ||
| 8 | + | ||
| 9 | +import javax.swing.*; | ||
| 10 | +import java.awt.*; | ||
| 11 | +import java.awt.image.BufferedImage; | ||
| 12 | + | ||
| 13 | +public class JFrameVeiwServiceImpl implements DisplayVeiwService { | ||
| 14 | + private static FishRegionPanel fishRegionPanel; | ||
| 15 | + | ||
| 16 | + public JFrameVeiwServiceImpl() | ||
| 17 | + { | ||
| 18 | + if(null == fishRegionPanel) | ||
| 19 | + { | ||
| 20 | + fishRegionPanel = new FishRegionPanel(); | ||
| 21 | + } | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + private Image convertMatToImage(Mat mat) { | ||
| 25 | + BufferedImage bufferedImage = OpenCVUtils.matToBufferedImage(mat); | ||
| 26 | + return bufferedImage.getScaledInstance(300, 300, Image.SCALE_SMOOTH); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public void veiw(VeiwDto veiwDto) { | ||
| 31 | + if(null != veiwDto.getBinaryImage()) | ||
| 32 | + { | ||
| 33 | + fishRegionPanel.getLblImage().setIcon(new ImageIcon(convertMatToImage(veiwDto.getBinaryImage()))); | ||
| 34 | + } | ||
| 35 | + if(null != veiwDto.getFrame()) | ||
| 36 | + { | ||
| 37 | + fishRegionPanel.getSrcImage().setIcon(new ImageIcon(convertMatToImage(veiwDto.getFrame()))); | ||
| 38 | + } | ||
| 39 | + if(null != veiwDto.getSize()) | ||
| 40 | + { | ||
| 41 | + fishRegionPanel.getPnlGraph().getFishCountList().add(veiwDto.getSize()); | ||
| 42 | + fishRegionPanel.getPnlGraph().repaint(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + fishRegionPanel.getFrame().repaint(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | +} |
| 1 | +package com.zhonglai.luhui.smart.feeder.util.serial; | ||
| 2 | + | ||
| 3 | +import purejavacomm.SerialPort; | ||
| 4 | + | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +public class GlobalCache { | ||
| 9 | + public static Map<String,Boolean> bmap = new HashMap<>(); | ||
| 10 | + public static Map<String, byte[]> dmap = new HashMap<>(); | ||
| 11 | + | ||
| 12 | + public static Map<String, SerialPort> smap = new HashMap<>(); | ||
| 13 | +} |
| 1 | +package com.zhonglai.luhui.smart.feeder.util.serial; | ||
| 2 | + | ||
| 3 | +import org.slf4j.Logger; | ||
| 4 | +import org.slf4j.LoggerFactory; | ||
| 5 | +import purejavacomm.SerialPort; | ||
| 6 | +import purejavacomm.SerialPortEvent; | ||
| 7 | +import purejavacomm.SerialPortEventListener; | ||
| 8 | + | ||
| 9 | +import java.io.IOException; | ||
| 10 | + | ||
| 11 | +public class SerialResquest { | ||
| 12 | + private static Logger logger = LoggerFactory.getLogger(SerialResquest.class); | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + public static void resquest(String portName, Integer baudrate, Integer dataBits, Integer stopBits, | ||
| 16 | + Integer parity,byte[] data) throws Exception { | ||
| 17 | + SerialPort serialPort; | ||
| 18 | + if (!GlobalCache.smap.containsKey(portName)) { | ||
| 19 | + GlobalCache.bmap.put(portName, false); | ||
| 20 | + serialPort = SerialTool.openPort(portName, baudrate, dataBits, stopBits, parity); | ||
| 21 | + GlobalCache.smap.put(portName, serialPort); | ||
| 22 | + SerialTool.addListener(new SerialPortEventListener() { | ||
| 23 | + | ||
| 24 | + @Override | ||
| 25 | + public void serialEvent(SerialPortEvent event) { | ||
| 26 | + try { | ||
| 27 | + Thread.sleep(50); | ||
| 28 | + } catch (InterruptedException e1) { | ||
| 29 | + logger.error("SerialResquest 监听异常!"+e1); | ||
| 30 | + } | ||
| 31 | + switch (event.getEventType()) { | ||
| 32 | + case SerialPortEvent.DATA_AVAILABLE: | ||
| 33 | + byte[] readBuffer = null; | ||
| 34 | + int availableBytes = 0; | ||
| 35 | + try { | ||
| 36 | + availableBytes = serialPort.getInputStream().available(); | ||
| 37 | + if (availableBytes > 0) { | ||
| 38 | + try { | ||
| 39 | + readBuffer = SerialTool.readFromPort(serialPort); | ||
| 40 | + GlobalCache.bmap.put(portName, true); | ||
| 41 | + GlobalCache.dmap.put(portName, readBuffer); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + logger.error("读取推送信息异常!"+e); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } catch (IOException e) { | ||
| 47 | + logger.error("读取流信息异常!"+e); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + }, serialPort); | ||
| 53 | + }else { | ||
| 54 | + serialPort = GlobalCache.smap.get(portName); | ||
| 55 | + } | ||
| 56 | + SerialTool.sendToPort(data, serialPort); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public static byte[] response(String portName) throws InterruptedException { | ||
| 60 | + /*if (!GlobalCache.dmap.containsKey(portName)) { | ||
| 61 | + return null; | ||
| 62 | + }*/ | ||
| 63 | + Thread.sleep(100); | ||
| 64 | + int i =0; | ||
| 65 | + while (!GlobalCache.bmap.get(portName)) { | ||
| 66 | + Thread.sleep(100); | ||
| 67 | + if (i++>30) { | ||
| 68 | + return new byte[0]; | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + GlobalCache.bmap.put(portName, false); | ||
| 72 | + return GlobalCache.dmap.get(portName); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public static void close(String portName) throws IOException { | ||
| 76 | + SerialTool.closePort(GlobalCache.smap.get(portName)); | ||
| 77 | + GlobalCache.smap.remove(portName); | ||
| 78 | + } | ||
| 79 | +} |
lh-modules/lh-smart-feeder/src/main/java/com/zhonglai/luhui/smart/feeder/util/serial/SerialTool.java
0 → 100644
| 1 | +package com.zhonglai.luhui.smart.feeder.util.serial; | ||
| 2 | + | ||
| 3 | +import java.io.IOException; | ||
| 4 | +import java.io.InputStream; | ||
| 5 | +import java.io.OutputStream; | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.Enumeration; | ||
| 8 | +import java.util.TooManyListenersException; | ||
| 9 | + | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | + | ||
| 13 | +import purejavacomm.CommPort; | ||
| 14 | +import purejavacomm.CommPortIdentifier; | ||
| 15 | +import purejavacomm.NoSuchPortException; | ||
| 16 | +import purejavacomm.PortInUseException; | ||
| 17 | +import purejavacomm.SerialPort; | ||
| 18 | +import purejavacomm.SerialPortEventListener; | ||
| 19 | +import purejavacomm.UnsupportedCommOperationException; | ||
| 20 | + | ||
| 21 | +public class SerialTool { | ||
| 22 | + private static Logger logger = LoggerFactory.getLogger(SerialTool.class); | ||
| 23 | + | ||
| 24 | + public static final ArrayList<String> findPorts() { | ||
| 25 | + // 获得当前所有可用串口 | ||
| 26 | + Enumeration<CommPortIdentifier> portList = CommPortIdentifier.getPortIdentifiers(); | ||
| 27 | + ArrayList<String> portNameList = new ArrayList<String>(); | ||
| 28 | + // 将可用串口名添加到List并返回该List | ||
| 29 | + while (portList.hasMoreElements()) { | ||
| 30 | + String portName = portList.nextElement().getName(); | ||
| 31 | + portNameList.add(portName); | ||
| 32 | + } | ||
| 33 | + return portNameList; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 打开串口 | ||
| 38 | + * | ||
| 39 | + * @param portName | ||
| 40 | + * 端口名称 | ||
| 41 | + * @param baudrate | ||
| 42 | + * 波特率 | ||
| 43 | + * @return 串口对象 | ||
| 44 | + * @throws Exception | ||
| 45 | +// * @throws SerialPortParameterFailure | ||
| 46 | +// * 设置串口参数失败 | ||
| 47 | +// * @throws NotASerialPort | ||
| 48 | +// * 端口指向设备不是串口类型 | ||
| 49 | +// * @throws NoSuchPort | ||
| 50 | +// * 没有该端口对应的串口设备 | ||
| 51 | +// * @throws PortInUse | ||
| 52 | +// * 端口已被占用 | ||
| 53 | + */ | ||
| 54 | + public static SerialPort openPort(String portName, Integer baudrate, Integer dataBits, Integer stopBits, | ||
| 55 | + Integer parity) throws Exception { | ||
| 56 | + | ||
| 57 | + try { | ||
| 58 | + | ||
| 59 | + // 通过端口名识别端口 | ||
| 60 | + CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); | ||
| 61 | + | ||
| 62 | + // 打开端口,并给端口名字和一个timeout(打开操作的超时时间) | ||
| 63 | + CommPort commPort = portIdentifier.open(portName, 2000); | ||
| 64 | + | ||
| 65 | + // 判断是不是串口 | ||
| 66 | + if (commPort instanceof SerialPort) { | ||
| 67 | + SerialPort serialPort = (SerialPort) commPort; | ||
| 68 | + try { | ||
| 69 | + // 设置一下串口的波特率等参数 | ||
| 70 | + serialPort.setSerialPortParams(baudrate, dataBits, stopBits, parity); | ||
| 71 | + logger.info("串口" + portName + "打开成功"); | ||
| 72 | + } catch (UnsupportedCommOperationException e) { | ||
| 73 | + logger.error("设置串口" + portName + "参数失败:" + e.getMessage()); | ||
| 74 | + throw e; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + return serialPort; | ||
| 78 | + | ||
| 79 | + } else { | ||
| 80 | + logger.error("不是串口" + portName); | ||
| 81 | + // 不是串口 | ||
| 82 | + throw new Exception(); | ||
| 83 | + } | ||
| 84 | + } catch (NoSuchPortException e1) { | ||
| 85 | + logger.error("无此串口" + portName); | ||
| 86 | + throw e1; | ||
| 87 | + } catch (PortInUseException e2) { | ||
| 88 | + logger.error("串口使用中" + portName); | ||
| 89 | + throw e2; | ||
| 90 | + } catch (Exception e) { | ||
| 91 | + throw e; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * 将字节数组转换为16进制字符串,并在每个字符之间用空格分隔 | ||
| 97 | + * @param byteArray | ||
| 98 | + * @return | ||
| 99 | + */ | ||
| 100 | + public static String bytesToHexString(byte[] byteArray) { | ||
| 101 | + StringBuilder sb = new StringBuilder(); | ||
| 102 | + for (byte b : byteArray) { | ||
| 103 | + // 将每个字节转换为两位的16进制字符串 | ||
| 104 | + String hex = String.format("%02X", b); | ||
| 105 | + sb.append(hex); | ||
| 106 | + | ||
| 107 | + // 在每个字符之间添加空格 | ||
| 108 | + sb.append(" "); | ||
| 109 | + } | ||
| 110 | + // 删除最后一个空格 | ||
| 111 | + sb.deleteCharAt(sb.length() - 1); | ||
| 112 | + return sb.toString(); | ||
| 113 | + } | ||
| 114 | + public static byte[] HexString2Bytes(String src) { | ||
| 115 | + if (null == src || 0 == src.length()) { | ||
| 116 | + return null; | ||
| 117 | + } | ||
| 118 | + byte[] ret = new byte[src.length() / 2]; | ||
| 119 | + byte[] tmp = src.getBytes(); | ||
| 120 | + for (int i = 0; i < (tmp.length / 2); i++) { | ||
| 121 | + ret[i] = uniteBytes(tmp[i * 2], tmp[i * 2 + 1]); | ||
| 122 | + } | ||
| 123 | + return ret; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + // byte类型数据,转成十六进制形式; | ||
| 127 | + public static byte uniteBytes(byte src0, byte src1) { | ||
| 128 | + byte _b0 = Byte.decode("0x" + new String(new byte[] { src0 })).byteValue(); | ||
| 129 | + _b0 = (byte) (_b0 << 4); | ||
| 130 | + byte _b1 = Byte.decode("0x" + new String(new byte[] { src1 })).byteValue(); | ||
| 131 | + byte ret = (byte) (_b0 ^ _b1); | ||
| 132 | + return ret; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 关闭串口 | ||
| 137 | + * | ||
| 138 | + * @throws IOException | ||
| 139 | + */ | ||
| 140 | + public static synchronized void closePort(SerialPort serialPort) throws IOException { | ||
| 141 | + if (serialPort != null) { | ||
| 142 | + serialPort.close(); | ||
| 143 | + logger.info("串口" + serialPort.getName() + "已关闭"); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * 往串口发送数据 | ||
| 149 | + * | ||
| 150 | + * @param order | ||
| 151 | + * 待发送数据 | ||
| 152 | +// * @throws SendDataToSerialPortFailure | ||
| 153 | +// * 向串口发送数据失败 | ||
| 154 | +// * @throws SerialPortOutputStreamCloseFailure | ||
| 155 | +// * 关闭串口对象的输出流出错 | ||
| 156 | + */ | ||
| 157 | + public static void sendToPort(byte[] order, SerialPort serialPort) throws IOException { | ||
| 158 | + | ||
| 159 | + OutputStream out = null; | ||
| 160 | + | ||
| 161 | + try { | ||
| 162 | + | ||
| 163 | + out = serialPort.getOutputStream(); | ||
| 164 | + out.write(order); | ||
| 165 | + out.flush(); | ||
| 166 | + logger.info("发送数据成功" + serialPort.getName()); | ||
| 167 | + } catch (IOException e) { | ||
| 168 | + logger.error("发送数据失败" + serialPort.getName()); | ||
| 169 | + throw e; | ||
| 170 | + } finally { | ||
| 171 | + try { | ||
| 172 | + if (out != null) { | ||
| 173 | + out.close(); | ||
| 174 | + out = null; | ||
| 175 | + } | ||
| 176 | + } catch (IOException e) { | ||
| 177 | + logger.error("关闭串口对象的输出流出错"); | ||
| 178 | + throw e; | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + /** | ||
| 185 | + * 从串口读取数据 | ||
| 186 | + * | ||
| 187 | + * @param serialPort | ||
| 188 | + * 当前已建立连接的SerialPort对象 | ||
| 189 | + * @return 读取到的数据 | ||
| 190 | +// * @throws ReadDataFromSerialPortFailure | ||
| 191 | +// * 从串口读取数据时出错 | ||
| 192 | +// * @throws SerialPortInputStreamCloseFailure | ||
| 193 | +// * 关闭串口对象输入流出错 | ||
| 194 | + */ | ||
| 195 | + public static byte[] readFromPort(SerialPort serialPort) throws Exception { | ||
| 196 | + | ||
| 197 | + InputStream in = null; | ||
| 198 | + byte[] bytes = null; | ||
| 199 | + | ||
| 200 | + try { | ||
| 201 | + if (serialPort != null) { | ||
| 202 | + in = serialPort.getInputStream(); | ||
| 203 | + } else { | ||
| 204 | + return null; | ||
| 205 | + } | ||
| 206 | + int bufflenth = in.available(); // 获取buffer里的数据长度 | ||
| 207 | + while (bufflenth != 0) { | ||
| 208 | + bytes = new byte[bufflenth]; // 初始化byte数组为buffer中数据的长度 | ||
| 209 | + in.read(bytes); | ||
| 210 | + bufflenth = in.available(); | ||
| 211 | + } | ||
| 212 | + } catch (Exception e) { | ||
| 213 | + throw e; | ||
| 214 | + } finally { | ||
| 215 | + try { | ||
| 216 | + if (in != null) { | ||
| 217 | + in.close(); | ||
| 218 | + in = null; | ||
| 219 | + } | ||
| 220 | + } catch (IOException e) { | ||
| 221 | + throw e; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + return bytes; | ||
| 227 | + | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + /** | ||
| 231 | + * 添加监听器 | ||
| 232 | + * | ||
| 233 | +// * @param port | ||
| 234 | +// * 串口对象 | ||
| 235 | + * @param listener | ||
| 236 | + * 串口监听器 | ||
| 237 | +// * @throws TooManyListeners | ||
| 238 | +// * 监听类对象过多 | ||
| 239 | + */ | ||
| 240 | + public static void addListener(SerialPortEventListener listener, SerialPort serialPort) throws TooManyListenersException { | ||
| 241 | + | ||
| 242 | + try { | ||
| 243 | + | ||
| 244 | + // 给串口添加监听器 | ||
| 245 | + serialPort.addEventListener(listener); | ||
| 246 | + // 设置当有数据到达时唤醒监听接收线程 | ||
| 247 | + serialPort.notifyOnDataAvailable(true); | ||
| 248 | + // 设置当通信中断时唤醒中断线程 | ||
| 249 | + serialPort.notifyOnBreakInterrupt(true); | ||
| 250 | + | ||
| 251 | + } catch (TooManyListenersException e) { | ||
| 252 | + throw e; | ||
| 253 | + } | ||
| 254 | + } | ||
| 255 | +} |
| 1 | -# 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8064 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* | ||
| 1 | +# 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 8064 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* sys: staticPath: "file:E:/work/idea/Luhui/lh-modules/lh-smart-feeder/src/main/resources/static/" cacheFilePath: "E:/work/idea/Luhui/lh-modules/lh-smart-feeder/cache/" |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<assembly> | ||
| 4 | + <id>bin</id> | ||
| 5 | + <!-- 最终打包成一个用于发布的zip文件 --> | ||
| 6 | + <formats> | ||
| 7 | + <format>zip</format> | ||
| 8 | + </formats> | ||
| 9 | + | ||
| 10 | + <!-- Adds dependencies to zip package under lib directory --> | ||
| 11 | + <dependencySets> | ||
| 12 | + <dependencySet> | ||
| 13 | + <!-- | ||
| 14 | + 不使用项目的artifact,第三方jar不要解压,打包进zip文件的lib目录 | ||
| 15 | + --> | ||
| 16 | + <useProjectArtifact>false</useProjectArtifact> | ||
| 17 | + <outputDirectory>lib</outputDirectory> | ||
| 18 | + <unpack>false</unpack> | ||
| 19 | + </dependencySet> | ||
| 20 | + </dependencySets> | ||
| 21 | + | ||
| 22 | + <fileSets> | ||
| 23 | + <!-- 把项目相关的说明文件,打包进zip文件的根目录 --> | ||
| 24 | + <fileSet> | ||
| 25 | + <directory>${project.basedir}</directory> | ||
| 26 | + <outputDirectory>/</outputDirectory> | ||
| 27 | + <includes> | ||
| 28 | + <include>README*</include> | ||
| 29 | + <include>LICENSE*</include> | ||
| 30 | + <include>NOTICE*</include> | ||
| 31 | + </includes> | ||
| 32 | + </fileSet> | ||
| 33 | + | ||
| 34 | + <!-- 把项目的配置文件,打包进zip文件的config目录 --> | ||
| 35 | + <fileSet> | ||
| 36 | + <directory>${project.basedir}\src\main\resources\configs</directory> | ||
| 37 | + <outputDirectory>../configs</outputDirectory> | ||
| 38 | + <includes> | ||
| 39 | + <include>*.properties</include> | ||
| 40 | + </includes> | ||
| 41 | + </fileSet> | ||
| 42 | + | ||
| 43 | + <!-- 把项目的配置文件,提出来 --> | ||
| 44 | + <fileSet> | ||
| 45 | + <directory>${project.basedir}\src\main\resources</directory> | ||
| 46 | + <outputDirectory>/</outputDirectory> | ||
| 47 | + <includes> | ||
| 48 | + <include>*.properties</include> | ||
| 49 | + <include>*.yml</include> | ||
| 50 | + </includes> | ||
| 51 | + </fileSet> | ||
| 52 | + | ||
| 53 | + <!-- 把项目的脚本文件目录( src/main/scripts )中的启动脚本文件,打包进zip文件的跟目录 --> | ||
| 54 | + <fileSet> | ||
| 55 | + <directory>${project.basedir}\bin</directory> | ||
| 56 | + <outputDirectory></outputDirectory> | ||
| 57 | + <includes> | ||
| 58 | + <include>start.*</include> | ||
| 59 | + <include>stop.*</include> | ||
| 60 | + </includes> | ||
| 61 | + </fileSet> | ||
| 62 | + | ||
| 63 | + <!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 --> | ||
| 64 | + <fileSet> | ||
| 65 | + <directory>${project.build.directory}</directory> | ||
| 66 | + <outputDirectory></outputDirectory> | ||
| 67 | + <includes> | ||
| 68 | + <include>*.jar</include> | ||
| 69 | + </includes> | ||
| 70 | + </fileSet> | ||
| 71 | + </fileSets> | ||
| 72 | +</assembly> |
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html lang="en"> | ||
| 3 | +<head> | ||
| 4 | + <meta charset="UTF-8"> | ||
| 5 | + <title>Title</title> | ||
| 6 | +</head> | ||
| 7 | +<body> | ||
| 8 | +<div> | ||
| 9 | + <div>消息: <span id="result"></span></div> | ||
| 10 | + | ||
| 11 | + <div><input type="number" id="maxSize"/><button onclick="setMaxSize()">改变曲线最大点数</button></div> | ||
| 12 | + <div><button onclick="lianjie()">连接服务</button></div> | ||
| 13 | + <div><input type="number" id="number"/><button onclick="setCameraNumber()">设置摄像头编号</button></div> | ||
| 14 | + <div><button onclick="openMedia()">开启摄像头</button></div> | ||
| 15 | + <div><button onclick="clean()">清空曲线</button></div> | ||
| 16 | + <div><button onclick="closeMedia()">停止摄像头</button></div> | ||
| 17 | + <div> | ||
| 18 | + <img id="showVideo" width="500" height="390" src="" style="display: none;"/> | ||
| 19 | + <canvas id="myCanvas" width="500" height="390" style="border:3px double #996633;"/> | ||
| 20 | + </div> | ||
| 21 | +</div> | ||
| 22 | +</body> | ||
| 23 | + | ||
| 24 | +<script src="js/jquery.min.js"></script> | ||
| 25 | +<script src="js/common.js"></script> | ||
| 26 | +<script> | ||
| 27 | + var userId = Math.round(Math.random()*100); | ||
| 28 | + var url=""; | ||
| 29 | + var fishCountList = []; | ||
| 30 | + | ||
| 31 | + var maxSize = 60; | ||
| 32 | + | ||
| 33 | + var ws1; | ||
| 34 | + | ||
| 35 | + function setMaxSize(){ | ||
| 36 | + maxSize = $("#maxSize").val(); | ||
| 37 | + fishCountList = []; | ||
| 38 | + } | ||
| 39 | + function lianjie(){ | ||
| 40 | + $("#showVideo").show(); | ||
| 41 | + var wsUrl = "ws://127.0.0.1:8064/websocket/"+userId; | ||
| 42 | + ws1 = new WebSocket(wsUrl); | ||
| 43 | + ws1.onopen = function (){ | ||
| 44 | + $("#result").textContent = "服务已连接"; | ||
| 45 | + } | ||
| 46 | + ws1.onmessage = function(message){ | ||
| 47 | + console.log(message); | ||
| 48 | + var data = JSON.parse(message.data); | ||
| 49 | + $("#showVideo").attr("src", "data:image/jpg;base64," + data.img); | ||
| 50 | + | ||
| 51 | + addData(data.size); | ||
| 52 | + drawChart(); | ||
| 53 | + } | ||
| 54 | + ws1.onclose = function (o) { | ||
| 55 | + $("#result").textContent = "服务断开"; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + function setCameraNumber() | ||
| 60 | + { | ||
| 61 | + var number = $("#number").val(); | ||
| 62 | + $.ajax({ | ||
| 63 | + type: "GET", | ||
| 64 | + url: url + "/camera/setNumber/"+number, | ||
| 65 | + }); | ||
| 66 | + } | ||
| 67 | + function openMedia(){ | ||
| 68 | + $.ajax({ | ||
| 69 | + type: "GET", | ||
| 70 | + url: url + "/camera/open", | ||
| 71 | + async: false | ||
| 72 | + }); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + function closeMedia(){ | ||
| 76 | + $.ajax({ | ||
| 77 | + type: "GET", | ||
| 78 | + url: url + "/camera/close", | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + function clean(){ | ||
| 83 | + fishCountList = []; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + function drawChart() { | ||
| 87 | + var canvas = document.getElementById("myCanvas"); | ||
| 88 | + var context = canvas.getContext("2d"); | ||
| 89 | + context.clearRect(0, 0, canvas.width, canvas.height); | ||
| 90 | + | ||
| 91 | + var panelWidth = canvas.width; | ||
| 92 | + var panelHeight = canvas.height; | ||
| 93 | + var countSize = fishCountList.length; | ||
| 94 | + var counts = fishCountList.slice(); | ||
| 95 | + | ||
| 96 | + var max = Math.max(...counts); | ||
| 97 | + var x = 0; | ||
| 98 | + var y = Math.round((counts[0] / max) * panelHeight); | ||
| 99 | + var yOffset = Math.round((panelHeight/2 - y)); // 计算垂直偏移量 | ||
| 100 | + | ||
| 101 | + context.beginPath(); | ||
| 102 | + context.moveTo(x, y + yOffset); // 将起始点偏移 | ||
| 103 | + context.strokeStyle = "blue"; | ||
| 104 | + context.lineWidth = 2; | ||
| 105 | + | ||
| 106 | + for (var i = 1; i < countSize; i++) { | ||
| 107 | + var nextX = Math.round((panelWidth * i) / countSize); | ||
| 108 | + var nextY = Math.round((counts[i] / max) * panelHeight); | ||
| 109 | + context.lineTo(nextX, nextY + yOffset); // 将每个点偏移 | ||
| 110 | + x = nextX; | ||
| 111 | + y = nextY; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + context.stroke(); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + // 添加数据到数组 | ||
| 118 | + function addData(value) { | ||
| 119 | + // 当数组长度达到最大值时,移除第一个数据 | ||
| 120 | + if (fishCountList.length >= maxSize) { | ||
| 121 | + fishCountList.shift(); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + // 添加新数据到数组末尾 | ||
| 125 | + fishCountList.push(value); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | +</script> | ||
| 129 | +</html> |
| 1 | +/** | ||
| 2 | + * 通用方法封装处理 | ||
| 3 | + * Copyright (c) 2019 ruoyi | ||
| 4 | + */ | ||
| 5 | + | ||
| 6 | +var startLayDate; | ||
| 7 | +var endLayDate; | ||
| 8 | +$(function() { | ||
| 9 | + | ||
| 10 | + // layer扩展皮肤 | ||
| 11 | + if (window.layer !== undefined) { | ||
| 12 | + layer.config({ | ||
| 13 | + extend: 'moon/style.css', | ||
| 14 | + skin: 'layer-ext-moon' | ||
| 15 | + }); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + // 回到顶部绑定 | ||
| 19 | + if ($.fn.toTop !== undefined) { | ||
| 20 | + $('#scroll-up').toTop(); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + // select2复选框事件绑定 | ||
| 24 | + if ($.fn.select2 !== undefined) { | ||
| 25 | + $.fn.select2.defaults.set( "theme", "bootstrap" ); | ||
| 26 | + $("select.form-control:not(.noselect2)").each(function () { | ||
| 27 | + $(this).select2().on("change", function () { | ||
| 28 | + $(this).valid(); | ||
| 29 | + }) | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + // iCheck单选框及复选框事件绑定 | ||
| 34 | + if ($.fn.iCheck !== undefined) { | ||
| 35 | + $(".check-box:not(.noicheck),.radio-box:not(.noicheck)").each(function() { | ||
| 36 | + $(this).iCheck({ | ||
| 37 | + checkboxClass: 'icheckbox-blue', | ||
| 38 | + radioClass: 'iradio-blue', | ||
| 39 | + }) | ||
| 40 | + }) | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + // 取消回车自动提交表单 | ||
| 44 | + $(document).on("keypress", ":input:not(textarea):not([type=submit])", function(event) { | ||
| 45 | + if (event.keyCode == 13) { | ||
| 46 | + event.preventDefault(); | ||
| 47 | + } | ||
| 48 | + }); | ||
| 49 | + | ||
| 50 | + // laydate 时间控件绑定 | ||
| 51 | + if ($(".select-time").length > 0) { | ||
| 52 | + layui.use('laydate', function() { | ||
| 53 | + var laydate = layui.laydate; | ||
| 54 | + startLayDate = laydate.render({ | ||
| 55 | + elem: '#startTime', | ||
| 56 | + max: $('#endTime').val(), | ||
| 57 | + theme: 'molv', | ||
| 58 | + type: $('#startTime').attr("data-type") || 'date', | ||
| 59 | + trigger: 'click', | ||
| 60 | + done: function(value, date) { | ||
| 61 | + // 结束时间大于开始时间 | ||
| 62 | + if (value !== '') { | ||
| 63 | + endLayDate.config.min.year = date.year; | ||
| 64 | + endLayDate.config.min.month = date.month - 1; | ||
| 65 | + endLayDate.config.min.date = date.date; | ||
| 66 | + } else { | ||
| 67 | + endLayDate.config.min.year = ''; | ||
| 68 | + endLayDate.config.min.month = ''; | ||
| 69 | + endLayDate.config.min.date = ''; | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + }); | ||
| 73 | + endLayDate = laydate.render({ | ||
| 74 | + elem: '#endTime', | ||
| 75 | + min: $('#startTime').val(), | ||
| 76 | + theme: 'molv', | ||
| 77 | + type: $('#endTime').attr("data-type") || 'date', | ||
| 78 | + trigger: 'click', | ||
| 79 | + done: function(value, date) { | ||
| 80 | + // 开始时间小于结束时间 | ||
| 81 | + if (value !== '') { | ||
| 82 | + startLayDate.config.max.year = date.year; | ||
| 83 | + startLayDate.config.max.month = date.month - 1; | ||
| 84 | + startLayDate.config.max.date = date.date; | ||
| 85 | + } else { | ||
| 86 | + startLayDate.config.max.year = '2099'; | ||
| 87 | + startLayDate.config.max.month = '12'; | ||
| 88 | + startLayDate.config.max.date = '31'; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + }); | ||
| 92 | + }); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + // laydate time-input 时间控件绑定 | ||
| 96 | + if ($(".time-input").length > 0) { | ||
| 97 | + layui.use('laydate', function () { | ||
| 98 | + var com = layui.laydate; | ||
| 99 | + $(".time-input").each(function (index, item) { | ||
| 100 | + var time = $(item); | ||
| 101 | + // 控制控件外观 | ||
| 102 | + var type = time.attr("data-type") || 'date'; | ||
| 103 | + // 控制回显格式 | ||
| 104 | + var format = time.attr("data-format") || 'yyyy-MM-dd'; | ||
| 105 | + // 控制日期控件按钮 | ||
| 106 | + var buttons = time.attr("data-btn") || 'clear|now|confirm', newBtnArr = []; | ||
| 107 | + // 日期控件选择完成后回调处理 | ||
| 108 | + var callback = time.attr("data-callback") || {}; | ||
| 109 | + if (buttons) { | ||
| 110 | + if (buttons.indexOf("|") > 0) { | ||
| 111 | + var btnArr = buttons.split("|"), btnLen = btnArr.length; | ||
| 112 | + for (var j = 0; j < btnLen; j++) { | ||
| 113 | + if ("clear" === btnArr[j] || "now" === btnArr[j] || "confirm" === btnArr[j]) { | ||
| 114 | + newBtnArr.push(btnArr[j]); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + } else { | ||
| 118 | + if ("clear" === buttons || "now" === buttons || "confirm" === buttons) { | ||
| 119 | + newBtnArr.push(buttons); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + } else { | ||
| 123 | + newBtnArr = ['clear', 'now', 'confirm']; | ||
| 124 | + } | ||
| 125 | + com.render({ | ||
| 126 | + elem: item, | ||
| 127 | + theme: 'molv', | ||
| 128 | + trigger: 'click', | ||
| 129 | + type: type, | ||
| 130 | + format: format, | ||
| 131 | + btns: newBtnArr, | ||
| 132 | + done: function (value, data) { | ||
| 133 | + if (typeof window[callback] != 'undefined' | ||
| 134 | + && window[callback] instanceof Function) { | ||
| 135 | + window[callback](value, data); | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + }); | ||
| 139 | + }); | ||
| 140 | + }); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + // tree 关键字搜索绑定 | ||
| 144 | + if ($("#keyword").length > 0) { | ||
| 145 | + $("#keyword").bind("focus", function focusKey(e) { | ||
| 146 | + if ($("#keyword").hasClass("empty")) { | ||
| 147 | + $("#keyword").removeClass("empty"); | ||
| 148 | + } | ||
| 149 | + }).bind("blur", function blurKey(e) { | ||
| 150 | + if ($("#keyword").val() === "") { | ||
| 151 | + $("#keyword").addClass("empty"); | ||
| 152 | + } | ||
| 153 | + $.tree.searchNode(e); | ||
| 154 | + }).bind("input propertychange", $.tree.searchNode); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + // tree表格树 展开/折叠 | ||
| 158 | + var expandFlag; | ||
| 159 | + $("#expandAllBtn").click(function() { | ||
| 160 | + var dataExpand = $.common.isEmpty(table.options.expandAll) ? true : table.options.expandAll; | ||
| 161 | + expandFlag = $.common.isEmpty(expandFlag) ? dataExpand : expandFlag; | ||
| 162 | + if (!expandFlag) { | ||
| 163 | + $.bttTable.bootstrapTreeTable('expandAll'); | ||
| 164 | + } else { | ||
| 165 | + $.bttTable.bootstrapTreeTable('collapseAll'); | ||
| 166 | + } | ||
| 167 | + expandFlag = expandFlag ? false: true; | ||
| 168 | + }) | ||
| 169 | + | ||
| 170 | + // 按下ESC按钮关闭弹层 | ||
| 171 | + $('body', document).on('keyup', function(e) { | ||
| 172 | + if (e.which === 27) { | ||
| 173 | + $.modal.closeAll(); | ||
| 174 | + } | ||
| 175 | + }); | ||
| 176 | +}); | ||
| 177 | + | ||
| 178 | +(function ($) { | ||
| 179 | + 'use strict'; | ||
| 180 | + $.fn.toTop = function(opt) { | ||
| 181 | + var elem = this; | ||
| 182 | + var win = (opt && opt.hasOwnProperty('win')) ? opt.win : $(window); | ||
| 183 | + var doc = (opt && opt.hasOwnProperty('doc')) ? opt.doc : $('html, body'); | ||
| 184 | + var options = $.extend({ | ||
| 185 | + autohide: true, | ||
| 186 | + offset: 50, | ||
| 187 | + speed: 500, | ||
| 188 | + position: true, | ||
| 189 | + right: 15, | ||
| 190 | + bottom: 5 | ||
| 191 | + }, opt); | ||
| 192 | + elem.css({ | ||
| 193 | + 'cursor': 'pointer' | ||
| 194 | + }); | ||
| 195 | + if (options.autohide) { | ||
| 196 | + elem.css('display', 'none'); | ||
| 197 | + } | ||
| 198 | + if (options.position) { | ||
| 199 | + elem.css({ | ||
| 200 | + 'position': 'fixed', | ||
| 201 | + 'right': options.right, | ||
| 202 | + 'bottom': options.bottom, | ||
| 203 | + }); | ||
| 204 | + } | ||
| 205 | + elem.click(function() { | ||
| 206 | + doc.animate({ | ||
| 207 | + scrollTop: 0 | ||
| 208 | + }, options.speed); | ||
| 209 | + }); | ||
| 210 | + win.scroll(function() { | ||
| 211 | + var scrolling = win.scrollTop(); | ||
| 212 | + if (options.autohide) { | ||
| 213 | + if (scrolling > options.offset) { | ||
| 214 | + elem.fadeIn(options.speed); | ||
| 215 | + } else elem.fadeOut(options.speed); | ||
| 216 | + } | ||
| 217 | + }); | ||
| 218 | + }; | ||
| 219 | +})(jQuery); | ||
| 220 | + | ||
| 221 | +/** 刷新选项卡 */ | ||
| 222 | +var refreshItem = function(){ | ||
| 223 | + var topWindow = $(window.parent.document); | ||
| 224 | + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id'); | ||
| 225 | + var target = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow); | ||
| 226 | + var url = target.attr('src'); | ||
| 227 | + target.attr('src', url).ready(); | ||
| 228 | +} | ||
| 229 | + | ||
| 230 | +/** 关闭选项卡 */ | ||
| 231 | +var closeItem = function(dataId){ | ||
| 232 | + var topWindow = $(window.parent.document); | ||
| 233 | + if($.common.isNotEmpty(dataId)){ | ||
| 234 | + window.parent.$.modal.closeLoading(); | ||
| 235 | + // 根据dataId关闭指定选项卡 | ||
| 236 | + $('.menuTab[data-id="' + dataId + '"]', topWindow).remove(); | ||
| 237 | + // 移除相应tab对应的内容区 | ||
| 238 | + $('.mainContent .RuoYi_iframe[data-id="' + dataId + '"]', topWindow).remove(); | ||
| 239 | + return; | ||
| 240 | + } | ||
| 241 | + var panelUrl = window.frameElement.getAttribute('data-panel'); | ||
| 242 | + $('.page-tabs-content .active i', topWindow).click(); | ||
| 243 | + if($.common.isNotEmpty(panelUrl)){ | ||
| 244 | + $('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active'); | ||
| 245 | + $('.mainContent .RuoYi_iframe', topWindow).each(function() { | ||
| 246 | + if ($(this).data('id') == panelUrl) { | ||
| 247 | + $(this).show().siblings('.RuoYi_iframe').hide(); | ||
| 248 | + return false; | ||
| 249 | + } | ||
| 250 | + }); | ||
| 251 | + } | ||
| 252 | +} | ||
| 253 | + | ||
| 254 | +/** 创建选项卡 */ | ||
| 255 | +function createMenuItem(dataUrl, menuName, isRefresh) { | ||
| 256 | + var panelUrl = window.frameElement.getAttribute('data-id'), | ||
| 257 | + dataIndex = $.common.random(1, 100), | ||
| 258 | + flag = true; | ||
| 259 | + if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false; | ||
| 260 | + var topWindow = $(window.parent.document); | ||
| 261 | + // 选项卡菜单已存在 | ||
| 262 | + $('.menuTab', topWindow).each(function() { | ||
| 263 | + if ($(this).data('id') == dataUrl) { | ||
| 264 | + if (!$(this).hasClass('active')) { | ||
| 265 | + $(this).addClass('active').siblings('.menuTab').removeClass('active'); | ||
| 266 | + scrollToTab(this); | ||
| 267 | + $('.page-tabs-content').animate({ marginLeft: ""}, "fast"); | ||
| 268 | + // 显示tab对应的内容区 | ||
| 269 | + $('.mainContent .RuoYi_iframe', topWindow).each(function() { | ||
| 270 | + if ($(this).data('id') == dataUrl) { | ||
| 271 | + $(this).show().siblings('.RuoYi_iframe').hide(); | ||
| 272 | + return false; | ||
| 273 | + } | ||
| 274 | + }); | ||
| 275 | + } | ||
| 276 | + if (isRefresh) { | ||
| 277 | + refreshTab(); | ||
| 278 | + } | ||
| 279 | + flag = false; | ||
| 280 | + return false; | ||
| 281 | + } | ||
| 282 | + }); | ||
| 283 | + // 选项卡菜单不存在 | ||
| 284 | + if (flag) { | ||
| 285 | + var str = '<a href="javascript:;" class="active menuTab noactive" data-id="' + dataUrl + '" data-panel="' + panelUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i></a>'; | ||
| 286 | + $('.menuTab', topWindow).removeClass('active'); | ||
| 287 | + | ||
| 288 | + // 添加选项卡对应的iframe | ||
| 289 | + var str1 = '<iframe class="RuoYi_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" data-panel="' + panelUrl + '" seamless></iframe>'; | ||
| 290 | + $('.mainContent', topWindow).find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1); | ||
| 291 | + | ||
| 292 | + window.parent.$.modal.loading("数据加载中,请稍候..."); | ||
| 293 | + $('.mainContent iframe:visible', topWindow).on('load', function() { | ||
| 294 | + window.parent.$.modal.closeLoading(); | ||
| 295 | + }); | ||
| 296 | + | ||
| 297 | + // 添加选项卡 | ||
| 298 | + $('.menuTabs .page-tabs-content', topWindow).append(str); | ||
| 299 | + scrollToTab($('.menuTab.active', topWindow)); | ||
| 300 | + } | ||
| 301 | + return false; | ||
| 302 | +} | ||
| 303 | + | ||
| 304 | +// 刷新iframe | ||
| 305 | +function refreshTab() { | ||
| 306 | + var topWindow = $(window.parent.document); | ||
| 307 | + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id'); | ||
| 308 | + var target = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow); | ||
| 309 | + var url = target.attr('src'); | ||
| 310 | + target.attr('src', url).ready(); | ||
| 311 | +} | ||
| 312 | + | ||
| 313 | +// 滚动到指定选项卡 | ||
| 314 | +function scrollToTab(element) { | ||
| 315 | + var topWindow = $(window.parent.document); | ||
| 316 | + var marginLeftVal = calSumWidth($(element).prevAll()), | ||
| 317 | + marginRightVal = calSumWidth($(element).nextAll()); | ||
| 318 | + // 可视区域非tab宽度 | ||
| 319 | + var tabOuterWidth = calSumWidth($(".content-tabs", topWindow).children().not(".menuTabs")); | ||
| 320 | + //可视区域tab宽度 | ||
| 321 | + var visibleWidth = $(".content-tabs", topWindow).outerWidth(true) - tabOuterWidth; | ||
| 322 | + //实际滚动宽度 | ||
| 323 | + var scrollVal = 0; | ||
| 324 | + if ($(".page-tabs-content", topWindow).outerWidth() < visibleWidth) { | ||
| 325 | + scrollVal = 0; | ||
| 326 | + } else if (marginRightVal <= (visibleWidth - $(element).outerWidth(true) - $(element).next().outerWidth(true))) { | ||
| 327 | + if ((visibleWidth - $(element).next().outerWidth(true)) > marginRightVal) { | ||
| 328 | + scrollVal = marginLeftVal; | ||
| 329 | + var tabElement = element; | ||
| 330 | + while ((scrollVal - $(tabElement).outerWidth()) > ($(".page-tabs-content", topWindow).outerWidth() - visibleWidth)) { | ||
| 331 | + scrollVal -= $(tabElement).prev().outerWidth(); | ||
| 332 | + tabElement = $(tabElement).prev(); | ||
| 333 | + } | ||
| 334 | + } | ||
| 335 | + } else if (marginLeftVal > (visibleWidth - $(element).outerWidth(true) - $(element).prev().outerWidth(true))) { | ||
| 336 | + scrollVal = marginLeftVal - $(element).prev().outerWidth(true); | ||
| 337 | + } | ||
| 338 | + $('.page-tabs-content', topWindow).animate({ marginLeft: 0 - scrollVal + 'px' }, "fast"); | ||
| 339 | +} | ||
| 340 | + | ||
| 341 | +// 计算元素集合的总宽度 | ||
| 342 | +function calSumWidth(elements) { | ||
| 343 | + var width = 0; | ||
| 344 | + $(elements).each(function() { | ||
| 345 | + width += $(this).outerWidth(true); | ||
| 346 | + }); | ||
| 347 | + return width; | ||
| 348 | +} | ||
| 349 | + | ||
| 350 | +// 返回当前激活的Tab页面关联的iframe的Windows对象 | ||
| 351 | +function activeWindow() { | ||
| 352 | + var topWindow = $(window.parent.document); | ||
| 353 | + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-id'); | ||
| 354 | + if (!currentId) { | ||
| 355 | + return window.parent; | ||
| 356 | + } | ||
| 357 | + return $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow; | ||
| 358 | +} | ||
| 359 | + | ||
| 360 | +/** 密码规则范围验证 */ | ||
| 361 | +function checkpwd(chrtype, password) { | ||
| 362 | + if (chrtype == 1) { | ||
| 363 | + if(!$.common.numValid(password)){ | ||
| 364 | + $.modal.alertWarning("密码只能为0-9数字"); | ||
| 365 | + return false; | ||
| 366 | + } | ||
| 367 | + } else if (chrtype == 2) { | ||
| 368 | + if(!$.common.enValid(password)){ | ||
| 369 | + $.modal.alertWarning("密码只能为a-z和A-Z字母"); | ||
| 370 | + return false; | ||
| 371 | + } | ||
| 372 | + } else if (chrtype == 3) { | ||
| 373 | + if(!$.common.enNumValid(password)){ | ||
| 374 | + $.modal.alertWarning("密码必须包含字母以及数字"); | ||
| 375 | + return false; | ||
| 376 | + } | ||
| 377 | + } else if (chrtype == 4) { | ||
| 378 | + if(!$.common.charValid(password)){ | ||
| 379 | + $.modal.alertWarning("密码必须包含字母、数字、以及特殊符号<font color='red'>~!@#$%^&*()-=_+</font>"); | ||
| 380 | + return false; | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + return true; | ||
| 384 | +} | ||
| 385 | + | ||
| 386 | +// 日志打印封装处理 | ||
| 387 | +var log = { | ||
| 388 | + log: function(msg) { | ||
| 389 | + console.log(msg); | ||
| 390 | + }, | ||
| 391 | + info: function(msg) { | ||
| 392 | + console.info(msg); | ||
| 393 | + }, | ||
| 394 | + warn: function(msg) { | ||
| 395 | + console.warn(msg); | ||
| 396 | + }, | ||
| 397 | + error: function(msg) { | ||
| 398 | + console.error(msg); | ||
| 399 | + } | ||
| 400 | +}; | ||
| 401 | + | ||
| 402 | +// 本地缓存处理 | ||
| 403 | +var storage = { | ||
| 404 | + set: function(key, value) { | ||
| 405 | + window.localStorage.setItem(key, value); | ||
| 406 | + }, | ||
| 407 | + get: function(key) { | ||
| 408 | + return window.localStorage.getItem(key); | ||
| 409 | + }, | ||
| 410 | + remove: function(key) { | ||
| 411 | + window.localStorage.removeItem(key); | ||
| 412 | + }, | ||
| 413 | + clear: function() { | ||
| 414 | + window.localStorage.clear(); | ||
| 415 | + } | ||
| 416 | +}; | ||
| 417 | + | ||
| 418 | +// 主子表操作封装处理 | ||
| 419 | +var sub = { | ||
| 420 | + editRow: function() { | ||
| 421 | + var dataColumns = []; | ||
| 422 | + for (var columnIndex = 0; columnIndex < table.options.columns.length; columnIndex++) { | ||
| 423 | + if (table.options.columns[columnIndex].visible != false) { | ||
| 424 | + dataColumns.push(table.options.columns[columnIndex]); | ||
| 425 | + } | ||
| 426 | + } | ||
| 427 | + var params = new Array(); | ||
| 428 | + var data = $("#" + table.options.id).bootstrapTable('getData'); | ||
| 429 | + var count = data.length; | ||
| 430 | + for (var dataIndex = 0; dataIndex < count; dataIndex++) { | ||
| 431 | + var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td'); | ||
| 432 | + var obj = new Object(); | ||
| 433 | + for (var i = 0; i < columns.length; i++) { | ||
| 434 | + var inputValue = $(columns[i]).find('input'); | ||
| 435 | + var selectValue = $(columns[i]).find('select'); | ||
| 436 | + var textareaValue = $(columns[i]).find('textarea'); | ||
| 437 | + var key = dataColumns[i].field; | ||
| 438 | + if ($.common.isNotEmpty(inputValue.val())) { | ||
| 439 | + obj[key] = inputValue.val(); | ||
| 440 | + } else if ($.common.isNotEmpty(selectValue.val())) { | ||
| 441 | + obj[key] = selectValue.val(); | ||
| 442 | + } else if ($.common.isNotEmpty(textareaValue.val())) { | ||
| 443 | + obj[key] = textareaValue.val(); | ||
| 444 | + } else { | ||
| 445 | + if (key == "index" && $.common.isNotEmpty(data[dataIndex].index)) { | ||
| 446 | + obj[key] = data[dataIndex].index; | ||
| 447 | + } else { | ||
| 448 | + obj[key] = ""; | ||
| 449 | + } | ||
| 450 | + } | ||
| 451 | + } | ||
| 452 | + var item = data[dataIndex]; | ||
| 453 | + var extendObj = $.extend({}, item, obj); | ||
| 454 | + params.push({ index: dataIndex, row: extendObj }); | ||
| 455 | + } | ||
| 456 | + $("#" + table.options.id).bootstrapTable("updateRow", params); | ||
| 457 | + }, | ||
| 458 | + delRow: function(column) { | ||
| 459 | + sub.editRow(); | ||
| 460 | + var subColumn = $.common.isEmpty(column) ? "index" : column; | ||
| 461 | + var ids = $.table.selectColumns(subColumn); | ||
| 462 | + if (ids.length == 0) { | ||
| 463 | + $.modal.alertWarning("请至少选择一条记录"); | ||
| 464 | + return; | ||
| 465 | + } | ||
| 466 | + $("#" + table.options.id).bootstrapTable('remove', { field: subColumn, values: ids }); | ||
| 467 | + }, | ||
| 468 | + delRowByIndex: function(value) { | ||
| 469 | + sub.editRow(); | ||
| 470 | + $("#" + table.options.id).bootstrapTable('remove', { field: "index", values: [value] }); | ||
| 471 | + sub.editRow(); | ||
| 472 | + }, | ||
| 473 | + addRow: function(row, tableId) { | ||
| 474 | + var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; | ||
| 475 | + table.set(currentId); | ||
| 476 | + var count = $("#" + currentId).bootstrapTable('getData').length; | ||
| 477 | + sub.editRow(); | ||
| 478 | + $("#" + currentId).bootstrapTable('insertRow', { index: count + 1, row: row }); | ||
| 479 | + } | ||
| 480 | +}; | ||
| 481 | + | ||
| 482 | +// 动态加载css文件 | ||
| 483 | +function loadCss(file, headElem) { | ||
| 484 | + var link = document.createElement('link'); | ||
| 485 | + link.href = file; | ||
| 486 | + link.rel = 'stylesheet'; | ||
| 487 | + link.type = 'text/css'; | ||
| 488 | + if (headElem) headElem.appendChild(link); | ||
| 489 | + else document.getElementsByTagName('head')[0].appendChild(link); | ||
| 490 | +} | ||
| 491 | + | ||
| 492 | +// 动态加载js文件 | ||
| 493 | +function loadJs(file, headElem) { | ||
| 494 | + var script = document.createElement('script'); | ||
| 495 | + script.src = file; | ||
| 496 | + script.type = 'text/javascript'; | ||
| 497 | + if (headElem) headElem.appendChild(script); | ||
| 498 | + else document.getElementsByTagName('head')[0].appendChild(script); | ||
| 499 | +} | ||
| 500 | + | ||
| 501 | +// 禁止后退键(Backspace) | ||
| 502 | +window.onload = function() { | ||
| 503 | + document.getElementsByTagName("body")[0].onkeydown = function() { | ||
| 504 | + // 获取事件对象 | ||
| 505 | + var elem = event.relatedTarget || event.srcElement || event.target || event.currentTarget; | ||
| 506 | + // 判断按键为backSpace键 | ||
| 507 | + if (event.keyCode == 8) { | ||
| 508 | + // 判断是否需要阻止按下键盘的事件默认传递 | ||
| 509 | + var name = elem.nodeName; | ||
| 510 | + var className = elem.className; | ||
| 511 | + // 屏蔽特定的样式名称 | ||
| 512 | + if (className.indexOf('note-editable') != -1) | ||
| 513 | + { | ||
| 514 | + return true; | ||
| 515 | + } | ||
| 516 | + if (name != 'INPUT' && name != 'TEXTAREA') { | ||
| 517 | + return _stopIt(event); | ||
| 518 | + } | ||
| 519 | + var type_e = elem.type.toUpperCase(); | ||
| 520 | + if (name == 'INPUT' && (type_e != 'TEXT' && type_e != 'TEXTAREA' && type_e != 'PASSWORD' && type_e != 'FILE' && type_e != 'SEARCH' && type_e != 'NUMBER' && type_e != 'EMAIL' && type_e != 'URL')) { | ||
| 521 | + return _stopIt(event); | ||
| 522 | + } | ||
| 523 | + if (name == 'INPUT' && (elem.readOnly == true || elem.disabled == true)) { | ||
| 524 | + return _stopIt(event); | ||
| 525 | + } | ||
| 526 | + } | ||
| 527 | + }; | ||
| 528 | +}; | ||
| 529 | +function _stopIt(e) { | ||
| 530 | + if (e.returnValue) { | ||
| 531 | + e.returnValue = false; | ||
| 532 | + } | ||
| 533 | + if (e.preventDefault) { | ||
| 534 | + e.preventDefault(); | ||
| 535 | + } | ||
| 536 | + return false; | ||
| 537 | +} | ||
| 538 | + | ||
| 539 | +/** 设置全局ajax处理 */ | ||
| 540 | +$.ajaxSetup({ | ||
| 541 | + complete: function(XMLHttpRequest, textStatus) { | ||
| 542 | + if (textStatus == 'timeout') { | ||
| 543 | + $.modal.alertWarning("服务器超时,请稍后再试!"); | ||
| 544 | + $.modal.enable(); | ||
| 545 | + $.modal.closeLoading(); | ||
| 546 | + } else if (textStatus == "parsererror" || textStatus == "error") { | ||
| 547 | + $.modal.alertWarning("服务器错误,请联系管理员!"); | ||
| 548 | + $.modal.enable(); | ||
| 549 | + $.modal.closeLoading(); | ||
| 550 | + } | ||
| 551 | + } | ||
| 552 | +}); |
| 1 | +/*! jQuery v3.6.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ | ||
| 2 | +!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document){throw Error("jQuery requires a window with a document")}return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e,t,n){n=n||Te;var r,i,o=n.createElement("script");if(o.text=e,t){for(r in Ce){i=t[r]||t.getAttribute&&t.getAttribute(r),i&&o.setAttribute(r,i)}}n.head.appendChild(o).parentNode.removeChild(o)}function r(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?he[ge.call(e)]||"object":typeof e}function i(e){var t=!!e&&"length" in e&&e.length,n=r(e);return be(e)||we(e)?!1:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function o(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}function a(e,t,n){return be(t)?Se.grep(e,function(e,r){return !!t.call(e,r,e)!==n}):t.nodeType?Se.grep(e,function(e){return e===t!==n}):"string"!=typeof t?Se.grep(e,function(e){return de.call(t,e)>-1!==n}):Se.filter(t,e,n)}function s(e,t){for(;(e=e[t])&&1!==e.nodeType;){}return e}function u(e){var t={};return Se.each(e.match(Re)||[],function(e,n){t[n]=!0}),t}function l(e){return e}function c(e){throw e}function f(e,t,n,r){var i;try{e&&be(i=e.promise)?i.call(e).done(t).fail(n):e&&be(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}function p(){Te.removeEventListener("DOMContentLoaded",p),e.removeEventListener("load",p),Se.ready()}function d(e,t){return t.toUpperCase()}function h(e){return e.replace(Fe,"ms-").replace($e,d)}function g(){this.expando=Se.expando+g.uid++}function m(e){return"true"===e?!0:"false"===e?!1:"null"===e?null:e===+e+""?+e:Ue.test(e)?JSON.parse(e):e}function v(e,t,n){var r;if(void 0===n&&1===e.nodeType){if(r="data-"+t.replace(Xe,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n=m(n)}catch(i){}ze.set(e,t,n)}else{n=void 0}}return n}function y(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return Se.css(e,t,"")},u=s(),l=n&&n[3]||(Se.cssNumber[t]?"":"px"),c=e.nodeType&&(Se.cssNumber[t]||"px"!==l&&+u)&&Ge.exec(Se.css(e,t));if(c&&c[3]!==l){for(u/=2,l=l||c[3],c=+u||1;a--;){Se.style(e,t,c+l),(1-o)*(1-(o=s()/u||0.5))<=0&&(a=0),c/=o}c=2*c,Se.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function x(e){var t,n=e.ownerDocument,r=e.nodeName,i=et[r];return i?i:(t=n.body.appendChild(n.createElement(r)),i=Se.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),et[r]=i,i)}function b(e,t){for(var n,r,i=[],o=0,a=e.length;a>o;o++){r=e[o],r.style&&(n=r.style.display,t?("none"===n&&(i[o]=_e.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&Ze(r)&&(i[o]=x(r))):"none"!==n&&(i[o]="none",_e.set(r,"display",n)))}for(o=0;a>o;o++){null!=i[o]&&(e[o].style.display=i[o])}return e}function w(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&o(e,t)?Se.merge([e],n):n}function T(e,t){for(var n=0,r=e.length;r>n;n++){_e.set(e[n],"globalEval",!t||_e.get(t[n],"globalEval"))}}function C(e,t,n,i,o){for(var a,s,u,l,c,f,p=t.createDocumentFragment(),d=[],h=0,g=e.length;g>h;h++){if(a=e[h],a||0===a){if("object"===r(a)){Se.merge(d,a.nodeType?[a]:a)}else{if(ot.test(a)){for(s=s||p.appendChild(t.createElement("div")),u=(nt.exec(a)||["",""])[1].toLowerCase(),l=it[u]||it._default,s.innerHTML=l[1]+Se.htmlPrefilter(a)+l[2],f=l[0];f--;){s=s.lastChild}Se.merge(d,s.childNodes),s=p.firstChild,s.textContent=""}else{d.push(t.createTextNode(a))}}}}for(p.textContent="",h=0;a=d[h++];){if(i&&Se.inArray(a,i)>-1){o&&o.push(a)}else{if(c=Je(a),s=w(p.appendChild(a),"script"),c&&T(s),n){for(f=0;a=s[f++];){rt.test(a.type||"")&&n.push(a)}}}}return p}function E(){return !0}function S(){return !1}function k(e,t){return e===A()==("focus"===t)}function A(){try{return Te.activeElement}catch(e){}}function N(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t){N(e,s,n,r,t[s],o)}return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1){i=S}else{if(!i){return e}}return 1===o&&(a=i,i=function(e){return Se().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=Se.guid++)),e.each(function(){Se.event.add(this,t,i,r,n)})}function j(e,t,n){return n?(_e.set(e,t,!1),void Se.event.add(e,t,{namespace:!1,handler:function(e){var r,i,o=_e.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length){(Se.event.special[t]||{}).delegateType&&e.stopPropagation()}else{if(o=ce.call(arguments),_e.set(this,t,o),r=n(this,t),this[t](),i=_e.get(this,t),o!==i||r?_e.set(this,t,!1):i={},o!==i){return e.stopImmediatePropagation(),e.preventDefault(),i&&i.value}}}else{o.length&&(_e.set(this,t,{value:Se.event.trigger(Se.extend(o[0],Se.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}}})):void (void 0===_e.get(e,t)&&Se.event.add(e,t,E))}function D(e,t){return o(e,"table")&&o(11!==t.nodeType?t:t.firstChild,"tr")?Se(e).children("tbody")[0]||e:e}function q(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function L(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function H(e,t){var n,r,i,o,a,s,u;if(1===t.nodeType){if(_e.hasData(e)&&(o=_e.get(e),u=o.events)){_e.remove(t,"handle events");for(i in u){for(n=0,r=u[i].length;r>n;n++){Se.event.add(t,i,u[i][n])}}}ze.hasData(e)&&(a=ze.access(e),s=Se.extend({},a),ze.set(t,s))}}function O(e,t){var n=t.nodeName.toLowerCase();"input"===n&&tt.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function P(e,t,r,i){t=fe(t);var o,a,s,u,l,c,f=0,p=e.length,d=p-1,h=t[0],g=be(h);if(g||p>1&&"string"==typeof h&&!xe.checkClone&&ut.test(h)){return e.each(function(n){var o=e.eq(n);g&&(t[0]=h.call(this,n,o.html())),P(o,t,r,i)})}if(p&&(o=C(t,e[0].ownerDocument,!1,e,i),a=o.firstChild,1===o.childNodes.length&&(o=a),a||i)){for(s=Se.map(w(o,"script"),q),u=s.length;p>f;f++){l=o,f!==d&&(l=Se.clone(l,!0,!0),u&&Se.merge(s,w(l,"script"))),r.call(e[f],l,f)}if(u){for(c=s[s.length-1].ownerDocument,Se.map(s,L),f=0;u>f;f++){l=s[f],rt.test(l.type||"")&&!_e.access(l,"globalEval")&&Se.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?Se._evalUrl&&!l.noModule&&Se._evalUrl(l.src,{nonce:l.nonce||l.getAttribute("nonce")},c):n(l.textContent.replace(lt,""),l,c))}}}return e}function R(e,t,n){for(var r,i=t?Se.filter(t,e):e,o=0;null!=(r=i[o]);o++){n||1!==r.nodeType||Se.cleanData(w(r)),r.parentNode&&(n&&Je(r)&&T(w(r,"script")),r.parentNode.removeChild(r))}return e}function M(e,t,n){var r,i,o,a,s=ft.test(t),u=e.style;return n=n||pt(e),n&&(a=n.getPropertyValue(t)||n[t],s&&(a=a.replace(mt,"$1")),""!==a||Je(e)||(a=Se.style(e,t)),!xe.pixelBoxStyles()&&ct.test(a)&&ht.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function I(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function W(e){for(var t=e[0].toUpperCase()+e.slice(1),n=vt.length;n--;){if(e=vt[n]+t,e in yt){return e}}}function F(e){var t=Se.cssProps[e]||xt[e];return t?t:e in yt?e:xt[e]=W(e)||e}function B(e,t,n){var r=Ge.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function _(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content")){return 0}for(;4>a;a+=2){"margin"===n&&(u+=Se.css(e,n+Ye[a],!0,i)),r?("content"===n&&(u-=Se.css(e,"padding"+Ye[a],!0,i)),"margin"!==n&&(u-=Se.css(e,"border"+Ye[a]+"Width",!0,i))):(u+=Se.css(e,"padding"+Ye[a],!0,i),"padding"!==n?u+=Se.css(e,"border"+Ye[a]+"Width",!0,i):s+=Se.css(e,"border"+Ye[a]+"Width",!0,i))}return !r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-0.5))||0),u}function z(e,t,n){var r=pt(e),i=!xe.boxSizingReliable()||n,a=i&&"border-box"===Se.css(e,"boxSizing",!1,r),s=a,u=M(e,t,r),l="offset"+t[0].toUpperCase()+t.slice(1);if(ct.test(u)){if(!n){return u}u="auto"}return(!xe.boxSizingReliable()&&a||!xe.reliableTrDimensions()&&o(e,"tr")||"auto"===u||!parseFloat(u)&&"inline"===Se.css(e,"display",!1,r))&&e.getClientRects().length&&(a="border-box"===Se.css(e,"boxSizing",!1,r),s=l in e,s&&(u=e[l])),u=parseFloat(u)||0,u+_(e,t,n||(a?"border":"content"),s,r,u)+"px"}function U(e,t,n,r,i){return new U.prototype.init(e,t,n,r,i)}function X(){Et&&(Te.hidden===!1&&e.requestAnimationFrame?e.requestAnimationFrame(X):e.setTimeout(X,Se.fx.interval),Se.fx.tick())}function V(){return e.setTimeout(function(){Ct=void 0}),Ct=Date.now()}function G(e,t){var n,r=0,i={height:e};for(t=t?1:0;4>r;r+=2-t){n=Ye[r],i["margin"+n]=i["padding"+n]=e}return t&&(i.opacity=i.width=e),i}function Y(e,t,n){for(var r,i=(K.tweeners[t]||[]).concat(K.tweeners["*"]),o=0,a=i.length;a>o;o++){if(r=i[o].call(n,t,e)){return r}}}function Q(e,t,n){var r,i,o,a,s,u,l,c,f="width" in t||"height" in t,p=this,d={},h=e.style,g=e.nodeType&&Ze(e),m=_e.get(e,"fxshow");n.queue||(a=Se._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,Se.queue(e,"fx").length||a.empty.fire()})}));for(r in t){if(i=t[r],St.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!m||void 0===m[r]){continue}g=!0}d[r]=m&&m[r]||Se.style(e,r)}}if(u=!Se.isEmptyObject(t),u||!Se.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],l=m&&m.display,null==l&&(l=_e.get(e,"display")),c=Se.css(e,"display"),"none"===c&&(l?c=l:(b([e],!0),l=e.style.display||l,c=Se.css(e,"display"),b([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===Se.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d){u||(m?"hidden" in m&&(g=m.hidden):m=_e.access(e,"fxshow",{display:l}),o&&(m.hidden=!g),g&&b([e],!0),p.done(function(){g||b([e]),_e.remove(e,"fxshow");for(r in d){Se.style(e,r,d[r])}})),u=Y(g?m[r]:0,r,p),r in m||(m[r]=u.start,g&&(u.end=u.start,u.start=0))}}}function J(e,t){var n,r,i,o,a;for(n in e){if(r=h(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=Se.cssHooks[r],a&&"expand" in a){o=a.expand(o),delete e[r];for(n in o){n in e||(e[n]=o[n],t[n]=i)}}else{t[r]=i}}}function K(e,t,n){var r,i,o=0,a=K.prefilters.length,s=Se.Deferred().always(function(){delete u.elem}),u=function(){if(i){return !1}for(var t=Ct||V(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;u>a;a++){l.tweens[a].run(o)}return s.notifyWith(e,[l,o,n]),1>o&&u?n:(u||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:Se.extend({},t),opts:Se.extend(!0,{specialEasing:{},easing:Se.easing._default},n),originalProperties:t,originalOptions:n,startTime:Ct||V(),duration:n.duration,tweens:[],createTween:function(t,n){var r=Se.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i){return this}for(i=!0;r>n;n++){l.tweens[n].run(1)}return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(J(c,l.opts.specialEasing);a>o;o++){if(r=K.prefilters[o].call(l,e,c,l.opts)){return be(r.stop)&&(Se._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r}}return Se.map(c,Y,l),be(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),Se.fx.timer(Se.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}function Z(e){var t=e.match(Re)||[];return t.join(" ")}function ee(e){return e.getAttribute&&e.getAttribute("class")||""}function te(e){return Array.isArray(e)?e:"string"==typeof e?e.match(Re)||[]:[]}function ne(e,t,n,i){var o;if(Array.isArray(t)){Se.each(t,function(t,r){n||Mt.test(e)?i(e,r):ne(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,n,i)})}else{if(n||"object"!==r(t)){i(e,t)}else{for(o in t){ne(e+"["+o+"]",t[o],n,i)}}}}function re(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(Re)||[];if(be(n)){for(;r=o[i++];){"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}}}function ie(e,t,n,r){function i(s){var u;return o[s]=!0,Se.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||a||o[l]?a?!(u=l):void 0:(t.dataTypes.unshift(l),i(l),!1)}),u}var o={},a=e===Yt;return i(t.dataTypes[0])||!o["*"]&&i("*")}function oe(e,t){var n,r,i=Se.ajaxSettings.flatOptions||{};for(n in t){void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n])}return r&&Se.extend(!0,e,r),e}function ae(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;"*"===u[0];){u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"))}if(r){for(i in s){if(s[i]&&s[i].test(r)){u.unshift(i);break}}}if(u[0] in n){o=u[0]}else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}return o?(o!==u[0]&&u.unshift(o),n[o]):void 0}function se(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1]){for(a in e.converters){l[a.toLowerCase()]=e.converters[a]}}for(o=c.shift();o;){if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift()){if("*"===o){o=u}else{if("*"!==u&&u!==o){if(a=l[u+" "+o]||l["* "+o],!a){for(i in l){if(s=i.split(" "),s[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){a===!0?a=l[i]:l[i]!==!0&&(o=s[0],c.unshift(s[1]));break}}}if(a!==!0){if(a&&e["throws"]){t=a(t)}else{try{t=a(t)}catch(f){return{state:"parsererror",error:a?f:"No conversion from "+u+" to "+o}}}}}}}}return{state:"success",data:t}}var ue=[],le=Object.getPrototypeOf,ce=ue.slice,fe=ue.flat?function(e){return ue.flat.call(e)}:function(e){return ue.concat.apply([],e)},pe=ue.push,de=ue.indexOf,he={},ge=he.toString,me=he.hasOwnProperty,ve=me.toString,ye=ve.call(Object),xe={},be=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},we=function(e){return null!=e&&e===e.window},Te=e.document,Ce={type:!0,src:!0,nonce:!0,noModule:!0},Ee="3.6.1",Se=function(e,t){return new Se.fn.init(e,t)};Se.fn=Se.prototype={jquery:Ee,constructor:Se,length:0,toArray:function(){return ce.call(this)},get:function(e){return null==e?ce.call(this):0>e?this[e+this.length]:this[e]},pushStack:function(e){var t=Se.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return Se.each(this,e)},map:function(e){return this.pushStack(Se.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(ce.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(Se.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(Se.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:pe,sort:ue.sort,splice:ue.splice},Se.extend=Se.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||be(a)||(a={}),s===u&&(a=this,s--);u>s;s++){if(null!=(e=arguments[s])){for(t in e){r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(Se.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||Se.isPlainObject(n)?n:{},i=!1,a[t]=Se.extend(l,o,r)):void 0!==r&&(a[t]=r))}}}return a},Se.extend({expando:"jQuery"+(Ee+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return e&&"[object Object]"===ge.call(e)?(t=le(e))?(n=me.call(t,"constructor")&&t.constructor,"function"==typeof n&&ve.call(n)===ye):!0:!1},isEmptyObject:function(e){var t;for(t in e){return !1}return !0},globalEval:function(e,t,r){n(e,{nonce:t&&t.nonce},r)},each:function(e,t){var n,r=0;if(i(e)){for(n=e.length;n>r&&t.call(e[r],r,e[r])!==!1;r++){}}else{for(r in e){if(t.call(e[r],r,e[r])===!1){break}}}return e},makeArray:function(e,t){var n=t||[];return null!=e&&(i(Object(e))?Se.merge(n,"string"==typeof e?[e]:e):pe.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:de.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;r++){e[i++]=t[r]}return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;a>o;o++){r=!t(e[o],o),r!==s&&i.push(e[o])}return i},map:function(e,t,n){var r,o,a=0,s=[];if(i(e)){for(r=e.length;r>a;a++){o=t(e[a],a,n),null!=o&&s.push(o)}}else{for(a in e){o=t(e[a],a,n),null!=o&&s.push(o)}}return fe(s)},guid:1,support:xe}),"function"==typeof Symbol&&(Se.fn[Symbol.iterator]=ue[Symbol.iterator]),Se.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){he["[object "+t+"]"]=t.toLowerCase()});var ke=function(e){function t(e,t,n,r){var i,o,a,s,u,l,c,p=t&&t.ownerDocument,h=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h){return n}if(!r&&(L(t),t=t||H,P)){if(11!==h&&(u=xe.exec(e))){if(i=u[1]){if(9===h){if(!(a=t.getElementById(i))){return n}if(a.id===i){return n.push(a),n}}else{if(p&&(a=p.getElementById(i))&&W(t,a)&&a.id===i){return n.push(a),n}}}else{if(u[2]){return Z.apply(n,t.getElementsByTagName(e)),n}if((i=u[3])&&T.getElementsByClassName&&t.getElementsByClassName){return Z.apply(n,t.getElementsByClassName(i)),n}}}if(T.qsa&&!V[e+" "]&&(!R||!R.test(e))&&(1!==h||"object"!==t.nodeName.toLowerCase())){if(c=e,p=t,1===h&&(fe.test(e)||ce.test(e))){for(p=be.test(e)&&f(t.parentNode)||t,p===t&&T.scope||((s=t.getAttribute("id"))?s=s.replace(Ce,Ee):t.setAttribute("id",s=F)),l=k(e),o=l.length;o--;){l[o]=(s?"#"+s:":scope")+" "+d(l[o])}c=l.join(",")}try{return Z.apply(n,p.querySelectorAll(c)),n}catch(g){V(e,!0)}finally{s===F&&t.removeAttribute("id")}}}return N(e.replace(ue,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>C.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[F]=!0,e}function i(e){var t=H.createElement("fieldset");try{return !!e(t)}catch(n){return !1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;){C.attrHandle[n[r]]=t}}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r){return r}if(n){for(;n=n.nextSibling;){if(n===t){return -1}}}return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return function(t){return"form" in t?t.parentNode&&t.disabled===!1?"label" in t?"label" in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ke(t)===e:t.disabled===e:"label" in t?t.disabled===e:!1}}function c(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;){n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}})})}function f(e){return e&&void 0!==e.getElementsByTagName&&e}function p(){}function d(e){for(var t=0,n=e.length,r="";n>t;t++){r+=e[t].value}return r}function h(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=_++;return t.first?function(t,n,i){for(;t=t[r];){if(1===t.nodeType||a){return e(t,n,i)}}return !1}:function(t,n,u){var l,c,f,p=[B,s];if(u){for(;t=t[r];){if((1===t.nodeType||a)&&e(t,n,u)){return !0}}}else{for(;t=t[r];){if(1===t.nodeType||a){if(f=t[F]||(t[F]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase()){t=t[r]||t}else{if((l=c[o])&&l[0]===B&&l[1]===s){return p[2]=l[2]}if(c[o]=p,p[2]=e(t,n,u)){return !0}}}}}return !1}}function g(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;){if(!e[i](t,n,r)){return !1}}return !0}:e[0]}function m(e,n,r){for(var i=0,o=n.length;o>i;i++){t(e,n[i],r)}return r}function v(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;u>s;s++){(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s))}return a}function y(e,t,n,i,o,a){return i&&!i[F]&&(i=y(i)),o&&!o[F]&&(o=y(o,a)),r(function(r,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=r||m(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?g:v(g,p,e,s,u),x=n?o||(r?e:h||i)?[]:a:y;if(n&&n(y,x,s,u),i){for(l=v(x,d),i(l,[],s,u),c=l.length;c--;){(f=l[c])&&(x[d[c]]=!(y[d[c]]=f))}}if(r){if(o||e){if(o){for(l=[],c=x.length;c--;){(f=x[c])&&l.push(y[c]=f)}o(null,x=[],l,u)}for(c=x.length;c--;){(f=x[c])&&(l=o?te(r,f):p[c])>-1&&(r[l]=!(a[l]=f))}}}else{x=v(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Z.apply(a,x)}})}function x(e){for(var t,n,r,i=e.length,o=C.relative[e[0].type],a=o||C.relative[" "],s=o?1:0,u=h(function(e){return e===t},a,!0),l=h(function(e){return te(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==j)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];i>s;s++){if(n=C.relative[e[s].type]){c=[h(g(c),n)]}else{if(n=C.filter[e[s].type].apply(null,e[s].matches),n[F]){for(r=++s;i>r&&!C.relative[e[r].type];r++){}return y(s>1&&g(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ue,"$1"),n,r>s&&x(e.slice(s,r)),i>r&&x(e=e.slice(r)),i>r&&d(e))}c.push(n)}}return g(c)}function b(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var c,f,p,d=0,h="0",g=r&&[],m=[],y=j,x=r||o&&C.find.TAG("*",l),b=B+=null==y?1:Math.random()||0.1,w=x.length;for(l&&(j=a==H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument==H||(L(c),s=!P);p=e[f++];){if(p(c,a||H,s)){u.push(c);break}}l&&(B=b)}i&&((c=!p&&c)&&d--,r&&g.push(c))}if(d+=h,i&&h!==d){for(f=0;p=n[f++];){p(g,m,a,s)}if(r){if(d>0){for(;h--;){g[h]||m[h]||(m[h]=J.call(u))}}m=v(m)}Z.apply(u,m),l&&!r&&m.length>0&&d+n.length>1&&t.uniqueSort(u)}return l&&(B=b,j=y),g};return i?r(a):a}var w,T,C,E,S,k,A,N,j,D,q,L,H,O,P,R,M,I,W,F="sizzle"+1*new Date,$=e.document,B=0,_=0,z=n(),U=n(),X=n(),V=n(),G=function(e,t){return e===t&&(q=!0),0},Y={}.hasOwnProperty,Q=[],J=Q.pop,K=Q.push,Z=Q.push,ee=Q.slice,te=function(e,t){for(var n=0,r=e.length;r>n;n++){if(e[n]===t){return n}}return -1},ne="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",re="[\\x20\\t\\r\\n\\f]",ie="(?:\\\\[\\da-fA-F]{1,6}"+re+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\x00-\\x7f])+",oe="\\["+re+"*("+ie+")(?:"+re+"*([*^$|!~]?=)"+re+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ie+"))|)"+re+"*\\]",ae=":("+ie+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",se=RegExp(re+"+","g"),ue=RegExp("^"+re+"+|((?:^|[^\\\\])(?:\\\\.)*)"+re+"+$","g"),le=RegExp("^"+re+"*,"+re+"*"),ce=RegExp("^"+re+"*([>+~]|"+re+")"+re+"*"),fe=RegExp(re+"|>"),pe=RegExp(ae),de=RegExp("^"+ie+"$"),he={ID:RegExp("^#("+ie+")"),CLASS:RegExp("^\\.("+ie+")"),TAG:RegExp("^("+ie+"|[*])"),ATTR:RegExp("^"+oe),PSEUDO:RegExp("^"+ae),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+re+"*(even|odd|(([+-]|)(\\d*)n|)"+re+"*(?:([+-]|)"+re+"*(\\d+)|))"+re+"*\\)|)","i"),bool:RegExp("^(?:"+ne+")$","i"),needsContext:RegExp("^"+re+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+re+"*((?:-\\d)?\\d*)"+re+"*\\)|)(?=[^-]|$)","i")},ge=/HTML$/i,me=/^(?:input|select|textarea|button)$/i,ve=/^h\d$/i,ye=/^[^{]+\{\s*\[native \w/,xe=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,be=/[+~]/,we=RegExp("\\\\[\\da-fA-F]{1,6}"+re+"?|\\\\([^\\r\\n\\f])","g"),Te=function(e,t){var n="0x"+e.slice(1)-65536;return t?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)},Ce=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Ee=function(e,t){return t?"\x00"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Se=function(){L()},ke=h(function(e){return e.disabled===!0&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{Z.apply(Q=ee.call($.childNodes),$.childNodes),Q[$.childNodes.length].nodeType}catch(Ae){Z={apply:Q.length?function(e,t){K.apply(e,ee.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];){}e.length=n-1}}}T=t.support={},S=t.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return !ge.test(t||n&&n.nodeName||"HTML")},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:$;return r!=H&&9===r.nodeType&&r.documentElement?(H=r,O=H.documentElement,P=!S(H),$!=H&&(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Se,!1):n.attachEvent&&n.attachEvent("onunload",Se)),T.scope=i(function(e){return O.appendChild(e).appendChild(H.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),T.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),T.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),T.getElementsByClassName=ye.test(H.getElementsByClassName),T.getById=i(function(e){return O.appendChild(e).id=F,!H.getElementsByName||!H.getElementsByName(F).length}),T.getById?(C.filter.ID=function(e){var t=e.replace(we,Te);return function(e){return e.getAttribute("id")===t}},C.find.ID=function(e,t){if(void 0!==t.getElementById&&P){var n=t.getElementById(e);return n?[n]:[]}}):(C.filter.ID=function(e){var t=e.replace(we,Te);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},C.find.ID=function(e,t){if(void 0!==t.getElementById&&P){var n,r,i,o=t.getElementById(e);if(o){if(n=o.getAttributeNode("id"),n&&n.value===e){return[o]}for(i=t.getElementsByName(e),r=0;o=i[r++];){if(n=o.getAttributeNode("id"),n&&n.value===e){return[o]}}}return[]}}),C.find.TAG=T.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):T.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];){1===n.nodeType&&r.push(n)}return r}return o},C.find.CLASS=T.getElementsByClassName&&function(e,t){return void 0!==t.getElementsByClassName&&P?t.getElementsByClassName(e):void 0},M=[],R=[],(T.qsa=ye.test(H.querySelectorAll))&&(i(function(e){var t;O.appendChild(e).innerHTML="<a id='"+F+"'></a><select id='"+F+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&R.push("[*^$]="+re+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||R.push("\\["+re+"*(?:value|"+ne+")"),e.querySelectorAll("[id~="+F+"-]").length||R.push("~="),t=H.createElement("input"),t.setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||R.push("\\["+re+"*name"+re+"*="+re+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||R.push(":checked"),e.querySelectorAll("a#"+F+"+*").length||R.push(".#.+[+~]"),e.querySelectorAll("\\\f"),R.push("[\\r\\n\\f]")}),i(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&R.push("name"+re+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&R.push(":enabled",":disabled"),O.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&R.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),R.push(",.*:")})),(T.matchesSelector=ye.test(I=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&i(function(e){T.disconnectedMatch=I.call(e,"*"),I.call(e,"[s!='']:x"),M.push("!=",ae)}),R=R.length&&RegExp(R.join("|")),M=M.length&&RegExp(M.join("|")),t=ye.test(O.compareDocumentPosition),W=t||ye.test(O.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t){for(;t=t.parentNode;){if(t===e){return !0}}}return !1},G=t?function(e,t){if(e===t){return q=!0,0}var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!T.sortDetached&&t.compareDocumentPosition(e)===n?e==H||e.ownerDocument==$&&W($,e)?-1:t==H||t.ownerDocument==$&&W($,t)?1:D?te(D,e)-te(D,t):0:4&n?-1:1)}:function(e,t){if(e===t){return q=!0,0}var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o){return e==H?-1:t==H?1:i?-1:o?1:D?te(D,e)-te(D,t):0}if(i===o){return a(e,t)}for(n=e;n=n.parentNode;){s.unshift(n)}for(n=t;n=n.parentNode;){u.unshift(n)}for(;s[r]===u[r];){r++}return r?a(s[r],u[r]):s[r]==$?-1:u[r]==$?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if(L(e),T.matchesSelector&&P&&!V[n+" "]&&(!M||!M.test(n))&&(!R||!R.test(n))){try{var r=I.call(e,n);if(r||T.disconnectedMatch||e.document&&11!==e.document.nodeType){return r}}catch(i){V(n,!0)}}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!=H&&L(e),W(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!=H&&L(e);var n=C.attrHandle[t.toLowerCase()],r=n&&Y.call(C.attrHandle,t.toLowerCase())?n(e,t,!P):void 0;return void 0!==r?r:T.attributes||!P?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(Ce,Ee)},t.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(q=!T.detectDuplicates,D=!T.sortStable&&e.slice(0),e.sort(G),q){for(;t=e[i++];){t===e[i]&&(r=n.push(i))}for(;r--;){e.splice(n[r],1)}}return D=null,e},E=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent){return e.textContent}for(e=e.firstChild;e;e=e.nextSibling){n+=E(e)}}else{if(3===i||4===i){return e.nodeValue}}}else{for(;t=e[r++];){n+=E(t)}}return n},C=t.selectors={cacheLength:50,createPseudo:r,match:he,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(we,Te),e[3]=(e[3]||e[4]||e[5]||"").replace(we,Te),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return he.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&pe.test(n)&&(t=k(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(we,Te).toLowerCase();return"*"===e?function(){return !0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=z[e+" "];return t||(t=RegExp("(^|"+re+")"+e+"("+re+"|$)"))&&z(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:n?(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(se," ")+" ").indexOf(r)>-1:"|="===n?o===r||o.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return !!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!u&&!s,x=!1;if(m){if(o){for(;g;){for(p=t;p=p[g];){if(s?p.nodeName.toLowerCase()===v:1===p.nodeType){return !1}}h=g="only"===e&&!h&&"nextSibling"}return !0}if(h=[a?m.firstChild:m.lastChild],a&&y){for(p=m,f=p[F]||(p[F]={}),c=f[p.uniqueID]||(f[p.uniqueID]={}),l=c[e]||[],d=l[0]===B&&l[1],x=d&&l[2],p=d&&m.childNodes[d];p=++d&&p&&p[g]||(x=d=0)||h.pop();){if(1===p.nodeType&&++x&&p===t){c[e]=[B,d,x];break}}}else{if(y&&(p=t,f=p[F]||(p[F]={}),c=f[p.uniqueID]||(f[p.uniqueID]={}),l=c[e]||[],d=l[0]===B&&l[1],x=d),x===!1){for(;(p=++d&&p&&p[g]||(x=d=0)||h.pop())&&((s?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++x||(y&&(f=p[F]||(p[F]={}),c=f[p.uniqueID]||(f[p.uniqueID]={}),c[e]=[B,x]),p!==t));){}}}return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=C.pseudos[e]||C.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[F]?o(n):o.length>1?(i=[e,e,"",n],C.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;){r=te(e,i[a]),e[r]=!(t[r]=i[a])}}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=A(e.replace(ue,"$1"));return i[F]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;){(o=a[s])&&(e[s]=!(t[s]=o))}}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(we,Te),function(t){return(t.textContent||E(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(we,Te).toLowerCase(),function(t){var n;do{if(n=P?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang")){return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-")}}while((t=t.parentNode)&&1===t.nodeType);return !1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===O},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:l(!1),disabled:l(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeType<6){return !1}}return !0},parent:function(e){return !C.pseudos.empty(e)},header:function(e){return ve.test(e.nodeName)},input:function(e){return me.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2){e.push(n)}return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2){e.push(n)}return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n>t?t:n;--r>=0;){e.push(r)}return e}),gt:c(function(e,t,n){for(var r=0>n?n+t:n;++r<t;){e.push(r)}return e})}},C.pseudos.nth=C.pseudos.eq;for(w in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0}){C.pseudos[w]=s(w)}for(w in {submit:!0,reset:!0}){C.pseudos[w]=u(w)}return p.prototype=C.filters=C.pseudos,C.setFilters=new p,k=t.tokenize=function(e,n){var r,i,o,a,s,u,l,c=U[e+" "];if(c){return n?0:c.slice(0)}for(s=e,u=[],l=C.preFilter;s;){(!r||(i=le.exec(s)))&&(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),r=!1,(i=ce.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(ue," ")}),s=s.slice(r.length));for(a in C.filter){!(i=he[a].exec(s))||l[a]&&!(i=l[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length))}if(!r){break}}return n?s.length:s?t.error(e):U(e,u).slice(0)},A=t.compile=function(e,t){var n,r=[],i=[],o=X[e+" "];if(!o){for(t||(t=k(e)),n=t.length;n--;){o=x(t[n]),o[F]?r.push(o):i.push(o)}o=X(e,b(i,r)),o.selector=e}return o},N=t.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&k(e=l.selector||e);if(n=n||[],1===c.length){if(o=c[0]=c[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&9===t.nodeType&&P&&C.relative[o[1].type]){if(t=(C.find.ID(a.matches[0].replace(we,Te),t)||[])[0],!t){return n}l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=he.needsContext.test(e)?0:o.length;i--&&(a=o[i],!C.relative[s=a.type]);){if((u=C.find[s])&&(r=u(a.matches[0].replace(we,Te),be.test(o[0].type)&&f(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e){return Z.apply(n,r),n}break}}}return(l||A(e,c))(r,t,!P,n,!t||be.test(e)&&f(t.parentNode)||t),n},T.sortStable=F.split("").sort(G).join("")===F,T.detectDuplicates=!!q,L(),T.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("fieldset"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),T.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(ne,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);Se.find=ke,Se.expr=ke.selectors,Se.expr[":"]=Se.expr.pseudos,Se.uniqueSort=Se.unique=ke.uniqueSort,Se.text=ke.getText,Se.isXMLDoc=ke.isXML,Se.contains=ke.contains,Se.escapeSelector=ke.escape;var Ae=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;){if(1===e.nodeType){if(i&&Se(e).is(n)){break}r.push(e)}}return r},Ne=function(e,t){for(var n=[];e;e=e.nextSibling){1===e.nodeType&&e!==t&&n.push(e)}return n},je=Se.expr.match.needsContext,De=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;Se.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?Se.find.matchesSelector(r,e)?[r]:[]:Se.find.matches(e,Se.grep(t,function(e){return 1===e.nodeType}))},Se.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e){return this.pushStack(Se(e).filter(function(){for(t=0;r>t;t++){if(Se.contains(i[t],this)){return !0}}}))}for(n=this.pushStack([]),t=0;r>t;t++){Se.find(e,i[t],n)}return r>1?Se.uniqueSort(n):n},filter:function(e){return this.pushStack(a(this,e||[],!1))},not:function(e){return this.pushStack(a(this,e||[],!0))},is:function(e){return !!a(this,"string"==typeof e&&je.test(e)?Se(e):e||[],!1).length}});var qe,Le=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,He=Se.fn.init=function(e,t,n){var r,i;if(!e){return this}if(n=n||qe,"string"==typeof e){if(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Le.exec(e),!r||!r[1]&&t){return !t||t.jquery?(t||n).find(e):this.constructor(t).find(e)}if(r[1]){if(t=t instanceof Se?t[0]:t,Se.merge(this,Se.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:Te,!0)),De.test(r[1])&&Se.isPlainObject(t)){for(r in t){be(this[r])?this[r](t[r]):this.attr(r,t[r])}}return this}return i=Te.getElementById(r[2]),i&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):be(e)?void 0!==n.ready?n.ready(e):e(Se):Se.makeArray(e,this)};He.prototype=Se.fn,qe=Se(Te);var Oe=/^(?:parents|prev(?:Until|All))/,Pe={children:!0,contents:!0,next:!0,prev:!0};Se.fn.extend({has:function(e){var t=Se(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++){if(Se.contains(this,t[e])){return !0}}})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&Se(e);if(!je.test(e)){for(;i>r;r++){for(n=this[r];n&&n!==t;n=n.parentNode){if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&Se.find.matchesSelector(n,e))){o.push(n);break}}}}return this.pushStack(o.length>1?Se.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?de.call(Se(e),this[0]):de.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(Se.uniqueSort(Se.merge(this.get(),Se(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Se.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Ae(e,"parentNode")},parentsUntil:function(e,t,n){return Ae(e,"parentNode",n)},next:function(e){return s(e,"nextSibling")},prev:function(e){return s(e,"previousSibling")},nextAll:function(e){return Ae(e,"nextSibling")},prevAll:function(e){return Ae(e,"previousSibling")},nextUntil:function(e,t,n){return Ae(e,"nextSibling",n)},prevUntil:function(e,t,n){return Ae(e,"previousSibling",n)},siblings:function(e){return Ne((e.parentNode||{}).firstChild,e)},children:function(e){return Ne(e.firstChild)},contents:function(e){return null!=e.contentDocument&&le(e.contentDocument)?e.contentDocument:(o(e,"template")&&(e=e.content||e),Se.merge([],e.childNodes))}},function(e,t){Se.fn[e]=function(n,r){var i=Se.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=Se.filter(r,i)),this.length>1&&(Pe[e]||Se.uniqueSort(i),Oe.test(e)&&i.reverse()),this.pushStack(i)}});var Re=/[^\x20\t\r\n\f]+/g;Se.Callbacks=function(e){e="string"==typeof e?u(e):Se.extend({},e);var t,n,i,o,a=[],s=[],l=-1,c=function(){for(o=o||e.once,i=t=!0;s.length;l=-1){for(n=s.shift();++l<a.length;){a[l].apply(n[0],n[1])===!1&&e.stopOnFalse&&(l=a.length,n=!1)}}e.memory||(n=!1),t=!1,o&&(a=n?[]:"")},f={add:function(){return a&&(n&&!t&&(l=a.length-1,s.push(n)),function i(t){Se.each(t,function(t,n){be(n)?e.unique&&f.has(n)||a.push(n):n&&n.length&&"string"!==r(n)&&i(n)})}(arguments),n&&!t&&c()),this},remove:function(){return Se.each(arguments,function(e,t){for(var n;(n=Se.inArray(t,a,n))>-1;){a.splice(n,1),l>=n&&l--}}),this},has:function(e){return e?Se.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return o=s=[],a=n="",this},disabled:function(){return !a},lock:function(){return o=s=[],n||t||(a=n=""),this},locked:function(){return !!o},fireWith:function(e,n){return o||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return !!i}};return f},Se.extend({Deferred:function(t){var n=[["notify","progress",Se.Callbacks("memory"),Se.Callbacks("memory"),2],["resolve","done",Se.Callbacks("once memory"),Se.Callbacks("once memory"),0,"resolved"],["reject","fail",Se.Callbacks("once memory"),Se.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return Se.Deferred(function(t){Se.each(n,function(n,r){var i=be(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&be(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){function o(t,n,r,i){return function(){var s=this,u=arguments,f=function(){var e,f;if(!(a>t)){if(e=r.apply(s,u),e===n.promise()){throw new TypeError("Thenable self-resolution")}f=e&&("object"==typeof e||"function"==typeof e)&&e.then,be(f)?i?f.call(e,o(a,n,l,i),o(a,n,c,i)):(a++,f.call(e,o(a,n,l,i),o(a,n,c,i),o(a,n,l,n.notifyWith))):(r!==l&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},p=i?f:function(){try{f()}catch(e){Se.Deferred.exceptionHook&&Se.Deferred.exceptionHook(e,p.stackTrace),t+1>=a&&(r!==c&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?p():(Se.Deferred.getStackHook&&(p.stackTrace=Se.Deferred.getStackHook()),e.setTimeout(p))}}var a=0;return Se.Deferred(function(e){n[0][3].add(o(0,e,be(i)?i:l,e.notifyWith)),n[1][3].add(o(0,e,be(t)?t:l)),n[2][3].add(o(0,e,be(r)?r:c))}).promise()},promise:function(e){return null!=e?Se.extend(e,i):i}},o={};return Se.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=ce.call(arguments),o=Se.Deferred(),a=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?ce.call(arguments):n,--t||o.resolveWith(r,i)}};if(1>=t&&(f(e,o.done(a(n)).resolve,o.reject,!t),"pending"===o.state()||be(i[n]&&i[n].then))){return o.then()}for(;n--;){f(i[n],a(n),o.reject)}return o.promise()}});var Me=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;Se.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&Me.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},Se.readyException=function(t){e.setTimeout(function(){throw t})};var Ie=Se.Deferred();Se.fn.ready=function(e){return Ie.then(e)["catch"](function(e){Se.readyException(e)}),this},Se.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--Se.readyWait:Se.isReady)||(Se.isReady=!0,e!==!0&&--Se.readyWait>0||Ie.resolveWith(Te,[Se]))}}),Se.ready.then=Ie.then,"complete"===Te.readyState||"loading"!==Te.readyState&&!Te.documentElement.doScroll?e.setTimeout(Se.ready):(Te.addEventListener("DOMContentLoaded",p),e.addEventListener("load",p));var We=function(e,t,n,i,o,a,s){var u=0,l=e.length,c=null==n;if("object"===r(n)){o=!0;for(u in n){We(e,t,u,n[u],!0,a,s)}}else{if(void 0!==i&&(o=!0,be(i)||(s=!0),c&&(s?(t.call(e,i),t=null):(c=t,t=function(e,t,n){return c.call(Se(e),n)})),t)){for(;l>u;u++){t(e[u],n,s?i:i.call(e[u],u,t(e[u],n)))}}}return o?e:c?t.call(e):l?t(e[0],n):a},Fe=/^-ms-/,$e=/-([a-z])/g,Be=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};g.uid=1,g.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Be(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t){i[h(t)]=n}else{for(r in t){i[h(r)]=t[r]}}return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][h(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){Array.isArray(t)?t=t.map(h):(t=h(t),t=t in r?[t]:t.match(Re)||[]),n=t.length;for(;n--;){delete r[t[n]]}}(void 0===t||Se.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!Se.isEmptyObject(t)}};var _e=new g,ze=new g,Ue=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Xe=/[A-Z]/g;Se.extend({hasData:function(e){return ze.hasData(e)||_e.hasData(e)},data:function(e,t,n){return ze.access(e,t,n)},removeData:function(e,t){ze.remove(e,t)},_data:function(e,t,n){return _e.access(e,t,n)},_removeData:function(e,t){_e.remove(e,t)}}),Se.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=ze.get(o),1===o.nodeType&&!_e.get(o,"hasDataAttrs"))){for(n=a.length;n--;){a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=h(r.slice(5)),v(o,r,i[r])))}_e.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){ze.set(this,e)}):We(this,function(t){var n;if(o&&void 0===t){if(n=ze.get(o,e),void 0!==n){return n}if(n=v(o,e),void 0!==n){return n}}else{this.each(function(){ze.set(this,e,t)})}},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){ze.remove(this,e)})}}),Se.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=_e.get(e,t),n&&(!r||Array.isArray(n)?r=_e.access(e,t,Se.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=Se.queue(e,t),r=n.length,i=n.shift(),o=Se._queueHooks(e,t),a=function(){Se.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _e.get(e,n)||_e.access(e,n,{empty:Se.Callbacks("once memory").add(function(){_e.remove(e,[t+"queue",n])})})}}),Se.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?Se.queue(this[0],e):void 0===t?this:this.each(function(){var n=Se.queue(this,e,t);Se._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&Se.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Se.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=Se.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;){n=_e.get(o[a],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(s))}return s(),i.promise(t)}});var Ve=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Ge=RegExp("^(?:([+-])=|)("+Ve+")([a-z%]*)$","i"),Ye=["Top","Right","Bottom","Left"],Qe=Te.documentElement,Je=function(e){return Se.contains(e.ownerDocument,e)},Ke={composed:!0};Qe.getRootNode&&(Je=function(e){return Se.contains(e.ownerDocument,e)||e.getRootNode(Ke)===e.ownerDocument});var Ze=function(e,t){return e=t||e,"none"===e.style.display||""===e.style.display&&Je(e)&&"none"===Se.css(e,"display")},et={};Se.fn.extend({show:function(){return b(this,!0)},hide:function(){return b(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Ze(this)?Se(this).show():Se(this).hide()})}});var tt=/^(?:checkbox|radio)$/i,nt=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,rt=/^$|^module$|\/(?:java|ecma)script/i;!function(){var e=Te.createDocumentFragment(),t=e.appendChild(Te.createElement("div")),n=Te.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),xe.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",xe.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,t.innerHTML="<option></option>",xe.option=!!t.lastChild}();var it={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};it.tbody=it.tfoot=it.colgroup=it.caption=it.thead,it.th=it.td,xe.option||(it.optgroup=it.option=[1,"<select multiple='multiple'>","</select>"]);var ot=/<|&#?\w+;/,at=/^([^.]*)(?:\.(.+)|)/;Se.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,m=_e.get(e);if(Be(e)){for(n.handler&&(o=n,n=o.handler,i=o.selector),i&&Se.find.matchesSelector(Qe,i),n.guid||(n.guid=Se.guid++),(u=m.events)||(u=m.events=Object.create(null)),(a=m.handle)||(a=m.handle=function(t){return void 0!==Se&&Se.event.triggered!==t.type?Se.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Re)||[""],l=t.length;l--;){s=at.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d&&(f=Se.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=Se.event.special[d]||{},c=Se.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&Se.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||(p=u[d]=[],p.delegateCount=0,f.setup&&f.setup.call(e,r,h,a)!==!1||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),Se.event.global[d]=!0)}}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,m=_e.hasData(e)&&_e.get(e);if(m&&(u=m.events)){for(t=(t||"").match(Re)||[""],l=t.length;l--;){if(s=at.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){for(f=Se.event.special[d]||{},d=(r?f.delegateType:f.bindType)||d,p=u[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;o--;){c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c))}a&&!p.length&&(f.teardown&&f.teardown.call(e,h,m.handle)!==!1||Se.removeEvent(e,d,m.handle),delete u[d])}else{for(d in u){Se.event.remove(e,d+t[l],n,r,!0)}}}Se.isEmptyObject(u)&&_e.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=Array(arguments.length),u=Se.event.fix(e),l=(_e.get(this,"events")||Object.create(null))[u.type]||[],c=Se.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++){s[t]=arguments[t]}if(u.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,u)!==!1){for(a=Se.event.handlers.call(this,u,l),t=0;(i=a[t++])&&!u.isPropagationStopped();){for(u.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!u.isImmediatePropagationStopped();){(!u.rnamespace||o.namespace===!1||u.rnamespace.test(o.namespace))&&(u.handleObj=o,u.data=o.data,r=((Se.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(u.result=r)===!1&&(u.preventDefault(),u.stopPropagation()))}}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1)){for(;l!==this;l=l.parentNode||this){if(1===l.nodeType&&("click"!==e.type||l.disabled!==!0)){for(o=[],a={},n=0;u>n;n++){r=t[n],i=r.selector+" ",void 0===a[i]&&(a[i]=r.needsContext?Se(i,this).index(l)>-1:Se.find(i,this,null,[l]).length),a[i]&&o.push(r)}o.length&&s.push({elem:l,handlers:o})}}}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(Se.Event.prototype,e,{enumerable:!0,configurable:!0,get:be(t)?function(){return this.originalEvent?t(this.originalEvent):void 0}:function(){return this.originalEvent?this.originalEvent[e]:void 0},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[Se.expando]?e:new Se.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return tt.test(t.type)&&t.click&&o(t,"input")&&j(t,"click",E),!1},trigger:function(e){var t=this||e;return tt.test(t.type)&&t.click&&o(t,"input")&&j(t,"click"),!0},_default:function(e){var t=e.target;return tt.test(t.type)&&t.click&&o(t,"input")&&_e.get(t,"click")||o(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},Se.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},Se.Event=function(e,t){return this instanceof Se.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?E:S,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&Se.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),void (this[Se.expando]=!0)):new Se.Event(e,t)},Se.Event.prototype={constructor:Se.Event,isDefaultPrevented:S,isPropagationStopped:S,isImmediatePropagationStopped:S,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=E,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=E,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=E,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},Se.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},Se.event.addProp),Se.each({focus:"focusin",blur:"focusout"},function(e,t){Se.event.special[e]={setup:function(){return j(this,e,k),!1},trigger:function(){return j(this,e),!0},_default:function(t){return _e.get(t.target,e)},delegateType:t}}),Se.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){Se.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!Se.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),Se.fn.extend({on:function(e,t,n,r){return N(this,e,t,n,r)},one:function(e,t,n,r){return N(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj){return r=e.handleObj,Se(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this}if("object"==typeof e){for(i in e){this.off(i,t,e[i])}return this}return(t===!1||"function"==typeof t)&&(n=t,t=void 0),n===!1&&(n=S),this.each(function(){Se.event.remove(this,e,n,t)})}});var st=/<script|<style|<link/i,ut=/checked\s*(?:[^=]|=\s*.checked.)/i,lt=/^\s*<!\[CDATA\[|\]\]>\s*$/g;Se.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=Je(e);if(!(xe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Se.isXMLDoc(e))){for(a=w(s),o=w(e),r=0,i=o.length;i>r;r++){O(o[r],a[r])}}if(t){if(n){for(o=o||w(e),a=a||w(s),r=0,i=o.length;i>r;r++){H(o[r],a[r])}}else{H(e,s)}}return a=w(s,"script"),a.length>0&&T(a,!u&&w(e,"script")),s},cleanData:function(e){for(var t,n,r,i=Se.event.special,o=0;void 0!==(n=e[o]);o++){if(Be(n)){if(t=n[_e.expando]){if(t.events){for(r in t.events){i[r]?Se.event.remove(n,r):Se.removeEvent(n,r,t.handle)}}n[_e.expando]=void 0}n[ze.expando]&&(n[ze.expando]=void 0)}}}}),Se.fn.extend({detach:function(e){return R(this,e,!0)},remove:function(e){return R(this,e)},text:function(e){return We(this,function(e){return void 0===e?Se.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=e)})},null,e,arguments.length)},append:function(){return P(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=D(this,e);t.appendChild(e)}})},prepend:function(){return P(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=D(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return P(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return P(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){1===e.nodeType&&(Se.cleanData(w(e,!1)),e.textContent="")}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return Se.clone(this,e,t)})},html:function(e){return We(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType){return t.innerHTML}if("string"==typeof e&&!st.test(e)&&!it[(nt.exec(e)||["",""])[1].toLowerCase()]){e=Se.htmlPrefilter(e);try{for(;r>n;n++){t=this[n]||{},1===t.nodeType&&(Se.cleanData(w(t,!1)),t.innerHTML=e)}t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return P(this,arguments,function(t){var n=this.parentNode;Se.inArray(this,e)<0&&(Se.cleanData(w(this)),n&&n.replaceChild(t,this))},e)}}),Se.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Se.fn[e]=function(e){for(var n,r=[],i=Se(e),o=i.length-1,a=0;o>=a;a++){n=a===o?this:this.clone(!0),Se(i[a])[t](n),pe.apply(r,n.get())}return this.pushStack(r)}});var ct=RegExp("^("+Ve+")(?!px)[a-z%]+$","i"),ft=/^--/,pt=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},dt=function(e,t,n){var r,i,o={};for(i in t){o[i]=e.style[i],e.style[i]=t[i]}r=n.call(e);for(i in t){e.style[i]=o[i]}return r},ht=RegExp(Ye.join("|"),"i"),gt="[\\x20\\t\\r\\n\\f]",mt=RegExp("^"+gt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+gt+"+$","g");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",Qe.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);r="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",a=36===n(t.right),i=36===n(t.width),c.style.position="absolute",o=12===n(c.offsetWidth/3),Qe.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var r,i,o,a,s,u,l=Te.createElement("div"),c=Te.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",xe.clearCloneStyle="content-box"===c.style.backgroundClip,Se.extend(xe,{boxSizingReliable:function(){return t(),i},pixelBoxStyles:function(){return t(),a},pixelPosition:function(){return t(),r},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),o},reliableTrDimensions:function(){var t,n,r,i;return null==s&&(t=Te.createElement("table"),n=Te.createElement("tr"),r=Te.createElement("div"),t.style.cssText="position:absolute;left:-11111px;border-collapse:separate",n.style.cssText="border:1px solid",n.style.height="1px",r.style.height="9px",r.style.display="block",Qe.appendChild(t).appendChild(n).appendChild(r),i=e.getComputedStyle(n),s=parseInt(i.height,10)+parseInt(i.borderTopWidth,10)+parseInt(i.borderBottomWidth,10)===n.offsetHeight,Qe.removeChild(t)),s}}))}();var vt=["Webkit","Moz","ms"],yt=Te.createElement("div").style,xt={},bt=/^(none|table(?!-c[ea]).+)/,wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"};Se.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=M(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=h(t),u=ft.test(t),l=e.style;return u||(t=F(s)),a=Se.cssHooks[t]||Se.cssHooks[s],void 0===n?a&&"get" in a&&void 0!==(i=a.get(e,!1,r))?i:l[t]:(o=typeof n,"string"===o&&(i=Ge.exec(n))&&i[1]&&(n=y(e,t,i),o="number"),null!=n&&n===n&&("number"!==o||u||(n+=i&&i[3]||(Se.cssNumber[s]?"":"px")),xe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set" in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n)),void 0)}},css:function(e,t,n,r){var i,o,a,s=h(t),u=ft.test(t);return u||(t=F(s)),a=Se.cssHooks[t]||Se.cssHooks[s],a&&"get" in a&&(i=a.get(e,!0,n)),void 0===i&&(i=M(e,t,r)),"normal"===i&&t in Tt&&(i=Tt[t]),""===n||n?(o=parseFloat(i),n===!0||isFinite(o)?o||0:i):i}}),Se.each(["height","width"],function(e,t){Se.cssHooks[t]={get:function(e,n,r){return n?!bt.test(Se.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?z(e,t,r):dt(e,wt,function(){return z(e,t,r)}):void 0},set:function(e,n,r){var i,o=pt(e),a=!xe.scrollboxSize()&&"absolute"===o.position,s=a||r,u=s&&"border-box"===Se.css(e,"boxSizing",!1,o),l=r?_(e,t,r,u,o):0;return u&&a&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-_(e,t,"border",!1,o)-0.5)),l&&(i=Ge.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=Se.css(e,t)),B(e,n,l)}}}),Se.cssHooks.marginLeft=I(xe.reliableMarginLeft,function(e,t){return t?(parseFloat(M(e,"marginLeft"))||e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px":void 0}),Se.each({margin:"",padding:"",border:"Width"},function(e,t){Se.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];4>r;r++){i[e+Ye[r]+t]=o[r]||o[r-2]||o[0]}return i}},"margin"!==e&&(Se.cssHooks[e+t].set=B)}),Se.fn.extend({css:function(e,t){return We(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=pt(e),i=t.length;i>a;a++){o[t[a]]=Se.css(e,t[a],!1,r)}return o}return void 0!==n?Se.style(e,t,n):Se.css(e,t)},e,t,arguments.length>1)}}),Se.Tween=U,U.prototype={constructor:U,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||Se.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(Se.cssNumber[n]?"":"px")},cur:function(){var e=U.propHooks[this.prop];return e&&e.get?e.get(this):U.propHooks._default.get(this)},run:function(e){var t,n=U.propHooks[this.prop];return this.options.duration?this.pos=t=Se.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):U.propHooks._default.set(this),this}},U.prototype.init.prototype=U.prototype,U.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=Se.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){Se.fx.step[e.prop]?Se.fx.step[e.prop](e):1!==e.elem.nodeType||!Se.cssHooks[e.prop]&&null==e.elem.style[F(e.prop)]?e.elem[e.prop]=e.now:Se.style(e.elem,e.prop,e.now+e.unit)}}},U.propHooks.scrollTop=U.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Se.easing={linear:function(e){return e},swing:function(e){return 0.5-Math.cos(e*Math.PI)/2},_default:"swing"},Se.fx=U.prototype.init,Se.fx.step={};var Ct,Et,St=/^(?:toggle|show|hide)$/,kt=/queueHooks$/;Se.Animation=Se.extend(K,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return y(n.elem,e,Ge.exec(t),n),n}]},tweener:function(e,t){be(e)?(t=e,e=["*"]):e=e.match(Re);for(var n,r=0,i=e.length;i>r;r++){n=e[r],K.tweeners[n]=K.tweeners[n]||[],K.tweeners[n].unshift(t)}},prefilters:[Q],prefilter:function(e,t){t?K.prefilters.unshift(e):K.prefilters.push(e)}}),Se.speed=function(e,t,n){var r=e&&"object"==typeof e?Se.extend({},e):{complete:n||!n&&t||be(e)&&e,duration:e,easing:n&&t||t&&!be(t)&&t};return Se.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in Se.fx.speeds?r.duration=Se.fx.speeds[r.duration]:r.duration=Se.fx.speeds._default),(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){be(r.old)&&r.old.call(this),r.queue&&Se.dequeue(this,r.queue)},r},Se.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Ze).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=Se.isEmptyObject(e),o=Se.speed(t,n,r),a=function(){var t=K(this,Se.extend({},e),o);(i||_e.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=Se.timers,a=_e.get(this);if(i){a[i]&&a[i].stop&&r(a[i])}else{for(i in a){a[i]&&a[i].stop&&kt.test(i)&&r(a[i])}}for(i=o.length;i--;){o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1))}(t||!n)&&Se.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=_e.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=Se.timers,a=r?r.length:0;for(n.finish=!0,Se.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;){o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1))}for(t=0;a>t;t++){r[t]&&r[t].finish&&r[t].finish.call(this)}delete n.finish})}}),Se.each(["toggle","show","hide"],function(e,t){var n=Se.fn[t];Se.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(G(t,!0),e,r,i)}}),Se.each({slideDown:G("show"),slideUp:G("hide"),slideToggle:G("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Se.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),Se.timers=[],Se.fx.tick=function(){var e,t=0,n=Se.timers;for(Ct=Date.now();t<n.length;t++){e=n[t],e()||n[t]!==e||n.splice(t--,1)}n.length||Se.fx.stop(),Ct=void 0},Se.fx.timer=function(e){Se.timers.push(e),Se.fx.start()},Se.fx.interval=13,Se.fx.start=function(){Et||(Et=!0,X())},Se.fx.stop=function(){Et=null},Se.fx.speeds={slow:600,fast:200,_default:400},Se.fn.delay=function(t,n){return t=Se.fx?Se.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=Te.createElement("input"),t=Te.createElement("select"),n=t.appendChild(Te.createElement("option"));e.type="checkbox",xe.checkOn=""!==e.value,xe.optSelected=n.selected,e=Te.createElement("input"),e.value="t",e.type="radio",xe.radioValue="t"===e.value}();var At,Nt=Se.expr.attrHandle;Se.fn.extend({attr:function(e,t){return We(this,Se.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Se.removeAttr(this,e)})}}),Se.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o){return void 0===e.getAttribute?Se.prop(e,t,n):(1===o&&Se.isXMLDoc(e)||(i=Se.attrHooks[t.toLowerCase()]||(Se.expr.match.bool.test(t)?At:void 0)),void 0!==n?null===n?void Se.removeAttr(e,t):i&&"set" in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get" in i&&null!==(r=i.get(e,t))?r:(r=Se.find.attr(e,t),null==r?void 0:r))}},attrHooks:{type:{set:function(e,t){if(!xe.radioValue&&"radio"===t&&o(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(Re);if(i&&1===e.nodeType){for(;n=i[r++];){e.removeAttribute(n)}}}}),At={set:function(e,t,n){return t===!1?Se.removeAttr(e,n):e.setAttribute(n,n),n}},Se.each(Se.expr.match.bool.source.match(/\w+/g),function(e,t){var n=Nt[t]||Se.find.attr;Nt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=Nt[a],Nt[a]=i,i=null!=n(e,t,r)?a:null,Nt[a]=o),i}});var jt=/^(?:input|select|textarea|button)$/i,Dt=/^(?:a|area)$/i;Se.fn.extend({prop:function(e,t){return We(this,Se.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[Se.propFix[e]||e]})}}),Se.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o){return 1===o&&Se.isXMLDoc(e)||(t=Se.propFix[t]||t,i=Se.propHooks[t]),void 0!==n?i&&"set" in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get" in i&&null!==(r=i.get(e,t))?r:e[t]}},propHooks:{tabIndex:{get:function(e){var t=Se.find.attr(e,"tabindex");return t?parseInt(t,10):jt.test(e.nodeName)||Dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),xe.optSelected||(Se.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),Se.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){Se.propFix[this.toLowerCase()]=this}),Se.fn.extend({addClass:function(e){var t,n,r,i,o,a;return be(e)?this.each(function(t){Se(this).addClass(e.call(this,t,ee(this)))}):(t=te(e),t.length?this.each(function(){if(r=ee(this),n=1===this.nodeType&&" "+Z(r)+" "){for(o=0;o<t.length;o++){i=t[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ")}a=Z(n),r!==a&&this.setAttribute("class",a)}}):this)},removeClass:function(e){var t,n,r,i,o,a;return be(e)?this.each(function(t){Se(this).removeClass(e.call(this,t,ee(this)))}):arguments.length?(t=te(e),t.length?this.each(function(){if(r=ee(this),n=1===this.nodeType&&" "+Z(r)+" "){for(o=0;o<t.length;o++){for(i=t[o];n.indexOf(" "+i+" ")>-1;){n=n.replace(" "+i+" "," ")}}a=Z(n),r!==a&&this.setAttribute("class",a)}}):this):this.attr("class","")},toggleClass:function(e,t){var n,r,i,o,a=typeof e,s="string"===a||Array.isArray(e);return be(e)?this.each(function(n){Se(this).toggleClass(e.call(this,n,ee(this),t),t)}):"boolean"==typeof t&&s?t?this.addClass(e):this.removeClass(e):(n=te(e),this.each(function(){if(s){for(o=Se(this),i=0;i<n.length;i++){r=n[i],o.hasClass(r)?o.removeClass(r):o.addClass(r)}}else{(void 0===e||"boolean"===a)&&(r=ee(this),r&&_e.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||e===!1?"":_e.get(this,"__className__")||""))}}))},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];){if(1===n.nodeType&&(" "+Z(ee(n))+" ").indexOf(t)>-1){return !0}}return !1}});var qt=/\r/g;Se.fn.extend({val:function(e){var t,n,r,i=this[0];if(arguments.length){return r=be(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,Se(this).val()):e,null==i?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=Se.map(i,function(e){return null==e?"":e+""})),t=Se.valHooks[this.type]||Se.valHooks[this.nodeName.toLowerCase()],t&&"set" in t&&void 0!==t.set(this,i,"value")||(this.value=i))})}if(i){return t=Se.valHooks[i.type]||Se.valHooks[i.nodeName.toLowerCase()],t&&"get" in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(qt,""):null==n?"":n)}}}),Se.extend({valHooks:{option:{get:function(e){var t=Se.find.attr(e,"value");return null!=t?t:Z(Se.text(e))}},select:{get:function(e){var t,n,r,i=e.options,a=e.selectedIndex,s="select-one"===e.type,u=s?null:[],l=s?a+1:i.length;for(r=0>a?l:s?a:0;l>r;r++){if(n=i[r],(n.selected||r===a)&&!n.disabled&&(!n.parentNode.disabled||!o(n.parentNode,"optgroup"))){if(t=Se(n).val(),s){return t}u.push(t)}}return u},set:function(e,t){for(var n,r,i=e.options,o=Se.makeArray(t),a=i.length;a--;){r=i[a],(r.selected=Se.inArray(Se.valHooks.option.get(r),o)>-1)&&(n=!0)}return n||(e.selectedIndex=-1),o}}}}),Se.each(["radio","checkbox"],function(){Se.valHooks[this]={set:function(e,t){return Array.isArray(t)?e.checked=Se.inArray(Se(e).val(),t)>-1:void 0}},xe.checkOn||(Se.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),xe.focusin="onfocusin" in e;var Lt=/^(?:focusinfocus|focusoutblur)$/,Ht=function(e){e.stopPropagation()};Se.extend(Se.event,{trigger:function(t,n,r,i){var o,a,s,u,l,c,f,p,d=[r||Te],h=me.call(t,"type")?t.type:t,g=me.call(t,"namespace")?t.namespace.split("."):[];if(a=p=s=r=r||Te,3!==r.nodeType&&8!==r.nodeType&&!Lt.test(h+Se.event.triggered)&&(h.indexOf(".")>-1&&(g=h.split("."),h=g.shift(),g.sort()),l=h.indexOf(":")<0&&"on"+h,t=t[Se.expando]?t:new Se.Event(h,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=g.join("."),t.rnamespace=t.namespace?RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:Se.makeArray(n,[t]),f=Se.event.special[h]||{},i||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!i&&!f.noBubble&&!we(r)){for(u=f.delegateType||h,Lt.test(u+h)||(a=a.parentNode);a;a=a.parentNode){d.push(a),s=a}s===(r.ownerDocument||Te)&&d.push(s.defaultView||s.parentWindow||e)}for(o=0;(a=d[o++])&&!t.isPropagationStopped();){p=a,t.type=o>1?u:f.bindType||h,c=(_e.get(a,"events")||Object.create(null))[t.type]&&_e.get(a,"handle"),c&&c.apply(a,n),c=l&&a[l],c&&c.apply&&Be(a)&&(t.result=c.apply(a,n),t.result===!1&&t.preventDefault())}return t.type=h,i||t.isDefaultPrevented()||f._default&&f._default.apply(d.pop(),n)!==!1||!Be(r)||l&&be(r[h])&&!we(r)&&(s=r[l],s&&(r[l]=null),Se.event.triggered=h,t.isPropagationStopped()&&p.addEventListener(h,Ht),r[h](),t.isPropagationStopped()&&p.removeEventListener(h,Ht),Se.event.triggered=void 0,s&&(r[l]=s)),t.result}},simulate:function(e,t,n){var r=Se.extend(new Se.Event,n,{type:e,isSimulated:!0});Se.event.trigger(r,null,t)}}),Se.fn.extend({trigger:function(e,t){return this.each(function(){Se.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?Se.event.trigger(e,t,n,!0):void 0}}),xe.focusin||Se.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){Se.event.simulate(t,e.target,Se.event.fix(e))};Se.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,i=_e.access(r,t);i||r.addEventListener(e,n,!0),_e.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=_e.access(r,t)-1;i?_e.access(r,t,i):(r.removeEventListener(e,n,!0),_e.remove(r,t))}}});var Ot=e.location,Pt={guid:Date.now()},Rt=/\?/;Se.parseXML=function(t){var n,r;if(!t||"string"!=typeof t){return null}try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(i){}return r=n&&n.getElementsByTagName("parsererror")[0],(!n||r)&&Se.error("Invalid XML: "+(r?Se.map(r.childNodes,function(e){return e.textContent}).join("\n"):t)),n};var Mt=/\[\]$/,It=/\r?\n/g,Wt=/^(?:submit|button|image|reset|file)$/i,Ft=/^(?:input|select|textarea|keygen)/i;Se.param=function(e,t){var n,r=[],i=function(e,t){var n=be(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e){return""}if(Array.isArray(e)||e.jquery&&!Se.isPlainObject(e)){Se.each(e,function(){i(this.name,this.value)})}else{for(n in e){ne(n,e[n],t,i)}}return r.join("&")},Se.fn.extend({serialize:function(){var e=this.serializeArray(),t=$("input[type=radio],input[type=checkbox]",this),n={};return $.each(t,function(){n.hasOwnProperty(this.name)||0==$("input[name='"+this.name+"']:checked").length&&(n[this.name]="",e.push({name:this.name,value:""}))}),Se.param(e)},serializeArray:function(){return this.map(function(){var e=Se.prop(this,"elements");return e?Se.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!Se(this).is(":disabled")&&Ft.test(this.nodeName)&&!Wt.test(e)&&(this.checked||!tt.test(e))}).map(function(e,t){var n=Se(this).val();return null==n?null:Array.isArray(n)?Se.map(n,function(e){return{name:t.name,value:e.replace(It,"\r\n")}}):{name:t.name,value:n.replace(It,"\r\n")}}).get()}});var $t=/%20/g,Bt=/#.*$/,_t=/([?&])_=[^&]*/,zt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ut=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Xt=/^(?:GET|HEAD)$/,Vt=/^\/\//,Gt={},Yt={},Qt="*/".concat("*"),Jt=Te.createElement("a");Jt.href=Ot.href,Se.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ot.href,type:"GET",isLocal:Ut.test(Ot.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Qt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":Se.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?oe(oe(e,Se.ajaxSettings),t):oe(Se.ajaxSettings,e)},ajaxPrefilter:re(Gt),ajaxTransport:re(Yt),ajax:function(t,n){function r(t,n,r,s){var l,p,d,b,w,T=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",C.readyState=t>0?4:0,l=t>=200&&300>t||304===t,r&&(b=ae(h,C,r)),!l&&Se.inArray("script",h.dataTypes)>-1&&Se.inArray("json",h.dataTypes)<0&&(h.converters["text script"]=function(){}),b=se(h,b,C,l),l?(h.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(Se.lastModified[o]=w),w=C.getResponseHeader("etag"),w&&(Se.etag[o]=w)),204===t||"HEAD"===h.type?T="nocontent":304===t?T="notmodified":(T=b.state,p=b.data,d=b.error,l=!d)):(d=T,(t||!T)&&(T="error",0>t&&(t=0))),C.status=t,C.statusText=(n||T)+"",l?v.resolveWith(g,[p,T,C]):v.rejectWith(g,[C,T,d]),C.statusCode(x),x=void 0,f&&m.trigger(l?"ajaxSuccess":"ajaxError",[C,h,l?p:d]),y.fireWith(g,[C,T]),f&&(m.trigger("ajaxComplete",[C,h]),--Se.active||Se.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=Se.ajaxSetup({},n),g=h.context||h,m=h.context&&(g.nodeType||g.jquery)?Se(g):Se.event,v=Se.Deferred(),y=Se.Callbacks("once memory"),x=h.statusCode||{},b={},w={},T="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){for(s={};t=zt.exec(a);){s[t[1].toLowerCase()+" "]=(s[t[1].toLowerCase()+" "]||[]).concat(t[2])}}t=s[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e){if(c){C.always(e[C.status])}else{for(t in e){x[t]=[x[t],e[t]]}}}return this},abort:function(e){var t=e||T;return i&&i.abort(t),r(0,t),this}};if(v.promise(C),h.url=((t||h.url||Ot.href)+"").replace(Vt,Ot.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(Re)||[""],null==h.crossDomain){l=Te.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Jt.protocol+"//"+Jt.host!=l.protocol+"//"+l.host}catch(E){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=Se.param(h.data,h.traditional)),ie(Gt,h,n,C),c){return C}f=Se.event&&h.global,f&&0===Se.active++&&Se.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Xt.test(h.type),o=h.url.replace(Bt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace($t,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(Rt.test(o)?"&":"?")+h.data,delete h.data),h.cache===!1&&(o=o.replace(_t,"$1"),d=(Rt.test(o)?"&":"?")+"_="+Pt.guid+++d),h.url=o+d),h.ifModified&&(Se.lastModified[o]&&C.setRequestHeader("If-Modified-Since",Se.lastModified[o]),Se.etag[o]&&C.setRequestHeader("If-None-Match",Se.etag[o])),(h.data&&h.hasContent&&h.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",h.contentType),C.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Qt+"; q=0.01":""):h.accepts["*"]);for(p in h.headers){C.setRequestHeader(p,h.headers[p])}if(h.beforeSend&&(h.beforeSend.call(g,C,h)===!1||c)){return C.abort()}if(T="abort",y.add(h.complete),C.done(h.success),C.fail(h.error),i=ie(Yt,h,n,C)){if(C.readyState=1,f&&m.trigger("ajaxSend",[C,h]),c){return C}h.async&&h.timeout>0&&(u=e.setTimeout(function(){C.abort("timeout")},h.timeout));try{c=!1,i.send(b,r)}catch(E){if(c){throw E}r(-1,E)}}else{r(-1,"No Transport")}return C},getJSON:function(e,t,n){return Se.get(e,t,n,"json")},getScript:function(e,t){return Se.get(e,void 0,t,"script")}}),Se.each(["get","post"],function(e,t){Se[t]=function(e,n,r,i){return be(n)&&(i=i||r,r=n,n=void 0),Se.ajax(Se.extend({url:e,type:t,dataType:i,data:n,success:r},Se.isPlainObject(e)&&e))}}),Se.ajaxPrefilter(function(e){var t;for(t in e.headers){"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}}),Se._evalUrl=function(e,t,n){return Se.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){Se.globalEval(e,t,n)}})},Se.fn.extend({wrapAll:function(e){var t;return this[0]&&(be(e)&&(e=e.call(this[0])),t=Se(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;){e=e.firstElementChild}return e}).append(this)),this},wrapInner:function(e){return be(e)?this.each(function(t){Se(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Se(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=be(e);return this.each(function(n){Se(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){Se(this).replaceWith(this.childNodes)}),this}}),Se.expr.pseudos.hidden=function(e){return !Se.expr.pseudos.visible(e)},Se.expr.pseudos.visible=function(e){return !!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},Se.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(t){}};var Kt={0:200,1223:204},Zt=Se.ajaxSettings.xhr();xe.cors=!!Zt&&"withCredentials" in Zt,xe.ajax=Zt=!!Zt,Se.ajaxTransport(function(t){var n,r;return xe.cors||Zt&&!t.crossDomain?{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields){for(a in t.xhrFields){s[a]=t.xhrFields[a]}}t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i){s.setRequestHeader(a,i[a])}n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Kt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(u){if(n){throw u}}},abort:function(){n&&n()}}:void 0}),Se.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),Se.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return Se.globalEval(e),e}}}),Se.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),Se.ajaxTransport("script",function(e){if(e.crossDomain||e.scriptAttrs){var t,n;return{send:function(r,i){t=Se("<script>").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i("error"===e.type?404:200,e.type)}),Te.head.appendChild(t[0])},abort:function(){n&&n()}}}});var en=[],tn=/(=)\?(?=&|$)|\?\?/;Se.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=en.pop()||Se.expando+"_"+Pt.guid++;return this[e]=!0,e}}),Se.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(tn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&tn.test(t.data)&&"data");return s||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=be(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(tn,"$1"+i):t.jsonp!==!1&&(t.url+=(Rt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||Se.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?Se(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,en.push(i)),a&&be(o)&&o(a[0]),a=o=void 0}),"script"):void 0}),xe.createHTMLDocument=function(){var e=Te.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),Se.parseHTML=function(e,t,n){if("string"!=typeof e){return[]}"boolean"==typeof t&&(n=t,t=!1);var r,i,o;return t||(xe.createHTMLDocument?(t=Te.implementation.createHTMLDocument(""),r=t.createElement("base"),r.href=Te.location.href,t.head.appendChild(r)):t=Te),i=De.exec(e),o=!n&&[],i?[t.createElement(i[1])]:(i=C([e],t,o),o&&o.length&&Se(o).remove(),Se.merge([],i.childNodes))},Se.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=Z(e.slice(s)),e=e.slice(0,s)),be(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&Se.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?Se("<div>").append(Se.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},Se.expr.pseudos.animated=function(e){return Se.grep(Se.timers,function(t){return e===t.elem}).length},Se.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=Se.css(e,"position"),f=Se(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=Se.css(e,"top"),u=Se.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),be(t)&&(t=t.call(e,n,Se.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using" in t?t.using.call(e,p):f.css(p)}},Se.fn.extend({offset:function(e){if(arguments.length){return void 0===e?this:this.each(function(t){Se.offset.setOffset(this,e,t)})}var t,n,r=this[0];if(r){return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===Se.css(r,"position")){t=r.getBoundingClientRect()}else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===Se.css(e,"position");){e=e.parentNode}e&&e!==r&&1===e.nodeType&&(i=Se(e).offset(),i.top+=Se.css(e,"borderTopWidth",!0),i.left+=Se.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-Se.css(r,"marginTop",!0),left:t.left-i.left-Se.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===Se.css(e,"position");){e=e.offsetParent}return e||Qe})}}),Se.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;Se.fn[e]=function(r){return We(this,function(e,r,i){var o;return we(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i?o?o[t]:e[r]:void (o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i)},e,r,arguments.length)}}),Se.each(["top","left"],function(e,t){Se.cssHooks[t]=I(xe.pixelPosition,function(e,n){return n?(n=M(e,t),ct.test(n)?Se(e).position()[t]+"px":n):void 0})}),Se.each({Height:"height",Width:"width"},function(e,t){Se.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){Se.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(i===!0||o===!0?"margin":"border");return We(this,function(t,n,i){var o;return we(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?Se.css(t,n,s):Se.style(t,n,i,s)},t,a?i:void 0,a)}})}),Se.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){Se.fn[t]=function(e){return this.on(t,e)}}),Se.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Se.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){Se.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}});var nn=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;Se.proxy=function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),be(e)?(r=ce.call(arguments,2),i=function(){return e.apply(t||this,r.concat(ce.call(arguments)))},i.guid=e.guid=e.guid||Se.guid++,i):void 0},Se.holdReady=function(e){e?Se.readyWait++:Se.ready(!0)},Se.isArray=Array.isArray,Se.parseJSON=JSON.parse,Se.nodeName=o,Se.isFunction=be,Se.isWindow=we,Se.camelCase=h,Se.type=r,Se.now=Date.now,Se.isNumeric=function(e){var t=Se.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},Se.trim=function(e){return null==e?"":(e+"").replace(nn,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return Se});var rn=e.jQuery,on=e.$;return Se.noConflict=function(t){return e.$===Se&&(e.$=on),t&&e.jQuery===Se&&(e.jQuery=rn),Se},void 0===t&&(e.jQuery=e.$=Se),Se}); |
| @@ -24,6 +24,8 @@ | @@ -24,6 +24,8 @@ | ||
| 24 | <module>lh-chatgpt-api</module> | 24 | <module>lh-chatgpt-api</module> |
| 25 | <module>lh-runingfish</module> | 25 | <module>lh-runingfish</module> |
| 26 | <module>lh-smart-feeder</module> | 26 | <module>lh-smart-feeder</module> |
| 27 | + <module>lh-server-ops</module> | ||
| 28 | + <module>lh-http-service</module> | ||
| 27 | </modules> | 29 | </modules> |
| 28 | 30 | ||
| 29 | <properties> | 31 | <properties> |
| @@ -333,6 +333,12 @@ | @@ -333,6 +333,12 @@ | ||
| 333 | <version>${ruoyi.version}</version> | 333 | <version>${ruoyi.version}</version> |
| 334 | </dependency> | 334 | </dependency> |
| 335 | 335 | ||
| 336 | + <dependency> | ||
| 337 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 338 | + <artifactId>lh-jar-device-analysis</artifactId> | ||
| 339 | + <version>${ruoyi.version}</version> | ||
| 340 | + </dependency> | ||
| 341 | + | ||
| 336 | <!-- 支持data --> | 342 | <!-- 支持data --> |
| 337 | <dependency> | 343 | <dependency> |
| 338 | <groupId>org.projectlombok</groupId> | 344 | <groupId>org.projectlombok</groupId> |
-
请 注册 或 登录 后发表评论