Merge remote-tracking branch 'origin/master'
| | |
| | | @TableField("important_command_image_tag") |
| | | private Boolean importantCommandImageTag; |
| | | |
| | | @ApiModelProperty("部级标签") |
| | | @TableField("dept_tag") |
| | | private Boolean deptTag; |
| | | |
| | | @TableField("serial_number") |
| | | private String serialNumber; |
| | | |
| | |
| | | |
| | | @ColumnWidth(40) |
| | | @DateTimeFormat("yyyy-MM-dd") |
| | | @ExcelProperty("运维开始时间") |
| | | @ExcelProperty("运维开始时间(导入界面可改)") |
| | | private Date startTime; |
| | | |
| | | @ColumnWidth(40) |
| | | @DateTimeFormat("yyyy-MM-dd") |
| | | @ExcelProperty("运维结束时间") |
| | | @ExcelProperty("运维结束时间(导入界面可改)") |
| | | private Date endTime; |
| | | |
| | | @ExcelIgnore |
| | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("是否省厅标签(可修改)") |
| | | private String provinceTagString; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("是否重点指挥图像(可修改)") |
| | | private String importantCommandImageTagString; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("是否部级标签(可修改)") |
| | | private String deptTag; |
| | | |
| | | @ExcelIgnore |
| | | private Boolean importantTag; |
| | |
| | | @ExcelIgnore |
| | | private Boolean importantCommandImageTag; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("是否重点指挥图像(可修改)") |
| | | private String importantCommandImageTagString; |
| | | |
| | | } |
| | |
| | | |
| | | /** 重点点位标签 */ |
| | | 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(); |
| | |
| | | |
| | | //返回省厅国标码集合 |
| | | 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()); |
| | | } |
| | | |
| | |
| | | public Result importData(MultipartFile file, |
| | | Integer unitId, |
| | | String startTime, |
| | | Boolean needUpdateUnit, |
| | | String endTime) throws IOException, ParseException { |
| | | Date start = null; |
| | | Date end = null; |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 通过标签查重点点位或省厅点位或重点指挥图像 |
| | | */ |
| | | 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); |
| | | |
| | | /** |
| | | * 导出数据 |
| | |
| | | * @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; |
| | | } |
| | |
| | | } |
| | | |
| | | @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) { |
| | |
| | | * @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("导入数据不能为空"); |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | 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(); |
| | |
| | | <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"> |
| | |
| | | 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 |
| | |
| | | <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> |
| | | |
| | |
| | | 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 |
| | |
| | | <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> |