Commit a13df414 authored by “yiyousong”'s avatar “yiyousong”
parents 231cc4bb 9afd82cd
......@@ -209,6 +209,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
*/
@Override
public Claims parseToken(String token) {
return Jwts.parser()
.setSigningKey(Base64.getEncoder().encodeToString(secret.getBytes()))
.parseClaimsJws(token)
......@@ -245,4 +248,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
private String getTokenKey(String uuid) {
return SysConstains.LOGIN_TOKEN_KEY + uuid;
}
public static void main(String[] args) {
// boolean signed = Jwts.parser().isSigned("123");
boolean signed = Jwts.parser().isSigned("eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJuaW5naGFvLm5ldCIsImV4cCI6IjE0Mzg5NTU0NDUiLCJuYW1lIjoid2FuZ2hhbyIsImFkbWluIjp0cnVlfQ.SwyHTEx_RQppr97g4J5lKXtabJecpejuef8AqKYMAJc");
System.out.println(signed);
}
}
......@@ -31,6 +31,7 @@ public class WindowEntity extends WindowVo {
/**
* 部门名称
*/
@Excel(name = "部门名称")
private String deptName;
/**
* 窗口名称
......
......@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.window.model.WindowHallEntity;
......@@ -15,7 +16,7 @@ import com.mortals.xhx.module.window.dao.WindowHallDao;
* @author zxfei
* @date 2023-04-25
*/
public interface WindowHallService extends ICRUDService<WindowHallEntity,Long>{
public interface WindowHallService extends ICRUDCacheService<WindowHallEntity,Long> {
WindowHallDao getDao();
......
......@@ -52,9 +52,12 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
@Override
protected void findAfter(WindowBusinessEntity entity, PageInfo pageInfo, Context context, List<WindowBusinessEntity> list) throws AppException {
Map<Long, WindowEntity> collect = windowService.findToMap(new WindowQuery(), context);
Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.find(new WindowHallQuery(), context).parallelStream().collect(Collectors.toMap(x -> x.getWindowId(), Function.identity()));
Map<Long, WindowEntity> collect = windowService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
//Map<Long, WindowEntity> collect = windowService.findToMap(new WindowQuery(), context);
Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
//Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.find(new WindowHallQuery(), context).parallelStream().collect(Collectors.toMap(x -> x.getWindowId(), Function.identity()));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
WindowBusinessEntity item = (WindowBusinessEntity) iterator.next();
......@@ -67,7 +70,7 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
if (!ObjectUtils.isEmpty(windowHallEntity)) {
item.setHallId(windowHallEntity.getHallId());
item.setHallName(windowHallEntity.getHallName());
}else {
} else {
//log.info("windowhallEntity is null windowId:{}",item.getWindowId());
}
} else {
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.module.window.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.window.model.WindowEntity;
import com.mortals.xhx.module.window.model.WindowQuery;
import com.mortals.xhx.module.window.service.WindowService;
......@@ -27,7 +28,7 @@ import java.util.stream.Collectors;
* @date 2023-04-25
*/
@Service("windowHallService")
public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao, WindowHallEntity, Long> implements WindowHallService {
public class WindowHallServiceImpl extends AbstractCRUDCacheServiceImpl<WindowHallDao, WindowHallEntity, Long> implements WindowHallService {
@Autowired
private WindowService windowService;
......@@ -41,8 +42,14 @@ public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao
*/
@Override
protected void findAfter(WindowHallEntity params, PageInfo pageInfo, Context context, List<WindowHallEntity> list) throws AppException {
super.findAfter(params, pageInfo, context, list);
List<Long> collect = list.stream().map(i -> i.getWindowId()).distinct().collect(Collectors.toList());
Map<Long, WindowEntity> collectWin = windowService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
list.forEach(item -> {
WindowEntity windowEntity = collectWin.get(item.getWindowId());
item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum());
});
/* List<Long> collect = list.stream().map(i -> i.getWindowId()).distinct().collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) {
WindowQuery windowQuery = new WindowQuery();
windowQuery.setIdList(collect);
......@@ -51,6 +58,6 @@ public class WindowHallServiceImpl extends AbstractCRUDServiceImpl<WindowHallDao
WindowEntity windowEntity = collectWin.get(item.getWindowId());
item.setFromnum(windowEntity == null ? "" : windowEntity.getFromnum());
});
}
}*/
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.site.model.SiteEntity;
......@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -186,6 +188,27 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
if (!ObjectUtils.isEmpty(deptEntity)) {
windowEntity.setDeptId(deptEntity.getId());
windowEntity.setDeptName(deptEntity.getName());
}else {
//判断是否填入了部门名称
if(!ObjectUtils.isEmpty(windowEntity.getDeptName())){
//根据部门名称与站点 更新窗口
DeptQuery deptQuery = new DeptQuery();
deptQuery.setName(windowEntity.getDeptName());
deptQuery.setSiteId(DataUtil.converStr2Long(siteId,0L));
deptEntity = deptService.selectOne(deptQuery);
if(!ObjectUtils.isEmpty(deptEntity)){
windowEntity.setDeptId(deptEntity.getId());
windowEntity.setDeptName(deptEntity.getName());
}
}
}
}
//siteId为空 或deptId为空 则删除 不导入
Iterator<WindowEntity> iterator = list.iterator();
while (iterator.hasNext()) {
WindowEntity next = iterator.next();
if(ObjectUtils.isEmpty(next.getSiteId())||ObjectUtils.isEmpty(next.getDeptId())){
iterator.remove();
}
}
}
......
......@@ -18,8 +18,6 @@ POST {{baseUrl}}/app/dataset/list
Content-Type: application/json
{
"siteId": 1,
"appId": 79,
"page": 1,
"size": 10
}
......
......@@ -3,7 +3,7 @@
POST {{baseUrl}}/dept/list
Content-Type: application/json
{"siteId":1,"page":"1","size":"-1","orderColList":[{"colName":"sort","sortKind":"asc"}]}
{}
###部门列表1
......
......@@ -4,11 +4,6 @@ POST {{baseUrl}}/holiday/list
Content-Type: application/json
{
"siteId":9033 ,
"name":"adqb9k" ,
"year":1996 ,
"page":1,
"size":10
}
......
......@@ -18,8 +18,9 @@ POST {{baseUrl}}/site/hall/list
Content-Type: application/json
{
"page":1,
"size":11
"siteId": 1,
"page": 1,
"size": -1
}
......
......@@ -3,11 +3,7 @@
POST {{baseUrl}}/window/business/list
Content-Type: application/json
{
"page":1,
"size":10
}
{"windowIdList":["77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99"],"size":-1}
###窗口业务更新与保存
POST {{baseUrl}}/window/business/save
......
......@@ -13,11 +13,7 @@ POST {{baseUrl}}/workman/list
Content-Type: application/json
{
"page":1,
"size":10,
"andConditionList":[{"name":"%张三%","number":"%123%","deptName":"%123%","windowName":"%123%"}]
}
}
###工作人员更新与保存
......
......@@ -76,6 +76,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
String token = getToken(request);
if (StringUtils.isNotEmpty(token)) {
try {
boolean signed = Jwts.parser().isSigned(token);
if (!signed) {
log.error("token非法!=>{}", token);
return null;
}
Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid);
......
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