Compare commits
No commits in common. "27dfb2d878ad46b3b01e0df10e26d72adfdf2d90" and "29a81bea9bb6035a7d9ba99480090e70790fc058" have entirely different histories.
27dfb2d878
...
29a81bea9b
@ -1,21 +0,0 @@
|
|||||||
package com.zhangy.skyeye.common.extend.config;
|
|
||||||
|
|
||||||
import com.zhangy.skyeye.common.extend.core.I18nLocaleResolver;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.LocaleResolver;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 国际化配置
|
|
||||||
*
|
|
||||||
* @author zhangy
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class I18nConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public LocaleResolver localeResolver() {
|
|
||||||
return new I18nLocaleResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package com.zhangy.skyeye.common.extend.core;
|
|
||||||
|
|
||||||
import org.springframework.web.servlet.LocaleResolver;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取请求头国际化信息
|
|
||||||
*
|
|
||||||
* @author zhangy
|
|
||||||
*/
|
|
||||||
public class I18nLocaleResolver implements LocaleResolver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Locale resolveLocale(HttpServletRequest httpServletRequest) {
|
|
||||||
String language = httpServletRequest.getHeader("content-language");
|
|
||||||
Locale locale = Locale.ENGLISH;
|
|
||||||
if (language != null && language.length() > 0) {
|
|
||||||
String[] split = language.split("_");
|
|
||||||
if (split.length > 1) {
|
|
||||||
locale = new Locale(split[0], split[1]);
|
|
||||||
} else {
|
|
||||||
locale = new Locale(split[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return locale;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
package com.zhangy.skyeye.common.extend.util;
|
|
||||||
|
|
||||||
import org.springframework.context.MessageSource;
|
|
||||||
import org.springframework.context.NoSuchMessageException;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取i18n资源文件
|
|
||||||
*
|
|
||||||
* @author zhangy
|
|
||||||
*/
|
|
||||||
public class MessageUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据消息键和参数 获取消息 委托给spring messageSource
|
|
||||||
*
|
|
||||||
* @param code 消息键
|
|
||||||
* @param args 参数
|
|
||||||
* @return 获取国际化翻译值
|
|
||||||
*/
|
|
||||||
public static String message(String code, Object... args) {
|
|
||||||
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
|
|
||||||
try {
|
|
||||||
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
|
|
||||||
} catch (NoSuchMessageException e) {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
package com.zhangy.skyeye.common.extend.util;
|
|
||||||
|
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.context.ApplicationContextAware;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* spring工具类 方便在非spring管理环境中获取bean
|
|
||||||
*
|
|
||||||
* @author zhangy
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class SpringUtils implements ApplicationContextAware {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前IOC上下文对象
|
|
||||||
*/
|
|
||||||
private static ApplicationContext applicationContext;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
|
||||||
SpringUtils.applicationContext = applicationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取applicationContext
|
|
||||||
*/
|
|
||||||
public static ApplicationContext getApplicationContext() {
|
|
||||||
return applicationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过name获取 Bean.
|
|
||||||
*
|
|
||||||
* @param name bean名称
|
|
||||||
* @return bean对象
|
|
||||||
*/
|
|
||||||
public static Object getBean(String name) {
|
|
||||||
return getApplicationContext().getBean(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过class获取Bean.
|
|
||||||
*
|
|
||||||
* @param clazz bean类型
|
|
||||||
* @param <T> 泛型
|
|
||||||
* @return bean对象
|
|
||||||
*/
|
|
||||||
public static <T> T getBean(Class<T> clazz) {
|
|
||||||
return getApplicationContext().getBean(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过name,以及Clazz返回指定的Bean
|
|
||||||
*
|
|
||||||
* @param name bean名称
|
|
||||||
* @param clazz bean类型
|
|
||||||
* @param <T> 泛型
|
|
||||||
* @return bean对象
|
|
||||||
*/
|
|
||||||
public static <T> T getBean(String name, Class<T> clazz) {
|
|
||||||
return getApplicationContext().getBean(name, clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
package com.zhangy.skyeye.device.controller;
|
package com.zhangy.skyeye.device.controller;
|
||||||
|
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -78,6 +77,6 @@ public class UavController {
|
|||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
public Object delete(@RequestBody Long... id) {
|
public Object delete(@RequestBody Long... id) {
|
||||||
uavService.delete(id);
|
uavService.delete(id);
|
||||||
return MessageUtils.message("device.uav.remove.success");
|
return "操作成功";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,7 +3,6 @@ package com.zhangy.skyeye.jm.controller;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.zhangy.skyeye.common.extend.anno.IgnoreAuth;
|
import com.zhangy.skyeye.common.extend.anno.IgnoreAuth;
|
||||||
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import com.zhangy.skyeye.jm.dto.JmImageKtyDTO;
|
import com.zhangy.skyeye.jm.dto.JmImageKtyDTO;
|
||||||
import com.zhangy.skyeye.jm.dto.JmImagePageDTO;
|
import com.zhangy.skyeye.jm.dto.JmImagePageDTO;
|
||||||
import com.zhangy.skyeye.jm.dto.JmImageUpdDTO;
|
import com.zhangy.skyeye.jm.dto.JmImageUpdDTO;
|
||||||
@ -65,7 +64,7 @@ public class JmImageController {
|
|||||||
public Object selectList(@Valid @RequestBody JmImageUpdDTO param) {
|
public Object selectList(@Valid @RequestBody JmImageUpdDTO param) {
|
||||||
JmImage e = BeanUtil.copyProperties(param, JmImage.class);
|
JmImage e = BeanUtil.copyProperties(param, JmImage.class);
|
||||||
sarImageService.updateNotNull(e);
|
sarImageService.updateNotNull(e);
|
||||||
return MessageUtils.message("sar.image.update.success");
|
return "操作成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,17 +73,14 @@ public class JmImageController {
|
|||||||
@PostMapping("/addHigh")
|
@PostMapping("/addHigh")
|
||||||
public Object addHighImage(@Valid @RequestBody JmJobImageDTO dto) {
|
public Object addHighImage(@Valid @RequestBody JmJobImageDTO dto) {
|
||||||
String lockKey = SAR_IMAGE_UPLOAD_LOCK;
|
String lockKey = SAR_IMAGE_UPLOAD_LOCK;
|
||||||
// 尝试 60 秒获取锁(比原来 1 分钟更灵活)
|
boolean locked = localLockUtil.tryLock(lockKey, 60); // 尝试 60 秒获取锁(比原来 1 分钟更灵活)
|
||||||
boolean locked = localLockUtil.tryLock(lockKey, 60);
|
|
||||||
if (!locked) {
|
if (!locked) {
|
||||||
throw ServiceException.noLog("正在上传其它图像,请稍后重试!");
|
throw ServiceException.noLog("正在上传其它图像,请稍后重试!");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 执行高精度图像添加逻辑
|
|
||||||
sarImageService.addHighImage(dto);
|
sarImageService.addHighImage(dto);
|
||||||
} finally {
|
} finally {
|
||||||
// 释放锁
|
localLockUtil.unlock(lockKey); // 释放锁
|
||||||
localLockUtil.unlock(lockKey);
|
|
||||||
}
|
}
|
||||||
return "操作完成";
|
return "操作完成";
|
||||||
}
|
}
|
||||||
@ -103,7 +99,7 @@ public class JmImageController {
|
|||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
public Object delete(@RequestBody Long... id) {
|
public Object delete(@RequestBody Long... id) {
|
||||||
sarImageService.delete(id);
|
sarImageService.delete(id);
|
||||||
return MessageUtils.message("sar.image.remove.success");
|
return "操作完成";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 空天院只查询sar低精度图
|
// 空天院只查询sar低精度图
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import com.zhangy.skyeye.common.extend.anno.IgnoreAuth;
|
|||||||
import com.zhangy.skyeye.common.extend.enums.EnumUtil;
|
import com.zhangy.skyeye.common.extend.enums.EnumUtil;
|
||||||
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
||||||
import com.zhangy.skyeye.common.extend.util.DateUtil;
|
import com.zhangy.skyeye.common.extend.util.DateUtil;
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import com.zhangy.skyeye.common.pojo.result.Result;
|
import com.zhangy.skyeye.common.pojo.result.Result;
|
||||||
import com.zhangy.skyeye.jm.consts.JmJobModeEnum;
|
import com.zhangy.skyeye.jm.consts.JmJobModeEnum;
|
||||||
import com.zhangy.skyeye.jm.dto.JmJobDTO;
|
import com.zhangy.skyeye.jm.dto.JmJobDTO;
|
||||||
@ -24,7 +23,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@ -116,10 +114,7 @@ public class JmJobController {
|
|||||||
* 重飞
|
* 重飞
|
||||||
*/
|
*/
|
||||||
@GetMapping("/retry")
|
@GetMapping("/retry")
|
||||||
public Object retry(Long id) {
|
public Object retry(@NotNull(message = "任务ID不能为空") Long id) {
|
||||||
if(Objects.isNull(id)) {
|
|
||||||
return MessageUtils.message("sar.job.retry.enullid");
|
|
||||||
}
|
|
||||||
JmJobDTO e = jobService.selectDetail(id);
|
JmJobDTO e = jobService.selectDetail(id);
|
||||||
clearId(e);
|
clearId(e);
|
||||||
e.setName(DateUtil.getTimeStr(DateUtil.DF_2));
|
e.setName(DateUtil.getTimeStr(DateUtil.DF_2));
|
||||||
@ -140,12 +135,12 @@ public class JmJobController {
|
|||||||
// 查询执行任务的无人机
|
// 查询执行任务的无人机
|
||||||
JmJobDTO job = jobService.selectDetail(id);
|
JmJobDTO job = jobService.selectDetail(id);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
throw ServiceException.noLog(MessageUtils.message("sar.job.start.enosuchjob", id));
|
throw ServiceException.noLog("找不到任务,id=" + id);
|
||||||
} else if (EnumUtil.parseEx(ExecStatusEnum.class, job.getStatus()) == ExecStatusEnum.PROCESSING) {
|
} else if (EnumUtil.parseEx(ExecStatusEnum.class, job.getStatus()) == ExecStatusEnum.PROCESSING) {
|
||||||
throw ServiceException.noLog(MessageUtils.message("sar.job.start.einexecuting"));
|
throw ServiceException.noLog("任务状态为执行中,无法起飞");
|
||||||
}
|
}
|
||||||
jobService.start(job);
|
jobService.start(job);
|
||||||
return MessageUtils.message("sar.job.start.success");
|
return "开始执行";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +177,7 @@ public class JmJobController {
|
|||||||
@GetMapping("/exit")
|
@GetMapping("/exit")
|
||||||
public Object exit(@RequestParam Long id) {
|
public Object exit(@RequestParam Long id) {
|
||||||
jobService.exit(id);
|
jobService.exit(id);
|
||||||
return MessageUtils.message("sar.job.exit.success");
|
return "操作成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.zhangy.skyeye.jm.controller;
|
package com.zhangy.skyeye.jm.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import com.zhangy.skyeye.jm.dto.JmJobDTO;
|
import com.zhangy.skyeye.jm.dto.JmJobDTO;
|
||||||
import com.zhangy.skyeye.jm.dto.JmJobPageDTO;
|
import com.zhangy.skyeye.jm.dto.JmJobPageDTO;
|
||||||
import com.zhangy.skyeye.jm.entity.JmImage;
|
import com.zhangy.skyeye.jm.entity.JmImage;
|
||||||
@ -61,6 +60,6 @@ public class JmJobExecController {
|
|||||||
@RequestMapping("/brightness")
|
@RequestMapping("/brightness")
|
||||||
public Object adjustBrightness(@Valid @RequestBody JmImage param) {
|
public Object adjustBrightness(@Valid @RequestBody JmImage param) {
|
||||||
jobExecService.adjustBrightness(param);
|
jobExecService.adjustBrightness(param);
|
||||||
return MessageUtils.message("sar.job_exec.brightness.success");
|
return "成功调整亮度";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,23 +0,0 @@
|
|||||||
package com.zhangy.skyeye.jm.controller;
|
|
||||||
|
|
||||||
import com.zhangy.skyeye.common.extend.anno.IgnoreAuth;
|
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* i18n 测试
|
|
||||||
*
|
|
||||||
* @author zhangy
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/test/i18n")
|
|
||||||
public class TestI18nController {
|
|
||||||
|
|
||||||
@IgnoreAuth
|
|
||||||
@GetMapping
|
|
||||||
public String test(String code) {
|
|
||||||
return MessageUtils.message(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +1,6 @@
|
|||||||
package com.zhangy.skyeye.jm.service.impl;
|
package com.zhangy.skyeye.jm.service.impl;
|
||||||
|
|
||||||
import com.zhangy.skyeye.cache.sar.SarCache;
|
|
||||||
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import com.zhangy.skyeye.jm.dto.*;
|
import com.zhangy.skyeye.jm.dto.*;
|
||||||
import com.zhangy.skyeye.jm.entity.JmJobPayload;
|
import com.zhangy.skyeye.jm.entity.JmJobPayload;
|
||||||
import com.zhangy.skyeye.jm.entity.JmJobUav;
|
import com.zhangy.skyeye.jm.entity.JmJobUav;
|
||||||
@ -11,7 +9,6 @@ import com.zhangy.skyeye.jm.event.JmJobStatusEvent;
|
|||||||
import com.zhangy.skyeye.jm.event.JmPayloadStatusEvent;
|
import com.zhangy.skyeye.jm.event.JmPayloadStatusEvent;
|
||||||
import com.zhangy.skyeye.jm.service.JmJobStatusService;
|
import com.zhangy.skyeye.jm.service.JmJobStatusService;
|
||||||
import com.zhangy.skyeye.jm.service.JmStatusLogService;
|
import com.zhangy.skyeye.jm.service.JmStatusLogService;
|
||||||
import com.zhangy.skyeye.publics.consts.CacheKey;
|
|
||||||
import com.zhangy.skyeye.publics.consts.ExecStatusEnum;
|
import com.zhangy.skyeye.publics.consts.ExecStatusEnum;
|
||||||
import com.zhangy.skyeye.publics.consts.WebSocketKey;
|
import com.zhangy.skyeye.publics.consts.WebSocketKey;
|
||||||
import com.zhangy.skyeye.publics.utils.CoordUtil;
|
import com.zhangy.skyeye.publics.utils.CoordUtil;
|
||||||
@ -45,12 +42,6 @@ public class JmJobStatusServiceImpl implements JmJobStatusService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SarImageUdpProcessor imageProcessService;
|
private SarImageUdpProcessor imageProcessService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SarCache sarCache;
|
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private ISmpSubscriptService subscriptService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存所有执行中的任务的状态 key 任务配置ID,value 任务状态
|
* 缓存所有执行中的任务的状态 key 任务配置ID,value 任务状态
|
||||||
*/
|
*/
|
||||||
@ -179,15 +170,11 @@ public class JmJobStatusServiceImpl implements JmJobStatusService {
|
|||||||
// 校验新任务中的无人机和载荷是否冲突
|
// 校验新任务中的无人机和载荷是否冲突
|
||||||
for (JmJobUav newUav : newJobUavs) {
|
for (JmJobUav newUav : newJobUavs) {
|
||||||
if (runningUavIds.contains(newUav.getUavId())) {
|
if (runningUavIds.contains(newUav.getUavId())) {
|
||||||
throw ServiceException.warnLog(MessageUtils.message("sar.control.turnon.euavinexec"));
|
throw ServiceException.warnLog("无人机正在任务中,无法执行新任务");
|
||||||
}
|
}
|
||||||
for (JmJobPayload payload : newUav.getPayloadList()) {
|
for (JmJobPayload payload : newUav.getPayloadList()) {
|
||||||
// 校验雷达连接状态
|
|
||||||
if (!sarCache.isConnected(payload.getIp())) {
|
|
||||||
throw ServiceException.warnLog(MessageUtils.message("device.sar.offline", payload.getPayloadName()));
|
|
||||||
}
|
|
||||||
if (runningPayloadIds.contains(payload.getPayloadId())) {
|
if (runningPayloadIds.contains(payload.getPayloadId())) {
|
||||||
throw ServiceException.warnLog(MessageUtils.message("sar.control.turnon.esarinexec"));
|
throw ServiceException.warnLog("载荷正在任务中,无法执行新任务");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,11 +6,9 @@ import com.zhangy.skyeye.common.extend.anno.IgnoreAuth;
|
|||||||
import com.zhangy.skyeye.common.extend.anno.OperationLog;
|
import com.zhangy.skyeye.common.extend.anno.OperationLog;
|
||||||
import com.zhangy.skyeye.common.extend.dto.PageDTO;
|
import com.zhangy.skyeye.common.extend.dto.PageDTO;
|
||||||
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import com.zhangy.skyeye.common.extend.util.ObjectUtil;
|
import com.zhangy.skyeye.common.extend.util.ObjectUtil;
|
||||||
import com.zhangy.skyeye.common.pojo.result.Result;
|
import com.zhangy.skyeye.common.pojo.result.Result;
|
||||||
import com.zhangy.skyeye.common.utils.JwtUtil;
|
import com.zhangy.skyeye.common.utils.JwtUtil;
|
||||||
import com.zhangy.skyeye.redis.utils.RedisUtil;
|
|
||||||
import com.zhangy.skyeye.publics.consts.CacheKey;
|
import com.zhangy.skyeye.publics.consts.CacheKey;
|
||||||
import com.zhangy.skyeye.publics.dto.RegisterDTO;
|
import com.zhangy.skyeye.publics.dto.RegisterDTO;
|
||||||
import com.zhangy.skyeye.publics.dto.SysUserPwdDTO;
|
import com.zhangy.skyeye.publics.dto.SysUserPwdDTO;
|
||||||
@ -22,11 +20,13 @@ import com.zhangy.skyeye.publics.utils.SecurityUtil;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.CacheManager;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@ -39,13 +39,11 @@ public class SysUserController {
|
|||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private CacheManager cacheManager;
|
||||||
|
|
||||||
/** token失效时间(秒) */
|
|
||||||
private final int TOKEN_EXPIRE = 60 * 60 * 24;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录接口
|
* 登录接口
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@IgnoreAuth
|
@IgnoreAuth
|
||||||
@ -54,18 +52,21 @@ public class SysUserController {
|
|||||||
public Result login(@RequestBody RegisterDTO registerDTO) {
|
public Result login(@RequestBody RegisterDTO registerDTO) {
|
||||||
SysUser user = sysUserService.selectByAccount(registerDTO.getUsername(), registerDTO.getPassword().toLowerCase());
|
SysUser user = sysUserService.selectByAccount(registerDTO.getUsername(), registerDTO.getPassword().toLowerCase());
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw ServiceException.noLog(MessageUtils.message("user.login.error"));
|
throw ServiceException.noLog("用户名或密码错误!");
|
||||||
}
|
}
|
||||||
UserDTO userDTO = BeanUtil.copyProperties(user, UserDTO.class);
|
UserDTO userDTO = BeanUtil.copyProperties(user, UserDTO.class);
|
||||||
String key = JSONUtil.toJsonStr(userDTO);
|
String payload = JSONUtil.toJsonStr(userDTO); // 保持原逻辑
|
||||||
String accessToken = JwtUtil.sign(key, user.getPassword());
|
String accessToken = JwtUtil.sign(payload, user.getPassword());
|
||||||
redisUtil.set(userDTO.getTokenKey(), accessToken, TOKEN_EXPIRE);
|
// 存到 Caffeine(用 cache name "user-tokens")
|
||||||
|
String tokenKey = userDTO.getTokenKey(); // skyeye:user:token:id@account
|
||||||
|
Objects.requireNonNull(cacheManager.getCache("user-tokens")).put(tokenKey, accessToken);
|
||||||
userDTO.setToken(accessToken);
|
userDTO.setToken(accessToken);
|
||||||
return Result.successData(MessageUtils.message("user.login.success"), userDTO);
|
return Result.successData("登录成功", userDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -73,15 +74,15 @@ public class SysUserController {
|
|||||||
public Object updatePwd(@Valid SysUserPwdDTO dto) {
|
public Object updatePwd(@Valid SysUserPwdDTO dto) {
|
||||||
List<SysUser> list = sysUserService.selectById(dto.getUserId());
|
List<SysUser> list = sysUserService.selectById(dto.getUserId());
|
||||||
if (ObjectUtil.isEmpty(list)) {
|
if (ObjectUtil.isEmpty(list)) {
|
||||||
throw ServiceException.noLog(MessageUtils.message("user.updpwd.error"));
|
throw ServiceException.noLog("用户名或密码错误!");
|
||||||
}
|
}
|
||||||
SysUser user = list.get(0);
|
SysUser user = list.get(0);
|
||||||
if (user.getPassword().equals(dto.getOldPwd())) {
|
if (user.getPassword().equals(dto.getOldPwd())) {
|
||||||
throw ServiceException.noLog(MessageUtils.message("user.updpwd.nochg"));
|
throw ServiceException.noLog("旧密码错误!");
|
||||||
}
|
}
|
||||||
user.setPassword(dto.getNewPwd());
|
user.setPassword(dto.getNewPwd());
|
||||||
sysUserService.update(user);
|
sysUserService.update(user);
|
||||||
return MessageUtils.message("user.updpwd.success");
|
return "修改成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,13 +90,12 @@ public class SysUserController {
|
|||||||
*/
|
*/
|
||||||
@IgnoreAuth
|
@IgnoreAuth
|
||||||
@OperationLog(value = "退出登录", type = SysLog.TYPE_USER)
|
@OperationLog(value = "退出登录", type = SysLog.TYPE_USER)
|
||||||
@RequestMapping("/logout")
|
@GetMapping("/logout")
|
||||||
@GetMapping
|
|
||||||
public Result logout() {
|
public Result logout() {
|
||||||
UserDTO userDTO = SecurityUtil.getUser();
|
UserDTO userDTO = SecurityUtil.getUser();
|
||||||
if (userDTO != null) {
|
if (userDTO != null) {
|
||||||
String key = CacheKey.getToekn(userDTO.getId(), userDTO.getAccount());
|
String key = CacheKey.getToken(userDTO.getId(), userDTO.getAccount());
|
||||||
redisUtil.del(key);
|
Objects.requireNonNull(cacheManager.getCache("user-tokens")).evict(key);
|
||||||
}
|
}
|
||||||
return Result.status(true);
|
return Result.status(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.zhangy.skyeye.sar.controller;
|
package com.zhangy.skyeye.sar.controller;
|
||||||
|
|
||||||
import com.zhangy.skyeye.common.extend.util.MessageUtils;
|
|
||||||
import com.zhangy.skyeye.common.pojo.result.Result;
|
import com.zhangy.skyeye.common.pojo.result.Result;
|
||||||
import com.zhangy.skyeye.sar.service.ISarControlService;
|
import com.zhangy.skyeye.sar.service.ISarControlService;
|
||||||
import com.zhangy.skyeye.sar.dto.SarControlParamDTO;
|
import com.zhangy.skyeye.sar.dto.SarControlParamDTO;
|
||||||
@ -32,7 +31,7 @@ public class SarControlController {
|
|||||||
public Result send(@RequestBody SarControlParamDTO param) {
|
public Result send(@RequestBody SarControlParamDTO param) {
|
||||||
param.checkOrSetData();
|
param.checkOrSetData();
|
||||||
controlInfoService.sendUdp(param);
|
controlInfoService.sendUdp(param);
|
||||||
return Result.successData(MessageUtils.message("sar.control.send.success"));
|
return Result.successData("发送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,16 +50,16 @@ public class SarControlController {
|
|||||||
// 检查是否成功获取
|
// 检查是否成功获取
|
||||||
if (ipVal == null || ipVal.isEmpty()) {
|
if (ipVal == null || ipVal.isEmpty()) {
|
||||||
// 根据你的业务逻辑返回错误,例如
|
// 根据你的业务逻辑返回错误,例如
|
||||||
return Result.error(MessageUtils.message("sar.control.turnon.enoip"));
|
return Result.error("请求体中缺少 'payloadId' 或其值为空");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 处理JSON解析异常
|
// 处理JSON解析异常
|
||||||
// 记录日志 e.g., log.error("Failed to parse turnOn payload", e);
|
// 记录日志 e.g., log.error("Failed to parse turnOn payload", e);
|
||||||
return Result.error(MessageUtils.message("sar.control.turnon.eexcept"));
|
return Result.error("请求体JSON格式错误");
|
||||||
}
|
}
|
||||||
// 3. 调用服务层
|
// 3. 调用服务层
|
||||||
controlInfoService.turnOn(ipVal);
|
controlInfoService.turnOn(ipVal);
|
||||||
return Result.successData(MessageUtils.message("sar.control.turnon.success"));
|
return Result.successData("发送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,16 +80,16 @@ public class SarControlController {
|
|||||||
// 检查是否成功获取
|
// 检查是否成功获取
|
||||||
if (ipVal == null || ipVal.isEmpty()) {
|
if (ipVal == null || ipVal.isEmpty()) {
|
||||||
// 根据你的业务逻辑返回错误,例如
|
// 根据你的业务逻辑返回错误,例如
|
||||||
return Result.error(MessageUtils.message("sar.control.endall.enoip"));
|
return Result.error("请求体中缺少 'payloadId' 或其值为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 处理JSON解析异常
|
// 处理JSON解析异常
|
||||||
// 记录日志 e.g., log.error("Failed to parse turnOn payload", e);
|
// 记录日志 e.g., log.error("Failed to parse turnOn payload", e);
|
||||||
return Result.error(MessageUtils.message("sar.control.endall.eexcept"));
|
return Result.error("请求体JSON格式错误");
|
||||||
}
|
}
|
||||||
// 3. 调用服务层
|
// 3. 调用服务层
|
||||||
controlInfoService.endAll(ipVal);
|
controlInfoService.endAll(ipVal);
|
||||||
return Result.successData(MessageUtils.message("sar.control.endall.success"));
|
return Result.successData("发送成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,311 +0,0 @@
|
|||||||
package com.zhangy.skyeye.sar.image.enhancer;
|
|
||||||
|
|
||||||
import org.opencv.core.*;
|
|
||||||
import org.opencv.imgcodecs.Imgcodecs;
|
|
||||||
import org.opencv.imgproc.Imgproc;
|
|
||||||
import org.opencv.imgproc.CLAHE;
|
|
||||||
import org.opencv.photo.Photo;
|
|
||||||
import org.opencv.photo.TonemapReinhard;
|
|
||||||
|
|
||||||
import java.nio.ShortBuffer;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ImageEnhancer.java
|
|
||||||
* ==================
|
|
||||||
* 两步组合图像亮度增强脚本(自适应参数 + 多格式兼容 Java 版)
|
|
||||||
*
|
|
||||||
* 支持的输入格式:
|
|
||||||
* - JPG : 8 bit BGR,直接兼容
|
|
||||||
* - PNG : 8/16 bit,RGB/RGBA,自动处理透明通道与位深
|
|
||||||
* - TIF : 8/16/32 bit,灰度/彩色/含透明通道,自动处理所有组合
|
|
||||||
*
|
|
||||||
* 增强步骤:
|
|
||||||
* 1. Reinhard 局部色调映射 —— 压缩动态范围,统一全局亮度
|
|
||||||
* 2. CLAHE 局部对比度增强 —— 在 LAB 空间对 L 通道进行局部直方图均衡化
|
|
||||||
*
|
|
||||||
* 所有关键参数均根据输入图像的统计特征自动计算,无需手动调参。
|
|
||||||
*
|
|
||||||
* 依赖:
|
|
||||||
* - OpenCV for Java (e.g., opencv-4.x.x.jar)
|
|
||||||
*
|
|
||||||
* 编译与运行:
|
|
||||||
* 1. 确保 opencv-4.x.x.jar 在 classpath 中。
|
|
||||||
* 2. 确保 OpenCV native library (e.g., opencv_java4xx.dll/so) 在 java.library.path 中。
|
|
||||||
* javac -cp .:/path/to/opencv-4.x.x.jar ImageEnhancer.java
|
|
||||||
* java -cp .:/path/to/opencv-4.x.x.jar -Djava.library.path=/path/to/native/libs ImageEnhancer <input_path> [output_dir]
|
|
||||||
*/
|
|
||||||
public class ImageEnhancer {
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
|
|
||||||
} catch (UnsatisfiedLinkError e) {
|
|
||||||
System.err.println("Native code library failed to load.\n" + e);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存放自适应计算出的参数
|
|
||||||
*/
|
|
||||||
public static class AdaptiveParams {
|
|
||||||
double gamma, intensity, lightAdapt, colorAdapt = 0.0, clipLimit;
|
|
||||||
Size tileGrid;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format(
|
|
||||||
" gamma = %.3f%n" +
|
|
||||||
" intensity = %.3f%n" +
|
|
||||||
" light_adapt = %.3f%n" +
|
|
||||||
" clip_limit = %.3f%n" +
|
|
||||||
" tile_grid = %s",
|
|
||||||
gamma, intensity, lightAdapt, clipLimit, tileGrid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存放归一化结果和日志
|
|
||||||
*/
|
|
||||||
public static class NormalizedImage {
|
|
||||||
Mat image;
|
|
||||||
String log;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对 uint16 图像做百分位截断线性拉伸后转为 uint8。
|
|
||||||
*/
|
|
||||||
private static Mat uint16ToUint8Stretch(Mat imgU16, double lowPct, double highPct) {
|
|
||||||
// 将所有通道像素合并后统一计算 lo/hi,避免各通道独立拉伸导致色偏
|
|
||||||
int totalPixels = (int) (imgU16.total() * imgU16.channels());
|
|
||||||
short[] pixels = new short[totalPixels];
|
|
||||||
imgU16.get(0, 0, pixels);
|
|
||||||
|
|
||||||
// 转换为 int 以避免排序时的符号问题
|
|
||||||
int[] pixelsInt = new int[totalPixels];
|
|
||||||
for (int i = 0; i < totalPixels; i++) {
|
|
||||||
pixelsInt[i] = pixels[i] & 0xFFFF;
|
|
||||||
}
|
|
||||||
Arrays.sort(pixelsInt);
|
|
||||||
|
|
||||||
// 使用全局统一的 lo/hi(所有通道共用),保持色彩比例
|
|
||||||
double lo = pixelsInt[(int) (totalPixels * lowPct / 100.0)];
|
|
||||||
double hi = pixelsInt[(int) (totalPixels * highPct / 100.0)];
|
|
||||||
|
|
||||||
// 使用 convertTo(alpha, beta) 做线性变换:dst = src * alpha + beta
|
|
||||||
// 等价于 (src - lo) * 255/(hi-lo) = src * (255/(hi-lo)) + (-lo * 255/(hi-lo))
|
|
||||||
double alpha = 255.0 / (hi - lo + 1e-6);
|
|
||||||
double beta = -lo * alpha;
|
|
||||||
Mat result = new Mat();
|
|
||||||
// convertTo 对所有通道均匀应用相同的 alpha/beta,不存在 Scalar 多通道问题
|
|
||||||
imgU16.convertTo(result, CvType.CV_8U, alpha, beta);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将任意常见格式的图像统一转换为 BGR uint8。
|
|
||||||
*/
|
|
||||||
public static NormalizedImage normalizeToBgrUint8(Mat img) {
|
|
||||||
NormalizedImage result = new NormalizedImage();
|
|
||||||
StringBuilder log = new StringBuilder();
|
|
||||||
log.append(String.format("原始格式:dtype=%s, shape=(%d, %d, %d)%n",
|
|
||||||
CvType.typeToString(img.type()), img.rows(), img.cols(), img.channels()));
|
|
||||||
|
|
||||||
Mat currentImg = img.clone();
|
|
||||||
List<String> steps = new ArrayList<>();
|
|
||||||
|
|
||||||
// 1. 位深归一化
|
|
||||||
if (img.depth() == CvType.CV_16U) {
|
|
||||||
currentImg = uint16ToUint8Stretch(img, 2.0, 98.0);
|
|
||||||
steps.add("uint16 → uint8 (百分位拉伸 2%~98%)");
|
|
||||||
} else if (img.depth() == CvType.CV_32F || img.depth() == CvType.CV_64F) {
|
|
||||||
img.convertTo(currentImg, CvType.CV_8U, 255.0);
|
|
||||||
steps.add(CvType.typeToString(img.type()) + " → uint8 (×255 缩放)");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 通道数归一化
|
|
||||||
if (currentImg.channels() == 1) {
|
|
||||||
Imgproc.cvtColor(currentImg, currentImg, Imgproc.COLOR_GRAY2BGR);
|
|
||||||
steps.add("灰度(1ch) → BGR(3ch)");
|
|
||||||
} else if (currentImg.channels() == 4) {
|
|
||||||
Imgproc.cvtColor(currentImg, currentImg, Imgproc.COLOR_BGRA2BGR);
|
|
||||||
steps.add("BGRA(4ch) → BGR(3ch, 丢弃 Alpha)");
|
|
||||||
}
|
|
||||||
|
|
||||||
log.append(" 转换步骤:").append(steps.isEmpty() ? "无需转换 (已是 BGR uint8)" : String.join(" | ", steps)).append("\n");
|
|
||||||
log.append(String.format(" 归一化后:dtype=%s, shape=(%d, %d, %d)",
|
|
||||||
CvType.typeToString(currentImg.type()), currentImg.rows(), currentImg.cols(), currentImg.channels()));
|
|
||||||
|
|
||||||
result.image = currentImg;
|
|
||||||
result.log = log.toString();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据输入图像的统计特征自适应计算增强参数。
|
|
||||||
*/
|
|
||||||
public static AdaptiveParams computeAdaptiveParams(Mat imgBgr) {
|
|
||||||
Mat gray = new Mat();
|
|
||||||
Imgproc.cvtColor(imgBgr, gray, Imgproc.COLOR_BGR2GRAY);
|
|
||||||
Mat grayF = new Mat();
|
|
||||||
gray.convertTo(grayF, CvType.CV_32F);
|
|
||||||
|
|
||||||
int H = gray.rows(), W = gray.cols(), totalPixels = H * W;
|
|
||||||
AdaptiveParams params = new AdaptiveParams();
|
|
||||||
|
|
||||||
// ── Reinhard gamma 语义说明 ────────────────────────────────────────────
|
|
||||||
// OpenCV Reinhard 中 gamma 越大 → 输出越亮(与传统 gamma 校正语义相反)
|
|
||||||
// 由实验扫描拟合(la=0.8, intensity=0):mean_out ≈ 79.2 × gamma
|
|
||||||
// target_mean 根据图像均值自适应:图越暗 → 目标越高(最大提亮到 128)
|
|
||||||
// 1. 图像均值 → gamma
|
|
||||||
double meanVal = Core.mean(grayF).val[0];
|
|
||||||
double meanNorm = meanVal / 255.0;
|
|
||||||
double targetMean = Math.min(128.0, 128.0 * Math.pow(1.0 - meanNorm, 0.3));
|
|
||||||
params.gamma = Math.max(0.8, Math.min(3.0, targetMean / 79.2));
|
|
||||||
|
|
||||||
// 2. intensity 固定为 0:亮度控制完全由 gamma 承担
|
|
||||||
// 避免 intensity 与 gamma 叠加导致方向混乱
|
|
||||||
params.intensity = 0.0;
|
|
||||||
|
|
||||||
// 3. 全局标准差 → light_adapt
|
|
||||||
// std 越小(对比度越低)→ 越需要局部自适应 → light_adapt 越大
|
|
||||||
// 上限 0.9(1.0 会产生 NaN),下限 0.5
|
|
||||||
MatOfDouble mean = new MatOfDouble(), stddev = new MatOfDouble();
|
|
||||||
Core.meanStdDev(grayF, mean, stddev);
|
|
||||||
double stdGlobal = stddev.get(0, 0)[0] / 255.0;
|
|
||||||
params.lightAdapt = Math.max(0.5, Math.min(0.9, 0.9 - stdGlobal));
|
|
||||||
|
|
||||||
// 4. 局部标准差均值 → clipLimit
|
|
||||||
int tile = 8;
|
|
||||||
List<Double> localStds = new ArrayList<>();
|
|
||||||
for (int y = 0; y < H - tile; y += tile) {
|
|
||||||
for (int x = 0; x < W - tile; x += tile) {
|
|
||||||
Mat patch = new Mat(grayF, new Rect(x, y, tile, tile));
|
|
||||||
Core.meanStdDev(patch, mean, stddev);
|
|
||||||
localStds.add(stddev.get(0, 0)[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double meanLocalStd = localStds.stream().mapToDouble(d -> d).average().orElse(20.0);
|
|
||||||
double clipLimit = 2.0 * (30.0 / (meanLocalStd + 1e-6));
|
|
||||||
params.clipLimit = Math.max(1.0, Math.min(6.0, clipLimit));
|
|
||||||
|
|
||||||
// 5. 图像短边分辨率 → tileGridSize
|
|
||||||
int tileSize = Math.max(8, Math.min(H, W) / 16);
|
|
||||||
params.tileGrid = new Size(tileSize, tileSize);
|
|
||||||
|
|
||||||
gray.release(); grayF.release(); mean.release(); stddev.release();
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 第一步:Reinhard 局部色调映射。
|
|
||||||
*/
|
|
||||||
public static Mat step1Reinhard(Mat imgBgr, AdaptiveParams params) {
|
|
||||||
Mat imgF32 = new Mat();
|
|
||||||
imgBgr.convertTo(imgF32, CvType.CV_32FC3, 1.0 / 255.0);
|
|
||||||
|
|
||||||
TonemapReinhard tonemap = Photo.createTonemapReinhard(
|
|
||||||
(float) params.gamma, (float) params.intensity, (float) params.lightAdapt, (float) params.colorAdapt);
|
|
||||||
Mat mapped = new Mat();
|
|
||||||
tonemap.process(imgF32, mapped);
|
|
||||||
|
|
||||||
// 将 NaN/Inf 替换为 0,再裁剪到合法范围
|
|
||||||
Core.patchNaNs(mapped, 0.0);
|
|
||||||
|
|
||||||
Mat result = new Mat();
|
|
||||||
mapped.convertTo(result, CvType.CV_8UC3, 255.0);
|
|
||||||
|
|
||||||
imgF32.release(); mapped.release();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 第二步:CLAHE 局部对比度增强。
|
|
||||||
*/
|
|
||||||
public static Mat step2Clahe(Mat imgBgr, AdaptiveParams params) {
|
|
||||||
Mat lab = new Mat();
|
|
||||||
Imgproc.cvtColor(imgBgr, lab, Imgproc.COLOR_BGR2Lab);
|
|
||||||
|
|
||||||
List<Mat> labPlanes = new ArrayList<>(3);
|
|
||||||
Core.split(lab, labPlanes);
|
|
||||||
|
|
||||||
CLAHE clahe = Imgproc.createCLAHE(params.clipLimit, params.tileGrid);
|
|
||||||
Mat lEnhanced = new Mat();
|
|
||||||
clahe.apply(labPlanes.get(0), lEnhanced);
|
|
||||||
|
|
||||||
labPlanes.set(0, lEnhanced);
|
|
||||||
Mat resultLab = new Mat();
|
|
||||||
Core.merge(labPlanes, resultLab);
|
|
||||||
|
|
||||||
Mat result = new Mat();
|
|
||||||
Imgproc.cvtColor(resultLab, result, Imgproc.COLOR_Lab2BGR);
|
|
||||||
|
|
||||||
lab.release(); lEnhanced.release(); resultLab.release();
|
|
||||||
for(Mat p : labPlanes) p.release();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主流程:对输入图像执行两步增强并保存结果。
|
|
||||||
*/
|
|
||||||
public static void enhance(String inputPath, String outputDir) {
|
|
||||||
Mat imgRaw = Imgcodecs.imread(inputPath, Imgcodecs.IMREAD_UNCHANGED);
|
|
||||||
if (imgRaw.empty()) {
|
|
||||||
System.err.println("无法读取图像: " + inputPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String baseName = inputPath.substring(
|
|
||||||
inputPath.lastIndexOf("/") >= 0 ? inputPath.lastIndexOf("/") + 1 : 0,
|
|
||||||
inputPath.lastIndexOf(".")
|
|
||||||
);
|
|
||||||
|
|
||||||
// 1. 格式归一化
|
|
||||||
System.out.println("── 格式归一化 ──────────────────────────────");
|
|
||||||
NormalizedImage normResult = normalizeToBgrUint8(imgRaw);
|
|
||||||
Mat imgBgr = normResult.image;
|
|
||||||
System.out.println(normResult.log);
|
|
||||||
|
|
||||||
// 2. 计算自适应参数
|
|
||||||
System.out.println("── 自适应参数 ──────────────────────────────");
|
|
||||||
AdaptiveParams params = computeAdaptiveParams(imgBgr);
|
|
||||||
System.out.println(params);
|
|
||||||
System.out.println("────────────────────────────────────────────");
|
|
||||||
|
|
||||||
// 3. 第一步:Reinhard 色调映射
|
|
||||||
Mat resultStep1 = step1Reinhard(imgBgr, params);
|
|
||||||
String pathStep1 = outputDir + "/" + baseName + "_step1_tonemap.png";
|
|
||||||
Imgcodecs.imwrite(pathStep1, resultStep1);
|
|
||||||
System.out.println("第一步结果已保存: " + pathStep1);
|
|
||||||
|
|
||||||
// 4. 第二步:CLAHE 局部增强
|
|
||||||
Mat resultStep2 = step2Clahe(resultStep1, params);
|
|
||||||
String pathStep2 = outputDir + "/" + baseName + "_step2_clahe.png";
|
|
||||||
Imgcodecs.imwrite(pathStep2, resultStep2);
|
|
||||||
System.out.println("第二步结果已保存: " + pathStep2);
|
|
||||||
|
|
||||||
imgRaw.release(); imgBgr.release(); resultStep1.release(); resultStep2.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
if (args.length < 1) {
|
|
||||||
System.out.println("用法: java ImageEnhancer <input_path> [output_dir]");
|
|
||||||
String inputPath = "/home/ubuntu/upload/pasted_file_a5uhAu_8986130c06b1e8661387e859b5d2ac93.png";
|
|
||||||
String outputDir = "/home/ubuntu";
|
|
||||||
System.out.println("\n使用默认路径进行处理:");
|
|
||||||
enhance(inputPath, outputDir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String inputPath = args[0];
|
|
||||||
String outputDir = (args.length > 1) ? args[1] : new java.io.File(inputPath).getParent();
|
|
||||||
if (outputDir == null) outputDir = ".";
|
|
||||||
new java.io.File(outputDir).mkdirs();
|
|
||||||
|
|
||||||
enhance(inputPath, outputDir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -14,9 +14,6 @@ spring:
|
|||||||
allow-circular-references: true
|
allow-circular-references: true
|
||||||
application:
|
application:
|
||||||
name: @artifactId@
|
name: @artifactId@
|
||||||
messages:
|
|
||||||
basename: i18n/messages
|
|
||||||
fallback-to-system-locale: false
|
|
||||||
profiles:
|
profiles:
|
||||||
# active: dev
|
# active: dev
|
||||||
config:
|
config:
|
||||||
|
|||||||
@ -1,47 +0,0 @@
|
|||||||
# Default messages
|
|
||||||
# device management
|
|
||||||
device.uav.remove.success=Remove success
|
|
||||||
device.uav.remove.fail=Remove failed
|
|
||||||
device.uav.offline=UAV [{0}] disconnected
|
|
||||||
device.sar.offline=SAR [{0}] disconnected
|
|
||||||
|
|
||||||
# SAR图片管理
|
|
||||||
sar.image.remove.success=Remove success
|
|
||||||
sar.image.remove.fail=Remove failed
|
|
||||||
sar.image.add_highres.success=Operation success
|
|
||||||
sar.image.add_highres.eagain=Other uploading in progress, try later!
|
|
||||||
sar.image.add_highres.fail=Operation failed
|
|
||||||
sar.image.update.success=Update success
|
|
||||||
sar.image.update.fail=Update failed
|
|
||||||
|
|
||||||
# SAR Job管理
|
|
||||||
sar.job.update.success=Operation success
|
|
||||||
sar.job.update.failed=Operation failed
|
|
||||||
sar.job.retry.enullid=Job ID can't be blank
|
|
||||||
sar.job.start.success=Start executing
|
|
||||||
sar.job.start.enosuchjob=Find no job, id={0}
|
|
||||||
sar.job.start.einexecuting=Job in executing, operation failed
|
|
||||||
sar.job.exit.success=Operation success
|
|
||||||
sar.job.exit.failed=Operation failed
|
|
||||||
sar.job_exec.brightness.success=Operation success
|
|
||||||
sar.job_exec.brightness.failed=Operation failed
|
|
||||||
|
|
||||||
# SAR控制
|
|
||||||
sar.control.send.success=Send success
|
|
||||||
sar.control.send.failed=Send failed
|
|
||||||
sar.control.turnon.success=Send success
|
|
||||||
sar.control.turnon.enoip=Failed to extract payload IP address
|
|
||||||
sar.control.turnon.eexcept=Failed to parse request body
|
|
||||||
sar.control.turnon.euavinexec=Configured UAV in middle of executing
|
|
||||||
sar.control.turnon.esarinexec=Configured SAR in middle of executing
|
|
||||||
sar.control.endall.success=Send success
|
|
||||||
sar.control.endall.enoip=Failed to extract payload IP address
|
|
||||||
sar.control.endall.eexcept=Failed to parse request body
|
|
||||||
|
|
||||||
# 用户管理
|
|
||||||
user.login.success=Login success
|
|
||||||
user.login.error=Login error
|
|
||||||
user.updpwd.success=Change password success
|
|
||||||
user.updpwd.error=User name or password error!
|
|
||||||
user.updpwd.nochg=Old password error!
|
|
||||||
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
# 中文消息
|
|
||||||
# 设备管理
|
|
||||||
device.uav.remove.success=操作成功
|
|
||||||
device.uav.remove.fail=操作失败
|
|
||||||
device.uav.offline=无人机[{0}]未连接
|
|
||||||
device.sar.offline=雷达[{0}]未连接
|
|
||||||
|
|
||||||
# SAR图片管理
|
|
||||||
sar.image.remove.success=操作完成
|
|
||||||
sar.image.remove.fail=操作失败
|
|
||||||
sar.image.add_highres.success=操作完成
|
|
||||||
sar.image.add_highres.eagain=正在上传其它图像,请稍后重试!
|
|
||||||
sar.image.add_highres.fail=操作失败
|
|
||||||
sar.image.update.success=操作成功
|
|
||||||
sar.image.update.fail=操作失败
|
|
||||||
|
|
||||||
# SAR Job管理
|
|
||||||
sar.job.update.success=操作成功
|
|
||||||
sar.job.update.failed=操作失败
|
|
||||||
sar.job.retry.enullid=任务ID不能为空
|
|
||||||
sar.job.start.success=开始执行
|
|
||||||
sar.job.start.enosuchjob=找不到任务,id={0}
|
|
||||||
sar.job.start.einexecuting=任务状态为执行中,无法起飞
|
|
||||||
sar.job.exit.success=操作成功
|
|
||||||
sar.job.exit.failed=操作失败
|
|
||||||
|
|
||||||
# SAR控制
|
|
||||||
sar.control.send.success=发送成功
|
|
||||||
sar.control.send.failed=发送失败
|
|
||||||
sar.control.turnon.success=发送成功
|
|
||||||
sar.control.turnon.enoip=请求体中缺少 'payloadId' 或其值为空
|
|
||||||
sar.control.turnon.eexcept=请求体JSON格式错误
|
|
||||||
sar.control.turnon.euavinexec=无人机正在任务中,无法执行新任务
|
|
||||||
sar.control.turnon.esarinexec=载荷正在任务中,无法执行新任务
|
|
||||||
sar.control.endall.success=发送成功
|
|
||||||
sar.control.endall.enoip=请求体中缺少 'payloadId' 或其值为空
|
|
||||||
sar.control.endall.eexcept=请求体JSON格式错误
|
|
||||||
|
|
||||||
|
|
||||||
# 用户管理
|
|
||||||
user.login.success=登录成功
|
|
||||||
user.login.error=用户名或密码错误!
|
|
||||||
user.updpwd.success=修改成功
|
|
||||||
user.updpwd.error=用户名或密码错误!
|
|
||||||
user.updpwd.nochg=旧密码错误!
|
|
||||||
@ -32,7 +32,6 @@
|
|||||||
"sockjs-client": "^1.5.1",
|
"sockjs-client": "^1.5.1",
|
||||||
"stompjs": "^2.3.3",
|
"stompjs": "^2.3.3",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-i18n": "^8.28.2",
|
|
||||||
"vue-router": "^3.1.5",
|
"vue-router": "^3.1.5",
|
||||||
"vuex": "^3.1.2",
|
"vuex": "^3.1.2",
|
||||||
"vuex-persistedstate": "^4.1.0"
|
"vuex-persistedstate": "^4.1.0"
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
// English translations
|
|
||||||
export default {
|
|
||||||
app: {
|
|
||||||
title: 'Skyeye Twin System',
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
login: 'Login',
|
|
||||||
logout: 'Logout',
|
|
||||||
},
|
|
||||||
login: {
|
|
||||||
username: 'Please enter username',
|
|
||||||
password: 'Please enter password',
|
|
||||||
title: 'Login',
|
|
||||||
submit: 'Log In',
|
|
||||||
validation: {
|
|
||||||
required: 'Cannot be empty',
|
|
||||||
passwordMin: 'Password must be at least 6 characters',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
common: {
|
|
||||||
capsLockOn: 'Caps lock is On',
|
|
||||||
},
|
|
||||||
menu: {
|
|
||||||
device: 'Device Management',
|
|
||||||
task: 'Task Management',
|
|
||||||
picture: 'Picture Management',
|
|
||||||
user: 'User Management'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
import Vue from 'vue'
|
|
||||||
import VueI18n from 'vue-i18n'
|
|
||||||
import zh from './zh';
|
|
||||||
import en from './en';
|
|
||||||
Vue.use(VueI18n)
|
|
||||||
|
|
||||||
// load locale messages
|
|
||||||
const messages = {
|
|
||||||
zh,
|
|
||||||
en,
|
|
||||||
}
|
|
||||||
|
|
||||||
const locale = localStorage.getItem('locale') || 'zh'
|
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
|
||||||
locale,
|
|
||||||
fallbackLocale: 'zh',
|
|
||||||
messages,
|
|
||||||
})
|
|
||||||
|
|
||||||
export default i18n
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
// Chinese translations
|
|
||||||
export default {
|
|
||||||
app: {
|
|
||||||
title: '空域快视系统',
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
login: '登录',
|
|
||||||
logout: '退出登录',
|
|
||||||
},
|
|
||||||
login: {
|
|
||||||
username: '请输入用户名',
|
|
||||||
password: '请输入用户密码',
|
|
||||||
title: '登录',
|
|
||||||
submit: '登 录',
|
|
||||||
validation: {
|
|
||||||
required: '不能为空',
|
|
||||||
passwordMin: '密码不少于6位字符',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
common: {
|
|
||||||
capsLockOn: '大写锁定已打开',
|
|
||||||
},
|
|
||||||
menu: {
|
|
||||||
device: '设备管理',
|
|
||||||
task: '任务管理',
|
|
||||||
picture: '图片管理',
|
|
||||||
user: '用户管理'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -18,7 +18,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const validatePassword = (rule, value, callback) => {
|
const validatePassword = (rule, value, callback) => {
|
||||||
if (value.length < 6) {
|
if (value.length < 6) {
|
||||||
callback(new Error(this.$t('login.validation.passwordMin')))
|
callback(new Error('密码不少于6位字符'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ export default {
|
|||||||
loginRules: {
|
loginRules: {
|
||||||
username: [
|
username: [
|
||||||
// { required: true, trigger: 'blur', validator: validateUsername }
|
// { required: true, trigger: 'blur', validator: validateUsername }
|
||||||
{ required: true, message: this.$t('login.username'), trigger: 'blur' }
|
{ required: true, message: '请输入用户名', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, trigger: 'blur', validator: validatePassword }
|
{ required: true, trigger: 'blur', validator: validatePassword }
|
||||||
@ -67,22 +67,22 @@ export default {
|
|||||||
activeIndex: '1',
|
activeIndex: '1',
|
||||||
menus: [
|
menus: [
|
||||||
{
|
{
|
||||||
key: 'device',
|
label: "设备管理",
|
||||||
value: '2',
|
value: '2',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'task',
|
label: "任务管理",
|
||||||
value: '3',
|
value: '3',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'picture',
|
label: "图片管理",
|
||||||
value: '4',
|
value: '4',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'user',
|
label: "用户管理",
|
||||||
value: '5',
|
value: '5',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
@ -175,10 +175,6 @@ export default {
|
|||||||
handleSelect(key) {
|
handleSelect(key) {
|
||||||
this.SET_MENUS_CHOSE(key)
|
this.SET_MENUS_CHOSE(key)
|
||||||
},
|
},
|
||||||
changeLocale(lang) {
|
|
||||||
this.$i18n.locale = lang
|
|
||||||
localStorage.setItem('locale', lang)
|
|
||||||
},
|
|
||||||
goHome() {
|
goHome() {
|
||||||
this.SET_MENUS_CHOSE('1')
|
this.SET_MENUS_CHOSE('1')
|
||||||
},
|
},
|
||||||
|
|||||||
@ -25,7 +25,7 @@ $light_gray: #eee;
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 350px;
|
width: 250px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
@ -129,7 +129,7 @@ $light_gray: #eee;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.header-nav-r {
|
.header-nav-r {
|
||||||
width: 350px;
|
width: 250px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<div class="logo" @click="goHome">
|
<div class="logo" @click="goHome">
|
||||||
<img src="@/assets/img/common/logo3.png" alt />
|
<img src="@/assets/img/common/logo3.png" alt />
|
||||||
<!--span :class="tokenKey">灵动孪生智控系统</span-->
|
<!--span :class="tokenKey">灵动孪生智控系统</span-->
|
||||||
<span :class="tokenKey">{{ $t('app.title') }}</span>
|
<span :class="tokenKey">空域快视系统</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-nav-c">
|
<div class="header-nav-c">
|
||||||
@ -19,17 +19,14 @@
|
|||||||
v-if="item.show"
|
v-if="item.show"
|
||||||
:index="item.value"
|
:index="item.value"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
>{{ $t('menu.' + item.key) }}</el-menu-item
|
>{{ item.label }}</el-menu-item
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</div>
|
</div>
|
||||||
<ul class="header-nav-r">
|
<ul class="header-nav-r">
|
||||||
<!-- <li class="lang-select">
|
|
||||||
<a @click.prevent="changeLocale('zh')">中文</a> | <a @click.prevent="changeLocale('en')">EN</a>
|
|
||||||
</li> -->
|
|
||||||
<li v-if="roleIdsLocale.indexOf(2) !== -1">
|
<li v-if="roleIdsLocale.indexOf(2) !== -1">
|
||||||
<span class="user-login" @click="showLogin">{{ $t('header.login') }}</span>
|
<span class="user-login" @click="showLogin">登录</span>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="roleIdsLocale.indexOf(2) === -1">
|
<li v-if="roleIdsLocale.indexOf(2) === -1">
|
||||||
<span class="user-photo">
|
<span class="user-photo">
|
||||||
@ -45,14 +42,14 @@
|
|||||||
<!-- <el-dropdown-item command="modifyPassword"
|
<!-- <el-dropdown-item command="modifyPassword"
|
||||||
>修改密码</el-dropdown-item
|
>修改密码</el-dropdown-item
|
||||||
> -->
|
> -->
|
||||||
<el-dropdown-item command="logout">{{ $t('header.logout') }}</el-dropdown-item>
|
<el-dropdown-item command="logout">退出登录</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<dt-dialog
|
<dt-dialog
|
||||||
:title="$t('header.login')"
|
title="登录"
|
||||||
:visible.sync="visible.login"
|
:visible.sync="visible.login"
|
||||||
top="20vh"
|
top="20vh"
|
||||||
width="22%"
|
width="22%"
|
||||||
@ -73,7 +70,7 @@
|
|||||||
class="username"
|
class="username"
|
||||||
clearable
|
clearable
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
:placeholder="$t('login.username')"
|
placeholder="请输入用户名"
|
||||||
name="username"
|
name="username"
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -85,7 +82,7 @@
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-model="capsTooltip"
|
v-model="capsTooltip"
|
||||||
:content="$t('common.capsLockOn')"
|
content="Caps lock is On"
|
||||||
placement="right"
|
placement="right"
|
||||||
manual
|
manual
|
||||||
>
|
>
|
||||||
@ -96,7 +93,7 @@
|
|||||||
class="password"
|
class="password"
|
||||||
v-model="loginForm.password"
|
v-model="loginForm.password"
|
||||||
:type="passwordType"
|
:type="passwordType"
|
||||||
:placeholder="$t('login.password')"
|
placeholder="请输入用户密码"
|
||||||
name="password"
|
name="password"
|
||||||
tabindex="2"
|
tabindex="2"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -125,7 +122,8 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@click.native.prevent="handleLogin"
|
@click.native.prevent="handleLogin"
|
||||||
>{{ $t('login.submit') }}</el-button>
|
>登 录</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</dt-dialog>
|
</dt-dialog>
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import appLoader from './App.Loader';
|
import appLoader from './App.Loader';
|
||||||
import i18n from '@/lang/index';
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await appLoader.install()
|
await appLoader.install()
|
||||||
Promise.all([
|
Promise.all([
|
||||||
@ -18,7 +17,6 @@ import i18n from '@/lang/index';
|
|||||||
el: '#app',
|
el: '#app',
|
||||||
router,
|
router,
|
||||||
store,
|
store,
|
||||||
i18n,
|
|
||||||
render: h => h(App)
|
render: h => h(App)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
label-position="left"
|
label-position="left"
|
||||||
>
|
>
|
||||||
<div class="title-container">
|
<div class="title-container">
|
||||||
<h3 class="title">{{ $t('login.title') }}</h3>
|
<h3 class="title">登录</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
@ -25,7 +25,7 @@
|
|||||||
ref="username"
|
ref="username"
|
||||||
class="username"
|
class="username"
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
:placeholder="$t('login.username')"
|
placeholder="请输入用户名"
|
||||||
name="username"
|
name="username"
|
||||||
type="text"
|
type="text"
|
||||||
tabindex="1"
|
tabindex="1"
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
v-model="capsTooltip"
|
v-model="capsTooltip"
|
||||||
:content="$t('common.capsLockOn')"
|
content="Caps lock is On"
|
||||||
placement="right"
|
placement="right"
|
||||||
manual
|
manual
|
||||||
>
|
>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
class="password"
|
class="password"
|
||||||
v-model="loginForm.password"
|
v-model="loginForm.password"
|
||||||
:type="passwordType"
|
:type="passwordType"
|
||||||
:placeholder="$t('login.password')"
|
placeholder="请输入用户密码"
|
||||||
name="password"
|
name="password"
|
||||||
tabindex="2"
|
tabindex="2"
|
||||||
autocomplete="on"
|
autocomplete="on"
|
||||||
@ -77,7 +77,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
round
|
round
|
||||||
@click.native.prevent="handleLogin"
|
@click.native.prevent="handleLogin"
|
||||||
>{{ $t('login.submit') }}</el-button
|
>登 录</el-button
|
||||||
>
|
>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@ -101,7 +101,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const validatePassword = (rule, value, callback) => {
|
const validatePassword = (rule, value, callback) => {
|
||||||
if (value.length < 6) {
|
if (value.length < 6) {
|
||||||
callback(new Error(this.$t('login.validation.passwordMin')))
|
callback(new Error('密码不少于6位字符'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ export default {
|
|||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
// { required: true, trigger: 'blur', validator: validatePassword }
|
// { required: true, trigger: 'blur', validator: validatePassword }
|
||||||
{ required: true, trigger: 'blur', message: this.$t('login.validation.required') },
|
{ required: true, trigger: 'blur', message: '请输入密码' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
passwordType: 'password',
|
passwordType: 'password',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user