Browse Source

#测试代码删除

zhongwei
yang_shj 5 months ago
parent
commit
b6e27ce3e5
  1. 80
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java
  2. 24
      hzims-service/topvision/Dockerfile
  3. 39
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/TopvisionApplication.java
  4. 142
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/controller/ImsTopvisionUserController.java
  5. 123
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/controller/TopvisionVideoController.java
  6. 16
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/ImsTopvisionUserMapper.java
  7. 11
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/ImsTopvisionUserMapper.xml
  8. 13
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/TopvisionVideoMapper.java
  9. 7
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/TopvisionVideoMapper.xml
  10. 42
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/IImsTopvisionUserService.java
  11. 22
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/ITopvisionVideoService.java
  12. 229
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/impl/ImsTopvisionUserServiceImpl.java
  13. 91
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/impl/TopvisionVideoServiceImpl.java
  14. 20
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/vo/UserVO.java
  15. 31
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/wrapper/ImsTopvisionUserWrapper.java
  16. 31
      hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/wrapper/TopvisionVideoWrapper.java
  17. 30
      hzims-service/topvision/src/test/java/BladeDemoTest.java
  18. 46
      hzims-service/topvision/src/test/java/launcher/DemoTestLauncherServiceImpl.java
  19. 64
      hzims-service/weather/src/test/java/com/hnac/hzims/weather/WeatherApplicationTest.java
  20. 13
      hzims-service/weather/src/test/java/com/hnac/hzims/weather/WeatherApplicationTests.java
  21. 46
      hzims-service/weather/src/test/java/com/hnac/hzims/weather/launcher/DemoTestLauncherServiceImpl.java
  22. 46
      hzims-service/weather/src/test/resources/launcher/DemoTestLauncherServiceImpl.java

80
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/areamonthly/feign/fallback/TaskFeignClientFallback.java

@ -1,80 +0,0 @@
// package com.hnac.hzinfo.inspect.areamonthly.feign.fallback;
//
// import com.baomidou.mybatisplus.core.metadata.IPage;
// import com.hnac.hzims.vo.VoteChartVo;
// import com.hnac.hzinfo.inspect.areamonthly.feign.TaskFeignClient;
// import com.hnac.hzinfo.inspect.areamonthly.vo.EventListVO;
// import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
// import com.hnac.hzinfo.inspect.areamonthly.vo.TaskObjectVO;
// import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
// import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
// import lombok.extern.slf4j.Slf4j;
// import org.springblade.core.mp.support.BladePage;
// import org.springblade.core.mp.support.Query;
// import org.springblade.core.secure.BladeUser;
// import org.springblade.core.tool.api.R;
// import org.springframework.stereotype.Service;
//
// import java.util.List;
//
// /**
// * @Author WL
// * @Version v1.0
// * @Serial 1.0
// * @Date 2023/4/11 17:23
// */
// @Slf4j
// @Service
// public class TaskFeignClientFallback implements TaskFeignClient {
// @Override
// public R<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
//
// return R.fail("远程调用失败");
// }
//
// @Override
// public R<TaskEntity> detail(Long id) {
// return R.fail("远程调用失败");
// }
//
// /**
// * 巡检任务分页
// *
// * @param page
// * @param size
// * @param task
// */
// @Override
// public R<BladePage<TaskVo>> pageList(Long page, Long size, TaskListQuery task) {
// return R.fail("远程调用失败");
// }
//
//
// @Override
// public R<BladePage<EventListVO>> eventList(Long taskId, Query query, BladeUser bladeUser) {
// return R.fail("远程调用失败");
// }
//
// /**
// * 获取任务详情
// *
// * @param id
// */
// @Override
// public R<List<TaskObjectVO>> getTaskById(Long id) {
// return R.fail("远程调用失败");
// }
//
// /**
// * 巡检计划统计
// *
// * @param startTime
// * @param endTime
// * @param deptId
// */
// @Override
// public R<List<VoteChartVo>> getTaskListStatistics(String startTime, String endTime, Long deptId) {
// return R.fail("远程调用失败");
// }
//
// }

24
hzims-service/topvision/Dockerfile

@ -1,24 +0,0 @@
FROM adoptopenjdk/openjdk8-openj9:alpine-slim
MAINTAINER smallchill@163.com
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add -U tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk add --no-cache bash bash-doc bash-completion \
&& apk del tzdata \
&& rm -rf /var/cache/apk/*
RUN mkdir -p /blade/desk
WORKDIR /blade/desk
EXPOSE 8105
ADD ./target/duty.jar ./app.jar
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
CMD ["--spring.profiles.active=test"]

39
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/TopvisionApplication.java

@ -1,39 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.topvision;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springframework.cloud.client.SpringCloudApplication;
/**
* topvision启动器
*
* @author Chill
*/
@EnableBladeFeign
@SpringCloudApplication
@MapperScan("com.hnac.hzims.topvision.**.mapper.**")
public class TopvisionApplication {
public static void main(String[] args) {
BladeApplication.run("hzims-topvision", TopvisionApplication.class, args);
}
}

142
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/controller/ImsTopvisionUserController.java

@ -1,142 +0,0 @@
package com.hnac.hzims.topvision.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.topvision.dto.TopvisionUserInfo;
import io.swagger.annotations.Api;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.redis.lock.RedisLock;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.topvision.entity.ImsTopvisionUserEntity;
import com.hnac.hzims.topvision.service.IImsTopvisionUserService;
import java.util.List;
/**
* 鼎视用户 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping("/topvision-user")
@Api(value = "鼎视用户", tags = "鼎视用户")
public class ImsTopvisionUserController extends BladeController {
private final IImsTopvisionUserService topvisionUserService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入topvisionUser")
public R<ImsTopvisionUserEntity> detail(ImsTopvisionUserEntity topvisionUser) {
ImsTopvisionUserEntity detail = topvisionUserService.getOne(Condition.getQueryWrapper(topvisionUser));
return R.data(detail);
}
/**
* 分页 代码自定义代号
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入topvisionUser")
@OperationAnnotation(moduleName ="远程协作",
title = "远程协作",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页查询")
public R<IPage<ImsTopvisionUserEntity>> list(ImsTopvisionUserEntity topvisionUser, Query query) {
IPage<ImsTopvisionUserEntity> pages = topvisionUserService.page(Condition.getPage(query), Condition.getQueryWrapper(topvisionUser));
return R.data(pages);
}
/**
* 根据companyId获取未被选择的鼎视用户
*/
@GetMapping("/unselected-topvision-users")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "根据companyId获取未被选择的鼎视用户", notes = "传入companyId")
public R<List<TopvisionUserInfo>> unSelectedTopvisionUsers(@ApiParam(value = "公司ID", required = true)Integer companyId) {
return R.data(topvisionUserService.getUnSelectedUsers(companyId));
}
/**
* 分页获取用户信息含绑定鼎视用户
*/
/* @GetMapping("/user-list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页获取用户信息,含绑定鼎视用户", notes = "传入user")
public R<List<UserVO>> getUsersByPage(User user, Query query) {
return R.data(topvisionUserService.getUsersByPage(user, query));
}*/
/**
* 新增 代码自定义代号
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入topvisionUser")
@RedisLock(value = "HZIMS:TOPVISION:TOP_USER_NAME:", param = "#topvisionUser.topUserName")
public R save(@Valid @RequestBody ImsTopvisionUserEntity topvisionUser) {
List<ImsTopvisionUserEntity> list = topvisionUserService.list(Wrappers.<ImsTopvisionUserEntity>lambdaQuery().eq(ImsTopvisionUserEntity::getTopUserName, topvisionUser.getTopUserName()));
if(Func.isNotEmpty(list) && list.size() > 0){
return R.fail("该远程协作账号已被绑定,请更换账号");
}
List<ImsTopvisionUserEntity> list2 = topvisionUserService.list(Wrappers.<ImsTopvisionUserEntity>lambdaQuery().eq(ImsTopvisionUserEntity::getUserId, topvisionUser.getUserId()));
if(Func.isNotEmpty(list2) && list2.size() > 0){
return R.fail("该账号已经绑定了远程协作账号,请不要重复绑定");
}
return R.status(topvisionUserService.save(topvisionUser));
}
/**
* 删除 代码自定义代号
*/
@PostMapping("/remove-by-userId")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "删除", notes = "传入userId")
public R remove(@ApiParam(value = "userId", required = true) @RequestParam Long userId) {
topvisionUserService.deleteByUserId(userId);
return R.success("操作成功");
}
/**
* 根据用户id修改绑定的鼎视用户
*/
@PostMapping("/update-by-userId")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "根据用户id修改绑定的鼎视用户", notes = "传入topvisionUser")
@RedisLock(value = "HZIMS:TOPVISION:TOP_USER_NAME:", param = "#topvisionUser.topUserName")
public R updateByUserId(@Valid @RequestBody ImsTopvisionUserEntity topvisionUser) {
List<ImsTopvisionUserEntity> list = topvisionUserService.list(Wrappers.<ImsTopvisionUserEntity>lambdaQuery()
.eq(ImsTopvisionUserEntity::getTopUserName, topvisionUser.getTopUserName())
.ne(ImsTopvisionUserEntity::getUserId, topvisionUser.getUserId()));
if(Func.isNotEmpty(list) && list.size() > 0){
return R.fail("该远程协作账号已被绑定,请更换账号");
}
List<ImsTopvisionUserEntity> list2 = topvisionUserService.list(Wrappers.<ImsTopvisionUserEntity>lambdaQuery()
.eq(ImsTopvisionUserEntity::getUserId, topvisionUser.getUserId()));
if(Func.isEmpty(list2) || list2.size() == 0){
topvisionUser.setId(null);
R.status(topvisionUserService.save(topvisionUser));
}
return R.status(topvisionUserService.updateByUserId(topvisionUser));
}
}

123
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/controller/TopvisionVideoController.java

@ -1,123 +0,0 @@
package com.hnac.hzims.topvision.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.topvision.entity.TopvisionVideoEntity;
import com.hnac.hzims.topvision.service.ITopvisionVideoService;
import java.util.List;
/**
* 控制器
*
* @author Chill
*/
@RestController
@AllArgsConstructor
@RequestMapping("/topvisionVideo")
@Api(value = "鼎视视频历史记录", tags = "鼎视视频历史记录")
public class TopvisionVideoController extends BladeController {
private final ITopvisionVideoService topvisionVideoService;
/**
* 详情
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入topvisionVideo")
public R<TopvisionVideoEntity> detail(TopvisionVideoEntity topvisionVideo) {
TopvisionVideoEntity detail = topvisionVideoService.getOne(Condition.getQueryWrapper(topvisionVideo));
return R.data(detail);
}
/**
* 查看列表-分页 代码自定义代号
*/
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "查看列表-分页", notes = "传入topvisionVideo")
public R<IPage<TopvisionVideoEntity>> list(TopvisionVideoEntity topvisionVideo, Query query) {
QueryWrapper<TopvisionVideoEntity> queryWrapper = Condition.getQueryWrapper(topvisionVideo);
if(Func.isNotEmpty(topvisionVideo.getCreatetime())){
queryWrapper.ge("createtime", topvisionVideo.getCreatetime());
}
if(Func.isNotEmpty(topvisionVideo.getEndtime())){
queryWrapper.le("createtime", topvisionVideo.getEndtime());
}
queryWrapper.orderByDesc("createtime");
IPage<TopvisionVideoEntity> pages = topvisionVideoService.page(Condition.getPage(query), queryWrapper);
return R.data(pages);
}
/**
* 获取编辑列表-不分页
* @param companyId
* @return
*/
@GetMapping("/editList")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "获取编辑列表 - 不分页", notes = "传入公司ID")
public R<List<TopvisionVideoEntity>> editList(@ApiParam(value = "公司ID", required = true)Integer companyId){
List<TopvisionVideoEntity> list = topvisionVideoService.getEditList(companyId);
return R.data(list);
}
/**
* 新增 代码自定义代号
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入topvisionVideo")
public R save(@Valid @RequestBody TopvisionVideoEntity topvisionVideo) {
return R.status(topvisionVideoService.save(topvisionVideo));
}
/**
* 修改 代码自定义代号
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入topvisionVideo")
public R update(@Valid @RequestBody TopvisionVideoEntity topvisionVideo) {
return R.status(topvisionVideoService.updateById(topvisionVideo));
}
/**
* 新增或修改 代码自定义代号
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入topvisionVideo")
public R submit(@Valid @RequestBody TopvisionVideoEntity topvisionVideo) {
return R.status(topvisionVideoService.saveOrUpdate(topvisionVideo));
}
/**
* 删除 代码自定义代号
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(topvisionVideoService.removeByIds(Func.toLongList(ids)));
}
}

16
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/ImsTopvisionUserMapper.java

@ -1,16 +0,0 @@
package com.hnac.hzims.topvision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.topvision.entity.ImsTopvisionUserEntity;
import org.apache.ibatis.annotations.Param;
/**
* 鼎视用户 Mapper 接口
*
* @author Chill
*/
public interface ImsTopvisionUserMapper extends BaseMapper<ImsTopvisionUserEntity> {
void deleteByUserId(@Param("userId") Long userId);
}

11
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/ImsTopvisionUserMapper.xml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.topvision.mapper.ImsTopvisionUserMapper">
<delete id="deleteByUserId" >
delete from hz_ims_topvision_user where USER_ID = #{userId}
</delete>
</mapper>

13
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/TopvisionVideoMapper.java

@ -1,13 +0,0 @@
package com.hnac.hzims.topvision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.topvision.entity.TopvisionVideoEntity;
/**
* Mapper 接口
*
* @author Chill
*/
public interface TopvisionVideoMapper extends BaseMapper<TopvisionVideoEntity> {
}

7
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/mapper/TopvisionVideoMapper.xml

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.topvision.mapper.TopvisionVideoMapper">
</mapper>

42
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/IImsTopvisionUserService.java

@ -1,42 +0,0 @@
package com.hnac.hzims.topvision.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.topvision.dto.TopvisionUserInfo;
import com.hnac.hzims.topvision.vo.UserVO;
import com.hnac.hzims.topvision.entity.ImsTopvisionUserEntity;
import org.springblade.core.mp.support.Query;
import org.springblade.system.user.entity.User;
import java.util.List;
/**
* 鼎视用户 服务类
*
* @author Chill
*/
public interface IImsTopvisionUserService extends IService<ImsTopvisionUserEntity> {
/**
* 获取 未被选择的鼎视用户
* @param companyId 公司id
* @return
*/
List<TopvisionUserInfo> getUnSelectedUsers(Integer companyId);
/**
* 获取用户信息含鼎视账号关联信息
* TODO: 由于平台组不适合提供用户分页接口固该方法逻辑改为前端实现
* @return
*/
List<UserVO> getUsersByPage(User user, Query query);
/**
* 根据用户id 更新
* @param topvisionUser
* @return
*/
boolean updateByUserId(ImsTopvisionUserEntity topvisionUser);
void deleteByUserId(Long userId);
}

22
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/ITopvisionVideoService.java

@ -1,22 +0,0 @@
package com.hnac.hzims.topvision.service;
import com.hnac.hzims.topvision.entity.TopvisionVideoEntity;
import java.util.List;
/**
* 服务类
*
* @author Chill
*/
public interface ITopvisionVideoService extends IService<TopvisionVideoEntity> {
/**
* 获取编辑列表
* @param companyId
* @return
*/
List<TopvisionVideoEntity> getEditList(Integer companyId);
}

229
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/impl/ImsTopvisionUserServiceImpl.java

@ -1,229 +0,0 @@
package com.hnac.hzims.topvision.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.topvision.dto.TopvisionReponse;
import com.hnac.hzims.topvision.dto.TopvisionUserInfo;
import com.hnac.hzims.topvision.vo.UserVO;
import org.springblade.core.http.HttpRequest;
import org.springblade.core.http.LogLevel;
import org.springblade.core.log.exception.ServiceException;
import com.hnac.hzims.topvision.entity.ImsTopvisionUserEntity;
import com.hnac.hzims.topvision.mapper.ImsTopvisionUserMapper;
import com.hnac.hzims.topvision.service.IImsTopvisionUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 鼎视用户 服务实现类
*
* @author Chill
*/
@Service
public class ImsTopvisionUserServiceImpl extends ServiceImpl<ImsTopvisionUserMapper, ImsTopvisionUserEntity> implements IImsTopvisionUserService {
@Value("${topvision.url}")
private String topvisionBaseUrl;
private IUserClient userClient;
@Override
public boolean save(ImsTopvisionUserEntity entity) {
checkParam(entity);
return super.save(entity);
}
@Override
public boolean updateById(ImsTopvisionUserEntity entity) {
checkParam(entity);
return super.updateById(entity);
}
@Override
public boolean saveOrUpdate(ImsTopvisionUserEntity entity) {
checkParam(entity);
return super.saveOrUpdate(entity);
}
/**
* 校验参数
* @param entity
*/
private void checkParam(ImsTopvisionUserEntity entity){
entity.setTenantId(AuthUtil.getTenantId());
if(Func.isEmpty(entity.getTopCompanyId())){
throw new ServiceException("公司ID不能为空");
}
if(Func.isEmpty(entity.getTopCompanyName())){
throw new ServiceException("公司名称不能为空");
}
if(Func.isEmpty(entity.getUserId())){
throw new ServiceException("用户ID不能为空");
}
if(Func.isEmpty(entity.getUserName())){
throw new ServiceException("用户名称不能为空");
}
if(Func.isEmpty(entity.getUserAccount())){
throw new ServiceException("用户账号不能为空");
}
if(Func.isEmpty(entity.getTopUserName())){
throw new ServiceException("鼎视用户账号不能为空");
}
if(Func.isEmpty(entity.getTopUserRealName())){
throw new ServiceException("鼎视用户名称不能为空");
}
if(Func.isEmpty(entity.getTopUserPassword())){
throw new ServiceException("鼎视用户密码不能为空");
}
}
/**
* 获取 未被选择的鼎视用户
* @param companyId 公司id
* @return
*/
@Override
public List<TopvisionUserInfo> getUnSelectedUsers(Integer companyId){
List<TopvisionUserInfo> userInfos = getTopvisionUser(companyId);
List<TopvisionUserInfo> re ;
ImsTopvisionUserEntity query = new ImsTopvisionUserEntity();
query.setTopCompanyId(companyId);
List<ImsTopvisionUserEntity> selectedUsers = list(Condition.getQueryWrapper(query));
if(Func.isNotEmpty(selectedUsers) && Func.isNotEmpty(userInfos)){
re = userInfos.stream()
.filter(userInfo -> !containsUser(selectedUsers,userInfo))
.collect(Collectors.toList());
} else {
re = userInfos;
}
return re;
}
/**
* 获取鼎视用户
* @param companyId 公司id
* @return
*/
private List<TopvisionUserInfo> getTopvisionUser(Integer companyId){
TopvisionReponse result = HttpRequest.get(topvisionBaseUrl + "user/query")
// 设定全局日志级别 NONE,BASIC,HEADERS,BODY, 默认:NONE
.log(LogLevel.BODY)
.query("pageIndex",1)
.query("pageSize",1000)
.query("companyId",companyId)
.execute()
.onFailed(((request, e) -> {
System.out.println("获取鼎视用户失败:" + e.toString());
}))
.asValue(TopvisionReponse.class);
if(Func.isEmpty(result) || Func.isEmpty(result.getData())){
return null;
}
return result.getData().getList();
}
/**
* 是否包含 已选用户
* @param selectedUsers 已选用户列表
* @param userInfo
* @return
*/
private boolean containsUser(List<ImsTopvisionUserEntity> selectedUsers,TopvisionUserInfo userInfo){
for (ImsTopvisionUserEntity entity: selectedUsers) {
if(entity.getTopUserName().equals(userInfo.getUser_name())){
return true;
}
}
return false;
}
/**
* 获取用户信息含鼎视账号关联信息
* TODO: 还未分页
* @return
*/
@Override
public List<UserVO> getUsersByPage(User quser, Query q){
List<UserVO> reList = new ArrayList<>();
/** 获取HZ用户信息 TODO 用户RPC分页接口未完成,由于平台组不适合提供该接口,固该方法逻辑改为前端实现 **/
List<User> users = userClient.userList(AuthUtil.getTenantId(),null).getData();
if(Func.isNotEmpty(users)){
/** 获取用户id数组 **/
List<Long> userIds = new ArrayList<>();
for (User user:users) {
userIds.add(user.getId());
}
/** 获取用户关联鼎视列表 **/
QueryWrapper<ImsTopvisionUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("TENANT_ID",AuthUtil.getTenantId());
queryWrapper.in("USER_ID", userIds);
List<ImsTopvisionUserEntity> selectedUsers = list(queryWrapper);
/** 设置用户 鼎视关联账号**/
for (User user:users) {
UserVO vo = BeanUtil.copy(user, UserVO.class);
vo.setTopvisionUserEntity(getEntity(selectedUsers, vo.getId()));
reList.add(vo);
}
}
return reList;
}
@Override
public void deleteByUserId(Long userId) {
this.baseMapper.deleteByUserId(userId);
}
@Override
public boolean updateByUserId(ImsTopvisionUserEntity topvisionUser) {
if(Func.isEmpty(topvisionUser.getTopCompanyId())){
throw new ServiceException("公司ID不能为空");
}
if(Func.isEmpty(topvisionUser.getTopCompanyName())){
throw new ServiceException("公司名称不能为空");
}
if(Func.isEmpty(topvisionUser.getUserId())){
throw new ServiceException("用户ID不能为空");
}
if(Func.isEmpty(topvisionUser.getTopUserName())){
throw new ServiceException("鼎视用户账号不能为空");
}
if(Func.isEmpty(topvisionUser.getTopUserPassword())){
throw new ServiceException("鼎视用户密码不能为空");
}
if(Func.isEmpty(topvisionUser.getTopUserRealName())){
throw new ServiceException("鼎视用户名称不能为空");
}
UpdateWrapper<ImsTopvisionUserEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("USER_ID",topvisionUser.getUserId());
return update(topvisionUser, updateWrapper);
}
/**
* 返回指定用户关联信息
* @param selectedUsers
* @param userId
* @return
*/
private ImsTopvisionUserEntity getEntity(List<ImsTopvisionUserEntity> selectedUsers,Long userId){
for (ImsTopvisionUserEntity entity : selectedUsers) {
if(entity.getUserId().equals(userId)){
return entity;
}
}
return null;
}
}

91
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/service/impl/TopvisionVideoServiceImpl.java

@ -1,91 +0,0 @@
package com.hnac.hzims.topvision.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.gson.JsonObject;
import com.hnac.hzims.topvision.dto.TopvisionVideoReponse;
import okhttp3.MediaType;
import org.joda.time.DateTime;
import org.springblade.core.http.HttpRequest;
import org.springblade.core.http.LogLevel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.topvision.entity.TopvisionVideoEntity;
import com.hnac.hzims.topvision.mapper.TopvisionVideoMapper;
import com.hnac.hzims.topvision.service.ITopvisionVideoService;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 服务实现类
*
* @author Chill
*/
@Service
public class TopvisionVideoServiceImpl extends ServiceImpl<TopvisionVideoMapper, TopvisionVideoEntity> implements ITopvisionVideoService {
private static final String TAG = "TopvisionVideoServiceImpl";
@Value("${topvision.url}")
private String topvisionBaseUrl;
@Autowired
BladeLogger bladeLogger;
/**
* 获取编辑列表
* @param companyId
* @return
*/
@Override
public List<TopvisionVideoEntity> getEditList(Integer companyId) {
List<TopvisionVideoEntity> originalList = getTopvisionVideo(companyId);
List<TopvisionVideoEntity> newList = this.list(Wrappers.<TopvisionVideoEntity>lambdaQuery().eq(TopvisionVideoEntity::getCompanyId, companyId));
List<TopvisionVideoEntity> collect = originalList.stream()
.filter(item ->
!(newList.stream().anyMatch(newItem -> newItem.getConfid().equals(item.getConfid())))
).collect(Collectors.toList());
List<TopvisionVideoEntity> re = Stream.of(collect, newList)
.flatMap(Collection::stream)
.sorted(Comparator.comparing(TopvisionVideoEntity::getStarttime, Comparator.nullsLast(Date::compareTo)).reversed())
.collect(Collectors.toList());
return re;
}
/**
* 获取鼎视用户
* @param companyId 公司id
* @return
*/
private List<TopvisionVideoEntity> getTopvisionVideo(Integer companyId){
JsonObject object = new JsonObject();
object.addProperty("pageindex",1);
object.addProperty("pagesize",1000000);
object.addProperty("companyid",companyId);
object.addProperty("status","2");
TopvisionVideoReponse result = HttpRequest.post(topvisionBaseUrl + "video/conferences/videos2")
// 设定全局日志级别 NONE,BASIC,HEADERS,BODY, 默认:NONE
.log(LogLevel.BODY)
.setHeader("Content-Type", "application/json")
.bodyString(MediaType.parse("application/json;charset=utf-8"),object.toString())
.execute()
.onFailed(((request, e) -> {
bladeLogger.error(TAG,"获取鼎视视频资源失败:" + e.toString());
}))
.asValue(TopvisionVideoReponse.class);
if(Func.isEmpty(result) || Func.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData().getConfInfo();
}
}

20
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/vo/UserVO.java

@ -1,20 +0,0 @@
package com.hnac.hzims.topvision.vo;
import com.hnac.hzims.topvision.entity.ImsTopvisionUserEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.system.user.entity.User;
/**
* @Author: py
*/
@Data
public class UserVO extends User {
/**
* 用户绑定鼎视账号信息
*/
@ApiModelProperty(value = "用户绑定鼎视账号信息")
private ImsTopvisionUserEntity topvisionUserEntity;
}

31
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/wrapper/ImsTopvisionUserWrapper.java

@ -1,31 +0,0 @@
package com.hnac.hzims.topvision.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import com.hnac.hzims.topvision.entity.ImsTopvisionUserEntity;
import com.hnac.hzims.topvision.vo.ImsTopvisionUserVO;
/**
* 鼎视用户 包装类,返回视图层所需的字段
*
* @author Chill
*/
public class ImsTopvisionUserWrapper extends BaseEntityWrapper<ImsTopvisionUserEntity, ImsTopvisionUserVO> {
public static ImsTopvisionUserWrapper build() {
return new ImsTopvisionUserWrapper();
}
@Override
public ImsTopvisionUserVO entityVO(ImsTopvisionUserEntity topvisionUser) {
ImsTopvisionUserVO topvisionUserVO = BeanUtil.copy(topvisionUser, ImsTopvisionUserVO.class);
//User createUser = UserCache.getUser(topvisionUser.getCreateUser());
//User updateUser = UserCache.getUser(topvisionUser.getUpdateUser());
//topvisionUserVO.setCreateUserName(createUser.getName());
//topvisionUserVO.setUpdateUserName(updateUser.getName());
return topvisionUserVO;
}
}

31
hzims-service/topvision/src/main/java/com/hnac/hzims/topvision/wrapper/TopvisionVideoWrapper.java

@ -1,31 +0,0 @@
package com.hnac.hzims.topvision.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import com.hnac.hzims.topvision.entity.TopvisionVideoEntity;
import com.hnac.hzims.topvision.vo.TopvisionVideoVO;
/**
* 包装类,返回视图层所需的字段
*
* @author Chill
*/
public class TopvisionVideoWrapper extends BaseEntityWrapper<TopvisionVideoEntity, TopvisionVideoVO> {
public static TopvisionVideoWrapper build() {
return new TopvisionVideoWrapper();
}
@Override
public TopvisionVideoVO entityVO(TopvisionVideoEntity topvisionVideo) {
TopvisionVideoVO topvisionVideoVO = BeanUtil.copy(topvisionVideo, TopvisionVideoVO.class);
//User createUser = UserCache.getUser(topvisionVideo.getCreateUser());
//User updateUser = UserCache.getUser(topvisionVideo.getUpdateUser());
//topvisionVideoVO.setCreateUserName(createUser.getName());
//topvisionVideoVO.setUpdateUserName(updateUser.getName());
return topvisionVideoVO;
}
}

30
hzims-service/topvision/src/test/java/BladeDemoTest.java

@ -1,30 +0,0 @@
//import com.hnac.hzims.monitor.TopvisionApplication;
import com.hnac.hzims.topvision.TopvisionApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springblade.core.test.BladeBootTest;
import org.springblade.core.test.BladeSpringRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
/**
* Blade单元测试
*
* @author Chill
*/
@RunWith(BladeSpringRunner.class)
@SpringBootTest(classes = TopvisionApplication.class)
@BladeBootTest(appName = "hzims-monitor", profile = "test", enableLoader = true)
public class BladeDemoTest {
@Autowired
// private INoticeService noticeService;
@Test
public void contextLoads() {
// int count = noticeService.count();
System.out.println("notice数量:[] 个");
}
}

46
hzims-service/topvision/src/test/java/launcher/DemoTestLauncherServiceImpl.java

@ -1,46 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package launcher;
import com.hnac.hzims.common.constant.LauncherConstant;
import org.springblade.core.auto.service.AutoService;
import org.springblade.core.launch.service.LauncherService;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
/**
* 启动参数拓展
*
* @author Chill
*/
@AutoService(LauncherService.class)
public class DemoTestLauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
Properties props = System.getProperties();
props.setProperty("spring.cloud.nacos.discovery.server-addr", LauncherConstant.NACOS_DEV_ADDR);
props.setProperty("spring.cloud.nacos.config.server-addr", LauncherConstant.NACOS_DEV_ADDR);
props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.SENTINEL_DEV_ADDR);
}
@Override
public int getOrder() {
return 10;
}
}

64
hzims-service/weather/src/test/java/com/hnac/hzims/weather/WeatherApplicationTest.java

@ -1,64 +0,0 @@
package com.hnac.hzims.weather;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.hnac.hzims.common.utils.CacheUtil;
import com.hnac.hzims.hzimsweather.entity.VStationEntity;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.weather.service.HeWeatherWeatherService;
import com.hnac.hzims.weather.service.IDailyHeWeatherService;
import com.hnac.hzims.weather.service.IStationService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springblade.core.test.BladeBootTest;
import org.springblade.core.test.BladeSpringRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
@RunWith(BladeSpringRunner.class)
@SpringBootTest(classes = WeatherApplication.class)
@BladeBootTest(appName = "hzims-weather", profile = "test", enableLoader = true)
@Slf4j
public class WeatherApplicationTest {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private CacheUtil cacheUtil;
@Autowired
private HeWeatherWeatherService weatherService;
@Autowired
private IStationService stationService;
@Before
public void initial() {
log.info("=======初始Cache测试方法=======");
// redisTemplate.opsForZSet().add("hzims:test", "{\"name\":\"zhangsan\"}", 1);
// redisTemplate.opsForZSet().add("hzims:test", "{\"name\":\"lisi\"}", 2);
// redisTemplate.opsForZSet().add("hzims:test", "{\"name\":\"wangwu\"}", 3);
}
@Test
public void toleranceFaultString() {
log.info("=======进入String Cache测试方法=======");
}
@Test
public void getWeather3d() {
List<VStationEntity> stationWithLocation = stationService.getStationWithLocation("90240008");
stationWithLocation.forEach(vStationEntity -> {
HeWeatherWeatherDailyResponse weather3d = weatherService.getWeather3d("109.25622,18.436962");
log.info(JSON.toJSONString(weather3d));
});
}
}

13
hzims-service/weather/src/test/java/com/hnac/hzims/weather/WeatherApplicationTests.java

@ -1,13 +0,0 @@
package com.hnac.hzims.weather;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class WeatherApplicationTests {
@Test
void contextLoads() {
}
}

46
hzims-service/weather/src/test/java/com/hnac/hzims/weather/launcher/DemoTestLauncherServiceImpl.java

@ -1,46 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.hnac.hzims.weather.launcher;
import com.hnac.hzims.common.constant.LauncherConstant;
import org.springblade.core.auto.service.AutoService;
import org.springblade.core.launch.service.LauncherService;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
/**
* 启动参数拓展
*
* @author Chill
*/
@AutoService(LauncherService.class)
public class DemoTestLauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
Properties props = System.getProperties();
props.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:3301");
props.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:3301");
//props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.SENTINEL_DEV_ADDR);
}
@Override
public int getOrder() {
return 10;
}
}

46
hzims-service/weather/src/test/resources/launcher/DemoTestLauncherServiceImpl.java

@ -1,46 +0,0 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package launcher;
import com.hnac.hzims.common.constant.LauncherConstant;
import org.springblade.core.auto.service.AutoService;
import org.springblade.core.launch.service.LauncherService;
import org.springframework.boot.builder.SpringApplicationBuilder;
import java.util.Properties;
/**
* 启动参数拓展
*
* @author Chill
*/
@AutoService(LauncherService.class)
public class DemoTestLauncherServiceImpl implements LauncherService {
@Override
public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) {
Properties props = System.getProperties();
props.setProperty("spring.cloud.nacos.discovery.server-addr", LauncherConstant.NACOS_DEV_ADDR);
props.setProperty("spring.cloud.nacos.config.server-addr", LauncherConstant.NACOS_DEV_ADDR);
props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.SENTINEL_DEV_ADDR);
}
@Override
public int getOrder() {
return 10;
}
}
Loading…
Cancel
Save