From 7f3e0cd59c16c12792c0b986e72ac844ceb1f483 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 10 Apr 2024 09:04:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#=20=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83app?= =?UTF-8?q?=E5=8D=B3=E6=97=B6=E6=8E=A8=E9=80=81=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PushMessageServiceImpl.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java index 4d7a943..b094107 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; /** @@ -112,14 +113,20 @@ public class PushMessageServiceImpl implements IMessageService { * @param tenantId 租户ID * @return 推送结果 */ - public R sendAndroidMsg(String subject,String content,List userIds,String tenantId) { + public synchronized R sendAndroidMsg(String subject,String content,List userIds,String tenantId) { PushInfoVO pushInfoVO = new PushInfoVO(); PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.Android).build(); PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build(); PushInfo pushInfo = new PushInfo("ops-push-android", subject, content,"", null, pushPlatform, pushAudience); pushInfoVO.setPushInfo(pushInfo); pushInfoVO.setTenantId(tenantId); - return pushClient.tenantPush(pushInfoVO); + R pushResponseR = pushClient.tenantPush(pushInfoVO); + try { + TimeUnit.SECONDS.sleep(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return pushResponseR; } /** @@ -130,13 +137,19 @@ public class PushMessageServiceImpl implements IMessageService { * @param tenantId 租户ID * @return 推送结果 */ - public R sendIOSMsg(String subject,String content,List userIds,String tenantId) { + public synchronized R sendIOSMsg(String subject,String content,List userIds,String tenantId) { PushInfoVO pushInfoVO = new PushInfoVO(); PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.IOS).build(); PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build(); PushInfo pushInfo = new PushInfo("ops-push-ios", subject, content,"", null, pushPlatform, pushAudience); pushInfoVO.setPushInfo(pushInfo); pushInfoVO.setTenantId(tenantId); - return pushClient.tenantPush(pushInfoVO); + R pushResponseR = pushClient.tenantPush(pushInfoVO); + try { + TimeUnit.SECONDS.sleep(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return pushResponseR; } } From 893eb8aeec9ee8585612c6f2c135c714be74d7f6 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 10 Apr 2024 09:06:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?#=20=E8=A7=86=E9=A2=91=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=A4=9A=E5=B9=B3=E5=8F=B0=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../video/entity/VideoPlatformEntity.java | 53 +++++++++++++ .../video/controller/VideoPlatformController.java | 92 ++++++++++++++++++++++ .../video/mapper/VideoPlatformMapper.java | 8 ++ .../video/service/IVideoConfigService.java | 11 +++ .../video/service/IVideoPlatformService.java | 8 ++ .../video/service/impl/VideoConfigServiceImpl.java | 20 +++++ .../service/impl/VideoPlatformServiceImpl.java | 12 +++ 7 files changed, 204 insertions(+) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/video/entity/VideoPlatformEntity.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/mapper/VideoPlatformMapper.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoConfigService.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoPlatformService.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoConfigServiceImpl.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoPlatformServiceImpl.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/video/entity/VideoPlatformEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/video/entity/VideoPlatformEntity.java new file mode 100644 index 0000000..96c151d --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/video/entity/VideoPlatformEntity.java @@ -0,0 +1,53 @@ +package com.hnac.hzims.operational.video.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.hnac.hzims.common.invalid.Create; +import com.hnac.hzims.common.invalid.Update; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.validator.constraints.Length; +import org.springblade.core.tenant.mp.TenantEntity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +@EqualsAndHashCode +@Data +@TableName("HZIMS_VIDEO_PLATFORM") +@ApiModel(value = "视频平台实体类",description = "视频平台实体类") +public class VideoPlatformEntity extends TenantEntity implements Serializable { + + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty(value = "主键id") + @NotNull(groups = Update.class) + private Long id; + + @ApiModelProperty("平台名称") + @NotBlank + @Size(min = 1,max = 50,groups = Create.class) + private String name; + + @ApiModelProperty("代理API网关nginx服务器ip端口") + @NotBlank + @Size(min = 1,max = 50,groups = Create.class) + private String videoHost; + + @ApiModelProperty("秘钥appKey") + @NotBlank + @Size(min = 1,max = 50,groups = Create.class) + private String appKey; + + @ApiModelProperty("秘钥appSecret") + @NotBlank + @Size(min = 1,max = 100,groups = Create.class) + private String appSecret; + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java new file mode 100644 index 0000000..964e085 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java @@ -0,0 +1,92 @@ +package com.hnac.hzims.operational.video.controller; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.common.invalid.Create; +import com.hnac.hzims.common.invalid.Update; +import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.common.support.constants.Order; +import com.hnac.hzims.common.support.utils.Condition; +import com.hnac.hzims.operational.OperationalConstants; +import com.hnac.hzims.operational.video.entity.VideoPlatformEntity; +import com.hnac.hzims.operational.video.service.IVideoPlatformService; +import com.hnac.hzinfo.log.annotation.Business; +import com.hnac.hzinfo.log.annotation.Operate; +import com.hnac.hzinfo.log.contants.BusinessType; +import com.hnac.hzinfo.log.contants.Risk; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiOperationSupport; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import okhttp3.MediaType; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.nio.charset.StandardCharsets; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; + +@RestController +@Api(value = "视频平台管理",tags = "视频平台管理") +@RequestMapping("/video/platform") +@AllArgsConstructor +@Business(module = OperationalConstants.APP_NAME,value = "视频平台管理",ignore = false) +public class VideoPlatformController extends BladeController { + + private final IVideoPlatformService videoPlatformService; + + + @PostMapping("/save") + @ApiOperation("新增海康视频平台") + @ApiOperationSupport(order = 1) + @Operate(label = "新增海康视频平台",type = BusinessType.INSERT,risk = Risk.LOW,ignore = false) + public R save(@Validated(Create.class) @RequestBody VideoPlatformEntity req) { + return R.status(videoPlatformService.save(req)); + } + + @PostMapping("/update") + @ApiOperation("编辑海康视频平台") + @ApiOperationSupport(order = 2) + @Operate(label = "编辑海康视频平台",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false) + public R update(@Validated(Update.class) @RequestBody VideoPlatformEntity req) { + return R.status(videoPlatformService.updateById(req)); + } + + @GetMapping("/detail") + @ApiOperation("查看视频平台详情") + @ApiOperationSupport(order = 3) + @Operate(label = "查看视频平台详情",type = BusinessType.QUERY,ignore = false) + public R detail(@RequestParam @ApiParam("主键ID") Long id) { + return R.data(videoPlatformService.getById(id)); + } + + @GetMapping("/list") + @ApiOperation("查询视频平台列表") + @ApiOperationSupport(order = 4) + @Operate(label = "查询视频平台列表",type = BusinessType.QUERY,ignore = false) + public R> list(VideoPlatformEntity req) { + HashMap sort = new HashMap() {{ + put("create_time", Order.DESC); + }}; + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(req, VideoPlatformEntity.class, sort); + return R.data(videoPlatformService.list(queryWrapper)); + } + + @DeleteMapping("/remove") + @ApiOperation("删除视频平台记录") + @ApiOperationSupport(order = 5) + @Operate(label = "删除视频平台记录",type = BusinessType.DELETE,risk = Risk.MEDIUM,ignore = false) + public R remove(@RequestParam @ApiParam("ids,按逗号分隔") String ids) { + return R.status(videoPlatformService.removeByIds(Func.toLongList(",",ids))); + } + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/mapper/VideoPlatformMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/mapper/VideoPlatformMapper.java new file mode 100644 index 0000000..711cc9e --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/mapper/VideoPlatformMapper.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.operational.video.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.operational.video.entity.VideoPlatformEntity; + +public interface VideoPlatformMapper extends BaseMapper { + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoConfigService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoConfigService.java new file mode 100644 index 0000000..1787dad --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoConfigService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.operational.video.service; + +/** + * @Author: huangxing + * @Date: 2024/04/09 16:21 + */ +public interface IVideoConfigService { + + // void importVideoConfig(String stationCode,); + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoPlatformService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoPlatformService.java new file mode 100644 index 0000000..843f25e --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoPlatformService.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.operational.video.service; + +import com.hnac.hzims.operational.video.entity.VideoPlatformEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IVideoPlatformService extends BaseService { + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoConfigServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoConfigServiceImpl.java new file mode 100644 index 0000000..7452693 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoConfigServiceImpl.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.operational.video.service.impl; + +import com.hnac.hzims.operational.station.service.IStationVideoTypeService; +import com.hnac.hzims.operational.video.service.IVideoConfigService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * @Author: huangxing + * @Date: 2024/04/09 16:21 + */ +@Service +@AllArgsConstructor +public class VideoConfigServiceImpl implements IVideoConfigService { + + private final IStationVideoTypeService videoService; + + + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoPlatformServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoPlatformServiceImpl.java new file mode 100644 index 0000000..179a15f --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoPlatformServiceImpl.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.operational.video.service.impl; + +import com.hnac.hzims.operational.video.entity.VideoPlatformEntity; +import com.hnac.hzims.operational.video.mapper.VideoPlatformMapper; +import com.hnac.hzims.operational.video.service.IVideoPlatformService; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class VideoPlatformServiceImpl extends BaseServiceImpl implements IVideoPlatformService { + +}