Quellcode durchsuchen

去掉权限相关问题

tags/v1.1.0
qiujinyang vor 2 Jahren
Ursprung
Commit
64cbf75b95
11 geänderte Dateien mit 28 neuen und 47 gelöschten Zeilen
  1. +0
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Question.java
  2. +2
    -6
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/ThInspection.java
  3. +0
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/ThMission.java
  4. +1
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/InspectionRequest.java
  5. +1
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/InspectionVO.java
  6. +0
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/ThMissionMapper.java
  7. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/IThInspectionService.java
  8. +2
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java
  9. +4
    -8
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionServiceImpl.java
  10. +17
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java
  11. +0
    -12
      tuoheng-admin/src/main/resources/mapper/ThMissionMapper.xml

+ 0
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Question.java Datei anzeigen

@@ -32,13 +32,10 @@ public class Question extends BaseEntity implements Serializable {

public Question(int type){
if(type== UpdateOrCreateEnum.CREATE.getCode()){
setCreateUser(ShiroUtils.getUserId());
setCreateTime(new Date());
setMark(MarkTypeEnum.VALID.getCode());
}
setUpdateUser(ShiroUtils.getUserId());
setUpdateTime(new Date());
setTenantId(ShiroUtils.getTenantId());
}

/**

+ 2
- 6
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/ThInspection.java Datei anzeigen

@@ -28,11 +28,9 @@ public class ThInspection extends BaseEntity implements Serializable {

public ThInspection(int type){
if(type== UpdateOrCreateEnum.CREATE.getCode()){
setCreateUser(ShiroUtils.getUserId());
setCreateTime(new Date());
setMark(MarkTypeEnum.VALID.getCode());
}
setUpdateUser(ShiroUtils.getUserId());
setUpdateTime(new Date());
}

@@ -55,7 +53,7 @@ public class ThInspection extends BaseEntity implements Serializable {
/**
* 地面站标识
*/
private Integer hostIp;
private String hostIp;


/**
@@ -77,8 +75,6 @@ public class ThInspection extends BaseEntity implements Serializable {
/**
* 飞行时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String timestamp;
private Long flyTime;

}

+ 0
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/ThMission.java Datei anzeigen

@@ -32,11 +32,9 @@ public class ThMission extends BaseEntity implements Serializable {

public ThMission(int type){
if(type== UpdateOrCreateEnum.CREATE.getCode()){
setCreateUser(ShiroUtils.getUserId());
setCreateTime(new Date());
setMark(MarkTypeEnum.VALID.getCode());
}
setUpdateUser(ShiroUtils.getUserId());
setUpdateTime(new Date());
}


+ 1
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/InspectionRequest.java Datei anzeigen

@@ -38,10 +38,8 @@ public class InspectionRequest implements Serializable {
private String hostIp;


@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "飞行时间")
@NotNull(message = "飞行时间不能为空!")
private String timestamp;
private Long flyTime;

}

+ 1
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/InspectionVO.java Datei anzeigen

@@ -30,8 +30,6 @@ public class InspectionVO implements Serializable {
@ApiModelProperty(value = "纬度")
private String lat;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "飞行时间")
private String timestamp;
private Long flyTime;
}

+ 0
- 5
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/ThMissionMapper.java Datei anzeigen

@@ -7,9 +7,4 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface ThMissionMapper extends BaseMapper<ThMission> {
/**
* 批量删除巡检任务
*
*/
int deleteBatch(@Param("idList") List<Integer> idList, @Param("updateUser") Integer updateUser, @Param("tenantId") Integer tenantId);
}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/IThInspectionService.java Datei anzeigen

@@ -20,7 +20,7 @@ public interface IThInspectionService extends IBaseService<ThInspection> {

List<InspectionVO> track(Integer id);

Integer track(InspectionRequest inspectionRequest);
Integer track(InspectionRequest inspectionRequest) throws ServiceException;

List<AirPortVO> airport() throws ServiceException;


+ 2
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java Datei anzeigen

@@ -72,6 +72,8 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi
public Integer addMission(MissionRequest addThMissionRequest) throws ServiceException {

ThMission tm=new ThMission(UpdateOrCreateEnum.CREATE.getCode());
tm.setCreateUser(ShiroUtils.getUserId());
tm.setUpdateUser(ShiroUtils.getUserId());
BeanUtils.copyProperties(addThMissionRequest,tm);

//任务名称不能重复

+ 4
- 8
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/QuestionServiceImpl.java Datei anzeigen

@@ -206,7 +206,7 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio
return inspectionMapper.selectList(new LambdaQueryWrapper<ThInspection>()
.eq(ThInspection::getMissionId, mission.getId())
.eq(ThInspection::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(ThInspection::getTimestamp));
.orderByDesc(ThInspection::getUpdateTime));
}

private List<Question> getQuestionList(ThMission mission, List<CallbackRequest.QuestionFilesDTO> questionFiles, List<ThInspection> flightDataList) {
@@ -249,14 +249,10 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!");
}
List<ThInspection> inspectionData =new ArrayList<>();
try {
for (ThInspection thInspection : inspectionList) {
if(dateformat.parse(thInspection.getTimestamp()).getTime() <= time){
inspectionData.add(thInspection);
}
for (ThInspection thInspection : inspectionList) {
if(thInspection.getUpdateTime().getTime() <= time){
inspectionData.add(thInspection);
}
} catch (ParseException e) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"巡检时间格式错误!");
}
if (CollectionUtils.isEmpty(inspectionData)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!");

+ 17
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java Datei anzeigen

@@ -8,6 +8,8 @@ import com.tuoheng.admin.entity.domain.ThInspection;
import com.tuoheng.admin.entity.domain.ThMission;
import com.tuoheng.admin.entity.request.InspectionRequest;
import com.tuoheng.admin.entity.vo.*;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.enums.TaskStatusEnum;
import com.tuoheng.admin.enums.UpdateOrCreateEnum;
import com.tuoheng.admin.mapper.ThInspectionMapper;
import com.tuoheng.admin.mapper.ThMissionMapper;
@@ -52,7 +54,7 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
public List<InspectionVO> track(Integer id) {

LambdaQueryWrapper<ThInspection> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ThInspection::getMissionId,id).orderByDesc(ThInspection::getTimestamp);
lambdaQueryWrapper.eq(ThInspection::getMissionId,id).orderByDesc(ThInspection::getUpdateTime);
//lambdaQueryWrapper.eq(ThInspection::getTenantId, ShiroUtils.getTenantId());
List<InspectionVO> result=new ArrayList<>();
List<ThInspection> thInspections = inspectionMapper.selectList(lambdaQueryWrapper);
@@ -66,9 +68,20 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
}

@Override
public Integer track(InspectionRequest inspectionRequest) {
public Integer track(InspectionRequest inspectionRequest) throws ServiceException {
ThInspection inspection=new ThInspection(UpdateOrCreateEnum.CREATE.getCode());
BeanUtils.copyProperties(inspectionRequest,inspection);
//获取当前巡检正在执行的任务
List<ThMission> thMissions = missionMapper.selectList(new LambdaQueryWrapper<ThMission>()
.eq(ThMission::getInspectionLine, inspectionRequest.getInspectionId())
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode())
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getExecutionStartTime));
if(ObjectUtil.isEmpty(thMissions) || thMissions.size()==0){
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"没有正在飞行的任务!");
}
ThMission mission = thMissions.get(0);
inspection.setMissionId(mission.getId());
inspection.setTenantId(mission.getTenantId());
inspectionMapper.insert(inspection);
return inspection.getId();
}
@@ -90,8 +103,8 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper,
public List<AirLineVO> airLine(Integer droneId) throws ServiceException {

//这边需要配置到yml文件里面
String url = CommonConfig.airportUrl +"/api/airportInterface/airportList";
String param="page=1&limit=10&droneId="+droneId;
String url = CommonConfig.airportUrl +"/api/airportInterface/taskByDroneId";
String param="page=1&limit=100&droneId="+droneId;
String airPortStr = HttpUtils.sendGet(url, param);
JsonResult<AirLineVO> jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
if(ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0)) {

+ 0
- 12
tuoheng-admin/src/main/resources/mapper/ThMissionMapper.xml Datei anzeigen

@@ -1,16 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.ThMissionMapper">
<!-- 批量删除 -->
<update id="deleteBatch">
update th_mission
set mark = 0,
update_user = #{updateUser}
where id in
<foreach collection="idList" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
and tenant_id = #{tenantId}
</update>

</mapper>

Laden…
Abbrechen
Speichern