Commit adf5dfe2 authored by wangjinjing's avatar wangjinjing

init

parent ad881afb
Pipeline #54 failed with stages
package im.dx;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
//@MapperScan("im.dx.system.mapper")
//@PropertySource("file:${spring.profiles.path}")
public class ShiroActionApplication {
public static void main(String[] args) {
SpringApplication.run(ShiroActionApplication.class, args);
}
}
\ No newline at end of file
package im.dx.common.config;
import im.dx.system.model.JobLJTParam;
import im.dx.system.service.AlgorithmPreprocessService;
import im.dx.system.service.CutpictureService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Configuration
@EnableScheduling
public class ScheduleTaskConfig {
private static final Logger log = LoggerFactory.getLogger(ScheduleTaskConfig.class);
@Autowired
private AlgorithmPreprocessService algorithmpreProcessService;
@Resource
private CutpictureService cutpictureService;
/***
* 从三点开始每小时执行一遍,查看表里是否有需要启动或者停止的任务
* 该功能只针对调用垃圾桶溢出等算法任务
*/
@Scheduled(cron = "0 0 * * * ?")
private void startOrStopAlgorithmTask() {
//查询表中需要开启的数据
List<JobLJTParam> jobLJTResultList= algorithmpreProcessService.querytask(5,1);
//停止任务
for(JobLJTParam jobParam:jobLJTResultList)
{
//调用开启任务的服务
Map result=cutpictureService.StartTask(jobParam.getDeviceNum(), jobParam.getParams().get("taskId").toString());
if (null != result.get("errorCode") &&result.get("errorCode").toString().equals("0")) {
jobParam.setStatus(3);
algorithmpreProcessService.update(jobParam);
} else {
log.error("StartTask error {}", result.get("errorCode"), result.get("errorMsg"));
}
}
//查询表中需要停止的数据
List<JobLJTParam> jobLJTStopResultList= algorithmpreProcessService.querytask(new Date().getHours(),0);
for(JobLJTParam jobParam:jobLJTStopResultList) {
//停止任务
Map result = cutpictureService.StopTask(jobParam.getDeviceNum(), jobParam.getParams().get("taskId").toString());
if (null != result.get("errorCode") && result.get("errorCode").toString().equals("0")) {
jobParam.setStatus(2);
algorithmpreProcessService.update(jobParam);
} else {
log.error("StopTask error {}", result.get("errorCode"), result.get("errorMsg"));
}
}
}
}
...@@ -8,7 +8,7 @@ import org.springframework.web.context.request.WebRequest; ...@@ -8,7 +8,7 @@ import org.springframework.web.context.request.WebRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Component //@Component
public class MyErrorAttributes extends DefaultErrorAttributes { public class MyErrorAttributes extends DefaultErrorAttributes {
@Override @Override
...@@ -17,7 +17,7 @@ public class MyErrorAttributes extends DefaultErrorAttributes { ...@@ -17,7 +17,7 @@ public class MyErrorAttributes extends DefaultErrorAttributes {
Object code = webRequest.getAttribute("code", RequestAttributes.SCOPE_REQUEST); Object code = webRequest.getAttribute("code", RequestAttributes.SCOPE_REQUEST);
Object message = webRequest.getAttribute("msg", RequestAttributes.SCOPE_REQUEST); Object message = webRequest.getAttribute("msg", RequestAttributes.SCOPE_REQUEST);
map.put("code", code); map.put("code", code);
map.put("msg", message); map.put("msg", "超时!");
return map; return map;
} }
} }
...@@ -52,79 +52,79 @@ public class WebExceptionHandler { ...@@ -52,79 +52,79 @@ public class WebExceptionHandler {
@ExceptionHandler @ExceptionHandler
public String unauthorized(NoHandlerFoundException e) { public String unauthorized(NoHandlerFoundException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("请求的地址不存在", e); log.debug("请求的地址不存在", e);
} }
return generateErrorInfo(ResultBean.FAIL, "请求的地址不存在", HttpStatus.NOT_FOUND.value()); return generateErrorInfo(ResultBean.FAIL, "请求的地址不存在", HttpStatus.NOT_FOUND.value());
} }
@ExceptionHandler(value = {UnauthorizedException.class}) @ExceptionHandler(value = {UnauthorizedException.class})
public String unauthorized(Exception e) { public String unauthorized(Exception e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("无权限"); log.debug("无权限");
} }
return generateErrorInfo(ResultBean.FAIL, "无权限"); return generateErrorInfo(ResultBean.FAIL, "无权限");
} }
@ExceptionHandler @ExceptionHandler
public String unknownAccount(UnknownAccountException e) { public String unknownAccount(UnknownAccountException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("账号不存在"); log.debug("账号不存在");
} }
return generateErrorInfo(ResultBean.FAIL, "账号不存在"); return generateErrorInfo(ResultBean.FAIL, "账号不存在");
} }
@ExceptionHandler @ExceptionHandler
public String incorrectCredentials(IncorrectCredentialsException e) { public String incorrectCredentials(IncorrectCredentialsException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("密码错误"); log.debug("密码错误");
} }
return generateErrorInfo(ResultBean.FAIL, "密码错误"); return generateErrorInfo(ResultBean.FAIL, "密码错误");
} }
@ExceptionHandler @ExceptionHandler
public String excessiveAttemptsException(ExcessiveAttemptsException e) { public String excessiveAttemptsException(ExcessiveAttemptsException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("登录失败次数过多"); log.debug("登录失败次数过多");
} }
return generateErrorInfo(ResultBean.FAIL, "登录失败次数过多, 请稍后再试"); return generateErrorInfo(ResultBean.FAIL, "登录失败次数过多, 请稍后再试");
} }
@ExceptionHandler @ExceptionHandler
public String lockedAccount(LockedAccountException e) { public String lockedAccount(LockedAccountException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("账号已锁定"); log.debug("账号已锁定");
} }
return generateErrorInfo(ResultBean.FAIL, "账号已锁定"); return generateErrorInfo(ResultBean.FAIL, "账号已锁定");
} }
@ExceptionHandler @ExceptionHandler
public String lockedAccount(CaptchaIncorrectException e) { public String lockedAccount(CaptchaIncorrectException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("验证码错误"); log.debug("验证码错误");
} }
return generateErrorInfo(ResultBean.FAIL, "验证码错误"); return generateErrorInfo(ResultBean.FAIL, "验证码错误");
} }
@ExceptionHandler @ExceptionHandler
public String lockedAccount(DuplicateNameException e) { public String lockedAccount(DuplicateNameException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("用户名已存在"); log.debug("用户名已存在");
} }
return generateErrorInfo(ResultBean.FAIL, "用户名已存在"); return generateErrorInfo(ResultBean.FAIL, "用户名已存在");
} }
@ExceptionHandler @ExceptionHandler
public String missingRequestParameter(MissingServletRequestParameterException e) { public String missingRequestParameter(MissingServletRequestParameterException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("请求参数无效"); log.debug("请求参数无效");
} }
return generateErrorInfo(ResultBean.FAIL, "请求参数缺失"); return generateErrorInfo(ResultBean.FAIL, "请求参数缺失");
} }
@ExceptionHandler @ExceptionHandler
public String methodArgumentNotValid(BindException e) { public String methodArgumentNotValid(BindException e) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("参数校验失败", e); log.debug("参数校验失败", e);
} }
List<ObjectError> allErrors = e.getBindingResult().getAllErrors(); List<ObjectError> allErrors = e.getBindingResult().getAllErrors();
StringBuilder errorMessage = new StringBuilder(); StringBuilder errorMessage = new StringBuilder();
...@@ -140,19 +140,19 @@ public class WebExceptionHandler { ...@@ -140,19 +140,19 @@ public class WebExceptionHandler {
@ExceptionHandler @ExceptionHandler
public String all(Exception e) { public String all(Exception e) {
String msg = e.getMessage() == null ? "系统出现异常" : e.getMessage(); String msg = e.getMessage() == null ? "系统出现异常" : e.getMessage();
log.error(msg, e); log.error(msg, e);
generateErrorInfo(ResultBean.FAIL, msg, HttpStatus.INTERNAL_SERVER_ERROR.value()); generateErrorInfo(ResultBean.FAIL, msg, HttpStatus.INTERNAL_SERVER_ERROR.value());
return "forward:/error"; return "forward:/error";
} }
/** /**
* 生成错误信息, 放到 request 域中. * 生成错误信息, 放到 request 域中.
* *
* @param code 错误码 * @param code 错误码
* @param msg 错误信息 * @param msg 错误信息
* @param httpStatus HTTP 状态码 * @param httpStatus HTTP 状态码
* @return SpringBoot 默认提供的 /error Controller 处理器 * @return SpringBoot 默认提供的 /error Controller 处理器
*/ */
private String generateErrorInfo(int code, String msg, int httpStatus) { private String generateErrorInfo(int code, String msg, int httpStatus) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
...@@ -164,14 +164,14 @@ public class WebExceptionHandler { ...@@ -164,14 +164,14 @@ public class WebExceptionHandler {
/** /**
* 捕获 ClientAbortException 异常, 不做任何处理, 防止出现大量堆栈日志输出, 此异常不影响功能. * 捕获 ClientAbortException 异常, 不做任何处理, 防止出现大量堆栈日志输出, 此异常不影响功能.
*/ */
@ExceptionHandler({HttpMediaTypeNotAcceptableException.class, ClientAbortException.class}) @ExceptionHandler({HttpMediaTypeNotAcceptableException.class, ClientAbortException.class})
@ResponseBody @ResponseBody
@ResponseStatus @ResponseStatus
public void clientAbortException(Exception ex) { public void clientAbortException(Exception ex) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("出现了断开异常:", ex); log.debug("出现了断开异常:", ex);
} }
} }
......
package im.dx.common.information;
import java.math.BigDecimal;
/**
* 精确的浮点数运算
*/
public class Arith {
/**
* 默认除法运算精度
*/
private static final int DEF_DIV_SCALE = 10;
/**
* 这个类不能实例化
*/
private Arith() {
}
/**
* 提供精确的加法运算。
*
* @param v1 被加数
* @param v2 加数
* @return 两个参数的和
*/
public static double add(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.add(b2).doubleValue();
}
/**
* 提供精确的减法运算。
*
* @param v1 被减数
* @param v2 减数
* @return 两个参数的差
*/
public static double sub(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.subtract(b2).doubleValue();
}
/**
* 提供精确的乘法运算。
*
* @param v1 被乘数
* @param v2 乘数
* @return 两个参数的积
*/
public static double mul(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.multiply(b2).doubleValue();
}
/**
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
* 小数点以后10位,以后的数字四舍五入。
*
* @param v1 被除数
* @param v2 除数
* @return 两个参数的商
*/
public static double div(double v1, double v2) {
return div(v1, v2, DEF_DIV_SCALE);
}
/**
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
* 定精度,以后的数字四舍五入。
*
* @param v1 被除数
* @param v2 除数
* @param scale 表示表示需要精确到小数点以后几位。
* @return 两个参数的商
*/
public static double div(double v1, double v2, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
if (b1.compareTo(BigDecimal.ZERO) == 0) {
return BigDecimal.ZERO.doubleValue();
}
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
* 提供精确的小数位四舍五入处理。
*
* @param v 需要四舍五入的数字
* @param scale 小数点后保留几位
* @return 四舍五入后的结果
*/
public static double round(double v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(Double.toString(v));
BigDecimal one = new BigDecimal("1");
return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
\ No newline at end of file
package im.dx.common.shiro;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.pam.AuthenticationStrategy;
import org.apache.shiro.authc.pam.ModularRealmAuthenticator;
import org.apache.shiro.realm.Realm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
/**
* 在 Shiro 使用多 Realm 时, 对于 Realm 中抛出的异常, 他都会进行捕获, 然后输出日志.
* 但我们系统有统一异常处理, 所以不需要他捕获我们的自定义异常, 这里将异常抛出.
*/
public class EnhanceModularRealmAuthenticator extends ModularRealmAuthenticator {
private static final Logger log = LoggerFactory.getLogger(EnhanceModularRealmAuthenticator.class);
/**
* 抛出 realm 中第一个遇到的异常
*/
@Override
protected AuthenticationInfo doMultiRealmAuthentication(Collection<Realm> realms, AuthenticationToken token) {
AuthenticationStrategy strategy = getAuthenticationStrategy();
AuthenticationInfo aggregate = strategy.beforeAllAttempts(realms, token);
if (log.isTraceEnabled()) {
log.trace("Iterating through {} realms for PAM authentication", realms.size());
}
for (Realm realm : realms) {
aggregate = strategy.beforeAttempt(realm, token, aggregate);
if (realm.supports(token)) {
log.trace("Attempting to authenticate token [{}] using realm [{}]", token, realm);
AuthenticationInfo info;
// 有异常从此处抛出
info = realm.getAuthenticationInfo(token);
aggregate = strategy.afterAttempt(realm, token, info, aggregate, null);
} else {
log.debug("Realm [{}] does not support token {}. Skipping realm.", realm, token);
}
}
aggregate = strategy.afterAllAttempts(token, aggregate);
return aggregate;
}
}
\ No newline at end of file
package im.dx.common.util;
import java.awt.*;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.util.Random;
/**
* 验证码工具类
*/
public class CaptchaUtil {
/**
* 生成验证码
* @param width 验证码宽度
* @param height 验证码高度
* @param codeCount 验证码个数
* @param lineCount 干扰线个数
* @param lineLenght 干扰线长度
* @return 验证码对象
*/
public static Captcha createCaptcha(int width, int height, int codeCount, int lineCount, int lineLenght) {
BufferedImage image = new BufferedImage(width, height, ColorSpace.TYPE_Lab);
Graphics g = image.getGraphics();
Random random = new Random();
// 取颜色区间中较淡的部分
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
g.setFont(new Font("Times New Roman", Font.PLAIN, 20));
g.setColor(getRandColor(160,200));
// 干扰线
for (int i = 0; i < lineCount; ++i) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xLength = random.nextInt(lineLenght);
int yLength = random.nextInt(lineLenght);
g.drawLine(x, y, x + xLength, y + yLength);
}
StringBuilder code = new StringBuilder();
// 生成验证码
for (int i = 0; i < codeCount; ++i) {
String rand = String.valueOf(random.nextInt(10));
code.append(rand);
g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
g.drawString(rand, (width / codeCount) * i + (width / codeCount / 2), height / 2 + 9);
}
g.dispose();
return new Captcha(code.toString(), image);
}
/**
* 给定范围内获取颜色值
*/
private static Color getRandColor(int fc, int bc) {
Random random = new Random();
if (fc > 255) {
fc = 255;
}
if (bc > 255) {
bc = 255;
}
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
/**
* 验证码对象
*/
public static class Captcha {
private final String code;
private final BufferedImage image;
public String getCode() {
return code;
}
public BufferedImage getImage() {
return image;
}
private Captcha(String code, BufferedImage image) {
this.code = code;
this.image = image;
}
}
}
package im.dx.common.util;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
/**
* JSON工具类
*/
public class JsonUtil {
private static final Logger log = LoggerFactory.getLogger(JsonUtil.class);
private final static ObjectMapper objectMapper = new ObjectMapper();
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
static {
// 对象的所有字段全部列入
objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
// 取消默认转换timestamps形式
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
// 忽略空bean转json的错误
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
// 统一日期格式
objectMapper.setDateFormat(new SimpleDateFormat(DATE_FORMAT));
// 忽略在json字符串中存在, 但在java对象中不存在对应属性的情况, 防止错误
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
public static <T> String objToStr(T obj) {
if (null == obj) {
return null;
}
try {
return obj instanceof String ? (String) obj : objectMapper.writeValueAsString(obj);
} catch (Exception e) {
log.warn("objToStr error: ", e);
return null;
}
}
public static <T> T strToObj(String str, Class<T> clazz) {
if (StringUtils.isBlank(str) || null == clazz) {
return null;
}
try {
return clazz.equals(String.class) ? (T) str : objectMapper.readValue(str, clazz);
} catch (Exception e) {
log.warn("strToObj error: ", e);
return null;
}
}
public static <T> T strToObj(String str, TypeReference<T> typeReference) {
if (StringUtils.isBlank(str) || null == typeReference) {
return null;
}
try {
return (T) (typeReference.getType().equals(String.class) ? str : objectMapper.readValue(str,
typeReference));
} catch (Exception e) {
log.error("strToObj error", e);
return null;
}
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.system.model.Code;
import im.dx.system.model.VideoeRecordType;
import im.dx.system.service.CodeService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/code")
public class CodeController {
@Resource
private CodeService codeService;
@OperationLog("获取code列表")
@GetMapping("/list")
@ResponseBody
public PageResultBean<Code> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "limit", defaultValue = "10") int limit) {
List<Code> codes = codeService.selectAllWithKey(page, limit);
PageInfo<Code> userPageInfo = new PageInfo<>(codes);
return new PageResultBean<>(userPageInfo.getTotal(), userPageInfo.getList());
}
@OperationLog("获取指定type的code列表")
@GetMapping("/list/{typeid}")
@ResponseBody
public ResultBean getList(@PathVariable("typeid") String typeid) {
List<Code> codes = codeService.selectAllWithType(typeid);
return ResultBean.success(codes);
};
@OperationLog("更新code")
@PostMapping("/update")
public ResultBean update(@RequestBody List<Code> codelist) {
int result = codeService.updatecode(codelist);
return ResultBean.success();
}
@OperationLog("新增")
@PostMapping("/add")
public ResultBean add(@RequestBody List<Code> codelist) {
int result = codeService.addcode(codelist);
return ResultBean.success();
}
@OperationLog("新增videoalarm")
@PostMapping("/addvideoeRecordType")
public ResultBean VideoeRecordType(@RequestBody VideoeRecordType videoeRecordType) {
//判断存不存在
int resultexixsts= codeService.selectvideoeRecordType(videoeRecordType);
if(resultexixsts>0){
return ResultBean.success("1");
}
int result = codeService.addvideoeRecordType(videoeRecordType);
return ResultBean.success();
}
@OperationLog("更新用户列表")
@GetMapping("/codetest")
public void test() {
List<Code> codes = codeService.selectAllWithKey(1, 10);
}
@OperationLog("更新code time")
@PostMapping("/updatetime")
public ResultBean updatetime(@RequestBody List<Code> codelist) {
int result = codeService.updatetime(codelist);
return ResultBean.success();
}
@OperationLog("禁用账号")
@PostMapping("/{codeId}/disable")
@ResponseBody
public ResultBean disable(@PathVariable("codeId") String codeId) {
return ResultBean.success(codeService.disableCodeByCodeID(codeId));
}
@OperationLog("激活账号")
@PostMapping("/{codeId}/enable")
@ResponseBody
public ResultBean enable(@PathVariable("codeId") String codeId) {
return ResultBean.success(codeService.enableCodeByCodeID(codeId));
}
@GetMapping("/update/{name}/{alarmlevel}")
public ResultBean update(@PathVariable("name") String name, @PathVariable("alarmlevel") String alarmlevel) {
//更新手动状态
return ResultBean.success(codeService.updatemanualcode(name,alarmlevel));
}
}
\ No newline at end of file
package im.dx.system.controller;
import im.dx.common.util.ResultBean;
import im.dx.system.model.vo.UrlVO;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@Controller
public class CommonPageController {
@Resource
private WebApplicationContext applicationContext;
@GetMapping("/403")
public String forbidden() {
return "error/403";
}
@GetMapping("/404")
public String unauthorizedPage() {
return "error/404";
}
@GetMapping("/500")
public String error() {
return "error/500";
}
/**
* 获取 @RequestMapping 中配置的所有 URL.
* @param keyword 关键字: 过滤条件
* @return URL 列表.
*/
@GetMapping("/system/urls")
@ResponseBody
public ResultBean getUrl(@RequestParam(defaultValue = "") String keyword) {
RequestMappingHandlerMapping mapping = applicationContext.getBean(RequestMappingHandlerMapping.class);
// 获取url与类和方法的对应信息
Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods();
Set<UrlVO> urlSet = new HashSet<>();
for (Map.Entry<RequestMappingInfo, HandlerMethod> m : map.entrySet()) {
// URL 类型, JSON 还是 VIEW
String type = "view";
if (isResponseBodyUrl(m.getValue())){
type = "json";
}
// URL 地址和 URL 请求 METHOD
RequestMappingInfo info = m.getKey();
PatternsRequestCondition p = info.getPatternsCondition();
// 一个 @RequestMapping, 可能有多个 URL.
for (String url : p.getPatterns()) {
// 根据 keyword 过滤 URL
if (url.contains(keyword)) {
// 获取这个 URL 支持的所有 http method, 多个以逗号分隔, 未配置返回 ALL.
Set<RequestMethod> methods = info.getMethodsCondition().getMethods();
String method = "ALL";
if (methods.size() != 0) {
method = StringUtils.collectionToDelimitedString(methods, ",");
}
urlSet.add(new UrlVO(url, method, type));
}
}
}
return ResultBean.success(urlSet);
}
/**
* 判断是否返回 JSON, 判断方式有两种:
* 1. 类上标有 ResponseBody 或 RestController 注解
* 2. 方法上标有 ResponseBody 注解
*/
private boolean isResponseBodyUrl(HandlerMethod handlerMethod) {
return handlerMethod.getBeanType().getDeclaredAnnotation(RestController.class) != null ||
handlerMethod.getBeanType().getDeclaredAnnotation(ResponseBody.class) != null ||
handlerMethod.getMethodAnnotation(ResponseBody.class) != null;
}
}
\ No newline at end of file
package im.dx.system.controller;
import im.dx.common.annotation.OperationLog;
import im.dx.common.shiro.ShiroActionProperties;
import im.dx.common.util.ResultBean;
import im.dx.common.util.TreeUtil;
import im.dx.system.model.Dept;
import im.dx.system.model.DeptVideo;
import im.dx.system.service.DeptService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/dept")
public class DeptController {
@Resource
private DeptService deptService;
@Resource
private ShiroActionProperties shiroActionProperties;
@Value("${managername}")
private String managername;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@GetMapping("/index")
public String index() {
return "dept/dept-list";
}
@OperationLog("获取部门列表")
@GetMapping("/list")
@ResponseBody
public ResultBean getList(@RequestParam(value="parentId",required = false) Integer parentId) {
List<Dept> deptList = deptService.selectByParentId(parentId);
return ResultBean.success(deptList);
}
@GetMapping("/tree/root")
@ResponseBody
public ResultBean treeAndRoot() {
return ResultBean.success(deptService.selectAllTreeAndRoot());
}
@GetMapping("/tree")
@ResponseBody
public ResultBean tree() {
return ResultBean.success(deptService.selectAllTree());
}
@GetMapping
public String add() {
return "dept/dept-add";
}
@OperationLog("新增部门")
@ResponseBody
@RequestMapping(value = "/add", method = RequestMethod.POST)
public ResultBean add(Dept dept) {
if(null==dept.getDeptId() ||dept.getDeptId().equals(""))
{
dept.setDeptId(deptService.selectMaxOrderNum()+1);
}
dept.setCreateTime(sdf.format(new Date()));
dept.setModifyTime(dept.getCreateTime());
return ResultBean.success(deptService.insert(dept));
}
@OperationLog("删除部门")
@DeleteMapping("/{deptId}")
@ResponseBody
public ResultBean delete(@PathVariable("deptId") Integer deptId) {
deptService.deleteCascadeByID(deptId);
return ResultBean.success();
}
@OperationLog("修改部门")
@ResponseBody
@RequestMapping(value = "/update", method = RequestMethod.POST)
public ResultBean update(Dept dept) {
dept.setModifyTime(sdf.format(new Date()));
deptService.updateByPrimaryKey(dept);
return ResultBean.success();
}
@GetMapping("/{deptId}")
public ResultBean update(@PathVariable("deptId") String deptId) {
List<Map> dept = deptService.selectByPrimaryKey(deptId);
return ResultBean.success(dept);
}
@GetMapping("/getDeptParent/{deptId}")
@ResponseBody
public ResultBean getDeptParent(@PathVariable("deptId") String deptId) {
List<Map> dept = deptService.selectByPrimaryKey(deptId);
return ResultBean.success(dept);
}
@OperationLog("调整部门排序")
@PostMapping("/swap")
@ResponseBody
public ResultBean swapSort(Integer currentId, Integer swapId) {
deptService.swapSort(currentId, swapId);
return ResultBean.success();
}
@OperationLog("查询部门及監控")
@GetMapping("/listvideo")
@ResponseBody
public ResultBean listvideo( @RequestParam("deptId") String deptId,@RequestParam("username") String username,@RequestParam("tdmc")String tdmc) {
if (null!=username && (shiroActionProperties.getSuperAdminUsername().equals(username)
||username.equalsIgnoreCase(managername))) {
deptId = "0";
username=null;
}
List<DeptVideo> deptlist=deptService.listvideo(deptId, username,tdmc);
return ResultBean.success(deptlist);
}
@OperationLog("查询部门及監控")
@GetMapping("/listvideotree")
@ResponseBody
public ResultBean listvideotree( @RequestParam("deptId") String deptId,@RequestParam("username") String username,@RequestParam("tdmc")String tdmc) {
if (null!=username && (shiroActionProperties.getSuperAdminUsername().equals(username)
||username.equalsIgnoreCase(managername))) {
deptId = "0";
username=null;
}
List<DeptVideo> deptlist=deptService.listvideo(deptId, username,tdmc);
List<DeptVideo> list= TreeUtil.toTree(deptlist,"deptId","parentId","nodes",DeptVideo.class,deptId);
return ResultBean.success(list);
}
@OperationLog("查询部门及其子節點")
@GetMapping("/listChildDept")
@ResponseBody
public ResultBean listChildDept( @RequestParam("deptId") Integer deptId,@RequestParam("username") String username) {
if (null!=username && (shiroActionProperties.getSuperAdminUsername().equals(username)
||username.equalsIgnoreCase(managername))) {
deptId =0;
username=null;
}
List<Dept> deptlist=deptService.selectDeptChildren(deptId, username);
return ResultBean.success(deptlist);
}
@OperationLog("更新部門默認監控")
@PostMapping("/updateDefaultVideo")
@ResponseBody
public ResultBean updateDefaultVideo( @RequestParam("deptId") String deptId,@RequestParam("videoId") String videoId) {
int result=deptService.updateDefaultVideoByDeptId(deptId, videoId);
if(result>0) {
return ResultBean.success();
}else {
return ResultBean.error("更新失敗");
}
}
@OperationLog("查詢部門默認監控")
@GetMapping("/queryDefaultVideoId")
@ResponseBody
public ResultBean queryDefaultVideo( @RequestParam("deptId") String deptId) {
return ResultBean.success(deptService.selectDefaultVideoByDeptId(deptId));
}
@OperationLog("查詢所有部門默認監控")
@GetMapping("/queryAllDefaultVideo")
@ResponseBody
public ResultBean queryAllDefaultVideo( @RequestParam("deptId") String deptId) {
return ResultBean.success(deptService.selectAllDefaultVideo(deptId));
}
@OperationLog("新增部門默認監控")
@PostMapping("/insertDefaultVideo")
@ResponseBody
public ResultBean insertDefaultVideo( @RequestParam("deptId") String deptId,
@RequestParam("videoId[]") List<String> videoId) {
for(String videoid:videoId)
{
//判断是否存在
int result= deptService.selectExistsDefaultVideo(deptId,videoid);
if(result==0){
deptService.insertDefaultVideo(deptId,videoid);
}
}
return ResultBean.success();
}
@OperationLog("查询所有监控")
@GetMapping("/listAllvideoIdsByDeptid")
@ResponseBody
public ResultBean listAllvideoIdsByDeptid(@RequestParam("deptid") String deptid) {
List<Map> deptList = deptService.listAllvideoIdsByDeptid(deptid);
return ResultBean.success(deptList);
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.shiro.ShiroActionProperties;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.common.util.TreeUtil;
import im.dx.system.model.*;
import im.dx.system.service.DeptTreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/depttree")
public class DeptTreeController {
@Resource
private DeptTreeService deptTreeService;
@Resource
private ShiroActionProperties shiroActionProperties;
@Value("${file.taskurl}")
private String taskurl;
@Autowired
private RestTemplate restTemplate;
@GetMapping("/index")
public String index() {
return "dept/dept-list";
}
@OperationLog("获取部门列表")
@GetMapping("/list")
@ResponseBody
public ResultBean getList(@RequestParam(required = false) String parentId) {
List<DeptTree> deptList = deptTreeService.selectByParentId(parentId);
return ResultBean.success(deptList);
}
@GetMapping("/tree/root")
@ResponseBody
public ResultBean treeAndRoot() {
return ResultBean.success(deptTreeService.selectAllDeptTreeAndRoot());
}
@GetMapping("/tree")
@ResponseBody
public ResultBean tree() {
return ResultBean.success( TreeUtil.toTree(deptTreeService.selectAllDeptTree("0"),"deptId","parentId","children",DeptTree.class,"0"));
}
@GetMapping("/alltree")
@ResponseBody
public ResultBean alltree() {
return ResultBean.success( deptTreeService.selectAllDeptTree("0"));
}
@GetMapping("/videotree/{deptId}")
@ResponseBody
public ResultBean videotree(@PathVariable("deptId") String deptId) {
List<DeptTree> dept= deptTreeService.selectAllVideoTree("0");
return ResultBean.success(TreeUtil.toTree(dept,"deptId","parentId","children",DeptTree.class,"0"));
}
@GetMapping
public String add() {
return "dept/dept-add";
}
// @OperationLog("新增部门")
// @PostMapping
// @ResponseBody
// public ResultBean add(DeptTree dept) {
// if(null==dept.getDeptId() ||dept.getDeptId().equals(""))
// {
// dept.setDeptId(deptTreeService.selectMaxOrderNum()+1);
// }
// dept.setCreateTime(sdf.format(new Date()));
// dept.setModifyTime(dept.getCreateTime());
// return ResultBean.success(deptTreeService.insert(dept));
// }
@OperationLog("删除部门")
@DeleteMapping("/{deptId}")
@ResponseBody
public ResultBean delete(@PathVariable("deptId") String deptId) {
deptTreeService.deleteCascadeByID(deptId);
return ResultBean.success();
}
@OperationLog("修改部门")
@PutMapping
@ResponseBody
public ResultBean update(DeptTree dept) {
dept.setModifyTime(dept.getCreateTime());
deptTreeService.updateByPrimaryKey(dept);
return ResultBean.success();
}
@GetMapping("/{deptId}")
public String update(@PathVariable("deptId") String taskno, Model model) {
DeptTree dept = deptTreeService.selectByPrimaryKey(taskno);
model.addAttribute("dept", dept);
return "dept/dept-add";
}
@OperationLog("调整部门排序")
@PostMapping("/swap")
@ResponseBody
public ResultBean swapSort(Integer currentId, Integer swapId) {
deptTreeService.swapSort(currentId, swapId);
return ResultBean.success();
}
@OperationLog("获取部门列表")
@GetMapping("/listByUsername")
@ResponseBody
public ResultBean listByUsername(@RequestParam(required = false) String parentId,String username) {
if (null!=username && shiroActionProperties.getSuperAdminUsername().equals(username)) {
parentId = "0";
}
List<DeptTree> deptList = deptTreeService.selectAllDeptTree(parentId);
return ResultBean.success(deptList);
}
@OperationLog("获取角色所管辖事件监控")
@GetMapping("/listeventByvideoid/{userID}")
@ResponseBody
public ResultBean listeventByvideoid(@PathVariable("userID") String userID) {
String[] eventids = deptTreeService.listeventByvideoid(userID);
return ResultBean.success(eventids);
}
@OperationLog("获取监控控制的事件")
@GetMapping("/recordtype/list")
@ResponseBody
public PageResultBean<Map> getrecordtypeList(@RequestParam(required = false) String parentId,
@RequestParam(required = false) int page,
@RequestParam(required = false) int limit
) {
List<Map> menuList =
deptTreeService.selectVideoeRecordType(parentId, page, limit);
PageInfo<Map> rolePageInfo = new PageInfo<>(menuList);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
@OperationLog("删除监控控制的事件")
@GetMapping("/delvideorecord/{taskno}/{status}")
@ResponseBody
public TaskResultObj delvideorecord(@PathVariable("taskno") String taskno,@PathVariable("status") String status) {
//调用任务删除的第三方接口
JobParam jobParam=new JobParam();
if(taskno.split("_").length>1)
jobParam.setDetectType(taskno.split("_")[2]);
jobParam.setType(status);
jobParam.setDeviceId(taskno.split("_")[1]);
//调用第三方接口直接删除
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<JobParam> requestEntity = new HttpEntity<>(jobParam, headers);
return restTemplate.postForObject(taskurl, requestEntity, TaskResultObj.class);
}
}
package im.dx.system.controller;
import im.dx.common.util.DateUtils;
import im.dx.system.model.Menu;
import im.dx.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Controller
@Slf4j
public class IndexController {
@Resource
private MenuService menuService;
@Resource
private LoginLogService loginLogService;
@Resource
private UserService userService;
@Resource
private RoleService roleService;
@Resource
private SysLogService sysLogService;
@Resource
private UserOnlineService userOnlineService;
@Autowired
private RestTemplate restTemplate;
@GetMapping(value = {"/main"})
public String index(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "main";
}
@GetMapping(value = {"/qxindex"})
public String qxindex(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "index";
}
@GetMapping(value = {"/pub_index"})
public String pagepub_index(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/pub_index";
}
@GetMapping(value = {"/sjcx"})
public String pagesjcx(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/sjcx";
}
@GetMapping(value = {"/jkgl"})
public String pagejkgl(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/jkgl";
}
@GetMapping(value = {"/sjfx"})
public String pagesjfx(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/sjfx";
}
@GetMapping(value = {"/jgsbgl"})
public String pagejgsbgl(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/jgsbgl";
}
@GetMapping(value = {"/tsgl"})
public String pagetsgl(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/tsgl";
}
@GetMapping(value = {"/xtgl"})
public String pagextgl(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/xtgl";
}
@GetMapping(value = {"/index"})
public String pageindex(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/index";
}
@GetMapping(value = {"/gcjl"})
public String pagegcjl(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/gcjl";
}
@GetMapping(value = {"/test"})
public String test(Model model) {
// List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
// model.addAttribute("menus", menuTreeVOS);
return "page/test";
}
@GetMapping(value = {"/manualscreen"})
public String manualscreen(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/manualscreen";
}
@GetMapping(value = {"/symrjk"})
public String pagesymrjk(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/symrjk";
}
@GetMapping(value = {"/sjdj"})
public String pagesjdj(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/sjdj";
}
@GetMapping(value = {"/sjts"})
public String pagesjts(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/sjts";
}
@GetMapping(value = {"/sbts"})
public String pagesbts(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/sbts";
}
@GetMapping(value = {"/sjzdbz"})
public String pagesjzdbz(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/sjzdbz";
}
@GetMapping(value = {"/jksj"})
public String jksj(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/jksj";
}
@GetMapping(value = {"/ksh"})
public String pageksh(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/ksh";
}
@GetMapping(value = {"/rgjy"})
public String rgjy(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/rgjy";
}
@GetMapping(value = {"/rwpfhistory"})
public String rwpfhistory(Model model) {
List<Menu> menuTreeVOS = menuService.selectCurrentUserMenuTree();
model.addAttribute("menus", menuTreeVOS);
return "page/rwpfhistory";
}
public static String getMatcher(String regex, String source) {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(source);
List<String> list = new ArrayList<>();
while (matcher.find()) {
list.add(matcher.group(1));
}
if (list.size() > 1) {
return list.get(list.size() - 2);
}
return null;
}
}
\ No newline at end of file
package im.dx.system.controller;
import cn.hutool.core.util.IdUtil;
import im.dx.common.annotation.OperationLog;
import im.dx.common.shiro.ShiroActionProperties;
import im.dx.common.util.CaptchaUtil;
import im.dx.common.util.DateUtils;
import im.dx.common.util.ResultBean;
import im.dx.system.model.ResultObj;
import im.dx.system.model.User;
import im.dx.system.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.thymeleaf.TemplateEngine;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
@Controller
public class LoginController {
@Resource
private UserService userService;
@Resource
private TemplateEngine templateEngine;
@Resource
private ShiroActionProperties shiroActionProperties;
@Autowired
private RestTemplate restTemplate;
@GetMapping(value = { "/","/login"})
public String login(Model model) {
model.addAttribute("loginVerify", shiroActionProperties.getLoginVerify());
return "login";
}
@GetMapping("/register")
public String register() {
return "register";
}
@PostMapping("/login")
@ResponseBody
public ResultBean login(User user, @RequestParam(value = "captcha", required = false) String captcha,HttpServletResponse response) {
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword());
subject.login(token);
userService.updateLastLoginTimeByUsername(user.getUsername(), DateUtils.dateTimeNow("YYYY/MM/dd HH:mm:ss"));
//查询用户操作权限一级菜单
User cuser= userService.selectOneByUserName(user.getUsername());
return ResultBean.success(cuser);
}
@OperationLog("注销")
@GetMapping("/logout")
public String logout() {
SecurityUtils.getSubject().logout();
return "redirect:login";
}
@OperationLog("用户账号查询权限")
@PostMapping("/firstmenu")
@ResponseBody
public ResultBean firstmenu(String username) {
if (null!=username && shiroActionProperties.getSuperAdminUsername().equals(username)) {
username = null;
return ResultBean.success(userService.selectUserFirstMenu(username));
}
else if(null!=username) {
return ResultBean.success(userService.selectUserFirstMenu(username));
}
return ResultBean.success();
}
@OperationLog("用户账号查询权限")
@PostMapping("/secondmenu")
@ResponseBody
public ResultBean firstmenu(Integer menuid,String username) {
if (null!=username && shiroActionProperties.getSuperAdminUsername().equals(username)) {
username = null;
return ResultBean.success(userService.selectUserSecondMenu(menuid,username));
}
else if(null!=username) {
return ResultBean.success(userService.selectUserSecondMenu(menuid,username));
}
return ResultBean.success();
}
/**
* 事件推送测试模拟接口
*
* @return 推送结果
*/
@RequestMapping("/test")
public ResultObj test() {
String message = "{\n" +
" \"type\": \"TRAFFIC_INCIDENT_ALARM\",\n" +
" \"id\": \"d9a2b0f0-f0cf-49b9-9b64-3da86a122afa\",\n" +
" \"video_id\": \"20200305112027144_0\",\n" +
" \"ts\": \"1609310601820\",\n" +
" \"incident_type\": \"no_motor_ban\",\n" +
" \"img_urls\": [\n" +
" \"http://33.57.1.22:8001/api/alg/files/1605126187-20200619143331241059_0-627?location=\",\n" +
" \"http://33.57.1.22:8001/api/alg/files/1605126187-20200619143331241059_0-627?location=\",\n" +
" \"http://33.57.1.22:8001/api/alg/files/1605126187-20200619143331241059_0-627?location=\",\n" +
" \"http://33.57.1.22:8001/api/alg/files/1605126187-20200619143331241059_0-627?location=\",\n" +
" \"http://33.57.1.22:8001/api/alg/files/1605126187-20200619143331241059_0-627?location=\"\n" +
" ],\n" +
" \"video_record_url\": \"http://33.57.1.22:8001/api/alg/files/1605126187-20200619143331241059_0-627?location=\",\n" +
" \"obj_location\": {\n" +
" \"x\": 0.1,\n" +
" \"y\": 0.2,\n" +
" \"width\": 0.4,\n" +
" \"height\": 0.7\n" +
" },\n" +
" \"img_base64\": [\"d0xEMHcFAESwdwaUjWDqB6/1Qw4LapAiSICVTOFWsGT0sgt\"]\n" +
"}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<String> requestEntity = new HttpEntity<>(message, headers);
return restTemplate.postForObject("http://localhost:" + 8089 + "/alarmevent", requestEntity, ResultObj.class);
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.PageResultBean;
import im.dx.system.model.LoginLog;
import im.dx.system.service.LoginLogService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/log/login")
public class LoginLogController {
@Resource
private LoginLogService loginLogService;
@GetMapping("/index")
public String index() {
return "log/login-logs";
}
@OperationLog("查看登录日志")
@GetMapping("/list")
@ResponseBody
public PageResultBean<LoginLog> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "limit", defaultValue = "10")int limit) {
List<LoginLog> loginLogs = loginLogService.selectAll(page, limit);
PageInfo<LoginLog> rolePageInfo = new PageInfo<>(loginLogs);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
}
package im.dx.system.controller;
import im.dx.common.annotation.OperationLog;
import im.dx.common.annotation.RefreshFilterChain;
import im.dx.common.util.ResultBean;
import im.dx.system.model.Menu;
import im.dx.system.service.MenuService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/menu")
public class MenuController {
@Resource
private MenuService menuService;
@GetMapping("/index")
public String index() {
return "menu/menu-list";
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@OperationLog("获取菜单列表")
@GetMapping("/list")
@ResponseBody
public ResultBean getList(@RequestParam(required = false) Integer parentId) {
List<Menu> menuList = menuService.selectByParentId(parentId);
return ResultBean.success(menuList);
}
@GetMapping
public String add(Model model) {
return "menu/menu-add";
}
@GetMapping("/tree")
@ResponseBody
public ResultBean tree() {
return ResultBean.success(menuService.getALLTree());
}
@GetMapping("/tree/root")
@ResponseBody
public ResultBean treeAndRoot() {
return ResultBean.success(menuService.getALLMenuTreeAndRoot());
}
@GetMapping("/tree/root/operator")
@ResponseBody
public ResultBean menuAndCountOperatorTreeAndRoot() {
return ResultBean.success(menuService.getALLMenuAndCountOperatorTreeAndRoot());
}
@OperationLog("新增菜单")
@RefreshFilterChain
@PostMapping
@ResponseBody
public ResultBean add(Menu menu) {
menu.setCreateTime(sdf.format(new Date()));
menu.setModifyTime(menu.getCreateTime());
menuService.insert(menu);
return ResultBean.success();
}
@OperationLog("删除菜单")
@RefreshFilterChain
@DeleteMapping("/{menuId}")
@ResponseBody
public ResultBean delete(@PathVariable("menuId") Integer menuId) {
menuService.deleteByIDAndChildren(menuId);
return ResultBean.success();
}
@GetMapping("/{menuId}")
public String updateMenu(@PathVariable("menuId") Integer menuId, Model model) {
Menu menu = menuService.selectByPrimaryKey(menuId);
model.addAttribute("menu", menu);
return "menu/menu-add";
}
@OperationLog("修改菜单")
@RefreshFilterChain
@PutMapping
@ResponseBody
public ResultBean update(Menu menu) {
menu.setModifyTime(sdf.format(new Date()));
menuService.updateByPrimaryKey(menu);
return ResultBean.success();
}
@OperationLog("调整部门排序")
@PostMapping("/swap")
@ResponseBody
public ResultBean swapSort(Integer currentId, Integer swapId) {
menuService.swapSort(currentId, swapId);
return ResultBean.success();
}
}
\ No newline at end of file
package im.dx.system.controller;
import im.dx.common.annotation.OperationLog;
import im.dx.common.constants.AuthcTypeEnum;
import im.dx.common.shiro.OAuth2Helper;
import im.dx.common.util.ResultBean;
import im.dx.common.util.ShiroUtil;
import im.dx.system.model.UserAuths;
import im.dx.system.model.vo.OAuth2VO;
import im.dx.system.service.UserAuthsService;
import me.zhyd.oauth.request.AuthRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("oauth2")
public class OAuth2Controller {
@Resource
private OAuth2Helper oAuth2Helper;
@Resource
private UserAuthsService userAuthsService;
/**
* 生成 Github 授权地址
*/
@OperationLog("Github OAuth2 登录")
@GetMapping("/render/github")
@ResponseBody
public ResultBean renderGithubAuth(HttpServletResponse response) {
AuthRequest authRequest = oAuth2Helper.getAuthRequest(AuthcTypeEnum.GITHUB);
return ResultBean.successData(authRequest.authorize());
}
/**
* 生成 Gitee 授权地址
*/
@OperationLog("Gitee OAuth2 登录")
@GetMapping("/render/gitee")
@ResponseBody
public ResultBean renderGiteeAuth(HttpServletResponse response) {
AuthRequest authRequest = oAuth2Helper.getAuthRequest(AuthcTypeEnum.GITEE);
return ResultBean.successData(authRequest.authorize());
}
@GetMapping("/index")
public String index() {
return "oauth2/oauth2-list";
}
@OperationLog("获取账号绑定信息")
@GetMapping("/list")
@ResponseBody
public ResultBean list() {
List<OAuth2VO> authsList = new ArrayList<>();
for (AuthcTypeEnum type : AuthcTypeEnum.values()) {
UserAuths auth = userAuthsService.selectOneByIdentityTypeAndUserId(type, ShiroUtil.getCurrentUser().getUserId());
OAuth2VO oAuth2VO = new OAuth2VO();
oAuth2VO.setType(type.name());
oAuth2VO.setDescription(type.getDescription());
oAuth2VO.setStatus(auth == null ? "unbind" : "bind");
oAuth2VO.setUsername(auth == null ? "" : auth.getIdentifier());
authsList.add(oAuth2VO);
}
return ResultBean.success(authsList);
}
/**
* 取消授权
*/
@OperationLog("取消账号绑定")
@GetMapping("/revoke/{provider}")
@ResponseBody
public Object revokeAuth(@PathVariable("provider") AuthcTypeEnum provider) {
UserAuths userAuths = userAuthsService.selectOneByIdentityTypeAndUserId(provider, ShiroUtil.getCurrentUser().getUserId());
if (userAuths == null) {
return ResultBean.error("已经是未绑定状态!");
}
userAuthsService.deleteByPrimaryKey(userAuths.getId());
return ResultBean.success();
}
@GetMapping("/success")
public String success() {
return "oauth2/authorize-success";
}
@GetMapping("/error")
public String error() {
return "oauth2/authorize-error";
}
}
package im.dx.system.controller;
import im.dx.common.annotation.OperationLog;
import im.dx.common.annotation.RefreshFilterChain;
import im.dx.common.util.ResultBean;
import im.dx.system.model.Operator;
import im.dx.system.service.OperatorService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/operator")
public class OperatorController {
@Resource
private OperatorService operatorService;
@OperationLog("查看操作日志")
@GetMapping("/index")
public String index() {
return "operator/operator-list";
}
@GetMapping
public String add() {
return "operator/operator-add";
}
@RefreshFilterChain
@PostMapping
@ResponseBody
public ResultBean add(Operator operator) {
operatorService.add(operator);
return ResultBean.success();
}
@GetMapping("/{operatorId}")
public String update(Model model, @PathVariable("operatorId") Integer operatorId) {
Operator operator = operatorService.selectByPrimaryKey(operatorId);
model.addAttribute("operator", operator);
return "operator/operator-add";
}
@RefreshFilterChain
@PutMapping
@ResponseBody
public ResultBean update(Operator operator) {
operatorService.updateByPrimaryKey(operator);
return ResultBean.success();
}
@GetMapping("/list")
@ResponseBody
public ResultBean getList(@RequestParam(required = false) Integer menuId) {
List<Operator> operatorList = operatorService.selectByMenuId(menuId);
return ResultBean.success(operatorList);
}
@RefreshFilterChain
@DeleteMapping("/{operatorId}")
@ResponseBody
public ResultBean delete(@PathVariable("operatorId") Integer operatorId) {
operatorService.deleteByPrimaryKey(operatorId);
return ResultBean.success();
}
@GetMapping("/tree")
@ResponseBody
public ResultBean tree() {
return ResultBean.success(operatorService.getALLMenuAndOperatorTree());
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.common.util.TreeUtil;
import im.dx.system.model.Role;
import im.dx.system.model.TaskParams;
import im.dx.system.model.UserRoleTree;
import im.dx.system.service.RoleService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/role")
public class RoleController {
@Resource
private RoleService roleService;
@GetMapping("/index")
public String index() {
return "role/role-list";
}
@OperationLog("查询角色列表")
@GetMapping("/list")
@ResponseBody
public PageResultBean<Role> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "limit", defaultValue = "10")int limit,
Role roleQuery) {
List<Role> roles = roleService.selectAll(page, limit, roleQuery);
PageInfo<Role> rolePageInfo = new PageInfo<>(roles);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
@GetMapping
public String add() {
return "role/role-add";
}
@OperationLog("新增角色")
@PostMapping
@ResponseBody
public ResultBean add(Role role) {
roleService.add(role);
return ResultBean.success();
}
@GetMapping("/{roleId}")
public String update(@PathVariable("roleId") Integer roleId, Model model) {
Role role = roleService.selectOne(roleId);
model.addAttribute("role", role);
return "role/role-add";
}
@OperationLog("修改角色")
@PutMapping
@ResponseBody
public ResultBean update(Role role) {
roleService.update(role);
return ResultBean.success();
}
@OperationLog("删除角色")
@DeleteMapping("/{roleId}")
@ResponseBody
public ResultBean delete(@PathVariable("roleId") Integer roleId) {
roleService.delete(roleId);
return ResultBean.success();
}
@OperationLog("为角色授予菜单")
@PostMapping("/{roleId}/grant/menu")
@ResponseBody
public ResultBean grantMenu(@PathVariable("roleId") Integer roleId, @RequestParam(value = "menuIds[]", required = false) Integer[] menuIds) {
roleService.grantMenu(roleId, menuIds);
return ResultBean.success();
}
@OperationLog("为角色授予操作权限")
@PostMapping("/{roleId}/grant/operator")
@ResponseBody
public ResultBean grantOperator(@PathVariable("roleId") Integer roleId, @RequestParam(value = "operatorIds[]", required = false) Integer[] operatorIds) {
roleService.grantOperator(roleId, operatorIds);
return ResultBean.success();
}
/**
* 获取角色拥有的菜单
*/
@GetMapping("/{roleId}/own/menu")
@ResponseBody
public ResultBean getRoleOwnMenu(@PathVariable("roleId") Integer roleId) {
return ResultBean.success(roleService.getMenusByRoleId(roleId));
}
/**
* 获取角色拥有的操作权限
*/
@GetMapping("/{roleId}/own/operator")
@ResponseBody
public ResultBean getRoleOwnOperator(@PathVariable("roleId") Integer roleId) {
Integer[] operatorIds = roleService.getOperatorsByRoleId(roleId);
for (int i = 0; i < operatorIds.length; i++) {
operatorIds[i] = operatorIds[i] + 10000;
}
return ResultBean.success(operatorIds);
}
@OperationLog("为角色授予菜单")
@PostMapping("/{roleId}/grant/videorecord")
@ResponseBody
public ResultBean grantVideorecord(@PathVariable("roleId") Integer roleId, @RequestParam(value = "videorecordIds[]", required = false) String[] videorecordIds) {
roleService.grantVideorecord(roleId, videorecordIds);
return ResultBean.success();
}
@OperationLog("查询角色用户树形数据")
@GetMapping("/listAllUsers")
@ResponseBody
public ResultBean listAllUsers() {
return ResultBean.success(roleService.queryRoleUserTree());
}
@OperationLog("给用户添加任务")
@PostMapping("/addtaskinfo")
@ResponseBody
public ResultBean addtaskinfo(@RequestBody TaskParams taskParams) {
return ResultBean.success(roleService.addtaskinfo(taskParams));
}
}
package im.dx.system.controller;
import im.dx.common.util.ResultBean;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 安全相关 Controller
*/
@Controller
@RequestMapping("/security")
public class SecurityController {
/**
* 判断当前登录用户是否有某权限
*/
@GetMapping("/hasPermission/{perms}")
@ResponseBody
public ResultBean hasPermission(@PathVariable("perms") String perms) {
return ResultBean.success(SecurityUtils.getSubject().isPermitted(perms));
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.PageResultBean;
import im.dx.system.model.SysLog;
import im.dx.system.service.SysLogService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/log/sys")
public class SysLogController {
@Resource
private SysLogService sysLogService;
@GetMapping("/index")
public String index() {
return "log/sys-logs";
}
@OperationLog("查看操作日志")
@GetMapping("/list")
@ResponseBody
public PageResultBean<SysLog> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "limit", defaultValue = "10")int limit) {
List<SysLog> loginLogs = sysLogService.selectAll(page, limit);
PageInfo<SysLog> rolePageInfo = new PageInfo<>(loginLogs);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.system.model.*;
import im.dx.system.service.TraffdevicewriteresultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@RestController
@RequestMapping("/traffresult")
public class TraffdevicewriteresultController {
@Autowired
private TraffdevicewriteresultService traffdevicewriteresultService;
@Autowired
private RestTemplate restTemplate;
/**
* ��ѯ���ͳɹ���ҳ
*/
@PostMapping("/queryTraffdevicewriteresultByPage")
public PageResultBean<Traffdevicewriteresult> queryTraffdevicewriteresultByPage(TraffdevicewriteresultParams traffdevicewriteresult) {
List<Traffdevicewriteresult> list= traffdevicewriteresultService.queryTraffdevicewriteresultByPage(traffdevicewriteresult);
PageInfo<Traffdevicewriteresult> rolePageInfo = new PageInfo<>(list);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
/**
* ��ѯ���м������״̬��ҳ
*/
@PostMapping("/querySbtdspsrResultByPage")
public PageResultBean<SbtdspsrResult> querySbtdspsrResultByPage(SbtdspsrParams sbtdspsr) {
List<SbtdspsrResult> list=traffdevicewriteresultService.querySbtdspsrResultByPage(sbtdspsr);
PageInfo<SbtdspsrResult> rolePageInfo = new PageInfo<>(list);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
/**
* ���
*/
@PostMapping("/saveTraffdevicewriteresult")
public ResultObj saveTraffdevicewriteresult(Traffdevicewriteresult traffdevicewriteresult) {
return traffdevicewriteresultService.saveTraffdevicewriteresult(traffdevicewriteresult);
}
/**
* �������
*/
@PostMapping("/saveTraffdevicewriteresultList")
public ResultBean saveTraffdevicewriteresultList(List<Traffdevicewriteresult> traffdevicewriteresultList) {
traffdevicewriteresultService.saveTraffdevicewriteresultList(traffdevicewriteresultList);
return ResultBean.success();
}
/**
* ����
*/
@PostMapping("/updateTraffdevicewriteresult")
public ResultBean updateTraffdevicewriteresult(Traffdevicewriteresult traffdevicewriteresult) {
traffdevicewriteresultService.updateTraffdevicewriteresult(traffdevicewriteresult);
return ResultBean.success();
}
/**
* ɾ��
*/
@PostMapping("/deleteTraffdevicewriteresult")
public ResultBean deleteTraffdevicewriteresult(Traffdevicewriteresult traffdevicewriteresult) {
traffdevicewriteresultService.deleteTraffdevicewriteresult(traffdevicewriteresult);
return ResultBean.success();
}
/**
* ����ɾ��
*/
@PostMapping("/deleteTraffdevicewriteresultList")
public ResultBean deleteTraffdevicewriteresultList(List<Traffdevicewriteresult> traffdevicewriteresultList) {
traffdevicewriteresultService.deleteTraffdevicewriteresultList(traffdevicewriteresultList);
return ResultBean.success();
}
}
\ No newline at end of file
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.*;
import im.dx.system.model.*;
import im.dx.system.service.TrafficStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import sun.net.www.protocol.ftp.FtpURLConnection;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
@Slf4j
@Controller
@RequestMapping("/TrafficStatistics")
public class TrafficStatisticsController {
@Resource
private TrafficStatisticsService trafficStatisticsService;
@OperationLog("查询字典表")
@GetMapping("/listcode")
@ResponseBody
public ResultBean listcode(@RequestParam("codeid") String codeid,
@RequestParam("alarmlevel") String level
) {
List<CodeData> deptList = trafficStatisticsService.selectCodeByCodeId(codeid, level);
return ResultBean.success(deptList);
}
@PostMapping("/queryTraffalarmrecordByPage/{sendOrNot}")
@ResponseBody
public PageResultBean<TraffpictureParam> queryTraffalarmrecordByPage(@PathVariable("sendOrNot")String sendOrNot,@RequestBody TraffalarmrecordParams params) {
String[] arry = {};
Map parammap = new HashMap();
parammap.put("videoids", Arrays.asList("".equals(params.getVideoids())|| "null".equals(params.getVideoids()) ? arry : params.getVideoids().split(",")));
parammap.put("starttime", params.getStarttime());
parammap.put("endtime", params.getEndtime());
parammap.put("recordtype", Arrays.asList(params.getRecordtype()== "" ? arry : params.getRecordtype().split(",")) );
parammap.put("checkstatus", params.getCheckstatus());
parammap.put("deptid", params.getDeptid());
parammap.put("construction", params.getConstruction());
parammap.put("objlables", Arrays.asList(params.getObjlabel() == "" ? arry : params.getObjlabel().split(",")));
parammap.put("processstatus", Arrays.asList(params.getProcessstatus() == "" ? arry : params.getProcessstatus().split(",")));
parammap.put("rectificationtype",params.getRectificationtype());
parammap.put("userId",params.getUserid());
parammap.put("pushstatus",sendOrNot);
parammap.put("sfpf",params.getSfpf());
List<TraffpictureParam> traffalarmrecordResults =
trafficStatisticsService.queryTraffalarmrecordByPage(parammap, params.getPage()
, params.getLimit());
PageInfo<TraffpictureParam> rolePageInfo = new PageInfo<>(traffalarmrecordResults);
return new PageResultBean<TraffpictureParam>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
//更新告警状态
@PostMapping("/updateTraffalarmrecordById")
@ResponseBody
public ResultBean updateTraffalarmrecordById(@RequestBody List<TraffpictureParam> recrdlist) {
//支持对某一点位某一事件类型标注正检后,该事件类型之前的MANUALCHECKTIME 重复事件类型自动标注为正检.
int result = trafficStatisticsService.updateTraffalarmrecordById(recrdlist);
//记录该次正检的时间
// int result2 = trafficStatisticsService.updateVideochecktime(recrdlist);
return ResultBean.success();
}
@OperationLog("查询事件本月及各分类数量")
@GetMapping("/list/todaytraffRecords")
@ResponseBody
public ResultBean todaytraffRecords(@RequestParam("videoId") String videoId,
@RequestParam("starttime") String starttime,
@RequestParam("endtime") String endtime) {
Map map = new HashMap();
map.put("starttime", starttime);
map.put("endtime", endtime);
map.put("videoId", videoId);
List<RecordResult> carList = trafficStatisticsService.todaytraffRecords(map);
Date entdate = DateUtils.parseDate(endtime);
Date startdate = DateUtils.parseDate(starttime);
map.put("starttime", DateUtils.getlastMonthTime(startdate, -1));
map.put("endtime", DateUtils.getlastMonthTime(startdate, -1));
List<Map> tblist = trafficStatisticsService.todaythbtraffRecords(map);
//上周
map.put("starttime", DateUtils.getlastDayTime(startdate, -7));
map.put("endtime", DateUtils.getlastDayTime(entdate, -7));
List<Map> hblist = trafficStatisticsService.todaythbtraffRecords(map);
for (RecordResult item : carList) {
for (Map mp : tblist) {
if (null != mp.get("total"))
item.setTbtotal(String.valueOf(mp.get("total")));
}
for (Map mp : hblist) {
if (null != mp.get("total"))
item.setHbtotal(String.valueOf(mp.get("total")));
}
}
return ResultBean.success(carList);
}
@OperationLog("查询历史一个月事件及各分类数量")
@GetMapping("/list/historytraffRecords")
@ResponseBody
public ResultBean selecthistorytraffRecords(@RequestParam("videoId") String videoId,
@RequestParam("starttime") String starttime,
@RequestParam("endtime") String endtime) {
Map map = new HashMap();
map.put("starttime", starttime);
map.put("videoId", videoId);
map.put("endtime", endtime);
List<VehiclesStatisticResult> carList = trafficStatisticsService.selecthistorytraffRecords(map);
return ResultBean.success(carList);
}
@OperationLog("查询历史一个月流量及各分类数量")
@GetMapping("/list/historyvehicles")
@ResponseBody
public ResultBean selecthistoryvehicles(@RequestParam("videoId") String videoId,
@RequestParam("starttime") String starttime,
@RequestParam("endtime") String endtime) {
Map map = new HashMap();
map.put("starttime", starttime);
map.put("videoId", videoId);
map.put("endtime", endtime);
List<VehiclesStatisticResult> carList = trafficStatisticsService.selecthistoryvehicles(map);
return ResultBean.success(carList);
}
@OperationLog("查询推送第三方的记录")
@PostMapping("/list/pushrecordsBypage")
@ResponseBody
public PageResultBean<Traffalarmrecord> selectPushRecordsBypage(@RequestBody Map map) {
List<Traffalarmrecord> carList = trafficStatisticsService.selectPushRecordsBypage(map, Integer.parseInt(map.get("page").toString()),Integer.parseInt(map.get("limit").toString()));
PageInfo<Traffalarmrecord> rolePageInfo = new PageInfo<>(carList);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
@OperationLog("统计事件推送结果")
@PostMapping("/list/eventresultBypage")
@ResponseBody
public PageResultBean<Traffalarmrecordstate> selecteventresultBypage(@RequestBody TraffalarmrecordstatParams traffalarmrecordstatParams) {
List<Traffalarmrecordstate> carList = trafficStatisticsService.selecteventresultBypage(traffalarmrecordstatParams);
PageInfo<Traffalarmrecordstate> rolePageInfo = new PageInfo<>(carList);
return new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
@OperationLog("导出事件推送结果")
@RequestMapping("/expTraffalarmrecordstat")
@ResponseBody
public void expTraffalarmrecordstat(HttpServletResponse response, TraffalarmrecordstatParams traffalarmrecordstatParams) {
String eventname = traffalarmrecordstatParams.getEventtype();
List<Traffalarmrecordstate> traffalarmrecordstats = trafficStatisticsService.selecteventresultBypage(traffalarmrecordstatParams);
List<HashMap> lists = new ArrayList<>();
for (Traffalarmrecordstate m : traffalarmrecordstats) {
HashMap<String, Object> listMap = new HashMap<>();
listMap.put("countdate", m.getCountdate());
listMap.put("eventname", StringUtils.isBlank(eventname) ? "全部" : m.getEventtypename());
listMap.put("areaname", m.getAreaname());
listMap.put("totalcount", m.getTotalcount());
lists.add(listMap);
}
ExcelCol[] cells = new ExcelCol[8];
cells[0] = new ExcelCol();
cells[0].setColKey("countdate");
cells[0].setColName("日期");
cells[1] = new ExcelCol();
cells[1].setColKey("eventname");
cells[1].setColName("事件类型");
cells[2] = new ExcelCol();
cells[2].setColKey("areaname");
cells[2].setColName("支队名称");
cells[3] = new ExcelCol();
cells[3].setColKey("totalcount");
cells[3].setColName("事件数量");
cells[4] = new ExcelCol();
cells[4].setColKey("checkstatusms");
cells[4].setColName("免审");
Map<String, Object> params = new HashMap<>(4);
SimpleDateFormat formart = new SimpleDateFormat("yyyy-MM-dd");
String dateTime = formart.format(new Date());
params.put("fileName", "推送统计-" + dateTime);
params.put("sheetName", "推送统计");
params.put("header", "推送统计");
new ExportEngine().exportCommData(params, cells, lists, response);
}
//删除某一事件
@OperationLog("取消推送事件信息")
@GetMapping("/deleteTraffalarmrecordById/{recordid}")
@ResponseBody
public ResultBean deleteTraffalarmrecordById(@PathVariable("recordid") String recordid) {
return ResultBean.success(trafficStatisticsService.deleteTraffalarmrecordById(recordid));
}
@OperationLog("查询事件详情")
@GetMapping("/queryTraffDetail/{id}/{recordtype}")
@ResponseBody
public ResultBean queryTraffDetail(@PathVariable("id") String id,@PathVariable("recordtype") String recordtype) {
if("1".equals(recordtype)){
List<Pedestrian> results= trafficStatisticsService.queryTraffPedeDetail(id);
return ResultBean.success(results);
}
else if("2".equals(recordtype)){//车辆
List<Traffic> results= trafficStatisticsService.queryTrafficDetail(id);
return ResultBean.success(results);
}
else if("3".equals(recordtype)){//人脸
List<Face> results= trafficStatisticsService.queryTraffFaceDetail(id);
return ResultBean.success(results);
}
else if("4".equals(recordtype)){//人骑车
List<PeopleRideBicyc> results= trafficStatisticsService.queryTraffPeopleRideBicycDetail(id);
return ResultBean.success(results);
}
return ResultBean.success();
}
@PostMapping("/delTraffalarmrecordByIds")
@ResponseBody
public ResultBean delTraffalarmrecordByIds(@RequestBody List<TraffpictureParam> recrdlist) {
try {
trafficStatisticsService.deltaskinfoByIds(recrdlist);
//删除告警信息
int result = trafficStatisticsService.delTraffalarmrecordByIds(recrdlist);
}catch (Exception ex) {
return ResultBean.error("-1");
}
return ResultBean.success();
}
@PostMapping("/deltaskinfoByIds")
@ResponseBody
public ResultBean deltaskinfoByIds(@RequestBody List<TraffpictureParam> recrdlist) {
//支持对某一点位某一事件类型标注正检后,该事件类型之前的MANUALCHECKTIME 重复事件类型自动标注为正检.
int result = trafficStatisticsService.deltaskinfoByIds(recrdlist);
return ResultBean.success();
}
@PostMapping("/queryTaskInfoByPage")
@ResponseBody
public PageResultBean<TraffpictureParam> queryTaskInfoByPage(@RequestBody TraffalarmrecordParams params) {
String[] arry = {};
Map parammap = new HashMap();
parammap.put("videoids", Arrays.asList("".equals(params.getVideoids())|| "null".equals(params.getVideoids()) ? arry : params.getVideoids().split(",")));
parammap.put("starttime", params.getStarttime());
parammap.put("endtime", params.getEndtime());
parammap.put("recordtype", Arrays.asList(params.getRecordtype()== "" ? arry : params.getRecordtype().split(",")) );
parammap.put("checkstatus", params.getCheckstatus());
parammap.put("deptid", params.getDeptid());
parammap.put("construction", params.getConstruction());
parammap.put("objlables", Arrays.asList(params.getObjlabel() == "" ? arry : params.getObjlabel().split(",")));
parammap.put("processstatus", Arrays.asList(params.getProcessstatus() == "" ? arry : params.getProcessstatus().split(",")));
parammap.put("rectificationtype",params.getRectificationtype());
parammap.put("userId",params.getUserid());
parammap.put("sfpf",params.getSfpf());
List<TraffpictureParam> traffalarmrecordResults =
trafficStatisticsService.queryTaskInfoByPage(parammap, params.getPage()
, params.getLimit());
PageInfo<TraffpictureParam> rolePageInfo = new PageInfo<>(traffalarmrecordResults);
return new PageResultBean<TraffpictureParam>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.common.validate.groups.Create;
import im.dx.system.model.User;
import im.dx.system.service.RoleService;
import im.dx.system.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/user")
public class UserController {
@Resource
private UserService userService;
@Resource
private RoleService roleService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@GetMapping("/index")
public String index() {
return "user/user-list";
}
@GetMapping("/send")
public String send() {
return "user/user-send";
}
@OperationLog("获取用户列表")
@GetMapping("/list")
@ResponseBody
public PageResultBean<User> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
User userQuery) {
List<User> users = userService.selectAllWithDept(page, pageSize, userQuery);
PageInfo<User> userPageInfo = new PageInfo<>(users);
return new PageResultBean<>(userPageInfo.getTotal(), userPageInfo.getList());
}
@OperationLog("根據部門获取用户列表")
@GetMapping("/list/userByDeptId")
@ResponseBody
public PageResultBean<User> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "deptId") String deptId,
@RequestParam(value = "userName") String userName) {
List<User> users = userService.selectAllWithDeptId(page, pageSize,Integer.parseInt(deptId),userName);
PageInfo<User> userPageInfo = new PageInfo<>(users);
return new PageResultBean<>(userPageInfo.getTotal(), userPageInfo.getList());
}
@GetMapping
public String add(Model model) {
model.addAttribute("roles", roleService.selectAll());
return "user/user-add";
}
@GetMapping("/{userId}")
public String update(@PathVariable("userId") Integer userId, Model model) {
model.addAttribute("roleIds", userService.selectRoleIdsById(userId));
model.addAttribute("user", userService.selectOne(userId));
model.addAttribute("roles", roleService.selectAll());
return "user/user-add";
}
@OperationLog("编辑角色")
@PutMapping
@ResponseBody
public ResultBean putupdate(@Valid User user, @RequestParam(value = "role[]", required = false) Integer[] roleIds) {
userService.update(user, roleIds);
return ResultBean.success();
}
@OperationLog("编辑角色")
@PostMapping("/edit")
@ResponseBody
public ResultBean update(@Valid User user, @RequestParam(value = "role[]", required = false) Integer[] roleIds) {
user.setModifyTime(sdf.format(new Date()));
userService.update(user, roleIds);
return ResultBean.success();
}
@OperationLog("新增用户")
@PostMapping
@ResponseBody
public ResultBean adduser(@Validated(Create.class) User user, @RequestParam(value = "role[]", required = false) Integer[] roleIds) {
user.setCreateTime(sdf.format(new Date()));
user.setModifyTime(user.getCreateTime());
return ResultBean.success(userService.add(user, roleIds));
}
@OperationLog("新增用户")
@PostMapping("/add")
@ResponseBody
public ResultBean add(@Validated(Create.class) User user, @RequestParam(value = "role[]", required = false) Integer[] roleIds) {
user.setCreateTime(sdf.format(new Date()));
user.setModifyTime(user.getCreateTime());
return ResultBean.success(userService.add(user, roleIds));
}
@OperationLog("禁用账号")
@PostMapping("/{userId:\\d+}/disable")
@ResponseBody
public ResultBean disable(@PathVariable("userId") Integer userId) {
return ResultBean.success(userService.disableUserByID(userId));
}
@OperationLog("激活账号")
@PostMapping("/{userId}/enable")
@ResponseBody
public ResultBean enable(@PathVariable("userId") Integer userId) {
return ResultBean.success(userService.enableUserByID(userId));
}
@OperationLog("删除账号")
@DeleteMapping("/{userId}")
@ResponseBody
public ResultBean delete(@PathVariable("userId") Integer userId) {
userService.delete(userId);
return ResultBean.success();
}
@GetMapping("/{userId}/reset")
public String resetPassword(@PathVariable("userId") Integer userId, Model model) {
model.addAttribute("userId", userId);
return "user/user-reset-pwd";
}
@OperationLog("重置密码")
@PostMapping("/{userId}/reset")
@ResponseBody
public ResultBean resetPassword(@PathVariable("userId") Integer userId, String password) {
int result=userService.updatePasswordByUserId(userId, password);
if(result>0) {
return ResultBean.success();
}
return ResultBean.error("");
}
@OperationLog("重置密码")
@PostMapping("/myreset/{newpwd}")
@ResponseBody
public ResultBean resetPassword(User user, @PathVariable("newpwd") String newpwd) {
//验证当前用户是否输入密码正确
try {
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword());
subject.login(token);
int result= userService.updatePasswordByUserId(user.getUserId(), newpwd);
if(result>0) {
return ResultBean.success();
}
return ResultBean.error("更新失败");
}catch( AuthenticationException ex) {
return ResultBean.error("密码错误");
}
}
@GetMapping("/update/{name}/{alarmlevel}")
public String editmodel(@PathVariable("name") String name, @PathVariable("alarmlevel") String alarmlevel,Model model) {
model.addAttribute("manualname", name);
model.addAttribute("manualalarmlevel", alarmlevel);
return "user/user-addsend";
}
}
\ No newline at end of file
package im.dx.system.controller;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.common.util.ThreadPoolUtil;
import im.dx.system.model.UserOnline;
import im.dx.system.service.UserOnlineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.*;
@Controller
@RequestMapping("/online")
@Slf4j
public class UserOnlineController {
@Value("${ipurl}")
String ipurl;
@Autowired
private RestTemplate restTemplate;
@Resource
private UserOnlineService userOnlineService;
private static CompletionService<String> completionService = new ExecutorCompletionService<String>(ThreadPoolUtil.getPool());
@GetMapping("/index")
public String index() {
return "online/user-online-list";
}
@GetMapping("/list")
@ResponseBody
public PageResultBean<UserOnline> online() {
List<UserOnline> list = userOnlineService.list();
return new PageResultBean<>(list.size(), list);
}
@PostMapping("/kickout")
@ResponseBody
public ResultBean forceLogout(String sessionId) {
userOnlineService.forceLogout(sessionId);
return ResultBean.success();
}
}
package im.dx.system.controller;
import com.github.pagehelper.PageInfo;
import im.dx.common.annotation.OperationLog;
import im.dx.common.util.DateUtils;
import im.dx.common.util.JsonUtil;
import im.dx.common.util.PageResultBean;
import im.dx.common.util.ResultBean;
import im.dx.system.model.*;
import im.dx.system.service.AlgorithmPreprocessService;
import im.dx.system.service.AutoSnapService;
import im.dx.system.service.CutpictureService;
import im.dx.system.service.VideoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Controller
@RequestMapping("/video")
public class VideoController {
private static final Logger log = LoggerFactory.getLogger(VideoController.class);
@Resource
private VideoService videoService;
@Autowired
public RestTemplate restTemplate;
@Autowired
private AutoSnapService autoSnapService;
@Value("${file.rtspurl}")
private String rtspurl;
@Value("${file.taskurl}")
private String addtaskurl;
@Value("${dixanxinAIurl}")
private String dixanxinAIurl;
@Resource
private CutpictureService cutpictureService;
@Resource
AlgorithmPreprocessService algorithmPreprocessService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@OperationLog("根据deptId获取用户列表")
@GetMapping("/list")
@ResponseBody
public PageResultBean<Video> getList(@RequestParam(value = "page", defaultValue = "1") int page,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
@RequestParam(value = "deptId") String deptId,
@RequestParam(value = "videoName") String videoName) {
List<Video> videos = videoService.selectByMutiParam(page, pageSize, deptId, videoName);
PageInfo<Video> userPageInfo = new PageInfo<>(videos);
return new PageResultBean<>(userPageInfo.getTotal(), userPageInfo.getList());
}
@OperationLog("新增监控")
@PostMapping("/add")
@ResponseBody
public ResultBean add(Sbtdspsr video) {
video.setCjrq(sdf.format(new Date()));
video.setXgrq(video.getCjrq());
return ResultBean.success(videoService.add(video));
}
@OperationLog("删除监控")
@GetMapping("/delete/{Id}")
@ResponseBody
public ResultBean delete(@PathVariable("Id") String id) {
videoService.delete(id);
return ResultBean.success();
}
@OperationLog("抽帧")
@PostMapping("/getSnapshot")
@ResponseBody
public ResultObj getSnapshot(@RequestBody String videoid) {
//根据rtsp 获得 图片地址
videoid = videoid.replace("\"", "");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Map<String, Object> maps = new HashMap<>();
maps.put("deviceCode", videoid);
Map result = restTemplate.getForObject(rtspurl + "?deviceCode={deviceCode}", Map.class, maps);
if (null != result) {
if (null != result.get("ret") && String.valueOf(result.get("ret")).equals("0")
&& result.get("desc").toString().contains("succ")) {
//获得图片地址
return ResultObj.ok(result.get("url").toString());
}
}
return ResultObj.error(999, "超时");
}
@OperationLog("添加任务")
@PostMapping("/task")
@ResponseBody
public TaskResultObj scheduleJob(@RequestBody JobParam jobParam) {
//根据type 判断是新增、删除、停止、开始
//0新增 1开启 2停止 3删除
if (jobParam.getType().equals("0")) {
//根据taskno 判断是否存在
String taskno="fx_" + jobParam.getDeviceId() + "_" + jobParam.getDetectType();
if(null!=jobParam.getParams().get("taskno")) {
taskno = jobParam.getParams().get("taskno").toString();
}
int fxtasknum = videoService.taskExists(taskno);
if (fxtasknum > 0) {
return TaskResultObj.error("-2", "任务已经存在");
}
}
//调用第三方接口
List<Point> points = new ArrayList<>();
Point point = jobParam.getArea() != null ? jobParam.getArea().size() > 0 ? jobParam.getArea().get(0) : null : null;
if (null != point) {
points.add(
new Point(point.getX(), point.getY())
);
points.add(
new Point(point.getX(), point.getY() + point.getH())
);
points.add(
new Point(point.getX() + point.getW(), point.getY())
);
points.add(
new Point(point.getX() + point.getW(), point.getY() + point.getH())
);
}
jobParam.setArea(points);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<JobParam> requestEntity = new HttpEntity<>(jobParam, headers);
try {
return CompletableFuture.supplyAsync(() -> restTemplate.postForObject(addtaskurl, requestEntity, TaskResultObj.class)).get(500, TimeUnit.MILLISECONDS);
}
catch (TimeoutException ex){
log.error("添加任务error:{}",ex.toString());
return TaskResultObj.error("-1","请求超时!");
} catch (InterruptedException e) {
log.error("添加任务error:{}",e.toString());
return TaskResultObj.error("-1","请求中断!");
} catch (ExecutionException e) {
log.error("添加任务error:{}",e.toString());
return TaskResultObj.error("-1","请求失败!");
}
}
@OperationLog("添加垃圾溢出识别任务")
@PostMapping("/LJTtask")
@ResponseBody
public TaskResultObj LJTtask(@RequestBody JobLJTParam jobParam) {
if (jobParam.getParams() != null) {//获得四个点的坐标
if(null!=jobParam.getParams().get("region") ) {
Map pointmap=(Map) jobParam.getParams().get("region");
try {
Point point = JsonUtil.strToObj(JsonUtil.objToStr(pointmap), Point.class);
//调用第三方
Integer[][] arrresult = {{point.getX(),
point.getY() + point.getH()},
{point.getX(), point.getY()},
{point.getX() + point.getW(),
point.getY()}, {point.getX() + point.getW(),
point.getY() + point.getH()}};
//入表数据
jobParam.getParams().put("region", point.getX()+","+point.getY()+","+point.getW()+","+ point.getH()
);
//新增任务
//调用电信算法,返回结果成功后入表
Map mapresult = cutpictureService.CreateTaskLJTMYJC(jobParam.getDeviceNum(), jobParam.getInterval(), arrresult);
log.info(JsonUtil.objToStr(mapresult));
if (null!=mapresult && null!= mapresult.get("errorCode")&& mapresult.get("errorCode").toString().equals("0")) {
//任务新建成功,数据入表{"errorCode":"0","errorMsg":"成功","data":{"taskId":"da7fa7b502014547b1bdced4ea5bc8629344"}}
Map result=(Map) mapresult.get("data");
if(null!=result.get("taskId")){
//表,将开始时间结束时间放入表中
jobParam.getParams().put("taskId",result.get("taskId").toString());
algorithmPreprocessService.add(jobParam);
}
} else {
log.error("添加垃圾溢出识别任务 :error:{}", mapresult.get("errorMsg"));
return TaskResultObj.error("-1",mapresult.get("errorMsg").toString());
}
}catch (Exception ex){
log.error("添加垃圾溢出识别任务 :error:{}", ex.toString());
return TaskResultObj.error("-1","异常");
}
}
}
return TaskResultObj.ok();
}
@OperationLog("开启或者停止任务")
@PostMapping("/taskmange")
@ResponseBody
public TaskResultObj taskstop(@RequestBody JobLJTParam jobParam) {
//调用第三方的停止任务
try {
if(jobParam.getStatus()==2 && null!=jobParam.getParams().get("taskId")) {//1:新建,2:暂停,3:重启,4:删除
Map result= cutpictureService.StopTask(jobParam.getDeviceNum(), jobParam.getParams().get("taskId").toString());
if (null != result.get("errorCode") &&result.get("errorCode").toString().equals("0")) {
algorithmPreprocessService.update(jobParam);
} else {
log.error("HTTP {}", result.get("errorCode"), result.get("errorMsg"));
return TaskResultObj.error("-1",result.get("errorMsg").toString());
}
}
else if(jobParam.getStatus()==3 && null!=jobParam.getParams().get("taskId")) {
Map result= cutpictureService.StartTask(jobParam.getDeviceNum(), jobParam.getParams().get("taskId").toString());
if (null != result.get("errorCode") &&result.get("errorCode").toString().equals("0")) {
algorithmPreprocessService.update(jobParam);
} else {
log.error("HTTP {}", result.get("errorCode"), result.get("errorMsg"));
return TaskResultObj.error("-1",result.get("errorMsg").toString());
}
}
else if(jobParam.getStatus()==4 && null!=jobParam.getParams().get("taskId")) {
Map result= cutpictureService.DeleteTask(jobParam.getDeviceNum(), jobParam.getParams().get("taskId").toString());
//删除记录
if (null != result.get("errorCode") &&result.get("errorCode").toString().equals("0")) {
algorithmPreprocessService.delete(jobParam);
}
else {
log.error("HTTP {}", result.get("errorCode"), result.get("errorMsg"));
return TaskResultObj.error("-1",result.get("errorMsg").toString());
}
}
}catch (Exception ex){
log.error("任务管理失败:{}",ex);
return TaskResultObj.error("-1","error");
}
return TaskResultObj.ok();
}
@OperationLog("编辑监控")
@PostMapping("/edit")
@ResponseBody
public ResultBean edit(Sbtdspsr video) {
video.setXgrq(video.getCjrq());
try {
videoService.update(video);
}catch (Exception ex){
return ResultBean.error("error");
}
return ResultBean.success();
}
@OperationLog("添加相机自动抓拍任务")
@PostMapping("/autoSnapTask")
@ResponseBody
public TaskResultObj autoSnapTask(@RequestBody JobParam jobParam) {
//0新增 1开启 2停止 3删除
String taskno = jobParam.getDeviceId() + "_" + jobParam.getDetectType();
if (jobParam.getType().equals("0")) {
//根据taskno 判断是否存在
if (null != jobParam.getParams().get("taskno")) {
taskno = jobParam.getParams().get("taskno").toString();
}
int fxtasknum = autoSnapService.taskAutoSnapExists(taskno);
if (fxtasknum > 0) {
return TaskResultObj.error("-2", "任务已经存在");
}
}
//新增到表中
Autosnaptaskinfo autosnaptaskinfo=new Autosnaptaskinfo();
autosnaptaskinfo.setAlgorithmfrom("1");
autosnaptaskinfo.setDevicenum(jobParam.getDeviceId());
autosnaptaskinfo.setSendurl(jobParam.getCallBackUrl());
autosnaptaskinfo.setStarthour(jobParam.getParams().get("starthour")==null?"0":jobParam.getParams().get("starthour").toString());
autosnaptaskinfo.setEndhour(jobParam.getParams().get("endhour")==null?"0":jobParam.getParams().get("endhour").toString());
autosnaptaskinfo.setObjectType(jobParam.getParams().get("objectType")==null?"0":jobParam.getParams().get("objectType").toString());
autosnaptaskinfo.setStatus("1");
autosnaptaskinfo.setRecordtype(jobParam.getDetectType());
autosnaptaskinfo.setSendtype(jobParam.getParams().get("sendType")==null?"1":jobParam.getParams().get("sendType").toString());
if(null!=jobParam.getArea() && jobParam.getArea().size()>0) {
Point point= jobParam.getArea().get(0);
autosnaptaskinfo.setRegionx(Integer.toString(point.getX()));
autosnaptaskinfo.setRegiony(Integer.toString(point.getY()));
autosnaptaskinfo.setRegionw(Integer.toString(point.getW()));
autosnaptaskinfo.setRegionh(Integer.toString(point.getH()));
}
autosnaptaskinfo.setSpId(jobParam.getDeviceId());
autosnaptaskinfo.setTaskid(taskno);
autosnaptaskinfo.setTaskname(jobParam.getName());
autosnaptaskinfo.setThreshold(jobParam.getParams().get("thresholdValue")==null?"0":jobParam.getParams().get("thresholdValue").toString());
autosnaptaskinfo.setCjrq(DateUtils.getTime());
try {
autoSnapService.add(autosnaptaskinfo);
}catch (Exception ex){
log.error(ex.toString());
return TaskResultObj.error("-2","新增失败");
}
return TaskResultObj.ok();
}
@PostMapping("/autosnaptaskmange")
@ResponseBody
public TaskResultObj autosnaptaskmange(@RequestBody JobParam jobParam) {
//根据type 判断是新增、删除、停止、开始
//0新增 1开启 2停止 3删除
if(null!=jobParam.getParams() && null!=jobParam.getParams().get("taskId")) {
String taskid = jobParam.getParams().get("taskId").toString();
try {
if (jobParam.getType().equalsIgnoreCase("3") && null != jobParam.getParams().get("taskId")) {
//删除
autoSnapService.delete(taskid);
} else {//更新任务状态
autoSnapService.update(taskid, jobParam.getType());
}
} catch (Exception ex) {
log.error("任务管理失败:{}", ex);
return TaskResultObj.error("-1", "error");
}
return TaskResultObj.ok();
}
return TaskResultObj.error("-1", "参数为空");
}
/***
*随机抽一帧图片,返回结果为存到表里吧
*/
@GetMapping("/getsnap/{sbbh}")
@ResponseBody
public TaskResultObj getsnap(@PathVariable(value = "sbbh") String sbbh) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Map<String, Object> maps = new HashMap<>();
maps.put("deviceCode", sbbh);
try {
Map result = restTemplate.getForObject(rtspurl + "?deviceCode={deviceCode}", Map.class, maps);
if (null != result) {
if (null != result.get("ret") && String.valueOf(result.get("ret")).equals("0")) {
videoService.updateImgSrc(result.get("url") == null ? "" : result.get("url").toString(),sbbh);
return TaskResultObj.ok(result.get("url") == null ? "" : result.get("url").toString());
}
}
}catch (Exception ex){
log.error(ex.toString());
}
return TaskResultObj.ok("");
}
}
\ No newline at end of file
package im.dx.system.mapper;
import im.dx.system.model.JobLJTParam;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface AlgorithmPreprocessMapper {
int insert(JobLJTParam alarm);
int update(JobLJTParam alarm);
int delete(JobLJTParam alarm);
List<JobLJTParam> querytask(int hour, int start);
}
\ No newline at end of file
package im.dx.system.mapper;
import im.dx.system.model.Autosnaptaskinfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface AutoSnapMapper {
List<Autosnaptaskinfo> selectByMutiParam(String deptId, String videoName);
int insert(Autosnaptaskinfo autosnaptaskinfo);
int deleteAutosnaptaskinfo(String id);
int updateAutosnaptaskinfo(String taskid,String type);
int taskAutoSnapExists(String taskno);
}
\ No newline at end of file
...@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface DeptTreeMapper { public interface DeptTreeMapper {
...@@ -31,7 +32,7 @@ public interface DeptTreeMapper { ...@@ -31,7 +32,7 @@ public interface DeptTreeMapper {
String[] listeventByvideoid(@Param("userId") String userId); String[] listeventByvideoid(@Param("userId") String userId);
List<VideoeRecordType> selectVideoeRecordType(@Param("videoId")String videoId); List<Map> selectVideoeRecordType(@Param("videoId")String videoId);
int delvideorecord(@Param("id")String id); int delvideorecord(@Param("id")String id);
......
package im.dx.system.mapper;
import im.dx.system.model.RoleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface RoleMenuMapper {
int insert(RoleMenu roleMenu);
/**
* 插入多条 角色-菜单 关联关系
*/
int insertRoleMenus(@Param("roleId") Integer roleId, @Param("menuIds") Integer[] menuIds);
/**
* 清空角色所拥有的所有菜单
*/
int deleteByRoleId(@Param("roleId") Integer roleId);
/**
* 取消某个菜单的所有授权用户
*/
int deleteByMenuId(@Param("menuId") Integer menuId);
Integer[] getMenusByRoleId(@Param("roleId") Integer roleId);
}
\ No newline at end of file
package im.dx.system.mapper; package im.dx.system.mapper;
import com.sun.tracing.dtrace.ModuleAttributes;
import im.dx.system.model.DeviceChannelid; import im.dx.system.model.DeviceChannelid;
import im.dx.system.model.Traffalarmrecord; import im.dx.system.model.Traffalarmrecord;
import im.dx.system.model.TraffalarmrecordResult; import im.dx.system.model.TraffalarmrecordResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.additional.dialect.oracle.InsertListMapper; import tk.mybatis.mapper.additional.dialect.oracle.InsertListMapper;
import tk.mybatis.mapper.common.BaseMapper; import tk.mybatis.mapper.common.BaseMapper;
...@@ -10,6 +12,7 @@ import tk.mybatis.mapper.common.ConditionMapper; ...@@ -10,6 +12,7 @@ import tk.mybatis.mapper.common.ConditionMapper;
import java.util.List; import java.util.List;
@Mapper
public interface TraffalarmrecordMapper extends BaseMapper<Traffalarmrecord>, ConditionMapper<Traffalarmrecord>, InsertListMapper<Traffalarmrecord> { public interface TraffalarmrecordMapper extends BaseMapper<Traffalarmrecord>, ConditionMapper<Traffalarmrecord>, InsertListMapper<Traffalarmrecord> {
List<TraffalarmrecordResult> queryTraffalarmrecordByPage(@Param("recordtype") String recordtype, @Param("areaid") Long areaid, @Param("checkstatus") Integer checkstatus, List<TraffalarmrecordResult> queryTraffalarmrecordByPage(@Param("recordtype") String recordtype, @Param("areaid") Long areaid, @Param("checkstatus") Integer checkstatus,
......
...@@ -4,6 +4,7 @@ package im.dx.system.mapper; ...@@ -4,6 +4,7 @@ package im.dx.system.mapper;
import im.dx.system.model.SbtdspsrParams; import im.dx.system.model.SbtdspsrParams;
import im.dx.system.model.SbtdspsrResult; import im.dx.system.model.SbtdspsrResult;
import im.dx.system.model.Traffdevicewriteresult; import im.dx.system.model.Traffdevicewriteresult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.additional.dialect.oracle.InsertListMapper; import tk.mybatis.mapper.additional.dialect.oracle.InsertListMapper;
import tk.mybatis.mapper.common.BaseMapper; import tk.mybatis.mapper.common.BaseMapper;
...@@ -11,6 +12,7 @@ import tk.mybatis.mapper.common.ConditionMapper; ...@@ -11,6 +12,7 @@ import tk.mybatis.mapper.common.ConditionMapper;
import java.util.List; import java.util.List;
@Mapper
public interface TraffdevicewriteresultMapper extends BaseMapper<Traffdevicewriteresult>, ConditionMapper<Traffdevicewriteresult>, InsertListMapper<Traffdevicewriteresult> public interface TraffdevicewriteresultMapper extends BaseMapper<Traffdevicewriteresult>, ConditionMapper<Traffdevicewriteresult>, InsertListMapper<Traffdevicewriteresult>
{ {
......
...@@ -23,11 +23,9 @@ public interface TrafficStatisticsMapper { ...@@ -23,11 +23,9 @@ public interface TrafficStatisticsMapper {
List<TraffpictureParam> queryTraffalarmrecordByPage(Map map); List<TraffpictureParam> queryTraffalarmrecordByPage(Map map);
List<TraffpictureParam> queryTaskInfoByPage(Map map);
int updateTraffalarmrecordById(@Param(value = "list") List<TraffpictureParam> recordlist); int updateTraffalarmrecordById(@Param(value = "list") List<TraffpictureParam> recordlist);
List<RecordResult> todaytraffRecords(Map map); List<RecordResult> todaytraffRecords(Map map);
public List<Map> todaythbtraffRecords(Map map); public List<Map> todaythbtraffRecords(Map map);
...@@ -44,6 +42,7 @@ public interface TrafficStatisticsMapper { ...@@ -44,6 +42,7 @@ public interface TrafficStatisticsMapper {
int deleteTraffalarmrecordById(String recordid); int deleteTraffalarmrecordById(String recordid);
int updateTraffalarmrecordPushStatusById(String recordid); int updateTraffalarmrecordPushStatusById(String recordid);
int deleteTraffalarmrecordByIds(String recordid);
List<Pedestrian> queryTraffPedeDetail(String id); List<Pedestrian> queryTraffPedeDetail(String id);
......
...@@ -14,5 +14,7 @@ public interface VideoMapper { ...@@ -14,5 +14,7 @@ public interface VideoMapper {
int insert(Sbtdspsr video); int insert(Sbtdspsr video);
void delete(String id); void delete(String id);
void updateByPrimaryKey(Sbtdspsr video); void updateByPrimaryKey(Sbtdspsr video);
int taskExists(String tsakno); int updateImgSrc(String imgsrc,String sbbh);
int taskExists(String taskno);
int taskAutoSnapExists(String taskno);
} }
\ No newline at end of file
package im.dx.system.model;
public class AIDXResult {
String errorCode;
String errorMsg;
}
package im.dx.system.model;
public class AIDXdata {
private String algCode;
}
package im.dx.system.model;
public class Autosnaptaskinfo {
private String taskid;
private String taskname;
private String devicenum;
private String starthour;
private String endhour;
private String recordtype;
private String regionx;
private String regiony;
private String regionw;
private String regionh;
private String spId;
private String status;
private String cjrq;
private String xgrq;
private String objectType;
private String sendurl;
private String threshold;
private String algorithmfrom;
private String sendtype;
public String getSendtype() {
return sendtype;
}
public void setSendtype(String sendtype) {
this.sendtype = sendtype;
}
public Autosnaptaskinfo() {
}
public Autosnaptaskinfo(String taskid, String taskname, String devicenum, String starthour, String endhour, String recordtype, String regionx, String regiony, String regionw, String regionh, String spId, String status, String objectType, String sendurl, String threshold, String algorithmfrom, String sendtype) {
this.taskid = taskid;
this.taskname = taskname;
this.devicenum = devicenum;
this.starthour = starthour;
this.endhour = endhour;
this.recordtype = recordtype;
this.regionx = regionx;
this.regiony = regiony;
this.regionw = regionw;
this.regionh = regionh;
this.spId = spId;
this.status = status;
this.objectType = objectType;
this.sendurl = sendurl;
this.threshold = threshold;
this.algorithmfrom = algorithmfrom;
this.sendtype = sendtype;
}
public Autosnaptaskinfo(String taskid, String taskname, String devicenum, String starthour, String endhour, String recordtype, String regionx, String regiony, String regionw, String regionh, String spId, String status, String cjrq, String xgrq, String objectType, String sendurl, String threshold, String algorithmfrom, String sendtype) {
this.taskid = taskid;
this.taskname = taskname;
this.devicenum = devicenum;
this.starthour = starthour;
this.endhour = endhour;
this.recordtype = recordtype;
this.regionx = regionx;
this.regiony = regiony;
this.regionw = regionw;
this.regionh = regionh;
this.spId = spId;
this.status = status;
this.cjrq = cjrq;
this.xgrq = xgrq;
this.objectType = objectType;
this.sendurl = sendurl;
this.threshold = threshold;
this.algorithmfrom = algorithmfrom;
this.sendtype = sendtype;
}
public String getTaskid() {
return taskid;
}
public void setTaskid(String taskid) {
this.taskid = taskid;
}
public String getTaskname() {
return taskname;
}
public void setTaskname(String taskname) {
this.taskname = taskname;
}
public String getDevicenum() {
return devicenum;
}
public void setDevicenum(String devicenum) {
this.devicenum = devicenum;
}
public String getStarthour() {
return starthour;
}
public void setStarthour(String starthour) {
this.starthour = starthour;
}
public String getEndhour() {
return endhour;
}
public void setEndhour(String endhour) {
this.endhour = endhour;
}
public String getRecordtype() {
return recordtype;
}
public void setRecordtype(String recordtype) {
this.recordtype = recordtype;
}
public String getSpId() {
return spId;
}
public void setSpId(String spId) {
this.spId = spId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCjrq() {
return cjrq;
}
public void setCjrq(String cjrq) {
this.cjrq = cjrq;
}
public String getXgrq() {
return xgrq;
}
public void setXgrq(String xgrq) {
this.xgrq = xgrq;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getSendurl() {
return sendurl;
}
public void setSendurl(String sendurl) {
this.sendurl = sendurl;
}
public String getThreshold() {
return threshold;
}
public void setThreshold(String threshold) {
this.threshold = threshold;
}
public String getAlgorithmfrom() {
return algorithmfrom;
}
public void setAlgorithmfrom(String algorithmfrom) {
this.algorithmfrom = algorithmfrom;
}
public Autosnaptaskinfo(String devicenum) {
this.devicenum = devicenum;
}
public String getRegionx() {
return regionx;
}
public void setRegionx(String regionx) {
this.regionx = regionx;
}
public String getRegiony() {
return regiony;
}
public void setRegiony(String regiony) {
this.regiony = regiony;
}
public String getRegionw() {
return regionw;
}
public void setRegionw(String regionw) {
this.regionw = regionw;
}
public String getRegionh() {
return regionh;
}
public void setRegionh(String regionh) {
this.regionh = regionh;
}
}
package im.dx.system.model;
import java.util.Map;
public class JobLJTParam {
String deviceNum;
String spId;
String interfaceCode;
Integer interval;
Integer status;
Map params;
public String getDeviceNum() {
return deviceNum;
}
public void setDeviceNum(String deviceNum) {
this.deviceNum = deviceNum;
}
public String getSpId() {
return spId;
}
public void setSpId(String spId) {
this.spId = spId;
}
public String getInterfaceCode() {
return interfaceCode;
}
public void setInterfaceCode(String interfaceCode) {
this.interfaceCode = interfaceCode;
}
public Integer getInterval() {
return interval;
}
public void setInterval(Integer interval) {
this.interval = interval;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Map getParams() {
return params;
}
public void setParams(Map params) {
this.params = params;
}
}
package im.dx.system.model;
import java.util.List;
import java.util.Map;
public class JobParam {
private String detectType;
private String deviceId;
private String type;
private String name;
private Map params;
private String callBackUrl;
private List<Point> area;
public String getDetectType() {
return detectType;
}
public void setDetectType(String detectType) {
this.detectType = detectType;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map getParams() {
return params;
}
public void setParams(Map params) {
this.params = params;
}
public String getCallBackUrl() {
return callBackUrl;
}
public void setCallBackUrl(String callBackUrl) {
this.callBackUrl = callBackUrl;
}
public List<Point> getArea() {
return area;
}
public void setArea(List<Point> area) {
this.area = area;
}
}
package im.dx.system.model;
import java.util.List;
public class PageResult<T> {
private long totle;
private List<T> rows;
}
package im.dx.system.model;
import com.alibaba.fastjson.annotation.JSONField;
/***
* 行人
*/
public class Pedestrian {
private Long id;
private String Type;
private ObjectBoundingBox ObjectBoundingBox;
private String Gender;
private String Age;
private String Angle;
private String HasBackpack;
private String HasGlasses;
private String HasCarrybag;
private String HasUmbrella;
private String CoatLength;
private String CoatColorNums;
private String CoatColor;
private String TrousersLength;
private String TrousersColorNums;
private String TrousersColor;
private HeadBoundingBox HeadBoundingBox;
private UpperBoundingBox UpperBoundingBox;
private LowerBoundingBox LowerBoundingBox;
private FaceBoundingBox FaceBoundingBox;
private String HasHat;
private String HasMask;
private String HairStyle;
private String CoatTexture;
private String TrousersTexture;
private String HasTrolley;
private String HasLuggage;
private String LuggageColorNums;
private String LuggageColor;
private int HasKnife;
public void setType(String Type) {
this.Type = Type;
}
@JSONField(name = "Type")
public String getType() {
return Type;
}
public void setObjectBoundingBox(ObjectBoundingBox ObjectBoundingBox) {
this.ObjectBoundingBox = ObjectBoundingBox;
}
@JSONField(name = "ObjectBoundingBox")
public ObjectBoundingBox getObjectBoundingBox() {
return ObjectBoundingBox;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setGender(String Gender) {
this.Gender = Gender;
}
@JSONField(name = "Gender")
public String getGender() {
return Gender;
}
public void setAge(String Age) {
this.Age = Age;
}
@JSONField(name = "Age")
public String getAge() {
return Age;
}
public void setAngle(String Angle) {
this.Angle = Angle;
}
@JSONField(name = "Angle")
public String getAngle() {
return Angle;
}
public void setHasBackpack(String HasBackpack) {
this.HasBackpack = HasBackpack;
}
@JSONField(name = "HasBackpack")
public String getHasBackpack() {
return HasBackpack;
}
public void setHasGlasses(String HasGlasses) {
this.HasGlasses = HasGlasses;
}
@JSONField(name = "HasGlasses")
public String getHasGlasses() {
return HasGlasses;
}
public void setHasCarrybag(String HasCarrybag) {
this.HasCarrybag = HasCarrybag;
}
@JSONField(name = "HasCarrybag")
public String getHasCarrybag() {
return HasCarrybag;
}
public void setHasUmbrella(String HasUmbrella) {
this.HasUmbrella = HasUmbrella;
}
@JSONField(name = "HasUmbrella")
public String getHasUmbrella() {
return HasUmbrella;
}
public void setCoatLength(String CoatLength) {
this.CoatLength = CoatLength;
}
@JSONField(name = "CoatLength")
public String getCoatLength() {
return CoatLength;
}
public void setCoatColorNums(String CoatColorNums) {
this.CoatColorNums = CoatColorNums;
}
@JSONField(name = "CoatColorNums")
public String getCoatColorNums() {
return CoatColorNums;
}
public void setTrousersLength(String TrousersLength) {
this.TrousersLength = TrousersLength;
}
@JSONField(name = "TrousersLength")
public String getTrousersLength() {
return TrousersLength;
}
public void setTrousersColorNums(String TrousersColorNums) {
this.TrousersColorNums = TrousersColorNums;
}
@JSONField(name = "TrousersColorNums")
public String getTrousersColorNums() {
return TrousersColorNums;
}
public void setHeadBoundingBox(HeadBoundingBox HeadBoundingBox) {
this.HeadBoundingBox = HeadBoundingBox;
}
@JSONField(name = "HeadBoundingBox")
public HeadBoundingBox getHeadBoundingBox() {
return HeadBoundingBox;
}
public void setUpperBoundingBox(UpperBoundingBox UpperBoundingBox) {
this.UpperBoundingBox = UpperBoundingBox;
}
@JSONField(name = "UpperBoundingBox")
public UpperBoundingBox getUpperBoundingBox() {
return UpperBoundingBox;
}
public void setLowerBoundingBox(LowerBoundingBox LowerBoundingBox) {
this.LowerBoundingBox = LowerBoundingBox;
}
@JSONField(name = "LowerBoundingBox")
public LowerBoundingBox getLowerBoundingBox() {
return LowerBoundingBox;
}
public void setFaceBoundingBox(FaceBoundingBox FaceBoundingBox) {
this.FaceBoundingBox = FaceBoundingBox;
}
@JSONField(name = "FaceBoundingBox")
public FaceBoundingBox getFaceBoundingBox() {
return FaceBoundingBox;
}
public void setHasHat(String HasHat) {
this.HasHat = HasHat;
}
@JSONField(name = "HasHat")
public String getHasHat() {
return HasHat;
}
public void setHasMask(String HasMask) {
this.HasMask = HasMask;
}
@JSONField(name = "HasMask")
public String getHasMask() {
return HasMask;
}
public void setHairStyle(String HairStyle) {
this.HairStyle = HairStyle;
}
@JSONField(name = "HairStyle")
public String getHairStyle() {
return HairStyle;
}
public void setCoatTexture(String CoatTexture) {
this.CoatTexture = CoatTexture;
}
@JSONField(name = "CoatTexture")
public String getCoatTexture() {
return CoatTexture;
}
public void setTrousersTexture(String TrousersTexture) {
this.TrousersTexture = TrousersTexture;
}
@JSONField(name = "TrousersTexture")
public String getTrousersTexture() {
return TrousersTexture;
}
public void setHasTrolley(String HasTrolley) {
this.HasTrolley = HasTrolley;
}
@JSONField(name = "HasTrolley")
public String getHasTrolley() {
return HasTrolley;
}
public void setHasLuggage(String HasLuggage) {
this.HasLuggage = HasLuggage;
}
@JSONField(name = "HasLuggage")
public String getHasLuggage() {
return HasLuggage;
}
public void setLuggageColorNums(String LuggageColorNums) {
this.LuggageColorNums = LuggageColorNums;
}
@JSONField(name = "LuggageColorNums")
public String getLuggageColorNums() {
return LuggageColorNums;
}
public void setHasKnife(int HasKnife) {
this.HasKnife = HasKnife;
}
@JSONField(name = "HasKnife")
public int getHasKnife() {
return HasKnife;
}
@JSONField(name = "CoatColor")
public String getCoatColor() {
return CoatColor;
}
public void setCoatColor(String coatColor) {
CoatColor = coatColor;
}
@JSONField(name = "TrousersColor")
public String getTrousersColor() {
return TrousersColor;
}
public void setTrousersColor(String trousersColor) {
TrousersColor = trousersColor;
}
@JSONField(name = "LuggageColor")
public String getLuggageColor() {
return LuggageColor;
}
public void setLuggageColor(String luggageColor) {
LuggageColor = luggageColor;
}
}
package im.dx.system.model;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 自定义响应结构
* @author cp
*/
@Getter
@Setter
public class ResultObj {
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 响应业务状态
* 200 成功
* 201 错误
* 400 参数错误
*/
private Integer status;
/**
* 响应消息
*/
private String msg;
/**
* 响应中的数据
*/
private Object data;
public static ResultObj error(Integer status, String msg, Object data) {
return new ResultObj(status, msg, data);
}
public static ResultObj ok(Object data) {
return new ResultObj(data);
}
public static ResultObj ok() {
return ok(null);
}
private ResultObj() {
}
public static ResultObj error(Integer status, String msg) {
return new ResultObj(status, msg, null);
}
private ResultObj(Integer status, String msg, Object data) {
this.status = status;
this.msg = msg;
this.data = data;
}
private ResultObj(Object data) {
this.status = 200;
this.msg = "OK";
this.data = data;
}
/**
* 将json结果集转化为SysResult对象
*
* @param jsonData json数据
* @param clazz SysResult中的object类型
* @return SysResult对象
*/
public static ResultObj formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, ResultObj.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
return error(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 没有object对象的转化
*
* @param json 字符串
* @return SysResult对象
*/
public static ResultObj format(String json) {
try {
return MAPPER.readValue(json, ResultObj.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return SysResult对象
*/
public static ResultObj formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return error(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public String toString() {
return "ResultObj{" +
"status=" + status +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
}
\ No newline at end of file
package im.dx.system.model;
public class SysLog {
private Integer id;
/**
* 用户名
*/
private String username;
/**
* 操作
*/
private String operation;
/**
* 响应时间/耗时
*/
private Integer time;
/**
* 请求方法
*/
private String method;
/**
* 请求参数
*/
private String params;
/**
* IP
*/
private String ip;
/**
* 创建时间
*/
private String createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public Integer getTime() {
return time;
}
public void setTime(Integer time) {
this.time = time;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
}
\ No newline at end of file
...@@ -8,6 +8,7 @@ public class TraffalarmrecordResult extends Traffpicture { ...@@ -8,6 +8,7 @@ public class TraffalarmrecordResult extends Traffpicture {
private String recordname; private String recordname;
private String alarmlevel; private String alarmlevel;
public String getAlarmlevel() { public String getAlarmlevel() {
return alarmlevel; return alarmlevel;
} }
......
...@@ -54,9 +54,28 @@ public class Traffpicture { ...@@ -54,9 +54,28 @@ public class Traffpicture {
private String faceimagedata; private String faceimagedata;
private String index; private String index;
private Integer targetnum; private String targetnum;
private String createtime; private String createtime;
private String processstatus;
private Integer pushstatus;
public Integer getPushstatus() {
return pushstatus;
}
public void setPushstatus(Integer pushstatus) {
this.pushstatus = pushstatus;
}
public String getProcessstatus() {
return processstatus;
}
public void setProcessstatus(String processstatus) {
this.processstatus = processstatus;
}
public String getCreatetime() { public String getCreatetime() {
return createtime; return createtime;
...@@ -66,11 +85,11 @@ public class Traffpicture { ...@@ -66,11 +85,11 @@ public class Traffpicture {
this.createtime = createtime; this.createtime = createtime;
} }
public Integer getTargetnum() { public String getTargetnum() {
return targetnum; return targetnum;
} }
public void setTargetnum(Integer targetnum) { public void setTargetnum(String targetnum) {
this.targetnum = targetnum; this.targetnum = targetnum;
} }
......
...@@ -30,8 +30,6 @@ public class TraffpictureParam extends Traffpicture { ...@@ -30,8 +30,6 @@ public class TraffpictureParam extends Traffpicture {
@JsonIgnore @JsonIgnore
private String remark; private String remark;
@JsonIgnore @JsonIgnore
private Integer pushstatus;
@JsonIgnore
private String pushdesc; private String pushdesc;
@JsonIgnore @JsonIgnore
private Integer pushcount; private Integer pushcount;
...@@ -42,6 +40,34 @@ public class TraffpictureParam extends Traffpicture { ...@@ -42,6 +40,34 @@ public class TraffpictureParam extends Traffpicture {
private Integer manualstatus; private Integer manualstatus;
private String imagedata; private String imagedata;
private Integer alarmnum; private Integer alarmnum;
private String taskhandler;
private String taskstate;
private String handlertime;
public String getTaskhandler() {
return taskhandler;
}
public void setTaskhandler(String taskhandler) {
this.taskhandler = taskhandler;
}
public String getTaskstate() {
return taskstate;
}
public void setTaskstate(String taskstate) {
this.taskstate = taskstate;
}
public String getHandlertime() {
return handlertime;
}
public void setHandlertime(String handlertime) {
this.handlertime = handlertime;
}
public Integer getAlarmnum() { public Integer getAlarmnum() {
return alarmnum; return alarmnum;
...@@ -205,14 +231,6 @@ public class TraffpictureParam extends Traffpicture { ...@@ -205,14 +231,6 @@ public class TraffpictureParam extends Traffpicture {
this.remark = remark; this.remark = remark;
} }
public Integer getPushstatus() {
return pushstatus;
}
public void setPushstatus(Integer pushstatus) {
this.pushstatus = pushstatus;
}
public String getPushdesc() { public String getPushdesc() {
return pushdesc; return pushdesc;
} }
......
package im.dx.system.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
public class VideoeRecordType implements Serializable {
private static final long serialVersionUID = -194076170058276436L;
/**
* 部门ID
*/
@JsonProperty("id")
private String id;
/**
* 监控名称
*/
private String videoName;
/**
* 监控 ID
*/
private String videoid;
/**
* 事件类型
*/
private String recordtype;
/**
* 事件类型名称
*/
private String recordtypeName;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getVideoName() {
return videoName;
}
public void setVideoName(String videoName) {
this.videoName = videoName;
}
public String getVideoid() {
return videoid;
}
public void setVideoid(String videoid) {
this.videoid = videoid;
}
public String getRecordtype() {
return recordtype;
}
public void setRecordtype(String recordtype) {
this.recordtype = recordtype;
}
public String getRecordtypeName() {
return recordtypeName;
}
public void setRecordtypeName(String recordtypeName) {
this.recordtypeName = recordtypeName;
}
}
\ No newline at end of file
package im.dx.system.service;
import im.dx.system.mapper.AlgorithmPreprocessMapper;
import im.dx.system.model.JobLJTParam;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class AlgorithmPreprocessService {
@Resource
private AlgorithmPreprocessMapper algorithmPMapper;
public int add(JobLJTParam alarm) {
return algorithmPMapper.insert(alarm);
}
public int update(JobLJTParam alarm) { return algorithmPMapper.update(alarm);}
public int delete(JobLJTParam alarm) { return algorithmPMapper.delete(alarm);}
public List<JobLJTParam> querytask(int hour, int start){
return algorithmPMapper.querytask(hour,start);
}
}
package im.dx.system.service;
import com.github.pagehelper.PageHelper;
import im.dx.system.mapper.AutoSnapMapper;
import im.dx.system.mapper.VideoMapper;
import im.dx.system.model.Autosnaptaskinfo;
import im.dx.system.model.JobParam;
import im.dx.system.model.Sbtdspsr;
import im.dx.system.model.Video;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
public class AutoSnapService {
@Resource
private AutoSnapMapper autoSnapMapper;
public List<Autosnaptaskinfo> selectByMutiParam(int page, int rows, String deptId, String videoName) {
PageHelper.startPage(page, rows);
return autoSnapMapper.selectByMutiParam(deptId,videoName);
}
@Transactional
public Integer add(Autosnaptaskinfo autosnaptaskinfo) {
return autoSnapMapper.insert(autosnaptaskinfo);
}
@Transactional
public void delete(String id) {
autoSnapMapper.deleteAutosnaptaskinfo(id);
}
public void update(String taskid,String type) {
autoSnapMapper.updateAutosnaptaskinfo(taskid,type);
}
public int taskAutoSnapExists(String taskno){
return autoSnapMapper.taskAutoSnapExists(taskno);
}
}
\ No newline at end of file
package im.dx.system.service;
import im.dx.common.util.DateUtils;
import im.dx.common.util.JsonUtil;
import im.dx.system.model.Point;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.net.URLDecoder;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class CutpictureService {
private static final Logger log = LoggerFactory.getLogger(CutpictureService.class);
@Value("${dixanxinAIurl}")
String dixanxinAIurl;
@Value("${dixanxinTokenurl}")
String dixanxinTokenurl;
@Value("${appSecret}")
String appSecret;
@Value("${appId}")
String appId;
@Value("${dianxin.baseurl}")
String baseUrl;
@Value("${dianxin.spId}")
String spId;
/***
* 新建垃圾桶检测任务
*/
@Resource
RestTemplate restTemplate;
public boolean cutpicturestart(String deviceNum, Integer status, String taskId) {
Map map = new HashMap<>();
map.put("deviceNum", deviceNum);
map.put("status", status);
map.put("taskId", taskId);
Map result = ctaiRequest(dixanxinAIurl, "capacity.algorithm.preprocess.create", JsonUtil.objToStr(map), "1.0.0");
if (null != result.get("errorCode") &&result.get("errorCode").toString().equals("0")) {
return true;
} else {
return false;
}
}
public boolean cutpicturestop(String deviceNum, Integer status, String taskId) {
Map map = new HashMap<>();
map.put("deviceNum", deviceNum);
map.put("status", status);
map.put("taskId", taskId);
Map result = ctaiRequest(dixanxinAIurl, "capacity.algorithm.preprocess.suspend", JsonUtil.objToStr(map), "1.0.0");
if (null != result.get("errorCode") &&result.get("errorCode").toString().equals("0")) {
return true;
} else {
return false;
}
}
public String getAccessToken() {
Map map = restTemplate.getForObject(
String.format("https://apicapacity.51iwifi.com/oauth/token?grantType=client_credential&appId=%s&appSecret=%s",appId,appSecret), Map.class);
if (null != map.get("errorCode") && map.get("errorCode").toString().equals("0")) {
if (null != map.get("data")) {
Map mapresult = (Map) map.get("data");
return mapresult.get("accessToken") == null ? null : mapresult.get("accessToken").toString();
}
}
return null;
}
public String getSign(String accessToken, String method, String timestamp, String params, String signContent, String version) {
if (null == accessToken || "".equals(accessToken)) {
return "";
}
String s;
if (null == params || "".equals(params)) {
s = MessageFormat.format("{0}accessToken{1}appId{2}bodyContent{3}method{4}timestamp{5}v{6}{0}",appSecret, accessToken, appId,
signContent, method, timestamp,
version, appSecret);
} else {
s = MessageFormat.format("{0}accessToken{1}appId{2}method{3}params{4}timestamp{5}v{6}{0}", appSecret, accessToken, appId, signContent,
method, signContent, timestamp,
version, appSecret);
}
try {
return DigestUtils.md5DigestAsHex(s.getBytes("utf-8")).toUpperCase();
}catch (Exception ex){
return null;
}
}
public Map ctaiRequest(String url, String method, String requestContent, String version) {
String accessToken = getAccessToken();
String timestamp = DateUtils.getTime();
String sign = getSign(accessToken, method, timestamp, null, requestContent, version);
String requesturl = String.format("%s?accessToken=%s&method=%s&v=%s&appId=%s&timestamp=%s&sign=%s",
url, accessToken, method, version, appId, URLDecoder.decode(timestamp).replace("%20", "+"), sign);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<String> requestEntity = new HttpEntity<>(requestContent, headers);
Map httpRequest = restTemplate.postForObject(requesturl, requestEntity, Map.class);
//{"errorCode":"0","errorMsg":"成功","data":{"taskId":"da7fa7b502014547b1bdced4ea5bc8629344"}}
return httpRequest;
}
/**
* 创建越线检测任务
* @param deviceNum
* @param interval
* @param areaPointList
* @param direct
* @param angle
* @return
*/
public Map CreateYXJCTask(String deviceNum, Integer interval, Integer[][] areaPointList, String direct, Integer angle) {
String url = "/algorithm/router";
String method = "capacity.algorithm.preprocess.create";
Map map = new HashMap();
map.put("deviceNum", deviceNum);
map.put("spId", spId);
map.put("interfaceCode", "NEW_YXJC_001");
map.put("interval", interval);
map.put("status", 1);
Map paramsMap = new HashMap();
paramsMap.put("direct", direct);
map.put("angle", angle);
map.put("area", areaPointList);
map.put("params", paramsMap);
String version = "1.0.0";
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), version);
}
/**
* 创建徘徊检测任务
* @param deviceNum
* @param interval
* @param areaPointList
* @param pushDuration
* @return
*/
public Map CreatePHJCTask(String deviceNum, Integer interval,Integer[][] areaPointList, String pushDuration) {
String url = "/algorithm/router";
String method = "capacity.algorithm.preprocess.create";
Map map = new HashMap();
map.put("deviceNum", deviceNum);
map.put("spId", spId);
map.put("interfaceCode", "NEW_PHJC_001");
map.put("interval", interval);
map.put("status", 1);
Map paramsMap = new HashMap();
paramsMap.put("duration", pushDuration);
map.put("region", areaPointList);
map.put("params", paramsMap);
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), "1.0.0");
}
/***
* 创建周界入侵任务
* @param deviceNum
* @param interval
* @param areaPoint
* @return
*/
public Map CreateZJRQTask(String deviceNum, Integer interval,List<Point> areaPoint) {
String url ="/algorithm/router";
String method ="capacity.algorithm.preprocess.create";
Map map = new HashMap();
map.put("deviceNum", deviceNum);
map.put("spId",spId);
map.put("interfaceCode", "NEW_ZJRQ_001");
map.put("interval", interval);
map.put("status", 1);
Map paramsMap = new HashMap();
paramsMap.put("area", areaPoint.toArray() );
map.put("params", paramsMap);
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), "1.0.0");
}
/***
* 4.创建垃圾满溢检测任务
* @param deviceNum
* @param interval
* @param areaPointList
* @return
*/
// areaPointList = [ [0,0], [0,1080], [1920,0], [1920,1080] ]
public Map CreateTaskLJTMYJC(String deviceNum,Integer interval, Integer[][] areaPointList) {
String url = "/algorithm/router";
String method = "capacity.algorithm.preprocess.create";
Map map = new HashMap();
map.put("deviceNum", deviceNum);
map.put("spId",spId);
map.put("interfaceCode", "NEW_LJTMYJC_001");
map.put("interval", interval);
map.put("status", 1);
Map paramsMap = new HashMap();
paramsMap.put("region", areaPointList);
map.put("params", paramsMap);
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), "1.0.0");
}
public Map StopTask(String deviceNum, String taskId) {
String url = "/preprocess/node/route/other";
String method ="capacity.preprocess.cutpicture.suspend";
Map map=new HashMap();
map.put("deviceNum", deviceNum);
map.put("status", 2);
map.put("taskId", taskId);
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), "2.0.0");
}
public Map StartTask(String deviceNum, String taskId) {
String url = "/preprocess/node/route/other";
String method = "capacity.preprocess.cutpicture.start";
Map map=new HashMap();
map.put("deviceNum", deviceNum);
map.put("status", 3);
map.put("taskId", taskId);
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), "2.0.0");
}
public Map DeleteTask(String deviceNum, String taskId) {
String url = "/preprocess/node/route/other";
String method = "capacity.preprocess.cutpicture.delete";
Map map=new HashMap();
map.put("deviceNum", deviceNum);
map.put("status", 4);
map.put("taskId", taskId);
return ctaiRequest(baseUrl, method, JsonUtil.objToStr(map), "2.0.0");
}
/**
* 订阅
* @param algCode: YXJC_001 越线检测 , PHJC_001 徘徊检测, RQJC_001 周界 , LJTJC_001 垃圾桶
* @param pushUrl
* @return
*/
public Map SubscribeAdd(String algCode, String pushUrl) {
String url = "/analysis/app/subscription/add";
String method ="capacity.ai.add";
return ctaiRequest(baseUrl, method,"{\"spId\":\"33\",\"algCode\":"+algCode+", \"pushUrl\":"+pushUrl+"}", "1.0.0");
}
/**
* 修改订阅
* @param algCode
* @param pushUrl
* @return
*/
public Map SubscribeUpdate(String algCode, String pushUrl) {
String url = "/analysis/app/subscription/update";
String method = "capacity.ai.update";
String requestdata = "{'spId':'33', 'algCode':"+algCode+", 'pushUrl':"+pushUrl+"}";
return ctaiRequest(baseUrl, method, requestdata, "1.0.0");
}
/**
* 查询订阅
* @param algCode
* @return
*/
public Map SubscribeGet(String algCode) {
String url = "/analysis/app/subscription/get";
String method = "capacity.ai.get";
String requestdata = "{'spId':'33', 'algCode':"+algCode+"}";
return ctaiRequest(baseUrl, method, requestdata, "1.0.0");
}
/**
* 删除订阅
* @param algCode
* @return
*/
public Map SubscribeDelete(String algCode) {
String url = "/analysis/app/subscription/delete";
String method ="capacity.ai.delete";
String requestdata = "{'spId':'33', 'algCode':"+algCode+"}";
return ctaiRequest(baseUrl, method, requestdata, "1.0.0");
}
}
\ No newline at end of file
package im.dx.system.service;
import im.dx.system.mapper.DeptMapper;
import im.dx.system.model.Dept;
import im.dx.system.model.DeptVideo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class DeptService {
@Resource
private DeptMapper deptMapper;
public Dept insert(Dept dept) {
int maxOrderNum = deptMapper.selectMaxOrderNum();
dept.setOrderNum(maxOrderNum + 1);
deptMapper.insert(dept);
return dept;
}
public int deleteByPrimaryKey(Integer deptId) {
return deptMapper.deleteByPrimaryKey(deptId);
}
public Dept updateByPrimaryKey(Dept dept) {
deptMapper.updateByPrimaryKey(dept);
return dept;
}
public List<Map> selectByPrimaryKey(String deptId) {
return deptMapper.selectByPrimaryKey(deptId);
}
/**
* 删除当前部门及子部门.
*/
public void deleteCascadeByID(Integer deptId) {
List<Integer> childIDList = deptMapper.selectChildrenIDByPrimaryKey(deptId);
for (Integer childId : childIDList) {
deleteCascadeByID(childId);
}
deleteByPrimaryKey(deptId);
}
/**
* 根据父 ID 查询部门
*/
public List<Dept> selectByParentId(Integer parentId) {
return deptMapper.selectByParentId(parentId);
}
/**
* 查找所有的部门的树形结构
*/
public List<Dept> selectAllTree() {
return deptMapper.selectAllTree();
}
/**
* 获取所有菜单并添加一个根节点 (树形结构)
*/
public List<Dept> selectAllTreeAndRoot() {
return selectAllTree();
}
public void swapSort(Integer currentId, Integer swapId) {
deptMapper.swapSort(currentId, swapId);
}
public int selectMaxOrderNum() {
return deptMapper.selectMaxOrderNum();
}
/**
* 查找所有的部门及监控树形结构
*/
public List<DeptVideo> listvideo(String deptId, String username,String tdmc) {
return deptMapper.listvideo(deptId,username,tdmc);
}
/**
* 查找部门及其子節點
*/
public List<Dept> selectDeptChildren(Integer deptId, String username) {
return deptMapper.selectDeptChildren(deptId,username);
}
/**
* 更新默認監控
*/
public Integer updateDefaultVideoByDeptId(String deptId, String videoId) {
return deptMapper.updateDefaultVideoByDeptId(deptId,videoId);
}
/**
* 查詢默認監控
*/
public List<Map> selectDefaultVideoByDeptId(String deptId) {
return deptMapper.selectDefaultVideoByDeptId(deptId);
}
/**
* 查詢默認監控
*/
public List<Map> selectAllDefaultVideo(String deptId) {
return deptMapper.selectAllDefaultVideo(deptId);
}
/**
* 查詢默認監控是否存在
*/
public int selectExistsDefaultVideo(String deptId,String videoid) {
return deptMapper.selectExistsDefaultVideo(deptId,videoid);
}
/**
* 新增默認監控是否存在
*/
public int insertDefaultVideo(String deptId,String videoid) {
return deptMapper.insertDefaultVideo(deptId,videoid);
}
public List<Map> listAllvideoIdsByDeptid(String deptid){
return deptMapper.listAllvideoIdsByDeptid(deptid);
}
}
...@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; ...@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class DeptTreeService { public class DeptTreeService {
...@@ -95,7 +96,7 @@ public class DeptTreeService { ...@@ -95,7 +96,7 @@ public class DeptTreeService {
/** /**
* 查找videoid下所有的监管 * 查找videoid下所有的监管
*/ */
public List<VideoeRecordType> selectVideoeRecordType(String parentId,int page,int limit) { public List<Map> selectVideoeRecordType(String parentId, int page, int limit) {
PageHelper.startPage(page,limit); PageHelper.startPage(page,limit);
return deptTreeMapper.selectVideoeRecordType(parentId); return deptTreeMapper.selectVideoeRecordType(parentId);
} }
......
package im.dx.system.service;
import cn.hutool.json.JSONUtil;
import im.dx.system.mapper.AlarmMapper;
import im.dx.system.model.Alarm;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import javax.annotation.Resource;
import java.net.URI;
public class MyWebSocketClient extends WebSocketClient {
public MyWebSocketClient(URI serverUri) {
super(serverUri);
}
@Resource
private AlarmMapper alarmMapper;
@Override
public void onOpen(ServerHandshake arg0) {
// TODO Auto-generated method stub
System.out.println("open");
}
@Override
public void onClose(int arg0, String arg1, boolean arg2) {
// TODO Auto-generated method stu
}
@Override
public void onError(Exception arg0) {
// TODO Auto-generated method stub
}
@Override
public void onMessage(String arg0) {
// TODO Auto-generated method stub
//获得消息,调用service 放入表中‘
try {
Alarm alarm = JSONUtil.toBean(arg0, Alarm.class);
alarmMapper.insert(alarm);
if(alarm.getType().equalsIgnoreCase("TRAFFIC_INCIDENT_ALARM")) {
alarmMapper.insert(alarm);
}
} catch (Exception ex) {
}
System.out.println(arg0);
}
}
\ No newline at end of file
package im.dx.system.service;
import im.dx.system.mapper.RoleOperatorMapper;
import im.dx.system.model.RoleOperator;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class RoleOperatorService {
@Resource
private RoleOperatorMapper roleOperatorMapper;
public int insert(RoleOperator roleOperator) {
return roleOperatorMapper.insert(roleOperator);
}
}
package im.dx.system.service;
import com.github.pagehelper.PageHelper;
import im.dx.system.mapper.SysLogMapper;
import im.dx.system.model.SysLog;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class SysLogService {
@Resource
private SysLogMapper sysLogMapper;
public List<SysLog> selectAll(int page, int rows) {
PageHelper.startPage(page, rows);
return sysLogMapper.selectAll();
}
public int count() {
return sysLogMapper.count();
}
}
package im.dx.system.service;
import com.github.pagehelper.PageHelper;
import im.dx.common.util.DateUtils;
import im.dx.system.mapper.TraffdevicewriteresultMapper;
import im.dx.system.model.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Service
@Slf4j
public class TraffdevicewriteresultService {
@Autowired
private RestTemplate restTemplate;
@Autowired
private TraffdevicewriteresultMapper traffdevicewriteresultMapper;
/**
* ��ѯ��ҳ
*/
public List<SbtdspsrResult> querySbtdspsrResultByPage(SbtdspsrParams sbtdspsr) {
PageHelper.startPage(sbtdspsr.getPage(), sbtdspsr.getLimit());
return traffdevicewriteresultMapper.querySbtdspsrResultByPage(sbtdspsr);
}
/**
* ��ѯ��ҳ
*/
public List<Traffdevicewriteresult> queryTraffdevicewriteresultByPage(TraffdevicewriteresultParams traffdevicewriteresult) {
PageHelper.startPage(traffdevicewriteresult.getPage(), traffdevicewriteresult.getLimit());
Condition condition = new Condition(Traffdevicewriteresult.class);
Example.Criteria criteria = condition.createCriteria();
if (traffdevicewriteresult.getCreatetime() != null) {
criteria.andEqualTo("createtime", traffdevicewriteresult.getCreatetime());
}
if (traffdevicewriteresult.getPushdesc() != null) {
criteria.andEqualTo("pushdesc", traffdevicewriteresult.getPushdesc());
}
if (traffdevicewriteresult.getPushstatus() != null) {
criteria.andEqualTo("pushstatus", traffdevicewriteresult.getPushstatus());
}
if (StringUtils.isNotBlank(traffdevicewriteresult.getSbbh())) {
criteria.andLike("sbbh", "%" + traffdevicewriteresult.getSbbh()+"%" );
}
if (traffdevicewriteresult.getTdbh() != null) {
criteria.andEqualTo("tdbh", traffdevicewriteresult.getTdbh());
}
if (traffdevicewriteresult.getLikePushdesc() != null) {
criteria.andLike("pushdesc", "%" + traffdevicewriteresult.getLikePushdesc() + "%");
}
if (traffdevicewriteresult.getLikePushstatus() != null) {
criteria.andLike("pushstatus", "%" + traffdevicewriteresult.getLikePushstatus() + "%");
}
if (StringUtils.isNotBlank(traffdevicewriteresult.getLikeSbbh())) {
criteria.andLike("sbbh", "%" + traffdevicewriteresult.getLikeSbbh() + "%");
}
if (traffdevicewriteresult.getLikeTdbh() != null) {
criteria.andLike("tdbh", "%" + traffdevicewriteresult.getLikeTdbh() + "%");
}
if (StringUtils.isNotBlank(traffdevicewriteresult.getCreatetimeBegin())) {
criteria.andGreaterThanOrEqualTo("createtime", DateUtils.parseDate(traffdevicewriteresult.getCreatetimeBegin()));
}
if (StringUtils.isNotBlank(traffdevicewriteresult.getCreatetimeEnd())) {
criteria.andLessThanOrEqualTo("createtime", DateUtils.parseDate(traffdevicewriteresult.getCreatetimeEnd()));
}
return traffdevicewriteresultMapper.selectByCondition(condition);
}
/**
* ���
*/
public ResultObj saveTraffdevicewriteresult(Traffdevicewriteresult traffdevicewriteresult) {
traffdevicewriteresultMapper.insertSelective(traffdevicewriteresult);
return ResultObj.ok();
}
/**
* �������
*/
public void saveTraffdevicewriteresultList(List<Traffdevicewriteresult> traffdevicewriteresultList) {
traffdevicewriteresultMapper.insertList(traffdevicewriteresultList);
}
/**
* ����
*/
public void updateTraffdevicewriteresult(Traffdevicewriteresult traffdevicewriteresult) {
traffdevicewriteresultMapper.updateByPrimaryKeySelective(traffdevicewriteresult);
}
/**
* ɾ��
*/
public void deleteTraffdevicewriteresult(Traffdevicewriteresult traffdevicewriteresult) {
traffdevicewriteresultMapper.deleteByPrimaryKey(traffdevicewriteresult);
}
/**
* ����ɾ��
*/
public void deleteTraffdevicewriteresultList(List<Traffdevicewriteresult> traffdevicewriteresultList) {
for (Traffdevicewriteresult traffdevicewriteresult : traffdevicewriteresultList) {
traffdevicewriteresultMapper.deleteByPrimaryKey(traffdevicewriteresult);
}
}
}
\ No newline at end of file
package im.dx.system.service;
import com.github.pagehelper.PageHelper;
import im.dx.system.mapper.TrafficStatisticsMapper;
import im.dx.system.model.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
/**
* 通流量统计 Service
*/
@Service
public class TrafficStatisticsService {
@Resource
private TrafficStatisticsMapper trafficStatisticsMapper;
public List<TraffpictureParam> queryTraffalarmrecordByPage( Map map,int page, int limit) {
PageHelper.startPage(page,limit);
List<TraffpictureParam> traffalarmrecordResults=trafficStatisticsMapper.queryTraffalarmrecordByPage(map);
return traffalarmrecordResults;
}
public List<TraffpictureParam> queryTaskInfoByPage( Map map,int page, int limit) {
PageHelper.startPage(page,limit);
List<TraffpictureParam> traffalarmrecordResults=trafficStatisticsMapper.queryTaskInfoByPage(map);
return traffalarmrecordResults;
}
public int updateTraffalarmrecordById(List<TraffpictureParam> recordlist ){
return trafficStatisticsMapper.updateTraffalarmrecordById(recordlist);
}
public List<RecordResult> todaytraffRecords(Map map) {
return trafficStatisticsMapper.todaytraffRecords(map);
}
public List<Map> todaythbtraffRecords(Map map) {
return trafficStatisticsMapper.todaythbtraffRecords(map);
}
public List<VehiclesStatisticResult> selecthistorytraffRecords(Map map) {
return trafficStatisticsMapper.selecthistorytraffRecords(map);
}
public List<VehiclesStatisticResult> selecthistoryvehicles(Map map) {
return trafficStatisticsMapper.selecthistoryvehicles(map);
}
public List<Traffalarmrecord> selectPushRecordsBypage(Map map,int page, int limit) {
PageHelper.startPage(page,limit);
return trafficStatisticsMapper.selectPushRecordsBypage(map);
}
public List<Traffalarmrecordstate> selecteventresultBypage(TraffalarmrecordstatParams params) {
PageHelper.startPage(params.getPage(),params.getLimit());
return trafficStatisticsMapper.selecteventresultBypage(params);
}
public int deleteTraffalarmrecordById(String recordid ){
return trafficStatisticsMapper.deleteTraffalarmrecordById(recordid);
}
public int updateTraffalarmrecordPushStatusById(String recordid ){
return trafficStatisticsMapper.updateTraffalarmrecordPushStatusById(recordid);
}
public List<Pedestrian> queryTraffPedeDetail(String id ){
return trafficStatisticsMapper.queryTraffPedeDetail(id);
}
public List<Traffic> queryTrafficDetail(String id ){
return trafficStatisticsMapper.queryTrafficDetail(id);
}
public List<Face> queryTraffFaceDetail(String id ){
return trafficStatisticsMapper.queryTraffFaceDetail(id);
}
public List<PeopleRideBicyc> queryTraffPeopleRideBicycDetail(String id ){
return trafficStatisticsMapper.queryTraffPeopleRideBicycDetail(id);
}
public int delTraffalarmrecordByIds(List<TraffpictureParam> recordlist){
return trafficStatisticsMapper.delTraffalarmrecordByIds(recordlist);
}
public int deltaskinfoByIds(List<TraffpictureParam> recordlist){
return trafficStatisticsMapper.deltaskinfoByIds(recordlist);
}
public List<CodeData> selectCodeByCodeId(String codeid, String level){
return trafficStatisticsMapper.selectCodeByCodeid(codeid,level);
}
}
\ No newline at end of file
package im.dx.system.service;
import im.dx.common.util.IPUtils;
import im.dx.system.model.User;
import im.dx.system.model.UserOnline;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionDAO;
import org.apache.shiro.subject.SimplePrincipalCollection;
import org.apache.shiro.subject.support.DefaultSubjectContext;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@Service
public class UserOnlineService {
@Resource
private SessionDAO sessionDAO;
public List<UserOnline> list() {
List<UserOnline> list = new ArrayList<>();
Collection<Session> sessions = sessionDAO.getActiveSessions();
for (Session session : sessions) {
UserOnline userOnline = new UserOnline();
if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) == null) {
continue;
} else {
SimplePrincipalCollection principalCollection = (SimplePrincipalCollection) session
.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
User user = (User) principalCollection.getPrimaryPrincipal();
userOnline.setUsername(user.getUsername());
userOnline.setUserId(user.getUserId());
}
userOnline.setId((String) session.getId());
userOnline.setIp(IPUtils.getIpAddr());
// userOnline.sers(session.getStartTimestamp());
// userOnline.setLastAccessTime(session.getLastAccessTime());
long timeout = session.getTimeout();
if (timeout == 0L) {
userOnline.setStatus("离线");
} else {
userOnline.setStatus("在线");
}
userOnline.setTimeout(timeout);
list.add(userOnline);
}
return list;
}
public void forceLogout(String sessionId) {
Session session = sessionDAO.readSession(sessionId);
if (session != null) {
session.setTimeout(0);
session.stop();
sessionDAO.delete(session);
}
}
public int count() {
int count = 0;
Collection<Session> sessions = sessionDAO.getActiveSessions();
for (Session session : sessions) {
if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) != null) {
count++;
}
}
return count;
}
}
package im.dx.system.service;
import com.github.pagehelper.PageHelper;
import im.dx.system.mapper.VideoMapper;
import im.dx.system.model.Sbtdspsr;
import im.dx.system.model.Video;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
public class VideoService {
@Resource
private VideoMapper videoMapper;
/**
* 根据父 ID 获取所有部门下的监控信息
*/
public List<Video> selectByMutiParam(int page, int rows,String deptId,String videoName) {
PageHelper.startPage(page, rows);
return videoMapper.selectByMutiParam(deptId,videoName);
}
@Transactional
public Integer add(Sbtdspsr video) {
return videoMapper.insert(video);
}
@Transactional
public void delete(String id) {
videoMapper.delete(id);
}
public void update(Sbtdspsr video) {
videoMapper.updateByPrimaryKey(video);
}
public void updateImgSrc(String imgsrc,String sbbh) {
videoMapper.updateImgSrc(imgsrc,sbbh);
}
public int taskExists(String taskno){
return videoMapper.taskExists(taskno);
}
public int taskAutoSnapExists(String taskno){
return videoMapper.taskAutoSnapExists(taskno);
}
}
\ No newline at end of file
...@@ -20,7 +20,7 @@ spring.datasource.poolPreparedStatements= true ...@@ -20,7 +20,7 @@ spring.datasource.poolPreparedStatements= true
spring.datasource.maxOpenPreparedStatements= 20 spring.datasource.maxOpenPreparedStatements= 20
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT spring.jackson.time-zone=GMT+8
# #
spring.redis.host=172.16.24.29 spring.redis.host=172.16.24.29
spring.redis.port=6379 spring.redis.port=6379
...@@ -28,12 +28,7 @@ spring.cache.type=redis ...@@ -28,12 +28,7 @@ spring.cache.type=redis
spring.cache.redis.time-to-live=60000 spring.cache.redis.time-to-live=60000
#spring.redis.password=123456 #spring.redis.password=123456
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:mapper/*.xml
#logging.level.im.zhaojun=debug
#logging.level.org.crazycake.shiro=info
logging.pattern.console=%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID}){magenta} %clr(---){faint} %clr([%15.15t]){faint} [%15.15X{username}] [%15.15X{ip}] %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:%wEx}
spring.mvc.throw-exception-if-no-handler-found=true spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=true spring.resources.add-mappings=true
...@@ -57,20 +52,7 @@ spring.devtools.restart.exclude=static/**,public/** ...@@ -57,20 +52,7 @@ spring.devtools.restart.exclude=static/**,public/**
managername=admin managername=admin
devicesend.url=http://172.16.24.29:8089/traffdevicewriteresult/sendDevices
devicesend.timeout=1000
flvurl=http://localhost:8089/getflv
json.resisurl=http://33.50.1.21:57081/record/ecvs
qingzhi.devicewrite.url=http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite
qingzhi.devicewritesupplier.name=zksy
qingzhi.devicewrite.timeout=5000
qingzhi.eventwrite.url=http://33.50.1.213:38080/api/jtldpt/impld/trafficEventWrite
qingzhi.eventwrite.timeout=5000
eventsend.url=http://172.16.24.29:8089/sendEvents
pushrecordurl=localhost:8089/sendtouser
ipurl=:8001/api/traffic-incident/restartAutoRule ipurl=:8001/api/traffic-incident/restartAutoRule
file.addtaskurl=http://zjh189.ncpoi.cc:20000/ai/task file.addtaskurl=http://zjh189.ncpoi.cc:20000/ai/task
\ No newline at end of file
...@@ -28,11 +28,13 @@ spring.cache.redis.time-to-live=60000 ...@@ -28,11 +28,13 @@ spring.cache.redis.time-to-live=60000
#spring.redis.password=123456 #spring.redis.password=123456
mybatis.configuration.map-underscore-to-camel-case=true mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration
mybatis.mapper-locations=classpath:mapper/*.xml mybatis.mapper-locations=classpath:mapper/*.xml
logging.level.im.dx=debug logging.level.im.dx=debug
#logging.level.org.crazycake.shiro=info #logging.level.org.crazycake.shiro=info
logging.pattern.console=%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr(${PID}){magenta} %clr(---){faint} %clr([%15.15t]){faint} [%15.15X{username}] [%15.15X{ip}] %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:%wEx}
spring.mvc.throw-exception-if-no-handler-found=true spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=true spring.resources.add-mappings=true
...@@ -56,18 +58,12 @@ spring.devtools.restart.exclude=static/**,public/** ...@@ -56,18 +58,12 @@ spring.devtools.restart.exclude=static/**,public/**
managername=admin managername=admin
devicesend.url=http://172.22.135.45:8089/traffdevicewriteresult/sendDevices ipurl=:8001/api/traffic-incident/restartAutoRule
devicesend.timeout=1000 file.taskurl=http://localhost:8088/ai/task
flvurl=http://localhost:8089/getflv dixanxinAIurl=http://vca-center-provider/algorithm/router
dixanxinTokenurl=https://apicapacity.51iwifi.com/oauth/token?grantType=client_credential&appId=%s&appSecret=%s
json.resisurl=http://33.50.1.21:57081/record/ecvs appSecret=d4c221294eea3bfd
qingzhi.devicewrite.url=http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite appId=a73cd8449170af33a5bd
qingzhi.devicewritesupplier.name=zksy dianxin.stopurl=http://vca-center-distribute/preprocess/node/route/other
qingzhi.devicewrite.timeout=5000 dianxin.baseurl= https://apicapacity.51iwifi.com/rest
qingzhi.eventwrite.url=http://33.50.1.213:38080/api/jtldpt/impld/trafficEventWrite dianxin.spId=33
qingzhi.eventwrite.timeout=5000 \ No newline at end of file
eventsend.url=http://localhost:8089/sendEvents
pushrecordurl=localhost:8089/sendtouser
ipurl=:8001/api/traffic-incident/restartAutoRule
\ No newline at end of file
...@@ -25,7 +25,7 @@ spring.jackson.time-zone=GMT+8 ...@@ -25,7 +25,7 @@ spring.jackson.time-zone=GMT+8
spring.redis.host=172.16.24.29 spring.redis.host=172.16.24.29
spring.redis.port=6379 spring.redis.port=6379
spring.cache.type=redis spring.cache.type=redis
spring.cache.redis.time-to-live=60000 spring.cache.redis.time-to-live=6000
#spring.redis.password=123456 #spring.redis.password=123456
mybatis.configuration.map-underscore-to-camel-case=true mybatis.configuration.map-underscore-to-camel-case=true
...@@ -57,19 +57,7 @@ spring.devtools.restart.exclude=static/**,public/** ...@@ -57,19 +57,7 @@ spring.devtools.restart.exclude=static/**,public/**
managername=admin managername=admin
devicesend.url=http://172.22.135.45:8089/traffdevicewriteresult/sendDevices
devicesend.timeout=1000
flvurl=http://localhost:8089/getflv
json.resisurl=http://33.50.1.21:57081/record/ecvs
qingzhi.devicewrite.url=http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite
qingzhi.devicewritesupplier.name=zksy
qingzhi.devicewrite.timeout=5000
qingzhi.eventwrite.url=http://33.50.1.213:38080/api/jtldpt/impld/trafficEventWrite
qingzhi.eventwrite.timeout=5000
eventsend.url=http://localhost:8089/sendEvents eventsend.url=http://localhost:8089/sendEvents
pushrecordurl=localhost:8089/sendtouser
ipurl=:8001/api/traffic-incident/restartAutoRule ipurl=:8001/api/traffic-incident/restartAutoRule
......
spring.profiles.active=local spring.profiles.active=local
server.port=8083 server.port=8083
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.default-fetch-size=100
mybatis.configuration.default-statement-timeout=3000
mybatis.type-aliases-package=im.dx.system.model.vo
mybatis.mapper-locations=classpath:mapper/*.xml
file.rtspurl=http://zjh189.ncpoi.cc:7180/getDeviceSnapshot file.rtspurl=http://zjh189.ncpoi.cc:7180/getDeviceSnapshot
file.taskurl=http://172.16.24.29:8089/ai/task file.taskurl=http://172.16.24.29:8089/ai/task
\ No newline at end of file spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=UTF-8
\ No newline at end of file
<?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="im.dx.system.mapper.AlgorithmPreprocessMapper">
<sql id="Base_Column_List">
taskid ,devicenum ,starthour ,endhour , interval,interfaceCode,region ,spId ,status
</sql>
<insert id="insert" parameterType="im.dx.system.model.JobLJTParam">
insert into algorithmpreprocess (taskid ,devicenum ,starthour ,endhour ,
intervals,interfaceCode,region ,spId ,status,taskname)
values(#{params.taskId},#{deviceNum},#{params.starthour},#{params.endhour},#{interval},#{interfaceCode},
#{params.region},#{spId},#{status},#{params.name})
</insert>
<update id="update" parameterType="im.dx.system.model.JobLJTParam">
update algorithmpreprocess set status=#{status} where taskid=#{params.taskid}
</update>
<delete id="delete" parameterType="im.dx.system.model.JobLJTParam">
delete from algorithmpreprocess where taskid=#{params.taskid}
</delete>
<resultMap id="BaseResultMap" type="im.dx.system.model.JobLJTParam">
<result column="taskid" jdbcType="VARCHAR" property="params.taskId" />
<result column="taskname" jdbcType="VARCHAR" property="params.taskname" />
<result column="devicenum" jdbcType="VARCHAR" property="deviceNum" />
<result column="starthour" jdbcType="INTEGER" property="params.starthour" />
<result column="endhour" jdbcType="INTEGER" property="params.endhour" />
<result column="intervals" jdbcType="INTEGER" property="interval" />
<result column="interfaceCode" jdbcType="VARCHAR" property="interfaceCode" />
<result column="region" jdbcType="VARCHAR" property="params.region" />
<result column="spId" jdbcType="INTEGER" property="spId" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<select id="querytask" resultMap="BaseResultMap">
select * from algorithmpreprocess
<where>
<if test="start!='' and start=1">
starthour=#{hour} and status=2
</if>
<if test="start!='' and start=0">
endhour=#{hour} and (status=3 or status=1)
</if>
</where>
</select>
</mapper>
\ No newline at end of file
<?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="im.dx.system.mapper.AutoSnapMapper">
<select id="selectByMutiParam" resultType="im.dx.system.model.Autosnaptaskinfo">
select * from autosnaptaskinfo
</select>
<insert id="insertAutosnaptaskinfo" parameterType="im.dx.system.model.Autosnaptaskinfo">
insert into autosnaptaskinfo
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskid !=null">taskid,</if>
<if test="taskname !=null">taskname,</if>
<if test="devicenum!=null">devicenum,</if>
<if test="starthour!=null ">starthour,</if>
<if test="endhour!=null ">endhour,</if>
<if test="recordtype!=null">recordtype ,</if>
<if test="regionx !=null">regionx ,</if>
<if test="regiony !=null">regiony ,</if>
<if test="regionw !=null">regionw ,</if>
<if test="regionh !=null">regionh ,</if>
<if test="spId !=null">spId ,</if>
<if test="status !=null">status ,</if>
<if test="objectType !=null">objectType ,</if>
<if test="sendurl !=null">sendurl ,</if>
<if test="threshold !=null">threshold ,</if>
<if test="sendtype !=null">sendtype ,</if>
<if test="algorithmfrom !=null">algorithmfrom ,</if>
<if test="cjrq !=null">cjrq ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskid !=null">#{taskid} ,</if>
<if test="taskname !=null">#{taskname},</if>
<if test="devicenum!=null">#{devicenum},</if>
<if test="starthour!=null">#{starthour},</if>
<if test="endhour!=null">#{endhour},</if>
<if test="recordtype!=null">#{recordtype},</if>
<if test="regionx !=null">#{regionx},</if>
<if test="regiony !=null">#{regiony},</if>
<if test="regionw !=null">#{regionw},</if>
<if test="regionh !=null">#{regionh},</if>
<if test="spId !=null">#{spId},</if>
<if test="status !=null">#{status},</if>
<if test="objectType !=null">#{objectType},</if>
<if test="sendurl !=null">#{sendurl},</if>
<if test="threshold !=null">#{threshold},</if>
<if test="sendtype !=null">#{sendtype},</if>
<if test="algorithmfrom!=null">#{algorithmfrom},</if>
<if test="cjrq !=null">str_to_date(#{cjrq},'%Y-%m-%d %H:%i:%s'),</if>
</trim>
</insert>
<delete id="deleteAutosnaptaskinfoByid" parameterType="String">
delete from autosnaptaskinfo where taskid = #{id}
</delete>
<update id="updateByPrimaryKey" parameterType="im.dx.system.model.Autosnaptaskinfo">
update autosnaptaskinfo
set
status = #{status ,jdbcType=VARCHAR},
starthour = #{starthour ,jdbcType=VARCHAR},
endhour = #{endhour ,jdbcType=VARCHAR}
where taskid = #{taskid,jdbcType=VARCHAR}
</update>
<select id="taskAutoSnapExists" resultType="java.lang.Integer">
select count(*) from autosnaptaskinfo where taskid=#{taskno}
</select>
<update id="updateAutosnaptaskinfo">
update autosnaptaskinfo set status=#{type} where taskid=#{taskid}
</update>
<delete id="deleteAutosnaptaskinfo">
delete from autosnaptaskinfo where taskid=#{id}
</delete>
</mapper>
\ No newline at end of file
...@@ -197,19 +197,37 @@ ...@@ -197,19 +197,37 @@
where a.roleid =b.role_id and a.roleid = #{userId} where a.roleid =b.role_id and a.roleid = #{userId}
</select> </select>
<select id="selectVideoeRecordType" resultType="im.dx.system.model.QuartzTaskInformations"> <select id="selectVideoeRecordType" resultType="java.util.Map">
select id, a.taskno,a.videoid,a.taskname, a.schedulerrule , select concat(id,'')id, a.taskno,a.videoid,a.taskname, a.schedulerrule ,
CASE frozenstatus CASE frozenstatus
WHEN 'UNFROZEN' THEN '开启' WHEN 'UNFROZEN' THEN '开启'
ELSE '停止' ELSE '停止'
END frozenstatus,objectx,objecty,objectw,objecth,recordtype, END frozenstatus,objectx,objecty,objectw,objecth,recordtype,
(select name from t_code b where a.recordtype=b.key and b.type=2)sendtype (select name from t_code b where a.recordtype=b.key and b.type=2)sendtype,'1' tasktype,imgsrc
from quartz_task_informations a from quartz_task_informations a
where a.videoid=#{videoId} where a.videoid=#{videoId}
union all
select taskid id, taskid taskno,devicenum videoid,taskname taskname,
concat(starthour,'-',endhour,'时每',a.intervals,'秒')schedulerrule ,
CASE status
WHEN '2' THEN '停止'
ELSE '开启'
END frozenstatus, '' objectx,'' objecty,'' objectw,'' objecth, interfaceCode recordtype,
(select name from t_code b where a.interfaceCode=b.key and b.type=2)sendtype,'2' tasktype,imgsrc
from algorithmpreprocess a
where a.devicenum=#{videoId} and status!=4
union all
select taskid id, taskid taskno,devicenum videoid,taskname taskname,
concat(starthour,'-',endhour,'时')schedulerrule ,
CASE status
WHEN '2' THEN '停止'
ELSE '开启'
END frozenstatus, regionx objectx,regiony objecty,regionw objectw,regionh objecth, recordtype recordtype,
(select name from t_code b where a.sendtype=b.key and b.type=2)sendtype,'3' tasktype,imgsrc
from autosnaptaskinfo a
where a.devicenum=#{videoId} and status!=4
order by frozenstatus desc
<!--and c.xzbh in(-->
<!--select t1.dept_id from dept t1 left join dept t2 on t1.parent_id=t2.dept_id where t1.parent_id= #{videoId}-->
<!--or t1.dept_id = #{videoId})-->
</select> </select>
<delete id="delvideorecord"> <delete id="delvideorecord">
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
concat(menu_name, (select decode(count(*), concat(menu_name, (select decode(count(*),
0, 0,
'', '',
concat(concat('(', count(*)), ')') from concat(concat('(', count(*)), ')')) from
operator where operator where
operator.menu_id = menu.menu_id)) as menu_name, url, perms, order_num, create_time, modify_time, icon operator.menu_id = menu.menu_id)) as menu_name, url, perms, order_num, create_time, modify_time, icon
from menu from menu
......
...@@ -107,18 +107,30 @@ ...@@ -107,18 +107,30 @@
<select id="queryTraffalarmrecordByPage" resultType="im.dx.system.model.TraffpictureParam"> <select id="queryTraffalarmrecordByPage" resultType="im.dx.system.model.TraffpictureParam">
SELECT SELECT
TA.*, TA.*,
TA.createtime recordtime, TA.createtime recordtime,tdmc,dept_name xzmc, NAME recordname, b.alarmnum,
(select tdmc from sbtdspsr where sbbh=fdid and tdbh=channelid limit 1)tdmc, c.username taskhandler , state taskstate, handlertime
( SELECT dept_name FROM dept b WHERE b.dept_id = TA.areaid LIMIT 1 ) xzmc,
( SELECT b.NAME FROM t_code b where TA.recordtype = LOWER( b.KEY ) and type=2 LIMIT 1 ) recordname,
( SELECT b.alarmnum FROM t_code b where TA.recordtype = LOWER( b.KEY ) and type=2 LIMIT 1) alarmnum,
( SELECT concat(b.handler,'_',state,'_',handlertime) FROM taskinfo b where TA.id =traffid LIMIT 1) remark
FROM FROM
traffpicture TA traffpicture TA
<where> LEFT JOIN sbtdspsr ON sbbh = fdid
AND tdbh = channelid
LEFT JOIN dept on dept_id = TA.areaid
LEFT JOIN t_code b ON TA.recordtype = LOWER( b.KEY ) AND type = 2
<if test="sfpf!= null and sfpf==1">
INNER JOIN (
select a.*,b.username from
taskinfo a,t_user b where user_id=a.HANDLER and handler=#{userId})c ON TA.id = traffid
where c.id is not null
</if>
<if test="sfpf== null or sfpf==0">
LEFT JOIN (
select a.*,b.username from
taskinfo a,t_user b where user_id=a.HANDLER and handler=#{userId})c ON TA.id = traffid
where c.id is null
</if>
<if test="recordtype!=null and recordtype.size>0"> <if test="recordtype!=null and recordtype.size>0">
AND AND
<foreach collection="recordtype" open="(" close=")" separator=" OR " item="item"> <foreach collection="recordtype" open="(" close=")" separator=" OR " item="item">
...@@ -139,9 +151,6 @@ ...@@ -139,9 +151,6 @@
(processstatus= #{item} ) (processstatus= #{item} )
</foreach> </foreach>
</if> </if>
<if test="sfpf!= null and sfpf==1">
AND id in( select traffid from taskinfo where handler=#{userId} )
</if>
<if test="videoids!= null and videoids.size>0"> <if test="videoids!= null and videoids.size>0">
AND AND
...@@ -149,11 +158,56 @@ ...@@ -149,11 +158,56 @@
( TA.fdid = #{item} ) ( TA.fdid = #{item} )
</foreach> </foreach>
</if> </if>
</where>
ORDER BY TA.createtime DESC ORDER BY TA.createtime DESC
</select> </select>
<select id="queryTaskInfoByPage" resultType="im.dx.system.model.TraffpictureParam">
SELECT
TA.*,
TA.createtime recordtime,tdmc,dept_name xzmc, NAME recordname, b.alarmnum,
concat( c.handler, '_', state, '_', handlertime ) remark
FROM
traffpicture TA
LEFT JOIN sbtdspsr ON sbbh = fdid
AND tdbh = channelid
LEFT join dept on dept_id = TA.areaid
LEFT JOIN t_code b ON TA.recordtype = LOWER( b.KEY )AND type = 2
<if test="sfpf!= null and sfpf==1">
inner JOIN taskinfo c ON TA.id = traffid and handler=#{userId}
where c.id is not null
</if>
<if test="sfpf== null or sfpf==0">
LEFT JOIN taskinfo c ON TA.id = traffid and handler=#{userId}
where c.id is null
</if>
<if test="recordtype!=null and recordtype.size>0">
AND
<foreach collection="recordtype" open="(" close=")" separator=" OR " item="item">
(TA.recordtype= #{item} )
</foreach>
</if>
<if test="starttime!=null and starttime != ''">
AND TA.createtime >= STR_TO_DATE( #{starttime}, '%Y-%m-%d %H:%i:%s' )
</if>
<if test="endtime!=null and endtime != ''">
AND TA.createtime &lt;= STR_TO_DATE( #{endtime}, '%Y-%m-%d %H:%i:%s' )
</if>
<if test="processstatus!= null and processstatus.size>0">
AND
<foreach collection="processstatus" open="(" close=")" separator=" OR " item="item">
(processstatus= #{item} )
</foreach>
</if>
<if test="videoids!= null and videoids.size>0">
AND
<foreach collection="videoids" open="(" close=")" separator=" OR " item="item">
( TA.fdid = #{item} )
</foreach>
</if>
ORDER BY TA.createtime DESC
</select>
<update id="updateTraffalarmrecordById" parameterType="java.util.List"> <update id="updateTraffalarmrecordById" parameterType="java.util.List">
update traffpicture set processstatus= update traffpicture set processstatus=
<foreach collection="list" item="item" index="index" open="case id" close="end" separator=" "> <foreach collection="list" item="item" index="index" open="case id" close="end" separator=" ">
...@@ -255,10 +309,11 @@ ...@@ -255,10 +309,11 @@
<select id="selectPushRecordsBypage" resultType="im.dx.system.model.TraffalarmrecordResult"> <select id="selectPushRecordsBypage" resultType="im.dx.system.model.TraffalarmrecordResult">
SELECT A.*,B.TDMC TDMC,C.NAME RECORDNAME, SELECT A.*,B.TDMC TDMC,C.NAME RECORDNAME,
(SELECT dept_NAME FROM dept B WHERE B.dept_ID=A.AREAID limit 1 )XZMC D.dept_NAME XZMC
FROM traffpicture A FROM traffpicture A
INNER JOIN SBTDSPSR B ON A.FDID=B.SBBH AND A.CHANNELID=B.TDBH INNER JOIN SBTDSPSR B ON A.FDID=B.SBBH AND A.CHANNELID=B.TDBH
LEFT JOIN T_CODE C ON C.KEY=UPPER(RECORDTYPE) LEFT JOIN T_CODE C ON C.KEY=UPPER(RECORDTYPE)
LEFT JOIN dept D ON D.dept_ID=A.AREAID
<where> <where>
<if test="starttime != '' and starttime != null "> <if test="starttime != '' and starttime != null ">
AND A.CREATETIME >= STR_TO_DATE( #{starttime}, '%Y-%m-%d %H:%i:%s' ) AND A.CREATETIME >= STR_TO_DATE( #{starttime}, '%Y-%m-%d %H:%i:%s' )
...@@ -266,7 +321,6 @@ ...@@ -266,7 +321,6 @@
<if test="endtime != '' and endtime != null "> <if test="endtime != '' and endtime != null ">
AND A.CREATETIME <![CDATA[ <= ]]>STR_TO_DATE( #{endtime}, '%Y-%m-%d %H:%i:%s' ) AND A.CREATETIME <![CDATA[ <= ]]>STR_TO_DATE( #{endtime}, '%Y-%m-%d %H:%i:%s' )
</if> </if>
<if test="pushstatus!=null and pushstatus!=9"> <if test="pushstatus!=null and pushstatus!=9">
AND PUSHSTATUS = #{pushstatus} AND PUSHSTATUS = #{pushstatus}
</if> </if>
...@@ -276,15 +330,9 @@ ...@@ -276,15 +330,9 @@
<if test="tdmc!=null and tdmc!=''"> <if test="tdmc!=null and tdmc!=''">
AND (B.TDMC like concat('%',#{tdmc},'%') AND (B.TDMC like concat('%',#{tdmc},'%')
</if> </if>
<if test="deptid!=null and deptid!=''"> <if test="userId!=null and userId!=''">
AND areaid in ( select t1.dept_id AND sbbh in ( select videorecordtypeid from user_role a , role_videoerecordtype b where
from dept t1 a.role_id=b.roleid and a.user_id=#{userId})
left join dept t2
on t1.parent_id = t2.dept_id
where t1.parent_id =#{deptid}
or t1.dept_id = #{deptid}
or t2.parent_id =#{deptid}
or t2.dept_id = #{deptid})
</if> </if>
<if test="construction!=null and construction.size>0"> <if test="construction!=null and construction.size>0">
and ( and (
...@@ -524,7 +572,7 @@ ...@@ -524,7 +572,7 @@
delete from traffpicture where delete from traffpicture where
<if test="list!= null and list.size>0"> <if test="list!= null and list.size>0">
<foreach collection="list" open="(" close=")" separator=" OR " item="item"> <foreach collection="list" open="(" close=")" separator=" OR " item="item">
(id= #{item.id} ) (id= #{item.recordid} )
</foreach> </foreach>
</if> </if>
</delete> </delete>
...@@ -533,7 +581,7 @@ ...@@ -533,7 +581,7 @@
delete from taskinfo where delete from taskinfo where
<if test="list!= null and list.size>0"> <if test="list!= null and list.size>0">
<foreach collection="list" open="(" close=")" separator=" OR " item="item"> <foreach collection="list" open="(" close=")" separator=" OR " item="item">
(traffid= #{item.id} ) (traffid= #{item.recordid} )
</foreach> </foreach>
</if> </if>
</delete> </delete>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<select id="selectByMutiParam" resultMap="BaseResultMap"> <select id="selectByMutiParam" resultMap="BaseResultMap">
select a.xh, a.tdmc, a.sbbh ,a.tdbh,a.squrllj,a.xzbh,a.jd,a.wd , b.dept_name qymc, a.tdlx select a.xh, a.tdmc, a.sbbh ,a.tdbh,a.squrllj,a.xzbh,a.jd,a.wd , b.dept_name qymc, a.tdlx,a.kz3
from sbtdspsr a,(select t1.dept_id, t1.dept_name from sbtdspsr a,(select t1.dept_id, t1.dept_name
from dept t1 from dept t1
left join dept t2 left join dept t2
...@@ -80,8 +80,10 @@ ...@@ -80,8 +80,10 @@
where xh = #{xh,jdbcType=VARCHAR} where xh = #{xh,jdbcType=VARCHAR}
</update> </update>
<select id="taskExists" resultType="java.lang.Integer"> <select id="taskExists" resultType="java.lang.Integer">
select count(*) from quartz_task_informations where taskno=#{taskno}
select count(*) from quartz_task_informations where taskno=#{tasnkno}
</select> </select>
<update id="updateImgSrc" >
update sbtdspsr set kz3=#{imgsrc} where sbbh=#{sbbh}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -191,7 +191,7 @@ html, body { ...@@ -191,7 +191,7 @@ html, body {
.modal .modal-body table tr td:first-child{ .modal .modal-body table tr td:first-child{
color: #3c3c3c; color: #3c3c3c;
text-align: right; /*text-align: right;*/
line-height: 30px; line-height: 30px;
} }
.modal .modal-body table tr td{ .modal .modal-body table tr td{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
DrawRectangle = function(id, onMouseUp, className){
document.oncontextmenu=function() {
return true;
};
this.IMG = document.getElementById(id);
var masker = document.createElement("div");
masker.id = "mask_" + id;
var position = this.getAbsolutePosition(this.IMG);
masker.style.width = position.width + "px";
masker.style.height = position.height + "px";
masker.style.left = position.left;
masker.style.top = position.top;
masker.style["background-image"] = "url("+this.IMG.src+")";
masker.className = "imgmasker";
this.masker = masker;
this.IMG.parentNode.appendChild(masker);
this.IMG.parentNode.removeChild(this.IMG);
this.isDraw = false;
this.isMouseUp = true;
this.index = 0;
this.currentDrawRectangle = null;
this.className = className;
this.RectangleDivs = [];
this.debug = true;
this._onMouseUp = onMouseUp;
this.bindListener();
};
DrawRectangle.prototype = {
bindListener: function(){
this.masker.onmousemove = this.dragSize.bind(this);
this.masker.onmouseup = this.onMouseUp.bind(this);
this.masker.onmouseout = this.onMouseOut.bind(this);
this.masker.onmouseover = this.onMouseOver.bind(this);
this.masker.onmousedown = this.drawLayer.bind(this);
this.masker.onmouseup = this.onMouseUp.bind(this);
},
drawLayer: function(){
//this.IMG.setCapture(true);
this.isDraw = true;
this.ismouseup = false;
this.index++;
var pos = this.getSourcePos();
var x = event.offsetX;
var y = event.offsetY;
var top = y + pos.top - 2;
var left = x + pos.left - 2;
var d = document.createElement("div");
// document.body.appendChild(d);
this.masker.appendChild(d);
d.style.border = "1px solid #ff0000";
d.style.width = 0;
d.style.height = 0;
d.style.overflow = "hidden";
d.style.position = "absolute";
d.style.left = left + "px";
d.style.top = top + "px";
d.style.opacity = 0.5;
d.style["z-index"] = 2;
if(this.className) {
d.className = this.className;
}
d.id = "draw" + this.index;
if (this.debug) {
d.innerHTML = "<div class='innerbg'>x:" + x + ",y:" + y + "..</div>";
}
this.currentDrawRectangle = d;
this.RectangleDivs[this.index] = {
left: left,
top: top,
el: d
};
},
getSourcePos: function(){
return this.getAbsolutePosition(this.masker);
},
dragSize: function(){
if (this.isDraw) {
if (!(event.srcElement.tagName.toLowerCase() == "div" && event.srcElement.className == "imgmasker"))
return;
var pos = this.getSourcePos();
var img_x = pos.top;
var img_y = pos.left;
var x = event.offsetX;
var y = event.offsetY;
var drawW = (x + img_x) - this.RectangleDivs[this.index].left;
var drawH = (y + img_y) - this.RectangleDivs[this.index].top;
this.currentDrawRectangle.style.width = (drawW > 0 ? drawW : -drawW) + "px";
this.currentDrawRectangle.style.height = (drawH > 0 ? drawH : -drawH) + "px";
if (drawW < 0) {
this.currentDrawRectangle.style.left = (x + img_x) + "px";
}
if (drawH < 0) {
this.currentDrawRectangle.style.top = (y + img_y) + "px";
}
if (this.debug) {
this.currentDrawRectangle.innerHTML = "<div class='innerbg'>x:" + x + ",y:" + y +
". img_x:" +
img_x +
",img_y:" +
img_y +
". drawW:" +
drawW +
",drawH:" +
drawH +
". Dleft[i]:" +
this.RectangleDivs[this.index].left +
",Dtop[i]:" +
this.RectangleDivs[this.index].top +
"src:" +
event.srcElement.tagName +
",this.isDraw: " + this.isDraw +
",this.isMouseUp: " + this.isMouseUp +
".</div>";
}
}
else {
return false;
}
},
stopDraw: function(){
this.isDraw = false;
},
onMouseOut: function(){
if (!this.isMouseUp) {
this.isDraw = false;
}
},
onMouseUp: function(){
this.isDraw = false;
this.isMouseUp = true;
//this.IMG.releaseCapture();
if(this._onMouseUp) {
this._onMouseUp.call(this, this.currentDrawRectangle);
}
},
onMouseOver: function(){
if (!this.isMouseUp) {
this.isDraw = true;
}
},
getAbsolutePosition: function(obj){
var t = obj.offsetTop;
var l = obj.offsetLeft;
var w = obj.offsetWidth;
var h = obj.offsetHeight;
while (obj = obj.offsetParent) {
t += obj.offsetTop;
l += obj.offsetLeft;
}
return {
top: t,
left: l,
width: w,
height: h
};
}
};
...@@ -6,14 +6,39 @@ let vue_right = new Vue({ ...@@ -6,14 +6,39 @@ let vue_right = new Vue({
xz_jg: getCookie("bjpt_deptId"), xz_jg: getCookie("bjpt_deptId"),
count: '', count: '',
level: '', level: '',
fy_select:20 fy_select:20,
}, },
methods: { methods: {
addtask: function (item) { addtask: function (item) {
vue_sjcx.widthdata="440px"; // vue_sjcx.widthdata="440px";
vue_sjcx.cheakallornot=null; vue_sjcx.cheakallornot=null;
vue_sjcx.sbbh=item.sbbh; vue_sjcx.sbbh=item.sbbh;
vue_sjcx.sfzdzptype=item.tdlx==2?1:0;
vue_sjcx.imgsrc=item.kz3;
$("#myModal2").modal("show"); $("#myModal2").modal("show");
let iframe=document.getElementById('iframe');
iframe.onload=function() {
document.getElementById('iframe').contentWindow.frames.setImg();
}
// setimg();
// draw = new DrawRectangle('draw-canvas', {
// src:this.imgsrc,
// layers: [{},
// {
// "x1":x,
// "y1": y,
// "x2": x+w,
// "y2": y+h,
// "width": w,
// "height": h,
// "strokeStyle": "red",
// "type": 0
// }
// ]
// });
}, },
add: function (item){ add: function (item){
$("#myjgModal1").modal("show"); $("#myjgModal1").modal("show");
...@@ -41,8 +66,7 @@ let vue_right = new Vue({ ...@@ -41,8 +66,7 @@ let vue_right = new Vue({
data: {}, data: {},
success: function (result) { success: function (result) {
vue_right.queryRY(1, true); vue_right.queryRY(1, true);
info_new("监控删除成功"); layer.alert("监控删除成功");
window.setTimeout("$('#info-warning-new').modal('hide')", 2000);
} }
}); });
...@@ -107,19 +131,256 @@ let vue_sjcx = new Vue({ ...@@ -107,19 +131,256 @@ let vue_sjcx = new Vue({
data:{ data:{
widthdata:'440px', widthdata:'440px',
cheakallornot:null, cheakallornot:null,
sbbh:null sbbh:null,
timetype:0,
detectType:null,
notljt:1,
sfzdzptype:0,
imgsrc:''
}, },
methods: methods:
{ {
setimg:function(item){
var iframe=document.getElementById("iframe");
document.getElementById('iframe').contentWindow.frames.setImg();
iframe.onload=function(){
iframe.contentWindow.document.getElementById("draw-canvas").style.backgroundImage = 'url("' + item+ '")';
}
},
changewidth: function() { changewidth: function() {
debugger;
console.log(this.cheakallornot);
if(this.cheakallornot=="0"){ if(this.cheakallornot=="0"){
this.widthdata="1050px"; this.widthdata="1070px";
this.setimg(this.imgsrc);
}
else if(this.cheakallornot=="1") {
this.widthdata = "440px";
}
},
getPic:function(){
//根据当前设备sbbh 调用抽帧服务
that=this;
$.ajax({
url: "/video/getsnap/"+this.sbbh,
dataType: "json",
type: "GET",
contentType: 'application/json',
success: function (result) {
if(result.errorCode=="0"){
that.imgsrc= result.data;
draw.src=result.data;
}
},error:function(result){
alert("获得失败!")
}
});
},
changedetectType: function(){
if(this.detectType=="15"){
//垃圾桶检测
this.notljt=0;
}else{
this.notljt=1; }
},
addtask: function (item) {
if($("#starthour").val()=="" && $("#endhour").val()!="")
{
layer.msg("请输入执行开始时刻!");
return;
}
if( $("#starthour").val()!="" && $("#endhour").val()=="")
{
layer.msg("请输入执行结束时刻!");
return;
}
if(parseInt($("#starthour").val()) >24)
{
layer.msg("开始时间超过24时!");
return;
}
if(parseInt($("#endhour").val()) >24)
{
layer.msg("结束时间超过24时!");
return;
}
if(parseInt($("#starthour").val()) > parseInt($("#endhour").val()))
{
layer.msg("执行开始时刻大于执行结束时刻,请重新输入!");
return;
}
if($("#schedulerRule").val()=='' && this.sfzdzptype==0){
layer.msg("请输入执行时间间隔!");
return;
}
if($("#name").val()==''){
layer.msg("请输入任务名称!");
return;
}
if($("#detectType").val()==''){
layer.msg("请输入事件类型!");
return;
}
if(this.detectType!="15") {
if ($("#objectType").val() == '') {
layer.msg("请输入检测对象!");
return;
}
if(this.sfzdzptype=="1")//自动抓拍的相机)
{
//调用新增自动抓拍任务
$.ajax({
url: "/video/autoSnapTask",
dataType: "json",
type: "POST",
contentType: 'application/json',
data: JSON.stringify(
{
detectType: this.detectType,
deviceId: vue_sjcx.sbbh,
type: "0",
name: $("#name").val(),
params: {
starthour: $("#starthour").val() ,
endhour:$("#endhour").val(),
thresholdValue: 0,
objectType: $("#objectType").val(),
sendType: $("#autosend").val(),//是否自动推送,
},
area: this.cheakallornot == "1" ? [] : [{
x: $("#objectxy").val().split(",")[0],
y: $("#objectxy").val().split(",")[1],
w: $("#objectxy").val().split(",")[2],
h: $("#objectxy").val().split(",")[3],
}],
callBackUrl: $("#url").val()
}
),
success: function (result) {
if (result.errorCode == '0') {
vue_right.queryRY(1, true);
layer.msg("任务新增成功", {
icon: 1,
time: 2000
});
$("#myModal2").modal("hide");
} else {
layer.msg(result.errorMsg, {
icon: 2,
time: 2000
});
}
}
});
}else {
//确认添加任务事件
$.ajax({
url: "/video/task",
dataType: "json",
type: "POST",
contentType: 'application/json',
data: JSON.stringify(
{
detectType: this.detectType,
deviceId: vue_sjcx.sbbh,
type: "0",
name: $("#name").val(),
params: {
schedulerRule: this.timetype == 0 ? $("#starthour").val() + "," + $("#endhour").val() + "," + $("#schedulerRule").val() :
$("#starthour").val() + "," + $("#endhour").val() + "," + $("#schedulerRule").val() * this.timetype * 60,
thresholdValue: 0,
objectType: $("#objectType").val(),
sendType: $("#autosend").val(),//是否自动推送,
},
area: this.cheakallornot == "1" ? [] : [{
x: $("#objectxy").val().split(",")[0],
y: $("#objectxy").val().split(",")[1],
w: $("#objectxy").val().split(",")[2],
h: $("#objectxy").val().split(",")[3],
}],
callBackUrl: $("#url").val()
}
),
success: function (result) {
if (result.errorCode == '0') {
vue_right.queryRY(1, true);
layer.msg("任务新增成功", {
icon: 1,
time: 2000
});
$("#myModal2").modal("hide");
} else {
layer.msg(result.errorMsg, {
icon: 2,
time: 2000
});
}
}
});
}
} }
else if(this.cheakallornot=="1"){ else{//调用垃圾识别算法服务
this.widthdata="440px"; $.ajax({
url: "/video/LJTtask",
dataType: "json",
type: "POST",
contentType: 'application/json',
data: JSON.stringify(
{
deviceNum: vue_sjcx.sbbh,
spId: vue_sjcx.sbbh,
interfaceCode: "NEW_LJTMYJC_001",
interval:this.timetype==0?$("#schedulerRule").val()*1000:
$("#schedulerRule").val()*this.timetype*60000 ,
status:1,
params: {
starthour: $("#starthour").val(),
endhour: $("#endhour").val(),
name :$("#name").val(),
region:{
x: $("#objectxy").val().split(",")[0],
y: $("#objectxy").val().split(",")[1],
w: $("#objectxy").val().split(",")[2],
h: $("#objectxy").val().split(",")[3],
},
sendType:$("#autosend").val()//是否自动推送
},
callBackUrl:$("#url").val()
}
),
success: function (result) {
if(result.errorCode=='0') {
vue_right.queryRY(1, true);
layer.msg("任务新增成功");
$("#myModal2").modal("hide");
}
else{
layer.alert(result.errorMsg);
}
}
});
} }
} }
}, },
...@@ -155,41 +416,6 @@ let vue_sjcx = new Vue({ ...@@ -155,41 +416,6 @@ let vue_sjcx = new Vue({
// } // }
// } // }
// }); // });
let vue_myjgModal1_edit = new Vue({
el: '#myjgModal1_edit',
data: {
data_s: {
id: '',
sbbh: '',
tdbh: '',
tdmc: '',
xzbh: '',
jd: '',
wd: '',
squrllj : '',
wbbh: '',
},
},
methods: {
define: function () {
$.ajax({
url: "/video/edit",
dataType: "json",
type: "POST",
data: vue_myjgModal1_edit.data_s,
success: function (result) {
if (result.code == 0) {
vue_right.queryRY(1, true);
$("#myjgModal1_edit").modal("hide");
info_new("监控修改成功");
window.setTimeout("$('#info-warning-new').modal('hide')", 2000);
}
}
});
}
}
});
let vue_default= new Vue({ let vue_default= new Vue({
el:"#myjgModal1", el:"#myjgModal1",
name: "el-tree-select", name: "el-tree-select",
...@@ -205,6 +431,9 @@ let vue_default= new Vue({ ...@@ -205,6 +431,9 @@ let vue_default= new Vue({
'name':'RTSP' 'name':'RTSP'
},{'id':'0', },{'id':'0',
'name':'HLS' 'name':'HLS'
},
{'id':'2',
'name':'自动抓拍'
}], }],
data_s: { data_s: {
id: '', id: '',
...@@ -244,47 +473,46 @@ let vue_default= new Vue({ ...@@ -244,47 +473,46 @@ let vue_default= new Vue({
}); });
}, },
methods: { methods: {
define: function () { define(){
if(vue_default.valueId==null || vue_default.valueId=='') if(vue_default.valueId==null || vue_default.valueId=='')
{ {
layer.msg("请选择设备所属部门!"); layer.msg("请选择设备所属部门!");
return; return;
} }
vue_default.data_s.xzbh=vue_default.valueId; vue_default.data_s.xzbh=vue_default.valueId;
if(vue_default.data_s.xh!=null && vue_default.data_s.xh!='') if(vue_default.data_s.xh!=null && vue_default.data_s.xh!='')
{//编辑监控 {//编辑监控
$.ajax({ $.ajax({
url: "/video/edit", url: "/video/edit",
dataType: "json", dataType: "json",
type: "POST", type: "POST",
data: vue_myjgModal1_edit.data_s, data: vue_default.data_s,
success: function (result) { success: function (result) {
if (result.code == 0) { if (result.code == 0) {
vue_right.queryRY(1, true); vue_right.queryRY(1, true);
$("#myjgModal1_edit").modal("hide"); $("#myjgModal1").modal("hide");
info_new("监控修改成功"); layer.msg("监控修改成功");
window.setTimeout("$('#info-warning-new').modal('hide')", 2000); }
} }
} });
}); }
} else{
else{ $.ajax({
$.ajax({ url: "/video/add",
url: "/video/add", dataType: "json",
dataType: "json", type: "POST",
type: "POST", data: vue_default.data_s,
data: vue_default.data_s, success: function (result) {
success: function (result) { if (result.code == 0) {
if (result.code == 0) { vue_right.queryRY(1, true);
vue_right.queryRY(1, true); $("#myjgModal1").modal("hide");
$("#myjgModal1").modal("hide"); info_new("监控新增成功");
info_new("监控新增成功"); window.setTimeout("$('#info-warning-new').modal('hide')", 2000);
window.setTimeout("$('#info-warning-new').modal('hide')", 2000); }
} }
} });
}); }
} },
} ,
// 初始化值 // 初始化值
initHandle() { initHandle() {
if (this.valueId) { if (this.valueId) {
...@@ -350,9 +578,6 @@ let vue_default= new Vue({ ...@@ -350,9 +578,6 @@ let vue_default= new Vue({
return father.parentId == "0"; //返回第一层 return father.parentId == "0"; //返回第一层
}) })
; ;
// return this.list;
} }
}, },
} ); } );
...@@ -362,7 +587,6 @@ var lastSelectTime = null; ...@@ -362,7 +587,6 @@ var lastSelectTime = null;
function customBusiness(data) { function customBusiness(data) {
// alert("双击获得节点名字: "+data.text); // alert("双击获得节点名字: "+data.text);
} }
function clickNode(event, data) { function clickNode(event, data) {
if (lastSelectedNodeId && lastSelectTime) { if (lastSelectedNodeId && lastSelectTime) {
var time = new Date().getTime(); var time = new Date().getTime();
...@@ -374,7 +598,6 @@ function clickNode(event, data) { ...@@ -374,7 +598,6 @@ function clickNode(event, data) {
lastSelectedNodeId = data.nodeId; lastSelectedNodeId = data.nodeId;
lastSelectTime = new Date().getTime(); lastSelectTime = new Date().getTime();
} }
//自定义双击事件 //自定义双击事件
function customDblClickFun() { function customDblClickFun() {
//节点选中时触发 //节点选中时触发
...@@ -389,10 +612,8 @@ function customDblClickFun() { ...@@ -389,10 +612,8 @@ function customDblClickFun() {
$(document).ready(function () { $(document).ready(function () {
customDblClickFun(); customDblClickFun();
}); });
function toTree(list, parId) { function toTree(list, parId) {
let len = list.length; let len = list.length;
function loop(parId) { function loop(parId) {
let res = []; let res = [];
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
...@@ -421,6 +642,5 @@ function toTree(list, parId) { ...@@ -421,6 +642,5 @@ function toTree(list, parId) {
} }
return res return res
} }
return loop(parId) return loop(parId)
} }
...@@ -204,11 +204,6 @@ let vue_sjcx = new Vue({ ...@@ -204,11 +204,6 @@ let vue_sjcx = new Vue({
data: JSON.stringify(json_s), data: JSON.stringify(json_s),
success: function (result) { success: function (result) {
// 拼接div // 拼接div
// vue_sjcx.data_table_wfpz = []; // vue_sjcx.data_table_wfpz = [];
// if (result.code == 0) { // if (result.code == 0) {
// let a_sum = result.count; // let a_sum = result.count;
......
...@@ -256,10 +256,11 @@ let vue_rgjy = new Vue({ ...@@ -256,10 +256,11 @@ let vue_rgjy = new Vue({
objlabel: 'null', objlabel: 'null',
processstatus: processstatus, processstatus: processstatus,
rectificationtype: '', rectificationtype: '',
userid: getCookie("bjpt_userId") userid: getCookie("bjpt_userId"),
sfpf:1
}; };
$.ajax({ $.ajax({
url: "/TrafficStatistics/queryTraffalarmrecordByPage/1", url: "/TrafficStatistics/queryTaskInfoByPage",
dateType: 'json', dateType: 'json',
type: "POST", type: "POST",
contentType: 'application/json', contentType: 'application/json',
......
let state_sj = true;
var layer;
layui.config({
base: '/lib/layui/extend/'
}).use(['layer'], function () {
layer=layui.layer;
});
let vue_rwpfhistory = new Vue({
el: '#rwpfhistory',
data: {
searchText: '',
show: true,
data_sjlxs: [],
data_table_wfpz: [],
num: 0,
num1: 1000,
sjlx: '',
data_sjlxs1: [],
count: '',
deptId: getCookie("bjpt_deptId"),
fy_select: 12,
gd_span: '',
show_nums: false,
state_arr: [],
cllx_select: [],
taskwp_select:[{
'id':0,
'name':''
},
{
'id':1,
'name':''
},
],
taskwpmodel_select:[],
clzt_select: [{
'id':0,
'name':'未处理'
},{'id':1,
'name':'正检'
},{'id':2,
'name':'误检'
},{'id':3,
'name':'重复事件'
}],
arr_cllx: [],
jk_s: [],
check_s: false,
cllx: [],
jk_arr: [],
sjlx_select:[],
model_select:[],
taskwpmodel_select:null
},
methods: {
fastSearch: function () {
this.xzml();
},
xzml: function () {
$.ajax({
url: "/dept/getDeptParent/" + getCookie("bjpt_deptId"),
dataType: "json",
type: "GET",
data: {},
success: function (result) {
if (result.code == 0) {
let parIds = result.data[0].parentId;
$.ajax({
url: "/dept/listvideo",
dataType: "json",
type: "GET",
data: {
deptId: getCookie("bjpt_deptId"),
username: getCookie("bjpt_realName"),
tdmc: vue_rwpfhistory.searchText,
},
success: function (result) {
let defaultData = [];
vue_rwpfhistory.jk_arr = [];
if (result.code == 0) {
vue_rwpfhistory.jk_arr = result.data;
defaultData = toTree(result.data, parIds + '');
$('#tree-xzxq').treeview({
expandIcon: 'glyphicon glyphicon-triangle-right selected-span',
collapseIcon: 'glyphicon glyphicon-triangle-bottom selected-span',
nodeIcon: 'glyphicon glyphicon-folder-open selected-span',
selectedBackColor: '#ff000000',
selectedColor: '#368ff3',
onhoverColor: '#73a5ff26',
showBorder: false,
data: defaultData,
multiSelect: false,
level: 2,
showCheckbox: 1,//复选框设置,也可以是true
onNodeChecked: function (event, node) { //选中节点
let selectNodes = getChildNodeIdArr(node); //获取所有子节点
if (selectNodes) { //子节点不为空,则选中所有子节点
$(this).treeview('checkNode', [selectNodes, {silent: true}]);
}
//如果当前节点的子节点都被选中了。则父节点也应该要选中
setParentNodeCheck(node);
}, onNodeUnchecked: function (event, node) { //取消选中节点
let selectNodes = getChildNodeIdArr(node); //获取所有子节点
if (selectNodes) { //子节点不为空,则取消选中所有子节点
$(this).treeview('uncheckNode', [selectNodes, {silent: true}]);
}
}, onNodeExpanded: function (event, data) {
}, onNodeSelected: function (event, node) {
}
});
vue_rwpfhistory.query(1, true);
}
}
});
}
}
});
},
qh_tab: function (el) {
if (el == 1) {
this.show = false;
} else {
this.show = true;
}
},
//事件类型切换
change: function (item, index) {
this.num = index;
this.num1 = 1000;
this.sjlx = item.id;
this.gd_span = '';
vue_rwpfhistory.query(1, true);
},
//事件类型切换
change_gd: function (item, index) {
this.num = 5;
this.sjlx = item.id;
this.num1 = index;
this.gd_span = item.name;
vue_rwpfhistory.query(1, true);
},
//详情
xq: function (item) {
vue_sjsstx.video_src = '';
vue_sjsstx.data_sj = item;
vue_sjsstx.class_s = 'class_1';
vue_sjsstx.class_s1 = 'class_2';
vue_sjsstx.show_s = false;
vue_sjsstx.img_src_s = '';
vue_sjsstx.data_wfsp = [];
//根据type 查询 详情
$.ajax({
url: "/TrafficStatistics/queryTraffDetail/" + item.id + "/" + item.metatype,
dateType: 'json',
type: "GET",
contentType: 'application/json',
success: function (result) {
if (result.code == 0) {
//获得 json 的值,将详细信息展示在界面上
if (item.metatype == "3") {
vue_sjsstx.dataface = result.data[0];
}
else if (item.metatype == "1") {
vue_sjsstx.datapede = result.data[0];
}
else if (item.metatype == "2") {
vue_sjsstx.datatraffic = result.data[0];
}
else if (item.metatype == "4") {
vue_sjsstx.datapeople = result.data[0];
}
}
$("#myModal").modal("show");
}
});
if (item.imagedata != null && item.imagedata!='') {
vue_sjsstx.img_src_s ="http://zjh189.ncpoi.cc:7080"+item.imagedata;
vue_sjsstx.data_wfsp.push({src: "http://zjh189.ncpoi.cc:7080"+item.imagedata});
}
if (item.img2path != null && item.img2path!='') {
if(item.img2path.indexOf("http:")>-1) {
vue_sjsstx.img_src_s ="http://zjh189.ncpoi.cc:7080"+item.img2path;
vue_sjsstx.data_wfsp.push({src: item.img2path});
}
}
if (item.img3path != null && item.img3path!='') {
if(item.img3path.indexOf("http:")>-1) {
// vue_sjsstx.img_src_s = '/TrafficStatistics/fielagent?ftpPath=' + item.img3path;
vue_sjsstx.data_wfsp.push({src: item.img3path});
}
}
if (item.img4path != null && item.img4path!='') {
if(item.img4path.indexOf("http:")>-1) {
// vue_sjsstx.img_src_s = '/TrafficStatistics/fielagent?ftpPath=' + item.img4path;
vue_sjsstx.data_wfsp.push({src: item.img4path});
}
}
if (item.img5path != null && item.img4path!='') {
if(item.img5path.indexOf("http:")>-1) {
vue_sjsstx.data_wfsp.push({src: item.img5path});
}
}
}
,
query: function (pages, items) {
let nodes = $('#tree-xzxq').treeview('getChecked').filter(n => n.level == null
).
map(n => {
return n.href
}
)
;
let arr_nodes = "";
if (nodes!=null && nodes.length > 0) {
nodes.forEach((item, index) => {
arr_nodes = arr_nodes + item + ',';
})
;
}
if ($('#tree-xzxq').treeview('getChecked').length > 0 && nodes.length == 0) {
arr_nodes = "null";
}
;
$(".div-ul").find('input').each(function () {
$(this).removeAttr("checked", false);
$(this).prop("checked", false);
});
this.show_nums = false;
// arr_nodes = arr_nodes.substring(0,arr_nodes.length -1);
let starttime = $("#kssj").val().substr(0, 19);
let endtime = $("#kssj").val().substr(22, 19);
let li = this.fy_select;
// let type = this.sjlx.toLowerCase();
let type = "";
if (this.sjlx_select!=null &&this.sjlx_select.length >0) {
type=this.sjlx_select.join(",")
}
;
let processstatus = "";
if (this.model_select!=null &&this.model_select.length > 0) {
processstatus=this.model_select.join(",");
}
let json_s = {
videoids: arr_nodes,
page: pages,
limit: li,
recordtype: type,
checkstatus: "",
starttime: starttime,
endtime: endtime,
deptid: getCookie("bjpt_deptId"),
construction: '2',
objlabel: 'null',
processstatus: processstatus,
rectificationtype: '',
userid: getCookie("bjpt_userId"),
sfpf: this.taskwpmodel_select
};
$.ajax({
url: "/TrafficStatistics/queryTraffalarmrecordByPage/1",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(json_s),
success: function (result) {
vue_rwpfhistory.data_table_wfpz = [];
if (result.code == 0) {
let a_sum = result.count;
vue_rwpfhistory.count = result.count;
vue_rwpfhistory.data_table_wfpz = result.data;
if (items) {
$("#fy4").bootstrapPaginator({
bootstrapMajorVersion: 3, //版本,这里设置为3,大于2即可
currentPage: 1,//当前页
totalPages: Math.ceil(((a_sum > 0) ? a_sum : 1) / vue_rwpfhistory.fy_select),//总页数
// numberofPages: 10,//显示的页数
itemTexts: function (type, page, current) { //修改显示文字
switch (type) {
case "first":
return "首页";
case "prev":
return "上一页";
case "next":
return "下一页";
case "last":
return "末页";
case "page":
return page;
}
}, onPageClicked: function (event, originalEvent, type, page) { //异步换页
//请求加载数据
setTimeout(function () {
vue_rwpfhistory.query(page, false);
}, 100);
}
});
}
}
}
});
},
getChange: function () {
setTimeout(function () {
vue_rwpfhistory.query(1, true);
}, 100);
},
back: function(){
},
distributed: function(){
//派发,弹出窗口
if(vue_rwpfhistory.state_arr.length>0) {
$("#myModal_rwpfhistory").modal('show');
}else{
layer.msg("请选择告警信息!")
}
},
sfpfrw:function(){
let taskexists=0;
if(vue_rwpfhistory.state_arr.length>0) {
//判断是否是已经下派的任务
vue_rwpfhistory.state_arr.forEach(function (item, index) {
if (typeof item.handler != 'undefined' && item.handler != null && item.handler != '') {
taskexists = 1;
}
});
return taskexists;
}
},
del: function() {
sfpf= this.sfpfrw();
msg="确认删除该告警?";
if(sfpf==1) {
msg="存在已经被分派的告警信息,确认删除?";
}
layer.confirm(msg, {icon: 3, title: "提示"},
function (index) {
layer.close(index);
$.ajax({
url: "/TrafficStatistics/delTraffalarmrecordByIds",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(vue_rwpfhistory.state_arr),
success: function (result) {
if (result.code == 0) {
vue_rwpfhistory.query(1, true);
layer.msg("删除成功");
vue_rwpfhistory.state_arr=[];
}
else{
layer.msg("删除失败");
}
}
});
}, function (index) {//取消回调
layer.close(index);
}
);
},
cli_input: function () {
vue_rwpfhistory.state_arr = [];
$(".div-ul").find('input:checked').each(function () {
let arr = $(this).val().split("|");
vue_rwpfhistory.state_arr.push({
recordid: arr[0],
channelid: arr[1],
fdid: arr[2],
recordtime: arr[3],
recordtype: arr[4],
handler:arr[5]
});
});
if (vue_rwpfhistory.state_arr.length > 0) {
vue_rwpfhistory.show_nums = true;
} else {
vue_rwpfhistory.show_nums = false;
}
},
state_cli: function (e) {
let json_s = [];
vue_rwpfhistory.state_arr.forEach((item, index) => {
json_s.push({
id: item.id,
channelid: item.channelid,
fdid: item.fdid,
recordtime: item.recordtime,
recordtype: item.recordtype,
processstatus: e
});
})
;
$.ajax({
url: "/TrafficStatistics/updateTraffalarmrecordById",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(json_s),
success: function (result) {
if (result.code == 0) {
vue_rwpfhistory.query(1, true);
info_new("状态修改成功");
window.setTimeout("$('#info-warning-new').modal('hide')", 2000);
}
}
});
},
zdsx: function () {
vue_rwpfhistory.check_s = document.getElementById('push').checked;
},
zdtx: function () {
state_sj = document.getElementById('status').checked;
}
},
mounted(){
$("#kssj").val(getTime_extent(6).pre_rq_start + ' - ' + getTime().jssj);
$.ajax({
url: "/dept/listAllvideoIdsByDeptid",
dataType: "json",
type: "GET",
data: {
deptid: getCookie("bjpt_deptId"),
},
success: function (result) {
vue_rwpfhistory.jk_s = [];
if (result.code == 0) {
if (result.data.length > 0) {
vue_rwpfhistory.jk_s = result.data;
}
}
}
});
$.ajax({
url: "/TrafficStatistics/listcode",
dataType: "json",
type: "GET",
data: {
codeid: 3,
alarmlevel: '',
},
success: function (result) {
vue_rwpfhistory.arr_cllx = [];
if (result.code == 0) {
if (result.data.length > 0) {
vue_rwpfhistory.arr_cllx=result.data;
}
}
}
});
$.ajax({
url: "/TrafficStatistics/listcode",
dataType: "json",
type: "GET",
data: {
codeid: 2,
alarmlevel: '',
},
success: function (result) {
vue_rwpfhistory.data_sjlxs = [];
if (result.code == 0) {
if (result.data.length > 0) {
vue_rwpfhistory.data_sjlxs = result.data;
}
}
setTimeout(function () {
$("#cllxs").selectpicker('refresh');
$("#cllxs").selectpicker('render');
}, 200);
}
});
this.xzml();
//初始化模态弹窗的角色和用户数据
$.ajax({
url: "/role/list?page=1&limit=100",
dataType: "json",
type: "GET",
success: function (result) {
vue_sjsstxnow.role_select = [];
if (result.code == 0) {
if (result.data.length > 0) {
vue_sjsstxnow.role_select = result.data;
}
setTimeout(function () {
$("#role").selectpicker('refresh');
$("#role").selectpicker('render');
}, 200);
}
}
});
$.ajax({
url: "/role/listAllUsers",
dataType: "json",
type: "GET",
success: function (result) {
vue_sjsstxnow.role_select = [];
if (result.code == 0) {
if (result.data.length > 0) {
vue_sjsstxnow.user_data = result.data;
}
}
}
});
},
});
//新的模态框,三等级模态框
let vue_sjsstxnow = new Vue({
el: '#myModal_rwpfhistory',
data: {
role_select: [],
rolepmodel_select:null,
usermodel_select: null,
user_select:[],
user_data:[],
index: 0,
},
methods: {
state_cli: function (item, e, index, type) {
let json_s = [];
json_s.push({
recordid: item.recordid + '',
channelid: item.channelid,
fdid: item.fdid,
recordtime: item.recordtime,
recordtype: item.recordtype.toLowerCase(),
processstatus: e
});
$.ajax({
url: "/TrafficStatistics/updateTraffalarmrecordById",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(json_s),
success: function (result) {
if (result.code == 0) {
info_new("处理成功");
window.setTimeout("$('#info-warning-new').modal('hide')", 2000);
if (type == 1) {
vue_sjsstxnow.yjsj_data[index].ss_type = e;
} else if (type == 2) {
vue_sjsstxnow.ejsj_data[index].ss_type = e;
} else {
vue_sjsstxnow.sjsj_data[index].ss_type = e;
}
}
}
});
},
getusers:function(event,item) {
//根据角色选择的值,查询用户信息
let json = [];
roleid=parseInt(event.target.value);
this.user_data.forEach(function(item, index) {
if(item.parentid == roleid)
{
json.push(item);
}
});
this.user_select = json;
setTimeout(function () {
$("#user").selectpicker('refresh');
$("#user").selectpicker('render');
}, 200);
},
dorwpf:function(){
//获得选中的userid,告警id
let jsonstr=[];
vue_rwpfhistory.state_arr.forEach(function(item,index){
jsonstr.push(item.recordid);
});
$.ajax({
url: "/role/addtaskinfo",
dateType: 'json',
type: "POST",
data:JSON.stringify({
"traffid":jsonstr,
"userid":vue_sjsstxnow.usermodel_select
}),
contentType: 'application/json',
success: function (result) {
if (result.code == 0) {
layer.alert("派发成功!", {
icon: 1,
skin: 'layer-ext-moon'
})
$("#myModal_rwpfhistory").modal('hide');
vue_rwpfhistory.getChange();
}
else{
layer.alert("派发超时!", {
icon: 2,
skin: 'layer-ext-moon'
})
}
}
});
},
del: function () {
let json_s = [];
if(vue_rgjy.state_arr.length>0) {
layer.confirm("确认删除?", {icon: 3, title: "提示"},
function (index) {
// vue_sjcx.state_arr.forEach((item, index) = > {
// json_s.push({ id: item.id });
// });
$.ajax({
url: "/TrafficStatistics/deltaskinfoByIds",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(vue_rgjy.state_arr),
success: function (result) {
if (result.code == 0) {
layer.msg("删除成功");
layer.close(index);
vue_rgjy.query(1, true);
}
}
});
}, function (index) {//取消回调
layer.close(index);
}
);
}else{
layer.msg("请选择告警信息!");
}
},
},
mounted(){
//查询所有
}
});
function toTree(list, parId) {
let len = list.length;
function loop(parId) {
let res = [];
for (let i = 0; i < len; i++) {
let item = list[i];
if (item.parentId === parId) {
item.nodes = loop(item.href);
let arr = {
href: item.href,
text: item.text,
level: item.level,
parentId: item.parentId,
}
if (item.level == 0 || item.level == 1 || item.level == 2) {
arr.selectable = false;
arr.state = {expanded: true, checked: true};
} else {
arr.icon = 'glyphicon glyphicon-facetime-video zx',
arr.state = {expanded: false, checked: true};
arr.selectable = true;
}
if (item.nodes.length > 0) {
arr.nodes = item.nodes;
}
res.push(arr);
}
}
return res
}
return loop(parId)
}
function checkNode(parentNode, i) {
if (parentNode.nodes[i].nodes != undefined && parentNode.nodes[i].nodes.length !== 0 && parentNode.nodes[i].nodes.filter(n => n.level === null).
length > 0
)
{
for (let j = 0; j < parentNode.nodes[i].nodes.length; j++) {
let d = checkNode(parentNode.nodes[i], j);
d && j--;
}
}
else
{
parentNode.nodes.splice(i, 1);
return true
}
}
//获取选中的id
function getChildNodeIdArr(node) {
let ts = [];
if (node.nodes) {
for (let x in node.nodes) {
ts.push(node.nodes[x].nodeId);
if (node.nodes[x].nodes) {
let getNodeDieDai = getChildNodeIdArr(node.nodes[x]);
for (let j in getNodeDieDai) {
ts.push(getNodeDieDai[j]);
}
}
}
} else {
ts.push(node.nodeId);
}
return ts;
};
//设置父节点
function setParentNodeCheck(node) {
let parentNode = $("#tree-xzxq").treeview("getNode", node.parentId);
if (parentNode.nodes) {
let checkedCount = 0;
for (let x in parentNode.nodes) {
if (parentNode.nodes[x].state.checked) {
checkedCount++;
} else {
break;
}
}
if (checkedCount === parentNode.nodes.length) {
$("#tree-xzxq").treeview("checkNode", parentNode.nodeId);
setParentNodeCheck(parentNode);
}
}
};
laydate.render({
elem: '#kssj'
, type: 'datetime'
, theme: '#368ff3'
, range: true
});
// 全选/取消
$("#all").click(function () {
$(".div-ul").find('input').each(function () {
$(this).prop("checked", true);
});
vue_rwpfhistory.state_arr = [];
$(".div-ul").find('input:checked').each(function () {
// vue_rwpfhistory.state_arr.push($(this).val());
let arr = $(this).val().split("|");
vue_rwpfhistory.state_arr.push({
recordid: arr[0],
channelid: arr[1],
fdid: arr[2],
recordtime: arr[3],
recordtype: arr[4]
});
});
vue_rwpfhistory.show_nums = true;
});
$("#unall").click(function () {
$(".div-ul").find('input').each(function () {
$(this).removeAttr("checked", false);
$(this).prop("checked", false);
vue_rwpfhistory.state_arr = [];
});
vue_rwpfhistory.show_nums = false;
});
//放大缩小图片
$('[data-gallery=manual]').click(function (e) {
e.preventDefault();
var items = [],
options = {
index: $(this).index()
};
$('[data-gallery=manual]').each(function () {
items.push({
src: $(this).attr('src'),
title: '图片查看'
});
});
new PhotoViewer(items, options);
});
\ No newline at end of file
...@@ -409,8 +409,10 @@ let vue_sjcx = new Vue({ ...@@ -409,8 +409,10 @@ let vue_sjcx = new Vue({
if (result.code == 0) { if (result.code == 0) {
if (result.data.length > 0) { if (result.data.length > 0) {
vue_sjcx.data_sjlxs=result.data; vue_sjcx.data_sjlxs=result.data;
} }
} }
vue_sjcx.data_sjlxs.unshift({name: '全部', id: "", type: "",});
} }
}); });
this.xzml(); this.xzml();
......
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>激活</title>
</head>
<body>
<h1 th:text="${msg}"></h1>
</body>
</html>
\ No newline at end of file
...@@ -52,9 +52,7 @@ ...@@ -52,9 +52,7 @@
<body> <body>
<div class="error-page"> <div class="error-page">
<img class="error-page-img" th:src="@{/images/ic_403.svg}">
<div class="error-page-info"> <div class="error-page-info">
<h1>ERROR</h1>
<div class="error-page-info-desc">错误页面</div> <div class="error-page-info-desc">错误页面</div>
</div> </div>
</div> </div>
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<option value="0">未处理</option> <option value="0">未处理</option>
<option value="1">正检</option> <option value="1">正检</option>
<option value="2">误检</option> <option value="2">误检</option>
<option value="2">重复事件</option> <option value="3">重复事件</option>
</select> </select>
<span class="pub-span" style="margin-left: 10px;">是否纠偏</span> <span class="pub-span" style="margin-left: 10px;">是否纠偏</span>
<select class="form-control selectpicker" v-model="clzt_select1"> <select class="form-control selectpicker" v-model="clzt_select1">
......
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
<link rel="stylesheet" href="../element/element-ui.css"> <link rel="stylesheet" href="../element/element-ui.css">
<title>机构设备管理</title> <title>机构设备管理</title>
</head> </head>
<body> <body >
<div id="page-sy"> <div id="page-sy">
<div class="right-nav" style="width: 98%"> <div class="right-nav" style="width: 98%">
<div class="center-nav" id="jgsb"> <div class="center-nav" id="jgsb">
<div class="div-right-top"> <div class="div-right-top">
...@@ -101,11 +100,15 @@ ...@@ -101,11 +100,15 @@
<tr> <tr>
<td>设备类型:</td> <td>设备类型:</td>
<td> <td>
<select> <select required style="width:220px;height: 40px;" class="form-control selectpicker" name="tdlx" v-model="data_s.tdlx">
<option value ="1">RTSP</option> <option v-for="(item,index) in tdlxdata" :key="index"
<option value ="2">HLS</option> :value='item.id'>{{item.name}}</option>
</select> </select>
<!--<select>-->
<!--<option value ="1">RTSP</option>-->
<!--<option value ="2">HLS</option>-->
<!--<option value ="3">自动抓拍</option>-->
<!--</select>-->
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -142,7 +145,7 @@ ...@@ -142,7 +145,7 @@
<h6 class="modal-title">新增监控</h6> <h6 class="modal-title">新增监控</h6>
</div> </div>
<div class="modal-body" style="height:360px;"> <div class="modal-body" style="height:360px;">
<table class="table table-td"> <table class="table table-td" style="text-align:left ">
<tr> <tr>
<td>监控名称:</td> <td>监控名称:</td>
<td><input type="text" name="name" style="width:220px;height: 40px;" class="form-control" required v-model="data_s.tdmc" <td><input type="text" name="name" style="width:220px;height: 40px;" class="form-control" required v-model="data_s.tdmc"
...@@ -160,6 +163,7 @@ ...@@ -160,6 +163,7 @@
<option v-for="(item,index) in tdlxdata" :key="index" <option v-for="(item,index) in tdlxdata" :key="index"
:value='item.id'>{{item.name}}</option> :value='item.id'>{{item.name}}</option>
</select> </select>
</td>
</tr> </tr>
<tr> <tr>
<td>所属部门:</td> <td>所属部门:</td>
...@@ -178,15 +182,8 @@ ...@@ -178,15 +182,8 @@
</el-tree> </el-tree>
</el-option> </el-option>
</el-select> </el-select>
<!--<input type="text" name="xzbh" style="width:280px;" class="form-control" v-model="data_s.xzbh"--> </td>
<!--autocomplete="off" required></td>-->
</tr> </tr>
<!--<tr>-->
<!--<td>RTSP/HLS地址:</td>-->
<!--<td><input type="text" name="address" style="width:280px;" class="form-control" v-model="data_s.squrllj"-->
<!--autocomplete="off" required></td>-->
<!--</tr>-->
</table> </table>
</div> </div>
...@@ -202,32 +199,32 @@ ...@@ -202,32 +199,32 @@
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<form onsubmit="return false;" class="form-horizontal" role="form" onkeydown="if(event.keyCode==13){return false;}"> <form onsubmit="return false;" class="form-horizontal" role="form" onkeydown="if(event.keyCode==13){return false;}">
<div class="modal-dialog" role="document" :style="{width: widthdata}"> <div class="modal-dialog" role="document" :style="{width:widthdata}">
<div class="modal-content" style="width: 100%;"> <div class="modal-content" style="width: 100%;">
<div class="modal-header" style="background-color: rgb(48, 53, 72);"> <div class="modal-header" style="background-color: rgb(48, 53, 72);">
<button type="button" click="add_sjlx()" id="add" class="close" data-dismiss="modal" aria-label="Close"><span <button type="button" click="add_sjlx()" id="add" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true" style="color: white;" >&times;</span></button> aria-hidden="true" style="color: white;">&times;</span></button>
<h6 class="modal-title" style="color: white;">新增任务事件</h6> <h6 class="modal-title" style="color: white;">新增任务事件</h6>
</div> </div>
<div class="modal-body" > <div class="modal-body" style="text-align:left">
<table class="table table-td"> <table class="table table-td" >
<tbody> <tbody>
<tr> <tr>
<td rowspan="13" v-show="cheakallornot==0"> <td rowspan="14" width="650px" v-show="cheakallornot==0">
<iframe if="iframepic" src="/test" width="650" height="500"></iframe> <iframe src="/test" id="iframe" width="100%" height="500" style="border: none">
</iframe>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="100px">任务名称</td> <td width="100px">任务名称<font color="red">*</font></td>
<td width="240px"><input type="text" id="name" class="form-control"> </td> <td width="240px"><input type="text" id="name" class="form-control"> </td>
</td>
</tr> </tr>
<tr> <tr>
<td width="100px">事件类型</td> <td width="120px">事件类型 <font color="red">*</font></td>
<td> <td>
<select class="form-control" id="detectType" > <select class="form-control" id="detectType" v-model="detectType" required @change="changedetectType()">
<option th:value="20" > <option th:value="20" >
周界入侵 周界入侵
</option> </option>
...@@ -237,21 +234,22 @@ ...@@ -237,21 +234,22 @@
<option th:value="12" > <option th:value="12" >
结构化统计 结构化统计
</option> </option>
<option th:value="13" > <!--<option th:value="13" >-->
未戴头盔 <!--未戴头盔-->
<!--</option>-->
<option th:value="60" >
人群佩戴口罩
</option> </option>
<option th:value="14" > <option th:value="15" >
是否佩戴口罩 垃圾满溢
</option> </option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr v-show="notljt==1">
<td width="120px">检测对象<font color="red">*</font></td>
<td width="100px">检测对象</td>
<!--1:人脸,2:机动车,3:非机动车,4:人-->
<td width="240px"> <td width="240px">
<select class="form-control" id="objectType"> <select class="form-control" id="objectType" required>
<option th:value="0" > <option th:value="0" >
所有 所有
</option> </option>
...@@ -268,47 +266,57 @@ ...@@ -268,47 +266,57 @@
</option> </option>
</select> </select>
</td> </tr> </td>
<!--<tr>-->
<!--<td width="100px">视频输入类型</td>-->
<!--<td width="240px">-->
<!--<select class="form-control" id="tasktype">-->
<!--</option>-->
<!--<option th:value="1" >-->
<!--rtsp地址-->
<!--</option>-->
<!--<option th:value="2" >-->
<!--hls地址-->
<!--</option>-->
<!--</select>-->
<!--</td>-->
<!--</tr>-->
</tr> </tr>
<tr>
<td width="100px">相机是否自动抓拍<font color="red">*</font></td>
<td width="240px">
<select class="form-control" id="sfzdzp" v-model="sfzdzptype" required disabled>
<option th:value=0 selected>
</option>
<option th:value=1 >
</option>
</select>
</td>
</tr> </tr>
<tr> <tr>
<td width="100px">执行开始时</td> <td width="100px">执行开始时刻</td>
<td width="240px"> <input type="number" class="form-control" max="23" min="0" id="starthour"> </td> <td width="240px"> <input type="number" class="form-control" max=23 min=0 id="starthour"> </td>
</tr> </tr>
<tr> <tr>
<td width="100px">执行结束时刻</td> <td width="100px">执行结束时刻</td>
<td width="240px"> <input type="number" class="form-control" max="23" min="0" id="endhour"> </td> <td width="240px"> <input type="number" class="form-control" max=23 min=0 id="endhour"> </td>
</tr> </tr>
<tr> <tr v-show="sfzdzptype==0">
<td width="100px">执行间隔(s)</td> <td width="100px">执行时间单位</td>
<td width="240px"> <input type="number" class="form-control" max="59" min="1" id="schedulerRule"> </td> <td width="240px">
<select class="form-control" id="ts" v-model="timetype" required>
<option th:value=0 >
</option>
<option th:value=1 >
</option>
</select>
</td>
</tr> </tr>
<tr> <tr v-show="sfzdzptype==0">
<td>告警阈值</td> <td width="100px">执行时间间隔<font color="red">*</font></td>
<td width="240px"><input type="number" id="thresholdValue" class="form-control" th:value="0"> </td> <td width="240px"> <input type="number" required class="form-control" max="59" min="1" id="schedulerRule"> </td>
</tr>
<tr v-show="notljt==1">
<td>告警阀值 <font color="red">*</font></td>
<td width="240px"><input type="number" required id="thresholdValue" class="form-control"min="0" th:value="0"> </td>
</tr> </tr>
<tr id="threshold" > <tr v-show="notljt==1" id="threshold" >
<td>是否自动推送</td> <td>是否自动推送<font color="red">*</font></td>
<td width="240px"> <td width="240px">
<select class="form-control" id="autosend"> <select class="form-control" id="autosend" required>
<option th:value="1" > <option th:value="1" selected >
</option> </option>
<option th:value="0" > <option th:value="0" >
...@@ -317,48 +325,44 @@ ...@@ -317,48 +325,44 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr >
<td>是否全区域检测</td> <td width="150px">是否全区域检测<font color="red">*</font></td>
<td width="240px"> <td width="240px">
<select class="form-control" id="allarea" v-model="cheakallornot" @change="changewidth()"> <select class="form-control" required id="allarea" v-model="cheakallornot" @change="changewidth()">
<option th:value="1" > <option th:value="1" selected>
</option> </option>
<option th:value="0" > <option th:value="0" >
</option> </option>
</select> </select>
</td>
<input type="text" v-model="imgsrc" id="imgsrc" style="display: none;">
</td>
</tr> </tr>
<tr v-show="cheakallornot==0"> <tr v-show="cheakallornot==0">
<td>识别区域(x,y,w,h)</td> <td width="150px">识别区域(x,y,w,h)<font color="red">*</font></td>
<td width="240px"> <td width="240px">
<input type="text" id="objectxy" class="form-control"> <input type="text" id="objectxy" required class="form-control">
<a id="getwidth" href="javascript:void(0)" <a id="getwidth" href="javascript:void(0)" v-on:click="getPic()"
style="float: left;padding-left: 12px;padding-top: 10px;">刷新图片</a> style="float: left;padding-left: 12px;padding-top: 10px;">刷新图片</a>
</td> </td>
</tr> </tr>
<tr> <tr v-show="notljt==1">
<td>告警回调地址</td> <td width="150px"> 告警回调地址<font color="red">*</font></td>
<td colspan="1"><input type="text" class="form-control" id="url"> </td> <td colspan="1"><input required type="text" class="form-control" id="url"> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-sm" data-dismiss="modal" style="color: #2f2f2f;">关闭</button> <button type="button" class="btn btn-sm" data-dismiss="modal" style="color: #2f2f2f;">关闭</button>
<button type="button submit" class="btn btn-sm btn-info" style="background-color: #368ff3" onclick="define()">确定 <button type="button submit" class="btn btn-sm btn-info" style="background-color: #368ff3" @click="addtask">确定
</button> </button>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
...@@ -374,6 +378,428 @@ ...@@ -374,6 +378,428 @@
<script src="../js/util/http_util.js"></script> <script src="../js/util/http_util.js"></script>
<script src="../element/element-ui.js"></script> <script src="../element/element-ui.js"></script>
<script src="../js/jgsbgl/jgsbgl.js"></script> <script src="../js/jgsbgl/jgsbgl.js"></script>
<!--<script src="../js/jgsbgl/DrawRectangle.js"></script>-->
<style>
* {
padding: 0;
margin: 0;
}
#draw-canvas {
display: block;
margin: 0px auto;
}
.innerbg {
background:#ff0000;
filter:Alpha(Opacity=40, FinishOpacity=90, Style=0, StartX=0, StartY=0, FinishX=100, FinishY=100);
width:100%;
height:100%;
}
div.imgmasker {
position: absolute;
z-index: 1;
cursor: pointer;
border:1px solid red;
background:#000000;
opacity: 1;
}
</style>
<script>
var x=0,y=0,w=600,h=400;
class DrawRectangle {
constructor(id, options) {
this.canvas = document.getElementById(id); //canvas标签
this.ctx = this.canvas.getContext('2d');
this.currentR = null; //单前点击的矩形框
this.startX = 0; //开始X坐标
this.startY = 0; //开始Y坐标
this.endX = 0; // 结束X坐标
this.endY = 0; // 结束Y坐标
this.layers = options && options.layers || []; //图层
this.optype = 0; //op操作类型 0 无操作 1 画矩形框 2 拖动矩形框
this.scale = 1; //放大倍数
this.scaleStep = 1.05; //
this.flag = false; //是否点击鼠标的标志
this.type = 0; //鼠标移动类型
this.topDistance = 0; //
this.leftDistance = 0; //
this.ratew = 1;
this.rateh = 1;
this.config = {
width: 600,
height: 400,
dashedColor: 'red', //虚线颜色
solidColor: 'red', //实线颜色
src: null, //图片的路径
}
if (options) {
for (const key in options) {
this.config[key] = options[key]
}
}
this.setImageBackground(this.config.src);
this.canvas.onmouseleave = ()=>
{
this.canvas.onmousedown = null;
this.canvas.onmousemove = null;
this.canvas.onmouseup = null;
}
this.canvas.onmouseenter = ()=>
{
this.canvas.onmousedown = this.mousedown.bind(this);
this.canvas.onmousemove = this.mousemove.bind(this);
document.onmouseup = this.mouseup.bind(this);
}
}
init(cvw, cvh, imgw, imgh) {
var item = this.layers[1];
this.ratew = cvw / imgw;
this.rateh = cvh / imgh;
this.ctx.beginPath();
this.startX = (item.x1) * this.ratew;
this.startY = (item.y1) * this.rateh;
this.endX = (item.x1) * this.ratew + (item.width) * this.ratew;
this.endY = (item.y1) * this.ratew + (item.height) * this.rateh;
this.ctx.rect(this.startX, this.startY, (item.width) * this.ratew, (item.height) * this.rateh);
// this.ctx.rect(item.x1, item.y1, item.width, item.height);
this.ctx.strokeStyle = item.strokeStyle;
this.layers.splice(0, 1, this.fixPosition({
x1: Math.ceil(this.startX),
y1: Math.ceil(this.startY),
x2: Math.ceil(this.endX),
y2: Math.ceil(this.endY),
strokeStyle: this.config.solidColor,
type: this.type
}));
this.ctx.stroke();
document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)
+","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);
}
//设置图片为canvas的背景
setImageBackground(src) {
const img = new Image();
img.src = src;
img.onload = ()=>
{
let
actImgW = img.width,
actImgH = img.height,
imgW = actImgW,
imgH = actImgH,
rate = 1,
left = 0,
top = 0,
canvasW = 600,
canvasH = 400;
//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理
if (actImgW > canvasW || actImgH > canvasH) {
if (actImgW / actImgH >= canvasW / canvasH) {
imgW = canvasW;
rate = actImgW / canvasW;
imgH = actImgH / rate;
top = (canvasH - imgH) / 2;
} else {
imgH = canvasH;
rate = actImgH / canvasH;
imgW = actImgW / rate;
left = (canvasW - imgW) / 2;
}
} else {
left = (canvasW - imgW) / 2;
top = (canvasH - imgH) / 2;
}
this.ctx.drawImage(img, left, top, imgW, imgH);
if (img.labelVos)
drawRect(this.ctx, img, left, top, rate);
const _this = this;
//img.onload = ()=> {
_this.canvas.width = imgW;
_this.canvas.height = imgH;
_this.config.width = actImgW;
_this.config.height = actImgH;
_this.canvas.style.backgroundImage = "url(" + img.src + ")";
_this.canvas.style.backgroundSize = `${imgW}px ${imgH}px`;
_this.init(imgW, imgH, actImgW, actImgH);
// }
document.getElementById('objectxy').value=0+","+0
+","+actImgW+","+actImgH;
}
}
//左侧拉伸展
resizeLeft(rect) {
this.canvas.style.cursor = "w-resize";
if (this.flag && this.optype == 0) {
this.optype = 3;
}
if (this.flag && this.optype == 3) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x1 = this.endX;
this.currentR.width = this.currentR.x2 - this.currentR.x1
}
}
//上边框拉伸
resizeTop(rect) {
this.canvas.style.cursor = "s-resize";
if (this.flag && this.optype == 0) {
this.optype = 4;
}
if (this.flag && this.optype == 4) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
}
}
resizeWidth(rect) {
this.canvas.style.cursor = "w-resize";
if (this.flag && this.optype == 0) {
this.optype = 5;
}
if (this.flag && this.optype == 5) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x2 = this.endX;
this.currentR.width = this.currentR.x2 - this.currentR.x1
}
}
resizeHeight(rect) {
this.canvas.style.cursor = "s-resize";
if (this.flag && this.optype == 0) {
this.optype = 6;
}
if (this.flag && this.optype == 6) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
}
}
resizeLT(rect) {
this.canvas.style.cursor = "se-resize";
if (this.flag && this.optype == 0) {
this.optype = 7;
}
if (this.flag && this.optype == 7) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x1 = this.endX;
this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
this.currentR.width = this.currentR.x2 - this.currentR.x1;
}
}
resizeWH(rect) {
this.canvas.style.cursor = "se-resize";
if (this.flag && this.optype == 0) {
this.optype = 8;
}
if (this.flag && this.optype == 8) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x2 = this.endX;
this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
this.currentR.width = this.currentR.x2 - this.currentR.x1;
}
}
resizeLH(rect) {
this.canvas.style.cursor = "ne-resize";
if (this.flag && this.optype == 0) {
this.optype = 9;
}
if (this.flag && this.optype == 9) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x1 = this.endX;
this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
this.currentR.width = this.currentR.x2 - this.currentR.x1;
}
}
resizeWT(rect) {
this.canvas.style.cursor = "ne-resize";
if (this.flag && this.optype == 0) {
this.optype = 10;
}
if (this.flag && this.optype == 10) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x2 = this.endX;
this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1
this.currentR.width = this.currentR.x2 - this.currentR.x1
}
}
reshow(x, y, changesmall) {
let allNotIn = 1;
let item = this.layers[0];
this.ctx.beginPath();
console.log(item.x1);
this.ctx.rect(item.x1, item.y1, item.width, item.height);
this.ctx.strokeStyle = item.strokeStyle;
if (this.ctx.isPointInPath(x * this.scale, y * this.scale)) {
this.render(item);
allNotIn = 0;
}
this.ctx.stroke();
if (this.flag && allNotIn && this.optype < 3) {
this.optype = 1;
}
}
render(rect) {
this.canvas.style.cursor = "move";
if (this.flag && this.optype == 0) {
this.optype = 2;
}
if (this.flag && this.optype == 2) {
if (!this.currentR) {
this.currentR = rect
}
this.currentR.x2 += this.endX - this.leftDistance - this.currentR.x1;
this.currentR.x1 += this.endX - this.leftDistance - this.currentR.x1;
this.currentR.y2 += this.endY - this.topDistance - this.currentR.y1;
this.currentR.y1 += this.endY - this.topDistance - this.currentR.y1;
}
}
isPointInRetc(x, y) {
let len = this.layers.length;
for (let i = 0; i < len; i++) {
if (this.layers[i].x1 < x && x < this.layers[i].x2 && this.layers[i].y1 < y && y < this.layers[i].y2) {
return this.layers[i];
}
}
}
fixPosition(position) {
if (position.x1 > position.x2) {
let x = position.x1;
position.x1 = position.x2;
position.x2 = x;
}
if (position.y1 > position.y2) {
let y = position.y1;
position.y1 = position.y2;
position.y2 = y;
}
position.width = position.x2 - position.x1
position.height = position.y2 - position.y1
return position
}
mousedown(e) {
// if ($("#changewidthnot").val() == "1") {
this.startX = (e.pageX - this.canvas.offsetLeft-50) / this.scale;
this.startY = (e.pageY - this.canvas.offsetTop) / this.scale;
// this.startX = (e.pageX ) / this.scale;
// this.startY = (e.pageY ) / this.scale;
this.currentR = this.isPointInRetc(this.startX, this.startY);
if (this.currentR) {
this.leftDistance = this.startX - this.currentR.x1;
this.topDistance = this.startY - this.currentR.y1;
}
this.ctx.strokeRect(this.endX, this.endY, 0, 0);
this.ctx.strokeStyle = this.config.dashedColor;
this.flag = 1;
}
// }
mousemove(e) {
// if ($("#changewidthnot").val() == "1") {
this.endX = (e.pageX - this.canvas.offsetLeft) / this.scale;
this.endY = (e.pageY - this.canvas.offsetTop) / this.scale;
// this.endX = (e.pageX ) / this.scale;
// this.endY = (e.pageY) / this.scale;
// console.log(`mousemove`, this.endX, this.endY);
this.ctx.save();
this.ctx.setLineDash([5])
this.canvas.style.cursor = "crosshair";
this.ctx.clearRect(0, 0, this.config.width, this.config.height);
if (this.flag && this.optype == 1) {
this.ctx.strokeRect(this.startX, this.startY, this.endX - this.startX, this.endY - this.startY);
}
this.ctx.restore();
this.reshow(this.endX, this.endY, "1");
}
// }
mouseup(e) {
// if ($("#changewidthnot").val() == "1") {
if (this.optype == 1) {
this.layers.splice(0, 1, this.fixPosition({
x1: this.startX,
y1: this.startY,
x2: this.endX,
y2: this.endY,
strokeStyle: this.config.solidColor,
type: this.type
}))
var ratew = this.config.width / this.canvas.width;
var rateh = this.config.height / this.canvas.height;
this.layers.splice(1, 1, this.fixPosition({
x1: Math.ceil(this.startX * ratew),
y1: Math.ceil(this.startY * rateh),
x2: Math.ceil(this.endX * ratew),
y2: Math.ceil(this.endY * rateh),
strokeStyle: this.config.solidColor,
type: this.type
}));
document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)
+","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);
} else if (this.optype >= 3) {
this.fixPosition(this.currentR);
}
this.currentR = null;
this.flag = 0;
this.reshow(this.endX, this.endY);
this.optype = 0;
// }
}
}
function init(x,y,w,h) {
var objectxywh = document.getElementById('objectxy').value;
if ("" != objectxywh && undefined != objectxywh) {
pointvalue = objectxywh.split(',');
if (pointvalue.length == 4) {
x = parseInt(pointvalue[0]);
y = parseInt(pointvalue[1]);
w = parseInt(pointvalue[2]);
h = parseInt(pointvalue[3]);
}
}
}
</script>
<script> <script>
......
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
</style> </style>
<body class="animated fadeIn"> <body class="animated fadeIn">
<div class="page-loading">
<div class="page-loading">
<div class="rubik-loader"></div> <div class="rubik-loader"></div>
</div> </div>
...@@ -66,25 +65,12 @@ ...@@ -66,25 +65,12 @@
<script type="text/html" id="column-toolbar"> <script type="text/html" id="column-toolbar">
<a lay-event="del">
<shiro:hasPermission name="menu:delete"> <i class="zadmin-icon zadmin-icon-delete zadmin-oper-area zadmin-red" title="删除"></i>
</a>
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="del"> <!--<a lay-event="edit">-->
删除 <!--<i class="zadmin-icon zadmin-icon-edit-square zadmin-oper-area zadmin-blue" title="编辑"></i>-->
</button> <!--</a>-->
<!--<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="start">-->
<!--启动-->
<!--</button>-->
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="stop">
停止
</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="detail">
图片详情
</button>
</shiro:hasPermission>
<shiro:lacksPermission name="menu:update, menu:delete">
<i class="zadmin-icon zadmin-icon-wuquanxian zadmin-oper-area zadmin-red"></i>无权
</shiro:lacksPermission>
</script> </script>
<script th:src="@{/lib/jquery/jquery.min.js}"></script> <script th:src="@{/lib/jquery/jquery.min.js}"></script>
...@@ -100,9 +86,9 @@ ...@@ -100,9 +86,9 @@
<script src="../js/echarts.min.js"></script> <script src="../js/echarts.min.js"></script>
<script src="../js/echarts-liquidfill.min.js"></script> <script src="../js/echarts-liquidfill.min.js"></script>
<script src="../js/vue.js"></script> <script src="../js/vue.js"></script>
<script src="../js/vue.js"></script>
<script >
<script type="text/javascript" th:inline="javascript">
var draw; var draw;
var parentMenuId = 0; var parentMenuId = 0;
var table; var table;
...@@ -157,6 +143,7 @@ ...@@ -157,6 +143,7 @@
icon: "dtree-icon-roundclose", icon: "dtree-icon-roundclose",
title: "删除", title: "删除",
handler: function (node, $div) { handler: function (node, $div) {
debugger
del(node.nodeId); del(node.nodeId);
} }
} }
...@@ -205,9 +192,14 @@ ...@@ -205,9 +192,14 @@
, {field: 'taskname', title: '任务名称', width: "15%"} , {field: 'taskname', title: '任务名称', width: "15%"}
, {field: 'sendtype', title: 'AI类型', width: "15%"} , {field: 'sendtype', title: 'AI类型', width: "15%"}
, {field: 'videoid', title: '设备编号', width: "15%"} , {field: 'videoid', title: '设备编号', width: "15%"}
, {field: 'schedulerrule', title: '间隔时间(s)', width: "5%"} , {field: 'schedulerrule', title: '间隔时间(s)', width: "10%"}
, {title: '状态', field: 'frozenstatus', width: "15%"}, , {title: '状态', field: 'frozenstatus', width: "5%",templet:function(item) {
{title: '操作', fixed: 'right', align: 'center', toolbar: '#column-toolbar'} if(item.frozenstatus=='停止'){
return "<img src=\"../img/start.png\" width=\"24px\" onclick=\"start('"+item.taskno+"','"+item.recordtype+"','"+item.videoid+"', '"+item.tasktype+"', 1)\">";
}
return "<img src=\"../img/stop.png\" width=\"24px\" onclick=\"start('"+item.taskno+"','"+item.recordtype+"','"+item.videoid+"','"+item.tasktype+"',2)\">";
}},
{title: '操作', fixed: 'right', align: 'center', toolbar: '#column-toolbar',width: "10%"}
] ]
] ]
}); });
...@@ -219,26 +211,32 @@ ...@@ -219,26 +211,32 @@
} }
}); });
parentMenuId = obj.param.nodeId; parentMenuId = obj.param.nodeId;
$("#card-header").html("[" + obj.param.context + "]的子菜单"); $("#card-header").html("[" + obj.param.context + "]的任务");
}); });
table.on('toolbar', function (obj) { table.on('tool', function (obj) {
var event = obj.event; if (obj.event === 'edit') {
if (event === 'add') { edit(obj.data.id);
add(parentMenuId); } else if (obj.event === 'del') {
start(obj.data.taskno,obj.data.recordtype,obj.data.videoid,obj.data.tasktype,3);
} }
}); });
function del(data) {
function del(taskno) { layer.confirm("你确定删除任务吗?", {icon: 3, title: '提示'},
layer.confirm("你确定删除数据吗?", {icon: 3, title: '提示'},
function (index) { function (index) {
$.get('/depttree/delvideorecord/' + taskno+"/3", function (data) { //判断是调用本地的还是第三方的
layer.close(index); if(data.taskno.startsWith("fx_") || data.taskno.startsWith("cz_")) {
handlerResult(data, function () {
refresh(); }
});
});
// $.get('/depttree/delvideorecord/' + taskno+"/3", function (data) {
// layer.close(index);
// handlerResult(data, function () {
// refresh();
// });
// });
}, function (index) { }, function (index) {
layer.close(index); layer.close(index);
} }
...@@ -256,11 +254,10 @@ ...@@ -256,11 +254,10 @@
getsnapshot(); getsnapshot();
$("#myModal2").modal("show"); $("#myModal2").modal("show");
} }
function refresh() { function refresh() {
table.reload("menu-table"); table.reload("menu-table");
DTree.menubarMethod().refreshTree(); DTree.menubarMethod().refreshTree();
} }
function add(parentId) { function add(parentId) {
$("#myModal2").modal("show"); $("#myModal2").modal("show");
} }
...@@ -278,8 +275,6 @@ ...@@ -278,8 +275,6 @@
if($(this).val()){ if($(this).val()){
$("#tasktypename").text($("#tasktype option:selected").text())} $("#tasktypename").text($("#tasktype option:selected").text())}
}); });
}); });
function define () { function define () {
if ($("#recordtype").val() == '') { if ($("#recordtype").val() == '') {
...@@ -324,36 +319,161 @@ ...@@ -324,36 +319,161 @@
} }
}); });
} }
function getsnapshot() function getsnapshot()
{ {
$.ajax({ $.ajax({
url: "/video/getSnapshot", url: "/video/getSnapshot",
dataType: "json", dataType: "json",
type: "post", type: "post",
contentType: 'application/json', contentType: 'application/json',
data: JSON.stringify($("#videoid").val()), data: JSON.stringify($("#videoid").val()),
success: function (result) { success: function (result) {
if (result.status == 200) { if (result.status == 200) {
draw.src = result.message.split(",")[0]; draw.src = result.message.split(",")[0];
draw.setImageBackground(result.message.split(",")[0]); draw.setImageBackground(result.message.split(",")[0]);
init(); init();
} }
else{ else{
alert("超时!"); alert("超时!");
init(); init();
} }
}, },
error:function (result) { error:function (result) {
alert("超时!"); alert("超时!");
}
});
} }
});
}
$("#getwidth").on('click', function (e) { $("#getwidth").on('click', function (e) {
getsnapshot(); getsnapshot();
}); });
function start(taskno,recordtype,videoid,tasktype,indexnum){
//开启任务
if(tasktype=="1")
{
if(indexnum==3){
layer.confirm("你确定删除任务吗?", {icon: 3, title: '提示'},
function (index) {
localtask(taskno,recordtype,videoid,indexnum);
}, function (index) {
layer.close(index);
});
}else{
localtask(taskno,recordtype,videoid,indexnum);
}
}
else if(tasktype=="2"){
if(indexnum==3){
layer.confirm("你确定删除任务吗?", {icon: 3, title: '提示'},
function (index) {
othertasj(taskno,recordtype,videoid,indexnum);
}, function (index) {
layer.close(index);
});
}
else{
othertasj(taskno,recordtype,videoid,indexnum);
}
}
else if(tasktype=="3"){//自动抓拍的任务
if(indexnum==3){
layer.confirm("你确定删除任务吗?", {icon: 3, title: '提示'},
function (index) {
autosnaptasj(taskno,recordtype,videoid,indexnum);
}, function (index) {
layer.close(index);
});
}
else{
autosnaptasj(taskno,recordtype,videoid,indexnum);
}
}
table.reload("menu-table");
}
function localtask(taskno,recordtype,videoid,index){
//开启本地任务//0新增 1开启 2停止 3删除
$.ajax({
url: "/video/task",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(
{ deviceId: videoid,
detectType: recordtype,
type: index,
params:{
taskno:taskno
}
}),
success: function (result) {
if (result.errorCode == -1) {
layer.msg("失败!")
}
if (result.errorCode == 0) {
layer.msg("成功!")
table.reload("menu-table");
}
}
});
}
function othertasj(taskno,recordtype,videoid,index){
// 1:新建,2:暂停,3:重启,4:删除
$.ajax({
url: "/video/taskmange",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(
{
deviceNum: videoid,
status: index==1?3:index==2?index:index==3?4:1,
params: {
taskId: taskno,
}
}),
success: function (result) {
if (result.errorCode == -1) {
layer.msg(result.errorMsg)
}
if (result.errorCode == 0) {
layer.msg("成功!")
table.reload("menu-table");
}
}
});
}
function autosnaptasj(taskno,recordtype,videoid,index){
// 1:新建,2:暂停,3:重启,4:删除
$.ajax({
url: "/video/autosnaptaskmange",
dateType: 'json',
type: "POST",
contentType: 'application/json',
data: JSON.stringify(
{
deviceNum: videoid,
type: index,
params: {
taskId: taskno,
}
}),
success: function (result) {
if (result.errorCode == -1) {
layer.msg(result.errorMsg)
}
if (result.errorCode == 0) {
layer.msg("成功!")
table.reload("menu-table");
}
}
});
}
</script> </script>
......
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="UTF-8">
<title>菜单权限</title>
<link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}"/>
<link rel="stylesheet" th:href="@{/css/common.css}">
<link rel="stylesheet" th:href="@{/css/animate.min.css}">
<link rel="stylesheet" th:href="@{/iconfont/iconfont.css}">
</head>
<style>
html, body {
height: 100%;
margin:0;padding:0;
font-size: 12px;
}
div{
-moz-box-sizing: border-box; /*Firefox3.5+*/
-webkit-box-sizing: border-box; /*Safari3.2+*/
-o-box-sizing: border-box; /*Opera9.6*/
-ms-box-sizing: border-box; /*IE8*/
box-sizing: border-box; /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.layui-table-view .layui-table {width:100%}
</style>
<body class="animated fadeIn">
<div class="page-loading">
<div class="rubik-loader"></div>
</div>
<div style="height: 100%">
<div style="height: 100%">
<div style="padding: 20px; background-color: #F2F2F2;height:100%;">
<div class="layui-row layui-col-space15">
<div class="layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">菜单树</div>
<div class="layui-card-body" id="toolbarDiv">
<ul id="menuTree" class="dtree" data-id="0"></ul>
</div>
</div>
</div>
<div class="layui-col-md9">
<div class="layui-card">
<div class="layui-card-header" id="card-header">菜单列表</div>
<div class="layui-card-body">
<table class="layui-hide" id="menu-table"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="toolbar">
<shiro:hasPermission name="menu:add">
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add">
<i class="zadmin-icon zadmin-icon-xinzeng zadmin-oper-area"></i>
新增
</button>
</shiro:hasPermission>
</script>
<script type="text/html" id="column-toolbar">
<shiro:hasPermission name="menu:update">
<a lay-event="edit">
<i class="zadmin-icon zadmin-icon-edit-square zadmin-oper-area zadmin-blue" title="编辑"></i>
</a>
</shiro:hasPermission>
<shiro:hasPermission name="menu:delete">
<a lay-event="del">
<i class="zadmin-icon zadmin-icon-delete zadmin-oper-area zadmin-red" title="删除"></i>
</a>
</shiro:hasPermission>
<shiro:lacksPermission name="menu:update, menu:delete">
<i class="zadmin-icon zadmin-icon-wuquanxian zadmin-oper-area zadmin-red"></i>无权
</shiro:lacksPermission>
</script>
<script type="text/html" id="column-toolbar-sort">
<i class="zadmin-icon zadmin-icon-shangyimian zadmin-oper-area zadmin-blue" lay-event="up" title="上移"></i>
<i class="zadmin-icon zadmin-icon-xiayimian zadmin-oper-area zadmin-blue" lay-event="down" title="下移"></i>
<i class="zadmin-icon zadmin-icon-zhidingmian zadmin-oper-area zadmin-blue" lay-event="top" title="置顶"></i>
<i class="zadmin-icon zadmin-icon-zhidimian zadmin-oper-area zadmin-blue" lay-event="bottom" title="置底"></i>
</script>
<script th:src="@{/lib/jquery/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}"></script>
<script th:src="@{/js/common.js}"></script>
<script>
var parentMenuId = 0;
// 获取有没有删除, 更新, 和新增的权限.
var hasMenuDelete = false;
var hasMenuUpdate = false;
var hasMenuAdd = false;
$.get('/security/hasPermission/menu:update', function (data) {
hasMenuUpdate = data.data;
});
$.get('/security/hasPermission/menu:delete', function (data) {
hasMenuDelete = data.data;
});
$.get('/security/hasPermission/menu:add', function (data) {
hasMenuAdd = data.data;
});
layui.config({
base: '/lib/layui/extend/'
}).use(['jquery', 'dtree', 'layer', 'table', 'element', 'tablePlug'], function () {
var dtree = layui.dtree;
var layer = layui.layer;
var table = layui.table;
var tablePlug = layui.tablePlug;
tablePlug.smartReload.enable(true);
var DTree = dtree.render({
elem: "#menuTree",
url: "/menu/tree/root",
dataStyle: "layuiStyle",
initLevel: 5, // 初始打开节点级别
method: "GET",
dot: false, // 圆点是否显示
toolbar: true, // 右键工具栏
menubar: true, // 树上方工具栏, 展开、收缩、刷新、搜索等
toolbarShow: [],
toolbarScroll: "#toolbarDiv",
toolbarExt: [
{
toolbarId: "add",
icon: "dtree-icon-roundadd",
title: "添加子菜单",
handler: function (node, $div) {
add(node.nodeId);
}
},
{
toolbarId: "edit",
icon: "dtree-icon-bianji",
title: "编辑",
handler: function (node, $div) {
edit(node.nodeId);
}
},
{
toolbarId: "remove",
icon: "dtree-icon-roundclose",
title: "删除",
handler: function (node, $div) {
del(node.nodeId);
}
}
],
response: {
statusCode: 0,
message: "msg",
treeId: "id",
parentId: "parentId",
title: "name"
},
toolbarFun:{
loadToolbarBefore: function(buttons, param, $div) {
if(param.level === "1") { // 如果是顶级节点, 则取消编辑和删除功能.
buttons.edit = "";
buttons.remove = "";
}
if (!hasMenuAdd) {
buttons.add = "";
}
if (!hasMenuDelete) {
buttons.remove = "";
}
if (!hasMenuUpdate) {
buttons.edit = "";
}
return buttons;
}
}
});
table.render({
elem: '#menu-table'
, url: '/menu/list'
, where: {
parentId: 0
} , page: true
, cellMinWidth: 80
, toolbar: '#toolbar'
, smartReloadModel: true
, cols: [
[
{type: 'numbers', title: 'ID', width: "5%"}
, {field: 'id', title: 'ID', hide: true}
, {field: 'name', title: '页面名称', width: "15%"}
, {field: 'url', title: 'URL', width: "25%"}
, {field: 'perms', title: '权限标识符', width: "15%"}
// , {title: '排序', fixed: 'right', width: "15%", align: 'center', toolbar: '#column-toolbar-sort'}
, {title: '操作', align: 'center', toolbar: '#column-toolbar'}
]
]
});
dtree.on("node('menuTree')", function (obj) {
table.reload('menu-table', {
where: {
parentId: obj.param.nodeId
}
});
parentMenuId = obj.param.nodeId;
$("#card-header").html("[" + obj.param.context + "]的子菜单");
});
table.on('toolbar', function (obj) {
var event = obj.event;
if (event === 'add') {
add(parentMenuId);
}
});
table.on('tool', function (obj) {
var data = obj.data;
var swapId;
var currentId;
if (obj.event === 'edit') {
edit(data.id);
} else if (obj.event === 'del') {
del(data.id);
} else if (obj.event === "up") {
swapId = $(obj.tr).prev().find("td[data-field='id'] div").html();
currentId = data.id;
if (typeof swapId == 'undefined') {
layer.msg("已是第一层");
return;
}
swapSort(currentId, swapId);
} else if (obj.event === "down") {
swapId = $(obj.tr).next().find("td[data-field='id'] div").html();
currentId = data.id;
if (typeof swapId == 'undefined') {
layer.msg("已是最后一层");
return;
}
swapSort(currentId, swapId);
} else if (obj.event === "top") {
swapId = $("tr[data-index='0']").first().parent().children().first().find("td[data-field='id'] div").html();
currentId = data.id;
swapSort(currentId, swapId);
} else if (obj.event === "bottom") {
swapId = $("tr[data-index='0']").first().parent().children().last().find("td[data-field='id'] div").html();
currentId = data.id;
swapSort(currentId, swapId);
}
});
function swapSort(currentId, swapId) {
$.post('/menu/swap', {currentId: currentId, swapId: swapId}, function (data) {
layer.msg("交换成功");
handlerResult(data, function () {
refresh();
});
});
}
function del(id) {
layer.confirm("你确定删除数据吗?如果存在下级节点则一并删除!", {icon: 3, title: '提示'},
function (index) {
$.post('/menu/' + id, {_method: "DELETE"}, function (data) {
layer.close(index);
handlerResult(data, function () {
refresh();
});
});
}, function (index) {
layer.close(index);
}
);
}
function refresh() {
table.reload("menu-table");
DTree.menubarMethod().refreshTree();
}
function add(parentId) {
layer.open({
content: "/menu?parentId=" + parentId,
title: "添加子菜单",
area: ['40%', '85%'],
type: 2,
maxmin: true,
shadeClose: true,
end: function () {
refresh();
}
});
}
function edit(id) {
layer.open({
content: '/menu/' + id,
title: "编辑",
area: ['40%', '85%'],
type: 2,
maxmin: true,
shadeClose: true,
end: function () {
refresh();
}
});
}
});
</script>
</body>
</html>
\ No newline at end of file
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<div style="position: absolute;right: 12px;top: 7px;border: 1px solid #e0e0e0;width: 18px;height: 18px;"> <div style="position: absolute;right: 12px;top: 7px;border: 1px solid #e0e0e0;width: 18px;height: 18px;">
<input type="checkbox" name="loginName" class="loginName" :value="item.id+'|'+item.channelid+'|'+item.fdid+'|'+item.recordtime+'|'+item.recordtype" @click="cli_input" style="width: 17px;height: 17px;margin-top: 0px;"> <input type="checkbox" name="loginName" class="loginName" :value="item.id+'|'+item.channelid+'|'+item.fdid+'|'+item.recordtime+'|'+item.recordtype" @click="cli_input" style="width: 17px;height: 17px;margin-top: 0px;">
</div> </div>
<div class="show-icon" :style="{'background':(item.processstatus==0||item.processstatus==null)?'#ff9c2b':(item.processstatus==2)?'#fc3939':(item.processstatus==1)?'#2fba08':'#cccccc'}" v-text="item.processstatus==0||item.processstatus==null?'未处理':item.processstatus==1?'正检':item.processstatus==2?'误检':'重复事件'"></div> <div class="show-icon" :style="{'background':(item.processstatus==null||item.processstatus==0||item.processstatus==-1)?'#ff9c2b':(item.processstatus==2)?'#fc3939':(item.processstatus==1)?'#2fba08':'#cccccc'}" v-text="item.processstatus==null||item.processstatus==0||item.processstatus==-1?'未处理':item.processstatus==1?'正检':item.processstatus==2?'误检':'重复事件'"></div>
<div class="li-top"> <div class="li-top">
<img :src="'http://zjh189.ncpoi.cc:7080'+item.imagedata" :id="'img'+item.id"> <img :src="'http://zjh189.ncpoi.cc:7080'+item.imagedata" :id="'img'+item.id">
<!-- <canvas :id="'cvs'+item.id" style="position: absolute;pointer-events: none;left:0;width:100%;height:100%"></canvas>--> <!-- <canvas :id="'cvs'+item.id" style="position: absolute;pointer-events: none;left:0;width:100%;height:100%"></canvas>-->
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</div> </div>
<div> <div>
<span>检测时间:</span> <span>检测时间:</span>
<span v-text="item.recordtime"></span> <span v-text="item.createtime"></span>
</div> </div>
<div> <div>
<span>通道名称:</span> <span>通道名称:</span>
...@@ -84,10 +84,10 @@ ...@@ -84,10 +84,10 @@
<!--<span v-text="item.xzmc"></span>--> <!--<span v-text="item.xzmc"></span>-->
<!--</div>--> <!--</div>-->
<div v-show="item.targetnum!=null && item.targetnum>0"> <div v-show="item.targetnum!=null && item.targetnum>0">
<span>人员密度:</span> <span>当前密度:</span>
<span v-text="item.targetnum"></span> <span v-text="item.targetnum"></span>
<span>警界值:</span> <span>警界值:</span>
<span v-text="item.alarmnum"></span> <span v-text="item.targetnum"></span>
</div> </div>
</div> </div>
<div class="li-bottom"> <div class="li-bottom">
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
<tbody class="div-pub-gt"> <tbody class="div-pub-gt">
<tr v-for="(item,index) in data_table_wfpz"> <tr v-for="(item,index) in data_table_wfpz">
<td v-text="item.recordname"></td> <td v-text="item.recordname"></td>
<td v-text="item.recordtime"></td> <td v-text="item.createtime"></td>
<td v-text="item.tdmc"></td> <td v-text="item.tdmc"></td>
<td v-text="item.xzmc"></td> <td v-text="item.xzmc"></td>
<td> <td>
......
...@@ -59,17 +59,16 @@ ...@@ -59,17 +59,16 @@
</span> </span>
<div style="padding: 10px"> <div style="padding: 10px">
<span class="div-right-top"> <span class="div-right-top">
<img v-show="taskwpmodel_select==1" src="../img/del.png" title="删除" @click="del()"> <img src="../img/back.png" title="回退" @click="back()">
<img src="../img/back.png" title="回退" @click="back()">
<img src="../img/pftask.png" title="派发" @click="distributed()"></span> <img src="../img/pftask.png" title="派发" @click="distributed()"></span>
</div> </div>
<div style="height:calc(100% - 164px);margin-top: 20px;" class="tables"> <div style="height:calc(100% - 164px);margin-top: 20px;" class="tables">
<ul class="div-ul div-pub-gt" v-if="show"> <ul class="div-ul div-pub-gt" v-if="show">
<li v-for="(item,index) in data_table_wfpz"> <li v-for="(item,index) in data_table_wfpz">
<div style="position: absolute;right: 12px;top: 7px;border: 1px solid #e0e0e0;width: 18px;height: 18px;"> <div style="position: absolute;right: 12px;top: 7px;border: 1px solid #e0e0e0;width: 18px;height: 18px;">
<input type="checkbox" name="loginName" class="loginName" :value="item.id+'|'+item.channelid+'|'+item.fdid+'|'+item.recordtime+'|'+item.recordtype" @click="cli_input" style="width: 17px;height: 17px;margin-top: 0px;"> <input type="checkbox" name="loginName" class="loginName" :value="item.id+'|'+item.channelid+'|'+item.fdid+'|'+item.recordtime+'|'+item.recordtype+'|'+item.handler" @click="cli_input" style="width: 17px;height: 17px;margin-top: 0px;">
</div> </div>
<div class="show-icon" :style="{'background':(item.processstatus==0||item.processstatus==null)?'#ff9c2b':(item.processstatus==2)?'#fc3939':(item.processstatus==1)?'#2fba08':'#cccccc'}" v-text="item.processstatus==0||item.processstatus==null?'未处理':item.processstatus==1?'正检':item.processstatus==2?'误检':'重复事件'"></div> <div class="show-icon" :style="{'background':(item.processstatus==null||item.processstatus==0||item.processstatus==-1)?'#ff9c2b':(item.processstatus==2)?'#fc3939':(item.processstatus==1)?'#2fba08':'#cccccc'}" v-text="item.processstatus==null||item.processstatus==0||item.processstatus==-1?'未处理':item.processstatus==1?'正检':item.processstatus==2?'误检':'重复事件'"></div>
<div class="li-top"> <div class="li-top">
<img :src="'http://zjh189.ncpoi.cc:7080'+item.imagedata" :id="'img'+item.id"> <img :src="'http://zjh189.ncpoi.cc:7080'+item.imagedata" :id="'img'+item.id">
<!-- <canvas :id="'cvs'+item.id" style="position: absolute;pointer-events: none;left:0;width:100%;height:100%"></canvas>--> <!-- <canvas :id="'cvs'+item.id" style="position: absolute;pointer-events: none;left:0;width:100%;height:100%"></canvas>-->
...@@ -86,10 +85,21 @@ ...@@ -86,10 +85,21 @@
<span>通道名称:</span> <span>通道名称:</span>
<span v-text="item.tdmc"></span> <span v-text="item.tdmc"></span>
</div> </div>
<!--<div>-->
<!--<span>辖区名称:</span>--> <div v-show="item.taskhandler!=null && item.taskhandler!=''">
<!--<span v-text="item.xzmc"></span>--> <span>处理人员:</span>
<!--</div>--> <span v-text="item.taskhandler"></span>
</div>
<div v-show="item.handlertime!=null && item.handlertime!=''">
<span>处理时间:</span>
<span v-text="item.handlertime"></span>
</div>
<div v-show="item.taskstate!=null && item.taskstate!=''">
<span>处理状态:</span>
<span v-text="item.taskstate==1?'待处理':'已处理'"></span>
</div>
<div v-show="item.targetnum!=null && item.targetnum>0"> <div v-show="item.targetnum!=null && item.targetnum>0">
<span>人员密度:</span> <span>人员密度:</span>
<span v-text="item.targetnum"></span> <span v-text="item.targetnum"></span>
...@@ -150,6 +160,10 @@ ...@@ -150,6 +160,10 @@
<button type="button" class="btn btn-sm btn1" id="all">全选</button> <button type="button" class="btn btn-sm btn1" id="all">全选</button>
<button type="button" class="btn btn-sm btn1" id="unall">取消</button> <button type="button" class="btn btn-sm btn1" id="unall">取消</button>
<span v-text="'已选择'+state_arr.length+'项'"></span> <span v-text="'已选择'+state_arr.length+'项'"></span>
<button type="button" class="btn btn-sm btn2" @click="state_cli(3)">重复事件</button>
<button type="button" class="btn btn-sm btn3" @click="state_cli(2)">误检</button>
<button type="button" class="btn btn-sm btn4" @click="state_cli(1)">正检</button>
<button type="button" class="btn btn-sm btn2" @click="del()">删除</button>
<!--<button type="button" class="btn btn-sm btn2" @click="state_cli(3)">重复事件</button>--> <!--<button type="button" class="btn btn-sm btn2" @click="state_cli(3)">重复事件</button>-->
<!--<button type="button" class="btn btn-sm btn3" @click="state_cli(2)">误检</button>--> <!--<button type="button" class="btn btn-sm btn3" @click="state_cli(2)">误检</button>-->
<!--<button type="button" class="btn btn-sm btn4" @click="state_cli(1)">正检</button>--> <!--<button type="button" class="btn btn-sm btn4" @click="state_cli(1)">正检</button>-->
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<td v-text="item.metatype"></td> <td v-text="item.metatype"></td>
<td v-text="item.videoid"></td> <td v-text="item.videoid"></td>
<td v-text="item.pushdesc==null?'':item.pushdesc"></td> <td v-text="item.pushdesc==null?'':item.pushdesc"></td>
<td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':'推送失败'"></td> <td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':item.pushstatus=='1'?'手动推送':'推送失败':'推送失败'"></td>
<td> <td>
<button type="button" class="btn btn-sm btn-danger" <button type="button" class="btn btn-sm btn-danger"
style="margin-left: 5px;margin-top: 0px;padding: 2px 7px;" @click="del(item)">删除 style="margin-left: 5px;margin-top: 0px;padding: 2px 7px;" @click="del(item)">删除
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<td v-text="item.xzmc"></td> <td v-text="item.xzmc"></td>
<td v-text="item.pushcount==null?'0':item.pushcount"></td> <td v-text="item.pushcount==null?'0':item.pushcount"></td>
<td v-text="item.pushdesc==null?'':item.pushdesc"></td> <td v-text="item.pushdesc==null?'':item.pushdesc"></td>
<td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':'推送失败'"></td> <td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':item.pushstatus=='1'?'手动推送':'推送失败'"></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<option value="0">未处理</option> <option value="0">未处理</option>
<option value="1">正检</option> <option value="1">正检</option>
<option value="2">误检</option> <option value="2">误检</option>
<option value="2">重复事件</option> <option value="3">重复事件</option>
</select> </select>
<span class="pub-span" style="margin-left: 10px;">自动刷新 <span class="pub-span" style="margin-left: 10px;">自动刷新
<input type="checkbox" id="push" @click="zdsx" style="width: 17px;height: 17px;margin-top: 16px;"/> <input type="checkbox" id="push" @click="zdsx" style="width: 17px;height: 17px;margin-top: 16px;"/>
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<!--<div style="position: absolute;right: 12px;top: 7px;border: 1px solid #e0e0e0;width: 18px;height: 18px;">--> <!--<div style="position: absolute;right: 12px;top: 7px;border: 1px solid #e0e0e0;width: 18px;height: 18px;">-->
<!--<input type="checkbox" name="loginName" class="loginName" :value="item.id+'|'+item.channelid+'|'+item.fdid+'|'+item.recordtime+'|'+item.recordtype" @click="cli_input" style="width: 17px;height: 17px;margin-top: 0px;">--> <!--<input type="checkbox" name="loginName" class="loginName" :value="item.id+'|'+item.channelid+'|'+item.fdid+'|'+item.recordtime+'|'+item.recordtype" @click="cli_input" style="width: 17px;height: 17px;margin-top: 0px;">-->
<!--</div>--> <!--</div>-->
<div class="show-icon" :style="{'background':(item.processstatus==0||item.processstatus==null)?'#ff9c2b':(item.processstatus==2)?'#fc3939':(item.processstatus==1)?'#2fba08':'#cccccc'}" v-text="item.processstatus==0||item.processstatus==null?'未处理':item.processstatus==1?'正检':item.processstatus==2?'误检':'重复事件'"></div> <div class="show-icon" :style="{'background':(item.processstatus==0||item.processstatus==null||item.processstatus==-1)?'#ff9c2b':(item.processstatus==2)?'#fc3939':(item.processstatus==1)?'#2fba08':'#cccccc'}" v-text="item.processstatus==null||item.processstatus==0||item.processstatus==-1?'未处理':item.processstatus==1?'正检':item.processstatus==2?'误检':'重复事件'"></div>
<div class="li-top"> <div class="li-top">
<img :src="'http://zjh189.ncpoi.cc:7080'+item.imagedata" :id="'img'+item.id"> <img :src="'http://zjh189.ncpoi.cc:7080'+item.imagedata" :id="'img'+item.id">
<!-- <canvas :id="'cvs'+item.id" style="position: absolute;pointer-events: none;left:0;width:100%;height:100%"></canvas>--> <!-- <canvas :id="'cvs'+item.id" style="position: absolute;pointer-events: none;left:0;width:100%;height:100%"></canvas>-->
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</div> </div>
<div> <div>
<span>检测时间:</span> <span>检测时间:</span>
<span v-text="item.recordtime"></span> <span v-text="item.createtime"></span>
</div> </div>
<div> <div>
<span>通道名称:</span> <span>通道名称:</span>
...@@ -108,10 +108,10 @@ ...@@ -108,10 +108,10 @@
<!--<span v-text="item.xzmc"></span>--> <!--<span v-text="item.xzmc"></span>-->
<!--</div>--> <!--</div>-->
<div v-show="item.targetnum!=null && item.targetnum>0"> <div v-show="item.targetnum!=null && item.targetnum>0">
<span>人员密度:</span> <span>密度:</span>
<span v-text="item.targetnum"></span> <span v-text="item.targetnum!=null">{{item.targetnum==null?'':item.targetnum.split('/')[0]}}</span>
<span>警界值:</span> <span>警界值:</span>
<span v-text="item.alarmnum"></span> <span v-text="item.targetnum!=null">{{item.targetnum==null?'':item.targetnum.split('/')[1]}}</span>
</div> </div>
</div> </div>
<div class="li-bottom"> <div class="li-bottom">
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
<tbody class="div-pub-gt"> <tbody class="div-pub-gt">
<tr v-for="(item,index) in data_table_wfpz"> <tr v-for="(item,index) in data_table_wfpz">
<td v-text="item.recordname"></td> <td v-text="item.recordname"></td>
<td v-text="item.recordtime"></td> <td v-text="item.createtime"></td>
<td v-text="item.tdmc"></td> <td v-text="item.tdmc"></td>
<td v-text="item.xzmc"></td> <td v-text="item.xzmc"></td>
<td> <td>
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
<select class="form-control selectpicker" v-model="clzt_select" @change="getChange_tszt()"> <select class="form-control selectpicker" v-model="clzt_select" @change="getChange_tszt()">
<option value="9">待推送</option> <option value="9">待推送</option>
<option value="0">推送成功</option> <option value="0">推送成功</option>
<option value="1">推送失败</option> <option value="-1">推送失败</option>
<option value="1">手动推送</option>
</select> </select>
<span class="pub-span" style="margin-left: 10px;">事件类型</span> <span class="pub-span" style="margin-left: 10px;">事件类型</span>
<select class="form-control selectpicker" v-model="sjlx_select" multiple id="cllxs"> <select class="form-control selectpicker" v-model="sjlx_select" multiple id="cllxs">
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
<td v-text="item.pushcount==null?'0':item.pushcount"></td> <td v-text="item.pushcount==null?'0':item.pushcount"></td>
<td v-text="item.pushdate==null?'':item.pushdate"></td> <td v-text="item.pushdate==null?'':item.pushdate"></td>
<td v-text="item.pushdesc==null?'':item.pushdesc"></td> <td v-text="item.pushdesc==null?'':item.pushdesc"></td>
<td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':'推送失败'"></td> <td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':item.pushstatus=='1'?'手动推送':'推送失败'"></td>
<td style="width: 90px;"> <td style="width: 90px;">
<button type="button" class="btn btn-sm pub-btn" <button type="button" class="btn btn-sm pub-btn"
@click="xq(item)" style="margin-left: 5px;margin-top: 0px;padding: 2px 7px;">详情 @click="xq(item)" style="margin-left: 5px;margin-top: 0px;padding: 2px 7px;">详情
...@@ -142,7 +143,7 @@ ...@@ -142,7 +143,7 @@
<td v-text="item.xzmc"></td> <td v-text="item.xzmc"></td>
<td v-text="item.recordtime"></td> <td v-text="item.recordtime"></td>
<td v-text="item.pushdesc==null?'':item.pushdesc"></td> <td v-text="item.pushdesc==null?'':item.pushdesc"></td>
<td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':'推送失败'"></td> <td v-text="item.pushstatus==null||item.pushstatus==9?'待推送':item.pushstatus==0?'推送成功':item.pushstatus==1?'手动推送':'推送失败'"></td>
<td style="width: 170px;"> <td style="width: 170px;">
<button type="button" class="btn btn-sm pub-btn pubs_1" <button type="button" class="btn btn-sm pub-btn pubs_1"
@click="xq(item)">详情 @click="xq(item)">详情
......
...@@ -12,417 +12,820 @@ ...@@ -12,417 +12,820 @@
} }
</style> </style>
<body style="width:600px;height:400px"> <body style="width:100%;height:400px">
<canvas id="draw-canvas" width="100%" height="400px" style="border:1px solid #d3d3d3;"> <canvas id="draw-canvas" width="100%" height="400px" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag. </canvas>
</canvas> <!-- <button id="up">增大</button><button id="down">减小</button><button id="cancel">撤销</button><button
<!-- <button id="up">增大</button><button id="down">减小</button><button id="cancel">撤销</button><button id="clear">清空</button> -->
id="clear">清空</button> -->
</body> </body>
<script> <script>
var x,y,w,h; var x=0,y=0,w=0,h=0;
class DrawRectangle { function setImg(){
constructor(id, options) { draw = new DrawRectangle('draw-canvas', {
this.canvas = document.getElementById(id); //canvas标签 src:parent.document.getElementById("imgsrc").value,
this.ctx = this.canvas.getContext('2d'); layers: [{},
this.currentR = null; //单前点击的矩形框
this.startX = 0; //开始X坐标
this.startY = 0; //开始Y坐标
this.endX = 0; // 结束X坐标
this.endY = 0; // 结束Y坐标
this.layers = options && options.layers || []; //图层
this.optype = 0; //op操作类型 0 无操作 1 画矩形框 2 拖动矩形框
this.scale = 1; //放大倍数
this.scaleStep = 1.05; //
this.flag = false; //是否点击鼠标的标志
this.type = 0; //鼠标移动类型
this.topDistance = 0; //
this.leftDistance = 0; //
this.ratew = 1;
this.rateh = 1;
this.config = {
width: 600,
height: 400,
dashedColor: 'red', //虚线颜色
solidColor: 'red', //实线颜色
src: null, //图片的路径
}
if (options) {
for (const key in options) {
this.config[key] = options[key]
}
}
this.setImageBackground(this.config.src);
this.canvas.onmouseleave = ()=>
{ {
this.canvas.onmousedown = null; "x1":x,
this.canvas.onmousemove = null; "y1": y,
this.canvas.onmouseup = null; "x2": x+w,
"y2": y+h,
"width": w,
"height": h,
"strokeStyle": "red",
"type": 0
} }
this.canvas.onmouseenter = ()=> ]
{ });
this.canvas.onmousedown = this.mousedown.bind(this); }
this.canvas.onmousemove = this.mousemove.bind(this); class DrawRectangle {
document.onmouseup = this.mouseup.bind(this); constructor(id, options) {
this.canvas = document.getElementById(id); //canvas标签
this.ctx = this.canvas.getContext('2d');
this.currentR = null; //单前点击的矩形框
this.startX = 0; //开始X坐标
this.startY = 0; //开始Y坐标
this.endX = 0; // 结束X坐标
this.endY = 0; // 结束Y坐标
this.layers = options && options.layers || []; //图层
this.optype = 0; //op操作类型 0 无操作 1 画矩形框 2 拖动矩形框
this.scale = 1; //放大倍数
this.scaleStep = 1.05; //
this.flag = false; //是否点击鼠标的标志
this.type = 0; //鼠标移动类型
this.topDistance = 0; //
this.leftDistance = 0; //
this.ratew = 1;
this.rateh = 1;
this.config = {
width: 600,
height: 400,
dashedColor: 'red', //虚线颜色
solidColor: 'red', //实线颜色
src: null, //图片的路径
}
if (options) {
for (const key in options) {
this.config[key] = options[key]
} }
} }
this.setImageBackground(this.config.src);
init(cvw, cvh, imgw, imgh) { this.canvas.onmouseleave = ()=>
var item = this.layers[1]; {
this.ratew = cvw / imgw; this.canvas.onmousedown = null;
this.rateh = cvh / imgh; this.canvas.onmousemove = null;
this.ctx.beginPath(); this.canvas.onmouseup = null;
this.startX = (item.x1) * this.ratew; }
this.startY = (item.y1) * this.rateh; this.canvas.onmouseenter = ()=>
this.endX = (item.x1) * this.ratew + (item.width) * this.ratew; {
this.endY = (item.y1) * this.ratew + (item.height) * this.rateh; this.canvas.onmousedown = this.mousedown.bind(this);
this.ctx.rect(this.startX, this.startY, (item.width) * this.ratew, (item.height) * this.rateh); this.canvas.onmousemove = this.mousemove.bind(this);
// this.ctx.rect(item.x1, item.y1, item.width, item.height); document.onmouseup = this.mouseup.bind(this);
this.ctx.strokeStyle = item.strokeStyle;
this.layers.splice(0, 1, this.fixPosition({
x1: Math.ceil(this.startX),
y1: Math.ceil(this.startY),
x2: Math.ceil(this.endX),
y2: Math.ceil(this.endY),
strokeStyle: this.config.solidColor,
type: this.type
}));
this.ctx.stroke();
parent.document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)
+","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);
} }
}
//设置图片为canvas的背景 init(cvw, cvh, imgw, imgh) {
setImageBackground(src) { var item = this.layers[1];
const img = new Image(); this.ratew = cvw / imgw;
img.src = src; this.rateh = cvh / imgh;
img.onload = ()=> this.ctx.beginPath();
{ this.startX = (item.x1) * this.ratew;
let this.startY = (item.y1) * this.rateh;
actImgW = img.width, this.endX = (item.x1) * this.ratew + (item.width) * this.ratew;
actImgH = img.height, this.endY = (item.y1) * this.ratew + (item.height) * this.rateh;
imgW = actImgW, this.ctx.rect(this.startX, this.startY, (item.width) * this.ratew, (item.height) * this.rateh);
imgH = actImgH, // this.ctx.rect(item.x1, item.y1, item.width, item.height);
rate = 1, this.ctx.strokeStyle = item.strokeStyle;
left = 0, this.layers.splice(0, 1, this.fixPosition({
top = 0, x1: Math.ceil(this.startX),
canvasW = 600, y1: Math.ceil(this.startY),
canvasH = 400; x2: Math.ceil(this.endX),
//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理 y2: Math.ceil(this.endY),
if (actImgW > canvasW || actImgH > canvasH) { strokeStyle: this.config.solidColor,
if (actImgW / actImgH >= canvasW / canvasH) { type: this.type
imgW = canvasW; }));
rate = actImgW / canvasW; this.ctx.stroke();
imgH = actImgH / rate; parent.document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)
top = (canvasH - imgH) / 2; +","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);
} else { }
imgH = canvasH;
rate = actImgH / canvasH; //设置图片为canvas的背景
imgW = actImgW / rate; setImageBackground(src) {
left = (canvasW - imgW) / 2; const img = new Image();
} img.src = src;
img.onload = ()=>
{
let
actImgW = img.width,
actImgH = img.height,
imgW = actImgW,
imgH = actImgH,
rate = 1,
left = 0,
top = 0,
canvasW = 600,
canvasH = 400;
//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理
if (actImgW > canvasW || actImgH > canvasH) {
if (actImgW / actImgH >= canvasW / canvasH) {
imgW = canvasW;
rate = actImgW / canvasW;
imgH = actImgH / rate;
top = (canvasH - imgH) / 2;
} else { } else {
imgH = canvasH;
rate = actImgH / canvasH;
imgW = actImgW / rate;
left = (canvasW - imgW) / 2; left = (canvasW - imgW) / 2;
top = (canvasH - imgH) / 2;
} }
//this.ctx.drawImage(img, left, top, imgW, imgH); } else {
//if (img.labelVos) left = (canvasW - imgW) / 2;
//drawRect(this.ctx, img, left, top, rate); top = (canvasH - imgH) / 2;
const _this = this; }
//img.onload = ()=> { // this.ctx.drawImage(img, left, top, imgW, imgH);
_this.canvas.width = imgW; // if (img.labelVos)
_this.canvas.height = imgH; // drawRect(this.ctx, img, left, top, rate);
_this.config.width = actImgW; const _this = this;
_this.config.height = actImgH; //img.onload = ()=> {
_this.canvas.style.backgroundImage = "url(" + img.src + ")"; _this.canvas.width = imgW;
_this.canvas.style.backgroundSize = `${imgW}px ${imgH}px`; _this.canvas.height = imgH;
_this.init(imgW, imgH, actImgW, actImgH); _this.config.width = actImgW;
// } _this.config.height = actImgH;
_this.canvas.style.backgroundImage = "url(" + img.src + ")";
_this.canvas.style.backgroundSize = `${imgW}px ${imgH}px`;
_this.init(imgW, imgH, actImgW, actImgH);
// }
parent.document.getElementById('objectxy').value=0+","+0
+","+actImgW+","+actImgH;
}
} }
}
//左侧拉伸展 //左侧拉伸展
resizeLeft(rect) { resizeLeft(rect) {
this.canvas.style.cursor = "w-resize"; this.canvas.style.cursor = "w-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 3; this.optype = 3;
} }
if (this.flag && this.optype == 3) { if (this.flag && this.optype == 3) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
}
this.currentR.x1 = this.endX;
this.currentR.width = this.currentR.x2 - this.currentR.x1
} }
this.currentR.x1 = this.endX;
this.currentR.width = this.currentR.x2 - this.currentR.x1
} }
}
//上边框拉伸 //上边框拉伸
resizeTop(rect) { resizeTop(rect) {
this.canvas.style.cursor = "s-resize"; this.canvas.style.cursor = "s-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 4; this.optype = 4;
} }
if (this.flag && this.optype == 4) { if (this.flag && this.optype == 4) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
}
this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
} }
this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
} }
}
resizeWidth(rect) { resizeWidth(rect) {
this.canvas.style.cursor = "w-resize"; this.canvas.style.cursor = "w-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 5; this.optype = 5;
} }
if (this.flag && this.optype == 5) { if (this.flag && this.optype == 5) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
}
this.currentR.x2 = this.endX;
this.currentR.width = this.currentR.x2 - this.currentR.x1
} }
this.currentR.x2 = this.endX;
this.currentR.width = this.currentR.x2 - this.currentR.x1
} }
}
resizeHeight(rect) { resizeHeight(rect) {
this.canvas.style.cursor = "s-resize"; this.canvas.style.cursor = "s-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 6; this.optype = 6;
} }
if (this.flag && this.optype == 6) { if (this.flag && this.optype == 6) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
}
this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
} }
this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1;
} }
}
resizeLT(rect) { resizeLT(rect) {
this.canvas.style.cursor = "se-resize"; this.canvas.style.cursor = "se-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 7; this.optype = 7;
} }
if (this.flag && this.optype == 7) { if (this.flag && this.optype == 7) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
} }
this.currentR.x1 = this.endX; this.currentR.x1 = this.endX;
this.currentR.y1 = this.endY; this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1; this.currentR.height = this.currentR.y2 - this.currentR.y1;
this.currentR.width = this.currentR.x2 - this.currentR.x1; this.currentR.width = this.currentR.x2 - this.currentR.x1;
}
} }
}
resizeWH(rect) { resizeWH(rect) {
this.canvas.style.cursor = "se-resize"; this.canvas.style.cursor = "se-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 8; this.optype = 8;
} }
if (this.flag && this.optype == 8) { if (this.flag && this.optype == 8) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
} }
this.currentR.x2 = this.endX; this.currentR.x2 = this.endX;
this.currentR.y2 = this.endY; this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1; this.currentR.height = this.currentR.y2 - this.currentR.y1;
this.currentR.width = this.currentR.x2 - this.currentR.x1; this.currentR.width = this.currentR.x2 - this.currentR.x1;
}
} }
}
resizeLH(rect) { resizeLH(rect) {
this.canvas.style.cursor = "ne-resize"; this.canvas.style.cursor = "ne-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 9; this.optype = 9;
} }
if (this.flag && this.optype == 9) { if (this.flag && this.optype == 9) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
} }
this.currentR.x1 = this.endX; this.currentR.x1 = this.endX;
this.currentR.y2 = this.endY; this.currentR.y2 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1; this.currentR.height = this.currentR.y2 - this.currentR.y1;
this.currentR.width = this.currentR.x2 - this.currentR.x1; this.currentR.width = this.currentR.x2 - this.currentR.x1;
}
} }
}
resizeWT(rect) { resizeWT(rect) {
this.canvas.style.cursor = "ne-resize"; this.canvas.style.cursor = "ne-resize";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 10; this.optype = 10;
} }
if (this.flag && this.optype == 10) { if (this.flag && this.optype == 10) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
} }
this.currentR.x2 = this.endX; this.currentR.x2 = this.endX;
this.currentR.y1 = this.endY; this.currentR.y1 = this.endY;
this.currentR.height = this.currentR.y2 - this.currentR.y1 this.currentR.height = this.currentR.y2 - this.currentR.y1
this.currentR.width = this.currentR.x2 - this.currentR.x1 this.currentR.width = this.currentR.x2 - this.currentR.x1
}
} }
}
reshow(x, y, changesmall) { reshow(x, y, changesmall) {
let allNotIn = 1; let allNotIn = 1;
let item = this.layers[0]; let item = this.layers[0];
this.ctx.beginPath(); this.ctx.beginPath();
console.log(item.x1); console.log(item.x1);
this.ctx.rect(item.x1, item.y1, item.width, item.height); this.ctx.rect(item.x1, item.y1, item.width, item.height);
this.ctx.strokeStyle = item.strokeStyle; this.ctx.strokeStyle = item.strokeStyle;
if (this.ctx.isPointInPath(x * this.scale, y * this.scale)) { if (this.ctx.isPointInPath(x * this.scale, y * this.scale)) {
this.render(item); this.render(item);
allNotIn = 0; allNotIn = 0;
} }
this.ctx.stroke(); this.ctx.stroke();
if (this.flag && allNotIn && this.optype < 3) { if (this.flag && allNotIn && this.optype < 3) {
this.optype = 1; this.optype = 1;
}
} }
}
render(rect) { render(rect) {
this.canvas.style.cursor = "move"; this.canvas.style.cursor = "move";
if (this.flag && this.optype == 0) { if (this.flag && this.optype == 0) {
this.optype = 2; this.optype = 2;
} }
if (this.flag && this.optype == 2) { if (this.flag && this.optype == 2) {
if (!this.currentR) { if (!this.currentR) {
this.currentR = rect this.currentR = rect
} }
this.currentR.x2 += this.endX - this.leftDistance - this.currentR.x1; this.currentR.x2 += this.endX - this.leftDistance - this.currentR.x1;
this.currentR.x1 += this.endX - this.leftDistance - this.currentR.x1; this.currentR.x1 += this.endX - this.leftDistance - this.currentR.x1;
this.currentR.y2 += this.endY - this.topDistance - this.currentR.y1; this.currentR.y2 += this.endY - this.topDistance - this.currentR.y1;
this.currentR.y1 += this.endY - this.topDistance - this.currentR.y1; this.currentR.y1 += this.endY - this.topDistance - this.currentR.y1;
}
} }
}
isPointInRetc(x, y) { isPointInRetc(x, y) {
let len = this.layers.length; let len = this.layers.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
if (this.layers[i].x1 < x && x < this.layers[i].x2 && this.layers[i].y1 < y && y < this.layers[i].y2) { if (this.layers[i].x1 < x && x < this.layers[i].x2 && this.layers[i].y1 < y && y < this.layers[i].y2) {
return this.layers[i]; return this.layers[i];
}
} }
} }
}
fixPosition(position) { fixPosition(position) {
if (position.x1 > position.x2) { if (position.x1 > position.x2) {
let x = position.x1; let x = position.x1;
position.x1 = position.x2; position.x1 = position.x2;
position.x2 = x; position.x2 = x;
}
if (position.y1 > position.y2) {
let y = position.y1;
position.y1 = position.y2;
position.y2 = y;
}
position.width = position.x2 - position.x1
position.height = position.y2 - position.y1
return position
} }
if (position.y1 > position.y2) {
let y = position.y1;
position.y1 = position.y2;
position.y2 = y;
}
position.width = position.x2 - position.x1
position.height = position.y2 - position.y1
return position
}
mousedown(e) { mousedown(e) {
// if ($("#changewidthnot").val() == "1") { // if ($("#changewidthnot").val() == "1") {
this.startX = (e.pageX - this.canvas.offsetLeft) / this.scale; this.startX = (e.pageX - this.canvas.offsetLeft) / this.scale;
this.startY = (e.pageY - this.canvas.offsetTop) / this.scale; this.startY = (e.pageY - this.canvas.offsetTop) / this.scale;
this.currentR = this.isPointInRetc(this.startX, this.startY); // this.startX = (e.pageX ) / this.scale;
if (this.currentR) { // this.startY = (e.pageY ) / this.scale;
this.leftDistance = this.startX - this.currentR.x1;
this.topDistance = this.startY - this.currentR.y1;
}
this.ctx.strokeRect(this.endX, this.endY, 0, 0);
this.ctx.strokeStyle = this.config.dashedColor;
this.flag = 1;
}
// }
mousemove(e) { this.currentR = this.isPointInRetc(this.startX, this.startY);
// if ($("#changewidthnot").val() == "1") { if (this.currentR) {
this.endX = (e.pageX - this.canvas.offsetLeft) / this.scale; this.leftDistance = this.startX - this.currentR.x1;
this.endY = (e.pageY - this.canvas.offsetTop) / this.scale; this.topDistance = this.startY - this.currentR.y1;
// console.log(`mousemove`, this.endX, this.endY); }
this.ctx.save(); this.ctx.strokeRect(this.endX, this.endY, 0, 0);
this.ctx.setLineDash([5]) this.ctx.strokeStyle = this.config.dashedColor;
this.canvas.style.cursor = "crosshair"; this.flag = 1;
this.ctx.clearRect(0, 0, this.config.width, this.config.height); }
if (this.flag && this.optype == 1) { // }
this.ctx.strokeRect(this.startX, this.startY, this.endX - this.startX, this.endY - this.startY);
} mousemove(e) {
this.ctx.restore(); // if ($("#changewidthnot").val() == "1") {
this.reshow(this.endX, this.endY, "1"); this.endX = (e.pageX - this.canvas.offsetLeft) / this.scale;
} this.endY = (e.pageY - this.canvas.offsetTop) / this.scale;
// } // this.endX = (e.pageX ) / this.scale;
// this.endY = (e.pageY) / this.scale;
// console.log(`mousemove`, this.endX, this.endY);
this.ctx.save();
this.ctx.setLineDash([5])
this.canvas.style.cursor = "crosshair";
this.ctx.clearRect(0, 0, this.config.width, this.config.height);
if (this.flag && this.optype == 1) {
this.ctx.strokeRect(this.startX, this.startY, this.endX - this.startX, this.endY - this.startY);
mouseup(e) {
// if ($("#changewidthnot").val() == "1") {
if (this.optype == 1) {
this.layers.splice(0, 1, this.fixPosition({
x1: this.startX,
y1: this.startY,
x2: this.endX,
y2: this.endY,
strokeStyle: this.config.solidColor,
type: this.type
}))
var ratew = this.config.width / this.canvas.width;
var rateh = this.config.height / this.canvas.height;
this.layers.splice(1, 1, this.fixPosition({
x1: Math.ceil(this.startX * ratew),
y1: Math.ceil(this.startY * rateh),
x2: Math.ceil(this.endX * ratew),
y2: Math.ceil(this.endY * rateh),
strokeStyle: this.config.solidColor,
type: this.type
}));
parent.document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)
+","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);
} else if (this.optype >= 3) {
this.fixPosition(this.currentR);
}
this.currentR = null;
this.flag = 0;
this.reshow(this.endX, this.endY);
this.optype = 0;
// }
} }
this.ctx.restore();
this.reshow(this.endX, this.endY, "1");
} }
init(); // }
function init() {
var objectxywh=parent.document.getElementById('objectxy').value;
if(""!=objectxywh && undefined!=objectxywh){
pointvalue=objectxywh.split(',');
if(pointvalue.length==4) {
x = parseInt(pointvalue[0]);
y = parseInt(pointvalue[1]);
w=parseInt(pointvalue[2]);
h=parseInt(pointvalue[3]);
}
} mouseup(e) {
// if ($("#changewidthnot").val() == "1") {
if (this.optype == 1) {
this.layers.splice(0, 1, this.fixPosition({
x1: this.startX,
y1: this.startY,
x2: this.endX,
y2: this.endY,
strokeStyle: this.config.solidColor,
type: this.type
}))
var ratew = this.config.width / this.canvas.width;
var rateh = this.config.height / this.canvas.height;
this.layers.splice(1, 1, this.fixPosition({
x1: Math.ceil(this.startX * ratew),
y1: Math.ceil(this.startY * rateh),
x2: Math.ceil(this.endX * ratew),
y2: Math.ceil(this.endY * rateh),
strokeStyle: this.config.solidColor,
type: this.type
}));
parent.document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)
+","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);
} else if (this.optype >= 3) {
this.fixPosition(this.currentR);
}
this.currentR = null;
this.flag = 0;
this.reshow(this.endX, this.endY);
this.optype = 0;
// }
} }
}
draw = new DrawRectangle('draw-canvas', {
src:'http://zjh189.ncpoi.cc:7180/download/202108/16/33050300001327599605/33050300001327599605_20210816_231137723.jpg',
layers: [{},
{
"x1":x,
"y1": y,
"x2": x+w,
"y2": y+h,
"width": w,
"height": h,
"strokeStyle": "red",
"type": 0
}
]
});
</script> </script>
<!--<script>-->
<!--var x,y,w,h;-->
<!--class DrawRectangle {-->
<!--constructor(id, options) {-->
<!--this.canvas = document.getElementById(id); //canvas标签-->
<!--this.ctx = this.canvas.getContext('2d');-->
<!--this.currentR = null; //单前点击的矩形框-->
<!--this.startX = 0; //开始X坐标-->
<!--this.startY = 0; //开始Y坐标-->
<!--this.endX = 0; // 结束X坐标-->
<!--this.endY = 0; // 结束Y坐标-->
<!--this.layers = options && options.layers || []; //图层-->
<!--this.optype = 0; //op操作类型 0 无操作 1 画矩形框 2 拖动矩形框-->
<!--this.scale = 1; //放大倍数-->
<!--this.scaleStep = 1.05; //-->
<!--this.flag = false; //是否点击鼠标的标志-->
<!--this.type = 0; //鼠标移动类型-->
<!--this.topDistance = 0; //-->
<!--this.leftDistance = 0; //-->
<!--this.ratew = 1;-->
<!--this.rateh = 1;-->
<!--this.config = {-->
<!--width: 600,-->
<!--height: 400,-->
<!--dashedColor: 'red', //虚线颜色-->
<!--solidColor: 'red', //实线颜色-->
<!--src: null, //图片的路径-->
<!--}-->
<!--if (options) {-->
<!--for (const key in options) {-->
<!--this.config[key] = options[key]-->
<!--}-->
<!--}-->
<!--this.setImageBackground(this.config.src);-->
<!--this.canvas.onmouseleave = ()=>-->
<!--{-->
<!--this.canvas.onmousedown = null;-->
<!--this.canvas.onmousemove = null;-->
<!--this.canvas.onmouseup = null;-->
<!--}-->
<!--this.canvas.onmouseenter = ()=>-->
<!--{-->
<!--this.canvas.onmousedown = this.mousedown.bind(this);-->
<!--this.canvas.onmousemove = this.mousemove.bind(this);-->
<!--document.onmouseup = this.mouseup.bind(this);-->
<!--}-->
<!--}-->
<!--init(cvw, cvh, imgw, imgh) {-->
<!--var item = this.layers[1];-->
<!--this.ratew = cvw / imgw;-->
<!--this.rateh = cvh / imgh;-->
<!--this.ctx.beginPath();-->
<!--this.startX = (item.x1) * this.ratew;-->
<!--this.startY = (item.y1) * this.rateh;-->
<!--this.endX = (item.x1) * this.ratew + (item.width) * this.ratew;-->
<!--this.endY = (item.y1) * this.ratew + (item.height) * this.rateh;-->
<!--this.ctx.rect(this.startX, this.startY, (item.width) * this.ratew, (item.height) * this.rateh);-->
<!--// this.ctx.rect(item.x1, item.y1, item.width, item.height);-->
<!--this.ctx.strokeStyle = item.strokeStyle;-->
<!--this.layers.splice(0, 1, this.fixPosition({-->
<!--x1: Math.ceil(this.startX),-->
<!--y1: Math.ceil(this.startY),-->
<!--x2: Math.ceil(this.endX),-->
<!--y2: Math.ceil(this.endY),-->
<!--strokeStyle: this.config.solidColor,-->
<!--type: this.type-->
<!--}));-->
<!--this.ctx.stroke();-->
<!--parent.document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)-->
<!--+","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);-->
<!--}-->
<!--//设置图片为canvas的背景-->
<!--setImageBackground(src) {-->
<!--const img = new Image();-->
<!--img.src = src;-->
<!--img.onload = ()=>-->
<!--{-->
<!--let-->
<!--actImgW = img.width,-->
<!--actImgH = img.height,-->
<!--imgW = actImgW,-->
<!--imgH = actImgH,-->
<!--rate = 1,-->
<!--left = 0,-->
<!--top = 0,-->
<!--canvasW = 600,-->
<!--canvasH = 400;-->
<!--//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理-->
<!--if (actImgW > canvasW || actImgH > canvasH) {-->
<!--if (actImgW / actImgH >= canvasW / canvasH) {-->
<!--imgW = canvasW;-->
<!--rate = actImgW / canvasW;-->
<!--imgH = actImgH / rate;-->
<!--top = (canvasH - imgH) / 2;-->
<!--} else {-->
<!--imgH = canvasH;-->
<!--rate = actImgH / canvasH;-->
<!--imgW = actImgW / rate;-->
<!--left = (canvasW - imgW) / 2;-->
<!--}-->
<!--} else {-->
<!--left = (canvasW - imgW) / 2;-->
<!--top = (canvasH - imgH) / 2;-->
<!--}-->
<!--//this.ctx.drawImage(img, left, top, imgW, imgH);-->
<!--//if (img.labelVos)-->
<!--//drawRect(this.ctx, img, left, top, rate);-->
<!--const _this = this;-->
<!--//img.onload = ()=> {-->
<!--_this.canvas.width = imgW;-->
<!--_this.canvas.height = imgH;-->
<!--_this.config.width = actImgW;-->
<!--_this.config.height = actImgH;-->
<!--_this.canvas.style.backgroundImage = "url(" + img.src + ")";-->
<!--_this.canvas.style.backgroundSize = `${imgW}px ${imgH}px`;-->
<!--_this.init(imgW, imgH, actImgW, actImgH);-->
<!--// }-->
<!--parent.document.getElementById('objectxy').value=0+","+0-->
<!--+","+actImgW+","+actImgH;-->
<!--}-->
<!--}-->
<!--//左侧拉伸展-->
<!--resizeLeft(rect) {-->
<!--this.canvas.style.cursor = "w-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 3;-->
<!--}-->
<!--if (this.flag && this.optype == 3) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x1 = this.endX;-->
<!--this.currentR.width = this.currentR.x2 - this.currentR.x1-->
<!--}-->
<!--}-->
<!--//上边框拉伸-->
<!--resizeTop(rect) {-->
<!--this.canvas.style.cursor = "s-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 4;-->
<!--}-->
<!--if (this.flag && this.optype == 4) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.y1 = this.endY;-->
<!--this.currentR.height = this.currentR.y2 - this.currentR.y1;-->
<!--}-->
<!--}-->
<!--resizeWidth(rect) {-->
<!--this.canvas.style.cursor = "w-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 5;-->
<!--}-->
<!--if (this.flag && this.optype == 5) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x2 = this.endX;-->
<!--this.currentR.width = this.currentR.x2 - this.currentR.x1-->
<!--}-->
<!--}-->
<!--resizeHeight(rect) {-->
<!--this.canvas.style.cursor = "s-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 6;-->
<!--}-->
<!--if (this.flag && this.optype == 6) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.y2 = this.endY;-->
<!--this.currentR.height = this.currentR.y2 - this.currentR.y1;-->
<!--}-->
<!--}-->
<!--resizeLT(rect) {-->
<!--this.canvas.style.cursor = "se-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 7;-->
<!--}-->
<!--if (this.flag && this.optype == 7) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x1 = this.endX;-->
<!--this.currentR.y1 = this.endY;-->
<!--this.currentR.height = this.currentR.y2 - this.currentR.y1;-->
<!--this.currentR.width = this.currentR.x2 - this.currentR.x1;-->
<!--}-->
<!--}-->
<!--resizeWH(rect) {-->
<!--this.canvas.style.cursor = "se-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 8;-->
<!--}-->
<!--if (this.flag && this.optype == 8) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x2 = this.endX;-->
<!--this.currentR.y2 = this.endY;-->
<!--this.currentR.height = this.currentR.y2 - this.currentR.y1;-->
<!--this.currentR.width = this.currentR.x2 - this.currentR.x1;-->
<!--}-->
<!--}-->
<!--resizeLH(rect) {-->
<!--this.canvas.style.cursor = "ne-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 9;-->
<!--}-->
<!--if (this.flag && this.optype == 9) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x1 = this.endX;-->
<!--this.currentR.y2 = this.endY;-->
<!--this.currentR.height = this.currentR.y2 - this.currentR.y1;-->
<!--this.currentR.width = this.currentR.x2 - this.currentR.x1;-->
<!--}-->
<!--}-->
<!--resizeWT(rect) {-->
<!--this.canvas.style.cursor = "ne-resize";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 10;-->
<!--}-->
<!--if (this.flag && this.optype == 10) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x2 = this.endX;-->
<!--this.currentR.y1 = this.endY;-->
<!--this.currentR.height = this.currentR.y2 - this.currentR.y1-->
<!--this.currentR.width = this.currentR.x2 - this.currentR.x1-->
<!--}-->
<!--}-->
<!--reshow(x, y, changesmall) {-->
<!--let allNotIn = 1;-->
<!--let item = this.layers[0];-->
<!--this.ctx.beginPath();-->
<!--console.log(item.x1);-->
<!--this.ctx.rect(item.x1, item.y1, item.width, item.height);-->
<!--this.ctx.strokeStyle = item.strokeStyle;-->
<!--if (this.ctx.isPointInPath(x * this.scale, y * this.scale)) {-->
<!--this.render(item);-->
<!--allNotIn = 0;-->
<!--}-->
<!--this.ctx.stroke();-->
<!--if (this.flag && allNotIn && this.optype < 3) {-->
<!--this.optype = 1;-->
<!--}-->
<!--}-->
<!--render(rect) {-->
<!--this.canvas.style.cursor = "move";-->
<!--if (this.flag && this.optype == 0) {-->
<!--this.optype = 2;-->
<!--}-->
<!--if (this.flag && this.optype == 2) {-->
<!--if (!this.currentR) {-->
<!--this.currentR = rect-->
<!--}-->
<!--this.currentR.x2 += this.endX - this.leftDistance - this.currentR.x1;-->
<!--this.currentR.x1 += this.endX - this.leftDistance - this.currentR.x1;-->
<!--this.currentR.y2 += this.endY - this.topDistance - this.currentR.y1;-->
<!--this.currentR.y1 += this.endY - this.topDistance - this.currentR.y1;-->
<!--}-->
<!--}-->
<!--isPointInRetc(x, y) {-->
<!--let len = this.layers.length;-->
<!--for (let i = 0; i < len; i++) {-->
<!--if (this.layers[i].x1 < x && x < this.layers[i].x2 && this.layers[i].y1 < y && y < this.layers[i].y2) {-->
<!--return this.layers[i];-->
<!--}-->
<!--}-->
<!--}-->
<!--fixPosition(position) {-->
<!--if (position.x1 > position.x2) {-->
<!--let x = position.x1;-->
<!--position.x1 = position.x2;-->
<!--position.x2 = x;-->
<!--}-->
<!--if (position.y1 > position.y2) {-->
<!--let y = position.y1;-->
<!--position.y1 = position.y2;-->
<!--position.y2 = y;-->
<!--}-->
<!--position.width = position.x2 - position.x1-->
<!--position.height = position.y2 - position.y1-->
<!--return position-->
<!--}-->
<!--mousedown(e) {-->
<!--// if ($("#changewidthnot").val() == "1") {-->
<!--console.log("offsetLeft"+this.canvas.offsetLeft);-->
<!--console.log("offsetTop"+this.canvas.offsetTop);-->
<!--console.log("e.pageX"+e.pageX);-->
<!--console.log("e.pageY"+e.pageY);-->
<!--this.startX = (e.pageX - this.canvas.offsetLeft) / this.scale;-->
<!--this.startY = (e.pageY - this.canvas.offsetTop) / this.scale;-->
<!--this.currentR = this.isPointInRetc(this.startX, this.startY);-->
<!--if (this.currentR) {-->
<!--this.leftDistance = this.startX - this.currentR.x1;-->
<!--this.topDistance = this.startY - this.currentR.y1;-->
<!--}-->
<!--this.ctx.strokeRect(this.endX, this.endY, 0, 0);-->
<!--this.ctx.strokeStyle = this.config.dashedColor;-->
<!--this.flag = 1;-->
<!--}-->
<!--// }-->
<!--mousemove(e) {-->
<!--// if ($("#changewidthnot").val() == "1") {-->
<!--this.endX = (e.pageX - this.canvas.offsetLeft) / this.scale;-->
<!--this.endY = (e.pageY - this.canvas.offsetTop) / this.scale;-->
<!--// console.log(`mousemove`, this.endX, this.endY);-->
<!--this.ctx.save();-->
<!--this.ctx.setLineDash([5])-->
<!--this.canvas.style.cursor = "crosshair";-->
<!--this.ctx.clearRect(0, 0, this.config.width, this.config.height);-->
<!--if (this.flag && this.optype == 1) {-->
<!--this.ctx.strokeRect(this.startX, this.startY, this.endX - this.startX, this.endY - this.startY);-->
<!--}-->
<!--this.ctx.restore();-->
<!--this.reshow(this.endX, this.endY, "1");-->
<!--}-->
<!--// }-->
<!--mouseup(e) {-->
<!--// if ($("#changewidthnot").val() == "1") {-->
<!--if (this.optype == 1) {-->
<!--this.layers.splice(0, 1, this.fixPosition({-->
<!--x1: this.startX,-->
<!--y1: this.startY,-->
<!--x2: this.endX,-->
<!--y2: this.endY,-->
<!--strokeStyle: this.config.solidColor,-->
<!--type: this.type-->
<!--}))-->
<!--var ratew = this.config.width / this.canvas.width;-->
<!--var rateh = this.config.height / this.canvas.height;-->
<!--this.layers.splice(1, 1, this.fixPosition({-->
<!--x1: Math.ceil(this.startX * ratew),-->
<!--y1: Math.ceil(this.startY * rateh),-->
<!--x2: Math.ceil(this.endX * ratew),-->
<!--y2: Math.ceil(this.endY * rateh),-->
<!--strokeStyle: this.config.solidColor,-->
<!--type: this.type-->
<!--}));-->
<!--// parent.document.getElementById('objectxy').value=Math.ceil(this.startX * this.ratew)+","+Math.ceil(this.startY * this.rateh)-->
<!--// +","+Math.ceil((this.endX-this.startX) * this.ratew)+","+Math.ceil((this.endY-this.startY) * this.rateh);-->
<!--} else if (this.optype >= 3) {-->
<!--this.fixPosition(this.currentR);-->
<!--}-->
<!--this.currentR = null;-->
<!--this.flag = 0;-->
<!--this.reshow(this.endX, this.endY);-->
<!--this.optype = 0;-->
<!--// }-->
<!--}-->
<!--}-->
<!--init();-->
<!--function init() {-->
<!--var objectxywh=0;-->
<!--if(""!=objectxywh && undefined!=objectxywh){-->
<!--pointvalue=objectxywh.split(',');-->
<!--if(pointvalue.length==4) {-->
<!--x = parseInt(pointvalue[0]);-->
<!--y = parseInt(pointvalue[1]);-->
<!--w=parseInt(pointvalue[2]);-->
<!--h=parseInt(pointvalue[3]);-->
<!--}-->
<!--}-->
<!--}-->
<!--draw = new DrawRectangle('draw-canvas', {-->
<!--src:"http://zjh189.ncpoi.cc:7180/download/202112/02/33050300001327599605/33050300001327599605_20211202_201056443.jpg",-->
<!--layers: [{},-->
<!--{-->
<!--"x1":x,-->
<!--"y1": y,-->
<!--"x2": x+w,-->
<!--"y2": y+h,-->
<!--"width": w,-->
<!--"height": h,-->
<!--"strokeStyle": "red",-->
<!--"type": 0-->
<!--}-->
<!--]-->
<!--});-->
<!--</script>-->
</html> </html>
\ No newline at end of file
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
<td v-text="item.tdmc" style="width: 400px;"></td> <td v-text="item.tdmc" style="width: 400px;"></td>
<td v-text="item.recordname"></td> <td v-text="item.recordname"></td>
<td v-text="item.xzmc"></td> <td v-text="item.xzmc"></td>
<td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':'推送失败'"></td> <td v-text="item.pushstatus==null||item.pushstatus=='9'?'待推送':item.pushstatus=='0'?'推送成功':item.pushstatus=='1'?'手动推送':'推送失败'"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
<td> <td>
<select class="form-control" style="width: 280px;"> <select class="form-control" style="width: 280px;">
<option value='1'>管理员</option> <option value='1'>管理员</option>
<option value='1'>普通用户</option> <option value='0'>普通用户</option>
</select> </select>
</td> </td>
</tr> </tr>
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
<td> <td>
<select class="form-control" style="width: 280px;"> <select class="form-control" style="width: 280px;">
<option value='1'>管理员</option> <option value='1'>管理员</option>
<option value='1'>普通用户</option> <option value='0'>普通用户</option>
</select> </select>
</td> </td>
</tr> </tr>
......
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>注册页</title>
<link rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
<link rel="stylesheet" th:href="@{/css/common.css}">
</head>
<body>
<div class="login-main">
<header class="layui-elip" style="width: 100%">注册页</header>
<!-- 表单选项 -->
<form class="layui-form">
<div class="layui-input-inline">
<div class="layui-inline" style="width: 100%">
<input type="text" class="layui-input" placeholder="请输入用户名" autocomplete="off"
lay-verify="required" lay-vertype="tips" id="username" name="username">
</div>
</div>
<div class="layui-input-inline">
<div class="layui-inline" style="width: 100%">
<input type="text" class="layui-input" placeholder="请输入邮箱" autocomplete="off"
lay-verify="required|email" lay-vertype="tips" id="email" name="email">
</div>
</div>
<div class="layui-input-inline">
<div class="layui-inline" style="width: 100%">
<input type="password" id="password" name="password"
lay-verify="required|password" lay-vertype="tips"
placeholder="请输入密码"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-input-inline">
<div class="layui-inline" style="width: 100%">
<input type="password" id="repassword"
lay-verify="repassword" lay-vertype="tips"
placeholder="请确认密码"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-input-inline login-btn" style="width: 100%">
<button type="button" lay-submit lay-filter="sub" class="layui-btn layui-btn-blue">注册</button>
</div>
<hr/>
<p>
<a href="login" class="zadmin-left">已有账号?立即登录</a>
<a href="#" class="zadmin-right">忘记密码?</a>
</p>
</form>
</div>
<script th:src="@{/lib/jquery/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}"></script>
<script th:src="@{/js/common.js}"></script>
<script type="text/javascript">
layui.use(['form', 'jquery', 'layer'], function () {
var form = layui.form;
var $ = layui.jquery;
var layer = layui.layer;
form.verify({
password: [
/^[\S]{6,12}$/,
'密码必须6到12位,且不能出现空格'
],
repassword: function (value) {
var password = $('#password').val();
if (value !== password) {
return '两次密码不一致';
}
}
});
//添加表单监听事件,提交注册信息
form.on('submit(sub)', function (form) {
$.post('/register', form.field, function (result) {
handlerResult(result, registerDone);
});
//防止页面跳转
return false;
});
});
function registerDone(data) {
layer.msg("注册成功, 请检查邮箱进行激活!", {icon: 6});
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="UTF-8">
<title>欢迎页面</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" type="image/x-icon" th:href="@{/favicon.ico}" />
<link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}">
<link rel="stylesheet" th:href="@{/css/common.css}">
<link rel="stylesheet" th:href="@{/css/animate.min.css}">
</head>
<body>
<div class="z-body animated fadeIn">
<blockquote class="layui-elem-quote">欢迎:
<span><shiro:principal property="username"/></span>!当前时间: [[${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}]]</blockquote>
<fieldset class="layui-elem-field">
<legend>数据统计</legend>
<div class="layui-field-box">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-carousel z-admin-carousel z-admin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 90px;">
<div carousel-item="">
<ul class="layui-row layui-col-space10 layui-this">
<li class="layui-col-xs2">
<a href="#" onclick="openTab('用户管理', '/user/index')" class="z-admin-backlog-body">
<h3>用户数</h3>
<p>
<cite th:text="${userCount}"></cite>
</p>
</a>
</li>
<li class="layui-col-xs2">
<a href="#" onclick="openTab('角色管理', '/role/index')" class="z-admin-backlog-body">
<h3>角色数</h3>
<p>
<cite th:text="${roleCount}"></cite>
</p>
</a>
</li>
<li class="layui-col-xs2">
<a href="#" onclick="openTab('菜单管理', '/menu/index')" class="z-admin-backlog-body">
<h3>菜单数</h3>
<p>
<cite th:text="${menuCount}"></cite>
</p>
</a>
</li>
<li class="layui-col-xs2">
<a href="#" onclick="openTab('登录日志', '/log/login/index')" class="z-admin-backlog-body">
<h3>登录日志</h3>
<p>
<cite th:text="${loginLogCount}"></cite>
</p>
</a>
</li>
<li class="layui-col-xs2">
<a href="#" onclick="openTab('操作日志', '/log/sys/index')" class="z-admin-backlog-body">
<h3>操作日志</h3>
<p>
<cite th:text="${sysLogCount}"></cite>
</p>
</a>
</li>
<li class="layui-col-xs2">
<a href="#" onclick="openTab('在线人数', '/online/index')" class="z-admin-backlog-body">
<h3>在线人数</h3>
<p>
<cite th:text="${userOnlineCount}"></cite>
</p>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset class="layui-elem-field">
<legend>最近登录</legend>
<div class="layui-field-box">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
</fieldset>
</div>
<script th:src="@{/lib/jquery/jquery.min.js}"></script>
<script th:src="@{/lib/layui/layui.js}"></script>
<script th:src="@{/js/common.js}"></script>
<script th:src="@{/lib/echarts/echarts.min.js}"></script>
<script type="application/javascript">
layui.use('element', function(){
layui.$("#main").css("width", (window.innerWidth - 100) +'px');
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
title: {
text: '近七天登陆次数统计图',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'none' // 默认为直线,可选为:'line' | 'shadow'
}
},
xAxis: {
type: 'category',
data: getWeekList()
},
yAxis: {
type: 'value'
},
series: [{
data: [],
type: 'line'
}]
};
layui.$.get('/weekLoginCount', function (data) {
option.series[0].data = data;
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
});
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment