Commit 228a044d authored by 赵啸非's avatar 赵啸非

修改窗口导入验证

parent 6416a161
...@@ -209,6 +209,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -209,6 +209,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
*/ */
@Override @Override
public Claims parseToken(String token) { public Claims parseToken(String token) {
return Jwts.parser() return Jwts.parser()
.setSigningKey(Base64.getEncoder().encodeToString(secret.getBytes())) .setSigningKey(Base64.getEncoder().encodeToString(secret.getBytes()))
.parseClaimsJws(token) .parseClaimsJws(token)
...@@ -245,4 +248,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -245,4 +248,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
private String getTokenKey(String uuid) { private String getTokenKey(String uuid) {
return SysConstains.LOGIN_TOKEN_KEY + 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 { ...@@ -31,6 +31,7 @@ public class WindowEntity extends WindowVo {
/** /**
* 部门名称 * 部门名称
*/ */
@Excel(name = "部门名称")
private String deptName; private String deptName;
/** /**
* 窗口名称 * 窗口名称
......
...@@ -12,6 +12,7 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; ...@@ -12,6 +12,7 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController; import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.dept.model.DeptEntity; 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.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.site.model.SiteEntity; import com.mortals.xhx.module.site.model.SiteEntity;
...@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -186,6 +188,27 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe ...@@ -186,6 +188,27 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
if (!ObjectUtils.isEmpty(deptEntity)) { if (!ObjectUtils.isEmpty(deptEntity)) {
windowEntity.setDeptId(deptEntity.getId()); windowEntity.setDeptId(deptEntity.getId());
windowEntity.setDeptName(deptEntity.getName()); 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 ...@@ -18,8 +18,6 @@ POST {{baseUrl}}/app/dataset/list
Content-Type: application/json Content-Type: application/json
{ {
"siteId": 1,
"appId": 79,
"page": 1, "page": 1,
"size": 10 "size": 10
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
POST {{baseUrl}}/dept/list POST {{baseUrl}}/dept/list
Content-Type: application/json Content-Type: application/json
{"siteId":1,"page":"1","size":"-1","orderColList":[{"colName":"sort","sortKind":"asc"}]} {}
###部门列表1 ###部门列表1
......
...@@ -4,11 +4,6 @@ POST {{baseUrl}}/holiday/list ...@@ -4,11 +4,6 @@ POST {{baseUrl}}/holiday/list
Content-Type: application/json Content-Type: application/json
{ {
"siteId":9033 ,
"name":"adqb9k" ,
"year":1996 ,
"page":1,
"size":10
} }
......
...@@ -18,8 +18,9 @@ POST {{baseUrl}}/site/hall/list ...@@ -18,8 +18,9 @@ POST {{baseUrl}}/site/hall/list
Content-Type: application/json Content-Type: application/json
{ {
"page":1, "siteId": 1,
"size":11 "page": 1,
"size": -1
} }
......
...@@ -13,11 +13,7 @@ POST {{baseUrl}}/workman/list ...@@ -13,11 +13,7 @@ POST {{baseUrl}}/workman/list
Content-Type: application/json 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 { ...@@ -76,6 +76,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
String token = getToken(request); String token = getToken(request);
if (StringUtils.isNotEmpty(token)) { if (StringUtils.isNotEmpty(token)) {
try { try {
boolean signed = Jwts.parser().isSigned(token);
if (!signed) {
log.error("token非法!=>{}", token);
return null;
}
Claims claims = parseToken(token); Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY); String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid); 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