Commit df5e85dc authored by kongfm's avatar kongfm

Merge branch 'developer' of http://e7ypyu8.nat.ipyingshe.com/moa/amos-boot-biz into developer

parents 669022be 6eadb145
......@@ -67,7 +67,7 @@ public class ControllerAop {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText",
String[] url = new String[]{"/api/user/save/curCompany", "/jcs/command/lookHtmlText",
"/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/elevator/getElevatorInfo"};
// 获取请求路径
for (String uri : url) {
......
......@@ -41,6 +41,16 @@ public class BaseController {
protected ReginParams getSelectedOrgInfo() {
return JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
}
/**
* 用户选择信息保存redis
*/
protected void saveSelectedOrgInfo(ReginParams reginParams) {
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParams));
}
protected String getOrgCode(ReginParams reginParams) {
if (reginParams == null) {
......
......@@ -23,6 +23,7 @@
u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode,
u.parent_id parent_id,
g.*
FROM
cb_org_usr u
......@@ -72,6 +73,9 @@
<if test="map.amosOrgId != null and map.amosOrgId != '-1'">
AND u.amos_org_id like concat(#{map.amosOrgId}, '%')
</if>
<if test="map.company != null and map.company != '-1'">
AND u.parent_id = #{map.company}
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
......@@ -141,7 +145,7 @@
AND u.amos_org_code like concat('%',#{map.amosOrgCode}, '%')
</if>
<if test="map.company != null and map.company != '-1'">
AND u.parent_id = #{company}
AND u.parent_id = #{map.company}
</if>
GROUP BY
u.sequence_nbr ,
......
......@@ -20,6 +20,20 @@
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.17</version>
<exclusions>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-scratchpad</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
......
......@@ -8,11 +8,19 @@ import lombok.Data;
@Data
public class AlamVideoVO {
private Long id;
private String url;
private String token;
private String name;
private String code;
private String address;
private String img;
private String presetPosition;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.entity.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -18,6 +19,6 @@ public class DetailPaneVO {
//图片
private String pic;
//参数
private List<Map<String,String>> items;
private List<Map<String,String>> items = new ArrayList<Map<String,String>>();
}
package com.yeejoin.equipmanage.common.enums;
/**
* 画布资源枚举
* @author DELL
*
*/
public enum BitmapEnum {
equipment("消防类设备", "equipment"),
video("视频类设备", "video");
BitmapEnum(String name, String key) {
this.name = name;
this.key = key;
}
private String name;
private String key;
public String getName() {
return name;
}
public String getKey() {
return key;
}
}
//package com.yeejoin.equipmanage.common.exception.handle;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.http.HttpStatus;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.RestControllerAdvice;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * @description: 全局异常处理器
// * @author: duanwei
// * @create: 2019-08-28 20:07
// **/
//@RestControllerAdvice
//public class GlobalExceptionHandler {
//
// private Logger log = LoggerFactory.getLogger(this.getClass());
//
// public GlobalExceptionHandler() {
// }
//
// @ExceptionHandler({ Exception.class })
// public ResponseModel<Object> MethodArgumentNotValidHandler(Exception exception) throws Exception {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
// .getRequest();
// ResponseModel<Object> response = new ResponseModel<>();
//
// //解析平台返回错误信息,统一返回403,app 端统一跳转到登录页面
// if(exception.getMessage()!=null&&exception.getMessage().indexOf("账号已经在其他设备登录")!=-1 ||exception.getMessage().indexOf("请重新登录")!=-1){
// response.setStatus(HttpStatus.FORBIDDEN.value());
// }else{
// response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
// }
//
// response.setDevMessage("FAILED");
// response.setMessage( exception.getMessage());
// response.setTraceId(RequestContext.getTraceId());
// response.setPath(request.getServletPath());exception.printStackTrace();
// return response;
// }
//
//}
package com.yeejoin.equipmanage.common.exception.handle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
/**
* @description: 全局异常处理器
* @author: duanwei
* @create: 2019-08-28 20:07
**/
@RestControllerAdvice
public class GlobalExceptionHandler {
private Logger log = LoggerFactory.getLogger(this.getClass());
public GlobalExceptionHandler() {
}
@ExceptionHandler({ Exception.class })
public ResponseModel<Object> MethodArgumentNotValidHandler(Exception exception) throws Exception {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
ResponseModel<Object> response = new ResponseModel<>();
//解析平台返回错误信息,统一返回403,app 端统一跳转到登录页面
if(exception.getMessage()!=null&&exception.getMessage().indexOf("账号已经在其他设备登录")!=-1 ||exception.getMessage().indexOf("请重新登录")!=-1){
response.setStatus(HttpStatus.FORBIDDEN.value());
}else{
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
}
response.setDevMessage("FAILED");
response.setMessage( exception.getMessage());
response.setTraceId(RequestContext.getTraceId());
response.setPath(request.getServletPath());exception.printStackTrace();
return response;
}
}
......@@ -136,7 +136,7 @@ public class DateUtils {
* @throws ParseException
*/
public static String dateFormat(Date date, String pattern) throws ParseException {
if (StringUtils.isNotEmpty(pattern)) {
if (StringUtils.isEmpty(pattern)) {
pattern = DateUtils.DATE_PATTERN;
}
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
......
......@@ -354,10 +354,10 @@ public class ExcelUtil
style.setWrapText(true);
style.setAlignment(HorizontalAlignment.CENTER);// 左右居中
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setLeftBorderColor(HSSFColor.BLACK.index);// 左边框的颜色
style.setRightBorderColor(HSSFColor.BLACK.index);// 右边框的颜色
style.setBottomBorderColor(HSSFColor.BLACK.index); // 设置单元格的边框颜色
style.setFillForegroundColor(HSSFColor.WHITE.index);
// style.setLeftBorderColor(HSSFColor.BLACK.index);// 左边框的颜色
// style.setRightBorderColor(HSSFColor.BLACK.index);// 右边框的颜色
// style.setBottomBorderColor(HSSFColor.BLACK.index); // 设置单元格的边框颜色
// style.setFillForegroundColor(HSSFColor.WHITE.index);
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
......
......@@ -7,6 +7,7 @@ import java.util.Set;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
......@@ -41,7 +42,7 @@ public interface ImportFile {
Cell cell = row.getCell(cellNum);
if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
if (cell.getCellType() == CellType.STRING) {
if (null != cell && StringUtil.isNotEmpty(cell.getStringCellValue())) {
ParsePropertyUtil.setting(value_1::add, () -> cell.getStringCellValue());
ParsePropertyUtil.setting(value_2::add, () -> cell.getStringCellValue());
......
......@@ -14,38 +14,38 @@ public class EquipmentAlarmDownloadVO implements Serializable {
@ExcelProperty(value = "告警类型", index = 0)
private String alarmType;
private String alarmType = "";
@ExcelProperty(value = "告警设备", index = 1)
private String equipName;
private String equipName = "";
@ExcelProperty(value = "告警内容", index = 2)
private String alarmContent;
private String alarmContent = "";
@ExcelProperty(value = "设备编号", index = 3)
private String equipCode;
private String equipCode = "";
@ExcelProperty(value = "告警位置", index = 4)
private String alarmPosition;
private String alarmPosition = "";
@ExcelProperty(value = "保护对象", index = 5)
private String protectObj;
private String protectObj = "";
@ExcelProperty(value = "告警时间", index = 6)
private String alarmTime;
private String alarmTime = "";
@ExcelProperty(value = "处理状态", index = 7)
private String handleStatus;
private String handleStatus = "";
@ExcelProperty(value = "处理类型", index = 8)
private String handleType;
private String handleType = "";
@ExcelProperty(value = "处理时间", index = 9)
private String confirmDate;
private String confirmDate = "";
@ExcelProperty(value = "报警原因", index = 10)
private String alarmReason;
private String alarmReason = "";
@ExcelProperty(value = "处理情况", index = 11)
private String resolveResult;
private String resolveResult = "";
}
......@@ -151,7 +151,7 @@
and a.call_time between #{startTime} and #{endTime}
</if>
<if test="alertTypeCode!= null and alertTypeCode!= '' ">
and a.alert_type_code = #{alertTypeCode}
and a.alarm_type_code = #{alertTypeCode}
</if>
<if test="alertSourceCode!= null ">
and a.alert_source_code = #{alertSourceCode}
......@@ -176,8 +176,11 @@
</select>
<select id="selectAllCount" resultType="int">
SELECT
count(a.sequence_nbr) as num
SELECT
count(b.num)
FROM
(SELECT
a.sequence_nbr as num
FROM
jc_alert_called a
<if test="isFatherAlert!= null and isFatherAlert == 'true' ">
......@@ -191,7 +194,7 @@
and a.call_time between #{startTime} and #{endTime}
</if>
<if test="alertTypeCode!= null and alertTypeCode!= '' ">
and a.alarm_type_code = #{alertTypeCode}
and a.alert_type_code = #{alertTypeCode}
</if>
<if test="alertSourceCode!= null ">
and a.alert_source_code = #{alertSourceCode}
......@@ -203,7 +206,7 @@
and j.alert_called_id = a.sequence_nbr
GROUP BY a.sequence_nbr
</if>
</where>
</where>) b
</select>
......
......@@ -125,8 +125,11 @@ public class FireStationController extends BaseController {
@GetMapping(value = "/list/page")
@ApiOperation(httpMethod = "GET", value = "新微型消防站分页查询", notes = "新微型消防站分页查询")
public ResponseModel<Page<FireStationDto>> getFireStation(@RequestParam(value = "pageNum") int pageNum,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "pageSize") int pageSize,@RequestParam(value = "company",required = false) Long company,
FireStationDto fireStationDto) {
if (company != null && company != -1){
fireStationDto.setBizCompanyId(company);
}
return ResponseHelper.buildResponse(fireStationServiceImpl.getFirefighters(pageNum, pageSize, fireStationDto));
}
......
......@@ -393,10 +393,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) {
map.put("bizOrgName", req.get("bizOrgName"));
}
if (!ObjectUtils.isEmpty(req.get("personNumber"))) {
map.put("personNumber", req.get("personNumber"));
}
if (req.containsKey("company") &&!ObjectUtils.isEmpty(req.get("company"))) {
req.put("parentId", req.get("company"));
}
/* BUG2680 查询部门人员错误 传递参数类型不正确 修改为string 2021-09-14 陈召 开始 */
if (req.get("parentId") != null && req.get("parentId") != "") {
OrgUsr parent = this.getById(req.get("parentId").toString());
......@@ -406,13 +408,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (req.containsKey("amosOrgId") && !ObjectUtils.isEmpty(req.get("amosOrgId"))) {
map.put("amosOrgCode", req.get("amosOrgId"));//当时给前端给的key名字错了,以为是传Id过来,现在传名字,那就将错就错吧
}
req.remove("bizOrgName");
req.remove("pageSize");
req.remove("pageNum");
req.remove("parentId");
req.remove("amosOrgId");
req.remove("company");
map.put("fieldsValue", req);
map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode()));
pageBean.setTotal(this.baseMapper.selectPersonListCount(map));
......
......@@ -4,18 +4,23 @@ import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.equipmanage.common.entity.vo.AppDownloadVO;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.equipmanage.common.entity.publics.CommonResponse;
import com.yeejoin.equipmanage.common.entity.vo.AppDownloadVO;
import com.yeejoin.equipmanage.common.utils.ExcelUtil;
import com.yeejoin.equipmanage.common.utils.FileUploadTypeEnum;
import com.yeejoin.equipmanage.service.IDownloadFileService;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......
......@@ -153,8 +153,8 @@ public class EquipmentSpecificController extends AbstractBaseController {
@RequestMapping(value = "/getOneCard", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "组装组态使用装备卡片数据")
public DetailPaneVO getOneCard(Long id) {
return equipmentSpecificSerivce.getOneCard(id);
public Object getOneCard(Long id , String type) {
return equipmentSpecificSerivce.getOneCard(id , type);
}
/**
......
......@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -44,11 +45,14 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.equipmanage.common.entity.publics.CommonResponse;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
......@@ -509,7 +513,7 @@ public class UserController extends AbstractBaseController {
/**
* APP登录
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.PUBLIC, needAuth = false)
@ApiOperation(value = "APP登录", notes = "APP登录")
@PostMapping(value = "/mobile/login")
public ResponseModel mobileLogin(@ApiParam(value = "账号", required = true) @RequestBody AppLoginUserParam param) {
......@@ -522,7 +526,7 @@ public class UserController extends AbstractBaseController {
result.put("userId", jsonObject.getString("userId"));
result.put("appKey", jsonObject.getString("appKey"));
result.put("product", jsonObject.getString("product"));
result.put("jpushUserKey", appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
result.put("jpushUserKey", AppMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return CommonResponseUtil.success(result);
}
return CommonResponseUtil.failure("登录失败");
......@@ -604,7 +608,8 @@ public class UserController extends AbstractBaseController {
}
}
Map<String, Object> mapRoles = objectToMap(user.getOrgRoles());
result.put("userModel", user);
result.put("companys", listCompanyModel);
result.put("orgRoles", user.getOrgRoles());
result.put("companyDepartments", mapdate);
......@@ -684,49 +689,49 @@ public class UserController extends AbstractBaseController {
/**
* 保存登陆用户选择公司信息
*/
// @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "保存登陆用户选择公司信息", notes = "保存登陆用户选择公司信息")
// @PostMapping(value = "/save/curCompany")
// public JSONObject saveCurCompany(
// @ApiParam(value = "当前登陆用户所选单位机构编号", required = true) @RequestBody SelectUserInfo selectUserInfo) {
// try {
// AgencyUserModel user = getUserInfo();
//
// CompanyBo company = new CompanyBo();
// DepartmentBo department = new DepartmentBo();
// RoleBo role = new RoleBo();
// if(ObjectUtils.isEmpty(selectUserInfo.getCompanyModel())){
// CompanyModel companyM = user.getCompanys().get(0);
// Bean.copyExistPropertis(companyM,company);
//
// Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
// DepartmentModel departmentM = mapDepartments.get(companyM.getSequenceNbr()).get(0);
// Bean.copyExistPropertis(departmentM,department);
// Map<Long, List<RoleModel>> roles = user.getOrgRoles();
// RoleModel roleM = roles.get(departmentM.getSequenceNbr()).get(0);
//
// Bean.copyExistPropertis(roleM,role);
// selectUserInfo.setCompanyModel(company);
// selectUserInfo.setDepartmentModel(department);
// selectUserInfo.setRoleModel(role);
// }else{
// company = selectUserInfo.getCompanyModel();
// role = selectUserInfo.getRoleModel();
// department = selectUserInfo.getDepartmentModel();
// }
// ReginParams reginParams = new ReginParams();
// reginParams.setCompany(company);
// reginParams.setRole(role);
// reginParams.setDepartment(department);
// saveSelectedOrgInfo(reginParams);
//
// return buildCurCompany(selectUserInfo, user);
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("保存登陆用户选择公司信息异常", e);
// throw new RuntimeException("系统繁忙,请稍后再试");
// }
// }
@PostMapping(value = "/save/curCompany")
public JSONObject saveCurCompany(
@ApiParam(value = "当前登陆用户所选单位机构编号", required = true) @RequestBody SelectUserInfo selectUserInfo) {
try {
AgencyUserModel user = getUserInfo();
CompanyBo company = new CompanyBo();
DepartmentBo department = new DepartmentBo();
RoleBo role = new RoleBo();
if(ObjectUtils.isEmpty(selectUserInfo.getCompanyModel())){
CompanyModel companyM = user.getCompanys().get(0);
Bean.copyExistPropertis(companyM,company);
Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
DepartmentModel departmentM = mapDepartments.get(companyM.getSequenceNbr()).get(0);
Bean.copyExistPropertis(departmentM,department);
Map<Long, List<RoleModel>> roles = user.getOrgRoles();
RoleModel roleM = roles.get(departmentM.getSequenceNbr()).get(0);
Bean.copyExistPropertis(roleM,role);
selectUserInfo.setCompanyModel(company);
selectUserInfo.setDepartmentModel(department);
selectUserInfo.setRoleModel(role);
}else{
company = selectUserInfo.getCompanyModel();
role = selectUserInfo.getRoleModel();
department = selectUserInfo.getDepartmentModel();
}
ReginParams reginParams = new ReginParams();
reginParams.setUserModel(user);
reginParams.setCompany(company);
reginParams.setRole(role);
reginParams.setDepartment(department);
saveSelectedOrgInfo(reginParams);
return buildCurCompany(selectUserInfo, user);
} catch (Exception e) {
e.printStackTrace();
logger.error("保存登陆用户选择公司信息异常", e);
throw new RuntimeException("系统繁忙,请稍后再试");
}
}
private JSONObject buildCurCompany(SelectUserInfo selectUserInfo, AgencyUserModel user) {
JSONObject result = new JSONObject();
......
......@@ -280,7 +280,7 @@ public class VideoController extends AbstractBaseController {
@ApiOperation(httpMethod = "GET", value = "通过视频id和预置位获取可播放的flv格式地址", notes = "通过视频id和预置位获取可播放的flv格式地址")
public String getVideoFlvUrl(@RequestParam String videoId,
@RequestParam String presetIndex) {
String flvUrl = videoService.getVideoUrl(videoId, presetIndex, "");
String flvUrl = videoService.getVideoUrl(videoId, presetIndex, "", "");
return flvUrl;
}
......
package com.yeejoin.equipmanage.fegin;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
/**
* @description:
* @author: tw
* @createDate: 2021/10/20
*/
@FeignClient(name = "${video.fegin.name}", path = "video", configuration = {MultipartSupportConfig.class})
public interface VideoFeignClient {
@RequestMapping(value = "/video-original/url/video/{indexCode}", method = RequestMethod.GET)
ResponseModel<String> videoUrlByIndexCode(@PathVariable("indexCode") String indexCode);
}
......@@ -41,7 +41,8 @@ public interface VideoMapper extends BaseMapper<Video> {
* @return
*/
List<AlamVideoVO> getVideoBySpeId(Long id);
List<AlamVideoVO> getVideoById(Long id);
AlamVideoVO getVideoById(Long id);
/**
......
......@@ -276,6 +276,7 @@ public class RemoteSecurityService {
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
FeignClientResult feignClientResult = new FeignClientResult();
RequestContext.setProduct(productApp);
RequestContext.setAppKey(appKeyApp);
feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
Map map = (Map) feignClientResult.getResult();
if (map != null) {
......
......@@ -80,7 +80,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
* @param id
* @return
*/
DetailPaneVO getOneCard(Long id);
Object getOneCard(Long id, String type);
/**
* 通过id获取设备区域建筑等信息
......
......@@ -75,5 +75,5 @@ public interface IVideoService extends IService<Video> {
* @param defaultUrl
* @return
*/
String getVideoUrl(String videoId, String presetIndex, String defaultUrl);
String getVideoUrl(String videoId, String presetIndex, String defaultUrl, String code);
}
......@@ -763,7 +763,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
x.setLocation(x.getAddress());
}
}
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl()));
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
});
}
return pages;
......
......@@ -43,6 +43,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.util.StringUtil;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -238,8 +239,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
// redi缓存选择的用户信息
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
return RedisKey.buildReginKey(userId, token);
}
......
......@@ -83,9 +83,9 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
final String alarmType = "IOT_CORE_PARAM";
Map<String, Object> res = new HashMap<>();
if (videoType.equals(type)) {
List<AlamVideoVO> video = videoMapper.getVideoById(equipId);
List<AlamVideoVO> video = videoMapper.getVideoBySpeId(equipId);
video.forEach(action -> {
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl()));
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
res.put("video", video);
return res;
......@@ -103,7 +103,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
videoBySpeId.forEach(action -> {
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl()));
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
res.put("data", specificAlarm);
res.put("video", videoBySpeId);
......
......@@ -7,6 +7,7 @@ import java.net.SocketException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
......@@ -25,6 +26,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
......@@ -55,7 +57,6 @@ import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.utils.ExcelUtil;
/**
* @author DELL
......@@ -103,11 +104,11 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
throw new RuntimeException("导出数据列表无数据!");
}
ExcelUtil.createTemplate(response, "设备告警信息", "设备告警信息", equipmentDownloads, EquipmentAlarmDownloadVO.class, null,
null, null, false);
false);
}
public List<EquipmentAlarmDownloadVO> handleExportData(List<Long> ids, List<HashMap<String, Object>> list) {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
List<EquipmentAlarmDownloadVO> equipmentDownloads = new ArrayList<>();
if (!ObjectUtils.isEmpty(ids) && 0 < ids.size()) {
if (0 < list.size()) {
......@@ -123,13 +124,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
alarmDownloadVO.setEquipCode(StringUtil.isNotEmpty(alarm.get("fireEquipmentCode")) ? alarm.get("fireEquipmentCode").toString() : "");
alarmDownloadVO.setAlarmPosition(StringUtil.isNotEmpty(alarm.get("warehouseStructureName")) ? alarm.get("warehouseStructureName").toString() : "");
alarmDownloadVO.setProtectObj(StringUtil.isNotEmpty(alarm.get("equipmentName")) ? alarm.get("equipmentName").toString() : "");
alarmDownloadVO.setAlarmTime(sdf.format(alarm.get("createDate")));
alarmDownloadVO.setAlarmTime(StringUtil.isNotEmpty(alarm.get("createDate")) ? alarm.get("createDate").toString().replace("T", " "):"");
// 处理状态、处理类型无业务字段,后期业务功能实现之后需在此处返回相应字段
alarmDownloadVO.setHandleStatus(String.valueOf(alarm.get("handleStatus")));
alarmDownloadVO.setHandleType(ConfirmAlamEnum.getTypeByCode(String.valueOf(alarm.get("handleType"))));
alarmDownloadVO.setResolveResult(StringUtil.isNotEmpty(alarm.get("resolveResult")) ? alarm.get("resolveResult").toString() : "");
alarmDownloadVO.setConfirmDate(StringUtil.isNotEmpty(alarm.get("confirmDate")) ?sdf.format(alarm.get("confirmDate")) : "");
alarmDownloadVO.setConfirmDate(StringUtil.isNotEmpty(alarm.get("confirmDate")) ?alarm.get("confirmDate").toString().replace("T", " ") : "");
alarmDownloadVO.setAlarmReason(StringUtil.isNotEmpty(alarm.get("alarmReason")) ? alarm.get("alarmReason").toString() : "");
equipmentDownloads.add(alarmDownloadVO);
}
......@@ -150,13 +151,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
alarmDownloadVO.setEquipCode(StringUtil.isNotEmpty(alarm.get("fireEquipmentCode")) ? alarm.get("fireEquipmentCode").toString() : "");
alarmDownloadVO.setAlarmPosition(StringUtil.isNotEmpty(alarm.get("warehouseStructureName")) ? alarm.get("warehouseStructureName").toString() : "");
alarmDownloadVO.setProtectObj(StringUtil.isNotEmpty(alarm.get("equipmentName")) ? alarm.get("equipmentName").toString() : "");
alarmDownloadVO.setAlarmTime(sdf.format(alarm.get("createDate")));
alarmDownloadVO.setAlarmTime(StringUtil.isNotEmpty(alarm.get("createDate")) ? alarm.get("createDate").toString().replace("T", " "):"");
// 处理状态、处理类型无业务字段,后期业务功能实现之后需在此处返回相应字段
alarmDownloadVO.setHandleStatus(String.valueOf(alarm.get("handleStatus")));
alarmDownloadVO.setHandleType(ConfirmAlamEnum.getTypeByCode(String.valueOf(alarm.get("handleType"))));
alarmDownloadVO.setResolveResult(StringUtil.isNotEmpty(alarm.get("resolveResult")) ? alarm.get("resolveResult").toString() : "");
alarmDownloadVO.setConfirmDate(StringUtil.isNotEmpty(alarm.get("confirmDate")) ?sdf.format(alarm.get("confirmDate")) : "");
alarmDownloadVO.setConfirmDate(StringUtil.isNotEmpty(alarm.get("confirmDate")) ?alarm.get("confirmDate").toString().replace("T", " ") : "");
alarmDownloadVO.setAlarmReason(StringUtil.isNotEmpty(alarm.get("alarmReason")) ? alarm.get("alarmReason").toString() : "");
equipmentDownloads.add(alarmDownloadVO);
});
......@@ -236,7 +237,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
video.setName(x.getName());
video.setTokens(x.getToken());
video.setUrl(x.getUrl());
video.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl()));
video.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
video.setIp(x.getIp());
video.setPort(x.getPort());
video.setCode(x.getCode());
......
......@@ -57,6 +57,7 @@ import com.yeejoin.equipmanage.common.entity.Video;
import com.yeejoin.equipmanage.common.entity.Warehouse;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.AlarmInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.AlarmVO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
......@@ -76,6 +77,7 @@ import com.yeejoin.equipmanage.common.entity.vo.TechInfoListVO;
import com.yeejoin.equipmanage.common.entity.vo.TechInfoVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoVO;
import com.yeejoin.equipmanage.common.enums.BillContentEnum;
import com.yeejoin.equipmanage.common.enums.BitmapEnum;
import com.yeejoin.equipmanage.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.equipmanage.common.enums.FileTypeEnum;
import com.yeejoin.equipmanage.common.enums.StockBillTypeEnum;
......@@ -89,10 +91,12 @@ import com.yeejoin.equipmanage.common.vo.EquipmentDetailVo;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.EquipmentSpecific3dVo;
import com.yeejoin.equipmanage.config.EquipmentIotMqttReceiveConfig;
import com.yeejoin.equipmanage.fegin.VideoFeignClient;
import com.yeejoin.equipmanage.mapper.EquipmentIndexMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.UploadFileMapper;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.service.IEquPropertyService;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
import com.yeejoin.equipmanage.service.IEquipmentDetailService;
......@@ -109,6 +113,7 @@ import com.yeejoin.equipmanage.service.IStockService;
import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.ISystemDicService;
import com.yeejoin.equipmanage.service.IUploadFileService;
import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.service.IWarehouseService;
import com.yeejoin.equipmanage.service.IWarehouseStructureService;
import com.yeejoin.equipmanage.utils.RelationRedisUtil;
......@@ -175,6 +180,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Autowired
private IVideoService videoService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
......@@ -196,10 +204,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
private RelationRedisUtil relationRedisUtil;
@Autowired
private VideoMapper videoMapper;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
private final String injection = "{\n" +
"\n" +
" \"items\": [\n" +
......@@ -1050,13 +1062,24 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public DetailPaneVO getOneCard(Long id) {
DetailPaneVO detailPaneVO = new DetailPaneVO();
Map<String, String> map = this.baseMapper.getQrCodeAndPic(id);
detailPaneVO.setQrCode(map.get("qrCode"));
detailPaneVO.setPic(map.get("pic"));
detailPaneVO.setItems(this.baseMapper.getOneCard(id));
return detailPaneVO;
public Object getOneCard(Long id, String type) {
if(BitmapEnum.video.getKey().equals(type)){
AlamVideoVO video = videoMapper.getVideoById(id);
if(!ObjectUtils.isEmpty(video)){
video.setUrl(videoService.getVideoUrl(video.getName().toString(), video.getPresetPosition(), video.getUrl(), video.getCode()));
}
return video;
}else{
DetailPaneVO detailPaneVO = new DetailPaneVO();
Map<String, String> map = this.baseMapper.getQrCodeAndPic(id);
if(ObjectUtils.isEmpty(map)){
return detailPaneVO;
}
detailPaneVO.setQrCode(map.get("qrCode"));
detailPaneVO.setPic(map.get("pic"));
detailPaneVO.setItems(this.baseMapper.getOneCard(id));
return detailPaneVO;
}
}
@Override
......
......@@ -27,6 +27,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -602,7 +603,7 @@ public class MainIotMonitorServiceImpl implements IMainIotMonitorSerivce {
// redis缓存选择的用户信息
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
return RedisKey.buildReginKey(userId, token);
}
protected AgencyUserModel getUser() {
......
......@@ -19,6 +19,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -506,8 +507,7 @@ public class QREquipmentDefServiceImpl implements IQRCodeService<ScanResult<QREq
// redi缓存选择的用户信息
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
return RedisKey.buildReginKey(userId, token);
}
}
......@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -1242,8 +1243,6 @@ public class QREquipmentKnowledgeServiceImpl implements IQRCodeService<ScanResul
// redi缓存选择的用户信息
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
return RedisKey.buildReginKey(userId, token);
}
}
......@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -130,9 +131,7 @@ public class StockBillDetailServiceImpl extends ServiceImpl<StockBillDetailMappe
}
// redi缓存选择的用户信息
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
return RedisKey.buildReginKey(userId, token);
}
}
package com.yeejoin.equipmanage.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.EquipmentCategory;
import com.yeejoin.equipmanage.common.entity.EquipmentIndex;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.Video;
import com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.VideoImportantEquipment;
import com.yeejoin.equipmanage.common.entity.VideoSource;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.dto.VideoDTO;
import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.entity.vo.BuildingListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentCategoryTypeTreeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.PageSecurityVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.PageVideoVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoDownloadVO;
import com.yeejoin.equipmanage.common.entity.vo.VideoListVo;
import com.yeejoin.equipmanage.common.enums.EquipmentSpeIndexEnum;
import com.yeejoin.equipmanage.common.enums.IndustryEnum;
import com.yeejoin.equipmanage.common.utils.HttpContentTypeUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.fegin.VideoFeignClient;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import com.yeejoin.equipmanage.service.IBuilldService;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IVideoEquipmentSpecificService;
import com.yeejoin.equipmanage.service.IVideoImportantEquipmentService;
import com.yeejoin.equipmanage.service.IVideoService;
import com.yeejoin.equipmanage.service.IVideoSourceService;
import com.yeejoin.equipmanage.service.IWarehouseStructureService;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* @author ZeHua Li
......@@ -67,6 +102,10 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Autowired
VideoMapper videoMapper;
@Autowired
VideoFeignClient videoFeignClient;
@Value("${param.htvideo.url}")
......@@ -482,12 +521,26 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Override
public String getVideoUrl(String videoId, String presetIndex, String defaultUrl) {
public String getVideoUrl(String videoId, String presetIndex, String defaultUrl, String code) {
if ("off".equals(isUseVideoTranscoding)) {
return defaultUrl;
String url = getVideoUrl(code);
return ObjectUtils.isEmpty(url) ? defaultUrl : url;
}
return getFlvUrlByVideoIdOrPresetIndex(videoId, presetIndex);
}
private String getVideoUrl(String code){
String url = "";
try{
ResponseModel<String> da = videoFeignClient.videoUrlByIndexCode(code);
if(!ObjectUtils.isEmpty(da)){
url = da.getResult().substring(da.getResult().indexOf("openUrl"));
}
}catch (Exception e) {
log.error("视频服务调用失败", e.getMessage());
}
return url;
}
public String getFlvUrlByVideoIdOrPresetIndex(String videoId, String presetIndex) {
try {
......@@ -542,91 +595,4 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
return "rtsp";
}
// /**
// * 异步保存监控和建筑关联关系
// * @param buildingCodes
// * @param videoId
// */
// @Async
// void saveVideoSource(String[] buildingCodes,Long videoId){
// List<VideoSource> videoSources = new ArrayList<>();
//
// //转map,方便后面code转id
// List<WarehouseStructure> list = warehouseStructureService.list();
// Map<String,Long> map = new HashMap<>();
// list.stream().forEach(x->{
// map.put(x.getCode(),x.getId());
// });
//
// //拼接数据
// for (int i = 0; i < buildingCodes.length; i++) {
// VideoSource videoSource = new VideoSource();
// videoSource.setVideoId(videoId);
// //通过code取id
// videoSource.setSourceId(map.get(buildingCodes[i]));
// videoSources.add(videoSource);
// }
//
// videoSourceService.saveBatch(videoSources);
// }
//
// /**
// * 异步保存监控和单个装备关联关系
// * @param equipmentSpecificCodes
// * @param videoId
// */
// @Async
// void saveEquipmentSpecificCodes(String[] equipmentSpecificCodes,Long videoId){
//
// List<VideoEquipmentSpecific> videoSources = new ArrayList<>();
//
// //转map,方便后面code转id
// List<EquipmentSpecific> list = equipmentSpecificSerivce.list();
// Map<String,Long> map = new HashMap<>();
// list.stream().forEach(x->{
// map.put(x.getCode(),x.getId());
// });
// //拼接数据
// for (int i = 0; i < equipmentSpecificCodes.length; i++) {
// VideoEquipmentSpecific videoEquipmentSpecific = new VideoEquipmentSpecific();
// videoEquipmentSpecific.setVideoId(videoId);
// //通过code取id
// videoEquipmentSpecific.setEquipmentSpecificId(map.get(equipmentSpecificCodes[i]));
// videoSources.add(videoEquipmentSpecific);
// }
//
// videoEquipmentSpecificService.saveBatch(videoSources);
// }
//
//
// /**
// * 异步保存监控和重点设备关联关系
// * @param importantEquipmentCodes
// * @param videoId
// */
// @Async
// void saveImportantEquipmentCodes(String[] importantEquipmentCodes,Long videoId){
//
// List<VideoImportantEquipment> videoImportantEquipments = new ArrayList<>();
//
// //转map,方便后面code转id
// List<EquipmentSpecificVo> list = baseMapper.selectImportantEquipment();
// Map<String,Long> map = new HashMap<>();
// list.stream().forEach(x->{
// map.put(x.getCode(),x.getId());
// });
//
// //拼接数据
// for (int i = 0; i < importantEquipmentCodes.length; i++) {
// VideoImportantEquipment videoImportantEquipment = new VideoImportantEquipment();
// videoImportantEquipment.setVideoId(videoId);
// //通过code取id
// videoImportantEquipment.setImportantEquipmentId(map.get(importantEquipmentCodes[i]));
// videoImportantEquipments.add(videoImportantEquipment);
// }
// videoImportantEquipmentService.saveBatch(videoImportantEquipments);
// }
}
......@@ -13,6 +13,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
......@@ -28,7 +29,8 @@ import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper",
"com.yeejoin.equipmanage.mapper"})
@ComponentScan({"org.typroject", "com.yeejoin.amos", "com.yeejoin.equipmanage"})
@ComponentScan(value = {"org.typroject", "com.yeejoin.amos", "com.yeejoin.equipmanage"}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler.class})})
@EnableFeignClients
@EnableAsync
public class AmostEquipApplication {
......
......@@ -50,6 +50,8 @@ iot.vehicle.track=AMOS-API-IOT
jcs.fegin.name=JCS
video.fegin.name=VIDEO
#项目初始化画布id
morphic.projectSeq=1390314016458514433
......
......@@ -226,7 +226,7 @@ FROM
FROM
wl_equipment_specific_index si,
wl_equipment_index WI
where SI.equipment_index_id = WI.id and si.equipment_specific_id = #{equipmentSpecificId}
where si.equipment_index_id = WI.id and si.equipment_specific_id = #{equipmentSpecificId}
</select>
......
......@@ -136,17 +136,20 @@
where equipment_specific_id = #{id}
</select>
<select id="getVideoById" resultType="com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO">
select
vid.id,
vid.token,
vid.name,
vid.url,
vid.code,
vid.preset_position as presetPosition
from
wl_video_equipment_specific as ves
left join wl_video as vid on ves.video_id = vid.id
where video_id = #{id}
SELECT
v.`name`,
v.`code`,
v.url,
v.token,
CONCAT_WS(' ', ws.full_name, v.address) AS address,
v.img,
v.preset_position as presetPosition
FROM
wl_video v
LEFT JOIN wl_video_source vs ON vs.video_id = v.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = vs.source_id
WHERE
v.id = #{id}
</select>
<select id="pageColaBuildingVideo" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment