Pu Zhibing
2 天以前 5dacdee9b54c78372b68140e2b068d03a620eab9
ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarRentalServiceImpl.java
@@ -3,7 +3,6 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.beetl.ShiroExtUtil;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.dao.CarRentalMapper;
import com.stylefeng.guns.modular.system.model.*;
@@ -12,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;
@@ -22,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 = 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);
   @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(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();
       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