Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
ty 8 months ago
parent
commit
9280a03e9c
  1. 53
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/video/entity/VideoPlatformEntity.java
  2. 21
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
  3. 92
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/controller/VideoPlatformController.java
  4. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/mapper/VideoPlatformMapper.java
  5. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoConfigService.java
  6. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/IVideoPlatformService.java
  7. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoConfigServiceImpl.java
  8. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/video/service/impl/VideoPlatformServiceImpl.java

53
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;
}

21
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<PushResponse> sendAndroidMsg(String subject,String content,List<String> userIds,String tenantId) {
public synchronized R<PushResponse> sendAndroidMsg(String subject,String content,List<String> 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<PushResponse> 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<PushResponse> sendIOSMsg(String subject,String content,List<String> userIds,String tenantId) {
public synchronized R<PushResponse> sendIOSMsg(String subject,String content,List<String> 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<PushResponse> pushResponseR = pushClient.tenantPush(pushInfoVO);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return pushResponseR;
}
}

92
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<VideoPlatformEntity> 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>> list(VideoPlatformEntity req) {
HashMap<String, Order> sort = new HashMap<String, Order>() {{
put("create_time", Order.DESC);
}};
LambdaQueryWrapper<VideoPlatformEntity> 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)));
}
}

8
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<VideoPlatformEntity> {
}

11
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,);
}

8
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<VideoPlatformEntity> {
}

20
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;
}

12
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<VideoPlatformMapper, VideoPlatformEntity> implements IVideoPlatformService {
}
Loading…
Cancel
Save