吉安感知网项目-后端
linwei
2026-01-23 c9a9515b72a360399b38cc51e4ddf55b975f94ef
Merge remote-tracking branch 'origin/master'
12 files modified
1 files added
197 ■■■■■ changed files
drone-common/src/main/java/org/sxkj/common/constant/WordOrderConstant.java 4 ●●●● patch | view | raw | blame | history
drone-service/drone-gd/pom.xml 4 ●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/common/GdMultipartFileUtil.java 46 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/controller/GdClueEventController.java 11 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdClueEventDTO.java 6 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/entity/GdClueEventEntity.java 5 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/excel/GdClueEventExcel.java 6 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.java 6 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml 12 ●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/IGdClueEventService.java 4 ●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdClueEventServiceImpl.java 13 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdPatrolTaskServiceImpl.java 78 ●●●●● patch | view | raw | blame | history
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/vo/GdClueEventVO.java 2 ●●● patch | view | raw | blame | history
drone-common/src/main/java/org/sxkj/common/constant/WordOrderConstant.java
@@ -6,9 +6,13 @@
    String ORDER_PREFIX = "GD";
    // 巡查任务号前缀
    String PATROL_TASK_PREFIX = "RW";
    //线索事件编号前缀
    String EVENT_NUM_PREFIX  = "CE";
    // 订单号redisKEY
    String ORDER_REDIS_KEY = "wordOrderInfo";
    // 巡查任务key
    String PATROL_TASK_KEY = "patrolTaskInfo";
    //线索事件编号key
    String EVENT_NUM_KEY = "eventNum";
}
drone-service/drone-gd/pom.xml
@@ -113,6 +113,10 @@
            <artifactId>javase</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>drone-resource-api</artifactId>
        </dependency>
    </dependencies>
    <build>
drone-service/drone-gd/src/main/java/org/sxkj/gd/common/GdMultipartFileUtil.java
New file
@@ -0,0 +1,46 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.sxkj.gd.common;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class GdMultipartFileUtil {
    private GdMultipartFileUtil() {
    }
    public static MultipartFile fromFile(File file, String contentType) throws IOException {
        if (file == null || !file.exists()) {
            throw new RuntimeException("文件不存在");
        }
        String fileName = file.getName();
        String finalContentType = StringUtil.isBlank(contentType) ? "application/octet-stream" : contentType;
        try (FileInputStream inputStream = new FileInputStream(file)) {
            return new MockMultipartFile(fileName, fileName, finalContentType, inputStream);
        }
    }
    public static MultipartFile fromFile(File file) throws IOException {
        return fromFile(file, "application/octet-stream");
    }
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/controller/GdClueEventController.java
@@ -77,8 +77,10 @@
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "列表", notes = "固定过滤本部门,onlyMine=1时仅我的数据")
    public R<List<GdClueEventListVO>> list(@ApiParam(value = "是否仅我的数据,1为是,0为否")
            @RequestParam(value = "onlyMine", required = false, defaultValue = "0") Integer onlyMine) {
        List<GdClueEventListVO> list = gdClueEventService.listGdClueEventByDept(onlyMine);
            @RequestParam(value = "onlyMine", required = false, defaultValue = "0") Integer onlyMine,
            @ApiParam(value = "事件编号关键字")
            @RequestParam(value = "keyword", required = false) String keyword) {
        List<GdClueEventListVO> list = gdClueEventService.listGdClueEventByDept(onlyMine, keyword);
        return R.data(list);
    }
@@ -88,8 +90,9 @@
    @GetMapping("/count")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "数量统计", notes = "返回全部工单与我的工单数量")
    public R<GdClueEventCountVO> count() {
        return R.data(gdClueEventService.getGdClueEventCount());
    public R<GdClueEventCountVO> count(@ApiParam(value = "事件编号关键字")
            @RequestParam(value = "keyword", required = false) String keyword) {
        return R.data(gdClueEventService.getGdClueEventCount(keyword));
    }
    /**
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/dto/GdClueEventDTO.java
@@ -78,4 +78,10 @@
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
    /**
     * 事件编号
     */
    @ApiModelProperty(value = "事件编号")
    private String eventNum;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/entity/GdClueEventEntity.java
@@ -75,5 +75,10 @@
     */
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
    /**
     * 事件编号
     */
    @ApiModelProperty(value = "事件编号")
    private String eventNum;
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/excel/GdClueEventExcel.java
@@ -89,6 +89,12 @@
    @ExcelProperty("区域编码")
    private String areaCode;
    /**
     * 事件编号
     */
    @ColumnWidth(20)
    @ExcelProperty("事件编号")
    private String eventNum;
    /**
     * 删除标志(0存在 1删除)
     */
    @ColumnWidth(20)
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.java
@@ -61,7 +61,8 @@
     * @param onlyMine
     * @return
     */
    List<GdClueEventListVO> selectGdClueEventSimpleList(@Param("deptId") Long deptId, @Param("userId") Long userId, @Param("onlyMine") Integer onlyMine);
    List<GdClueEventListVO> selectGdClueEventSimpleList(@Param("deptId") Long deptId, @Param("userId") Long userId,
            @Param("onlyMine") Integer onlyMine, @Param("keyword") String keyword);
    /**
     * 详情查询
@@ -79,7 +80,8 @@
     * @param userId
     * @return
     */
    GdClueEventCountVO selectGdClueEventCount(@Param("deptId") Long deptId, @Param("userId") Long userId);
    GdClueEventCountVO selectGdClueEventCount(@Param("deptId") Long deptId, @Param("userId") Long userId,
            @Param("keyword") String keyword);
    /**
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml
@@ -13,6 +13,7 @@
        <result column="latitude" property="latitude"/>
        <result column="event_status" property="eventStatus"/>
        <result column="area_code" property="areaCode"/>
        <result column="event_num" property="eventNum"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
@@ -34,7 +35,7 @@
        <result column="latitude" property="latitude"/>
        <result column="event_status" property="eventStatus"/>
        <result column="area_code" property="areaCode"/>
        <result column="event_code" property="eventCode"/>
        <result column="event_num" property="eventNum"/>
        <result column="event_location" property="eventLocation"/>
        <result column="shoot_time" property="shootTime"/>
        <result column="event_image_url" property="eventImageUrl"/>
@@ -75,6 +76,7 @@
        <result column="latitude" property="latitude"/>
        <result column="event_status" property="eventStatus"/>
        <result column="area_code" property="areaCode"/>
        <result column="event_num" property="eventNum"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
@@ -99,6 +101,9 @@
        left join ja_gd_task_result tr on tr.id = ce.result_id and tr.is_deleted = 0
        <include refid="gdClueEventDeptWhere"/>
        and ce.event_status in (1, 3)
        <if test="keyword != null and keyword != ''">
            and ce.event_num like concat('%', #{keyword}, '%')
        </if>
        <if test="onlyMine != null and onlyMine == 1">
            and ce.dispose_user = #{userId}
        </if>
@@ -112,7 +117,7 @@
        cd.dept_name as distribute_dept_name,
        ce.create_time as distribute_time,
        concat(ce.longitude, ',', ce.latitude) as event_location,
        tr.result_code as event_code,
        ce.event_num as event_num,
        tr.shoot_time as shoot_time,
        tr.result_url as event_image_url
        from ja_gd_clue_event ce
@@ -131,6 +136,9 @@
        from ja_gd_clue_event ce
        <include refid="gdClueEventDeptWhere"/>
        and ce.event_status in (1, 3)
        <if test="keyword != null and keyword != ''">
            and ce.event_num like concat('%', #{keyword}, '%')
        </if>
    </select>
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/IGdClueEventService.java
@@ -59,7 +59,7 @@
     * @param onlyMine
     * @return
     */
    List<GdClueEventListVO> listGdClueEventByDept(Integer onlyMine);
    List<GdClueEventListVO> listGdClueEventByDept(Integer onlyMine, String keyword);
    /**
     * 详情查询
@@ -74,7 +74,7 @@
     *
     * @return
     */
    GdClueEventCountVO getGdClueEventCount();
    GdClueEventCountVO getGdClueEventCount(String keyword);
    /**
     * 分发事件
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdClueEventServiceImpl.java
@@ -21,6 +21,8 @@
import lombok.AllArgsConstructor;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.sxkj.common.constant.WordOrderConstant;
import org.sxkj.common.utils.OrderNumUtils;
import org.sxkj.gd.workorder.entity.GdClueEventEntity;
import org.sxkj.gd.workorder.entity.GdTaskResultEntity;
import org.sxkj.gd.workorder.excel.GdClueEventExcel;
@@ -63,11 +65,11 @@
    }
    @Override
    public List<GdClueEventListVO> listGdClueEventByDept(Integer onlyMine) {
    public List<GdClueEventListVO> listGdClueEventByDept(Integer onlyMine, String keyword) {
        Long deptId = Long.valueOf(AuthUtil.getDeptId());
        Long userId = AuthUtil.getUserId();
        Integer mine = onlyMine == null ? 0 : onlyMine;
        return baseMapper.selectGdClueEventSimpleList(deptId, userId, mine);
        return baseMapper.selectGdClueEventSimpleList(deptId, userId, mine, keyword);
    }
    @Override
@@ -88,10 +90,10 @@
    }
    @Override
    public GdClueEventCountVO getGdClueEventCount() {
    public GdClueEventCountVO getGdClueEventCount(String keyword) {
        Long deptId = Long.valueOf(AuthUtil.getDeptId());
        Long userId = AuthUtil.getUserId();
        GdClueEventCountVO countVO = baseMapper.selectGdClueEventCount(deptId, userId);
        GdClueEventCountVO countVO = baseMapper.selectGdClueEventCount(deptId, userId, keyword);
        if (countVO == null) {
            GdClueEventCountVO empty = new GdClueEventCountVO();
            empty.setTotalCount(0L);
@@ -119,6 +121,9 @@
        clueEvent.setLongitude(distributeParam.getLongitude());
        clueEvent.setLatitude(distributeParam.getLatitude());
        clueEvent.setEventStatus(1);
        String times = OrderNumUtils.initOrderNum(WordOrderConstant.EVENT_NUM_KEY);
        String eventNum = WordOrderConstant.EVENT_NUM_PREFIX + times;
        clueEvent.setEventNum(eventNum);
        if (StringUtil.isBlank(distributeParam.getAreaCode())) {
            clueEvent.setAreaCode(taskResult.getAreaCode());
        } else {
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdPatrolTaskServiceImpl.java
@@ -21,6 +21,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,7 @@
import org.sxkj.common.utils.OrderNumUtils;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.FileUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.sxkj.gd.workorder.entity.GdPatrolTaskEntity;
import org.sxkj.gd.workorder.entity.GdTaskResultEntity;
@@ -47,12 +49,16 @@
import org.sxkj.gd.workorder.service.IGdWorkOrderFlowService;
import org.sxkj.gd.workorder.utils.GdPatrolReportWordUtil;
import org.sxkj.gd.workorder.vo.GdPatrolTaskVO;
import org.sxkj.gd.common.GdMultipartFileUtil;
import org.sxkj.resource.entity.Attach;
import org.sxkj.resource.feign.IAttachClient;
import org.sxkj.system.entity.Dept;
import org.sxkj.system.entity.User;
import org.sxkj.system.feign.ISysClient;
import org.sxkj.system.feign.IUserClient;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
@@ -74,6 +80,8 @@
    private ISysClient sysClient;
    @Autowired
    private IUserClient userClient;
    @Autowired
    private IAttachClient attachClient;
    @Autowired
    private IGdTaskResultService gdTaskResultService;
    @Override
@@ -368,7 +376,9 @@
        String creatorName = getUserName(taskEntity.getCreateUser());
        String deptName = getDeptName(taskEntity.getCreateDept());
        try {
            return GdPatrolReportWordUtil.generateReportFile(taskEntity, resultList, creatorName, deptName);
            File reportFile = GdPatrolReportWordUtil.generateReportFile(taskEntity, resultList, creatorName, deptName);
            saveAttachFile(reportFile, taskEntity);
            return reportFile;
        } catch (Exception e) {
            throw new RuntimeException("生成巡查报告失败", e);
        }
@@ -476,5 +486,71 @@
        return StringUtil.isBlank(realName) ? "/" : realName;
    }
    private BladeFile saveAttachFile(File reportFile, GdPatrolTaskEntity taskEntity) throws IOException {
        if (reportFile == null || !reportFile.exists()) {
            throw new RuntimeException("巡查报告文件不存在");
        }
        String fileName = reportFile.getName();
        BladeFile bladeFile = attachClient.putFile(
            GdMultipartFileUtil.fromFile(reportFile,
                "application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
            fileName
        );
        if (bladeFile == null || StringUtil.isBlank(bladeFile.getLink())) {
            throw new RuntimeException("附件上传失败");
        }
        Integer resultType = parseResultType(taskEntity != null ? taskEntity.getPatrolTaskType() : null);
        Attach attach = buildAttachInfo(taskEntity, reportFile, bladeFile, resultType);
        Boolean saved = attachClient.saveAttachInfo(attach);
        if (!Boolean.TRUE.equals(saved)) {
            log.error("附件信息保存失败,报告文件:"+fileName);
        }
        return bladeFile;
    }
    private Attach buildAttachInfo(GdPatrolTaskEntity taskEntity, File reportFile, BladeFile bladeFile, Integer resultType) {
        Attach attach = new Attach();
        attach.setDomainUrl(bladeFile.getDomain());
        attach.setLink(bladeFile.getLink());
        attach.setName(bladeFile.getName());
        attach.setOriginalName(StringUtil.isBlank(bladeFile.getOriginalName()) ? reportFile.getName() : bladeFile.getOriginalName());
        attach.setAttachSize(reportFile.length());
        attach.setExtension(FileUtil.getFileExtension(reportFile.getName()));
        attach.setResultType(resultType);
        Long createUser = taskEntity != null ? taskEntity.getCreateUser() : null;
        Long updateUser = taskEntity != null ? taskEntity.getUpdateUser() : null;
        Long createDept = taskEntity != null ? taskEntity.getCreateDept() : null;
        if (createUser == null) {
            createUser = AuthUtil.getUserId();
        }
        if (updateUser == null) {
            updateUser = createUser;
        }
        if (createDept == null) {
            createDept = Long.valueOf(AuthUtil.getDeptId());
        }
        Date now = new Date();
        attach.setCreateUser(createUser);
        attach.setUpdateUser(updateUser);
        attach.setCreateDept(createDept);
        attach.setCreateTime(now);
        attach.setUpdateTime(now);
        return attach;
    }
    private Integer parseResultType(String patrolTaskType) {
        if (StringUtil.isBlank(patrolTaskType)) {
            return null;
        }
        try {
            Integer type = Integer.valueOf(patrolTaskType);
            if (type < 1 || type > 5) {
                return null;
            }
            return type;
        } catch (NumberFormatException ex) {
            return null;
        }
    }
}
drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/vo/GdClueEventVO.java
@@ -82,7 +82,7 @@
     * 事件编号
     */
    @ApiModelProperty(value = "事件编号")
    private String eventCode;
    private String eventNum;
    /**
     * 事件位置