| | |
| | | "The scale must be a positive integer or zero");
|
| | | }
|
| | | BigDecimal b = new BigDecimal(Double.toString(v));
|
| | | BigDecimal one = new BigDecimal("1");
|
| | | return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
|
| | | return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
|
| | | * |
| | | * @param str 要截取的字符串
|
| | | * @param open 起始字符串
|
| | | * @param close 结束字符串
|
| | | * @return 截取结果
|
| | | */
|
| | | public static String substringBetweenLast(final String str, final String open, final String close)
|
| | | {
|
| | | if (isEmpty(str) || isEmpty(open) || isEmpty(close))
|
| | | {
|
| | | return NULLSTR;
|
| | | }
|
| | | final int start = str.indexOf(open);
|
| | | if (start != INDEX_NOT_FOUND)
|
| | | {
|
| | | final int end = str.lastIndexOf(close);
|
| | | if (end != INDEX_NOT_FOUND)
|
| | | {
|
| | | return str.substring(start + open.length(), end);
|
| | | }
|
| | | }
|
| | | return NULLSTR;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 判断是否为空,并且不是空白字符
|
| | | *
|
| | | * @param str 要判断的value
|
| | |
| | | */
|
| | | public static List<Object[]> getMethodParams(String invokeTarget)
|
| | | {
|
| | | String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")");
|
| | | String methodStr = StringUtils.substringBetweenLast(invokeTarget, "(", ")");
|
| | | if (StringUtils.isEmpty(methodStr))
|
| | | {
|
| | | return null;
|
| | |
| | | */
|
| | | public String encodingFilename(String filename)
|
| | | {
|
| | | filename = UUID.randomUUID() + "_" + filename + ".xlsx";
|
| | | return filename;
|
| | | return UUID.randomUUID() + "_" + filename + ".xlsx";
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * 处理请求前执行
|
| | | */
|
| | | @Before(value = "@annotation(controllerLog)")
|
| | | public void boBefore(JoinPoint joinPoint, Log controllerLog)
|
| | | public void doBefore(JoinPoint joinPoint, Log controllerLog)
|
| | | {
|
| | | TIME_THREADLOCAL.set(System.currentTimeMillis());
|
| | | }
|
| | |
| | | // 设置permissions属性,以便数据权限匹配权限
|
| | | for (SysRole role : roles)
|
| | | {
|
| | | if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL))
|
| | | if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && !role.isAdmin())
|
| | | {
|
| | | Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
| | | role.setPermissions(rolePerms);
|
| | |
| | |
|
| | | Map<String, Object> claims = new HashMap<>();
|
| | | claims.put(Constants.LOGIN_USER_KEY, token);
|
| | | claims.put(Constants.JWT_USERNAME, loginUser.getUsername());
|
| | | return createToken(claims);
|
| | | }
|
| | |
|
| | |
| | | * @param list 列表数据
|
| | | * @param total 总记录数
|
| | | */
|
| | | public TableDataInfo(List<?> list, int total)
|
| | | public TableDataInfo(List<?> list, long total)
|
| | | {
|
| | | this.rows = list;
|
| | | this.total = total;
|
| | |
| | | update sys_user
|
| | | <set>
|
| | | <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
| | | <if test="userName != null and userName != ''">user_name = #{userName},</if>
|
| | | <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
| | | <if test="email != null ">email = #{email},</if>
|
| | | <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|