修改边带人员数据
This commit is contained in:
parent
b0afaa6d63
commit
1fa52a68b2
|
|
@ -54,4 +54,6 @@ public class EmergencyPlanVo {
|
|||
|
||||
|
||||
private List<FileExportVo> sourceIds;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class SystemGlobal {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public final static String USER_IMAGE="人员图片";
|
||||
public final static String USER_IMAGE="人员照片";
|
||||
/**
|
||||
* 预案类型
|
||||
*/
|
||||
|
|
@ -110,6 +110,24 @@ public class SystemGlobal {
|
|||
public final static String FLOAT_TYPE="float";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 定位
|
||||
*/
|
||||
public final static String LAT_TYPE="lat";
|
||||
/**
|
||||
* 定位
|
||||
*/
|
||||
public final static String LNG_TYPE="lng";
|
||||
/**
|
||||
* 安全帽
|
||||
*/
|
||||
public final static String CAR_TYPE="plateNumber";
|
||||
/**
|
||||
* 人员闸机关键字
|
||||
*/
|
||||
public final static String PEOPLE_TYPE="personId";
|
||||
/**
|
||||
* 手环关键字
|
||||
*/
|
||||
public final static String SH_TYPE="BloodPressureAlarm";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,21 @@ public class BdController {
|
|||
}
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
/**
|
||||
* 项目信息获取
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getGtList")
|
||||
public AjaxResult getGtList(@RequestBody InterfaceParamVo param){
|
||||
try{
|
||||
List<ProjectVo> list=service.getGtList(param);
|
||||
return AjaxResult.success(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -116,4 +116,25 @@ public interface BdMapper {
|
|||
* @param selectDataVo
|
||||
*/
|
||||
void insertHistoryValue(SelectDataVo selectDataVo);
|
||||
|
||||
/**
|
||||
* 依据边带查询比那吗
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
String getBdIdByCode(DeviceInfoVo param);
|
||||
|
||||
/**
|
||||
* 一句设备id 查询编码
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
WarnInfoVo getDeviceInfo(WarnInfoVo param);
|
||||
|
||||
/**
|
||||
* 查询干他集合
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<ProjectVo> getGtList(InterfaceParamVo param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.alibaba.nacos.common.utils.UuidUtils;
|
|||
import com.securitycontrol.common.core.constant.HttpStatus;
|
||||
import com.securitycontrol.common.core.constant.SecurityConstants;
|
||||
import com.securitycontrol.common.core.domain.Result;
|
||||
import com.securitycontrol.common.core.utils.aes.AesCbcUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.ListHelper;
|
||||
import com.securitycontrol.common.core.utils.aes.StringHelper;
|
||||
import com.securitycontrol.common.core.utils.uuid.IdUtils;
|
||||
|
|
@ -19,6 +20,7 @@ import com.securitycontrol.system.api.domain.SysFile;
|
|||
import com.securitycontrol.system.api.domain.TbSourceFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.expression.spel.ast.NullLiteral;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -80,7 +82,8 @@ public class BdServiceImpl {
|
|||
String jsonString = JSON.toJSONString(result2.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
String base64 = item.getString("url");
|
||||
vo.setWorkerPhote(base64);
|
||||
vo.setIdCard(AesCbcUtils.decrypt(vo.getIdCard()));
|
||||
vo.setWorkerPhoto(base64);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -123,6 +126,10 @@ public class BdServiceImpl {
|
|||
* @return
|
||||
*/
|
||||
public AjaxResult deviceDel(InterfaceParamVo param) {
|
||||
DeviceInfoVo vo=new DeviceInfoVo();
|
||||
vo.setGatewayId(param.getGatewayId());
|
||||
String bdId=mapper.getBdIdByCode(vo);
|
||||
param.setBdId(bdId);
|
||||
int num=mapper.deviceDel(param);
|
||||
if(num>SystemGlobal.MIN_NUM){
|
||||
return AjaxResult.success(1);
|
||||
|
|
@ -131,6 +138,8 @@ public class BdServiceImpl {
|
|||
}
|
||||
|
||||
public AjaxResult deviceStatus(DeviceInfoVo param) {
|
||||
String bdId=mapper.getBdIdByCode(param);
|
||||
param.setBdId(bdId);
|
||||
int num=mapper.deviceStatus(param);
|
||||
if(num>SystemGlobal.MIN_NUM){
|
||||
return AjaxResult.success(1);
|
||||
|
|
@ -144,8 +153,15 @@ public class BdServiceImpl {
|
|||
* @return
|
||||
*/
|
||||
public AjaxResult devWarn(WarnInfoVo param) {
|
||||
param.setDevCode(param.getDeviceId());
|
||||
String bidCode=mapper.getBidCodeByBd(param);
|
||||
param.setBidCode(bidCode);
|
||||
String type=param.getEventCode().replaceAll("Alarm","").trim();
|
||||
param.setType(type);
|
||||
WarnInfoVo vo=mapper.getDeviceInfo(param);
|
||||
param.setDeviceId(vo.getDeviceId());
|
||||
param.setAttributeId(vo.getAttributeId());
|
||||
param.setId(IdUtils.getUUId());
|
||||
int num=mapper.insertWarn(param);
|
||||
if(num>SystemGlobal.MIN_NUM){
|
||||
return AjaxResult.success(1);
|
||||
|
|
@ -164,41 +180,49 @@ public class BdServiceImpl {
|
|||
String id=param.getDeviceId();
|
||||
//json数据
|
||||
String json=param.getData();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject data=JSON.parseObject(json);
|
||||
String isWarn=param.getIsWarn();
|
||||
if(StringHelper.isEmpty(isWarn)){
|
||||
isWarn=SystemGlobal.WARN_DEFEAT;
|
||||
}
|
||||
//数据源
|
||||
String sourceType=IdUtils.getUUId();
|
||||
//获取全部key
|
||||
Set<String> keys=data.keySet();
|
||||
String finalIsWarn = isWarn;
|
||||
keys.forEach(key->{
|
||||
//查询系统的id
|
||||
SelectDataVo selectDataVo=mapper.getBdDeviceDetailByIdCode(id,key);
|
||||
//查询存储值
|
||||
String value=data.getString(key);
|
||||
selectDataVo.setValue(value);
|
||||
selectDataVo.setChangeValue(getChangeValue(selectDataVo));
|
||||
selectDataVo.setSourceData(json);
|
||||
selectDataVo.setIsWarn(finalIsWarn);
|
||||
selectDataVo.setSourceType(sourceType);
|
||||
mapper.insertValue(selectDataVo);
|
||||
selectDataVo.setId(IdUtils.getUUId());
|
||||
mapper.insertHistoryValue(selectDataVo);
|
||||
insertHistoryValue(selectDataVo);
|
||||
});
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return AjaxResult.success(0);
|
||||
}
|
||||
return AjaxResult.success(1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入历史记录
|
||||
* @param selectDataVo
|
||||
*/
|
||||
public void insertHistoryValue( SelectDataVo selectDataVo){
|
||||
try{
|
||||
selectDataVo.setId(IdUtils.getUUId());
|
||||
//换成设备id
|
||||
selectDataVo.setAttributeId(selectDataVo.getDeviceId());
|
||||
mapper.insertHistoryValue(selectDataVo);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数据处理
|
||||
* @param vo
|
||||
|
|
@ -226,7 +250,18 @@ public class BdServiceImpl {
|
|||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public List<ProjectVo> getGtList(InterfaceParamVo param) {
|
||||
try{
|
||||
return mapper.getGtList(param);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ public class DeviceInfoVo {
|
|||
*/
|
||||
private String isWarn;
|
||||
|
||||
private String bdId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,4 +33,10 @@ public class InterfaceParamVo {
|
|||
*/
|
||||
private String bidNo;
|
||||
|
||||
private String gatewayId;
|
||||
|
||||
private String bdId;
|
||||
|
||||
private String bidCode;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,4 +37,10 @@ public class ProjectVo {
|
|||
*/
|
||||
private String projectType;
|
||||
|
||||
private String gtName;
|
||||
|
||||
private String gtId;
|
||||
|
||||
private String bidCode;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,4 +66,8 @@ public class SelectDataVo {
|
|||
|
||||
private String dataTime;
|
||||
|
||||
private String sourceType;
|
||||
|
||||
private String gtId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class UserInfoVo {
|
|||
/**
|
||||
* 照片数据
|
||||
*/
|
||||
private String workerPhote;
|
||||
private String workerPhoto;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ public class WarnInfoVo {
|
|||
* 边代ID
|
||||
*/
|
||||
private String gatewayId;
|
||||
/**
|
||||
* 边带设备编码
|
||||
*/
|
||||
private String devCode;
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
|
|
@ -34,4 +38,10 @@ public class WarnInfoVo {
|
|||
*/
|
||||
private String bidCode;
|
||||
|
||||
private String id;
|
||||
|
||||
private String type;
|
||||
|
||||
private String attributeId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,28 +8,28 @@
|
|||
)
|
||||
</insert>
|
||||
<insert id="insertWarn">
|
||||
insert into tb_warn (warn_time,warn_content,warn_type,bd_device,db_id,bid_code)
|
||||
value (#{eventTime},#{eventDesc},#{eventCode},#{deviceId},#{gatewayId},#{bidCode})
|
||||
insert into tb_warn (warn_id,warn_time,warn_content,warn_type,bd_device,db_id,bid_code,device_id,attribute_id,status)
|
||||
value (#{id},#{eventTime},#{eventDesc},#{eventCode},#{devCode},#{gatewayId},#{bidCode},#{deviceId},#{attributeId},'0')
|
||||
</insert>
|
||||
<insert id="insertValue">
|
||||
replace into tb_device_value (attribute_id,val,create_time,is_warn,unit,change_val)
|
||||
value(#{attributeId},#{value},#{dataTime},#{isWarn},#{unit},#{changeValue})
|
||||
</insert>
|
||||
<insert id="insertHistoryValue">
|
||||
insert into(id, bid_code, attribute_id, val, create_time, is_warn, source_type,
|
||||
source_data, change_val, unit)
|
||||
values( #{id}, #{bidCode}, #{attributeId}, #{value}, #{dataTime}, #{isWarn},'边带数据上传',
|
||||
#{sourceData},#{changeValue},#{unit}
|
||||
insert into tb_his_device_value (id, bid_code, attribute_id, val, create_time, is_warn, source_type,
|
||||
source_data, change_val, unit,gt_id)
|
||||
value( #{id}, #{bidCode}, #{attributeId}, #{value}, #{dataTime}, #{isWarn},#{sourceType},
|
||||
#{sourceData},#{changeValue},#{unit}, #{gtId}
|
||||
)
|
||||
</insert>
|
||||
<update id="bindBdPro">
|
||||
update tb_pro_bd set bid_code=#{bidNo},bind_time=now() where bd_code=#{gatewayId};
|
||||
</update>
|
||||
<update id="deviceDel">
|
||||
update tb_bd_device set del_flag=1 where device_id=#{deviceId} and bd_id=#{gatewayId}
|
||||
update tb_bd_device set del_flag=1 where bd_code=#{deviceId} and bd_id=#{bdId}
|
||||
</update>
|
||||
<update id="deviceStatus">
|
||||
update tb_bd_device set status=#{state} where device_id=#{deviceId} and bd_id=#{gatewayId}
|
||||
update tb_bd_device set status=#{state} where bd_code=#{deviceId} and bd_id=#{bdId}
|
||||
</update>
|
||||
<!--查询工程名称-->
|
||||
<select id="getProjectByName" resultType="com.securitycontrol.inter.vo.ProjectVo">
|
||||
|
|
@ -107,13 +107,29 @@
|
|||
<!--查询检测值信息-->
|
||||
<select id="getBdDeviceDetailByIdCode" resultType="com.securitycontrol.inter.vo.SelectDataVo">
|
||||
select tdd.id attributeId,tbd.device_id deviceId,tdv.unit,tdv.val historyValue,tpb.bid_code bidCode
|
||||
,tbd.bd_code deviceCode,tdd.device_code attributeCode,tdd.data_type dataType
|
||||
,tbd.bd_code deviceCode,tdd.device_code attributeCode,tdd.data_type dataType,tpb.gt_id gtId
|
||||
from tb_bd_device tbd
|
||||
left join tb_pro_bd tpb on tpb.id=tbd.bd_id
|
||||
left join tb_device_detail tdd on tdd.device_id=tbd.device_id
|
||||
left JOIN tb_device_value tdv on tdv.attribute_id=tdd.id
|
||||
where tbd.bd_code=#{id} and tdd.device_code=#{code}
|
||||
</select>
|
||||
<select id="getBdIdByCode" resultType="java.lang.String">
|
||||
select id
|
||||
from tb_pro_bd where bd_code=#{gatewayId}
|
||||
</select>
|
||||
<select id="getDeviceInfo" resultType="com.securitycontrol.inter.vo.WarnInfoVo">
|
||||
SELECT tbd.device_id deviceId,tdd.id attributeId
|
||||
FROM tb_bd_device tbd
|
||||
LEFT JOIN tb_device_detail tdd on tbd.device_id=tbd.device_id
|
||||
WHERE tbd.bd_code=#{deviceId} and tdd.device_code=#{type}
|
||||
</select>
|
||||
<!--查询干他数据-->
|
||||
<select id="getGtList" resultType="com.securitycontrol.inter.vo.ProjectVo">
|
||||
select gt_name gtName,gt_id gtId
|
||||
from t_pro_gt
|
||||
where del_flag=0 AND bid_code=#{bidCode}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -111,6 +111,11 @@
|
|||
left join tb_project pro on pro.bid_code=sw.bid_code and pro.del_flag=0
|
||||
left join t_pro_gt gt on gt.gt_id=sw.gt_id and gt.del_flag=0
|
||||
where sw.del_flag=0
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
AND ( INSTR(pro.pro_name,#{keyWord}) > 0 or
|
||||
INSTR(gt.gt_name,#{keyWord}) > 0
|
||||
)
|
||||
</if>
|
||||
GROUP BY sw.id
|
||||
</select>
|
||||
<select id="getSwData" resultType="java.lang.Integer">
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@
|
|||
left join tb_user_pro tup on su.user_id=tup.user_id and tup.del_flag=0
|
||||
LEFT JOIN tb_project pro on tup.bid_cod=pro.bid_code and pro.del_flag=0
|
||||
where su.del_flag=0 and sr.role_code=#{roleCode}
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
AND (
|
||||
INSTR(su.user_name,#{keyWord}) > 0 OR
|
||||
INSTR(su.login_name,#{keyWord}) > 0
|
||||
)
|
||||
<if test="userName!=null and userName!=''">
|
||||
AND INSTR(su.user_name,#{userName}) > 0
|
||||
</if>
|
||||
<if test="loginName!=null and loginName!=''">
|
||||
AND INSTR(su.login_name,#{loginName}) > 0
|
||||
</if>
|
||||
<if test='orgId!=null and orgId!=""'>
|
||||
AND su.org_id =#{orgId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue