设备监控修改

This commit is contained in:
lyd
2022-10-22 14:41:05 +08:00
parent 4f150811ee
commit 542db1ce93
20 changed files with 152 additions and 341 deletions

View File

@@ -37,7 +37,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@RequestMapping("/mobile/auth")
@RequestMapping("/api/pda")
@RequiredArgsConstructor
@Api(tags = "手持:系统授权接口")
public class MobileAuthorizationController {

View File

@@ -1,136 +0,0 @@
//
//package org.nl.wms.pda.login.rest;
//
//
//import cn.hutool.core.map.MapUtil;
//import cn.hutool.core.util.StrUtil;
//import com.alibaba.fastjson.JSONObject;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.tomcat.util.net.openssl.ciphers.Authentication;
//import org.nl.modules.common.config.RsaProperties;
//import org.nl.modules.common.exception.BadRequestException;
//import org.nl.modules.common.utils.RsaUtils;
//import org.nl.modules.common.utils.SecurityUtils;
//import org.nl.modules.logging.annotation.Log;
//import org.nl.modules.security.service.OnlineUserService;
//
//import org.nl.modules.system.service.UserService;
//import org.nl.modules.system.service.dto.UserDto;
//
//import org.nl.wms.pda.login.service.HandLoginService;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Map;
//
///**
// * @author ldjun
// * @date 2021-07-26
// **/
//@RestController
//@RequiredArgsConstructor
//@Api(tags = "手持登陆")
//@RequestMapping("api/pda")
//@Slf4j
//public class HandLoginController {
// private final HandLoginService handLoginService;
// private final UserService userService;
// private final OnlineUserService onlineUserService;
//
// @PostMapping("/handlogin")
// @Log("手持登陆验证")
// @ApiOperation("手持登陆验证")
// public ResponseEntity<Object> handlogin(@RequestBody Map<String, String> whereJson, HttpServletRequest request) {
// JSONObject resultJson = new JSONObject();
// MapUtil.getStr(whereJson, "user");
// String user = MapUtil.getStr(whereJson, "user");
// String password = MapUtil.getStr(whereJson, "password");
// String nick_name = "";
// if (StrUtil.isEmpty(user)) {
// throw new BadRequestException("用户不能为空");
//
// }
// if (StrUtil.isEmpty("device_id")) {
// resultJson.put("code", "0");
// resultJson.put("desc", "设备不能为空");
// // return resultJson;
// }
// if (StrUtil.isEmpty(password)) {
// throw new BadRequestException("密码不能为空!");
// }
// boolean is_match = false;
// Long account_id = 0L;
// try {
// String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
// UserDto userDto = userService.findByName(user);
// account_id = userDto.getId();
// nick_name =userDto.getNickName();
// is_match = passwordEncoder.matches(pwd, userDto.getPassword());
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// if (is_match) {
// resultJson.put("code", "1");
// resultJson.put("desc", "登陆成功");
// } else {
// resultJson.put("code", "0");
// resultJson.put("desc", "登陆失败!");
// }
// UserDetails userDetails = userDetailsService.loadUserByUsername(user);
// Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
// SecurityContextHolder.getContext().setAuthentication(authentication);
// String token = tokenProvider.createToken(authentication);
// final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// // 保存在线信息
// onlineUserService.save(jwtUserDto, token, request);
//
// JSONObject jo = new JSONObject();
// jo.put("user_name", user);
// jo.put("nick_name", nick_name);
// jo.put("token", properties.getTokenStartWith() + token);
// jo.put("account_id", account_id.toString());
// resultJson.put("result", jo);
//
// return new ResponseEntity<>(resultJson, HttpStatus.OK);
// }
//
// @PostMapping("/authority")
// @Log("手持登陆查询权限")
// @ApiOperation("手持登陆查询权限")
// public ResponseEntity<Object> queryAuthority(@RequestBody Map<String, String> whereJson) {
// return new ResponseEntity<>(handLoginService.queryAuthority(whereJson), HttpStatus.OK);
// }
//
// @ApiOperation("修改密码")
// @Log("手持修改密码")
// @PostMapping(value = "/updatePass")
// public ResponseEntity<Object> updatePass(@RequestBody Map<String, String> whereJson) throws Exception {
// String RfoldPass = MapUtil.getStr(whereJson, "RfoldPass");
// String RfnewPass = MapUtil.getStr(whereJson, "RfnewPass");
// String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, RfoldPass);
// String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, RfnewPass);
// UserDto user = userService.findByName(SecurityUtils.getCurrentUsername());
// if (!passwordEncoder.matches(oldPass, user.getPassword())) {
// throw new BadRequestException("修改失败,旧密码错误");
// }
// if (passwordEncoder.matches(newPass, user.getPassword())) {
// throw new BadRequestException("新密码不能与旧密码相同");
// }
// userService.updatePass(user.getUsername(), passwordEncoder.encode(newPass));
// JSONObject returnjo = new JSONObject();
// returnjo.put("code", "1");
// returnjo.put("desc", "修改密码成功!");
// return new ResponseEntity<>(returnjo, HttpStatus.OK);
// }
//}

View File

@@ -1,22 +0,0 @@
//package org.nl.wms.pda.login.service;
//
//import java.util.Map;
//
//public interface HandLoginService {
// /**
// * 手持登陆
// *
// * @param jsonObject 条件
// * @return Map<String, Object>
// */
// Map<String, Object> handleLogin(Map<String, String> jsonObject);
//
// /**
// * 手持登陆查询权限
// *
// * @param jsonObject 条件
// * @return Map<String, Object>
// */
// Map<String, Object> queryAuthority(Map<String, String> jsonObject);
//
//}

View File

@@ -1,112 +0,0 @@
//package org.nl.wms.pda.login.service.impl;
//
//import cn.hutool.core.util.StrUtil;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import lombok.RequiredArgsConstructor;
//import lombok.SneakyThrows;
//import lombok.extern.slf4j.Slf4j;
//
//
//import org.apache.tomcat.util.net.openssl.ciphers.Authentication;
//import org.nl.modules.common.config.RsaProperties;
//import org.nl.modules.common.utils.SecurityUtils;
//import org.nl.modules.security.service.OnlineUserService;
//
//import org.nl.modules.system.service.UserService;
//import org.nl.modules.system.service.dto.UserDto;
//import org.nl.modules.wql.WQL;
//import org.nl.utils.RsaUtils;
//
//import org.nl.wms.pda.login.service.HandLoginService;
//
//
//
//
//import org.springframework.stereotype.Service;
//
//import java.util.Map;
//
//@Service
//@RequiredArgsConstructor
//@Slf4j
//public class HandLoginServiceImpl implements HandLoginService {
//
// private final UserService userService;
//
// private final OnlineUserService onlineUserService;
//
// @SneakyThrows
// @Override
// public Map<String, Object> handleLogin(Map<String, String> jsonObject) {
// JSONObject resultJson = new JSONObject();
// String user = jsonObject.get("user");
// String password = jsonObject.get("password");
// boolean is_match = false;
// Long account_id = 0L;
// try {
// String pwd = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, password);
// UserDto userDto = userService.findByName(user);
// account_id = userDto.getId();
// is_match = passwordEncoder.matches(pwd, userDto.getPassword());
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// if (is_match) {
// resultJson.put("code", "1");
// resultJson.put("desc", "登陆成功");
// } else {
// resultJson.put("code", "0");
// resultJson.put("desc", "登陆失败!");
// }
// UserDetails userDetails = userDetailsService.loadUserByUsername(user);
// Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
// SecurityContextHolder.getContext().setAuthentication(authentication);
// String token = tokenProvider.createToken(authentication);
// final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// // 保存在线信息
// onlineUserService.save(jwtUserDto, token, null);
// JSONObject jo = new JSONObject();
// jo.put("user_name", user);
// jo.put("token", properties.getTokenStartWith() + token);
// jo.put("account_id", account_id.toString());
// resultJson.put("result", jo);
// return resultJson;
//
// }
//
// @Override
// public Map<String, Object> queryAuthority(Map<String, String> jsonObject) {
// String accountId = String.valueOf(SecurityUtils.getCurrentUserId());
// JSONObject returnjo = new JSONObject();
// if (StrUtil.isEmpty(accountId)) {
// returnjo.put("code", "0");
// returnjo.put("desc", "用户id不能为空");
// returnjo.put("result", new JSONArray());
// }
// //查询一级
// JSONObject result = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "0").process().uniqueResult(0);
//
// //查询二级
// //JSONArray SecondResults = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "1").process().getResultJSONArray(0);
// //查询三级
// /* JSONArray roleTree = new JSONArray();
// for (int i = 0; i < SecondResults.size(); i++) {
// JSONObject row = SecondResults.getJSONObject(i);
// String menu_id = row.getString("menu_id");
// JSONArray ThirdResults = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "2").addParam("pid", menu_id).process().getResultJSONArray(0);
// row.put("sonTree", ThirdResults);
// roleTree.add(row);
// }*/
// JSONArray ThirdResults = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "4").addParam("accountId", accountId).addParam("component", "2").process().getResultJSONArray(0);
//
// result.put("sonTree", ThirdResults);
//
// returnjo.put("code", "1");
// returnjo.put("desc", "查询成功!");
// returnjo.put("result", result);
// return returnjo;
// }
//}

View File

@@ -0,0 +1,9 @@
package org.nl.wms.pda.login;
/**
* @author: lyd
* @description:
* @Date: 2022/10/22
*/
public class test {
}