fuliqi
2024-08-31 6221c8b5df5eb0ee62dce79048c9c3f0dc3d0fc1
Merge remote-tracking branch 'origin/master'
9个文件已修改
102 ■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwPoint.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/excel/PointExport.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/vo/YwPointVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/YwPointController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/YwPointMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/YwPointService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/YwPointServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwPoint.java
@@ -67,6 +67,10 @@
    @TableField("important_command_image_tag")
    private Boolean importantCommandImageTag;
    @ApiModelProperty("部级标签")
    @TableField("dept_tag")
    private Boolean deptTag;
    @TableField("serial_number")
    private String serialNumber;
ycl-pojo/src/main/java/com/ycl/platform/domain/excel/PointExport.java
@@ -37,12 +37,12 @@
    @ColumnWidth(40)
    @DateTimeFormat("yyyy-MM-dd")
    @ExcelProperty("运维开始时间")
    @ExcelProperty("运维开始时间(导入界面可改)")
    private Date startTime;
    @ColumnWidth(40)
    @DateTimeFormat("yyyy-MM-dd")
    @ExcelProperty("运维结束时间")
    @ExcelProperty("运维结束时间(导入界面可改)")
    private Date endTime;
    @ExcelIgnore
@@ -51,6 +51,14 @@
    @ColumnWidth(20)
    @ExcelProperty("是否省厅标签(可修改)")
    private String provinceTagString;
    @ColumnWidth(20)
    @ExcelProperty("是否重点指挥图像(可修改)")
    private String importantCommandImageTagString;
    @ColumnWidth(20)
    @ExcelProperty("是否部级标签(可修改)")
    private String deptTag;
    @ExcelIgnore
    private Boolean importantTag;
@@ -61,7 +69,5 @@
    @ExcelIgnore
    private Boolean importantCommandImageTag;
    @ColumnWidth(20)
    @ExcelProperty("是否重点指挥图像(可修改)")
    private String importantCommandImageTagString;
}
ycl-pojo/src/main/java/com/ycl/platform/domain/vo/YwPointVO.java
@@ -48,11 +48,16 @@
    /** 重点点位标签 */
    private Boolean importantTag;
    /** 省厅点位标签 */
    private Boolean provinceTag;
    /** 重点指挥图像标签 */
    private Boolean importantCommandImageTag;
    /** 部级标签 */
    private Boolean deptTag;
    public static YwPointVO getVoByEntity(@NonNull YwPoint entity, YwPointVO vo) {
        if(vo == null) {
            vo = new YwPointVO();
ycl-server/src/main/java/com/ycl/calculate/IndexCalculationServe.java
@@ -183,19 +183,25 @@
    //返回省厅国标码集合
    public List<String> getProvince() {
        List<YwPoint> province = pointMapper.selectByTag(null, Boolean.TRUE, null);
        List<YwPoint> province = pointMapper.selectByTag(null, Boolean.TRUE, null, null);
        return CollectionUtils.isEmpty(province) ? new ArrayList<>() : province.stream().map(YwPoint::getSerialNumber).collect(Collectors.toList());
    }
    //返回重点点位集合
    public List<String> getImportant() {
        List<YwPoint> important = pointMapper.selectByTag(Boolean.TRUE, null, null);
        List<YwPoint> important = pointMapper.selectByTag(Boolean.TRUE, null, null, null);
        return CollectionUtils.isEmpty(important) ? new ArrayList<>() : important.stream().map(YwPoint::getSerialNumber).collect(Collectors.toList());
    }
    //返回重点指挥图像集合
    public List<String> getCommandImage() {
        List<YwPoint> commandImages = pointMapper.selectByTag(null, null, Boolean.TRUE);
        List<YwPoint> commandImages = pointMapper.selectByTag(null, null, Boolean.TRUE, null);
        return CollectionUtils.isEmpty(commandImages) ? new ArrayList<>() : commandImages.stream().map(YwPoint::getSerialNumber).collect(Collectors.toList());
    }
    //返回重点指挥图像集合
    public List<String> getDeptTag() {
        List<YwPoint> commandImages = pointMapper.selectByTag(null, null, null, Boolean.TRUE);
        return CollectionUtils.isEmpty(commandImages) ? new ArrayList<>() : commandImages.stream().map(YwPoint::getSerialNumber).collect(Collectors.toList());
    }
ycl-server/src/main/java/com/ycl/platform/controller/YwPointController.java
@@ -123,6 +123,7 @@
    public Result importData(MultipartFile file,
                             Integer unitId,
                             String startTime,
                             Boolean needUpdateUnit,
                             String endTime) throws IOException, ParseException {
        Date start = null;
        Date end = null;
@@ -137,7 +138,7 @@
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            end = format.parse(endTime);
        }
        return ywPointService.importData(file, unitId, start, end);
        return ywPointService.importData(file, unitId, start, end, needUpdateUnit);
    }
}
ycl-server/src/main/java/com/ycl/platform/mapper/YwPointMapper.java
@@ -40,7 +40,10 @@
    /**
     * 通过标签查重点点位或省厅点位或重点指挥图像
     */
    List<YwPoint> selectByTag(@Param("important")Boolean important, @Param("province")Boolean province, @Param("commandImage")Boolean commandImage);
    List<YwPoint> selectByTag(@Param("important")Boolean important,
                              @Param("province")Boolean province,
                              @Param("commandImage")Boolean commandImage,
                              @Param("deptTag") Boolean deptTag);
    /**
     * 导出数据
ycl-server/src/main/java/com/ycl/platform/service/YwPointService.java
@@ -121,5 +121,5 @@
     * @param unitId 运维单位id
     * @return
     */
    Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime) throws IOException;
    Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean needUpdateUnit) throws IOException;
}
ycl-server/src/main/java/com/ycl/platform/service/impl/YwPointServiceImpl.java
@@ -248,10 +248,10 @@
    }
    @Override
    public Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime) throws IOException {
    public Result importData(MultipartFile file, Integer unitId, Date startTime, Date endTime, Boolean needUpdateUnit) throws IOException {
        Consumer<List<PointExport>> consumer = (dataList) -> {
            try {
                this.updatePoint(dataList, unitId, startTime, endTime);
                this.updatePoint(dataList, unitId, startTime, endTime, needUpdateUnit);
            } catch (ExecutionException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
@@ -269,7 +269,7 @@
     * @param unitId
     */
    @Transactional(rollbackFor = Exception.class)
    public void updatePoint(List<PointExport> dataList, Integer unitId, Date startTime, Date endTime) throws ExecutionException, InterruptedException {
    public void updatePoint(List<PointExport> dataList, Integer unitId, Date startTime, Date endTime, Boolean needUpdateUnit) throws ExecutionException, InterruptedException {
        if (CollectionUtils.isEmpty(dataList)) {
            throw new RuntimeException("导入数据不能为空");
        }
@@ -277,11 +277,19 @@
            YwPoint point = new YwPoint();
            point.setImportantCommandImageTag("是".equals(item.getImportantCommandImageTagString()));
            point.setProvinceTag("是".equals(item.getProvinceTagString()));
            if (Objects.nonNull(unitId)) {
                point.setUnitId(Long.valueOf(unitId));
            point.setDeptTag("是".equals(item.getDeptTag()));
            if (needUpdateUnit) {
                if (Objects.nonNull(unitId)) {
                    point.setUnitId(Long.valueOf(unitId));
                }
                point.setStartTime(startTime);
                point.setEndTime(endTime);
            } else {
                point.setUnitId(null);
                point.setStartTime(null);
                point.setEndTime(null);
            }
            point.setStartTime(startTime);
            point.setEndTime(endTime);
            point.setPointName(item.getPointName());
            point.setSerialNumber(item.getSerialNumber());
            return point;
@@ -290,19 +298,17 @@
    }
    public void waitAllFinishAndGetResult(List<YwPoint> dataList) throws InterruptedException, ExecutionException {
        List<FutureTask<Boolean>> resultList = new ArrayList<>(512);
        List<Boolean> data = new ArrayList<>(512);
        int start = 0;
        Date startTime = new Date();
        while (true) {
            if (dataList.size() < start + 100) {
            if (dataList.size() < start + 800) {
                List<YwPoint> list = dataList.subList(start, dataList.size() - 1);
                this.baseMapper.updatePoint(list);
                break;
            } else {
                List<YwPoint> list = dataList.subList(start, start + 100);
                List<YwPoint> list = dataList.subList(start, start + 800);
                this.baseMapper.updatePoint(list);
                start += 100;
                start += 800;
            }
        }
        Date endTime = new Date();
ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
@@ -19,6 +19,7 @@
        <result column="province_tag" property="provinceTag"/>
        <result column="important_tag" property="importantTag"/>
        <result column="important_command_image_tag" property="importantCommandImageTag"/>
        <result column="dept_tag" property="deptTag"/>
    </resultMap>
    <select id="selectData" resultType="com.ycl.platform.base.BaseSelect">
@@ -41,7 +42,8 @@
        typ.update_time,
        typ.important_tag,
        typ.province_tag,
        typ.important_command_image_tag
        typ.important_command_image_tag,
        typ.dept_tag
        FROM
        t_yw_point typ
        LEFT JOIN t_yw_unit tyu ON typ.unit_id = tyu.id AND tyu.deleted = 0
@@ -78,6 +80,9 @@
            <if test="commandImage!=null and commandImage == true ">
                and important_command_image_tag = #{commandImage}
            </if>
            <if test="deptTag !=null and deptTag == true ">
                and dept_tag = #{deptTag}
            </if>
        </where>
    </select>
@@ -91,7 +96,8 @@
        yp.end_time,
        CASE WHEN yp.province_tag = 0 THEN '否' ELSE '是' END AS provinceTagString,
        CASE WHEN yp.important_tag = 0 THEN '否' ELSE '是' END AS importantTagString,
        CASE WHEN yp.important_command_image_tag = 0 THEN '否' ELSE '是' END AS importantCommandImageTagString
        CASE WHEN yp.important_command_image_tag = 0 THEN '否' ELSE '是' END AS importantCommandImageTagString,
        CASE WHEN yp.dept_tag = 0 THEN '否' ELSE '是' END AS deptTag
        FROM
        t_yw_point yp
        INNER JOIN t_monitor m ON yp.serial_number = m.serial_number
@@ -115,11 +121,18 @@
            <if test="point.pointName != null and point.pointName != ''">
                point_name = #{point.pointName},
            </if>
            unit_id = #{point.unitId},
            start_time = #{point.startTime},
            end_time = #{point.endTime},
            <if test="point.unitId != null">
                unit_id = #{point.unitId},
            </if>
            <if test="point.startTime != null">
                start_time = #{point.startTime},
            </if>
            <if test="point.endTime != null">
                end_time = #{point.endTime},
            </if>
            province_tag = #{point.provinceTag},
            important_command_image_tag = #{point.importantCommandImageTag}
            important_command_image_tag = #{point.importantCommandImageTag},
            dept_tag = #{point.deptTag}
            WHERE serial_number = #{point.serialNumber}
        </foreach>
    </update>