import com.tuoheng.admin.enums.InspectionStatusEnum; | import com.tuoheng.admin.enums.InspectionStatusEnum; | ||||
import com.tuoheng.admin.mapper.InspectionHistoryMapper; | import com.tuoheng.admin.mapper.InspectionHistoryMapper; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.service.report.generate.GenerateReportService; | |||||
import com.tuoheng.admin.service.third.dsp.IDspService; | import com.tuoheng.admin.service.third.dsp.IDspService; | ||||
import com.tuoheng.admin.tzhl.response.TZHLFlyLogResponse; | import com.tuoheng.admin.tzhl.response.TZHLFlyLogResponse; | ||||
import com.tuoheng.admin.tzhl.service.fly.data.FlyDataService; | import com.tuoheng.admin.tzhl.service.fly.data.FlyDataService; | ||||
@Autowired | @Autowired | ||||
private FlyDataService flyDataService; | private FlyDataService flyDataService; | ||||
@Autowired | |||||
private GenerateReportService generateReportService; | |||||
public void getFlyLog(Inspection inspection, TZHLFlyLogResponse flyLogResponse) { | public void getFlyLog(Inspection inspection, TZHLFlyLogResponse flyLogResponse) { | ||||
log.info("获取飞行日志,status=normal,title={}", flyLogResponse.getTitle()); | log.info("获取飞行日志,status=normal,title={}", flyLogResponse.getTitle()); | ||||
this.updateInspection(inspection); | this.updateInspection(inspection); | ||||
// 任务完成后自动生成报告 | |||||
generateReportService.generateByAuto(inspection); | |||||
// 拉取飞行数据 | // 拉取飞行数据 | ||||
flyDataService.getFlyData(inspection); | flyDataService.getFlyData(inspection); | ||||
@Override | @Override | ||||
public JsonResult getUserInfo() { | public JsonResult getUserInfo() { | ||||
//登录用户信息 | //登录用户信息 | ||||
User userInfo = CurrentUserUtil.getUserInfo(); | |||||
String username = userInfo.getUsername(); | |||||
if(StringUtils.isEmpty(username)){ | |||||
return JsonResult.error(UserCodeEnum.USER_NAME_IS_NULL.getCode(),UserCodeEnum.USER_NAME_IS_NULL.getMsg()); | |||||
} | |||||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||||
.eq(User::getUsername, username) | |||||
.eq(User::getMark, MarkEnum.VALID.getCode())); | |||||
if(ObjectUtil.isNull(user)){ | |||||
return JsonResult.error(UserCodeEnum.USER_IS_NULL.getCode(),UserCodeEnum.USER_IS_NULL.getMsg()); | |||||
} | |||||
User user = CurrentUserUtil.getUserInfo(); | |||||
if(2== user.getStatus()){ | if(2== user.getStatus()){ | ||||
return JsonResult.error(UserCodeEnum.USER_STATUS_INTERDICT.getCode(),UserCodeEnum.USER_STATUS_INTERDICT.getMsg()); | return JsonResult.error(UserCodeEnum.USER_STATUS_INTERDICT.getCode(),UserCodeEnum.USER_STATUS_INTERDICT.getMsg()); | ||||
} | } |
@Override | @Override | ||||
public JsonResult uploadResult(UploadResultDto dto) { | public JsonResult uploadResult(UploadResultDto dto) { | ||||
//登录用户信息 | //登录用户信息 | ||||
User userInfo = CurrentUserUtil.getUserInfo(); | |||||
String username = userInfo.getUsername(); | |||||
if(StringUtils.isEmpty(username)){ | |||||
return JsonResult.error(InspectionFileHandleEnum.USER_NAME_IS_NULL.getCode(),InspectionFileHandleEnum.USER_NAME_IS_NULL.getMsg()); | |||||
} | |||||
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||||
.eq(User::getMark, MarkEnum.VALID.getCode()) | |||||
.eq(User::getUsername, username)); | |||||
if(ObjectUtil.isNull(user)){ | |||||
return JsonResult.error(InspectionFileHandleEnum.USER_IS_NOT_EXIST.getCode(),InspectionFileHandleEnum.USER_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
User user = CurrentUserUtil.getUserInfo(); | |||||
if(StringUtils.isEmpty(user.getId())){ | if(StringUtils.isEmpty(user.getId())){ | ||||
return JsonResult.error(InspectionFileHandleEnum.USER_ID_IS_NULL.getCode(),InspectionFileHandleEnum.USER_ID_IS_NULL.getMsg()); | return JsonResult.error(InspectionFileHandleEnum.USER_ID_IS_NULL.getCode(),InspectionFileHandleEnum.USER_ID_IS_NULL.getMsg()); | ||||
} | } |
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | ||||
} | } | ||||
//登录用户信息 | //登录用户信息 | ||||
User userInfo = CurrentUserUtil.getUserInfo(); | |||||
String username = userInfo.getUsername(); | |||||
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||||
.eq(StringUtils.isNotEmpty(username), User::getUsername, username) | |||||
.eq(User::getStatus, 1).eq(User::getMark, MarkEnum.VALID.getCode())); | |||||
if(ObjectUtil.isNull(user)){ | |||||
return null; | |||||
} | |||||
User user = CurrentUserUtil.getUserInfo(); | |||||
String tenantId = user.getTenantId(); | String tenantId = user.getTenantId(); | ||||
if(StringUtils.isEmpty(tenantId)){ | if(StringUtils.isEmpty(tenantId)){ | ||||
return null; | return null; |
@Override | @Override | ||||
public JsonResult mothCount() { | public JsonResult mothCount() { | ||||
//获取登录用户信息 | //获取登录用户信息 | ||||
User userInfo = CurrentUserUtil.getUserInfo(); | |||||
String username = userInfo.getUsername(); | |||||
if (StringUtils.isEmpty(username)) { | |||||
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); | |||||
} | |||||
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||||
.eq(User::getMark, MarkEnum.VALID.getCode()) | |||||
.eq(User::getUsername, username)); | |||||
if (ObjectUtil.isNull(user)) { | |||||
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
User user = CurrentUserUtil.getUserInfo(); | |||||
String tenantId = user.getTenantId(); | String tenantId = user.getTenantId(); | ||||
if (StringUtils.isEmpty(tenantId)) { | if (StringUtils.isEmpty(tenantId)) { | ||||
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); | return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); | ||||
if (null == endTime || null == beginTime) { | if (null == endTime || null == beginTime) { | ||||
return null; | return null; | ||||
} | } | ||||
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户 | |||||
if (RoleEnum.SUPER_ADMIN.getCode() == type) { | if (RoleEnum.SUPER_ADMIN.getCode() == type) { | ||||
//获取当前登录用户(超级管理员)已完成工单列表 | //获取当前登录用户(超级管理员)已完成工单列表 | ||||
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() | List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() |