作者 RuoYi

优化代码

@@ -37,7 +37,7 @@ public class TableDataInfo implements Serializable @@ -37,7 +37,7 @@ public class TableDataInfo implements Serializable
37 * @param list 列表数据 37 * @param list 列表数据
38 * @param total 总记录数 38 * @param total 总记录数
39 */ 39 */
40 - public TableDataInfo(List<?> list, int total) 40 + public TableDataInfo(List<?> list, long total)
41 { 41 {
42 this.rows = list; 42 this.rows = list;
43 this.total = total; 43 this.total = total;
@@ -108,7 +108,6 @@ public class Arith @@ -108,7 +108,6 @@ public class Arith
108 "The scale must be a positive integer or zero"); 108 "The scale must be a positive integer or zero");
109 } 109 }
110 BigDecimal b = new BigDecimal(Double.toString(v)); 110 BigDecimal b = new BigDecimal(Double.toString(v));
111 - BigDecimal one = BigDecimal.ONE;  
112 - return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); 111 + return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
113 } 112 }
114 } 113 }
@@ -287,6 +287,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils @@ -287,6 +287,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
287 } 287 }
288 288
289 /** 289 /**
  290 + * 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
  291 + *
  292 + * @param str 要截取的字符串
  293 + * @param open 起始字符串
  294 + * @param close 结束字符串
  295 + * @return 截取结果
  296 + */
  297 + public static String substringBetweenLast(final String str, final String open, final String close)
  298 + {
  299 + if (isEmpty(str) || isEmpty(open) || isEmpty(close))
  300 + {
  301 + return NULLSTR;
  302 + }
  303 + final int start = str.indexOf(open);
  304 + if (start != INDEX_NOT_FOUND)
  305 + {
  306 + final int end = str.lastIndexOf(close);
  307 + if (end != INDEX_NOT_FOUND)
  308 + {
  309 + return str.substring(start + open.length(), end);
  310 + }
  311 + }
  312 + return NULLSTR;
  313 + }
  314 +
  315 + /**
290 * 判断是否为空,并且不是空白字符 316 * 判断是否为空,并且不是空白字符
291 * 317 *
292 * @param str 要判断的value 318 * @param str 要判断的value
@@ -1448,8 +1448,7 @@ public class ExcelUtil<T> @@ -1448,8 +1448,7 @@ public class ExcelUtil<T>
1448 */ 1448 */
1449 public String encodingFilename(String filename) 1449 public String encodingFilename(String filename)
1450 { 1450 {
1451 - filename = UUID.randomUUID() + "_" + filename + ".xlsx";  
1452 - return filename; 1451 + return UUID.randomUUID() + "_" + filename + ".xlsx";
1453 } 1452 }
1454 1453
1455 /** 1454 /**
@@ -52,7 +52,7 @@ public class LogAspect @@ -52,7 +52,7 @@ public class LogAspect
52 * 处理请求前执行 52 * 处理请求前执行
53 */ 53 */
54 @Before(value = "@annotation(controllerLog)") 54 @Before(value = "@annotation(controllerLog)")
55 - public void boBefore(JoinPoint joinPoint, Log controllerLog) 55 + public void doBefore(JoinPoint joinPoint, Log controllerLog)
56 { 56 {
57 TIME_THREADLOCAL.set(System.currentTimeMillis()); 57 TIME_THREADLOCAL.set(System.currentTimeMillis());
58 } 58 }
@@ -70,7 +70,7 @@ public class SysPermissionService @@ -70,7 +70,7 @@ public class SysPermissionService
70 // 多角色设置permissions属性,以便数据权限匹配权限 70 // 多角色设置permissions属性,以便数据权限匹配权限
71 for (SysRole role : roles) 71 for (SysRole role : roles)
72 { 72 {
73 - if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL)) 73 + if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && !role.isAdmin())
74 { 74 {
75 Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId()); 75 Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
76 role.setPermissions(rolePerms); 76 role.setPermissions(rolePerms);
@@ -120,6 +120,7 @@ public class TokenService @@ -120,6 +120,7 @@ public class TokenService
120 120
121 Map<String, Object> claims = new HashMap<>(); 121 Map<String, Object> claims = new HashMap<>();
122 claims.put(Constants.LOGIN_USER_KEY, token); 122 claims.put(Constants.LOGIN_USER_KEY, token);
  123 + claims.put(Constants.JWT_USERNAME, loginUser.getUsername());
123 return createToken(claims); 124 return createToken(claims);
124 } 125 }
125 126
@@ -105,7 +105,7 @@ public class JobInvokeUtil @@ -105,7 +105,7 @@ public class JobInvokeUtil
105 */ 105 */
106 public static List<Object[]> getMethodParams(String invokeTarget) 106 public static List<Object[]> getMethodParams(String invokeTarget)
107 { 107 {
108 - String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); 108 + String methodStr = StringUtils.substringBetweenLast(invokeTarget, "(", ")");
109 if (StringUtils.isEmpty(methodStr)) 109 if (StringUtils.isEmpty(methodStr))
110 { 110 {
111 return null; 111 return null;
@@ -178,7 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -178,7 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
178 update sys_user 178 update sys_user
179 <set> 179 <set>
180 <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> 180 <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
181 - <if test="userName != null and userName != ''">user_name = #{userName},</if>  
182 <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if> 181 <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
183 <if test="email != null ">email = #{email},</if> 182 <if test="email != null ">email = #{email},</if>
184 <if test="phonenumber != null ">phonenumber = #{phonenumber},</if> 183 <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
1 <template> 1 <template>
2 <div class="app-container home"> 2 <div class="app-container home">
3 <el-row :gutter="20"> 3 <el-row :gutter="20">
4 - <el-col :sm="24" :lg="24">  
5 - <blockquote class="text-warning" style="font-size: 14px">  
6 - 阿里云服务器折扣区<el-link href="http://aly.ruoyi.vip" type="primary" target="_blank">☛☛点我进入☚☚</el-link> &nbsp;&nbsp;&nbsp; 腾讯云服务器秒杀区<el-link href="http://txy.ruoyi.vip" type="primary" target="_blank">☛☛点我进入☚☚</el-link>  
7 - </blockquote>  
8 - <hr />  
9 - </el-col>  
10 - </el-row>  
11 - <el-row :gutter="20">  
12 <el-col :sm="24" :lg="12" style="padding-left: 20px"> 4 <el-col :sm="24" :lg="12" style="padding-left: 20px">
13 <h2>若依后台管理框架</h2> 5 <h2>若依后台管理框架</h2>
14 <p> 6 <p>