💄 Updating the UI and style files. code api

This commit is contained in:
冷冷 committed 2018-11-20 22:53:01 +08:00
1 parent d0e02d299d
commit 74dfedc436
16 files changed
+79 -33

No files matched your search

@@ -17,7 +17,7 @@
package com.pig4cloud.pigx.auth.handler;
import com.pig4cloud.pigx.common.security.handler.AuthenticationFailureEvenHandler;
import com.pig4cloud.pigx.common.security.handler.AbstractAuthenticationFailureEvenHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public class PigxAuthenticationFailureEvenHandler extends AuthenticationFailureEvenHandler {
public class PigxAuthenticationFailureEvenHandler extends AbstractAuthenticationFailureEvenHandler {
/**
* 处理登录失败方法
@@ -17,7 +17,7 @@
package com.pig4cloud.pigx.auth.handler;
import com.pig4cloud.pigx.common.security.handler.AuthenticationSuccessEventHandler;
import com.pig4cloud.pigx.common.security.handler.AbstractAuthenticationSuccessEventHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public class PigxAuthenticationSuccessEventHandler extends AuthenticationSuccessEventHandler {
public class PigxAuthenticationSuccessEventHandler extends AbstractAuthenticationSuccessEventHandler {
/**
* 处理登录成功方法
@@ -40,11 +40,11 @@ import java.util.Map;
*/
@Slf4j
public class RedisAutoCacheManager extends RedisCacheManager {
private static final String SPLIT_FLAG = "#";
private static final int CACHE_LENGTH = 2;
public static final String SPLIT_FLAG = "#";
public RedisAutoCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration,
Map<String, RedisCacheConfiguration> initialCacheConfigurations, boolean allowInFlightCacheCreation) {
RedisAutoCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration,
Map<String, RedisCacheConfiguration> initialCacheConfigurations, boolean allowInFlightCacheCreation) {
super(cacheWriter, defaultCacheConfiguration, initialCacheConfigurations, allowInFlightCacheCreation);
}
@@ -54,7 +54,7 @@ public class RedisAutoCacheManager extends RedisCacheManager {
return super.createRedisCache(name, cacheConfig);
}
String[] cacheArray = name.split(SPLIT_FLAG);
if (cacheArray.length < 2) {
if (cacheArray.length < CACHE_LENGTH) {
return super.createRedisCache(name, cacheConfig);
}
String cacheName = cacheArray[0] + ":" + TenantUtils.getTenantId();
@@ -46,4 +46,8 @@ public class TenantUtils {
public static Integer getTenantId() {
return THREAD_LOCAL_TENANT.get();
}
public static void clear(){
THREAD_LOCAL_TENANT.remove();
}
}
@@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class PigxFeignTenantConfiguration {
@Bean
public RequestInterceptor PigxFeignTenantInterceptor() {
public RequestInterceptor pigxFeignTenantInterceptor() {
return new PigxFeignTenantInterceptor();
}
}
@@ -58,5 +58,6 @@ public class TenantIdTtlFilter extends GenericFilterBean {
}
filterChain.doFilter(request, response);
TenantUtils.clear();
}
}
@@ -27,7 +27,7 @@ import org.springframework.security.core.AuthenticationException;
* @date 2018/10/8
* 认证失败事件处理器
*/
public abstract class AuthenticationFailureEvenHandler implements ApplicationListener<AbstractAuthenticationFailureEvent> {
public abstract class AbstractAuthenticationFailureEvenHandler implements ApplicationListener<AbstractAuthenticationFailureEvent> {
/**
* Handle an application event.
@@ -26,7 +26,7 @@ import org.springframework.security.core.Authentication;
* @date 2018/10/8
* 认证成功事件处理器
*/
public abstract class AuthenticationSuccessEventHandler implements ApplicationListener<AuthenticationSuccessEvent> {
public abstract class AbstractAuthenticationSuccessEventHandler implements ApplicationListener<AuthenticationSuccessEvent> {
/**
* Handle an application event.
*
@@ -19,7 +19,6 @@
package com.pig4cloud.pigx.admin.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.pig4cloud.pigx.admin.api.dto.DeptTree;
import com.pig4cloud.pigx.admin.api.entity.SysDept;
import com.pig4cloud.pigx.admin.service.SysDeptService;
@@ -68,7 +67,17 @@ public class DeptController {
*/
@GetMapping(value = "/tree")
public R<List<DeptTree>> getTree() {
return new R<>(sysDeptService.selectListTree(new EntityWrapper<>()));
return new R<>(sysDeptService.selectTree());
}
/**
* 返回当前用户树形菜单集合
*
* @return 树形菜单
*/
@GetMapping(value = "/user-tree")
public R<List<DeptTree>> userTree() {
return new R<>(sysDeptService.selectUserTree());
}
/**
@@ -48,12 +48,13 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
/**
* 分页查询用户信息(含角色)
*
* @param query 查询条件
* @param query 分页条件
* @param username 用户名
* @param dataScope
* @param deptId 部门ID
* @param dataScope 数据权限
* @return list
*/
List selectUserVoPage(Query query, @Param("username") Object username, DataScope dataScope);
List selectUserVoPage(Query query, @Param("username") Object username, @Param("deptId") Object deptId, DataScope dataScope);
/**
* 通过ID查询用户信息
@@ -19,7 +19,6 @@
package com.pig4cloud.pigx.admin.service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.IService;
import com.pig4cloud.pigx.admin.api.dto.DeptTree;
import com.pig4cloud.pigx.admin.api.entity.SysDept;
@@ -39,10 +38,16 @@ public interface SysDeptService extends IService<SysDept> {
/**
* 查询部门树菜单
*
* @param sysDeptEntityWrapper
* @return 树
*/
List<DeptTree> selectListTree(EntityWrapper<SysDept> sysDeptEntityWrapper);
List<DeptTree> selectTree();
/**
* 查询用户部门树
*
* @return
*/
List<DeptTree> selectUserTree();
/**
* 添加信息部门
@@ -67,4 +72,5 @@ public interface SysDeptService extends IService<SysDept> {
* @return 成功、失败
*/
Boolean updateDeptById(SysDept sysDept);
}
@@ -21,6 +21,7 @@ package com.pig4cloud.pigx.admin.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.pig4cloud.pigx.admin.api.dto.DeptTree;
import com.pig4cloud.pigx.admin.api.entity.SysDept;
@@ -29,6 +30,7 @@ import com.pig4cloud.pigx.admin.api.vo.TreeUtil;
import com.pig4cloud.pigx.admin.mapper.SysDeptMapper;
import com.pig4cloud.pigx.admin.service.SysDeptRelationService;
import com.pig4cloud.pigx.admin.service.SysDeptService;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -114,17 +116,36 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}
/**
* 查询部门树
* 查询全部部门树
*
* @param sysDeptEntityWrapper
* @return 树
*/
@Override
public List<DeptTree> selectListTree(EntityWrapper<SysDept> sysDeptEntityWrapper) {
sysDeptEntityWrapper.orderBy("sort", false);
return getDeptTree(this.selectList(sysDeptEntityWrapper));
public List<DeptTree> selectTree() {
Wrapper condition = new EntityWrapper<>();
condition.orderBy("sort", false);
return getDeptTree(this.selectList(condition));
}
/**
* 查询用户部门树
*
* @return
*/
@Override
public List<DeptTree> selectUserTree() {
Integer deptId = SecurityUtils.getUser().getDeptId();
SysDeptRelation condition = new SysDeptRelation();
condition.setAncestor(deptId);
List<Integer> descendantIdList = sysDeptRelationService
.selectList(new EntityWrapper<>(condition))
.stream().map(SysDeptRelation::getDescendant)
.collect(Collectors.toList());
List<SysDept> deptList = baseMapper.selectBatchIds(descendantIdList);
return getDeptTree(deptList);
}
/**
* 构建部门树
@@ -109,7 +109,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
dataScope.setIsOnly(true);
dataScope.setDeptIds(getChildDepts());
Object username = query.getCondition().get("username");
query.setRecords(baseMapper.selectUserVoPage(query, username, dataScope));
Object deptId = query.getCondition().get("deptId");
query.setRecords(baseMapper.selectUserVoPage(query, username, deptId, dataScope));
return query;
}
@@ -164,6 +164,9 @@
<if test="username != null and username != ''">
and `user`.username LIKE CONCAT('%',#{username},'%')
</if>
<if test="deptId != null and deptId != ''">
and `user`.dept_id = #{deptId}
</if>
ORDER BY `user`.create_time DESC
</select>
</mapper>
@@ -42,8 +42,8 @@ public interface EditorService {
* @param modelId
* @param name
* @param description
* @param json_xml
* @param svg_xml
* @param jsonXml
* @param svgXml
*/
void saveModel(String modelId, String name, String description, String json_xml, String svg_xml);
void saveModel(String modelId, String name, String description, String jsonXml, String svgXml);
}
@@ -134,7 +134,7 @@ public class CompensateServiceImpl implements CompensateService {
boolean autoExecuteRes;
try {
int executeCount = 0;
autoExecuteRes = executeCompensate_(json);
autoExecuteRes = executeCompensateMethod(json);
logger.info("Automatic Compensate Result->" + autoExecuteRes + ",json->" + json);
while (!autoExecuteRes) {
logger.info("Compensate Failure, Entering Compensate Queue->" + autoExecuteRes + ",json->" + json);
@@ -148,7 +148,7 @@ public class CompensateServiceImpl implements CompensateService {
} catch (InterruptedException e) {
e.printStackTrace();
}
autoExecuteRes = executeCompensate_(json);
autoExecuteRes = executeCompensateMethod(json);
}
//执行成功删除数据
@@ -316,7 +316,7 @@ public class CompensateServiceImpl implements CompensateService {
throw new ServiceException("no data existing");
}
boolean hasOk = executeCompensate_(json);
boolean hasOk = executeCompensateMethod(json);
if (hasOk) {
// 删除本地补偿数据
compensateDao.deleteCompensateByPath(path);
@@ -327,7 +327,7 @@ public class CompensateServiceImpl implements CompensateService {
}
private boolean executeCompensate_(String json) throws ServiceException {
private boolean executeCompensateMethod(String json) throws ServiceException {
JSONObject jsonObject = JSON.parseObject(json);
String model = jsonObject.getString("model");