Commit 3fa49ad7 authored by litengwei's avatar litengwei

巡检代码迁移

parent 949695f2
......@@ -29,7 +29,7 @@ public class FeignConfiguration {
private ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
public Encoder feignFormEncoder() {
public Encoder feignComFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
......
......@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.common.api.dto.CarInfoDto;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -386,4 +387,39 @@ public interface EquipFeignClient {
@RequestMapping(value = "/building/companyBuildingTree", method = RequestMethod.GET)
public ResponseModel<Object> getCompanyBuildingTree();
@RequestMapping(value = "/equipSpecific/getSourceNameByEquipSpeId", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getEquipDetail(@RequestParam(value = "id", required = true) Long id);
@RequestMapping(value = "/equipSpecific/getSourceNameList", method = RequestMethod.POST ,consumes="application/json")
LinkedHashMap<String,Object> getEquipList(@RequestBody Long id);
@RequestMapping(value = "/building/myTreeList", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult myTreeList();
@RequestMapping(value = "/warehouse-structure/listAll", method = RequestMethod.GET ,consumes="application/json")
String getStructureNameAll();
/**
* 所属局域树
* @return
*/
@RequestMapping(value = "/area/treeToPartol", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getRegionTress();
@RequestMapping(value = "/warehouse-structure/gettree/{id}", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> gettreeWarehouse(@PathVariable Long id, @RequestParam(value = "bizOrgCode", required = true) String bizOrgCode, @RequestParam(value = "buildingId", required = false) String buildingId);
@RequestMapping(value = "/building/getOne", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult getBuildingTreeOne(@RequestParam(value = "instanceId", required = true) String instanceId);
@RequestMapping(value = "/equipSpecific/status/equip", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult updateEquipSpecificStatus(@RequestParam(value = "status", required = false) String status,@RequestParam(value = "id", required = false) String id,@RequestParam(value = "sourceId", required = false) String sourceId,@RequestParam(value = "source", required = false) String source);
}
......@@ -52,7 +52,10 @@ import java.net.UnknownHostException;
@EnableEurekaClient
@ComponentScan(value = {"org.typroject", "com.yeejoin.amos"}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {JsonSerializerManage.class})})
@MapperScan(basePackages = {"com.yeejoin.amos.patrol.business.dao.mapper", "org.typroject.tyboot.core.auth.face.orm.dao", "com.yeejoin.amos.boot.biz.common.dao.mapper"})
@MapperScan(basePackages = {"com.yeejoin.amos.patrol.business.dao.mapper", "org.typroject.tyboot.core.auth.face.orm.dao", "com.yeejoin.amos.boot.biz.common.dao.mapper",
"org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper"})
public class PatrolApplication {
private static final Logger logger = LoggerFactory.getLogger(PatrolApplication.class);
......
......@@ -3,13 +3,13 @@ package com.yeejoin.amos.patrol.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PointMapper;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckInputDao;
import com.yeejoin.amos.patrol.business.dto.*;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.param.CheckInfoPageParam;
import com.yeejoin.amos.patrol.business.param.CheckRecordParam;
import com.yeejoin.amos.patrol.business.param.CheckStatisticalParam;
......@@ -79,8 +79,9 @@ public class CheckController extends AbstractBaseController {
@Autowired
private AsyncTask asyncTask;
@Autowired
private EquipFeign equipFeign;
private EquipFeignClient equipFeign;
@Autowired
private IPlanTaskService planTaskService;
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.business.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
......@@ -10,7 +11,6 @@ import com.yeejoin.amos.patrol.business.dao.mapper.PointInputItemMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PointMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.RoutePointItemMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.service.intfc.ICatalogTreeService;
......@@ -76,7 +76,7 @@ public class PointController extends AbstractBaseController {
private RemoteSecurityService remoteSecurityService;
@Autowired
private EquipFeign equipFeign;
private EquipFeignClient equipFeign;
@Autowired
private JcsFeignClient jcsFeignClient;
......
......@@ -17,7 +17,6 @@ import com.yeejoin.amos.patrol.business.param.AppLoginUserParam;
import com.yeejoin.amos.patrol.business.service.intfc.IAppService;
import com.yeejoin.amos.patrol.business.util.*;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.jpush.AppMessagePushService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -56,8 +55,6 @@ public class UserController extends AbstractBaseController {
private static final String appType = "APP";
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private AppMessagePushService appMessagePushService;
@Value("${Security.fegin.name}")
private String SecurityName;
......
package com.yeejoin.amos.patrol.business.feign;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.patrol.business.entity.mybatis.DangerResultBo;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.core.common.response.PointCheckInfoBusinessRespone;
import com.yeejoin.amos.patrol.core.common.response.TaskInfoBusinessRespone;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(name = "${Business.fegin.name}",configuration=FeignConfiguration.class)
@FeignClient(name = "${Business.fegin.name}",configuration= FeignTzsConfiguration.class)
public interface Business {
@RequestMapping(value = "/fireAutoSys/api/risksource/data/patroldata", method = RequestMethod.PUT)
......
package com.yeejoin.amos.patrol.business.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedHashMap;
//装备
@FeignClient(name ="${equip.fegin.name}", configuration = FeignConfiguration.class)
public interface EquipFeign {
@RequestMapping(value = "${equip.fegin.prefix}"+"/equipSpecific/getSourceNameByEquipSpeId", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getEquipDetail(@RequestParam(value = "id", required = true) Long id);
@RequestMapping(value = "${equip.fegin.prefix}"+"/equipSpecific/getSourceNameList", method = RequestMethod.POST ,consumes="application/json")
LinkedHashMap<String,Object> getEquipList(@RequestBody Long id);
@RequestMapping(value = "${equip.fegin.prefix}"+"/building/myTreeList", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult myTreeList();
@RequestMapping(value = "${equip.fegin.prefix}"+"/warehouse-structure/listAll", method = RequestMethod.GET ,consumes="application/json")
String getStructureNameAll();
/**
* 消防建筑树
* @return
*/
@RequestMapping(value = "${equip.fegin.prefix}"+"/building/tree", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getBuildingTree();
@RequestMapping(value = "${equip.fegin.prefix}"+"/building/getBuildingAbsolutePosition", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getBuildingAbsolutePosition();
/**
* 所属局域树
* @return
*/
@RequestMapping(value = "${equip.fegin.prefix}"+"/area/treeToPartol", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getRegionTress();
@RequestMapping(value = "${equip.fegin.prefix}"+"/warehouse-structure/gettree/{id}", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> gettreeWarehouse(@PathVariable Long id, @RequestParam(value = "bizOrgCode", required = true) String bizOrgCode, @RequestParam(value = "buildingId", required = false) String buildingId);
@RequestMapping(value = "${equip.fegin.prefix}"+"/building/getOne", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult getBuildingTreeOne(@RequestParam(value = "instanceId", required = true) String instanceId);
@RequestMapping(value = "${equip.fegin.prefix}"+"/equipSpecific/status/equip", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult updateEquipSpecificStatus(@RequestParam(value = "status", required = false) String status,@RequestParam(value = "id", required = false) String id,@RequestParam(value = "sourceId", required = false) String sourceId,@RequestParam(value = "source", required = false) String source);
}
......@@ -7,19 +7,30 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
public class FeignConfiguration {
/**
* @author DELL
*/
@Configuration
public class FeignTzsConfiguration {
/**
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
* @return
*/
@Bean
public FeignBasicAuthRequestInterceptor basicTzsAuthRequestInterceptor() {
return new FeignBasicAuthRequestInterceptor();
}
@Autowired
private ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
public Encoder feignFormEncoder() {
public Encoder feignTzsComFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
@Bean
public FeignBasicAuthRequestInterceptor basicAuthRequestInterceptor() {
return new FeignBasicAuthRequestInterceptor();
}
}
package com.yeejoin.amos.patrol.business.feign;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -12,7 +13,7 @@ import java.util.List;
/**
* @author DELL
*/
@FeignClient(name = "${idx.feign.name}", path = "idx", configuration = {FeignConfiguration.class})
@FeignClient(name = "${idx.feign.name}", path = "idx", configuration= FeignTzsConfiguration.class)
public interface IdxFeign {
/***
......
package com.yeejoin.amos.patrol.business.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -11,7 +12,7 @@ import java.util.List;
import java.util.Map;
// 机场服务
@FeignClient(name = "${jcs.fegin.name}", path = "jcs", configuration = FeignConfiguration.class)
@FeignClient(name = "${jcs.fegin.name}", path = "jcs", configuration= FeignTzsConfiguration.class)
public interface JcsFeignClient {
/**
......
package com.yeejoin.amos.patrol.business.feign;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.patrol.business.dto.UserDetailsDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -13,7 +14,7 @@ import java.util.Map;
/**
* @author DELL
*/
@FeignClient(name = "${tzs.feign.name}", path = "tcm", configuration = {FeignConfiguration.class})
@FeignClient(name = "${tzs.feign.name}", path = "tcm", configuration= FeignTzsConfiguration.class)
public interface TzsFeign {
/**
......
......@@ -21,7 +21,6 @@ import com.yeejoin.amos.patrol.business.dao.mapper.*;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dto.CheckDto;
import com.yeejoin.amos.patrol.business.entity.mybatis.*;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.IdxFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.*;
......@@ -1589,8 +1588,7 @@ public class CheckServiceImpl implements ICheckService {
CommonPage<CheckInputBo> result = new CommonPage<>(content, param, total);
return result;
}
@Autowired
private EquipFeign equipment;
@Override
public List<HashMap<String,Object>> getEquipByCheckId(CheckDetailInputPageParam param) {
// 如果不传巡检ID,则获取最新一条巡检点对应的巡检记录ID
......
......@@ -10,6 +10,7 @@ import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
......@@ -30,7 +31,6 @@ import com.yeejoin.amos.patrol.business.entity.mybatis.extend.LatentDangerFlowRe
import com.yeejoin.amos.patrol.business.entity.mybatis.extend.LatentDangerNoticeBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.extend.LatentDangerPatrolBo;
import com.yeejoin.amos.patrol.business.feign.Business;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.service.intfc.ILatentDangerService;
......@@ -140,7 +140,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
private Business business;
@Autowired
EquipFeign equipFeign;
private EquipFeignClient equipFeign;
@Autowired
JcsFeignClient jcsFeignClient;
......@@ -232,125 +232,125 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
@Transactional
@Override
public CommonResponse savePatrol(LatentDangerPatrolParam latentDangerPatrolParam, String userId, String userRealName, String departmentId, String departmentName, String companyId, String orgCode, RoleBo role) {
List<LatentDangerPatrolItemParam> itemList = latentDangerPatrolParam.getItemList();
Long checkId = latentDangerPatrolParam.getCheckId();
Check check = iCheckDao.getById(checkId);
if (CollectionUtils.isEmpty(itemList)) {
return CommonResponseUtil.failure("请求参数有误");
}
// Set<String> inputUserIdsStr = getUserIdsStrByTypeAndDefKey("B_1");
// Set<String> reviewUserIdsStr = getUserIdsStrByTypeAndDefKey("B_2");
//获取装备全路径
LinkedHashMap<String,Object> positionAll = equipFeign.getBuildingAbsolutePosition();
LinkedHashMap<String,Object> position = new LinkedHashMap<>();
if("200".equals(positionAll.get("status").toString())){
position = (LinkedHashMap<String, Object>) positionAll.get("result");
}
for (LatentDangerPatrolItemParam param : itemList) {
InputCheckDto inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(checkId,
param.getItemId(), param.getRoutePointItemId(), null);
if (CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
// 如果是外来检查,这里itemList里面无法区分InputCheckDto...
// 在LatentDangerPatrolItemParam中增加checkInputId字段来区分
inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(null, null,
null, param.getCheckInputId());
}
if (inputCheckDto == null) {
return CommonResponseUtil.failure("检查项不存在");
}
InputItem inputItem = iInputItemDao.getOne(inputCheckDto.getItemId());
if (inputItem == null && !CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
return CommonResponseUtil.failure("检查项不存在");
}
String businessKey = RandomUtil.buildOrderNo();
LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getByCode(param.getDangerLevel());
if (levelEnum == null) {
return CommonResponseUtil.failure("请求参数有误");
}
String remark = param.getRemark();
String photoUrls = "";
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(inputCheckDto.getCheckId(),
0L);
if (!CollectionUtils.isEmpty(checkShots)) {
List<String> photos = checkShots.stream().map(e -> {
if (e != null) {
return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
}).collect(Collectors.toList());
photoUrls = Joiner.on(",").join(photos);
}
LatentDangerTypeEnum dangerTypeEnum = null;
String dangerName = "";
if (check.getPlanId() > 0) {
dangerTypeEnum = LatentDangerTypeEnum.计划检查;
} else if (CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
dangerTypeEnum = LatentDangerTypeEnum.无码检查;
} else {
dangerTypeEnum = LatentDangerTypeEnum.无计划检查;
}
if(org.apache.commons.lang3.StringUtils.isNotEmpty(param.getName())){
dangerName = param.getName();
}else {
dangerName = inputItem.getName();
}
Long riskSourceId = null;
if(org.apache.commons.lang3.StringUtils.isNotEmpty(inputCheckDto.getRiskSourceId())){
riskSourceId = Long.parseLong(inputCheckDto.getRiskSourceId());
}
LatentDangerBo latentDangerBo = saveLatentDanger("", "", remark, userId, departmentId,
businessKey, orgCode, dangerName, levelEnum.getCode(),
null, dangerTypeEnum, photoUrls, inputCheckDto.getCheckInputId(), riskSourceId,
position.get(inputCheckDto.getRiskSourceId())==null?"":position.get(inputCheckDto.getRiskSourceId()).toString(), InstanceKeyEnum.PATROL.getCode());
// 更新p_check_input表state字段
updateCheckInputDangerState(latentDangerBo.getBizId(), DangerHandleStateEnum.HANDLE.getCode());
Long dangerId = latentDangerBo.getId();
Date startDate = new Date();
JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey);
Date endDate = new Date();
logger.info("-------------------------提交隐患时间" +(endDate.getTime()-startDate.getTime()));
if (jsonObject == null) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return CommonResponseUtil.failure("启动流程失败");
}
JSONObject instance = jsonObject.getJSONObject("data");
if(instance==null){
return CommonResponseUtil.failure("无提交隐患权限");
}
LatentDangerFlowRecordBo inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId,
null, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(),latentDangerBo.getRemark());
JSONObject flowJson = new JSONObject();
flowJson.put("photoUrls", photoUrls);
updateFlowRecord(inputRecord, LatentDangerExcuteTypeEnum.填写隐患完成, userId, departmentId, remark, flowJson);
if (LatentDangerTypeEnum.计划检查.getCode().equals(latentDangerBo.getDangerType())
|| LatentDangerTypeEnum.无计划检查.getCode().equals(latentDangerBo.getDangerType())) {
LatentDangerPatrolBo latentDangerPatrolBo = new LatentDangerPatrolBo();
latentDangerPatrolBo.setCheckId(inputCheckDto.getCheckId());
latentDangerPatrolBo.setPointClassifyId(inputCheckDto.getPointClassifyId());
latentDangerPatrolBo.setItemId(inputCheckDto.getItemId());
latentDangerPatrolBo.setRouteId(inputCheckDto.getRouteId());
latentDangerPatrolBo.setPointId(inputCheckDto.getPointId());
latentDangerPatrolBo.setLatentDangerId(latentDangerBo.getId());
latentDangerPatrolBo.setRoutePointItemId(inputCheckDto.getRoutePointItemId());
latentDangerPatrolMapper.save(latentDangerPatrolBo);
}
latentDangerBo.setCurrentFlowRecordId(inputRecord.getId());
latentDangerBo.setInstanceId(instance.getString("id"));
latentDangerMapper.update(latentDangerBo);
//修改管控措施的状态为失效
LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, patrolBo,
"巡检隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
try {
webMqttComponent.publish(dangerTopic, "");
}catch (Exception e){
logger.error("巡检隐患提交数字换流站页面推送失败-----------"+e.getMessage());
}
}
// List<LatentDangerPatrolItemParam> itemList = latentDangerPatrolParam.getItemList();
// Long checkId = latentDangerPatrolParam.getCheckId();
// Check check = iCheckDao.getById(checkId);
// if (CollectionUtils.isEmpty(itemList)) {
// return CommonResponseUtil.failure("请求参数有误");
// }
//// Set<String> inputUserIdsStr = getUserIdsStrByTypeAndDefKey("B_1");
//// Set<String> reviewUserIdsStr = getUserIdsStrByTypeAndDefKey("B_2");
// //获取装备全路径
//// LinkedHashMap<String,Object> positionAll = equipFeign.getBuildingAbsolutePosition();
//// LinkedHashMap<String,Object> position = new LinkedHashMap<>();
//// if("200".equals(positionAll.get("status").toString())){
//// position = (LinkedHashMap<String, Object>) positionAll.get("result");
//// }
//
// for (LatentDangerPatrolItemParam param : itemList) {
// InputCheckDto inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(checkId,
// param.getItemId(), param.getRoutePointItemId(), null);
// if (CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
// // 如果是外来检查,这里itemList里面无法区分InputCheckDto...
// // 在LatentDangerPatrolItemParam中增加checkInputId字段来区分
// inputCheckDto = checkInputMapper.getByCheckIdAndItemIdAndRoutePointItemId(null, null,
// null, param.getCheckInputId());
// }
// if (inputCheckDto == null) {
// return CommonResponseUtil.failure("检查项不存在");
// }
// InputItem inputItem = iInputItemDao.getOne(inputCheckDto.getItemId());
// if (inputItem == null && !CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
// return CommonResponseUtil.failure("检查项不存在");
// }
// String businessKey = RandomUtil.buildOrderNo();
// LatentDangerLevelEnum levelEnum = LatentDangerLevelEnum.getByCode(param.getDangerLevel());
// if (levelEnum == null) {
// return CommonResponseUtil.failure("请求参数有误");
// }
// String remark = param.getRemark();
// String photoUrls = "";
// List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(inputCheckDto.getCheckId(),
// 0L);
// if (!CollectionUtils.isEmpty(checkShots)) {
// List<String> photos = checkShots.stream().map(e -> {
// if (e != null) {
// return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
// } else {
// return "";
// }
// }).collect(Collectors.toList());
// photoUrls = Joiner.on(",").join(photos);
// }
// LatentDangerTypeEnum dangerTypeEnum = null;
// String dangerName = "";
// if (check.getPlanId() > 0) {
// dangerTypeEnum = LatentDangerTypeEnum.计划检查;
// } else if (CheckModeEnum.WEB_OUT.getCode().equals(check.getCheckMode())) {
// dangerTypeEnum = LatentDangerTypeEnum.无码检查;
// } else {
// dangerTypeEnum = LatentDangerTypeEnum.无计划检查;
// }
// if(org.apache.commons.lang3.StringUtils.isNotEmpty(param.getName())){
// dangerName = param.getName();
// }else {
// dangerName = inputItem.getName();
// }
// Long riskSourceId = null;
// if(org.apache.commons.lang3.StringUtils.isNotEmpty(inputCheckDto.getRiskSourceId())){
// riskSourceId = Long.parseLong(inputCheckDto.getRiskSourceId());
// }
//
// LatentDangerBo latentDangerBo = saveLatentDanger("", "", remark, userId, departmentId,
// businessKey, orgCode, dangerName, levelEnum.getCode(),
// null, dangerTypeEnum, photoUrls, inputCheckDto.getCheckInputId(), riskSourceId,
// position.get(inputCheckDto.getRiskSourceId())==null?"":position.get(inputCheckDto.getRiskSourceId()).toString(), InstanceKeyEnum.PATROL.getCode());
// // 更新p_check_input表state字段
// updateCheckInputDangerState(latentDangerBo.getBizId(), DangerHandleStateEnum.HANDLE.getCode());
// Long dangerId = latentDangerBo.getId();
// Date startDate = new Date();
// JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey);
// Date endDate = new Date();
// logger.info("-------------------------提交隐患时间" +(endDate.getTime()-startDate.getTime()));
// if (jsonObject == null) {
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return CommonResponseUtil.failure("启动流程失败");
// }
// JSONObject instance = jsonObject.getJSONObject("data");
// if(instance==null){
// return CommonResponseUtil.failure("无提交隐患权限");
// }
// LatentDangerFlowRecordBo inputRecord = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId,
// null, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(),latentDangerBo.getRemark());
//
// JSONObject flowJson = new JSONObject();
// flowJson.put("photoUrls", photoUrls);
// updateFlowRecord(inputRecord, LatentDangerExcuteTypeEnum.填写隐患完成, userId, departmentId, remark, flowJson);
// if (LatentDangerTypeEnum.计划检查.getCode().equals(latentDangerBo.getDangerType())
// || LatentDangerTypeEnum.无计划检查.getCode().equals(latentDangerBo.getDangerType())) {
// LatentDangerPatrolBo latentDangerPatrolBo = new LatentDangerPatrolBo();
// latentDangerPatrolBo.setCheckId(inputCheckDto.getCheckId());
// latentDangerPatrolBo.setPointClassifyId(inputCheckDto.getPointClassifyId());
// latentDangerPatrolBo.setItemId(inputCheckDto.getItemId());
// latentDangerPatrolBo.setRouteId(inputCheckDto.getRouteId());
// latentDangerPatrolBo.setPointId(inputCheckDto.getPointId());
// latentDangerPatrolBo.setLatentDangerId(latentDangerBo.getId());
// latentDangerPatrolBo.setRoutePointItemId(inputCheckDto.getRoutePointItemId());
// latentDangerPatrolMapper.save(latentDangerPatrolBo);
// }
// latentDangerBo.setCurrentFlowRecordId(inputRecord.getId());
// latentDangerBo.setInstanceId(instance.getString("id"));
// latentDangerMapper.update(latentDangerBo);
// //修改管控措施的状态为失效
// LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
// sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, patrolBo,
// "巡检隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
// try {
// webMqttComponent.publish(dangerTopic, "");
// }catch (Exception e){
// logger.error("巡检隐患提交数字换流站页面推送失败-----------"+e.getMessage());
// }
// }
return CommonResponseUtil.success();
}
......@@ -1630,49 +1630,49 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
@Override
public Page<DangerListResponse> listDanger(PageParam pageParam) {
String idsStr = (String) pageParam.get("dangerIds");
if (StringUtil.isNotEmpty(idsStr)) {
List<String> dangerIdList = Lists.newArrayList(idsStr.split(","));
pageParam.put("dangerIds", dangerIdList);
}
if (StringUtil.isNotEmpty(pageParam.get("pageNumber")) && StringUtil.isNotEmpty(pageParam.get("pageSize"))) {
int offSet = (int) pageParam.get("pageNumber") * (int) pageParam.get("pageSize");
pageParam.put("offset", offSet);
}
// 获取隐患地点的子节点
Object structureId = pageParam.get("structureId");
List<Long> structureIdList = null;
if (structureId != null && structureId.toString().trim().length() > 0) {
LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
if(o==null||!"200".equals(o.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> structureId.equals(map.get("id"))).findFirst().orElse(null);
if (node != null) {
structureIdList = findBuildChildrenIds(node);
}
}
pageParam.put("structureId", structureIdList);
List<DangerListResponse> dangerListResponseList = latentDangerMapper.dangerListByMap(pageParam);
Map<Long, String> buildingAbsolutePositionMap = new HashMap<>();
try {
LinkedHashMap<String, Object> buildingAbsolutePosition = equipFeign.getBuildingAbsolutePosition();
if (buildingAbsolutePosition == null || !"200".equals(buildingAbsolutePosition.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
buildingAbsolutePositionMap = (Map<Long, String>) buildingAbsolutePosition.get("result");
} catch (Exception e) {
}
if (!dangerListResponseList.isEmpty()) {
Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap;
dangerListResponseList.forEach(danger->danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId())));
}
Long count = latentDangerMapper.countDangerListByMap(pageParam);
if (CollectionUtils.isEmpty(dangerListResponseList)) {
return new PageImpl<>(dangerListResponseList, pageParam, 0L);
}
return new PageImpl<>(dangerList(dangerListResponseList), pageParam, count);
// String idsStr = (String) pageParam.get("dangerIds");
// if (StringUtil.isNotEmpty(idsStr)) {
// List<String> dangerIdList = Lists.newArrayList(idsStr.split(","));
// pageParam.put("dangerIds", dangerIdList);
// }
// if (StringUtil.isNotEmpty(pageParam.get("pageNumber")) && StringUtil.isNotEmpty(pageParam.get("pageSize"))) {
// int offSet = (int) pageParam.get("pageNumber") * (int) pageParam.get("pageSize");
// pageParam.put("offset", offSet);
// }
// // 获取隐患地点的子节点
// Object structureId = pageParam.get("structureId");
// List<Long> structureIdList = null;
// if (structureId != null && structureId.toString().trim().length() > 0) {
// LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
// if(o==null||!"200".equals(o.get("status").toString())) {
// throw new YeeException("获取建筑树出错");
// }
// List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
// Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> structureId.equals(map.get("id"))).findFirst().orElse(null);
// if (node != null) {
// structureIdList = findBuildChildrenIds(node);
// }
// }
// pageParam.put("structureId", structureIdList);
// List<DangerListResponse> dangerListResponseList = latentDangerMapper.dangerListByMap(pageParam);
// Map<Long, String> buildingAbsolutePositionMap = new HashMap<>();
// try {
// LinkedHashMap<String, Object> buildingAbsolutePosition = equipFeign.getBuildingAbsolutePosition();
// if (buildingAbsolutePosition == null || !"200".equals(buildingAbsolutePosition.get("status").toString())) {
// throw new YeeException("获取建筑树出错");
// }
// buildingAbsolutePositionMap = (Map<Long, String>) buildingAbsolutePosition.get("result");
// } catch (Exception e) {
// }
// if (!dangerListResponseList.isEmpty()) {
// Map<Long, String> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap;
// dangerListResponseList.forEach(danger->danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId())));
// }
// Long count = latentDangerMapper.countDangerListByMap(pageParam);
// if (CollectionUtils.isEmpty(dangerListResponseList)) {
// return new PageImpl<>(dangerListResponseList, pageParam, 0L);
// }
return null;
}
private List<Map<String, Object>> getAllNodes(List<Map<String, Object>> buildingTree) {
......
package com.yeejoin.amos.patrol.business.service.impl;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
......@@ -11,7 +12,6 @@ import com.yeejoin.amos.patrol.business.dao.repository.IRouteDao;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckMsgBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PushTargetBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.TaskMsgBo;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.MsgInfoPageParam;
import com.yeejoin.amos.patrol.business.param.NoticePublishParam;
......@@ -24,7 +24,6 @@ import com.yeejoin.amos.patrol.dao.entity.*;
import com.yeejoin.amos.patrol.email.IEmailService;
import com.yeejoin.amos.patrol.feign.PushFeignServer;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.jpush.AppMessagePushService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -76,8 +75,6 @@ public class MessageServiceImpl implements IMessageService {
@Autowired
private IEmailService emailService;
@Autowired
private AppMessagePushService appMessagePushService;
@Autowired
private PushFeignServer pushFeignServer;
......@@ -86,7 +83,7 @@ public class MessageServiceImpl implements IMessageService {
private RemoteSecurityService remoteSecurityService;
@Autowired
private EquipFeign equipFeign;
private EquipFeignClient equipFeign;
@Autowired
......@@ -94,84 +91,84 @@ public class MessageServiceImpl implements IMessageService {
@Override
public void pushCheckMessage(String toke,String product,String appKey,Long checkId) {
try{
//消息发送内容、执行人id,巡检点id,巡检线路id
CheckMsgBo checkMsgBo = msgMapper.getCheckMsgBos(checkId);
if(checkMsgBo != null){
PushMsgParam pushMsgParam = new PushMsgParam();
pushMsgParam.setContent(checkMsgBo.getPushMsg());
pushMsgParam.setSubject(MsgTypeEnum.CHECK.getName());
//发送目标,执行人,巡检点责任人,巡检线路责任人,关注线路人
//获取建筑地址
if(StringUtils.isNotBlank(checkMsgBo.getRiskSourceId())){
LinkedHashMap<String,Object> positionAll = equipFeign.getBuildingAbsolutePosition();
LinkedHashMap<String,Object> position = new LinkedHashMap<>();
if("200".equals(positionAll.get("status").toString())){
position = (LinkedHashMap<String, Object>) positionAll.get("result");
}
checkMsgBo.setPushMsg(checkMsgBo.getPushMsg().replace("address",position.get(checkMsgBo.getRiskSourceId()).toString()));
checkMsgBo.setSaveMsg(checkMsgBo.getSaveMsg().replace("address",position.get(checkMsgBo.getRiskSourceId()).toString()));
}else{
checkMsgBo.setPushMsg(checkMsgBo.getPushMsg().replace("address","无"));
checkMsgBo.setSaveMsg(checkMsgBo.getSaveMsg().replace("address","无"));
}
Set<String> needUserIds = new HashSet<>();
//执行人
needUserIds.add(checkMsgBo.getUserId());
//获取点责任人
Optional<Point> point = iPointDao.findById(checkMsgBo.getPointId());
needUserIds.add(point.get().getChargePersonId());
//获取线路责任人
if(checkMsgBo.getRouteId() != 0){
Optional<Route> route = iRouteDao.findById(checkMsgBo.getRouteId());
if(route.isPresent()){
if(route.get().getBoss() !=null && route.get().getBoss().trim() !=""){
needUserIds.add(route.get().getBoss());
}
}
}
//获取需要推送的app的用户 手机端暂时无订阅功能,暂时屏蔽
// List<PushTargetBo> jpushUser = msgMapper.getPushUserBo("app", String.join(",", needUserIds), checkMsgBo.getRouteId(),getAppPushConfig(checkMsgBo.getStatus()));
List<PushTargetBo> jpushUser = new ArrayList<>();
needUserIds.stream().forEach(action->{
if(!ObjectUtils.isEmpty(action)){
PushTargetBo pb = new PushTargetBo();
pb.setUserId(action);
jpushUser.add(pb);
}
});
//获取需要推送的email的用户
List<PushTargetBo> emailUser = msgMapper.getPushUserBo("email", String.join(",", needUserIds), checkMsgBo.getRouteId(),getEmailPushConfig(checkMsgBo.getStatus()));
//处理用户信息
List<PushTargetBo> tempList = new ArrayList<>();
tempList.addAll(jpushUser);
tempList.addAll(emailUser);
// 手机端暂时无订阅功能,暂时屏蔽
// List<String> userIds=tempList.stream().map(PushTargetBo::getUserId).distinct().collect(Collectors.toList());
Set<String> userIds = needUserIds;
List<AgencyUserModel> agencyUserModelList=remoteSecurityService.listUserByUserIds( toke,product,appKey,String.join(",", userIds));
try {
pushAppMsg(jpushUser,agencyUserModelList,pushMsgParam,checkMsgBo, toke, product, appKey);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
log.error(e.getMessage(), e);
e.printStackTrace();
}
try {
pushEmailMsg(emailUser, agencyUserModelList, pushMsgParam,checkMsgBo);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
log.error(e.getMessage(), e);
e.printStackTrace();
}
}
}catch (Exception e) {
log.error(e.getMessage(), e);
e.printStackTrace();
}
// try{
// //消息发送内容、执行人id,巡检点id,巡检线路id
// CheckMsgBo checkMsgBo = msgMapper.getCheckMsgBos(checkId);
// if(checkMsgBo != null){
// PushMsgParam pushMsgParam = new PushMsgParam();
// pushMsgParam.setContent(checkMsgBo.getPushMsg());
// pushMsgParam.setSubject(MsgTypeEnum.CHECK.getName());
// //发送目标,执行人,巡检点责任人,巡检线路责任人,关注线路人
// //获取建筑地址
// if(StringUtils.isNotBlank(checkMsgBo.getRiskSourceId())){
// LinkedHashMap<String,Object> positionAll = equipFeign.getBuildingAbsolutePosition();
// LinkedHashMap<String,Object> position = new LinkedHashMap<>();
// if("200".equals(positionAll.get("status").toString())){
// position = (LinkedHashMap<String, Object>) positionAll.get("result");
// }
// checkMsgBo.setPushMsg(checkMsgBo.getPushMsg().replace("address",position.get(checkMsgBo.getRiskSourceId()).toString()));
// checkMsgBo.setSaveMsg(checkMsgBo.getSaveMsg().replace("address",position.get(checkMsgBo.getRiskSourceId()).toString()));
// }else{
// checkMsgBo.setPushMsg(checkMsgBo.getPushMsg().replace("address","无"));
// checkMsgBo.setSaveMsg(checkMsgBo.getSaveMsg().replace("address","无"));
// }
// Set<String> needUserIds = new HashSet<>();
// //执行人
// needUserIds.add(checkMsgBo.getUserId());
// //获取点责任人
// Optional<Point> point = iPointDao.findById(checkMsgBo.getPointId());
// needUserIds.add(point.get().getChargePersonId());
// //获取线路责任人
// if(checkMsgBo.getRouteId() != 0){
// Optional<Route> route = iRouteDao.findById(checkMsgBo.getRouteId());
// if(route.isPresent()){
// if(route.get().getBoss() !=null && route.get().getBoss().trim() !=""){
// needUserIds.add(route.get().getBoss());
// }
// }
// }
//
// //获取需要推送的app的用户 手机端暂时无订阅功能,暂时屏蔽
//// List<PushTargetBo> jpushUser = msgMapper.getPushUserBo("app", String.join(",", needUserIds), checkMsgBo.getRouteId(),getAppPushConfig(checkMsgBo.getStatus()));
// List<PushTargetBo> jpushUser = new ArrayList<>();
// needUserIds.stream().forEach(action->{
// if(!ObjectUtils.isEmpty(action)){
// PushTargetBo pb = new PushTargetBo();
// pb.setUserId(action);
// jpushUser.add(pb);
// }
// });
// //获取需要推送的email的用户
// List<PushTargetBo> emailUser = msgMapper.getPushUserBo("email", String.join(",", needUserIds), checkMsgBo.getRouteId(),getEmailPushConfig(checkMsgBo.getStatus()));
//
//
// //处理用户信息
// List<PushTargetBo> tempList = new ArrayList<>();
// tempList.addAll(jpushUser);
// tempList.addAll(emailUser);
// // 手机端暂时无订阅功能,暂时屏蔽
//// List<String> userIds=tempList.stream().map(PushTargetBo::getUserId).distinct().collect(Collectors.toList());
// Set<String> userIds = needUserIds;
// List<AgencyUserModel> agencyUserModelList=remoteSecurityService.listUserByUserIds( toke,product,appKey,String.join(",", userIds));
// try {
// pushAppMsg(jpushUser,agencyUserModelList,pushMsgParam,checkMsgBo, toke, product, appKey);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// log.error(e.getMessage(), e);
// e.printStackTrace();
// }
// try {
// pushEmailMsg(emailUser, agencyUserModelList, pushMsgParam,checkMsgBo);
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// log.error(e.getMessage(), e);
// e.printStackTrace();
// }
// }
// }catch (Exception e) {
// log.error(e.getMessage(), e);
// e.printStackTrace();
// }
}
......
......@@ -8,6 +8,7 @@ import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -117,7 +118,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private Business business;
@Autowired
private EquipFeign equipFeign;
private EquipFeignClient equipFeign;
@Autowired
private RuleTrigger ruleTrigger;
......
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
......@@ -17,7 +18,6 @@ import com.yeejoin.amos.patrol.business.dao.mapper.RoutePointItemMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.dto.PointClassifySynDto;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
......@@ -107,7 +107,7 @@ public class PointServiceImpl implements IPointService {
@Autowired
private IInputItemDao inputItemDao;
@Autowired
private EquipFeign equipFeign;
private EquipFeignClient equipFeign;
@Autowired
private JcsFeignClient jcsFeignClient;
......@@ -1961,15 +1961,15 @@ public class PointServiceImpl implements IPointService {
List<Map<String, Object>> list = Collections.EMPTY_LIST;
// 传入riskSourceId为-2请求的是巡检点区域为空
if (riskSourceId != null && riskSourceId != -2) {
LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
if(o==null||!"200".equals(o.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> riskSourceId.toString().equals(map.get("id"))).findFirst().orElse(null);
if (node != null) {
structureIdList = findBuildChildrenIds(node);
}
// LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
// if(o==null||!"200".equals(o.get("status").toString())) {
// throw new YeeException("获取建筑树出错");
// }
// List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
// Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> riskSourceId.toString().equals(map.get("id"))).findFirst().orElse(null);
// if (node != null) {
// structureIdList = findBuildChildrenIds(node);
// }
}
boolean nullRiskSourceId = false;
......@@ -1991,15 +1991,15 @@ public class PointServiceImpl implements IPointService {
List<Map<String, Object>> list = Collections.EMPTY_LIST;
// 传入riskSourceId为-2请求的是巡检点区域为空
if (riskSourceId != null && riskSourceId != -2) {
LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
if(o==null||!"200".equals(o.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> riskSourceId.toString().equals(map.get("id"))).findFirst().orElse(null);
if (node != null) {
structureIdList = findBuildChildrenIds(node);
}
// LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
// if(o==null||!"200".equals(o.get("status").toString())) {
// throw new YeeException("获取建筑树出错");
// }
// List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
// Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> riskSourceId.toString().equals(map.get("id"))).findFirst().orElse(null);
// if (node != null) {
// structureIdList = findBuildChildrenIds(node);
// }
}
boolean nullRiskSourceId = false;
......
package com.yeejoin.amos.patrol.common.remote;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.business.feign.FeignConfiguration;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......
......@@ -30,7 +30,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
@Component
@ResponseBody
@Order(value = 1)
public class PersonIdentifyAspect {
public class PersonIdentifyTzsAspect {
@Autowired
RedisUtils redisUtils;
......
......@@ -19,7 +19,6 @@ import com.yeejoin.amos.patrol.common.enums.MsgSubscribeEnum;
import com.yeejoin.amos.patrol.dao.entity.Msg;
import com.yeejoin.amos.patrol.email.IEmailService;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.jpush.AppMessagePushService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -53,8 +52,6 @@ public class AsyncTask {
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private AppMessagePushService appMessagePushService;
@Autowired
private MsgSubscribeMapper msgSubscribeMapper;
......
//package com.yeejoin.amos.patrol.feign;
//
//import feign.codec.Encoder;
//import feign.form.spring.SpringFormEncoder;
//import org.springframework.beans.factory.ObjectFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
//import org.springframework.cloud.openfeign.support.SpringEncoder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.context.request.RequestContextListener;
//
///**
// * @Author: xinglei
// * @Description:
// * @Date: 2020/3/30 16:26
// */
//@Configuration
//public class MultipartSupportConfig {
//
// @Autowired
// private ObjectFactory<HttpMessageConverters> messageConverters;
//
// @Bean
// public Encoder feignFormEncoder() {
// return new SpringFormEncoder(new SpringEncoder(messageConverters));
// }
//
// /**
// * 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
// * @return
// */
// @Bean
// public RequestContextListener requestInterceptor() {
// return new RequestContextListener();
// }
//}
package com.yeejoin.amos.patrol.feign;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.patrol.business.param.PushMsgParam;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
//推送
@FeignClient(name = "${Push.fegin.name}", configuration={MultipartSupportConfig.class})
public interface PushFeign {
//
// @RequestMapping(value = "/api/user/sendMessage", method = RequestMethod.POST)
// CommonResponse sendMessage( @RequestBody List<PushMsgParam> responses);
@RequestMapping(value = "/api/user/sendMessageone", method = RequestMethod.POST)
CommonResponse sendMessageone( @RequestBody PushMsgParam responses);
@RequestMapping(value = "/api/user/pushNoticeMany", method = RequestMethod.POST)
CommonResponse pushNoticeMany( @RequestBody PushMsgParam responses);
@RequestMapping(value = "/api/user/buildPushPayload", method = RequestMethod.POST)
CommonResponse buildPushPayload( @RequestBody PushMsgParam responses);
@RequestMapping(value = "/api/user/pushDevice", method = RequestMethod.GET)
CommonResponse PushDevice( @RequestParam("alias") String alias);
@RequestMapping(value = "/api/user/PushDeviceRegistration", method = RequestMethod.GET)
CommonResponse PushDeviceRegistration( @RequestParam("registrationId") String registrationId,@RequestParam("alias") String alias);
}
package com.yeejoin.amos.patrol.jpush;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.model.PushPayload;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.param.PushMsgParam;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
public class AppMessagePushService {
protected static final Logger log = LoggerFactory
.getLogger(AppMessagePushService.class);
@Autowired
private com.yeejoin.amos.patrol.feign.PushFeign PushFeign;
// private static String APP_KEY;
//
// private static String MASTER_SECRET;
//
// @Value("${params.jpush.appKey}")
// public void setAppKey(String appKey) {
// this.APP_KEY = appKey;
// }
// @Value("${params.jpush.masterSecret}")
// public void setMasterSecret(String masterSecret) {
// this.MASTER_SECRET = masterSecret;
// }
@Value("${params.isPush}")
private String isPush;
protected static final String APP_KEY = "1b3f7b961200f4b236811dfe";
protected static final String MASTER_SECRET = "8b650e645fb3a43c96be02b2";
//
private static JPushClient jpushClient = new JPushClient(MASTER_SECRET,
APP_KEY);
public static String buildJpushUserKey(String userId) {
return XJConstant.JPUSH_USER_KEY + "_" + userId;
}
// private static JPushClient jpushClient = null;
//
// public static JPushClient getJPushClient(String APP_KEY, String MASTER_SECRET) {
// if (jpushClient == null) {
// return new JPushClient(MASTER_SECRET,
//package com.yeejoin.amos.patrol.jpush;
//
//import cn.jpush.api.JPushClient;
//import cn.jpush.api.push.model.PushPayload;
//import com.yeejoin.amos.patrol.business.constants.XJConstant;
//import com.yeejoin.amos.patrol.business.param.PushMsgParam;
//import com.yeejoin.amos.patrol.business.util.CommonResponse;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//
//
//@Service
//public class AppMessagePushService {
//
//
// protected static final Logger log = LoggerFactory
// .getLogger(AppMessagePushService.class);
//
////
// @Autowired
// private com.yeejoin.amos.patrol.feign.PushFeign PushFeign;
//// private static String APP_KEY;
////
//// private static String MASTER_SECRET;
////
//// @Value("${params.jpush.appKey}")
//// public void setAppKey(String appKey) {
//// this.APP_KEY = appKey;
//// }
//// @Value("${params.jpush.masterSecret}")
//// public void setMasterSecret(String masterSecret) {
//// this.MASTER_SECRET = masterSecret;
//// }
//
// @Value("${params.isPush}")
// private String isPush;
//
// protected static final String APP_KEY = "1b3f7b961200f4b236811dfe";
// protected static final String MASTER_SECRET = "8b650e645fb3a43c96be02b2";
// //
//
// private static JPushClient jpushClient = new JPushClient(MASTER_SECRET,
// APP_KEY);
// public static String buildJpushUserKey(String userId) {
// return XJConstant.JPUSH_USER_KEY + "_" + userId;
// }
//
//// private static JPushClient jpushClient = null;
////
//// public static JPushClient getJPushClient(String APP_KEY, String MASTER_SECRET) {
//// if (jpushClient == null) {
//// return new JPushClient(MASTER_SECRET,
//// APP_KEY);
//// }
//// return jpushClient;
//// }
//
//
// /*public void sendMessage(List<PushMsgParam> responses)
// {
// PushFeign.sendMessage(responses);
// try
// {
// if(responses!=null && "true".equals(isPush))
// {
// for(PushMsgParam response:responses)
// {
// PushPayload payload = buildPushPayload(response);
// jpushClient.sendPush(payload);
// }
// return jpushClient;
// }
/*public void sendMessage(List<PushMsgParam> responses)
{
PushFeign.sendMessage(responses);
try
{
if(responses!=null && "true".equals(isPush))
{
for(PushMsgParam response:responses)
{
PushPayload payload = buildPushPayload(response);
jpushClient.sendPush(payload);
}
}
}
catch (Exception e){
log.error(e.getMessage(),e);
e.printStackTrace();
}
}
*/
private PushPayload buildPushPayload(PushMsgParam response) {
CommonResponse commonResponse = PushFeign.buildPushPayload(response);
return (PushPayload)commonResponse.getDataList();
/*if(JPushTypeEnum.ALL.getCode().equals(response.getType())){
return PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.all())
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
}else if(JPushTypeEnum.TAG.getCode().equals(response.getType())){
return PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.tag(response.getRecivers()))
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
}else{
return PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.alias(response.getRecivers())).
setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
}*/
}
// public void sendMessage(PushMsgParam response){
//
// try {
// if(null!=response && "true".equals(isPush)){
// CommonResponse commonResponse = PushFeign.sendMessageone(response);
// }
// } catch (Exception e) {
// catch (Exception e){
// log.error(e.getMessage(),e);
// e.printStackTrace();
//
// }
// }
}
//*/
// private PushPayload buildPushPayload(PushMsgParam response) {
// CommonResponse commonResponse = PushFeign.buildPushPayload(response);
// return (PushPayload)commonResponse.getDataList();
// /*if(JPushTypeEnum.ALL.getCode().equals(response.getType())){
// return PushPayload.newBuilder()
// .setPlatform(Platform.android())
// .setAudience(Audience.all())
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// }else if(JPushTypeEnum.TAG.getCode().equals(response.getType())){
// return PushPayload.newBuilder().setPlatform(Platform.android())
// .setAudience(Audience.tag(response.getRecivers()))
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// }else{
// return PushPayload.newBuilder().setPlatform(Platform.android())
// .setAudience(Audience.alias(response.getRecivers())).
// setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// }*/
//
// }
//
//// public void sendMessage(PushMsgParam response){
////
//// try {
//// if(null!=response && "true".equals(isPush)){
//// CommonResponse commonResponse = PushFeign.sendMessageone(response);
//// }
//// } catch (Exception e) {
//// log.error(e.getMessage(),e);
//// e.printStackTrace();
////
//// }
//// }
//
//}
......@@ -85,12 +85,12 @@ windows.img.path = D:\\
linux.img.path = /
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}-3578
emqx.broker=tcp://172.16.10.210:1883
emqx.user-name=admin
emqx.password=public
emqx.max-inflight=1000
emqx.clean-session=false
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://36.46.151.113:1883
emqx.client-user-name=super
emqx.client-password=123456
emqx.keepAliveInterval=1000
file.url=http://172.16.10.210:9000/
......@@ -99,3 +99,6 @@ logic=false
#是否为中心级系统 true-中心级系统 false-站端系统
is.zxj=true
## \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u052E\uFFFD\uFFFD\uFFFD\u03F2\uFFFDID
fire-rescue=1432549862557130753
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment