Commit e900428d authored by caotao's avatar caotao

1.车辆管理-根据组织机构搜索无效问题处理。

2.车辆管理-优化未完成里程统计。
parent 19848713
...@@ -85,30 +85,32 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -85,30 +85,32 @@ public class FireFightingSystemController extends AbstractBaseController {
@Autowired @Autowired
FireFightingSystemMapper fireFightingSystemMapper; FireFightingSystemMapper fireFightingSystemMapper;
@Autowired @Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
ICarService carService;
/**
* 通过装备定义id查找性能指标
*
* @return
*/
@Autowired
IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired
private AmosRequestContext amosAuth; private AmosRequestContext amosAuth;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Value("${equipment.hierarchy}") @Value("${equipment.hierarchy}")
private String hierarchy; private String hierarchy;
@Value("${firefightingsystem.detail.url}") @Value("${firefightingsystem.detail.url}")
private String ffsDetailUrl; private String ffsDetailUrl;
@Value("${firefightingsystem.equip.alarms.url}") @Value("${firefightingsystem.equip.alarms.url}")
private String ffsEquipAlarmsUrl; private String ffsEquipAlarmsUrl;
@Autowired @Autowired
private JcsFeign jcsFeign; private JcsFeign jcsFeign;
@Value("${auth-key-fire-system-build:fire_system_build_info}") @Value("${auth-key-fire-system-build:fire_system_build_info}")
private String systemBuildAuthKey; private String systemBuildAuthKey;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
ICarService carService;
@RequestMapping(value = "/getEquiplistBySystemId", method = RequestMethod.GET) @RequestMapping(value = "/getEquiplistBySystemId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据系统id查询设备列表") @ApiOperation("根据系统id查询设备列表")
...@@ -137,7 +139,6 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -137,7 +139,6 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getOneById(id); return fireFightingSystemService.getOneById(id);
} }
@RequestMapping(value = "/{systemCode}/detail", method = RequestMethod.GET) @RequestMapping(value = "/{systemCode}/detail", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过id查询消防系统信息") @ApiOperation("通过id查询消防系统信息")
...@@ -149,7 +150,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -149,7 +150,7 @@ public class FireFightingSystemController extends AbstractBaseController {
@RequestMapping(value = "/alarmSystem/info", method = RequestMethod.GET) @RequestMapping(value = "/alarmSystem/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过systemCode查询消防系统信息") @ApiOperation("通过systemCode查询消防系统信息")
public List<Map<String,Object>> getEquip(@RequestParam(required = false) String bizOrgCode, public List<Map<String, Object>> getEquip(@RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String systemCode) { @RequestParam(required = false) String systemCode) {
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
...@@ -168,7 +169,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -168,7 +169,7 @@ public class FireFightingSystemController extends AbstractBaseController {
@RequestMapping(value = "/getFireSystemEquipStatusList", method = RequestMethod.GET) @RequestMapping(value = "/getFireSystemEquipStatusList", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过systemCode、设备分类编码字符串查询消防系统信息") @ApiOperation("通过systemCode、设备分类编码字符串查询消防系统信息")
public List<Map<String,Object>> getFireSystemEquipStatusList(@RequestParam(required = false) String bizOrgCode, public List<Map<String, Object>> getFireSystemEquipStatusList(@RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String systemCode, @RequestParam(required = false) String systemCode,
@RequestParam(required = false) String categoryCodes) { @RequestParam(required = false) String categoryCodes) {
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
...@@ -184,7 +185,6 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -184,7 +185,6 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getFireSystemEquipStatusList(bizOrgCode, systemCode, categoryCodes); return fireFightingSystemService.getFireSystemEquipStatusList(bizOrgCode, systemCode, categoryCodes);
} }
/** /**
* 生产厂商列表(不分页) * 生产厂商列表(不分页)
* *
...@@ -236,7 +236,6 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -236,7 +236,6 @@ public class FireFightingSystemController extends AbstractBaseController {
return CommonResponseUtil.success(Boolean.TRUE); return CommonResponseUtil.success(Boolean.TRUE);
} }
private void refreshCount(String bizOrgCode) { private void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData(); equipmentSpecificSerivce.refreshStaData();
try { try {
...@@ -246,15 +245,6 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -246,15 +245,6 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
} }
/**
* 通过装备定义id查找性能指标
*
* @return
*/
@Autowired
IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@GetMapping(value = "/getPrefList") @GetMapping(value = "/getPrefList")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "通过装备定义id查找性能指标") @ApiOperation(httpMethod = "GET", value = "通过装备定义id查找性能指标")
...@@ -385,9 +375,8 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -385,9 +375,8 @@ public class FireFightingSystemController extends AbstractBaseController {
for (int i = 0; i < result.length; i++) { for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i])); map.put(i, Integer.valueOf(result[i]));
} }
if(equipTypeAmountPage.getCurrent()!=null&&equipTypeAmountPage.getSize()!=null) if (equipTypeAmountPage.getCurrent() != null && equipTypeAmountPage.getSize() != null) {
{ equipTypeAmountPage.setPage(new Page<>(equipTypeAmountPage.getCurrent(), equipTypeAmountPage.getSize()));
equipTypeAmountPage.setPage(new Page<>(equipTypeAmountPage.getCurrent(),equipTypeAmountPage.getSize()));
} }
if (StringUtil.isNotEmpty(equipTypeAmountPage.getEquipmentClassificationCode())) { if (StringUtil.isNotEmpty(equipTypeAmountPage.getEquipmentClassificationCode())) {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
...@@ -421,7 +410,6 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -421,7 +410,6 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
@PostMapping(value = "/iot/getEquipTypeAmount") @PostMapping(value = "/iot/getEquipTypeAmount")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表") @ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表")
...@@ -465,10 +453,6 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -465,10 +453,6 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
@PostMapping(value = "/getEquipTypeAmountCar") @PostMapping(value = "/getEquipTypeAmountCar")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表") @ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表")
...@@ -519,13 +503,22 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -519,13 +503,22 @@ public class FireFightingSystemController extends AbstractBaseController {
for (int i = 0; i < result.length; i++) { for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i])); map.put(i, Integer.valueOf(result[i]));
} }
log.info("orgCode当前值为start::" + equipTypeAmountPage.getBizOrgCode());
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if(!ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())){ if (ObjectUtils.isEmpty(equipTypeAmountPage.getBizOrgCode())) {
if (!ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())) {
equipTypeAmountPage.setBizOrgCode(reginParams.getCompany().getOrgCode()); equipTypeAmountPage.setBizOrgCode(reginParams.getCompany().getOrgCode());
}else { } else {
equipTypeAmountPage.setBizOrgCode("-1"); equipTypeAmountPage.setBizOrgCode("-1");
} }
} else {
if (!ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode()) && (equipTypeAmountPage.getBizOrgCode().startsWith(reginParams.getCompany().getOrgCode()))) {
} else {
equipTypeAmountPage.setBizOrgCode(reginParams.getCompany().getOrgCode());
}
}
log.info("orgCode当前值为::" + equipTypeAmountPage.getBizOrgCode());
if (StringUtil.isNotEmpty(equipTypeAmountPage.getEquipmentClassificationCode())) { if (StringUtil.isNotEmpty(equipTypeAmountPage.getEquipmentClassificationCode())) {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
equipmentCategoryQueryWrapper.eq("code", equipTypeAmountPage.getEquipmentClassificationCode()); equipmentCategoryQueryWrapper.eq("code", equipTypeAmountPage.getEquipmentClassificationCode());
...@@ -556,6 +549,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -556,6 +549,7 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getColaCategoryAmountCarListJxiop(0, null, equipTypeAmountPage); return fireFightingSystemService.getColaCategoryAmountCarListJxiop(0, null, equipTypeAmountPage);
} }
} }
@PostMapping(value = "/getEquipTypeAmountEqu") @PostMapping(value = "/getEquipTypeAmountEqu")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表") @ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表")
...@@ -661,7 +655,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -661,7 +655,7 @@ public class FireFightingSystemController extends AbstractBaseController {
@RequestParam(value = "controBoxBuildId", required = false) String controBoxBuildId, @RequestParam(value = "controBoxBuildId", required = false) String controBoxBuildId,
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int pageSize, @RequestParam(value = "size") int pageSize,
@RequestParam(value = "nameOrCode", required = false) String nameOrCode, @RequestParam(value = "companyId",required = false) String companyId, @RequestParam(value = "nameOrCode", required = false) String nameOrCode, @RequestParam(value = "companyId", required = false) String companyId,
@ApiParam(value = "缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是") @RequestParam(required = false) Integer isDefect @ApiParam(value = "缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是") @RequestParam(required = false) Integer isDefect
) { ) {
if (null != isDefect && 1 == isDefect) { if (null != isDefect && 1 == isDefect) {
...@@ -673,21 +667,21 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -673,21 +667,21 @@ public class FireFightingSystemController extends AbstractBaseController {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode(); bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
} }
} }
if (current > 0){ if (current > 0) {
current = (current - 1) * pageSize; current = (current - 1) * pageSize;
} }
if (StringUtil.isNotEmpty(companyId)){ if (StringUtil.isNotEmpty(companyId)) {
String token = getToken(); String token = getToken();
String appKey = getAppKey(); String appKey = getAppKey();
String product = getProduct(); String product = getProduct();
ResponseModel<JSONObject> obj = jcsFeign.getUnitById(appKey,product,token,companyId); ResponseModel<JSONObject> obj = jcsFeign.getUnitById(appKey, product, token, companyId);
JSONObject result = obj.getResult(); JSONObject result = obj.getResult();
if (result.containsKey("bizOrgCode")) { if (result.containsKey("bizOrgCode")) {
companyId = result.get("bizOrgCode").toString(); companyId = result.get("bizOrgCode").toString();
} }
} }
return fireFightingSystemService.queryEquipmenInfoAndCount(equipmentName, equipmentCode, construction, maintenance, bizOrgCode, formGroupId, current, pageSize,controBoxBuildId, companyId, nameOrCode, systemStatus); return fireFightingSystemService.queryEquipmenInfoAndCount(equipmentName, equipmentCode, construction, maintenance, bizOrgCode, formGroupId, current, pageSize, controBoxBuildId, companyId, nameOrCode, systemStatus);
} }
/** /**
...@@ -702,7 +696,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -702,7 +696,7 @@ public class FireFightingSystemController extends AbstractBaseController {
try { try {
return CommonResponseUtil.success(fireFightingSystemService.update(vo)); return CommonResponseUtil.success(fireFightingSystemService.update(vo));
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
...@@ -762,7 +756,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -762,7 +756,7 @@ public class FireFightingSystemController extends AbstractBaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public List<SpeIndexVo> selectById(Long id) { public List<SpeIndexVo> selectById(Long id) {
return fireFightingSystemService.getSpeIndex(id,1); return fireFightingSystemService.getSpeIndex(id, 1);
} }
...@@ -782,7 +776,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -782,7 +776,7 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
if (StringUtil.isNotEmpty(bizOrgCode)) { if (StringUtil.isNotEmpty(bizOrgCode)) {
QueryWrapper<FireFightingSystemEntity> qw = new QueryWrapper<>(); QueryWrapper<FireFightingSystemEntity> qw = new QueryWrapper<>();
qw.lambda().likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode).ne(FireFightingSystemEntity::getName,name); qw.lambda().likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode).ne(FireFightingSystemEntity::getName, name);
return fireFightingSystemService.list(qw); return fireFightingSystemService.list(qw);
} }
return new ArrayList<>(); return new ArrayList<>();
...@@ -999,7 +993,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -999,7 +993,7 @@ public class FireFightingSystemController extends AbstractBaseController {
RequestContext.setAppKey(amosAuth.getAppKey()); RequestContext.setAppKey(amosAuth.getAppKey());
RequestContext.setProduct(amosAuth.getProduct()); RequestContext.setProduct(amosAuth.getProduct());
RequestContext.setToken(amosAuth.getToken()); RequestContext.setToken(amosAuth.getToken());
return fireFightingSystemService.getPointTree(systemId, bizOrgCode,type); return fireFightingSystemService.getPointTree(systemId, bizOrgCode, type);
} }
@RequestMapping(value = "/{systemCode}/system/detail", method = RequestMethod.GET) @RequestMapping(value = "/{systemCode}/system/detail", method = RequestMethod.GET)
...@@ -1022,41 +1016,44 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -1022,41 +1016,44 @@ public class FireFightingSystemController extends AbstractBaseController {
/** /**
* 获取装备类型和统计值 * 获取装备类型和统计值
*
* @throws Exception * @throws Exception
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取装备类型和统计值", notes = "获取装备类型和统计值") @ApiOperation(value = "获取装备类型和统计值", notes = "获取装备类型和统计值")
@GetMapping(value = "/getEquipmentTypeAndCount/tree") @GetMapping(value = "/getEquipmentTypeAndCount/tree")
public Object getEquipmentTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception { public Object getEquipmentTypeAndCount(@RequestParam(required = false) String bizOrgCode) throws Exception {
return fireFightingSystemService.getEquipmentTypeAndCount(bizOrgCode); return fireFightingSystemService.getEquipmentTypeAndCount(bizOrgCode);
} }
/** /**
* 获取车辆类型和统计值 * 获取车辆类型和统计值
*
* @throws Exception * @throws Exception
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取车辆类型和统计值", notes = "获取车辆类型和统计值") @ApiOperation(value = "获取车辆类型和统计值", notes = "获取车辆类型和统计值")
@GetMapping(value = "/getCarTypeAndCount/tree") @GetMapping(value = "/getCarTypeAndCount/tree")
public Object getCarTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception { public Object getCarTypeAndCount(@RequestParam(required = false) String bizOrgCode) throws Exception {
return fireFightingSystemService.getCarTypeAndCount(bizOrgCode); return fireFightingSystemService.getCarTypeAndCount(bizOrgCode);
} }
/** /**
* 获取物联设备类型和统计值 * 获取物联设备类型和统计值
*
* @throws Exception * @throws Exception
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取物联设备类型和统计值", notes = "获取物联设备类型和统计值") @ApiOperation(value = "获取物联设备类型和统计值", notes = "获取物联设备类型和统计值")
@GetMapping(value = "iot/getEquipmentTypeAndCount/tree") @GetMapping(value = "iot/getEquipmentTypeAndCount/tree")
public Object iotgetEquipmentTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception { public Object iotgetEquipmentTypeAndCount(@RequestParam(required = false) String bizOrgCode) throws Exception {
return fireFightingSystemService.iotgetEquipmentTypeAndCount(bizOrgCode); return fireFightingSystemService.iotgetEquipmentTypeAndCount(bizOrgCode);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "装备信息导出", notes = "装备信息导出") @ApiOperation(value = "装备信息导出", notes = "装备信息导出")
@PostMapping(value = "/downParameter") @PostMapping(value = "/downParameter")
public void export(HttpServletResponse response,@RequestBody EquipTypeAmountPageDTO dto) { public void export(HttpServletResponse response, @RequestBody EquipTypeAmountPageDTO dto) {
List<EquipmentExportVO> list = fireFightingSystemMapper.exportEquipmentList(dto); List<EquipmentExportVO> list = fireFightingSystemMapper.exportEquipmentList(dto);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
for (EquipmentExportVO vo : list) { for (EquipmentExportVO vo : list) {
...@@ -1073,6 +1070,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -1073,6 +1070,7 @@ public class FireFightingSystemController extends AbstractBaseController {
/** /**
* 获取消防系统状态信息 * 获取消防系统状态信息
*
* @throws Exception * @throws Exception
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -1084,6 +1082,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -1084,6 +1082,7 @@ public class FireFightingSystemController extends AbstractBaseController {
/** /**
* 获取消防系统告警状态信息 * 获取消防系统告警状态信息
*
* @throws Exception * @throws Exception
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -1095,12 +1094,11 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -1095,12 +1094,11 @@ public class FireFightingSystemController extends AbstractBaseController {
/** /**
* 重置画布数据 * 重置画布数据
*
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "重置画布数据", notes = "重置画布数据") @ApiOperation(value = "重置画布数据", notes = "重置画布数据")
@GetMapping(value = "/reset/morphic") @GetMapping(value = "/reset/morphic")
public void resetMorphic(){ public void resetMorphic() {
fireFightingSystemService.resetMorphic(); fireFightingSystemService.resetMorphic();
} }
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.WlCarMileage; import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
...@@ -18,7 +19,8 @@ public interface WlCarMileageMapper extends BaseMapper<WlCarMileage> { ...@@ -18,7 +19,8 @@ public interface WlCarMileageMapper extends BaseMapper<WlCarMileage> {
Page<WlCarMileage> page(Page<WlCarMileage> page,@Param("wlCarMileage") WlCarMileage wlCarMileage, @Param("mileageParameter") Double mileageParameter); Page<WlCarMileage> page(Page<WlCarMileage> page,@Param("wlCarMileage") WlCarMileage wlCarMileage, @Param("mileageParameter") Double mileageParameter);
Double totalMileage(String iotCode); Double totalMileage(String iotCode);
@Select("select count(1) from wl_car_mileage where start_time is not null and end_time is null and iot_code = #{iotCode}")
Integer getUncompleteMileagByIotCode(String iotCode);
List<WlCarMileage> list(@Param("date") String date); List<WlCarMileage> list(@Param("date") String date);
Double getTotalTravelByIotCodeAndDate(String date,String iotCode); Double getTotalTravelByIotCodeAndDate(String date,String iotCode);
......
...@@ -62,24 +62,14 @@ public class JxiopCarIotListerServiceImpl { ...@@ -62,24 +62,14 @@ public class JxiopCarIotListerServiceImpl {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
// 用于根据topicId 也就是物联设备id 存储对应的线程来进行计时
// public static final ConcurrentHashMap<String, ThreadCar> deviceInfo = new ConcurrentHashMap();
// public static final ConcurrentHashMap<String, String> deviceLastInfo = new ConcurrentHashMap();
// @Async("equipAsyncExecutor") // @Async("equipAsyncExecutor")
public void processMessage(String topic, MqttMessage message){ public void processMessage(String topic, MqttMessage message){
logger.info("----收到物联消息::topic---------------" + topic);
logger.info("----收到物联消息::message---------------" + message);
String measurement = topic.split("/")[0]; String measurement = topic.split("/")[0];
String deviceName = topic.split("/")[1]; String deviceName = topic.split("/")[1];
//根据topic 组装iotCode //根据topic 组装iotCode
String iotCode = measurement + deviceName; String iotCode = measurement + deviceName;
//对于收到的消息进行数据转换
JSONObject jsonObject = JSONObject.parseObject(message.toString()); JSONObject jsonObject = JSONObject.parseObject(message.toString());
//通过消息存电量到扩展字段2
this.updateEquipBattery(jsonObject, iotCode);
// logger.info("当前设备信息info" + JSON.toJSONString(deviceInfo));
//判断是否有效坐标 //判断是否有效坐标
if (!ObjectUtils.isEmpty(jsonObject.get("FireCar_Longitude")) && !ObjectUtils.isEmpty(jsonObject.get("FireCar_Latitude"))) { if (!ObjectUtils.isEmpty(jsonObject.get("FireCar_Longitude")) && !ObjectUtils.isEmpty(jsonObject.get("FireCar_Latitude"))) {
//判断是否存在未结束进程,如果不存在,则进入判断插入开始节点 //判断是否存在未结束进程,如果不存在,则进入判断插入开始节点
...@@ -95,7 +85,7 @@ public class JxiopCarIotListerServiceImpl { ...@@ -95,7 +85,7 @@ public class JxiopCarIotListerServiceImpl {
wlCarMileage.setStartLatitude(startLatitude); wlCarMileage.setStartLatitude(startLatitude);
// Date startTime = UTCToCST(); // Date startTime = UTCToCST();
//时间值被mysql自动转换 //时间值被mysql自动转换
Date startTime = new Date((jsonObject.getLong("time") / 1000) * 1000); Date startTime = new Date();
wlCarMileage.setStartTime(startTime); wlCarMileage.setStartTime(startTime);
wlCarMileage.setStartName(getAddress(startLongitude, startLatitude)); wlCarMileage.setStartName(getAddress(startLongitude, startLatitude));
wlCarMileage.setStartSpeed(Double.valueOf(jsonObject.getDoubleValue("FireCar_Speed")).intValue()); wlCarMileage.setStartSpeed(Double.valueOf(jsonObject.getDoubleValue("FireCar_Speed")).intValue());
...@@ -118,39 +108,6 @@ public class JxiopCarIotListerServiceImpl { ...@@ -118,39 +108,6 @@ public class JxiopCarIotListerServiceImpl {
logger.info("插入数据到::redis"); logger.info("插入数据到::redis");
} }
} }
//如果map中已经存在该设备或者该设备有但是线程已经执行了
//存储上报上来的经纬度信息
// logger.info("----收到经纬度消息::coordinate---------------" + coordinate);
//判断缓存中是否已经存在该设备对应的倒计时线程
// if (!deviceInfo.containsKey(iotCode)) {
// logger.info("topic---------------------" + topic + "开启计时线程");
// ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, clipping_time);
// deviceInfo.put(iotCode, threadCar);
// threadCar.start();
// }
//判断缓存中是否已经存在该设备对应的经纬度信息
// if (!deviceLastInfo.containsKey(iotCode)) {
// deviceLastInfo.put(iotCode, coordinate);
// }
//如果当前时间减去上报时间大小于配置的时间并且之前没包含上报的数据
// logger.info("----收到上次经纬度消息::coordinate---------------" + deviceLastInfo.get(iotCode));
//判断本次上报的经纬度信息是否与当前上报的经纬度信息相同
// if ((!deviceLastInfo.get(iotCode).equals(coordinate))) {
// try {
// //销毁线程后移除
// deviceInfo.get(iotCode).interrupt();
// deviceInfo.remove(iotCode);
// } catch (Exception e) {
// deviceInfo.remove(iotCode);
// }
// logger.info("topic---------------------" + topic + "销毁后,开启计时线程");
// ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, clipping_time);
// deviceInfo.put(iotCode, threadCar);
// //更新车辆的最新坐标数据
// deviceLastInfo.put(iotCode, coordinate);
// threadCar.start();
// }
} }
} }
...@@ -212,6 +169,16 @@ public class JxiopCarIotListerServiceImpl { ...@@ -212,6 +169,16 @@ public class JxiopCarIotListerServiceImpl {
String waringDate = jsonObject.getString("createdTime"); String waringDate = jsonObject.getString("createdTime");
Double speed = jsonObject.getDoubleValue("fireCar_Speed") > 0 ? jsonObject.getDoubleValue("fireCar_Speed") : jsonObject.getDoubleValue("FireCar_Speed"); Double speed = jsonObject.getDoubleValue("fireCar_Speed") > 0 ? jsonObject.getDoubleValue("fireCar_Speed") : jsonObject.getDoubleValue("FireCar_Speed");
Double maxSpeed = 70.0; Double maxSpeed = 70.0;
Integer power = 0;
if (jsonObject.containsKey("additionalInformations") && jsonObject.get("additionalInformations") != null) {
JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("additionalInformations").toString());
if (jsonObject1 != null) {
JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.get("additionalInformations").toString());
if (jsonObject2 != null && jsonObject2.containsKey("power")) {
power = jsonObject2.getInteger("power");
}
}
}
// 地图推送消息 // 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode)); Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) { if (car != null && startLongitude != 0 && startLatitude != 0) {
...@@ -226,15 +193,19 @@ public class JxiopCarIotListerServiceImpl { ...@@ -226,15 +193,19 @@ public class JxiopCarIotListerServiceImpl {
sendArr.add(sendObj); sendArr.add(sendObj);
// MqttMessage mqttMessage = new MqttMessage(); // MqttMessage mqttMessage = new MqttMessage();
// mqttMessage.setPayload(sendArr.toJSONString().getBytes()); // mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude); car.setLongitude(startLongitude);
car.setLatitude(startLatitude); car.setLatitude(startLatitude);
if (!ObjectUtils.isEmpty(car.getMaxSpeed())) { if (!ObjectUtils.isEmpty(car.getMaxSpeed())) {
maxSpeed = car.getMaxSpeed(); maxSpeed = car.getMaxSpeed();
} }
car.setExtra2(power.toString());
logger.info("----------------更新车辆电池电量信息成功----------------");
iCarService.updateById(car); iCarService.updateById(car);
logger.info("车牌号::" + car.getCarNum() + "最大车速:" + maxSpeed + "当前车速::" + speed); logger.info("车牌号::" + car.getCarNum() + "最大车速:" + maxSpeed + "当前车速::" + speed);
if ((speed - maxSpeed)>0) { if ((speed - maxSpeed)>0) {
List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(new QueryWrapper<CarSpeedWarningRecord>().eq("car_num",car.getCarNum()).between("waring_date",DateUtil.offsetMinute(new Date(),10),new Date())); List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(new QueryWrapper<CarSpeedWarningRecord>().eq("car_num",car.getCarNum()).
between("waring_date",DateUtil.offsetMinute(new Date(),10),new Date()));
if(!(list.size() >0)) { if(!(list.size() >0)) {
CarSpeedWarningRecord carSpeedWarningRecord = new CarSpeedWarningRecord(); CarSpeedWarningRecord carSpeedWarningRecord = new CarSpeedWarningRecord();
carSpeedWarningRecord.setCarNum(car.getCarNum()); carSpeedWarningRecord.setCarNum(car.getCarNum());
...@@ -258,24 +229,24 @@ public class JxiopCarIotListerServiceImpl { ...@@ -258,24 +229,24 @@ public class JxiopCarIotListerServiceImpl {
} }
} }
//存储设备电量到扩展字段2 // //存储设备电量到扩展字段2
public void updateEquipBattery(JSONObject jsonObject, String iotCode) { // public void updateEquipBattery(JSONObject jsonObject, String iotCode) {
Integer power = 0; // Integer power = 0;
if (jsonObject.containsKey("additionalInformations") && jsonObject.get("additionalInformations") != null) { // if (jsonObject.containsKey("additionalInformations") && jsonObject.get("additionalInformations") != null) {
JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("additionalInformations").toString()); // JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("additionalInformations").toString());
if (jsonObject1 != null) { // if (jsonObject1 != null) {
JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.get("additionalInformations").toString()); // JSONObject jsonObject2 = JSONObject.parseObject(jsonObject1.get("additionalInformations").toString());
if (jsonObject2 != null && jsonObject2.containsKey("power")) { // if (jsonObject2 != null && jsonObject2.containsKey("power")) {
power = jsonObject2.getInteger("power"); // power = jsonObject2.getInteger("power");
} // }
} // }
} // }
//
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode)); // Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && power != 0) { // if (car != null && power != 0) {
car.setExtra2(power.toString()); // car.setExtra2(power.toString());
iCarService.updateById(car); // iCarService.updateById(car);
logger.info(iotCode + "-----------更新车辆设备电池电量成功--------"); // logger.info(iotCode + "-----------更新车辆设备电池电量成功--------");
} // }
} // }
} }
...@@ -538,7 +538,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -538,7 +538,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Override @Override
public Boolean getUncompleteMileagByIotCode(String iotCode) { public Boolean getUncompleteMileagByIotCode(String iotCode) {
Integer integer = this.count(new QueryWrapper<WlCarMileage>().select("1").lambda().eq(WlCarMileage::getIotCode, iotCode).isNull(WlCarMileage::getEndTime)); Integer integer = wlCarMileageMapper.getUncompleteMileagByIotCode(iotCode);
return integer <= 0; return integer <= 0;
} }
......
...@@ -2044,9 +2044,9 @@ ...@@ -2044,9 +2044,9 @@
<if test="equipTypeAmountPage.equipStatus!=null and equipTypeAmountPage.equipStatus!=''"> <if test="equipTypeAmountPage.equipStatus!=null and equipTypeAmountPage.equipStatus!=''">
And wlc.equip_status = #{equipTypeAmountPage.equipStatus} And wlc.equip_status = #{equipTypeAmountPage.equipStatus}
</if> </if>
<!-- <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">--> <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
<!-- And wlc.biz_org_code LIKE CONCAT('%',#{equipTypeAmountPage.bizOrgCode},'%')--> And wlc.biz_org_code LIKE CONCAT('%',#{equipTypeAmountPage.bizOrgCode},'%')
<!-- </if>--> </if>
<if test="equipTypeAmountPage.keyword!=null and equipTypeAmountPage.keyword!=''"> <if test="equipTypeAmountPage.keyword!=null and equipTypeAmountPage.keyword!=''">
And (wlc.`NAME` LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%') And (wlc.`NAME` LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')
OR wlc.car_num LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%') OR wlc.car_num LIKE CONCAT('%',#{equipTypeAmountPage.keyword},'%')
...@@ -2058,9 +2058,9 @@ ...@@ -2058,9 +2058,9 @@
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"> <if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
where s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%') where s2.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if> </if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"> <!-- <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">-->
where s2.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%') <!-- where s2.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')-->
</if> <!-- </if>-->
order by createDate DESC order by createDate DESC
</select> </select>
......
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