Commit f754a00b authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_dl_plan6_temp' into develop_dl_plan6_temp

parents 884934ee b7d93421
......@@ -2,7 +2,8 @@ package com.yeejoin.amos.boot.module.common.api.enums;
public enum ExceptionEnum {
PARAMETER_TYPE_ERROR ("0001","传入參數异常");
PARAMETER_TYPE_ERROR ("0001","传入參數异常"),
PARAMETER_TYPE_ERR ("400","系统异常!");
private String eCode;
......
......@@ -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);
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -15,6 +16,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceIm
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataSourcesImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -50,6 +52,7 @@ import java.util.Map;
* @date 2021-06-29
*/
@RestController
@Slf4j
@Api(tags = "航空器信息Api")
@RequestMapping(value = "/aircraft")
public class AircraftController extends BaseController {
......@@ -64,6 +67,7 @@ public class AircraftController extends BaseController {
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
/**
* 新增航空器信息
*
......@@ -244,19 +248,22 @@ public class AircraftController extends BaseController {
ResponseModel<Map<String, Object>> dataModel = iotFeignClient.getDynamicFlightInfo(num);
if (dataModel != null) {
Map<String, Object> map = dataModel.getResult()!=null? dataModel.getResult():null;
if (map != null) {
if (dataModel != null && dataModel.getResult()!=null) {
Map<String, Object> map = dataModel.getResult();
//sonarLint 报错 需要将多次引用的抽成常量
String dynamicFlightId = "dynamicFlightId";
String runway = "runway";
String stand = "stand";
String passengerCapacity = "passengerCapacity";
map1.put("aircraftModel", map.containsKey("aircraftType")?map.get("aircraftType"):null);
map1.put("dynamicFlightId", map.containsKey("dynamicFlightId")?map.get("dynamicFlightId"):null);
map1.put(dynamicFlightId, map.containsKey(dynamicFlightId)?map.get(dynamicFlightId):null);
map1.put("landingTime", map.containsKey("sta")?map.get("sta"):null);
/* 任务 3488 根据航班号查询航班信息回填 增加跑道,机位字段 start*/
map1.put("runway", map.containsKey("runway")?map.get("runway"):null);
map1.put("stand", map.containsKey("stand")?map.get("stand"):null);
map1.put(runway, map.containsKey(runway)?map.get(runway):null);
map1.put(stand, map.containsKey(stand)?map.get(stand):null);
/* 任务 3488 根据航班号查询航班信息回填 end*/
// map1.put("fuelQuantity", map.get(""));
map1.put("passengerCapacity", map.containsKey("passengerCapacity")?map.get("passengerCapacity"):null );
}
map1.put(passengerCapacity, map.containsKey(passengerCapacity)?map.get(passengerCapacity):null );
}
return ResponseHelper.buildResponse(map1);
}
......@@ -273,28 +280,6 @@ public class AircraftController extends BaseController {
/**
*
* 导出航空器信息
* 已废弃
* **/
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/exportData")
// @ApiOperation(httpMethod = "GET", value = "导出航空器信息", notes = "导出航空器信息")
// public void exportData ( HttpServletResponse response)throws IOException {
// String fileName = "Aircraft";
// response.setContentType("multipart/form-data");
// response.setCharacterEncoding("utf-8");
// response.addHeader("Content-Disposition", "attachment;filename=" + fileName+ ".xlsx");
// String sheetName = "航空器信息";
// ExcelWriter writer = new ExcelWriter(response.getOutputStream(), ExcelTypeEnum.XLSX);
// Sheet sheet = new Sheet(1, 0,AircraftDtos.class);
// List<AircraftDto> list = aircraftServiceImpl.queryAircraftDtoForList(false);
// sheet.setSheetName(sheetName);
// writer.write(list, sheet);
// writer.finish();
// }
/**
*
* 导入航空器信息
*
* **/
......@@ -304,8 +289,7 @@ public class AircraftController extends BaseController {
public Boolean ImportData (@RequestPart MultipartFile multipartFile) {
List<Aircraft> aircraftList = new ArrayList<>();
try {
// list = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 0);
EasyExcel.read(multipartFile.getInputStream(), AircraftDto.class, new AnalysisEventListener<AircraftDto>() {
EasyExcelFactory.read(multipartFile.getInputStream(), AircraftDto.class, new AnalysisEventListener<AircraftDto>() {
// 每读取一行就调用该方法
@Override
public void invoke(AircraftDto data, AnalysisContext context) {
......@@ -317,7 +301,7 @@ public class AircraftController extends BaseController {
// 全部读取完成就调用该方法
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("读取完成");
log.warn("读取完成");
}
}).sheet().doRead();
aircraftServiceImpl.saveBatch(aircraftList);
......
......@@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -121,7 +122,7 @@ public class AlertFormController extends BaseController {
@RequestMapping(value = "/form/{code}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据表态类型code查询表单数据项", notes = "根据表态类型code查询表单数据项")
public ResponseModel<Object> selectFormdItem(HttpServletRequest request, @PathVariable String code){
List<AlertFormInitDto> list=new ArrayList<AlertFormInitDto>();
List<AlertFormInitDto> list;
if(redisUtils.hasKey(RedisKey.FORM_CODE+code)){
Object obj= redisUtils.get(RedisKey.FORM_CODE+code);
JSONArray arr = (JSONArray) obj;
......@@ -163,7 +164,7 @@ public class AlertFormController extends BaseController {
Class<? extends AlertForm> aClass = alertForm.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(alertForm);
if (o != null) {
Class<?> type = field.getType();
......@@ -174,9 +175,6 @@ public class AlertFormController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(alertForm);
alertFormQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertForm);
alertFormQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(alertForm);
alertFormQueryWrapper.eq(name, fileValue);
......
......@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -24,6 +25,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormTypeServiceImp
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
......@@ -107,7 +109,7 @@ public class AlertFormTypeController extends BaseController {
Class<? extends AlertFormType> aClass = alertFormType.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(alertFormType);
if (o != null) {
Class<?> type = field.getType();
......@@ -126,11 +128,10 @@ public class AlertFormTypeController extends BaseController {
String fileValue = (String) field.get(alertFormType);
alertFormTypeQueryWrapper.eq(name, fileValue);
}
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<AlertFormType> page;
......
......@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -24,6 +25,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceIm
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
......@@ -107,7 +109,7 @@ public class AlertFormValueController extends BaseController {
Class<? extends AlertFormValue> aClass = alertFormValue.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(alertFormValue);
if (o != null) {
Class<?> type = field.getType();
......@@ -118,16 +120,13 @@ public class AlertFormValueController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(alertFormValue);
alertFormValueQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertFormValue);
alertFormValueQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(alertFormValue);
alertFormValueQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<AlertFormValue> page;
......
......@@ -34,6 +34,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -42,6 +43,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -171,7 +173,7 @@ public class AlertSubmittedController extends BaseController {
return;
}
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(alertSubmitted);
if (o != null) {
Class<?> type = field.getType();
......@@ -182,16 +184,13 @@ public class AlertSubmittedController extends BaseController {
} else if (type.equals(Long.class) || "long".equals(type.toString())) {
Long fileValue = (Long) field.get(alertSubmitted);
alertSubmittedQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertSubmitted);
alertSubmittedQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(alertSubmitted);
alertSubmittedQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<AlertSubmitted> page;
......@@ -220,7 +219,7 @@ public class AlertSubmittedController extends BaseController {
String companyName = getSelectedOrgInfo().getCompany().getCompanyName();
alertSubmittedService.getAlertSubmittedContent(alertCalledId, templateVos, companyName);
} catch (IllegalAccessException e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
} catch (ParseException e) {
e.printStackTrace();
}
......@@ -248,10 +247,9 @@ public class AlertSubmittedController extends BaseController {
TemplateExtendDto template = null;
Template templateN = null;
if(schedulingContent.getType().equals(AlertBusinessTypeEnum.警情结案.getName()) ||
schedulingContent.getType().equals(AlertBusinessTypeEnum.警情续报.getName()) ||
schedulingContent.getType().equals(AlertBusinessTypeEnum.非警情确认.getName())) {
} else {
if(!schedulingContent.getType().equals(AlertBusinessTypeEnum.警情结案.getName()) &&
!schedulingContent.getType().equals(AlertBusinessTypeEnum.警情续报.getName()) &&
!schedulingContent.getType().equals(AlertBusinessTypeEnum.非警情确认.getName())) {
// 获取模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
......@@ -271,18 +269,17 @@ public class AlertSubmittedController extends BaseController {
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
// definitions.put("$recDate",DateUtils.convertDateToString(alertCalled.getUpdateTime(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(schedulingContent.getSubmissionContent()).getString("companyName") ;
String companyName = JSON.parseObject(schedulingContent.getSubmissionContent()).getString("companyName") ;
JSONObject jsonObject = null;
if(!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
jsonObject = JSONObject.parseObject(schedulingContent.getSubmissionContent());
jsonObject = JSON.parseObject(schedulingContent.getSubmissionContent());
jsonObject.put("recDate",DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
}
......
......@@ -11,9 +11,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
......@@ -93,7 +95,7 @@ public class AlertSubmittedObjectController extends BaseController {
Class<? extends AlertSubmittedObject> aClass = alertSubmittedObject.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(alertSubmittedObject);
if (o != null) {
Class<?> type = field.getType();
......@@ -104,16 +106,13 @@ public class AlertSubmittedObjectController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(alertSubmittedObject);
alertSubmittedObjectQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(alertSubmittedObject);
alertSubmittedObjectQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(alertSubmittedObject);
alertSubmittedObjectQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<AlertSubmittedObject> page;
......
......@@ -42,13 +42,6 @@ public class Audio2TextController {
@ApiOperation(httpMethod = "GET", value = "测试语音转文字融合接口", notes = "测试语音转文字融合接口")
public HashMap<String, Object> startConvertAndSendAudio(@RequestParam String cid, @RequestParam String myNumber, @RequestParam String callerNumber) {
HashMap<String, Object> convert = audio2Text.doTranslate(cid, myNumber, callerNumber);
/* try {
TimeUnit.SECONDS.sleep(1);
socketClient.process((Integer) convert.get(myNumber), 2);
socketClient.process((Integer) convert.get(callerNumber), 3);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
return convert;
}
......
......@@ -4,6 +4,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.common.api.enums.ExceptionEnum;
import org.apache.commons.jexl2.UnifiedJEXL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -58,8 +60,9 @@ public class ExcelController extends BaseController {
@Value("${logic}")
Boolean logic ;
private static final String NOT_DUTY = "休班";
private static String JCDWRY = "JCDWRY";
private static String DLDWRY = "DLDWRY";
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取上传excle文件是否成功")
......@@ -78,8 +81,8 @@ public class ExcelController extends BaseController {
@GetMapping("/download/template/{type}")
public void downloadTemplate(HttpServletResponse response, @PathVariable(value = "type") String type) {
try {
if(type.equals("JCDWRY") && !logic){
type = "DLDWRY";
if(type.equals(JCDWRY) && logic != null&& !logic){
type = DLDWRY;
}
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
......@@ -87,15 +90,15 @@ public class ExcelController extends BaseController {
excelService.templateExport(response, excelDto);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
/**
* * @param Map par 可以传递过滤条件,传入具体实现类中
*
*
* @return
*
*
* <PRE>
* author tw
* date 2021/9/13
......@@ -107,8 +110,8 @@ public class ExcelController extends BaseController {
public void getFireStationFile(HttpServletResponse response, @PathVariable(value = "type") String type,
@RequestParam Map par) {
try {
if(type.equals("JCDWRY") && !logic){
type = "DLDWRY";
if(type.equals(JCDWRY) && logic != null &&!logic){
type = DLDWRY;
}
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
......@@ -116,7 +119,7 @@ public class ExcelController extends BaseController {
excelService.commonExport(response, excelDto, par);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -129,8 +132,8 @@ public class ExcelController extends BaseController {
long uuid = sequence.nextId();
String uuidString = Long.toString(uuid);
redisUtils.set(uuidString, 0);
if(type.equals("JCDWRY") && !logic){
type = "DLDWRY";
if(type.equals(JCDWRY) && logic !=null && !logic){
type = DLDWRY;
}
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(),
......@@ -146,32 +149,6 @@ public class ExcelController extends BaseController {
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "上传文件数据-2")
// @PostMapping("/upload2")
// public void upload2(@RequestPart("file") MultipartFile multipartFile,
// @RequestParam(required = false) String fileName,
// @RequestParam(required = false) String sheetName,
// @RequestParam String type) {
// try {
// excelService.commonUpload(multipartFile, new ExcelDto(fileName, sheetName, type));
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("系统异常!");
// }
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "导出公用类2")
// @GetMapping("/export/list")
// public void exportByType(HttpServletResponse response, @RequestParam(required = false) String fileName,
// @RequestParam(required = false) String sheetName, @RequestParam String type) {
// try {
// excelService.commonExport(response, new ExcelDto(fileName, sheetName, type));
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("系统异常!");
// }
// }
/**
* 导出值班模板
*
......@@ -193,7 +170,7 @@ public class ExcelController extends BaseController {
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -206,7 +183,7 @@ public class ExcelController extends BaseController {
excelService.dutyInfoExport(response, beginDate, endDate, excelDto);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -222,7 +199,7 @@ public class ExcelController extends BaseController {
excelService.exportByParams(response, excelDto, params);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -234,7 +211,7 @@ public class ExcelController extends BaseController {
return ResponseHelper.buildResponse(dataSources.selectList(type, method));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
}
......@@ -5,12 +5,14 @@ import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.common.api.enums.ExceptionEnum;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -22,6 +24,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -138,7 +141,7 @@ public class FirefightersController extends BaseController {
iFirefightersService.saveFirefighters(firefighters);
return ResponseHelper.buildResponse(firefighters);
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -155,7 +158,7 @@ public class FirefightersController extends BaseController {
@Transactional
public ResponseModel<Object> deleteById(HttpServletRequest request, @PathVariable Long id) {
//BUG 2761 判断人员删除时的逻辑 如果被选为队伍联系人则无法被删除 bykongfm
List fireTeam = iFireTeamService.list(new LambdaQueryWrapper<FireTeam>().eq(FireTeam::getIsDelete, false).eq(FireTeam::getContactUserId, id));
List<FireTeam> fireTeam = iFireTeamService.list(new LambdaQueryWrapper<FireTeam>().eq(FireTeam::getIsDelete, false).eq(FireTeam::getContactUserId, id));
if (fireTeam.size() > 0) {
return ResponseHelper.buildResponse("-1");
}
......@@ -186,7 +189,7 @@ public class FirefightersController extends BaseController {
return ResponseHelper.buildResponse("0");
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("删除失败!");
throw new BadRequest("删除失败!");
}
}
......@@ -219,7 +222,7 @@ public class FirefightersController extends BaseController {
userCarService.delete(userCar);
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -270,7 +273,7 @@ public class FirefightersController extends BaseController {
return ResponseHelper.buildResponse(null);
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -343,7 +346,7 @@ public class FirefightersController extends BaseController {
Class<? extends Firefighters> aClass = firefighters.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(firefighters);
if (o != null) {
Class<?> type = field.getType();
......@@ -365,7 +368,7 @@ public class FirefightersController extends BaseController {
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
});
IPage<Firefighters> page;
......@@ -500,7 +503,7 @@ public class FirefightersController extends BaseController {
}
return ResponseHelper.buildResponse(iFirefightersService.updatePeopleById(firefighters, id));
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest(ExceptionEnum.PARAMETER_TYPE_ERR.getEmsg());
}
}
......@@ -519,10 +522,6 @@ public class FirefightersController extends BaseController {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if(null != reginParam) {
String bizOrgCode = reginParam.getPersonIdentity().getBizOrgCode();
// String bizOrgName = reginParam.getPersonIdentity().getCompanyName();
// QueryWrapper<Firefighters> firefightersQueryWrapper2 = new QueryWrapper<>();
// firefightersQueryWrapper2.eq("amos_user_id",reginParam.getUserModel().getUserId());
// Firefighters one = iFirefightersService.getOne(firefightersQueryWrapper2);
List<Map<String,Object>> list = new ArrayList<>();
Map<String,Object> bizOrgCodeAndBizOrgName = iFirefightersService.getCompanyName(bizOrgCode);
......
......@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -128,7 +129,7 @@ public class FirefightersJacketController extends BaseController {
Class<? extends FirefightersJacket> aClass = firefightersJacket.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(firefightersJacket);
if (o != null) {
Class<?> type = field.getType();
......@@ -158,7 +159,7 @@ public class FirefightersJacketController extends BaseController {
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<FirefightersJacket> page;
......
......@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -147,7 +148,7 @@ public class FirestationJacketController extends BaseController {
Class<? extends FirestationJacket> aClass = firestationJacket.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(firestationJacket);
if (o != null) {
Class<?> type = field.getType();
......@@ -177,7 +178,7 @@ public class FirestationJacketController extends BaseController {
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<FirestationJacket> page;
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.read.builder.ExcelReaderSheetBuilder;
......@@ -30,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -52,6 +54,10 @@ public class OrganizationController extends BaseController {
@Autowired
private OrganizationService organizationService;
@Autowired
private static String UTF8 = "UTF-8";
private static String CONTENTDISPOSITION = "Content-Disposition";
@PersonIdentify
@GetMapping(value = "/getOrganizationInfo")
......@@ -100,21 +106,21 @@ public class OrganizationController extends BaseController {
public void export(HttpServletResponse response) {
String file_name = null;
try {
response.setCharacterEncoding("UTF-8");
response.setCharacterEncoding(UTF8);
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("组织机构信息.xlsx", "UTF-8") );
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader(CONTENTDISPOSITION, "attachment;filename=" + URLEncoder.encode("组织机构信息.xlsx", UTF8) );
response.setHeader("Access-Control-Expose-Headers", CONTENTDISPOSITION);
List<OrganizationExportDto> firstSheetVOS = new ArrayList<>();
List<OrganizationUserExportDto> secondSheetVOS = new ArrayList<>();
// 应急救援小组写入
ExcelWriter writer = EasyExcel.write(response.getOutputStream(), OrganizationExportDto.class).build();
WriteSheet sheet = EasyExcel.writerSheet(0, "应急救援小组").build();
ExcelWriter writer = EasyExcelFactory.write(response.getOutputStream(), OrganizationExportDto.class).build();
WriteSheet sheet = EasyExcelFactory.writerSheet(0, "应急救援小组").build();
writer.write(firstSheetVOS, sheet);
// 组员写入
WriteSheet sheet2 = EasyExcel.writerSheet(1, "组员").head(OrganizationUserExportDto.class).build();
WriteSheet sheet2 = EasyExcelFactory.writerSheet(1, "组员").head(OrganizationUserExportDto.class).build();
writer.write(secondSheetVOS, sheet2);
// 关闭流
......@@ -140,21 +146,21 @@ public class OrganizationController extends BaseController {
}
}
try {
response.setCharacterEncoding("UTF-8");
response.setCharacterEncoding(UTF8);
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("组织机构信息.xlsx", "UTF-8") );
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader(CONTENTDISPOSITION, "attachment;filename=" + URLEncoder.encode("组织机构信息.xlsx", UTF8) );
response.setHeader("Access-Control-Expose-Headers", CONTENTDISPOSITION);
// 应急小组信息
List<OrganizationExportDto> organizationList = organizationService.selectOrganization(bizOrgCode);
// 应急小组人员信息
List<OrganizationUserExportDto> organizationUserList = organizationService.selectOrganizationUserList(bizOrgCode);
// 应急小组写入
ExcelWriter writer = EasyExcel.write(response.getOutputStream(), OrganizationExportDto.class).build();
WriteSheet sheet = EasyExcel.writerSheet(0, "应急救援小组").build();
ExcelWriter writer = EasyExcelFactory.write(response.getOutputStream(), OrganizationExportDto.class).build();
WriteSheet sheet = EasyExcelFactory.writerSheet(0, "应急救援小组").build();
writer.write(organizationList, sheet);
// 组员写入
WriteSheet sheet2 = EasyExcel.writerSheet(1, "组员").head(OrganizationUserExportDto.class).build();
WriteSheet sheet2 = EasyExcelFactory.writerSheet(1, "组员").head(OrganizationUserExportDto.class).build();
writer.write(organizationUserList, sheet2);
// 关闭流
......@@ -179,14 +185,14 @@ public class OrganizationController extends BaseController {
}
}
try {
ExcelReader reader = EasyExcel.read(file.getInputStream()).build();
ExcelReader reader = EasyExcelFactory.read(file.getInputStream()).build();
List<OrganizationExportDto> organizationList = ExcelUtil.readExcel(reader, OrganizationExportDto.class, 0);
List<OrganizationUserExportDto> organizationUserList = ExcelUtil.readExcel(reader, OrganizationUserExportDto.class, 1);
organizationService.saveOrganization(organizationList, organizationUserList, bizOrgCode);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
throw new BadRequest(e.getMessage());
}
return CommonResponseUtil.success();
......
......@@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -130,7 +131,7 @@ public class PowerTransferCompanyController extends BaseController {
Class<? extends PowerTransferCompany> aClass = powerTransferCompany.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(powerTransferCompany);
if (o != null) {
Class<?> type = field.getType();
......@@ -141,16 +142,13 @@ public class PowerTransferCompanyController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(powerTransferCompany);
powerTransferCompanyQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(powerTransferCompany);
powerTransferCompanyQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(powerTransferCompany);
powerTransferCompanyQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<PowerTransferCompany> page;
......@@ -176,10 +174,6 @@ public class PowerTransferCompanyController extends BaseController {
throw new BadRequest("警情ID不能为空");
}
jcSituationDetailMapper.insert(jcSituationDetail);
// if (ObjectUtils.isNotEmpty(jcSituationDetail.getAttachments())) {
// sourceFileService.saveAttachments(jcSituationDetail.getSequenceNbr(), jcSituationDetail.getAttachments());
// }
// 自定义指令信息消息推送
// 定义指令信息消息推送 页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
......
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IUserCarService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -27,6 +28,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.PowerTransferCompanyRes
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
......@@ -95,7 +97,6 @@ public class PowerTransferCompanyResourcesController extends BaseController {
//获取用户已绑定车辆id、
UserCar userCar=userCarService.selectByAmosUserId(Long.valueOf(agencyUserModel.getUserId()));
id =userCar!=null?userCar.getCarId():null;
UpdateWrapper<PowerTransferCompanyResources> up=new UpdateWrapper<>();
return powerTransferCompanyResourcesService.update(new UpdateWrapper<PowerTransferCompanyResources>().eq("resources_id", id).set("status", code));
}
......@@ -138,7 +139,7 @@ public class PowerTransferCompanyResourcesController extends BaseController {
Class<? extends PowerTransferCompanyResources> aClass = powerTransferCompanyResources.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(powerTransferCompanyResources);
if (o != null) {
Class<?> type = field.getType();
......@@ -149,16 +150,13 @@ public class PowerTransferCompanyResourcesController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(powerTransferCompanyResources);
powerTransferCompanyResourcesQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(powerTransferCompanyResources);
powerTransferCompanyResourcesQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(powerTransferCompanyResources);
powerTransferCompanyResourcesQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<PowerTransferCompanyResources> page;
......
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -128,7 +129,7 @@ public class PowerTransferController extends BaseController {
Class<? extends PowerTransfer> aClass = powerTransfer.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(powerTransfer);
if (o != null) {
Class<?> type = field.getType();
......@@ -139,9 +140,6 @@ public class PowerTransferController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(powerTransfer);
powerTransferQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(powerTransfer);
powerTransferQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(powerTransfer);
powerTransferQueryWrapper.eq(name, fileValue);
......
......@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -128,7 +129,7 @@ public class ShiftChangeController extends BaseController {
iShiftChangeService.exportPdfById(response, shiftChangeId);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
throw new BadRequest("系统异常!");
}
}
......
......@@ -179,14 +179,6 @@ public class SignController extends BaseController {
@ApiOperation(httpMethod = "POST",value = "保存打卡记录", notes = "保存打卡记录")
@PostMapping(value = "/saveSign")
public ResponseModel<Boolean> hasSign(@RequestBody SignDto dto) {
// QueryWrapper<Sign> signQueryWrapper = new QueryWrapper<>();
// signQueryWrapper.eq("user_id",dto.getSignUserId());
// signQueryWrapper.eq("date",dto.getDate());
// signQueryWrapper.eq("type",dto.getType());
// Sign one = signServiceImpl.getOne(signQueryWrapper);
// if(null != one) {
// return ResponseHelper.buildResponse(true);
// }
return ResponseHelper.buildResponse(signServiceImpl.saveSign(dto));
}
}
......@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -115,7 +117,7 @@ public class TemplateController extends BaseController {
Class<? extends Template> aClass = template.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
ReflectionUtils.makeAccessible(field);
Object o = field.get(template);
if (o != null) {
Class<?> type = field.getType();
......@@ -126,16 +128,13 @@ public class TemplateController extends BaseController {
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(template);
templateQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(template);
templateQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(template);
templateQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常");
throw new BadRequest("系统异常");
}
});
IPage<Template> page;
......
......@@ -58,8 +58,8 @@ public class VoiceRecordFileController extends BaseController {
@GetMapping(value = "/{sequenceNbr}")
public ResponseModel<VoiceRecordFileDto> getRecordById(@PathVariable Long sequenceNbr) {
VoiceRecordFileDto record = voiceRecordFileService.getRecordById(sequenceNbr);
return ResponseHelper.buildResponse(record);
VoiceRecordFileDto data = voiceRecordFileService.getRecordById(sequenceNbr);
return ResponseHelper.buildResponse(data);
}
/**
......
......@@ -35,32 +35,14 @@ public class AlertCalledAction {
@Autowired
private AlertSubmittedServiceImpl alertSubmittedService;
public void sendSysMessage(String msgType, AlertCalledRo contingency) {
// ContingencyRo ro = (ContingencyRo)contingency;
// ro.setTelemetryMap(null);
// ro.setTelesignallingMap(null);
// Constructor<?> constructor;
// try {
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// AbstractActionResultMessage<?> action = (AbstractActionResultMessage<?>) constructor.newInstance(result);
// ToipResponse toipResponse = action.buildResponse(msgType, contingency, result.toJson());
// String topic = String.format("/%s/%s/%s", serviceName, stationName,"numberPlan");
// log.info(String.format("mqtt[%s]:【 %s 】", topic, toipResponse.toJsonStr()));
// webMqttComponent.publish(topic, toipResponse.toJsonStr());
// ContingencyEvent event = new ContingencyEvent(this);
// event.setMsgBody(toipResponse.toJsonStr());
// event.setTopic(topic);
// event.setMsgType(msgType);
// event.setContingency(contingency);
// contingencyLogPublisher.publish(event);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
String logs= String.format("sendSysMessage %s,%s", msgType,contingency.getAlertType());
log.info(logs);
}
/**
* 短信报送
*
......@@ -72,7 +54,9 @@ public class AlertCalledAction {
@RuleMethod(methodLabel = "短信报送", project = "西咸机场119接处警规则")
public void sendcmd(String smsCode, String sendType, List<Map<String,Object>> submittedList, Object object) throws Exception {
System.out.println("接收到规则调用--------------西咸机场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 = new ArrayList<>();
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);
}
......
......@@ -64,6 +64,8 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
private static String aircraftModel="aircraftModel";
/**
* <pre>
* 保存
......@@ -121,7 +123,7 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
AlertCalledObjsDto dto = (AlertCalledObjsDto)iAlertCalledService.selectAlertCalledByIdNoRedisNew(seq);
List<AlertFormValue> list = dto.getAlertFormValue();
String aircraft = "";
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals("aircraftModel")).collect(Collectors.toList());
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals(aircraftModel)).collect(Collectors.toList());
if(list1.size() > 0) {
if(!ValidationUtil.isEmpty(list1.get(0).getFieldValue())) {
aircraft = list1.get(0).getFieldValue();
......@@ -158,7 +160,7 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
AlertCalledObjsDto dto = (AlertCalledObjsDto)iAlertCalledService.selectAlertCalledByIdNoRedisNew(seq);
List<AlertFormValue> list = dto.getAlertFormValue();
String aircraft = "";
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals("aircraftModel")).collect(Collectors.toList());
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals(aircraftModel)).collect(Collectors.toList());
if(list1.size() > 0) {
if(!ValidationUtil.isEmpty(list1.get(0).getFieldValue())) {
aircraft = list1.get(0).getFieldValue();
......@@ -260,11 +262,6 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
AircraftDto aircraftDto = this.queryBySeq(id);
aircraftDto.setIsDelete(true);
this.updateWithModel(aircraftDto);
// //删除附件信息
// Systemctl.fileInfoClient.deleteByAlias(agencyCode, Aircraft.class.getSimpleName(),
// String.valueOf(id), null);
// //删除航空器信息
// this.deleteBySeq(id);
}
return seqs;
}
......@@ -395,7 +392,7 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
@Override
public Aircraft queryByaircraftModel(String seq) {
QueryWrapper<Aircraft> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("aircraftModel", seq);
queryWrapper.eq(aircraftModel, seq);
// 警情动态表单数据
Aircraft aircraft = this.getOne(queryWrapper);
return aircraft;
......@@ -412,7 +409,6 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", alertId);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
String num = null;
......
......@@ -44,9 +44,7 @@ public class AlertCalledFeedbackServiceImpl extends BaseService<AlertCalledFeedb
@Override
public boolean handleFeedback(AlertCalledFeedbackDto model) {
Long alertCalledId = model.getAlertCalledId();
// 更新警情调派任务状态
List<String> carIdList = powerTransferMapper.queryTransferCarIdsByAlertCalledId(alertCalledId);
// 保存警情反馈
model = createWithModel(model);
......
......@@ -231,13 +231,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
split[0] = "alertStatus";
}
}
if (split[1] != null) {
if (split[1].equals("ascend")) {
if (split[1] != null && split[1].equals("ascend") ){
split[1] = "ASC";
}
if (split[1].equals("descend")) {
split[1] = "DESC";
}
}else (split[1] != null && split[1].equals("descend") ) {
split[1] = "DESC";
}
}
}
......@@ -590,7 +588,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
map.put("sequenceNbr",ll.getSequenceNbr()+"");
map.put("callTime",ll.getCallTime()!=null?sdf.format(ll.getCallTime()):"");
map.put("updateTime",ll.getUpdateTime()!=null?sdf.format(ll.getUpdateTime()):"");
json=list!=null&&list.size()>0?JSONObject.toJSONString(map, SerializerFeature.PrettyFormat,
json=list!=null&&list.size()>0?JSON.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue):"";
}
......@@ -603,7 +601,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// 航空报警器报警通知
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> flightNumber = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
String flightNumIds = JSONObject.toJSONString(flightNumber);
String flightNumIds = JSON.toJSONString(flightNumber);
emqKeeper.getMqttClient().publish(noticeAviation, flightNumIds.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1113,6 +1111,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
case LYXC:
case ZJBZ:
resultList = queryDisposalObjectAircraft(alertCalled);
break;
default:
break;
}
......@@ -1193,22 +1192,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始 */
public List<Map<String, String>> getContactName() {
// List<Map<String,String>> firefightersName =
// firefightersService.getFirefightersName();
// firefightersName.forEach(r->{
// String phone = r.get("phone");
// phone = QRCodeUtil.generateQRCode()+"@"+phone;
// r.put("phone",phone);
// }
// );
// List<Map<String,String>> contactNames = alertCalledMapper.getContactName();
// contactNames.forEach(r->{
// String phone = r.get("phone");
// phone = QRCodeUtil.generateQRCode()+"@"+phone;
// r.put("phone",phone);
// }
// );
// firefightersName.addAll(contactNames);
List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
list.stream().forEach(i -> {
String phone = "";
......@@ -1369,13 +1352,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
int priority = 1;
boolean flag2 = false;
boolean flag3 = false;
JSONObject listForcondition1Nameobj = JSONObject.parseObject(JSONObject.toJSONString(i));
JSONObject listForcondition1Nameobj = JSON.parseObject(JSON.toJSONString(i));
ResponseModel<Object> responseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(listForcondition1Nameobj.getString("sequenceNbr")));
List responseForInstanceIdList = (List) responseForInstanceId.getResult();
Object responseForInstanceIdDetail = responseForInstanceIdList.get(0);
JSONObject responseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(responseForInstanceIdDetail));
.parseObject(JSON.toJSONString(responseForInstanceIdDetail));
if (!(condition1.split(",")[1]).equals(responseForInstanceIdJsonDetail.getString("tagValue"))) {
continue;
}
......@@ -1401,16 +1384,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
ResponseModel<Object> targetSeqResult = knowledgebaseFeignClient
.queryListByTargetSeq(Long.parseLong(listForcondition1Nameobj.getString("targetSeq")));
Object targetSeqResultObj = targetSeqResult.getResult();
JSONArray targetSeqResultArray = JSONArray.parseArray(JSONArray.toJSONString(targetSeqResultObj));
JSONArray targetSeqResultArray = JSON.parseArray(JSON.toJSONString(targetSeqResultObj));
for (Object m : targetSeqResultArray) {
JSONObject detailJson = JSONObject.parseObject(JSONObject.toJSONString(m));
JSONObject detailJson = JSON.parseObject(JSON.toJSONString(m));
if (condition2Name != null && condition2Name.equals(detailJson.getString("tagName"))) {
ResponseModel<Object> condition2ResponseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(detailJson.getString("sequenceNbr")));
List condition2ResponseForInstanceIdList = (List) condition2ResponseForInstanceId.getResult();
Object condition2ResponseForInstanceIdDetail = condition2ResponseForInstanceIdList.get(0);
JSONObject condition2ResponseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(condition2ResponseForInstanceIdDetail));
JSONObject condition2ResponseForInstanceIdJsonDetail = JSON
.parseObject(JSON.toJSONString(condition2ResponseForInstanceIdDetail));
if (condition2value != null && condition2value
.equals(condition2ResponseForInstanceIdJsonDetail.getString("tagValue"))) {
flag2 = true;
......@@ -1423,7 +1406,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
List condition3ResponseForInstanceIdList = (List) condition3ResponseForInstanceId.getResult();
Object condition3ResponseForInstanceIdDetail = condition3ResponseForInstanceIdList.get(0);
JSONObject condition3ResponseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(condition3ResponseForInstanceIdDetail));
.parseObject(JSON.toJSONString(condition3ResponseForInstanceIdDetail));
if (condition3value != null && condition3value
.equals(condition3ResponseForInstanceIdJsonDetail.getString("tagValue"))) {
flag3 = true;
......@@ -1451,7 +1434,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
ResponseModel<Object> SimpleDetailResponse = knowledgebaseFeignClient
.getSimpleDetail(listForcondition1Nameobj.getString("targetSeq"));
if (ObjectUtils.isNotEmpty(SimpleDetailResponse.getResult()) && priority != 0) {
JSONArray detailJsonArray = JSONArray.parseArray(JSONArray.toJSONString(SimpleDetailResponse.getResult()));
JSONArray detailJsonArray = JSON.parseArray(JSON.toJSONString(SimpleDetailResponse.getResult()));
JSONObject detailJsonObject= detailJsonArray.getJSONObject(0);
map.put("recDate",DateUtils.dateToString(detailJsonObject.getString("REC_DATE")));
map.put("sequenceNbr", detailJsonObject.getString("SEQUENCE_NBR"));
......@@ -1467,39 +1450,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
public void sort(List<Map<String, Object>> list) {
Collections.sort(list, new Comparator<Map<String, Object>>() {
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
Integer i =(Integer) o1.get("priority") == (Integer) o2
.get("priority") ? 0 : -1;
return (Integer) o1.get("priority") < (Integer) o2
.get("priority") ? ((Integer) o1.get("priority") == (Integer) o2
.get("priority") ? 0 : -1) : 1;
.get("priority") ? i : 1;
}
});
}
//
// public static void main(String[] args) {
// List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
// Map<String, Object> map = new HashMap<String, Object>();
// map.put("docTitle", "21313213");
// map.put("priority", 21);
// resultList.add(map);
// Map<String, Object> map1 = new HashMap<String, Object>();
// map1.put("docTitle", "21313213");
// map1.put("priority", 12);
// resultList.add(map1);
// Map<String, Object> map2 = new HashMap<String, Object>();
// map2.put("docTitle", "21313213");
// map2.put("priority", 1);
// resultList.add(map2);
// Map<String, Object> map3 = new HashMap<String, Object>();
// map3.put("docTitle", "21313213");
// map3.put("priority", 31);
// resultList.add(map3);
// Map<String, Object> map4 = new HashMap<String, Object>();
// map4.put("docTitle", "21313213");
// map4.put("priority", 18);
// resultList.add(map4);
// sort(resultList);
// for (Map<String, Object> map6 : resultList) {
// System.out.println(map6.get("priority"));
// }
// }
}
......@@ -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