- 为什么即便我设置了时区,我查到的当天的时间都不对?
public static Date getStartOfTheDay() { LocalDate currentDate = LocalDate.now(); // 将当前日期和零点时间合并 LocalDateTime currentDateTime = LocalDateTime.of(currentDate, LocalTime.MIDNIGHT); // 获取0点的Date对象 return Date.from(currentDateTime.atZone(java.time.ZoneId.of("Asia/Shanghai")).toInstant()); } public static Date getEndOfTheDay() { LocalDate currentDate = LocalDate.now(); // 将当前日期和零点时间合并 LocalDateTime currentDateTime = LocalDateTime.of(currentDate, LocalTime.MAX); // 获取0点的Date对象 return Date.from(currentDateTime.atZone(java.time.ZoneId.of("Asia/Shanghai")).toInstant()); } 上面是我的代码,我在零点多一点的时候,执行了以上的代码,并且写了一段这样的日志: log.info("the start date is: {} and the end date is: {}", TimeUtils.getStartOfTheDay(), TimeUtils.getEndOfTheDay()); 打出来的时间却是两天前的: 09/27 00:41:20 blood-sugar-dev-133 2024-09-26T16:41:19.814Z INFO 1 --- [blood-sugar-monitor] [nio-8080-exec-9] c.p.u.h.B.dao.impl.FoodDao : the start date is: Wed Sep 25 16:00:00 GMT 2024 and the end date is: Thu Sep 26 15:59:59 GMT 2024 如果是因为时区问题也可以理解,当前的GMT时间是26号,但是就算这样出来的时间也应该是26的0点-23:59吧?
09-27 - 为什么我从服务端发multipart/form-data时一直提示not well-formed?
如下是我组装post请求的代码: 我发现同样是是是用这个方法,当我上传一个.png文件的时候,就没有问题,但是当我上传一个.xlsx文件后,就反复失败,提示: The body of your POST request is not well-formed multipart/form-data. MalformedPOSTRequest在网上搜了相关资料,把MediaType.parse的内容改成了application/vnd.openxmlformats-officedocument.spreadsheetml.sheet之后也是一样的报错 public static String sendMultipartPost(String url, Map<String, String> body, File file, Map<String, String> headers) throws IOException { log.info("request url: {}, body: {}, headers: {}", url, body, headers); MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse("multipart/form-data"), file)); if (body != null && !body.isEmpty()) { body.forEach(multipartBodyBuilder::addFormDataPart); } MultipartBody multipartBody = multipartBodyBuilder.build(); Request.Builder builder = new Request.Builder(); if (headers != null && !headers.isEmpty()) { headers.forEach(builder::addHeader); } Request request = builder .url(url) .post(multipartBody) .build(); try (Response response = client.newCall(request).execute()) { String responseBody = response.body().string(); log.info("the response body is: {}", responseBody); return responseBody; } }
09-06 - 为什么部署失败,然后日志里提示unable to access jarfile?
部署的时候报错:[2024-08-19 21:42:20] [Pipeline] } [2024-08-19 21:42:20] [Pipeline] // stage [2024-08-19 21:42:20] [Pipeline] } [2024-08-19 21:42:20] [Pipeline] // node [2024-08-19 21:42:20] [Pipeline] End of Pipeline [2024-08-19 21:42:20] Finished: SUCCESS *** -----------构建blood-sugar-dev-001----------- 2024-08-19 21:40:24 create_build_image : succ, 2024-08-19 21:42:26 check_build_image : succ, , -----------服务blood-sugar-dev部署blood-sugar-dev-001----------- 2024-08-19 21:42:27 create_eks_virtual_service : succ, 2024-08-19 21:42:27 check_eks_virtual_service : process, DescribeVersion_user_error_Exec lifecycle hook ([/bin/sh /app/cert/initenv.sh]) for Container "blood-sugar-dev-001" in Pod "blood-sugar-dev-001-7cc77f6d48-bcqhl_sjhkfurb(8b1e578d-22d0-4950-9294-6b8b06a084ab)" failed - error: rpc error: code = Unknown desc = failed to exec in container: failed to create exec "471ee5a50f14bee62311714cfda81925bfdacd9d1ba54c406345ca53fcbe6a15": cannot exec in a stopped state: unknown, message: "", 然后在日志里看到:(dockerfile是照着模板写的,除了javaversion不太一样其他基本一致 [图片]
08-20 - 为什么我看不到有在运行的流水线但一直报错?
[图片]
08-19