Browse Source

设备管理-20240827优化

thing_master
xiezw 1 year ago
parent
commit
914043d2d5
  1. 276
      application/src/main/resources/application.yml
  2. 3
      modules/equipment/src/main/java/com/thing/eq/eqmanager/dto/EqScrapDTO.java
  3. 4
      modules/equipment/src/main/java/com/thing/eq/eqmanager/mapper/IotThingBaseInfoMapper.java
  4. 1
      modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/EqScrapServiceImpl.java
  5. 6
      modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingBaseInfoServiceImpl.java
  6. 1
      modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java
  7. 10
      modules/equipment/src/main/java/com/thing/eq/tree/controller/DeviceController.java
  8. 14
      modules/equipment/src/main/resources/mapper/eqmanager/IotThingBaseInfoMapper.xml

276
application/src/main/resources/application.yml

@ -1,271 +1,541 @@
server:
port: 18080
port: 8070
servlet:
context-path: /thing
spring:
cache:
type: caffeine # 支持 redis/caffeine, 当选择redis时,要在application.yml中配置redis连接信息
main:
allow-bean-definition-overriding: true
allow-circular-references: true
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
enabled: true
messages:
encoding: UTF-8
basename: i18n/messages
data:
redis:
host: 192.168.188.185
port: 7963
password: Sddt8888!
database: 5
#项目入口签名
title:
sign: ck #企业签名
technical:
phone:
map-bucket: geojson #地图文件路径
queue:
type: in-memory # 队列类型: inMemory / disruptor
inMemory:
maxSize: 500
pollInterval: 100
disruptor:
maximumPoolSize: 8
bufferSize: 256 # 指定ringbuffer字节大小,当前值将乘1024
partitions:
hash_function_name: murmur3_128 # murmur3_32, murmur3_128 or sha256
core:
topic: queue_core
poll-interval: 1000
partitions: 30
debug: false
log-interval: 300
rabbitmq:
exchange_name:
host: localhost
port: 5673
virtual_host: /
username: guest
password: guest
automatic_recovery_enabled: false
connection_timeout: 60000
handshake_timeout: 10000
queue-properties:
core: x-max-length-bytes:1048576000;x-message-ttl:604800000
#数据源配置
database:
ts_kv:
type: postgresql # 时序数据存储类型 clickhouse/timescale/postgresql/tidb/mysql
latest:
type: postgresql # 最新数据存储类型 postgresql/timescale/mysql/tidb/clickhouse
save_maximumPoolSize: 12
# 数据源及mybatis、mybatis-flex配置
mybatis-flex:
typeAliasesPackage: com.thing.**.mapper
mapperLocations: classpath*:/mapper/**/*.xml
#本部分(Configuration)的配置都为 MyBatis 原生支持的配置,有关配置请参考:https://mybatis.org/mybatis-3/zh/configuration.html#%E8%AE%BE%E7%BD%AE%EF%BC%88settings%EF%BC%89
configuration:
mapUnderscoreToCamelCase: true
autoMappingBehavior: FULL
autoMappingUnknownColumnBehavior: NONE
cacheEnabled: true
global-config:
print-banner: true
normal-value-of-logic-delete: 0
deleted-value-of-logic-delete: 1
datasource:
pg:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://192.168.188.185:5432/thing_v2
url: jdbc:postgresql://192.168.188.184:5432/thingbi_v3
driver-class-name: org.postgresql.Driver
username: postgres
password: sddt8888
postgresql:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://192.168.188.185:5432/thing_v2
url: jdbc:postgresql://192.168.188.184:5432/thingbi_v3
driver-class-name: org.postgresql.Driver
username: postgres
password: sddt8888
sqlServer:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:sqlserver://127.0.0.1:1433;databaseName=销售生产其他
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
username: czj
password: 1234
# 区间统计计算相关配置
calculate:
am_total:
offset: 24 #当数据出现断点时,向后偏移查询多少小时
interval: 15 # 分区间统计,间隔时长(分)1/3/5/10/15/20/30/60
keys: A29,B2,C2,C6,D2,D4,E3,E4,F4,G2,G4,H2,I2,I4,K2,N2,N4,P4,Q2,R2,R4,S2,S4,F2,T2,T4,U2,U4,J2,J4,L2,A30,P2,Q4,V2,V4,A29_rush,A29_peak,A29_valley,A29_normal,A29_generate,A30_rush,A30_peak,A30_valley,A30_normal,tce_C6,tce_A29,tce_E3,CO2_A29,CO2_C6,CO2_E3,CO2_run,tce_run,tce_E3,A201,A202,A204,tce_J2
ddmmyy: #例如:每月1号0时0分 开始统计年/月/日用量
start_hh: 0 #小时/天/月/年 用量统计开始的分钟数(0-59)
start_dd: 0 #天/月/年 用量统计开始的小时(0-23)
start_mm: 1 #月/年 用量统计开始的天(1-30)
start_yy: 1 #年 用量统计开始的月份(1-12)
maximumPoolSize: 12
# 产品碳足迹 相关配置
carbon:
syncButton: false
pub:
# 公共服务侧租户标识
tenantTag: 公共服务
api:
secret: nba!w^0@01
#物管理相关配置
thing:
# token 过期时间 30天
token:
expire: 2592000
##数据解析配置
nashorn:
# JS Eval max request timeout. 0 - no timeout
max_requests_timeout: 0
# Specify thread pool size for javascript executor service
js_thread_pool_size: 120
# Specify thread pool size for JavaScript sandbox resource monitor
monitor_thread_pool_size: 12
# Maximum CPU time in milliseconds allowed for script execution
max_cpu_time: 8000
tbel:
# JS Eval max request timeout. 0 - no timeout
max_requests_timeout: 0
# Specify thread pool size for javascript executor service
thread_pool_size: 100
# Maximum allowed TBEL script execution memory
max_memory_limit_mb: 8
compiled_scripts_cache_size: 1000
aviator:
# JS Eval max request timeout. 0 - no timeout
max_requests_timeout: 0
# Specify thread pool size for javascript executor service
js_thread_pool_size: 100
# Whether to put capturing groups into passed-in env map
# when regular-expression pattern matches
put_capturing_groups_into_env: false
# Max loop count to prevent too much CPU consumption. If it's value is zero or negative, it means
# no limitation on loop count.Default is zero.
max_loop_count: 1000
#队列相关配置
transport:
# Enable/disable http/mqtt/... transport protocols (has higher priority than certain protocol's 'enabled' property)
api_enabled: true
sessions:
inactivity_timeout: 300000
report_timeout: 30000
rate_limits:
enabled: false
# 1s 10次,60s 300次
device: 10:1,300:60
# Local HTTP transport parameters
http:
# Enable/disable http transport protocol.
enabled: false
request_timeout: 60000
# Local MQTT transport parameters
mqtt:
# Enable/disable mqtt transport protocol.
enabled: false
bind_address: 0.0.0.0
bind_port: 1883
timeout: 10000
netty:
leak_detector_level: DISABLED
boss_group_thread_count: 1
worker_group_thread_count: 12
max_payload_size: 65536
so_keep_alive: false
#告警模块 配置
alarm:
event_bus:
queue_size: 50
core_pool_size: 5
max_pool_size: 20
#swagger 文档配置
springdoc:
swagger-ui:
path: /swagger-ui.html
packages-to-scan: com.thing
api-docs:
enabled: true
# knife4j的增强配置,不需要增强可以不配
knife4j:
enable: true
setting:
language: zh_cn
#数据过滤配置
filter:
rule:
enable: false
#项目状态
management:
health:
redis:
enabled: false
endpoints:
enabled-by-default: true #暴露所有端点信息
web:
exposure:
include: '*' #以web方式暴露
# 缓存管理
cache-manager:
specs:
security:
timeToLiveInMinutes: 10
maxSize: 50
thingModel:
timeToLiveInMinutes: 1440
maxSize: 10000
authThingCodes:
timeToLiveInMinutes: 1440
maxSize: 10000
thingEntity:
timeToLiveInMinutes: 1440
maxSize: 10000
thingDict:
timeToLiveInMinutes: 1440
maxSize: 10000
thingDictRelation:
timeToLiveInMinutes: 1440
maxSize: 10000
thingDetailRelation:
timeToLiveInMinutes: 1440
maxSize: 10000
thingRootRelation:
timeToLiveInMinutes: 1440
maxSize: 10000
thingCalcConfig:
timeToLiveInMinutes: 525600
maxSize: 10000
filterRule:
timeToLiveInMinutes: 525600
maxSize: 10000
alarmRule:
timeToLiveInMinutes: 525600
maxSize: 1000
alarmRuleEntity:
timeToLiveInMinutes: 525600
maxSize: 1000
alarmRuleAction:
timeToLiveInMinutes: 525600
maxSize: 1000
scriptInfo:
timeToLiveInMinutes: 525600
maxSize: 1000
mockDataConfig:
timeToLiveInMinutes: 525600
maxSize: 1000
mockDataLatestTime:
timeToLiveInMinutes: 525600
maxSize: 1000

3
modules/equipment/src/main/java/com/thing/eq/eqmanager/dto/EqScrapDTO.java

@ -1,5 +1,7 @@
package com.thing.eq.eqmanager.dto;
import com.thing.common.orm.dto.BaseDTO;
import com.thing.common.orm.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -41,5 +43,6 @@ public class EqScrapDTO implements Serializable {
private String scrapDisposal;
@Schema(description = "设备信息")
private EqInfoDTO eqInfo;
private Long tenantCode;
}

4
modules/equipment/src/main/java/com/thing/eq/eqmanager/mapper/IotThingBaseInfoMapper.java

@ -35,7 +35,7 @@ public interface IotThingBaseInfoMapper extends PowerBaseMapper<IotThingBaseInfo
void updateScrap(@Param("eqId") Long eqId, @Param("scrap") String scrap, @Param("scrapDisposal") String scrapDisposal);
List<IotThingsPartExcel> exportPartListByThingsId(@Param("params") Map<String, Object> params);
// List<IotThingsPartExcel> exportPartListByThingsId(@Param("params") Map<String, Object> params);
String getStock(@Param("eqId") Long eqId);
@ -47,5 +47,5 @@ public interface IotThingBaseInfoMapper extends PowerBaseMapper<IotThingBaseInfo
List<IotThingsExcel> exportDeviceListByThingsId(@Param("relationTypeId") Long relationTypeId, @Param("toId") Long toId, @Param("ids") Long[] ids);
List<IotThingsPartExcel> exportPartListByThingsId(@Param("relationTypeId") Long relationTypeId, @Param("toId") Long toId, @Param("ids") Long[] ids);
List<IotThingsPartExcel> exportPartListByThingsId(@Param("relationTypeId") Long relationTypeId, @Param("toId") Long toId, @Param("ids") Long[] ids,@Param("keyWord")String keyWord);
}

1
modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/EqScrapServiceImpl.java

@ -119,6 +119,7 @@ public class EqScrapServiceImpl extends BaseServiceImpl<EqScrapMapper, EqScrapEn
}
//报废未处理
dto.setScrapDisposal("0");
dto.setTenantCode(TenantContext.getTenantCode(SecurityUser.getUser()));
//更新设备报废状态设备未处理状态
iotThingBaseInfoService.updateScrap(eqId,scrap,"0");
//保存记录

6
modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingBaseInfoServiceImpl.java

@ -320,8 +320,12 @@ public class IotThingBaseInfoServiceImpl extends BaseServiceImpl<IotThingBaseInf
String aLong2 = params.get("toId").toString();
toId = new Long(aLong2);
};
String keyWord = null;
if (ObjectUtil.isNotEmpty(params.get("keyWord"))){
keyWord = params.get("keyWord").toString();
}
// ids.length
List<IotThingsPartExcel> excels = iotThingBaseInfoDao.exportPartListByThingsId(relationTypeId,toId,ids);
List<IotThingsPartExcel> excels = iotThingBaseInfoDao.exportPartListByThingsId(relationTypeId,toId,ids,keyWord);
return excels;
}

1
modules/equipment/src/main/java/com/thing/eq/eqmanager/service/impl/IotThingsServiceImpl.java

@ -187,6 +187,7 @@ public class IotThingsServiceImpl implements IotThingsService {
IotThingBaseInfoDTO baseInfoDTO = new IotThingBaseInfoDTO();
BeanUtils.copyProperties(dto,baseInfoDTO);
//***
baseInfoDTO.setId(thingEntity.getId());
baseInfoDTO.setThingId(thingEntity.getId());
baseInfoDTO.setScrap("0");
baseInfoDTO.setScrapDisposal("0");

10
modules/equipment/src/main/java/com/thing/eq/tree/controller/DeviceController.java

@ -108,10 +108,9 @@ public class DeviceController {
newList.add(iotThingsExcel);
}
}
} else{
newList.addAll(list);
}
// else{
// newList.addAll(list);
// }
ExcelUtils.exportExcel(newList,null, "设备台账", IotThingsExcel.class,"设备台账.xls",response);
}
@ -148,10 +147,9 @@ public class DeviceController {
newList.add(iotThingsPartExcel);
}
}
} else{
newList.addAll(list);
}
// else{
// newList.addAll(list);
// }
ExcelUtils.exportExcel(newList,null, "备件库", IotThingsPartExcel.class,"备件库.xls",response);
}

14
modules/equipment/src/main/resources/mapper/eqmanager/IotThingBaseInfoMapper.xml

@ -25,7 +25,7 @@
<result property="operator" column="operator"/>
</resultMap>
<update id="updateScrap">
update iot_thing_base_info set scrap=#{scrap},scrap_disposal=#{scrapDisposal} where thing_id=#{eqId}
update iot_thing_base_info set scrap=#{scrap},scrap_disposal=#{scrapDisposal} where id=#{eqId}
</update>
<delete id="deleteByThingsId">
@ -130,27 +130,25 @@
FROM
iot_thing_base_info baseinfo
LEFT JOIN iot_thing_entity things ON things.id = baseinfo.thing_id
LEFT JOIN iot_thing_relation_detail relation on relation.to_id = baseinfo.thing_id and relation.root_id = #{params.relationTypeId} and relation.from_id =#{params.toId}
LEFT JOIN iot_thing_relation_detail relation on relation.to_id = baseinfo.thing_id
LEFT JOIN iot_thing_entity things2 ON relation.from_id = things2.id
<where>
relation.root_id = #{relationTypeId}
<if test="ids !=null and ids.length >0">
baseinfo.thing_id in
<foreach collection="ids" item="thingId" open="(" close=")" separator="," >
#{thingId}
</foreach>
</if>
<if test="toId!=null and toId !=''" >
and relation.from_id =#{toId}
</if>
<if test="keyWord!=null and keyWord !=''" >
and (things.name like concat('%',#{keyWord}::varchar,'%')
or things.code like concat('%',#{keyWord}::varchar,'%')
or baseinfo.eq_code like concat('%',#{keyWord}::varchar,'%')
or baseinfo.standard like concat('%',#{keyWord}::varchar,'%'))
</if>
<if test="useDeptId!=null and useDeptId !=''" >
and baseinfo.use_dept_id =#{params.useDeptId}
</if>
<if test="eqTypeName!=null and eqTypeName !=''" >
and things2.name like concat('%',#{eqTypeName}::varchar,'%')
</if>
</where>
order by things.create_date desc
</select>

Loading…
Cancel
Save