Browse Source

Merge pull request 'master' (#22) from master into V3

Reviewed-on: http://git.lrdaiot.cn:9000/thing/thing_api/pulls/22
qingyuan_dev_new
夏超 2 years ago
parent
commit
d9b9837800
  1. 2
      modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmConfigServiceImpl.java
  2. 6
      modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/CarbonPubProductionReportController.java
  3. 2
      modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/CarbonPubProductionResultController.java
  4. 47
      modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java
  5. 1
      modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CarbonPubSupplierDTO.java
  6. 16
      modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitEnergyInfo.java
  7. 6
      modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitEnterpriseInfo.java
  8. 32
      modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitProductionCarbon.java
  9. 40
      modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/SupplierStatisticsDto.java
  10. 4
      modules/carbon-public/src/main/java/com/thing/carbon/pub/entity/CarbonPubSupplierEntity.java
  11. 6
      modules/carbon-public/src/main/java/com/thing/carbon/pub/mapper/PubCockpitMapper.java
  12. 7
      modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java
  13. 3
      modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/CarbonPubProductionReportServiceImpl.java
  14. 40
      modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java
  15. 140
      modules/carbon-public/src/main/resources/mapper/PubCockpitMapper.xml
  16. 39
      modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java
  17. 4
      modules/equipment/src/main/java/com/thing/eq/eqbxwx/entity/EqWxPlanEntity.java
  18. 10
      modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java
  19. 30
      modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByPlanPartEntity.java
  20. 3
      modules/equipment/src/main/java/com/thing/eq/eqby/service/impl/EqByPlanServiceImpl.java
  21. 4
      modules/equipment/src/main/java/com/thing/eq/equsergroup/controller/EqUserGroupController.java
  22. 5
      modules/equipment/src/main/java/com/thing/eq/equsergroup/dto/EqUserGroupDTO.java
  23. 44
      modules/equipment/src/main/java/com/thing/eq/equsergroup/entity/EqUserGroupEntity.java
  24. 2
      modules/equipment/src/main/java/com/thing/eq/equsergroup/service/EqUserGroupService.java
  25. 26
      modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java
  26. 2
      modules/filter-rule/src/main/java/com/thing/filter/rule/service/impl/FilterLogServiceImpl.java
  27. 2
      modules/filter-rule/src/main/java/com/thing/filter/rule/service/impl/FilterRuleServiceImpl.java
  28. 1
      modules/pom.xml
  29. 35
      modules/quartz/src/main/java/com/thing/quartz/timetask/task/ThingStatusTask.java
  30. 2
      modules/report-analysis/src/main/java/com/thing/carbon/xiaochengxu/service/impl/AppletServiceImpl.java
  31. 4
      modules/thing/src/main/java/com/thing/thing/cache/service/CacheInit.java
  32. 3
      modules/thing/src/main/java/com/thing/thing/context/service/ThingManageContextService.java
  33. 4
      modules/thing/src/main/java/com/thing/thing/context/service/impl/ThingManageContextServiceImpl.java
  34. 2
      modules/thing/src/main/java/com/thing/thing/dictRelation/service/impl/IotThingDictRelationServiceImpl.java
  35. 10
      modules/thing/src/main/java/com/thing/thing/entity/controller/IotThingEntityController.java
  36. 4
      modules/thing/src/main/java/com/thing/thing/entity/service/IotThingEntityService.java
  37. 13
      modules/thing/src/main/java/com/thing/thing/entity/service/impl/IotThingEntityServiceImpl.java
  38. 31
      modules/visual-design/pom.xml

2
modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmConfigServiceImpl.java

@ -62,7 +62,7 @@ public class AlarmConfigServiceImpl extends BaseServiceImpl<AlarmConfigMapper, A
params.put("name",code);
params.remove("type");
Optional<List<ObjectNode>> optionalList = thingManageContextService.findViewAllEntity(null, null, code, type, UserContext.getRealTenantCode(),
null, null, null, null, TemplateMark.NO.getValue());
null, null, null, null, TemplateMark.NO.getValue(),null);
if(optionalList.isPresent()){
wrapper.in( AlarmConfigEntity::getThingId, optionalList.get().stream().map(
s-> s.get(CacheNameEnum.EntityField.THING_ENTITY_ID.getField()).asLong()

6
modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/CarbonPubProductionReportController.java

@ -20,11 +20,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 产品碳足迹报告
@ -68,6 +70,10 @@ public class CarbonPubProductionReportController {
@Parameter(name = "tenantCode", description = "租户编码"),
})
public Result<List<CarbonPubProductionReportDTO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
Long tenantCode = MapUtils.getLong(params, "tenantCode");
if (Objects.isNull(tenantCode)) {
return new Result<List<CarbonPubProductionReportDTO>>().ok(List.of());
}
List<CarbonPubProductionReportDTO> list = carbonPubProductionReportService.listAs(params, CarbonPubProductionReportDTO.class);
return new Result<List<CarbonPubProductionReportDTO>>().ok(list);
}

2
modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/CarbonPubProductionResultController.java

@ -45,7 +45,7 @@ public class CarbonPubProductionResultController {
public Result<List<CarbonPubLibRecordSimpleAgg>> getSimpleAggResult(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
String tenantCodes = MapUtils.getString(params, "tenantCodes");
if (StringUtils.isBlank(tenantCodes)) {
throw new IllegalArgumentException("租户编码不能为空");
return new Result<List<CarbonPubLibRecordSimpleAgg>>().ok(Collections.emptyList());
}
List<Long> tenantCodeList =
Arrays.stream(tenantCodes.split(",")).map(s -> Long.parseLong(s.trim())).toList();

47
modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java

@ -1,22 +1,28 @@
package com.thing.carbon.pub.controller;
import com.thing.carbon.pub.dto.CarbonPubSupplierProduct;
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo;
import com.thing.carbon.pub.dto.CockpitStatisticsDto;
import com.thing.carbon.pub.dto.SupplierStatisticsDto;
import com.thing.carbon.pub.service.CarbonPubSupplierService;
import com.thing.carbon.pub.service.PubCockpitService;
import com.thing.carbontrack.screen.dto.SimpleProductionCarbon;
import com.thing.common.core.web.response.PageData;
import com.thing.common.core.web.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 企业注册
* 公共服务侧大屏看板
*
* @author xc
* @since 3.0 2024-07-09
@ -30,6 +36,9 @@ public class PubCockpitController {
@Autowired
private PubCockpitService pubCockpitService;
@Autowired
private CarbonPubSupplierService carbonPubSupplierService;
@GetMapping("list")
@Operation(summary="左上角和地图得企业列表")
public Result<List<CockpitEnterpriseInfo>> list(){
@ -44,5 +53,35 @@ public class PubCockpitController {
return new Result<CockpitStatisticsDto>().ok(statisticsDto);
}
@GetMapping("productList")
@Operation(summary="右上角。企业产品碳足迹列表")
@Parameters({
@Parameter(name = "id", description = "左侧列表选中得企业id", required = true),
})
public Result<PageData<CarbonPubSupplierProduct>> detailProduct(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
PageData<CarbonPubSupplierProduct> data = carbonPubSupplierService.handleDetailProduct(params);
return new Result<PageData<CarbonPubSupplierProduct>>().ok(data);
}
@GetMapping("supplierStatistics")
@Operation(summary="左下角,企业八个统计")
@Parameters({
@Parameter(name = "code", description = "左侧列表选中得企业code", required = true),
})
public Result<SupplierStatisticsDto> supplierStatistics(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
SupplierStatisticsDto data = pubCockpitService.supplierStatistics(params);
return new Result<SupplierStatisticsDto>().ok(data);
}
@GetMapping("trend/{productId}")
@Operation(summary = "右下角,产品碳足迹趋势,传入右上角选中的产品id")
public Result<List<SimpleProductionCarbon>> getCarbonTrend(
@PathVariable("productId") Long productId) {
List<SimpleProductionCarbon> data = pubCockpitService.getCarbonTrend(productId);
return new Result<List<SimpleProductionCarbon>>().ok(data);
}
}

1
modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CarbonPubSupplierDTO.java

@ -48,4 +48,5 @@ public class CarbonPubSupplierDTO implements Serializable {
@Schema(description = "更新时间")
private Long updateDate;
private String supplierJson;
}

16
modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitEnergyInfo.java

@ -0,0 +1,16 @@
package com.thing.carbon.pub.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "能源数据实时采集-数采模块 数采设备类型名称 电,天然气等")
public class CockpitEnergyInfo {
@Schema(description = "数采设备类型")
private String name;
@Schema(description = "数量")
private Long number;
}

6
modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitEnterpriseInfo.java

@ -11,9 +11,13 @@ import java.math.BigDecimal;
@Data
@Schema(description = "国网侧驾驶舱企业信息")
public class CockpitEnterpriseInfo {
@Schema(description = "企业id,供应商id")
private Long id;
@Schema(description = "企业名称")
private String name;
@Schema(description = "企业编码")
@Schema(description = "企业编码 也就是tenant_code")
private String code;
@Schema(description = "企业区域id")
private String regionId;

32
modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitProductionCarbon.java

@ -0,0 +1,32 @@
package com.thing.carbon.pub.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author siyang
* @date 2024/6/27 09:38
* @description 简单产品碳足迹
*/
@Data
@Schema(description = "简单产品碳足迹")
public class CockpitProductionCarbon {
@Schema(description = "产品id")
private Long productId;
@Schema(description = "产品名称")
private String productName;
@Schema(description = "批次号")
private String prCode;
@Schema(description = "碳足迹值")
private BigDecimal carbon;
@Schema(description = "工单日期")
private Date prDate;
}

40
modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/SupplierStatisticsDto.java

@ -0,0 +1,40 @@
package com.thing.carbon.pub.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "国网侧驾驶舱左下角 企业统计信息")
public class SupplierStatisticsDto {
@Schema(description = "碳排因子库调用次数")
private Long carbonLibCount;
@Schema(description = "工艺模型调用次数")
private Long processCount;
@Schema(description = "计算结果共享条数")
private Long computedShareCount;
@Schema(description = "工艺模型共享条数")
private Long processShareCount;
@Schema(description = "能源数据实时采集-数采模块")
private List<CockpitEnergyInfo> cockpitEnergyInfo;
@Schema(description = "生产系统对接套数")
private Long systemCount= 1L;
@Schema(description = "对接数据量条数")
private Long dataCount;
}

4
modules/carbon-public/src/main/java/com/thing/carbon/pub/entity/CarbonPubSupplierEntity.java

@ -50,4 +50,8 @@ public class CarbonPubSupplierEntity implements Serializable {
* 剩余积分
*/
private Integer points;
private String supplierJson;
}

6
modules/carbon-public/src/main/java/com/thing/carbon/pub/mapper/PubCockpitMapper.java

@ -2,6 +2,8 @@ package com.thing.carbon.pub.mapper;
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo;
import com.thing.carbon.pub.dto.CockpitEnergyInfo;
import com.thing.carbontrack.screen.dto.SimpleProductionCarbon;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -10,4 +12,8 @@ import java.util.List;
@Mapper
public interface PubCockpitMapper {
List<CockpitEnterpriseInfo> cockpitEnterpriseInfoList();
List<CockpitEnergyInfo> supplierStatistics(Long tenantCode);
List<SimpleProductionCarbon> getCarbonTrend(Long productId);
}

7
modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java

@ -2,8 +2,11 @@ package com.thing.carbon.pub.service;
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo;
import com.thing.carbon.pub.dto.CockpitStatisticsDto;
import com.thing.carbon.pub.dto.SupplierStatisticsDto;
import com.thing.carbontrack.screen.dto.SimpleProductionCarbon;
import java.util.List;
import java.util.Map;
public interface PubCockpitService {
@ -11,4 +14,8 @@ public interface PubCockpitService {
List<CockpitEnterpriseInfo> cockpitEnterpriseInfoList();
CockpitStatisticsDto statistics();
SupplierStatisticsDto supplierStatistics(Map<String, Object> params);
List<SimpleProductionCarbon> getCarbonTrend(Long productId);
}

3
modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/CarbonPubProductionReportServiceImpl.java

@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.stereotype.Service;
@ -76,7 +77,7 @@ public class CarbonPubProductionReportServiceImpl extends BaseServiceImpl<Carbon
.leftJoin(CARBON_PUB_PRODUCTION_REPORT_CONFIG_ENTITY)
.on(CARBON_PUB_PRODUCTION_REPORT_ENTITY.CONFIG_ID.eq(CARBON_PUB_PRODUCTION_REPORT_CONFIG_ENTITY.ID))
.eq(CarbonPubProductionReportEntity::getId, id, Objects::nonNull)
.in(CarbonPubProductionReportEntity::getProductId, productIds, CollectionUtils.isNotEmpty(productIds))
.in(CarbonPubProductionReportEntity::getProductId, productIds, ObjectUtils.isNotEmpty(productIds))
.ge(CarbonPubProductionReportEntity::getCreateDate, startTs, Objects::nonNull)
.le(CarbonPubProductionReportEntity::getCreateDate, endTs, Objects::nonNull)
.eq(CarbonPubProductionReportEntity::getTenantCode, tenantCode, Objects::nonNull);

40
modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java

@ -1,17 +1,28 @@
package com.thing.carbon.pub.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.mybatisflex.core.query.QueryWrapper;
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo;
import com.thing.carbon.pub.dto.CockpitStatisticsDto;
import com.thing.carbon.pub.dto.CockpitEnergyInfo;
import com.thing.carbon.pub.dto.SupplierStatisticsDto;
import com.thing.carbon.pub.entity.CarbonPubSupplierEntity;
import com.thing.carbon.pub.mapper.*;
import com.thing.carbon.pub.service.PubCockpitService;
import com.thing.carbontrack.screen.dto.SimpleProductionCarbon;
import com.thing.common.core.web.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
@Service
@ -82,4 +93,33 @@ public class PubCockpitServiceImpl implements PubCockpitService {
return dto;
}
@Override
public SupplierStatisticsDto supplierStatistics(Map<String, Object> params) {
SupplierStatisticsDto dto = new SupplierStatisticsDto();
Long tenantCode = MapUtils.getLong(params, "code");
List<CockpitEnergyInfo> infoList = pubCockpitMapper.supplierStatistics(tenantCode);
infoList.forEach(temp -> {
switch (temp.getName()) {
case "消费碳足迹因子" -> dto.setCarbonLibCount(temp.getNumber());
case "过程数据共享", "结果数据共享" -> dto.setProcessShareCount(temp.getNumber());
case "模型共享" -> dto.setComputedShareCount(temp.getNumber());
case "模型点击" -> dto.setProcessCount(temp.getNumber());
}
});
Long carbonCount = carbonPubProductionResultMapper.selectCountByQuery(QueryWrapper.create().eq("tenant_code", tenantCode));
dto.setDataCount(carbonCount);
CarbonPubSupplierEntity entity = carbonPubSupplierMapper.selectOneByQuery(QueryWrapper.create().eq("code", tenantCode));
String json = entity.getSupplierJson();
dto.setCockpitEnergyInfo(JSONArray.parseArray(json, CockpitEnergyInfo.class));
return dto;
}
@Override
public List<SimpleProductionCarbon> getCarbonTrend(Long productId) {
return pubCockpitMapper.getCarbonTrend(productId);
}
}

140
modules/carbon-public/src/main/resources/mapper/PubCockpitMapper.xml

@ -5,6 +5,7 @@
<select id="cockpitEnterpriseInfoList" resultType="com.thing.carbon.pub.dto.CockpitEnterpriseInfo">
SELECT
cps.id,
cps.NAME,
cps.code,
cps.region_id,
@ -35,5 +36,144 @@
) t3 ON cps.code = t3.tenant_code
LEFT JOIN sys_tenant_detail td on cps.code = td.id
</select>
<select id="supplierStatistics" resultType="com.thing.carbon.pub.dto.CockpitEnergyInfo">
SELECT
"type" AS NAME,
"count" ( TYPE ) AS NUMBER
FROM
carbon_pub_points_logs
WHERE
tenant_code =#{tenantCode}
GROUP BY
TYPE
</select>
<select id="getCarbonTrend" resultType="com.thing.carbon.pub.dto.CockpitProductionCarbon">
SELECT
*
FROM
(
SELECT
product_id,
product_name,
pr_code,
finish_time AS pr_date,
type1_carbon_avg + type1_usage_avg + type2_carbon_avg + type3_carbon_avg + type4_carbon_avg + type5_carbon_avg + type6_carbon_avg + type6_fq_carbon_avg AS carbon,
rk
FROM
(
SELECT
product_id,
product_name,
pr_code,
finish_time,
SUM ( type1_carbon_avg ) AS type1_carbon_avg,
SUM ( type1_usage_avg ) AS type1_usage_avg,
SUM ( type2_carbon_avg ) AS type2_carbon_avg,
SUM ( type3_carbon_avg ) AS type3_carbon_avg,
SUM ( type4_carbon_avg ) AS type4_carbon_avg,
SUM ( type5_carbon_avg ) AS type5_carbon_avg,
SUM ( type6_carbon_avg ) AS type6_carbon_avg,
SUM ( type6_fq_carbon_avg ) AS type6_fq_carbon_avg,
ROW_NUMBER ( ) OVER ( PARTITION BY product_id ORDER BY finish_time DESC ) AS rk
FROM
(
SELECT
product_id,
product_name,
pr_code,
carbon_type,
finish_time,
CASE
carbon_type
WHEN '1' THEN
carbon_avg ELSE 0
END AS type1_carbon_avg,
CASE
carbon_type
WHEN '1' THEN
usage_avg ELSE 0
END AS type1_usage_avg,
CASE
carbon_type
WHEN '2' THEN
carbon_avg ELSE 0
END AS type2_carbon_avg,
CASE
carbon_type
WHEN '3' THEN
carbon_avg ELSE 0
END AS type3_carbon_avg,
CASE
carbon_type
WHEN '4' THEN
carbon_avg ELSE 0
END AS type4_carbon_avg,
CASE
carbon_type
WHEN '5' THEN
carbon_avg ELSE 0
END AS type5_carbon_avg,
CASE
carbon_type
WHEN '6' THEN
carbon_avg ELSE 0
END AS type6_carbon_avg,
CASE
carbon_type
WHEN '6' THEN
fq_carbon_avg ELSE 0
END AS type6_fq_carbon_avg
FROM
(
SELECT
product_id AS product_id,
product_name AS product_name,
pr_code,
carbon_type,
finish_time,
SUM ( carbon_avg ) AS carbon_avg,
SUM ( usage_avg ) AS usage_avg,
SUM ( fq_carbon_avg ) AS fq_carbon_avg
FROM
carbon_pub_production_result
where product_id = #{productId}
GROUP BY
product_id,
product_name,
pr_code,
finish_time,
carbon_type
) AS t1
) AS t2
GROUP BY
product_id,
product_name,
pr_code,
finish_time
) AS t3
) AS t4
where product_id = #{productId}
ORDER BY
pr_date DESC
LIMIT 10
</select>
</mapper>

39
modules/equipment/src/main/java/com/thing/eq/eqbxwx/controller/EqWxPlanController.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.thing.common.core.annotation.LogOperation;
import com.thing.common.core.constants.Constant;
import com.thing.common.core.exception.SysException;
import com.thing.common.core.utils.ConvertUtils;
import com.thing.common.core.utils.excel.ExcelUtils;
import com.thing.common.core.validator.AssertUtils;
import com.thing.common.core.validator.ValidatorUtils;
@ -124,21 +125,23 @@ public class EqWxPlanController {
List<EqWxInfoRes> resultList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(pageData)) {
for (EqWxPlanDTO data : pageData) {
EqWxInfoRes eqWxInfoRes = new EqWxInfoRes();
BeanUtils.copyProperties(data, eqWxInfoRes);
EqWxInfoRes eqWxInfoRes = ConvertUtils.sourceToTarget(data, EqWxInfoRes.class);
//调整
String userId = data.getWxUser();
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(new Long(s));
} List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";
for (String s : planUserName) {
name+=s+",";
if(StringUtils.isNotBlank(userId)){
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(Long.parseLong(s));
}
List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";
for (String s : planUserName) {
name+=s+",";
}
name = name.substring(0, name.length() - 1);
eqWxInfoRes.setWxUseText(name);
}
name = name.substring(0, name.length() - 1);
eqWxInfoRes.setWxUseText(name);
// 查询设备信息
ThingDTO thingDTO = new ThingDTO();
if (storeThingsMap.containsKey(data.getThingId())) {
@ -153,7 +156,10 @@ public class EqWxPlanController {
if (storeEqBxMap.containsKey(data.getEqBxId())) {
eqWxInfoRes.setBxInfo(storeEqBxMap.get(data.getEqBxId()));
} else {
EqBxEntity eqBxEntity = eqBxService.getById(data.getEqBxId());
EqBxEntity eqBxEntity = null;
if(!Objects.isNull(data.getEqBxId())){
eqBxEntity = eqBxService.getById(data.getEqBxId());
}
if (!Objects.isNull(eqBxEntity)) {
BxInfoDTO bxInfoDTO = new BxInfoDTO();
BeanUtils.copyProperties(eqBxEntity, bxInfoDTO);
@ -163,13 +169,10 @@ public class EqWxPlanController {
storeEqBxMap.put(data.getEqBxId(), null);
}
}
resultList.add(eqWxInfoRes);
}
}
PageData<EqWxInfoRes> page = new PageData<>(resultList, CollectionUtil.isEmpty(resultList) ? 0 : pageList.getTotal());
return new Result<PageData<EqWxInfoRes>>().ok(page);
}
@ -195,7 +198,7 @@ public class EqWxPlanController {
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(new Long(s));
longs.add(Long.parseLong(s));
} List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";
for (String s : planUserName) {
@ -355,7 +358,7 @@ public class EqWxPlanController {
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(new Long(s));
longs.add(Long.parseLong(s));
} List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";
for (String s : planUserName) {

4
modules/equipment/src/main/java/com/thing/eq/eqbxwx/entity/EqWxPlanEntity.java

@ -2,7 +2,9 @@ package com.thing.eq.eqbxwx.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -26,7 +28,7 @@ public class EqWxPlanEntity implements Serializable {
/**
* id
*/
@Id
@Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId)
private Long id;
/**
* 维修班组

10
modules/equipment/src/main/java/com/thing/eq/eqbxwx/service/impl/EqWxPlanServiceImpl.java

@ -23,6 +23,7 @@ import com.thing.eq.eqpartrecord.service.EqPartRecordService;
import com.thing.eq.utils.SerialNumberUnit;
import com.thing.sys.biz.entity.SysDictDataEntity;
import com.thing.sys.security.context.TenantContext;
import com.thing.sys.security.context.UserContext;
import com.thing.sys.security.domain.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@ -258,8 +259,13 @@ public class EqWxPlanServiceImpl extends BaseServiceImpl<EqWxPlanMapper, EqWxPla
}
lastNo = SerialNumberUnit.generateNumber("WX", eqWxPlanEntity.getWxNo());
dto.setWxNo(lastNo);
saveDto(dto);
BeanUtils.copyProperties(dto, eqWxPlanEntity);
eqWxPlanEntity.setTenantCode(UserContext.getRealTenantCode());
eqWxPlanEntity.setCreateDate(new Date());
eqWxPlanEntity.setUpdateDate(new Date());
eqWxPlanEntity.setCreator(SecurityUser.getUserId());
save(eqWxPlanEntity);
if (CollectionUtil.isEmpty(replacementDTOS)) {
continue;
}
@ -294,7 +300,6 @@ public class EqWxPlanServiceImpl extends BaseServiceImpl<EqWxPlanMapper, EqWxPla
eqWxReplacementService.saveDto(ConvertUtils.sourceToTarget(replacementDTOS, EqWxReplacementEntity.class));
}
// 重新赋值备件的各个使用总数
if ("2".equals(dto.getWxStatus()) && CollectionUtil.isNotEmpty(replacementDTOS)) {
List<ReplaceMentUseDTO> replaceMentUseDTOList = new ArrayList<>();
@ -307,7 +312,6 @@ public class EqWxPlanServiceImpl extends BaseServiceImpl<EqWxPlanMapper, EqWxPla
replaceMentUseDTOList.add(replaceMentUseDTO);
}
updateStock(replaceMentUseDTOList);
}
}

30
modules/equipment/src/main/java/com/thing/eq/eqby/entity/EqByPlanPartEntity.java

@ -1,11 +1,11 @@
package com.thing.eq.eqby.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import com.thing.common.orm.entity.BaseDateEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.io.Serial;
/**
* 部件使用记录
@ -16,34 +16,16 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@Table("eq_by_plan_part")
public class EqByPlanPartEntity {
public class EqByPlanPartEntity extends BaseDateEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@Id
private Long id;
/**
* 更换数量
*/
private String useCount;
/**
* 创建人
*/
private Long creator;
/**
* 创建时间
*/
private Date createDate;
/**
* 更新人
*/
private Long updater;
/**
* 更新时间
*/
private Date updateDate;
/**
* 设备保养计划id
*/

3
modules/equipment/src/main/java/com/thing/eq/eqby/service/impl/EqByPlanServiceImpl.java

@ -30,6 +30,7 @@ import com.thing.sys.biz.service.SysDictDataService;
import com.thing.sys.biz.service.SysDictTypeService;
import com.thing.sys.biz.service.SysUserService;
import com.thing.sys.security.context.TenantContext;
import com.thing.sys.security.context.UserContext;
import com.thing.sys.security.domain.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@ -142,7 +143,7 @@ public class EqByPlanServiceImpl extends BaseServiceImpl<EqByPlanMapper, EqByPla
dto.setByStatus("0");
dto.setPlanStatus("0");
dto.setIsRemind("0");
dto.setTenantCode(SecurityUser.getTenantCode());
dto.setTenantCode(UserContext.getRealTenantCode());
// 第一个单号用lastNo
if (Objects.isNull(eqByPlanEntity)) {
eqByPlanEntity = new EqByPlanEntity();

4
modules/equipment/src/main/java/com/thing/eq/equsergroup/controller/EqUserGroupController.java

@ -104,9 +104,7 @@ public class EqUserGroupController {
throw new SysException("用户组名称不可重复");
}
}
eqUserGroupService.saveDto(dto);
eqUserGroupService.save(dto);
return new Result();
}

5
modules/equipment/src/main/java/com/thing/eq/equsergroup/dto/EqUserGroupDTO.java

@ -4,7 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 用户组
@ -26,11 +25,11 @@ public class EqUserGroupDTO implements Serializable {
@Schema(description = "创建人")
private Long creator;
@Schema(description = "创建时间")
private Date createDate;
private Long createDate;
@Schema(description = "更新人")
private Long updater;
@Schema(description = "更新时间")
private Date updateDate;
private Long updateDate;
@Schema(description = "部门id")
private Long deptId;
@Schema(description = "租户code")

44
modules/equipment/src/main/java/com/thing/eq/equsergroup/entity/EqUserGroupEntity.java

@ -3,9 +3,12 @@ package com.thing.eq.equsergroup.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import com.thing.common.orm.entity.BaseDateEntity;
import com.thing.common.orm.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.util.Date;
/**
@ -17,14 +20,12 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@Table("eq_user_group")
public class EqUserGroupEntity {
public class EqUserGroupEntity extends BaseDateEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@Id
private Long id;
/**
* usrid,多个隔开
*/
@ -33,34 +34,19 @@ public class EqUserGroupEntity {
* 用户组名
*/
private String name;
/**
* 创建人
*/
private Long creator;
/**
* 创建时间
*/
private Date createDate;
/**
* 更新人
*/
private Long updater;
/**
* 更新时间
*/
private Date updateDate;
/**
* 部门id
*/
* 部门id
*/
private Long deptId;
/**
* 租户code
*/
* 租户code
*/
private Long tenantCode;
}

2
modules/equipment/src/main/java/com/thing/eq/equsergroup/service/EqUserGroupService.java

@ -19,6 +19,8 @@ import java.util.Map;
*/
public interface EqUserGroupService extends IBaseService<EqUserGroupEntity> {
void save(EqUserGroupDTO dto);
EqUserGroupDTO getById(Long id);
List<EqUserGroupDTO> getList(Map<String, Object> params);

26
modules/equipment/src/main/java/com/thing/eq/equsergroup/service/impl/EqUserGroupServiceImpl.java

@ -1,7 +1,9 @@
package com.thing.eq.equsergroup.service.impl;
import cn.hutool.core.map.MapUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.thing.common.core.utils.ConvertUtils;
import com.thing.common.core.web.response.PageData;
import com.thing.common.orm.service.impl.BaseServiceImpl;
import com.thing.eq.equsergroup.dto.EqUserGroupDTO;
@ -38,15 +40,15 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl<EqUserGroupMapper, E
@Override
public PageData<EqUserGroupDTO> page(Map<String, Object> params) {
Page<EqUserGroupEntity> page = getPage(params);
params.put("tenantCode", TenantContext.getTenantCode(SecurityUser.getUser()));
List<EqUserGroupDTO> eqUserGroupDTOs = mapper.getListData(params);
for (EqUserGroupDTO eqUserGroupDTO : eqUserGroupDTOs) {
Integer page = MapUtil.getInt(params, "page", 1);
Integer limit = MapUtil.getInt(params, "limit", 10);
Page<EqUserGroupDTO> pageList = mapper.paginateAs(page, limit, getWrapper(params),EqUserGroupDTO.class);
for (EqUserGroupDTO eqUserGroupDTO : pageList.getRecords()) {
String userId = eqUserGroupDTO.getUserId();
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(new Long(s));
longs.add(Long.parseLong(s));
}
List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";
@ -56,7 +58,15 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl<EqUserGroupMapper, E
name = name.substring(0, name.length() - 1);
eqUserGroupDTO.setUserIdStr(name);
}
return new PageData<>(eqUserGroupDTOs, eqUserGroupDTOs.size());
return new PageData<>(pageList.getRecords(), pageList.getTotalRow());
}
@Override
public void save(EqUserGroupDTO dto) {
EqUserGroupEntity eqUserGroupEntity = ConvertUtils.sourceToTarget(dto, EqUserGroupEntity.class);
eqUserGroupEntity.setTenantCode(TenantContext.getTenantCode(SecurityUser.getUser()));
eqUserGroupEntity.setDeptId(TenantContext.getCompanyId(SecurityUser.getUser()));
mapper.insert(eqUserGroupEntity);
}
@Override
@ -67,7 +77,7 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl<EqUserGroupMapper, E
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(new Long(s));
longs.add(Long.parseLong(s));
}
List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";
@ -88,7 +98,7 @@ public class EqUserGroupServiceImpl extends BaseServiceImpl<EqUserGroupMapper, E
String[] split = userId.split(",");
List<Long> longs = new ArrayList<>();
for (String s : split) {
longs.add(new Long(s));
longs.add(Long.parseLong(s));
}
List<String> planUserName = sysUserService.getUserNameLists(longs);
String name="";

2
modules/filter-rule/src/main/java/com/thing/filter/rule/service/impl/FilterLogServiceImpl.java

@ -47,7 +47,7 @@ public class FilterLogServiceImpl extends BaseServiceImpl<FilterLogMapper, Filte
.innerJoin(FILTER_LOG_ENTITY)
.on(FILTER_RULE_ENTITY.ID.eq(FILTER_LOG_ENTITY.FILTER_RULE_ID))
.eq(FilterRuleEntity::getTenantCode, UserContext.getTenantCode())
.eq(FilterRuleEntity::getName, filterRuleName, StringUtils.isNotBlank(filterRuleName))
.like(FilterRuleEntity::getName, filterRuleName, StringUtils.isNotBlank(filterRuleName))
.eq(FilterLogEntity::getStatus, status, Objects.nonNull(status))
.eq(FilterLogEntity::getResult, result, Objects.nonNull(result))
.orderBy(FilterLogEntity::getCreateDate)

2
modules/filter-rule/src/main/java/com/thing/filter/rule/service/impl/FilterRuleServiceImpl.java

@ -55,7 +55,7 @@ public class FilterRuleServiceImpl extends BaseServiceImpl<FilterRuleMapper, Fil
.from(FILTER_RULE_ENTITY)
.innerJoin(FILTER_RULE_DETAIL_ENTITY)
.on(FILTER_RULE_ENTITY.ID.eq(FILTER_RULE_DETAIL_ENTITY.FILTER_RULE_ID))
.eq(FilterRuleEntity::getName, name, StringUtils.isNotBlank(name));
.like(FilterRuleEntity::getName, name, StringUtils.isNotBlank(name));
if (StringUtils.isNotBlank(thingKeyword)) {
wrapper.and(
FILTER_RULE_DETAIL_ENTITY

1
modules/pom.xml

@ -28,6 +28,7 @@
<module>carbon-track</module>
<module>carbon-public</module>
<module>cqc-service</module>
<module>visual-design</module>
</modules>
<artifactId>modules</artifactId>

35
modules/quartz/src/main/java/com/thing/quartz/timetask/task/ThingStatusTask.java

@ -12,6 +12,7 @@ import com.thing.thing.context.service.ThingManageContextService;
import com.thing.thing.model.dto.IotThingModelDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@ -49,7 +50,7 @@ public class ThingStatusTask implements ITask {
@Override
public void run(String params) {
log.info("设备在线离线 statusTask start");
//所有物
//所有物模型
Optional<List<ObjectNode>> optionalList = thingManageContextService.findModelByGateway(GateWayStatus.NO_GATE_WAY.getValue());
if(optionalList.isEmpty()) {
return;
@ -60,29 +61,41 @@ public class ThingStatusTask implements ITask {
//处理
List<IotThingModelDTO> statusList = optionalList.get().stream()
.map(item -> {
IotThingModelDTO iotThingModelDTO = JacksonUtil.convertValue(item, IotThingModelDTO.class);
// IotThingModelDTO iotThingModelDTO = JacksonUtil.convertValue(item, IotThingModelDTO.class);
//找到最大时间的属性
Optional<TsKvDTO> optionalMax = lastTsKvList.stream()
.filter(tsKvDTO -> StringUtils.equals(tsKvDTO.getThingCode(),item.get(CacheNameEnum.ModelField.THING_MODEL_CODE.getField()).asText()))
.max(Comparator.comparing(TsKvDTO::getTs));
if(optionalMax.isEmpty()){
iotThingModelDTO.setStatus(ThingStatus.OFFLINE.getCode());
// item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),ThingStatus.OFFLINE.getCode());
item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),ThingStatus.OFFLINE.getCode());
}else{
TsKvDTO tsKvDTO = optionalMax.get();
//根据当前时间和获取的最新时间 若大于45min 则离线 否则为在线
boolean isOffline = System.currentTimeMillis() - tsKvDTO.getTs() > TIME_INTERVAL;
iotThingModelDTO.setStatus(isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode());
iotThingModelDTO.setStatusTs(new Date(tsKvDTO.getTs()).getTime());
// item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode());
// item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS_TS.getField(),new Date(tsKvDTO.getTs()).getTime());
item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(),isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode());
item.put(CacheNameEnum.ModelField.THING_MODEL_STATUS_TS.getField(),new Date(tsKvDTO.getTs()).getTime());
//更新实体设备状态
List<ObjectNode> entityNodes = cache.findKeyMap(CacheNameEnum.THING_ENTITY, item.get(CacheNameEnum.ModelField.THING_MODEL_CODE.getField()).asText());
if(CollectionUtils.isNotEmpty(entityNodes)){
for (ObjectNode entityNode : entityNodes) {
entityNode.put(CacheNameEnum.EntityField.THING_ENTITY_STATUS.getField()
,isOffline ? ThingStatus.OFFLINE.getCode() : ThingStatus.ONLINE.getCode());
cache.updateKeyMap(CacheNameEnum.THING_ENTITY
,entityNode.get(CacheNameEnum.EntityField.THING_ENTITY_TENANT_CODE.getField()).asText()
+ ":" + entityNode.get(CacheNameEnum.EntityField.THING_ENTITY_CODE.getField()).asText()
+ ":" + entityNode.get(CacheNameEnum.EntityField.THING_ENTITY_ID.getField()).asText(),entityNode);
}
}
}
return iotThingModelDTO;
//更新物模型
cache.updateKeyMap(CacheNameEnum.THING_MODEL
, item.get(CacheNameEnum.ModelField.THING_MODEL_CODE.getField()).asText()
+ ":" + item.get(CacheNameEnum.ModelField.THING_MODEL_ID.getField()).asText(),item);
return JacksonUtil.convertValue(item, IotThingModelDTO.class);
}).collect(Collectors.toList());
//修改状态
thingManageContextService.saveModelBatch(statusList);
cache.clearTopic(CacheNameEnum.THING_MODEL);
cache.clearTopic(CacheNameEnum.THING_ENTITY);
log.info("设备在线离线 statusTask end");
}

2
modules/report-analysis/src/main/java/com/thing/carbon/xiaochengxu/service/impl/AppletServiceImpl.java

@ -54,7 +54,7 @@ public class AppletServiceImpl implements AppletService {
thingParams.put("tenantCode", tenantCode);
thingParams.put("companyId", companyId);
thingParams.put("enableStatus", "1");
Optional<List<ObjectNode>> optionalList = thingManageContextService.findViewAllEntity(null, null, null, null, tenantCode, null, null, null, "1", TemplateMark.NO.getValue());
Optional<List<ObjectNode>> optionalList = thingManageContextService.findViewAllEntity(null, null, null, null, tenantCode, null, null, null, "1", TemplateMark.NO.getValue(),null);
long online = optionalList.orElseGet(Collections::emptyList).stream().filter(item -> ThingStatus.ONLINE.getCode().equals(item.get(CacheNameEnum.EntityField.THING_ENTITY_STATUS.getField()).asText())).count();
long offline = optionalList.orElseGet(Collections::emptyList).stream().filter(item -> ThingStatus.OFFLINE.getCode().equals(item.get(CacheNameEnum.EntityField.THING_ENTITY_STATUS.getField()).asText())).count();
result.setOnlineCount((int) online);

4
modules/thing/src/main/java/com/thing/thing/cache/service/CacheInit.java

@ -52,7 +52,7 @@ public class CacheInit {
//物模型的初始化
cacheModel();
//定时打印缓存
notificationsConsumerExecutor.scheduleAtFixedRate(thingCache::printStats, 0, 5, TimeUnit.MINUTES);
notificationsConsumerExecutor.scheduleAtFixedRate(thingCache::printStats, 0, 3, TimeUnit.HOURS);
log.info("thing 【物模型:物实体:物指标】 cache init end");
}
@ -65,7 +65,7 @@ public class CacheInit {
private void cacheEntity() {
entityService.findList(CacheNameEnum.EntityField.THING_ENTITY_CREATE_DATE.getField(), Constant.DESC, null,null, null,
null, null, null, null, null);
null, null, null, null, null,null);
cacheDictRelation();
cacheRelation();
cacheRelationDetail();

3
modules/thing/src/main/java/com/thing/thing/context/service/ThingManageContextService.java

@ -57,7 +57,8 @@ public interface ThingManageContextService {
Optional<List<IotThingEntityDTO>> findEntityAllByCodeAndTenantCode(Collection<String> codes,Long tenantCode,boolean isEntity);
Optional<List<ObjectNode>> findViewAllEntity(String orderField,String order,
String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark);
String name,String type,Long tenantCode,Long deptId,String realType,String tags
,String enableStatus,String templateMark,String status);
Optional<IotThingViewDTO> findViewEntityById(Long id);

4
modules/thing/src/main/java/com/thing/thing/context/service/impl/ThingManageContextServiceImpl.java

@ -100,8 +100,8 @@ public class ThingManageContextServiceImpl implements ThingManageContextService
@Override
public Optional<List<ObjectNode>> findViewAllEntity(String orderField,String order,
String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark) {
return Optional.ofNullable(entityService.findList(orderField,order,name,type,tenantCode,deptId,realType,tags,enableStatus,templateMark));
String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark,String status) {
return Optional.ofNullable(entityService.findList(orderField,order,name,type,tenantCode,deptId,realType,tags,enableStatus,templateMark,status));
}
@Override

2
modules/thing/src/main/java/com/thing/thing/dictRelation/service/impl/IotThingDictRelationServiceImpl.java

@ -169,7 +169,7 @@ public class IotThingDictRelationServiceImpl extends BaseServiceImpl<IotThingDic
CacheInit.dictRelationMap(dictRelationList,cache);
}
if(StringUtils.isBlank(entityIds)){
List<ObjectNode> entityServiceList = thingEntityService.findList(null, null, null, null, tenantCode, null, null, null, null, templateMark);
List<ObjectNode> entityServiceList = thingEntityService.findList(null, null, null, null, tenantCode, null, null, null, null, templateMark,null);
entityIds = entityServiceList.stream().map(jsonObject -> jsonObject.get(CacheNameEnum.EntityField.THING_ENTITY_ID.getField()).asText()).collect(Collectors.joining(","));
}
if(StringUtils.isBlank(orderField)){

10
modules/thing/src/main/java/com/thing/thing/entity/controller/IotThingEntityController.java

@ -63,9 +63,10 @@ public class IotThingEntityController {
@Parameter(name = "realType", description = "真实/虚拟物") @RequestParam(required = false) String realType,
@Parameter(name = "tags", description = "真实/虚拟物") @RequestParam(required = false) String tags,
@Parameter(name = "enableStatus", description = "停用开启")@RequestParam(required = false) String enableStatus,
@Parameter(name = "templateMark", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark)
@Parameter(name = "templateMark", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark,
@Parameter(name = "status", description = "在线离线状态,0离线 1在线 2错误 3未接入") @RequestParam(required = false) String status)
{
PageData<ObjectNode> pageList = service.pageList(page,limit,orderField,order, name,type,deptId,realType,tags,enableStatus,templateMark);
PageData<ObjectNode> pageList = service.pageList(page,limit,orderField,order, name,type,deptId,realType,tags,enableStatus,templateMark,status);
return new Result<PageData<ObjectNode>>().ok(pageList);
}
@ -80,9 +81,10 @@ public class IotThingEntityController {
@Parameter(name = "realType", description = "真实/虚拟物") @RequestParam(required = false) String realType,
@Parameter(name = "tags", description = "真实/虚拟物") @RequestParam(required = false) String tags,
@Parameter(name = "enableStatus", description = "停用开启")@RequestParam(required = false) String enableStatus,
@Parameter(name = "enableStatus", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark)
@Parameter(name = "enableStatus", description = "是否是物实体/模板")@RequestParam(required = false) String templateMark,
@Parameter(name = "status", description = "在线离线状态,0离线 1在线 2错误 3未接入") @RequestParam(required = false) String status)
{
List<ObjectNode> list = service.findList(orderField,order,name,type, UserContext.getRealTenantCode(),deptId,realType,tags,enableStatus,templateMark);
List<ObjectNode> list = service.findList(orderField,order,name,type, UserContext.getRealTenantCode(),deptId,realType,tags,enableStatus,templateMark,status);
return new Result<List<ObjectNode>>().ok(list);
}

4
modules/thing/src/main/java/com/thing/thing/entity/service/IotThingEntityService.java

@ -29,10 +29,10 @@ import java.util.Optional;
public interface IotThingEntityService extends IBaseService<IotThingEntity> {
PageData<ObjectNode> pageList(Integer page,Integer limit,String orderField,String order,
String code,String type,Long deptId,String realType,String tags,String enableStatus,String templateMark);
String code,String type,Long deptId,String realType,String tags,String enableStatus,String templateMark,String status);
List<ObjectNode> findList(String orderField,String order,
String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark);
String name,String type,Long tenantCode,Long deptId,String realType,String tags,String enableStatus,String templateMark,String status);
List<IotThingViewDTO> findAll(Map<String, Object> params);

13
modules/thing/src/main/java/com/thing/thing/entity/service/impl/IotThingEntityServiceImpl.java

@ -240,8 +240,8 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl<IotThingEntityMap
String realType,
String tags,
String enableStatus,
String templateMark) {
List<ObjectNode> list = findList(orderField, order, name, type, UserContext.getRealTenantCode(),deptId, realType, tags,enableStatus, templateMark);
String templateMark,String status) {
List<ObjectNode> list = findList(orderField, order, name, type, UserContext.getRealTenantCode(),deptId, realType, tags,enableStatus, templateMark, status);
if (CollectionUtils.isEmpty(list)) {
return PageData.empty();
}
@ -259,7 +259,7 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl<IotThingEntityMap
String realType,
String tags,
String enableStatus,
String templateMark) {
String templateMark,String status) {
List<ObjectNode> thingList = cache.getTopicMap(CacheNameEnum.THING_ENTITY);
if(CollectionUtils.isEmpty(thingList)){
List<IotThingViewDTO> iotThingViewDTOS = mapper.selectListByQueryAs(getWrapper(orderField,order, null, null,null,null,
@ -277,7 +277,7 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl<IotThingEntityMap
}
//封装参数
List<Pair<String, String>> pairs = buildParam(type,tenantCode,
deptId,realType,tags,enableStatus,templateMark);
deptId,realType,tags,enableStatus,templateMark,status);
String finalOrderField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, orderField);
Comparator<ObjectNode> comparator = CompareUtils.getComparator(order, finalOrderField);
return thingList.stream().filter(jsonObject -> JacksonUtil.filter(jsonObject, pairs))
@ -932,7 +932,7 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl<IotThingEntityMap
String realType,
String tags,
String enableStatus,
String templateMark)
String templateMark,String status)
{
List<Pair<String, String>> filterList = new ArrayList<>();
/* if (StringUtils.isNotBlank(code)) {
@ -962,6 +962,9 @@ public class IotThingEntityServiceImpl extends BaseServiceImpl<IotThingEntityMap
if (StringUtils.isNotBlank(templateMark)) {
filterList.add(Pair.of(CacheNameEnum.EntityField.THING_ENTITY_TEMPLATE_MARK.getField(), templateMark));
}
if (StringUtils.isNotBlank(status)) {
filterList.add(Pair.of(CacheNameEnum.ModelField.THING_MODEL_STATUS.getField(), status));
}
return filterList;
}

31
modules/visual-design/pom.xml

@ -0,0 +1,31 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.thing</groupId>
<artifactId>modules</artifactId>
<version>5.1</version>
</parent>
<groupId>com.thing.modules</groupId>
<artifactId>visual-design</artifactId>
<packaging>jar</packaging>
<name>ThingBI Server Modules visual-design</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.thing.modules</groupId>
<artifactId>thing</artifactId>
</dependency>
</dependencies>
</project>
Loading…
Cancel
Save