Compare commits

...

10 Commits

Author SHA1 Message Date
TS-QD1
0b85059f4b 增加环变量 2023-04-18 10:22:27 +08:00
ad3850ba17 git ignore 2021-07-06 22:06:11 +08:00
0b2da3d574 修改日志输出 2021-06-25 20:48:32 +08:00
bf4edb4827 新增部门接口 2021-06-25 00:40:56 +08:00
1a3155f8d5 修改权限 2021-06-22 17:19:25 +08:00
d6d6d612f5 新增接口 2021-05-23 20:21:16 +08:00
b3d0e1d847 整理代码 2021-05-22 09:19:54 +08:00
d1820f7a3f 完善网格的处理逻辑 2021-05-22 09:19:30 +08:00
45aee17e43 调整资源客户端token的请求地址,可以不走外网 2021-05-22 09:19:06 +08:00
717628ed54 修改密码问题 2021-04-12 18:23:32 +08:00
33 changed files with 1275 additions and 371 deletions

36
.gitignore vendored Normal file
View File

@ -0,0 +1,36 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
.mvn
mvnw
mvnw.cmd
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@ -107,6 +107,15 @@ public interface IGridDao {
*/
List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;
/**
* 网格列表group
*
* @param relationIds
* @return
* @throws SearchException
*/
List<GridDTO> listGridGroupByRelationIds(List<String> relationIds) throws SearchException;
/**
* 获取网格点列表
*
@ -115,4 +124,5 @@ public interface IGridDao {
* @throws SearchException
*/
List<GridPointDTO> listPointByGridIds(List<String> gridIds) throws SearchException;
}

View File

@ -2,11 +2,12 @@ package com.cm.plugin.map.service;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResultList;
import com.cm.plugin.map.pojo.dto.GridDTO;
import com.cm.plugin.map.pojo.dto.GridRelationDTO;
import com.cm.plugin.map.pojo.vo.GridPointVO;
import com.cm.plugin.map.pojo.vo.GridVO;
import org.springframework.stereotype.Service;
import java.util.List;
@ -56,6 +57,22 @@ public interface IGridService {
*/
void deleteGridByGridIds(List<String> gridIds) throws RemoveException;
/**
* 删除空网格没有节点的网格
*
* @param deleteGridIds
*/
void deleteEmptyGrid(List<String> gridIds);
/**
* 删除网格
*
* @param gridId
* @param relationId
* @throws RemoveException
*/
void deleteGridRelation(String gridId, String relationId) throws RemoveException;
/**
* 获取网格关系列表
*
@ -108,6 +125,24 @@ public interface IGridService {
* @return
* @throws SearchException
*/
List<GridDTO> listGridGroupByRelationIds(List<String> relationIds) throws SearchException;
/**
* 获取全部网格列表
*
* @param relationIds
* @return
* @throws SearchException
*/
List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;
/**
* 获取网格分页列表
*
* @param relationIds
* @return
*/
SuccessResultList<List<GridDTO>> listPageGridByRelationIds(ListPage page, List<String> relationIds);
}

View File

@ -4,6 +4,8 @@ import com.alibaba.druid.util.StringUtils;
import com.cm.common.base.AbstractService;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.plugin.map.dao.IGridDao;
@ -13,12 +15,12 @@ import com.cm.plugin.map.pojo.dto.GridRelationDTO;
import com.cm.plugin.map.pojo.vo.GridPointVO;
import com.cm.plugin.map.pojo.vo.GridVO;
import com.cm.plugin.map.service.IGridService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* When you feel like quitting. Think about why you started
@ -104,6 +106,39 @@ public class GridServiceImpl extends AbstractService implements IGridService {
gridDao.deleteGridRelation(params);
}
@Override
public void deleteEmptyGrid(List<String> gridIds) {
if (gridIds.isEmpty()) {
return;
}
// 所有的网格和人员关联关系列表
List<GridRelationDTO> gridRelationDTOs = listGridRelationByGridIds(gridIds);
// 得到为空的网格
List<String> emptyGridIds = new ArrayList<>();
for (String gridId : gridIds) {
boolean isEmpty = true;
for (GridRelationDTO gridRelationDTO : gridRelationDTOs) {
if (StringUtils.equals(gridId, gridRelationDTO.getGridId())) {
isEmpty = false;
break;
}
}
if (isEmpty) {
emptyGridIds.add(gridId);
}
}
// 删除空网格
deleteGridByGridIds(emptyGridIds);
}
@Override
public void deleteGridRelation(String gridId, String relationId) throws RemoveException {
Map<String, Object> params = getHashMap(4);
params.put("gridId", gridId);
params.put("relationId", relationId);
gridDao.deleteGridRelation(params);
}
@Override
public List<GridRelationDTO> listGridRelationByRelationId(String relationId) throws SearchException {
Map<String, Object> params = getHashMap(2);
@ -145,6 +180,45 @@ public class GridServiceImpl extends AbstractService implements IGridService {
return gridDTOs;
}
@Override
public List<GridDTO> listGridGroupByRelationIds(List<String> relationIds) throws SearchException {
if (relationIds == null || relationIds.size() == 0) {
return new ArrayList<>();
}
List<GridDTO> gridDTOs = gridDao.listGridByRelationIds(relationIds);
if (gridDTOs.isEmpty()) {
return gridDTOs;
}
// 聚合后的网格
List<GridDTO> gridGroupDTOs = listGridGroup(gridDTOs);
// 只能展示包含关联人员列表的网格比如查询AB那么可以展示的应该是AB...而不能是A
for (int i = 0; i < gridGroupDTOs.size(); i++) {
GridDTO gridDTO = gridGroupDTOs.get(i);
// 关联人数多于片区人数排除
if (relationIds.size() > gridDTO.getRelationIdArray().size()) {
gridGroupDTOs.remove(i);
i--;
continue;
}
// 判断关联人是否全部被片区包含
boolean isAllExist = true;
for (String relationId : relationIds) {
if (!gridDTO.getRelationId().contains(relationId)) {
isAllExist = false;
break;
}
}
// 不是全部包含就删除
if (!isAllExist) {
gridGroupDTOs.remove(i);
i--;
continue;
}
}
setGridPoints(gridGroupDTOs);
return gridGroupDTOs;
}
@Override
public List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException {
if (relationIds == null || relationIds.size() == 0) {
@ -154,6 +228,19 @@ public class GridServiceImpl extends AbstractService implements IGridService {
if (gridDTOs.isEmpty()) {
return gridDTOs;
}
setGridPoints(gridDTOs);
return gridDTOs;
}
/**
* 设置网格点
*
* @param gridDTOs
*/
private void setGridPoints(List<GridDTO> gridDTOs) {
if (gridDTOs.isEmpty()) {
return;
}
List<String> gridIds = new ArrayList<>();
for (GridDTO gridDTO : gridDTOs) {
gridIds.add(gridDTO.getGridId());
@ -161,7 +248,7 @@ public class GridServiceImpl extends AbstractService implements IGridService {
// 获取所有点
List<GridPointDTO> gridPointDTOs = gridDao.listPointByGridIds(gridIds);
if (gridPointDTOs.isEmpty()) {
return gridDTOs;
return;
}
// 构建所有点
for (GridDTO gridDTO : gridDTOs) {
@ -173,7 +260,47 @@ public class GridServiceImpl extends AbstractService implements IGridService {
}
gridDTO.setPointArray(pointArray);
}
return gridDTOs;
}
/**
* 得到聚合后的列表
*
* @param gridDTOs
* @return
*/
private List<GridDTO> listGridGroup(List<GridDTO> gridDTOs) {
Map<String, GridDTO> gridMap = new HashMap<>(16);
for (GridDTO gridDTO : gridDTOs) {
GridDTO grid = gridMap.get(gridDTO.getGridId());
if (grid == null) {
grid = gridDTO;
List<String> getRelationIdArray = new ArrayList<>();
getRelationIdArray.add(gridDTO.getRelationId());
gridDTO.setRelationIdArray(getRelationIdArray);
gridMap.put(gridDTO.getGridId(), gridDTO);
}
// 合并relationId
grid.getRelationIdArray().add(gridDTO.getRelationId());
}
List<GridDTO> gridGroups = new ArrayList<>();
for (Map.Entry<String, GridDTO> kv : gridMap.entrySet()) {
GridDTO gridDTO = kv.getValue();
Collections.sort(gridDTO.getRelationIdArray());
gridDTO.setRelationId(gridDTO.getRelationIdArray().toString());
gridGroups.add(gridDTO);
}
return gridGroups;
}
@Override
public SuccessResultList<List<GridDTO>> listPageGridByRelationIds(ListPage page, List<String> relationIds) {
if (relationIds == null || relationIds.size() == 0) {
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
}
PageHelper.startPage(page.getPage(), page.getRows());
List<GridDTO> gridDTOs = gridDao.listGridByRelationIds(relationIds);
PageInfo<GridDTO> pageInfo = new PageInfo<>(gridDTOs);
return new SuccessResultList<>(gridDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
/**

View File

@ -92,19 +92,22 @@
<delete id="deleteGridRelation" parameterType="map" flushCache="true">
DELETE FROM
map_grid_relation
WHERE
<where>
<if test="gridId != null and gridId != ''">
grid_id = #{gridId}
</if>
<if test="gridIds != null and gridIds.size > 0">
AND
grid_id IN
<foreach collection="gridIds" index="index" open="(" separator="," close=")">
#{gridIds[${index}]}
</foreach>
</if>
<if test="relationId != null and relationId != ''">
AND
relation_id = #{relationId}
</if>
</where>
</delete>
<!-- 保存网格点 -->
@ -193,6 +196,30 @@
</foreach>
</select>
<select id="listGridGroupByRelationIds" parameterType="java.util.List" resultMap="gridDTO" useCache="true">
SELECT
t1.grid_id,
t1.fill_color,
t1.grid_name
FROM
map_grid t1
LEFT JOIN
map_grid_relation t2
ON
t1.grid_id = t2.grid_id
WHERE
t1.is_delete = 0
AND
t2.relation_id IN
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{list[${index}]}
</foreach>
GROUP BY
t1.grid_id,
t1.fill_color,
t1.grid_name
</select>
<!-- 获取网格点列表通过网格ID -->
<select id="listPointByGridId" parameterType="java.lang.String" resultMap="gridPointDTO" useCache="true">
SELECT

View File

@ -107,7 +107,7 @@ public interface IApiConsts {
/**
* 修改密码
*/
String UPDATE_USER_PASSWORD = "%s/resource/user/updateuserpassword";
String UPDATE_USER_PASSWORD = "%s/resource/user/updateuserpassword/%s";
/**
* 部门人员列表ZTree格式
@ -211,4 +211,8 @@ public interface IApiConsts {
*/
String LIST_LAYIM_DEPARTMENT_USER = "%s/resource/user/im/listdepartmentuser";
/**
* 部门列表
*/
String LIST_DEPARTMENT_SORT = "%s/resource/department/list-sort";
}

View File

@ -3,7 +3,10 @@ package com.cm.common.plugin.oauth.service.department;
import com.alibaba.fastjson.JSONArray;
import com.cm.common.exception.AccessTokenException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import java.util.List;
import java.util.Map;
/**
@ -58,4 +61,12 @@ public interface IDepartmentService {
* @throws SearchException
*/
JSONArray listZTreeDepartment(Map<String, Object> params) throws AccessTokenException, SearchException;
/**
* 部门列表
*
* @param type 部门类型
* @return
*/
List<DepartmentSortDTO> listSortByType(String type);
}

View File

@ -9,11 +9,12 @@ import com.cm.common.plugin.IApiConsts;
import com.cm.common.plugin.oauth.service.department.IDepartmentService;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
import com.cm.common.plugin.utils.RestTemplateUtil;
import org.apache.commons.lang3.StringUtils;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -78,4 +79,14 @@ public class DepartmentServiceImpl extends AbstractService implements IDepartmen
searchResourceResult(result, "获取部门人员列表失败");
return JSONArray.parseArray(result);
}
@Override
public List<DepartmentSortDTO> listSortByType(String type) {
Map<String, Object> params = new HashMap<>(2);
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
params.put("departmentType", type);
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_DEPARTMENT_SORT, apiPathProperties.getUserCenter()), params);
searchResourceResult(result, "获取部门列表失败");
return JSONArray.parseArray(result, DepartmentSortDTO.class);
}
}

View File

@ -130,25 +130,15 @@ public class ClientRbacServiceImpl implements IClientRbacService {
}
List<String> savePaths = accessControl.getSavePaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiSaveMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getSaveMenu()) {
for (String savePath : savePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + savePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getApiPrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + savePath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceSaveMenu()) {
for (String savePath : savePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + savePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getResourcePrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + savePath, uri)) {
return true;
}
}
}
// 匹配路由
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getRouteSaveMenu()) {
for (String savePath : savePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + savePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getRoutePrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + savePath, uri)) {
return true;
}
}
@ -173,17 +163,12 @@ public class ClientRbacServiceImpl implements IClientRbacService {
}
List<String> deletePaths = accessControl.getDeletePaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiDeleteMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getDeleteMenu()) {
for (String deletePath : deletePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + deletePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getApiPrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + deletePath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceDeleteMenu()) {
for (String deletePath : deletePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + deletePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getResourcePrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + deletePath, uri)) {
return true;
}
}
@ -208,25 +193,15 @@ public class ClientRbacServiceImpl implements IClientRbacService {
}
List<String> updatePaths = accessControl.getUpdatePaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiUpdateMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getUpdateMenu()) {
for (String updatePath : updatePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + updatePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getApiPrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + updatePath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceUpdateMenu()) {
for (String updatePath : updatePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + updatePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getResourcePrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + updatePath, uri)) {
return true;
}
}
}
// 匹配路由
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getRouteUpdateMenu()) {
for (String updatePath : updatePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + updatePath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getRoutePrefix()) && antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + updatePath, uri)) {
return true;
}
}
@ -251,26 +226,23 @@ public class ClientRbacServiceImpl implements IClientRbacService {
}
List<String> queryPaths = accessControl.getQueryPaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiQueryMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getQueryMenu()) {
if (StringUtils.isBlank(roleMenuBO.getApiPrefix())
&& StringUtils.isBlank(roleMenuBO.getResourcePrefix())
&& StringUtils.isBlank(roleMenuBO.getRoutePrefix())) {
continue;
}
for (String queryPath : queryPaths) {
String queryAntPath = contextPath + roleMenuBO.getApiPrefix() + queryPath;
if (antPathMatcher.match(queryAntPath, uri)) {
if (!StringUtils.isBlank(roleMenuBO.getApiPrefix()) && antPathMatcher.match(queryAntPath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceQueryMenu()) {
for (String queryPath : queryPaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + queryPath, uri)) {
queryAntPath = contextPath + roleMenuBO.getResourcePrefix() + queryPath;
if (!StringUtils.isBlank(roleMenuBO.getResourcePrefix()) && antPathMatcher.match(queryAntPath, uri)) {
return true;
}
}
}
// 匹配路由
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getRouteQueryMenu()) {
for (String queryPath : queryPaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + queryPath, uri)) {
queryAntPath = contextPath + roleMenuBO.getRoutePrefix() + queryPath;
if (!StringUtils.isBlank(roleMenuBO.getRoutePrefix()) && antPathMatcher.match(queryAntPath, uri)) {
return true;
}
}

View File

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import com.cm.common.base.AbstractService;
import com.cm.common.component.OAuthRestTemplateComponent;
import com.cm.common.config.properties.ApiPathProperties;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.AccessTokenException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.IApiConsts;
@ -18,14 +17,13 @@ import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.print.attribute.standard.PageRanges;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
@ -144,7 +142,7 @@ public class UserServiceImpl extends AbstractService implements IUserService {
@Override
public SuccessResult updateUserPassword(Map<String, Object> params) throws AccessTokenException, SearchException {
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.UPDATE_USER_PASSWORD, apiPathProperties.getUserCenter()), params);
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.UPDATE_USER_PASSWORD, apiPathProperties.getUserCenter(), securityComponent.getCurrentUser().getUserId()), params);
updateResourceResult(result, "密码修改失败");
return new SuccessResult();
}

View File

@ -1,6 +1,7 @@
package com.cm.common.plugin.oauth.token;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.config.properties.ApiPathProperties;
import com.cm.common.config.properties.OauthClientProperties;
import com.cm.common.config.properties.OauthProperties;
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
@ -30,6 +31,7 @@ public class ClientTokenManager {
private RestTemplateUtil restTemplateUtil;
private OauthProperties oauthProperties;
private OauthClientProperties oauthClientProperties;
private ApiPathProperties apiPathProperties;
private ClientTokenManager() {
}
@ -50,7 +52,7 @@ public class ClientTokenManager {
params.put("client_id", oauthClientProperties.getClientId());
params.put("client_secret", oauthClientProperties.getClientSecret());
params.put("scope", "all");
String result = restTemplateUtil.doPostFormNormal(String.format("%s/oauth_client/token", oauthProperties.getOauthServer()), params);
String result = restTemplateUtil.doPostFormNormal(String.format("%s/oauth_client/token", apiPathProperties.getUserCenter()), params);
if (StringUtils.isBlank(result)) {
LOG.error("客户端获取token失效");
} else {
@ -95,4 +97,7 @@ public class ClientTokenManager {
public static ClientTokenManager clientTokenManager = new ClientTokenManager();
}
public void setApiPathProperties(ApiPathProperties apiPathProperties) {
this.apiPathProperties = apiPathProperties;
}
}

View File

@ -1,5 +1,6 @@
package com.cm.common.plugin.startup;
import com.cm.common.config.properties.ApiPathProperties;
import com.cm.common.config.properties.OauthClientProperties;
import com.cm.common.config.properties.OauthProperties;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
@ -27,6 +28,8 @@ public class OAuthStartUp implements ApplicationRunner {
@Autowired
private OauthProperties oauthProperties;
@Autowired
private ApiPathProperties apiPathProperties;
@Autowired
private RestTemplateUtil restTemplateUtil;
@Override
@ -35,5 +38,6 @@ public class OAuthStartUp implements ApplicationRunner {
clientTokenManager.setRestTemplateUtil(restTemplateUtil);
clientTokenManager.setOauthProperties(oauthProperties);
clientTokenManager.setOauthClientProperties(oauthClientProperties);
clientTokenManager.setApiPathProperties(apiPathProperties);
}
}

View File

@ -173,7 +173,7 @@ public class RestTemplateUtil {
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(queryParams, httpHeaders);
RestTemplate restTemplate = getRestTemplate();
try {
LOG.debug("Rest post:\nurl: {},\nparams: {},\nhttpHeaders: {},\nqueryParams: {}", url, params, httpHeaders, queryParams);
LOG.debug("Rest post:\nurl: {},\nhttpHeaders: {},\nqueryParams: {}", url, params, httpHeaders, queryParams);
return getResponse(restTemplate.postForEntity(url, httpEntity, String.class));
} catch (HttpClientErrorException e) {
if (e.getRawStatusCode() == HttpStatus.BAD_REQUEST.value()) {
@ -230,7 +230,7 @@ public class RestTemplateUtil {
LOG.debug(">>>> 请求结果状态: {}, ", responseEntity.getStatusCodeValue());
String response = responseEntity.getBody();
if (HttpStatus.OK.value() == responseEntity.getStatusCodeValue()) {
LOG.debug(">>>> 返回结果: {}", response);
LOG.debug(response);
if (response == null) {
return new JSONObject().toJSONString();
}

View File

@ -1,7 +1,6 @@
package com.cm.common.advice;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.enums.ErrorResultCodeEnum;
import com.cm.common.exception.*;
import com.cm.common.exception.base.SystemException;
@ -11,7 +10,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@ -77,7 +75,7 @@ public class ResponseAdvice {
result.setDetail(e.getMessage());
}
String contentType = request.getContentType();
if (contentType != null && contentType.contains(MediaType.APPLICATION_JSON_VALUE)) {
if (contentType != null && (contentType.contains(MediaType.APPLICATION_JSON_VALUE) || contentType.contains(MediaType.APPLICATION_FORM_URLENCODED_VALUE))) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
response.setStatus(HttpStatus.BAD_REQUEST.value());
response.getWriter().write(JSON.toJSONString(result));

View File

@ -0,0 +1,43 @@
package com.cm.common.base;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.pojo.dtos.env.EnvDTO;
import com.cm.common.pojo.vos.env.EnvListVO;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.service.IEnvService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "环境变量")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/env")
public class EnvController extends AbstractController {
@Autowired
private IEnvService envService;
@ApiOperation(value = "更新", notes = "更新")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update")
@CheckRequestBodyAnnotation
public SuccessResult update(@RequestBody EnvListVO envListVO) {
envService.update(envListVO);
return new SuccessResult();
}
@ApiOperation(value = "获取配置", notes = "获取配置接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
public List<EnvDTO> list() {
return envService.list();
}
}

View File

@ -0,0 +1,21 @@
package com.cm.common.base;
import com.cm.common.constants.ISystemConstant;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "环境变量")
@RestController
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/env")
public class EnvRouteController {
@GetMapping("update")
public ModelAndView update() {
ModelAndView modelAndView = new ModelAndView("env/update");
return modelAndView;
}
}

View File

@ -0,0 +1,57 @@
package com.cm.common.dao;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.pojo.dtos.env.EnvDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface IEnvDao {
/**
* 新增
*
* @param params
* @throws SaveException
*/
void save(Map<String, Object> params) throws SaveException;
/**
* 修改
*
* @param params
* @throws UpdateException
*/
void update(Map<String, Object> params) throws UpdateException;
/**
* 删除
*
* @throws RemoveException
*/
void delete() throws RemoveException;
/**
* 列表
*
* @return
* @throws SearchException
*/
List<EnvDTO> list() throws SearchException;
/**
* 详情
*
* @param envKey
* @return
* @throws SearchException
*/
EnvDTO get(String envKey) throws SearchException;
}

View File

@ -0,0 +1,78 @@
package com.cm.common.manager;
import com.cm.common.dao.IEnvDao;
import com.cm.common.pojo.Env;
import com.cm.common.pojo.dtos.env.EnvDTO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class EnvManager {
private static final Logger LOG = LoggerFactory.getLogger(EnvManager.class);
private static EnvManager envManager = EnvManagerBuilder.envManager;
private static Pattern ENV_VARIABLE = Pattern.compile("%[a-zA-Z\\d\\_\\-]+%");
private IEnvDao envDao;
private Env env = new Env();
private EnvManager() {}
public static EnvManager getInstance() {
return envManager;
}
/**
* 刷新环境变量
*/
public void refreshEnv() {
env.clear();
List<EnvDTO> envDTOS = envDao.list();
envDTOS.forEach(envDTO -> {
env.put(envDTO.getEnvKey(), envDTO.getEnvValue());
});
}
/**
* 获得环境变量
*
* @return
*/
public Env getEnv() {
return env;
}
public boolean isKeyExist(String key) {
return env.containsKey(key);
}
public String getValue(String key) {
String value = env.get(key);
value = value == null ? "" : value;
// 替换变量
Matcher matcher = ENV_VARIABLE.matcher(value);
while (matcher.find()) {
String variable = matcher.group();
String variableValue = env.get(variable.substring(1, variable.length() - 1));
if (StringUtils.isBlank(variableValue)) {
continue;
}
value = value.replaceFirst(variable, variableValue);
}
return value;
}
public void setEnvDao(IEnvDao envDao) {
this.envDao = envDao;
}
private static class EnvManagerBuilder {
public static final EnvManager envManager = new EnvManager();
}
}

View File

@ -0,0 +1,76 @@
package com.cm.common.pojo;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class Env implements Map<String, String> {
Map<String, String> envMap = new ConcurrentHashMap<>();
@Override
public int size() {
return envMap.size();
}
@Override
public boolean isEmpty() {
return envMap.isEmpty();
}
@Override
public boolean containsKey(Object key) {
return envMap.containsKey(key);
}
@Override
public boolean containsValue(Object value) {
return envMap.containsValue(value);
}
@Override
public String get(Object key) {
return envMap.get(key);
}
@Override
public String put(String key, String value) {
return envMap.put(key, value);
}
@Override
public String remove(Object key) {
return envMap.remove(key);
}
@Override
public void putAll(Map<? extends String, ? extends String> m) {
envMap.putAll(m);
}
@Override
public void clear() {
envMap.clear();
}
@Override
public Set<String> keySet() {
return envMap.keySet();
}
@Override
public Collection<String> values() {
return envMap.values();
}
@Override
public Set<Entry<String, String>> entrySet() {
return envMap.entrySet();
}
@Override
public String toString() {
return envMap.toString();
}
}

View File

@ -18,17 +18,10 @@ public class RoleBO implements Serializable {
private String roleName;
private String roleSummary;
private String roleDataAuthority;
private List<RoleMenuBO> apiSaveMenu = new ArrayList<>();
private List<RoleMenuBO> apiDeleteMenu = new ArrayList<>();
private List<RoleMenuBO> apiUpdateMenu = new ArrayList<>();
private List<RoleMenuBO> apiQueryMenu = new ArrayList<>();
private List<RoleMenuBO> resourceSaveMenu = new ArrayList<>();
private List<RoleMenuBO> resourceDeleteMenu = new ArrayList<>();
private List<RoleMenuBO> resourceUpdateMenu = new ArrayList<>();
private List<RoleMenuBO> resourceQueryMenu = new ArrayList<>();
private List<RoleMenuBO> routeSaveMenu = new ArrayList<>();
private List<RoleMenuBO> routeUpdateMenu = new ArrayList<>();
private List<RoleMenuBO> routeQueryMenu = new ArrayList<>();
private List<RoleMenuBO> saveMenu = new ArrayList<>();
private List<RoleMenuBO> deleteMenu = new ArrayList<>();
private List<RoleMenuBO> updateMenu = new ArrayList<>();
private List<RoleMenuBO> queryMenu = new ArrayList<>();
private List<PermissionBO> permissionInsert = new ArrayList<>();
private List<PermissionBO> permissionDelete = new ArrayList<>();
private List<PermissionBO> permissionUpdate = new ArrayList<>();
@ -66,92 +59,36 @@ public class RoleBO implements Serializable {
this.roleDataAuthority = roleDataAuthority;
}
public List<RoleMenuBO> getApiSaveMenu() {
return apiSaveMenu;
public List<RoleMenuBO> getSaveMenu() {
return saveMenu == null ? new ArrayList() : saveMenu;
}
public void setApiSaveMenu(List<RoleMenuBO> apiSaveMenu) {
this.apiSaveMenu = apiSaveMenu;
public void setSaveMenu(List<RoleMenuBO> saveMenu) {
this.saveMenu = saveMenu;
}
public List<RoleMenuBO> getApiDeleteMenu() {
return apiDeleteMenu;
public List<RoleMenuBO> getDeleteMenu() {
return deleteMenu == null ? new ArrayList() : deleteMenu;
}
public void setApiDeleteMenu(List<RoleMenuBO> apiDeleteMenu) {
this.apiDeleteMenu = apiDeleteMenu;
public void setDeleteMenu(List<RoleMenuBO> deleteMenu) {
this.deleteMenu = deleteMenu;
}
public List<RoleMenuBO> getApiUpdateMenu() {
return apiUpdateMenu;
public List<RoleMenuBO> getUpdateMenu() {
return updateMenu == null ? new ArrayList() : updateMenu;
}
public void setApiUpdateMenu(List<RoleMenuBO> apiUpdateMenu) {
this.apiUpdateMenu = apiUpdateMenu;
public void setUpdateMenu(List<RoleMenuBO> updateMenu) {
this.updateMenu = updateMenu;
}
public List<RoleMenuBO> getApiQueryMenu() {
return apiQueryMenu;
public List<RoleMenuBO> getQueryMenu() {
return queryMenu == null ? new ArrayList() : queryMenu;
}
public void setApiQueryMenu(List<RoleMenuBO> apiQueryMenu) {
this.apiQueryMenu = apiQueryMenu;
}
public List<RoleMenuBO> getResourceSaveMenu() {
return resourceSaveMenu;
}
public void setResourceSaveMenu(List<RoleMenuBO> resourceSaveMenu) {
this.resourceSaveMenu = resourceSaveMenu;
}
public List<RoleMenuBO> getResourceDeleteMenu() {
return resourceDeleteMenu;
}
public void setResourceDeleteMenu(List<RoleMenuBO> resourceDeleteMenu) {
this.resourceDeleteMenu = resourceDeleteMenu;
}
public List<RoleMenuBO> getResourceUpdateMenu() {
return resourceUpdateMenu;
}
public void setResourceUpdateMenu(List<RoleMenuBO> resourceUpdateMenu) {
this.resourceUpdateMenu = resourceUpdateMenu;
}
public List<RoleMenuBO> getResourceQueryMenu() {
return resourceQueryMenu;
}
public void setResourceQueryMenu(List<RoleMenuBO> resourceQueryMenu) {
this.resourceQueryMenu = resourceQueryMenu;
}
public List<RoleMenuBO> getRouteSaveMenu() {
return routeSaveMenu;
}
public void setRouteSaveMenu(List<RoleMenuBO> routeSaveMenu) {
this.routeSaveMenu = routeSaveMenu;
}
public List<RoleMenuBO> getRouteUpdateMenu() {
return routeUpdateMenu;
}
public void setRouteUpdateMenu(List<RoleMenuBO> routeUpdateMenu) {
this.routeUpdateMenu = routeUpdateMenu;
}
public List<RoleMenuBO> getRouteQueryMenu() {
return routeQueryMenu;
}
public void setRouteQueryMenu(List<RoleMenuBO> routeQueryMenu) {
this.routeQueryMenu = routeQueryMenu;
public void setQueryMenu(List<RoleMenuBO> queryMenu) {
this.queryMenu = queryMenu;
}
public List<PermissionBO> getPermissionInsert() {
@ -189,36 +126,22 @@ public class RoleBO implements Serializable {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"roleId\":")
.append("\"").append(roleId).append("\"");
sb.append(",\"roleName\":")
.append("\"").append(roleName).append("\"");
sb.append(",\"roleSummary\":")
.append("\"").append(roleSummary).append("\"");
sb.append(",\"roleDataAuthority\":")
.append("\"").append(roleDataAuthority).append("\"");
sb.append(",\"apiSaveMenu\":")
.append(apiSaveMenu);
sb.append(",\"apiDeleteMenu\":")
.append(apiDeleteMenu);
sb.append(",\"apiUpdateMenu\":")
.append(apiUpdateMenu);
sb.append(",\"apiQueryMenu\":")
.append(apiQueryMenu);
sb.append(",\"resourceSaveMenu\":")
.append(resourceSaveMenu);
sb.append(",\"resourceDeleteMenu\":")
.append(resourceDeleteMenu);
sb.append(",\"resourceUpdateMenu\":")
.append(resourceUpdateMenu);
sb.append(",\"resourceQueryMenu\":")
.append(resourceQueryMenu);
sb.append(",\"routeSaveMenu\":")
.append(routeSaveMenu);
sb.append(",\"routeUpdateMenu\":")
.append(routeUpdateMenu);
sb.append(",\"routeQueryMenu\":")
.append(routeQueryMenu);
sb.append("\"roleId\":\"")
.append(roleId).append('\"');
sb.append(",\"roleName\":\"")
.append(roleName).append('\"');
sb.append(",\"roleSummary\":\"")
.append(roleSummary).append('\"');
sb.append(",\"roleDataAuthority\":\"")
.append(roleDataAuthority).append('\"');
sb.append(",\"saveMenu\":")
.append(saveMenu);
sb.append(",\"deleteMenu\":")
.append(deleteMenu);
sb.append(",\"updateMenu\":")
.append(updateMenu);
sb.append(",\"queryMenu\":")
.append(queryMenu);
sb.append(",\"permissionInsert\":")
.append(permissionInsert);
sb.append(",\"permissionDelete\":")

View File

@ -2,6 +2,7 @@ package com.cm.common.pojo.bos;
import org.springframework.security.core.GrantedAuthority;
import java.util.ArrayList;
import java.util.List;
/**
@ -17,17 +18,10 @@ public class RoleGrantedAuthority implements GrantedAuthority {
private String role;
private String roleId;
private String roleName;
private List<RoleMenuBO> apiSaveMenu;
private List<RoleMenuBO> apiDeleteMenu;
private List<RoleMenuBO> apiUpdateMenu;
private List<RoleMenuBO> apiQueryMenu;
private List<RoleMenuBO> resourceSaveMenu;
private List<RoleMenuBO> resourceDeleteMenu;
private List<RoleMenuBO> resourceUpdateMenu;
private List<RoleMenuBO> resourceQueryMenu;
private List<RoleMenuBO> routeSaveMenu;
private List<RoleMenuBO> routeUpdateMenu;
private List<RoleMenuBO> routeQueryMenu;
private List<RoleMenuBO> saveMenu;
private List<RoleMenuBO> deleteMenu;
private List<RoleMenuBO> updateMenu;
private List<RoleMenuBO> queryMenu;
private List<PermissionBO> permissionInsert;
private List<PermissionBO> permissionDelete;
private List<PermissionBO> permissionUpdate;
@ -41,17 +35,10 @@ public class RoleGrantedAuthority implements GrantedAuthority {
this.role = role;
this.roleId = roleBO.getRoleId();
this.roleName = roleBO.getRoleName();
this.apiSaveMenu = roleBO.getApiSaveMenu();
this.apiDeleteMenu = roleBO.getApiDeleteMenu();
this.apiUpdateMenu = roleBO.getApiUpdateMenu();
this.apiQueryMenu = roleBO.getApiQueryMenu();
this.resourceSaveMenu = roleBO.getResourceSaveMenu();
this.resourceDeleteMenu = roleBO.getResourceDeleteMenu();
this.resourceUpdateMenu = roleBO.getResourceUpdateMenu();
this.resourceQueryMenu = roleBO.getResourceQueryMenu();
this.routeSaveMenu = roleBO.getRouteSaveMenu();
this.routeUpdateMenu = roleBO.getRouteUpdateMenu();
this.routeQueryMenu = roleBO.getRouteQueryMenu();
this.saveMenu = roleBO.getSaveMenu();
this.deleteMenu = roleBO.getDeleteMenu();
this.updateMenu = roleBO.getUpdateMenu();
this.queryMenu = roleBO.getQueryMenu();
this.permissionInsert = roleBO.getPermissionInsert();
this.permissionDelete = roleBO.getPermissionDelete();
this.permissionUpdate = roleBO.getPermissionUpdate();
@ -93,92 +80,36 @@ public class RoleGrantedAuthority implements GrantedAuthority {
this.roleName = roleName;
}
public List<RoleMenuBO> getApiSaveMenu() {
return apiSaveMenu;
public List<RoleMenuBO> getSaveMenu() {
return saveMenu == null ? new ArrayList() : saveMenu;
}
public void setApiSaveMenu(List<RoleMenuBO> apiSaveMenu) {
this.apiSaveMenu = apiSaveMenu;
public void setSaveMenu(List<RoleMenuBO> saveMenu) {
this.saveMenu = saveMenu;
}
public List<RoleMenuBO> getApiDeleteMenu() {
return apiDeleteMenu;
public List<RoleMenuBO> getDeleteMenu() {
return deleteMenu == null ? new ArrayList() : deleteMenu;
}
public void setApiDeleteMenu(List<RoleMenuBO> apiDeleteMenu) {
this.apiDeleteMenu = apiDeleteMenu;
public void setDeleteMenu(List<RoleMenuBO> deleteMenu) {
this.deleteMenu = deleteMenu;
}
public List<RoleMenuBO> getApiUpdateMenu() {
return apiUpdateMenu;
public List<RoleMenuBO> getUpdateMenu() {
return updateMenu == null ? new ArrayList() : updateMenu;
}
public void setApiUpdateMenu(List<RoleMenuBO> apiUpdateMenu) {
this.apiUpdateMenu = apiUpdateMenu;
public void setUpdateMenu(List<RoleMenuBO> updateMenu) {
this.updateMenu = updateMenu;
}
public List<RoleMenuBO> getApiQueryMenu() {
return apiQueryMenu;
public List<RoleMenuBO> getQueryMenu() {
return queryMenu == null ? new ArrayList() : queryMenu;
}
public void setApiQueryMenu(List<RoleMenuBO> apiQueryMenu) {
this.apiQueryMenu = apiQueryMenu;
}
public List<RoleMenuBO> getResourceSaveMenu() {
return resourceSaveMenu;
}
public void setResourceSaveMenu(List<RoleMenuBO> resourceSaveMenu) {
this.resourceSaveMenu = resourceSaveMenu;
}
public List<RoleMenuBO> getResourceDeleteMenu() {
return resourceDeleteMenu;
}
public void setResourceDeleteMenu(List<RoleMenuBO> resourceDeleteMenu) {
this.resourceDeleteMenu = resourceDeleteMenu;
}
public List<RoleMenuBO> getResourceUpdateMenu() {
return resourceUpdateMenu;
}
public void setResourceUpdateMenu(List<RoleMenuBO> resourceUpdateMenu) {
this.resourceUpdateMenu = resourceUpdateMenu;
}
public List<RoleMenuBO> getResourceQueryMenu() {
return resourceQueryMenu;
}
public void setResourceQueryMenu(List<RoleMenuBO> resourceQueryMenu) {
this.resourceQueryMenu = resourceQueryMenu;
}
public List<RoleMenuBO> getRouteSaveMenu() {
return routeSaveMenu;
}
public void setRouteSaveMenu(List<RoleMenuBO> routeSaveMenu) {
this.routeSaveMenu = routeSaveMenu;
}
public List<RoleMenuBO> getRouteUpdateMenu() {
return routeUpdateMenu;
}
public void setRouteUpdateMenu(List<RoleMenuBO> routeUpdateMenu) {
this.routeUpdateMenu = routeUpdateMenu;
}
public List<RoleMenuBO> getRouteQueryMenu() {
return routeQueryMenu;
}
public void setRouteQueryMenu(List<RoleMenuBO> routeQueryMenu) {
this.routeQueryMenu = routeQueryMenu;
public void setQueryMenu(List<RoleMenuBO> queryMenu) {
this.queryMenu = queryMenu;
}
public List<PermissionBO> getPermissionInsert() {
@ -216,34 +147,20 @@ public class RoleGrantedAuthority implements GrantedAuthority {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"role\":")
.append("\"").append(role).append("\"");
sb.append(",\"roleId\":")
.append("\"").append(roleId).append("\"");
sb.append(",\"roleName\":")
.append("\"").append(roleName).append("\"");
sb.append(",\"apiSaveMenu\":")
.append(apiSaveMenu);
sb.append(",\"apiDeleteMenu\":")
.append(apiDeleteMenu);
sb.append(",\"apiUpdateMenu\":")
.append(apiUpdateMenu);
sb.append(",\"apiQueryMenu\":")
.append(apiQueryMenu);
sb.append(",\"resourceSaveMenu\":")
.append(resourceSaveMenu);
sb.append(",\"resourceDeleteMenu\":")
.append(resourceDeleteMenu);
sb.append(",\"resourceUpdateMenu\":")
.append(resourceUpdateMenu);
sb.append(",\"resourceQueryMenu\":")
.append(resourceQueryMenu);
sb.append(",\"routeSaveMenu\":")
.append(routeSaveMenu);
sb.append(",\"routeUpdateMenu\":")
.append(routeUpdateMenu);
sb.append(",\"routeQueryMenu\":")
.append(routeQueryMenu);
sb.append("\"role\":\"")
.append(role).append('\"');
sb.append(",\"roleId\":\"")
.append(roleId).append('\"');
sb.append(",\"roleName\":\"")
.append(roleName).append('\"');
sb.append(",\"saveMenu\":")
.append(saveMenu);
sb.append(",\"deleteMenu\":")
.append(deleteMenu);
sb.append(",\"updateMenu\":")
.append(updateMenu);
sb.append(",\"queryMenu\":")
.append(queryMenu);
sb.append(",\"permissionInsert\":")
.append(permissionInsert);
sb.append(",\"permissionDelete\":")

View File

@ -18,6 +18,7 @@ public class RoleMenuBO implements Serializable {
private String apiPrefix;
private String resourcePrefix;
private String routePrefix;
private String menuUrl;
public String getRoleId() {
return roleId == null ? "" : roleId.trim();
@ -67,21 +68,31 @@ public class RoleMenuBO implements Serializable {
this.routePrefix = routePrefix;
}
public String getMenuUrl() {
return menuUrl == null ? "" : menuUrl;
}
public void setMenuUrl(String menuUrl) {
this.menuUrl = menuUrl;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"roleId\":")
.append("\"").append(roleId).append("\"");
sb.append(",\"roleType\":")
.append("\"").append(roleType).append("\"");
sb.append(",\"menuId\":")
.append("\"").append(menuId).append("\"");
sb.append(",\"apiPrefix\":")
.append("\"").append(apiPrefix).append("\"");
sb.append(",\"resourcePrefix\":")
.append("\"").append(resourcePrefix).append("\"");
sb.append(",\"routePrefix\":")
.append("\"").append(routePrefix).append("\"");
sb.append("\"roleId\":\"")
.append(roleId).append('\"');
sb.append(",\"roleType\":\"")
.append(roleType).append('\"');
sb.append(",\"menuId\":\"")
.append(menuId).append('\"');
sb.append(",\"apiPrefix\":\"")
.append(apiPrefix).append('\"');
sb.append(",\"resourcePrefix\":\"")
.append(resourcePrefix).append('\"');
sb.append(",\"routePrefix\":\"")
.append(routePrefix).append('\"');
sb.append(",\"menuUrl\":\"")
.append(menuUrl).append('\"');
sb.append('}');
return sb.toString();
}

View File

@ -0,0 +1,78 @@
package com.cm.common.pojo.dtos.department;
import java.io.Serializable;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: DepartmentSortDTO
* @Description: 部门
* @Author: WangGeng
* @Date: 2021/6/24 21:21
* @Version: 1.0
**/
public class DepartmentSortDTO implements Serializable {
private static final long serialVersionUID = -5063411302090290214L;
private String departmentId;
private String departmentParentId;
private String departmentName;
private String departmentCode;
private String departmentType;
public String getDepartmentId() {
return departmentId == null ? "" : departmentId.trim();
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentParentId() {
return departmentParentId == null ? "" : departmentParentId.trim();
}
public void setDepartmentParentId(String departmentParentId) {
this.departmentParentId = departmentParentId;
}
public String getDepartmentName() {
return departmentName == null ? "" : departmentName.trim();
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getDepartmentCode() {
return departmentCode == null ? "" : departmentCode.trim();
}
public void setDepartmentCode(String departmentCode) {
this.departmentCode = departmentCode;
}
public String getDepartmentType() {
return departmentType == null ? "" : departmentType.trim();
}
public void setDepartmentType(String departmentType) {
this.departmentType = departmentType;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"departmentId\":\"")
.append(departmentId).append('\"');
sb.append(",\"departmentName\":\"")
.append(departmentName).append('\"');
sb.append(",\"departmentCode\":\"")
.append(departmentCode).append('\"');
sb.append(",\"departmentType\":\"")
.append(departmentType).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -0,0 +1,39 @@
package com.cm.common.pojo.dtos.env;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
public class EnvDTO implements Serializable {
@ApiModelProperty(name = "envKey", value = "环境变量")
private String envKey;
@ApiModelProperty(name = "envExplain", value = "环境变量说明")
private String envExplain;
@ApiModelProperty(name = "envValue", value = "环境变量值")
private String envValue;
public String getEnvKey() {
return envKey == null ? "" : envKey.trim();
}
public void setEnvKey(String envKey) {
this.envKey = envKey;
}
public String getEnvExplain() {
return envExplain == null ? "" : envExplain.trim();
}
public void setEnvExplain(String envExplain) {
this.envExplain = envExplain;
}
public String getEnvValue() {
return envValue == null ? "" : envValue.trim();
}
public void setEnvValue(String envValue) {
this.envValue = envValue;
}
}

View File

@ -0,0 +1,31 @@
package com.cm.common.pojo.vos.env;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
@ApiModel
public class EnvListVO {
@ApiModelProperty(name = "envs", value = "环境变量列表")
private List<EnvVO> envs;
public List<EnvVO> getEnvs() {
return envs == null ? new ArrayList() : envs;
}
public void setEnvs(List<EnvVO> envs) {
this.envs = envs;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"envs\":")
.append(envs);
sb.append('}');
return sb.toString();
}
}

View File

@ -0,0 +1,52 @@
package com.cm.common.pojo.vos.env;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel
public class EnvVO {
@ApiModelProperty(name = "envKey", value = "环境变量")
private String envKey;
@ApiModelProperty(name = "envExplain", value = "环境变量说明")
private String envExplain;
@ApiModelProperty(name = "envValue", value = "环境变量值")
private String envValue;
public String getEnvKey() {
return envKey == null ? "" : envKey.trim();
}
public void setEnvKey(String envKey) {
this.envKey = envKey;
}
public String getEnvExplain() {
return envExplain == null ? "" : envExplain.trim();
}
public void setEnvExplain(String envExplain) {
this.envExplain = envExplain;
}
public String getEnvValue() {
return envValue == null ? "" : envValue.trim();
}
public void setEnvValue(String envValue) {
this.envValue = envValue;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"envKey\":\"")
.append(envKey).append('\"');
sb.append(",\"envExplain\":\"")
.append(envExplain).append('\"');
sb.append(",\"envValue\":\"")
.append(envValue).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -0,0 +1,24 @@
package com.cm.common.service;
import com.cm.common.pojo.dtos.env.EnvDTO;
import com.cm.common.pojo.vos.env.EnvListVO;
import java.util.List;
public interface IEnvService {
/**
* 更新
*
* @param envMap
*/
void update(EnvListVO envListVO);
/**
* 详情
*
* @return
*/
List<EnvDTO> list();
}

View File

@ -0,0 +1,45 @@
package com.cm.common.service.impl;
import com.cm.common.base.AbstractService;
import com.cm.common.dao.IEnvDao;
import com.cm.common.manager.EnvManager;
import com.cm.common.pojo.Env;
import com.cm.common.pojo.dtos.env.EnvDTO;
import com.cm.common.pojo.vos.env.EnvListVO;
import com.cm.common.pojo.vos.env.EnvVO;
import com.cm.common.service.IEnvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class EnvServiceImpl extends AbstractService implements IEnvService {
@Autowired
private IEnvDao envDao;
@Override
public void update(EnvListVO envListVO) {
// 清空
envDao.delete();
// 新增
Map<String, Object> params = getHashMap(5);
for (EnvVO envVO : envListVO.getEnvs()) {
params.put("envKey", envVO.getEnvKey());
params.put("envExplain", envVO.getEnvExplain());
params.put("envValue", envVO.getEnvValue());
envDao.save(params);
}
// 刷新缓存
EnvManager.getInstance().refreshEnv();
}
@Override
public List<EnvDTO> list() {
Env env = EnvManager.getInstance().getEnv();
System.out.println(env.toString());
return envDao.list();
}
}

View File

@ -66,17 +66,10 @@ public class RbacServiceImpl implements IRbacService {
RoleBO roleBO = new RoleBO();
roleBO.setRoleId(authorityObject.getString("roleId"));
roleBO.setRoleName(authorityObject.getString("roleName"));
roleBO.setApiSaveMenu(JSON.parseArray(authorityObject.getString("apiSaveMenu"), RoleMenuBO.class));
roleBO.setApiDeleteMenu(JSON.parseArray(authorityObject.getString("apiDeleteMenu"), RoleMenuBO.class));
roleBO.setApiUpdateMenu(JSON.parseArray(authorityObject.getString("apiSaveMenu"), RoleMenuBO.class));
roleBO.setApiQueryMenu(JSON.parseArray(authorityObject.getString("apiQueryMenu"), RoleMenuBO.class));
roleBO.setResourceSaveMenu(JSON.parseArray(authorityObject.getString("resourceSaveMenu"), RoleMenuBO.class));
roleBO.setResourceDeleteMenu(JSON.parseArray(authorityObject.getString("resourceDeleteMenu"), RoleMenuBO.class));
roleBO.setResourceUpdateMenu(JSON.parseArray(authorityObject.getString("resourceUpdateMenu"), RoleMenuBO.class));
roleBO.setResourceQueryMenu(JSON.parseArray(authorityObject.getString("resourceQueryMenu"), RoleMenuBO.class));
roleBO.setRouteSaveMenu(JSON.parseArray(authorityObject.getString("routeSaveMenu"), RoleMenuBO.class));
roleBO.setRouteUpdateMenu(JSON.parseArray(authorityObject.getString("routeUpdateMenu"), RoleMenuBO.class));
roleBO.setRouteQueryMenu(JSON.parseArray(authorityObject.getString("routeQueryMenu"), RoleMenuBO.class));
roleBO.setSaveMenu(JSON.parseArray(authorityObject.getString("saveMenu"), RoleMenuBO.class));
roleBO.setDeleteMenu(JSON.parseArray(authorityObject.getString("deleteMenu"), RoleMenuBO.class));
roleBO.setUpdateMenu(JSON.parseArray(authorityObject.getString("updateMenu"), RoleMenuBO.class));
roleBO.setQueryMenu(JSON.parseArray(authorityObject.getString("queryMenu"), RoleMenuBO.class));
roleGrantedAuthority = new RoleGrantedAuthority(authorityObject.getString("authority"), roleBO);
}
}
@ -151,24 +144,14 @@ public class RbacServiceImpl implements IRbacService {
private boolean hasSavePermission(String contextPath, String uri, RoleGrantedAuthority roleGrantedAuthority, AntPathMatcher antPathMatcher) {
List<String> savePaths = accessControl.getSavePaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiSaveMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getSaveMenu()) {
for (String savePath : savePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + savePath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceSaveMenu()) {
for (String savePath : savePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + savePath, uri)) {
return true;
}
}
}
// 匹配路由
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getRouteSaveMenu()) {
for (String savePath : savePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + savePath, uri)) {
return true;
}
@ -188,16 +171,11 @@ public class RbacServiceImpl implements IRbacService {
private boolean hasDeletePermission(String contextPath, String uri, RoleGrantedAuthority roleGrantedAuthority, AntPathMatcher antPathMatcher) {
List<String> deletePaths = accessControl.getDeletePaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiDeleteMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getDeleteMenu()) {
for (String deletePath : deletePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + deletePath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceDeleteMenu()) {
for (String deletePath : deletePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + deletePath, uri)) {
return true;
}
@ -217,24 +195,14 @@ public class RbacServiceImpl implements IRbacService {
private boolean hasUpdatePermission(String contextPath, String uri, RoleGrantedAuthority roleGrantedAuthority, AntPathMatcher antPathMatcher) {
List<String> updatePaths = accessControl.getUpdatePaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiUpdateMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getUpdateMenu()) {
for (String updatePath : updatePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getApiPrefix() + updatePath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceUpdateMenu()) {
for (String updatePath : updatePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + updatePath, uri)) {
return true;
}
}
}
// 匹配路由
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getRouteUpdateMenu()) {
for (String updatePath : updatePaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + updatePath, uri)) {
return true;
}
@ -254,25 +222,15 @@ public class RbacServiceImpl implements IRbacService {
private boolean hasQueryPermission(String contextPath, String uri, RoleGrantedAuthority roleGrantedAuthority, AntPathMatcher antPathMatcher) {
List<String> queryPaths = accessControl.getQueryPaths();
// 匹配接口
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getApiQueryMenu()) {
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getQueryMenu()) {
for (String queryPath : queryPaths) {
String queryAntPath = contextPath + roleMenuBO.getApiPrefix() + queryPath;
if (antPathMatcher.match(queryAntPath, uri)) {
return true;
}
}
}
// 匹配资源
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getResourceQueryMenu()) {
for (String queryPath : queryPaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getResourcePrefix() + queryPath, uri)) {
return true;
}
}
}
// 匹配路由
for (RoleMenuBO roleMenuBO : roleGrantedAuthority.getRouteQueryMenu()) {
for (String queryPath : queryPaths) {
if (antPathMatcher.match(contextPath + roleMenuBO.getRoutePrefix() + queryPath, uri)) {
return true;
}

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.common.dao.IEnvDao">
<resultMap id="envDTO" type="com.cm.common.pojo.dtos.env.EnvDTO">
<result column="env_key" property="envKey"/>
<result column="env_explain" property="envExplain"/>
<result column="env_value" property="envValue"/>
</resultMap>
<!-- 新增环境变量 -->
<insert id="save" parameterType="map">
INSERT INTO sys_env(
env_key,
env_explain,
env_value
) VALUES(
#{envKey},
#{envExplain},
#{envValue}
)
</insert>
<!-- 删除环境变量 -->
<delete id="delete" parameterType="map">
DELETE FROM sys_env
</delete>
<!-- 更新环境变量 -->
<update id="update" parameterType="map">
UPDATE
sys_env
SET
env_value = #{envValue},
env_explain = #{envExplain}
WHERE
env_key = #{envKey}
</update>
<!-- 环境变量列表 -->
<select id="list" resultMap="envDTO">
SELECT
env_key,
env_explain,
env_value
FROM
sys_env
</select>
<!-- 获取环境变量 -->
<select id="get" parameterType="String" resultMap="envDTO">
SELECT
env_key,
env_explain,
env_value
FROM
sys_env
WHERE
env_key = #{_parameter}
</select>
</mapper>

View File

@ -0,0 +1,252 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<form class="layui-form" lay-filter="dataForm">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a href="javascript:void(0);"><cite>环境变量(参数名唯一且只能是字母、数字、下划线与英文横线的组合。可以通过 %变量名% 的方式相互引用。)</cite></a>
</span>
<button id="envPlusBtn" type="button" class="layui-btn layui-btn-xs" style="float: right; margin-top: 12px;">
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</div>
<div id="cardBody" class="layui-card-body" style="padding: 15px; overflow: auto">
<div class="layui-form-item">
<table class="layui-table">
<colgroup>
<col width="250">
<col>
<col width="250">
<col width="60">
</colgroup>
<thead>
<tr>
<th>变量名</th>
<th>变量值</th>
<th>描述</th>
<th style="text-align: center;">操作</th>
</tr>
</thead>
<tbody id="envBody"></tbody>
</table>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交更新</button>
</div>
</div>
</div>
</form>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var $win = $(window);
var windowHeight = $(window).height();
$('#cardBody').css({
height: (windowHeight - 170) +'px'
})
var envs;
// 系统参数配置
function EnvsInit(idPrefix, classPrefix, envList) {
var envsArray = [];
var keyupSetTimeout;
function getTr(index, key, value, explain) {
return '<tr>' +
' <td>' +
' <input type="text" id="'+ idPrefix +'Key'+ index +'" placeholder="输入参数名" class="layui-input '+ classPrefix +'-key" value="'+ (key ? key : '') +'" data-index="'+ index +'">' +
' </td>' +
' <td>' +
' <input type="text" id="'+ idPrefix +'Value'+ index +'" placeholder="输入参数值" class="layui-input '+ classPrefix +'-value" value="'+ (value ? value : '') +'" data-index="'+ index +'">' +
' </td>' +
' <td>' +
' <input type="text" id="'+ idPrefix +'Explain'+ index +'" placeholder="输入描述" class="layui-input '+ classPrefix +'-explain" value="'+ (explain ? explain : '') +'" data-index="'+ index +'">' +
' </td>' +
' <td style="text-align: center;">' +
' <button type="button" class="layui-btn layui-btn-xs layui-btn-danger '+ classPrefix +'-remove-btn" data-index="'+ index +'">' +
' <i class="fa fa-times" aria-hidden="true"></i>' +
' </button>' +
' </td>' +
'</tr>';
}
function refreshTr() {
var trs = '';
for(var i = 0; i < envsArray.length; i++) {
var item = envsArray[i];
trs += getTr(i, item.envKey, item.envValue, item.envExplain);
}
$('#'+ idPrefix +'Body').empty();
$('#'+ idPrefix +'Body').append(trs);
}
function isKeyExist(index, key) {
if(!key) {
return false;
}
for(var i = 0, item; item = envsArray[i++];) {
if(key == item.envKey && index != (i - 1)) {
return true;
}
}
return false;
}
function isKeyEffective(key) {
if((/^[a-zA-Z0-9\_\-]+$/g.test(key))) {
return true;
}
return false;
}
$(document).on('keyup', '.'+ classPrefix +'-key', function() {
var self = this;
var index = this.dataset.index;
this.value = this.value.replace(/\s/g, '');
var value = this.value;
if(keyupSetTimeout) {
clearTimeout(keyupSetTimeout);
}
keyupSetTimeout = setTimeout(function() {
if(!isKeyEffective(value)) {
top.dialog.msg('参数名只能是字母、数字、下划线与英文横线组合');
self.focus();
self.value = '';
return;
}
if(isKeyExist(index, value)) {
top.dialog.msg('参数名重复');
self.focus();
self.value = '';
return;
} else {
envsArray[index].envKey = value;
}
}, 500);
});
$(document).on('keyup', '.'+ classPrefix +'-value', function() {
var index = this.dataset.index;
this.value = this.value.replace(/\s/g, '');
envsArray[index].envValue = this.value;
});
$(document).on('keyup', '.'+ classPrefix +'-explain', function() {
var index = this.dataset.index;
this.value = this.value.replace(/\s/g, '');
envsArray[index].envExplain = this.value;
});
$(document).on('click', '#'+ idPrefix +'PlusBtn', function() {
envsArray.push({
envKey: '',
envValue: '',
envExplain: '',
});
refreshTr();
})
$(document).on('click', '.'+ classPrefix +'-remove-btn', function() {
var index = this.dataset.index;
envsArray.splice(index, 1);
refreshTr();
})
this.init = function() {
if(!envList) {
return;
}
for(var i = 0, item; item = envList[i++];) {
envsArray.push({
envKey: item.envKey,
envValue: item.envValue,
envExplain: item.envExplain
})
}
refreshTr();
}
this.listEnvs = function() {
return envsArray;
}
};
// 初始化
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/env/list', []), {}, null, function(code, data) {
envs = new EnvsInit('env', 'env', data);
envs.init();
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/env/update', []), {
envs: envs.listEnvs()
}, null, function(code, data) {
var layerIndex = top.dialog.msg('更新成功', {
time: 0,
btn: [top.dataMessage.button.yes],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
form.verify({
positiveNumber: function(value, item) {
if(value < 0) {
return '必须是正数';
}
}
});
});
</script>
</body>
</html>

View File

@ -27,5 +27,4 @@ public class SmsTask {
VerificationCodeManager.getInstance().clearExpireTimeCode();
}
}

View File

@ -43,7 +43,8 @@ public class LicenseTest {
// 包头体育局00-16-3E-00-F3-CE
// 包头安监局业务服务器00-50-56-93-66-AC
// 西藏日喀则08-94-EF-6B-5A-44
String license = License.getLicense("2020-08-25", "10000", "84-65-69-5C-23-AA", "_System_License_");
// 集宁环保FA-26-00-03-D3-C4
String license = License.getLicense("2021-05-06", "10000", "FA-26-00-03-D3-C4", "_System_License_");
System.out.println(license);
}