From 1c40baaf9ca0183945b9881d11ceed5aeebc8290 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 23 十月 2025 11:35:44 +0800
Subject: [PATCH] 修改bug
---
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarRentalServiceImpl.java | 89 +++++++++++++++++++++++---------------------
1 files changed, 46 insertions(+), 43 deletions(-)
diff --git a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarRentalServiceImpl.java b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarRentalServiceImpl.java
index 3352526..0502fa3 100644
--- a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarRentalServiceImpl.java
+++ b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarRentalServiceImpl.java
@@ -2,7 +2,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
-import com.stylefeng.guns.core.shiro.ShiroKit;
+import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.CarRentalMapper;
import com.stylefeng.guns.modular.system.model.*;
@@ -11,6 +11,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -21,54 +22,56 @@
@Autowired
private ITCarBrandService carBrandService;
-
- @Autowired
- private ITRegionService regionService;
-
- @Autowired
- private IMessNumService messNumService;
-
- @Autowired
- private ITSystemNoticeService systemNoticeService;
-
-
-
- @Override
- public Map<String, Object> list(String createTime, String title, Integer brandId, String insertUser, List<Integer> status, Integer userType, Integer offset, Integer limit) throws Exception {
- Integer companyId = ShiroKit.getUser().getRoleType() == 1 ? null : ShiroKit.getUser().getObjectId();
- String start = "";
- String end = "";
- if(ToolUtil.isNotEmpty(createTime)){
- String[] split = createTime.split(" - ");
- start = split[0];
- end = split[1];
- }
- Map<String, Object> map = new HashMap<>();
- List<Map<String, Object>> list = this.baseMapper.list(companyId, start, end, title, brandId, insertUser, status, userType, offset, limit);
- int count = this.baseMapper.listCount(companyId, start, end, title, brandId, insertUser, status, userType);
- map.put("rows", list);
+
+ @Autowired
+ private ITRegionService regionService;
+
+ @Autowired
+ private IMessNumService messNumService;
+
+ @Autowired
+ private ITSystemNoticeService systemNoticeService;
+
+ @Resource
+ private ShiroExtUtil shiroExtUtil;
+
+
+ @Override
+ public Map<String, Object> list(String createTime, String title, Integer brandId, String insertUser, List<Integer> status, Integer userType, Integer offset, Integer limit) throws Exception {
+ Integer companyId = shiroExtUtil.getUser().getRoleType() == 1 ? null : shiroExtUtil.getUser().getObjectId();
+ String start = "";
+ String end = "";
+ if (ToolUtil.isNotEmpty(createTime)) {
+ String[] split = createTime.split(" - ");
+ start = split[0];
+ end = split[1];
+ }
+ Map<String, Object> map = new HashMap<>();
+ List<Map<String, Object>> list = this.baseMapper.list(companyId, start, end, title, brandId, insertUser, status, userType, offset, limit);
+ int count = this.baseMapper.listCount(companyId, start, end, title, brandId, insertUser, status, userType);
+ map.put("rows", list);
map.put("total", count);
return map;
}
@Override
public ResultUtil addCarRental(CarRental carRental) throws Exception {
- carRental.setUserType(3);
- carRental.setUserId(ShiroKit.getUser().getObjectId());
- TCarBrand tCarBrand = carBrandService.selectById(carRental.getBrandId());
- carRental.setBrandName(tCarBrand.getName());
- TRegion region = regionService.selectOne(new EntityWrapper<TRegion>().eq("code", carRental.getProvinceCode()));
- carRental.setProvinceName(region.getName());
- region = regionService.selectOne(new EntityWrapper<TRegion>().eq("code", carRental.getCityCode()));
- carRental.setCityName(region.getName());
- carRental.setCreateTime(new Date());
- carRental.setFirstPageShow(2);
- carRental.setInsertUser(ShiroKit.getUser().getId());
- if(ShiroKit.getUser().getRoleType() == 1 && carRental.getStatus() == 1){
- carRental.setStatus(4);
- }
- this.insert(carRental);
- return ResultUtil.success();
+ carRental.setUserType(3);
+ carRental.setUserId(shiroExtUtil.getUser().getObjectId());
+ TCarBrand tCarBrand = carBrandService.selectById(carRental.getBrandId());
+ carRental.setBrandName(tCarBrand.getName());
+ TRegion region = regionService.selectOne(new EntityWrapper<TRegion>().eq("code", carRental.getProvinceCode()));
+ carRental.setProvinceName(region.getName());
+ region = regionService.selectOne(new EntityWrapper<TRegion>().eq("code", carRental.getCityCode()));
+ carRental.setCityName(region.getName());
+ carRental.setCreateTime(new Date());
+ carRental.setFirstPageShow(2);
+ carRental.setInsertUser(shiroExtUtil.getUser().getId());
+ if (shiroExtUtil.getUser().getRoleType() == 1 && carRental.getStatus() == 1) {
+ carRental.setStatus(4);
+ }
+ this.insert(carRental);
+ return ResultUtil.success();
}
@Override
--
Gitblit v1.7.1