Commit 7189d282 authored by tangwei's avatar tangwei

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents f6373876 11702b95
......@@ -20,6 +20,16 @@
<artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author tb
* @date 2022-04-21.
*/
@Data
public class AlertMsgDto {
@ApiModelProperty(value = "消息类别")
private String type;
@ApiModelProperty(value = "消息来源")
private String from;
@ApiModelProperty(value = "内容")
private String body;
@ApiModelProperty(value = "消息时间")
private Date time;
@ApiModelProperty(value = "消息关联业务id")
private String relationId;
}
......@@ -13,7 +13,7 @@ public class CylWarningMsgDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = -5835716804355474954L;
@Label("企业名称")
private String companyName;
@Label("企业联系人")
......@@ -32,4 +32,6 @@ public class CylWarningMsgDto implements Serializable{
private String num;
@Label("气瓶seq")
private String cylSeq;
@Label("预警发生时间")
private String currentTime;
}
......@@ -48,11 +48,11 @@ public class EsCylinder {
// @Field(type = FieldType.Text)
// private String district;
//
// /**
// * 所属区域代码
// */
// @Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
// private String regionCode;
/**
* 所属区域代码
*/
@Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
private String regionCode;
/**
* 产权单位名称
......
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -8,6 +9,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 气瓶基本信息
......@@ -143,4 +145,6 @@ public class CylinderInfoDto extends BaseDto {
@ApiModelProperty(value = "企业负责人")
private String unitPerson;
@ApiModelProperty(value = "附件")
private Map<String, List<AttachmentDto>> attachments;
}
......@@ -65,4 +65,12 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Page<CylinderInfoDto> queryPageListByEarlyWarningLevel(Page<CylinderInfoDto> page, @Param("earlyWarningLevel") String earlyWarningLevel);
CylinderInfoDto getDetail(String sequenceCode);
/**
* 查询行政区划下的所有气瓶
*
* @param regionCode
* @return
*/
List<CylinderInfoDto> listWithRegionCode(Integer regionCode);
}
......@@ -104,4 +104,14 @@
where
ci.sequence_code = #{sequenceCode}
</select>
<select id="listWithRegionCode" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto">
SELECT
ci.*,
cu.region_code
FROM
`tz_cylinder_info` ci
LEFT JOIN tz_cylinder_unit cu ON cu.app_id = ci.app_id
WHERE
cu.region_code LIKE CONCAT("%", #{regionCode}, "%")
</select>
</mapper>
......@@ -6,8 +6,10 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -21,6 +23,8 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -77,6 +81,9 @@ public class WebServicesFileFransferResource {
@Value(value = "${upload.temp.dir}")
String tempDir;
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSSS");
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "文件下载")
......@@ -130,8 +137,9 @@ public class WebServicesFileFransferResource {
}
String fileName = file.getOriginalFilename();
String suffixName = fileName.substring(fileName.lastIndexOf("."));
String name = fileName.substring(0, fileName.lastIndexOf(".") -1);
String filePath = tempDir;
fileName = UUID.randomUUID() + suffixName;
fileName = name + "-" + sdf.format(new Date()) + suffixName;
File dest = new File(filePath + fileName);
if (!dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
......@@ -210,6 +218,11 @@ public class WebServicesFileFransferResource {
try {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(webserviceUrl);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(1000000); // 连接超时时间
policy.setReceiveTimeout(1000000);// 请求超时时间.
conduit.setClient(policy);
if (ObjectUtils.isEmpty(transferModel.getAvicCode())) {
for (String file : transferModel.getFiles().stream().map(m -> m.getUrl())
.collect(Collectors.toList())) {
......
......@@ -769,16 +769,20 @@ public class OrgUsrController extends BaseController {
queryWrapper.eq("type", "SpecialType").or().eq("type", "SpecialDepartment");
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<String> objects = new ArrayList<>();
list.stream().forEach(e->objects.add(e.getName()));
list.stream().forEach(e->objects.add(e.getCode()));
//判断当前登录人权限是否处于特殊类型
if (objects.contains(authKey)){
//判断当前登录人部门是否处于特殊部门
if (objects.contains(personIdentity.getCompanyId())) {
//查询当前登录人所属单位/部门
OrgUsr orgUsr = orgUsrMapper.selectById(personIdentity.getCompanyId());
//查询当前登录人父级单位
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getParentId,personIdentity.getCompanyId());
wrapper.eq(OrgUsr::getSequenceNbr,orgUsr.getParentId());
wrapper.eq(BaseEntity::getIsDelete,false);
OrgUsr orgUsr = orgUsrMapper.selectOne(wrapper);
personIdentity.setBizOrgCode(orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode() : personIdentity.getBizOrgCode());
OrgUsr result = orgUsrMapper.selectOne(wrapper);
bizOrgCode = result.getBizOrgCode() != null? result.getBizOrgCode() : personIdentity.getBizOrgCode();
}
}
// 权限处理
......
package com.yeejoin.amos.boot.module.tzs.biz.action;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.CylWarningMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.api.enums.EarlyWarningLevelEnum;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
@Component
@RuleActionBean(beanLabel = "气瓶预警消息")
public class CylWarningMsgAction{
private final Logger logger = LoggerFactory.getLogger(CylWarningMsgAction.class);
@Value("${tzs.wechat.tempId.warning}")
private String templateId_Warning;
@Autowired
WechatRelationServiceImpl wechatRelationService;
@Autowired
WechatServiceImpl wechatServiceImpl;
@Autowired
CylinderInfoServiceImpl cylinderInfoServiceImpl;
@Autowired
MsgLogServiceImpl msgLogServiceImpl;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.cyl.warning.push}")
private String cylpushTopic;
// @ExposeAction("气瓶预警消息")
@RuleMethod(methodLabel = "气瓶预警消息方法", project = "气瓶监管")
public void sendCylWebMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
{
CylWarningMsgDto cylWarningMsgDto = (CylWarningMsgDto)bizobj;
//更新气瓶等级
logger.info("更新气瓶等级:"+level);
logger.info("预警区间:"+cylWarningMsgDto.getNum());
cylinderInfoServiceImpl.updateEarlyWarningLevel(cylWarningMsgDto.getCylSeq(), level);
//增加消息日志数据
MsgLog msgLog = new MsgLog();
msgLog.setRelationCode(cylWarningMsgDto.getCylSeq());
msgLog.setMsgType(EarlyWarningLevelEnum.getEumByLevel(level).getCode());
msgLog.setMsgTypeName(EarlyWarningLevelEnum.getEumByLevel(level).getName());
msgLog.setBody(instedParams(text,cylWarningMsgDto));
msgLog.setTargetCode(instedParams(phone,cylWarningMsgDto));
msgLog.setTargetName(instedParams(orgUserName,cylWarningMsgDto));
msgLog.setTerminalType("WEB");
msgLog.setSendTime(new Date());
msgLogServiceImpl.save(msgLog);
logger.info("增加消息日志数据:"+msgLog.toString());
//发送web消息
try {
emqKeeper.getMqttClient().publish(cylpushTopic, instedParams(text,cylWarningMsgDto).getBytes("UTF-8"), 2, false);
logger.info("气瓶预警消息发送成功:");
} catch (MqttException e) {
e.printStackTrace();
logger.error("mqtt发送失败" +text );
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error("mqtt发送失败" +text );
}
}
@RuleMethod(methodLabel = "气瓶公众号", project = "气瓶监管")
public void sendCylWechatMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
{
//增加消息日志数据
CylWarningMsgDto cylWarningMsgDto = (CylWarningMsgDto)bizobj;
MsgLog msgLog = new MsgLog();
msgLog.setRelationCode(cylWarningMsgDto.getCylSeq());
msgLog.setMsgType(EarlyWarningLevelEnum.getEumByLevel(level).getCode());
msgLog.setMsgTypeName(EarlyWarningLevelEnum.getEumByLevel(level).getName());
msgLog.setBody(instedParams(text,cylWarningMsgDto));
msgLog.setTargetCode(instedParams(phone,cylWarningMsgDto));
msgLog.setTargetName(instedParams(orgUserName,cylWarningMsgDto));
msgLog.setTerminalType("APP");
msgLog.setSendTime(new Date());
msgLogServiceImpl.save(msgLog);
//发送公众号消息
logger.info("气瓶预警消息发送开始:"+phone);
WechatRelation wechatRelation =wechatRelationService.getOne(new LambdaQueryWrapper<WechatRelation>().eq(WechatRelation::getPhone,phone));
logger.info("气瓶预警消息发送OpenId:"+wechatRelation.toString());
if(null != wechatRelation) {
WechatMessageDto wechatMessageDto1 = new WechatMessageDto();
wechatMessageDto1.setTemplateId(templateId_Warning);
Map<String, String> data1 = Maps.newHashMap();
data1.put("first", "【陕西特种设备安全监察局】风险预警提醒");
data1.put("keyword1", instedParams(text,cylWarningMsgDto));
data1.put("keyword2", DateUtils.date2LongStr(new Date()));
wechatMessageDto1.setData(data1);
wechatServiceImpl.sendWechatModelMessage(wechatRelation.getOpenId(), wechatMessageDto1);
logger.info("公众号消息发送成功:");
}
}
private String instedParams(String content, CylWarningMsgDto contingencyRo) {
// Map<String, String> strengthMap = this.getStrengthMap(contingencyRo);
// for (String key : strengthMap.keySet())
// content = content.replaceAll("\\$\\{" + key + "}", strengthMap.get(key));
if(null == content || !content.contains("$")) {
return content;
}
Field[] fields = contingencyRo.getClass().getDeclaredFields();
Method getMethod = null;
try {
for (Field field : fields) {
if (field.getName().equals("serialVersionUID"))
continue;
String fileNameInMethod = String.valueOf(field.getName().charAt(0)).toUpperCase() + field.getName().substring(1);
getMethod = contingencyRo.getClass().getMethod("get" + fileNameInMethod);
String value = String.valueOf(getMethod.invoke(contingencyRo));
content = content.replaceAll("\\$\\{" + field.getName() + "}", value.equals("null")?"":value);
}
content = getNative(content);
} catch (Exception e) {
e.printStackTrace();
}
return content;
}
public String getNative(String str)
{
Pattern p = Pattern.compile("\\$\\{(.*?)\\}");
Matcher m = p.matcher(str);
while (m.find())
{
String parameter = m.group();
Object parametervalue = ELEvaluationContext
.getValue(parameter.substring(1, parameter.length() - 1));
if(parametervalue != null)
str = str.replace(parameter,
parametervalue != null ? parametervalue.toString() : null);
}
return str;
}
}
package com.yeejoin.amos.boot.module.tzs.biz.action;
import java.util.Map;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
public class ELEvaluationContext
{
private static EvaluationContext instance = new StandardEvaluationContext();
private static ExpressionParser parser = new SpelExpressionParser();
public static EvaluationContext getInstance()
{
return instance;
}
public static void setVariable(String name, Object value)
{
instance.setVariable(name, value);
}
public static void setVariable(Map<String, Object> vars)
{
for (Map.Entry<String, Object> entry : vars.entrySet())
{
instance.setVariable(entry.getKey(), entry.getValue());
}
}
public static Object getValue(String Expression){
return parser.parseExpression(Expression).getValue(instance);
}
}
......@@ -131,7 +131,6 @@ public class AlertCalledController extends BaseController {
@Value("${mqtt.topic.alertInfo.push}")
private String alertInfopushTopic;
@Autowired
TzsAuthService tzsAuthService;
......@@ -721,42 +720,11 @@ public class AlertCalledController extends BaseController {
@GetMapping(value = "/getActualAlert")
@ApiOperation(httpMethod = "GET", value = "根据regionCode 获取区域内实时警情", notes = "根据regionCode 获取区域内实时警情")
public ResponseModel<List<AlertPaperInfoDto>> getActualAlert(@RequestParam(name = "regionCodes", required = false) List<String> regionCodes) {
// 警情id 警情地址 警情状态 警情类型 警情发生时间
List<String> useRegionCode = tzsAuthService.getUserRegionCode();
if(regionCodes == null) {
regionCodes = useRegionCode;
} else {
// 判断传入regionCodes 是否越权
List<String> tempList = new ArrayList<>();
Iterator<String> regionIt = regionCodes.iterator();
while(regionIt.hasNext()) {
String tempCode = regionIt.next();
String districtCode = tempCode.substring(4,6);
String provinceCode = tempCode.substring(2,6);
if("0000".equals(provinceCode)) {// 为省则默认使用用户现有权限查询数据
regionCodes = useRegionCode;
} else {
if("00".equals(districtCode)) { // 为市
if(!useRegionCode.contains(tempCode)) { // 不包含该市权限 需要移除市搜索条件 添加 该市下区搜索条件
for(String tempUsercode : useRegionCode) {
if(tempUsercode.indexOf(tempCode.substring(0,4)) != -1) {
tempList.add(tempUsercode);
}
}
regionIt.remove();
}
} else { // 为区 不会出现越权情况
}
}
}
for (String t : tempList) {
regionCodes.add(t);
}
}
return ResponseHelper.buildResponse(iAlertCalledService.getAlertPaperInfoList(regionCodes,false));
return ResponseHelper.buildResponse(iAlertCalledService.getAlertPaperInfoList(iAlertCalledService.authRegionCodeList(regionCodes),false));
}
/**
* 根据regionCode 获取区域内历史警情 七日内
*/
......
......@@ -113,4 +113,17 @@ public class MsgLogController extends BaseController {
public ResponseModel<List<MsgLogDto>> selectForList() {
return ResponseHelper.buildResponse(msgLogServiceImpl.queryForMsgLogList());
}
}
/**
* 告警数量统计
*
* @return Integer
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "告警数量统计", notes = "告警数量统计")
@GetMapping(value = "/count")
public ResponseModel<Integer> countByTerminalType(
@RequestParam(value = "terminalType",required = false) String terminalType) {
return ResponseHelper.buildResponse(msgLogServiceImpl.countByTerminalType(terminalType));
}
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorBaseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
......@@ -35,20 +37,27 @@ import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentRegionNumServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MaintainInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TestInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javafx.scene.shape.Cylinder;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -117,6 +126,11 @@ public class SpecialEquipmentController extends BaseController {
@Autowired
ESCylinderServiceImpl esCylinderService;
@Autowired
CylinderInfoMapper cylinderInfoMapper;
@Autowired
MsgLogServiceImpl msgLogService;
/**
* ES查询特种设备信息 带分页 加经纬度过滤 keyword 搜索
......@@ -158,9 +172,12 @@ public class SpecialEquipmentController extends BaseController {
throw new BadRequest("参数校验失败.");
}
if(StringUtils.isNotBlank(esSpecialEquipmentDto.getCategoryCode())) { // 查找特定设备
if("3000".equals(esSpecialEquipmentDto.getCategoryCode())) {
if(SpecialEquipmentCategoryEnum.ELEVATOR.getCode().equals(esSpecialEquipmentDto.getCategoryCode())) {
result = esElevatorService.queryByDto(esSpecialEquipmentDto);
}
if(SpecialEquipmentCategoryEnum.PRESSURE_VESSEL.getCode().equals(esSpecialEquipmentDto.getCategoryCode())) {
result = esCylinderService.queryByDto(esSpecialEquipmentDto);
}
}
return ResponseHelper.buildResponse(result);
}
......@@ -201,21 +218,20 @@ public class SpecialEquipmentController extends BaseController {
public ResponseModel<Map<String, Long>> queryEquipNum(@RequestBody EsSpecialEquipmentDto esSpecialEquipmentDto){
Map<String, Long> result = new HashMap<>();
// 锅炉
Long boiler = 0l;
Long boiler = 0L;
result.put("1000",boiler);
// 压力容器
Long vessel = 0l;
Long vessel = esCylinderService.queryNumberByDto(esSpecialEquipmentDto);
result.put("2000",vessel);
// 电梯
Long elevator = esElevatorService.queryNumberByDto(esSpecialEquipmentDto);
result.put("3000",elevator);
// 起重机械
Long crane = 0l;
Long crane = 0L;
result.put("4000",crane);
// 大型游乐设施
Long facility = 0l;
Long facility = 0L;
result.put("6000",facility);
// 大型游乐设施
return ResponseHelper.buildResponse(result);
}
......@@ -238,7 +254,7 @@ public class SpecialEquipmentController extends BaseController {
RegionModel province = userTree.get(0);
if("0".equals(esSpecialEquipmentDto.getSelectType())) { // 获取省聚合
List<EquipmentRegionNum> list = equipmentRegionNumServiceImpl.list(new LambdaQueryWrapper<EquipmentRegionNum>().eq(EquipmentRegionNum::getProvinceCode,province.getRegionCode()).eq(EquipmentRegionNum::getCategoryCode,esSpecialEquipmentDto.getCategoryCode()));
Long count = 0l;
Long count = 0L;
for(EquipmentRegionNum t : list) {
count += t.getNum();
}
......@@ -250,9 +266,9 @@ public class SpecialEquipmentController extends BaseController {
result.add(tepMap);
} else if("1".equals(esSpecialEquipmentDto.getSelectType())) {// 获取市聚合
List<RegionModel> citys = (List<RegionModel>) province.getChildren();
citys.stream().forEach(c -> {
citys.forEach(c -> {
List<EquipmentRegionNum> list = equipmentRegionNumServiceImpl.list(new LambdaQueryWrapper<EquipmentRegionNum>().eq(EquipmentRegionNum::getCityCode,c.getRegionCode()).eq(EquipmentRegionNum::getCategoryCode,esSpecialEquipmentDto.getCategoryCode()));
Long count = 0l;
Long count = 0L;
for(EquipmentRegionNum t : list) {
count += t.getNum();
}
......@@ -265,11 +281,11 @@ public class SpecialEquipmentController extends BaseController {
});
} else if("2".equals(esSpecialEquipmentDto.getSelectType())) {// 获取县聚合
List<RegionModel> citys = (List<RegionModel>) province.getChildren();
citys.stream().forEach(c -> {
citys.forEach(c -> {
List<RegionModel> districts = (List<RegionModel>) c.getChildren();
districts.stream().forEach(d -> {
districts.forEach(d -> {
List<EquipmentRegionNum> list = equipmentRegionNumServiceImpl.list(new LambdaQueryWrapper<EquipmentRegionNum>().eq(EquipmentRegionNum::getDistrictCode,d.getRegionCode()).eq(EquipmentRegionNum::getCategoryCode,esSpecialEquipmentDto.getCategoryCode()));
Long count = 0l;
Long count = 0L;
for(EquipmentRegionNum t : list) {
count += t.getNum();
}
......@@ -298,9 +314,9 @@ public class SpecialEquipmentController extends BaseController {
// 按照最低级来查询数量 保存地址
RegionModel start = tree.get(0); // 省
List<RegionModel> city = (List<RegionModel>) start.getChildren();
city.stream().forEach(c -> {
city.forEach(c -> {
List<RegionModel> district = (List<RegionModel>) c.getChildren();
district.stream().forEach(d -> {
district.forEach(d -> {
List<Elevator> list = elevatorService.list(new LambdaQueryWrapper<Elevator>().eq(Elevator::getIsDelete,false).like(Elevator::getRegionCode,d.getRegionCode()));
EquipmentRegionNum temp = new EquipmentRegionNum();
temp.setCategoryCode("3000");
......@@ -311,9 +327,19 @@ public class SpecialEquipmentController extends BaseController {
temp.setLongitude(d.getLongitude());
temp.setNum((long) list.size());
equipmentRegionNumServiceImpl.save(temp);
});
List<CylinderInfoDto> cylinderInfoList =
cylinderInfoMapper.listWithRegionCode(d.getRegionCode());
EquipmentRegionNum temp1 = new EquipmentRegionNum();
temp1.setCategoryCode("2000");
temp1.setCityCode(c.getRegionCode()+"");
temp1.setDistrictCode(d.getRegionCode()+"");
temp1.setProvinceCode(start.getRegionCode()+"");
temp1.setLatitude(d.getLatitude());
temp1.setLongitude(d.getLongitude());
temp1.setNum((long) cylinderInfoList.size());
equipmentRegionNumServiceImpl.save(temp1);
});
});
}
......@@ -328,6 +354,14 @@ public class SpecialEquipmentController extends BaseController {
}
/**
* 根据regionCode 获取区域内实时预警
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAlertMsg")
@ApiOperation(httpMethod = "GET", value = "根据regionCode 获取区域内实时预警", notes = "根据regionCode 获取区域内实时预警")
public ResponseModel<List<AlertMsgDto>> getActualAlert(@RequestParam(name = "regionCodes", required = false) List<String> regionCodes) {
return ResponseHelper.buildResponse(msgLogService.queryForAlertMsg(regionCodes));
}
}
......@@ -364,8 +364,10 @@ public class WechatController extends BaseController {
@GetMapping(value = "/getOpenIdTel/{code}")
@ApiOperation(httpMethod = "GET", value = "根据微信code获取openId和手机号接口", notes = "根据微信code获取openId和手机号接口")
public ResponseModel<WechatAccessDto> getOpenIdTel(@PathVariable String code) {
logger.info("公众号登录"+code);
WechatAccessDto wechatAccessDto = new WechatAccessDto();
String openId = wechatService.getOpenId(code);
logger.info("公众号登录openId"+openId);
if(StringUtils.isNotEmpty(openId)) {
JSONObject userInfo = wechatService.getUserInfo(openId);
wechatAccessDto.setOpenId(openId);
......@@ -383,6 +385,7 @@ public class WechatController extends BaseController {
}
}
}
logger.info("公众号登录wechatAccessDto"+wechatAccessDto);
return ResponseHelper.buildResponse(wechatAccessDto);
}
......
......@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -45,6 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -53,6 +55,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -106,6 +109,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
VoiceRecordFileServiceImpl voiceRecordFileServiceImpl;
@Autowired
TzsAuthService tzsAuthService;
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
......@@ -674,7 +680,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
public List<AlertPaperInfoDto> getAlertPaperInfoList(List<String> regionCodes, Boolean isHistory) {
List<AlertPaperInfoDto> temp = baseMapper.getAlertPaperInfoList(regionCodes, isHistory);
temp.stream().forEach(t -> {
temp.forEach(t -> {
DispatchPaper paper = dispatchPaperService.getOne(new LambdaQueryWrapper<DispatchPaper>().eq(DispatchPaper::getIsDelete,false).eq(DispatchPaper::getAlertId,t.getAlertId()));
if(paper != null) {
t.setFinishTime(paper.getFeedbackFinishTime());
......@@ -683,6 +689,41 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return temp;
}
public List<String> authRegionCodeList(List<String> regionCodes) {
// 警情id 警情地址 警情状态 警情类型 警情发生时间
List<String> useRegionCode = tzsAuthService.getUserRegionCode();
if(regionCodes == null) {
regionCodes = useRegionCode;
} else {
// 判断传入regionCodes 是否越权
List<String> tempList = new ArrayList<>();
Iterator<String> regionIt = regionCodes.iterator();
while(regionIt.hasNext()) {
String tempCode = regionIt.next();
String districtCode = tempCode.substring(4,6);
String provinceCode = tempCode.substring(2,6);
if("0000".equals(provinceCode)) {// 为省则默认使用用户现有权限查询数据
regionCodes = useRegionCode;
} else {
if("00".equals(districtCode)) { // 为市
if(!useRegionCode.contains(tempCode)) { // 不包含该市权限 需要移除市搜索条件 添加 该市下区搜索条件
for(String tempUsercode : useRegionCode) {
if(tempUsercode.contains(tempCode.substring(0, 4))) {
tempList.add(tempUsercode);
}
}
regionIt.remove();
}
} else { // 为区 不会出现越权情况
}
}
}
regionCodes.addAll(tempList);
}
return regionCodes;
}
@Override
public List<AlertPaperInfoDto> getEquipmentHistory(List<String> regionCodes, String equipmentClassCode, Integer current, Integer pageNum, String equipmentCode) {
current = pageNum * ( current - 1);
......
......@@ -10,14 +10,15 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder;
import com.yeejoin.amos.boot.module.tzs.api.enums.SpecialEquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderRepository;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderUnitServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EndUserServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
......@@ -50,6 +51,9 @@ public class ESCylinderServiceImpl {
@Autowired
private EndUserServiceImpl endUserService;
@Autowired
private CylinderUnitServiceImpl cylinderUnitService;
/**
* <pre>
* 保存气瓶信息
......@@ -74,6 +78,12 @@ public class ESCylinderServiceImpl {
if (!ValidationUtil.isEmpty(endUser)) {
esCylinder.setAddress(endUser.getAddress());
}
CylinderUnit cylinderUnit =
cylinderUnitService.getOne(new LambdaQueryWrapper<CylinderUnit>().eq(CylinderUnit::getAppId,
cylinderInfo.getAppId()));
if (!ValidationUtil.isEmpty(cylinderUnit)) {
esCylinder.setRegionCode(cylinderUnit.getRegionCode());
}
esCylinder.setFactoryNum(cylinderInfo.getFactoryNum());
esCylinder.setUnitName(cylinderInfo.getUnitName());
if (StringUtils.isNotBlank(cylinderInfo.getLatitude()) && StringUtils.isNotBlank(cylinderInfo.getLongitude())) {
......@@ -161,4 +171,137 @@ public class ESCylinderServiceImpl {
return result;
}
public Long queryNumberByDto(EsSpecialEquipmentDto esSpecialEquipmentDto) {
Double startLongitude = esSpecialEquipmentDto.getStartLongitude();
Double startLatitude = esSpecialEquipmentDto.getStartLatitude();
Double endLongitude = esSpecialEquipmentDto.getEndLongitude();
Double endLatitude = esSpecialEquipmentDto.getEndLatitude();
String regionCode = esSpecialEquipmentDto.getRegionCode();
String keyword = esSpecialEquipmentDto.getKeyword();
/**
* 通用匹配规则,条件构建
*/
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 经度比start 大比end 小 纬度比start 小 比end 大
if (!ValidationUtil.isEmpty(startLongitude) && !ValidationUtil.isEmpty(startLatitude) && !ValidationUtil.isEmpty(endLongitude) && !ValidationUtil.isEmpty(endLatitude)) {
BoolQueryBuilder longLatMust = QueryBuilders.boolQuery();
BoolQueryBuilder qb1 = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("longitude").gte(startLongitude).lte(endLongitude));
BoolQueryBuilder qb2 = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("latitude").gte(endLatitude).lte(startLatitude));
longLatMust.must(qb1);
longLatMust.must(qb2);
boolMust.must(longLatMust);
}
if (!ValidationUtil.isEmpty(regionCode)) {
BoolQueryBuilder qb2 = QueryBuilders.boolQuery().
filter(QueryBuilders.matchPhraseQuery("regionCode", regionCode));
boolMust.must(qb2);
}
if (!ValidationUtil.isEmpty(keyword)) {
BoolQueryBuilder qb0 = QueryBuilders.boolQuery().
must(QueryBuilders.matchQuery("factoryNum", keyword));
boolMust.should(qb0);
BoolQueryBuilder qb1 = QueryBuilders.boolQuery().
must(QueryBuilders.matchQuery("address", keyword));
boolMust.should(qb1);
BoolQueryBuilder qb2 = QueryBuilders.boolQuery().
must(QueryBuilders.matchQuery("unitName", keyword));
boolMust.should(qb2);
boolMust.minimumShouldMatch(1);
}
// 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页
// .withPageable(PageRequest.of(current, size))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.withQuery(boolMust);
long total = 0;
try {
SearchHits<EsCylinder> searchHits = elasticsearchTemplate.search(queryBuilder.build(), EsCylinder.class);
total = searchHits.getTotalHits();
} catch (Exception e) {
// TODO: handle exception
}
return total;
}
/**
* 根据特种设备搜索类查找气瓶相关信息
*
* @param esSpecialEquipmentDto
* @return
*/
public List<SpecialEquipmentDto> queryByDto(EsSpecialEquipmentDto esSpecialEquipmentDto) {
Double startLongitude = esSpecialEquipmentDto.getStartLongitude();
Double startLatitude = esSpecialEquipmentDto.getStartLatitude();
Double endLongitude = esSpecialEquipmentDto.getEndLongitude();
Double endLatitude = esSpecialEquipmentDto.getEndLatitude();
String regionCode = esSpecialEquipmentDto.getRegionCode();
String keyword = esSpecialEquipmentDto.getKeyword();
// 如果传入经纬度则根据经纬度过滤 如果传入regionCode 根据regionCode过滤 如果是 单独查电梯 则返回最多3000条 否则为 400条
/**
* 通用匹配规则,条件构建
*/
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 经度比start 大比end 小 纬度比start 小 比end 大
if (!ValidationUtil.isEmpty(startLongitude) && !ValidationUtil.isEmpty(startLatitude) && !ValidationUtil.isEmpty(endLongitude) && !ValidationUtil.isEmpty(endLatitude)) {
BoolQueryBuilder longLatMust = QueryBuilders.boolQuery();
BoolQueryBuilder qb1 = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("longitude").gte(startLongitude).lte(endLongitude));
BoolQueryBuilder qb2 = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("latitude").gte(endLatitude).lte(startLatitude));
longLatMust.must(qb1);
longLatMust.must(qb2);
boolMust.must(longLatMust);
}
if (!ValidationUtil.isEmpty(regionCode)) {
BoolQueryBuilder qb2 = QueryBuilders.boolQuery().
filter(QueryBuilders.matchPhraseQuery("regionCode", regionCode));
boolMust.must(qb2);
}
if (!ValidationUtil.isEmpty(keyword)) {
BoolQueryBuilder qb0 = QueryBuilders.boolQuery().
must(QueryBuilders.matchQuery("factoryNum", keyword));
boolMust.should(qb0);
BoolQueryBuilder qb1 = QueryBuilders.boolQuery().
must(QueryBuilders.matchQuery("address", keyword));
boolMust.should(qb1);
BoolQueryBuilder qb2 = QueryBuilders.boolQuery().
must(QueryBuilders.matchQuery("unitName", keyword));
boolMust.should(qb2);
boolMust.minimumShouldMatch(1);
}
// 创建查询构造器
NativeSearchQuery query = new NativeSearchQueryBuilder()
// 分页
// .withPageable(PageRequest.of(0, size))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.withQuery(boolMust).build();
query.setTrackTotalHits(true);
query.setMaxResults(10000);
List<SpecialEquipmentDto> list = new LinkedList<>();
SearchHits<EsCylinder> searchHits = elasticsearchTemplate.search(query, EsCylinder.class);
for (SearchHit searchHit : searchHits.getSearchHits()) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
SpecialEquipmentDto esCylinderDto = JSONObject.toJavaObject(jsonObject, SpecialEquipmentDto.class);
esCylinderDto.setCategoryCode(SpecialEquipmentCategoryEnum.PRESSURE_VESSEL.getCode());
esCylinderDto.setUnitName(jsonObject.getString("unitName"));
esCylinderDto.setRegisterCode(jsonObject.getString("factoryNum"));
list.add(esCylinderDto);
}
return list;
}
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.api.mapper.MsgLogMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IMsgLogService;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
......@@ -17,6 +27,12 @@ import java.util.List;
*/
@Service
public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper> implements IMsgLogService {
Logger logger = LoggerFactory.getLogger(MsgLogServiceImpl.class);
@Autowired
AlertCalledServiceImpl alertCalledService;
/**
* 分页查询
*/
......@@ -30,4 +46,47 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper
public List<MsgLogDto> queryForMsgLogList() {
return this.queryForList("" , false);
}
public List<MsgLogDto> queryForWebMsgLogList(String terminalType) {
return this.queryForList("" , false, terminalType);
}
public List<AlertMsgDto> queryForAlertMsg(List<String> regionCodes) {
List<AlertMsgDto> alertMsgDtoList = Lists.newArrayList();
// 查询电梯警情预报消息
List<AlertPaperInfoDto> alertPaperInfoDtoList =
alertCalledService.getAlertPaperInfoList(alertCalledService.authRegionCodeList(regionCodes), false);
if (!ValidationUtil.isEmpty(alertPaperInfoDtoList)) {
alertPaperInfoDtoList.forEach(msg -> {
AlertMsgDto alertMsgDto = new AlertMsgDto();
alertMsgDto.setBody(msg.getAddress() + "发生" + msg.getAlarmType() + "事件");
alertMsgDto.setFrom("elevator");
alertMsgDto.setRelationId(String.valueOf(msg.getAlertId()));
alertMsgDto.setTime(msg.getCallTime());
alertMsgDto.setType(msg.getAlarmType());
alertMsgDtoList.add(alertMsgDto);
});
}
// 查询气瓶预警消息
List<MsgLog> msgLogList = this.list(new LambdaQueryWrapper<MsgLog>().eq(MsgLog::getTerminalType, "WEB"));
if (!ValidationUtil.isEmpty(msgLogList)) {
msgLogList.forEach(msg -> {
AlertMsgDto alertMsgDto = new AlertMsgDto();
alertMsgDto.setBody(msg.getBody());
alertMsgDto.setFrom("cylinder");
alertMsgDto.setRelationId(String.valueOf(msg.getSequenceNbr()));
alertMsgDto.setTime(msg.getSendTime());
alertMsgDto.setType(msg.getMsgTypeName());
alertMsgDtoList.add(alertMsgDto);
});
}
return alertMsgDtoList;
}
public Integer countByTerminalType(String terminalType) {
return this.list(new LambdaQueryWrapper<MsgLog>().eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType)).size();
}
}
\ No newline at end of file
......@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESCylinderServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
......@@ -20,6 +23,7 @@ import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderUnitService
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.recycler.Recycler;
......@@ -74,6 +78,8 @@ public class CylinderInfoController extends BaseController {
private Map<Integer, String> regionMap;
@Autowired
private SourceFileServiceImpl sourceFileService;
/**
* 新增气瓶基本信息
......@@ -554,6 +560,8 @@ public class CylinderInfoController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取气瓶详细信息", notes = "获取气瓶详细信息")
public ResponseModel<CylinderInfoDto> cyinderInfoList(@PathVariable Long sequenceNbr) {
CylinderInfo cylinderInfo = cylinderInfoServiceImpl.getById(sequenceNbr);
Map<String, List<AttachmentDto>> imgMap = sourceFileService.getAttachments(cylinderInfo.getSequenceNbr());
CylinderInfoDto target = new CylinderInfoDto();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(cylinderInfo, target);
......@@ -591,7 +599,7 @@ public class CylinderInfoController extends BaseController {
} else {
target.setInspectionStatas(0);
}
target.setAttachments(imgMap);
return ResponseHelper.buildResponse(target);
}
......
......@@ -19,7 +19,7 @@ public class CylinderSchedulerJob {
/**
* 每天9点-日报生成
*/
@Scheduled(cron = "0 0 9 * * ?")
@Scheduled(cron = "${cylinder-early-warning-cron:0 0 9 * * ?}")
public void dayReport() {
cylinderInfoService.calEarlyWarningLevel();
}
......
......@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Consumer;
......@@ -611,7 +612,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
page.setCurrent(i);
page.setSize(size);
LambdaQueryWrapper<CylinderInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByDesc(CylinderInfo::getSequenceNbr);
wrapper.select(CylinderInfo::getSequenceCode,CylinderInfo::getSequenceNbr).orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) {
// 设置token
......@@ -627,11 +628,17 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date();
String dateStr;
try {
dateStr = DateUtils.dateFormat(now,DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
throw new RuntimeException("日期个时候失败");
}
//1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try {
CylWarningMsgDto cylWarningMsgDto = new CylWarningMsgDto();
int interval = DateUtils.dateBetweenIncludeToday(cylinderInfoDto.getNextInspectionDate(), now);
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
cylWarningMsgDto.setNum(String.valueOf(interval));
cylWarningMsgDto.setFactoryNum(cylinderInfoDto.getFactoryNum());
cylWarningMsgDto.setUserType(cylinderInfoDto.getCustomType());
......@@ -641,13 +648,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
cylWarningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
cylWarningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
cylWarningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
cylWarningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(cylWarningMsgDto));
}
ruleTrigger.publish(cylWarningMsgDto, packageId, null);
} catch (Exception e) {
log.error("调用规则失败!:{}", JSON.toJSONString(cylinderInfoDto));
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto),e);
}
}
......
......@@ -2820,7 +2820,7 @@
</preConditions>
<comment>add data wl_form_group</comment>
<sql>
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000346, 'inwhichBuild', '所在建筑', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
REPLACE INTO `wl_form_group_column`(`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000347, 'inwhichBuild', '所在建筑', 'String', 132828674824, 'eq', b'0', 'r_tank', 2581805, '2022-04-18 11:29:34');
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -5,13 +5,18 @@ spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMu
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
#eureka properties:
eureka.instance.hostname=113.134.211.174
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:10001/eureka/
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.39:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.39:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.39:${server.port}${server.servlet.context-path}/swagger-ui.html
## ES properties:
biz.elasticsearch.address=113.134.211.174
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
......@@ -22,7 +27,7 @@ alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=113.134.211.174
spring.redis.host=172.16.3.28
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
......@@ -34,60 +39,13 @@ spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://113.134.211.174:1883
emqx.user-name=super
emqx.password=a123456
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://113.134.211.174:8000
#tzs.wechat.url=https://api.weixin.qq.com
#tzs.wechat.appid=wx8918c1aaad956617
#tzs.wechat.secret=337c3d8f3e749140d4f9aedc8311033b
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## 预警通知模板id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##督查整改通知
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## 公众号测试用户id(平台userId)
tzs.wechat.test.userId=3393279
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.3.28:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8&rewriteBatchedStatement=true
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
......@@ -43,56 +43,4 @@ emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
#tzs.wechat.url=https://api.weixin.qq.com
#tzs.wechat.appid=wx8918c1aaad956617
#tzs.wechat.secret=337c3d8f3e749140d4f9aedc8311033b
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
## 预警通知模板id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##督查整改通知
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## 公众号测试用户id(平台userId)
tzs.wechat.test.userId=3413513,3427644
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
tzs.cti.url=http://113.134.211.174:8000
......@@ -42,52 +42,4 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## 预警通知模板id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##督查整改通知
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## 公众号测试用户id(平台userId)
tzs.wechat.test.userId=3413513,3427644
\ No newline at end of file
tzs.cti.url=http://113.134.211.174:8000
spring.application.name=TZS-kfm
spring.application.name=TZS
server.servlet.context-path=/tzs
server.port=11000
spring.profiles.active=jd
......@@ -52,9 +52,9 @@ security.systemctl.name=AMOS-API-SYSTEMCTL
jcs.company.topic.add=jcs/company/topic/add
jcs.company.topic.delete=jcs/company/topic/delete
## 设备联动服务(车库门、广播、警铃
## �豸�������񣨳����š��㲥�����壩
control.fegin.name=JCS-API-CONTROL
## redis超时时间
## redis��ʱʱ��
redis.cache.failure.time=10800
failure.work.flow.processDefinitionKey=malfunction_repair
video.fegin.name=video
......@@ -62,8 +62,61 @@ latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 设备告知流程v1
## �豸��֪����v1
inform.work.flow.processDefinitionKey=equipment_inform_process_v1
## 消防救援保障部ID
fire-rescue=1432549862557130753
\ No newline at end of file
## ������Ԯ���ϲ�ID
fire-rescue=1432549862557130753
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
mqtt.topic.cyl.warning.push=/tzs/cyl_cyl_warning
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## Ԥ��֪ͨģ��id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##��������֪ͨ
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ���ںŲ����û�id��ƽ̨userId��
tzs.wechat.test.userId=3393279
\ No newline at end of file
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