增加金额格式化、异常抛出

This commit is contained in:
syruan 2026-01-13 09:53:30 +08:00
parent 415b3134a7
commit 4dca35da61
2 changed files with 11 additions and 7 deletions

View File

@ -39,12 +39,12 @@ public class HomeIndexServiceImpl implements HomeIndexService {
@Override @Override
public ServerResponse getDataPreviewData(BackParamsDto dto) { public ServerResponse getDataPreviewData(BackParamsDto dto) {
HomeDataPreviewVo vo = new HomeDataPreviewVo(); HomeDataPreviewVo vo = new HomeDataPreviewVo();
List<Integer> fList = new ArrayList<>(2); List<Integer> fList;
List<Integer> fList2 = new ArrayList<>(2); List<Integer> fList2;
List<Integer> fList3 = new ArrayList<>(2); List<Integer> fList3;
List<Integer> fList4 = new ArrayList<>(2); List<Integer> fList4;
List<Object> fList5 = new ArrayList<>(2); List<Object> fList5;
List<Object> fList6 = new ArrayList<>(2); List<Object> fList6;
try { try {
Future<List<Integer>> future = testTaskExecutor.submit(() -> { Future<List<Integer>> future = testTaskExecutor.submit(() -> {
log.info("数据概览-工程数量{}", Thread.currentThread().getName()); log.info("数据概览-工程数量{}", Thread.currentThread().getName());
@ -132,6 +132,9 @@ public class HomeIndexServiceImpl implements HomeIndexService {
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString(), e); log.error(e.toString(), e);
} }
BigDecimal bd = new BigDecimal(vo.getEstimateMoney());
bd = bd.setScale(2, RoundingMode.HALF_UP); // 四舍五入
vo.setEstimateMoney(bd.doubleValue());
return ServerResponse.createSuccess(vo); return ServerResponse.createSuccess(vo);
} }

View File

@ -65,7 +65,7 @@ public class JWTTokenService {
public static void main(String[] args) { public static void main(String[] args) {
String token = IdUtils.fastUUID(); String token = IdUtils.fastUUID();
Map<String, Object> claimsMap = new HashMap<String, Object>(); Map<String, Object> claimsMap = new HashMap<>();
claimsMap.put(SecurityConstants.USER_KEY, token); claimsMap.put(SecurityConstants.USER_KEY, token);
claimsMap.put(SecurityConstants.DETAILS_USER_ID, 1); claimsMap.put(SecurityConstants.DETAILS_USER_ID, 1);
claimsMap.put(SecurityConstants.DETAILS_USERNAME, "!Admin"); claimsMap.put(SecurityConstants.DETAILS_USERNAME, "!Admin");
@ -107,6 +107,7 @@ public class JWTTokenService {
return user; return user;
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getMessage());
} }
return user; return user;
} }