package com.doumee.api; 
 | 
  
 | 
import com.doumee.service.business.third.model.ApiResponse; 
 | 
import com.doumee.core.utils.Constants; 
 | 
import com.doumee.service.business.VisitsService; 
 | 
import com.doumee.service.business.impl.hksync.HkSyncVisitServiceImpl; 
 | 
import com.doumee.service.business.impl.hksync.fhk.HkSyncVisitFromHKServiceImpl; 
 | 
import io.swagger.annotations.Api; 
 | 
import io.swagger.annotations.ApiOperation; 
 | 
import org.springframework.beans.factory.annotation.Autowired; 
 | 
import org.springframework.web.bind.annotation.GetMapping; 
 | 
import org.springframework.web.bind.annotation.RequestMapping; 
 | 
import org.springframework.web.bind.annotation.RestController; 
 | 
  
 | 
import java.util.Date; 
 | 
  
 | 
/** 
 | 
 * @author 江蹄蹄 
 | 
 * @date 2023/11/30 15:33 
 | 
 */ 
 | 
@Api(tags = "访客定时器接口") 
 | 
@RestController 
 | 
@RequestMapping("/timer/visit") 
 | 
public class HkVisitTimerController extends BaseController { 
 | 
  
 | 
    @Autowired 
 | 
    private HkSyncVisitServiceImpl hkSyncVisitService; 
 | 
    @Autowired 
 | 
    private HkSyncVisitFromHKServiceImpl hkSyncVisitFromHKService; 
 | 
    @Autowired 
 | 
    private VisitsService visitsService; 
 | 
  
 | 
    @ApiOperation("开启定时下发访客预约申请") 
 | 
    @GetMapping("/syncVisitData") 
 | 
    public ApiResponse syncVisitData() { 
 | 
        hkSyncVisitService.syncVisitData(); 
 | 
        return ApiResponse.success("开启定时下发访客预约申请成功"); 
 | 
    } 
 | 
    @ApiOperation("开启定时查询访客预约状态") 
 | 
    @GetMapping("/getOutTimeVisitRecord") 
 | 
    public ApiResponse getOutTimeVisitRecord() { 
 | 
        hkSyncVisitService.getOutTimeVisitRecordIccm(); 
 | 
        return ApiResponse.success("开启定时查询访客预约状态成功"); 
 | 
    } 
 | 
    @ApiOperation("开启定时今日的访客预约数据") 
 | 
    @GetMapping("/syncVistAppointData") 
 | 
    public ApiResponse syncVistAppointData() { 
 | 
        if(!Constants.DEALING_FROM_HK_VISIT){ 
 | 
            try { 
 | 
                Constants.DEALING_FROM_HK_VISIT =true; 
 | 
                hkSyncVisitFromHKService.syncVistAppointData(new Date()); 
 | 
                Constants.DEALING_FROM_HK_VISIT =false; 
 | 
            }catch (Exception e){ 
 | 
  
 | 
            }finally { 
 | 
                Constants.DEALING_FROM_HK_VISIT =false; 
 | 
            } 
 | 
        } 
 | 
        return ApiResponse.success("开启定时今日的访客预约数据成功"); 
 | 
    } 
 | 
  
 | 
    @ApiOperation("访客即将超时预警") 
 | 
    @GetMapping("/visitTimeOut") 
 | 
    public ApiResponse visitTimeOut() { 
 | 
        visitsService.syncTimeOutData(); 
 | 
        return ApiResponse.success("访客即将超时预警"); 
 | 
    } 
 | 
  
 | 
} 
 |