企业列表出来了
parent
dc425a3868
commit
d4268ddf78
|
@ -1,6 +1,11 @@
|
|||
package com.muyu.market.controller;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
|
@ -127,11 +132,27 @@ public class MyApiController extends BaseController
|
|||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
myApi.setUserId(userId);
|
||||
if (myApiService.checkIdUnique(myApi)) {
|
||||
MyApi myApi1 = myApiService.selectMyApiByMyId(myApi.getMyId());
|
||||
if (myApi1!=null) {
|
||||
myApi.setMyNum(myApi1.getMyNum()+myApi.getMyNum());
|
||||
return toAjax(myApiService.updateById(myApi));
|
||||
}
|
||||
// 获取当前时间(没有时区)
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 假设我们使用系统默认时区
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
|
||||
// 将LocalDateTime转换为ZonedDateTime(添加了时区信息)
|
||||
ZonedDateTime zdt = now.atZone(zoneId);
|
||||
|
||||
// 将ZonedDateTime转换为Instant(UTC时间线上的点)
|
||||
Instant instant = zdt.toInstant();
|
||||
|
||||
// 将Instant转换为Date
|
||||
Date date = Date.from(instant);
|
||||
myApi.setMyTime(date);
|
||||
myApi.setMyStates("Y");
|
||||
return toAjax(myApiService.save(myApi));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue