Commit 471ef949 authored by helinlin's avatar helinlin

添加APP待办任务统计

parent a705411a
......@@ -3,24 +3,29 @@ package com.yeejoin.amos.boot.module.jcs.api.service;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import java.util.List;
/**
* 调派单位资源 服务类
*
* @author tb
* @date 2021-06-17
*/
* 调派单位资源 服务类
*
* @author tb
* @date 2021-06-17
*/
public interface IPowerTransferCompanyResourcesService {
AlertCalled getByPowerTransferCompanyResourId(Long id );
AlertCalled getByPowerTransferCompanyResourId(Long id);
PowerTransferCompanyResources getByAlertCalledIdCarId(Long alertCalledId,Long carId);
PowerTransferCompanyResources getByAlertCalledIdCarId(Long alertCalledId, Long carId);
void updateByAlertCalledId(Long alertCalledId);
void updateByAlertCalledId(Long alertCalledId);
void updatePowerTransferCompanyResourcesService(Long alertCalledId,Long carId,String code,int type,String remarks);
void updatePowerTransferCompanyResourcesService(Long alertCalledId, Long carId, String code, int type, String remarks);
/**
* 根据ID获取资源信息
*
* @param resourceId 资源id
* @return 车辆状态
*/
PowerTransferCompanyResources getResourceById(String resourceId);
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import java.util.List;
import java.util.Map;
/**
*
*/
*
*/
public interface IUserCarService {
UserCar selectByAmosUserId(Long id);
void add (UserCar userCar);
void delete (UserCar userCar);
void add(UserCar userCar);
void delete(UserCar userCar);
/**
* 获取用户绑定的车辆的状态为执行中的数量
*
* @return 执行中车辆的数量
*/
int countUserCarExecuting(Long userId);
}
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
......@@ -10,7 +9,6 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources
import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyResourcesMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyResourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -21,26 +19,27 @@ import java.util.ArrayList;
import java.util.List;
/**
* 调派单位资源 服务实现类
*
* @author tb
* @date 2021-06-17
*/
* 调派单位资源 服务实现类
*
* @author tb
* @date 2021-06-17
*/
@Service
public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerTransferCompanyResourcesDto,PowerTransferCompanyResources,PowerTransferCompanyResourcesMapper> implements IPowerTransferCompanyResourcesService {
public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerTransferCompanyResourcesDto, PowerTransferCompanyResources, PowerTransferCompanyResourcesMapper> implements IPowerTransferCompanyResourcesService {
@Resource
PowerTransferCompanyResourcesMapper powerTransferCompanyResourcesMapper;
@Autowired
EquipFeignClient equipFeignClient;
@Override
public AlertCalled getByPowerTransferCompanyResourId(Long id) {
QueryWrapper<PowerTransferCompanyResources> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", FireCarStatusEnum.执行中.getCode() );
queryWrapper.eq("resources_id", id.toString() );
queryWrapper.eq("status", FireCarStatusEnum.执行中.getCode());
queryWrapper.eq("resources_id", id.toString());
PowerTransferCompanyResources alertFormValue = this.getOne(queryWrapper);
if(alertFormValue!=null){
if (alertFormValue != null) {
return powerTransferCompanyResourcesMapper.getByPowerTransferCompanyResourId(alertFormValue.getPowerTransferCompanyId());
}
return null;
......@@ -48,7 +47,7 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
@Override
public PowerTransferCompanyResources getByAlertCalledIdCarId(Long alertCalledId, Long carId) {
return powerTransferCompanyResourcesMapper.getByAlertCalledIdCarId(alertCalledId,carId);
return powerTransferCompanyResourcesMapper.getByAlertCalledIdCarId(alertCalledId, carId);
}
@Override
......@@ -59,32 +58,39 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
@Override
@Transactional
public void updatePowerTransferCompanyResourcesService(Long alertCalledId, Long carId, String code,int type , String remarks) {
public void updatePowerTransferCompanyResourcesService(Long alertCalledId, Long carId, String code, int type, String remarks) {
PowerTransferCompanyResources powerTransferCompanyResources= powerTransferCompanyResourcesMapper.getByAlertCalledIdCarId(alertCalledId,carId);
PowerTransferCompanyResources powerTransferCompanyResources = powerTransferCompanyResourcesMapper.getByAlertCalledIdCarId(alertCalledId, carId);
try {
if(type==2){
if (type == 2) {
powerTransferCompanyResources.setStatus(code);
powerTransferCompanyResources.setRemarks(remarks);
powerTransferCompanyResourcesMapper.updateById(powerTransferCompanyResources);
List<Object> carStatusInfoDtoList = new ArrayList();
//修改装备信息
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId+"");
carStatusInfo.setSequenceNbr(carId + "");
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
}else{
} else {
powerTransferCompanyResources.setCarStatus(code);
powerTransferCompanyResources.setRemarks(remarks);
powerTransferCompanyResourcesMapper.updateById(powerTransferCompanyResources);
}
} catch (Exception e) {
throw new RuntimeException("修改失败!");
throw new RuntimeException("修改失败!");
}
}
@Override
public PowerTransferCompanyResources getResourceById(String resourceId) {
QueryWrapper<PowerTransferCompanyResources> powerTransferCompanyResourcesQueryWrapper = new QueryWrapper<>();
powerTransferCompanyResourcesQueryWrapper.eq("resources_id", resourceId);
return powerTransferCompanyResourcesMapper.selectOne(powerTransferCompanyResourcesQueryWrapper);
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import com.yeejoin.amos.boot.module.jcs.api.enums.AircraftFileTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AircraftMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAircraftService;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyResourcesService;
import com.yeejoin.amos.boot.module.jcs.api.service.IUserCarService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -49,6 +23,11 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
@Autowired
UserCarMapper UserCarMapper;
@Autowired
IPowerTransferCompanyResourcesService companyResourcesService;
@Override
public UserCar selectByAmosUserId(Long id) {
QueryWrapper<UserCar> queryWrapper = new QueryWrapper<>();
......@@ -61,12 +40,12 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
QueryWrapper<UserCar> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_user_id", userCar.getAmosUserId());
UserCar uer= UserCarMapper.selectOne(queryWrapper);
if(uer!=null){
UserCar uer = UserCarMapper.selectOne(queryWrapper);
if (uer != null) {
userCar.setSequenceNbr(uer.getSequenceNbr());
UserCarMapper.updateById(userCar);
}else{
UserCarMapper.insert(userCar);
} else {
UserCarMapper.insert(userCar);
}
}
......@@ -76,4 +55,22 @@ public class UserCarServiceImpl extends BaseService<AircraftDto, UserCar, UserCa
queryWrapper.eq("amos_user_id", userCar.getAmosUserId());
UserCarMapper.delete(queryWrapper);
}
@Override
public int countUserCarExecuting(Long userId) {
UserCar userCar = this.selectByAmosUserId(userId);
if (userCar == null) {
return 0;
}
PowerTransferCompanyResources resource = companyResourcesService.getResourceById(userCar.getCarId().toString());
if (resource == null) {
return 0;
}
if ("executing".equals(resource.getCarStatus())) {
return 1;
} else {
return 0;
}
}
}
......@@ -242,7 +242,7 @@ public class PlanTaskController extends AbstractBaseController {
* 根据点查询用户权限所有巡检执行计划
*
* @param dataType 数据类型
* @param serial 巡检点编号
* @param pointNo 巡检点编号
* @param planTaskId 巡检任务Id
* @return
*/
......
......@@ -22,12 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -515,6 +510,27 @@ public class PlanTaskController extends AbstractBaseController {
return ResponseHelper.buildResponse(planTaskService.getPlanTasks(params, pageable));
}
/**
* 根据用户统计待办任务数量
*
* @param userId 用户id
* @return 统计数量
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防监督待办任务查询-mobile", notes = "根据用户查询执行中的任务")
@GetMapping("/countWaitingTaskByUser")
public CommonResponse countWaitingTaskByUser(
@ApiParam(value = "用户ID") @RequestParam("userId") String userId
) {
try {
return CommonResponseUtil.success(planTaskService.countWaitingTaskByUser(userId));
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure(e.getMessage());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据检查任务ID查询计划任务详情和任务点(<font color='blue'>手机app</font>)", notes = "根据检查任务ID查询计划任务详情和任务点(<font color='blue'>手机app</font>)")
@RequestMapping(value = "/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
......
......@@ -43,6 +43,7 @@ import com.yeejoin.amos.supervision.exception.YeeException;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import com.yeejoin.amos.supervision.quartz.IJobService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.assertj.core.util.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -608,6 +609,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public int countWaitingTaskByUser(String userId) {
return planTaskMapper.countWaitingTaskByUser(userId);
}
@Override
public Map queryPlanTaskById(Long planTaskId) {
Map map = new HashMap();
map = planTaskMapper.queryPlanTaskById(planTaskId);
......@@ -619,7 +625,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public Page<Map<String, Object>> getPlanTaskPoints(HashMap<String, Object> params, CommonPageable pageable) {
public Page<Map<String, Object>> getPlanTaskPoints(HashMap<String, Object> params, CommonPageable pageable) {
List<Map<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTaskPointsCount(params);
if (total == 0) {
......
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.supervision.business.vo.CodeOrderVo;
import com.yeejoin.amos.supervision.business.vo.LeavePlanTaskVo;
import com.yeejoin.amos.supervision.business.vo.PlanTaskVo;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Page;
import com.yeejoin.amos.supervision.business.param.CheckPtListPageParam;
......@@ -20,133 +21,154 @@ import com.yeejoin.amos.supervision.dao.entity.PlanTask;
public interface IPlanTaskService {
/**
* 计划执行查询
*/
Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params);
/**
* 计划执行重做
*/
void reGenPlanTask(HashMap<String, Object> param) throws ParseException;
/**
* 计划执行删除
*/
void planTaskDet(String[] strArry);
/**
* 执行计划导出
*/
List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam params);
/**
* 自动任务执行
* @param runDate
*/
void taskExecution(String runDate);
/**
* 根据路线id获取关联的所有计划任务
*
* @param routeId
* @return
*/
List<PlanTask> getPlanTaskByRouteId(Long routeId);
/**
* 停用计划任务
*
* @param routeIds
*/
void disablePlanTask(Long[] routeIds);
/**
* app 根据条件查询用户权限内所有当前巡检计划任务
* @param params
* @return
*/
List getPlanTaskInfo(HashMap<String, Object> params);
/**
* 根据计划任务ID查询任务想起
* @param id
* @return
*/
public Map findPlanTaskByTaskIdAndPointId(long id, long pointId);
/**
* 天剑查询假话任务信息
* @param params
* @param page
* @return
*/
Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable page);
/**
* 根据计划任务Id获取计划任务信息
* @param planTaskId
* @return
*/
Map queryPlanTaskById(Long planTaskId);
/**
* 根据计划ID获取所有的 任务计划巡检点
* @param params
* @return
*/
Page<Map<String, Object>> getPlanTaskPoints(HashMap<String, Object> params, CommonPageable pageable);
/**
* 获取用户当前所有有的计划任务
* @param userId
* @return
*/
int getCurrentPlanTaskCount(String userId);
/**
* 计划执行查询
*/
Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params);
/**
* 计划执行重做
*/
void reGenPlanTask(HashMap<String, Object> param) throws ParseException;
/**
* 计划执行删除
*/
void planTaskDet(String[] strArry);
/**
* 执行计划导出
*/
List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam params);
/**
* 自动任务执行
*
* @param runDate
*/
void taskExecution(String runDate);
/**
* 根据路线id获取关联的所有计划任务
*
* @param routeId
* @return
*/
List<PlanTask> getPlanTaskByRouteId(Long routeId);
/**
* 停用计划任务
*
* @param routeIds
*/
void disablePlanTask(Long[] routeIds);
/**
* app 根据条件查询用户权限内所有当前巡检计划任务
*
* @param params
* @return
*/
List getPlanTaskInfo(HashMap<String, Object> params);
/**
* 根据计划任务ID查询任务想起
*
* @param id
* @return
*/
public Map findPlanTaskByTaskIdAndPointId(long id, long pointId);
/**
* 天剑查询假话任务信息
*
* @param params
* @param page
* @return
*/
Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable page);
/**
* 根据用户统计待办任务数量
*
* @param userId 用户id
* @return 统计数量
*/
int countWaitingTaskByUser(String userId);
/**
* 根据计划任务Id获取计划任务信息
*
* @param planTaskId
* @return
*/
Map queryPlanTaskById(Long planTaskId);
/**
* 根据计划ID获取所有的 任务计划巡检点
*
* @param params
* @return
*/
Page<Map<String, Object>> getPlanTaskPoints(HashMap<String, Object> params, CommonPageable pageable);
/**
* 获取用户当前所有有的计划任务
*
* @param userId
* @return
*/
int getCurrentPlanTaskCount(String userId);
/**
* 今日执行情况
*
* @param params
* @return
*/
Page<CheckChkExListBo> getChkExList(String toke, String product, String appKey, CheckPtListPageParam params);
Page<CheckChkExListBo> getChkExList(String toke, String product, String appKey, CheckPtListPageParam params);
/**
* 根据id获取执行计划
* @param ids
* @return
*/
List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids);
/**
* 根据id获取执行计划
*
* @param ids
* @return
*/
List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids);
/**
* 根据任务id点id 获取点详情
* @param planTaskId
* @param pointId
* @return
*/
AppPointCheckRespone queryPointPlanTaskDetail(String toke,String product,String appKey,Long planTaskId,Long pointId);
/**
* 根据任务id点id 获取点详情
*
* @param planTaskId
* @param pointId
* @return
*/
AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId);
AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke,String product,String appKey,Long planTaskId,Long pointId);
AppPointCheckRespone queryPointPlanTaskDetailInVersion2(String toke, String product, String appKey, Long planTaskId, Long pointId);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
/**
* 获取公司计划累计情况
* @param loginOrgCode
* @return
*/
String getCumulativePlanCountByOrgCode(String loginOrgCode);
/**
* 获取公司计划累计情况
*
* @param loginOrgCode
* @return
*/
String getCumulativePlanCountByOrgCode(String loginOrgCode);
List<LeavePlanTaskVo> queryLeavePlanTask(HashMap<String, Object> params);
List<LeavePlanTaskVo> queryLeavePlanTask(HashMap<String, Object> params);
List<CodeOrderVo> queryCodeOrderVo(HashMap<String, Object> params);
List<CodeOrderVo> queryCodeOrderVo(HashMap<String, Object> params);
PlanTask selectPlanTaskStatus(Long id);
PlanTask selectPlanTaskStatus(Long id);
public void reformStatisticsPlanTask(String strBginDate, String strEndDate, String userId, String orgCode) throws ParseException;
public void reformStatisticsPlanTask(String strBginDate, String strEndDate, String userId, String orgCode) throws ParseException;
void initPlanStatusOrGenDate();
void initPlanStatusOrGenDate();
List<Map<String,Object>> queryPlanTaskTimeAxis(Long userId,Integer createDate);
List<Map<String, Object>> queryPlanTaskTimeAxis(Long userId, Integer createDate);
List<Map<String,Object>> queryTimeAxis(Long userId,Integer createDate);
List<Map<String, Object>> queryTimeAxis(Long userId, Integer createDate);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment