Commit bbb9fd9e by zzrdark

1.修复 7198 7251

parent 993f725b
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
<module name="cneeds-common-utils" /> <module name="cneeds-common-utils" />
<module name="cneeds-common-data" /> <module name="cneeds-common-data" />
<module name="cneeds-server-eureka" /> <module name="cneeds-server-eureka" />
<module name="cneeds-common-hadoop-dfs" />
<module name="cneeds-common-pojo" /> <module name="cneeds-common-pojo" />
<module name="cneeds-server-device_activate" /> <module name="cneeds-server-device_activate" />
<module name="cneeds-server-logupload" />
<module name="cneeds-server-authorization" /> <module name="cneeds-server-authorization" />
<module name="cneeds-server-user" /> <module name="cneeds-server-user" />
<module name="cneeds-server-logupload" /> <module name="cneeds-common-hadoop-dfs" />
<module name="cneeds-server-device" /> <module name="cneeds-server-device" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="LeetcodeEditor">
<option name="projectConfig">
<map>
<entry key="$USER_HOME$/AppData/Local/Temp/leetcode/editor/cn/[1]两数之和.java">
<value>
<LeetcodeEditor>
<option name="path" value="$USER_HOME$/AppData/Local/Temp/leetcode/editor/cn/[1]两数之和.java" />
<option name="questionId" value="1" />
</LeetcodeEditor>
</value>
</entry>
<entry key="$USER_HOME$/AppData/Local/Temp/leetcode/editor/cn/[2]两数相加.java">
<value>
<LeetcodeEditor>
<option name="path" value="$USER_HOME$/AppData/Local/Temp/leetcode/editor/cn/[2]两数相加.java" />
<option name="questionId" value="2" />
</LeetcodeEditor>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
...@@ -353,3 +353,10 @@ ADD COLUMN `ca_certificate_status` varchar(255) COMMENT 'ca证书状态 -1 未 ...@@ -353,3 +353,10 @@ ADD COLUMN `ca_certificate_status` varchar(255) COMMENT 'ca证书状态 -1 未
ALTER TABLE `cneeds_server`.`device_info` ALTER TABLE `cneeds_server`.`device_info`
CHANGE COLUMN `status` `active_status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci CHANGE COLUMN `status` `active_status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci
DEFAULT NULL COMMENT '状态0未激活,1已激活' AFTER `iccid`; DEFAULT NULL COMMENT '状态0未激活,1已激活' AFTER `iccid`;
-- 2020-07-14
ALTER TABLE `cneeds_server`.`device_info`
MODIFY COLUMN `active_status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 0 COMMENT '状态0未激活,1已激活' AFTER `iccid`,
MODIFY COLUMN `channel_rules` int(255) DEFAULT 1 COMMENT '0:白名单,1:黑名单' AFTER `channel_nums_message`,
MODIFY COLUMN `ca_certificate_status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT -1 COMMENT 'ca证书状态 -1 未下载,0 已下载 类型:非量产 1 已下载 类型:量产,2 已下载 类型:非量产,未验证 3 已下载 类型:量产,未验证' AFTER `sn`;
\ No newline at end of file
spring: spring:
profiles: profiles:
active: prod active: dev
application: application:
name: cneeds-server-authorization name: cneeds-server-authorization
server: server:
......
...@@ -52,7 +52,7 @@ public class DeviceController { ...@@ -52,7 +52,7 @@ public class DeviceController {
try { try {
deviceInfoDto = deviceClient.queryDeviceByImei(imei); deviceInfoDto = deviceClient.queryDeviceByImei(imei);
if (deviceInfoDto == null){ if (deviceInfoDto == null){
log.debug("ResultCode:"+ResultCode.NOTFOUND_IMEI); // log.debug("ResultCode:"+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei的设备"); return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei的设备");
} }
}catch (Exception e) { }catch (Exception e) {
...@@ -307,6 +307,11 @@ public class DeviceController { ...@@ -307,6 +307,11 @@ public class DeviceController {
return R.ok().put("data",deviceChannelDtos); return R.ok().put("data",deviceChannelDtos);
} }
/**
* 删除(还原)设置的渠道号
* @param deviceId
* @return
*/
@PreAuthorize("hasRole('configManagement:deviceChannel:delete') or hasRole('admin')") @PreAuthorize("hasRole('configManagement:deviceChannel:delete') or hasRole('admin')")
@PostMapping("/deviceChannel/deleteSettingDeviceChannel") @PostMapping("/deviceChannel/deleteSettingDeviceChannel")
public R deleteSettingDeviceChannel(Long deviceId){ public R deleteSettingDeviceChannel(Long deviceId){
......
...@@ -125,13 +125,13 @@ public class LogFlieController { ...@@ -125,13 +125,13 @@ public class LogFlieController {
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei()); DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei());
if (deviceInfoDto == null){ if (deviceInfoDto == null){
log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI); // log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei"); return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei");
} }
DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId()); DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId());
if ( deviceLogDto == null ){ if ( deviceLogDto == null ){
log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG); // log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG);
return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息"); return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息");
} }
return R.ok(); return R.ok();
...@@ -147,13 +147,13 @@ public class LogFlieController { ...@@ -147,13 +147,13 @@ public class LogFlieController {
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei()); DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei());
if (deviceInfoDto == null){ if (deviceInfoDto == null){
log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI); // log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei"); return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei");
} }
DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId()); DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId());
if ( deviceLogDto == null ){ if ( deviceLogDto == null ){
log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG); // log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG);
return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息"); return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息");
} }
......
package com.mx.cneeds.server.wechat.common.codec; package com.mx.cneeds.server.wechat.common.codec;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.mx.cneeds.server.wechat.websocket.config.NettyChannelManager;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder; import io.netty.handler.codec.MessageToMessageEncoder;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
...@@ -19,7 +20,7 @@ public class MessageToWebSocketEncoder extends MessageToMessageEncoder<Invocatio ...@@ -19,7 +20,7 @@ public class MessageToWebSocketEncoder extends MessageToMessageEncoder<Invocatio
@Override @Override
protected void encode(ChannelHandlerContext ctx, Invocation invocation, List<Object> list) throws Exception { protected void encode(ChannelHandlerContext ctx, Invocation invocation, List<Object> list) throws Exception {
// String toJsonString = JSON.toJSONString(invocation.getMessage()); // String toJsonString = JSON.toJSONString(invocation.getMessage());
log.debug("发出一条消息({})",invocation.getMessage()); log.debug("用户:["+ctx.channel().attr(NettyChannelManager.CHANNEL_ATTR_KEY_USER).get() + "]发出一条消息({})",invocation.getMessage());
list.add(new TextWebSocketFrame(invocation.getMessage())); list.add(new TextWebSocketFrame(invocation.getMessage()));
} }
} }
...@@ -23,7 +23,7 @@ public class NettyChannelManager { ...@@ -23,7 +23,7 @@ public class NettyChannelManager {
/** /**
* {@link Channel#attr(AttributeKey)} 属性中,表示 Channel 对应的用户 * {@link Channel#attr(AttributeKey)} 属性中,表示 Channel 对应的用户
*/ */
private static final AttributeKey<String> CHANNEL_ATTR_KEY_USER = AttributeKey.newInstance("user"); public static final AttributeKey<String> CHANNEL_ATTR_KEY_USER = AttributeKey.newInstance("user");
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
...@@ -91,11 +91,13 @@ public class NettyChannelManager { ...@@ -91,11 +91,13 @@ public class NettyChannelManager {
// 获得用户对应的 Channel // 获得用户对应的 Channel
Channel channel = userChannels.get(user); Channel channel = userChannels.get(user);
if (channel == null) { if (channel == null) {
logger.error("[send][连接不存在]"); logger.debug("[send]用户:["+user+"][连接不存在]");
logger.error("[send]用户:["+user+"][连接不存在]");
return; return;
} }
if (!channel.isActive()) { if (!channel.isActive()) {
logger.error("[send][连接({})未激活]", channel.id()); logger.debug("[send]用户:["+user+"][连接({})未激活]", channel.id());
logger.error("[send]用户:["+user+"][连接({})未激活]", channel.id());
return; return;
} }
......
...@@ -135,6 +135,7 @@ public class DeviceChannelController { ...@@ -135,6 +135,7 @@ public class DeviceChannelController {
DeviceInfoEntity deviceInfoEntity = new DeviceInfoEntity(); DeviceInfoEntity deviceInfoEntity = new DeviceInfoEntity();
deviceInfoEntity.setDeviceId(deviceId); deviceInfoEntity.setDeviceId(deviceId);
deviceInfoEntity.setChannelRules(1); deviceInfoEntity.setChannelRules(1);
deviceInfoEntity.setChannelNumsMessage("未设置");
deviceInfoService.updateById(deviceInfoEntity); deviceInfoService.updateById(deviceInfoEntity);
HashMap<String, Object> stringObjectHashMap = new HashMap<>(); HashMap<String, Object> stringObjectHashMap = new HashMap<>();
stringObjectHashMap.put("device_id",deviceId); stringObjectHashMap.put("device_id",deviceId);
......
spring: spring:
profiles: profiles:
active: prod active: dev
application: application:
name: cneeds-server-device name: cneeds-server-device
......
spring: spring:
profiles: profiles:
active: prod active: dev
application: application:
name: cneeds-server-logupload name: cneeds-server-logupload
......
...@@ -54,6 +54,10 @@ public class SysUserController { ...@@ -54,6 +54,10 @@ public class SysUserController {
@RequestMapping("/list") @RequestMapping("/list")
public PageUtils list(@RequestParam Map<String, Object> params){ public PageUtils list(@RequestParam Map<String, Object> params){
PageUtils page = sysUserService.queryPage(params); PageUtils page = sysUserService.queryPage(params);
page.getList().forEach(sysUser -> {
// 不暴露密码
((SysUserEntity)sysUser).setPassword(null);
});
return page; return page;
} }
...@@ -64,13 +68,16 @@ public class SysUserController { ...@@ -64,13 +68,16 @@ public class SysUserController {
// @RequestMapping("/info/{userId}") // @RequestMapping("/info/{userId}")
public R info(@PathVariable("userId") Long userId){ public R info(@PathVariable("userId") Long userId){
SysUserEntity sysUser = sysUserService.getById(userId); SysUserEntity sysUser = sysUserService.getById(userId);
// 不暴露密码
sysUser.setPassword(null);
return R.ok().put("sysUser", sysUser); return R.ok().put("sysUser", sysUser);
} }
@PostMapping("/userinfo") @PostMapping("/userinfo")
public UserDto infoByUsername(@RequestParam("username") String username){ public UserDto infoByUsername(@RequestParam("username") String username){
SysUserEntity sysUser = sysUserService.queryUserByUsername(username); SysUserEntity sysUser = sysUserService.queryUserByUsername(username);
// 不暴露密码
sysUser.setPassword(null);
Long roleId = sysUserRoleService.queryRoleId(sysUser.getUserId()); Long roleId = sysUserRoleService.queryRoleId(sysUser.getUserId());
UserDto userDto = new UserDto(); UserDto userDto = new UserDto();
BeanUtils.copyProperties(sysUser,userDto); BeanUtils.copyProperties(sysUser,userDto);
......
spring: spring:
profiles: profiles:
active: prod active: dev
application: application:
name: cneeds-server-user name: cneeds-server-user
......
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