1、增加登录用户密码修改功能
2、增加debug打印d331消息序号和长度,用来定位d331字节数统计错误的问题
This commit is contained in:
parent
046d73ebaf
commit
bbe4a841ea
@ -29,7 +29,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
@Override
|
@Override
|
||||||
public Void execute(D331RtcmMessage message) {
|
public Void execute(D331RtcmMessage message) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("receive d331 rtcm message of device:{}", message.getId());
|
logger.debug("receive d331 rtcm message of device: "+message.getId()+", seq:"+message.getSeq()+", len:"+message.getLen());
|
||||||
}
|
}
|
||||||
// 补齐tenantId
|
// 补齐tenantId
|
||||||
Device device1 = deviceService.findByDeviceId(message.getId());
|
Device device1 = deviceService.findByDeviceId(message.getId());
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import com.imdroid.sideslope.sal.DeviceService;
|
|||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
import com.imdroid.sideslope.service.DataPersistService;
|
import com.imdroid.sideslope.service.DataPersistService;
|
||||||
import com.imdroid.common.util.ThreadManager;
|
import com.imdroid.common.util.ThreadManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -18,6 +20,8 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessage, Void> {
|
public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessage, Void> {
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataPersistService dataPersistService;
|
private DataPersistService dataPersistService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -28,10 +32,14 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void execute(D3F0SelfCheckMessage message) {
|
public Void execute(D3F0SelfCheckMessage message) {
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("receive d3f0 message of device: "+message.getId());
|
||||||
|
}
|
||||||
// 补齐tenantId
|
// 补齐tenantId
|
||||||
Device device = deviceService.findByDeviceId(message.getId());
|
Device device = deviceService.findByDeviceId(message.getId());
|
||||||
if(device == null) return null;
|
if(device == null) return null;
|
||||||
message.setTenantId(device.getTenantId());
|
message.setTenantId(device.getTenantId());
|
||||||
|
device.clearStat();
|
||||||
|
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
GnssStatus lastGnssStatus = dataPersistService.getDeviceState(message.getId());
|
GnssStatus lastGnssStatus = dataPersistService.getDeviceState(message.getId());
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import com.imdroid.sideslope.sal.Device;
|
|||||||
import com.imdroid.sideslope.sal.DeviceService;
|
import com.imdroid.sideslope.sal.DeviceService;
|
||||||
import com.imdroid.sideslope.service.DataPersistService;
|
import com.imdroid.sideslope.service.DataPersistService;
|
||||||
import com.imdroid.common.util.ThreadManager;
|
import com.imdroid.common.util.ThreadManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -21,6 +23,7 @@ import java.time.LocalDateTime;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndicationMessage, Void> {
|
public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndicationMessage, Void> {
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataPersistService dataPersistService;
|
private DataPersistService dataPersistService;
|
||||||
@ -34,6 +37,9 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void execute(D3F2StopIndicationMessage message) {
|
public Void execute(D3F2StopIndicationMessage message) {
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("receive d3f2 message of device: "+message.getId());
|
||||||
|
}
|
||||||
// 补齐tenantId
|
// 补齐tenantId
|
||||||
String deviceId = message.getId();
|
String deviceId = message.getId();
|
||||||
Device device = deviceService.findByDeviceId(deviceId);
|
Device device = deviceService.findByDeviceId(deviceId);
|
||||||
@ -42,7 +48,6 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
|||||||
GnssTrxMsg gnssTrxMsg = message.getTrxMsg();
|
GnssTrxMsg gnssTrxMsg = message.getTrxMsg();
|
||||||
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
|
gnssTrxMsg.setD3xxbytes(device.getD3xxbytes());
|
||||||
gnssTrxMsg.setB562bytes(device.getB562bytes());
|
gnssTrxMsg.setB562bytes(device.getB562bytes());
|
||||||
device.clearStat();
|
|
||||||
|
|
||||||
LocalDateTime uploadTime = multiLineGNSSCalcService.getUploadTime(device.getDeviceId());
|
LocalDateTime uploadTime = multiLineGNSSCalcService.getUploadTime(device.getDeviceId());
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.imdroid.beidou.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.imdroid.beidou.common.HttpResult;
|
||||||
|
import com.imdroid.beidou.entity.User;
|
||||||
|
import com.imdroid.beidou.entity.UserMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class UserController extends BasicController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
UserMapper userMapper;
|
||||||
|
|
||||||
|
/**** 推送页面 *****/
|
||||||
|
@RequestMapping("/page/user_pwd")
|
||||||
|
public String warning() throws Exception {
|
||||||
|
return "/page/user_pwd";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**** 推送数据 *****/
|
||||||
|
@PostMapping("/personal/update_pwd")
|
||||||
|
@ResponseBody
|
||||||
|
public String updatePwd(HttpSession session, @RequestBody JSONObject object) throws Exception {
|
||||||
|
String result = "修改成功";
|
||||||
|
boolean flag = false;
|
||||||
|
String name = (String) session.getAttribute("login_user");
|
||||||
|
User user = userMapper.queryByName(name);
|
||||||
|
if (user != null) {
|
||||||
|
String old_pwd = object.getString("old_pwd");
|
||||||
|
String new_pwd = object.getString("new_pwd");
|
||||||
|
String re_pwd = object.getString("re_pwd");
|
||||||
|
BCryptPasswordEncoder pwdEncoder = new BCryptPasswordEncoder();
|
||||||
|
if (!pwdEncoder.matches(old_pwd, user.getPwd())) {
|
||||||
|
result = "原密码错误";
|
||||||
|
} else if (!new_pwd.equals(re_pwd)) {
|
||||||
|
result = "新密码输入不一致";
|
||||||
|
}
|
||||||
|
else if(IsSimplePassword(new_pwd)){
|
||||||
|
result = "密码过于简单,必须是数字和字母的组合";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
flag = true;
|
||||||
|
user.setPwd(pwdEncoder.encode(new_pwd));
|
||||||
|
user.setInit_pwd(false);
|
||||||
|
userMapper.updateById(user);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HttpResult.result(flag?HttpResult.HTTP_RSP_OK:HttpResult.HTTP_RSP_FAILED,result);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean IsSimplePassword(String pwd){
|
||||||
|
if(pwd.length()<8) return true;
|
||||||
|
|
||||||
|
boolean hasNum = false;
|
||||||
|
boolean hasNotNum = false;
|
||||||
|
for(int i=0; i<pwd.length(); i++){
|
||||||
|
char ch = pwd.charAt(i);
|
||||||
|
if(ch >='0' && ch <='9') hasNum = true;
|
||||||
|
else hasNotNum = true;
|
||||||
|
}
|
||||||
|
return !(hasNum && hasNotNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.imdroid.beidou.entity;
|
package com.imdroid.beidou.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -12,7 +13,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@TableName(value = "UserCfg")
|
@TableName(value = "UserCfg")
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
@TableId
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
int tenant_id;
|
int tenant_id;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
CREATE TABLE IF NOT EXISTS `UserCfg` (
|
CREATE TABLE IF NOT EXISTS `UserCfg` (
|
||||||
`id` bigint(20),
|
`id` bigint(20) AUTO_INCREMENT,
|
||||||
`tenant_id` int DEFAULT 0,
|
`tenant_id` int DEFAULT 0,
|
||||||
`name` varchar(20) NOT NULL,
|
`name` varchar(20) NOT NULL,
|
||||||
`pwd` varchar(64) NOT NULL,
|
`pwd` varchar(64) NOT NULL,
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
<a href="javascript:;" layuimini-content-href="page/user-setting.html" data-title="基本资料" data-icon="fa fa-gears">基本资料<span class="layui-badge-dot"></span></a>
|
<a href="javascript:;" layuimini-content-href="page/user-setting.html" data-title="基本资料" data-icon="fa fa-gears">基本资料<span class="layui-badge-dot"></span></a>
|
||||||
</dd>
|
</dd>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="javascript:;" layuimini-content-href="page/user-password.html" data-title="修改密码" data-icon="fa fa-gears">修改密码</a>
|
<a href="javascript:;" layuimini-content-href="page/user_pwd" data-title="修改密码" data-icon="fa fa-gears">修改密码</a>
|
||||||
</dd>
|
</dd>
|
||||||
<dd>
|
<dd>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
64
sec-beidou/src/main/resources/templates/page/user_pwd.html
Normal file
64
sec-beidou/src/main/resources/templates/page/user_pwd.html
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<div class="layuimini-container layuimini-page-anim">
|
||||||
|
<div class="layuimini-main">
|
||||||
|
<div class="layui-card top-panel">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<form class="layui-form" >
|
||||||
|
<div class="layui-form" lay-filter="changePassword">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">当前密码</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="password" name="old_pwd" lay-verify="required" lay-verType="tips" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">新密码</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="password" name="new_pwd" lay-verify="pass" lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid layui-word-aux">8个以上字符,包含数字和非数字</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">确认新密码</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="password" name="re_pwd" lay-verify="repass" lay-verType="tips" autocomplete="off" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认修改</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
layui.use(['form'], function () {
|
||||||
|
var form = layui.form,
|
||||||
|
$ = layui.$;
|
||||||
|
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(saveBtn)', function (data) {
|
||||||
|
console.log(JSON.stringify(data.field));
|
||||||
|
$.ajax({
|
||||||
|
type:"POST",
|
||||||
|
url:"/personal/update_pwd",
|
||||||
|
contentType: "application/json;charset=UTF-8",
|
||||||
|
data: JSON.stringify(data.field),
|
||||||
|
success: function (result) {
|
||||||
|
var obj = JSON.parse(result);
|
||||||
|
layer.alert(obj.msg);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
console.log("ajax error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Loading…
x
Reference in New Issue
Block a user