Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -72,6 +72,24 @@ public class TableConfigController {
|
||||
return tableConfigService.deleteField(ids);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "字段排序上移")
|
||||
@PutMapping("field/upMove")
|
||||
public ResultVO upMove(Integer id) {
|
||||
return tableConfigService.upMove(id);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "字段排序上移")
|
||||
@PutMapping("field/downMove")
|
||||
public ResultVO downMove(Integer id) {
|
||||
return tableConfigService.downMove(id);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "字段排序")
|
||||
@PutMapping("field/sort")
|
||||
public ResultVO fieldSort(Integer tableId) {
|
||||
return tableConfigService.fieldSort(tableId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取下拉选项列表")
|
||||
@GetMapping("select")
|
||||
public ResultVO getSelectList(OsSysSelect osSysSelect) {
|
||||
|
||||
@@ -77,6 +77,8 @@ public class OsSysField implements Serializable {
|
||||
private Integer logic;
|
||||
private String fkKey;
|
||||
private String fkValue;
|
||||
private Integer width;
|
||||
private Integer orderId;
|
||||
|
||||
private List<OsSysSelect> selectList;
|
||||
}
|
||||
|
||||
@@ -33,4 +33,10 @@ public interface TableConfigService {
|
||||
ResultVO deleteSelectInfo(String ids);
|
||||
|
||||
ResultVO getTableSelect();
|
||||
|
||||
ResultVO fieldSort(Integer tableId);
|
||||
|
||||
ResultVO upMove(Integer id);
|
||||
|
||||
ResultVO downMove(Integer id);
|
||||
}
|
||||
|
||||
@@ -256,4 +256,54 @@ public class TableConfigServiceImpl implements TableConfigService {
|
||||
}
|
||||
return ResultVO.getSuccess(resultList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO fieldSort(Integer tableId) {
|
||||
List<OsSysField> list = osSysFieldDao.select(OsSysField.builder().tableId(tableId).build());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
OsSysField osSysField = list.get(i);
|
||||
osSysField.setOrderId(i);
|
||||
osSysFieldDao.updateByPrimaryKey(osSysField);
|
||||
}
|
||||
OsSysTable osSysTable = osSysTableMapper.selectByPrimaryKey(OsSysTable.builder().tableId(tableId).build());
|
||||
tableCache.delete(osSysTable.getTableAlias());
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO upMove(Integer id) {
|
||||
OsSysField osSysField = osSysFieldDao.selectOne(OsSysField.builder().fieldId(id).build());
|
||||
Integer orderId = osSysField.getOrderId();
|
||||
OsSysField field = osSysFieldDao.selectOne(OsSysField.builder().tableId(osSysField.getTableId()).orderId(orderId-1).build());
|
||||
if (field == null) {
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
osSysField.setOrderId(orderId - 1);
|
||||
osSysFieldDao.updateByPrimaryKey(osSysField);
|
||||
field.setOrderId(orderId);
|
||||
osSysFieldDao.updateByPrimaryKey(field);
|
||||
OsSysTable osSysTable = osSysTableMapper.selectByPrimaryKey(OsSysTable.builder().tableId(field.getTableId()).build());
|
||||
tableCache.delete(osSysTable.getTableAlias());
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO downMove(Integer id) {
|
||||
OsSysField osSysField = osSysFieldDao.selectOne(OsSysField.builder().fieldId(id).build());
|
||||
Integer orderId = osSysField.getOrderId();
|
||||
OsSysField field = osSysFieldDao.selectOne(OsSysField.builder().tableId(osSysField.getTableId()).orderId(orderId+1).build());
|
||||
if (field == null) {
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
osSysField.setOrderId(orderId + 1);
|
||||
osSysFieldDao.updateByPrimaryKey(osSysField);
|
||||
field.setOrderId(orderId);
|
||||
osSysFieldDao.updateByPrimaryKey(field);
|
||||
OsSysTable osSysTable = osSysTableMapper.selectByPrimaryKey(OsSysTable.builder().tableId(field.getTableId()).build());
|
||||
tableCache.delete(osSysTable.getTableAlias());
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
<result column="IS_SEARCH" jdbcType="VARCHAR" property="isSearch" />
|
||||
<result column="FK_KEY" jdbcType="VARCHAR" property="fkKey" />
|
||||
<result column="FK_VALUE" jdbcType="VARCHAR" property="fkValue" />
|
||||
<result column="WIDTH" jdbcType="INTEGER" property="width" />
|
||||
<result column="ORDER_ID" jdbcType="INTEGER" property="orderId" />
|
||||
<collection property="selectList" resultMap="com.hcframe.base.module.tableconfig.dao.OsSysSelectDao.OsSysSelectMap"/>
|
||||
</resultMap>
|
||||
<select id="getTableAlise" resultType="java.lang.String">
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
<collection property="fieldList" resultMap="com.hcframe.base.module.tableconfig.dao.OsSysFieldDao.BaseResultMap">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="getTableAllInfo" resultMap="BaseResultMap">
|
||||
select *
|
||||
from OS_SYS_TABLE
|
||||
left join OS_SYS_FIELD on OS_SYS_TABLE.TABLE_ID = OS_SYS_FIELD.TABLE_ID
|
||||
left join OS_SYS_SELECT on OS_SYS_FIELD.FIELD_ID = OS_SYS_SELECT.FIELD_ID
|
||||
where OS_SYS_TABLE.TABLE_ALIAS = #{typeName} order by OS_SYS_FIELD.FIELD_ID,OS_SYS_SELECT.SELECT_ID
|
||||
where OS_SYS_TABLE.TABLE_ALIAS = #{typeName} order by OS_SYS_FIELD.ORDER_ID,OS_SYS_SELECT.SELECT_ID
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,10 +2,6 @@ server:
|
||||
port: 8084
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.1.131:8848
|
||||
namespace: 2e9f0148-751e-4da2-83ec-cb00ffe0d83a
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
profiles:
|
||||
active: @profile.name@
|
||||
application:
|
||||
name: cloud-gateway1
|
||||
name: cloud-gateway
|
||||
# 若不使用redis需要注释掉此类信息
|
||||
redis:
|
||||
database: @redis.database@
|
||||
|
||||
@@ -16,10 +16,9 @@ import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.http.HttpCookie;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseCookie;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
@@ -96,7 +95,6 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
} else {
|
||||
String serviceUrl = Utils.encodingUrl(request, true, false);
|
||||
String urlToRedirectTo = Utils.makeRedirectUrl(casGatewayClientConfig.casServiceUrl + casGatewayClientConfig.casContextPath + casGatewayClientConfig.loginUrl, this.protocol.getServiceParameterName(), serviceUrl);
|
||||
response.setStatusCode(HttpStatus.UNAUTHORIZED);
|
||||
return Utils.redirect(exchange, urlToRedirectTo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ public class ShiroRealmConfig implements SystemRealm {
|
||||
// druid 资源路径
|
||||
map.put("/druid/**",ShiroType.ANON);
|
||||
map.put("/cas/valid",ShiroType.ANON);
|
||||
map.put("/cas/logout",ShiroType.ANON);
|
||||
// 其余路径均拦截
|
||||
map.put("/**", ShiroType.AUTH);
|
||||
return map;
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.hcframe.user.common.log;
|
||||
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.module.data.module.BaseMapper;
|
||||
import com.hcframe.base.module.data.module.BaseMapperImpl;
|
||||
import com.hcframe.base.module.data.service.TableService;
|
||||
import com.hcframe.base.module.log.annotation.LogAnno;
|
||||
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lhc
|
||||
* @date 2020.01.17
|
||||
*/
|
||||
@Order(3)
|
||||
@Aspect
|
||||
@Component
|
||||
public class OprateLog {
|
||||
|
||||
private static final String LOG_ID = "LOG_ID";
|
||||
private static final String OS_SYS_TITLE = "GB_LOGS";
|
||||
private static final OsSysTable TABLE_INFO = OsSysTable.builder().tableName(OS_SYS_TITLE).tablePk(LOG_ID).build();
|
||||
|
||||
final BaseMapper baseMapper;
|
||||
|
||||
final TableService tableService;
|
||||
public OprateLog(@Qualifier(BaseMapperImpl.BASE) BaseMapper baseMapper,
|
||||
TableService tableService) {
|
||||
this.baseMapper = baseMapper;
|
||||
this.tableService = tableService;
|
||||
}
|
||||
|
||||
@Around("@annotation(com.hcframe.base.module.log.annotation.LogAnno)")
|
||||
public Object aroundAdvice(ProceedingJoinPoint pjp) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
assert attributes != null;
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
// 1.方法执行前的处理,相当于前置通知
|
||||
// 获取方法签名
|
||||
MethodSignature methodSignature = (MethodSignature) pjp.getSignature();
|
||||
// 获取方法
|
||||
Method method = methodSignature.getMethod();
|
||||
// 获取方法上面的注解
|
||||
LogAnno logAnno = method.getAnnotation(LogAnno.class);
|
||||
ResultVO result = ResultVO.getSuccess();
|
||||
if (!logAnno.isBefore()) {
|
||||
result= (ResultVO) pjp.proceed();
|
||||
}
|
||||
|
||||
String operateType = logAnno.operateType();
|
||||
// 获取操作记录的日志表
|
||||
Map<String,Object> log=new HashMap<String,Object>();
|
||||
log.put("CREATE_TIME", new Date());
|
||||
log.put("IP", request.getRemoteAddr());
|
||||
log.put("CURL", request.getRequestURI());
|
||||
log.put("ACTTYPE", request.getMethod());
|
||||
log.put("CLOG", operateType + "参数:" + request.getQueryString());
|
||||
// log.put("USERID", value);
|
||||
log.put("STATUS", (byte) 1);
|
||||
|
||||
tableService.saveWithDate(TABLE_INFO, log);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,20 +57,26 @@ public class RoleGroupController {
|
||||
@PostMapping("bind")
|
||||
@ApiOperation(value = "绑定角色组")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleGroupId", value = "角色组ID",required = true),
|
||||
@ApiImplicitParam(name = "groupId", value = "角色组ID",required = true),
|
||||
@ApiImplicitParam(name = "roleIds", value = "角色ID数组",required = true)
|
||||
})
|
||||
public ResultVO<Object> bind(Integer roleGroupId, String roleIds) {
|
||||
return roleGroupServie.bind(roleGroupId, roleIds);
|
||||
public ResultVO<Object> bind(Integer groupId, String roleIds) {
|
||||
return roleGroupServie.bind(groupId, roleIds);
|
||||
}
|
||||
|
||||
@GetMapping("getRoles")
|
||||
@ApiOperation(value = "绑定角色组")
|
||||
@ApiOperation(value = "获取角色")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleGroupId", value = "角色组ID",required = true),
|
||||
@ApiImplicitParam(name = "groupId", value = "角色组ID",required = true),
|
||||
})
|
||||
public ResultVO<Object> getRoles(Integer roleGroupId) {
|
||||
return roleGroupServie.getRoles(roleGroupId);
|
||||
public ResultVO<Object> getRoles(Integer groupId) {
|
||||
return roleGroupServie.getRoles(groupId);
|
||||
}
|
||||
|
||||
@GetMapping("all")
|
||||
@ApiOperation(value = "获取全部角色组")
|
||||
public ResultVO<Object> getAll() {
|
||||
return roleGroupServie.getAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.hcframe.user.module.auth.controller;
|
||||
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.user.module.auth.service.RoleUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author lhc
|
||||
* @version 1.0
|
||||
* @className RoleUserController
|
||||
* @date 2021年04月15日 9:09 上午
|
||||
* @description 描述
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/roleUser")
|
||||
@Api(tags="用户授权")
|
||||
public class RoleUserController {
|
||||
|
||||
final RoleUserService roleUserService;
|
||||
|
||||
public RoleUserController(RoleUserService roleUserService) {
|
||||
this.roleUserService = roleUserService;
|
||||
}
|
||||
|
||||
@PostMapping("role")
|
||||
public ResultVO<Object> roleUserBind(String userId, String roleIds) {
|
||||
return roleUserService.roleUserBind(userId,roleIds);
|
||||
}
|
||||
|
||||
@GetMapping("role")
|
||||
public ResultVO<Object> getUserRole(String userId) {
|
||||
return roleUserService.getUserRole(userId);
|
||||
}
|
||||
|
||||
@PostMapping("roleGroup")
|
||||
public ResultVO<Object> roleGroupBind(String userId, String groupIds) {
|
||||
return roleUserService.roleGroupBind(userId,groupIds);
|
||||
}
|
||||
|
||||
@GetMapping("roleGroup")
|
||||
public ResultVO<Object> getUserGroup(String userId) {
|
||||
return roleUserService.getUserGroup(userId);
|
||||
}
|
||||
}
|
||||
@@ -26,5 +26,7 @@ public interface RoleGroupServie {
|
||||
|
||||
ResultVO<Object> bind(Integer roleGroupId, String roleIds);
|
||||
|
||||
ResultVO<Object> getRoles(Integer roleGroupId);
|
||||
ResultVO<Object> getRoles(Integer groupId);
|
||||
|
||||
ResultVO<Object> getAll();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.hcframe.user.module.auth.service;
|
||||
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
|
||||
/**
|
||||
* @author lhc
|
||||
* @version 1.0
|
||||
* @className RoleUserService
|
||||
* @date 2021年04月15日 9:09 上午
|
||||
* @description 描述
|
||||
*/
|
||||
public interface RoleUserService {
|
||||
ResultVO<Object> roleUserBind(String userId, String roleIds);
|
||||
|
||||
ResultVO<Object> roleGroupBind(String userId, String groupIds);
|
||||
|
||||
ResultVO<Object> getUserRole(String userId);
|
||||
|
||||
ResultVO<Object> getUserGroup(String userId);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.hcframe.user.module.auth.service.RoleGroupServie;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -81,6 +82,9 @@ public class RoleGroupServiceImpl implements RoleGroupServie {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Object> bind(Integer roleGroupId, String roleIds) {
|
||||
baseMapper.deleteByCondition(OS_REL_GROUP_ROLE, Condition.creatCriteria().andEqual(PK_ID,roleGroupId).build());
|
||||
if (StringUtils.isEmpty(roleIds)) {
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
for (String str : roleIds.split(COMMA)) {
|
||||
Integer roleId = Integer.parseInt(str);
|
||||
DataMap<Object> dataMap = DataMap
|
||||
@@ -96,11 +100,16 @@ public class RoleGroupServiceImpl implements RoleGroupServie {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> getRoles(Integer roleGroupId) {
|
||||
JudgeException.isNull(roleGroupId,"roleGroupId 不能为空!");
|
||||
public ResultVO<Object> getRoles(Integer groupId) {
|
||||
JudgeException.isNull(groupId,"roleGroupId 不能为空!");
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put(ROLE_GROUP_ID, roleGroupId);
|
||||
map.put(PK_ID, groupId);
|
||||
List<Map<String, Object>> list = baseMapper.selectByEqual(OS_REL_GROUP_ROLE,map);
|
||||
return ResultVO.getSuccess(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> getAll() {
|
||||
return ResultVO.getSuccess(baseMapper.selectAll(TABLE_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.hcframe.user.module.auth.service.impl;
|
||||
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.common.utils.JudgeException;
|
||||
import com.hcframe.base.module.data.module.BaseMapper;
|
||||
import com.hcframe.base.module.data.module.BaseMapperImpl;
|
||||
import com.hcframe.base.module.data.module.Condition;
|
||||
import com.hcframe.base.module.data.service.TableService;
|
||||
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
|
||||
import com.hcframe.user.module.auth.service.RoleUserService;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lhc
|
||||
* @version 1.0
|
||||
* @className RoleUserServiceImpl
|
||||
* @date 2021年04月15日 9:09 上午
|
||||
* @description 描述
|
||||
*/
|
||||
@Service
|
||||
public class RoleUserServiceImpl implements RoleUserService {
|
||||
|
||||
private static final String OS_REL_USER_ROLE = "OS_REL_USER_ROLE";
|
||||
private static final String USER_GROUP_ID = "USER_GROUP_ID";
|
||||
private static final String USER_ROLE_ID = "USER_ROLE_ID";
|
||||
private static final String OS_REL_USER_GROUP = "OS_REL_USER_GROUP";
|
||||
private static final String COMMA = ",";
|
||||
|
||||
final BaseMapper baseMapper;
|
||||
|
||||
final TableService tableService;
|
||||
|
||||
public RoleUserServiceImpl(@Qualifier(BaseMapperImpl.BASE) BaseMapper baseMapper,
|
||||
TableService tableService) {
|
||||
this.baseMapper = baseMapper;
|
||||
this.tableService = tableService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Object> roleUserBind(String userId, String roleIds) {
|
||||
JudgeException.isNull(userId,"userId 不能为空");
|
||||
JudgeException.isNull(roleIds,"roleIds 不能为空");
|
||||
OsSysTable osSysTable = OsSysTable.builder().tableName(OS_REL_USER_ROLE).tablePk(USER_ROLE_ID).build();
|
||||
Condition condition = Condition.creatCriteria().andEqual("USER_ID",userId).build();
|
||||
baseMapper.deleteByCondition(OS_REL_USER_ROLE, condition);
|
||||
for (String roleId : roleIds.split(COMMA)) {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("USER_ID", userId.replaceAll("\"",""));
|
||||
map.put("ROLE_ID", Integer.parseInt(roleId));
|
||||
tableService.save(osSysTable, map);
|
||||
}
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Object> roleGroupBind(String userId, String groupIds) {
|
||||
JudgeException.isNull(userId,"userId 不能为空");
|
||||
JudgeException.isNull(groupIds,"roleIds 不能为空");
|
||||
Condition condition = Condition.creatCriteria().andEqual("USER_ID",userId).build();
|
||||
baseMapper.deleteByCondition(OS_REL_USER_GROUP, condition);
|
||||
OsSysTable osSysTable = OsSysTable.builder().tableName(OS_REL_USER_GROUP).tablePk(USER_GROUP_ID).build();
|
||||
for (String groupId : groupIds.split(COMMA)) {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("USER_ID", userId.replaceAll("\"",""));
|
||||
map.put("GROUP_ID", groupId);
|
||||
tableService.save(osSysTable, map);
|
||||
}
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> getUserRole(String userId) {
|
||||
Condition condition = Condition.creatCriteria().andEqual("USER_ID",userId).build();
|
||||
List<Map<String,Object>> list = baseMapper.selectByCondition(OS_REL_USER_ROLE, condition);
|
||||
return ResultVO.getSuccess(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> getUserGroup(String userId) {
|
||||
Condition condition = Condition.creatCriteria().andEqual("USER_ID",userId).build();
|
||||
List<Map<String,Object>> list = baseMapper.selectByCondition(OS_REL_USER_GROUP, condition);
|
||||
return ResultVO.getSuccess(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,10 +6,7 @@ import net.unicon.cas.client.configuration.CasClientConfigurationProperties;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CookieValue;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -63,14 +60,14 @@ public class CasController {
|
||||
|
||||
@GetMapping("/logout")
|
||||
@ResponseBody
|
||||
public ResultVO<String> logout(HttpServletRequest request, @CookieValue("X-Access-Token") String token) {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
subject.logout();
|
||||
public ResultVO<String> logout(HttpServletRequest request, @RequestHeader("X-Access-Token") String token) {
|
||||
Cookie cookie = new Cookie("X-Access-Token", null);
|
||||
cookie.setMaxAge(0);
|
||||
String headerToken = request.getHeader("X-Access-Token");
|
||||
redisUtil.hdel("session", token);
|
||||
redisUtil.hdel("session", headerToken);
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
subject.logout();
|
||||
return ResultVO.getSuccess(casClientConfigurationProperties.getServerUrlPrefix()+"/logout");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.hcframe.user.module.userinfo.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.common.WebPageInfo;
|
||||
import com.hcframe.user.module.userinfo.service.OrgService;
|
||||
import com.hcframe.user.module.userinfo.service.OsService;
|
||||
import com.hcframe.user.module.userinfo.service.TitleService;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("os")
|
||||
@Api(tags = "应用系统管理")
|
||||
public class OsController {
|
||||
|
||||
final OsService osService;
|
||||
|
||||
public OsController(OsService osService) {
|
||||
this.osService = osService;
|
||||
}
|
||||
|
||||
@GetMapping("/{oscode}")
|
||||
@ApiOperation(value = "校验系统编码是否存在", notes = "将自动传承key-value对象模式即可")
|
||||
public ResultVO<Object> checkExistOs(@PathVariable String oscode) {
|
||||
return osService.checkExistOs(oscode);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@ApiOperation(value = "新增系统", notes = "将自动传承key-value对象模式即可")
|
||||
public ResultVO<Object> addOs(@RequestParam Map<String,Object> os) {
|
||||
return osService.addOs(os);
|
||||
}
|
||||
|
||||
@PutMapping("/{version}")
|
||||
@ApiOperation(value = "更新系统信息")
|
||||
public ResultVO<Integer> updateOs(@RequestParam Map<String,Object> os,@PathVariable Integer version) {
|
||||
return osService.updateOs(os,version);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除系统信息")
|
||||
public ResultVO<Object> deleteOs(@PathVariable String ids) {
|
||||
return osService.deleteOs(ids);
|
||||
}
|
||||
|
||||
@GetMapping()
|
||||
@ApiOperation(value = "获取系统信息列表")
|
||||
public ResultVO<PageInfo<Map<String,Object>>> getOsList(String data, WebPageInfo webPageInfo) {
|
||||
return osService.getOsList(data, webPageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.common.WebPageInfo;
|
||||
import com.hcframe.base.module.log.annotation.LogAnno;
|
||||
import com.hcframe.user.module.userinfo.service.OrgService;
|
||||
import com.hcframe.user.module.userinfo.service.TitleService;
|
||||
|
||||
@@ -30,6 +31,12 @@ public class TitleController {
|
||||
public TitleController(TitleService titleService) {
|
||||
this.titleService = titleService;
|
||||
}
|
||||
|
||||
@GetMapping("/{titlecode}")
|
||||
@ApiOperation(value = "校验职称编码是否存在", notes = "将自动传承key-value对象模式即可")
|
||||
public ResultVO<Object> checkExistTitle(@PathVariable String titlecode) {
|
||||
return titleService.checkExistTitle(titlecode);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@ApiOperation(value = "新增title", notes = "将自动传承key-value对象模式即可")
|
||||
@@ -50,6 +57,7 @@ public class TitleController {
|
||||
}
|
||||
|
||||
@GetMapping()
|
||||
@LogAnno(operateType="getTitleList",tableName="title")
|
||||
@ApiOperation(value = "获取职称列表")
|
||||
public ResultVO<PageInfo<Map<String,Object>>> getTitleList(String data, WebPageInfo webPageInfo) {
|
||||
return titleService.getTitleList(data, webPageInfo);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.hcframe.user.module.userinfo.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.common.WebPageInfo;
|
||||
|
||||
public interface OsService {
|
||||
|
||||
ResultVO<Object> checkExistOs(String oscode);
|
||||
|
||||
ResultVO<Object> addOs(Map<String, Object> os);
|
||||
|
||||
ResultVO<Integer> updateOs(Map<String, Object> os, Integer version);
|
||||
|
||||
ResultVO<Object> deleteOs(String ids);
|
||||
|
||||
ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo);
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.common.WebPageInfo;
|
||||
|
||||
public interface TitleService {
|
||||
|
||||
ResultVO<Object> checkExistTitle(String titlecode);
|
||||
|
||||
ResultVO<Object> addTitle(Map<String, Object> title);
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.hcframe.user.module.userinfo.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hcframe.base.common.ResultVO;
|
||||
import com.hcframe.base.common.WebPageInfo;
|
||||
import com.hcframe.base.module.data.module.BaseMapper;
|
||||
import com.hcframe.base.module.data.module.BaseMapperImpl;
|
||||
import com.hcframe.base.module.data.module.Condition;
|
||||
import com.hcframe.base.module.data.service.TableService;
|
||||
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
|
||||
import com.hcframe.user.module.userinfo.service.OsService;
|
||||
import com.hcframe.user.module.userinfo.service.TitleService;
|
||||
|
||||
@Service
|
||||
public class OsServiceImpl implements OsService{
|
||||
|
||||
private static final String OS_ID = "OS_ID";
|
||||
private static final String OS_SYS_OS = "OS_SYS_OS";
|
||||
private static final OsSysTable TABLE_INFO = OsSysTable.builder().tableName(OS_SYS_OS).tablePk(OS_ID).build();
|
||||
|
||||
final BaseMapper baseMapper;
|
||||
|
||||
final TableService tableService;
|
||||
|
||||
public OsServiceImpl(@Qualifier(BaseMapperImpl.BASE) BaseMapper baseMapper,
|
||||
TableService tableService) {
|
||||
this.baseMapper = baseMapper;
|
||||
this.tableService = tableService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> checkExistOs(String oscode){
|
||||
Condition condition = Condition.creatCriteria().andEqual("OS_CODE",oscode).andEqual("DELETED",1).build();
|
||||
Long i = baseMapper.count(OS_SYS_OS, condition);
|
||||
if (i > 0L) {
|
||||
return ResultVO.getFailed("系统编码不能重复");
|
||||
}
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> addOs(Map<String, Object> os) {
|
||||
return ResultVO.getSuccess(tableService.saveWithDate(TABLE_INFO, os));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Integer> updateOs(Map<String, Object> os, Integer version) {
|
||||
return tableService.updateWithDate(TABLE_INFO,os,version);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Object> deleteOs(String ids) {
|
||||
String[] idArr = ids.split(",");
|
||||
tableService.delete(TABLE_INFO, ids);
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo) {
|
||||
PageInfo<Map<String,Object>> pageInfo = tableService.searchSingleTables(data, TABLE_INFO, webPageInfo);
|
||||
return ResultVO.getSuccess(pageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.hcframe.user.module.userinfo.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -33,10 +35,21 @@ public class TitleServiceImpl implements TitleService{
|
||||
this.baseMapper = baseMapper;
|
||||
this.tableService = tableService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> checkExistTitle(String titlecode){
|
||||
Condition condition = Condition.creatCriteria().andEqual("TITLE_CODE",titlecode).andEqual("DELETED",1).build();
|
||||
Long i = baseMapper.count(OS_SYS_TITLE, condition);
|
||||
if (i > 0L) {
|
||||
return ResultVO.getFailed("职称编码不能重复");
|
||||
}
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> addTitle(Map<String, Object> title) {
|
||||
return ResultVO.getSuccess(tableService.saveWithDate(TABLE_INFO, title));
|
||||
|
||||
return ResultVO.getSuccess(tableService.saveWithDate(TABLE_INFO, title));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ spring:
|
||||
druid:
|
||||
# 配置sqlite文件路径,需要填写绝对路径,推荐将sqlite文件放入到服务器上,而非程序jar包或war包中
|
||||
driver-class-name: dm.jdbc.driver.DmDriver
|
||||
url: jdbc:dm://192.168.1.131:5236/GBCAS?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
|
||||
url: jdbc:dm://192.168.100.98:5236/GBCAS?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
|
||||
username: GBCAS
|
||||
password: 123456789
|
||||
#使用Druid数据源
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<cas.client-context-path>/user/cas/valid</cas.client-context-path>
|
||||
<cas.cas-service-url>http://192.168.100.98:8080</cas.cas-service-url>
|
||||
<cas.cas-context-path>/cas</cas.cas-context-path>
|
||||
<cas.white-url>^.*(/logout?)$</cas.white-url>
|
||||
<cas.white-url>^.*(/logout/?)$</cas.white-url>
|
||||
<cas.service-url>http://localhost:8084</cas.service-url>
|
||||
<cas.cookie-holder-pattern>com.hcframe.gateway.config.MyDataStorage</cas.cookie-holder-pattern>
|
||||
<cas.login-url>/login</cas.login-url>
|
||||
|
||||
Reference in New Issue
Block a user