fix(): 修复
parent
a08b98ca95
commit
abafd16cf1
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.openbusiness.controller;
|
package com.muyu.openbusiness.controller;
|
||||||
|
|
||||||
import com.muyu.openbusiness.config.SnowflakeIdWorker;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.SysMember;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.openbusiness.domain.SysCar;
|
import com.muyu.openbusiness.domain.SysCar;
|
||||||
import com.muyu.openbusiness.service.ISysCarService;
|
import com.muyu.openbusiness.service.ISysCarService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
@ -10,10 +12,10 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
@ -34,9 +36,10 @@ public class SysCarController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysCarService sysCarService;
|
private ISysCarService sysCarService;
|
||||||
|
@Resource
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate redisTemplate;
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆基础信息列表
|
* 查询车辆基础信息列表
|
||||||
*/
|
*/
|
||||||
|
@ -49,6 +52,12 @@ private RedisTemplate redisTemplate;
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysCar> sysCarList()
|
||||||
|
{
|
||||||
|
List<SysCar> list = sysCarService.selectSysCarList(new SysCar());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出车辆基础信息列表
|
* 导出车辆基础信息列表
|
||||||
*/
|
*/
|
||||||
|
@ -68,13 +77,6 @@ private RedisTemplate redisTemplate;
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public Result<List<SysCar>> getInfo(@PathVariable("id") Long id)
|
public Result<List<SysCar>> getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
SnowflakeIdWorker snowMaker = new SnowflakeIdWorker();
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
long ids = snowMaker.nextId();
|
|
||||||
System.out.println(ids);
|
|
||||||
|
|
||||||
}
|
|
||||||
redisTemplate.opsForValue().set("ids",sysCarService.selectSysCarById(id));
|
|
||||||
return success(sysCarService.selectSysCarById(id));
|
return success(sysCarService.selectSysCarById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +88,13 @@ private RedisTemplate redisTemplate;
|
||||||
public Result<Integer> add(
|
public Result<Integer> add(
|
||||||
@Validated @RequestBody SysCar sysCar)
|
@Validated @RequestBody SysCar sysCar)
|
||||||
{
|
{
|
||||||
|
String saasKey = SecurityUtils.getSaasKey();
|
||||||
|
Result<SysMember> sysMemberResult = remoteUserService.selectSysMemberListById(saasKey);
|
||||||
|
SysMember sysMember = sysMemberResult.getData();
|
||||||
|
List<SysCar> list = this.sysCarList();
|
||||||
|
if(list.size()>=sysMember.getMemberCarNum()){
|
||||||
|
return Result.error("已达到当前会员等级可添加上限,请联系管理员升级会员等级");
|
||||||
|
}
|
||||||
// 获取当前时间(没有时区)
|
// 获取当前时间(没有时区)
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
// 假设我们使用系统默认时区
|
// 假设我们使用系统默认时区
|
||||||
|
|
Loading…
Reference in New Issue