package com.xiaopeng.maintenance.controller;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.xiaopeng.api.model.maintenance.XpCruiseCheckInRecord;
|
import com.xiaopeng.api.model.maintenance.XpCruiseCheckInRule;
|
import com.xiaopeng.api.model.operation.SysOperLog;
|
import com.xiaopeng.api.vo.account.LoginOperationUser;
|
import com.xiaopeng.common.core.domain.R;
|
import com.xiaopeng.common.core.utils.poi.ExcelUtil;
|
import com.xiaopeng.common.core.web.page.PageInfo;
|
import com.xiaopeng.common.security.service.TokenService;
|
import com.xiaopeng.maintenance.dto.XpCruiseCheckInRuleDto;
|
import com.xiaopeng.maintenance.dto.XpCruiseCheckInRuleListPageDto;
|
import com.xiaopeng.maintenance.model.vo.AppXpCruiseCheckInLocationVo;
|
import com.xiaopeng.maintenance.model.vo.AppXpCruiseCheckInRuleVo;
|
import com.xiaopeng.maintenance.model.vo.CheckInMessageVo;
|
import com.xiaopeng.maintenance.model.vo.RealTimePositionVo;
|
import com.xiaopeng.maintenance.service.IXpCruiseCheckInRecordService;
|
import com.xiaopeng.maintenance.service.IXpCruiseCheckInRuleService;
|
import com.xiaopeng.maintenance.vo.*;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
/**
|
* 巡游打卡规则
|
*/
|
@RestController
|
@RequestMapping("")
|
public class XpCruiseCheckInRuleController {
|
|
@Resource
|
public IXpCruiseCheckInRuleService xpCruiseCheckInRuleService;
|
|
@Resource
|
private TokenService tokenService;
|
|
@Resource
|
private IXpCruiseCheckInRecordService xpCruiseCheckInRecordService;
|
|
@ApiOperation(value = "获取个人中心巡游打卡任务", tags = {"运维APP-个人中心"})
|
@GetMapping("/maintenance-app/api/v1/cruiseCheckInRule/getMyXpCruiseCheckInRule")
|
public R<AppXpCruiseCheckInRuleVo> getMyXpCruiseCheckInRule() {
|
LoginOperationUser loginOperationUser = tokenService.getLoginOperationUser();
|
AppXpCruiseCheckInRuleVo myXpCruiseCheckInRule = xpCruiseCheckInRuleService.getMyXpCruiseCheckInRule(loginOperationUser.getId());
|
return R.ok(myXpCruiseCheckInRule);
|
}
|
|
|
@ApiOperation(value = "获取巡游打卡定位列表", tags = {"运维APP-个人中心"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "任务id", name = "id", required = true, dataType = "Integer")
|
})
|
@GetMapping("/maintenance-app/api/v1/cruiseCheckInRule/getAppXpCruiseCheckInLocation/{id}")
|
public R<List<AppXpCruiseCheckInLocationVo>> getAppXpCruiseCheckInLocation(@PathVariable("id") Integer id){
|
LoginOperationUser loginOperationUser = tokenService.getLoginOperationUser();
|
List<AppXpCruiseCheckInLocationVo> appXpCruiseCheckInLocation = xpCruiseCheckInRuleService.getAppXpCruiseCheckInLocation(id, loginOperationUser.getId());
|
return R.ok(appXpCruiseCheckInLocation);
|
}
|
|
|
|
@ApiOperation(value = "巡游打卡操作", tags = {"运维APP-个人中心"})
|
@PostMapping("/maintenance-app/api/v1/cruiseCheckInRule/saveCruiseCheckInRecord")
|
public R<XpCruiseCheckInRecord> saveCruiseCheckInRecord(@RequestBody XpCruiseCheckInRecord dto){
|
LoginOperationUser loginOperationUser = tokenService.getLoginOperationUser();
|
dto.setOperationsUserId(loginOperationUser.getId());
|
Long id = xpCruiseCheckInRuleService.saveCruiseCheckInRecord(dto);
|
XpCruiseCheckInRecord cruiseCheckInRecordInfo = xpCruiseCheckInRecordService.getById(id);
|
return R.ok(cruiseCheckInRecordInfo);
|
}
|
|
|
|
@ApiOperation(value = "巡游打卡5秒钟轮询上传实时位置", tags = {"运维APP-个人中心"})
|
@PostMapping("/maintenance-app/api/v1/cruiseCheckInRule/uploadRealTimePosition")
|
public R<CheckInMessageVo> uploadRealTimePosition(@RequestBody RealTimePositionVo dto){
|
LoginOperationUser loginOperationUser = tokenService.getLoginOperationUser();
|
CheckInMessageVo checkInMessageVo = xpCruiseCheckInRuleService.uploadRealTimePosition(dto, loginOperationUser.getId());
|
return R.ok(checkInMessageVo);
|
}
|
|
|
|
@ApiOperation(value = "获取打卡结果详情", tags = {"运维APP-个人中心"})
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "任务id", name = "id", required = true, dataType = "Integer"),
|
@ApiImplicitParam(value = "打卡点位id", name = "locationId", required = true, dataType = "Long")
|
})
|
@GetMapping("/maintenance-app/api/v1/cruiseCheckInRule/getCruiseCheckInRecordInfo/{id}/{locationId}")
|
public R<XpCruiseCheckInRecord> getCruiseCheckInRecordInfo(@PathVariable("id") Integer id, @PathVariable("locationId") Long locationId) {
|
LoginOperationUser loginOperationUser = tokenService.getLoginOperationUser();
|
XpCruiseCheckInRecord cruiseCheckInRecordInfo = xpCruiseCheckInRuleService.getCruiseCheckInRecordInfo(id, locationId, loginOperationUser.getId());
|
return R.ok(cruiseCheckInRecordInfo);
|
}
|
|
|
|
@ApiOperation(value = "查询巡游打卡规则列表", tags = {"管理后台-巡游打卡规则管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/getXpCruiseCheckInRuleListPage")
|
public R<Page<XpCruiseCheckInRuleListPage>> getXpCruiseCheckInRuleListPage(XpCruiseCheckInRuleListPageDto dto){
|
Page<XpCruiseCheckInRuleListPage> pageInfo = PageInfo.of(dto.getPageNum(), dto.getPageSize());
|
List<XpCruiseCheckInRuleListPage> xpCruiseCheckInRuleListPage = xpCruiseCheckInRuleService.getXpCruiseCheckInRuleListPage(pageInfo, dto);
|
pageInfo.setRecords(xpCruiseCheckInRuleListPage);
|
return R.ok(pageInfo);
|
}
|
|
|
@ApiOperation(value = "添加巡游打卡规则", tags = {"管理后台-巡游打卡规则管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/addXpCruiseCheckInRule")
|
public R<?> addXpCruiseCheckInRule(@RequestBody XpCruiseCheckInRuleDto dto){
|
xpCruiseCheckInRuleService.addXpCruiseCheckInRule(dto);
|
return R.ok();
|
}
|
|
@ApiOperation(value = "删除巡游打卡规则", tags = {"管理后台-巡游打卡规则管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/delXpCruiseCheckInRule/{id}")
|
public R<?> delXpCruiseCheckInRule(@PathVariable("id") Integer id){
|
xpCruiseCheckInRuleService.removeById(id);
|
return R.ok();
|
}
|
|
@ApiOperation(value = "获取打卡规则详情", tags = {"管理后台-巡游打卡规则管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/getXpCruiseCheckInRuleInfo/{id}")
|
public R<XpCruiseCheckInRuleInfoVo> getXpCruiseCheckInRuleInfo(@PathVariable("id") Integer id){
|
XpCruiseCheckInRuleInfoVo xpCruiseCheckInRuleInfo = xpCruiseCheckInRuleService.getXpCruiseCheckInRuleInfo(id);
|
return R.ok(xpCruiseCheckInRuleInfo);
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询巡游打卡记录列表", tags = {"管理后台-巡游打卡管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/pageList")
|
public R<PageInfo<XpCruiseCheckInRecordVO>> pageList(@RequestBody XpCruiseCheckInRecordQuery query) {
|
PageInfo<XpCruiseCheckInRecordVO> pageInfo = xpCruiseCheckInRecordService.pageList(query);
|
return R.ok(pageInfo);
|
}
|
|
@ApiOperation(value = "查询巡游打卡记录详情", tags = {"管理后台-巡游打卡管理"})
|
@GetMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/{id}")
|
public R<XpCruiseCheckInRecordVO> detail(@PathVariable("id")Long id) {
|
XpCruiseCheckInRecordVO xpCruiseCheckInRecordVO = xpCruiseCheckInRecordService.detail(id);
|
return R.ok(xpCruiseCheckInRecordVO);
|
}
|
|
@ApiOperation(value = "巡游打卡统计", tags = {"管理后台-巡游打卡管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/statistic")
|
public R<List<XpCruiseCheckInStatisticsVO>> pageList(@RequestBody XpCruiseCheckInStatisticsQuery query) {
|
|
return R.ok(xpCruiseCheckInRecordService.statistics(query));
|
}
|
|
@ApiOperation(value = "查询巡游打卡记录列表导出", tags = {"管理后台-巡游打卡管理"})
|
@PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/export")
|
public R<PageInfo<XpCruiseCheckInRecordVO>> pageListExport(@RequestBody XpCruiseCheckInRecordQuery query, HttpServletResponse response) {
|
List<XpCruiseCheckInRecordVO> list = xpCruiseCheckInRecordService.all(query);
|
ExcelUtil<XpCruiseCheckInRecordVO> util = new ExcelUtil<>(XpCruiseCheckInRecordVO.class);
|
util.exportExcel(response, list, "巡游打卡记录");
|
return R.ok();
|
}
|
|
}
|