|  | @@ -1,7 +1,10 @@
 | 
	
		
			
				|  |  |  package com.pj.project.tb_business_car;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.time.LocalDate;
 | 
	
		
			
				|  |  | +import java.time.format.DateTimeFormatter;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import cn.hutool.core.util.StrUtil;
 | 
	
		
			
				|  |  |  import com.pj.constants.UserTypeEnum;
 | 
	
		
			
				|  |  |  import com.pj.project.tb_business.TbBusiness;
 | 
	
		
			
				|  |  |  import com.pj.project.tb_costomer.TbCostomer;
 | 
	
	
		
			
				|  | @@ -18,111 +21,139 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  | - * Controller: tb_business_car -- 
 | 
	
		
			
				|  |  | - * @author qzy 
 | 
	
		
			
				|  |  | + * Controller: tb_business_car --
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * @author qzy
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  @RestController
 | 
	
		
			
				|  |  |  @RequestMapping("/TbBusinessCar/")
 | 
	
		
			
				|  |  |  public class TbBusinessCarController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	/** 底层 Service 对象 */
 | 
	
		
			
				|  |  | -	@Autowired
 | 
	
		
			
				|  |  | -	TbBusinessCarService tbBusinessCarService;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	/** 查 - 根据id */
 | 
	
		
			
				|  |  | -	@RequestMapping("add")
 | 
	
		
			
				|  |  | -	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | -	public AjaxJson add(TbBusinessCar t) throws Exception{
 | 
	
		
			
				|  |  | -		tbBusinessCarService.add(t);
 | 
	
		
			
				|  |  | -		return AjaxJson.getSuccess();
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -	/** 查 - 根据id */
 | 
	
		
			
				|  |  | -	@RequestMapping("delete")
 | 
	
		
			
				|  |  | -	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | -	public AjaxJson delete(String id) {
 | 
	
		
			
				|  |  | -		return tbBusinessCarService.deleteCar(id);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	/** 查 - 根据id */
 | 
	
		
			
				|  |  | -	@RequestMapping("deleteRecord")
 | 
	
		
			
				|  |  | -	@SaCheckPermission(TbBusinessCar.PERMISSION_DEL)
 | 
	
		
			
				|  |  | -	public AjaxJson deleteRecord(String id) {
 | 
	
		
			
				|  |  | -		return tbBusinessCarService.deleteRecord(id);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	@RequestMapping(value = "findInAndNoBusinessCar")
 | 
	
		
			
				|  |  | -	public AjaxJson findInAndNoBusinessCar(){
 | 
	
		
			
				|  |  | -		List<TbBusinessCar>list=tbBusinessCarService.findInAndNoBusinessCar();
 | 
	
		
			
				|  |  | -		return AjaxJson.getSuccessData(list);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	/** 查 - 根据id */
 | 
	
		
			
				|  |  | -	@RequestMapping("update")
 | 
	
		
			
				|  |  | -	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | -	public AjaxJson update(TbBusinessCar t){
 | 
	
		
			
				|  |  | -		tbBusinessCarService.updateCar(t);
 | 
	
		
			
				|  |  | -		return AjaxJson.getSuccess();
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -	/** 查 - 根据id */
 | 
	
		
			
				|  |  | -	@RequestMapping("getById")
 | 
	
		
			
				|  |  | -	public AjaxJson getById(Long id){
 | 
	
		
			
				|  |  | -		TbBusinessCar t = tbBusinessCarService.getById(id);
 | 
	
		
			
				|  |  | -		return AjaxJson.getSuccessData(t);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -	/** 改 - 状态(0=否,1=是) */
 | 
	
		
			
				|  |  | -	@RequestMapping("updateStatus")
 | 
	
		
			
				|  |  | -	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | -	public AjaxJson updateStatus(String id, int value){
 | 
	
		
			
				|  |  | -		TbBusinessCar t=tbBusinessCarService.getById(id);
 | 
	
		
			
				|  |  | -		t.setIsLock(value);
 | 
	
		
			
				|  |  | -		tbBusinessCarService.updateById(t);
 | 
	
		
			
				|  |  | -		return AjaxJson.getByLine(1);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
 | 
	
		
			
				|  |  | -	@RequestMapping("getList")
 | 
	
		
			
				|  |  | -	public AjaxJson getList() { 
 | 
	
		
			
				|  |  | -		SoMap so = SoMap.getRequestSoMap();
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 底层 Service 对象
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    TbBusinessCarService tbBusinessCarService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查 - 根据id
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("add")
 | 
	
		
			
				|  |  | +    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | +    public AjaxJson add(TbBusinessCar t) throws Exception {
 | 
	
		
			
				|  |  | +        tbBusinessCarService.add(t);
 | 
	
		
			
				|  |  | +        return AjaxJson.getSuccess();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查 - 根据id
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("delete")
 | 
	
		
			
				|  |  | +    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | +    public AjaxJson delete(String id) {
 | 
	
		
			
				|  |  | +        return tbBusinessCarService.deleteCar(id);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查 - 根据id
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("deleteRecord")
 | 
	
		
			
				|  |  | +    @SaCheckPermission(TbBusinessCar.PERMISSION_DEL)
 | 
	
		
			
				|  |  | +    public AjaxJson deleteRecord(String id) {
 | 
	
		
			
				|  |  | +        return tbBusinessCarService.deleteRecord(id);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @RequestMapping(value = "findInAndNoBusinessCar")
 | 
	
		
			
				|  |  | +    public AjaxJson findInAndNoBusinessCar() {
 | 
	
		
			
				|  |  | +        List<TbBusinessCar> list = tbBusinessCarService.findInAndNoBusinessCar();
 | 
	
		
			
				|  |  | +        return AjaxJson.getSuccessData(list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查 - 根据id
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("update")
 | 
	
		
			
				|  |  | +    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | +    public AjaxJson update(TbBusinessCar t) {
 | 
	
		
			
				|  |  | +        tbBusinessCarService.updateCar(t);
 | 
	
		
			
				|  |  | +        return AjaxJson.getSuccess();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查 - 根据id
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("getById")
 | 
	
		
			
				|  |  | +    public AjaxJson getById(Long id) {
 | 
	
		
			
				|  |  | +        TbBusinessCar t = tbBusinessCarService.getById(id);
 | 
	
		
			
				|  |  | +        return AjaxJson.getSuccessData(t);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 改 - 状态(0=否,1=是)
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("updateStatus")
 | 
	
		
			
				|  |  | +    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
 | 
	
		
			
				|  |  | +    public AjaxJson updateStatus(String id, int value) {
 | 
	
		
			
				|  |  | +        TbBusinessCar t = tbBusinessCarService.getById(id);
 | 
	
		
			
				|  |  | +        t.setIsLock(value);
 | 
	
		
			
				|  |  | +        tbBusinessCarService.updateById(t);
 | 
	
		
			
				|  |  | +        return AjaxJson.getByLine(1);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping("getList")
 | 
	
		
			
				|  |  | +    public AjaxJson getList() {
 | 
	
		
			
				|  |  | +        SoMap so = SoMap.getRequestSoMap();
 | 
	
		
			
				|  |  |          String currentCustomerId = StpUserUtil.getCustomerId();
 | 
	
		
			
				|  |  |          if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
 | 
	
		
			
				|  |  | -            so.put("customerId",currentCustomerId);
 | 
	
		
			
				|  |  | +            so.put("customerId", currentCustomerId);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -		List<TbBusinessCar> list = tbBusinessCarService.getList(so.startPage());
 | 
	
		
			
				|  |  | -		return AjaxJson.getPageData(so.getDataCount(), list);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | +        String limitDay = so.getString("limitDay");
 | 
	
		
			
				|  |  | +        if (StrUtil.isNotEmpty(limitDay)){
 | 
	
		
			
				|  |  | +            LocalDate now=LocalDate.now();
 | 
	
		
			
				|  |  | +            LocalDate startDay=now.minusMonths(1);
 | 
	
		
			
				|  |  | +            DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy-MM-dd");
 | 
	
		
			
				|  |  | +            String startDayStr=startDay.format(formatter);
 | 
	
		
			
				|  |  | +            String endDayStr=now.format(formatter);
 | 
	
		
			
				|  |  | +            so.put("startDay",startDayStr);
 | 
	
		
			
				|  |  | +            so.put("endDay",endDayStr);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<TbBusinessCar> list = tbBusinessCarService.getList(so.startPage());
 | 
	
		
			
				|  |  | +        return AjaxJson.getPageData(so.getDataCount(), list);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /** 手动添加放行记录*/
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 手动添加放行记录
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      @RequestMapping("addCarRecord")
 | 
	
		
			
				|  |  |      @SaCheckPermission(TbBusinessCar.PERMISSION_ADD)
 | 
	
		
			
				|  |  | -    public AjaxJson addManualCar(TbBusinessCar t) throws Exception{
 | 
	
		
			
				|  |  | +    public AjaxJson addManualCar(TbBusinessCar t) throws Exception {
 | 
	
		
			
				|  |  |          tbBusinessCarService.addCarRecord(t);
 | 
	
		
			
				|  |  |          return AjaxJson.getSuccess();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @RequestMapping("updateCarRecord")
 | 
	
		
			
				|  |  |      @SaCheckPermission(TbBusinessCar.PERMISSION_EDIT)
 | 
	
		
			
				|  |  | -    public AjaxJson updateCarRecord(TbBusinessCar t) throws Exception{
 | 
	
		
			
				|  |  | +    public AjaxJson updateCarRecord(TbBusinessCar t) throws Exception {
 | 
	
		
			
				|  |  |          tbBusinessCarService.updateCarRecord(t);
 | 
	
		
			
				|  |  |          return AjaxJson.getSuccess();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @RequestMapping("export")
 | 
	
		
			
				|  |  |      @SaCheckPermission(TbBusinessCar.PERMISSION_EXPORT)
 | 
	
		
			
				|  |  |      public AjaxJson export() {
 | 
	
		
			
				|  |  | -    	SoMap soMap=SoMap.getRequestSoMap();
 | 
	
		
			
				|  |  | -        return AjaxJson.getSuccessData( tbBusinessCarService.export(soMap));
 | 
	
		
			
				|  |  | +        SoMap soMap = SoMap.getRequestSoMap();
 | 
	
		
			
				|  |  | +        return AjaxJson.getSuccessData(tbBusinessCarService.export(soMap));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @RequestMapping("searchInNotOutCar")
 | 
	
		
			
				|  |  |      public AjaxJson searchInNotOutCar() {
 | 
	
		
			
				|  |  | -		SoMap soMap=SoMap.getRequestSoMap();
 | 
	
		
			
				|  |  | -		String carNo=soMap.getString("carNo");
 | 
	
		
			
				|  |  | -        return AjaxJson.getSuccessData( tbBusinessCarService.findNotOutCarLike(carNo));
 | 
	
		
			
				|  |  | +        SoMap soMap = SoMap.getRequestSoMap();
 | 
	
		
			
				|  |  | +        String carNo = soMap.getString("carNo");
 | 
	
		
			
				|  |  | +        return AjaxJson.getSuccessData(tbBusinessCarService.findNotOutCarLike(carNo));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  }
 |