Procházet zdrojové kódy

修改sql片段 删除resumbitInspectionService里面的name

pull/357/head
suqin před 11 měsíci
rodič
revize
20232f7341
7 změnil soubory, kde provedl 68 přidání a 53 odebrání
  1. +20
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  2. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/resubmit/ResubmitInspectionService.java
  3. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/CurrentUserUtil.java
  4. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionVo.java
  5. +24
    -35
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml
  6. +2
    -2
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/InspectionFileServiceTest.java
  7. +11
    -11
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/InspectionServiceTest.java

+ 20
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java Zobrazit soubor

@@ -231,14 +231,19 @@ public class QueryInspectionPageListService {
*/
private List<InspectionVo> buildIspectionVoList(User user, Dept dept, List<Inspection> inspectionList) {
Map<String, String> deptMap = this.getDeptMap(inspectionList);

List<InspectionVo> inspectionVoList = InspectionConverMapper.INSTANCE.fromInspectionListToInspectionVoList(inspectionList);
Map<String, RoadInformation> roadInformationMap = this.getRoadInformationMap(inspectionList);
Map<String, Section> sectionMap = this.getSectionMap(inspectionList);
Map<Integer, AirportLineVo> airportLineMap = this.getAirportLineMap(inspectionList);
Map<String, AirportInfoVo> airportMap = this.getAirportMap(inspectionList);
Map<String, User> userMap = this.getUserMap(inspectionList);

String deptName;
RoadInformation roadInformation;
Section section;
User createUser;

for (InspectionVo inspectionVo : inspectionVoList) {
deptName = deptMap.get(inspectionVo.getDeptId());
inspectionVo.setDeptName(deptName);
@@ -269,6 +274,13 @@ public class QueryInspectionPageListService {
inspectionVo.setInspectionLineName(airportLineMap.get(inspectionVo.getInspectionLine()).getFileName());
}
}
//创建人名称
if (CollectionUtil.isNotEmpty(userMap)) {
createUser = userMap.get(inspectionVo.getCreateUser());
if (ObjectUtil.isNotNull(userMap.get(inspectionVo.getCreateUser()))) {
inspectionVo.setCreateUserName(createUser.getRealname());
}
}

executeHandle.handler(user, dept, inspectionVo);
}
@@ -294,6 +306,14 @@ public class QueryInspectionPageListService {
return map;
}

private Map<String, User> getUserMap(List<Inspection> inspectionList) {
List<String> userIdList = inspectionList.stream().map(o -> o.getCreateUser()).collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getId, userIdList)
.eq(User::getMark, MarkEnum.VALID.getCode()));
Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
return userMap;
}

/**
* 获取公路列表,放到map,减少循环次数

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/resubmit/ResubmitInspectionService.java Zobrazit soubor

@@ -106,19 +106,19 @@ public class ResubmitInspectionService {
if (null == request.getInspectionType()) {
return JsonResult.error(ResubmitInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), ResubmitInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg());
}
if (null == request.getRoadId() || StringUtils.isEmpty(request.getRoadName())) {
if (null == request.getRoadId()) {
return JsonResult.error(ResubmitInspectionCodeEnum.ROAD_IS_NULL.getCode(), ResubmitInspectionCodeEnum.ROAD_IS_NULL.getMsg());
}

if (null == request.getSectionId() || StringUtils.isEmpty(request.getSectionName())) {
if (null == request.getSectionId()) {
return JsonResult.error(ResubmitInspectionCodeEnum.SECTION_IS_NULL.getCode(), ResubmitInspectionCodeEnum.SECTION_IS_NULL.getMsg());
}
if (InspectionTypeEnum.AIRPORT.getCode() == request.getInspectionType()) {
// 巡检方式:机场巡逻,可选择巡检机场和巡检路线
if (null == request.getAirportId() || StringUtils.isEmpty(request.getAirportName())) {
if (null == request.getAirportId()) {
return JsonResult.error(ResubmitInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), ResubmitInspectionCodeEnum.AIRPORT_IS_NULL.getMsg());
}
if (null == request.getInspectionLine() || StringUtils.isEmpty(request.getInspectionLineName())) {
if (null == request.getInspectionLine()) {
return JsonResult.error(ResubmitInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), ResubmitInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg());
}
} else if (InspectionTypeEnum.MABNNEDFLIGHT.getCode() == request.getInspectionType()) {

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/CurrentUserUtil.java Zobrazit soubor

@@ -48,7 +48,6 @@ public class CurrentUserUtil {
* @return
*/
public static User getUserInfo() {
// String username = "admin";
String username = SecurityUserUtils.username();
User user = currentUserUtil.userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getMark, 1).eq(User::getStatus, 1).eq(User::getUsername, username));
if (null == user) {

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/inspection/InspectionVo.java Zobrazit soubor

@@ -337,4 +337,11 @@ public class InspectionVo extends BaseEntity {
*/
private boolean edit;

/**
* 创建人名
*/
private String createUserName;



}

+ 24
- 35
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml Zobrazit soubor

@@ -70,8 +70,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createUserName" column="create_user_name" />
</resultMap>
<sql id="Base_Column_list">
id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type,
inspectionCycleId, airport_task_id, airport_id, drone_id, airport_name, inspection_line, inspection_line_name,
id, tenant_id, dept_id, code, name, type, road_id, section_id, inspection_type,
inspection_cycle_id, airport_task_id, airport_id, drone_id, inspection_line,
equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn,
flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt,
video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather,
@@ -80,16 +80,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
create_user, create_time, update_user, update_time, mark
</sql>

<sql id="Base_Column_list2">
t.id, t.tenant_id, t.dept_id, t.code, t.name, t.type, t.inspection_type, t.inspection_cycle_id, t.airport_task_id,
t.airport_id, t.drone_id, t.inspection_line, t.equipment_id, t.equipment_name, t.equipment_mount_id,
t.equipment_mount_name, t.cloud_box_id, t.cloud_box_name, t.box_sn, t.flight_hand, t.flight_hand_name, t.inspection_time,
t.execution_start_time, t.execution_end_time, t.is_live, t.is_taken, t.is_tilt, t.video_url, t.ai_video_url, t.report_url, t.srt_url,
t.status, t.analyse_status, t.progressbar, t.note, t.weather, t.fly_height, t.mileage, t.flytime, t.srt_name, t.heartbeat_time, t.execution_status,
t.start_longitude, t.start_latitude, t.end_longitude, t.end_latitude, t.mobile, t.patrol_location, t.dsp_service_inst_id, t.emergency_data_inspection_id,
t.create_user, t.create_time, t.update_user, t.update_time, t.mark
</sql>

<sql id="selectInspectionVo">
select id, tenant_id, dept_id, code, name, type, road_id, road_name, section_id, section_name, inspection_type,
inspectionCycleI, airport_task_id, airport_id, drone_id, airport_name, inspection_line, inspection_line_name,
@@ -110,67 +100,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>

<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="ForeignResult">
select <include refid="Base_Column_list2"/> ,u.realname as create_user_name
from th_inspection t
left join th_user u on u.id = t.create_user
select <include refid="Base_Column_list"/>
from th_inspection
<where>
<if test="1 == 1"> and t.mark = 1 </if>
<if test="request.code != null and request.code != ''"> and t.code like concat('%', #{request.code}, '%') </if>
<if test="request.name != null and request.name != ''"> and t.name like concat('%', #{request.name}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and t.tenant_id = #{request.tenantId} </if>
<if test="request.airportId != null and request.airportId != 0"> and t.airport_id = #{request.airportId} </if>
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and t.inspection_line = #{request.inspectionLine} </if>
<if test="request.type != null and (request.type == 0 or request.type == 1)"> and t.type = #{request.type} </if>
<if test="request.inspectionType != null and request.inspectionType != 0"> and t.inspection_type = #{request.inspectionType} </if>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.code != null and request.code != ''"> and code like concat('%', #{request.code}, '%') </if>
<if test="request.name != null and request.name != ''"> and name like concat('%', #{request.name}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if>
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and inspection_line = #{request.inspectionLine} </if>
<if test="request.type != null and (request.type == 0 or request.type == 1)"> and type = #{request.type} </if>
<if test="request.inspectionType != null and request.inspectionType != 0"> and inspection_type = #{request.inspectionType} </if>
<if test="request.statusList != null and request.statusList.size() > 0">
and t.status in
and status in
<foreach item="status" collection="request.statusList" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.deptIdList != null and request.deptIdList.size() > 0">
and t.dept_id in
and dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
<if test="request.deptId != null and request.deptId !=''">
and t.dept_id = #{request.deptId}
and dept_id = #{request.deptId}
</if>
<if test="request.inspectionTimeBegin != null and request.inspectionTimeBegin != ''">
and t.inspection_time &gt;= #{request.inspectionTimeBegin}
and inspection_time &gt;= #{request.inspectionTimeBegin}
</if>
<if test="request.inspectionTimeEnd != null and request.inspectionTimeEnd != ''">
and t.inspection_time &lt;= #{request.inspectionTimeEnd}
and inspection_time &lt;= #{request.inspectionTimeEnd}
</if>
<if test="request.executionTimeBegin != null and request.executionTimeBegin != ''">
and t.execution_start_time &gt;= #{request.executionTimeBegin}
and execution_start_time &gt;= #{request.executionTimeBegin}
</if>
<if test="request.executionTimeEnd != null and request.executionTimeEnd != ''">
and t.execution_start_time &lt;= #{request.executionTimeEnd}
and execution_start_time &lt;= #{request.executionTimeEnd}
</if>
<if test="request.inspectionCycleId != null and request.inspectionCycleId != ''">
and t.type = 0 and t.inspection_cycle_id = #{request.inspectionCycleId}
and type = 0 and inspection_cycle_id = #{request.inspectionCycleId}
</if>
<choose>
<!-- 单次任务程序:只展示待执行(5)的单次任务 -->
<when test="request.singleTask != null and request.singleTask == 1">
and t.type = 1 and t.status = 5
and type = 1 and status = 5
</when>
<!-- 执行任务程序:只展示准备中(6)、飞行中(10)、飞行完成(15)、飞行失败(7)、已取消(16)的单次任务、周期任务子任务 -->
<otherwise>
and t.type in(0,1) and t.status in (6,10,15,7,16)
and type in(0,1) and status in (6,10,15,7,16)
</otherwise>
</choose>
</where>
<choose>
<!-- 单次任务程序:按创建时间倒序排 -->
<when test="request.singleTask != null and request.singleTask == 1">
order by t.create_time desc
order by create_time desc
</when>
<!-- 执行任务程序:按实际巡检时间倒序排,null为后 -->
<otherwise>
order by t.execution_start_time desc
order by execution_start_time desc
</otherwise>
</choose>
</select>

+ 2
- 2
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/InspectionFileServiceTest.java Zobrazit soubor

@@ -166,8 +166,8 @@ public class InspectionFileServiceTest {
inspectionFileExportExcelDto.setFileOriginal(new URL(CommonConfig.imageURL + inspectionFile.getFileOriginal()));
inspectionFileExportExcelDto.setFileImage(new URL(CommonConfig.imageURL + inspectionFile.getFileImage()));
inspectionFileExportExcelDto.setLocation(inspectionFile.getLongitude() + "," + inspectionFile.getLatitude());
inspectionFileExportExcelDto.setSectionName(inspection.getSectionName());
inspectionFileExportExcelDto.setRoadName(inspection.getRoadName());
// inspectionFileExportExcelDto.setSectionName(inspection.getSectionName());
// inspectionFileExportExcelDto.setRoadName(inspection.getRoadName());
if (InspectionFileStatusEnum.WAIT_CONFIRMED.getCode() == inspectionFile.getStatus()) {
inspectionFileExportExcelDto.setStatus("待确认");
} else if (InspectionFileStatusEnum.IGNORED.getCode() == inspectionFile.getStatus()) {

+ 11
- 11
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/service/InspectionServiceTest.java Zobrazit soubor

@@ -41,7 +41,7 @@ public class InspectionServiceTest {
request.setAirportId(1); // 巡检机场id
request.setInspectionLine(1); // 巡检线路Id
request.setType(1); // 巡检任务类型: 1 临时巡检(目前只有该一种类型)
request.setStatus(5); // 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
// request.setStatus(5); // 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
request.setInspectionType(1); // 1 无人机 2机场
request.setDeptId("");
request.setPage(1);
@@ -60,14 +60,14 @@ public class InspectionServiceTest {
request.setType(1);
request.setName("test-2022112501-11");
request.setRoadId("1");
request.setRoadName("G2");
// request.setRoadName("G2");
request.setSectionId("1");
request.setSectionName("路段1");
// request.setSectionName("路段1");
request.setInspectionType(1);
request.setAirportId(1);
request.setAirportName("禄口-2022112501");
// request.setAirportName("禄口-2022112501");
request.setInspectionLine(1);
request.setInspectionLineName("路线1");
// request.setInspectionLineName("路线1");
request.setInspectionTime(DateUtils.now());

JSONObject json = (JSONObject) JSONObject.toJSON(request);
@@ -87,9 +87,9 @@ public class InspectionServiceTest {
request.setSectionId("1");
request.setInspectionType(1);
request.setAirportId(1);
request.setAirportName("禄口1");
// request.setAirportName("禄口1");
request.setInspectionLine(1);
request.setInspectionLineName("路线11");
// request.setInspectionLineName("路线11");
request.setInspectionTime(DateUtils.now());
request.setNote("test");

@@ -113,13 +113,13 @@ public class InspectionServiceTest {
request.setInspectionType(2);
request.setName("test1");
request.setRoadId("1");
request.setRoadName("G2");
// request.setRoadName("G2");
request.setSectionId("1");
request.setSectionName("路段1");
// request.setSectionName("路段1");
request.setAirportId(1);
request.setAirportName("禄口1");
// request.setAirportName("禄口1");
request.setInspectionLine(1);
request.setInspectionLineName("路线11");
// request.setInspectionLineName("路线11");
request.setIsLive(1);
request.setStartLatitude("11");
request.setStartLongitude("11");

Načítá se…
Zrušit
Uložit