/** | /** | ||||
* 管理员列表接口 | * 管理员列表接口 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 编辑-提交接口 | * 编辑-提交接口 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping(value = "/edit") | @PostMapping(value = "/edit") | ||||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | @RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | ||||
public Response edit(@RequestBody @Valid SysAdmin map, BindingResult bindingResult) { | public Response edit(@RequestBody @Valid SysAdmin map, BindingResult bindingResult) { | ||||
if(bindingResult.hasErrors()){ | |||||
if (bindingResult.hasErrors()) { | |||||
String msg = bindingResult.getFieldError().getDefaultMessage(); | String msg = bindingResult.getFieldError().getDefaultMessage(); | ||||
return response.failure(msg); | return response.failure(msg); | ||||
} | } | ||||
/** | /** | ||||
* 编辑-获取原数据接口 | * 编辑-获取原数据接口 | ||||
* | |||||
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 添加管理员 | * 添加管理员 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping("/add") | @PostMapping("/add") | ||||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | @RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | ||||
public Response add(@RequestBody @Valid SysAdmin map, BindingResult bindingResult) { | public Response add(@RequestBody @Valid SysAdmin map, BindingResult bindingResult) { | ||||
if(bindingResult.hasErrors()){ | |||||
if (bindingResult.hasErrors()) { | |||||
String msg = bindingResult.getFieldError().getDefaultMessage(); | String msg = bindingResult.getFieldError().getDefaultMessage(); | ||||
return response.failure(msg); | return response.failure(msg); | ||||
} | } | ||||
/** | /** | ||||
* 删除管理员账号 | * 删除管理员账号 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 重置密码接口 | * 重置密码接口 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 修改账户状态接口 | * 修改账户状态接口 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 设置账户权限接口 | * 设置账户权限接口 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping("/setPermit") | @PostMapping("/setPermit") | ||||
@RequiresPermissions("admin:setPermit") | @RequiresPermissions("admin:setPermit") | ||||
public Response setPermit(@RequestBody (required = false) Map<String,String> map) { | |||||
public Response setPermit(@RequestBody(required = false) Map<String, String> map) { | |||||
return iSysAdminService.setPermit(map); | return iSysAdminService.setPermit(map); | ||||
} | } | ||||
/** | /** | ||||
* 获取所有管理员(组装option用) | * 获取所有管理员(组装option用) | ||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping("/getAdminList") | @PostMapping("/getAdminList") | ||||
/** | /** | ||||
* 获取角色数组 | * 获取角色数组 | ||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping("/authList") | @PostMapping("/authList") | ||||
/** | /** | ||||
* 获取城市数组 | * 获取城市数组 | ||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
@GetMapping("/getCityList") | @GetMapping("/getCityList") | ||||
List<Map<String, Object>> cityList = cityService.listMaps(wrapper); | List<Map<String, Object>> cityList = cityService.listMaps(wrapper); | ||||
return response.success("操作成功", cityList); | return response.success("操作成功", cityList); | ||||
} | } | ||||
/** | |||||
* 获取飞手列表【分配任务时使用】 | |||||
* | |||||
* @return | |||||
*/ | |||||
@PostMapping("/getFlyHandList") | |||||
public Response getFlyHandList() { | |||||
return response.success(iSysAdminService.getAdminListByGroupId(6)); | |||||
} | |||||
} | } |
import com.taauav.common.constant.PermissionConstants; | import com.taauav.common.constant.PermissionConstants; | ||||
import com.taauav.admin.entity.TauvEquipment; | import com.taauav.admin.entity.TauvEquipment; | ||||
import com.taauav.admin.service.ITauvEquipmentService; | import com.taauav.admin.service.ITauvEquipmentService; | ||||
import com.taauav.common.util.DateUtil; | |||||
import com.taauav.common.util.FunctionUtils; | import com.taauav.common.util.FunctionUtils; | ||||
import org.apache.commons.lang3.time.DateUtils; | |||||
import org.apache.shiro.authz.annotation.RequiresPermissions; | import org.apache.shiro.authz.annotation.RequiresPermissions; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.util.StringUtils; | import org.springframework.util.StringUtils; | ||||
return response.failure("数据不存在"); | return response.failure("数据不存在"); | ||||
} | } | ||||
Map<String, Object> info = FunctionUtils.transBean2Map(equipment); | Map<String, Object> info = FunctionUtils.transBean2Map(equipment); | ||||
info.put("format_register_time", FunctionUtils.formatTime(equipment.getRegisterTime(), "yyyy-MM-dd HH:mm:ss")); | |||||
info.put("format_register_time", DateUtil.format(equipment.getRegisterTime(), "yyyy-MM-dd HH:mm:ss")); | |||||
info.put("typeList", equipment.getTypeList()); | info.put("typeList", equipment.getTypeList()); | ||||
info.put("statusList", equipment.getStatusList()); | info.put("statusList", equipment.getStatusList()); | ||||
return response.success(info); | return response.success(info); | ||||
public Response getBaseData() { | public Response getBaseData() { | ||||
return response.success(iTauvEquipmentService.getBaseData()); | return response.success(iTauvEquipmentService.getBaseData()); | ||||
} | } | ||||
/** | |||||
* 获取无人机设备列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
@PostMapping("/getEquipmentList") | |||||
public Response getEquipmentList(@RequestBody EquipmentQuery query) { | |||||
return iTauvEquipmentService.getEquipmentList(query); | |||||
} | |||||
} | } |
package com.taauav.admin.controller; | package com.taauav.admin.controller; | ||||
import com.taauav.admin.dto.TauvInspectDriverAssignTaskDTO; | |||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.common.constant.PermissionConstants; | import com.taauav.common.constant.PermissionConstants; | ||||
import com.taauav.admin.entity.TauvInspect; | import com.taauav.admin.entity.TauvInspect; | ||||
} | } | ||||
String status = "status"; | String status = "status"; | ||||
if (map.containsKey(status) && !"".equals(map.get(status))) { | if (map.containsKey(status) && !"".equals(map.get(status))) { | ||||
map.put("status", new Byte[]{Byte.valueOf(map.get(status).toString())}); | |||||
map.put("status", Integer.valueOf(map.get(status).toString())); | |||||
} else { | } else { | ||||
map.put("status", new Byte[]{2, 3, 4, 5, 6}); | map.put("status", new Byte[]{2, 3, 4, 5, 6}); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* 分配任务 | |||||
* 获取待分类任务列表 | |||||
* | * | ||||
* @param map | |||||
* @param inspectDriverIds 待分配任务ID集合 | |||||
* @return | |||||
*/ | |||||
@GetMapping("/getAssignTaskList") | |||||
public Response getAssignTaskList(String inspectDriverIds) { | |||||
return iTauvInspectDriverService.getAssignTaskList(inspectDriverIds); | |||||
} | |||||
/** | |||||
* 分配 | |||||
* | |||||
* @param inspectDriverAssignTaskDTO | |||||
* @return | * @return | ||||
*/ | */ | ||||
@RequestMapping("/assignTask") | @RequestMapping("/assignTask") | ||||
@RequiresPermissions(controllerName + ":assign") | @RequiresPermissions(controllerName + ":assign") | ||||
public Response assignTask(@RequestBody Map<String, String> map) { | |||||
return iTauvInspectDriverService.assignTask(map); | |||||
public Response assignTask(@RequestBody TauvInspectDriverAssignTaskDTO inspectDriverAssignTaskDTO) { | |||||
return iTauvInspectDriverService.assignTask(inspectDriverAssignTaskDTO); | |||||
} | } | ||||
/** | /** |
return tauvMountEquipmentService.getParamsList(); | return tauvMountEquipmentService.getParamsList(); | ||||
} | } | ||||
/** | |||||
* 获取挂载设备列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
@PostMapping("/getMountEquipmentList") | |||||
public Response getMountEquipmentList(@RequestBody MountEquipmentQuery query) { | |||||
return tauvMountEquipmentService.getMountEquipmentList(query); | |||||
} | |||||
} | } |
package com.taauav.admin.dto; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.taauav.admin.entity.TauvInspectDriver; | |||||
import lombok.Data; | |||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
@Data | |||||
public class TauvInspectDriverAssignTaskDTO { | |||||
/** | |||||
* 分配河流列表 | |||||
*/ | |||||
List<TauvInspectDriver> inspectDrivers; | |||||
/** | |||||
* 飞手ID | |||||
*/ | |||||
private Integer adminId; | |||||
/** | |||||
* 无人机设备ID | |||||
*/ | |||||
private Integer equipmentId; | |||||
/** | |||||
* 挂载设备ID | |||||
*/ | |||||
private Integer mountequipmentId; | |||||
/** | |||||
* 执行时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date executionTime; | |||||
} |
package com.taauav.admin.dto; | package com.taauav.admin.dto; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import lombok.Data; | import lombok.Data; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import java.util.Date; | |||||
/** | /** | ||||
* 分区统计 | * 分区统计 | ||||
/** | /** | ||||
* 巡检时间 | * 巡检时间 | ||||
*/ | */ | ||||
private Integer inspectTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date inspectTime; | |||||
/** | /** | ||||
* 格式化巡检时间 | * 格式化巡检时间 |
package com.taauav.admin.entity; | package com.taauav.admin.entity; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.util.Date; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Map; | import java.util.Map; | ||||
import com.baomidou.mybatisplus.annotation.IdType; | import com.baomidou.mybatisplus.annotation.IdType; | ||||
import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.taauav.common.domain.Entity; | import com.taauav.common.domain.Entity; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||
import org.hibernate.validator.constraints.Length; | import org.hibernate.validator.constraints.Length; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.NotEmpty; | import javax.validation.constraints.NotEmpty; | ||||
/** | /** | ||||
* 注册时间 | * 注册时间 | ||||
*/ | */ | ||||
private Integer registerTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date registerTime; | |||||
public Map<Integer, String> getStatusList() { | public Map<Integer, String> getStatusList() { | ||||
Map<Integer, String> map = new HashMap<>(); | Map<Integer, String> map = new HashMap<>(); |
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.math.BigInteger; | import java.math.BigInteger; | ||||
import java.util.Date; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.taauav.common.domain.Entity; | import com.taauav.common.domain.Entity; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.NotEmpty; | import javax.validation.constraints.NotEmpty; | ||||
@Data | @Data | ||||
@EqualsAndHashCode(callSuper = false) | @EqualsAndHashCode(callSuper = false) | ||||
@Accessors(chain = true) | @Accessors(chain = true) | ||||
public class TauvInspectDriver extends Entity implements Serializable { | |||||
public class TauvInspectDriver extends Entity { | |||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
private String driverEnd; | private String driverEnd; | ||||
/** | /** | ||||
* 河流位置 | |||||
* 河流图片 | |||||
*/ | */ | ||||
private String driverImage; | private String driverImage; | ||||
/** | |||||
* 航线文件名 | |||||
*/ | |||||
private String driverFilename; | |||||
/** | |||||
* 航线文件 | |||||
*/ | |||||
private String driverFile; | |||||
/** | /** | ||||
* 河流备注 | * 河流备注 | ||||
*/ | */ | ||||
private String driverNote; | private String driverNote; | ||||
/** | /** | ||||
* 飞行小组 | |||||
* 飞行设备ID | |||||
*/ | |||||
private Integer equipmentId; | |||||
/** | |||||
* 挂载设备ID | |||||
*/ | */ | ||||
private Integer flightGroup; | |||||
private Integer mountequipmentId; | |||||
/** | /** | ||||
* 执行开始时间 | |||||
* 飞手ID | |||||
*/ | */ | ||||
private Integer executionStartTime; | |||||
private Integer flightHand; | |||||
/** | /** | ||||
* 执行结束时间 | |||||
* 执行时间 | |||||
*/ | */ | ||||
private Integer executionEndTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date executionTime; | |||||
/** | /** | ||||
* 天气 | * 天气 | ||||
/** | /** | ||||
* 复核时间 | * 复核时间 | ||||
*/ | */ | ||||
private Integer reviewTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date reviewTime; | |||||
} | } |
import java.io.Serializable; | import java.io.Serializable; | ||||
import java.math.BigInteger; | import java.math.BigInteger; | ||||
import java.util.Date; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Map; | import java.util.Map; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.taauav.common.domain.Entity; | import com.taauav.common.domain.Entity; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
/** | /** | ||||
* 巡检开始时间 | * 巡检开始时间 | ||||
*/ | */ | ||||
private Integer inspectStartTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date inspectStartTime; | |||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private String formatInspectStartTime; | private String formatInspectStartTime; | ||||
/** | /** |
*/ | */ | ||||
private Integer type; | private Integer type; | ||||
/** | |||||
* 设备型号 | |||||
*/ | |||||
private String model; | |||||
} | } |
*/ | */ | ||||
private Integer type; | private Integer type; | ||||
/** | |||||
* 设备型号 | |||||
*/ | |||||
private String model; | |||||
} | } |
* @return | * @return | ||||
*/ | */ | ||||
Response getCityDriverList(Integer cityId); | Response getCityDriverList(Integer cityId); | ||||
/** | |||||
* 根据城市ID获取城市名称 | |||||
* | |||||
* @param cityId | |||||
* @return | |||||
*/ | |||||
String getCityName(BigInteger cityId); | |||||
} | } |
* @return | * @return | ||||
*/ | */ | ||||
Map<String, Object> getBaseData(); | Map<String, Object> getBaseData(); | ||||
/** | |||||
* 获取无人机列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
Response getEquipmentList(EquipmentQuery query); | |||||
} | } |
package com.taauav.admin.service; | package com.taauav.admin.service; | ||||
import com.taauav.admin.dto.TauvInspectDriverAssignTaskDTO; | |||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.admin.entity.TauvInspect; | import com.taauav.admin.entity.TauvInspect; | ||||
import com.taauav.admin.entity.TauvInspectDriver; | import com.taauav.admin.entity.TauvInspectDriver; | ||||
/** | /** | ||||
* 添加任务对应数据 | * 添加任务对应数据 | ||||
* | |||||
* @param inspect | * @param inspect | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 获取分页数据 | * 获取分页数据 | ||||
* | |||||
* @param map | * @param map | ||||
* @param act | * @param act | ||||
* @return | * @return | ||||
*/ | */ | ||||
Response getPageList(Map<String,Object> map, String act); | |||||
Response getPageList(Map<String, Object> map, String act); | |||||
/** | /** | ||||
* 根据id获取数据 | * 根据id获取数据 | ||||
* | |||||
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
TauvInspectDriver getInfoById(Integer id); | TauvInspectDriver getInfoById(Integer id); | ||||
/** | /** | ||||
* 批量分配任务 | |||||
* @param map | |||||
* 待分类任务ID集合 | |||||
* | |||||
* @param inspectDriverIds | |||||
* @return | * @return | ||||
*/ | */ | ||||
Response assignTask(Map<String,String> map); | |||||
Response getAssignTaskList(String inspectDriverIds); | |||||
/** | /** | ||||
* 分配任务 | |||||
* @param id | |||||
* @param flightGroupId | |||||
* 批量分配任务 | |||||
* | |||||
* @param inspectDriverAssignTaskDTO | |||||
* @return | * @return | ||||
*/ | */ | ||||
boolean assignFlightGroup(Integer id,Integer flightGroupId); | |||||
Response assignTask(TauvInspectDriverAssignTaskDTO inspectDriverAssignTaskDTO); | |||||
// /** | |||||
// * 分配任务 | |||||
// * | |||||
// * @param id | |||||
// * @param flightGroupId | |||||
// * @return | |||||
// */ | |||||
// boolean assignFlightGroup(Integer id, Integer flightGroupId); | |||||
/** | /** | ||||
* 任务详情 | * 任务详情 | ||||
* | |||||
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
Map<String,Object> detail(Integer id); | |||||
Map<String, Object> detail(Integer id); | |||||
/** | /** | ||||
* 取消任务 | * 取消任务 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
Response cancel(Map<String,String> map); | |||||
Response cancel(Map<String, String> map); | |||||
/** | /** | ||||
* 执行任务 | * 执行任务 | ||||
* | |||||
* @param executeTask | * @param executeTask | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 获取打印数据 | * 获取打印数据 | ||||
* | |||||
* @param id | * @param id | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 判断是否已生成报告 | * 判断是否已生成报告 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 删除任务 | * 删除任务 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* 重处理任务 | * 重处理任务 | ||||
* | |||||
* @param map | * @param map | ||||
* @return | * @return | ||||
*/ | */ |
*/ | */ | ||||
Response getParamsList(); | Response getParamsList(); | ||||
/** | |||||
* 获取挂载设备列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
Response getMountEquipmentList(MountEquipmentQuery query); | |||||
} | } |
import com.taauav.admin.service.ISysCityService; | import com.taauav.admin.service.ISysCityService; | ||||
import com.taauav.admin.service.ITauvInspectFileService; | import com.taauav.admin.service.ITauvInspectFileService; | ||||
import com.taauav.admin.service.ITauvReportService; | import com.taauav.admin.service.ITauvReportService; | ||||
import com.taauav.common.util.DateUtil; | |||||
import com.taauav.common.util.FunctionUtils; | import com.taauav.common.util.FunctionUtils; | ||||
import com.taauav.common.util.ShiroUtils; | import com.taauav.common.util.ShiroUtils; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
info.setDriverName(report.getDriverName()); | info.setDriverName(report.getDriverName()); | ||||
info.setInspectTime(report.getInspectStartTime()); | info.setInspectTime(report.getInspectStartTime()); | ||||
if (!StringUtils.isEmpty(report.getInspectStartTime())) { | if (!StringUtils.isEmpty(report.getInspectStartTime())) { | ||||
info.setFormatInspectStartTime(FunctionUtils.formatTime(report.getInspectStartTime(),"yyyy-MM-dd HH:mm:ss")); | |||||
info.setFormatInspectStartTime(DateUtil.format(report.getInspectStartTime(),"yyyy-MM-dd HH:mm:ss")); | |||||
} | } | ||||
info.setTotalExamineScore(report.getTotalExamineScore()); | info.setTotalExamineScore(report.getTotalExamineScore()); | ||||
List<Map<String,Object>> fileDocumentNums = iTauvInspectFileService.getNumByFileDocument(cityId, report.getInspectDriverId(), driverExam, startTime, endTime); | List<Map<String,Object>> fileDocumentNums = iTauvInspectFileService.getNumByFileDocument(cityId, report.getInspectDriverId(), driverExam, startTime, endTime); |
import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
import java.math.BigInteger; | import java.math.BigInteger; | ||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.*; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
} | } | ||||
return response.success(cityList); | return response.success(cityList); | ||||
} | } | ||||
/** | |||||
* 根据城市ID获取城市名称 | |||||
* | |||||
* @param cityId 城市ID | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public String getCityName(BigInteger cityId) { | |||||
List<String> nameList = new ArrayList<>(); | |||||
while (cityId != null && cityId.compareTo(BigInteger.valueOf(320117)) >= 0) { | |||||
SysCity cateInfo = sysCityMapper.selectById(cityId); | |||||
if (cateInfo != null) { | |||||
nameList.add(cateInfo.getName()); | |||||
cityId = cateInfo.getPid(); | |||||
} else { | |||||
cityId = null; | |||||
} | |||||
} | |||||
// 使用集合工具实现数组翻转 | |||||
Collections.reverse(nameList); | |||||
return org.apache.commons.lang3.StringUtils.join(nameList.toArray(), ">>"); | |||||
} | |||||
} | } |
map.put("status_list", equipment.getStatusList()); | map.put("status_list", equipment.getStatusList()); | ||||
return map; | return map; | ||||
} | } | ||||
/** | |||||
* 获取无人机列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response getEquipmentList(EquipmentQuery query) { | |||||
// 查询条件 | |||||
QueryWrapper<TauvEquipment> queryWrapper = new QueryWrapper<>(); | |||||
// 无人机类型 | |||||
if (query.getType() != null && query.getType() > 0) { | |||||
queryWrapper.eq("type", query.getType()); | |||||
} | |||||
// 无人机型号 | |||||
if (!StringUtils.isEmpty(query.getModel())) { | |||||
queryWrapper.like("model", query.getModel()); | |||||
} | |||||
queryWrapper.eq("status", 1); | |||||
queryWrapper.eq("mark", 1); | |||||
queryWrapper.orderByDesc("id"); | |||||
// 查询列表 | |||||
List<TauvEquipment> equipmentList = equipmentMapper.selectList(queryWrapper); | |||||
List<TauvEquipmentListVo> equipmentListVoList = new ArrayList<>(); | |||||
if (!equipmentList.isEmpty()) { | |||||
equipmentList.forEach(item -> { | |||||
TauvEquipmentListVo equipmentListVo = new TauvEquipmentListVo(); | |||||
// 拷贝属性 | |||||
BeanUtils.copyProperties(item, equipmentListVo); | |||||
// 设备类型 | |||||
equipmentListVo.setTypeName(item.getTypeList().get(item.getType())); | |||||
// 任务类型 | |||||
equipmentListVo.setTaskTypeName(item.getTaskTypeList().get(item.getTaskType())); | |||||
// 状态名称 | |||||
equipmentListVo.setStatusName(item.getStatusList().get(item.getStatus())); | |||||
equipmentListVoList.add(equipmentListVo); | |||||
}); | |||||
} | |||||
return response.success(equipmentListVoList); | |||||
} | |||||
} | } |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.taauav.admin.dto.TauvInspectDriverAssignTaskDTO; | |||||
import com.taauav.admin.vo.TauvInspectDriverListVo; | |||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.admin.dto.TauvInspectDriverDTO; | import com.taauav.admin.dto.TauvInspectDriverDTO; | ||||
import com.taauav.admin.entity.*; | import com.taauav.admin.entity.*; | ||||
import com.taauav.common.util.ShiroUtils; | import com.taauav.common.util.ShiroUtils; | ||||
import com.taauav.admin.validate.ExecuteTask; | import com.taauav.admin.validate.ExecuteTask; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
if (inspectDriver != null && !"".equals(inspectDriver) && inspectDriver.size() > 0) { | if (inspectDriver != null && !"".equals(inspectDriver) && inspectDriver.size() > 0) { | ||||
int i = 1; | int i = 1; | ||||
for (TauvInspectDriver driver : inspectDriver) { | for (TauvInspectDriver driver : inspectDriver) { | ||||
if (!StringUtils.isEmpty(driver.getDriverImage())) { | |||||
//如果上传了图片 对图片做处理 | |||||
String img = driver.getDriverImage(); | |||||
if (img.contains("temp")) { | |||||
img = img.replace(uploadUrl, uploadFolder); | |||||
File oldFile = new File(img); | |||||
// if (!StringUtils.isEmpty(driver.getDriverImage())) { | |||||
// //如果上传了图片 对图片做处理 | |||||
// String img = driver.getDriverImage(); | |||||
// if (img.contains("temp")) { | |||||
// img = img.replace(uploadUrl, uploadFolder); | |||||
// File oldFile = new File(img); | |||||
// if (!oldFile.exists()) { | |||||
// return "图片不存在"; | |||||
// } | |||||
// String fileName = oldFile.getName(); | |||||
// if (fileName.contains("thumbnail")) { | |||||
// fileName = fileName.replace("-thumbnail", ""); | |||||
// } | |||||
// //把文件移动到正式目录下 | |||||
// Calendar date = Calendar.getInstance(); | |||||
// String year = String.valueOf(date.get(Calendar.YEAR)); | |||||
// String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||||
// String day = String.valueOf(date.get(Calendar.DATE)); | |||||
// String destImg = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||||
// boolean flag = FileUtil.cutGeneralFile(img, destImg); | |||||
// if (flag) { | |||||
// destImg = destImg.replace(uploadFolder, ""); | |||||
// driver.setDriverImage(destImg + fileName); | |||||
// } else { | |||||
// return "图片保存失败了!"; | |||||
// } | |||||
// } | |||||
// } | |||||
if (!StringUtils.isEmpty(driver.getDriverFile())) { | |||||
// 如果上传了文件则对文件进行处理 | |||||
String file = driver.getDriverFile(); | |||||
if (file.contains("temp")) { | |||||
file = file.replace(uploadUrl, uploadFolder); | |||||
File oldFile = new File(file); | |||||
if (!oldFile.exists()) { | if (!oldFile.exists()) { | ||||
return "图片不存在"; | |||||
} | |||||
String fileName = oldFile.getName(); | |||||
if (fileName.contains("thumbnail")) { | |||||
fileName = fileName.replace("-thumbnail", ""); | |||||
return "文件不存在"; | |||||
} | } | ||||
//把文件移动到正式目录下 | //把文件移动到正式目录下 | ||||
Calendar date = Calendar.getInstance(); | Calendar date = Calendar.getInstance(); | ||||
String year = String.valueOf(date.get(Calendar.YEAR)); | String year = String.valueOf(date.get(Calendar.YEAR)); | ||||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | String month = String.valueOf(date.get(Calendar.MONTH) + 1); | ||||
String day = String.valueOf(date.get(Calendar.DATE)); | String day = String.valueOf(date.get(Calendar.DATE)); | ||||
String destImg = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||||
boolean flag = FileUtil.cutGeneralFile(img, destImg); | |||||
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||||
boolean flag = FileUtil.cutGeneralFile(file, destFile); | |||||
if (flag) { | if (flag) { | ||||
destImg = destImg.replace(uploadFolder, ""); | |||||
driver.setDriverImage(destImg + fileName); | |||||
// 文件名 | |||||
String fileName = oldFile.getName(); | |||||
destFile = destFile.replace(uploadFolder, ""); | |||||
driver.setDriverFile(destFile + fileName); | |||||
} else { | } else { | ||||
return "图片保存失败了!"; | return "图片保存失败了!"; | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* 分配任务 | |||||
* 获取待分配任务ID集合 | |||||
* | * | ||||
* @param map | |||||
* @param inspectDriverIds 待分配任务ID(多个逗号","分隔) | |||||
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
public Response assignTask(Map<String, String> map) { | |||||
if (StringUtils.isEmpty(map)) { | |||||
return response.failure("请求参数不能为空"); | |||||
} | |||||
String adminIdStr = map.getOrDefault("adminId", ""); | |||||
if (StringUtils.isEmpty(adminIdStr)) { | |||||
return response.failure("请选择分配的飞行小组"); | |||||
} | |||||
String ids = map.getOrDefault("ids", ""); | |||||
if (StringUtils.isEmpty(ids)) { | |||||
return response.failure("请选择要分配的任务"); | |||||
} | |||||
Integer adminId = Integer.valueOf(adminIdStr); | |||||
SysAdmin adminInfo = iSysAdminService.getAdminInfo(adminId); | |||||
if (StringUtils.isEmpty(adminInfo)) { | |||||
return response.failure("飞行小组不存在"); | |||||
} | |||||
String[] idsArr = ids.split(","); | |||||
String msg = ""; | |||||
for (String idStr : idsArr) { | |||||
Integer id = Integer.valueOf(idStr); | |||||
TauvInspectDriver info = getInfoById(id); | |||||
if (StringUtils.isEmpty(info)) { | |||||
msg = "编号" + id + "数据不存在"; | |||||
break; | |||||
} | |||||
public Response getAssignTaskList(String inspectDriverIds) { | |||||
// 查询条件 | |||||
QueryWrapper<TauvInspectDriver> queryWrapper = new QueryWrapper<>(); | |||||
// 待分配任务 | |||||
String arr[] = inspectDriverIds.split(","); | |||||
ArrayList arrayList = new ArrayList(); | |||||
for (String s : arr) { | |||||
arrayList.add(s); | |||||
} | |||||
queryWrapper.in("id", arrayList); | |||||
queryWrapper.eq("mark", 1); | |||||
Boolean f = assignFlightGroup(id, adminId); | |||||
if (!f) { | |||||
msg = "分配失败"; | |||||
break; | |||||
} | |||||
} | |||||
if (StringUtils.isEmpty(msg)) { | |||||
return response.success("操作成功"); | |||||
} else { | |||||
return response.failure("操作失败"); | |||||
// 查询数据 | |||||
List<TauvInspectDriver> inspectDriverList = inspectDriverMapper.selectList(queryWrapper); | |||||
List<TauvInspectDriverListVo> inspectDriverListVoList = new ArrayList<>(); | |||||
List<String> inspectTypeList = new ArrayList<>(); | |||||
if (!inspectDriverList.isEmpty()) { | |||||
inspectDriverList.forEach(item -> { | |||||
TauvInspectDriverListVo inspectDriverListVo = new TauvInspectDriverListVo(); | |||||
// 拷贝属性 | |||||
BeanUtils.copyProperties(item, inspectDriverListVo); | |||||
// 区划 | |||||
String cityName = iSysCityService.getCityName(item.getDriverArea()); | |||||
inspectDriverListVo.setDriverAreaName(cityName); | |||||
// 图片地址 | |||||
inspectDriverListVo.setDriverFile(uploadUrl + inspectDriverListVo.getDriverFile()); | |||||
// 巡检时间 | |||||
TauvInspect inspectInfo = inspectMapper.selectById(item.getInspectId()); | |||||
if (inspectInfo != null) { | |||||
inspectDriverListVo.setInspectTime(inspectInfo.getInspectTime()); | |||||
String inspectType = inspectInfo.getTypeList().get(inspectInfo.getType()); | |||||
if (!inspectTypeList.contains(inspectType)) { | |||||
inspectTypeList.add(inspectType); | |||||
} | |||||
} | |||||
inspectDriverListVoList.add(inspectDriverListVo); | |||||
}); | |||||
} | } | ||||
// 返回结果 | |||||
Map<String, Object> result = new HashMap<>(); | |||||
result.put("inspectTypeList", inspectTypeList); | |||||
result.put("inspectDriverList", inspectDriverListVoList); | |||||
return response.success(result); | |||||
} | } | ||||
/** | /** | ||||
* 分配飞行小组 | |||||
* 分配任务 | |||||
* | * | ||||
* @param id | |||||
* @param flightGroupId | |||||
* @param assignTaskDto | |||||
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
public boolean assignFlightGroup(Integer id, Integer flightGroupId) { | |||||
TauvInspectDriver inspectDriver = new TauvInspectDriver(); | |||||
inspectDriver.setId(id); | |||||
inspectDriver.setFlightGroup(flightGroupId); | |||||
inspectDriver.setStatus(Integer.valueOf("2")); | |||||
Integer res = inspectDriverMapper.updateById(inspectDriver); | |||||
if (res > 0) { | |||||
return true; | |||||
} else { | |||||
return false; | |||||
public Response assignTask(TauvInspectDriverAssignTaskDTO assignTaskDto) { | |||||
// 验证河流是否为空 | |||||
if (assignTaskDto.getInspectDrivers() == null) { | |||||
return response.failure("河流信息不存在"); | |||||
} | |||||
// 执行时间 | |||||
if (assignTaskDto.getExecutionTime() == null) { | |||||
return response.failure("执行时间不能为空"); | |||||
} | |||||
// 无人机设备校验 | |||||
if (assignTaskDto.getEquipmentId() == null || assignTaskDto.getEquipmentId() <= 0) { | |||||
return response.failure("无人机设备不能为空"); | |||||
} | |||||
// 挂载设备 | |||||
if (assignTaskDto.getMountequipmentId() == null || assignTaskDto.getMountequipmentId() <= 0) { | |||||
return response.failure("挂载设备不能为空"); | |||||
} | |||||
// 飞手校验 | |||||
if (assignTaskDto.getAdminId() == null || assignTaskDto.getAdminId() <= 0) { | |||||
return response.failure("飞手不能为空"); | |||||
} | |||||
// 循环遍历河流信息 | |||||
Integer totalNum = 0; | |||||
for (TauvInspectDriver inspectDriver : assignTaskDto.getInspectDrivers()) { | |||||
if (inspectDriver.getId() == null || inspectDriver.getId() <= 0) { | |||||
continue; | |||||
} | |||||
// 执行时间 | |||||
inspectDriver.setExecutionTime(assignTaskDto.getExecutionTime()); | |||||
// 无人机设备 | |||||
inspectDriver.setEquipmentId(assignTaskDto.getEquipmentId()); | |||||
// 挂载设备 | |||||
inspectDriver.setMountequipmentId(assignTaskDto.getMountequipmentId()); | |||||
// 飞手 | |||||
inspectDriver.setFlightHand(assignTaskDto.getAdminId()); | |||||
// 设置已分配状态 | |||||
inspectDriver.setStatus(2); | |||||
// 更新巡检河流信息 | |||||
boolean result = this.editData(inspectDriver); | |||||
if (result) { | |||||
totalNum++; | |||||
} | |||||
} | |||||
if (totalNum == assignTaskDto.getInspectDrivers().size()) { | |||||
return response.success("任务分配成功"); | |||||
} | } | ||||
return response.failure("任务分配失败"); | |||||
} | } | ||||
// /** | |||||
// * 分配任务 | |||||
// * | |||||
// * @param map | |||||
// * @return | |||||
// */ | |||||
// | |||||
// @Override | |||||
// public Response assignTask(Map<String, String> map) { | |||||
// if (StringUtils.isEmpty(map)) { | |||||
// return response.failure("请求参数不能为空"); | |||||
// } | |||||
// String adminIdStr = map.getOrDefault("adminId", ""); | |||||
// if (StringUtils.isEmpty(adminIdStr)) { | |||||
// return response.failure("请选择分配的飞行小组"); | |||||
// } | |||||
// String ids = map.getOrDefault("ids", ""); | |||||
// if (StringUtils.isEmpty(ids)) { | |||||
// return response.failure("请选择要分配的任务"); | |||||
// } | |||||
// Integer adminId = Integer.valueOf(adminIdStr); | |||||
// SysAdmin adminInfo = iSysAdminService.getAdminInfo(adminId); | |||||
// if (StringUtils.isEmpty(adminInfo)) { | |||||
// return response.failure("飞行小组不存在"); | |||||
// } | |||||
// String[] idsArr = ids.split(","); | |||||
// String msg = ""; | |||||
// for (String idStr : idsArr) { | |||||
// Integer id = Integer.valueOf(idStr); | |||||
// TauvInspectDriver info = getInfoById(id); | |||||
// if (StringUtils.isEmpty(info)) { | |||||
// msg = "编号" + id + "数据不存在"; | |||||
// break; | |||||
// } | |||||
// | |||||
// Boolean f = assignFlightGroup(id, adminId); | |||||
// if (!f) { | |||||
// msg = "分配失败"; | |||||
// break; | |||||
// } | |||||
// } | |||||
// if (StringUtils.isEmpty(msg)) { | |||||
// return response.success("操作成功"); | |||||
// } else { | |||||
// return response.failure("操作失败"); | |||||
// } | |||||
// } | |||||
// /** | |||||
// * 分配飞行小组 | |||||
// * | |||||
// * @param id | |||||
// * @param flightGroupId | |||||
// * @return | |||||
// */ | |||||
// @Override | |||||
// public boolean assignFlightGroup(Integer id, Integer flightGroupId) { | |||||
// TauvInspectDriver inspectDriver = new TauvInspectDriver(); | |||||
// inspectDriver.setId(id); | |||||
// inspectDriver.setFlightHand(flightGroupId); | |||||
// inspectDriver.setStatus(Integer.valueOf("2")); | |||||
// Integer res = inspectDriverMapper.updateById(inspectDriver); | |||||
// if (res > 0) { | |||||
// return true; | |||||
// } else { | |||||
// return false; | |||||
// } | |||||
// } | |||||
/** | /** | ||||
* 详情 | * 详情 | ||||
* | * | ||||
if (StringUtils.isEmpty(driverArea)) { | if (StringUtils.isEmpty(driverArea)) { | ||||
detail.put("driverArea", ""); | detail.put("driverArea", ""); | ||||
} else { | } else { | ||||
SysCity cityInfo = iSysCityService.getInfoById(driverArea); | |||||
detail.put("driverArea", StringUtils.isEmpty(cityInfo) ? "" : cityInfo.getName()); | |||||
// SysCity cityInfo = iSysCityService.getInfoById(driverArea); | |||||
// detail.put("driverArea", StringUtils.isEmpty(cityInfo) ? "" : cityInfo.getName()); | |||||
String cityName = iSysCityService.getCityName(driverArea); | |||||
detail.put("driverArea", cityName); | |||||
} | } | ||||
String executionTime = ""; | |||||
if (info.getExecutionStartTime() > 0) { | |||||
executionTime = FunctionUtils.formatTime(info.getExecutionStartTime(), "yyyy-MM-dd HH:mm:ss"); | |||||
} | |||||
detail.put("executionTime", executionTime); | |||||
// detail.put("executionTime", executionTime); | |||||
detail.put("driverStart", info.getDriverStart()); | detail.put("driverStart", info.getDriverStart()); | ||||
detail.put("driverEnd", info.getDriverEnd()); | detail.put("driverEnd", info.getDriverEnd()); | ||||
detail.put("driverLength", info.getDriverLength()); | detail.put("driverLength", info.getDriverLength()); | ||||
detail.put("flightTime", info.getFlightTime()); | detail.put("flightTime", info.getFlightTime()); | ||||
detail.put("flightHeight", info.getFlightHeight()); | detail.put("flightHeight", info.getFlightHeight()); | ||||
detail.put("flightSpeed", info.getFlightSpeed()); | detail.put("flightSpeed", info.getFlightSpeed()); | ||||
detail.put("flightGroup", info.getFlightGroup()); | |||||
// detail.put("inspectTime", inspectInfo.getinspectTime()); | |||||
detail.put("inspectTime", inspectInfo.getInspectTime()); | |||||
//图片位置信息 | |||||
if (!"".equals(info.getDriverImage())) { | |||||
info.setDriverImage(uploadUrl + info.getDriverImage()); | |||||
} | |||||
detail.put("driverImage", info.getDriverImage()); | |||||
detail.put("flightGroup", info.getFlightHand()); | |||||
// 巡检时间 | |||||
String inspectTime = ""; | |||||
if (!StringUtils.isEmpty(inspectInfo.getInspectTime())) { | |||||
inspectTime = DateUtil.format(inspectInfo.getInspectTime(), "yyyy-MM-dd HH:mm:ss"); | |||||
} | |||||
detail.put("inspectTime", inspectTime); | |||||
// detail.put("inspectTime", inspectInfo.getInspectTime()); | |||||
// //图片位置信息 | |||||
// if (!"".equals(info.getDriverImage())) { | |||||
// info.setDriverImage(uploadUrl + info.getDriverImage()); | |||||
// } | |||||
// detail.put("driverImage", info.getDriverImage()); | |||||
// //巡检目的 | // //巡检目的 | ||||
// detail.put("inspectPurpose", inspectInfo.getInspectPurpose()); | // detail.put("inspectPurpose", inspectInfo.getInspectPurpose()); | ||||
// //巡检结果 | // //巡检结果 | ||||
// 备注 | // 备注 | ||||
detail.put("note", inspectInfo.getNote()); | detail.put("note", inspectInfo.getNote()); | ||||
//执行时间 | //执行时间 | ||||
detail.put("executionStartTime", info.getExecutionStartTime()); | |||||
String executionTime = ""; | |||||
if (info.getExecutionTime() != null) { | |||||
executionTime = DateUtil.format(info.getExecutionTime(), "yyyy-MM-dd HH:mm:ss"); | |||||
} | |||||
detail.put("executionTime", executionTime); | |||||
return detail; | return detail; | ||||
} | } | ||||
*/ | */ | ||||
@Override | @Override | ||||
public Response executeTask(ExecuteTask task) { | public Response executeTask(ExecuteTask task) { | ||||
String executionStartTime = task.getExecutionStartTime(); | |||||
String executionEndTime = task.getExecutionEndTime(); | |||||
// String executionTime = task.getExecutionTime(); | |||||
Integer id = Integer.valueOf(task.getId()); | Integer id = Integer.valueOf(task.getId()); | ||||
Integer adminId = ShiroUtils.getAdminId(); | Integer adminId = ShiroUtils.getAdminId(); | ||||
TauvInspectDriver info = getInfoById(id); | TauvInspectDriver info = getInfoById(id); | ||||
if (StringUtils.isEmpty(info)) { | if (StringUtils.isEmpty(info)) { | ||||
return response.failure("数据不存在"); | return response.failure("数据不存在"); | ||||
} | } | ||||
Integer fligGroup = info.getFlightGroup(); | |||||
Integer fligGroup = info.getFlightHand(); | |||||
if (!fligGroup.equals(adminId) && !fligGroup.equals(1)) { | if (!fligGroup.equals(adminId) && !fligGroup.equals(1)) { | ||||
response.failure("只有被分配的小组才有权限"); | response.failure("只有被分配的小组才有权限"); | ||||
} | } | ||||
TauvInspectDriver inspectDriver = new TauvInspectDriver(); | TauvInspectDriver inspectDriver = new TauvInspectDriver(); | ||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
inspectDriver.setWeather(task.getWeather()); | inspectDriver.setWeather(task.getWeather()); | ||||
inspectDriver.setWind(task.getWind()); | inspectDriver.setWind(task.getWind()); | ||||
inspectDriver.setFlightSpeed(new BigDecimal(task.getFlightSpeed())); | inspectDriver.setFlightSpeed(new BigDecimal(task.getFlightSpeed())); | ||||
inspectDriver.setFlightTime(new BigDecimal(task.getFlightTime())); | inspectDriver.setFlightTime(new BigDecimal(task.getFlightTime())); | ||||
inspectDriver.setRemark(task.getRemark()); | inspectDriver.setRemark(task.getRemark()); | ||||
inspectDriver.setStatus(Integer.valueOf("3")); | |||||
inspectDriver.setFlightGroup(adminId); | |||||
inspectDriver.setExecutionStartTime(Integer.valueOf(executionStartTime)); | |||||
inspectDriver.setExecutionEndTime(Integer.valueOf(executionEndTime)); | |||||
inspectDriver.setStatus(3); | |||||
inspectDriver.setFlightHand(adminId); | |||||
inspectDriver.setExecutionTime(task.getExecutionTime()); | |||||
inspectDriver.setId(id); | inspectDriver.setId(id); | ||||
inspectDriverMapper.updateById(inspectDriver); | inspectDriverMapper.updateById(inspectDriver); | ||||
return response.success("执行成功"); | return response.success("执行成功"); |
import com.taauav.common.util.*; | import com.taauav.common.util.*; | ||||
import org.apache.commons.beanutils.ConvertUtils; | import org.apache.commons.beanutils.ConvertUtils; | ||||
import org.apache.commons.codec.digest.DigestUtils; | import org.apache.commons.codec.digest.DigestUtils; | ||||
import org.apache.commons.lang3.time.DateUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
driver.setId(inspectDriverId); | driver.setId(inspectDriverId); | ||||
driver.setStatus(Integer.valueOf("5")); | driver.setStatus(Integer.valueOf("5")); | ||||
driver.setReviewUser(ShiroUtils.getAdminId()); | driver.setReviewUser(ShiroUtils.getAdminId()); | ||||
driver.setReviewTime(FunctionUtils.getCurrentTime()); | |||||
driver.setReviewTime(DateUtil.now()); | |||||
inspectDriverMapper.updateById(driver); | inspectDriverMapper.updateById(driver); | ||||
return response.success("复核成功"); | return response.success("复核成功"); | ||||
} | } | ||||
return response.failure("数据不存在"); | return response.failure("数据不存在"); | ||||
} | } | ||||
info.setStatus(Integer.valueOf("6")); | info.setStatus(Integer.valueOf("6")); | ||||
info.setReviewTime(FunctionUtils.getCurrentTime()); | |||||
info.setReviewTime(DateUtil.now()); | |||||
info.setReviewUser(ShiroUtils.getAdminId()); | info.setReviewUser(ShiroUtils.getAdminId()); | ||||
inspectDriverMapper.updateById(info); | inspectDriverMapper.updateById(info); | ||||
report.setDriverStart(inspectDriver.getDriverStart()); | report.setDriverStart(inspectDriver.getDriverStart()); | ||||
report.setDriverEnd(inspectDriver.getDriverEnd()); | report.setDriverEnd(inspectDriver.getDriverEnd()); | ||||
report.setInspectLength(inspectDriver.getDriverLength().toString()); | report.setInspectLength(inspectDriver.getDriverLength().toString()); | ||||
report.setInspectStartTime(inspectDriver.getExecutionStartTime()); | |||||
report.setInspectEndTime(inspectDriver.getExecutionEndTime()); | |||||
report.setFlightGroup(inspectDriver.getFlightGroup()); | |||||
report.setInspectStartTime(inspectDriver.getExecutionTime()); | |||||
report.setFlightGroup(inspectDriver.getFlightHand()); | |||||
report.setCreateTime(DateUtil.now()); | report.setCreateTime(DateUtil.now()); | ||||
report.setCreateUser(ShiroUtils.getAdminId()); | report.setCreateUser(ShiroUtils.getAdminId()); | ||||
reportMapper.insert(report); | reportMapper.insert(report); |
import com.taauav.admin.service.ITauvInspectService; | import com.taauav.admin.service.ITauvInspectService; | ||||
import com.taauav.common.service.impl.BaseServiceImpl; | import com.taauav.common.service.impl.BaseServiceImpl; | ||||
import com.taauav.common.util.DateUtil; | import com.taauav.common.util.DateUtil; | ||||
import com.taauav.common.util.FileUtil; | |||||
import com.taauav.common.util.FunctionUtils; | import com.taauav.common.util.FunctionUtils; | ||||
import com.taauav.common.util.ShiroUtils; | import com.taauav.common.util.ShiroUtils; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.util.StringUtils; | import org.springframework.util.StringUtils; | ||||
import java.io.File; | |||||
import java.util.Calendar; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
private TauvInspectMapper inspectMapper; | private TauvInspectMapper inspectMapper; | ||||
@Autowired | @Autowired | ||||
private ITauvInspectDriverService iTauvInspectDriverService; | private ITauvInspectDriverService iTauvInspectDriverService; | ||||
@Value("${server.UPLOAD_URL}") | |||||
private String uploadUrl; | |||||
@Value("${file.uploadFolder}") | |||||
private String uploadFolder; | |||||
/** | /** | ||||
* 添加任务 | * 添加任务 | ||||
String idStr = String.format("%04d", id); | String idStr = String.format("%04d", id); | ||||
inspect.setId(id); | inspect.setId(id); | ||||
inspect.setInspectNo(code + idStr); | inspect.setInspectNo(code + idStr); | ||||
// 图片处理 | |||||
if (!StringUtils.isEmpty(inspect.getAttachment())) { | |||||
// 如果上传了文件则对文件进行处理 | |||||
String file = inspect.getAttachment(); | |||||
if (file.contains("temp")) { | |||||
file = file.replace(uploadUrl, uploadFolder); | |||||
File oldFile = new File(file); | |||||
if (!oldFile.exists()) { | |||||
return response.failure("文件不存在"); | |||||
} | |||||
//把文件移动到正式目录下 | |||||
Calendar date = Calendar.getInstance(); | |||||
String year = String.valueOf(date.get(Calendar.YEAR)); | |||||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||||
String day = String.valueOf(date.get(Calendar.DATE)); | |||||
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||||
boolean flag = FileUtil.cutGeneralFile(file, destFile); | |||||
if (flag) { | |||||
// 文件名 | |||||
String fileName = oldFile.getName(); | |||||
destFile = destFile.replace(uploadFolder, ""); | |||||
inspect.setAttachment(destFile + fileName); | |||||
} else { | |||||
return response.failure("图片保存失败了"); | |||||
} | |||||
} | |||||
} | |||||
saveOrUpdate(inspect); | saveOrUpdate(inspect); | ||||
String msg = iTauvInspectDriverService.batchAddData(inspect); | String msg = iTauvInspectDriverService.batchAddData(inspect); | ||||
if (!"".equals(msg)) { | if (!"".equals(msg)) { |
result.put("type_list", CommonConstant.MOUNT_EQUIPMENT_TYPE_LIST); | result.put("type_list", CommonConstant.MOUNT_EQUIPMENT_TYPE_LIST); | ||||
return response.success(result); | return response.success(result); | ||||
} | } | ||||
/** | |||||
* 获取挂载设备列表 | |||||
* | |||||
* @param query 查询条件 | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response getMountEquipmentList(MountEquipmentQuery query) { | |||||
// 查询条件 | |||||
QueryWrapper<TauvMountEquipment> queryWrapper = new QueryWrapper<>(); | |||||
// 设备类型 | |||||
if (query.getType() != null && query.getType() > 0) { | |||||
queryWrapper.eq("type", 1); | |||||
} | |||||
// 设备型号 | |||||
if (!StringUtils.isEmpty(query.getModel())) { | |||||
queryWrapper.like("model", query.getModel()); | |||||
} | |||||
queryWrapper.eq("status", 1); | |||||
queryWrapper.eq("mark", 1); | |||||
queryWrapper.orderByDesc("id"); | |||||
// 查询数据 | |||||
List<TauvMountEquipment> mountEquipmentList = mountEquipmentMapper.selectList(queryWrapper); | |||||
List<TauvMountEquipmentListVo> mountEquipmentListVoList = new ArrayList<>(); | |||||
if (!mountEquipmentList.isEmpty()) { | |||||
mountEquipmentList.forEach(item -> { | |||||
TauvMountEquipmentListVo mountEquipmentListVo = new TauvMountEquipmentListVo(); | |||||
// 拷贝属性 | |||||
BeanUtils.copyProperties(item, mountEquipmentListVo); | |||||
// 类型描述 | |||||
mountEquipmentListVo.setTypeName(CommonConstant.MOUNT_EQUIPMENT_TYPE_LIST.get(item.getType())); | |||||
// 状态描述 | |||||
mountEquipmentListVo.setStatusName(CommonConstant.MOUNT_EQUIPMENT_STATUS_LIST.get(item.getStatus())); | |||||
mountEquipmentListVoList.add(mountEquipmentListVo); | |||||
}); | |||||
} | |||||
return response.success(mountEquipmentListVoList); | |||||
} | |||||
} | } |
} | } | ||||
data.put("questionFileList", questionFileList); | data.put("questionFileList", questionFileList); | ||||
String format = "yyyy-MM-dd HH:mm:ss"; | String format = "yyyy-MM-dd HH:mm:ss"; | ||||
data.put("inspectStartTime", StringUtils.isEmpty(reportInfo.getInspectStartTime()) ? "" : FunctionUtils.formatTime(reportInfo.getInspectStartTime(), format)); | |||||
data.put("inspectStartTime", StringUtils.isEmpty(reportInfo.getInspectStartTime()) ? "" : DateUtil.format(reportInfo.getInspectStartTime(), format)); | |||||
data.put("driverStart", reportInfo.getDriverStart()); | data.put("driverStart", reportInfo.getDriverStart()); | ||||
data.put("driverEnd", reportInfo.getDriverEnd()); | data.put("driverEnd", reportInfo.getDriverEnd()); | ||||
data.put("inspectLength", reportInfo.getInspectLength()); | data.put("inspectLength", reportInfo.getInspectLength()); | ||||
* @param remark | * @param remark | ||||
* @return | * @return | ||||
*/ | */ | ||||
private void checkSub(Integer reportId, Integer inspectDriverId, String remark,Integer status) { | |||||
private void checkSub(Integer reportId, Integer inspectDriverId, String remark, Integer status) { | |||||
TauvInspectDriver inspectDriver = new TauvInspectDriver(); | TauvInspectDriver inspectDriver = new TauvInspectDriver(); | ||||
inspectDriver.setId(inspectDriverId); | inspectDriver.setId(inspectDriverId); | ||||
inspectDriver.setStatus(Integer.valueOf("4")); | inspectDriver.setStatus(Integer.valueOf("4")); | ||||
} else { | } else { | ||||
info.setDriverAreaText(""); | info.setDriverAreaText(""); | ||||
} | } | ||||
info.setFormatInspectStartTime(StringUtils.isEmpty(info.getInspectStartTime()) ? "" : FunctionUtils.formatTime(info.getInspectStartTime(), "yyyy-MM-dd HH:mm:ss")); | |||||
info.setFormatInspectStartTime(StringUtils.isEmpty(info.getInspectStartTime()) ? "" : DateUtil.format(info.getInspectStartTime(), "yyyy-MM-dd HH:mm:ss")); | |||||
} | } | ||||
return info; | return info; | ||||
} | } |
package com.taauav.admin.validate; | package com.taauav.admin.validate; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import lombok.Data; | import lombok.Data; | ||||
import org.hibernate.validator.constraints.Length; | import org.hibernate.validator.constraints.Length; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.DecimalMin; | import javax.validation.constraints.DecimalMin; | ||||
import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||
import javax.validation.constraints.NotNull; | import javax.validation.constraints.NotNull; | ||||
import java.util.Date; | |||||
/** | /** | ||||
* @author dyg | * @author dyg | ||||
@NotNull(message = "任务编号不能为空") | @NotNull(message = "任务编号不能为空") | ||||
private Integer id; | private Integer id; | ||||
private String executionStartTime; | |||||
/** | |||||
* 执行时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date executionTime; | |||||
private String executionEndTime; | |||||
@Length(min = 1, max = 20, message = "天气为1-20个字符") | @Length(min = 1, max = 20, message = "天气为1-20个字符") | ||||
@NotBlank(message = "天气不能为空") | @NotBlank(message = "天气不能为空") | ||||
private String weather; | private String weather; | ||||
@DecimalMin(value = "0", message = "飞行时间只能输入合理的数字") | @DecimalMin(value = "0", message = "飞行时间只能输入合理的数字") | ||||
@NotBlank(message = "飞行时间不能为空") | @NotBlank(message = "飞行时间不能为空") | ||||
private String flightTime; | private String flightTime; | ||||
@Length(max = 200, message = "备注不能超过200个字符") | @Length(max = 200, message = "备注不能超过200个字符") | ||||
private String remark; | private String remark; | ||||
} | } |
import org.springframework.format.annotation.DateTimeFormat; | import org.springframework.format.annotation.DateTimeFormat; | ||||
import javax.validation.constraints.NotEmpty; | import javax.validation.constraints.NotEmpty; | ||||
import java.util.Date; | |||||
/** | /** | ||||
* 飞行设备列表Vo | * 飞行设备列表Vo | ||||
/** | /** | ||||
* 类型:1多旋翼 2固定翼 | * 类型:1多旋翼 2固定翼 | ||||
*/ | */ | ||||
private Byte type; | |||||
private Integer type; | |||||
/** | /** | ||||
* 类型名称 | * 类型名称 | ||||
*/ | */ | ||||
private Integer taskType; | private Integer taskType; | ||||
/** | |||||
* 任务类型描述 | |||||
*/ | |||||
private String taskTypeName; | |||||
/** | /** | ||||
* 注册时间 | * 注册时间 | ||||
*/ | */ | ||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
private Integer registerTime; | |||||
private Date registerTime; | |||||
/** | /** | ||||
* 状态:1正常 2停用 | * 状态:1正常 2停用 | ||||
*/ | */ | ||||
private Byte status; | |||||
private Integer status; | |||||
/** | /** | ||||
* 状态描述 | * 状态描述 | ||||
/** | /** | ||||
* 创建时间 | * 创建时间 | ||||
*/ | */ | ||||
private Integer createTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date createTime; | |||||
/** | /** | ||||
* 更新时间 | * 更新时间 | ||||
*/ | */ | ||||
private Integer updateTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date updateTime; | |||||
} | } |
package com.taauav.admin.vo; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import lombok.Data; | |||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.NotEmpty; | |||||
import java.math.BigDecimal; | |||||
import java.math.BigInteger; | |||||
import java.util.Date; | |||||
/** | |||||
* 巡检河流列表Vo | |||||
*/ | |||||
@Data | |||||
public class TauvInspectDriverListVo { | |||||
/** | |||||
* 巡检河流ID | |||||
*/ | |||||
private Integer id; | |||||
/** | |||||
* 巡检任务ID | |||||
*/ | |||||
private Integer inspectId; | |||||
/** | |||||
* 巡检时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd") | |||||
@JsonFormat(pattern = "yyyy-MM-dd") | |||||
private Date inspectTime; | |||||
/** | |||||
* 行号(以10的倍数递增) | |||||
*/ | |||||
private Integer num; | |||||
/** | |||||
* 巡检任务单号对应的河流子编号 | |||||
*/ | |||||
private String inspectNo; | |||||
/** | |||||
* 河道ID | |||||
*/ | |||||
private Integer driverId; | |||||
/** | |||||
* 河流名称 | |||||
*/ | |||||
private String driverName; | |||||
/** | |||||
* 区划ID | |||||
*/ | |||||
private BigInteger driverArea; | |||||
/** | |||||
* 区划名称 | |||||
*/ | |||||
private String driverAreaName; | |||||
/** | |||||
* 河流长度(单位:KM) | |||||
*/ | |||||
private BigDecimal driverLength; | |||||
/** | |||||
* 河流起点 | |||||
*/ | |||||
private String driverStart; | |||||
/** | |||||
* 河流终点 | |||||
*/ | |||||
private String driverEnd; | |||||
/** | |||||
* 航线文件名 | |||||
*/ | |||||
private String driverFilename; | |||||
/** | |||||
* 航线文件 | |||||
*/ | |||||
private String driverFile; | |||||
/** | |||||
* 河流备注 | |||||
*/ | |||||
private String driverNote; | |||||
} |
import com.baomidou.mybatisplus.annotation.IdType; | import com.baomidou.mybatisplus.annotation.IdType; | ||||
import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import lombok.Data; | import lombok.Data; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import java.util.Date; | |||||
/** | /** | ||||
* 挂载设备列表Vo | * 挂载设备列表Vo | ||||
/** | /** | ||||
* 创建时间 | * 创建时间 | ||||
*/ | */ | ||||
private Integer createTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date createTime; | |||||
/** | /** | ||||
* 更新时间 | * 更新时间 | ||||
*/ | */ | ||||
private Integer updateTime; | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
private Date updateTime; | |||||
} | } |