Commit bfb4092a authored by maoying's avatar maoying

合并developer分支代码

parents 9544a5a9 4d844354
......@@ -10,8 +10,9 @@ import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
public enum RuleTypeEnum {
// 防火监督
计划提交("计划提交", "addPlan","auditPage", RuleConstant.WEB, RuleConstant.TASK),
计划提交("计划提交", "addPlan","auditPage", RuleConstant.APP_WEB, RuleConstant.TASK),
计划审核("计划审核", "planAudit", "auditPage", RuleConstant.APP_WEB, RuleConstant.NOTIFY),
计划审核任务("计划审核", "planAudit", "auditPage", RuleConstant.APP_WEB, RuleConstant.TASK),
计划审核完成("计划审核完成", "planAuditAll", "formulatePage", RuleConstant.APP_WEB, RuleConstant.TASK),
消息型计划生成("计划生成", "addPlanTask", null, RuleConstant.APP, RuleConstant.NOTIFY),
任务型计划生成("计划生成", "addPlanTask", null, RuleConstant.APP, RuleConstant.TASK),
......
......@@ -24,7 +24,7 @@ public interface FileFransferService {
@XmlMimeType(value = "application/octet-stream") DataHandler handler,
@WebParam(name = "fileName") String fileName,
@WebParam(name = "path") String path,
@WebParam(name = "code") String code);
@WebParam(name = "code") String code) throws Exception;
/**
* 传输文件
* @param handler
......
......@@ -23,7 +23,7 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<FirefightersZhDto> getFirefighters(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize,
@Param("par") FirefightersDto par);
@Param("par") FirefightersDto par);
Map<String, Long> getFirefightersCount(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param(
"par") FirefightersDto par);
......@@ -32,12 +32,14 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<FirefightersTreeDto> getFirefightersJobTitleCount(String bizOrgCode);
List<Map<String,String>> getFirefightersName( );
List<Map<String, String>> getFirefightersName();
List<FirefightersExcelDto> exportToExcel(Boolean isDelete, String name, String postQualification, String fireTeamId,
String state, String areasExpertise, String jobTitle,String bizOrgCode);
List<FirefightersExcelDto> exportToExcel(Boolean isDelete, String name, String postQualification, String fireTeamId,
String state, String areasExpertise, String jobTitle, String bizOrgCode);
List<FirefightersDto> queryById(@Param("gw")String[] gw, @Param("name")String name);
List<Map<String,String>> selectNormalFirePerson(String jobId);
List<FirefightersDto> queryById(@Param("gw") String[] gw, @Param("name") String name);
List<Map<String, String>> selectNormalFirePerson(String jobId);
List<Firefighters> getPersonByCodes(@Param("list") List<String> list);
}
......@@ -357,4 +357,7 @@ public interface IOrgUsrService {
* @return
*/
String deleteFirefighterPeopleById(Long id);
OrgUsr selectParentOrgUsr(OrgUsr orgUsr);
}
......@@ -263,4 +263,12 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
</select>
<select id="getPersonByCodes" resultType="com.yeejoin.amos.boot.module.common.api.entity.Firefighters">
select * from cb_firefighters where
employee_number in
<foreach item="item" collection="list" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and is_delete = 0
</select>
</mapper>
......@@ -334,8 +334,7 @@
a.companyMaleEmployees,
a.companyFemaleEmployees,
a.managementType,
a. keySiteCompany as isKeyPoint
FROM
a. keySiteCompany as isKeyPoint,
Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) AS distance,
case when cks_d.count is null then 0 else cks_d.count end as keySiteNum
FROM important_companys a left join (
......@@ -347,7 +346,7 @@
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
#{par.distance}
</if>
ORDER BY distance limit #{pageNum},#{pageSize}
ORDER BY distance limit #{pageNum},#{pageSize}
</select>
<select id="listContractDtoCount" resultType="Integer">
......
......@@ -155,4 +155,8 @@ public class EquipmentSpecific extends BaseEntity {
@ApiModelProperty(value = "系统名称")
@TableField(exist = false)
private String systemName;
@ApiModelProperty(value = "设备值说明")
@TableField("value_label")
private String valueLabel;
}
......@@ -145,5 +145,8 @@ public class PointTreeVo {
private String address;
/**
* 装备编码
*/
private String code;
}
......@@ -87,4 +87,8 @@ public class AlertCallePowerTransferRo implements Serializable{
@ApiModelProperty(value = "调派类型队伍")
private String powerTransType;
//bug 5973
@Label(value = "类别")
private Integer category;
}
......@@ -162,8 +162,8 @@ public class AlertCalledRo implements Serializable{
private String gender;
@Label(value = "年龄段")
private String ageGroup;
@Label(value = "类型")
private Integer category;
//
// /**
......
package com.yeejoin.amos.boot.module.jcs.api.dto;
import lombok.Data;
@Data
public class StatusDto {
private Long cardId;
private String carStatus;
}
......@@ -2,21 +2,27 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.StatusDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 调派单位资源 Mapper 接口
*
* @author tb
* @date 2021-06-17
*/
* 调派单位资源 Mapper 接口
*
* @author tb
* @date 2021-06-17
*/
public interface PowerTransferCompanyResourcesMapper extends BaseMapper<PowerTransferCompanyResources> {
AlertCalled getByPowerTransferCompanyResourId(Long id);
PowerTransferCompanyResources getByAlertCalledIdCarId(Long alertCalledId,Long carId);
PowerTransferCompanyResources getByAlertCalledIdCarId(Long alertCalledId, Long carId);
void updateByAlertCalledId(Long alertCalledId);
List<StatusDto> findStatusByIds(@Param("ids") List<Long> ids);
}
......@@ -65,6 +65,11 @@
</select>
<select id="findStatusByIds" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.StatusDto">
select resources_id as cardId, car_status as carStatus from jc_power_transfer_company_resources where status = 'executing' and is_delete = 0
and resources_id in
<foreach collection="ids" item="item" open='(' close=')' separator=','>
#{item}
</foreach>
</select>
</mapper>
......@@ -308,7 +308,8 @@
SELECT DISTINCT
car.resources_id sequenceNbr,
car.resources_name,
'car' type
'car' type,
car.car_status carState
FROM
jc_power_transfer_company_resources car
LEFT JOIN jc_power_transfer_company company ON company.sequence_nbr = car.power_transfer_company_id
......
......@@ -39,7 +39,7 @@ public class FileFransferServiceImpl implements FileFransferService {
@Override
public void useCodetransferFile(DataHandler handler, String fileName, String path, String code) {
public void useCodetransferFile(DataHandler handler, String fileName, String path, String code) throws Exception {
saveFile(handler, fileName, path);
sendEmail(code, path, fileName);
}
......@@ -82,11 +82,15 @@ public class FileFransferServiceImpl implements FileFransferService {
}
}
private void sendEmail(String userCode, String path, String fileName) {
private void sendEmail(String userCode, String path, String fileName) throws Exception {
String template = eMailSenderService.getEmailTemplate();
File file = new File(String.format("%s%s%s%s", baseDir,path.replace(":", ""), File.separator, fileName));
Multipart mp = new MimeMultipart();
<<<<<<< HEAD
//eMailSenderService.send(userCode, userCode, template, mp);
=======
eMailSenderService.send(userCode, userCode, template, mp.toString());
>>>>>>> developer
}
@Override
......
......@@ -5,6 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -333,4 +334,12 @@ public class MaintenanceCompanyController extends BaseController {
return ResponseHelper.buildResponse(maintenanceCompanyServiceImpl.queryCompanyMsg());
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/get/amosOrgIdsByIds")
@ApiOperation(httpMethod = "GET", value = "根据主键查orgIds", notes = "根据主键查orgIds")
public ResponseModel<List<String>> getAmosOrgIdsByIdsgetAmosOrgIdsByIds(@RequestParam(value = "list", required = true) List<String> list) {
return ResponseHelper.buildResponse(maintenanceCompanyServiceImpl.getAmosOrgIdsByIds(list));
}
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
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;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.emq.EmqKeeper;
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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -17,7 +44,15 @@ import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContex
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.ESOrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto;
import com.yeejoin.amos.boot.module.common.api.entity.CompanyInfo;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
......@@ -29,21 +64,9 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.ESOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireCompanyInfoServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
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.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper;
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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
* 部门信息修改
......@@ -91,6 +114,8 @@ public class OrgUsrController extends BaseController {
String deptKey;
@Value("special-deptType")
String deptTypeKey;
private static final String AUTH_SPECIAL_KEY = "fire_build_video_info";
/**
* 新增单位信息
*
......@@ -706,9 +731,10 @@ public class OrgUsrController extends BaseController {
@GetMapping(value = "/{companyId}/person/newList")
public ResponseModel<List<OrgUsr>> getNewPersonListByCompanyId(@PathVariable String companyId) {
ReginParams reginParams = getSelectedOrgInfo();
String roleNameString = reginParams.getRole().getRoleName();
String roleNameString = reginParams.getUserModel().getOrgNames();
String currentCompanyId = getCompanyId(reginParams);
if (companyId.equals(currentCompanyId) && roleNameString.contains("Person_charge_unit_fire_protection_supervision_inspection")) {//单位防火监督检查负责人
// if (companyId.equals(currentCompanyId) && roleNameString.contains("Person_charge_unit_fire_protection_supervision_inspection")) {//单位防火监督检查负责人
if ( roleNameString.contains("Person_charge_unit_fire_protection_supervision_inspection")) {//单位防火监督检查负责人
return ResponseHelper.buildResponse(iOrgUsrService.getPersonListByCompanyId(companyId));
}
return null;
......@@ -760,20 +786,30 @@ 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<DataDictionary> specialDepartment = list.stream().filter(e -> e.getType().equals("SpecialDepartment")).collect(Collectors.toList());
for (DataDictionary dataDictionary : specialDepartment) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getParentId,dataDictionary.getCode());
wrapper.eq(BaseEntity::getIsDelete,false);
List<OrgUsr> orgUsrs = orgUsrMapper.selectList(wrapper);
orgUsrs.forEach(e->objects.add(e.getSequenceNbr().toString()));
}
list.stream().forEach(e->objects.add(e.getCode()));
//判断当前登录人权限是否处于特殊类型
if (objects.contains(authKey)){
if (objects.contains(authKey) || AUTH_SPECIAL_KEY.equals(authKey)){
//判断当前登录人部门是否处于特殊部门
if (objects.contains(personIdentity.getCompanyId())) {
if (objects.contains(personIdentity.getCompanyId()) || AUTH_SPECIAL_KEY.equals(authKey)) {
//查询当前登录人所属单位/部门
OrgUsr orgUsr = orgUsrMapper.selectById(personIdentity.getCompanyId());
//判断登陆人是否已经是顶级节点单位
if (orgUsr.getParentId() != null ){
orgUsr =orgUsrService.selectParentOrgUsr(orgUsr);
bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode() : personIdentity.getBizOrgCode();
}
//查询当前登录人父级单位
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getSequenceNbr,orgUsr.getParentId());
wrapper.eq(BaseEntity::getIsDelete,false);
OrgUsr result = orgUsrMapper.selectOne(wrapper);
bizOrgCode = result.getBizOrgCode() != null? result.getBizOrgCode() : personIdentity.getBizOrgCode();
}
}
// 权限处理
......@@ -783,6 +819,8 @@ public class OrgUsrController extends BaseController {
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{authKey}/treeWithAuth", method = RequestMethod.GET)
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
......@@ -244,4 +246,12 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
orgUsrService.saveFirefighters(firefighters);
}
public Map<String, String> getPersonByCodes(List<String> list) {
List<Firefighters> personByCodes = firefightersMapper.getPersonByCodes(list);
Map<String, String> personGenderMap = new HashMap<>();
for (Firefighters personByCode : personByCodes) {
personGenderMap.put(personByCode.getEmployeeNumber(), personByCode.getGender());
}
return personGenderMap;
}
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
......@@ -820,11 +821,11 @@ public class MaintenanceCompanyServiceImpl
// 查询公司下人列表
List<MaintenanceCompany> personList = list(new LambdaQueryWrapper<MaintenanceCompany>()
.eq(MaintenanceCompany::getIsDelete, false).eq(MaintenanceCompany::getType, PERSON)
.eq(MaintenanceCompany::getParentId,company.getParentId()));
.eq(MaintenanceCompany::getParentId,company.getSequenceNbr()));
List<Long> instanceIdList = Lists.transform(personList, MaintenanceCompany::getInstanceId);
// 查询手机号
List<DynamicFormInstance> dynamicFormInstanceList = dynamicFormInstanceService
.list(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getFieldCode, "tel")
.list(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getFieldCode, "tel")
.in(DynamicFormInstance::getInstanceId, instanceIdList));
Map<Long, List<DynamicFormInstance>> dyMap = dynamicFormInstanceList.stream()
.collect(Collectors.groupingBy(DynamicFormInstance::getInstanceId));
......@@ -838,4 +839,13 @@ public class MaintenanceCompanyServiceImpl
});
return resultList;
}
public List<String> getAmosOrgIdsByIds(List<String> list) {
QueryWrapper<MaintenanceCompany> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().select(MaintenanceCompany::getAmosId)
.in(MaintenanceCompany::getSequenceNbr, list)
.groupBy(MaintenanceCompany::getAmosId);
List<String> collect = maintenanceCompanyMapper.selectList(queryWrapper).stream().map(MaintenanceCompany::getAmosId).collect(Collectors.toList());
return collect;
}
}
\ No newline at end of file
......@@ -973,6 +973,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
// this.updateBatchById(list);
// /*单位编辑后 code值也应做出修改 2021-09-09 陈召 结束 */8888
orgUsrMapper.updatelistByParentId(orgUsr.getBizOrgCode(), oriOrgUsr.getBizOrgCode());
}else {
orgUsr.setBizOrgCode(oriOrgUsr.getBizOrgCode());
}
updateById(orgUsr);
// 更新公司消防信息
......@@ -1180,6 +1182,18 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return orgUsrFormVo;
}
public OrgUsr selectParentOrgUsr(OrgUsr orgUsr){
if (orgUsr.getBizOrgType().equals("COMPANY")){
return orgUsr ;
}
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OrgUsr::getSequenceNbr,orgUsr.getParentId());
wrapper.eq(BaseEntity::getIsDelete,false);
orgUsr = orgUsrMapper.selectOne(wrapper);
return selectParentOrgUsr(orgUsr);
}
@Override
public IPage<OrgUsr> bizOrgTypeListPage(String pageNum, String pageSize, String bizOrgType) throws Exception {
......
package com.yeejoin.equipmanage.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Slf4j
@Configuration
@EnableAsync
public class EquipExecutorConfig {
@Bean(name = "equipAsyncExecutor")
public Executor asyncServiceExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//配置核心线程数
executor.setCorePoolSize(10);
//配置最大线程数
executor.setMaxPoolSize(100);
//配置队列大小
executor.setQueueCapacity(1000);
//配置线程池中的线程的名称前缀
executor.setThreadNamePrefix("namePrefix");
//线程池维护线程所允许的空闲时间
executor.setKeepAliveSeconds(30);
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
// CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行--拒绝策略
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//执行初始化
executor.initialize();
//等待所有任务结束后再关闭线程池
executor.setWaitForTasksToCompleteOnShutdown(true);
return executor;
}
}
......@@ -325,6 +325,13 @@ public class BuildingController extends AbstractBaseController {
return buildService.getCompanyBuildingTree(null);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("单位树")
@GetMapping(value = "/selectCompanyTree")
public List<BuildingTreeVo> selectCompanyTree(@RequestParam(value = "authKey", required = false) String authKey ) {
return buildService.selectCompanyTree(authKey);
}
@ApiOperation(value = "查询指定单位的建筑树")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{bizOrgCode}/tree")
......
......@@ -11,10 +11,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -51,7 +48,7 @@ public class BuildingVideoController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑视屏监控分页列表")
@GetMapping(value = "/page")
public Page<BuildingVideoVO> buildingList(Page page, BuildingVideoListVO dto) {
public Page<BuildingVideoVO> buildingList( Page page, BuildingVideoListVO dto) {
return buildService.buildingVideoList(page, dto);
}
......
......@@ -236,7 +236,7 @@ public class CarController extends AbstractBaseController {
@Async
@Async("equipAsyncExecutor")
public void refreshAllCount() {
// 清空单位装备分类树缓存
redisUtils.getAndDeletePatternKeys(carTypeAndCount + "*");
......
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentDetailDownloadVO;
import com.yeejoin.equipmanage.common.enums.ExcelEnums;
......@@ -67,6 +68,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@Autowired
IEquipmentDetailService iEquipmentDetailService;
@Autowired
EquipmentDetailMapper equipmentDetailMapper;
@Autowired
......@@ -125,7 +127,7 @@ public class EquipmentDetailController extends AbstractBaseController {
return detail;
}
@Async
@Async("equipAsyncExecutor")
public void refreshCount(String ...bizOrgCodes) {
try {
equipmentSpecificSerivce.refreshStaData();
......@@ -580,17 +582,64 @@ public class EquipmentDetailController extends AbstractBaseController {
// }
// List<EquipmentDetailDownloadTemplateVO> equipmentDetailDownloadS = ExcelUtils.importExcel(file, 1, 1, EquipmentDetailDownloadTemplateVO.class);
Object date="";
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
date= excelService.commonUpload(file, excelDto, getSelectedOrgInfo(), getUserInfo());
EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy.refreshAllCount();
return ResponseHelper.buildResponse(date);
String key="";
try {
UUID uuid = UUID.randomUUID();
key= uuid.toString();
ExcelEnums excelEnums = ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
// date= excelService.commonUpload(file, excelDto, getSelectedOrgInfo(), getUserInfo());
EquipmentDetailController controllerProxy1 = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy1.commonUpload(file, excelDto,key, getSelectedOrgInfo(), getUserInfo());
EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy.refreshAllCount();
} catch (Exception e) {
e.printStackTrace();
throw new BadRequest(e.getMessage());
}
return ResponseHelper.buildResponse(key);
}
@Async
@Async("equipAsyncExecutor")
public void commonUpload(MultipartFile file, ExcelDto excelDto, String key, ReginParams reginParams, AgencyUserModel user) {
Object date="";
Map<String,Object> map=new HashMap();
try {
synchronized(this.getClass()){
date= excelService.commonUpload(file, excelDto, reginParams,user);
map.put("flag","0");
map.put("date",date);
redisUtils.set(key, map);
}
} catch (Exception e) {
map.put("flag","1");
map.put("date",e.getMessage());
redisUtils.set(key, map);
e.printStackTrace();
}
}
@RequestMapping(value = "/getUpload/{key}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询上传进度", notes = "根据id查询上传进度")
public ResponseModel<Object> getUpload( @PathVariable String key) {
if(redisUtils.hasKey(key)){
return ResponseHelper.buildResponse(redisUtils.get(key));
} else{
return ResponseHelper.buildResponse(null);
}
}
@Async("equipAsyncExecutor")
public void refreshAllCount() {
// 清空单位装备分类树缓存
redisUtils.getAndDeletePatternKeys(carTypeAndCount + "*");
......
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.service.IEquipmentInfoOnPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: EquipmentInfoOnPlanController
* <pre>
* @description: TODO
* </pre>
* @date 2022/5/12 10:49
*/
@RestController
@Api(tags = "预案界面装备信息展示")
@RequestMapping(value = "/fire/plan")
public class EquipmentInfoOnPlanController {
@Autowired
private IEquipmentInfoOnPlanService equipmentInfoOnPlanService;
@ApiOperation(httpMethod = "GET", value = "消防炮信息", notes = "消防炮信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value ="/monitor", method = RequestMethod.GET)
public ResponseModel getFireMonitorInfo(@RequestParam(required=false) Long fireEquipmentId) {
List<Map<String, Object>> list = equipmentInfoOnPlanService.getFireMonitorInfo(fireEquipmentId);
return ResponseHelper.buildResponse(list);
}
@ApiOperation(httpMethod = "GET", value = "消防泵信息", notes = "消防泵信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value ="/pump")
public ResponseModel getFirePumpInfo() {
List<Map<String, Object>> list = equipmentInfoOnPlanService.getFirePumpInfo();
return CommonResponseUtil.success(list);
}
@ApiOperation(httpMethod = "GET", value = "其他设备信息", notes = "其他设备信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value ="/journal")
public ResponseModel getOtherEquipInfo() {
List<Map<String, Object>> list = equipmentInfoOnPlanService.getOtherEquipInfo();
return CommonResponseUtil.success(list);
}
@ApiOperation(httpMethod = "GET", value = "消防力量和车辆启停信息", notes = "消防力量和车辆启停信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value ="/power/info")
public ResponseModel getFirePowerAndCarInfo() {
Map<String, Object> list = equipmentInfoOnPlanService.getFirePowerAndCarInfo();
return CommonResponseUtil.success(list);
}
}
package com.yeejoin.equipmanage.dto;
import lombok.Data;
@Data
public class CountDto {
private String bizOrgCode;
private Integer num;
}
......@@ -29,7 +29,7 @@ public class EquipmentTreeListListener implements ApplicationListener<EquipmentT
@Autowired
IEquipmentCategoryService iEquipmentCategoryService;
@Async
@Async("equipAsyncExecutor")
@Override
public void onApplicationEvent(EquipmentTreeListEvent event) {
// 更新redis全量装备树
......
......@@ -72,7 +72,13 @@ public interface CarMapper extends BaseMapper<Car> {
List<CarFusionDto> selectCarAndCarProperty();
List<Map<String, Object>> queryCompanyCarStaData();
List<Map<String, Object>> queryCompanyIotStaData();
List<Map<String, Object>> getCarState();
List<Map<String, Object>> getFirePowerInfo();
}
......@@ -22,7 +22,7 @@ public interface EquipmentMapper extends BaseMapper<Equipment> {
int getEquipmentCount(@Param("whereConditionStr") String whereConditionStr);
EquipmentBaseAppVO getEquipmentAppMessage(String qrCode);
EquipmentBaseAppVO getEquipmentAppMessage(@Param("qrCode") String qrCode);
List<ImportantEquipmentVO> getImportantEquipmentList(@Param("ids") List<Long> ids);
......
......@@ -8,7 +8,9 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author keyong
......@@ -32,4 +34,8 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
List<FireEquipmentFireAlarm> getFireEquipAlarmLogDetailsById(@Param("list") List<Long> ids);
Map<String, Object> getPlanRecord();
List<Map<String, Object>> getOtherEquipInfo(@Param("date") String date, @Param("equipmentId") Long equipmentId);
}
......@@ -150,7 +150,7 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
List<FireEquipmentFireAlarm> getFireEquipAlarmDetailsByAlarmId(@Param("list") List<Long> specificAlarmIds, @Param("indexIds") List<Long> equipIndexIds);
Page<Map<String, Object>> pageAlarmsInfo(Page page,@Param("param") CommonPageInfoParam param);
Page<Map<String, Object>> pageAlarmsInfo(Page page, @Param("param") CommonPageInfoParam param);
List<Map<String, Object>> getProObject(@Param("id") Long id);
......@@ -164,6 +164,7 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
Page<EquipSpecificAlarmDTO> getAlarmPage(Page page, @Param("dto") AlarmDTO dto);
Page<EquipSpecificAlarmDTO> getEqPage(Page page, @Param("dto") AlarmDTO dto);
List<EquipmentSpecificAlarmLog> getConfirmUser();
EquipSpecificAlarmDTO getbyqrCode(@Param("code") String code);
......@@ -174,9 +175,8 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
//统计已处理和未处理
Integer getcountAlarmHandle(@Param("tyep") String tyep);
/**
*
* <pre>
* 根据装备id和查询指定状态告警数据
* </pre>
......@@ -187,4 +187,12 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
*/
List<EquipmentSpecificAlarm> getEquipListBySpecific(@Param("status") Boolean status, @Param("equipmentSpecificId") Long equipmentSpecificId);
/**
* 根据Code 和 indexKey 查设备是否报警
* @param iotCode
* @param indexKey
* @param indexValue
* @return
*/
int selectCountByIotCode(@Param("iotCode") String iotCode, @Param("indexKey") String indexKey, @Param("indexValue") String indexValue);
}
......@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*;
import liquibase.pro.packaged.M;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -206,6 +207,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId);
List<Map<String,String>> getStationInfo();
List<Map<String, Object>> getFireMonitorInfo(@Param("fireEquipmentId") Long fireEquipmentId, @Param("list") String[] strings);
List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings);
}
......@@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.Video;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.dto.CountDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author ZeHua Li
......@@ -90,4 +92,6 @@ public interface VideoMapper extends BaseMapper<Video> {
String getParentSourceIds(String childrenId);
List<CountDto> getVideoCountMapList();
}
......@@ -301,6 +301,14 @@ public interface IBuilldService extends IService<Building> {
*/
List<BuildingTreeVo> getCompanyBuildingTree(String authKey);
/**
* 获取单位树
* @param authKey
* @return
*/
List<BuildingTreeVo> selectCompanyTree(String authKey);
List<BuildingTreeVo> getBuildingVideoTreeNew();
List<Map<String, Object>> getBuildingDetaiList();
......
package com.yeejoin.equipmanage.service;
import java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: EquipmentInfoOnPlanService
* <pre>
* @description: TODO
* </pre>
* @date 2022/5/12 11:43
*/
public interface IEquipmentInfoOnPlanService {
/**
* 消防炮信息
* @return
*/
List<Map<String, Object>> getFireMonitorInfo(Long fireEquipmentId);
/**
* 消防泵信息
* @return
*/
List<Map<String, Object>> getFirePumpInfo();
/**
* 其他设备信息
* @return
*/
List<Map<String, Object>> getOtherEquipInfo();
/**
* 消防力量和车辆启停信息
* @return
*/
Map<String, Object> getFirePowerAndCarInfo();
}
......@@ -9,6 +9,7 @@ import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto;
import com.yeejoin.equipmanage.common.entity.vo.*;
import java.util.List;
import java.util.Map;
/**
* @author ZeHua Li
......@@ -79,4 +80,11 @@ public interface IVideoService extends IService<Video> {
String getVideoUrl(String videoId, String presetIndex, String defaultUrl, String code);
List<OrgMenuDto> companyTreeByUserAndType(String type);
/**
* 获取机构下的监控数量
* key:机构编码 value:数量
* @return
*/
Map<String, Long> getVideoCountMap();
}
......@@ -37,6 +37,7 @@ import com.yeejoin.equipmanage.operation.SyncRiskOperator;
import com.yeejoin.equipmanage.operation.factory.PageOperatorFactory;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
import liquibase.pro.packaged.S;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -102,6 +103,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Autowired
ISourceSceneService sourceSceneService;
@Autowired
IVideoService iVideoService;
@Value("${morphic.projectSeq}")
private Long projectSeq;
......@@ -1215,6 +1219,41 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
return companyBuildingList.stream().filter(a -> companyBuildingList.stream().noneMatch(c -> c.getId().toString().equals(a.getParentId()))).peek(b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyBuildingList))).collect(Collectors.toList());
}
@Override
public List<BuildingTreeVo> selectCompanyTree(String authKey) {
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
}
Map<String, Long> countMap = iVideoService.getVideoCountMap();
// 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY");
if (orgUsrLists.isEmpty()) {
return new ArrayList<>();
}
// 2.数据结构转换
List<BuildingTreeVo> companyList = orgUsrLists.stream().map(orgUsrDto -> {
BuildingTreeVo vo = new BuildingTreeVo();
vo.setGroupType("allBuilding");
vo.setGroupCode("allBuilding");
vo.setInstanceName(orgUsrDto.getBizOrgName());
vo.setBizOrgCode(orgUsrDto.getBizOrgCode());
vo.setInstanceId(orgUsrDto.getSequenceNbr());
vo.setParentId(orgUsrDto.getParentId());
vo.setName(orgUsrDto.getBizOrgName());
vo.setId(orgUsrDto.getSequenceNbr());
vo.setBizOrgName(orgUsrDto.getBizOrgName());
vo.setTotal(countMap.get(orgUsrDto.getBizOrgCode()) == null ? 0L : countMap.get(orgUsrDto.getBizOrgCode()));
return vo;
}).collect(Collectors.toList());
return companyList.stream().filter(a -> companyList.stream().noneMatch(c -> c.getId().toString().equals(a.getParentId())))
.peek(b -> {
b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyList));
b.setTotal(b.getChildren().stream().filter(c -> c.getTotal() != null).mapToLong(BuildingTreeVo::getTotal).sum());
}).collect(Collectors.toList());
}
private List<BuildingTreeVo> buildBuildingAndCompanyListVos(String authKey) {
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
......@@ -1262,8 +1301,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
public List<BuildingTreeVo> getBuildingVideoTreeNew() {
//1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(buildVideoAuthKey);
List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
Map<Long, Long> countMap = countList.stream().collect(Collectors.toMap(p -> p.get("buildId"), p -> p.get("total")));
companyBuildingList.forEach(c -> {
// 建筑类型数据,填充本级及子级包含的摄像头数量
if (!ALL_BUILDING.equals(c.getGroupType())) {
......
......@@ -1116,7 +1116,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
@Override
@Async
@Async("equipAsyncExecutor")
public FireVehicle getFireVehicleDetailById(Long id) {
return carMapper.getFireVehicleDetailById(id);
}
......@@ -1187,7 +1187,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return "";
}
@Async
@Async("equipAsyncExecutor")
void dataSyncSaveOrUpdate(Car car) {
CarIndexVo carIndexVo = new CarIndexVo();
carIndexVo.setId(car.getId());
......
......@@ -6,16 +6,22 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.enums.BillContentEnum;
import com.yeejoin.equipmanage.common.enums.FileTypeEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.dto.ExcelDto;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -68,7 +74,10 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
private IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired
JCSRemoteService jcsRemoteService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private IExcelService excelService;
@Value("${fileserver_domain}")
private String fileServer;
......@@ -299,4 +308,6 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
public List<OrgMenuDto> companyDeptTree() {
return jcsRemoteService.getCompanyDeptTreeWithAuth(authKey, null);
}
}
package com.yeejoin.equipmanage.service.impl;
import com.google.common.collect.Maps;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.CarMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentInfoOnPlanService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author keyong
* @title: EquipmentInfoOnPlanServiceImpl
* <pre>
* @description: TODO
* </pre>
* @date 2022/5/12 11:43
*/
@Service("EquipmentInfoOnPlanService")
public class EquipmentInfoOnPlanServiceImpl implements IEquipmentInfoOnPlanService {
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired
private CarMapper carMapper;
@Value("${equipment.plan.monitor}")
String monitorCodes;
@Value("${equipment.plan.pump}")
String pumpCodes;
@Override
public List<Map<String, Object>> getFireMonitorInfo(Long fireEquipmentId) {
String[] strings = monitorCodes.split(",");
List<Map<String, Object>> list = equipmentSpecificMapper.getFireMonitorInfo(fireEquipmentId, strings);
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
@Override
public List<Map<String, Object>> getFirePumpInfo() {
String[] strings = pumpCodes.split(",");
List<Map<String, Object>> list = equipmentSpecificMapper.getFirePumpInfo(strings);
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
@Override
public List<Map<String, Object>> getOtherEquipInfo() {
Map<String, Object> map = equipmentSpecificAlarmLogMapper.getPlanRecord();
Date startTime = null;
Long equipmentId = null;
if (!ValidationUtil.isEmpty(map)) {
try {
startTime = DateUtils.dateParse(String.valueOf(map.get("startTime")), DateUtils.DATE_TIME_T_PATTERN);
equipmentId = Long.valueOf(String.valueOf(map.get("equipmentId")));
} catch (Exception e) {
e.printStackTrace();
}
}
String dateParam = startTime == null ? null : new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
List<Map<String, Object>> list = equipmentSpecificAlarmLogMapper.getOtherEquipInfo(dateParam, equipmentId);
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
@Override
public Map<String, Object> getFirePowerAndCarInfo() {
List<Map<String, Object>> firePowerMap = carMapper.getFirePowerInfo();
List<Map<String, Object>> carStateMap = carMapper.getCarState();
Map<String, Object> map = new HashMap<>();
map.put("firePower", Optional.ofNullable(firePowerMap).orElse(Lists.newArrayList()));
map.put("carState", Optional.ofNullable(carStateMap).orElse(Lists.newArrayList()));
return map;
}
}
......@@ -1157,7 +1157,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
@Async
@Async("equipAsyncExecutor")
public void equipSpecificDataSync(Long equipmentId) {
// TODO 放大范围,根据equipment_id同步
List<FireEquipment> specificDetails = getEquipSpecificDetailsByEquipmentId(equipmentId);
......@@ -1548,7 +1548,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentSpecificIndexSerivce.saveBatch(equipmentSpecificIndices);
}
@Async
@Async("equipAsyncExecutor")
void initEquipmentSystemSourceStatistics(List<EquipmentSpecific> equipmentSpecifics) {
List<EquipmentSystemSourceStatistics> list = new ArrayList<>();
equipmentSpecifics.parallelStream().forEach(x -> {
......@@ -1600,7 +1600,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
*
* @param systemTypeCode
*/
@Async
@Async("equipAsyncExecutor")
@Override
public void integrationPageSysDataRefresh(String systemTypeCode) {
if (ObjectUtils.isEmpty(systemTypeCode)) {
......@@ -1642,6 +1642,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
es.setRealtimeIotIndexValue(index.getValue());
es.setRealtimeIotIndexId(index.getEquipmentIndexId());
es.setRealtimeIotIndexUpdateDate(index.getUpdateDate());
es.setValueLabel(index.getValueLabel());
equipmentSpecificMapper.updateById(es);
}
}
......
......@@ -484,43 +484,74 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
//TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id);
if (!CollectionUtils.isEmpty(pointData)) {
// 优化不查指标,
pointData.forEach(p -> {
// 查询所有wl_source_scene,判断是否绑定
List<SourceScene> sourceSceneList = sourceSceneMapper.selectList(null);
Map<Long, String> sourceSceneMap = null;
String equipSpecificIds = null;
if (!CollectionUtils.isEmpty(sourceSceneList)) {
sourceSceneMap = sourceSceneList.stream().collect(Collectors.toMap(SourceScene::getSourceId, SourceScene::getPointInScene));
List<String> equipSpecificIdList = sourceSceneList.stream().map(SourceScene::getPointInScene).collect(Collectors.toList());
equipSpecificIds = String.join(",", equipSpecificIdList);
}
// 优化不查指标
for (PointTreeVo p : pointData) {
Long buildOrSysId = p.getParentId();
Long equipSpecificId = p.getSequenceNbr();
Map map = new HashMap(7);
map.put("imgPath", p.getImgPath());
map.put("equipCode", p.getEquipCode());
map.put("equipSyetemId", p.getEquipSyetemId());
map.put("equipTypeId", p.getEquipId());
map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("speindexApi", speindexUrl + equipSpecificId);
map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
p.setDataConfig(map);
});
}
allRiskSource.addAll(pointData);
// 树组装优化
Map<Long, PointTreeVo> map = new HashMap<>(allRiskSource.size());
allRiskSource.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends PointTreeVo>> entries = map.entrySet();
List<PointTreeVo> treeList = new ArrayList<>();
entries.forEach(entry -> {
PointTreeVo value = entry.getValue();
if (value != null) {
PointTreeVo treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<PointTreeVo> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
if (StringUtils.isEmpty(id)) {
// 建筑
if (equipSpecificIds.contains(String.valueOf(equipSpecificId))) {
p.setBinding(true);
} else {
p.setBinding(false);
}
children.add(value);
} else {
treeList.add(value);
if (sourceSceneMap != null) {
String pointInScene = sourceSceneMap.get(buildOrSysId);
if (!StringUtils.isEmpty(pointInScene)) {
// 系统
if (pointInScene.contains(String.valueOf(equipSpecificId))) {
p.setBinding(true);
} else {
p.setBinding(false);
}
}
}
}
}
});
return treeList;
allRiskSource.addAll(pointData);
// 树组装优化
Map<Long, PointTreeVo> map = new HashMap<>(allRiskSource.size());
allRiskSource.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends PointTreeVo>> entries = map.entrySet();
List<PointTreeVo> treeList = new ArrayList<>();
entries.forEach(entry -> {
PointTreeVo value = entry.getValue();
if (value != null) {
PointTreeVo treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<PointTreeVo> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
treeList.add(value);
}
}
});
return treeList;
}
return Collections.emptyList();
}
/**
......
......@@ -288,7 +288,7 @@ public class MainIotMonitorServiceImpl implements IMainIotMonitorSerivce {
}
}
@Async
@Async("equipAsyncExecutor")
void updateEquipmentSystemSourceStatistics(EquipmentSpecific equipmentSpecific, int status){
QueryWrapper<EquipmentSystemSourceStatistics> wrapper = new QueryWrapper<>();
wrapper.eq("equipment_specific_id",equipmentSpecific.getId());
......
......@@ -133,7 +133,7 @@ public class MaintenanceResourceDataServiceImpl extends ServiceImpl<MaintenanceR
return 0;
}
@Async
@Async("equipAsyncExecutor")
void deleteRelationMainResData(List<Long> ids) {
try {
maintenanceFeign.pointDelete(Joiner.on(",").join(ids));
......
......@@ -264,6 +264,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (ObjectUtils.isEmpty(iotDatalist)) {
return;
}
for (IotDataVO item : iotDatalist) {
int count = equipmentSpecificAlarmMapper.selectCountByIotCode(iotCode, item.getKey(), String.valueOf(item.getValue()));
if (count > 0 && "true".equals(item.getValue())) {
return;
}
}
log.info(String.format("收到mqtt消息:%s", message));
realTimeDateProcessing(topicEntity, iotDatalist);
}
......
......@@ -266,7 +266,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
return stockBill;
}
@Async
@Async("equipAsyncExecutor")
void initEquipmentSystemSourceStatistics(List<EquipmentSpecific> equipmentSpecifics) {
List<EquipmentSystemSourceStatistics> list = new ArrayList<>();
equipmentSpecifics.parallelStream().forEach(x -> {
......@@ -294,9 +294,9 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
StringBuffer errBufferName= new StringBuffer();
StringBuffer erryy= new StringBuffer();
int errNum=0; //失败条数
int okNum=0; //成功条数
errBufferName.append("导入失败装备:");
// StringBuffer errNum="0"; //失败条数
// StringBuffer okNum="0"; //成功条数
// errBufferName.append("导入失败装备:");
SimpleDateFormat stf = new SimpleDateFormat("yyyy-MM-dd");
List<EquipmentSpecific> list = new ArrayList<>();
try {
......@@ -478,8 +478,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
for (int i = 0; i < equipmentDetailDownloadVOS.size(); i++) {
try {
seveRK( equipmentDetailDownloadVOS.get(i), reginParams, agencyUserModel, fireFightSysIdsBuffer,list, errBufferName ,erryy , errNum,
okNum);
seveRK( equipmentDetailDownloadVOS.get(i), reginParams, agencyUserModel,
fireFightSysIdsBuffer,list, errBufferName ,erryy );
} catch (Exception e) {
e.printStackTrace();
}
......@@ -503,11 +503,13 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
} catch (Exception e) {
//处理异常 返回 成功失败条数
e.printStackTrace();
String date="上传成功:"+okNum+"条---上传失败:"+errNum+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
String[] split = errBufferName.toString().split(",");
String date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
log.error(date);
return date;
}
String date="上传成功:"+okNum+"条---上传失败:"+errNum+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
String[] split = errBufferName.toString().split(",");
String date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
log.error(date);
return date;
}
......@@ -519,9 +521,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
StringBuffer fireFightSysIdsBuffer,
List<EquipmentSpecific> list,
StringBuffer errBufferName,
StringBuffer erryy,
int errNum,
int okNum
StringBuffer erryy
){
SimpleDateFormat stf = new SimpleDateFormat("yyyy-MM-dd");
......@@ -533,13 +534,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
equipmentQueryWrapper.lambda().eq(Equipment::getCode, equipmentDetailDownloadVOS.getCode());
Equipment equipment = equipmentMapper.selectOne(equipmentQueryWrapper);
if (equipment == null) {
erryy.append(String.format("装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!",equipmentDetailDownloadVOS.getCode()) + ",");
throw new RuntimeException(String.format("装备(器材)编码[%S]填写错误,请输入正确的装备(器材)编码!",equipmentDetailDownloadVOS.getCode()));
}
String sysCode = equipmentDetailDownloadVOS.getSystemCode();
if (StringUtils.isNotEmpty(sysCode) && StringUtils.isNotEmpty(sysCode.trim())) {
Integer code = equipmentSpecificMapper.selectCount(new QueryWrapper<EquipmentSpecific>().eq("code", sysCode.trim()));
if (code != 0) {
erryy.append(String.format("设备编码[%S]填写重复,请重新输入!",sysCode)+ ",");
throw new RuntimeException(String.format("设备编码[%S]填写重复,请重新输入!",sysCode));
}
}
......@@ -547,10 +549,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
if (StringUtils.isNotEmpty(iot) && StringUtils.isNotEmpty(iot.trim())) {
Integer iot_code = equipmentSpecificMapper.selectCount(new QueryWrapper<EquipmentSpecific>().eq("iot_code", iot.trim()));
if (iot_code != 0) {
erryy.append(String.format("物联编码[%S]填写重复,请重新输入!",iot)+ ",");
throw new RuntimeException(String.format("物联编码[%S]填写重复,请重新输入!",iot));
}
if(iot.startsWith("20210003")||iot.startsWith("20210004")||iot.startsWith("20210005")){
erryy.append(String.format("物联编码[%S]航班已占用,请重新输入!",iot)+ ",");
throw new BadRequest("物联编码航班已占用");
}
}
......@@ -640,6 +643,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
warehouseStructureQueryWrapper.lambda().eq(WarehouseStructure::getCode, equipmentDetailDownloadVOS.getWarehouseStructCode());
WarehouseStructure warehouseStructure = warehouseStructureService.getOne(warehouseStructureQueryWrapper);
if (warehouseStructure == null) {
erryy.append(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())+ ",");
throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode()));
} else {
equipmentSpecific.setPosition(warehouseStructure.getFullName());
......@@ -706,10 +710,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
list.add(equipmentSpecific);
this.equipmentSpecificIndexSave(equipmentDetail, equipmentSpecific);
platformTransactionManager.commit(transactionStatus);
okNum=okNum+1;
} catch (Exception e) {
platformTransactionManager.rollback(transactionStatus);
errNum=errNum+1;
errBufferName.append(equipmentDetailDownloadVOS.getCode() + ",");
e.printStackTrace();
......
......@@ -59,7 +59,7 @@ import com.yeejoin.equipmanage.utils.SyncDataUtil;
* @Date 2021-04-01 14:28
*/
@Service("syncDataService")
@Async
@Async("equipAsyncExecutor")
public class SyncDataServiceImpl implements ISyncDataService {
private final Logger logger = LoggerFactory.getLogger(SyncDataServiceImpl.class);
......@@ -511,7 +511,7 @@ public class SyncDataServiceImpl implements ISyncDataService {
}
}
@Async
@Async("equipAsyncExecutor")
@Override
public void saveOrUpdateEquipIotCodeRedisData(List<EquipmentSpecificVo> data) {
// TODO Auto-generated method stub
......
......@@ -15,6 +15,7 @@ import com.yeejoin.equipmanage.common.enums.IndustryEnum;
import com.yeejoin.equipmanage.common.enums.VideoTypeEnum;
import com.yeejoin.equipmanage.common.utils.HttpContentTypeUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.dto.CountDto;
import com.yeejoin.equipmanage.fegin.VideoFeignClient;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.service.*;
......@@ -621,4 +622,14 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
return "";
}
@Override
public Map<String, Long> getVideoCountMap() {
List<CountDto> videoCountMapList = videoMapper.getVideoCountMapList();
Map<String, Long> videoMap = new HashMap<>();
videoCountMapList.forEach(item -> {
videoMap.put(item.getBizOrgCode(), item.getNum().longValue());
});
return videoMap;
}
}
......@@ -34,7 +34,7 @@ public class RelationRedisUtil {
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Async
@Async("equipAsyncExecutor")
public Boolean delSysRedisKey(String systemId) {
if (StringUtils.isNotBlank(systemId)) {
QueryWrapper<FireFightingSystemEntity> queryWrapper = new QueryWrapper<>();
......
package com.yeejoin.amos.boot.module.jcs.biz.audioToText.entity;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "speech-config")
public class SpeechConfig implements InitializingBean {
public String accessKeyId;
public String accessKeySecret;
public String appKey;
@Override
public void afterPropertiesSet() throws Exception {
com.yeejoin.amos.speech.SpeechConfig.AccessKeyId = accessKeyId;
com.yeejoin.amos.speech.SpeechConfig.AccessKeySecret = accessKeySecret;
com.yeejoin.amos.speech.SpeechConfig.AppKey = appKey;
}
}
......@@ -6,25 +6,18 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import com.yeejoin.amos.boot.module.jcs.api.service.IUserCarService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
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.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;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -38,13 +31,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.PeopleBasicInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.PeopleInfoDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
......@@ -53,6 +55,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.FirefightersEducation;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersThought;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersContactsServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersContractServiceImpl;
......@@ -60,6 +63,9 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersEducatio
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersPostServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersThoughtServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import com.yeejoin.amos.boot.module.jcs.api.service.IUserCarService;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FirefightersJacketServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......@@ -488,4 +494,12 @@ public class FirefightersController extends BaseController {
throw new RuntimeException("系统异常");
}
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/get/personByCodes")
@ApiOperation(httpMethod = "GET", value = "根据code查性别", notes = "根据code查性别")
public ResponseModel<Map<String, String>> getPersonByCodes(@RequestParam(value = "list", required = true) List<String> list) {
return ResponseHelper.buildResponse(iFirefightersService.getPersonByCodes(list));
}
}
......@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.config.ClazzUtils;
import com.yeejoin.amos.feign.rule.Rule;
import com.yeejoin.amos.feign.rule.client.RuleClient;
......@@ -265,6 +266,9 @@ public class RuleAlertCalledService {
if (alertCalledFormDto == null) {
return false;
}
//任务型计划 // bug 5973
alertCallePowerTransferRo.setCategory(RuleTypeEnum.任务型计划生成.getCategory());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
alertCallePowerTransferRo
.setCallTimeStr(DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
......
......@@ -87,7 +87,8 @@ public class LatentDangerController extends BaseController {
@ApiOperation(value = "创建巡检隐患", notes = "创建巡检隐患")
@PostMapping(value = "/patrol/save")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel<List<LatentDanger>> savePatrol(@ApiParam(value = "隐患对象", required = true) @RequestBody List<LatentDangerDto> latentDangerDtoList) throws Exception {
public ResponseModel<List<LatentDanger>> savePatrol(@ApiParam(value = "隐患对象", required = true) @RequestBody List<LatentDangerDto> latentDangerDtoList,
@RequestParam String flag ) throws Exception {
AgencyUserModel user = getUserInfo();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
......@@ -96,7 +97,7 @@ public class LatentDangerController extends BaseController {
String departmentName = getDepartmentName(reginParams);
RoleBo role = reginParams.getRole();
return ResponseHelper.buildResponse(iLatentDangerService.savePatrol(latentDangerDtoList, user.getUserId(),
user.getRealName(), deptId, departmentName, companyId, loginOrgCode, role));
user.getRealName(), deptId, departmentName, companyId, loginOrgCode, role,flag));
}
@ApiOperation(value = "隐患列表", notes = "隐患列表")
......@@ -406,7 +407,12 @@ public class LatentDangerController extends BaseController {
@GetMapping(value = "/web/updateStatusByUserIdAndPlandIdLike/{userId}/{plandId}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel updateStatusByUserIdAndPlandIdLike(@PathVariable String userId,@PathVariable String plandId) {
iLatentDangerService.updateStatusByUserIdAndPlandIdLike(userId,plandId);
return ResponseHelper.buildResponse(null);
ReginParams reginParams = getSelectedOrgInfo();
try {
iLatentDangerService.updateStatusByUserIdAndPlandIdLike(userId,plandId,reginParams);
} catch (Exception e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(null);
}
}
......@@ -38,7 +38,7 @@ public interface ILatentDangerService {
String departmentId, String departmentName, String companyId, String orgCode, RoleBo role);
List<LatentDanger> savePatrol(List<LatentDangerDto> latentDangerDtoList, String userId, String userRealName,
String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) throws Exception;
String departmentId, String departmentName, String companyId, String orgCode, RoleBo role,String flag) throws Exception;
CommonResponse list(String toke, String product, String appKey, LatentDangerListParam latentDangerListParam, AgencyUserModel user, String loginOrgCode, String deptId);
......@@ -195,5 +195,5 @@ public interface ILatentDangerService {
public Map<String, Integer> currentLandgerCount(String companyId,String loginOrgCode);
void updateStatusByUserIdAndPlandIdLike(String userId, String planId);
void updateStatusByUserIdAndPlandIdLike(String userId, String planId,ReginParams reginParams) throws Exception;
}
package com.yeejoin.amos.maintenance.business.dto;
import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author: xl
* @Description: 计划规则触发对象
* @Date: 2021/11/10 10:01
*/
@Data
@RuleFact(value = "维保任务",project = "消息规则")
public class PlanRo implements Serializable {
private static final long serialVersionUID = 1779427739908876854L;
@Label("任务名称")
private String name;
@Label(value = "检查类型名称")
private String checkTypeName;
@Label(value = "执行方法")
private String ruleType;
@Label(value = "执行状态")
private String excuteStateName;
@Label(value = "推送时间")
private String sendTime;
@Label(value = "接收人")
private List<String> recivers;
@Label(value = "发送到web标识")
private Boolean isSendWeb;
@Label(value = "发送到app标识")
private Boolean isSendApp;
@Label("关联id")
private String relationId;
@Label("消息类型")
private String msgType;
@Label(value = "终端标识")
private String terminal;
@Label(value = "类别")
private Integer category;
@Label(value = "扩展参数")
private Map<String, String> extras;
}
......@@ -3,10 +3,12 @@ package com.yeejoin.amos.maintenance.business.feign;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* @author DELL
*/
......@@ -20,4 +22,12 @@ public interface JCSFeignClient {
*/
@GetMapping(value = "jcs/org-usr/{userId}/userUnit")
FeignClientResult getUserUnit(@PathVariable String userId);
/**
* 根据主键查orgIds
* @return
*/
@RequestMapping(value = "jcs/common/maintenance-company/get/amosOrgIdsByIds", method = RequestMethod.GET, consumes = "application/json")
ResponseModel<List<String>> getAmosOrgIdsByIds(@RequestParam(value = "list") List<String> list);
}
package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanMapper;
......@@ -8,9 +13,12 @@ import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.dao.repository.*;
import com.yeejoin.amos.maintenance.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam;
import com.yeejoin.amos.maintenance.business.param.PlanTaskPageParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.maintenance.business.util.CommonResponse;
import com.yeejoin.amos.maintenance.business.util.CommonResponseUtil;
import com.yeejoin.amos.maintenance.business.util.PlanTaskUtil;
import com.yeejoin.amos.maintenance.business.vo.CalDateVo;
import com.yeejoin.amos.maintenance.business.vo.PlanTaskVo;
......@@ -34,10 +42,12 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletionException;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -68,6 +78,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
IPlanTaskDetailDao iPlanTaskDetailDao;
@Autowired
InputItemMapper inputItemMapper;
@Autowired
RulePlanService rulePlanService;
@Autowired
JCSFeignClient jcsFeignClient;
@Override
public Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params) {
......@@ -430,6 +445,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 2.保存执行数据明细表
planTaskDetail.saveAndFlush(planTaskDetailInstance);
}
sendMessage(plan);
// 定时任务监控
jobService.planTaskAddJob(planTask);
}
......@@ -464,6 +480,36 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
public void sendMessage(Plan plan) throws Exception {
// 查询检查对象对应防火监督负责人id
List<String> extraUserIds = com.google.common.collect.Lists.newArrayList();
//
log.info(String.format("计划对象:%s", JSON.toJSON(plan)));
/* // 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);*/
// NOTIFY
String userIdString = plan.getUserId();
if (org.apache.commons.lang3.StringUtils.isNotBlank(userIdString)) {
String[] userIdArr = userIdString.split(",");
List<String> userIdList = Arrays.asList(userIdArr);
// 规则推送消息
try {
if (CollectionUtils.isNotEmpty(userIdList)) {
ResponseModel<List<String>> amosOrgIdsByIds = jcsFeignClient.getAmosOrgIdsByIds(userIdList);
extraUserIds = amosOrgIdsByIds.getResult();
}
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
if (CollectionUtils.isNotEmpty(extraUserIds)) {
log.info("接收人ID:{}", extraUserIds);
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, extraUserIds);
}
}
}
@Override
public List<PlanTask> getPlanTaskByRouteId(Long routeId) {
return planTaskMapper.getPlanTaskByRouteId(routeId);
......
package com.yeejoin.amos.maintenance.business.service.impl;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.maintenance.business.dto.PlanRo;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.business.util.DateUtil;
import com.yeejoin.amos.maintenance.dao.entity.Plan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class RulePlanService {
private final String packageId = "消息/addMaintenance";
private final String msgType = "maintenance";
private final Logger log = LoggerFactory.getLogger(RulePlanService.class);
@Autowired
private RuleTrigger ruleTrigger;
@Autowired
private JCSFeignClient jcsFeignClient;
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, extraUserIds);
//触发规则
log.info("消防维保推规则触发消息入参:{}, packageId:{} ", planRo, packageId);
ruleTrigger.publish(planRo, packageId, new String[0]);
return true;
}
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) {
PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo);
planRo.setMsgType(msgType);
planRo.setRuleType(ruleType.getCode());
planRo.setRelationId(String.valueOf(plan.getId()));
planRo.setTerminal(ruleType.getTerminal());
planRo.setCategory(ruleType.getCategory());
Map<String, String> map = new HashMap<>();
map.put("planId", String.valueOf(plan.getId()));
if (!ValidationUtil.isEmpty(ruleType.getUrl())){
map.put("url", ruleType.getUrl());
}
if (RuleConstant.WEB.equals(ruleType.getTerminal())){
planRo.setIsSendWeb(true);
} else if (RuleConstant.APP.equals(ruleType.getTerminal())){
planRo.setIsSendApp(true);
} else if (RuleConstant.APP_WEB.equals(ruleType.getTerminal())){
planRo.setIsSendWeb(true);
planRo.setIsSendApp(true);
}
planRo.setSendTime(DateUtil.date2LongStr(new Date()));
planRo.setRecivers(extraUserIds);
planRo.setExtras(map);
return planRo;
}
}
package com.yeejoin.amos.patrol.business.service.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.dto.MsgRo;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.feign.Business;
......@@ -53,7 +62,17 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -91,6 +110,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired
private EquipFeign equipFeign;
@Autowired
private RulePlanService rulePlanService;
@Autowired
private RuleTrigger ruleTrigger;
private final String packageId = "消息/addCheckRule";
private final String msgType = "patrolSystem";
private final String APP = "APP";
private final String WEB = "WEB";
private final String APP_WEB = "APP/WEB";
private static final String TAB = "\r\n";
@Override
public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params);
......@@ -680,6 +713,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTask.setEndTime(endTime);
// 1.保存执行数据主表
iplanTaskDao.saveAndFlush(planTask);
// 发送APP待办消息
sendMessage(plan, planTask);
String executorId = planTask.getUserId();
long planId = planTask.getId();
for (int i1 = 0; i1 < pointIdList.size(); i1++) {
......@@ -729,6 +764,42 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// return deptMap;
}
public void sendMessage(Plan plan, PlanTask planTask) throws Exception {
MsgRo msgRo = new MsgRo();
// 标题
msgRo.setName(plan.getName());
// 内容
String body = "";
body += "待执行巡检任务" + TAB;
body += "巡检任务名称:" + plan.getName() + TAB;
body += "执行时间:" + planTask.getBeginTime() + "-" + planTask.getEndTime();
msgRo.setContent(body);
// 接收人
ArrayList<String> userIdList = new ArrayList<>();
userIdList.add(planTask.getUserId());
msgRo.setRecivers(userIdList);
msgRo.setMsgType(msgType);
msgRo.setTerminal(APP_WEB);
msgRo.setSendTime(DateTime.now().toString());
// 关联id
msgRo.setRelationId(String.valueOf(plan.getId()));
// 扩展参数
HashMap<String, String> extras = new HashMap<>();
extras.put("type", msgType);
extras.put("planId", String.valueOf(plan.getId()));
extras.put("planTaskId", String.valueOf(planTask.getId()));
msgRo.setExtras(extras);
msgRo.setIsSendApp(true);
msgRo.setIsSendWeb(true);
msgRo.setCategory(RuleConstant.TASK);
// PushMsgParam pushMsgParam = new PushMsgParam();
// rulePlanService.sendRule(pushMsgParam);
log.info("巡检待办任务:%s {}", JSON.toJSON(msgRo));
//触发规则
ruleTrigger.publish(msgRo, packageId, new String[0]);
}
@Override
public List<PlanTask> getPlanTaskByRouteId(Long routeId) {
List<PlanTask> planTaskList = planTaskMapper.getPlanTaskByRouteId(routeId);
......
......@@ -44,7 +44,7 @@ public interface DangerFeignClient {
* @return FeignClientResult
*/
@PostMapping(value = "/patrol/save")
FeignClientResult<List<DangerDto>> saveOrUpdateBatch(@RequestBody List<DangerDto> latentDangerDtoList);
FeignClientResult<List<DangerDto>> saveOrUpdateBatch(@RequestBody List<DangerDto> latentDangerDtoList, @RequestParam String flag);
/**
* 隐患分页查询
......
......@@ -1623,7 +1623,7 @@ public class CheckServiceImpl implements ICheckService {
});
// 1.feign调用保存隐患
log.info(String.format("隐患参数:%s", JSON.toJSONString(allDanger)));
FeignClientResult<List<DangerDto>> listFeignClientResult = DangerFeignClient.saveOrUpdateBatch(allDanger);
FeignClientResult<List<DangerDto>> listFeignClientResult = DangerFeignClient.saveOrUpdateBatch(allDanger,recordParam.getPlanTaskStatus());
if (ObjectUtils.isEmpty(listFeignClientResult.getResult()) || listFeignClientResult.getStatus() != HTTP_OK_STATUS) {
throw new RuntimeException(listFeignClientResult.getDevMessage());
}
......
......@@ -145,7 +145,7 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
Map<String, Object> bizInfo = this.buildBizInfo(hiddenDangerDto);
dangerDto.setBizInfo(JSON.parseObject(JSON.toJSONString(bizInfo)));
//feign 调用保存
FeignClientResult<List<DangerDto>> feignClientResult = feignClient.saveOrUpdateBatch(Collections.singletonList(dangerDto));
FeignClientResult<List<DangerDto>> feignClientResult = feignClient.saveOrUpdateBatch(Collections.singletonList(dangerDto),"3");
//更新隐患
List<DangerDto> saveDangers = feignClientResult.getResult();
if (!saveDangers.isEmpty()) {
......@@ -227,7 +227,7 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
}
return dangerDto;
}).collect(Collectors.toList());
FeignClientResult<List<DangerDto>> feignClientResult = feignClient.saveOrUpdateBatch(dtoList);
FeignClientResult<List<DangerDto>> feignClientResult = feignClient.saveOrUpdateBatch(dtoList,"0");
List<DangerDto> dangerDbs = feignClientResult.getResult();
//2.保存隐患关系表
List<HiddenDanger> hiddenDangers = dangerDbs.stream().map(d -> {
......
......@@ -261,6 +261,7 @@ public class PlanServiceImpl implements IPlanService {
} else {
if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核任务, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核任务通知
} else {
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核完成, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核完成
}
......
......@@ -8,6 +8,7 @@ import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
......@@ -694,11 +695,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
String userIdString = plan.getUserId();
if (org.apache.commons.lang3.StringUtils.isNotBlank(userIdString)) {
String[] userIdArr = userIdString.split(",");
List<String> userIdList = Arrays.asList(userIdArr);
FeignClientResult amosIdListByUserIds = jcsFeignClient.getAmosIdListByUserIds(userIdString);
List<String> result = (List<String>) amosIdListByUserIds.getResult();
if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(result)) {
// String[] userIdArr = userIdString.split(",");
// List<String> userIdList = Arrays.asList(userIdArr);
// 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, userIdList);
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, result);
// 根据bug5569
}
}
......
......@@ -85,3 +85,7 @@ param.nrvideo.url=http://198.87.103.158:8001;
#南瑞视频平台通过视频id获取flv格式视频播放地址
param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live
# 预案消防炮、消防泵设备维度类型
equipment.plan.monitor=92030200,92032200
equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
......@@ -457,17 +457,7 @@
alter table `wl_equipment_specific_alarm` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1621826150001-20">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="location"/>
</not>
</preConditions>
<comment>wl_equipment_specific_alarm_log add column location</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1621826150001-21">
<preConditions onFail="MARK_RAN">
<not>
......@@ -1007,6 +997,17 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备报警信息日志表';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1621826150001-20">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="location"/>
</not>
</preConditions>
<comment>wl_equipment_specific_alarm_log add column location</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
</sql>
</changeSet>
<changeSet id="1630379025553-1" author="shg">
<preConditions onFail="MARK_RAN">
<columnExists tableName="wl_equipment_standard" columnName="create_id"/>
......@@ -2813,7 +2814,6 @@
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-04-21-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_form_group_column"/>
......@@ -2927,4 +2927,30 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</sql>
</changeSet>
<changeSet author="keyong" id="1652339928-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific" columnName="value_label"/>
</not>
</preConditions>
<comment>wl_equipment_specific add column value_label</comment>
<sql>
alter table `wl_equipment_specific` add column `value_label` varchar(255) DEFAULT NULL COMMENT '设备值说明' after `realtime_iot_index_value`;
</sql>
</changeSet>
<changeSet author="keyong" id="1652339928-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment_specific" />
</preConditions>
<comment>wl_equipment_specific同步value_label列数据</comment>
<sql>
UPDATE
wl_equipment_specific wes
SET
wes.value_label = ( SELECT value_label FROM wl_equipment_specific_index wesi
WHERE
wesi.equipment_specific_id = wes.id AND wesi.equipment_index_id = wes.realtime_iot_index_id );
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -619,6 +619,7 @@
from wl_car wc LEFT JOIN wl_car_property wcp on wc.id = wcp.car_id
where wcp.equipment_index_key in ('FAS_Car_Video', 'FAS_Car_GIS');
</select>
<select id="queryCompanyCarStaData" resultType="java.util.Map">
SELECT
s.biz_org_code as bizOrgCode,
......@@ -670,7 +671,20 @@
and e.category_id = c.id
and s.biz_org_code is not null
GROUP BY s.biz_org_code ,c.code
</select>
<select id="getCarState" resultType="Map">
SELECT
*
FROM
v_fire_firecar_num
</select>
<select id="getFirePowerInfo" resultType="Map">
SELECT
department_name departmentName,
total,
on_duty onDuty
FROM
v_duty_person
</select>
</mapper>
......@@ -148,4 +148,36 @@
</if>
</where>
</select>
<select id="getPlanRecord" resultType="Map">
SELECT
start_time startTime,
equipment_code equipmentCode,
equipment_name equipmentName,
equipment_id equipmentId,
fire_equipment_id fireEquipmentId
FROM
c_plan_operation_record cpor
WHERE
cpor.status = 0
ORDER BY cpor.create_date DESC
LIMIT 1
</select>
<select id="getOtherEquipInfo" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog">
SELECT
*
FROM
wl_equipment_specific_alarm_log weal
<where>
weal.type != 'HearBeat'
<if test="date != null">
AND weal.create_date <![CDATA[>=]]> DATE_FORMAT(#{date}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="equipmentId != null">
AND weal.equipment_specific_id = #{equipmentId}
</if>
</where>
ORDER BY weal.create_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -1059,34 +1059,14 @@
<select id="getbyqrCode" resultType="com.yeejoin.equipmanage.common.entity.dto.EquipSpecificAlarmDTO">
-- SELECT
-- (
-- CASE
--
-- WHEN d.type = 'FIREALARM' THEN
-- '火警'
-- WHEN d.type = 'BREAKDOWN' THEN
-- '故障'
-- WHEN d.type = 'SHIELD' THEN
-- '屏蔽'
-- WHEN d.type = 'NOTICE' THEN
-- '预警' ELSE ''
--
-- END
-- ) AS type,
-- ( CASE WHEN d.update_date = NULL THEN d.create_date ELSE d.update_date END ) AS createDate
-- FROM
-- wl_equipment_specific_alarm d LEFT JOIN wl_equipment_specific on wl_equipment_specific.id=d.equipment_specific_id
-- where wl_equipment_specific.qr_code=#{code}
-- ORDER BY d.create_date ,d.update_date LIMIT 1
SELECT
wl_signal_classify.type_name AS type,
wl_signal_classify.type_name AS type,
( CASE WHEN d.update_date = NULL THEN d.create_date ELSE d.update_date END ) AS createDate
FROM
wl_equipment_specific_alarm d
wl_equipment_specific_alarm d
LEFT JOIN wl_equipment_specific on wl_equipment_specific.id=d.equipment_specific_id
LEFT JOIN wl_signal_classify on wl_signal_classify.type_code=d.type
where wl_equipment_specific.qr_code=#{code}
where wl_equipment_specific.qr_code = #{code}
ORDER BY d.create_date ,d.update_date LIMIT 1
</select>
......@@ -1116,4 +1096,15 @@
</if>
</select>
<select id="selectCountByIotCode" resultType="int">
SELECT
count(*)
FROM
wl_equipment_specific_alarm
WHERE
iot_code = #{iotCode,jdbcType=VARCHAR}
AND equipment_specific_index_value = #{indexValue,jdbcType=VARCHAR}
AND equipment_specific_index_key = #{indexKey,jdbcType=VARCHAR}
and `status` = 1
</select>
</mapper>
\ No newline at end of file
......@@ -463,6 +463,8 @@
wws.full_name
FROM
wl_warehouse_structure wws
WHERE
wws.parent_id is not null
</select>
<select id="getEquipBySourceIdBycount" resultType="java.lang.Long">
......@@ -1524,4 +1526,57 @@
f_station_info
LIMIT 1
</select>
<select id="getFireMonitorInfo" resultType="Map">
SELECT
wes.id,
wes.name,
wes.position,
wes.equipment_code equipmentCode,
wes.realtime_iot_index_name realtimeIotIndexName,
wes.realtime_iot_index_key realtimeIotIndexKey,
wes.realtime_iot_index_value realtimeIotIndexValue,
wes.value_label valueLabel,
wes.realtime_iot_es_index_id realtimeIotSpecificIndexId,
wes.realtime_iot_index_update_date realtiemIotIndexUpdateDate,
wes.realtime_iot_index_id realtimeIotIndexId
FROM
wl_equipment_specific wes
LEFT JOIN f_equipment_fire_equipment fire ON wes.id = fire.fire_equipment_id
<where>
<if test="list != null and list.length > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wes.equipment_code LIKE <![CDATA[CONCAT(#{item},'%')]]>
</foreach>
</if>
<if test="fireEquipmentId != null and fireEquipmentId != ''">
AND wes.id = #{fireEquipmentId}
</if>
</where>
ORDER BY realtiemIotIndexUpdateDate DESC
</select>
<select id="getFirePumpInfo" resultType="Map">
SELECT
wes.id,
wes.name,
wes.position,
wes.equipment_code equipmentCode,
wes.realtime_iot_index_name realtimeIotIndexName,
wes.realtime_iot_index_key realtimeIotIndexKey,
wes.realtime_iot_index_value realtimeIotIndexValue,
wes.value_label valueLabel,
wes.realtime_iot_es_index_id realtimeIotSpecificIndexId,
wes.realtime_iot_index_update_date realtiemIotIndexUpdateDate,
wes.realtime_iot_index_id realtimeIotIndexId
FROM
wl_equipment_specific wes
<where>
<if test="list != null and list.length > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wes.equipment_code LIKE <![CDATA[CONCAT(#{item},'%')]]>
</foreach>
</if>
</where>
ORDER BY realtiemIotIndexUpdateDate DESC
</select>
</mapper>
\ No newline at end of file
......@@ -191,18 +191,6 @@
select
'component' as template,
true as openStatus,
<if test="id == null">
if((select count(1) from `wl_source_scene` ss where
-- find_in_set(spe.id, ss.point_in_scene)
spe.id in (ss.point_in_scene)
and EXISTS
(SELECT es.instance_id FROM `wl_form_instance` es WHERE ss.source_id = es.instance_id)) = 0,0,1) as
isBinding, -- 一个装备只能在一个建筑使用
</if>
<if test="id != null and id !=''">
if((SELECT count(1) FROM `wl_source_scene` ss where ss.source_id = #{id} and
FIND_IN_SET(spe.id,ss.point_in_scene)) = 0,0,1) as isBinding,-- 一个装备可在多个系统使用
</if>
if(spe.code is null,eqdet.name,concat(eqdet.name,'(',spe.code,')')) as displayName,
'{\"width\": 20, \"height\": 20}'as initStyle,
'CommonEquip' as componentName,
......@@ -210,8 +198,9 @@
'equipment' as componentKey,
'equipment' as `key`,
equ.img as imgPath,
-- spe.qr_code as equipCode,
spe.code as equipCode,
spe.qr_code as equipCode,
-- spe.code as equipCode,
spe.code AS code,
stru.source_id as parentId,
cat.id as equipId,
cat.code as categoryCode,
......@@ -240,15 +229,6 @@
'component' AS template,
TRUE AS openStatus,
IF
(
( SELECT ss.id FROM wl_source_scene ss WHERE
-- ss.video_in_scene LIKE CONCAT( '%', vid.id, '%' )
vid.id in (ss.video_in_scene)
) IS NULL,
0,
1
) AS isBinding,
IF
( vid.CODE IS NULL, vid.NAME, concat( vid.NAME, '(', vid.CODE, ')' ) ) AS displayName,
'{\"width\": 20, \"height\": 20}' AS initStyle,
'CommonEquip' AS componentName,
......@@ -256,7 +236,8 @@
'equipment' AS componentKey,
'video' AS `key`,
img AS imgPath,
vid.CODE AS equipCode,
vid.code AS equipCode,
vid.code AS code,
vis.source_id AS parentId,
vid.id AS equipId,
vid.CODE AS categoryCode,
......
......@@ -55,7 +55,7 @@
</select>
<select id="pageBuildingVideo" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO">
SELECT
<!-- SELECT
v.id AS id,
v.name AS name,
v.token AS token,
......@@ -80,8 +80,46 @@
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test ="ids != null and ids.size()>0">
and
<foreach collection="ids" index="index" item="id" open="(" close=")" separator=",">
FIND_IN_SET(#{ids}, vc.parent_source_ids)
</foreach>
</if>
</where>
order by v.create_date-->
SELECT
v.id AS id,
v.name AS name,
v.token AS token,
v.url AS url,
v.code AS code,
v.address,
v.preset_position as presetPosition
FROM wl_video v
JOIN wl_video_source vc ON vc.video_id = v.id
join wl_form_instance wfl on wfl.instance_id = vc.source_id
WHERE
1 = 1
<if test="dto.buildingId!=null and dto.buildingId!=''">
and FIND_IN_SET(#{dto.buildingId}, vc.parent_source_ids)
</if>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
and v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test="dto.orgCode!=null and dto.bizOrgCode!='' and dto.buildingId ==null and dto.buildingId =='' ">
and wfl.field_value like concat (#{dto.bizOrgCode},'%')
</if>
GROUP BY id
order by v.create_date
</select>
<select id="getFireEquipByVideoId" resultType="com.yeejoin.equipmanage.common.entity.vo.BuildingListVO">
......@@ -387,4 +425,10 @@
<select id="getParentSourceIds" resultType="java.lang.String">
select getBuildingParentIds(#{childrenId})
</select>
<select id="getVideoCountMapList" resultType="com.yeejoin.equipmanage.dto.CountDto">
select biz_org_code as bizOrgCode, count(biz_org_code) as num
from wl_video
group by biz_org_code
</select>
</mapper>
......@@ -149,7 +149,7 @@
AND d.update_date BETWEEN '${startTime}' AND '${endTime}'
</if>
<if test="buildId!=null">
AND d.buildId in #{buildId}
AND d.buildId in (#{buildId})
<!-- <foreach item="item" index="index" collection="buildId" open="(" separator="," close=")">
#{item}
</foreach>-->
......@@ -203,7 +203,7 @@
AND d.create_date BETWEEN '${startTime}' AND '${endTime}'
</if>
<if test="buildId!=null">
AND d.buildId in #{buildId}
AND d.buildId in (#{buildId})
<!-- AND d.buildId in
<foreach item="item" index="index" collection="buildId" open="(" separator="," close=")">
#{item}
......
......@@ -113,4 +113,9 @@ auth-key-fire-fighters=fire_fighters_info
mybatis.interceptor.enabled = false
## 消防救援保障部ID
fire-rescue=1432549862557130753
\ No newline at end of file
fire-rescue=1432549862557130753
#阿里云实时语音识别参数
speech-config.access-key-id=LTAI5t7mGN6dYoCwMdKiLTgt
speech-config.access-key-secret=0LYdEnvKzQxBg0lpIahDp5rzB2r4Dp
speech-config.app-key=EG5fJBBIqkNMj6bM
\ No newline at end of file
......@@ -85,7 +85,7 @@ class AppNslClientToken {
* @return token 访问token
*/
private static AccessToken getAccessToken() {
AccessToken accessToken = new AccessToken(SpeechConfig.AccessKeId, SpeechConfig.AccessKeySecret);
AccessToken accessToken = new AccessToken(SpeechConfig.AccessKeyId, SpeechConfig.AccessKeySecret);
try {
accessToken.apply();
logger.warn("获取到最新的token: " + accessToken.getToken() + ", 过期时间: " + accessToken.getExpireTime() + "(" + accessToken.getExpireTime() / (1000 * 60 * 60 * 24) + "天)");
......
......@@ -107,13 +107,13 @@ public class AppSpeechTranscriber {
//输入音频采样率。
transcriber.setSampleRate(SampleRateEnum.SAMPLE_RATE_16K);
//是否返回中间识别结果。
transcriber.setEnableIntermediateResult(true);
transcriber.setEnableIntermediateResult(false);
//是否生成并返回标点符号。
transcriber.setEnablePunctuation(true);
transcriber.setEnablePunctuation(false);
//是否将返回结果规整化,比如将一百返回为100。
transcriber.setEnableITN(true);
//设置vad断句参数。默认值:800ms,有效值:200ms~2000ms。
transcriber.addCustomedParam("max_sentence_silence", 500);
transcriber.addCustomedParam("max_sentence_silence", 800);
//设置是否语义断句。
//transcriber.addCustomedParam("enable_semantic_sentence_detection",false);
//设置是否开启顺滑。
......
......@@ -23,8 +23,8 @@ public class SpeechConfig {
/**
* 测试信息,可在阿里云上配置
*/
public static final String AccessKeId = "LTAI5t7mGN6dYoCwMdKiLTgt";
public static final String AccessKeySecret = "0LYdEnvKzQxBg0lpIahDp5rzB2r4Dp";
public static final String AppKey = "EG5fJBBIqkNMj6bM";
public static String AccessKeyId = "";
public static String AccessKeySecret = "";
public static String AppKey = "";
}
......@@ -69,7 +69,7 @@ public class SpeechRecognizer {
e.printStackTrace();
}
// 创建DefaultAcsClient实例并初始化
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, SpeechConfig.AccessKeId, SpeechConfig.AccessKeySecret);
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, SpeechConfig.AccessKeyId, SpeechConfig.AccessKeySecret);
this.client = new DefaultAcsClient(profile);
}
......
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