@@ -7,6 +7,9 @@ RUN rm -rf /usr/local/tomcat/webapps/* | |||
# 应用程序部署包 | |||
COPY target/on-visitor-web /usr/local/tomcat/webapps/ROOT | |||
ARG JASYPT_SALT | |||
RUN echo 'export jasypt.encryptor.password='${JASYPT_SALT} >> /root/.bashrc | |||
# 修改apt-get源 | |||
@@ -18,7 +21,9 @@ COPY target/on-visitor-web /usr/local/tomcat/webapps/ROOT | |||
#RUN apt install -y mysql-client && rm -rf /var/lib/apt | |||
#RUN apt install libmysqlclient-dev | |||
# Ubuntu | |||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |||
RUN echo "Asia/Shanghai" > /etc/timezone | |||
# 暴露的端口,容器启动时指定 -p 8888:8080 | |||
@@ -13,8 +13,8 @@ | |||
<artifactId>on-visitor-web</artifactId> | |||
<packaging>war</packaging> | |||
<name>奥北科技园访客系统</name> | |||
<inceptionYear>2018-Now</inceptionYear> | |||
<name>HONOR闸机管理平台</name> | |||
<inceptionYear>2022-Now</inceptionYear> | |||
<properties> | |||
@@ -163,11 +163,6 @@ | |||
<version>0.0.2</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba</groupId> | |||
<artifactId>fastjson</artifactId> | |||
<version>1.2.44</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.google.guava</groupId> | |||
<artifactId>guava</artifactId> | |||
@@ -228,12 +223,27 @@ | |||
<version>${weixin-java-mp.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>redis.clients</groupId> | |||
<artifactId>jedis</artifactId> | |||
<version>3.3.0</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.redisson</groupId> | |||
<artifactId>redisson-spring-boot-starter</artifactId> | |||
<version>3.9.1</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.redisson</groupId> | |||
<!-- for Spring Data Redis v.2.1.x --> | |||
<artifactId>redisson-spring-data-20</artifactId> | |||
<version>3.9.1</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-configuration-processor</artifactId> | |||
@@ -277,19 +287,22 @@ | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-redis</artifactId> | |||
<version>1.4.1.RELEASE</version> | |||
<artifactId>spring-boot-starter-data-redis</artifactId> | |||
<version>2.0.6.RELEASE</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba</groupId> | |||
<artifactId>fastjson</artifactId> | |||
<version>1.2.3</version> | |||
<version>1.2.76</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.fasterxml.jackson.core</groupId> | |||
<artifactId>jackson-databind</artifactId> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-pool2</artifactId> | |||
<version>2.5.0</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-batch</artifactId> | |||
@@ -302,6 +315,36 @@ | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.hihonor</groupId> | |||
<artifactId>idaas</artifactId> | |||
<version>3.0.0.RELEASE</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.hihonor</groupId> | |||
<artifactId>idaas-sdk</artifactId> | |||
<version>3.0.0.RELEASE</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.auth0</groupId> | |||
<artifactId>java-jwt</artifactId> | |||
<version>3.8.2</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.github.ulisesbocchio</groupId> | |||
<artifactId>jasypt-spring-boot-starter</artifactId> | |||
<version>2.1.2</version> | |||
</dependency> | |||
<dependency><!-- Ehcache 2.x //--> | |||
<groupId>net.sf.ehcache</groupId> | |||
<artifactId>ehcache</artifactId> | |||
<version>2.10.4</version> | |||
</dependency> | |||
</dependencies> | |||
<build> | |||
@@ -309,8 +352,6 @@ | |||
<outputDirectory>${project.basedir}/src/main/webapp/WEB-INF/classes/</outputDirectory> | |||
<plugins> | |||
<!-- Eclipse插件 --> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
@@ -347,6 +388,7 @@ | |||
<configuration> | |||
<fork>true</fork> | |||
<addResources>true</addResources><!----> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
@@ -401,7 +443,6 @@ | |||
</snapshots> | |||
</repository> | |||
</repositories> | |||
<pluginRepositories> | |||
@@ -1,5 +1,7 @@ | |||
package com.lecooai.visitor.web; | |||
import com.hihonor.idaas.IDaas; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.io.PropertiesUtils; | |||
import com.lecooai.visitor.web.config.BusinessLoggerInterceptor; | |||
import com.lecooai.visitor.web.sys.service.support.DeviceServiceSupport; | |||
@@ -33,6 +35,7 @@ import javax.servlet.MultipartConfigElement; | |||
import java.nio.charset.Charset; | |||
import java.util.Collections; | |||
import java.util.Map; | |||
import java.util.TimeZone; | |||
import java.util.concurrent.ScheduledExecutorService; | |||
import java.util.concurrent.ScheduledThreadPoolExecutor; | |||
@@ -67,6 +70,7 @@ public class Application extends SpringBootServletInitializer implements Command | |||
DeviceServiceSupport deviceServiceSupport; | |||
public static void main(String[] args) { | |||
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); | |||
SpringApplication app = new SpringApplication(Application.class); | |||
app.setDefaultProperties(PropertiesUtils.getInstance().getProperties()); | |||
app.run(args); | |||
@@ -138,5 +142,10 @@ public class Application extends SpringBootServletInitializer implements Command | |||
@Override | |||
public void run(String... args) throws Exception { | |||
deviceServiceSupport.putRedisData(); | |||
String idaasAk = Global.getConfig("idaas.ak"); | |||
String idaasSk = Global.getConfig("idaas.sk"); | |||
System.err.println("setAPIGatewayInfo sk:"+idaasSk); | |||
System.err.println("setAPIGatewayInfo ak:"+idaasAk); | |||
IDaas.setAPIGatewayInfo(idaasAk, idaasSk); | |||
} | |||
} |
@@ -0,0 +1,83 @@ | |||
package com.lecooai.visitor.web.config; | |||
import com.hihonor.idaas.IDaas; | |||
import com.hihonor.idaas.UserInfo; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.shiro.authc.FormToken; | |||
import com.jeesite.modules.sys.entity.User; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import org.apache.catalina.connector.Response; | |||
import org.apache.shiro.authz.AuthorizationInfo; | |||
import org.springframework.web.servlet.AsyncHandlerInterceptor; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
public class IdaasInterceptor implements AsyncHandlerInterceptor { | |||
@Override | |||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | |||
UserInfo idaasUsr = IDaas.getUserInfo(request, response, false); | |||
User user = UserUtils.getUser(); | |||
if (ObjectUtils.anyNotNull(idaasUsr) || user != null) { | |||
String eNumber = ""; | |||
AuthorizationInfo authorizationInfo = null; | |||
if (ObjectUtils.anyNotNull(idaasUsr)) { | |||
eNumber = idaasUsr.getEmployeeNumber(); | |||
authorizationInfo = UserUtils.getAuthInfo(); | |||
} else { | |||
eNumber = user.getLoginCode(); | |||
authorizationInfo = UserUtils.getAuthInfo(); | |||
} | |||
if (StringUtils.isEmpty(eNumber)) { | |||
response.setStatus(Response.SC_UNAUTHORIZED); | |||
return false; | |||
} | |||
if (null == authorizationInfo) { | |||
FormToken formToken = new FormToken(); | |||
formToken.setUsername(eNumber); | |||
formToken.setSsoToken(UserUtils.getSsoToken(eNumber)); | |||
//formToken.setParams(ServletUtils.getExtParams(request)); | |||
UserUtils.getSubject().login(formToken); | |||
String sid = UserUtils.getSession().getId().toString(); | |||
System.out.println("登录成功,__sid=" + sid); | |||
} | |||
// response.setStatus(Response.SC_UNAUTHORIZED); | |||
response.setStatus(Response.SC_OK); | |||
return true; | |||
} else { | |||
/*UserUtils.getSubject().logout(); | |||
if (StringUtils.isNotBlank(UserUtils.getUser().getId())) { | |||
System.err.println("UserUtils.getUser()======322222"); | |||
} else { | |||
System.err.println("UserUtils.getUser()======433333"); | |||
FormToken formToken = new FormToken(); | |||
formToken.setUsername("admin"); | |||
formToken.setSsoToken(UserUtils.getSsoToken("admin")); | |||
//formToken.setParams(ServletUtils.getExtParams(request)); | |||
UserUtils.getSubject().login(formToken); | |||
String sid = UserUtils.getSession().getId().toString(); | |||
System.out.println("登录成功,__sid=" + sid); | |||
// response.setStatus(Response.SC_UNAUTHORIZED); | |||
response.setStatus(Response.SC_OK); | |||
response.sendRedirect(Global.getAdminPath()+"/index"); | |||
}*/ | |||
response.setStatus(Response.SC_UNAUTHORIZED); | |||
// response.sendRedirect("/error/"+Response.SC_UNAUTHORIZED); | |||
return false; | |||
} | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
package com.lecooai.visitor.web.config; | |||
import org.springframework.boot.SpringApplication; | |||
import org.springframework.boot.env.EnvironmentPostProcessor; | |||
import org.springframework.core.env.ConfigurableEnvironment; | |||
import org.springframework.core.env.MutablePropertySources; | |||
import org.springframework.core.env.PropertiesPropertySource; | |||
import org.springframework.core.io.FileSystemResource; | |||
import org.springframework.core.io.support.PropertiesLoaderUtils; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Properties; | |||
/** | |||
* @author yk | |||
* @description 读取本地配置文件jasypt加密salt值 | |||
*/ | |||
public class LocalSettingsEnvironmentPostProcessor implements EnvironmentPostProcessor{ | |||
/** | |||
* 第一个配置文件路径为部署环境路径,用于部署环境加载配置文件里的值(Linux服务器) | |||
* 第二个配置文件路径为本地打包环境路径,解决打包时报错问题(本地路径) | |||
* 这样配置的目的就是可以在不更改的情况下直接在本地和服务器上去运行 | |||
*/ | |||
private static final String LOCATIONS [] = {"/home/jasypt/jasypt.properties","/usr/local/jasypt/jasypt.properties"}; | |||
@Override | |||
public void postProcessEnvironment(ConfigurableEnvironment configurableEnvironment, SpringApplication springApplication) { | |||
for(String fileLocation : LOCATIONS){ | |||
File file = new File(fileLocation); | |||
if (file.exists()) { | |||
MutablePropertySources propertySources = configurableEnvironment.getPropertySources(); | |||
Properties properties = loadProperties(file); | |||
propertySources.addFirst(new PropertiesPropertySource("Config", properties)); | |||
return ; | |||
} | |||
} | |||
} | |||
private Properties loadProperties(File f) { | |||
FileSystemResource resource = new FileSystemResource(f); | |||
try { | |||
return PropertiesLoaderUtils.loadProperties(resource); | |||
} | |||
catch (IOException ex) { | |||
throw new IllegalStateException("Failed to load local settings from " + f.getAbsolutePath(), ex); | |||
} | |||
} | |||
} |
@@ -71,6 +71,7 @@ public class MyWebMvcConfigurer implements WebMvcConfigurer { | |||
@Override | |||
public void addInterceptors(InterceptorRegistry registry) { | |||
registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**"); | |||
registry.addInterceptor(new IdaasInterceptor()).addPathPatterns(new String[]{adminPath + "/index/**", adminPath + "/sys/**"}); | |||
registry.addInterceptor(getCsrfInterceptor()).addPathPatterns(adminPath + "/sys/**"); | |||
} | |||
@@ -1,64 +0,0 @@ | |||
package com.lecooai.visitor.web.config; | |||
import java.lang.reflect.Method; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.cache.CacheManager; | |||
import org.springframework.cache.annotation.CachingConfigurerSupport; | |||
import org.springframework.cache.annotation.EnableCaching; | |||
import org.springframework.cache.interceptor.KeyGenerator; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.data.redis.cache.RedisCacheManager; | |||
import org.springframework.data.redis.connection.RedisConnectionFactory; | |||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; | |||
import org.springframework.data.redis.core.RedisTemplate; | |||
import org.springframework.data.redis.core.StringRedisTemplate; | |||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | |||
import com.fasterxml.jackson.annotation.PropertyAccessor; | |||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | |||
import com.fasterxml.jackson.databind.ObjectMapper; | |||
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; | |||
import org.springframework.data.redis.serializer.RedisSerializer; | |||
import org.springframework.data.redis.serializer.StringRedisSerializer; | |||
@Configuration | |||
@EnableCaching | |||
public class RedisConfig extends CachingConfigurerSupport{ | |||
@Value("${spring.redis.host}") | |||
private String host; | |||
@Value("${spring.redis.port}") | |||
private int port; | |||
@Value("${spring.redis.timeout}") | |||
private int timeout; | |||
@Value("${spring.redis.password}") | |||
private String password; | |||
@Value("${spring.redis.jedis.pool.max-active}") | |||
private int maxActive; | |||
@Value("${spring.redis.jedis.pool.max-wait}") | |||
private int maxWait; | |||
@Value("${spring.redis.jedis.pool.max-idle}") | |||
private int maxIdle; | |||
@Value("${spring.redis.jedis.pool.min-idle}") | |||
private int minIdle; | |||
/** | |||
* redis模板,存储关键字是字符串,值是Jdk序列化 | |||
* @Description: | |||
* @param factory | |||
* @return | |||
*/ | |||
@Bean | |||
public RedisTemplate<String,Object> redisTemplate(RedisConnectionFactory factory) { | |||
RedisTemplate<String,Object> redisTemplate = new RedisTemplate<>(); | |||
redisTemplate.setConnectionFactory(factory); | |||
RedisSerializer<String> redisSerializer = new StringRedisSerializer(); | |||
redisTemplate.setKeySerializer(redisSerializer); | |||
redisTemplate.setHashKeySerializer(redisSerializer); | |||
//JdkSerializationRedisSerializer序列化方式; | |||
JdkSerializationRedisSerializer jdkRedisSerializer=new JdkSerializationRedisSerializer(); | |||
redisTemplate.setValueSerializer(jdkRedisSerializer); | |||
redisTemplate.setHashValueSerializer(jdkRedisSerializer); | |||
redisTemplate.afterPropertiesSet(); | |||
return redisTemplate; | |||
} | |||
} |
@@ -0,0 +1,79 @@ | |||
package com.lecooai.visitor.web.config; | |||
import org.springframework.boot.context.properties.ConfigurationProperties; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
@Component | |||
@ConfigurationProperties(prefix = "spring.redis") | |||
public class RedisConfigProperties { | |||
private Integer timeout; | |||
private Integer database; | |||
private Integer port; | |||
private String host; | |||
private String password; | |||
private cluster cluster; | |||
public static class cluster { | |||
private List<String> nodes; | |||
public List<String> getNodes() { | |||
return nodes; | |||
} | |||
public void setNodes(List<String> nodes) { | |||
this.nodes = nodes; | |||
} | |||
} | |||
public Integer getTimeout() { | |||
return timeout; | |||
} | |||
public void setTimeout(Integer timeout) { | |||
this.timeout = timeout; | |||
} | |||
public Integer getDatabase() { | |||
return database; | |||
} | |||
public void setDatabase(Integer database) { | |||
this.database = database; | |||
} | |||
public Integer getPort() { | |||
return port; | |||
} | |||
public void setPort(Integer port) { | |||
this.port = port; | |||
} | |||
public String getHost() { | |||
return host; | |||
} | |||
public void setHost(String host) { | |||
this.host = host; | |||
} | |||
public String getPassword() { | |||
return password; | |||
} | |||
public void setPassword(String password) { | |||
this.password = password; | |||
} | |||
public RedisConfigProperties.cluster getCluster() { | |||
return cluster; | |||
} | |||
public void setCluster(RedisConfigProperties.cluster cluster) { | |||
this.cluster = cluster; | |||
} | |||
} | |||
@@ -0,0 +1,43 @@ | |||
package com.lecooai.visitor.web.config; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.data.redis.connection.RedisConnectionFactory; | |||
import org.springframework.data.redis.core.RedisTemplate; | |||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; | |||
import org.springframework.data.redis.serializer.StringRedisSerializer; | |||
/** | |||
* <p> | |||
* Redis Template 配置 | |||
* </p> | |||
* | |||
*/ | |||
@Configuration | |||
public class RedisTemplateConfig { | |||
@Bean | |||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { | |||
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); | |||
redisTemplate.setConnectionFactory(redisConnectionFactory); | |||
// 自定义的string序列化器和fastjson序列化器 | |||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); | |||
// jackson 序列化器 | |||
GenericJackson2JsonRedisSerializer jsonRedisSerializer = new GenericJackson2JsonRedisSerializer(); | |||
// kv 序列化 | |||
redisTemplate.setKeySerializer(stringRedisSerializer); | |||
redisTemplate.setValueSerializer(stringRedisSerializer); | |||
// hash 序列化 | |||
redisTemplate.setHashKeySerializer(stringRedisSerializer); | |||
redisTemplate.setHashValueSerializer(stringRedisSerializer); | |||
redisTemplate.afterPropertiesSet(); | |||
return redisTemplate; | |||
} | |||
} | |||
@@ -0,0 +1,29 @@ | |||
package com.lecooai.visitor.web.config; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.http.client.ClientHttpRequestFactory; | |||
import org.springframework.http.client.SimpleClientHttpRequestFactory; | |||
import org.springframework.web.client.RestTemplate; | |||
@Configuration | |||
public class RestTemplateConfig { | |||
@Bean | |||
public RestTemplate restTemplate(ClientHttpRequestFactory factory){ | |||
return new RestTemplate(factory); | |||
} | |||
@Bean | |||
public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ | |||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); | |||
//单位为ms | |||
factory.setReadTimeout(5000); | |||
//单位为ms | |||
factory.setConnectTimeout(5000); | |||
return factory; | |||
} | |||
} | |||
@@ -22,6 +22,10 @@ import java.util.List; | |||
@Controller | |||
@RequestMapping("${frontPath}/wx/audit") | |||
public class AuditController extends WxBaseController { | |||
@Autowired | |||
RedisUtils redisUtils; | |||
@Autowired | |||
private AuditRecordsService auditRecordsService; | |||
@RequestMapping(value = "/index/{openid}") | |||
@@ -30,7 +34,7 @@ public class AuditController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson = null; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -90,6 +90,9 @@ public class VisitController extends WxBaseController { | |||
@Autowired | |||
private OfficeService officeService; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
public String mgrUpdVisitRecord(VisitRecords vr, Emp emp, String loginCode){ | |||
String uName = loginCode; | |||
@@ -162,7 +165,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -251,7 +254,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -338,7 +341,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -376,7 +379,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -442,7 +445,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -463,7 +466,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -504,7 +507,7 @@ public class VisitController extends WxBaseController { | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
JSONObject userJson; | |||
try { | |||
userJson = RedisUtils.getUserObject(decodeOpenid); | |||
userJson = redisUtils.getUserObject(decodeOpenid); | |||
} catch (Exception e) { | |||
model.addAttribute("msg", e.getMessage()); | |||
return "wx/error"; | |||
@@ -567,15 +570,15 @@ public class VisitController extends WxBaseController { | |||
System.err.println(officeCodeList); | |||
System.err.println(officeCodeList.size()); | |||
//Sec-admin filter | |||
// String loginCode = UserUtils.getUser().getLoginCode(); | |||
// if (BusinessUtils.isSecAdmin(loginCode) ) { | |||
if (!ObjectUtils.anyNotNull(officeCodeList)) | |||
officeCodeList = userDataScopeService.getOfficeCodeByUserCode(UserUtils.getUser().getUserCode()); | |||
if (officeCodeList == null || officeCodeList.size() <= 0) { | |||
return page; | |||
String loginCode = UserUtils.getUser().getLoginCode(); | |||
if (BusinessUtils.isSecAdmin(loginCode) ) { | |||
if (!ObjectUtils.anyNotNull(officeCodeList)) | |||
officeCodeList = userDataScopeService.getOfficeCodeByUserCode(UserUtils.getUser().getUserCode()); | |||
if (officeCodeList == null || officeCodeList.size() <= 0) { | |||
return page; | |||
} | |||
findEmp.setOfficeCode_in(officeCodeList.toArray(new String[officeCodeList.size()])); | |||
} | |||
findEmp.setOfficeCode_in(officeCodeList.toArray(new String[officeCodeList.size()])); | |||
// } | |||
/*if (!"0".equals(emp.getEmpType())) { | |||
findEmp.setEmpType(emp.getEmpType()); | |||
}*/ | |||
@@ -18,12 +18,17 @@ public class ErrorController { | |||
@GetMapping(value = "/404") | |||
public String error404() { | |||
return "error"; | |||
return "404"; | |||
} | |||
@GetMapping(value = "/401") | |||
public String error401() { | |||
return "error/401"; | |||
} | |||
@GetMapping(value = "/500") | |||
public String error500() { | |||
return "error"; | |||
return "500"; | |||
} | |||
} |
@@ -20,6 +20,7 @@ public class ErrorPageConfiguration implements ErrorPageRegistrar { | |||
public void registerErrorPages(ErrorPageRegistry errorPageRegistry) { | |||
errorPageRegistry.addErrorPages( | |||
new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"), | |||
new ErrorPage(HttpStatus.UNAUTHORIZED, "/error/401"), | |||
new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500") | |||
); | |||
} | |||
@@ -19,7 +19,11 @@ public interface AccessControlDao extends CrudDao<AccessControl> { | |||
public List<Device> findPadByAcId(String acId); | |||
public List<Device> findGateByOfficeCode(String officeCode); | |||
public AccessControl findAccessControlByDev(String devId); | |||
public List<AccessControl> findAcTreeList(String userCode); | |||
public void deleteByDevId(String devId); | |||
} |
@@ -46,6 +46,9 @@ public interface DeviceDao extends CrudDao<Device> { | |||
**/ | |||
List<Device> findByUserCode(@Param("userCode") String userCode); | |||
List<Device> findGatesByUserCode(@Param("userCode") String userCode); | |||
Device findByDeviceId(@Param("deviceId")String deviceId); | |||
Device findByDevId(@Param("devId")String devId); | |||
@@ -14,5 +14,5 @@ import com.lecooai.visitor.web.sys.entity.DeviceEventType; | |||
*/ | |||
@MyBatisDao | |||
public interface DeviceEventTypeDao extends CrudDao<DeviceEventType> { | |||
public DeviceEventType getByHexCode(String hexCode); | |||
} |
@@ -10,5 +10,7 @@ import com.lecooai.visitor.web.sys.entity.DeviceExt; | |||
@MyBatisDao | |||
public interface DeviceExtDao extends CrudDao<DeviceExt> { | |||
public DeviceExt findByDevId(String devId); | |||
public void deleteByDevId(String devId); | |||
} |
@@ -5,10 +5,13 @@ package com.lecooai.visitor.web.sys.dao; | |||
import com.jeesite.common.dao.CrudDao; | |||
import com.jeesite.common.mybatis.annotation.MyBatisDao; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExt; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExtGate; | |||
@MyBatisDao | |||
public interface DeviceExtGateDao extends CrudDao<DeviceExtGate> { | |||
public DeviceExt findByDevId(String devId); | |||
public void deleteByDevId(String devId); | |||
} |
@@ -6,6 +6,10 @@ package com.lecooai.visitor.web.sys.dao; | |||
import com.jeesite.common.dao.CrudDao; | |||
import com.jeesite.common.mybatis.annotation.MyBatisDao; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExtGateEvent; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* tf_project_device_ext_gate_eventDAO接口 | |||
@@ -14,5 +18,20 @@ import com.lecooai.visitor.web.sys.entity.DeviceExtGateEvent; | |||
*/ | |||
@MyBatisDao | |||
public interface DeviceExtGateEventDao extends CrudDao<DeviceExtGateEvent> { | |||
public DeviceExtGateEvent fetchData(); | |||
public List<Map<String, Object>> findEventListGroupByDate(String startDate, String endDate, String[] deviceIds); | |||
public List<Map<String, Object>> findEventListGroupByDateAndPad(String startDate, String endDate); | |||
public List<Map<String, Object>> findEventListGroupByPad(String startDate, String endDate); | |||
Long findEventCount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceId") String deviceId); | |||
Long findEventCountByDevIds(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceIds") String[] deviceIds); | |||
List<Map<String, Long>> findDistinctEventCountByDay(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceId") String deviceId); | |||
} |
@@ -5,10 +5,13 @@ package com.lecooai.visitor.web.sys.dao; | |||
import com.jeesite.common.dao.CrudDao; | |||
import com.jeesite.common.mybatis.annotation.MyBatisDao; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExt; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExtGcu; | |||
@MyBatisDao | |||
public interface DeviceExtGcuDao extends CrudDao<DeviceExtGcu> { | |||
public DeviceExt findByDevId(String devId); | |||
public void deleteByDevId(String devId); | |||
} |
@@ -38,4 +38,6 @@ public interface OfficeAccessControlDao extends CrudDao<OfficeAccessControl> { | |||
void deleteByOfficeAndAc(String officeCode, List<String> acIds); | |||
List<OfficeAccessControl> findAccessControlByOfficeCode(String officeCode); | |||
} |
@@ -27,6 +27,8 @@ public interface UserExtraDao extends CrudDao<User> { | |||
void updateUserType(@Param("userType") String userType, @Param("loginCode") String loginCode); | |||
void updateUserCorp(@Param("corpName") String corpName, @Param("corpCode") String corpCode, @Param("userCode") String userCode); | |||
void clearWxOpenidByLoginCode(@Param("loginCode") String loginCode); | |||
} |
@@ -25,8 +25,8 @@ import java.util.List; | |||
@Column(name="access_control_name", attrName="accessControlName", label="access_control_name", comment="设备点名称"), | |||
@Column(name="address", attrName="address", label="address", comment="地点"), | |||
@Column(name="access_control_id", attrName="accessControlId", label="access_control_id", comment="设备点id", isPK = true), | |||
@Column(name="office_code", attrName="office.officeCode", label="office_code", comment="对应office_code"), | |||
@Column(name="device_id", attrName="deviceId", label="device_id", comment="对应deviceId"), | |||
@Column(name="office_code", attrName="office.officeCode", label="office_code", comment="office_code"), | |||
@Column(name="created_at", attrName="createdAt", label="created_at", comment="创建时间"), | |||
@Column(name="updated_at", attrName="updatedAt", label="updated_at", comment="修改时间") | |||
}, | |||
@@ -34,9 +34,9 @@ import java.util.List; | |||
@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Device.class, alias = "o", | |||
on = "o.device_id = a.device_id", | |||
columns = {@Column(includeEntity = Device.class)}), | |||
@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Office.class, alias = "p", | |||
on = "p.office_code = a.office_code", | |||
columns = {@Column(includeEntity = Office.class)}), | |||
@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Office.class, alias = "of", | |||
on = "of.office_code = a.office_code", | |||
columns = {@Column(includeEntity = Office.class)}) | |||
}, orderBy="a.access_control_id ASC" | |||
) | |||
@@ -3,10 +3,8 @@ | |||
*/ | |||
package com.lecooai.visitor.web.sys.entity; | |||
import com.alibaba.fastjson.annotation.JSONField; | |||
import com.fasterxml.jackson.annotation.JsonBackReference; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.fasterxml.jackson.annotation.JsonManagedReference; | |||
import com.jeesite.common.entity.DataEntity; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.mybatis.annotation.Column; | |||
@@ -61,6 +59,13 @@ public class Device extends DataEntity<Device> { | |||
public static final String TYPE_VISITOR_MACHINE = "coderecorder"; | |||
public static final String TYPE_HEARTBEAT_SRV = "heartbeatsrv"; | |||
public static final String DEV_STATUS_NORMAL = "0"; | |||
public static final String DEV_STATUS_OFFLINE = "2"; | |||
public static final String DEV_STATUS_ERROR = "1"; | |||
public static final String DEV_STATUS_NOT_AUTH = "3"; | |||
private static final long serialVersionUID = 1L; | |||
private String deviceName; | |||
@@ -83,7 +88,13 @@ public class Device extends DataEntity<Device> { | |||
private Date expireTime; | |||
private DeviceExtInter deviceExt; | |||
private DeviceExtInter deviceExtInter; | |||
private DeviceExt deviceExt; | |||
private DeviceExtGcu deviceExtGcu; | |||
private DeviceExtGate deviceExtGate; | |||
private String faceCnt; | |||
@@ -120,7 +131,7 @@ public class Device extends DataEntity<Device> { | |||
private String devStatus; | |||
private boolean isOnline; | |||
private boolean online; | |||
private boolean synced; | |||
@@ -298,41 +309,22 @@ public class Device extends DataEntity<Device> { | |||
this.typeName = typeName; | |||
} | |||
public DeviceExtInter getDeviceExt() { | |||
return deviceExt; | |||
public DeviceExtInter getDeviceExtInter() { | |||
return deviceExtInter; | |||
} | |||
public void setDeviceExt(DeviceExtInter deviceExt) { | |||
this.deviceExt = deviceExt; | |||
public void setDeviceExtInter(DeviceExtInter deviceExt) { | |||
this.deviceExtInter = deviceExtInter; | |||
} | |||
public boolean isOnline() { | |||
DeviceExt deviceExt = (DeviceExt) this.getDeviceExt(); | |||
if (ObjectUtils.anyNotNull(deviceExt)) { | |||
Date date = deviceExt.getUpdatedAt(); | |||
Long ut = date.getTime(); | |||
Long ct = new Date().getTime(); | |||
if (ut + 2*60*1000 >= ct) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
return online; | |||
} | |||
public boolean isSynced() { | |||
DeviceExt deviceExt = (DeviceExt) this.getDeviceExt(); | |||
if (ObjectUtils.anyNotNull(deviceExt)) { | |||
String ts = deviceExt.getLastTs(); | |||
String ds = ObjectUtils.anyNotNull(this.getLatestAuthTs()) ? this.getLatestAuthTs().toString() : ""; | |||
if (ObjectUtils.anyNotNull(ts) && ts.equals(ds)) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
return synced; | |||
} | |||
@@ -345,7 +337,7 @@ public class Device extends DataEntity<Device> { | |||
} | |||
public String getFaceCnt() { | |||
DeviceExt deviceExt = (DeviceExt) this.getDeviceExt(); | |||
DeviceExt deviceExt = (DeviceExt) this.getDeviceExtInter(); | |||
if (ObjectUtils.anyNotNull(deviceExt)) { | |||
return deviceExt.getFaceCnt(); | |||
} | |||
@@ -358,7 +350,7 @@ public class Device extends DataEntity<Device> { | |||
} | |||
public String getIp() { | |||
DeviceExt deviceExt = (DeviceExt) this.getDeviceExt(); | |||
DeviceExt deviceExt = (DeviceExt) this.getDeviceExtInter(); | |||
if (ObjectUtils.anyNotNull(deviceExt)) { | |||
return deviceExt.getIpAddr(); | |||
} | |||
@@ -410,7 +402,7 @@ public class Device extends DataEntity<Device> { | |||
} | |||
public void setOnline(boolean online) { | |||
isOnline = online; | |||
this.online = online; | |||
} | |||
public String getArea() { | |||
@@ -440,6 +432,18 @@ public class Device extends DataEntity<Device> { | |||
} | |||
@JsonBackReference | |||
public Device getGate(){ | |||
Device dev = new Device(); | |||
String parents = this.getParentCodes(); | |||
String[] devIds = parents.split(","); | |||
dev.getSqlMap().getWhere().and("device_type", QueryType.EQ, Device.TYPE_GATE).and("id",QueryType.EQ,devIds[0]); | |||
return dev; | |||
} | |||
public List<Device> getPads() { | |||
if (Device.TYPE_GATE.equals(this.deviceType) || Device.TYPE_GCU.equals(this.deviceType)) | |||
@@ -465,4 +469,28 @@ public class Device extends DataEntity<Device> { | |||
public void setGcus(List<Device> gcus) { | |||
this.gcus = gcus; | |||
} | |||
public DeviceExt getDeviceExt() { | |||
return deviceExt; | |||
} | |||
public void setDeviceExt(DeviceExt deviceExt) { | |||
this.deviceExt = deviceExt; | |||
} | |||
public DeviceExtGcu getDeviceExtGcu() { | |||
return deviceExtGcu; | |||
} | |||
public void setDeviceExtGcu(DeviceExtGcu deviceExtGcu) { | |||
this.deviceExtGcu = deviceExtGcu; | |||
} | |||
public DeviceExtGate getDeviceExtGate() { | |||
return deviceExtGate; | |||
} | |||
public void setDeviceExtGate(DeviceExtGate deviceExtGate) { | |||
this.deviceExtGate = deviceExtGate; | |||
} | |||
} |
@@ -18,6 +18,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
*/ | |||
@Table(name="${_prefix}project_device_event_type", alias="a", columns={ | |||
@Column(name="id", attrName="id", label="id", isPK=true), | |||
@Column(name="hex_code", attrName="hexCode", label="hexCode"), | |||
@Column(name="code", attrName="code", label="code"), | |||
@Column(name="name", attrName="name", label="name", queryType=QueryType.LIKE), | |||
@Column(name="warn_level", attrName="warnLevel", label="报警级别", comment="报警级别:0-正常,1-报警,2-错误"), | |||
@@ -29,6 +30,8 @@ public class DeviceEventType extends DataEntity<DeviceEventType> { | |||
private Long code; // code | |||
private String name; // name | |||
private Long warnLevel; // 报警级别:0-正常,1-报警,2-错误 | |||
private String hexCode; | |||
public DeviceEventType() { | |||
this(null); | |||
@@ -63,5 +66,12 @@ public class DeviceEventType extends DataEntity<DeviceEventType> { | |||
public void setWarnLevel(Long warnLevel) { | |||
this.warnLevel = warnLevel; | |||
} | |||
public String getHexCode() { | |||
return hexCode; | |||
} | |||
public void setHexCode(String hexCode) { | |||
this.hexCode = hexCode; | |||
} | |||
} |
@@ -3,11 +3,16 @@ | |||
*/ | |||
package com.lecooai.visitor.web.sys.entity; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.alibaba.fastjson.serializer.SerializerFeature; | |||
import com.fasterxml.jackson.annotation.JsonBackReference; | |||
import com.jeesite.common.entity.DataEntity; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.mybatis.annotation.Column; | |||
import com.jeesite.common.mybatis.annotation.Table; | |||
import com.lecooai.visitor.web.sys.entity.in.DeviceExtInter; | |||
import java.lang.reflect.Field; | |||
import java.util.Date; | |||
/** | |||
@@ -64,12 +69,12 @@ public class DeviceExtGate extends DataEntity<DeviceExtGate> implements DeviceEx | |||
private String sensorData; | |||
private String warnData; | |||
private String authData; | |||
private int eventCode; | |||
private int eventWarnLevel; | |||
private int eventP21; | |||
private int eventP22; | |||
private int eventP31; | |||
private int eventP32; | |||
private String eventCode; | |||
private String eventWarnLevel; | |||
private String eventP21; | |||
private String eventP22; | |||
private String eventP31; | |||
private String eventP32; | |||
private String eventMemo; | |||
private Double eventTs; | |||
private Double statTs; | |||
@@ -230,51 +235,51 @@ public class DeviceExtGate extends DataEntity<DeviceExtGate> implements DeviceEx | |||
this.dirClose = dirClose; | |||
} | |||
public int getEventCode() { | |||
public String getEventCode() { | |||
return eventCode; | |||
} | |||
public void setEventCode(int eventCode) { | |||
public void setEventCode(String eventCode) { | |||
this.eventCode = eventCode; | |||
} | |||
public int getEventWarnLevel() { | |||
public String getEventWarnLevel() { | |||
return eventWarnLevel; | |||
} | |||
public void setEventWarnLevel(int eventWarnLevel) { | |||
public void setEventWarnLevel(String eventWarnLevel) { | |||
this.eventWarnLevel = eventWarnLevel; | |||
} | |||
public int getEventP21() { | |||
public String getEventP21() { | |||
return eventP21; | |||
} | |||
public void setEventP21(int eventP21) { | |||
public void setEventP21(String eventP21) { | |||
this.eventP21 = eventP21; | |||
} | |||
public int getEventP22() { | |||
public String getEventP22() { | |||
return eventP22; | |||
} | |||
public void setEventP22(int eventP22) { | |||
public void setEventP22(String eventP22) { | |||
this.eventP22 = eventP22; | |||
} | |||
public int getEventP31() { | |||
public String getEventP31() { | |||
return eventP31; | |||
} | |||
public void setEventP31(int eventP31) { | |||
public void setEventP31(String eventP31) { | |||
this.eventP31 = eventP31; | |||
} | |||
public int getEventP32() { | |||
public String getEventP32() { | |||
return eventP32; | |||
} | |||
public void setEventP32(int eventP32) { | |||
public void setEventP32(String eventP32) { | |||
this.eventP32 = eventP32; | |||
} | |||
@@ -319,7 +324,17 @@ public class DeviceExtGate extends DataEntity<DeviceExtGate> implements DeviceEx | |||
} | |||
@Override | |||
@JsonBackReference | |||
public String getJsonString() { | |||
return null; | |||
JSONObject json = new JSONObject(); | |||
Field[] fields = this.getClass().getDeclaredFields(); | |||
for (Field f : fields){ | |||
try { | |||
json.put(f.getName(), (ObjectUtils.anyNotNull(f.get(this))?f.get(this).toString():"")); | |||
} catch (IllegalAccessException e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
return json.toJSONString(); | |||
} | |||
} |
@@ -5,9 +5,11 @@ package com.lecooai.visitor.web.sys.entity; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.jeesite.common.entity.DataEntity; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.annotation.Column; | |||
import com.jeesite.common.mybatis.annotation.JoinTable; | |||
import com.jeesite.common.mybatis.annotation.Table; | |||
import com.lecooai.visitor.web.sys.utils.DateUtils; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotBlank; | |||
@@ -34,27 +36,33 @@ import java.util.Date; | |||
@Column(name="created_at", attrName="createdAt", label="created_at"), | |||
},joinTable = { | |||
@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = DeviceEventType.class, alias = "o", | |||
on = "o.code = a.event_code", | |||
on = "o.hex_code = a.event_code", | |||
columns = {@Column(includeEntity = DeviceEventType.class)}), | |||
@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Device.class, alias = "d", | |||
on = "d.device_id = a.device_id", | |||
columns = {@Column(includeEntity = Device.class)}), | |||
}, orderBy="a.id DESC" | |||
},extColumnKeys = "occur_time",orderBy="a.created_at DESC" | |||
) | |||
public class DeviceExtGateEvent extends DataEntity<DeviceExtGateEvent> { | |||
private static final long serialVersionUID = 1L; | |||
private String deviceId; // 闸机ID | |||
private String padId; // PAD-ID | |||
private Long eventCode; // 事件code | |||
private Integer warnLevel; // 报警级别 | |||
private Integer param21; // 事件参数21 | |||
private Integer param22; // 事件参数22 | |||
private Integer param31; // 事件参数31 | |||
private Integer param32; // 事件参数32 | |||
private String eventCode; // 事件code | |||
private String warnLevel; // 报警级别 | |||
private String param21; // 事件参数21 | |||
private String param22; // 事件参数22 | |||
private String param31; // 事件参数31 | |||
private String param32; // 事件参数32 | |||
private String memo; // 事件描述 | |||
private Double timestamp; // 事件时间戳 | |||
private String occurTime; | |||
private String level; | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date createdAt; // created_at | |||
private Device device; | |||
@@ -90,51 +98,51 @@ public class DeviceExtGateEvent extends DataEntity<DeviceExtGateEvent> { | |||
this.padId = padId; | |||
} | |||
public Long getEventCode() { | |||
public String getEventCode() { | |||
return eventCode; | |||
} | |||
public void setEventCode(Long eventCode) { | |||
public void setEventCode(String eventCode) { | |||
this.eventCode = eventCode; | |||
} | |||
public Integer getWarnLevel() { | |||
public String getWarnLevel() { | |||
return warnLevel; | |||
} | |||
public void setWarnLevel(Integer warnLevel) { | |||
public void setWarnLevel(String warnLevel) { | |||
this.warnLevel = warnLevel; | |||
} | |||
public Integer getParam21() { | |||
public String getParam21() { | |||
return param21; | |||
} | |||
public void setParam21(Integer param21) { | |||
public void setParam21(String param21) { | |||
this.param21 = param21; | |||
} | |||
public Integer getParam22() { | |||
public String getParam22() { | |||
return param22; | |||
} | |||
public void setParam22(Integer param22) { | |||
public void setParam22(String param22) { | |||
this.param22 = param22; | |||
} | |||
public Integer getParam31() { | |||
public String getParam31() { | |||
return param31; | |||
} | |||
public void setParam31(Integer param31) { | |||
public void setParam31(String param31) { | |||
this.param31 = param31; | |||
} | |||
public Integer getParam32() { | |||
public String getParam32() { | |||
return param32; | |||
} | |||
public void setParam32(Integer param32) { | |||
public void setParam32(String param32) { | |||
this.param32 = param32; | |||
} | |||
@@ -155,7 +163,7 @@ public class DeviceExtGateEvent extends DataEntity<DeviceExtGateEvent> { | |||
public void setTimestamp(Double timestamp) { | |||
this.timestamp = timestamp; | |||
} | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
public Date getCreatedAt() { | |||
return createdAt; | |||
@@ -188,4 +196,21 @@ public class DeviceExtGateEvent extends DataEntity<DeviceExtGateEvent> { | |||
public void setTimePart(String timePart) { | |||
this.timePart = timePart; | |||
} | |||
public String getLevel() { | |||
return level; | |||
} | |||
public void setLevel(String level) { | |||
this.level = level; | |||
} | |||
public String getOccurTime() { | |||
return occurTime; | |||
} | |||
public void setOccurTime(String occurTime) { | |||
this.occurTime = occurTime; | |||
} | |||
} |
@@ -64,8 +64,8 @@ public class DeviceExtGcu extends DataEntity<DeviceExtGcu> implements DeviceExtI | |||
private String reverseClose; | |||
private String tailClose; | |||
private String dirClose; | |||
private int waitPassTimeout; | |||
private int doubleDirectionAuth; | |||
private String waitPassTimeout; | |||
private String doubleDirectionAuth; | |||
private String jxVersion; | |||
private String jxBuildno; | |||
private String jxOpenSpeed; | |||
@@ -174,19 +174,19 @@ public class DeviceExtGcu extends DataEntity<DeviceExtGcu> implements DeviceExtI | |||
this.jxBuildno = jxBuildno; | |||
} | |||
public int getWaitPassTimeout() { | |||
public String getWaitPassTimeout() { | |||
return waitPassTimeout; | |||
} | |||
public void setWaitPassTimeout(int waitPassTimeout) { | |||
public void setWaitPassTimeout(String waitPassTimeout) { | |||
this.waitPassTimeout = waitPassTimeout; | |||
} | |||
public int getDoubleDirectionAuth() { | |||
public String getDoubleDirectionAuth() { | |||
return doubleDirectionAuth; | |||
} | |||
public void setDoubleDirectionAuth(int doubleDirectionAuth) { | |||
public void setDoubleDirectionAuth(String doubleDirectionAuth) { | |||
this.doubleDirectionAuth = doubleDirectionAuth; | |||
} | |||
@@ -3,17 +3,13 @@ | |||
*/ | |||
package com.lecooai.visitor.web.sys.entity; | |||
import com.fasterxml.jackson.annotation.JsonBackReference; | |||
import org.hibernate.validator.constraints.Length; | |||
import java.util.Date; | |||
import com.jeesite.common.mybatis.annotation.JoinTable; | |||
import com.jeesite.common.mybatis.annotation.JoinTable.Type; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.jeesite.common.entity.DataEntity; | |||
import com.jeesite.common.mybatis.annotation.Column; | |||
import com.jeesite.common.mybatis.annotation.Table; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import org.hibernate.validator.constraints.Length; | |||
import java.util.Date; | |||
/** | |||
* tf_project_device_package_versionEntity | |||
@@ -30,6 +26,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
@Column(name="sign", attrName="sign", label="sign"), | |||
@Column(name="memo", attrName="memo", label="memo"), | |||
@Column(name="author", attrName="author", label="author"), | |||
@Column(name="is_enable", attrName="isEnable", label="is_enable"), | |||
@Column(name="updated_time", attrName="updatedTime", label="updated_time"), | |||
}, orderBy="a.id DESC" | |||
) | |||
@@ -46,6 +43,8 @@ public class DevicePackageVersion extends DataEntity<DevicePackageVersion> { | |||
private String author; // author | |||
private Date updatedTime; // updated_time | |||
private String isEnable; | |||
public static final long TYPE_PAD = 1; | |||
public static final long TYPE_GCU = 2; | |||
@@ -151,4 +150,13 @@ public class DevicePackageVersion extends DataEntity<DevicePackageVersion> { | |||
public String getId(){ | |||
return this.id; | |||
} | |||
public String getIsEnable() { | |||
return isEnable; | |||
} | |||
public void setIsEnable(String isEnable) { | |||
this.isEnable = isEnable; | |||
} | |||
} |
@@ -16,4 +16,8 @@ public interface AccessControlService extends CrudServiceApi<AccessControl> { | |||
public void updateOfficeAuth(String accessControlId, List<String> officeIds); | |||
List<AccessControl> getAccessControlsByOfficeCodes(String[] officeCodes); | |||
List<AccessControl> getAccessControlsByOfficeCode(String officeCode); | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.lecooai.visitor.web.sys.service; | |||
import com.jeesite.modules.sys.entity.EmpUser; | |||
import com.jeesite.modules.sys.entity.User; | |||
import java.util.List; | |||
@@ -17,7 +18,7 @@ public interface AdminService { | |||
* @param loginCode 账户登录名 | |||
* @param password 账户密码 | |||
*/ | |||
void createAdminAccount(String loginCode, String password); | |||
User createAdminAccount(String loginCode, String password, String userType); | |||
/** | |||
* 更新二级管理员所管辖的公司 | |||
@@ -5,6 +5,7 @@ package com.lecooai.visitor.web.sys.service; | |||
import java.util.List; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
@@ -21,7 +22,10 @@ import com.lecooai.visitor.web.sys.dao.DeviceExtGateEventDao; | |||
@Service | |||
@Transactional(readOnly=true) | |||
public class DeviceExtGateEventService extends CrudService<DeviceExtGateEventDao, DeviceExtGateEvent> { | |||
@Autowired | |||
private DeviceExtGateEventDao deviceExtGateEventDao; | |||
/** | |||
* 获取单条数据 | |||
* @param deviceExtGateEvent | |||
@@ -72,5 +76,9 @@ public class DeviceExtGateEventService extends CrudService<DeviceExtGateEventDao | |||
public void delete(DeviceExtGateEvent deviceExtGateEvent) { | |||
super.delete(deviceExtGateEvent); | |||
} | |||
public DeviceExtGateEvent fetchData(){ | |||
return deviceExtGateEventDao.fetchData(); | |||
} | |||
} |
@@ -28,6 +28,9 @@ public interface DeviceService extends CrudServiceApi<Device> { | |||
*/ | |||
List<Device> getDeviceListByUserCode(String userCode); | |||
List<Device> getGateListByUserCode(String userCode); | |||
/** | |||
* 获取某公司下所有设备 | |||
* | |||
@@ -97,4 +100,6 @@ public interface DeviceService extends CrudServiceApi<Device> { | |||
Device getMasterGcu(Device gate); | |||
Device getMasterPad(Device gate); | |||
public Device bindOnlineAndSynced(Device d); | |||
} |
@@ -27,6 +27,9 @@ public class AccessControlServiceSupport | |||
private final String firstDeviceId = "AS001"; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
@Autowired | |||
private AccessControlDao accessControlDao; | |||
@@ -44,7 +47,10 @@ public class AccessControlServiceSupport | |||
@Autowired | |||
private DeviceService deviceService; | |||
@Autowired | |||
private AccessControlService accessControlService; | |||
@Autowired | |||
private EmpDao empDao; | |||
@@ -119,7 +125,7 @@ public class AccessControlServiceSupport | |||
for (Device device : padList) { | |||
if (ObjectUtils.anyNotNull(device) && (Double.parseDouble(mis) > 0)) { | |||
RedisUtils.setString(device.getDeviceId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(device.getDeviceId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
@@ -250,4 +256,36 @@ public class AccessControlServiceSupport | |||
} | |||
} | |||
@Override | |||
public List<AccessControl> getAccessControlsByOfficeCodes(String[] officeCodes) { | |||
List<AccessControl> sumList = new ArrayList<>(); | |||
if (officeCodes != null && officeCodes.length > 0) { | |||
for (String officeCode : officeCodes) { | |||
List<AccessControl> deviceList = accessControlService.getAccessControlsByOfficeCode(officeCode); | |||
for (AccessControl accessControl : deviceList) { | |||
if (!sumList.contains(accessControl)) { | |||
sumList.add(accessControl); | |||
} | |||
} | |||
} | |||
} | |||
return sumList; | |||
} | |||
@Override | |||
public List<AccessControl> getAccessControlsByOfficeCode(String officeCode) { | |||
List<OfficeAccessControl> list = officeAccessControlDao.findAccessControlByOfficeCode(officeCode); | |||
List<AccessControl> accessControls = Lists.newArrayList(); | |||
for (OfficeAccessControl oac : list) { | |||
AccessControl temp = accessControlService.get(oac.getAccessControlId()); | |||
if (ObjectUtils.anyNotNull(temp)) { | |||
accessControls.add(temp); | |||
} | |||
} | |||
return accessControls; | |||
} | |||
} |
@@ -7,7 +7,9 @@ import com.jeesite.modules.sys.entity.*; | |||
import com.jeesite.modules.sys.service.EmpUserService; | |||
import com.jeesite.modules.sys.service.OfficeService; | |||
import com.jeesite.modules.sys.service.UserService; | |||
import com.jeesite.modules.sys.utils.RoleUtils; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.dao.UserExtraDao; | |||
import com.lecooai.visitor.web.sys.service.AdminService; | |||
import com.lecooai.visitor.web.sys.service.UserDataScopeService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -49,14 +51,24 @@ public class AdminServiceSupport implements AdminService{ | |||
@Autowired | |||
private UserRoleDao userRoleDao; | |||
@Autowired | |||
private UserExtraDao userDao; | |||
@Override | |||
public void createAdminAccount(String loginCode, String password){ | |||
public User createAdminAccount(String loginCode, String password, String userType){ | |||
User findUser = UserUtils.getByLoginCode(loginCode); | |||
if (findUser == null){ | |||
//新建用户 | |||
EmpUser empUser = new EmpUser(); | |||
empUser.setUserCode(loginCode); | |||
empUser.setUserName("组织管理员"); | |||
String role = null; | |||
if (userType.equals("none")) { | |||
empUser.setUserName("平台管理员"); | |||
role = "corpAdmin"; | |||
} else { | |||
empUser.setUserName("组织管理员"); | |||
role = "secAdmin"; | |||
} | |||
empUser.setLoginCode(loginCode); | |||
empUser.setIsNewRecord(true); | |||
//设置额外信息 | |||
@@ -77,19 +89,14 @@ public class AdminServiceSupport implements AdminService{ | |||
//分配二级管理员角色 | |||
UserRole userRole = new UserRole(); | |||
userRole.setUserCode(userCode); | |||
userRole.setRoleCode("secAdmin"); | |||
userRole.setRoleCode(role); | |||
userRoleDao.insert(userRole); | |||
//赋予二级管理员顶级机构权限 | |||
UserDataScope userDataScope = new UserDataScope(); | |||
userDataScope.setUserCode(userCode); | |||
userDataScope.setCtrlData(topOffice); | |||
userDataScope.setCtrlType("Office"); | |||
userDataScope.setCtrlPermi("1"); | |||
userDataScopeDao.insert(userDataScope); | |||
} | |||
//设置该账户密码 | |||
userService.updatePassword(findUser.getUserCode(), password); | |||
return findUser; | |||
} | |||
@Override | |||
@@ -106,6 +113,13 @@ public class AdminServiceSupport implements AdminService{ | |||
userDataScope.setCtrlPermi("1"); | |||
userDataScope.setCtrlData(id); | |||
userDataScopes.add(userDataScope); | |||
Office office = officeService.get(id); | |||
if(RoleUtils.hasUserRole(userCode, "corpAdmin")) { | |||
userDao.updateUserCorp("全部", "0", userCode); | |||
} else { | |||
userDao.updateUserCorp(office.getOfficeName(), id, userCode); | |||
} | |||
} | |||
userDataScope = new UserDataScope(); | |||
userDataScope.setUserCode(userCode); | |||
@@ -136,6 +150,11 @@ public class AdminServiceSupport implements AdminService{ | |||
empUserService.delete(empUser); | |||
} | |||
User user = userService.get(userCode); | |||
if(null != user){ | |||
userService.delete(user); | |||
} | |||
UserRole userRole = new UserRole(); | |||
userRole.setUserCode(userCode); | |||
userRoleDao.deleteByEntity(userRole); | |||
@@ -8,7 +8,6 @@ import com.jeesite.common.lang.StringUtils; | |||
import com.lecooai.visitor.web.sys.dao.AuthMappingDao; | |||
import com.lecooai.visitor.web.sys.dao.EmpDao; | |||
import com.lecooai.visitor.web.sys.entity.AuthMapping; | |||
import com.lecooai.visitor.web.sys.entity.Device; | |||
import com.lecooai.visitor.web.sys.entity.Emp; | |||
import com.lecooai.visitor.web.sys.utils.DateUtils; | |||
import com.lecooai.visitor.web.sys.utils.RedisUtils; | |||
@@ -16,7 +15,6 @@ import org.springframework.batch.item.ItemProcessor; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
@@ -35,6 +33,9 @@ public class AuthMappingItemProcessorService implements ItemProcessor<AuthMappin | |||
@Autowired | |||
private DeviceServiceSupport deviceService; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
@Override | |||
public AuthMapping process(AuthMapping authMapping) throws Exception { | |||
if (ObjectUtils.anyNotNull(authMapping)) { | |||
@@ -68,7 +69,7 @@ public class AuthMappingItemProcessorService implements ItemProcessor<AuthMappin | |||
for (String a : list) { | |||
if (StringUtils.isNotEmpty(a) && Emp.STATUS_NORMAL.equals(emp.getStatus())) { | |||
RedisUtils.setString(a+":face-latest-ts", mis); | |||
redisUtils.setGroupString(a+":face-latest-ts", mis); | |||
} | |||
} | |||
@@ -1,14 +1,11 @@ | |||
package com.lecooai.visitor.web.sys.service.support; | |||
import com.alibaba.fastjson.support.odps.udf.CodecCheck; | |||
import com.beust.jcommander.internal.Lists; | |||
import com.jeesite.common.lang.NumberUtils; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.common.service.CrudService; | |||
import com.jeesite.modules.sys.dao.UserDataScopeDao; | |||
import com.jeesite.modules.sys.entity.Office; | |||
import com.jeesite.modules.sys.entity.UserDataScope; | |||
import com.jeesite.modules.sys.service.OfficeService; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
@@ -25,6 +22,7 @@ import org.apache.commons.collections4.ListUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.data.redis.core.StringRedisTemplate; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
@@ -123,11 +121,11 @@ public class DeviceServiceSupport | |||
} | |||
} | |||
String loginCode = UserUtils.getUser().getLoginCode(); | |||
if (!BusinessUtils.isSecAdmin(loginCode)) { | |||
//if (!BusinessUtils.isSecAdmin(loginCode)) { | |||
if (entity.getOfficeIds() != null && entity.getOfficeIds().size() > 0) { | |||
deviceService.updateOfficeAuth(entity.getDeviceId(), entity.getOfficeIds(), originIds); | |||
} | |||
} | |||
// } | |||
entity.setDeviceId(StringUtils.upperCase(entity.getDeviceId())); | |||
//自动为闸机添加两个GCU和两个PAD | |||
if (Device.TYPE_GATE.equals(entity.getDeviceType()) && true == entity.getIsNewRecord()) { | |||
@@ -166,6 +164,7 @@ public class DeviceServiceSupport | |||
deviceExt1.setDeviceId(pad1.getDeviceId()); | |||
pad1.setCreatedAt(new Date()); | |||
pad1.setUpdatedAt(new Date()); | |||
pad1.setDevStatus(Device.DEV_STATUS_NOT_AUTH); | |||
deviceExtDao.insert(deviceExt1); | |||
Device pad2 = new Device(); | |||
pad2.setDeviceId(entity.getDeviceId()+"_PAD2"); | |||
@@ -178,6 +177,7 @@ public class DeviceServiceSupport | |||
deviceExt2.setDeviceId(pad2.getDeviceId()); | |||
pad2.setCreatedAt(new Date()); | |||
pad2.setUpdatedAt(new Date()); | |||
pad2.setDevStatus(Device.DEV_STATUS_NOT_AUTH); | |||
deviceExtDao.insert(deviceExt2); | |||
List<Device> devices = Lists.newArrayList(); | |||
devices.add(gcu1); | |||
@@ -193,6 +193,7 @@ public class DeviceServiceSupport | |||
ac.setAddress(entity.getAddress()); | |||
// ac.setOffice(officeService.get()); | |||
String userOfficeCode = ""; | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
UserDataScope uds = new UserDataScope(); | |||
uds.setUserCode(userCode); | |||
@@ -210,7 +211,10 @@ public class DeviceServiceSupport | |||
} | |||
} | |||
} | |||
} else { | |||
userOfficeCode = topOffice; | |||
} | |||
ac.setAccessControlName(entity.getDeviceName()); | |||
ac.setAccessControlId("SBD"+entity.getDeviceId()); | |||
ac.setOffice(officeService.get(userOfficeCode)); | |||
@@ -221,9 +225,16 @@ public class DeviceServiceSupport | |||
oac.setAccessControlId(ac.getAccessControlId()); | |||
oac.setOfficeId(userOfficeCode); | |||
officeAccessControlDao.insert(oac); | |||
OfficeAccessControl officeAccessControl = officeAccessControlDao.get(oac); | |||
if (!ObjectUtils.anyNotNull(officeAccessControl)) { | |||
officeAccessControlDao.insert(oac); | |||
} | |||
} | |||
if (true == entity.getIsNewRecord()) { | |||
entity.setDevStatus(Device.DEV_STATUS_NOT_AUTH); | |||
super.save(entity); | |||
} else { | |||
super.update(entity); | |||
@@ -298,9 +309,14 @@ public class DeviceServiceSupport | |||
return deviceDao.findByUserCode(userCode); | |||
} | |||
@Override | |||
public List<Device> getGateListByUserCode(String userCode) { | |||
return deviceDao.findGatesByUserCode(userCode); | |||
} | |||
@Override | |||
public List<Device> getDevicesByOffice(String officeCode) { | |||
OfficeAccessControl officeAccessControl = new OfficeAccessControl(); | |||
/*OfficeAccessControl officeAccessControl = new OfficeAccessControl(); | |||
officeAccessControl.setOfficeId(officeCode); | |||
List<OfficeAccessControl> officeAccessControls = officeAccessControlService.findList(officeAccessControl); | |||
List<Device> devices = new ArrayList<>(); | |||
@@ -310,7 +326,10 @@ public class DeviceServiceSupport | |||
if (device != null) { | |||
devices.add(device); | |||
} | |||
}); | |||
});*/ | |||
List<Device> devices = accessControlDao.findGateByOfficeCode(officeCode); | |||
return devices; | |||
} | |||
@@ -471,6 +490,9 @@ public class DeviceServiceSupport | |||
DeviceExtGcu deg = new DeviceExtGcu(); | |||
deg.setDeviceId(d.getDeviceId()); | |||
deg.setMasterSlaver("M"); | |||
// deg.setWaitPassTimeout(); | |||
// deg.setWaitPassTimeout(0); | |||
long gcuExtCont = deviceExtGcuDao.findCount(deg); | |||
if (gcuExtCont > 0) { | |||
return d; | |||
@@ -544,7 +566,7 @@ public class DeviceServiceSupport | |||
for (Device device : padList) { | |||
if (ObjectUtils.anyNotNull(device) && (Double.parseDouble(mis) > 0)) { | |||
RedisUtils.setString(device.getDeviceId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(device.getDeviceId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
@@ -562,14 +584,13 @@ public class DeviceServiceSupport | |||
} | |||
} | |||
public void putRedisData(){ | |||
List<Device> list = deviceDao.findAllPadDevice(); | |||
for (Device device : list) { | |||
// System.err.println(device.getDeviceId()+":"+ String.valueOf(device.getLatestAuthTs())); | |||
redisUtils.setString(device.getDeviceId()+":face-latest-ts", StringUtils.isNotEmpty(String.valueOf(device.getLatestAuthTs()))?String.valueOf(device.getLatestAuthTs()):"0"); | |||
redisUtils.setString(device.getDeviceId()+":auth-code", StringUtils.isNotEmpty(device.getAuthCode())?device.getAuthCode():""); | |||
redisUtils.setString(device.getDeviceId()+":bind-sn", StringUtils.isNotEmpty(device.getBindDeviceSn())?device.getBindDeviceSn():""); | |||
redisUtils.setGroupString(device.getDeviceId()+":face-latest-ts", StringUtils.isNotEmpty(String.valueOf(device.getLatestAuthTs()))?String.valueOf(device.getLatestAuthTs()):"0"); | |||
redisUtils.setGroupString(device.getDeviceId()+":auth-code", StringUtils.isNotEmpty(device.getAuthCode())?device.getAuthCode():""); | |||
redisUtils.setGroupString(device.getDeviceId()+":bind-sn", StringUtils.isNotEmpty(device.getBindDeviceSn())?device.getBindDeviceSn():""); | |||
} | |||
} | |||
@@ -578,4 +599,65 @@ public class DeviceServiceSupport | |||
deviceDao.updateAuthTs(devIds, mis); | |||
} | |||
public Device bindOnlineAndSynced(Device d){ | |||
if (!d.getDeviceType().equals("pad")) {//非PAD,直接退出 | |||
return d; | |||
} | |||
if (null != d.getDevStatus() && d.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH)) {//未激活,直接退出 | |||
return d; | |||
} | |||
DeviceExt deviceExt = deviceExtDao.findByDevId(d.getDeviceId()); | |||
Device findD = d.getGate(); | |||
List<Device> devices = deviceDao.findList(findD); | |||
if (ObjectUtils.anyNotNull(deviceExt)) { | |||
Date date = deviceExt.getUpdatedAt(); | |||
Long ut = date.getTime(); | |||
Long ct = new Date().getTime(); | |||
if (ut + 2*60*1000 >= ct) { | |||
d.setOnline(true); | |||
d.setDevStatus(Device.DEV_STATUS_NORMAL); | |||
devices.stream().forEach(gate->{ | |||
if (!(gate.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) | |||
gate.setDevStatus(Device.DEV_STATUS_NORMAL); | |||
deviceDao.update(gate); | |||
}); | |||
} else { | |||
d.setOnline(false); | |||
d.setDevStatus(Device.DEV_STATUS_OFFLINE); | |||
devices.stream().forEach(gate->{ | |||
if (!(gate.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) | |||
gate.setDevStatus(Device.DEV_STATUS_OFFLINE); | |||
deviceDao.update(gate); | |||
}); | |||
} | |||
String ts = deviceExt.getLastTs(); | |||
String ds = ObjectUtils.anyNotNull(d.getLatestAuthTs()) ? d.getLatestAuthTs().toString() : ""; | |||
if (ObjectUtils.anyNotNull(ts) && ts.equals(ds)) { | |||
d.setSynced(true); | |||
} else { | |||
d.setSynced(false); | |||
} | |||
} else { | |||
d.setOnline(false); | |||
// d.setDevStatus(Device.DEV_STATUS_OFFLINE); | |||
devices.stream().forEach(gate->{ | |||
if (!(gate.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) | |||
gate.setDevStatus(Device.DEV_STATUS_OFFLINE); | |||
deviceDao.update(gate); | |||
}); | |||
} | |||
deviceDao.update(d); | |||
return d; | |||
} | |||
} |
@@ -501,7 +501,7 @@ public class EmpServiceSupport | |||
Device device = deviceService.findByDevId(authMapping.getDevId()); | |||
if (ObjectUtils.anyNotNull(device) && Emp.STATUS_NORMAL.equals(emp.getStatus())) { | |||
redisUtils.setString(authMapping.getDevId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(authMapping.getDevId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
@@ -731,7 +731,7 @@ public class EmpServiceSupport | |||
AuthMapping authMapping = new AuthMapping(); | |||
String empId = emp.getId(); | |||
authMapping.setEmpId(empId); | |||
// Device device = deviceService.findByDevId(acId); | |||
AuthMapping am = authMappingDao.getByEmpAndDev(acId, empId); | |||
String mis = DateUtils.getMillsSecondsDouble(); | |||
if (!Emp.STATUS_NORMAL.equals(emp.getStatus())) { | |||
@@ -755,16 +755,14 @@ public class EmpServiceSupport | |||
authMappingDao.insert(authMapping); | |||
} | |||
List<Device> padList = accessControlDao.findPadByAcId(acId);//一个门禁点可能含多个pad | |||
// Device device = deviceService.findByDevId(acId); | |||
for (Device device : padList) { | |||
if (ObjectUtils.anyNotNull(device) && (Double.parseDouble(mis) > 0)) { | |||
RedisUtils.setString(device.getDeviceId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(device.getDeviceId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
} | |||
} | |||
public void updMappingTs(List<String> accessControlIds, Emp emp){ | |||
@@ -798,7 +796,7 @@ public class EmpServiceSupport | |||
for (Device device : padList) { | |||
if (ObjectUtils.anyNotNull(device) && (Double.parseDouble(mis) > 0)) { | |||
RedisUtils.setString(device.getDeviceId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(device.getDeviceId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
@@ -870,7 +868,7 @@ public class EmpServiceSupport | |||
authMappingDao.update(am); | |||
Device device = deviceService.findByDevId(am.getDevId()); | |||
if (ObjectUtils.anyNotNull(device) && Emp.STATUS_NORMAL.equals(emp.getStatus())) { | |||
redisUtils.setString(am.getDevId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(am.getDevId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
@@ -26,6 +26,7 @@ public class ApiSignUtil { | |||
public static String apiSign(String string){ | |||
String str = string+KeySecrect; | |||
System.err.println(str); | |||
return DigestUtils.md5DigestAsHex(str.getBytes()); | |||
} | |||
@@ -1,8 +1,17 @@ | |||
package com.lecooai.visitor.web.sys.utils; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.modules.sys.utils.RoleUtils; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.constant.BusinessConsts; | |||
import com.lecooai.visitor.web.sys.dao.DeviceExtDao; | |||
import com.lecooai.visitor.web.sys.entity.Device; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExt; | |||
import com.lecooai.visitor.web.sys.entity.VisitRecords; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import java.util.Date; | |||
/** | |||
@@ -24,7 +33,7 @@ public class BusinessUtils { | |||
* @return java.lang.Boolean | |||
**/ | |||
public static Boolean isSecAdmin(String userCode){ | |||
return !(BusinessConsts.LOGIN_CODE_ADMIN.getCode().equals(userCode) || BusinessConsts.lOGIN_CODE_SYSTEM.getCode().equals(userCode)); | |||
return !(BusinessConsts.LOGIN_CODE_ADMIN.getCode().equals(userCode) || BusinessConsts.lOGIN_CODE_SYSTEM.getCode().equals(userCode)) && RoleUtils.hasUserRole(userCode, "secAdmin"); | |||
} | |||
public static String getMmsJsonString(VisitRecords vr){ | |||
@@ -37,5 +46,23 @@ public class BusinessUtils { | |||
return json.toJSONString(); | |||
} | |||
@Autowired | |||
private static DeviceExtDao deviceExtDao; | |||
public static Boolean isOnline(String deviceId){ | |||
DeviceExt deviceExt = deviceExtDao.findByDevId(deviceId); | |||
if (ObjectUtils.anyNotNull(deviceExt)) { | |||
Date date = deviceExt.getUpdatedAt(); | |||
Long ut = date.getTime(); | |||
Long ct = new Date().getTime(); | |||
if (ut + 2*60*1000 >= ct) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
} | |||
} |
@@ -6,7 +6,6 @@ import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import net.coobird.thumbnailator.Thumbnails; | |||
import net.coobird.thumbnailator.tasks.UnsupportedFormatException; | |||
import org.beetl.ext.fn.Json; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.http.HttpEntity; | |||
@@ -21,6 +20,7 @@ import sun.misc.BASE64Encoder; | |||
import javax.imageio.ImageIO; | |||
import java.awt.image.BufferedImage; | |||
import java.io.*; | |||
import java.util.Base64; | |||
import java.util.Map; | |||
import java.util.UUID; | |||
@@ -164,8 +164,10 @@ public class ImageUtil { | |||
*/ | |||
public static String convertToBase64(byte[] bytes) { | |||
// 对字节数组进行Base64编码,得到Base64编码的字符串 | |||
BASE64Encoder encoder = new BASE64Encoder(); | |||
String base64Str = encoder.encode(bytes); | |||
Base64.Encoder encoder = Base64.getEncoder(); | |||
String base64Str = encoder.encodeToString(bytes); | |||
/*BASE64Encoder encoder = new BASE64Encoder(); | |||
String base64Str = encoder.encode(bytes);*/ | |||
return base64Str; | |||
} | |||
@@ -177,6 +179,7 @@ public class ImageUtil { | |||
public static String convertToBase64(InputStream inStream) { | |||
// 对字节数组进行Base64编码,得到Base64编码的字符串 | |||
BASE64Encoder encoder = new BASE64Encoder(); | |||
String base64Str = ""; | |||
// 读取图片字节数组 | |||
try { | |||
@@ -218,10 +221,12 @@ public class ImageUtil { | |||
json.put("message", "参数为空"); | |||
return json; | |||
} | |||
BASE64Decoder decoder = new BASE64Decoder(); | |||
// BASE64Decoder decoder = new BASE64Decoder(); | |||
// | |||
Base64.Decoder decoder = Base64.getDecoder(); | |||
try { | |||
//Base64解码 | |||
byte[] bytes = decoder.decodeBuffer(imgStr); | |||
byte[] bytes = decoder.decode(imgStr); | |||
for (int i = 0; i < bytes.length; ++i) { | |||
if (bytes[i] < 0) {//调整异常数据 | |||
bytes[i] += 256; | |||
@@ -1,6 +1,9 @@ | |||
package com.lecooai.visitor.web.sys.utils; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.fasterxml.jackson.annotation.JsonAutoDetect; | |||
import com.fasterxml.jackson.annotation.PropertyAccessor; | |||
import com.fasterxml.jackson.databind.ObjectMapper; | |||
import com.jeesite.common.codec.DesUtils; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.entity.Extend; | |||
@@ -11,93 +14,90 @@ import com.jeesite.modules.sys.entity.UserRole; | |||
import com.lecooai.visitor.web.sys.dao.EmpDao; | |||
import com.lecooai.visitor.web.sys.dao.UserExtraDao; | |||
import com.lecooai.visitor.web.sys.entity.Emp; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.data.redis.connection.RedisConnectionFactory; | |||
import org.springframework.data.redis.core.RedisTemplate; | |||
import org.springframework.data.redis.core.StringRedisTemplate; | |||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | |||
import org.springframework.data.redis.serializer.StringRedisSerializer; | |||
import org.springframework.stereotype.Component; | |||
import javax.annotation.PostConstruct; | |||
import javax.annotation.Resource; | |||
import java.util.concurrent.TimeUnit; | |||
@AllArgsConstructor | |||
@Component | |||
public class RedisUtils { | |||
@Resource | |||
private RedisTemplate<String, String> redisTemplate; | |||
@Autowired | |||
private StringRedisTemplate stringRedisTemplate2; | |||
@Value("${spring.redis.group}") | |||
private String group2; | |||
private String group; | |||
@Autowired | |||
private UserExtraDao userDao2; | |||
private UserExtraDao userDao; | |||
@Autowired | |||
private EmpDao empDao2; | |||
private EmpDao empDao; | |||
@Autowired | |||
private UserRoleDao userRoleDao2; | |||
private static StringRedisTemplate stringRedisTemplate; | |||
private UserRoleDao userRoleDao; | |||
private static String group; | |||
private static UserExtraDao userDao; | |||
private static EmpDao empDao; | |||
private static UserRoleDao userRoleDao; | |||
public void setGroupString (String key, String value){ | |||
redisTemplate.opsForValue().set(group+":"+key, ObjectUtils.anyNotNull(value)?value:""); | |||
// stringRedisTemplate.opsForValue().set(group+":"+key, ObjectUtils.anyNotNull(value)?value:""); | |||
} | |||
@PostConstruct | |||
public void init() { | |||
stringRedisTemplate = stringRedisTemplate2; | |||
group = group2; | |||
userDao = userDao2; | |||
empDao = empDao2; | |||
public void setDefaultString (String key, String value){ | |||
userRoleDao = userRoleDao2; | |||
// stringRedisTemplate.opsForValue().set(key, ObjectUtils.anyNotNull(value)?value:"", 15*60, TimeUnit.SECONDS); | |||
redisTemplate.opsForValue().set(key, ObjectUtils.anyNotNull(value)?value:"", 15*60, TimeUnit.SECONDS); | |||
} | |||
public RedisUtils(){ | |||
public String getString (String key){ | |||
return redisTemplate.opsForValue().get(key); | |||
} | |||
public static void setString (String key, String value){ | |||
public String getGroupString (String key){ | |||
return redisTemplate.opsForValue().get(group+":"+key); | |||
} | |||
stringRedisTemplate.opsForValue().set(group+":"+key, ObjectUtils.anyNotNull(value)?value:""); | |||
public String getDefaultString (String key){ | |||
return redisTemplate.opsForValue().get(key); | |||
} | |||
public static void setDefaultString (String key, String value){ | |||
stringRedisTemplate.opsForValue().set(key, ObjectUtils.anyNotNull(value)?value:"", 15*60, TimeUnit.SECONDS); | |||
} | |||
public boolean hasKey (String key){ | |||
public static String getString (String key){ | |||
return stringRedisTemplate.opsForValue().get(group+":"+key); | |||
return redisTemplate.hasKey(key); | |||
} | |||
public static String getDefaultString (String key){ | |||
return stringRedisTemplate.opsForValue().get(key); | |||
} | |||
public boolean hasGroupKey (String key){ | |||
return redisTemplate.hasKey(group+":"+key); | |||
} | |||
public static boolean hasKey (String key){ | |||
public boolean delKey (String key){ | |||
return stringRedisTemplate.hasKey(key); | |||
return redisTemplate.delete(key); | |||
} | |||
public static boolean delKey (String key){ | |||
public boolean delGroupKey (String key){ | |||
return stringRedisTemplate.delete(key); | |||
return redisTemplate.delete(group+":"+key); | |||
} | |||
public static void setUserVariables(String wxOpenid, String type) throws Exception{ | |||
public void setUserVariables(String wxOpenid, String type) throws Exception{ | |||
String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||
String encodeOpenid = DesUtils.encode(type+wxOpenid, secretKey); | |||
@@ -154,7 +154,7 @@ public class RedisUtils { | |||
} | |||
public static JSONObject getUserObject(String wxOpenid) throws Exception{ | |||
public JSONObject getUserObject(String wxOpenid) throws Exception{ | |||
User findUser = userDao.findByWxOpenid(wxOpenid.substring(1),wxOpenid.substring(0,1)); | |||
@@ -200,9 +200,9 @@ public class AccessControlGroupController extends BaseController { | |||
@RequestMapping(value = "/treeData") | |||
@ResponseBody | |||
public List<HashMap> treeData(){ | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
// String userCode = UserUtils.getUser().getUserCode(); | |||
List<HashMap> acgs = accessControlGroupDao.findAcTreeList(userCode); | |||
List<HashMap> acgs = accessControlGroupDao.findAcTreeList(null); | |||
List<DictData> dlist = DictUtils.getDictList("sys_citys"); | |||
@@ -7,6 +7,7 @@ package com.lecooai.visitor.web.sys.web; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.huawei.it.sso.filter.util.IDaasUtils; | |||
import com.jeesite.common.codec.DesUtils; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.entity.Extend; | |||
@@ -248,6 +249,74 @@ public class Account2Controller extends WxBaseController { | |||
} | |||
} | |||
@RequestMapping( | |||
value = {"/account/login"}, | |||
method = {RequestMethod.POST} | |||
) | |||
public String loginFailure2(HttpServletRequest request, HttpServletResponse response, Model model) { | |||
LoginInfo loginInfo = UserUtils.getLoginInfo(); | |||
String username; | |||
UserUtils.clearCache(); | |||
if (loginInfo != null) { | |||
username = request.getQueryString(); | |||
username = username == null ? "" : "?" + username; | |||
ServletUtils.redirectUrl(request, response, this.adminPath + "/index" + username); | |||
return null; | |||
} else { | |||
username = WebUtils.getCleanParam(request, "username"); | |||
String password = WebUtils.getCleanParam(request, "password"); | |||
System.err.println("======login====="); | |||
System.err.println(username); | |||
String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||
String un = DesUtils.decode(username, secretKey); | |||
String pwd = DesUtils.decode(password, secretKey); | |||
User user = UserUtils.getByLoginCode(un); | |||
if (ObjectUtils.anyNotNull(user)) { | |||
if(!(PwdUtils.validatePassword(pwd, user.getPassword()))){ | |||
model.addAttribute("message", "密码输入错误"); | |||
} else { | |||
model.addAttribute("user", user); | |||
} | |||
} else { | |||
model.addAttribute("message", "账号输入错误"); | |||
} | |||
Map<String, Object> paramMap = ServletUtils.getExtParams(request); | |||
Iterator var12 = paramMap.entrySet().iterator(); | |||
while(var12.hasNext()) { | |||
Map.Entry<String, Object> entry = (Map.Entry)var12.next(); | |||
model.addAttribute("param_" + (String)entry.getKey(), entry.getValue()); | |||
} | |||
FormToken formToken = new FormToken(); | |||
formToken.setUsername(un); | |||
formToken.setSsoToken(UserUtils.getSsoToken(un)); | |||
//formToken.setParams(ServletUtils.getExtParams(request)); | |||
UserUtils.getSubject().login(formToken); | |||
String sid = UserUtils.getSession().getId().toString(); | |||
System.out.println("登录成功,__sid=" + sid); | |||
User u = UserUtils.getUser(); | |||
Session session = UserUtils.getSession(); | |||
if (ServletUtils.isAjaxRequest(request)) { | |||
model.addAttribute("result", "false"); | |||
return ServletUtils.renderObject(response, model); | |||
} else { | |||
String userType = (String)paramMap.get("userType"); | |||
if (StringUtils.isNotBlank(userType)) { | |||
String view = UserUtils.getUserTypeValue(userType, "loginView"); | |||
if (StringUtils.isNotBlank(view)) { | |||
return view; | |||
} | |||
} | |||
return "modules/sys/sysAdminLogin"; | |||
} | |||
} | |||
} | |||
@PostMapping({"/account2/updPhone"}) | |||
@ResponseBody | |||
@@ -303,7 +372,7 @@ public class Account2Controller extends WxBaseController { | |||
userService.update(u); | |||
try { | |||
sendUtil.sendRegToUser(getOfficeMgrUser(emp), u.getUserName()+"已修改公司,需您审核!", emp, SendUtil.TYPE_COMPANY_MGR); | |||
RedisUtils.setUserVariables(u.getWxOpenid(), "0"); | |||
redisUtils.setUserVariables(u.getWxOpenid(), "0"); | |||
} catch (WxErrorException e) { | |||
e.printStackTrace(); | |||
msg = e.getMessage(); | |||
@@ -496,7 +565,7 @@ public class Account2Controller extends WxBaseController { | |||
wxErrorException.printStackTrace(); | |||
msg += wxErrorException.getMessage(); | |||
} | |||
RedisUtils.delKey("user:"+jobNumber); | |||
redisUtils.delKey("user:"+jobNumber); | |||
empDao.delByJobNumber(jobNumber); | |||
userDao.delByLoginCode(jobNumber); | |||
empUserRoleDao.delUserRoleByIds(new String[]{jobNumber});//删除邀约权 | |||
@@ -549,8 +618,8 @@ public class Account2Controller extends WxBaseController { | |||
if (1==Integer.valueOf((String)type)) { | |||
String secretKey = Global.getConfig("shiro.loginSubmit.secretKey"); | |||
String decodeOpenid = DesUtils.decode((String) openid, secretKey); | |||
RedisUtils.setUserVariables(decodeOpenid.substring(1), decodeOpenid.substring(0, 1)); | |||
JSONObject userJson = RedisUtils.getUserObject(decodeOpenid); | |||
redisUtils.setUserVariables(decodeOpenid.substring(1), decodeOpenid.substring(0, 1)); | |||
JSONObject userJson = redisUtils.getUserObject(decodeOpenid); | |||
model.addAttribute("userJson", userJson); | |||
model.addAttribute("isReg", 0); | |||
} else { | |||
@@ -606,7 +675,7 @@ public class Account2Controller extends WxBaseController { | |||
empService.faceUpdate(emp, imgUrl, array.toJSONString()); | |||
// empService.updAuthMapping(emp);//修改人脸无需修改mapping表 | |||
try { | |||
RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
redisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
sendUtil.sendRegToUser(getOfficeMgrUser(emp),"贵司员工"+emp.getRealName()+"人脸照片已修改,需您审核", emp, SendUtil.TYPE_COMPANY_MGR); | |||
} catch (WxErrorException e) { | |||
errMsg += e.getMessage(); | |||
@@ -668,7 +737,7 @@ public class Account2Controller extends WxBaseController { | |||
auditRecordsDao.insert(auditRecords); | |||
RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
redisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
return outputSuccess(); | |||
} | |||
@@ -698,7 +767,7 @@ public class Account2Controller extends WxBaseController { | |||
userService.update(user); | |||
userDao.updateUserType(User.USER_TYPE_PERSION, userCode); | |||
RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
redisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
return outputSuccess(); | |||
} | |||
@@ -822,8 +891,8 @@ public class Account2Controller extends WxBaseController { | |||
System.err.println(DateUtils.getMillsSecondsDouble()); | |||
JSONObject userJson; | |||
try { | |||
RedisUtils.setUserVariables(wxOpenid.substring(1),wxOpenid.substring(0,1)); | |||
userJson = RedisUtils.getUserObject(wxOpenid); | |||
redisUtils.setUserVariables(wxOpenid.substring(1),wxOpenid.substring(0,1)); | |||
userJson = redisUtils.getUserObject(wxOpenid); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
model.addAttribute("msg", e.getMessage()); | |||
@@ -850,4 +919,11 @@ public class Account2Controller extends WxBaseController { | |||
return "wx/camera"; | |||
} | |||
@RequestMapping(value = "/account/adminLogin") | |||
public String adminLogin(Model model) { | |||
Subject subject = SecurityUtils.getSubject(); | |||
subject.logout(); | |||
return "modules/sys/sysAdminLogin"; | |||
} | |||
} |
@@ -1,22 +1,32 @@ | |||
package com.lecooai.visitor.web.sys.web; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.google.common.collect.Lists; | |||
import com.google.gson.JsonObject; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.entity.Extend; | |||
import com.jeesite.common.entity.Page; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.modules.sys.dao.ModuleDao; | |||
import com.jeesite.modules.sys.dao.UserDataScopeDao; | |||
import com.jeesite.modules.sys.entity.EmpUser; | |||
import com.jeesite.modules.sys.entity.Office; | |||
import com.jeesite.modules.sys.entity.User; | |||
import com.jeesite.modules.sys.entity.UserDataScope; | |||
import com.jeesite.modules.sys.service.EmpUserService; | |||
import com.jeesite.modules.sys.service.OfficeService; | |||
import com.jeesite.modules.sys.service.UserService; | |||
import com.jeesite.modules.sys.utils.RoleUtils; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.jeesite.modules.sys.utils.ValidCodeUtils; | |||
import com.lecooai.visitor.web.sys.dao.EmpDao; | |||
import com.lecooai.visitor.web.sys.dao.UserExtraDao; | |||
import com.lecooai.visitor.web.sys.entity.Device; | |||
import com.lecooai.visitor.web.sys.service.AdminService; | |||
import com.lecooai.visitor.web.sys.service.DeviceService; | |||
import com.lecooai.visitor.web.sys.service.UserDataScopeService; | |||
import com.lecooai.visitor.web.sys.utils.BusinessUtils; | |||
import com.lecooai.visitor.web.sys.utils.OfficeEmpUtils; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -58,30 +68,66 @@ public class AdminController extends BaseController { | |||
@Autowired | |||
private EmpUserService empUserService; | |||
@Autowired | |||
private UserService userService; | |||
@Autowired | |||
private EmpDao empDao; | |||
@Autowired | |||
private UserExtraDao userDao; | |||
@Autowired | |||
private UserDataScopeDao userDataScopeDao; | |||
@RequiresPermissions("sys:admin:edit") | |||
@GetMapping(value = "/list") | |||
public String list(EmpUser empUser, Model model) { | |||
Office office = new Office(); | |||
office.setParentCode(topOffice); | |||
// List<String> hasMgrs = OfficeEmpUtils.getHasMgrOffices(); | |||
// office.getSqlMap().getWhere().and("office_code", QueryType.NOT_IN, hasMgrs); | |||
List<Office> officeList = officeService.findList(office); | |||
List<JSONObject> userTypeList = Lists.newArrayList(); | |||
userTypeList.add(JSONObject.parseObject("{'userTypeName':'平台管理员', 'userTypeCode':'none'}")); | |||
userTypeList.add(JSONObject.parseObject("{'userTypeName':'组织管理员', 'userTypeCode':'employee'}")); | |||
System.err.println(userTypeList.get(0).getString("userTypeName")); | |||
System.err.println(userTypeList.get(0).getString("userTypeCode")); | |||
model.addAttribute("admin", empUser); | |||
model.addAttribute("officeList", officeList); | |||
model.addAttribute("userTypeList", userTypeList); | |||
return "modules/sys/admin/list"; | |||
} | |||
@RequiresPermissions("user") | |||
@RequestMapping(value = "/listData") | |||
@ResponseBody | |||
public Page<EmpUser> listData(EmpUser empUser, HttpServletRequest request, HttpServletResponse response) { | |||
Page<EmpUser> page = new Page<>(request, response); | |||
empUser.setUserType("employee"); | |||
empUser.setStatus("0"); | |||
String loginCode = empUser.getLoginCode(); | |||
public Page<User> listData(EmpUser empUser, HttpServletRequest request, HttpServletResponse response) { | |||
Page<User> page = new Page<>(request, response); | |||
/*empUser.setUserType("none"); | |||
empUser.setStatus("0");*/ | |||
User user = new User(); | |||
user.setStatus("0"); | |||
/** | |||
* 无公司管理员,只有平台管理员,与荣耀idaas系统关联 | |||
* 公司管理园,如奥北,需要登陆到公众号页面 | |||
*/ | |||
// user.setUserType("none"); | |||
user.getSqlMap().getWhere().and("user_code", QueryType.NE, "admin", 1).and("user_code", QueryType.NE, "system", 2).andBracket("user_type", QueryType.EQ, "none",1).or("user_type", QueryType.EQ, "employee",2).endBracket(); | |||
String loginCode = user.getLoginCode(); | |||
if ("_".equals(loginCode)) { | |||
empUser.setLoginCode("\\_"); | |||
user.setLoginCode("\\_"); | |||
} | |||
page.setOrderBy("loginCode"); | |||
page = empUserService.findPage(page, empUser); | |||
List<EmpUser> list = page.getList(); | |||
page = userService.findPage(page, user); | |||
List<User> list = page.getList(); | |||
for (User u : list) { | |||
StringBuilder officeAuth = new StringBuilder(); | |||
if (u != null) { | |||
@@ -92,6 +138,7 @@ public class AdminController extends BaseController { | |||
if (i > 0) { | |||
officeAuth.append(" \\ "); | |||
} | |||
System.err.println(officeCodes); | |||
Office office = officeService.get(officeCodes.get(i)); | |||
officeAuth.append(office.getOfficeName()); | |||
} | |||
@@ -109,27 +156,23 @@ public class AdminController extends BaseController { | |||
public String form(EmpUser empUser, Model model) { | |||
Office office = new Office(); | |||
office.setParentCode(topOffice); | |||
List<String> hasMgrs = OfficeEmpUtils.getHasMgrOffices(); | |||
office.getSqlMap().getWhere().and("office_code", QueryType.NOT_IN, hasMgrs); | |||
// List<String> hasMgrs = OfficeEmpUtils.getHasMgrOffices(); | |||
// office.getSqlMap().getWhere().and("office_code", QueryType.NOT_IN, hasMgrs); | |||
List<Office> officeList = officeService.findList(office); | |||
List<String> officeIdIn = new ArrayList<>(); | |||
empUser = empUserService.get(empUser.getUserCode()); | |||
if (empUser != null) { | |||
User user = userService.get(empUser.getUserCode()); | |||
if (user != null) { | |||
//根据用户获取管辖公司 | |||
List<String> officeIdList = userDataScopeService.getOfficeCodeByUserCode(empUser.getUserCode()); | |||
officeIdList.forEach(o -> officeIdIn.add("'" + o + "'")); | |||
} | |||
model.addAttribute("admin", empUser); | |||
model.addAttribute("admin", user); | |||
model.addAttribute("officeList", officeList); | |||
model.addAttribute("officeIdIn", officeIdIn); | |||
String mgrOfficeCode = officeIdIn.size()>0?officeIdIn.get(0).replaceAll("'",""):""; | |||
model.addAttribute("mgrOffice", StringUtils.isNotEmpty(mgrOfficeCode)?officeService.get(mgrOfficeCode):null); | |||
System.err.println(officeIdIn); | |||
System.err.println(officeIdIn.size()); | |||
System.err.println(mgrOfficeCode); | |||
System.err.println(StringUtils.isNotEmpty(mgrOfficeCode)?officeService.get(mgrOfficeCode):null); | |||
return "modules/sys/admin/form"; | |||
} | |||
@@ -178,8 +221,15 @@ public class AdminController extends BaseController { | |||
@RequiresPermissions("user") | |||
@RequestMapping(value = "query-devices-by-offices") | |||
@ResponseBody | |||
public List<Device> queryDevicesByOffices(String[] officeCodes) { | |||
return deviceService.getDevicesByOfficeCodes(officeCodes); | |||
public List<Device> queryDevicesByOffices(String[] officeCodes, String userCode) { | |||
if (StringUtils.isNotEmpty(userCode) && BusinessUtils.isSecAdmin(userCode)) { | |||
return deviceService.getDevicesByOfficeCodes(officeCodes); | |||
} else { | |||
Device d = new Device(); | |||
d.setDeviceType(Device.TYPE_GATE); | |||
return deviceService.findList(d); | |||
} | |||
} | |||
/** | |||
@@ -195,7 +245,7 @@ public class AdminController extends BaseController { | |||
@RequiresPermissions("sys:admin:edit") | |||
@RequestMapping(value = "new-admin") | |||
@ResponseBody | |||
public String newAdmin(HttpServletRequest request, String loginCode, String password | |||
public String newAdmin(HttpServletRequest request, String loginCode, String password, String userType, String officeCode | |||
, @RequestParam(required = true, defaultValue = "") String validCode) { | |||
boolean isCorrect = ValidCodeUtils.validate(request, validCode); | |||
if (!isCorrect) { | |||
@@ -215,7 +265,41 @@ public class AdminController extends BaseController { | |||
emp.setRegisterTime(new Date()); | |||
empDao.insert(emp);*/ | |||
adminService.createAdminAccount(loginCode, password); | |||
User user = adminService.createAdminAccount(loginCode, password, userType); | |||
System.err.println("create admin account"); | |||
UserDataScope userDataScope2 = new UserDataScope(); | |||
userDataScope2.setUserCode(user.getUserCode()); | |||
userDataScope2.setCtrlType("Office"); | |||
userDataScope2.setCtrlPermi("1"); | |||
userDataScope2.setCtrlData(topOffice); | |||
if (officeCode != null) { | |||
List<UserDataScope> userDataScopes = new ArrayList<>(); | |||
UserDataScope userDataScope; | |||
userDataScope = new UserDataScope(); | |||
userDataScope.setUserCode(user.getUserCode()); | |||
userDataScope.setCtrlType("Office"); | |||
userDataScope.setCtrlPermi("1"); | |||
userDataScope.setCtrlData(officeCode); | |||
userDataScopes.add(userDataScope); | |||
Office office = officeService.get(officeCode); | |||
userDataScopes.add(userDataScope2); | |||
if(RoleUtils.hasUserRole(user.getUserCode(), "corpAdmin")) { | |||
userDao.updateUserCorp("全部", "0", user.getUserCode()); | |||
} else { | |||
userDao.updateUserCorp(office.getOfficeName(), officeCode, user.getUserCode()); | |||
} | |||
userDataScopeDao.insertBatch(userDataScopes); | |||
} else { | |||
userDataScopeDao.insert(userDataScope2); | |||
} | |||
userDao.updateUserType(User.USER_TYPE_NONE, loginCode); | |||
return renderResult(Global.TRUE, "添加管理员成功"); | |||
} | |||
@@ -1,11 +1,14 @@ | |||
package com.lecooai.visitor.web.sys.web; | |||
import com.jeesite.common.entity.Page; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.modules.sys.utils.D; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.entity.AdminLog; | |||
import com.lecooai.visitor.web.sys.service.AdminLogService; | |||
import com.lecooai.visitor.web.sys.utils.BusinessUtils; | |||
import com.lecooai.visitor.web.sys.utils.DateUtils; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Controller; | |||
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.ResponseBody; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.Date; | |||
/** | |||
@@ -59,12 +63,28 @@ public class AdminLogController extends BaseController { | |||
@RequiresPermissions("user") | |||
@RequestMapping(value = "/listData") | |||
@ResponseBody | |||
public Page<AdminLog> listData(HttpServletRequest request, HttpServletResponse response){ | |||
public Page<AdminLog> listData(HttpServletRequest request, HttpServletResponse response, String startDate, String account){ | |||
if (StringUtils.isEmpty(startDate)) { | |||
startDate = DateUtils.formatDate(DateUtils.getPushForwardDate(new Date(), 11), "yyyy-MM-dd") +" ~ "+ DateUtils.formatDate(new Date(), "yyyy-MM-dd"); | |||
} | |||
String[] dateStrs = startDate.split(" ~ "); | |||
String startDateStr = dateStrs[0]; | |||
String endDateStr = dateStrs[1]+" 23:59:59"; | |||
AdminLog adminLog = new AdminLog(); | |||
if (StringUtils.isEmpty(account)) { | |||
adminLog.getSqlMap().getWhere().and("create_by", QueryType.LIKE, "%"+account+"%"); | |||
} | |||
String[] logArr = new String[]{LOG_OPERATE_INFO}; | |||
adminLog.getSqlMap().getWhere().and("log_title", QueryType.NOT_IN, logArr); | |||
adminLog.getSqlMap().getWhere().and("create_date", QueryType.GTE, startDateStr).and("create_date", QueryType.LTE, endDateStr).and("log_title", QueryType.NOT_IN, logArr); | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
String loginCode = UserUtils.getUser().getLoginCode(); | |||
if (BusinessUtils.isSecAdmin(loginCode)) { | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
adminLog.setCreateBy(loginCode); | |||
} | |||
return adminLogService.findPage(new Page<>(request, response), adminLog); | |||
@@ -1,6 +1,7 @@ | |||
package com.lecooai.visitor.web.sys.web; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.idgen.IdGen; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.shiro.session.SessionManager; | |||
@@ -16,6 +17,8 @@ import com.lecooai.visitor.web.sys.service.FaceHistoryService; | |||
import com.lecooai.visitor.web.sys.service.PasswordLogService; | |||
import com.lenovo.nowgo.common.constant.ResponseCode; | |||
import com.lenovo.nowgo.common.http.response.MyResponse; | |||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; | |||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Controller; | |||
@@ -202,4 +205,35 @@ public class ApiController extends BaseController { | |||
} | |||
return outputSuccess(); | |||
} | |||
@Value("jasypt.encryptor.password") | |||
private String jasyptPwd; | |||
@GetMapping("/jasypt/{pwd}") | |||
@ResponseBody | |||
public MyResponse jasypt2(@PathVariable(required = true) String pwd){ | |||
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); | |||
SimpleStringPBEConfig config = new SimpleStringPBEConfig(); | |||
String jasyptPwd = System.getProperty("jasypt.encryptor.password"); | |||
jasyptPwd = (null==jasyptPwd ? Global.getConfig("jasypt.encryptor.password"):jasyptPwd); | |||
System.err.println("jasyptPwd-----------:"); | |||
System.err.println(Global.getConfig("jasypt.encryptor.password")); | |||
System.err.println(jasyptPwd); | |||
config.setPassword(jasyptPwd); | |||
config.setAlgorithm("PBEWithMD5AndDES"); | |||
config.setKeyObtentionIterations("1000"); | |||
config.setPoolSize("1"); | |||
config.setProviderName(null); | |||
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); | |||
config.setStringOutputType("base64"); | |||
encryptor.setConfig(config); | |||
return outputData(0, encryptor.encrypt(pwd)); | |||
} | |||
} |
@@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject; | |||
import com.google.common.collect.Lists; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.entity.Page; | |||
import com.jeesite.common.lang.NumberUtils; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.common.mybatis.s.x.J; | |||
import com.jeesite.modules.sys.dao.UserDataScopeDao; | |||
import com.jeesite.modules.sys.entity.Office; | |||
import com.jeesite.modules.sys.entity.UserDataScope; | |||
@@ -26,6 +28,7 @@ import kong.unirest.Unirest; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.ui.Model; | |||
@@ -41,6 +44,7 @@ import java.io.IOException; | |||
import java.math.BigDecimal; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
@@ -114,6 +118,12 @@ public class DeviceController extends BaseController { | |||
@Autowired | |||
private UserDataScopeDao userDataScopeDao; | |||
@Autowired | |||
private AccessControlDao accessControlDao; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
/** | |||
* 获取设备 | |||
*/ | |||
@@ -133,12 +143,51 @@ public class DeviceController extends BaseController { | |||
@RequiresPermissions("sys:device:view") | |||
@RequestMapping(value = "/gate/list",method = RequestMethod.GET, produces = "text/html;charset=UTF-8") | |||
public String gateList(Device device, Model model) { | |||
public String gateList(Device device, @RequestParam(required = false) String ableFlush, @RequestParam(required = false) String flushSec, Model model) { | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
device.setDeviceType(Device.TYPE_GATE); | |||
List<String> devices = Lists.newArrayList(); | |||
if (StringUtils.isNotEmpty(device.getGroupCode()) || StringUtils.isNotEmpty(device.getArea())) { | |||
List<String> devIds = Lists.newArrayList(); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
UserDataScope uds = new UserDataScope(); | |||
uds.setUserCode(userCode); | |||
uds.setCtrlType("Office"); | |||
List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||
List<String> offices = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||
System.err.println("=======office ----"); | |||
System.err.println(offices); | |||
AccessControl ac = new AccessControl(); | |||
if (offices.size()>0) { | |||
ac.getSqlMap().getWhere().and("office_code", QueryType.IN, offices); | |||
} | |||
List<AccessControl> acLists = accessControlDao.findList(ac); | |||
for(AccessControl accessControl : acLists){ | |||
String oId = accessControl.getDeviceId(); | |||
if (StringUtils.isNotEmpty(oId)) { | |||
devIds.add(oId); | |||
} | |||
} | |||
} else { | |||
AccessControl ac = new AccessControl(); | |||
List<AccessControl> acLists = accessControlDao.findList(ac); | |||
for(AccessControl accessControl : acLists){ | |||
String oId = accessControl.getDeviceId(); | |||
if (StringUtils.isNotEmpty(oId)) { | |||
devIds.add(oId); | |||
} | |||
} | |||
} | |||
if (StringUtils.isNotEmpty(device.getGroupCode()) || (StringUtils.isNotEmpty(device.getArea())) && !"top".equals(device.getArea())) { | |||
AccessControlGroupDetail accessControlGroupDetail = new AccessControlGroupDetail(); | |||
if (StringUtils.isNotEmpty(device.getGroupCode())) { | |||
accessControlGroupDetail.setGroupCode(device.getGroupCode()); | |||
@@ -146,18 +195,6 @@ public class DeviceController extends BaseController { | |||
AccessControlGroup acg = new AccessControlGroup(); | |||
acg.setArea(device.getArea()); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
UserDataScope uds = new UserDataScope(); | |||
uds.setUserCode(userCode); | |||
uds.setCtrlType("Office"); | |||
List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||
List<String> offices = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||
if (offices.size()>0) { | |||
acg.getSqlMap().getWhere().and("office_code", QueryType.IN, offices); | |||
} | |||
} | |||
List<AccessControlGroup> lists = accessControlGroupDao.findList(acg); | |||
List<String> codes = Lists.newArrayList(); | |||
lists.forEach(a->{ | |||
@@ -169,33 +206,101 @@ public class DeviceController extends BaseController { | |||
List<AccessControlGroupDetail> list = accessControlGroupDetailDao.findList(accessControlGroupDetail); | |||
for (AccessControlGroupDetail ad : list){ | |||
if (ObjectUtils.anyNotNull(ad.getAccessControl())) { | |||
devices.add(ad.getAccessControl().getDeviceId()); | |||
if (ObjectUtils.anyNotNull(ad.getAccessControl()) ) { | |||
if (devIds.contains(ad.getAccessControl().getDeviceId())) { | |||
devices.add(ad.getAccessControl().getDeviceId()); | |||
} | |||
} | |||
} | |||
device.getSqlMap().getWhere().and("device_id", QueryType.IN, devices.size()>0?devices:new String[]{""}); | |||
} else { | |||
device.getSqlMap().getWhere().and("device_id", QueryType.IN, devIds.size()>0?devIds:new String[]{""}); | |||
} | |||
if (StringUtils.isNotEmpty(device.getDeviceName())) { | |||
device.getSqlMap().getWhere().and("device_name", QueryType.LIKE, "%"+device.getDeviceName()+"%"); | |||
} | |||
if (StringUtils.isNotEmpty(device.getDevStatus()) && Integer.valueOf(device.getDevStatus())>=0) { | |||
device.getSqlMap().getWhere().and("dev_status", QueryType.EQ, device.getDevStatus()); | |||
String devStatus = device.getDevStatus(); | |||
if (StringUtils.isNotEmpty(devStatus) && Integer.valueOf(devStatus)>=0) { | |||
if (devStatus.equals(Device.DEV_STATUS_ERROR)) { | |||
device.getSqlMap().getWhere().and("dev_status", QueryType.IN, new String[]{devStatus, Device.DEV_STATUS_NOT_AUTH}); | |||
} else | |||
device.getSqlMap().getWhere().and("dev_status", QueryType.EQ, devStatus); | |||
} else { | |||
device.getSqlMap().getWhere().andBracket("dev_status", QueryType.IS_NULL, null, 1).or("dev_status",QueryType.GT,"-1",2).endBracket(2); | |||
} | |||
device.setDevStatus(""); | |||
List<Device> devs = deviceDao.findList(device); | |||
device.setDevStatus(devStatus); | |||
devs.stream().forEach(dev->{ | |||
Device pad = dev.getPad(); | |||
boolean isOnline = false; | |||
boolean isAuthed = false; | |||
DeviceExtGate deg = new DeviceExtGate(); | |||
deg.setDeviceId(dev.getDeviceId()); | |||
DeviceExtGate deviceExtGate = deviceExtGateDao.get(deg); | |||
dev.setDeviceExtGate(deviceExtGate); | |||
List<Device> pads = deviceDao.findList(pad); | |||
for(Device p : pads) { | |||
deviceService.bindOnlineAndSynced(p); | |||
if (!isOnline && p.getDevStatus().equals(Device.DEV_STATUS_NORMAL)) { | |||
isOnline = true; | |||
} | |||
if (StringUtils.isEmpty(device.getDevStatus())){ | |||
device.setDevStatus(""); | |||
if (!(p.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) { | |||
isAuthed = true; | |||
} | |||
} | |||
if (isOnline) { | |||
if (!(dev.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) | |||
dev.setDevStatus(Device.DEV_STATUS_NORMAL); | |||
} else { | |||
if (!(dev.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) | |||
dev.setDevStatus(Device.DEV_STATUS_OFFLINE); | |||
} | |||
if (!isAuthed) { | |||
dev.setDevStatus(Device.DEV_STATUS_NOT_AUTH); | |||
} else { | |||
if (dev.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH)) { | |||
dev.setDevStatus(Device.DEV_STATUS_NORMAL); | |||
} else | |||
dev.setDevStatus(dev.getDevStatus()); | |||
} | |||
if (ObjectUtils.anyNotNull(deviceExtGate) && StringUtils.isNotEmpty(deviceExtGate.getDevErr()) && !(StringUtils.isNumeric(deviceExtGate.getDevErr()) && Integer.valueOf(deviceExtGate.getDevErr())==0)){ | |||
if (!dev.getDevStatus().equals(Device.DEV_STATUS_OFFLINE)) { | |||
if (!(dev.getDevStatus().equals(Device.DEV_STATUS_NOT_AUTH))) | |||
dev.setDevStatus(Device.DEV_STATUS_ERROR); | |||
} | |||
} | |||
deviceDao.update(dev); | |||
}); | |||
if (!(ObjectUtils.anyNotNull(flushSec) && NumberUtils.isParsable(flushSec))) { | |||
flushSec = "10000"; | |||
} | |||
if (!(ObjectUtils.anyNotNull(ableFlush) && NumberUtils.isParsable(ableFlush))) { | |||
ableFlush = "1"; | |||
} | |||
model.addAttribute("device", device); | |||
model.addAttribute("devs", devs); | |||
model.addAttribute("flushSec", Integer.parseInt(flushSec)); | |||
model.addAttribute("ableFlush", Integer.parseInt(ableFlush)); | |||
model.addAttribute("devs", devs); | |||
return "modules/sys/device/gateList"; | |||
} | |||
@@ -209,30 +314,48 @@ public class DeviceController extends BaseController { | |||
List<DeviceEventType> lists = deviceEventTypeDao.findList(new DeviceEventType()); | |||
model.addAttribute("logTypes", lists); | |||
if (StringUtils.isNotEmpty(deviceId)) { | |||
DeviceExtGate deviceExtGate = new DeviceExtGate(); | |||
deviceExtGate.setDeviceId(deviceId); | |||
DeviceExtGate dega = deviceExtGateDao.get(deviceExtGate); | |||
device = deviceDao.findByDevId(deviceId); | |||
device.setDeviceExtInter(dega); | |||
device.setDeviceExtGate(dega); | |||
Device dev = device.getPad(); | |||
Device gDev = device.getGcu(); | |||
List<Device> pads = deviceDao.findList(dev); | |||
List<Device> gcus = deviceDao.findList(gDev); | |||
pads.stream().forEach(p->{ | |||
for(Device p : pads) { | |||
DeviceExt deviceExt = new DeviceExt(); | |||
deviceExt.setDeviceId(p.getDeviceId()); | |||
DeviceExt de = deviceExtDao.get(deviceExt); | |||
p.setDeviceExtInter(de); | |||
p.setDeviceExt(de); | |||
}); | |||
deviceService.bindOnlineAndSynced(p); | |||
if (p.getDevStatus().equals(Device.DEV_STATUS_NORMAL)) { | |||
break; | |||
} | |||
} | |||
gcus.stream().forEach(p->{ | |||
DeviceExtGcu deviceExtGcu = new DeviceExtGcu(); | |||
deviceExtGcu.setDeviceId(p.getDeviceId()); | |||
DeviceExtGcu deg = deviceExtGcuDao.get(deviceExtGcu); | |||
p.setDeviceExt(deg); | |||
p.setDeviceExtInter(deg); | |||
p.setDeviceExtGcu(deg); | |||
}); | |||
device.setPads(pads); | |||
device.setGcus(gcus); | |||
} | |||
device.setDeviceId((String)devId); | |||
// deviceService.bindOnlineAndSynced(device); | |||
model.addAttribute("device", device); | |||
List<DevicePackageVersion> list = devicePackageVersionDao.findNew(); | |||
model.addAttribute("apkPackage", new DevicePackageVersion()); | |||
@@ -290,7 +413,7 @@ public class DeviceController extends BaseController { | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
Page<Device> page = new Page<Device>(request, response); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode) | |||
List<String> deviceIds = deviceService.getGateListByUserCode(userCode) | |||
.stream().map(Device::getId).collect(Collectors.toList()); | |||
if (deviceIds.size() > 0) { | |||
String[] ids = new String[deviceIds.size()]; | |||
@@ -313,8 +436,61 @@ public class DeviceController extends BaseController { | |||
} | |||
// device.setDeviceType(Device.TYPE_PAD); | |||
//dev.getSqlMap().getWhere().and("device_type", QueryType.EQ, Device.TYPE_PAD).andBracket("parent_codes",QueryType.RIGHT_LIKE,this.getDeviceId()+",",2).or("parent_codes",QueryType.LIKE,","+this.getDeviceId()+",",3).endBracket(); | |||
if (StringUtils.isNotEmpty(device.getDeviceName())) { | |||
device.getSqlMap().getWhere().andBracket("device_name", QueryType.LIKE, "%"+device.getDeviceName()+"%").or("device_id", QueryType.LIKE, "%"+device.getDeviceName()+"%").or("address", QueryType.LIKE, "%"+device.getDeviceName()+"%").endBracket(); | |||
} | |||
// | |||
if (Device.TYPE_PAD.equalsIgnoreCase(device.getDeviceType()) ){ | |||
device.getSqlMap().getWhere().and("device_id", QueryType.LEFT_LIKE, "_PAD1"); | |||
} | |||
if (Device.TYPE_GCU.equalsIgnoreCase(device.getDeviceType()) ){ | |||
device.getSqlMap().getWhere().and("device_id", QueryType.LEFT_LIKE, "_GCU1"); | |||
} | |||
Page<Device> pageDevice = deviceService.findPage(new Page<>(request, response), device); | |||
List<Device> lists = pageDevice.getList(); | |||
if (Device.TYPE_PAD.equalsIgnoreCase(device.getDeviceType())){ | |||
// Iterator it = lists.iterator(); | |||
// while(it.hasNext()){ | |||
// Device p = (Device) it.next(); | |||
// if (p.getDeviceId().endsWith("2")) { | |||
// it.remove(); | |||
// } | |||
// } | |||
for(Device p : lists) { | |||
DeviceExt deviceExt = new DeviceExt(); | |||
deviceExt.setDeviceId(p.getDeviceId()); | |||
DeviceExt de = deviceExtDao.get(deviceExt); | |||
p.setDeviceExtInter(de); | |||
p.setDeviceExt(de); | |||
deviceService.bindOnlineAndSynced(p); | |||
} | |||
} | |||
else if (Device.TYPE_GCU.equalsIgnoreCase(device.getDeviceType())) { | |||
// Iterator it = lists.iterator(); | |||
// while(it.hasNext()){ | |||
// Device g = (Device) it.next(); | |||
// if (g.getDeviceId().endsWith("2")) { | |||
// it.remove(); | |||
// } | |||
// } | |||
for(Device g : lists) { | |||
DeviceExtGcu deviceExt = new DeviceExtGcu(); | |||
deviceExt.setDeviceId(g.getDeviceId()); | |||
DeviceExtGcu de = deviceExtGcuDao.get(deviceExt); | |||
g.setDeviceExtInter(de); | |||
g.setDeviceExtGcu(de); | |||
} | |||
} else {} | |||
return deviceService.findPage(new Page<>(request, response), device); | |||
pageDevice.setList(lists); | |||
return pageDevice; | |||
} | |||
/** | |||
@@ -528,11 +704,54 @@ public class DeviceController extends BaseController { | |||
@RequiresPermissions("sys:device:delete") | |||
@PostMapping(value = "delete") | |||
@ResponseBody | |||
@Transactional | |||
public String delete(Device device) { | |||
// deviceService.delete(device); | |||
Device dev = deviceDao.get(device); | |||
deviceDao.deleteById(device.getDeviceId()); | |||
return renderResult(Global.TRUE, "设备'" + dev.getDeviceName() + "'删除成功"); | |||
if (!(ObjectUtils.anyNotNull(device) && StringUtils.isNotEmpty(device.getDeviceId()))) { | |||
return renderResult(Global.FALSE, "设备删除失败,无对应deviceId"); | |||
} | |||
String deviceId = device.getDeviceId(); | |||
Device dev = deviceService.getMasterPad(device); | |||
//重启PAD后执行 | |||
System.err.println("通知PAD重启----------------"); | |||
JSONObject json = remoteHanle(dev.getDeviceId(), "reset pad"); | |||
System.err.println(json.toJSONString()); | |||
if (ObjectUtils.anyNotNull(json)) { | |||
Device pad = device.getPad(); | |||
Device gDev = device.getGcu(); | |||
List<Device> pads = deviceDao.findList(pad); | |||
List<Device> gcus = deviceDao.findList(gDev); | |||
pads.stream().forEach(d->{ | |||
deviceExtDao.deleteByDevId(d.getDeviceId()); | |||
}); | |||
gcus.stream().forEach(d->{ | |||
deviceExtGcuDao.deleteByDevId(d.getDeviceId()); | |||
}); | |||
deviceExtGateDao.deleteByDevId(deviceId); | |||
deviceDao.deleteById(deviceId); | |||
accessControlDao.deleteByDevId(deviceId); | |||
//删除redis | |||
redisUtils.delGroupKey(deviceId+":auth-code"); | |||
redisUtils.delGroupKey(deviceId+":bind-sn"); | |||
redisUtils.delGroupKey(deviceId+":face-latest-ts"); | |||
return renderResult(Global.TRUE, "设备删除成功"); | |||
} else { | |||
return renderResult(Global.FALSE, "设备删除失败,对应PAD重启失败"); | |||
} | |||
} | |||
/** | |||
@@ -606,7 +825,7 @@ public class DeviceController extends BaseController { | |||
authMappingDao.update(authMapping); | |||
} | |||
if (!("0".equals(mis))) { | |||
RedisUtils.setString(device.getDeviceId()+":face-latest-ts", mis); | |||
redisUtils.setGroupString(device.getDeviceId()+":face-latest-ts", mis); | |||
device.setLatestAuthTs(new BigDecimal(mis)); | |||
deviceService.update(device); | |||
} | |||
@@ -616,6 +835,44 @@ public class DeviceController extends BaseController { | |||
} | |||
public JSONObject remoteHanle(String deviceId, String actCode){ | |||
JSONObject paramJson = new JSONObject(); | |||
paramJson.put("devId", deviceId); | |||
JSONObject cmdJson = new JSONObject(); | |||
cmdJson.put("dataType", "command"); | |||
cmdJson.put("cmd", "gate-action"); | |||
cmdJson.put("cmdId", DateUtils.getMillsSecondsDouble()); | |||
JSONObject cmdParamsJson = new JSONObject(); | |||
cmdParamsJson.put("act-code",actCode); | |||
cmdJson.put("params", cmdParamsJson); | |||
paramJson.put("cmdinfo", cmdJson); | |||
String content = paramJson.toJSONString(); | |||
CommandLog commandLog = new CommandLog(deviceId, "gate-action", content, new Date()); | |||
commandLogDao.add(commandLog); | |||
int id = commandLog.getAutoId(); | |||
String httpSrv = Global.getConfig("mqtt.httpServer"); | |||
String cmdPath = Global.getConfig("mqtt.devCmdPath"); | |||
System.err.println("content====="); | |||
System.err.println(httpSrv+cmdPath); | |||
System.err.println(content); | |||
HttpResponse<String> response = Unirest.post(httpSrv+cmdPath) | |||
.header("Content-Type", "application/json") | |||
.body(content) | |||
.asString(); | |||
String result = response.getBody(); | |||
JSONObject resultJson = JSON.parseObject(result); | |||
int resCode = resultJson.getInteger("status"); | |||
CommandReturnLog commandReturnLog = new CommandReturnLog("gate-action", deviceId, id, String.valueOf(resCode), new Date()); | |||
commandReturnLogDao.insert(commandReturnLog); | |||
return resultJson; | |||
} | |||
/** | |||
* 远程操作设备 | |||
* | |||
@@ -626,6 +883,7 @@ public class DeviceController extends BaseController { | |||
@ResponseBody | |||
@Transactional | |||
public String remoteHandle(@RequestParam(value = "devs[]") List<String> devs, @RequestParam(value = "act") String act) { | |||
String act_code = ""; | |||
switch (act) { | |||
case "enterOpen": | |||
@@ -634,15 +892,21 @@ public class DeviceController extends BaseController { | |||
case "leaveOpen": | |||
act_code = "auth leave"; | |||
break; | |||
case "padRestart": | |||
case "appRestart": | |||
act_code = "reset app"; | |||
break; | |||
case "gcuRestart": | |||
act_code = "reset gcu"; | |||
break; | |||
case "shutdown": | |||
case "padRestart": | |||
act_code = "reset pad"; | |||
break; | |||
case "netAdbOpen": | |||
act_code = "netAdbOpen"; | |||
break; | |||
case "netAdbClose": | |||
act_code = "netAdbClose"; | |||
break; | |||
} | |||
List<String> successDev = Lists.newArrayList(); | |||
@@ -653,40 +917,16 @@ public class DeviceController extends BaseController { | |||
if (ObjectUtils.anyNotNull(masterPad)) { | |||
deviceId = masterPad.getDeviceId(); | |||
JSONObject paramJson = new JSONObject(); | |||
paramJson.put("devId", deviceId); | |||
JSONObject cmdJson = new JSONObject(); | |||
cmdJson.put("dataType", "command"); | |||
cmdJson.put("cmd", "gate-action"); | |||
cmdJson.put("cmdId", DateUtils.getMillsSecondsDouble()); | |||
JSONObject cmdParamsJson = new JSONObject(); | |||
cmdParamsJson.put("act-code",act_code); | |||
cmdJson.put("params", cmdParamsJson); | |||
paramJson.put("cmdinfo", cmdJson); | |||
String content = paramJson.toJSONString(); | |||
System.err.println("start content====");System.err.println(content);System.err.println("end handle content"); | |||
CommandLog commandLog = new CommandLog(deviceId, "gate-action", content, new Date()); | |||
commandLogDao.add(commandLog); | |||
int id = commandLog.getAutoId(); | |||
HttpResponse<String> response = Unirest.post("http://39.105.85.176:8008/api/mqtt_dev_cmd") | |||
.header("Content-Type", "application/json") | |||
.body(content) | |||
.asString(); | |||
String result = response.getBody(); | |||
System.err.println(result); | |||
JSONObject resultJson = JSON.parseObject(result); | |||
System.err.println(resultJson); | |||
int resCode = resultJson.getInteger("status"); | |||
CommandReturnLog commandReturnLog = new CommandReturnLog("gate-action", deviceId, id, String.valueOf(resCode), new Date()); | |||
commandReturnLogDao.insert(commandReturnLog); | |||
if (0 == resCode) { | |||
JSONObject resultJson = remoteHanle(deviceId, act_code); | |||
if (0 == resultJson.getInteger("status")) { | |||
successDev.add(gate.getDeviceName()); | |||
} else { | |||
failMsg.add(gate.getDeviceName()+":"+resultJson.getString("errMsg")); | |||
} | |||
System.err.println(resultJson); | |||
} else { | |||
failMsg.add(gate.getDeviceName()+":"+"设备配置存在错误,可能主从设备未指定"); | |||
// failMsg.add(gate.getDeviceName()+":"+"设备配置存在错误,可能主从设备未指定"); | |||
} | |||
} | |||
@@ -696,7 +936,7 @@ public class DeviceController extends BaseController { | |||
endMsg += sss+","; | |||
} | |||
endMsg = endMsg.substring(0, endMsg.length()-1); | |||
endMsg = "设备'"+endMsg+" "+act_code+ "'操作成功;"; | |||
endMsg = "设备'"+endMsg+" "+act_code+ "指令发送成功;"; | |||
} | |||
if (failMsg.size()>0) { | |||
@@ -707,7 +947,7 @@ public class DeviceController extends BaseController { | |||
} | |||
if (StringUtils.isEmpty(endMsg)) { | |||
return renderResult(Global.FALSE, "设备配置存在错误,可能主从未指定"); | |||
return renderResult(Global.TRUE, "指令发送成功"); | |||
} | |||
@@ -727,6 +967,8 @@ public class DeviceController extends BaseController { | |||
public String remoteConfig(@RequestParam(value = "devs[]") List<String> devs, @RequestParam(value = "actStatus") String actStatus, @RequestParam(value = "actValue") String actValue) { | |||
String act_code = ""; | |||
String httpSrv = Global.getConfig("mqtt.httpServer"); | |||
String cmdPath = Global.getConfig("mqtt.devCmdPath"); | |||
System.err.println(devs); | |||
List<String> successDev = Lists.newArrayList(); | |||
List<String> failMsg = Lists.newArrayList(); | |||
@@ -745,14 +987,14 @@ public class DeviceController extends BaseController { | |||
JSONObject cmdParamsJson = new JSONObject(); | |||
switch (actStatus) { | |||
case "inMode": | |||
case "workMode": | |||
cmdParamsJson.put("workMode",actValue); | |||
break; | |||
case "inSpeed": | |||
case "outMode": | |||
cmdParamsJson.put("workMode",actValue); | |||
case "dirClose": | |||
cmdParamsJson.put("dirClose",actValue); | |||
break; | |||
case "outSpeed": | |||
@@ -765,23 +1007,33 @@ public class DeviceController extends BaseController { | |||
cmdParamsJson.put("reverseClose",actValue); | |||
break; | |||
case "tailClose": | |||
cmdParamsJson.put("tailClose",actValue); | |||
break; | |||
case "doubleDirAuth": | |||
cmdParamsJson.put("doubleDirAuth", actValue); | |||
break; | |||
case "triggerMode": | |||
cmdParamsJson.put("triggerMode", actValue); | |||
break; | |||
} | |||
cmdJson.put("params", cmdParamsJson); | |||
paramJson.put("cmdinfo", cmdJson); | |||
String content = paramJson.toJSONString(); | |||
CommandLog commandLog = new CommandLog(deviceId, "gate-config-set", content, new Date()); | |||
commandLogDao.add(commandLog); | |||
int id = commandLog.getAutoId(); | |||
HttpResponse<String> response = Unirest.post("http://39.105.85.176:8008/api/mqtt_dev_cmd") | |||
System.err.println("content=====config"); | |||
System.err.println(content); | |||
HttpResponse<String> response = Unirest.post(httpSrv+cmdPath) | |||
.header("Content-Type", "application/json") | |||
.body(content) | |||
.asString(); | |||
String result = response.getBody(); | |||
JSONObject resultJson = JSON.parseObject(result); | |||
System.err.println(resultJson); | |||
int resCode = resultJson.getInteger("status"); | |||
CommandReturnLog commandReturnLog = new CommandReturnLog("gate-config-set", deviceId, id, String.valueOf(resCode), new Date()); | |||
@@ -892,9 +1144,12 @@ public class DeviceController extends BaseController { | |||
String typeEn = "apk"; | |||
if (DevicePackageVersion.TYPE_GCU == type) { | |||
typeEn = "gcu"; | |||
apkUploadPath = gcuUploadPath; | |||
} | |||
dpv.setDownloadUrl("/"+typeEn+"/"+startName+typeEn+version+endName); | |||
dpv.setMemo(startName); | |||
try { | |||
String md5 = DigestUtils.md5DigestAsHex(file.getBytes()); | |||
dpv.setSign(md5);//校检码 | |||
@@ -903,7 +1158,7 @@ public class DeviceController extends BaseController { | |||
} | |||
devicePackageVersionDao.insert(dpv); | |||
File f = new File(apkUploadPath+"/"+typeEn+"/"+startName+version+endName); | |||
File f = new File(apkUploadPath+"/"+startName+typeEn+version+endName); | |||
if (!f.getParentFile().exists()) { | |||
@@ -942,7 +1197,7 @@ public class DeviceController extends BaseController { | |||
@RequiresPermissions("sys:device:view") | |||
@RequestMapping(value = "updVersion/{type}") | |||
@ResponseBody | |||
public String editVersionData(@PathVariable(required = true) Long type, String memo) { | |||
public String editVersionData(@PathVariable(required = true) Long type, String memo, String version) { | |||
String typeEn = "apk"; | |||
if (DevicePackageVersion.TYPE_GCU == type) { | |||
@@ -951,6 +1206,9 @@ public class DeviceController extends BaseController { | |||
DevicePackageVersion dpv = devicePackageVersionDao.findExactNew(type); | |||
dpv.setMemo(memo); | |||
if (StringUtils.isNotEmpty(version)) { | |||
dpv.setVersion(version); | |||
} | |||
devicePackageVersionDao.update(dpv); | |||
@@ -3,17 +3,21 @@ | |||
*/ | |||
package com.lecooai.visitor.web.sys.web; | |||
import com.beust.jcommander.internal.Lists; | |||
import com.jeesite.common.config.Global; | |||
import com.jeesite.common.entity.Page; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.common.web.BaseController; | |||
import com.jeesite.modules.sys.entity.User; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.dao.DeviceDao; | |||
import com.lecooai.visitor.web.sys.dao.DeviceEventTypeDao; | |||
import com.lecooai.visitor.web.sys.entity.Device; | |||
import com.lecooai.visitor.web.sys.entity.DeviceEventType; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExtGateEvent; | |||
import com.lecooai.visitor.web.sys.service.DeviceExtGateEventService; | |||
import com.lecooai.visitor.web.sys.utils.BusinessUtils; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Controller; | |||
@@ -80,9 +84,33 @@ public class DeviceExtGateEventController extends BaseController { | |||
public Page<DeviceExtGateEvent> listData(DeviceExtGateEvent deviceExtGateEvent, HttpServletRequest request, HttpServletResponse response) { | |||
deviceExtGateEvent.setPage(new Page<>(request, response)); | |||
String timePart = deviceExtGateEvent.getTimePart(); | |||
String level = deviceExtGateEvent.getLevel(); | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
List<Device> list = deviceDao.findGatesByUserCode(userCode); | |||
List<String> ids = Lists.newArrayList(); | |||
for (Device d : list) { | |||
if (ObjectUtils.anyNotNull(d)) | |||
ids.add(d.getDeviceId()); | |||
} | |||
deviceExtGateEvent.getSqlMap().getWhere().and("device_id", QueryType.IN, ids); | |||
} | |||
if (StringUtils.isNotEmpty(timePart)) { | |||
String[] times = timePart.split(" ~ "); | |||
deviceExtGateEvent.getSqlMap().getWhere().andBracket("created_at", QueryType.LTE, times[1]+" 23:59:59",1).and("created_at", QueryType.GTE, times[0],2).endBracket(); | |||
deviceExtGateEvent.getSqlMap().getWhere().andBracket("created_at", QueryType.LTE, times[1]+" 23:59:59",1).and("created_at", QueryType.GTE, times[0],2).endBracket(1); | |||
} | |||
if (Integer.valueOf(level) == 1) { | |||
deviceExtGateEvent.getSqlMap().getWhere().and("warn_level", QueryType.EQ, "0").and("event_code", QueryType.EQ, "0004"); | |||
} else if (Integer.valueOf(level) == 2) { | |||
deviceExtGateEvent.getSqlMap().getWhere().and("warn_level", QueryType.GT, "0"); | |||
} else { | |||
deviceExtGateEvent.getSqlMap().getWhere().andBracket("id",QueryType.GT, 0).andBracket("warn_level", QueryType.EQ, "0" ,1).and("event_code", QueryType.EQ, "0004").endBracket(2).orBracket("warn_level", QueryType.NE, "0" ,2).endBracket(3).endBracket(4); | |||
} | |||
Page<DeviceExtGateEvent> page = deviceExtGateEventService.findPage(deviceExtGateEvent); | |||
return page; | |||
@@ -118,5 +146,14 @@ public class DeviceExtGateEventController extends BaseController { | |||
deviceExtGateEventService.delete(deviceExtGateEvent); | |||
return renderResult(Global.TRUE, text("删除设备日志成功!")); | |||
} | |||
@RequestMapping(value = "fetchData") | |||
@ResponseBody | |||
public Object fetchData(long id) { | |||
DeviceExtGateEvent deg = deviceExtGateEventService.fetchData(); | |||
return outputData(0,deg); | |||
} | |||
} |
@@ -14,7 +14,6 @@ import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.modules.sys.dao.UserDataScopeDao; | |||
import com.jeesite.modules.sys.entity.Office; | |||
import com.jeesite.modules.sys.entity.User; | |||
import com.jeesite.modules.sys.entity.UserDataScope; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.constant.CommonConsts; | |||
import com.lecooai.visitor.web.sys.dao.AuthHandleDao; | |||
@@ -25,6 +24,7 @@ import com.lecooai.visitor.web.sys.service.*; | |||
import com.lecooai.visitor.web.sys.service.support.EmpServiceSupport; | |||
import com.lecooai.visitor.web.sys.utils.BackupUtils; | |||
import com.lecooai.visitor.web.sys.utils.BusinessUtils; | |||
import com.lecooai.visitor.web.sys.utils.RedisUtils; | |||
import com.lenovo.nowgo.common.constant.ResponseCode; | |||
import com.lenovo.nowgo.common.http.response.MyResponse; | |||
import net.coobird.thumbnailator.tasks.UnsupportedFormatException; | |||
@@ -105,6 +105,9 @@ public class EmployeeController extends BaseController { | |||
@Autowired | |||
private UserDataScopeDao userDataScopeDao; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
@Autowired | |||
private AuthHandleDao authHandleDao; | |||
@@ -354,13 +357,13 @@ public class EmployeeController extends BaseController { | |||
office.setParentCode(topOffice); | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
List<AccessControl> accessControlList = Lists.newLinkedList(); | |||
/*if (BusinessUtils.isSecAdmin(userCode)) { | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
List<String> officeCodes = userDataScopeService.getOfficeCodeByUserCode(UserUtils.getUser().getUserCode()); | |||
office.getSqlMap().getWhere().and("office_code", QueryType.IN, officeCodes); | |||
accessControlList = accessControlService.getAccessControlsByOfficeCodes(officeCodes.toArray(new String[0])); | |||
} else { | |||
accessControlList = accessControlService.findList(new AccessControl()); | |||
}*/ | |||
} | |||
accessControlList = accessControlService.findList(new AccessControl()); | |||
List<Office> officeList = officeService.findList(office); | |||
@@ -478,6 +481,8 @@ public class EmployeeController extends BaseController { | |||
@RequestMapping(value = "/listData") | |||
@ResponseBody | |||
public Page<Emp> listData(Emp emp, @RequestParam(required = false, defaultValue = "1") String btnType,@RequestParam(required = false, defaultValue = "") String officeCodes, HttpServletRequest request, HttpServletResponse response) { | |||
redisUtils.setDefaultString("hjjh", "hkkejj"); | |||
Emp findEmp = new Emp(); | |||
Page<Emp> page = new Page<Emp>(request, response); | |||
@@ -525,7 +530,7 @@ public class EmployeeController extends BaseController { | |||
} | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
/*if (BusinessUtils.isSecAdmin(userCode)) { | |||
UserDataScope uds = new UserDataScope(); | |||
uds.setUserCode(userCode); | |||
uds.setCtrlType("Office"); | |||
@@ -536,7 +541,7 @@ public class EmployeeController extends BaseController { | |||
if (offices.size()>0) { | |||
findEmp.getSqlMap().getWhere().and("office_code", QueryType.IN, offices); | |||
} | |||
} | |||
}*/ | |||
page = empService.findPage(page, findEmp); | |||
@@ -705,7 +710,6 @@ public class EmployeeController extends BaseController { | |||
if (StringUtils.isNotEmpty(officeCodes)) { | |||
officeCodeList = Arrays.asList(officeCodes.split(",")); | |||
} | |||
System.err.println(officeCodeList); | |||
//Sec-admin filter | |||
// String loginCode = UserUtils.getUser().getLoginCode(); | |||
// if (BusinessUtils.isSecAdmin(loginCode) ) { | |||
@@ -97,7 +97,7 @@ public class FaceController extends BaseController { | |||
List<Device> devices = null; | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
officeList = officeService.getOfficesByUserCode(userCode); | |||
devices = deviceService.getDeviceListByUserCode(userCode); | |||
devices = deviceService.getGateListByUserCode(userCode); | |||
} else { | |||
Office office = new Office(); | |||
office.setParentCode(topOffice); | |||
@@ -183,7 +183,7 @@ public class FaceController extends BaseController { | |||
//Sec-admin filter | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
List<String> deviceIds = deviceService.getDeviceListByUserCode(userCode) | |||
List<String> deviceIds = deviceService.getGateListByUserCode(userCode) | |||
.stream().map(Device::getId).collect(Collectors.toList()); | |||
if (null == deviceIds || deviceIds.size() <= 0) { | |||
return null; | |||
@@ -10,8 +10,10 @@ import com.jeesite.modules.sys.utils.PwdUtils; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.dao.CheckRecordsDao; | |||
import com.lecooai.visitor.web.sys.dao.DeviceDao; | |||
import com.lecooai.visitor.web.sys.dao.DeviceExtGateEventDao; | |||
import com.lecooai.visitor.web.sys.dao.EmpDao; | |||
import com.lecooai.visitor.web.sys.entity.Device; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExtGateEvent; | |||
import com.lecooai.visitor.web.sys.entity.Emp; | |||
import com.lecooai.visitor.web.sys.entity.FaceHistory; | |||
import com.lecooai.visitor.web.sys.service.DeviceService; | |||
@@ -70,6 +72,9 @@ public class IndexController extends BaseController { | |||
public static String EMP_AVTIVE_SATTUS = "0"; | |||
@Autowired | |||
private DeviceExtGateEventDao deviceExtGateEventDao; | |||
/** | |||
* 首页显示当天人脸识别统计 | |||
* nearlyDays 最期天数 | |||
@@ -85,13 +90,17 @@ public class IndexController extends BaseController { | |||
Date endDate = DateUtils.getOfDayLast(new Date()); | |||
List<Device> devices = null; | |||
if (BusinessUtils.isSecAdmin(userCode)){ | |||
/*if (BusinessUtils.isSecAdmin(userCode)){ | |||
devices = deviceDao.findByUserCode(userCode); | |||
} else { | |||
Device d = new Device(); | |||
d.setDeviceType("PAD"); | |||
devices = deviceDao.findList(d); | |||
} | |||
}*/ | |||
Device d = new Device(); | |||
d.setDeviceType("PAD"); | |||
d.getSqlMap().getWhere().and("device_id", QueryType.LIKE, "%_PAD1"); | |||
devices = deviceDao.findList(d); | |||
String[] deviceIds = null; | |||
List<Map<String, Object>>deviceList = Lists.newArrayList(); | |||
@@ -109,7 +118,7 @@ public class IndexController extends BaseController { | |||
resMap.put("employee", getEmployeeFaceHistoryByDatePeriod2(startDate, endDate, deviceIds)); | |||
// 访客识别记录 | |||
Device d = new Device(); | |||
d = new Device(); | |||
// d.setDeviceType("visitorMachine"); | |||
d.getSqlMap().getWhere().and("device_type", QueryType.EQ, "visitorMachine"); | |||
List<Device> visitorDevs = deviceDao.findList(d); | |||
@@ -126,6 +135,54 @@ public class IndexController extends BaseController { | |||
} | |||
@RequestMapping("/face-history-static2") | |||
@ResponseBody | |||
public MyResponse getFaceHistoryStatic2(@RequestParam(value = "nearlyDays", required = false, defaultValue = "14") Integer nearlyDays) { | |||
//获取登录用户,根据用户获得下属员工 | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
Date startDate = DateUtils.getOfDayFirst(new Date()); | |||
Date endDate = DateUtils.getOfDayLast(new Date());//日末 | |||
List<String> dateStringList = DateUtils.generateNearlyDateString(endDate, nearlyDays); | |||
List<Map<String, Object>> initMapList = initializeCountGuestMap(dateStringList); | |||
List<Device> devices = null; | |||
if (BusinessUtils.isSecAdmin(userCode)){ | |||
devices = deviceDao.findByUserCode(userCode); | |||
} else { | |||
Device d = new Device(); | |||
d.setDeviceType("PAD"); | |||
d.getSqlMap().getWhere().and("device_id", QueryType.LIKE, "%_PAD1"); | |||
devices = deviceDao.findList(d); | |||
} | |||
String[] deviceIds = null; | |||
List<Map<String, Object>> deviceList = Lists.newArrayList(); | |||
if(null != devices && devices.size() > 0) { | |||
deviceIds = new String[devices.size()]; | |||
for(int i = 0; i < devices.size(); i++) { | |||
deviceList.add(getEventsByDeviceAndDatePeriod(devices.get(i), startDate, endDate)); | |||
deviceIds[i] = devices.get(i).getId(); | |||
} | |||
} | |||
List<Map<String, Object>> lMap = deviceExtGateEventDao.findEventListGroupByDate(DateUtils.formatDate(startDate, "yyyy-MM-dd HH:mm:ss"), DateUtils.formatDate(DateUtils.addDays(startDate, nearlyDays), "yyyy-MM-dd HH:mm:ss"), deviceIds); | |||
lMap = finalCountGuest(initMapList, lMap); | |||
Map<String, Object> resMap = Maps.newHashMap(); | |||
// 设备识别记录 | |||
resMap.put("deviceList", deviceList); | |||
//员工记录 | |||
resMap.put("employee", getEmployeeFaceHistoryByDatePeriod2(startDate, endDate, deviceIds)); | |||
// 访客识别记录 | |||
// resMap.put("guest", countGuestByDay(startDate, endDate, deviceIds, nearlyDays)); | |||
resMap.put("events", lMap); | |||
return outputSuccess(resMap); | |||
} | |||
/** | |||
* 按设备类型获取人脸识别记录 | |||
@@ -461,4 +518,80 @@ public class IndexController extends BaseController { | |||
} | |||
return employeeTotalCount / days; | |||
} | |||
private Map<String, Object> getEventsByDeviceAndDatePeriod(Device device, Date startDate, Date endDate){ | |||
Map<String, Object> countMap = Maps.newHashMap(); | |||
countMap.put("deviceName", device.getDeviceName()); | |||
countMap.put("address", device.getAddress()); | |||
countMap.put("id",device.getId()); | |||
// checkRecords.setAuthOk(1); | |||
// checkRecords.setAuthMode(CheckRecords.AUTH_MODE_FACE); | |||
long employeeCount = deviceExtGateEventDao.findEventCount(DateUtils.formatDate(startDate, "yyyy-MM-dd HH:mm:ss"),DateUtils.formatDate(endDate, "yyyy-MM-dd HH:mm:ss"), device.getDeviceId()); | |||
countMap.put("eventCount", employeeCount); | |||
long employeeAvgCount = calculateEventAvgCountByDevice(device, startDate, endDate); | |||
countMap.put("eventAvgCount", employeeAvgCount); | |||
return countMap; | |||
} | |||
private Long calculateEventAvgCountByDevice(Device device, Date startDate, Date endDate) { | |||
Map<String, Object> countMap = Maps.newHashMap(); | |||
countMap.put("deviceName", device.getDeviceName()); | |||
countMap.put("address", device.getAddress()); | |||
countMap.put("id",device.getId()); | |||
// 按天查询识别员工人数 | |||
List<Map<String, Long>> alleventCount = deviceExtGateEventDao.findDistinctEventCountByDay(DateUtils.formatDate(DateUtils.getPushForwardDate(startDate, NEAR_MAX_DAYS), "yyyy-MM-dd HH:mm:ss"), DateUtils.formatDate(endDate, "yyyy-MM-dd HH:mm:ss"), device.getDeviceId()); | |||
Integer days = NEAR_MAX_DAYS; | |||
Long eventTotalCount = 0L; | |||
if (null != alleventCount && alleventCount.size() > 0){ | |||
days = alleventCount.size(); | |||
for (Map<String, Long> map : alleventCount){ | |||
eventTotalCount += map.get("count"); | |||
} | |||
} | |||
return eventTotalCount / days; | |||
} | |||
/** | |||
* 按天获取报警数量 | |||
* @param selectDate | |||
* @return {eventCount, count} | |||
*/ | |||
@RequiresPermissions("user") | |||
@GetMapping(value = "/count-event-by-date") | |||
@ResponseBody | |||
public MyResponse countEventByDevice(@DateTimeFormat(pattern = "yyyy-MM-dd") | |||
@RequestParam(value = "date", required = false) Date selectDate) { | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
Long count = 0L; | |||
List<Device> devices = null; | |||
if (BusinessUtils.isSecAdmin(userCode)){ | |||
devices = deviceDao.findByUserCode(userCode); | |||
} else { | |||
Device d = new Device(); | |||
d.setDeviceType("PAD"); | |||
d.getSqlMap().getWhere().and("device_id", QueryType.LIKE, "%_PAD1"); | |||
devices = deviceDao.findList(d); | |||
} | |||
String[] deviceIds = null; | |||
if(null != devices && devices.size() > 0) { | |||
deviceIds = new String[devices.size()]; | |||
for(int i = 0; i < devices.size(); i++) { | |||
deviceIds[i] = devices.get(i).getId(); | |||
} | |||
} | |||
count = deviceExtGateEventDao.findEventCountByDevIds(DateUtils.formatDate(selectDate, "yyyy-MM-dd 00:00:00"), DateUtils.formatDate(selectDate, "yyyy-MM-dd 23:59:59"), deviceIds); | |||
Map<String,Object> map = Maps.newHashMap(); | |||
map.put("eventCount" , count); | |||
return outputSuccess(map); | |||
} | |||
} |
@@ -1,8 +1,13 @@ | |||
package com.lecooai.visitor.web.sys.web; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.modules.msg.entity.MsgPush; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.lecooai.visitor.web.sys.dao.DeviceEventTypeDao; | |||
import com.lecooai.visitor.web.sys.entity.DeviceEventType; | |||
import com.lecooai.visitor.web.sys.entity.DeviceExtGateEvent; | |||
import com.lecooai.visitor.web.sys.service.DeviceExtGateEventService; | |||
import com.lenovo.nowgo.common.http.response.MyResponse; | |||
import com.lecooai.visitor.web.sys.constant.MsgType; | |||
import com.lecooai.visitor.web.sys.service.MessageService; | |||
@@ -34,6 +39,12 @@ public class MassageController extends BaseController { | |||
@Autowired | |||
private MessageService messageService; | |||
@Autowired | |||
private DeviceExtGateEventService deviceExtGateEventService; | |||
@Autowired | |||
private DeviceEventTypeDao deviceEventTypeDao; | |||
@RequiresPermissions("user") | |||
@GetMapping(value = "/list") | |||
public String list(MsgPush msgPush, Model model) { | |||
@@ -69,6 +80,13 @@ public class MassageController extends BaseController { | |||
Map<String,Object> map = new HashMap<>(); | |||
map.put("newMsg", messageService.getUnreachedMsgList()); | |||
map.put("unreadNum", messageService.getUnreadMsgList().size()); | |||
DeviceExtGateEvent deg = deviceExtGateEventService.fetchData(); | |||
if (ObjectUtils.anyNotNull(deg)) { | |||
DeviceEventType det = deviceEventTypeDao.getByHexCode(deg.getEventCode()); | |||
deg.setDeviceEventType(det); | |||
} | |||
map.put("deg", deg); | |||
return outputSuccess(map); | |||
} | |||
@@ -13,10 +13,14 @@ import com.jeesite.common.entity.Page; | |||
import com.jeesite.common.idgen.IdGen; | |||
import com.jeesite.common.lang.ObjectUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import com.jeesite.common.mybatis.mapper.query.QueryType; | |||
import com.jeesite.common.web.BaseController; | |||
import com.jeesite.modules.sys.dao.UserDataScopeDao; | |||
import com.jeesite.modules.sys.entity.EmpUser; | |||
import com.jeesite.modules.sys.entity.Office; | |||
import com.jeesite.modules.sys.entity.UserDataScope; | |||
import com.jeesite.modules.sys.service.OfficeService; | |||
import com.jeesite.modules.sys.utils.UserUtils; | |||
import com.jeesite.modules.sys.web.user.EmpUserController; | |||
import com.lecooai.visitor.web.sys.dao.DeviceDao; | |||
import com.lecooai.visitor.web.sys.dao.MyOfficeDao; | |||
@@ -28,6 +32,7 @@ import com.lecooai.visitor.web.sys.service.MyOfficeService; | |||
import com.lecooai.visitor.web.sys.service.OfficeDeviceService; | |||
import com.lecooai.visitor.web.sys.service.support.EmpServiceSupport; | |||
import com.lecooai.visitor.web.sys.utils.BackupUtils; | |||
import com.lecooai.visitor.web.sys.utils.BusinessUtils; | |||
import com.lecooai.visitor.web.sys.utils.MapSortUtils; | |||
import com.lecooai.visitor.web.sys.utils.OfficeVO; | |||
import org.apache.commons.collections4.ListUtils; | |||
@@ -43,6 +48,7 @@ import org.springframework.web.bind.annotation.*; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -87,6 +93,9 @@ public class MyOfficeController extends BaseController { | |||
@Autowired | |||
private EmpUserController empUserController; | |||
@Autowired | |||
private UserDataScopeDao userDataScopeDao; | |||
/** | |||
* 获取机构 | |||
*/ | |||
@@ -231,6 +240,23 @@ public class MyOfficeController extends BaseController { | |||
this.officeService.addDataScopeFilter(office, ctrlPermi); | |||
office.setStatus(""); | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
UserDataScope uds = new UserDataScope(); | |||
uds.setUserCode(userCode); | |||
uds.setCtrlType("Office"); | |||
List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||
List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||
if (officeIds.size()>0) { | |||
office.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||
} | |||
} | |||
office.getSqlMap().getWhere().disableAutoAddStatusWhere(); | |||
page = this.officeService.findPage(page, office); | |||
List<Office> list = page.getList(); | |||
@@ -445,6 +471,21 @@ public class MyOfficeController extends BaseController { | |||
} | |||
where.setStatus_in(Emp.STATUS_ABLE_SHOW); | |||
String userCode = UserUtils.getUser().getUserCode(); | |||
if (BusinessUtils.isSecAdmin(userCode)) { | |||
UserDataScope uds = new UserDataScope(); | |||
uds.setUserCode(userCode); | |||
uds.setCtrlType("Office"); | |||
List<UserDataScope> userDataScopes = userDataScopeDao.findList(uds); | |||
List<String> officeIds = userDataScopes.stream().map(UserDataScope::getCtrlData).collect(Collectors.toList()); | |||
if (officeIds.size()>0) { | |||
where.getSqlMap().getWhere().and("office_code", QueryType.IN, officeIds); | |||
} | |||
} | |||
List<Office> list = this.officeService.findList(where); | |||
List<Map<String, Object>> list2 = empService.findCountByOffice(); | |||
@@ -5,25 +5,25 @@ package com.lecooai.visitor.web.sys.web; | |||
// (powered by Fernflower decompiler) | |||
// | |||
import com.jeesite.common.lang.NumberUtils; | |||
import com.jeesite.common.lang.StringUtils; | |||
import lombok.AllArgsConstructor; | |||
import net.oschina.j2cache.CacheChannel; | |||
import net.oschina.j2cache.CacheObject; | |||
import net.oschina.j2cache.J2Cache; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.data.redis.core.StringRedisTemplate; | |||
import org.springframework.stereotype.Controller; | |||
@AllArgsConstructor | |||
@Controller | |||
public class TestController{ | |||
@Autowired | |||
StringRedisTemplate stringRedisTemplate; | |||
public static void main(String[] args) { | |||
System.err.println(NumberUtils.isParsable("0000")); | |||
System.err.println(Integer.parseInt("0000")); | |||
System.err.println(NumberUtils.isParsable("0000")&&Integer.parseInt("000")==0); | |||
System.err.println(StringUtils.replaceAll("0000", "0", "")); | |||
} | |||
} |
@@ -213,6 +213,11 @@ public class CommonApiController extends BaseController { | |||
return outputSuccess(json); | |||
} | |||
/** | |||
* 设备激活 | |||
* @param map | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/dev_activate", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") | |||
public Object activate(@RequestBody JSONObject map){ | |||
@@ -229,6 +234,9 @@ public class CommonApiController extends BaseController { | |||
String authCode = ApiSignUtil.apiSign(devId+devSn); | |||
Device device2 = deviceService.findByDevId(devId); | |||
System.err.println(devId); | |||
System.err.println(authCode); | |||
if (ObjectUtils.anyNotNull(device2)) { | |||
if (StringUtils.isNotEmpty(device2.getBindDeviceSn())) { | |||
return output(ResponseCode.DEVICE_ALREADY_ACTIVATE); | |||
@@ -240,10 +248,12 @@ public class CommonApiController extends BaseController { | |||
if (!("".equals(devName))) | |||
device2.setDeviceName(devName); | |||
redisUtils.setString(devId+":auth-code", authCode); | |||
redisUtils.setString(devId+":face-latest-ts", StringUtils.isNotEmpty(String.valueOf(device2.getLatestAuthTs()))?String.valueOf(device2.getLatestAuthTs()):"0"); | |||
redisUtils.setString(devId+":bind-sn", devSn); | |||
device2.setDevStatus(Device.DEV_STATUS_NORMAL); | |||
deviceService.update(device2); | |||
redisUtils.setGroupString(devId+":auth-code", authCode); | |||
redisUtils.setGroupString(devId+":face-latest-ts", StringUtils.isNotEmpty(String.valueOf(device2.getLatestAuthTs()))?String.valueOf(device2.getLatestAuthTs()):"0"); | |||
redisUtils.setGroupString(devId+":bind-sn", devSn); | |||
} else { | |||
return output(ResponseCode.DEVICE_NOT_FOUND); | |||
} | |||
@@ -496,6 +506,27 @@ public class CommonApiController extends BaseController { | |||
return outputSuccess(jsonObject); | |||
} | |||
@Autowired | |||
private DevicePackageVersionDao devicePackageVersionDao; | |||
@ResponseBody | |||
@RequestMapping(value = {"/pad_version"}) | |||
public Object padVersion() { | |||
JSONObject jsonObject = new JSONObject(); | |||
DevicePackageVersion dpv = devicePackageVersionDao.findExactNew(1L); | |||
if (ObjectUtils.anyNotNull(dpv)) { | |||
jsonObject.put("version", dpv.getVersion()); | |||
jsonObject.put("url", dpv.getDownloadUrl()); | |||
return outputSuccess(jsonObject); | |||
} else { | |||
return outputError(ResponseCode.FILE_NOT_FOUND, "未曾上传过版本"); | |||
} | |||
} | |||
@@ -623,7 +654,7 @@ public class CommonApiController extends BaseController { | |||
} else {//人脸审核不过 | |||
empService.updEmpStatus(e, Emp.STATUS_AVATAR_AUDIT_BACK); | |||
try { | |||
RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
redisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
} catch (Exception exception) { | |||
msg+=exception.getMessage(); | |||
} | |||
@@ -642,9 +673,9 @@ public class CommonApiController extends BaseController { | |||
empService.updEmpStatus(e, Emp.STATUS_NORMAL, 1); | |||
empService.updAuthMapping(e); | |||
// RedisUtils.setUserVariables(user.getWxOpenid(),0); | |||
// redisUtils.setUserVariables(user.getWxOpenid(),0); | |||
try { | |||
RedisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
redisUtils.setUserVariables(user.getWxOpenid(), user.getUserType().equals("estate")?"1":"0"); | |||
} catch (Exception exception) { | |||
msg+=exception.getMessage(); | |||
} | |||
@@ -751,8 +782,8 @@ public class CommonApiController extends BaseController { | |||
String key = "pass:records:"+ crs.get("id").toString(); | |||
if (RedisUtils.hasKey(key)) { | |||
String passStr = RedisUtils.getDefaultString(key); | |||
if (redisUtils.hasKey(key)) { | |||
String passStr = redisUtils.getDefaultString(key); | |||
JSONObject json = JSONObject.parseObject(passStr); | |||
jsonArray.add(json); | |||
} else { | |||
@@ -766,7 +797,7 @@ public class CommonApiController extends BaseController { | |||
if (ObjectUtils.anyNotNull(device)) { | |||
deviceExt.setDeviceId(devId); | |||
deviceExt = deviceExtDao.get(deviceExt); | |||
device.setDeviceExt(deviceExt); | |||
device.setDeviceExtInter(deviceExt); | |||
} | |||
} | |||
String userId = (String)crs.get("user_id"); | |||
@@ -787,7 +818,7 @@ public class CommonApiController extends BaseController { | |||
temp.put("check_time", DateUtils.formatDate(check, "yyyy-MM-dd HH:mm:ss")); | |||
temp.put("status", ObjectUtils.anyNotNull(device) ? (device.isOnline()?1:0):0); | |||
RedisUtils.setDefaultString(key,temp.toJSONString()); | |||
redisUtils.setDefaultString(key,temp.toJSONString()); | |||
jsonArray.add(temp); | |||
} | |||
} | |||
@@ -0,0 +1 @@ | |||
org.springframework.boot.env.EnvironmentPostProcessor=com.lecooai.visitor.web.config.LocalSettingsEnvironmentPostProcessor |
@@ -1,15 +1,6 @@ | |||
log: | |||
level: DEBUG | |||
# Redis 连接参数 (RedisProperties) | |||
redisson: | |||
hosts: redis://localhost:6379 | |||
# 1:单机 2:集群 3:哨兵 | |||
mode: 1 | |||
masterName: mymaster | |||
database: 0 | |||
password: | |||
timeout: 2000 | |||
model: standalone | |||
@@ -27,11 +18,17 @@ server: | |||
# 数据库连接配置 | |||
mysql: | |||
host: localhost | |||
port: 3306 | |||
database: aobei | |||
username: root | |||
password: Lecooai@2021 | |||
#host: localhost | |||
#port: 3306 | |||
#database: aobei2 | |||
#username: root | |||
#password: 123456 | |||
host: ${DB_HOST:39.105.85.176} | |||
port: ${DB_PORT:3306} | |||
database: ${DB_NAME:ENC(yhXI6cCOLsYAUVHeh7fs2g==)} | |||
username: ${DB_USER:root} | |||
password: ${DB_PASSWORD:ENC(4uU9GETpWUn5qumSNU4u+HiaPeKYc2MS)} | |||
# 业务相关配置 | |||
biz: | |||
@@ -124,6 +121,8 @@ office: | |||
# 默认机构ID | |||
defaultOffice: 2000003 | |||
defaultCorpName: 荣耀 | |||
# 设备 | |||
device: | |||
# 初始设备ID | |||
@@ -126,6 +126,8 @@ office: | |||
# 默认机构ID | |||
defaultOffice: 2000003 | |||
defaultCorpName: 荣耀 | |||
# 设备 | |||
device: | |||
# 初始设备ID | |||
@@ -121,6 +121,8 @@ office: | |||
# 默认机构ID | |||
defaultOffice: 2000003 | |||
defaultCorpName: 荣耀 | |||
# 设备 | |||
device: | |||
# 初始设备ID | |||
@@ -122,6 +122,8 @@ office: | |||
# 默认机构ID | |||
defaultOffice: 2000003 | |||
defaultCorpName: 荣耀 | |||
# 设备 | |||
device: | |||
# 初始设备ID | |||
@@ -8,7 +8,7 @@ spring: | |||
max-file-size: 100MB | |||
max-request-size: 100MB | |||
profiles: | |||
# active: prod | |||
#active: prod | |||
active: dev | |||
mail: | |||
@@ -46,19 +46,24 @@ spring: | |||
# # Redis 连接参数 (RedisProperties) | |||
redis: | |||
host: 127.0.0.1 | |||
port: 6379 | |||
ssl: false | |||
database: 0 | |||
password: | |||
timeout: 600000 | |||
password: ENC(1DCP8QVU6dsZDvL8ZFUFkw==) | |||
group: leface:pad | |||
timeout: 10000 | |||
# lettuce: | |||
# pool: | |||
# # 最大空闲连接数 | |||
# maxIdle: 3 | |||
# # 最大活动连接数 | |||
# maxActive: 20 | |||
cluster: | |||
max-redirects: 3 # 获取失败 最大重定向次数 | |||
nodes: | |||
- 39.105.85.176:6371 | |||
- 39.105.85.176:6372 | |||
- 39.105.85.176:6373 | |||
- 39.105.85.176:6374 | |||
- 39.105.85.176:6375 | |||
- 39.105.85.176:6376 | |||
lettuce: | |||
pool: | |||
max-active: 20 #连接池最大连接数(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 5 # 连接池中的最小空闲连接 | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
jedis: | |||
pool: | |||
# 连接池最大连接数(负值表示无限制) | |||
@@ -74,6 +79,11 @@ spring: | |||
static-path-pattern: /static/** | |||
resources: | |||
static-locations: classpath:/static/ | |||
jackson: | |||
time-zone: GMT+8 | |||
#============================# | |||
#===== Project settings =====# | |||
#============================# | |||
@@ -84,7 +94,9 @@ copyrightYear: 2021 | |||
# 软件提供商公司或个人名称 | |||
companyName: Lenovo | |||
productName: 奥北科技园访客系统 | |||
productName: HONOR闸机管理平台 | |||
#是否演示模式 | |||
demoMode: false | |||
@@ -108,9 +120,9 @@ jdbc: | |||
# Mysql 数据库配置 | |||
type: mysql | |||
driver: com.mysql.jdbc.Driver | |||
url: jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.database}?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useAffectedRows=true | |||
url: jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.database}?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useAffectedRows=true | |||
username: ${mysql.username} | |||
password: 123456 | |||
password: ${mysql.password} | |||
testSql: SELECT 1 | |||
maxWait: 10000 | |||
testOnBorrow: true | |||
@@ -169,67 +181,6 @@ user: | |||
"estate":{"dao":"","loginView":"wx/sysLogin","indexView":"wx/sysIndex"}, | |||
"expert":{"dao":"expertDao","loginView":"","indexView":"modules/sys/sysIndexExpert"} | |||
} | |||
# | |||
# # 数据权限设置参数,可新增自定义数据权限,moduleCode: 针对模块, ctrlPermi: 权限类型, 0全部 1拥有权限 2管理权限 | |||
# dataScopes: > | |||
# [{ | |||
# moduleCode: "core", | |||
# ctrlPermi: "0", | |||
# ctrlName: "机构权限", | |||
# ctrlName_en: "Office", | |||
# ctrlType: "Office", | |||
# ctrlDataUrl: "/sys/office/treeData", | |||
# chkboxType: {"Y":"ps","N":"ps"}, | |||
# expandLevel: -1, | |||
# remarks: "" | |||
# },{ | |||
# moduleCode: "core", | |||
# ctrlName: "公司权限", | |||
# ctrlName_en: "Company", | |||
# ctrlType: "Company", | |||
# ctrlPermi: "0", | |||
# ctrlDataUrl: "/sys/company/treeData", | |||
# chkboxType: {"Y":"ps","N":"ps"}, | |||
# expandLevel: -1, | |||
# remarks: "" | |||
# },{ | |||
# moduleCode: "core", | |||
# ctrlName: "角色权限", | |||
# ctrlName_en: "Role", | |||
# ctrlType: "Role", | |||
# ctrlPermi: "2", | |||
# ctrlDataUrl: "/sys/role/treeData", | |||
# chkboxType: {"Y":"ps","N":"ps"}, | |||
# expandLevel: -1, | |||
# remarks: "" | |||
# }] | |||
# # 多租户模式(SAAS模式)(专业版) | |||
# useCorpModel: false | |||
# 任务调度(个人版+) | |||
#job: | |||
# | |||
# # 是否自动启动任务调度(可关闭) | |||
# autoStartup: true | |||
# | |||
# # 任务调度启动延迟设置(单位:秒)(建议设置项目启动完成后的时间) | |||
# startupDelay: 60 | |||
# | |||
# # 任务调度线程池 | |||
# threadPool: | |||
# threadCount: 10 | |||
# threadPriority: 5 | |||
# | |||
# # 任务调度集群设置 | |||
# jobStore: | |||
# isClustered: true | |||
# clusterCheckinInterval: 1000 | |||
# | |||
#============================# | |||
#==== Framework settings ====# | |||
#============================# | |||
## Shiro 相关配置 | |||
shiro: | |||
@@ -246,48 +197,6 @@ shiro: | |||
# 是否加密单点登录安全Key | |||
# encryptKey: true | |||
# | |||
# # CAS 相关配置 | |||
## casServerUrl: http://192.168.1.3:8080/cas | |||
## casClientUrl: http://192.168.1.3:8180/jeesite | |||
## loginUrl: ${shiro.casServerUrl}?service=${shiro.casClientUrl}${adminPath}/login-cas | |||
## logoutUrl: ${shiro.casServerUrl}/logout?service=${shiro.loginUrl} | |||
## successUrl: ${shiro.casClientUrl}${adminPath}/index | |||
# | |||
# # SSO 登录相关配置 | |||
# sso: | |||
# | |||
# # 如果启用/sso/{username}/{token}单点登录,请修改此安全key并与单点登录系统key一致。 | |||
# secretKey: ~ | |||
# | |||
# # 是否加密单点登录安全Key | |||
# encryptKey: true | |||
# | |||
# # 登录提交信息加密 | |||
# loginSubmit: | |||
# | |||
# # 登录提交信息安全Key,加密用户名、密码、验证码,后再提交(key设置为3个,用逗号分隔) | |||
# secretKey: thinkgem,jeesite,com | |||
# | |||
# # 允许的请求方法设定,解决安全审计问题 | |||
# allowRequestMethods: GET,POST | |||
# | |||
# # 是否允许账号多地登录,如果设置为false,同一个设备类型的其它地点登录的相同账号被踢下线 | |||
# isAllowMultiAddrLogin: true | |||
# | |||
# # 是否允许刷新主框架页,如果设置为false,刷新主页将导致重新登录。如安全性比较高的,如银行个人首页不允许刷新。 | |||
# isAllowRefreshIndex: true | |||
# | |||
# # 是否允许嵌入到外部网站iframe中(true:不限制,false:不允许) | |||
# isAllowExternalSiteIframe: true | |||
# | |||
# 是否允许跨域访问,如果允许,设置允许的域名,全部域名设置*号,如果不允许,此设置应该为空 | |||
#accessControlAllowOrigin: http://test.lenovonowgo.com | |||
#accessControlAllowOrigin: '*' | |||
# | |||
# # URI 权限过滤器定义 | |||
filterChainDefinitions: | | |||
/api/v1/** = anon | |||
/face01/** = anon | |||
@@ -533,6 +442,10 @@ mqtt: | |||
# 心跳 | |||
keepalive: 30 | |||
httpServer: http://39.105.85.176:8008 | |||
devCmdPath: /api/mqtt_dev_cmd | |||
face: | |||
server: http://${faceServerI.ip}:${faceServerI.port} | |||
updServer: http://${faceServerII.ip}:${faceServerII.port} | |||
@@ -546,6 +459,24 @@ face: | |||
j2cache: | |||
config-location: classpath:/config/j2cache.properties | |||
server: | |||
tomcat: | |||
max-http-post-size: 2048000000 | |||
max-http-post-size: 2048000000 | |||
idaas: | |||
ak: access_AK_SK_ee32333155e9444f9bb46a71779b1127 | |||
sk: 42c950072c4942f09baa51494956d2217d316f32567945aaa761a6aa8d411d7a | |||
serverPath: http://uniportal.hihonor.com/uniportal1/ | |||
#jasypt加密配置 | |||
jasypt: | |||
encryptor: | |||
algorithm: PBEWithMD5AndDES | |||
iv-generator-classname: org.jasypt.iv.NoIvGenerator | |||
# property: | |||
# prefix: "ENC@[" | |||
# suffix: "]" |
@@ -0,0 +1,60 @@ | |||
<!-- for ehcache 2.x --> | |||
<ehcache updateCheck="false" dynamicConfig="false"> | |||
<diskStore path="java.io.tmpdir"/> | |||
<cacheManagerEventListenerFactory class="" properties=""/> | |||
<!--Default Cache configuration. These will applied to caches programmatically created through | |||
the CacheManager. | |||
The following attributes are required for defaultCache: | |||
maxInMemory - Sets the maximum number of objects that will be created in memory | |||
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element | |||
is never expired. | |||
timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used | |||
if the element is not eternal. Idle time is now - last accessed time | |||
timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used | |||
if the element is not eternal. TTL is now - creation time | |||
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache | |||
has reached the maxInMemory limit. | |||
--> | |||
<defaultCache | |||
maxElementsInMemory="1000" | |||
eternal="false" | |||
timeToIdleSeconds="1800" | |||
timeToLiveSeconds="1800" | |||
overflowToDisk="true"> | |||
</defaultCache> | |||
<!--Predefined caches. Add your cache configuration settings here. | |||
If you do not have a configuration for your cache a WARNING will be issued when the | |||
CacheManager starts | |||
The following attributes are required for defaultCache: | |||
name - Sets the name of the cache. This is used to identify the cache. It must be unique. | |||
maxInMemory - Sets the maximum number of objects that will be created in memory | |||
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element | |||
is never expired. | |||
timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used | |||
if the element is not eternal. Idle time is now - last accessed time | |||
timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used | |||
if the element is not eternal. TTL is now - creation time | |||
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache | |||
has reached the maxInMemory limit. | |||
--> | |||
<cache name="example" | |||
maxElementsInMemory="5000" | |||
eternal="false" | |||
timeToIdleSeconds="1800" | |||
timeToLiveSeconds="1800" | |||
overflowToDisk="false" | |||
> | |||
</cache> | |||
</ehcache> |
@@ -38,7 +38,7 @@ j2cache.broadcast.cache_clean_mode = passive | |||
# [classname] -> use custom provider | |||
######################################### | |||
j2cache.L1.provider_class = caffeine | |||
j2cache.L1.provider_class = ehcache | |||
#j2cache.L2.provider_class = redis | |||
j2cache.L2.provider_class = com.jeesite.common.j2cache.cache.support.redis.SpringRedisProvider | |||
@@ -70,7 +70,7 @@ j2cache.serialization = fst | |||
# caffeine.region.[name] = size, xxxx[s|m|h|d] | |||
######################################### | |||
# caffeine.properties = /config/caffeine.properties | |||
#caffeine.properties = /config/caffeine.properties | |||
caffeine.region.default = 10000, 1h | |||
caffeine.region.sessionCache = 100000, 30m | |||
@@ -80,9 +80,9 @@ caffeine.region.sessionCache = 100000, 30m | |||
#redis storage mode (generic|hash) | |||
redis.storage = hash | |||
redis.hosts = 8.131.78.156:6379 | |||
redis.hosts = 39.105.85.176:6371 | |||
redis.timeout = 2000 | |||
redis.password = | |||
redis.password = 123456 | |||
## redis pub/sub channel name | |||
redis.channel = j2cache | |||
## redis pub/sub server (using redis.hosts when empty) | |||
@@ -1,15 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.lecooai.visitor.web.sys.entity./.dao.DeviceExtGateEventDao"> | |||
<!-- 查询数据 | |||
<select id="findList" resultType="DeviceExtGateEvent"> | |||
SELECT ${sqlMap.column.toSql()} | |||
FROM ${sqlMap.table.toSql()} | |||
<where> | |||
${sqlMap.where.toSql()} | |||
</where> | |||
ORDER BY ${sqlMap.order.toSql()} | |||
</select> --> | |||
</mapper> |
@@ -1,15 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.lecooai.visitor.web.sys.entity.project.dao.DeviceExtGateEventDao"> | |||
<!-- 查询数据 | |||
<select id="findList" resultType="DeviceExtGateEvent"> | |||
SELECT ${sqlMap.column.toSql()} | |||
FROM ${sqlMap.table.toSql()} | |||
<where> | |||
${sqlMap.where.toSql()} | |||
</where> | |||
ORDER BY ${sqlMap.order.toSql()} | |||
</select> --> | |||
</mapper> |
@@ -31,4 +31,11 @@ | |||
</if> | |||
</select> | |||
<delete id="deleteByDevId" parameterType="String"> | |||
delete from tf_project_access_control where device_id = #{devId} | |||
</delete> | |||
<select id="findGateByOfficeCode" parameterType="String" resultType="com.lecooai.visitor.web.sys.entity.Device"> | |||
select * from tf_project_device where device_id in (select device_id from tf_project_access_control where office_code=#{officeCode}); | |||
</select> | |||
</mapper> |
@@ -25,9 +25,14 @@ | |||
<!-- 根据登录账号查找设备 --> | |||
<select id="findByUserCode" parameterType="String" resultType="com.lecooai.visitor.web.sys.entity.Device"> | |||
<!--select * from tf_project_device where device_type='PAD' AND id in (select device_id from tf_project_office_device where office_id in (select ctrl_data from tf_sys_user_data_scope where user_code=#{userCode})) --> | |||
select dev.* from tf_project_device dev where dev.device_type='pad' AND dev.device_id like '%PAD1' AND substring_index(dev.parent_codes, ',', 1) in (select d.device_id from tf_project_device d JOIN tf_project_access_control ac on ac.device_id=d.device_id and ac.office_code in (select ctrl_data from tf_sys_user_data_scope where user_code=#{userCode}) ) | |||
</select> | |||
<select id="findGatesByUserCode" parameterType="String" resultType="com.lecooai.visitor.web.sys.entity.Device"> | |||
<!--select * from tf_project_device where device_type='PAD' AND id in (select device_id from tf_project_office_device where office_id in (select ctrl_data from tf_sys_user_data_scope where user_code=#{userCode})) --> | |||
select dev.* from tf_project_device dev where dev.device_id in (select d.device_id from tf_project_device d JOIN tf_project_access_control ac on ac.device_id=d.device_id and ac.office_code in (select ctrl_data from tf_sys_user_data_scope where user_code=#{userCode}) ) | |||
select d.* from tf_project_device d JOIN tf_project_access_control ac on ac.device_id=d.device_id JOIN tf_project_office_access_control oac on ac.access_control_id = oac.access_control_id | |||
and oac.office_id in (select ctrl_data from tf_sys_user_data_scope where user_code=#{userCode}) | |||
</select> | |||
<!-- 根据设备ID获取到对应的设备信息 --> | |||
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.lecooai.visitor.web.sys.dao.DeviceExtDao"> | |||
<!-- 根据设备ID获取到对应的设备信息 --> | |||
<select id="findByDevId" parameterType="String" resultType="DeviceExt"> | |||
SELECT * FROM tf_project_device_ext WHERE device_id = #{devId} limit 1; | |||
</select> | |||
<delete id="deleteByDevId" parameterType="String"> | |||
delete from tf_project_device_ext where device_id = #{devId} | |||
</delete> | |||
</mapper> |
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.lecooai.visitor.web.sys.dao.DeviceExtGateDao"> | |||
<!-- 根据设备ID获取到对应的设备信息 --> | |||
<select id="findByDevId" parameterType="String" resultType="DeviceExtGate"> | |||
SELECT * FROM tf_project_device_ext_gate WHERE device_id = #{devId} limit 1; | |||
</select> | |||
<delete id="deleteByDevId" parameterType="String"> | |||
delete from tf_project_device_ext_gate where device_id = #{devId} | |||
</delete> | |||
</mapper> |
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.lecooai.visitor.web.sys.dao.DeviceExtGcuDao"> | |||
<!-- 根据设备ID获取到对应的设备信息 --> | |||
<select id="findByDevId" parameterType="String" resultType="DeviceExtGcu"> | |||
SELECT * FROM tf_project_device_ext_gcu WHERE device_id = #{devId} limit 1; | |||
</select> | |||
<delete id="deleteByDevId" parameterType="String"> | |||
delete from tf_project_device_ext_gcu where device_id = #{devId} | |||
</delete> | |||
</mapper> |
@@ -18,5 +18,9 @@ | |||
</foreach> | |||
</delete> | |||
<select id="findAccessControlByOfficeCode" parameterType="String" resultType="com.lecooai.visitor.web.sys.entity.OfficeAccessControl"> | |||
SELECT * FROM tf_project_office_access_control WHERE office_id = #{officeCode} | |||
</select> | |||
</mapper> |
@@ -50,4 +50,9 @@ | |||
delete from tf_sys_user where login_code = #{loginCode} | |||
</delete> | |||
<update id="updateUserCorp" parameterType="String" flushCache="true" > | |||
update tf_sys_user set corp_code = #{corpCode}, corp_name = #{corpName} where user_code = #{userCode} | |||
</update> | |||
</mapper> |
@@ -11,5 +11,15 @@ | |||
</where> | |||
ORDER BY ${sqlMap.order.toSql()} | |||
</select> --> | |||
<select id="getByHexCode" resultType="DeviceEventType"> | |||
SELECT * | |||
FROM tf_project_device_event_type | |||
<where> | |||
AND hex_code=#{hexCode} | |||
</where> | |||
</select> | |||
</mapper> |
@@ -11,5 +11,63 @@ | |||
</where> | |||
ORDER BY ${sqlMap.order.toSql()} | |||
</select> --> | |||
<select id="fetchData" resultType="DeviceExtGateEvent"> | |||
SELECT a.timestamp,FROM_UNIXTIME(a.timestamp, '%Y-%m-%d %H:%i:%s') occurTime, a.device_id, a.id, a.created_at, a.event_code, t.code, t.name, t.warn_level FROM tf_project_device_ext_gate_event a | |||
JOIN tf_project_device_event_type t on t.hex_code=a.event_code | |||
<where> | |||
AND UNIX_TIMESTAMP() - UNIX_TIMESTAMP(created_at) <![CDATA[<=]]> 10 AND t.warn_level>0 | |||
</where> | |||
ORDER BY id limit 1; | |||
</select> | |||
<select id="findEventListGroupByDate" resultType="java.util.HashMap" parameterType="String"> | |||
select DATE_FORMAT(created_at, '%Y-%m-%d') as date , count(1) AS count from tf_project_device_ext_gate_event a | |||
<where> | |||
AND a.warn_level>0 and a.timestamp <![CDATA[>=]]> UNIX_TIMESTAMP(#{startDate}) and a.timestamp <![CDATA[<=]]> UNIX_TIMESTAMP(#{endDate}) AND pad_id in | |||
<foreach item="item" collection="deviceIds" index="index" open="(" separator="," close=")"> | |||
#{item} | |||
</foreach> | |||
</where> | |||
GROUP BY date | |||
</select> | |||
<select id="findEventListGroupByDateAndPad" resultType="java.util.HashMap" parameterType="String"> | |||
select DATE_FORMAT(created_at, '%Y-%m-%d') as date , pad_id, count(1) AS count from tf_project_device_ext_gate_event a | |||
<where> | |||
AND a.warn_level>0 and a.timestamp <![CDATA[>=]]> UNIX_TIMESTAMP(#{startDate}) and a.timestamp <![CDATA[<=]]> UNIX_TIMESTAMP(#{endDate}) | |||
</where> | |||
GROUP BY date, pad_id | |||
</select> | |||
<select id="findEventListGroupByPad" resultType="java.util.HashMap" parameterType="String"> | |||
select pad_id, count(1) AS count from tf_project_device_ext_gate_event a | |||
<where> | |||
AND a.warn_level>0 and a.timestamp <![CDATA[>=]]> UNIX_TIMESTAMP(#{startDate}) and a.timestamp <![CDATA[<=]]> UNIX_TIMESTAMP(#{endDate}) | |||
</where> | |||
GROUP BY pad_id | |||
</select> | |||
<select id="findEventCount" resultType="long"> | |||
SELECT count(0) count FROM tf_project_device_ext_gate_event a where pad_id=#{deviceId} and a.warn_level>0 and a.timestamp <![CDATA[>=]]> UNIX_TIMESTAMP(#{startTime}) and a.timestamp <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime}) | |||
</select> | |||
<select id="findEventCountByDevIds" resultType="long" parameterType="String"> | |||
SELECT count(0) count FROM tf_project_device_ext_gate_event a where pad_id in | |||
<foreach item="item" collection="deviceIds" index="index" open="(" separator="," close=")"> | |||
#{item} | |||
</foreach> and a.warn_level>0 and a.timestamp <![CDATA[>=]]> UNIX_TIMESTAMP(#{startTime}) and a.timestamp <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime}) | |||
</select> | |||
<select id="findDistinctEventCountByDay" resultType="java.util.Map"> | |||
SELECT FROM_UNIXTIME(a.timestamp, '%Y-%m-%d') as date, count(1) as count | |||
FROM tf_project_device_ext_gate_event a | |||
<where> | |||
and pad_id=#{deviceId} and a.warn_level>0 | |||
and a.timestamp <![CDATA[>=]]> UNIX_TIMESTAMP(#{startTime}) | |||
and a.timestamp <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime}) | |||
</where> | |||
GROUP BY date ORDER BY date | |||
</select> | |||
</mapper> |
@@ -0,0 +1,23 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- | |||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project. | |||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information. | |||
--> | |||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd"> | |||
<id>on-visitor-web</id> | |||
<classpath> | |||
<dir name="/Users/yychang/IdeaProjects/aobei/on-visitor-web/src/main/webapp/WEB-INF/classes"> | |||
</dir> | |||
</classpath> | |||
<web> | |||
<link target="/"> | |||
<dir name="/Users/yychang/IdeaProjects/aobei/on-visitor-web/src/main/webapp"> | |||
</dir> | |||
</link> | |||
</web> | |||
</application> |
@@ -1,7 +1,7 @@ | |||
@import "fontgoogle.css"; | |||
.box-body{ | |||
padding: 10px 20px 20px; | |||
padding: 35px 20px 20px; | |||
background-color: #F8F8F8; | |||
color: #191919; | |||
} | |||
@@ -364,7 +364,7 @@ body { | |||
width: 100%; | |||
overflow: hidden; | |||
background-color: #FFF; | |||
padding: 30px 10px 10px; | |||
padding: 15px 10px 10px; | |||
box-shadow:inset -2px -2px 14px #E9E9E9; | |||
} | |||
/* 表格外边框 */ | |||
@@ -48,7 +48,8 @@ g==c?1==g[f].length?h.replaceSwitchClass(e,b,p.line.ROOT):(c=l("#"+g[f][0].tId+p | |||
b.removeAttr("disabled"):b.attr("disabled","disabled")}}},selectNode:function(a,b,g){g||h.cancelPreSelectedNode(a);l("#"+b.tId+p.id.A).addClass(p.node.CURSELECTED);d.addSelectedNode(a,b)},setNodeFontCss:function(a,b){var c=l("#"+b.tId+p.id.A);(a=h.makeNodeFontCss(a,b))&&c.css(a)},setNodeLineIcos:function(a,b){if(b){var c=l("#"+b.tId+p.id.SWITCH),d=l("#"+b.tId+p.id.UL),f=l("#"+b.tId+p.id.ICON),g=h.makeUlLineClass(a,b);0==g.length?d.removeClass(p.line.LINE):d.addClass(g);c.attr("class",h.makeNodeLineClass(a, | |||
b));b.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled");f.removeAttr("style");f.attr("style",h.makeNodeIcoStyle(a,b));f.attr("class",h.makeNodeIcoClass(a,b))}},setNodeName:function(a,b){var c=d.getNodeTitle(a,b),g=l("#"+b.tId+p.id.SPAN);g.empty();a.view.nameIsHTML?g.html(d.getNodeName(a,b)):g.text(d.getNodeName(a,b));m.apply(a.view.showTitle,[a.treeId,b],a.view.showTitle)&&l("#"+b.tId+p.id.A).attr("title",c?c:"")},setNodeTarget:function(a){l("#"+a.tId+p.id.A).attr("target",h.makeNodeTarget(a))}, | |||
setNodeUrl:function(a,b){var c=l("#"+b.tId+p.id.A);a=h.makeNodeUrl(a,b);null==a||0==a.length?c.removeAttr("href"):c.attr("href",a)},switchNode:function(a,b){b.open||!m.canAsync(a,b)?h.expandCollapseNode(a,b,!b.open):a.async.enable?h.asyncNode(a,b)||h.expandCollapseNode(a,b,!b.open):b&&h.expandCollapseNode(a,b,!b.open)}};l.fn.zTree={consts:{className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand", | |||
COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:m,view:h,event:g,data:d},getZTreeObj:function(a){return(a=d.getZTreeTools(a))?a:null},destroy:function(a){if(a&&0<a.length)h.destroy(d.getSetting(a));else for(var b in z)h.destroy(z[b])}, | |||
COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error"},id:{ | |||
A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:m,view:h,event:g,data:d},getZTreeObj:function(a){return(a=d.getZTreeTools(a))?a:null},destroy:function(a){if(a&&0<a.length)h.destroy(d.getSetting(a));else for(var b in z)h.destroy(z[b])}, | |||
init:function(a,b,e){var c=m.clone(n);l.extend(!0,c,b);c.treeId=a.attr("id");c.treeObj=a;c.treeObj.empty();z[c.treeId]=c;"undefined"===typeof document.body.style.maxHeight&&(c.view.expandSpeed="");d.initRoot(c);a=d.getRoot(c);b=c.data.key.children;e=e?m.clone(m.isArray(e)?e:[e]):[];a[b]=c.data.simpleData.enable?d.transformTozTreeFormat(c,e):e;d.initCache(c);g.unbindTree(c);g.bindTree(c);g.unbindEvent(c);g.bindEvent(c);e={setting:c,addNodes:function(a,b,d){function g(){h.addNodes(c,a,e,1==d)}if(!b)return null; | |||
a||(a=null);if(a&&!a.isParent&&c.data.keep.leaf)return null;var e=m.clone(m.isArray(b)?b:[b]);m.canAsync(c,a)?h.asyncNode(c,a,d,g):g();return e},cancelSelectedNode:function(a){h.cancelPreSelectedNode(this.setting,a)},destroy:function(){h.destroy(this.setting)},expandAll:function(a){a=!!a;h.expandCollapseSonNode(this.setting,null,a,!0);return a},expandNode:function(a,b,g,e,f){if(!a||!a.isParent)return null;!0!==b&&!1!==b&&(b=!a.open);if((f=!!f)&&b&&0==m.apply(c.callback.beforeExpand,[c.treeId,a],!0)|| | |||
f&&!b&&0==m.apply(c.callback.beforeCollapse,[c.treeId,a],!0))return null;b&&a.parentTId&&h.expandCollapseParentNode(this.setting,a.getParentNode(),b,!1);if(b===a.open&&!g)return null;d.getRoot(c).expandTriggerFlag=f;if(g)h.expandCollapseSonNode(this.setting,a,b,!0,function(){if(!1!==e)try{l("#"+a.tId).focus().blur()}catch(S){}});else if(a.open=!b,h.switchNode(this.setting,a),!1!==e)try{l("#"+a.tId).focus().blur()}catch(S){}return b},getNodes:function(){return d.getNodes(this.setting)},getNodeByParam:function(a, | |||
@@ -0,0 +1,98 @@ | |||
/*! | |||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved. | |||
* | |||
* @author ThinkGem | |||
* @version 2017-4-18 | |||
*/ | |||
function GetRequest() { | |||
var url = location.search; //获取url中"?"符后的字串 | |||
var theRequest = new Object(); | |||
if (url.indexOf("?") != -1) { | |||
var str = url.substr(1); | |||
strs = str.split("&"); | |||
for(var i = 0; i < strs.length; i ++) { | |||
theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); | |||
} | |||
} | |||
return theRequest; | |||
} | |||
var req = GetRequest(); | |||
var type = req['type']; | |||
var layer = layui.layer; | |||
$("#username, #password").on("focus blur", function() { | |||
var a = this; | |||
setTimeout(function() { | |||
var b = $(a).css("borderColor"); | |||
if (b != "") { | |||
$(a).prev().css("color", b) | |||
} | |||
}, 100) | |||
}).blur(); | |||
$("#loginForm").validate({ | |||
submitHandler: function(c) { | |||
var d = $("#username").val(), | |||
a = $("#password").val(), | |||
b = $("#validCode").val(); | |||
if (secretKey != "") { | |||
$("#username").val(DesUtils.encode(d, secretKey)); | |||
$("#password").val(DesUtils.encode(a, secretKey)); | |||
$("#validCode").val(DesUtils.encode(b, secretKey)) | |||
} | |||
js.ajaxSubmitForm($(c), function(f, e, g) { | |||
$("#btnSubmit").attr("disabled","disabled"); | |||
console.log(f); | |||
if (f.result == "false" && f.message &&f.message.length > 0) { | |||
$("#btnSubmit").removeAttr("disabled"); | |||
// js.showMessage(f.message); | |||
layer.msg(f.message, {icon: 5, time: 2000}); | |||
$("#password").val("").focus(); | |||
} else { | |||
var userInfo = {"username": d,"checkedDefault": ["punchClockDays","workLateDays","workLeaveEarlyDays","missingPunchClockDays","unpunchClockDays","workTime"]}; | |||
var newArray = []; | |||
var getUserAllStr = window.localStorage.getItem("userInfo"); | |||
window.localStorage.setItem("username",d); | |||
window.localStorage.setItem("password",a); | |||
if( getUserAllStr ){ | |||
var getUserAllData = JSON.parse(getUserAllStr) || []; | |||
var flag = true; | |||
$.each(getUserAllData,function(i,v){ | |||
if( v.username == d ){ | |||
flag = false; | |||
} | |||
}); | |||
if( flag ){ | |||
getUserAllData.push(userInfo); | |||
window.localStorage.setItem("userInfo",JSON.stringify(getUserAllData)); | |||
} | |||
}else{ | |||
newArray.push(userInfo); | |||
window.localStorage.setItem("userInfo",JSON.stringify(newArray)); | |||
} | |||
js.loading($("#btnSubmit").data("loading")); | |||
// var openid = window.localStorage.getItem("aobei-openid"); | |||
/*var openid = request['openid']; | |||
console.log(openid); | |||
console.log("${cookie.openid}");*/ | |||
if (f.__url && f.__url != "") { | |||
location = f.__url | |||
} else { | |||
location = ctxAdmin + "/index"; | |||
} | |||
$("#password").val(a).select().focus(); | |||
} | |||
}, "json", true, $("#btnSubmit").data("loginValid")); | |||
$("#username").val(d); | |||
$("#password").val(a).select().focus(); | |||
// $("#validCode").val(b) | |||
} | |||
}); |
@@ -0,0 +1,50 @@ | |||
<% | |||
@servlet.getResponse().setStatus(400); | |||
var message = @ObjectUtils.toString(@request.getAttribute("message")); | |||
if (isBlank(message)){ | |||
var ex = @ExceptionUtils.getThrowable(request); | |||
if (ex != null){ | |||
if(@StringUtils.startsWith(@ex.getMessage(), "msg:")){ | |||
message = @StringUtils.replace(@ex.getMessage(), "msg:", ""); | |||
} | |||
} | |||
} | |||
if (isBlank(message)){ | |||
//message = text('sys.error.403.message'); | |||
message = '请登陆后再进行此操作'; | |||
} | |||
// 如果是异步请求或是手机端,则直接返回信息 | |||
if (@ServletUtils.isAjaxRequest(request)) { | |||
print(@ServletUtils.renderResult(@Global.FALSE, message)); | |||
} | |||
// 输出异常信息页面 | |||
else { | |||
%> | |||
<% layout('/layouts/default.html', {title: '401 - '+text('sys.error.401.title')}){ %> | |||
<link rel="stylesheet" href="${ctxStatic}/common/error.css?${_version}"> | |||
<div class="error-page text-center"> | |||
<div class="headline text-yellow">401</div> | |||
<div class="error-content" style="display: contents;"> | |||
<h3><i class="fa fa-warning text-yellow"></i> ${message}</h3> | |||
<!-- <p>${text('sys.error.403.message.p1')}</p> --> | |||
<button type="button" class="btn btn-warning btn-sm" onclick="location.href='${ctxAdmin}/login';"><i | |||
class="fa fa-reply-all"></i> ${text('sys.error.returnButton')}</button> | |||
</div> | |||
</div> | |||
<script> | |||
$(function (){ | |||
if (is_weixn()) { | |||
location.href = ctxFront + "/wx/oauth2?type=1&redirect="; | |||
} else { | |||
log("other browsers"); | |||
} | |||
}) | |||
</script> | |||
<% } %> | |||
<% } %> |
@@ -49,4 +49,41 @@ var themeName = @Global.getConfig('web.view.themeName', 'default'); | |||
}; | |||
return fmt; | |||
} | |||
$(function(){ | |||
/*pushHistory(); | |||
window.addEventListener( | |||
"popstate", | |||
function (e) { | |||
console.log(e); | |||
setTimeout(function (){ | |||
layer.closeAll(); | |||
parent.layer.closeAll(); | |||
},2000) | |||
window.location.reload(); //跳转后执行的方法 | |||
// alert('已监听到你从上个页面返回!'); | |||
}, | |||
false | |||
); | |||
function pushHistory() { | |||
var href; | |||
if (document.referrer === '') { | |||
href ="/"; | |||
} else { | |||
href = document.referrer; | |||
} | |||
var state = { | |||
title: "title", | |||
url: href, | |||
}; | |||
window.history.pushState(state, "title", "#"); | |||
}*/ | |||
}) | |||
</script> |
@@ -171,17 +171,7 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<div class="col-xs-4"> | |||
<div class="form-group"> | |||
<!--<label class="control-label col-sm-2" title="">--> | |||
<!--<span class="required ">*</span>设备位置<i class="fa icon-question hide"></i></label>--> | |||
<div class="col-sm-7 add-delete-btn"> | |||
<span class="required">*</span><p>归属公司(区域)</p> | |||
<i class="layui-icon reset_input" ></i> | |||
<#form:select path="office.officeCode" items="${officeList}" itemLabel="officeName" itemValue="officeCode" blankOption="true" class="form-control"/> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="row"> | |||
@@ -129,23 +129,20 @@ | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(2){ | |||
width: 18%; | |||
width: 241px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(3){ | |||
width: 18%; | |||
width: 241px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(4){ | |||
width: 18%; | |||
width: 241px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(5){ | |||
width: 18%; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(6){ | |||
width: 316px; | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(5){ | |||
width: 385px; | |||
} | |||
</style> | |||
<script> | |||
@@ -192,13 +189,6 @@ | |||
formatter: function(val, obj, row, act){ | |||
return js.getDictLabel(${@DictUtils.getDictListJson('sys_citys')}, val, '-', true); | |||
} | |||
},{ | |||
header : '所属公司(区域)', | |||
name : 'office.officeName', | |||
index : 'a.office_code', | |||
width : 50, | |||
align : "left", | |||
}, | |||
{ | |||
header : '操作', | |||
@@ -232,34 +232,34 @@ | |||
margin-right: 23px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(2){ | |||
width: 18%; | |||
width: 146px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(3){ | |||
width: 18%; | |||
width: 146px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(4){ | |||
width: 18%; | |||
width: 146px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(5){ | |||
width: 18%; | |||
width: 146px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(6){ | |||
width: 18%; | |||
width: 146px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(7){ | |||
width: 18%; | |||
width: 146px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(8){ | |||
width: 234px; | |||
width: 232px; | |||
} | |||
</style> | |||
<script> | |||
@@ -310,13 +310,19 @@ | |||
align : "left" | |||
}, | |||
{ | |||
header : '所属公司(区域)', | |||
name : 'office.officeName', | |||
width : 50, | |||
align : "left" | |||
}, | |||
/* { | |||
header : '所属公司(区域)', | |||
name : 'office.officeName', | |||
index : 'a.office_code', | |||
width : 50, | |||
align : "left", | |||
},{ | |||
},*/{ | |||
header : '设备位置', | |||
name : 'device.address', | |||
index : 'a.address', | |||
@@ -78,33 +78,31 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<% if (@RoleUtils.hasUserRole(admin.userCode,"secAdmin")) { %> | |||
<div class="row"> | |||
<div class="col-xs-12"> | |||
<div class="form-group" style="margin-bottom: 37px;"> | |||
<p style="margin-bottom:30px">管辖公司</p> | |||
<div> | |||
<!--<#form:checkbox id="offices" name="officeIds" items="${officeList}" itemLabel="officeName" itemValue="officeCode" class="form-control"/>--> | |||
<% | |||
if(@ObjectUtils.anyNotNull(mgrOffice)) { %> | |||
<select name="officeIds" id="sel-office"> | |||
<% | |||
print('<option value="' + mgrOffice.officeCode + '">' + mgrOffice.officeName + '</option>'); | |||
%> | |||
</select> | |||
<% } else {%> | |||
<select name="officeIds" id="sel-office"> | |||
<% | |||
for(office in officeList){ | |||
print('<option value="' + office.officeCode + '">' + office.officeName + '</option>'); | |||
if(@ObjectUtils.anyNotNull(mgrOffice) && @StringUtils.equals(mgrOffice.officeCode, office.officeCode)) { | |||
print('<option value="' + mgrOffice.officeCode + '" selected>' + mgrOffice.officeName + '</option>'); | |||
} else { | |||
print('<option value="' + office.officeCode + '">' + office.officeName + '</option>'); | |||
} | |||
} | |||
%> | |||
</select> | |||
<% } %> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<% } %> | |||
<div class="row"> | |||
<div class="col-xs-12"> | |||
<div class="form-group"> | |||
@@ -113,6 +111,8 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<div class="row row_bottom"> | |||
<button type="submit" class="button red center" id="btnSubmit">保存</button> | |||
<button type="button" class="button black center" id="btnCancel" onclick="pageReturn(2)">关闭</button> | |||
@@ -136,7 +136,7 @@ $(function(){ | |||
js.showMessage(data.message); | |||
if(data.result == Global.TRUE){ | |||
pageReturn(2); | |||
contentWindow.page(); | |||
// contentWindow.page(); | |||
} | |||
}, "json"); | |||
} | |||
@@ -178,7 +178,7 @@ $(function(){ | |||
var oc = $("#sel-office").val(); | |||
offices.push(oc); | |||
$.post("${ctx}/sys/admin/query-devices-by-offices", {officeCodes: offices}, function(data){ | |||
$.post("${ctx}/sys/admin/query-devices-by-offices", {officeCodes: offices, userCode:"${admin.userCode}"}, function(data){ | |||
$('#devicePermi').empty(); | |||
for(var i=0; i<data.length; i++){ | |||
$('#devicePermi').append('<div style="display:inline-block; width:200px; padding:2px 8px 0 0;"><img src="${ctxStatic}/images/checked.png"/><span> ' + data[i].deviceName + '</span></div>'); | |||
@@ -76,6 +76,22 @@ | |||
<i class="layui-icon reset_input"></i> | |||
</div> | |||
</div> | |||
<div class="layui-form-item" style="margin-bottom:10px;"> | |||
<label class="layui-form-label" style="width:100px;">账户类型</label> | |||
<div class="layui-input-block add-delete-btn" style="width:250px !important;"> | |||
<#form:select path="userType" items="${userTypeList}" itemLabel="userTypeName" itemValue="userTypeCode" class="form-control required layui-form-select" /> | |||
</div> | |||
</div> | |||
<div class="layui-form-item lead-office-div" style="margin-bottom:10px;display: none;"> | |||
<label class="layui-form-label" style="width:100px;">管辖组织</label> | |||
<div class="layui-input-block add-delete-btn" style="width:250px !important;"> | |||
<#form:select path="officeCode" items="${officeList}" itemLabel="officeName" itemValue="officeCode" class="form-control required layui-form-select" /> | |||
<p></p> | |||
</div> | |||
</div> | |||
<div class="layui-form-item form-group has-feedback" id="isValidCodeLogin" style="margin-bottom:5px;"> | |||
<label class="layui-form-label" >验证码</label> | |||
<div class="layui-input-block add-delete-btn"> | |||
@@ -93,7 +109,7 @@ | |||
</form> | |||
</div> | |||
<% } %> | |||
<style> | |||
.avatar { | |||
width: 64px; | |||
@@ -110,11 +126,20 @@ | |||
.layui_pop .layui-form .layui-form-item .add-delete-btn{ | |||
width:250px; | |||
} | |||
.select2{ | |||
display: none !important; | |||
} | |||
</style> | |||
<script> | |||
<% } %> | |||
<SCRIPT type="text/javascript"> | |||
$(function() { | |||
//员工列表 | |||
var pageSize = 0; | |||
var dataGrid = $('#dataGrid') | |||
@@ -130,11 +155,23 @@ | |||
align : "left", | |||
frozen : true | |||
}, | |||
{ | |||
/*{ | |||
header : '管辖公司', | |||
name : 'extend.extendS1', | |||
width : 60, | |||
align : "left" | |||
},*/ | |||
{ | |||
header : '账户类型', | |||
name : 'userName', | |||
width : 60, | |||
align : "left" | |||
},{ | |||
header : '管辖区域', | |||
name : 'corpName_', | |||
width : 60, | |||
align : "left" | |||
}, | |||
{ | |||
header : '操作', | |||
@@ -177,6 +214,15 @@ | |||
var layer = layui.layer; | |||
var form = layui.form; | |||
var layerIndex = ''; | |||
$('#userType').val('none').trigger('change'); | |||
// form.render('select'); | |||
form.on("select", function (data) { | |||
if (data.value == "none") { | |||
$(".lead-office-div").css("display", "none"); | |||
} else { | |||
$(".lead-office-div").css("display","inline-block") | |||
} | |||
}) | |||
form.verify({ | |||
pwd: [ | |||
@@ -237,7 +283,7 @@ | |||
layerIndex = layer.open({ | |||
type: 1 | |||
,title: false | |||
,area: ['500px', '290px'] | |||
,area: ['500px', '430px'] | |||
,shade: 0.5 | |||
,maxmin: false | |||
,scrollbar: false | |||
@@ -260,6 +306,9 @@ | |||
layer.close(layerIndex); | |||
}); | |||
}); | |||
}) | |||
//删除二级管理员 | |||
var deleteUrl = ""; | |||
@@ -289,4 +338,7 @@ | |||
} | |||
); | |||
} | |||
</script> |
@@ -2,7 +2,7 @@ | |||
['dataGrid','fileupload','zTree'], bodyClass: ''}){ %> | |||
<style> | |||
.remote-action-btn{ | |||
.remote-action-btn, .refresh-btn{ | |||
display: inline-block; | |||
width: 76px; | |||
height: 25px; | |||
@@ -21,6 +21,14 @@ | |||
border-radius: 3px; | |||
} | |||
.refresh-btn{ | |||
width: 80px; | |||
height: 30px; | |||
line-height: 30px; | |||
right: 10px; | |||
position: absolute; | |||
} | |||
.remote-status-btn{ | |||
display: inline-block; | |||
padding: 0px 11px; | |||
@@ -69,7 +77,7 @@ | |||
} | |||
.item-gate .layui-card{ | |||
margin-top: 15px; | |||
margin-top: 23px; | |||
background-color: #bcc6cf; | |||
box-shadow:none !important; | |||
} | |||
@@ -80,14 +88,14 @@ | |||
} | |||
.item-gate .layui-card .layui-card-header{ | |||
border: none; | |||
height: 26px; | |||
height: 30px; | |||
line-height: 12px; | |||
font-size: 16px; | |||
font-size: 20px; | |||
} | |||
.item-gate .layui-card .layui-card-body{ | |||
border: none; | |||
color: #2f4056; | |||
line-height: 28px; | |||
line-height: 35px; | |||
padding-top: 0; | |||
padding-bottom: 0; | |||
} | |||
@@ -114,31 +122,13 @@ | |||
color: #2f4056; | |||
} | |||
.item-error-span { | |||
font-size: 12px; | |||
line-height: 26px; | |||
color: orangered; | |||
} | |||
.settingDevice, .warningDevice{ | |||
font-size: 12px; | |||
line-height: 24px; | |||
background-color: #acb6bf; | |||
border: none; | |||
opacity: 1; | |||
padding: 0 12px; | |||
color: #334053; | |||
border-radius: 3px; | |||
} | |||
.item-gate-handle{ | |||
border: 1px solid #C7C7C7; | |||
padding: 15px; | |||
text-align: center; | |||
} | |||
.item-gate-handle .setting-div{ | |||
border-right: 1px solid #acb6bf; | |||
} | |||
.pb-15{ | |||
padding-bottom: 15px !important; | |||
} | |||
.layui-form-select dl { | |||
top: 27px !important; | |||
@@ -183,7 +173,6 @@ | |||
} | |||
#table-record, #table-record2 { | |||
width: 100%; | |||
height: auto; | |||
@@ -226,26 +215,11 @@ | |||
} | |||
#table-record thead tr th .iconx, #table-record2 thead tr th .iconx{display:inline-flex;flex-direction:column;align-items:center;width:20px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative;font-size: 9px;} | |||
.f11 { | |||
font-size: 18px !important; | |||
line-height: 11px !important; | |||
} | |||
.f-blue { | |||
color: #10aeff !important; | |||
} | |||
.add-delete-btn input { | |||
height: 28px; | |||
line-height: 28px; | |||
} | |||
#ipt-start-time, #ipt-start-time2{ | |||
height: 28px !important; | |||
background-color: #2e4056; | |||
color: #f2f2f2; | |||
border: none !important; | |||
outline: none; | |||
} | |||
.select2-container--default.select2-container--focus .select2-selection--single { | |||
height: 28px !important; | |||
@@ -254,10 +228,6 @@ | |||
color: #344152 !important; | |||
margin-top: -5px !important; | |||
} | |||
.ui-widget-content { | |||
border: none !important; | |||
width: 100% !important; | |||
} | |||
.layui-laypage-skip input{ | |||
height: 26px !important; | |||
@@ -275,6 +245,16 @@ | |||
padding: 15px !important; | |||
} | |||
.bg-yellow2{ | |||
background-color: #f39c12; | |||
color: white; | |||
} | |||
.bg-red2{ | |||
background-color: #dd4b39; | |||
color: white; | |||
} | |||
</style> | |||
<div class="main-content"> | |||
<div class="box box-main"> | |||
@@ -291,45 +271,63 @@ | |||
<div> | |||
<img class="item-gate-img" src="/static/images/gate.png"> | |||
<a onclick="editDeviceName()"><p class="item-gate-name"><i class="fa fa-pencil-square-o edit-dev-name cursor"></i> ${device.deviceName}</p></a> | |||
<p class="item-gate-sn">设备SN:027382833</p> | |||
<p class="item-gate-sn">设备ID: ${device.deviceId}</p> | |||
<% if(isNotEmpty(device.pads[0].bindDeviceSn)){ %> | |||
<p class="item-gate-sn">设备SN: ${device.pads[0].bindDeviceSn}</p> | |||
<% } else {%> | |||
<p class="item-error-span">SN不存在,设备未激活</p> | |||
<% } %> | |||
</div> | |||
</div> | |||
<div class="col-xs-5" style="padding-bottom: 10px;"> | |||
<div class="layui-card" style="border-right: 2px solid white !important;"> | |||
<div class="layui-card-header"> | |||
${decode(device.gcus[0].deviceExt.masterSlaver,"M","主机","S","从机","主从机未知")} | |||
${decode(device.gcus[0].deviceExtGcu.masterSlaver,"M","主机","S","从机","主从机未知")} | |||
</div> | |||
<div class="layui-card-body"> | |||
<div class="d-flex"> | |||
<div class="div-info-label">设备IP地址:</div> | |||
<div class="div-info-value">${nvl(device.pads[0].deviceExt.ipAddr,"暂无")}</div> | |||
<% if(device.pads[0].isOnline) { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-green" flag="false">通讯正常</span></div> | |||
<div class="div-info-status"><span class="remote-status-btn bg-green" flag="false">通讯正常</span> | |||
</div> | |||
<% } else { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-red-active" flag="false">通讯异常</span></div> | |||
<div class="div-info-status"><span class="remote-status-btn bg-red-active" flag="false">通讯异常</span> | |||
</div> | |||
<% } %> | |||
</div> | |||
<div class="d-flex"> | |||
<div class="div-info-label">客户端版本:</div> | |||
<div class="div-info-value">${nvl(device.pads[0].deviceExt.appVer,"暂无")}</div> | |||
<% if(apkPackage.version>nvl(device.pads[0].deviceExt.appVer,"")) { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="${ctx}/sys/device/version"><i class="fa fa-hand-pointer-o fz16"></i></a></div> | |||
<!--<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="${ctx}/sys/device/version"><i class="fa fa-hand-pointer-o fz16"></i></a></div>--> | |||
<% } else { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-info" flag="false">最新版</span></div> | |||
<% } %> | |||
</div> | |||
<div class="d-flex"> | |||
<div class="div-info-label">GCU版本:</div> | |||
<div class="div-info-value">${nvl(device.gcus[0].deviceExt.mtcVersion,"暂无")}</div> | |||
<% if(gcuPackage.version>nvl(device.gcus[0].deviceExt.mtcVersion,"")) { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="${ctx}/sys/device/version"><i class="fa fa-hand-pointer-o fz16"></i></a></div> | |||
<div class="div-info-value">${nvl(device.gcus[0].deviceExtGcu.mtcVersion,"暂无")}</div> | |||
<% if(gcuPackage.version>nvl(device.gcus[0].deviceExtGcu.mtcVersion,"")) { %> | |||
<!--<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="${ctx}/sys/device/version"><i class="fa fa-hand-pointer-o fz16"></i></a></div>--> | |||
<% } else { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-info" flag="false">最新版</span></div> | |||
<% } %> | |||
</div> | |||
<div class="d-flex"> | |||
<div class="div-info-label">模块状态:</div> | |||
<div class="div-info-status"><span class="remote-status-btn bg-green" flag="false">全部正常</span></div> | |||
<div class="div-info-status"> | |||
<% | |||
var errorFlag=false; | |||
if (device.devStatus!=0 && isNotEmpty(device.deviceExtGate) && isNotEmpty(device.deviceExtGate.devErr) && !(@NumberUtils.isParsable(device.deviceExtGate.devErr)&& @Integer.parseInt(device.deviceExtGate.devErr)==0)) { errorFlag=true;%> | |||
<span class="remote-status-btn bg-yellow2" flag="false">闸机异常:${device.deviceExtGate.devErr}</span> | |||
<% } %> | |||
<% if (errorFlag==false) { %> | |||
<span class="remote-status-btn bg-green" flag="false">全部正常</span> | |||
<% } %> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -337,7 +335,7 @@ | |||
<div class="col-xs-5"> | |||
<div class="layui-card"> | |||
<div class="layui-card-header"> | |||
${decode(device.gcus[1].deviceExt.masterSlaver,"M","主机","S","从机","主从机未知")} | |||
${decode(device.gcus[1].deviceExtGcu.masterSlaver,"M","主机","S","从机","主从机未知")} | |||
</div> | |||
<div class="layui-card-body"> | |||
<div class="d-flex"> | |||
@@ -353,18 +351,18 @@ | |||
<div class="div-info-label">客户端版本:</div> | |||
<div class="div-info-value">${nvl(device.pads[0].deviceExt.appVer,"暂无")}</div> | |||
<% if(apkPackage.version>nvl(device.pads[0].deviceExt.appVer,"")) { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="${ctx}/sys/device/version"><i class="fa fa-hand-pointer-o fz16"></i></a></div> | |||
<!--<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="${ctx}/sys/device/version"><i class="fa fa-hand-pointer-o fz16"></i></a></div>--> | |||
<% } else { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-info" flag="false">最新版</span></div> | |||
<% } %> | |||
</div> | |||
<div class="d-flex"> | |||
<div class="div-info-label">GCU版本:</div> | |||
<div class="div-info-value">${nvl(device.gcus[1].deviceExt.mtcVersion,"暂无")}</div> | |||
<% if(gcuPackage.version>nvl(device.gcus[0].deviceExt.mtcVersion,"")) { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="#" onclick=openPage("终端更新","${ctx}/sys/device/version",1)><i class="fa fa-hand-pointer-o fz16"></i></a></div> | |||
<div class="div-info-value">${nvl(device.gcus[1].deviceExtGcu.mtcVersion,"暂无")}</div> | |||
<% if(gcuPackage.version>nvl(device.gcus[0].deviceExtGcu.mtcVersion,"")) { %> | |||
<!--<div class="div-info-status"><span class="remote-status-btn bg-yellow" flag="false">可升级</span> <a href="#" onclick=openPage("终端更新","${ctx}/sys/device/version",1)><i class="fa fa-hand-pointer-o fz16"></i></a></div>--> | |||
<% } else { %> | |||
<div class="div-info-status"><span class="remote-status-btn bg-info" flag="false">最新版</span></div> | |||
<div class="d iv-info-status"><span class="remote-status-btn bg-info" flag="false">最新版</span></div> | |||
<% } %> | |||
</div> | |||
<div class="d-flex"> | |||
@@ -390,10 +388,13 @@ | |||
<div class="layui-input-block"> | |||
<span class="remote-action-btn bg-green" act="enterOpen" flag="false"><img src="${ctxStatic}/images/open.png"/> 进开门</span> | |||
<span class="remote-action-btn bg-green" act="leaveOpen" flag="false"><img src="${ctxStatic}/images/open.png"/> 出开门</span> | |||
<span class="remote-action-btn bg-red" act="clear" flag="false"><i class="fa fa-trash-o"></i> 清空授权</span> | |||
<span class="remote-action-btn bg-yellow" act="padRestart" flag="false"><i class="fa fa-repeat"></i> PAD重启</span> | |||
<!--<span class="remote-action-btn bg-red" act="clear" flag="false"><i class="fa fa-trash-o"></i> 清空授权</span>--> | |||
<!--<span class="remote-action-btn bg-yellow" act="appRestart" flag="false"><i class="fa fa-repeat"></i> APP重启</span>--> | |||
<span class="remote-action-btn bg-yellow" act="gcuRestart" flag="false"><i class="fa fa-repeat"></i> GCU重启</span> | |||
<span class="remote-action-btn bg-gray" act="shutdown" flag="false"><i class="fa fa-power-off"></i> 关机</span> | |||
<span class="remote-action-btn bg-gray" act="padRestart" flag="false"><i class="fa fa-power-off"></i> PAD重启</span> | |||
<span class="remote-action-btn bg-gray" act="netAdbOpen" flag="false"></i> ADB开启</span> | |||
<span class="remote-action-btn bg-gray" act="netAdbClose" flag="false"></i> ADB关闭</span> | |||
<span class="refresh-btn bg-red2" flag="false"></i> 刷新</span> | |||
</div> | |||
</div> | |||
@@ -401,83 +402,115 @@ | |||
<label class="layui-form-label" style="padding: 2px 0;"><i class="layui-icon" style="font-size: 16px;color: #272727;"></i> 设置</label> | |||
<div class="layui-input-block row pl0"> | |||
<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">进门状态:</div> | |||
<div class="col-sm-4 pr0 pl0">通行模式:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="inMode" id="in-mode" lay-verify="required"> | |||
<option value="60">正常验证</option> | |||
<option value="60">维护模式</option> | |||
<option value="120">触发通行</option> | |||
<option value="180">单向禁行</option> | |||
<select name="workMode" id="work-mode" lay-verify="required"> | |||
<option value="0" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.workMode) && @StringUtils.equals(device.deviceExtGate.workMode, "0")){ %> selected <%} %> >正常验证</option> | |||
<option value="1" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.workMode) && @StringUtils.equals(device.deviceExtGate.workMode, "1")){ %> selected <%} %>>常开进</option> | |||
<option value="3" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.workMode) && @StringUtils.equals(device.deviceExtGate.workMode, "3")){ %> selected <%} %>>常开出</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<!--<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">进门速度:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="inSpeed" id="in-speed" lay-verify="required"> | |||
<option value="60">快</option> | |||
<option value="120">中</option> | |||
<option value="180">正常</option> | |||
<option value="1">快</option> | |||
<option value="2">中</option> | |||
<option value="0">正常</option> | |||
</select> | |||
</div> | |||
</div>--> | |||
<div class="my-select col-sm-3 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">进门禁行:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="inDirClose" id="in-dir-close" lay-verify="required" lay-filter="in-dir-close"> | |||
<option value="0" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.dirClose) && (@StringUtils.equals(device.deviceExtGate.dirClose, "00")||@StringUtils.equals(device.deviceExtGate.dirClose, "10"))){ %> selected <%} %>>关闭</option> | |||
<option value="1" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.dirClose) && (@StringUtils.equals(device.deviceExtGate.dirClose, "01")||@StringUtils.equals(device.deviceExtGate.dirClose, "11"))){ %> selected <%} %>>开启</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select col-sm-3 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">出门模式:</div> | |||
<div class="col-sm-4 pr0 pl0">出门禁行:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="outMode" id="out-mode" lay-verify="required"> | |||
<option value="1">正常验证</option> | |||
<option value="2">触发通行</option> | |||
<option value="3">维护模式</option> | |||
<option value="4">单向禁行</option> | |||
<select name="outDirClose" id="out-dir-close" lay-verify="required" lay-filter="out-dir-close"> | |||
<option value="0" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.dirClose) && (@StringUtils.equals(device.deviceExtGate.dirClose, "00")||@StringUtils.equals(device.deviceExtGate.dirClose, "01"))){ %> selected <%} %>>关闭</option> | |||
<option value="1" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.dirClose) && (@StringUtils.equals(device.deviceExtGate.dirClose, "10")||@StringUtils.equals(device.deviceExtGate.dirClose, "11"))){ %> selected <%} %>>开启</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="my-select col-sm-3 pl0 " style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">触发通行:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="triggerMode" id="trigger-mode" lay-verify="required" lay-filter="trigger-mode"> | |||
<option value="00" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.triggerMode) && @StringUtils.equals(device.deviceExtGate.triggerMode, "00")){ %> selected <%} %>>关闭</option> | |||
<option value="01" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.triggerMode) && (@StringUtils.equals(device.deviceExtGate.triggerMode, "01"))){ %> selected <%} %>>进门开</option> | |||
<option value="10" <% if(@ObjectUtils.anyNotNull(device.deviceExtGate) && @ObjectUtils.anyNotNull(device.deviceExtGate.triggerMode) && (@StringUtils.equals(device.deviceExtGate.triggerMode, "10"))){ %> selected <%} %>>出门开</option> | |||
</select> | |||
</div> | |||
</div> | |||
<!--<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">出门速度:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="outSpeed" id="out-speed" lay-verify="required" size="30"> | |||
<option value="60">快</option> | |||
<option value="120">中</option> | |||
<option value="180">正常</option> | |||
<option value="1">快</option> | |||
<option value="2">中</option> | |||
<option value="0">正常</option> | |||
</select> | |||
</div> | |||
</div> | |||
</div>--> | |||
</div> | |||
<div class="layui-input-block row pl0 pt0"> | |||
<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<!--<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">通行方式:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="passQueMode" id="pass-que-mode" lay-verify="required"> | |||
<option value="1">一人一闸</option> | |||
<option value="0">排队</option> | |||
<option value="11">一人一闸</option> | |||
<option value="00">排队</option> | |||
</select> | |||
</div> | |||
</div> | |||
</div>--> | |||
<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">双向同时授权:</div> | |||
<div CLASS="col-sm-5 pl0"> | |||
<select name="doubleDirAuth" id="double-dir-auth" lay-verify="required"> | |||
<option value="1">开启</option> | |||
<option value="0">关闭</option> | |||
<!-- <div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">逆行关门:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="reverseClose" id="reverse-close" lay-verify="required"> | |||
<option value="11">开启</option> | |||
<option value="00">关闭</option> | |||
</select> | |||
</div> | |||
</div> | |||
</div>--> | |||
<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">逆行关门:</div> | |||
<!--<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-4 pr0 pl0">尾随关门:</div> | |||
<div CLASS="col-sm-6 pl0"> | |||
<select name="reverseClose" id="reverse-close" lay-verify="required"> | |||
<select name="tailClose" id="tail-close" lay-verify="required"> | |||
<option value="11">开启</option> | |||
<option value="00">关闭</option> | |||
</select> | |||
</div> | |||
</div>--> | |||
<!--<div class="my-select col-sm-3 pl0 pb3" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">双向同时授权:</div> | |||
<div CLASS="col-sm-5 pl0"> | |||
<select name="doubleDirAuth" id="double-dir-auth" lay-verify="required"> | |||
<option value="1">开启</option> | |||
<option value="0">关闭</option> | |||
</select> | |||
</div> | |||
</div> | |||
</div>--> | |||
</div> | |||
</div> | |||
@@ -502,7 +535,14 @@ | |||
<div class="form-group"> | |||
<label class="control-label">类型:</label> | |||
<div class="control-inline" style="width: 140px !important;"> | |||
<#form:select path="eventCode" readonly="true" items="${logTypes}" itemLabel="name" itemValue="code" blankOption="true" blankOptionLabel="全部类型" class="form-control" style="height:28px;width:100px;"/> | |||
<#form:select path="eventCode" readonly="true" items="${logTypes}" itemLabel="name" itemValue="hexCode" blankOption="true" blankOptionLabel="全部类型" class="form-control" style="height:28px;width:100px;"/> | |||
</div> | |||
</div> | |||
<div class="form-group"> | |||
<label class="control-label">日志级别:</label> | |||
<div class="control-inline" style="width: 140px !important;"> | |||
<#form:select path="level" dictType="sys_log_level_type" class="form-control required " /> | |||
</div> | |||
</div> | |||
@@ -580,16 +620,16 @@ | |||
}); | |||
}) | |||
function renderTable(code, timePart){ | |||
function renderTable(code, timePart, level){ | |||
var width = $(".layui-show").width() - 40; | |||
console.log(width); | |||
layui.use('table', function(){ | |||
var table = layui.table; | |||
table.render({ | |||
elem: '#dataGrid', | |||
url:"${ctx}/sys/gateEvent/listData?deviceId=${device.deviceId}&eventCode="+code+"&timePart="+timePart, //获取数据的接口 | |||
url:"${ctx}/sys/gateEvent/listData?deviceId=${device.deviceId}&eventCode="+code+"&timePart="+timePart+"&level="+level, //获取数据的接口 | |||
width:width, | |||
height:450, | |||
height:480, | |||
cellMinWidth: 'auto', | |||
page:true, | |||
request: {pageName:"pageNo", limitName:"pageSize"}, | |||
@@ -615,7 +655,10 @@ | |||
,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据 | |||
console.log(res); | |||
for (var i=0;i<res.list.length;i++) { | |||
res.list[i].eventName = res.list[i].deviceEventType.name; | |||
res.list[i].eventName = "未知"; | |||
if (res.list[i].deviceEventType && res.list[i].deviceEventType.name) { | |||
res.list[i].eventName = res.list[i].deviceEventType.name; | |||
} | |||
} | |||
console.log(res); | |||
return { | |||
@@ -639,22 +682,52 @@ | |||
$(document).ready(function () { | |||
// select下拉框选中触发事件 | |||
form.on("select", function (data) { | |||
if("${device.devStatus}" == 2 || !(${device.pads[0].isOnline} || ${device.pads[1].isOnline})) {//短线 | |||
layer.alert("闸机PAD处于离线状态,暂时不可进行此操作!"); | |||
return; | |||
} | |||
var actStatus = ""; | |||
var actValue = ""; | |||
if (data.value != "") { | |||
actValue = data.value; | |||
if (data.elem.id == "in-mode") { | |||
actStatus = "inMode"; | |||
if (data.elem.id == "work-mode") { | |||
actStatus = "workMode"; | |||
} else if (data.elem.id == "in-speed") { | |||
actStatus = "inSpeed"; | |||
} else if (data.elem.id == "out-mode") { | |||
actStatus = "outMode"; | |||
} else if (data.elem.id == "out-speed") { | |||
actStatus = "outSpeed"; | |||
} else if (data.elem.id == "in-dir-close") { | |||
actStatus = "dirClose"; | |||
var out = $("#out-dir-close").val(); | |||
actValue = out + actValue; | |||
} else if (data.elem.id == "out-dir-close") { | |||
actStatus = "dirClose"; | |||
var inVal = $("#in-dir-close").val(); | |||
actValue = actValue + inVal; | |||
} else if (data.elem.id == "pass-que-mode") { | |||
actStatus = "passQueMode"; | |||
} else if (data.elem.id == "reverse-close") { | |||
actStatus = "reverseClose"; | |||
} else if (data.elem.id == "trigger-mode") { | |||
if(actValue == "01") { | |||
var inDoor = $("#in-dir-close").val(); | |||
if (inDoor == "1") { | |||
layer.alert("请先关闭进门禁行"); | |||
return; | |||
} | |||
} else if(actValue == "10") { | |||
var outDoor = $("#out-dir-close").val(); | |||
if (outDoor == "1") { | |||
layer.alert("请先关闭出门禁行"); | |||
return; | |||
} | |||
} | |||
actStatus = "triggerMode"; | |||
} else if (data.elem.id == "double-dir-auth") { | |||
actStatus = "doubleDirAuth"; | |||
} | |||
@@ -666,7 +739,6 @@ | |||
for (var i = 0; i < devs.length; i ++) { | |||
idData.push(devs[i]); | |||
} | |||
console.log(idData); | |||
js.ajaxSubmit("${ctx}/sys/device/remoteConfig?___t=" + new Date().getTime(), {actStatus:actStatus,actValue:actValue, devs:idData}, function(data){ | |||
layer.alert(data.message) | |||
}, null, null, js.text('loading.message')); | |||
@@ -727,32 +799,45 @@ | |||
$(function() { | |||
var timePart = $("#ipt-start-time2").val(); | |||
renderTable("", timePart); | |||
renderTable("0001", timePart, 2); | |||
$('#eventCode').val('0001').trigger('change'); | |||
$('#level').val('2').trigger('change'); | |||
$(document).on("click", "#queryBtn", function(){ | |||
var timePart = $("#ipt-start-time2").val(); | |||
var eventCode = $("#eventCode").val(); | |||
renderTable(eventCode, timePart); | |||
var level = $("#level").val(); | |||
renderTable(eventCode, timePart, level); | |||
}) | |||
$(document).on("click",".remote-action-btn", function (){ | |||
console.log(${device.pads[0].isOnline}); | |||
console.log(${device.pads[1].isOnline}); | |||
if("${device.devStatus}" == 2 || !(${device.pads[0].isOnline} || ${device.pads[1].isOnline})) {//短线 | |||
layer.alert("闸机PAD处于离线状态,暂时不可进行此操作!"); | |||
return; | |||
} | |||
var deviceId = "${device.deviceId}"; | |||
var devs = [deviceId]; | |||
var act = $(this).attr("act"); | |||
console.log(devs); | |||
var idData = []; | |||
for (var i = 0; i < devs.length; i ++) { | |||
idData.push(devs[i]); | |||
} | |||
console.log(idData); | |||
js.ajaxSubmit("${ctx}/sys/device/remoteHandle?___t=" + new Date().getTime(), {act:act, devs:idData}, function(data){ | |||
layer.alert(data.message) | |||
}, null, null, js.text('loading.message')); | |||
}) | |||
$(document).on("click",".refresh-btn", function (){ | |||
window.location.reload(); | |||
}) | |||
}) | |||
</script> |
@@ -229,6 +229,20 @@ | |||
color: white; | |||
} | |||
.div-item { | |||
height: 25px; | |||
line-height: 25px; | |||
padding-left: 25px; | |||
} | |||
.div-item label{ | |||
padding-right: 5px; | |||
} | |||
.div-item input[type=checkbox] { | |||
margin-top: 6px; | |||
} | |||
</style> | |||
<div class="main-content"> | |||
<div class="box box-main"> | |||
@@ -245,10 +259,10 @@ | |||
<div class="layui-input-block"> | |||
<span class="remote-action-btn bg-green" act="enterOpen" flag="false"><img src="${ctxStatic}/images/open.png"/> 进开门</span> | |||
<span class="remote-action-btn bg-green" act="leaveOpen" flag="false"><img src="${ctxStatic}/images/open.png"/> 出开门</span> | |||
<span class="remote-action-btn bg-red" act="clear" flag="false"><i class="fa fa-trash-o"></i> 清空授权</span> | |||
<span class="remote-action-btn bg-yellow" act="padRestart" flag="false"><i class="fa fa-repeat"></i> PAD重启</span> | |||
<!--<span class="remote-action-btn bg-red" act="clear" flag="false"><i class="fa fa-trash-o"></i> 清空授权</span> --> | |||
<!--<span class="remote-action-btn bg-yellow" act="appRestart" flag="false"><i class="fa fa-repeat"></i> APP重启</span>--> | |||
<span class="remote-action-btn bg-yellow" act="gcuRestart" flag="false"><i class="fa fa-repeat"></i> GCU重启</span> | |||
<span class="remote-action-btn bg-gray" act="shutdown" flag="false"><i class="fa fa-power-off"></i> 关机</span> | |||
<span class="remote-action-btn bg-gray" act="padRestart" flag="false"><i class="fa fa-power-off"></i> PAD重启</span> | |||
</div> | |||
</div> | |||
@@ -256,56 +270,75 @@ | |||
<label class="layui-form-label" style="padding: 2px 0;"><i class="layui-icon" style="font-size: 16px;color: #272727;"></i> 设置</label> | |||
<div class="layui-input-block row pl0"> | |||
<div class="my-select-div col-sm-2 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">进门模式:</div> | |||
<div class="col-sm-5 pr0 pl0">通行模式:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="inMode" id="in-mode" lay-verify="required" lay-filter="in-mode"> | |||
<option value="1">正常验证</option> | |||
<option value="2">触发通行</option> | |||
<option value="3">维护模式</option> | |||
<option value="4">单向禁行</option> | |||
<select class="my-select" name="workMode" id="work-mode" lay-verify="required" lay-filter="work-mode"> | |||
<option value="0">正常验证</option> | |||
<option value="1">常开</option> | |||
<option value="3">常开(反)</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select-div col-sm-2 pl0" style="line-height: 25px;"> | |||
<!--<div class="my-select-div col-sm-2 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">进门速度:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="inSpeed" id="in-speed" lay-verify="required" lay-filter="in-speed"> | |||
<option value="60">快</option> | |||
<option value="120">中</option> | |||
<option value="180">正常</option> | |||
<option value="1">快</option> | |||
<option value="2">中</option> | |||
<option value="0">正常</option> | |||
</select> | |||
</div> | |||
</div>--> | |||
<div class="my-select-div col-sm-2 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">进门禁行:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="inDirClose" id="in-dir-close" lay-verify="required" lay-filter="in-dir-close"> | |||
<option value="0">关闭</option> | |||
<option value="1">开启</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select-div col-sm-2 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">出门状态:</div> | |||
<div class="col-sm-5 pr0 pl0">出门禁行:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="outMode" id="out-mode" lay-verify="required" lay-filter="out-mode"> | |||
<option value="1">正常验证</option> | |||
<option value="2">触发通行</option> | |||
<option value="3">维护模式</option> | |||
<option value="4">单向禁行</option> | |||
<select class="my-select" name="outDirClose" id="out-dir-close" lay-verify="required" lay-filter="out-dir-close"> | |||
<option value="0">关闭</option> | |||
<option value="1">开启</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select-div col-sm-2 pl0 " style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">触发通行:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="triggerMode" id="trigger-mode" lay-verify="required" lay-filter="trigger-mode"> | |||
<option value="00">关闭</option> | |||
<option value="01">进门开</option> | |||
<option value="10">出门开</option> | |||
</select> | |||
</div> | |||
</div> | |||
<!--<div class="my-select-div col-sm-2 pl0 " style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">出门速度:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="outSpeed" id="out-speed" lay-verify="required" size="30" lay-filter="out-speed"> | |||
<option value="60" selected="selected">快</option> | |||
<option value="120">中</option> | |||
<option value="180">正常</option> | |||
<option value="1" selected="selected">快</option> | |||
<option value="2">中</option> | |||
<option value="0">正常</option> | |||
</select> | |||
</div> | |||
</div> | |||
</div>--> | |||
</div> | |||
<div class="layui-input-block row pl0 pt0"> | |||
<div class="my-select-div col-sm-2 pl0 " style="line-height: 25px;"> | |||
<!--<div class="my-select-div col-sm-2 pl0 " style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">通行方式:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select class="my-select" name="passQueMode" id="pass-que-mode" lay-verify="required" lay-filter="pass-que-mode"> | |||
@@ -323,6 +356,16 @@ | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select-div col-sm-2 pl0" style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">尾随关门:</div> | |||
<div CLASS="col-sm-7 pl0"> | |||
<select name="tailClose" id="tail-close" lay-verify="required" lay-filter="tail-close"> | |||
<option value="11">开启</option> | |||
<option value="00">关闭</option> | |||
</select> | |||
</div> | |||
</div> | |||
<div class="my-select-div col-sm-3 pl0 " style="line-height: 25px;"> | |||
<div class="col-sm-5 pr0 pl0">双向同时授权:</div> | |||
<div CLASS="col-sm-4 pl0"> | |||
@@ -331,7 +374,7 @@ | |||
<option value="0">关闭</option> | |||
</select> | |||
</div> | |||
</div> | |||
</div>--> | |||
</div> | |||
</div> | |||
@@ -375,12 +418,14 @@ | |||
<div class="layui-card-header"> | |||
<#form:form id="searchForm" model="${device}" style="float:right;width:100%;" | |||
action="${ctx}/sys/device/gate/list" method="get" class=""> | |||
<#form:hidden path="deviceType" maxlength="100" class="form-control" style="height:40px;"/> | |||
<#form:hidden path="groupCode" maxlength="100" class="form-control" style="height:40px;"/> | |||
<#form:hidden path="area" maxlength="100" class="form-control" style="height:40px;"/> | |||
<#form:hidden path="devStatus" maxlength="100" class="form-control" style="height:40px;"/> | |||
<div class="control-inline" style="width:120px;padding-top: 8px;display: flex;"> | |||
<#form:hidden path="deviceType" /> | |||
<#form:hidden path="groupCode" /> | |||
<#form:hidden path="area" /> | |||
<#form:hidden path="devStatus" /> | |||
<#form:hidden path="flushSec" /> | |||
<#form:hidden path="ableFlush" /> | |||
<div class="control-inline" style="padding-top: 8px;display: flex;"> | |||
<input type="text" name="deviceName" class="layui-input deviceName" placeholder="请输入设备名称" style="height: 28px !important;width: 120px;" readonly onfocus="this.removeAttribute('readonly');" value="${device.deviceName}" autocomplete="off" /> | |||
<div class="search-div query-dev-name-div"> | |||
<i class="fa fa-search query-dev-name-btn"></i> | |||
@@ -389,9 +434,18 @@ | |||
<span class="remote-status-btn bg-info <% | |||
if (!@ObjectUtils.anyNotNull(device.devStatus) || (@ObjectUtils.anyNotNull(device.devStatus) && @StringUtils.equals(device.devStatus, ''))) {%>bg-current <% } %>" flag="false" value="">全部</span> | |||
<span class="remote-status-btn bg-green2 <% if (@ObjectUtils.anyNotNull(device.devStatus) && @StringUtils.equals(device.devStatus, '0')) {%>bg-current <% } %>" flag="false" value="0">正常</span> | |||
<span class="remote-status-btn bg-yellow2 <% if (@ObjectUtils.anyNotNull(device.devStatus) && @StringUtils.equals(device.devStatus, '1')) {%>bg-current <% } %>" flag="false" value="1">异常</span> | |||
<span class="remote-status-btn bg-yellow2 <% if ((@ObjectUtils.anyNotNull(device.devStatus) && @StringUtils.equals(device.devStatus, '1'))) {%>bg-current <% } %>" flag="false" value="1">异常</span> | |||
<span class="remote-status-btn bg-red2 <% if (@ObjectUtils.anyNotNull(device.devStatus) && @StringUtils.equals(device.devStatus, '2')) {%>bg-current <% } %>" flag="false" value="2">离线</span> | |||
<span class="remote-status-btn bg-gray2 <% if (@ObjectUtils.anyNotNull(device.devStatus) && @StringUtils.equals(device.devStatus, '3')) {%>bg-current <% } %>" flag="false" value="3">故障</span> | |||
<div class="d-flex div-item"><label>定时刷新</label><input type="checkbox" name="enableFlush" id="enableFlush" <% if(ableFlush==1){ %> checked <% } %>></div> | |||
<div class="d-flex div-item"> | |||
<label>定时刷新间隔</label><select class="my-select" name="flushOffset" id="flushOffset" lay-filter="flushOffset"> | |||
<option value="10000" <% if(flushSec==10000){ %> selected <% } %>>10秒</option> | |||
<option value="5000" <% if(flushSec==5000){ %> selected <% } %>>5秒</option> | |||
<option value="30000" <% if(flushSec==30000){ %> selected <% } %>>30秒</option> | |||
<option value="60000" <% if(flushSec==60000){ %> selected <% } %>>60秒</option> | |||
</select></div> | |||
</div> | |||
</div> | |||
</#form:form> | |||
@@ -402,13 +456,25 @@ | |||
if (!isEmpty(devs)){ | |||
for(var dev in devs){ %> | |||
<div class="col-sm-3 pb-15 div-panel"> | |||
<div class="col-sm-12 item-gate bg-green"> | |||
<% if(@ObjectUtils.anyNotNull(dev.devStatus) && @StringUtils.equals(dev.devStatus,"0")) { %> | |||
<div class="col-sm-12 item-gate bg-green"> | |||
<% } else if(@ObjectUtils.anyNotNull(dev.devStatus) && (@StringUtils.equals(dev.devStatus,"2"))) {%> | |||
<div class="col-sm-12 item-gate bg-red2"> | |||
<% } else {%> | |||
<div class="col-sm-12 item-gate bg-yellow2"> | |||
<% } %> | |||
<div class="col-xs-7 item-gate-base-info"> | |||
<div> | |||
<img class="item-gate-img" src="/static/images/gate.png"> | |||
<p class="item-gate-name">${dev.deviceName}</p></div> | |||
</div> | |||
<% if(@StringUtils.equals(dev.devStatus,"0")) {%> | |||
<div class="col-xs-3 item-gate-status pl0 pr0">状态正常 | |||
<% } else if(@StringUtils.equals(dev.devStatus,"2")) {%> | |||
<div class="col-xs-3 item-gate-status pl0 pr0">设备离线 | |||
<% } else { %> | |||
<div class="col-xs-3 item-gate-status pl0 pr0">设备异常 ${(isNotEmpty(dev.deviceExtGate) && isNotEmpty(dev.deviceExtGate.devErr) && !(@NumberUtils.isParsable(dev.deviceExtGate.devErr) && @Integer.parseInt(dev.deviceExtGate.devErr)==0))?"异常码:"+dev.deviceExtGate.devErr:(@StringUtils.equals(dev.devStatus,"3")?"设备未激活":"未知异常" )} | |||
<% } %> | |||
</div> | |||
<div class="col-xs-2 item-gate-checkbox"><input type="checkbox" value="${dev.deviceId}" name="devs"></div> | |||
</div> | |||
@@ -644,6 +710,43 @@ | |||
</style> | |||
<script> | |||
var devs = $('input:checkbox[name="devs"]:checked'); | |||
var flush = ${ableFlush}; | |||
var flushOffset = ${flushSec}; | |||
$(":checkbox[name='devs']").on("change",function(){ | |||
devs = $('input:checkbox[name="devs"]:checked'); | |||
}); | |||
$(":checkbox[name='enableFlush']").on("change",function(){ | |||
var obj = $('input:checkbox[name="enableFlush"]:checked'); | |||
if (obj.length > 0) { | |||
flush = 1; | |||
$("#ableFlush").val( 1) | |||
} else { | |||
$("#ableFlush").val(0); | |||
} | |||
$("#searchForm").submit(); | |||
}); | |||
$("#flushOffset").on("change",function(){ | |||
flushOffset = Number($("#flushOffset").val()); | |||
$("#flushSec").val(flushOffset) | |||
window.clearInterval(interval); | |||
$("#searchForm").submit(); | |||
}); | |||
function myrefresh() { | |||
console.log(flush); | |||
console.log(flushOffset); | |||
if (devs.length==0 && flush == 1) { | |||
window.location.reload(); | |||
} | |||
} | |||
var interval = setInterval(myrefresh, flushOffset); | |||
var node_count = 0, nodes = [], ind=1; | |||
@@ -752,31 +855,44 @@ | |||
$(document).ready(function () { | |||
// select下拉框选中触发事件 | |||
form.on("select", function (data) { | |||
if (!devs.length > 0) { | |||
layer.alert("您尚未选择要操作的设备!") | |||
return; | |||
} | |||
var actStatus = ""; | |||
var actValue = ""; | |||
if (data.value != "") { | |||
actValue = data.value; | |||
if (data.elem.id == "in-mode") { | |||
actStatus = "inMode"; | |||
if (data.elem.id == "work-mode") { | |||
actStatus = "workMode"; | |||
} else if (data.elem.id == "in-speed") { | |||
actStatus = "inSpeed"; | |||
} else if (data.elem.id == "out-mode") { | |||
actStatus = "outMode"; | |||
} else if (data.elem.id == "out-speed") { | |||
actStatus = "outSpeed"; | |||
} else if (data.elem.id == "in-dir-close") { | |||
actStatus = "dirClose"; | |||
var out = $("#out-dir-close").val(); | |||
actValue = out + actValue; | |||
console.log(out); | |||
} else if (data.elem.id == "out-dir-close") { | |||
actStatus = "dirClose"; | |||
var inVal = $("#in-dir-close").val(); | |||
actValue = actValue + inVal; | |||
console.log(out); | |||
} else if (data.elem.id == "pass-que-mode") { | |||
actStatus = "passQueMode"; | |||
} else if (data.elem.id == "reverse-close") { | |||
actStatus = "reverseClose"; | |||
} else if (data.elem.id == "trigger-mode") { | |||
actStatus = "triggerMode"; | |||
} else if (data.elem.id == "double-dir-auth") { | |||
actStatus = "doubleDirAuth"; | |||
} | |||
} | |||
var devs = $('input:checkbox[name="devs"]:checked'); | |||
if (!devs.length > 0) { | |||
layer.alert("您尚未选择要操作的设备!") | |||
return; | |||
} | |||
var idData = []; | |||
for (var i = 0; i < devs.length; i ++) { | |||
//利用三元运算符去点 | |||
@@ -813,6 +929,13 @@ | |||
} | |||
}) | |||
$(document).on("click", ".query-dev-name-div", function () { | |||
var deviceName = $(".deviceName").val(); | |||
if (deviceName!="") { | |||
$("#searchForm").submit(); | |||
} | |||
}) | |||
$(document).on("click", ".remote-status-btn", function () { | |||
if ($(this).hasClass("bg-current")) { | |||
@@ -173,6 +173,15 @@ | |||
</div> | |||
</div> | |||
</div> | |||
<div class="col-xs-3"> | |||
<div class="form-group"> | |||
<div class="col-sm-7 add-delete-btn"> | |||
<span class="required">*</span><p>位置</p> | |||
<i class="layui-icon reset_input" ></i> | |||
<#form:input path="address" maxlength="100" class="form-control required "/> | |||
</div> | |||
</div> | |||
</div> | |||
<!--<div class="col-xs-3"> | |||
<div class="form-group"> | |||
<div class="col-sm-7 calendar_input"> | |||
@@ -66,49 +66,47 @@ | |||
margin-right: 23px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(2){ | |||
width: 166px; | |||
width: 168px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(3){ | |||
width: 166px; | |||
width: 168px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(4){ | |||
width: 166px; | |||
width: 168px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(5){ | |||
width: 166px; | |||
width: 168px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(6){ | |||
width: 166px; | |||
width: 168px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(7){ | |||
width: 168px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(7){ | |||
width: 268px; | |||
} | |||
#searchForm { | |||
padding-left: 10px; | |||
} | |||
.d-flex{ | |||
display: flex !important; | |||
} | |||
</style> | |||
<div class="main-content"> | |||
<div class="box box-main"> | |||
<div class="box-body"> | |||
<div class="box-tools pull-left"> | |||
<% if(hasPermi("sys:device:add")) { %> | |||
<!-- <button id="addDevice" class="button black center" title="新增设备" style="margin-left:0">新增设备</button>--> | |||
<% } %> | |||
</div> | |||
<div class="pull-right"> | |||
<div class="form-group"> | |||
<% if(hasPermi("sys:device:delete") || hasPermi('sys:password:edit')) { %> | |||
<!--<button type="" id="control_deal" class="button red center">管理</button>--> | |||
<% } %> | |||
<!-- <button type="" id="control_refresh" class="button red center" onclick=refresh()>刷新</button>--> | |||
</div> | |||
</div> | |||
<#form:form id="searchForm" model="${device}" style="float:right;" | |||
action="${ctx}/sys/device/listData" method="post" class="" | |||
<#form:form id="searchForm" model="${device}" | |||
action="${ctx}/sys/device/listData" method="post" class="d-flex" | |||
data-page-no="${parameter.pageNo}" | |||
data-page-size="${parameter.pageSize}" | |||
data-order-by="${parameter.orderBy}"> | |||
@@ -131,11 +129,33 @@ | |||
</div> | |||
<div class="form-group"> | |||
<div class="control-inline"> | |||
<#form:hidden path="deviceName" maxlength="100" class="form-control" style="height:40px;"/> | |||
<div class="control-inline" style="width: 180px !important;"> | |||
<#form:input path="deviceName" class="form-control" style="height:28px;width:180px;" placeholder="设备号或设备名称或地址"/> | |||
</div> | |||
</div> | |||
<div class="form-group last-form-group"> | |||
<button id="queryBtn" type="submit" class="button bg-black center" style=" margin-right: 8px;padding: 4px 23px;font-size: 14px;">查询</button> | |||
</div> | |||
</#form:form> | |||
<div class="box-tools pull-left"> | |||
<% if(hasPermi("sys:device:add")) { %> | |||
<!-- <button id="addDevice" class="button black center" title="新增设备" style="margin-left:0">新增设备</button>--> | |||
<% } %> | |||
</div> | |||
<div class="pull-right"> | |||
<div class="form-group"> | |||
<% if(hasPermi("sys:device:delete") || hasPermi('sys:password:edit')) { %> | |||
<!--<button type="" id="control_deal" class="button red center">管理</button>--> | |||
<% } %> | |||
<!-- <button type="" id="control_refresh" class="button red center" onclick=refresh()>刷新</button>--> | |||
</div> | |||
</div> | |||
<div class="table_box"> | |||
<table id="dataGrid"></table> | |||
@@ -178,7 +198,7 @@ | |||
function refresh(){ | |||
location.reload(); | |||
} | |||
$(function() { | |||
$('#addDevice').click(function(){ | |||
@@ -214,24 +234,24 @@ | |||
index : 'a.address', | |||
width : 50, | |||
align : "left" | |||
},{ | |||
} | |||
,{ | |||
header : '对应闸机', | |||
name : 'parentId', | |||
index : 'a.parent_id', | |||
width : 50, | |||
align : "left" | |||
}, | |||
{ | |||
header : '设备状态', | |||
name : 'online', | |||
index : 'a.online', | |||
},{ | |||
header : 'GCU版本', | |||
name : 'deviceExtGcu.mtcVersion', | |||
width : 50, | |||
align : "left", | |||
formatter: function(val, obj, row, act){ | |||
return val?'<span style="color:green;">在线</span>':'<span style="color:orangered;">离线</span>'; | |||
return val!=undefined?val:"未知"; | |||
} | |||
}, | |||
/*{ | |||
header : '密码有效期', | |||
name : 'expireTime', | |||
@@ -249,11 +269,11 @@ | |||
formatter : function(val, obj, row, act) { | |||
var actions = []; | |||
actions.push('<a onclick=openPage("编辑设备","${ctx}/sys/device/form/${device.deviceType}?id=' + row.deviceId + '","2")>编辑</a> '); | |||
/* actions.push('<a onclick=openPage("编辑设备","${ctx}/sys/device/form/${device.deviceType}?id=' + row.deviceId + '","2")>编辑</a> '); | |||
<% if(hasPermi("sys:device:delete")) { %> | |||
actions.push('<a onclick=deleteRow("${ctx}/sys/device/delete?id='+ row.deviceId +'") >删除</a> '); | |||
<% } %> | |||
<% } %>*/ | |||
return actions.join(''); | |||
} | |||
} ], | |||
@@ -1,12 +1,52 @@ | |||
<% layout('/layouts/default.html', {title: '设备列表', libs: | |||
['dataGrid','fileupload'], bodyClass: ''}){ %> | |||
<style> | |||
.d-flex{ | |||
display: flex !important; | |||
} | |||
</style> | |||
<div class="main-content"> | |||
<div class="box box-main"> | |||
<div class="box-body"> | |||
<div class="box-tools pull-left"> | |||
<% if(hasPermi("sys:device:add")) { %> | |||
<!-- <button id="addDevice" class="button black center" title="新增设备" style="margin-left:0">新增设备</button>--> | |||
<% } %> | |||
<#form:form id="searchForm" model="${device}" | |||
action="${ctx}/sys/device/listData" method="post" class="d-flex" | |||
data-page-no="${parameter.pageNo}" | |||
data-page-size="${parameter.pageSize}" | |||
data-order-by="${parameter.orderBy}"> | |||
<#form:hidden path="deviceType" maxlength="100" class="form-control" style="height:40px;"/> | |||
<div class="form-group"> | |||
<div id="dealIsshow"> | |||
<% if(hasPermi("sys:device:delete")) { %> | |||
<!--<div class="form-group pull-left">--> | |||
<a class="deal_a" href="javascript:;" id="delete-select" style="margin-right:20px;">删除</a> | |||
<!--</div>--> | |||
<% } %> | |||
<% if(hasPermi('sys:password:edit')){ %> | |||
<!--<div class="form-group pull-left">--> | |||
<a class="deal_a" href="javascript:;" id="change-psd-select">修改密码</a> | |||
<!--</div>--> | |||
<% } %> | |||
</div> | |||
</div> | |||
<div class="form-group"> | |||
<div class="control-inline" style="width: 180px !important;"> | |||
<#form:input path="deviceName" class="form-control" style="height:28px;width:180px;" placeholder="设备号或设备名称或地址"/> | |||
</div> | |||
</div> | |||
<div class="form-group last-form-group"> | |||
<button id="queryBtn" type="submit" class="button bg-black center" style=" margin-right: 8px;padding: 4px 23px;font-size: 14px;">查询</button> | |||
</div> | |||
</#form:form> | |||
</div> | |||
<div class="pull-right"> | |||
<div class="form-group"> | |||
@@ -16,38 +56,8 @@ | |||
<button type="" id="control_refresh" class="button red center" onclick=refresh()>刷新</button> | |||
</div> | |||
</div> | |||
<#form:form id="searchForm" model="${device}" style="float:right;" | |||
action="${ctx}/sys/device/listData" method="post" class="" | |||
data-page-no="${parameter.pageNo}" | |||
data-page-size="${parameter.pageSize}" | |||
data-order-by="${parameter.orderBy}"> | |||
<#form:hidden path="deviceType" maxlength="100" class="form-control" style="height:40px;"/> | |||
<div class="form-group"> | |||
<div id="dealIsshow"> | |||
<% if(hasPermi("sys:device:delete")) { %> | |||
<!--<div class="form-group pull-left">--> | |||
<a class="deal_a" href="javascript:;" id="delete-select" style="margin-right:20px;">删除</a> | |||
<!--</div>--> | |||
<% } %> | |||
<% if(hasPermi('sys:password:edit')){ %> | |||
<!--<div class="form-group pull-left">--> | |||
<a class="deal_a" href="javascript:;" id="change-psd-select">修改密码</a> | |||
<!--</div>--> | |||
<% } %> | |||
</div> | |||
</div> | |||
<div class="form-group"> | |||
<div class="control-inline"> | |||
<#form:hidden path="deviceName" maxlength="100" class="form-control" style="height:40px;"/> | |||
</div> | |||
</div> | |||
</#form:form> | |||
<div class="table_box"> | |||
<table id="dataGrid"></table> | |||
<div id="dataGridPage" class="my-pagination"></div> | |||
@@ -239,34 +249,41 @@ | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(2){ | |||
width: 137px; | |||
width: 111px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(3){ | |||
width: 137px; | |||
width: 111px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(4){ | |||
width: 137px; | |||
width: 111px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(5){ | |||
width: 137px; | |||
width: 111px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(6){ | |||
width: 137px; | |||
width: 111px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(7){ | |||
width: 82px; | |||
width: 111px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(8){ | |||
width: 110px; | |||
width: 89px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(9){ | |||
width: 220px; | |||
width: 89px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(10){ | |||
width: 89px; | |||
} | |||
.ui-jqgrid-btable tbody tr td:nth-of-type(11){ | |||
width: 175px; | |||
} | |||
@@ -322,20 +339,42 @@ | |||
}, | |||
{ | |||
header : '设备IP', | |||
name : 'ip', | |||
index : 'a.ip', | |||
name : 'deviceExt.ipAddr', | |||
width : 50, | |||
align : "left", | |||
formatter: function(val, obj, row, act){ | |||
return val!=undefined?val:"未知"; | |||
} | |||
}, | |||
{ | |||
header : '设备SN', | |||
name : 'bindDeviceSn', | |||
width : 50, | |||
align : "left", | |||
formatter: function(val, obj, row, act){ | |||
return (val!=undefined && val!="")?val:'<span style="color:orangered;">未激活</span>'; | |||
} | |||
}, | |||
{ | |||
header : '设备状态', | |||
name : 'online', | |||
index : 'a.online', | |||
width : 30, | |||
width : 40, | |||
align : "left", | |||
formatter: function(val, obj, row, act){ | |||
return val?'<span style="color:green;">在线</span>':'<span style="color:orangered;">离线</span>'; | |||
console.log(val); | |||
console.log(row); | |||
return val ?'<span style="color:green;">在线</span>':'<span style="color:orangered;">离线</span>'; | |||
} | |||
}, | |||
{ | |||
header : 'app版本', | |||
name : 'deviceExt.appVer', | |||
width : 40, | |||
align : "left", | |||
formatter: function(val, obj, row, act){ | |||
return val!=undefined?val:"未知"; | |||
} | |||
}, | |||
{ | |||
@@ -345,13 +384,10 @@ | |||
width : 40, | |||
align : "left", | |||
formatter: function(val, obj, row, act){ | |||
console.log(row); | |||
console.log(obj); | |||
console.log(row.deviceType); | |||
var str = ""; | |||
if (row.deviceType == "PAD") { | |||
if (row.deviceType == "PAD" || row.deviceType == "pad") { | |||
str = val?'<span style="color:green;">已完成</span>':'<span style="color:orangered;">未完成</span>'; | |||
str += "("+row.faceCnt+")"; | |||
str += "("+(row.faceCnt!=undefined?row.faceCnt:0)+")"; | |||
} | |||
return str; | |||
@@ -373,13 +409,10 @@ | |||
title : false, | |||
formatter : function(val, obj, row, act) { | |||
var actions = []; | |||
actions.push('<a onclick=syncRow("${ctx}/sys/device/sync?id='+ row.deviceId +'") >全量下发</a> '); | |||
actions.push('<a onclick=openPage("编辑设备","${ctx}/sys/device/form/${device.deviceType}?id=' + row.deviceId + '","2")>编辑</a> '); | |||
/*actions.push('<a onclick=openPage("编辑设备","${ctx}/sys/device/form/${device.deviceType}?id=' + row.deviceId + '","2")>编辑</a> '); | |||
<% if(hasPermi("sys:device:delete")) { %> | |||
actions.push('<a onclick=deleteRow("${ctx}/sys/device/delete?id='+ row.deviceId +'") >删除</a> '); | |||
<% } %> | |||
actions.push('<a onclick=deleteRow("${ctx}/sys/device/delete?id='+ row.deviceId +'") >删除</a> ');*/ | |||
return actions.join(''); | |||
} | |||
} ], | |||
@@ -394,9 +427,7 @@ | |||
var num = parseInt(pageSize/2); | |||
return 80*pageSize + num*8 + 16; | |||
}, // 自动表格高度(设置为false后,不自动调整表格高度),为函数时返回'100%',则自动高度。 | |||
<% if(hasPermi("sys:device:delete")) { %> | |||
multiselect : false,//多选 | |||
<% } %> | |||
multiselectWidth: 30, | |||
// 行选择事件 | |||
onSelectRow: function(id, isSelect, event) { | |||
@@ -2,46 +2,6 @@ | |||
['dataGrid','fileupload','zTree'], bodyClass: ''}){ %> | |||
<style> | |||
.remote-action-btn{ | |||
display: inline-block; | |||
width: 76px; | |||
height: 25px; | |||
line-height: 25px; | |||
color: #191919; | |||
font-size: 12px; | |||
border: 1px solid #E8E8E8; | |||
background-color: #FFF; | |||
overflow: hidden; | |||
text-overflow:ellipsis; | |||
white-space: nowrap; | |||
margin-right: 10px; | |||
margin-bottom: 12px; | |||
text-align: center; | |||
cursor: pointer; | |||
border-radius: 3px; | |||
} | |||
.remote-status-btn{ | |||
display: inline-block; | |||
padding: 0px 11px; | |||
line-height: 20px; | |||
font-size: 12px; | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
white-space: nowrap; | |||
margin-top: 4px; | |||
text-align: center; | |||
margin-left: 10px; | |||
} | |||
.fz16 { | |||
font-size: 16px !important; | |||
} | |||
.fz12 { | |||
font-size: 12px !important; | |||
} | |||
.my-select input{ | |||
height: 25px !important; | |||
border-radius: 6px; | |||
@@ -98,52 +58,6 @@ | |||
} | |||
.item-gate-base-info{ | |||
padding: 10px 15px 10px 0 !important; | |||
text-align: center; | |||
} | |||
.item-gate-img{ | |||
width: 52%; | |||
} | |||
.item-gate-name{ | |||
ont-size: 16px; | |||
color: #2f4056; | |||
padding-top: 15px; | |||
} | |||
.item-gate-sn{ | |||
font-size: 12px; | |||
line-height: 26px; | |||
color: #2f4056; | |||
} | |||
.settingDevice, .warningDevice{ | |||
font-size: 12px; | |||
line-height: 24px; | |||
background-color: #acb6bf; | |||
border: none; | |||
opacity: 1; | |||
padding: 0 12px; | |||
color: #334053; | |||
border-radius: 3px; | |||
} | |||
.item-gate-handle{ | |||
border: 1px solid #C7C7C7; | |||
padding: 15px; | |||
text-align: center; | |||
} | |||
.item-gate-handle .setting-div{ | |||
border-right: 1px solid #acb6bf; | |||
} | |||
.pb-15{ | |||
padding-bottom: 15px !important; | |||
} | |||
.layui-form-select dl { | |||
top: 27px !important; | |||
@@ -154,8 +68,6 @@ | |||
margin-bottom: 4px; | |||
} | |||
#actionForm{ | |||
} | |||
.layui-this:after { | |||
border: none !important; | |||
@@ -183,74 +95,11 @@ | |||
line-height: 28px; | |||
} | |||
.cursor{ | |||
cursor: pointer; | |||
} | |||
#table-record, #table-record2 { | |||
width: 100%; | |||
height: auto; | |||
border-bottom: 1px solid #e6e7f1; | |||
float: left | |||
} | |||
#table-record tr:nth-child(2n) td, #table-record2 tr:nth-child(2n) td { | |||
background: #f6f7fa | |||
} | |||
#table-record tr td, #table-record2 tr td { | |||
line-height: 20px; | |||
padding: 15px; | |||
border-top: 1px solid #e6e7f1; | |||
text-align: center; | |||
background: #fff; | |||
color: #505050; | |||
font-size: 16px | |||
} | |||
#table-record td,table th, #table-record2 td,table th{ | |||
border: none; white-space: nowrap;word-break: keep-all;width:1px;word-wrap: break-word;padding:0 5px; | |||
font-size: 16px; | |||
} | |||
#table-record tr th, #table-record2 tr th { | |||
font-weight: 500; | |||
line-height:40px; | |||
text-align: center; | |||
color: #edeef1; | |||
background: #798299; | |||
font-size: 14px | |||
} | |||
#table-record tr td font,#table-record2 tr td font { | |||
color: #e13b6d; | |||
font-size: 12px | |||
} | |||
#table-record thead tr th .iconx, #table-record2 thead tr th .iconx{display:inline-flex;flex-direction:column;align-items:center;width:20px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative;font-size: 9px;} | |||
.f11 { | |||
font-size: 18px !important; | |||
line-height: 11px !important; | |||
} | |||
.f-blue { | |||
color: #10aeff !important; | |||
} | |||
.add-delete-btn input { | |||
height: 28px; | |||
line-height: 28px; | |||
} | |||
#ipt-start-time2{ | |||
height: 28px !important; | |||
background-color: #2e4056; | |||
color: #f2f2f2; | |||
border: none !important; | |||
outline: none; | |||
} | |||
.select2-container--default.select2-container--focus .select2-selection--single { | |||
height: 28px !important; | |||
@@ -259,10 +108,6 @@ | |||
color: #344152 !important; | |||
margin-top: -5px !important; | |||
} | |||
.ui-widget-content { | |||
border: none !important; | |||
width: 100% !important; | |||
} | |||
.layui-laypage-skip input{ | |||
height: 26px !important; | |||
@@ -296,9 +141,6 @@ | |||
color: #0D0D0D; | |||
} | |||
.layui-table-view{ | |||
margin: 20px 0 20px 20px !important; | |||
} | |||
.fs13 { | |||
font-size: 13px !important; | |||
@@ -312,10 +154,6 @@ | |||
padding: 15px !important; | |||
} | |||
.layui-table-cell{ | |||
min-height: 28px !important; | |||
height: auto !important; | |||
} | |||
</style> | |||
<div class="main-content"> | |||
@@ -359,7 +197,7 @@ | |||
<div class="d-flex layui-upload" style="margin-top: 15px;"> | |||
<button id="apk-upload-btn" class="layui-btn bg-green no-border apk-upload-btn"><i class="iconfont icon-shangchuan2 "></i> 上传新版本</button> | |||
<button class="bg-theme no-border apk-edit-btn" onclick=editApkRow()><i class="fa fa-pencil-square-o"></i> 更新新版本</button> | |||
<button class="bg-theme no-border apk-edit-btn" onclick=editApkRow()><i class="fa fa-pencil-square-o"></i> 编辑版本信息</button> | |||
<button class="bg-theme no-border apk-download-btn" onclick="window.open('${ctxPath}${apkPackage.downloadUrl}')"><i class="iconfont icon-xiazai1 fs13"></i> 下载新版本</button> | |||
</div> | |||
</div> | |||
@@ -395,7 +233,7 @@ | |||
<div class="d-flex layui-upload" style="margin-top: 15px;"> | |||
<button id="gcu-upload-btn" class="layui-btn bg-green no-border gcu-upload-btn"><i class="iconfont icon-shangchuan2 "></i> 上传新版本</button> | |||
<button class="bg-theme no-border gcu-edit-btn" onclick=editGcuRow()><i class="fa fa-pencil-square-o"></i> 更新新版本</button> | |||
<button class="bg-theme no-border gcu-edit-btn" onclick=editGcuRow()><i class="fa fa-pencil-square-o"></i> 编辑版本信息</button> | |||
<button class="bg-theme no-border gcu-download-btn" onclick="window.open('${ctxPath}${gcuPackage.downloadUrl}')"><i class="iconfont icon-xiazai1 fs13"></i> 下载新版本</button> | |||
</div> | |||
</div> | |||
@@ -441,6 +279,9 @@ | |||
<div class="modal-body" style="margin-bottom: 0 !important;"> | |||
<#form:form id="uploadForm" model="${apkPackage}" style="margin:20px 0 !important;" | |||
action="${ctx}/sys/device/updVersion/1" method="post" class="form-inline"> | |||
<p>版本号:</p> | |||
<#form:input path="version" id="version" rows="10" cols="48" class="form-control apk-version required" /> | |||
<p>更新说明:</p> | |||
<#form:textarea path="memo" rows="10" cols="48" class="form-control layui-textarea" style="display: none;"/> | |||
@@ -469,6 +310,10 @@ | |||
<div class="modal-body" style="margin-bottom: 0 !important;"> | |||
<#form:form id="uploadForm" model="${gcuPackage}" style="margin:20px 0 !important;" | |||
action="${ctx}/sys/device/updVersion/2" method="post" class="form-inline"> | |||
<p>版本号:</p> | |||
<#form:input path="version" id="version" rows="10" cols="48" class="form-control gcu-version required" /> | |||
<p>更新说明:</p> | |||
<#form:textarea path="memo" id="memo2" rows="10" cols="48" class="form-control layui-textarea" style="display: none;"/> | |||
@@ -520,10 +365,10 @@ | |||
{field: 'version', title: '版本号', fixed: 'left',width: '8%'}, | |||
{field: 'packageSize', title: '文件大小', fixed: 'left',width: '8%'}, | |||
{field: 'sign', title: '校检码', fixed: 'left',width: '20%'}, | |||
{field: 'uploadTime', title: '上传时间', fixed: 'left',width: '15%'}, | |||
{field: 'updatedTime', title: '更新时间', fixed: 'left',width: '15%'}, | |||
{field: 'uploadTime', title: '上传时间', fixed: 'left',width: '13%'}, | |||
{field: 'updatedTime', title: '更新时间', fixed: 'left',width: '13%'}, | |||
{field: 'decodeMemo', title: '更新内容', fixed: 'left',width: '25%'}, | |||
{field: 'download', title: '下载', fixed: 'left',width: '5%'}, | |||
{field: 'download', title: '操作', fixed: 'left',width: '9%'}, | |||
]; | |||
table.render({ | |||
elem: '#dataGrid1', | |||
@@ -534,7 +379,7 @@ | |||
request: {pageName:"pageNo", limitName:"pageSize"}, | |||
initSort: { | |||
field: 'uploadAt' //排序字段,对应 cols 设定的各字段名 | |||
field: 'uploadTime' //排序字段,对应 cols 设定的各字段名 | |||
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序 | |||
}, | |||
sort:true, | |||
@@ -578,7 +423,7 @@ | |||
request: {pageName:"pageNo", limitName:"pageSize"}, | |||
initSort: { | |||
field: 'uploadAt' //排序字段,对应 cols 设定的各字段名 | |||
field: 'uploadTime' //排序字段,对应 cols 设定的各字段名 | |||
,type: 'desc' //排序方式 asc: 升序、desc: 降序、null: 默认排序 | |||
}, | |||
sort:true, | |||
@@ -592,6 +437,18 @@ | |||
loading:true //分页加上动画效果 | |||
,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据 | |||
for (var i=0;i<res.list.length;i++) { | |||
res.list[i].decodeMemo = ""; | |||
res.list[i].download = ""; | |||
if (res.list[i].memo) { | |||
res.list[i].decodeMemo = HtmlUtil.htmlDecodeByRegExp(res.list[i].memo); | |||
} | |||
if (res.list[i].downloadUrl) { | |||
res.list[i].download = "<a onclick=window.open('${ctxPath}"+res.list[i].downloadUrl+"')>下载</a>"; | |||
} | |||
} | |||
return { | |||
"code": 0, //解析接口状态 | |||
"msg": res.msg, //解析提示文本 | |||
@@ -630,18 +487,17 @@ | |||
$("#updApkModal").modal('hide'); | |||
$("#updGcuModal").modal('hide'); | |||
var val = layedit.getContent(index1); | |||
var val2 = layedit.getContent(index2); | |||
console.log(type); | |||
console.log(val); | |||
console.log(val2); | |||
var version = $(".apk-version").val(); | |||
var memo = layedit.getContent(index1); | |||
if (2==type) { | |||
memo = layedit.getContent(index2); | |||
version = $(".gcu-version").val(); | |||
} | |||
memo = HtmlUtil.htmlEncodeByRegExp(memo); | |||
js.ajaxSubmit(syncUrl, {memo:memo}, function(data){ | |||
js.ajaxSubmit(syncUrl, {memo:memo, version: version}, function(data){ | |||
js.showMessage(data.message); | |||
window.location.reload(); | |||
// $('#dataGrid').jqGrid().trigger("reloadGrid"); | |||
@@ -712,12 +568,7 @@ | |||
//上传成功 | |||
} | |||
,error: function(){ | |||
//演示失败状态,并实现重传 | |||
/*var demoText = $('#demoText'); | |||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>'); | |||
demoText.find('.demo-reload').on('click', function(){ | |||
uploadInst.upload(); | |||
});*/ | |||
} | |||
}); | |||
@@ -736,12 +587,7 @@ | |||
//上传成功 | |||
} | |||
,error: function(){ | |||
//演示失败状态,并实现重传 | |||
/*var demoText = $('#demoText'); | |||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>'); | |||
demoText.find('.demo-reload').on('click', function(){ | |||
uploadInst.upload(); | |||
});*/ | |||
} | |||
}); | |||
}); | |||
@@ -785,7 +631,6 @@ | |||
}, | |||
/*4.用正则表达式实现html解码*/ | |||
htmlDecodeByRegExp:function (str){ | |||
console.log("str===="+str); | |||
var s = ""; | |||
if(str.length == 0) return ""; | |||
s = str.replace(/&/g,"&"); | |||
@@ -59,17 +59,23 @@ | |||
</div> | |||
</div> | |||
<div class="form-group"> | |||
<label class="control-label">类型:</label> | |||
<div class="control-inline" style="width: 140px !important;"> | |||
<#form:select path="eventCode" readonly="true" items="${logTypes}" itemLabel="name" itemValue="code" blankOption="true" blankOptionLabel="全部类型" class="form-control" style="height:28px;width:100px;"/> | |||
<#form:select path="eventCode" readonly="true" items="${logTypes}" itemLabel="name" itemValue="hexCode" blankOption="true" blankOptionLabel="全部类型" class="form-control" style="height:28px;width:100px;"/> | |||
</div> | |||
</div> | |||
<div class="form-group last-form-group"> | |||
<button id="queryBtn" type="button" class="button bg-black center" style=" margin-right: 8px;padding: 4px 23px;font-size: 14px;">查询</button> | |||
<div class="form-group"> | |||
<label class="control-label">日志级别:</label> | |||
<div class="control-inline" style="width: 140px !important;"> | |||
<#form:select path="level" dictType="sys_log_level_type" class="form-control required " /> | |||
</div> | |||
</div> | |||
<div class="form-group last-form-group"> | |||
<button id="queryBtn" type="button" class="button bg-black center" style=" margin-right: 8px;padding: 4px 23px;font-size: 14px;">查询</button> | |||
</div> | |||
</#form:form> | |||
<table id="dataGrid"></table> | |||
</div> | |||
@@ -79,14 +85,14 @@ | |||
<script> | |||
// 初始化DataGrid对象 | |||
function renderTable(deviceId, code, timePart){ | |||
function renderTable(deviceId, code, timePart, level){ | |||
var width = $(".box-body").width() - 40; | |||
console.log(width); | |||
layui.use('table', function(){ | |||
var table = layui.table; | |||
table.render({ | |||
elem: '#dataGrid', | |||
url:"${ctx}/sys/gateEvent/listData?deviceId="+deviceId+"&eventCode="+code+"&timePart="+timePart, //获取数据的接口 | |||
url:"${ctx}/sys/gateEvent/listData?deviceId="+deviceId+"&eventCode="+code+"&timePart="+timePart+"&level="+level, //获取数据的接口 | |||
width:width, | |||
height:650, | |||
cellMinWidth: 'auto', | |||
@@ -202,7 +208,10 @@ layui.use('laydate', function () { | |||
$(function() { | |||
var timePart = $("#ipt-start-time2").val(); | |||
renderTable("", "", timePart); | |||
renderTable("", "0001", timePart, 2); | |||
$('#eventCode').val('0001').trigger('change'); | |||
$('#level').val('2').trigger('change'); | |||
$(document).on("click", "#queryBtn", function(){ | |||
@@ -210,7 +219,8 @@ $(function() { | |||
var timePart = $("#ipt-start-time2").val(); | |||
var eventCode = $("#eventCode").val(); | |||
var deviceId = $("#deviceId").val(); | |||
renderTable(deviceId, eventCode, timePart); | |||
var level = $("#level").val(); | |||
renderTable(deviceId, eventCode, timePart, level); | |||
}) | |||
}) | |||
</script> |