| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | |
| | | import com.ycl.utils.SecurityUtils; |
| | | import com.ycl.utils.poi.EasyExcelImportUtils; |
| | | import com.ycl.utils.uuid.IdUtils; |
| | | import constant.CheckConstants; |
| | | import constant.PointHeaderConstant; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | YwPoint entity = baseMapper.selectById(form.getId()); |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | if (form.getUnitId() != null) { |
| | | entity.setUnitId(Long.valueOf(form.getUnitId())); |
| | | }else { |
| | | entity.setUnitId(null); |
| | | } |
| | | Date now = new Date(); |
| | | entity.setUpdateTime(now); |
| | | baseMapper.updateById(entity); |
| | | baseMapper.myUpdateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | |
| | | headers.add(PointHeaderConstant.Point_Name); |
| | | headers.add(PointHeaderConstant.Serial_Number); |
| | | headers.add(PointHeaderConstant.IP); |
| | | headers.add(PointHeaderConstant.Province_Tag); |
| | | headers.add(PointHeaderConstant.Area); |
| | | headers.add(PointHeaderConstant.Unit); |
| | | headers.add(PointHeaderConstant.Province_Tag_Video); |
| | | headers.add(PointHeaderConstant.Province_Tag_Car); |
| | | headers.add(PointHeaderConstant.Province_Tag_Face); |
| | | headers.add(PointHeaderConstant.Impotrant_Command_Image); |
| | | headers.add(PointHeaderConstant.Dept_Tag); |
| | | List<String> headersList = new LinkedList<>(); |
| | |
| | | list.add(export.getPointName()); |
| | | list.add(export.getSerialNumber()); |
| | | list.add(export.getPointIP()); |
| | | list.add(export.getProvinceTagString()); |
| | | list.add(export.getArea()); |
| | | list.add(export.getUnitName()); |
| | | list.add(export.getProvinceTagVideoString()); |
| | | list.add(export.getProvinceTagCarString()); |
| | | list.add(export.getProvinceTagFaceString()); |
| | | list.add(export.getImportantCommandImageTagString()); |
| | | list.add(export.getDeptTagString()); |
| | | for (String header : headersList) { |
| | |
| | | pointExport.setPointName(map.get(PointHeaderConstant.Point_Name)); |
| | | pointExport.setPointIP(map.get(PointHeaderConstant.IP)); |
| | | pointExport.setSerialNumber(map.get(PointHeaderConstant.Serial_Number)); |
| | | pointExport.setProvinceTag("是".equals(map.get(PointHeaderConstant.Province_Tag))); |
| | | pointExport.setProvinceTagVideo("是".equals(map.get(PointHeaderConstant.Province_Tag_Video))); |
| | | pointExport.setProvinceTagCar("是".equals(map.get(PointHeaderConstant.Province_Tag_Car))); |
| | | pointExport.setProvinceTagFace("是".equals(map.get(PointHeaderConstant.Province_Tag_Face))); |
| | | pointExport.setImportantCommandImageTag("是".equals(map.get(PointHeaderConstant.Impotrant_Command_Image))); |
| | | pointExport.setDeptTag("是".equals(map.get(PointHeaderConstant.Dept_Tag))); |
| | | List<DynamicColumnVO> dynamics = new ArrayList<>(); |
| | |
| | | List<YwPoint> pointList = dataList.stream().map(item -> { |
| | | YwPoint point = new YwPoint(); |
| | | point.setImportantCommandImageTag(item.getImportantCommandImageTag()); |
| | | point.setProvinceTag(item.getProvinceTag()); |
| | | point.setProvinceTagVideo(item.getProvinceTagVideo()); |
| | | point.setProvinceTagCar(item.getProvinceTagCar()); |
| | | point.setProvinceTagFace(item.getProvinceTagFace()); |
| | | point.setDeptTag(item.getDeptTag()); |
| | | if (needUpdateUnit) { |
| | | if (Objects.nonNull(unitId)) { |
| | | point.setUnitId(Long.valueOf(unitId)); |
| | | } else { |
| | | point.setUnitId(null); |
| | | } |
| | | point.setStartTime(startTime); |
| | | point.setEndTime(endTime); |
| | |
| | | point.setSerialNumber(item.getSerialNumber()); |
| | | return point; |
| | | }).collect(Collectors.toList()); |
| | | this.waitAllFinishAndGetResult(pointList); |
| | | this.waitAllFinishAndGetResult(pointList, needUpdateUnit); |
| | | } |
| | | |
| | | @Override |
| | |
| | | //数据库里查不到excel里面的这个点位动态列,全为新增 |
| | | List<DynamicColumnVO> dynamicData = pointExport.getDynamicData(); |
| | | for (DynamicColumnVO excelData : dynamicData) { |
| | | if(excelData.getColumnValue()!=null) { |
| | | if (excelData.getColumnValue() != null) { |
| | | Integer dynamicId = dictionary.get(excelData.getLabelValue()); |
| | | DynamicColumnValue entity = new DynamicColumnValue(); |
| | | entity.setColumnValue(excelData.getColumnValue()); |
| | |
| | | } |
| | | } |
| | | } |
| | | //mybaits方法 |
| | | //插入 |
| | | if(!CollectionUtils.isEmpty(insertList)) dynamicColumnMapper.saveBatch(insertList); |
| | | if (!CollectionUtils.isEmpty(insertList)) dynamicColumnMapper.saveBatch(insertList); |
| | | //更新 |
| | | if(!CollectionUtils.isEmpty(updateList)) dynamicColumnMapper.updateBatch(updateList); |
| | | if (!CollectionUtils.isEmpty(updateList)) dynamicColumnMapper.updateBatch(updateList); |
| | | //删除 |
| | | if(!CollectionUtils.isEmpty(deleteList)) dynamicColumnMapper.deleteBatchIds(deleteList); |
| | | if (!CollectionUtils.isEmpty(deleteList)) dynamicColumnMapper.deleteBatch(deleteList); |
| | | } |
| | | |
| | | public void waitAllFinishAndGetResult(List<YwPoint> dataList) { |
| | | /** |
| | | * 根据设备编码查询点位信息 |
| | | * |
| | | * @param serialNumber 序列号 |
| | | * @return {@link YwPoint } |
| | | * @author |
| | | */ |
| | | @Override |
| | | public YwPoint selectBySerialNumber(String serialNumber) { |
| | | return baseMapper.selectOne(new LambdaQueryWrapper<>(YwPoint.class).eq(YwPoint::getSerialNumber, serialNumber).eq(YwPoint::getDeleted, "0")); |
| | | } |
| | | |
| | | public void waitAllFinishAndGetResult(List<YwPoint> dataList, Boolean needUpdateUnit) { |
| | | Date startTime = new Date(); |
| | | this.baseMapper.updatePoint(dataList); |
| | | this.baseMapper.updatePoint(dataList, needUpdateUnit); |
| | | Date endTime = new Date(); |
| | | log.error("总共耗时:" + (endTime.getTime() - startTime.getTime())); |
| | | } |
| | | |
| | | @Override |
| | | public <T extends BaseResult> void setDeviceTagByGB(List<T> dataList) { |
| | | public <T extends BaseResult> void setDeviceTagByGB(List<T> dataList,Short category) { |
| | | List<String> gbList = dataList.stream().map(BaseResult::getNo).collect(Collectors.toList()); |
| | | List<CheckTagVO> pointList = baseMapper.getTagsByGB(gbList); |
| | | Map<String, CheckTagVO> pointMap = pointList.stream().collect(Collectors.toMap(CheckTagVO::getNo, item -> item)); |
| | |
| | | CheckTagVO tag = pointMap.get(data.getNo()); |
| | | if (Objects.nonNull(tag)) { |
| | | BeanUtils.copyProperties(tag, data); |
| | | //通过设备类型打省厅标签 |
| | | if(CheckConstants.Rule_Category_Video.equals(category)){ |
| | | data.setProvinceTag(tag.getProvinceTagVideo()); |
| | | }else if(CheckConstants.Rule_Category_Car.equals(category)){ |
| | | data.setProvinceTag(tag.getProvinceTagCar()); |
| | | }else if(CheckConstants.Rule_Category_Face.equals(category)){ |
| | | data.setProvinceTag(tag.getProvinceTagFace()); |
| | | }else if(CheckConstants.Rule_Category_Or.equals(category)){ |
| | | if(tag.getProvinceTagVideo() || tag.getProvinceTagCar() || tag.getProvinceTagFace()) { |
| | | data.setProvinceTag(Boolean.TRUE); |
| | | }else { |
| | | data.setProvinceTag(Boolean.FALSE); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |