Commit b7d93421 authored by chenzhao's avatar chenzhao

Merge branch 'develop_dl_plan6_temp' of…

Merge branch 'develop_dl_plan6_temp' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6_temp
parents fc1b3bc8 8de75800
......@@ -86,9 +86,4 @@ public class AlertCallePowerTransferRo implements Serializable{
@ApiModelProperty(value = "调派类型队伍")
private String powerTransType;
//bug 5973
// @Label(value = "类别")
// private Integer category;
}
......@@ -162,16 +162,6 @@ public class AlertCalledRo implements Serializable{
private String gender;
@Label(value = "年龄段")
private String ageGroup;
@Label(value = "类型")
private Integer category;
//
// /**
// * 其他
// */
// @Label(value = "灾害事故情况")
// private String accidentSituation;
@Label(value = "类型")
private Integer category;
}
......@@ -17,7 +17,7 @@ import lombok.Data;
@ApiModel(value="AlertFormInitDto", description="表单初始值")
public class AlertFormInitDto implements Serializable{
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1905122041950251207L;
@ApiModelProperty(value = "表单key")
......
......@@ -26,7 +26,6 @@ public class EquipSpecificDto extends BaseEntity {
/**
* 装备分类code(人员装备【10000000】)
*/
//private String categoryCode = "10000000";
private String categoryCode;
/**
* 队伍ID
......
......@@ -12,12 +12,12 @@ public enum ExcelEnums {
WHP ("危险品", "危险品", "com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto","WHP"),// ("WHP","危险品"),
XFZJ ("消防专家", "消防专家", "com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto","XFZJ"),//("XFZJ","消防专家"),
SYXX ("水源信息", "水源信息", "com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto","SYXX"),//("SYXX","水源信息"),
HKQ ("航空器", "航空器", "com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto","HKQ"),//("HKQ","航空器");
HKQ ("航空器", "航空器", "com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto","HKQ"),//("HKQ","航空器"),
XFDW ("消防队伍", "消防队伍", "com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto","XFDW"),//("XFDW","消防队伍")
WXXFZ("微型消防站", "微型消防站", "com.yeejoin.amos.boot.module.common.api.dto.FireStationDto","WXXFZ"),//("WXXFZ","微型消防站")
XFRY ("消防人员", "消防人员", "com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto","XFRY"),//("XFRY","消防人员")
WBRY ("维保人员", "维保人员", "com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto","WBRY"),//("WBRY",维保人员)
KEYSITE ("重点部位", "重点部位", "com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto","KEYSITE"),//{"KEYSITE":}
KEYSITE ("重点部位", "重点部位", "com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto","KEYSITE"),//"KEYSITE"
CLZQ ("车辆执勤", "车辆执勤", "com.yeejoin.amos.boot.module.common.api.dto.DutyCarExcelDto","CLZQ"),//("CLZQ","车辆执勤")
JCDWRY ("单位人员", "单位人员", "com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto","JCDWRY"),//("JCDW","机场单位")
DLDWRY ("单位人员", "单位人员", "com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDlExcelDto","DLDWRY"),//("JCDW","机场单位")
......
......@@ -32,7 +32,7 @@ public enum FireCarStatusEnum {
已完成("YWC","finished", "已完成");
// 完成("WC","9", "完成");
private String key;
......
......@@ -4,49 +4,53 @@ import org.springframework.http.HttpStatus;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
public class CommonResponseUtil2 {
public static ResponseModel success() {
ResponseModel res = new ResponseModel();
public static ResponseModel<Object> success() {
ResponseModel<Object> res = new ResponseModel<Object>();
res.setDevMessage(Constant.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel success(Object obj) {
ResponseModel res = new ResponseModel();
public static ResponseModel<Object> success(Object obj) {
ResponseModel<Object> res = new ResponseModel<Object>();
res.setResult(obj);
res.setDevMessage(Constant.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel success(Object obj, String message) {
ResponseModel res = new ResponseModel();
public static ResponseModel<Object> success(Object obj, String message) {
ResponseModel<Object> res = new ResponseModel<Object>();
res.setResult(obj);
res.setDevMessage(message);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel failure() {
ResponseModel res = new ResponseModel();
public static ResponseModel<Object> failure() {
ResponseModel<Object> res = new ResponseModel<Object>();
res.setDevMessage(Constant.RESULT_FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
public static ResponseModel failure(String message) {
ResponseModel res = new ResponseModel();
public static ResponseModel<Object> failure(String message) {
ResponseModel<Object> res = new ResponseModel<Object>();
res.setDevMessage(Constant.RESULT_FAILURE);
res.setMessage(message);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
public static ResponseModel failure(Object obj, String message) {
ResponseModel res = new ResponseModel();
public static ResponseModel<Object> failure(Object obj, String message) {
ResponseModel<Object> res = new ResponseModel<Object>();
res.setResult(obj);
res.setMessage(message);
res.setDevMessage(Constant.RESULT_FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
private CommonResponseUtil2() {
}
}
......@@ -9,92 +9,92 @@ import java.time.format.DateTimeFormatter;
* @Author: duanwei
* @Date: 2019/7/29
*/
public interface Constant {
public class Constant {
String SMALL_PRO_PRCODE = "SMALL_PRO_PRCODE_";
static String SMALL_PRO_PRCODE = "SMALL_PRO_PRCODE_";
String RESULT_SUCCESS = "SUCCESS";
static String RESULT_SUCCESS = "SUCCESS";
String RESULT_FAILURE = "FAILURE";
static String RESULT_FAILURE = "FAILURE";
/**
* 任务-作业交底
*/
Integer JOB_TYPE = 0;
static Integer JOB_TYPE = 0;
/**
* 任务-三交三查
*/
Integer HAND_QUERY = 1;
static Integer HAND_QUERY = 1;
/**
* 违规管理
*/
Integer BAD_MANAGEMENT = 2;
static Integer BAD_MANAGEMENT = 2;
Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
static Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
String FILE_SEPARATOR = System.getProperty("file.separator");
static String FILE_SEPARATOR = System.getProperty("file.separator");
DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
static DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String PAGE_NUM = "0";
static String PAGE_NUM = "0";
String SIZE_NUM = "20";
static String SIZE_NUM = "20";
String PAGE = "page";
static String PAGE = "page";
String SIZE = "size";
static String SIZE = "size";
String ZERO = "0";
static String ZERO = "0";
String ONE = "1";
static String ONE = "1";
String TWO = "2";
static String TWO = "2";
String THREE = "3";
static String THREE = "3";
String FOUR = "4";
static String FOUR = "4";
String FIVE = "5";
static String FIVE = "5";
String NULL = "";
static String NULL = "";
String JSON_NULL = "[]";
static String JSON_NULL = "[]";
/**
* 请求成功
*/
String SUCCESS = "200";
static String SUCCESS = "200";
/**
* 请求错误
*/
String ERROR = "300";
static String ERROR = "300";
/**
* 无权限
*/
String PERMISSION = "401";
static String PERMISSION = "401";
/**
* 请求成功,其他错误
*/
String DATA_NULL = "402";
static String DATA_NULL = "402";
/**
* 请求失败
*/
String FAILED = "999";
static String FAILED = "999";
/**
* 最大值
*/
Integer MAX = 32767;
static Integer MAX = 32767;
/**
......@@ -122,4 +122,7 @@ public interface Constant {
public static final int JWT_REFRESH_INTERVAL = 18 * 1000; //55*60*1000; //millisecond
public static final int JWT_REFRESH_TTL = 60 * 1000; // 12*60*60*1000; //millisecond
private Constant() {
}
}
//package com.yeejoin.amos.boot.module.jcs.api.feign;
//
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
//import com.yeejoin.amos.boot.module.jcs.api.dto.EquipSpecificDto;
//import com.yeejoin.amos.boot.module.jcs.api.dto.EquipmentOnCarDto;
//import com.yeejoin.amos.component.feign.config.InnerInvokException;
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * 装备服务feign
// *
// * @author Dell
// */
//@FeignClient(name = "AMOS-EQUIPMANAGE-tb", path = "equip", configuration = {MultipartSupportConfig.class})
//public interface EquipFeignClient {
//
// /**
// * 获取未列装人员装备列表数据
// *
// * @return
// */
// @RequestMapping(value = "/equipSpecific/getAirEquipSpecificPage", method = RequestMethod.POST)
// ResponseModel<Page<Object>> getAirEquipSpecificPage(@RequestBody Object var1) throws InnerInvokException;
//
// /**
// * 人员装备列装
// *
// * @return
// */
// @RequestMapping(value = "/stock-detail/airport/person/bind", method = RequestMethod.POST)
// ResponseModel<List<Object>> stockBindEquip(@RequestBody List<Long> ids) throws InnerInvokException;
//
// /**
// * 人员装备退装
// *
// * @return
// */
// @RequestMapping(value = "/scrap/airport/person", method = RequestMethod.POST)
// ResponseModel<Object> scrapEquip(@RequestBody String id) throws InnerInvokException;
//
// /**
// * 人员装备回库
// *
// * @return
// */
// @RequestMapping(value = "/stock-detail/airport/person", method = RequestMethod.POST)
// ResponseModel<Object> stockEquip(@RequestBody Map<String, Object> map) throws InnerInvokException;
//
// /**
// * 装备详情
// *
// * @return
// */
// @RequestMapping(value = "/equipSpecific/getAirEquipSpecificDetail", method = RequestMethod.GET)
// ResponseModel<Object> getAirEquipSpecificDetail(@RequestParam Long stockDetailId) throws InnerInvokException;
//
// /**
// * 获取车辆列表
// *
// * @return
// */
// @RequestMapping(value = "/car/list-all", method = RequestMethod.GET)
// ResponseModel<Object> getFireCarListAll();
//
// /**
// * 获取个队伍下车辆统计
// *
// * @return
// */
// @RequestMapping(value = "/car/list-info", method = RequestMethod.GET)
// ResponseModel<List<Map<String,Object>>> getFireCarListAllcount();
//
// /**
// * 获取消防系统列表
// *
// * @return
// */
// @RequestMapping(value = "/fire-fighting-system/list", method = RequestMethod.GET)
// ResponseModel<Object> getFireSystemListAll();
//
// /**
// * 获取消防系统列表
// *
// * @return
// */
// @RequestMapping(value = "/building/tree", method = RequestMethod.GET)
// ResponseModel<Object> getBuildingTree();
//
// /**
// * 更新车辆状态
// * @param carStatusInfo 车辆状态信息
// * @return
// */
// @RequestMapping(value = "/car/status", method = RequestMethod.POST)
// ResponseModel<Object> updateCarStatus(@RequestBody List<Object> carStatusInfo);
//
// /**
// * 获取装备平面图
// *
// * @return
// */
// @RequestMapping(value = "/sourceFile/findImgByFileCategory", method = RequestMethod.GET)
// ResponseModel<List<Map<String,Object>>> findImgByFileCategory(@RequestParam String id,@RequestParam String fileCategory);
//
// /**
// * 车辆信息
// *
// * **/
// @RequestMapping(value = "/car/getTeamCarList", method = RequestMethod.GET)
// ResponseModel<List<Map<String,Object>>> getTeamCarList(@RequestParam Double longitude,@RequestParam Double latitude);
//}
//package com.yeejoin.amos.boot.module.jcs.api.feign;
//
//import feign.codec.Encoder;
//import feign.form.spring.SpringFormEncoder;
//import org.springframework.beans.factory.ObjectFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
//import org.springframework.cloud.openfeign.support.SpringEncoder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @Author: xl
// * @Description:
// * @Date: 2020/3/30 16:26
// */
//@Configuration
//public class MultipartSupportConfig {
//
// @Autowired
// private ObjectFactory<HttpMessageConverters> messageConverters;
//
// @Bean
// public Encoder feignFormEncoder() {
// return new SpringFormEncoder(new SpringEncoder(messageConverters));
// }
//}
......@@ -15,9 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface SignMapper extends BaseMapper<Sign> {
IPage<SignDto> queryForPage(IPage page,SignDto dto);
IPage<SignDto> queryForPage(IPage<?> page,SignDto dto);
IPage<SinStaticDto> queryStaticForPage(IPage page, SinStaticDto dto);
IPage<SinStaticDto> queryStaticForPage(IPage<?> page, SinStaticDto dto);
int queryPersonNum(String bizOgrCode);
}
......@@ -42,7 +42,7 @@ public interface IAlertSubmittedService extends IService<AlertSubmitted> {
* @param userName
* @return
*/
Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception;
Boolean save(AlertSubmittedDto alertSubmittedDto, String userName);
AlertSubmittedSMSDto getSchedulingContent(Long id);
......
......@@ -11,8 +11,8 @@ import java.util.List;
*/
public interface IESCarService {
public ESCar saveESCar(ESCar Car) throws Exception;
public Iterable<ESCar> findAllById(List<Long> ids) throws Exception;
public ESCar saveESCar(ESCar Car);
public Iterable<ESCar> findAllById(List<Long> ids);
public ESCar findAllByCarId(Long id);
}
package com.yeejoin.equipmanage.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class AddResourceHandlersConfig implements WebMvcConfigurer {
private static final Logger logger = LoggerFactory.getLogger(AddResourceHandlersConfig.class);
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// String constImg = Thread.currentThread().getContextClassLoader().getResource("constImg").toString()+"/";
// registry.addResourceHandler("/constImg/**").addResourceLocations(constImg);
// String substring1 = constImg.substring(0, 5);
// String substring2 = constImg.substring(8);
// System.err.println(substring1+substring2+"/");
// System.err.println(constImg);
// String os = System.getProperty("os.name");
//如果是Windows系统
// if (os.toLowerCase().startsWith("win")) {
// } else {
// registry.addResourceHandler("/constImg/**")
// .addResourceLocations(constImg);
// }
logger.info( "web");
}
}
//package com.yeejoin.equipmanage.config;
//
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.AfterReturning;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//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.foundation.utils.Bean;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//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.Privilege;
//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.equipmanage.common.config.GlobalCache;
//import com.yeejoin.equipmanage.common.utils.RedisUtils;
//
//
///**
// * controller层切面 用于用户数据缓存 供 sql自动填充使用
// *
// * @author Admin
// */
//@Aspect
//@Component
//public class ControllerAop {
// /**
// * saveUserRedis设置过期时间
// */
// @Value("${redis_region_time_second}")
// private Long redisRegionTimeSecond;
//
// @Autowired
// private RedisUtils redisUtils;
//
// @Pointcut("execution(public * com.yeejoin.equipmanage.controller..*(..))")
// public void userCache() {
// }
//
// @Before("userCache()")
// public void doBefore(JoinPoint joinPoint) throws Throwable {
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest request = attributes.getRequest();
// String token = getToken(request);
// if (token != null) {
// String product = request.getHeader("product");
// String appKey = request.getHeader("appKey");
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.getme();
// AgencyUserModel userModel = feignClientResult.getResult();
// if (userModel == null) {
// throw new Exception("无法获取用户信息");
// }
// RequestContext.setExeUserId(userModel.getUserId());
// String key = "region_" + userModel.getUserId() + "_" + token;
// Map<String, Object> map = new HashMap<>();
// map.put("user", JSON.toJSONString(userModel));
//
// // 不需要添加请求头的接口
// String[] url = new String[]{"/equip/api/user/selectInfo", "/equip/api/user/save/curCompany"};
// System.out.println((Arrays.asList(url).toString()));
// System.out.println(request.getRequestURI());
// // 获取请求路径
// if (Arrays.asList(url).contains(request.getRequestURI())) {
// // 暂无需要
// } else {
// if (redisUtils.hasKey(key)) {
// map.put("org", redisUtils.get(key).toString());
// GlobalCache.paramMap.put(token, JSON.toJSONString(map));
// } else {
// saveUserRedis(userModel, token);
// }
// }
//
// }
//
// }
//
// public void saveUserRedis(AgencyUserModel user, String token) {
// CompanyBo company = new CompanyBo();
// DepartmentBo department = new DepartmentBo();
// RoleBo role = new RoleBo();
// 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();
// Long sequenceNbr;
// if (departmentM == null) {
// sequenceNbr = null;
// } else {
// sequenceNbr = departmentM.getSequenceNbr();
// }
// RoleModel roleM = null;
// if (sequenceNbr == null) {
// roleM = roles.get(companyM.getSequenceNbr()).get(0);
// } else {
// roleM = roles.get(sequenceNbr).get(0);
// }
//
// Bean.copyExistPropertis(roleM, role);
// ReginParams reginParams = new ReginParams();
// reginParams.setCompany(company);
// reginParams.setRole(role);
// reginParams.setDepartment(department);
// redisUtils.set(buildKey(user.getUserId(), token), JSONObject.toJSONString(reginParams), redisRegionTimeSecond);
// Map<String, Object> map = new HashMap<>();
// map.put("user", JSON.toJSONString(user));
// map.put("org", JSONObject.toJSONString(reginParams));
// GlobalCache.paramMap.put(token, JSON.toJSONString(map));
// }
//
//
// public String buildKey(String userId, String token) {
// return "region_" + userId + "_" + token;
// }
//
// @AfterReturning(returning = "ret", pointcut = "userCache()")
// public void doAfterReturning(Object ret) throws Throwable {
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest request = attributes.getRequest();
// String token = getToken(request);
// if (token != null) {
// GlobalCache.paramMap.remove(token);
// }
// }
//
// protected String getToken(HttpServletRequest request) {
// String authToken = request.getHeader("token");
// if (authToken == null) {
// authToken = request.getHeader("X-Access-Token");
// }
// return authToken;
// }
//}
//package com.yeejoin.equipmanage.config;
//
//import com.baomidou.mybatisplus.core.toolkit.Sequence;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
///**
// * @author DELL
// */
//@Component
//public class EquipmanageConfig {
// @Bean
// public Sequence sequence(){
// return new Sequence();
// }
//}
......@@ -50,7 +50,6 @@ public class EquipmentIotMqttProduceConfig {
mqttConnectOptions.setServerURIs(new String[]{hostUrl});
mqttConnectOptions.setKeepAliveInterval(2);
mqttConnectOptions.setAutomaticReconnect(true);
// mqttConnectOptions.setConnectionTimeout(0);
return mqttConnectOptions;
}
......
......@@ -26,6 +26,7 @@ import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import java.awt.image.DirectColorModel;
import java.util.ArrayList;
import java.util.List;
......@@ -60,14 +61,27 @@ public class EquipmentIotMqttReceiveConfig {
@Value("${spring.mqtt.completionTimeout}")
private int completionTimeout;
private EquipmentSpecificMapper equipmentSpecificMapper;
private MqttEventReceiveService mqttEventReceiveService;
private ISyncDataService iSyncDataService;
@Autowired
EquipmentSpecificMapper equipmentSpecificMapper;
public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper) {
this.equipmentSpecificMapper = equipmentSpecificMapper;
}
@Autowired
MqttEventReceiveService mqttEventReceiveService;
public void setMqttEventReceiveService(MqttEventReceiveService mqttEventReceiveService) {
this.mqttEventReceiveService = mqttEventReceiveService;
}
@Autowired
private ISyncDataService iSyncDataService;
public void setiSyncDataService(ISyncDataService iSyncDataService) {
this.iSyncDataService = iSyncDataService;
}
@Autowired
@Lazy
......@@ -85,7 +99,6 @@ public class EquipmentIotMqttReceiveConfig {
mqttConnectOptions.setServerURIs(new String[]{hostUrl});
mqttConnectOptions.setKeepAliveInterval(20);
mqttConnectOptions.setAutomaticReconnect(true);
// mqttConnectOptions.setConnectionTimeout(0);
return mqttConnectOptions;
}
......@@ -108,17 +121,7 @@ public class EquipmentIotMqttReceiveConfig {
List<EquipmentSpecificVo> equipAndCars = equipmentSpecificMapper.getEquipOrCarByIotCode(null);
iSyncDataService.saveOrUpdateEquipIotCodeRedisData(equipAndCars);
List<String> list = new ArrayList<String>();
if (equipAndCars.size() > 0) {
// for (EquipmentSpecificVo specificVo : equipAndCars) {
// String iotCode = specificVo.getIotCode();
// if (iotCode.length() > 8) {
// String prefix = iotCode.substring(0, 8);
// String suffix = iotCode.substring(8);
// String topicTotal = String.format("%s/%s/property", prefix, suffix);
// list.add(topicTotal);
// }
// }
} else {
if (equipAndCars.size() <= 0) {
list.add(defaultTopic);
}
list.addAll(ConfigPageTopicEnum.getEnumTopicList()); //大屏数据推送接口订阅
......
......@@ -5,12 +5,17 @@ import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.equipmanage.common.exception.BaseException;
import com.yeejoin.equipmanage.common.exception.CommonException;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -25,10 +30,12 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
@Component
public class FeignAop {
private static final Logger logger = LoggerFactory.getLogger(FeignAop.class);
@Pointcut("execution(public * com.yeejoin.equipmanage.remote.RemoteSecurityService.*(..))")
public void webLog(){}
public void webLog(){
logger.info( "进入切面");
}
/**
* 前置通知:在连接点之前执行的通知
......@@ -36,10 +43,19 @@ public class FeignAop {
* @throws Throwable
*/
@Before("webLog()")
public void doBefore(JoinPoint joinPoint) throws Throwable {
// 接收到请求,记录请求内容
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
public void doBefore(JoinPoint joinPoint) {
try {
// 接收到请求,记录请求内容
RequestAttributes requestAttributes=RequestContextHolder.getRequestAttributes();
ServletRequestAttributes attributes =null;
if(requestAttributes!=null){
attributes= (ServletRequestAttributes) requestAttributes;
}
if(attributes!=null){
HttpServletRequest request = attributes.getRequest();
//不需要添加请求头的接口
String[] url=new String[]{"/api/user/mobile/login"};
......@@ -53,19 +69,21 @@ public class FeignAop {
String appKey = request.getHeader("appKey");
if(token==null||product==null||appKey==null||"".equals(token)||"".equals(product)||"".equals(appKey)){
//没有请求头信息直接转异常到403
throw new RuntimeException("非法异常请求!请重新登录!");
throw new BaseException("非法异常请求!请重新登录!");
}
RequestContext.setToken(token);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
}
}
} catch (Exception e) {
throw new BaseException("系统异常");
}
}
@AfterReturning(returning = "ret",pointcut = "webLog()")
public void doAfterReturning(Object ret) throws Throwable {
public void doAfterReturning(Object ret) {
logger.info( "切面后");
}
}
//package com.yeejoin.equipmanage.config;
//
//import java.util.Date;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.apache.commons.lang3.StringUtils;
//import org.apache.ibatis.reflection.MetaObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
//import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
//import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
//import com.yeejoin.equipmanage.common.annotation.FillCommonUserField;
//import com.yeejoin.equipmanage.common.config.GlobalCache;
//
///**
// * @description: 处理mybatis业务处理, 新增和更新的基础数据填充,配合BaseEntity和MyBatisPlusConfig使用
// * @author: duanwei
// * @create: 2020-05-28 13:57
// **/
//@Component
//public class MetaHandler implements MetaObjectHandler {
//
// @Autowired
// protected HttpServletRequest request;
//
// protected String getToken() {
// String authToken = request.getHeader("token");
// if (authToken == null) {
// authToken = request.getHeader("X-Access-Token");
// }
// return authToken;
// }
//
// /**
// * 新增数据拦截
// *
// * @param metaObject
// */
// @Override
// public void insertFill(MetaObject metaObject) {
// Date currentDate = new Date();
// Class clazz = metaObject.getOriginalObject().getClass();
// FillCommonUserField annotation = (FillCommonUserField) clazz.getAnnotation(FillCommonUserField.class);
// if(annotation == null || annotation.isAutoFill()){
// autoFillUser(metaObject);
// }
// //如果有上传创建时间,不需要修改
// if(metaObject.getValue("createDate")==null){
// this.setFieldValByName("createDate", currentDate, metaObject);
// }
// }
//
// private void autoFillUser(MetaObject metaObject) {
// Object obj = GlobalCache.paramMap.get(getToken());
// if(ObjectUtils.isEmpty(obj)){
// return;
// }
// @SuppressWarnings("unchecked")
// Map<String, String> map = JSONObject.parseObject(obj.toString(), Map.class);
// AgencyUserModel user = JSONObject.parseObject(map.get("user"), AgencyUserModel.class);
// ReginParams reginParams = JSONObject.parseObject(map.get("org"), ReginParams.class);
// Object entity = metaObject.getOriginalObject();
// if (isExistField("userId", entity)) {
// this.setFieldValByName("userId", Long.valueOf(user.getUserId()), metaObject);
// }
// if (isExistField("creatorId", entity)) {
// this.setFieldValByName("creatorId", Long.valueOf(user.getUserId()), metaObject);
// }
// if (isExistField("userName", entity)) {
// this.setFieldValByName("userName", user.getRealName(), metaObject);
// }
// if (isExistField("companyName", entity)) {
// this.setFieldValByName("companyName", reginParams.getCompany().getCompanyName(), metaObject);
// }
// if (isExistField("orgCode", entity)) {
// this.setFieldValByName("orgCode", reginParams.getCompany().getOrgCode(), metaObject);
// }
// if (isExistField("departmentName", entity)) {
// this.setFieldValByName("departmentName", ObjectUtils.isEmpty(reginParams.getDepartment())?"":reginParams.getDepartment().getDepartmentName(), metaObject);
// }
// if (isExistField("departmentOrgcode", entity)) {
// this.setFieldValByName("departmentOrgcode", ObjectUtils.isEmpty(reginParams.getDepartment())?"":reginParams.getDepartment().getOrgCode(), metaObject);
// }
// }
//
// private Boolean isExistField(String field, Object obj) {
// if (obj == null || StringUtils.isEmpty(field)) {
// return null;
// }
// Object o = JSONObject.toJSON(obj);
// JSONObject jsonObj = new JSONObject();
// if (o instanceof JSONObject) {
// jsonObj = (JSONObject) o;
// if (jsonObj.get(field) != null) {
// return Boolean.FALSE;
// }
// }
// return jsonObj.containsKey(field);
// }
//
// /**
// * 更新拦截
// *
// * @param metaObject
// */
// @Override
// public void updateFill(MetaObject metaObject) {
// Date currentDate = new Date();
// this.setFieldValByName("updateDate", currentDate, metaObject);
// }
//
//}
\ No newline at end of file
//package com.yeejoin.equipmanage.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
//import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
//import com.baomidou.mybatisplus.core.MybatisConfiguration;
//import com.baomidou.mybatisplus.core.config.GlobalConfig;
//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
//import com.yeejoin.amos.boot.biz.config.MetaHandler;
//
///**
// * @description: 分页插件
// * @author: duanwei
// * @create: 2020-06-30 13:57
// **/
//@EnableTransactionManagement
//@Configuration
//public class MybatisPlusConfig {
////
//// @Value("${mybatis.mapper-locations}")
//// private String mapperLocations;
// /**
// * plus分页插件支持
// */
// @Bean
// public PaginationInterceptor paginationInterceptor() {
// PaginationInterceptor page = new PaginationInterceptor();
// //设置方言类型
// page.setDialectType("mysql");
// //不限制
// page.setLimit(-1);
// return page;
// }
//
// /**
// * pageHelper插件支持
// *
// * @return
// */
// @Bean
// ConfigurationCustomizer mybatisConfigurationCustomizer() {
// return new ConfigurationCustomizer() {
// @Override
// public void customize(MybatisConfiguration configuration) {
// configuration.addInterceptor(new com.github.pagehelper.PageInterceptor());
// }
// };
// }
//
// /**
// * mp参数切面
// *
// * @return
// */
// @Bean
// public GlobalConfig globalConfig() {
// GlobalConfig globalConfig = new GlobalConfig();
// globalConfig.setMetaObjectHandler(new MetaHandler());
// return globalConfig;
// }
//
//// @Bean
//// public SqlSessionFactoryBean configSqlSessionFactoryBean(DataSource dataSource) throws IOException {
//// SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//// org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
//// configuration.setMapUnderscoreToCamelCase(true);// 开启驼峰命名
//// configuration.setCallSettersOnNulls(true);// 开启在属性为null也调用setter方法
////
//// sqlSessionFactoryBean.setConfiguration(configuration);
//// sqlSessionFactoryBean.setDataSource(dataSource);
//// ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
//// sqlSessionFactoryBean.setMapperLocations(resolver.getResources(mapperLocations));
//// return sqlSessionFactoryBean;
//// }
//
//}
//package com.yeejoin.equipmanage.config;
//
//import com.fasterxml.jackson.annotation.JsonAutoDetect;
//import com.fasterxml.jackson.annotation.JsonTypeInfo;
//import com.fasterxml.jackson.annotation.PropertyAccessor;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.fasterxml.jackson.databind.SerializationFeature;
//import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
//import org.springframework.data.redis.serializer.StringRedisSerializer;
//
///**
// * @description:
// * @author: duanwei
// **/
//@Configuration
//public class RedisConfig {
// @Bean
// public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory factory) {
// RedisTemplate<String, Object> template = new RedisTemplate<>();
// template.setConnectionFactory(factory);
// Jackson2JsonRedisSerializer<Object> j2jrs = new Jackson2JsonRedisSerializer<>(Object.class);
// ObjectMapper om = new ObjectMapper();
// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// // 解决jackson2无法反序列化LocalDateTime的问题
// om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// om.registerModule(new JavaTimeModule());
// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
// j2jrs.setObjectMapper(om);
// // 序列化 value 时使用此序列化方法
// // template.setValueSerializer(j2jrs);
// template.setHashValueSerializer(j2jrs);
// StringRedisSerializer srs = new StringRedisSerializer();
// // 序列化 key 时
// template.setKeySerializer(srs);
// template.setHashKeySerializer(srs);
// template.afterPropertiesSet();
// // 序列化 value 时
// template.setValueSerializer(srs);
// return template;
// }
//
//}
//package com.yeejoin.equipmanage.config;
//
//import io.swagger.annotations.ApiOperation;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.ParameterBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.schema.ModelRef;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.Parameter;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * swagger配置类 模块如果需要引入则引入
// * @author duanwei
// */
//@Configuration
//@EnableSwagger2
//public class SwaggerConfig {
// @Bean
// public Docket api() {
// ParameterBuilder tokenPar1 = new ParameterBuilder();
// ParameterBuilder tokenPar2 = new ParameterBuilder();
// ParameterBuilder tokenPar3 = new ParameterBuilder();
// //header中的ticket参数非必填,传空也可以
// //根据每个方法名也知道当前方法在设置什么参数
// List<Parameter> pars = new ArrayList<Parameter>();
// tokenPar1.name("token").description("用户token")
// .modelRef(new ModelRef("string")).parameterType("header")
// .required(false).build();
// tokenPar2.name("appKey").description("appKey").modelRef(new ModelRef("string")).parameterType("header").defaultValue("studio_normalapp_3056965")
// .required(false).build();
// tokenPar3.name("product").description("product").modelRef(new ModelRef("string")).parameterType("header").defaultValue("STUDIO_APP_WEB")
// .required(false).build();
//
// pars.add(tokenPar1.build());
// pars.add(tokenPar2.build());
// pars.add(tokenPar3.build());
//
// return new Docket(DocumentationType.SWAGGER_2)
// .enable(true)
// .apiInfo(apiInfo())
// .select()
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// .paths(PathSelectors.any())
// .build().globalOperationParameters(pars);
//
// }
//
//
// /**
// * 构建 api文档的详细信息函数,注意这里的注解引用的是哪个
// */
// private ApiInfo apiInfo() {
//
// return new ApiInfoBuilder()
// .title("装备物联") //网站标题
// .description("装备物联swagger RESTful APIs") //网站描述
// .version("1.0") //版本
// .build();
// }
//
//}
\ No newline at end of file
//package com.yeejoin.amos.boot.module.jcs.biz.aop;
//
//
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.AfterReturning;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Arrays;
//
//
///**
// * feign请求header设置
// * @author DELL
// *
// */
//@Aspect
//@Component
//public class FeignAop {
//
//
//
// @Pointcut("execution(public * com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService.*(..))")
// public void webLog(){}
//
// /**
// * 前置通知:在连接点之前执行的通知
// * @param joinPoint
// * @throws Throwable
// */
// @Before("webLog()")
// public void doBefore(JoinPoint joinPoint) throws Throwable {
// // 接收到请求,记录请求内容
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest request = attributes.getRequest();
// //不需要添加请求头的接口
// String[] url=new String[]{"/api/user/mobile/login"};
// //获取请求路径
// if(Arrays.asList(url).contains(request.getRequestURI())){
// //暂无需要
// }else{
//
// String token = request.getHeader("token");
// String product = request.getHeader("product");
// String appKey = request.getHeader("appKey");
// if(token==null||product==null||appKey==null||"".equals(token)||"".equals(product)||"".equals(appKey)){
// //没有请求头信息直接转异常到403
// throw new RuntimeException("非法异常请求!请重新登录!");
// }
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// }
//
//
//
// }
//
// @AfterReturning(returning = "ret",pointcut = "webLog()")
// public void doAfterReturning(Object ret) throws Throwable {
// }
//}
//
......@@ -2,42 +2,47 @@ package com.yeejoin.amos.boot.module.jcs.biz.audioToText;
import com.alibaba.nls.client.protocol.asr.SpeechTranscriberListener;
import com.alibaba.nls.client.protocol.asr.SpeechTranscriberResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 文件语音识别 回调函数
*/
public class FileSpeechTranscriberListener extends SpeechTranscriberListener {
private static final Logger logg = LoggerFactory.getLogger(FileSpeechTranscriberListener.class);
@Override
public void onTranscriberStart(SpeechTranscriberResponse response) {
logg.info( "onTranscriberStart");
}
@Override
public void onSentenceBegin(SpeechTranscriberResponse response) {
logg.info( "onSentenceBegin");
}
@Override
public void onSentenceEnd(SpeechTranscriberResponse response) {
logg.info( "onSentenceEnd");
}
@Override
public void onTranscriptionResultChange(SpeechTranscriberResponse response) {
logg.info( "onTranscriptionResultChange");
}
@Override
public void onTranscriptionComplete(SpeechTranscriberResponse response) {
logg.info( "onTranscriptionComplete");
}
@Override
public void onFail(SpeechTranscriberResponse response) {
logg.info( "onFail");
}
void responseLogger(SpeechTranscriberResponse response) {
}
}
......@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
* 实时语音识别 回调函数
*/
public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener {
private static final Logger logger = LoggerFactory.getLogger(RealTimeSpeechTranscriberListener.class);
private static final Logger logg = LoggerFactory.getLogger(RealTimeSpeechTranscriberListener.class);
public static final int RESULT_SUCCESS_CODE = 20000000;
private final String myNumber;
private final String typeNumber;
......@@ -41,16 +41,13 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
*/
@Override
public void onTranscriptionResultChange(SpeechTranscriberResponse response) {
logger.warn("语音识别过程中返回的结果");
logger.warn("task_id: " + response.getTaskId() + ", name: " + response.getName() +
//状态码“20000000”表示正常识别。
", status: " + response.getStatus() +
//句子编号,从1开始递增。
", index: " + response.getTransSentenceIndex() +
//当前的识别结果。
", result: " + response.getTransSentenceText() +
//当前已处理的音频时长,单位为毫秒。
", time: " + response.getTransSentenceTime());
logg.warn("语音识别过程中返回的结果");
String logs= String.format("task_id:%s , name: %s , status: %d, index: %d , result: %s , time:%d",
response.getTaskId(),response.getName(),response.getStatus(),response.getTransSentenceIndex(),response.getTransSentenceText(), response.getTransSentenceTime()
);
logg.error( logs);
responseHandler(response);
}
......@@ -60,7 +57,7 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
*/
@Override
public void onTranscriberStart(SpeechTranscriberResponse response) {
logger.warn("服务端准备好了进行识别");
logg.warn("服务端准备好了进行识别");
}
/**
......@@ -68,7 +65,7 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
*/
@Override
public void onSentenceBegin(SpeechTranscriberResponse response) {
logger.warn("服务端检测到了一句话的开始");
logg.warn("服务端检测到了一句话的开始");
}
/**
......@@ -77,20 +74,14 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
*/
@Override
public void onSentenceEnd(SpeechTranscriberResponse response) {
logger.warn("服务端检测到了一句话的结束");
logger.warn("task_id: " + response.getTaskId() + ", name: " + response.getName() +
//状态码“20000000”表示正常识别。
", status: " + response.getStatus() +
//句子编号,从1开始递增。
", index: " + response.getTransSentenceIndex() +
//当前的识别结果。
", result: " + response.getTransSentenceText() +
//置信度
", confidence: " + response.getConfidence() +
//开始时间
", begin_time: " + response.getSentenceBeginTime() +
//当前已处理的音频时长,单位为毫秒。
", time: " + response.getTransSentenceTime());
logg.warn("服务端检测到了一句话的结束");
String logs= String.format("task_id:%s , name: %s , status: %d, index: %d , result: %s ,, confidence:%f, begin_time:%d, time:%d",
response.getTaskId(),response.getName(),response.getStatus(),response.getTransSentenceIndex(),response.getTransSentenceText(),
response.getConfidence(),response.getSentenceBeginTime(), response.getTransSentenceTime()
);
logg.error( logs);
responseHandler(response);
}
......@@ -99,8 +90,10 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
*/
@Override
public void onTranscriptionComplete(SpeechTranscriberResponse response) {
logger.warn("识别结束后返回的最终结果");
logger.warn("task_id: " + response.getTaskId() + ", name: " + response.getName() + ", status: " + response.getStatus() + ",result:" + response.getTransSentenceText());
logg.warn("识别结束后返回的最终结果");
String logs= String.format("task_id:%s , name: %s , status: %d, result: %s ",
response.getTaskId(),response.getName(),response.getStatus(),response.getTransSentenceText());
logg.error( logs);
try {
emqKeeper.getMqttClient().publish(AudioTopic.RECORD.getName() + "/" + myNumber, "".getBytes(), 2, true);
emqKeeper.getMqttClient().publish(AudioTopic.KEYWORD.getName() + "/" + myNumber, "".getBytes(), 2, true);
......@@ -114,8 +107,10 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
*/
@Override
public void onFail(SpeechTranscriberResponse response) {
logger.error("失败处理");
logger.error("task_id: " + response.getTaskId() + ", status: " + response.getStatus() + ", status_text: " + response.getStatusText());
logg.error("失败处理");
String logs= String.format("task_id: %s, status: %d, status_text: %s", response.getTaskId(),response.getStatus(),response.getStatusText());
logg.error( logs);
}
private void responseHandler(SpeechTranscriberResponse response) {
......@@ -130,7 +125,9 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
sendRecord(audioRecord);
sendKeyword();
} else {
logger.error("异常的相应结果,响应码:" + response.getStatus());
String logs= String.format("异常的相应结果,响应码:%s", response.getStatus());
logg.error( logs);
}
}
......@@ -146,7 +143,9 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
emqKeeper.getMqttClient().publish(AudioTopic.RECORD.getName() + "/" + myNumber, bytes, 2, false);
} catch (Exception e) {
e.printStackTrace();
logger.error("发送音频识别结果消息异常,原因:" + e.getMessage());
String logs= String.format("发送音频识别结果消息异常,原因:%s", e.getMessage());
logg.error( logs);
}
}
......@@ -177,7 +176,7 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
}
int keywordIndex = message.indexOf(keyword);
if (keywordIndex != -1) {
try {
// 第一种(获取keyword紧跟的内容直至结束)
String keywordValue = message.substring(keywordIndex + keyword.length());
if (!StringUtils.isEmpty(keywordValue) && keywordValue.length() > 2) {
......@@ -187,9 +186,7 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
if (!StringUtils.isEmpty(nextMessage)) {
audioKeyWords.getValues().get(messageKeyword.getType()).add(nextMessage);
}
} catch (Exception e) {
logger.error(e.getMessage());
}
}
}
}
......@@ -198,7 +195,9 @@ public class RealTimeSpeechTranscriberListener extends SpeechTranscriberListener
emqKeeper.getMqttClient().publish(AudioTopic.KEYWORD.getName() + "/" + myNumber, bytes, 2, false);
} catch (Exception e) {
e.printStackTrace();
logger.error("发送音频关键字消息异常,原因:" + e.getMessage());
String logs= String.format("发送音频关键字消息异常,原因:%s", e.getMessage());
logg.error( logs);
}
}
}
......
......@@ -26,7 +26,6 @@ public class SocketClient {
public static void main(String[] args) throws SocketException {
SocketClient socketClient = new SocketClient();
//socketClient.processTcp(0, 0);
socketClient.processUdp(25002, 1);
}
......@@ -40,7 +39,10 @@ public class SocketClient {
byte[] b = new byte[1280];
int len;
while ((len = fis.read(b)) > 0) {
logger.info("send data pack length: " + len);
String logs= String.format("send data pack length: %s",len);
logger.error( logs);
datagramSocket.send(new DatagramPacket(b, b.length,InetAddress.getLocalHost(), port));
int deltaSleep = getSleepDelta(len, 16000);
Thread.sleep(deltaSleep);
......@@ -64,7 +66,11 @@ public class SocketClient {
byte[] b = new byte[4096];
int len;
while ((len = fis.read(b)) > 0) {
logger.info("send data pack length: " + len);
String logs= String.format("send data pack length: %s",len);
logger.error( logs);
outputStream.write(b);
TimeUnit.MILLISECONDS.sleep(200);
}
......
package com.yeejoin.amos.boot.module.jcs.biz.audioToText.streamToText;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.InputStream;
/**
......@@ -18,7 +20,10 @@ public abstract class AbstractInputStream2Text {
*/
void doTranslate() {
inputStream = getInputStream();
if (inputStream == null) throw new RuntimeException("inputStream is null");
if (inputStream == null) {
throw new BadRequest("inputStream is null");
}
}
}
......@@ -45,18 +45,10 @@ public class ElasticSearchClientConfig {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
});
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
public RequestConfig.Builder customizeRequestConfig(
RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
builder.setRequestConfigCallback((requestConfigBuilder)->requestConfigBuilder.setConnectTimeout(5000 * 1000).setSocketTimeout(6000 * 1000));
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
......
package com.yeejoin.amos.boot.module.jcs.biz.config;
import com.yeejoin.amos.boot.module.common.biz.service.impl.ESOrgUsrService;
import com.yeejoin.amos.boot.module.jcs.biz.audioToText.RealTimeSpeechTranscriberListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
......@@ -13,13 +16,13 @@ import java.sql.SQLOutput;
*/
@Component
public class JCSRunnner implements ApplicationRunner {
private static final Logger logg = LoggerFactory.getLogger(JCSRunnner.class);
@Autowired
ESOrgUsrService esOrgUsrService;
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("开始初始化ES");
logg.info("开始初始化ES");
esOrgUsrService.init();
}
}
......@@ -45,7 +45,7 @@ public class StartLoader implements ApplicationRunner {
try {
emqKeeper.getMqttClient().subscribe(topic, (s, mqttMessage) -> {
byte[] payload = mqttMessage.getPayload();
try {
String obj = new String(payload);
if (!ValidationUtil.isEmpty(obj)) {
JSONObject json = JSON.parseObject(obj);
......@@ -55,11 +55,8 @@ public class StartLoader implements ApplicationRunner {
+",联系人:"+(json.get("contactUser")!=null?json.get("contactUser").toString():"")
+",联系电话:"+(json.get("contactPhone")!=null?json.get("contactPhone").toString():"")+".请尽快处理!",
json.get("id").toString(), json);
emqKeeper.getMqttClient().publish(topicweb, JSONObject.toJSON(alertNewsDto).toString().getBytes("UTF-8"), 1, false);
emqKeeper.getMqttClient().publish(topicweb, JSON.toJSON(alertNewsDto).toString().getBytes("UTF-8"), 1, false);
}
} catch (Exception e) {
logger.error("系统异常", e);
}
});
} catch (MqttException e) {
logger.info("订阅物联警情异常", e);
......
......@@ -36,6 +36,13 @@ public class AlertCalledAction {
private AlertSubmittedServiceImpl alertSubmittedService;
public void sendSysMessage(String msgType, AlertCalledRo contingency) {
String logs= String.format("sendSysMessage %s,%s", msgType,contingency.getAlertType());
log.info(logs);
}
/**
* 短信报送
*
......@@ -46,7 +53,10 @@ public class AlertCalledAction {
*/
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, List<Map<String,Object>> submittedList, Object object) throws Exception {
log.warn("接收到规则调用--------------西咸机场119接处警规则/alertCalledRule");
log.info("接收到规则调用--------------西咸机场119接处警规则/alertCalledRule");
alertSubmittedService.ruleCallbackAction(smsCode, submittedList, object);
}
......
......@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.module.jcs.biz.rule.action;
import java.util.*;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerrTransferLogServiceImpl;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -53,12 +55,11 @@ public class PowerTransferAction {
*/
@SuppressWarnings("rawtypes")
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, List sendIds, Object object) throws Exception {
public void sendcmd(String smsCode, String sendType, List sendIds, Object object) throws IllegalAccessException, MqttPersistenceException, MqttException {
if (object instanceof AlertCallePowerTransferRo) {
AlertCallePowerTransferRo calledRo = (AlertCallePowerTransferRo) object;
// 获取力量调派发送人员
List<String> persons = null;
List<Map<String, Object>> personslist = new ArrayList<Map<String, Object>>();
if (FireBrigadeTypeEnum.专职消防队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForCar(smsCode, sendIds, object,personslist);//消防车辆
......@@ -67,7 +68,7 @@ public class PowerTransferAction {
} else if (FireBrigadeTypeEnum.监控大队.getKey().equals(calledRo.getPowerTransType())) {
alertSubmittedService.ruleCallbackActionForPowerTransferForSurvBrigade(smsCode, sendIds, object,personslist);//监控大队
}
persons=getwone(personslist);
List<String> persons=getwone(personslist);
powerrTransferLogServiceImpl.savePowerTransferLog(calledRo,persons);
}
......
......@@ -342,7 +342,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
@Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) {
try {
String company = ValidationUtil.isEmpty(alertSubmittedDto.getSubmitContent().get("companyName")) ? "" : alertSubmittedDto.getSubmitContent().get("companyName").toString() ;
Map<String,String> map = saveAlertSubmitted(alertSubmittedDto, userName);
......
......@@ -38,14 +38,14 @@ public class ESCarService implements IESCarService {
private ESCarRepository esCarRepository;
@Override
public ESCar saveESCar(ESCar Car) throws Exception
public ESCar saveESCar(ESCar Car)
{
esCarRepository.save(Car);
return Car;
}
@Override
public Iterable<ESCar> findAllById(List<Long> ids) throws Exception {
public Iterable<ESCar> findAllById(List<Long> ids) {
return esCarRepository.findAllById(ids);
......
......@@ -63,7 +63,7 @@ public class RuleAlertCalledService {
* @return
* @throws Exception
*/
public Boolean fireAlertCalledRule(AlertCalledObjsDto alertCalledVo,String alertWay, String mobiles,String usIds,String feedBack) throws Exception {
public Boolean fireAlertCalledRule(AlertCalledObjsDto alertCalledVo,String alertWay, String mobiles,String usIds,String feedBack) {
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled)) {
throw new BadRequest("参数校验失败.");
......
......@@ -93,7 +93,9 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
log.setDealTimes(0);
if (!ValidationUtil.isEmpty(callRecord)) {
model.setFilePath(String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName").replace("wav", "mp3")));
logger.info(String.format("音频地址:【%s】", String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName"))));
String logs=String.format("音频地址:【%s】", String.format("/%s/%s", callRecord.get("subPath"), callRecord.get("recordName")));
logger.info(logs);
} else { // 无录音地址记录日志
iVoiceRecordLogServiceImpl.save(log);
}
......@@ -133,12 +135,12 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
@Override
public List<FusionDto> getCarList(Boolean hasFusion) {
List<FusionDto> fusionDtos = new ArrayList<>();
List carList = equipFeignClient.getCarFusionList().getResult();
List<Map<String,Object>> carList = equipFeignClient.getCarFusionList().getResult();
List<String> employeeIDs = getAllOnlineUser(hasFusion);
if (!ValidationUtil.isEmpty(carList)) {
carList.forEach(x -> {
FusionDto fusionDto = new FusionDto();
Map map = (Map) x;
Map<String,Object> map = (Map<String,Object>) x;
fusionDto.setName(String.valueOf(map.get("name")));
fusionDto.setCarNum(String.valueOf(map.get("carNum")));
buildFusionDtoAndId(fusionDto, employeeIDs, hasFusion, map);
......@@ -211,16 +213,16 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,
return employeeIDs;
}
private FusionDto buildFusionDtoAndId(FusionDto fusionDto, List<String> employeeIDs, Boolean hasFusion, Map map) {
private FusionDto buildFusionDtoAndId(FusionDto fusionDto, List<String> employeeIDs, Boolean hasFusion, Map<String,Object> map) {
List carPropertyList = (List) map.get("carPropertyList");
carPropertyList.forEach(carProperty -> {
Map carPropertyMap = (Map) carProperty;
Map<String,Object> carPropertyMap = (Map<String,Object>) carProperty;
Object nameKey = carPropertyMap.get("nameKey");
if (hasFusion && PropertyEnum.GIS.getValue().equals(nameKey)) {
fusionDto.setId(String.valueOf(carPropertyMap.get("value")));
} else if (!hasFusion && PropertyEnum.VIDEO.getValue().equals(nameKey)) {
if((hasFusion &&PropertyEnum.GIS.getValue().equals(nameKey))|| (!hasFusion &&PropertyEnum.VIDEO.getValue().equals(nameKey))){
fusionDto.setId(String.valueOf(carPropertyMap.get("value")));
}
});
buildFusionDto(fusionDto, employeeIDs, hasFusion);
return fusionDto;
......
......@@ -64,7 +64,8 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
// @Scheduled(fixedDelay=ONE_Minute)
public void fixedDelayJob(){
// 设置token
System.out.println(JSON.toJSONString(RequestContext.cloneRequestContext()));
String logs=JSON.toJSONString(RequestContext.cloneRequestContext());
logger.info(logs);
// 首先查找未完成 且失败次数少于5 的 记录
List<VoiceRecordLog> logList = this.list(new LambdaQueryWrapper<VoiceRecordLog>().eq(VoiceRecordLog::getIsDeal,false).lt(VoiceRecordLog::getDealTimes,5));
if(logList != null && logList.size() >0) {
......@@ -77,10 +78,7 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
}
l.setDealTimes(dealTimes);
Map<String, String> map = fusionService.getCallRecordByCID(l.getConnectId());
// if(ctiInfos == null || ctiInfos.size() == 0) {
// this.updateById(l);
// return;
// }
VoiceRecordFileDto model = new VoiceRecordFileDto();
model.setAlertId(l.getAlertId());
model.setCaller(map.get("caller"));
......@@ -105,15 +103,7 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
}
Map<String, String> downloadFile = null;
try {
// JSONObject jsonObject = fusionService.getCallRecordByCID(l.getConnectId());
// Map<String, String> map = voiceRecordFileService.getResult(jsonObject);
// downloadFile = ctiService.downLoadRecordFile(recordInfo.getString("connectionid"));
} catch (Exception e) {
e.printStackTrace();
this.updateById(l);
return;
}
if(downloadFile.isEmpty()) {
this.updateById(l);
return;
......@@ -121,34 +111,10 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
for(Map.Entry<String,String> file : downloadFile.entrySet()) {
model.setFilePath(file.getKey());
}
// AlertCalledFormDto alertDto = iAlertCalledService.selectAlertCalledByIdNoCache(model.getAlertId());
// if(alertDto == null || alertDto.getAlertCalledDto() == null) {
// this.updateById(l);
// return;
// }
// model.setAlertStage(alertDto.getAlertCalledDto().getAlertStage());
// model.setAlertStageCode(alertDto.getAlertCalledDto().getAlertStageCode());
// model.setSourceId(-1l);
// voiceRecordFileServiceImpl.createWithModel(model);
// JSONObject json = new JSONObject();
// json.put("alertId",model.getAlertId());
// try {
// emqKeeper.getMqttClient().publish(ctiMessage, json.toJSONString().getBytes(), 2, false);
// try {
// redisUtils.del(RedisKey.jcs_ALERTCALLED_ID+model.getAlertId());
// } catch (Exception e) {
// e.printStackTrace();
// logger.error("删除redis失败:" + e.getMessage());
// }
// } catch (MqttException e) {
// logger.error("推送失败");
// }
// l.setIsDeal(true);
// this.updateById(l);
});
}
System.out.println("执行通话记录任务");
logger.info("执行通话记录任务");
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ public class WarningServiceImpl implements IHomePageService {
@Autowired
EquipFeignClient quipFeignClient;
private static EquipFeignClient quipFeignClient1;
private EquipFeignClient quipFeignClient1;
@PostConstruct
public void init(){
......
......@@ -19,7 +19,8 @@ public class YesServiceImpl implements IHomePageService {
@Autowired
EquipFeignClient quipFeignClient;
private static EquipFeignClient quipFeignClient1;
private EquipFeignClient quipFeignClient1;
@PostConstruct
public void init(){
......
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