生箔下料界面、手持登录
This commit is contained in:
@@ -95,7 +95,7 @@ public class AuthorizationController {
|
||||
// 获取权限列表 - 登录查找权限
|
||||
List<String> permissionList = roleService.getPermissionList(userDto);
|
||||
|
||||
// 保存用户信息到session - 登录输入,登出删除
|
||||
// 登录输入,登出删除
|
||||
CurrentUser user = new CurrentUser();
|
||||
user.setId(userDto.getId());
|
||||
user.setUsername(userDto.getUsername());
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package org.nl.modules.security.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
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.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.dto.CurrentUser;
|
||||
import org.nl.modules.security.service.dto.AuthUserDto;
|
||||
import org.nl.modules.system.service.RoleService;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.modules.system.service.dto.UserDto;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: lyd
|
||||
* @description: 手持登录鉴权
|
||||
* @Date: 2022/10/10
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mobile/auth")
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持:系统授权接口")
|
||||
public class MobileAuthorizationController {
|
||||
private final RedisUtils redisUtils;
|
||||
private final UserService userService;
|
||||
private final RoleService roleService;
|
||||
|
||||
@ApiOperation("登录授权")
|
||||
@PostMapping(value = "/login")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
||||
String password = authUser.getPassword();
|
||||
// String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
|
||||
// 校验数据库
|
||||
// 根据用户名查询,在比对密码
|
||||
UserDto userDto = userService.findByName(authUser.getUsername()); // 拿不到已经抛出异常
|
||||
if (!userDto.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) { // 这里需要密码加密
|
||||
throw new BadRequestException("账号或密码错误");
|
||||
}
|
||||
// 获取权限列表 - 登录查找权限
|
||||
List<String> permissionList = roleService.getPermissionList(userDto);
|
||||
|
||||
// 登录输入,登出删除
|
||||
CurrentUser user = new CurrentUser();
|
||||
user.setId(userDto.getId());
|
||||
user.setUsername(userDto.getUsername());
|
||||
user.setNickName(userDto.getNickName());
|
||||
user.setUser(userDto);
|
||||
user.setPermissions(permissionList);
|
||||
|
||||
// SaLoginModel 配置登录相关参数
|
||||
StpUtil.login(userDto.getId(), new SaLoginModel()
|
||||
.setDevice("PE") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
.setExtra("loginInfo", user) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
);
|
||||
|
||||
// 返回 token 与 用户信息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("roles", permissionList);
|
||||
jsonObject.put("user", userDto);
|
||||
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
|
||||
put("token", StpUtil.getTokenValue());
|
||||
put("user", jsonObject);
|
||||
}};
|
||||
|
||||
redisUtils.set("pe-satoken", StpUtil.getTokenValue(), StpUtil.getTokenTimeout());
|
||||
|
||||
return ResponseEntity.ok(authInfo);
|
||||
}
|
||||
}
|
||||
@@ -64,4 +64,12 @@ public class CoolPointIvtController {
|
||||
coolpointivtService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/coolRegionIOQueryAll")
|
||||
@Log("冷却区出入表")
|
||||
@ApiOperation("冷却区出入表")
|
||||
//@SaCheckPermission("@el.check('stIvtCoolpointivt:list')")
|
||||
public ResponseEntity<Object> coolRegionIOQueryAll(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(coolpointivtService.coolRegionIOQueryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,12 @@ public interface CoolPointIvtService {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 冷却区出入分页查询
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> coolRegionIOQueryAll(Map whereJson, Pageable page);
|
||||
}
|
||||
|
||||
@@ -140,4 +140,24 @@ public class CoolPointIvtServiceImpl implements CoolPointIvtService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 冷却区出入分页查询
|
||||
*
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> coolRegionIOQueryAll(Map whereJson, Pageable page) {
|
||||
HashMap map = new HashMap();
|
||||
map.put("flag", "2");
|
||||
if (whereJson.get("start_point_code")!=null)
|
||||
map.put("start_point_code", "%" + whereJson.get("start_point_code") + "%");
|
||||
map.put("bill_status", whereJson.get("bill_status"));
|
||||
map.put("begin_time", whereJson.get("begin_time"));
|
||||
map.put("end_time", whereJson.get("end_time"));
|
||||
JSONObject json = WQL.getWO("ST_IVT_COOLPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
输入.is_used TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.start_point_code TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -83,4 +85,27 @@
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
coolregionio.*
|
||||
FROM
|
||||
st_ivt_coolregionio coolregionio
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.start_point_code <> ""
|
||||
start_point_code LIKE 输入.start_point_code
|
||||
ENDOPTION
|
||||
OPTION 输入.bill_status <> ""
|
||||
bill_status = 输入.bill_status
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
create_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
create_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user