Commit bab97bdc authored by maoying's avatar maoying

Merge branch 'develop_dl_3.7.0.9' into temp

parents dfa0e903 d79b844d
......@@ -21,6 +21,8 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
public List<DynamicFormInstanceDto> selectListByCalledId(Long id);
public List<DynamicFormInstanceDto> listBySeqnum(Long id);
/**
* 列转行查询
*
......
......@@ -87,6 +87,8 @@ public interface IOrgUsrService {
*/
List<FormValue> getFormValue(Long id) throws Exception;
String getPersonImg(String id) throws Exception;
/**
* 保存 机构/部门/人员基本信息
*
......
......@@ -21,6 +21,26 @@
WHERE v.instance_id = #{id}
</select>
<select id="listBySeqnum" resultType="com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto">
SELECT v.sequence_nbr sequenceNbr,
v.form_column_id formColumnId,
v.instance_id instanceId,
v.group_code groupCode,
v.field_name fieldName,
v.field_code fieldCode,
v.field_value fieldValue,
v.field_value_label fieldValueLabel,
v.rec_user_name recUserName,
v.rec_user_id recUserId,
v.rec_date recDate,
v.is_delete isDelete,
v.block block,
f.field_type fieldType
FROM cb_dynamic_form_instance v
LEFT JOIN cb_dynamic_form_column f ON f.sequence_nbr = v.form_column_id
WHERE v.instance_id = #{id} AND v.field_code = 'personImg'
</select>
<select id="listOnDutyPersonByAid" resultType="java.util.Map">
select
d.*,
......
......@@ -481,17 +481,35 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
SELECT
count( a.is_firefighters = 1 OR NULL ) AS firefightersNum,
count( a.is_firefighters = 0 OR NULL ) AS opertNum,
COUNT(( a.is_firefighters = 1 AND a.certificate_type IS NOT NULL ) OR NULL ) AS fireCer,
COUNT(( a.is_firefighters = 0 AND a.certificate_type IS NOT NULL ) OR NULL ) AS operCer
COUNT(( a.is_firefighters = 1 AND a.post_qualification IS NOT NULL ) OR NULL ) AS fireCer,
COUNT(( a.is_firefighters = 0 AND a.post_qualification IS NOT NULL ) OR NULL ) AS operCer
FROM
(
SELECT
u.sequence_nbr,
cfp.fire_management_post,
( CASE WHEN cf.sequence_nbr IS NULL THEN 0 ELSE 1 END ) AS is_firefighters,
cfp.certificate_type
cfp.post_qualification
FROM
cb_org_usr u
( SELECT
*
FROM (
SELECT
*
FROM
cb_org_usr cb
LEFT JOIN (
SELECT v.`instance_id`,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
) temp ON cb.sequence_nbr = temp.instance_id
) te where te.peopleType in('1601','1602' ) and te.is_delete = 0 ) u
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = u.sequence_nbr
AND cfp.is_delete = 0
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr
......@@ -554,7 +572,7 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
WHERE
@s > DATEDIFF( date_add( curdate(), INTERVAL - DAY ( curdate()) + 1 DAY ), CURDATE() )) t
LEFT JOIN cb_sign cs ON cs.date = t.date
LEFT JOIN cb_org_usr ou ON ou.`amos_org_id` = cs.`user_id`
LEFT JOIN cb_org_usr ou ON ou.`biz_org_code` = cs.`biz_org_code`
AND ou.is_delete = 0
LEFT JOIN idx_biz_station_info si ON si.`code` = ou.`code`
GROUP BY
......@@ -578,26 +596,24 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
<select id="getUsrSignInfoByBizOrgCode" resultType="java.util.Map">
SELECT
count( 1 ) AS total,
count( DISTINCT cs.user_id ) AS qualifiedNum,
a.qualifiedNum,
a.allNum - a.qualifiedNum AS unQualifiedNum,
(
count( 1 ) - count( DISTINCT cs.user_id )) AS unQualifiedNum,
(TRUNCATE (
abs(
count( DISTINCT cs.user_id ) /
IF
(( count( 1 ) = 0 ), 1, count( 1 ) )) * 100,
2
)) as qualifiedAbs
TRUNCATE ( abs( a.qualifiedNum / IF (( a.allNum = 0 ), 1, a.allNum )) * 100, 2 )) AS qualifiedAbs
FROM
cb_org_usr u
LEFT JOIN cb_sign cs ON cs.user_id = u.amos_org_id
WHERE
u.is_delete = 0
AND u.biz_org_type = 'PERSON'
(
SELECT
( SELECT count( DISTINCT user_id ) FROM `cb_sign` WHERE `date` = CURRENT_DATE
<if test="bizOrgCode != null and bizOrgCode != ''">
AND u.`biz_org_code` LIKE concat(#{bizOrgCode}, '%')
AND `biz_org_code` LIKE concat(#{bizOrgCode}, '%')
</if>
) AS qualifiedNum,
( SELECT count( 1 ) FROM cb_org_usr WHERE is_delete = 0 AND biz_org_type = 'PERSON'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND `biz_org_code` LIKE concat(#{bizOrgCode}, '%')
</if>
) AS allNum
) a
</select>
<select id="getUserInfoByYJYA" resultType="java.util.Map">
......
......@@ -185,12 +185,10 @@ public class Car extends BaseEntity {
private String importStr;
@TableField(exist = false)
private Integer totalTravel;
private Double totalTravel;
@TableField(exist = false)
private double longitude;
@TableField(exist = false)
private double latitude;
@TableField(exist = false)
......
......@@ -97,6 +97,11 @@ public class EquipmentSpecific extends BaseEntity {
@TableField("realtime_iot_index_update_date")
private Date realtimeIotIndexUpdateDate;
@ApiModelProperty(value = "物联设备实时状态,默认0表示正常(绿色#00ff00),1为故障类(黄色 #ffd500),2为火警类(红色#ff0000)")
@TableField("equip_status")
private String equipStatus="0";
@ApiModelProperty(value = "完整二维码")
@TableField(exist = false)
private String fullqrCode;
......
......@@ -225,4 +225,7 @@ public class EquipmentSpecificAlarm extends BaseEntity {
@TableField(value = "station_name")
private String stationName;
@ApiModelProperty(value = "消息内容")
@TableField(exist = false)
private String messageBody;
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ public class CarTravelDto {
String totalTime;
Integer totalTravel;
Double totalTravel;
List<WlCarMileageDto> records;
......
package com.yeejoin.equipmanage.common.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -61,4 +63,10 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty(value = "纬度")
private Double latitude;
@ApiModelProperty(value = "物联设备实时状态")
private Double equipStatus;
@ApiModelProperty(value = "车牌号")
private String carNum;
}
......@@ -538,8 +538,7 @@ public class OrgPersonController extends BaseController {
}
return orgUsrs;
}
/**
* 根据ids查询多人员信息
* @param ids
......@@ -557,6 +556,10 @@ public class OrgPersonController extends BaseController {
return orgUsrs;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/person/img/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "查询人员头像", notes = "根据id查询")
public ResponseModel getPersonImage(@PathVariable String id) {
return ResponseHelper.buildResponse(iOrgUsrService.getPersonImg(id));
}
}
......@@ -72,6 +72,10 @@ public class DynamicFormInstanceServiceImpl extends BaseService<DynamicFormInsta
return this.baseMapper.selectListByCalledId(instanceId);
}
public List<DynamicFormInstanceDto> listBySeqnum(Long instanceId) {
return this.baseMapper.listBySeqnum(instanceId);
}
public Long commonSave(String groupCode, Map<String, Object> model) {
Long instanceId = sequence.nextId();
List<DynamicFormColumn> columns = dynamicFormColumnService.list(new LambdaQueryWrapper<DynamicFormColumn>().eq(DynamicFormColumn::getGroupCode, groupCode));
......
......@@ -774,6 +774,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public String getPersonImg(String id) {
Long userId = Long.valueOf(id);
OrgUsr orgUsr = this.baseMapper.queryByUserId(userId);
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listBySeqnum(orgUsr.getSequenceNbr());
String str = list.get(0).getFieldValue();
return str;
}
public List<FormValue> getFormValueDetail(Long id) throws Exception {
// 动态表单数据
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
......
......@@ -69,6 +69,19 @@ public class EquipmentSpecificAlarmLogController extends AbstractBaseController
return CommonResponseUtil.success();
}
@RequestMapping(value = "/updateStatusByAlarm", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "批量消除log表所有设备告警及归位", notes = "批量消除log表所有设备告警及归位")
public ResponseModel updateStatusByAlarm() {
equipmentSpecificAlarmLogService.updateStatusByAlarm();
return CommonResponseUtil.success();
}
}
......
......@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -89,7 +90,14 @@ public class SupervisionConfigureController extends AbstractBaseController {
} else {
m.put("levelStatus", "--");
}
m.put("levelAbs", transResult.get("abs"));
m.put("abs", transResult.get("abs"));
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(m.get("volume"))) {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, BigDecimal.ROUND_HALF_UP);
m.put("levelAbs", bigDecimal + "m³ " + " (" + transResult.get("abs") + "%)");
} else {
m.put("levelAbs", transResult.get("abs"));
}
}
}
return CommonResponseUtil.success(page1);
......
......@@ -20,6 +20,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -159,7 +160,7 @@ public class WlCarMileageController {
CarTravelDto carTravelDto = new CarTravelDto();
carTravelDto.setTotal(page.getTotal());
long totalTime = 0;
int totalTravel = 0;
double totalTravel = 0;
List<WlCarMileageDto> list = new ArrayList<WlCarMileageDto>();
for (WlCarMileage wl : page.getRecords()) {
WlCarMileageDto wlCarMileageDto = new WlCarMileageDto();
......@@ -179,7 +180,9 @@ public class WlCarMileageController {
//
// String timeStr = dateFormat.format(totalTime);
carTravelDto.setTotalTime(millisToStringShort(totalTime));
carTravelDto.setTotalTravel(totalTravel);
BigDecimal two = BigDecimal.valueOf(totalTravel);
double result = two.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
carTravelDto.setTotalTravel(result);
return carTravelDto;
}
......@@ -243,4 +246,17 @@ public class WlCarMileageController {
@DateTimeFormat(pattern = "yyyy-MM") @RequestParam("date") Date date) {
return iWlCarMileageService.getCalender(id, date);
}
/**
* 里程切分
*/
@RequestMapping(value = "/mileageSegmentation", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "里程切分", notes = "里程切分")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public void mileageSegmentation() {
iWlCarMileageService.mileageSegmentation();
}
}
......@@ -66,4 +66,6 @@ public interface EquipmentIndexMapper extends BaseMapper<EquipmentIndex> {
List<EquipmentIndex> getPerfQutoaIotList(Long id);
List<String> getGruopName(Long equipmentId);
EquipmentIndex getMessage(@Param("equipmentSpecificId")Long equipmentSpecificId, @Param("equipmentIndexKey")String equipmentIndexKey);
}
......@@ -44,4 +44,6 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
Map<String, Object> unCleanAlarmEquipLink(String date, String pattern, String cleanFlag);
List<EquipmentSpecificAlarmLog> getAlarmLogInfoList(String equipmentCode, String nameKeys, String value, String isCleanTime, String bizOrgCode);
void updateStatusByAlarm(String confirmUserName, String resolveResult , String confirmTypeName);
}
......@@ -230,4 +230,6 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
List<Map<String, Object>> alarmTrend(String bizOrgCode);
List<Map<String, Object>> stationInfo();
void updateStatusByAlarm();
}
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 车量里程表 Mapper 接口
*
......@@ -13,8 +15,10 @@ import org.apache.ibatis.annotations.Param;
*/
public interface WlCarMileageMapper extends BaseMapper<WlCarMileage> {
Page<WlCarMileage> page(Page<WlCarMileage> page,@Param("wlCarMileage") WlCarMileage wlCarMileage);
Page<WlCarMileage> page(Page<WlCarMileage> page,@Param("wlCarMileage") WlCarMileage wlCarMileage, @Param("mileageParameter") Double mileageParameter);
Double totalMileage(String iotCode);
Integer totalMileage(String iotCode);
List<WlCarMileage> list(@Param("date") String date);
}
......@@ -11,7 +11,9 @@ import com.yeejoin.equipmanage.common.vo.Token;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.MarqueeDataMapper;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
......@@ -36,6 +38,7 @@ public class PumpSendMessage implements Job {
SystemctlFeign systemctlFeign = (SystemctlFeign)jobDataMap.get("systemctlFeign");
RemoteSecurityService remoteSecurityService = (RemoteSecurityService)jobDataMap.get("remoteSecurityService");
MarqueeDataMapper marqueeDataMapper = (MarqueeDataMapper)jobDataMap.get("marqueeDataMapper");
IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService = (IEquipmentSpecificAlarmLogService)jobDataMap.get("equipmentSpecificAlarmLogService");
MessageModel model = new MessageModel();
model.setSendTime(new Date());
......@@ -64,8 +67,9 @@ public class PumpSendMessage implements Job {
marqueeData.setType("漏水提醒");
marqueeData.setCreateDate(new Date());
marqueeDataMapper.insert(marqueeData);
// 稳压泵漏水告警添加告警事件信息
equipmentSpecificAlarmLogService.pressurePumpDisposeAlarm(equipmentSpecific.getId(), String.format(StringUtils.substring(recordMessage, 13), pressurePumpEnum.getTips()));
}
model.setBody(body);
model.setTitle("漏水提醒");
model.setExtras(map);
......
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentAlarmLogDto;
......@@ -61,4 +62,11 @@ public interface IEquipmentSpecificAlarmLogService extends IService<EquipmentSpe
* @return
*/
Page<EquipmentAlarmLogDto> getEquipAlarmLog(String id, String startTime, String endTime, long pageSize, long current );
void pressurePumpDisposeAlarm(Long equipmentSpecificId, String body);
void pressurePumpRestore(Long equipmentSpecificId);
void updateStatusByAlarm();
}
......@@ -19,10 +19,17 @@ public interface IWlCarMileageService extends IService<WlCarMileage> {
Page<WlCarMileage> page(Page<WlCarMileage> page, WlCarMileage wlCarMileage);
Integer totalMileage(String iotCode);
Double totalMileage(String iotCode);
List<Coordinate> getCoordinateList(long id);
Map<String,Boolean> getCalender(long id,Date date);
/**
* 里程切分(0点若里程未结束,自动切分设置结束信息,并开始新里程)
*/
void mileageSegmentation();
}
......@@ -1382,7 +1382,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public List<BuildingTreeVo> getCompanyBuildingTree(String authKey, String type) {
//1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type);
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type,"building");
//2.list to tree
List<BuildingTreeVo> buildingTreeVos = 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());
// 任务 7481
......@@ -1442,7 +1442,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
private List<BuildingTreeVo> buildBuildingAndCompanyListVos(String authKey, String type) {
private List<BuildingTreeVo> buildBuildingAndCompanyListVos(String authKey, String type, String ment) {
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
}
......@@ -1464,7 +1464,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
vo.setName(orgUsrDto.getBizOrgName());
vo.setId(orgUsrDto.getSequenceNbr());
vo.setBizOrgName(orgUsrDto.getBizOrgName());
vo.setTotal(!StringUtils.isEmpty(orgUsrDto.getBizOrgCode()) ? formInstanceMapper.queryVideoCountByBizOrgCode(orgUsrDto.getBizOrgCode()) : 0L);
//此处为公共接口 未区分导致消防建筑页面树统计错误
if(ment.equals("video")){
vo.setTotal(!StringUtils.isEmpty(orgUsrDto.getBizOrgCode()) ? formInstanceMapper.queryVideoCountByBizOrgCode(orgUsrDto.getBizOrgCode()) : 0L);
}else {
vo.setTotal(buildingTreeVos.stream().filter(b -> !ObjectUtils.isEmpty(b.getBizOrgCode()) && b.getBizOrgCode().contains(ObjectUtils.isEmpty(vo.getBizOrgCode())?"":vo.getBizOrgCode()) && "building".equals(b.getGroupType())).count());
}
return vo;
}).collect(Collectors.toList());
// 3.将建筑的bizOrgCode转换为parentId连接树 ,拼接数据准备
......@@ -1488,7 +1493,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public List<BuildingTreeVo> getBuildingVideoTreeNew() {
//1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(buildVideoAuthKey, null);
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(buildVideoAuthKey, null,"video");
List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
......
......@@ -1355,7 +1355,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
car.setImportStr(car.getIsImport() ? "进口" : "国产");
}
if (!ObjectUtils.isEmpty(car.getIotCode())) {
Integer totalTravel = iWlCarMileageService.totalMileage(car.getIotCode());
Double totalTravel = iWlCarMileageService.totalMileage(car.getIotCode());
car.setTotalTravel(totalTravel);
WlCarMileage last = iWlCarMileageService
.getOne(new LambdaQueryWrapper<WlCarMileage>().eq(WlCarMileage::getIotCode, car.getIotCode())
......
......@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
......@@ -96,7 +97,13 @@ public class EmergencyServiceImpl implements IEmergencyService {
} else {
m.put("statusDesc", "--");
}
m.put("sxyl", transResult.get("abs"));
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(m.get("volume"))) {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, BigDecimal.ROUND_HALF_UP);
m.put("sxyl", bigDecimal + "m³ " + " (" + transResult.get("abs") + "%)");
} else {
m.put("sxyl", transResult.get("abs"));
}
}
}
return Optional.ofNullable(list).orElse(Lists.newArrayList());
......@@ -131,7 +138,13 @@ public class EmergencyServiceImpl implements IEmergencyService {
} else {
m.put("status", "--");
}
m.put("abs", transResult.get("abs"));
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(m.get("volume"))) {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, BigDecimal.ROUND_HALF_UP);
m.put("abs", bigDecimal + "m³ " + " (" + transResult.get("abs") + "%)");
} else {
m.put("abs", transResult.get("abs"));
}
}
}
return page1;
......
......@@ -1699,6 +1699,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return data;
}
List<EquipmentSpecificVo> resultData = data.stream().filter(a -> a.getIotCode().equals(iotCode)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(resultData)) {
List<EquipmentSpecificVo> equipOrCarByIotCode = equipmentSpecificMapper.getEquipOrCarByIotCode(iotCode);
if (!CollectionUtils.isEmpty(equipOrCarByIotCode)) {
data.addAll(equipOrCarByIotCode);
redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data));
return equipOrCarByIotCode;
}
}
return resultData;
}
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
import com.yeejoin.equipmanage.common.utils.HttpUtil;
import com.yeejoin.equipmanage.controller.Coordinate;
import com.yeejoin.equipmanage.fegin.IotFeign;
......@@ -15,7 +16,11 @@ import com.yeejoin.equipmanage.mapper.WlCarMileageMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import org.apache.commons.lang3.ObjectUtils;
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.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -31,6 +36,7 @@ import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/**
......@@ -49,17 +55,24 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Autowired
ICarService iCarService;
@Value("${mileage.parameter}")
private Double mileageParameter;
private static final Logger log = LoggerFactory.getLogger(HttpUtil.class);
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private final String GUIDE_URL = "https://restapi.amap.com/v4/grasproad/driving?";
private final String GUIDE_ADDRESS_URL = "https://restapi.amap.com/v3/geocode/regeo?";
@Override
public Page<WlCarMileage> page(Page<WlCarMileage> page, WlCarMileage wlCarMileage) {
return this.baseMapper.page(page, wlCarMileage);
return this.baseMapper.page(page, wlCarMileage, mileageParameter);
}
@Override
public Integer totalMileage(String iotCode) {
public Double totalMileage(String iotCode) {
return this.baseMapper.totalMileage(iotCode);
}
......@@ -214,6 +227,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
List<Map<String, Object>> hasList = this.listMaps(new QueryWrapper<WlCarMileage>()
.select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode())
.between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1))
.isNotNull(WlCarMileage::getEndTime)
.ge(WlCarMileage::getTravel, 0.5)
.groupBy(WlCarMileage::getDate));
Map<String, Object> hasMap = new HashMap<>();
for (Map<String, Object> mapOne : hasList) {
......@@ -261,4 +276,140 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
return data;
}
@Override
@Scheduled(cron = "${mileage.segmentation.cron}")
public void mileageSegmentation() {
log.info("轨迹切分定时任务开始执行时间.............{}", LocalDateTime.now());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, -1);
String nowDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
log.info("轨迹切分定时任务数据过滤时间.............{}", nowDate);
List<WlCarMileage> list = this.baseMapper.list(nowDate);
log.info("需要切分数据, {}", list);
list.forEach(item -> {
Calendar calendar = Calendar.getInstance();
calendar.setTime(item.getDate());
calendar.add(Calendar.DATE, 1);
Date date = calendar.getTime();
if (!ObjectUtils.isEmpty(item.getIotCode()) && item.getIotCode().length() > 8) {
// 查询车辆上报信息
ResponseModel<List<Object>> result = iotFeign.getLiveData(item.getIotCode().substring(0, 8), item.getIotCode().substring(8),
item.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list1 = result.getResult();
// 获取最后一个有坐标的数据
JSONObject lastObj = null;
// 过滤空坐标
List<Object> filterList = new ArrayList<Object>();
for (int i = 0; i < list1.size(); i++) {
JSONObject Obj = JSONObject.parseObject(JSONObject.toJSONString(list1.get(i)));
if (Obj.get("FireCar_Longitude") != null && Obj.get("FireCar_Latitude") != null
&& Obj.getDoubleValue("FireCar_Longitude") != 0
&& Obj.getDoubleValue("FireCar_Latitude") != 0) {
filterList.add(list1.get(i));
// 获取第一个不为空的坐标
if (lastObj == null) {
lastObj = Obj;
}
}
}
if (lastObj == null) {
lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", 0.0);
lastObj.put("FireCar_Latitude", 0.0);
lastObj.put("time", 0);
lastObj.put("FireCar_Speed", 0);
}
// 当前坐标
double startLongitude = lastObj.getDoubleValue("FireCar_Longitude");
double startLatitude = lastObj.getDoubleValue("FireCar_Latitude");
// 当前速度
double v = Double.parseDouble(String.valueOf(lastObj.get("FireCar_Speed")));
int ceil = (int) Math.ceil(v);
item.setStartSpeed(ceil);
double travel = 0.0;
// 获取里程
for (int i = 0; i < filterList.size() - 1; i++) {
JSONObject start = JSONObject.parseObject(JSONObject.toJSONString(filterList.get(i)));
JSONObject end = JSONObject.parseObject(JSONObject.toJSONString(filterList.get(i + 1)));
travel += CoordinateUtil.distance(start.getDoubleValue("FireCar_Latitude"),
start.getDoubleValue("FireCar_Longitude"), end.getDoubleValue("FireCar_Latitude"),
end.getDoubleValue("FireCar_Longitude"));
}
// 查询车辆最新位置
String address = getAddress(startLongitude, startLatitude);
// 里程耗时
long takeTime = (date.getTime()) - (item.getStartTime().getTime());
// 修改0点未结束里程记录
item.setEndSpeed(ceil);
item.setEndTime(date);
item.setEndLatitude(startLatitude);
item.setEndLongitude(startLongitude);
item.setEndName(address);
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime);
this.getBaseMapper().updateById(item);
// 从0点开启新里程
item.setStartName(address);
item.setDate(date);
item.setId(null);
item.setEndSpeed(null);
item.setEndTime(null);
item.setEndLatitude(null);
item.setEndLongitude(null);
item.setEndName(null);
item.setTravel(null);
item.setTakeTime(null);
item.setStartSpeed(ceil);
item.setStartTime(item.getDate());
item.setStartLongitude(startLongitude);
item.setStartLatitude(startLatitude);
this.baseMapper.insert(item);
}
});
log.info("轨迹切分任务执行完成..............");
}
private String getAddress(double longitude, double lantitude) {
StringBuilder api = new StringBuilder(GUIDE_ADDRESS_URL);
api.append("key=").append(GUIDE_KEY).append("&location=").append(longitude).append(",").append(lantitude)
.append("&radius=1000").append("&batch=false").append("&extensions=base").append("&roadlevel=0")
.append("&batch=false");
StringBuilder res = new StringBuilder();
BufferedReader in = null;
try {
System.out.println(api.toString());
URL url = new URL(api.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
res.append(line).append("\n");
}
JSONObject object = JSONObject.parseObject(res.toString());
JSONObject regeocode = object.getJSONObject("regeocode");
String address = regeocode.getString("formatted_address");
if ("[]".equals(address)) {
address = "无效坐标";
}
res = new StringBuilder(address);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return res.toString();
}
}
......@@ -30,6 +30,7 @@ import io.swagger.annotations.ApiParam;
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.data.domain.Page;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -64,6 +65,9 @@ public class PlanTaskController extends AbstractBaseController {
@Autowired
private IRouteService routeService;
@Value("${params.isPush:false}")
private Boolean isZxj;
@Autowired
private RemoteSecurityService remoteSecurityService;
......@@ -349,16 +353,19 @@ public class PlanTaskController extends AbstractBaseController {
@ApiOperation(value = "定时执行任务表生成(<font color='blue'>release</font>)", notes = "定时执行任务表生成")
@RequestMapping(value = "/queryOmission", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse pushCarData() {
try {
RequestAttributes reqs = RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(reqs, true);
planTaskService.taskExecution(null);
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure();
if (Boolean.TRUE.equals(!isZxj)) {
try {
RequestAttributes reqs = RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(reqs, true);
planTaskService.taskExecution(null);
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure();
}
}
return CommonResponseUtil.success();
}
/**
......@@ -366,9 +373,11 @@ public class PlanTaskController extends AbstractBaseController {
*/
@Scheduled(cron = "${jobs.cron}")
public void taskMessage() {
RequestAttributes reqs = RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(reqs, true);
planTaskService.taskMessage(null);
if (Boolean.TRUE.equals(!isZxj)) {
RequestAttributes reqs = RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(reqs, true);
planTaskService.taskMessage(null);
}
}
/**
......
......@@ -8,7 +8,7 @@
</parent>
<artifactId>amos-boot-system-equip</artifactId>
<version>3.7.0.8</version>
<version>3.7.0.9</version>
<dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
......
......@@ -129,4 +129,9 @@ system.type=zd
is.open.telemetering=false
# 水池液位相关信号
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
\ No newline at end of file
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
# 江西电建-车辆里程过滤参数(单位KM)
mileage.parameter=0.5
# 江西电建-车辆里程跨天记录切分(每日0点执行)
mileage.segmentation.cron=0 0 0 * * ?
\ No newline at end of file
......@@ -752,5 +752,48 @@
alter table `wl_video` add column `video_type` varchar(100) DEFAULT 'flv' COMMENT '视频格式: 1.flv,2.rtsp,3.hls,4.other';
</sql>
</changeSet>
<changeSet author="maoy" id="202300511-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific" columnName="equip_status"/>
</not>
</preConditions>
<comment>wl_equipment_specific新增属性字段 equip_status</comment>
<sql>
ALTER TABLE `wl_equipment_specific`
ADD COLUMN `equip_status` varchar(20) NULL DEFAULT 0 COMMENT '物联设备实时状态,默认0表示正常(绿色),1为故障类(黄色),2为火警类(红色)' ;
</sql>
</changeSet>
<changeSet author="maoy" id="202300511-2">
<preConditions onFail="MARK_RAN">
<columnExists tableName="wl_equipment_specific" columnName="equip_status"/>
</preConditions>
<comment>wl_equipment_specific字段 equip_status 初始化</comment>
<sql>
UPDATE wl_equipment_specific es SET es.equip_status = IFNULL((
SELECT
(
CASE
WHEN find_in_set(
'FIREALARM',
GROUP_CONCAT(esa.type)
) > 0 THEN
'2'
ELSE
'1'
END
) s
FROM
`wl_equipment_specific_alarm` esa
WHERE
esa.equipment_specific_id = es.id
AND esa.`status` = TRUE
GROUP BY
esa.equipment_specific_id
),'0') ;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -45,7 +45,8 @@
a.sxrj,
a.`unit`,
a.minLevel,
a.maxLevel
a.maxLevel,
a.volume
FROM
wl_equipment_specific wes
LEFT JOIN (
......@@ -58,7 +59,8 @@
CASE
WHEN ( SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume' ) <![CDATA[<>]]> 0 THEN
CONCAT(( SELECT field_value FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume' ),'m³') ELSE '--m³'
END AS sxrj
END AS sxrj,
(SELECT IFNULL( wfie.field_value, 0 ) FROM wl_form_instance_equip wfie WHERE wfie.instance_id = wlesi.equipment_specific_id AND field_name = 'volume') AS volume
FROM
wl_equipment_specific_index wlesi
WHERE
......
......@@ -230,4 +230,21 @@
select equipment_detail_id from wl_equipment_specific where id = #{id})
)
</select>
<select id="getMessage" resultType="com.yeejoin.equipmanage.common.entity.EquipmentIndex">
SELECT
wei.id,
wei.equipment_id as equipmentId,
wei.name_key as perfQuotaDefinitionId,
wei.emergency_level as emergencyLevel,
wei.emergency_level_describe as emergencyLevelDescribe,
wei.emergency_level_color as emergencyLevelColor,
wei.type_code as typeCode ,
wei.name as perfQuotaName
FROM
`wl_equipment_index` wei
LEFT JOIN wl_equipment_specific_index wesi ON wei.id = wesi.equipment_index_id
WHERE
wesi.equipment_specific_id = #{equipmentSpecificId}
AND wesi.equipment_index_key = #{equipmentIndexKey}
</select>
</mapper>
......@@ -273,4 +273,17 @@
</where>
ORDER BY wesal.create_date DESC
</select>
<update id="updateStatusByAlarm">
update wl_equipment_specific_alarm_log
set confirm_type = 'BREAKDOWN',
clean_time = now() ,
confirm_date = IFNULL(wl_equipment_specific_alarm_log.confirm_date,now()),
resolve_result = #{resolveResult},
confirm_user_name = #{confirmUserName},
confirm_type_name = #{confirmTypeName},
alarm_reason = concat((select name from wl_equipment_specific WHERE id = wl_equipment_specific_alarm_log.equipment_specific_id) ,'故障引起设备报警')
WHERE
confirm_type is null or clean_time is null
</update>
</mapper>
\ No newline at end of file
......@@ -12,6 +12,11 @@
<result column="status" property="status"/>
<result column="confirmType" property="confirmType"/>
</resultMap>
<update id="updateStatusByAlarm">
update wl_equipment_specific_alarm set status = 0,recovery_date = now() where status = 1
</update>
<select id="getEquipmentSpecAlarmByIotCode"
resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm">
SELECT
......@@ -172,9 +177,8 @@
wles.equipment_detail_id AS equipDetailId,
wles.code AS fireEquipmentCode,
wles.system_id AS systemId,
if(wles.code is null,wlesal.equipment_specific_name,concat(wlesal.equipment_specific_name,'(',wles.code,')')) as
fireEquipmentName,
concat(wlesal.equipment_specific_name,wlesal.equipment_specific_index_name) as alamContent,
wlesal.equipment_specific_name as fireEquipmentName,
wlesal.equipment_specific_index_name as alamContent,
if(wlesal.confirm_type is null,'未处理','已处理') handleStatus,
IF (
wlesal.clean_time IS NOT NULL,
......
......@@ -1870,7 +1870,7 @@
wlai.`name` manufacturerName,
wlc.car_num as code,
wlc.iot_code as iotCode,
wlc.car_num,
wlc.car_num as carNum,
CASE
wlc.car_state
WHEN '1' THEN
......@@ -1976,9 +1976,10 @@
wles.create_date as createDate,
wled.code as eqtype,
wles.biz_org_code as bizOrgCode,
wles.biz_org_name as bizOrgName
wles.biz_org_name as bizOrgName,
wles.equip_status as equipStatus
FROM
(select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id from wl_equipment_specific) wles
(select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id,equip_status from wl_equipment_specific) wles
LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure wlws on wlsd.warehouse_structure_id = wlws.id
LEFT JOIN (select id,standard ,name ,area ,code, equipment_id ,manufacturer_id,is_import from wl_equipment_detail) wled on wles.equipment_detail_id = wled.id
......@@ -2093,9 +2094,10 @@
wles.create_date as createDate,
wled.code as eqtype,
wles.biz_org_code as bizOrgCode,
wles.biz_org_name as bizOrgName
wles.biz_org_name as bizOrgName,
wles.equip_status as equipStatus
FROM
(select id,qr_code,code ,iot_code ,biz_org_code ,team_id,biz_org_name,create_date ,equipment_detail_id ,system_id from wl_equipment_specific) wles
(select id,qr_code,code ,iot_code ,biz_org_code ,team_id,biz_org_name,create_date ,equipment_detail_id ,system_id ,equip_status from wl_equipment_specific) wles
LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id
LEFT JOIN wl_warehouse_structure wlws on wlsd.warehouse_structure_id = wlws.id
LEFT JOIN (select id,standard ,name ,area ,code, equipment_id ,manufacturer_id,is_import from wl_equipment_detail) wled on wles.equipment_detail_id = wled.id
......
......@@ -64,39 +64,39 @@
wles.biz_org_code like concat (#{param.bizOrgCode},'%')
</if>
</where>
UNION ALL
SELECT
equipment_specific_id id,
NULL org_code,
null fireEquipmentId,
NULL equipDetailId,
NULL fireEquipmentCode,
null systemId,
NULL fireEquipmentName,
NULL alamContent,
NULL handleStatus,
NULL cleanStatus,
NULL handleType,
NULL fireEquipmentIndexId,
NULL fireEquipmentSpecificIndexKey,
type fireEquipmentSpecificIndexName,
NULL buildId,
NULL imgUrl,
NULL fireEquipmentPointValue,
NULL typeCode,
NULL type,
date_format( create_date, '%Y-%m-%d %H:%i:%s' ) createDate,
NULL warehouseStructureName,
NULL equipmentName,
NAME equipmentSpecificName,
position,
id messageId,
message_type messageType,
is_read isRead
FROM
wl_marquee_data
WHERE
is_read = '0'
-- UNION ALL
-- SELECT
-- equipment_specific_id id,
-- NULL org_code,
-- null fireEquipmentId,
-- NULL equipDetailId,
-- NULL fireEquipmentCode,
-- null systemId,
-- NULL fireEquipmentName,
-- NULL alamContent,
-- NULL handleStatus,
-- NULL cleanStatus,
-- NULL handleType,
-- NULL fireEquipmentIndexId,
-- NULL fireEquipmentSpecificIndexKey,
-- type fireEquipmentSpecificIndexName,
-- NULL buildId,
-- NULL imgUrl,
-- NULL fireEquipmentPointValue,
-- NULL typeCode,
-- NULL type,
-- date_format( create_date, '%Y-%m-%d %H:%i:%s' ) createDate,
-- NULL warehouseStructureName,
-- NULL equipmentName,
-- NAME equipmentSpecificName,
-- position,
-- id messageId,
-- message_type messageType,
-- is_read isRead
-- FROM
-- wl_marquee_data
-- WHERE
-- is_read = '0'
ORDER BY createDate DESC
</select>
</mapper>
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace="com.yeejoin.equipmanage.mapper.WlCarMileageMapper">
<select id="totalMileage" resultType="Integer">
<select id="totalMileage" resultType="Double">
SELECT SUM(travel) FROM wl_car_mileage WHERE iot_code = #{iotCode}
</select>
......@@ -29,6 +29,7 @@
FROM wl_car_mileage
LEFT JOIN wl_car ON wl_car.iot_code = wl_car_mileage.iot_code
<where>
wl_car_mileage.travel >= #{mileageParameter}
<if test="wlCarMileage.carId != null">
AND wl_car.id = #{wlCarMileage.carId}
</if>
......@@ -43,4 +44,14 @@
</if>
</where>
</select>
<select id="list" resultType="com.yeejoin.equipmanage.common.entity.WlCarMileage">
SELECT
*
FROM
`wl_car_mileage` wcm
WHERE
wcm.date = #{date}
AND wcm.start_time IS NOT NULL
AND wcm.end_time IS NULL
</select>
</mapper>
......@@ -9,7 +9,7 @@
<artifactId>amos-boot-system-jcs</artifactId>
<version>3.7.0.8</version>
<version>3.7.0.9</version>
<dependencies>
<dependency>
......
......@@ -8,7 +8,7 @@
</parent>
<artifactId>amos-boot-system-patrol</artifactId>
<version>3.7.0.8</version>
<version>3.7.0.9</version>
<dependencies>
<dependency>
......
......@@ -95,4 +95,7 @@ emqx.max-inflight=1000
file.url=http://172.16.11.201:9000/
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑
logic=false
\ No newline at end of file
logic=false
#是否为中心级系统 true-中心级系统 false-站端系统
is.zxj=true
\ 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