Browse Source
Merge pull request 'master' (#14) from master into V3
Merge pull request 'master' (#14) from master into V3
Reviewed-on: http://git.lrdaiot.cn:9000/thing/thing_api/pulls/14qingyuan_dev_new
36 changed files with 618 additions and 260 deletions
-
47help/sql/ddl_1.0.0.sql
-
4modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmRuleLogServiceImpl.java
-
9modules/alarm/src/main/java/com/thing/alarm/alarm/service/impl/AlarmRuleServiceImpl.java
-
6modules/alarm/src/main/resources/mapper/AlarmRuleEntityMapper.xml
-
6modules/alarm/src/main/resources/mapper/AlarmRuleLogMapper.xml
-
49modules/carbon-public/src/main/java/com/thing/carbon/pub/controller/PubCockpitController.java
-
34modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitEnterpriseInfo.java
-
20modules/carbon-public/src/main/java/com/thing/carbon/pub/dto/CockpitStatisticsDto.java
-
13modules/carbon-public/src/main/java/com/thing/carbon/pub/mapper/PubCockpitMapper.java
-
11modules/carbon-public/src/main/java/com/thing/carbon/pub/service/PubCockpitService.java
-
42modules/carbon-public/src/main/java/com/thing/carbon/pub/service/impl/PubCockpitServiceImpl.java
-
2modules/carbon-public/src/main/resources/mapper/CarbonPubSupplierMapper.xml
-
39modules/carbon-public/src/main/resources/mapper/PubCockpitMapper.xml
-
29modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonConsumables/controller/CqcCarbonConsumablesController.java
-
36modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonConsumables/dto/CqcCarbonConsumablesDTO.java
-
36modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonConsumables/entity/CqcCarbonConsumablesEntity.java
-
12modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDiscard/controller/CqcCarbonDiscardController.java
-
36modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDiscard/dto/CqcCarbonDiscardDTO.java
-
36modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDiscard/entity/CqcCarbonDiscardEntity.java
-
6modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDiscard/service/impl/CqcCarbonDiscardServiceImpl.java
-
29modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDistribution/controller/CqcCarbonDistributionController.java
-
24modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDistribution/dto/CqcCarbonDistributionDTO.java
-
24modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonDistribution/entity/CqcCarbonDistributionEntity.java
-
29modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonEnergy/controller/CqcCarbonEnergyController.java
-
20modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonEnergy/dto/CqcCarbonEnergyDTO.java
-
20modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonEnergy/entity/CqcCarbonEnergyEntity.java
-
29modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonMake/controller/CqcCarbonMakeController.java
-
18modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonMake/dto/CqcCarbonMakeDTO.java
-
18modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonMake/entity/CqcCarbonMakeEntity.java
-
29modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonRaw/controller/CqcCarbonRawController.java
-
36modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonRaw/dto/CqcCarbonRawDTO.java
-
36modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonRaw/entity/CqcCarbonRawEntity.java
-
17modules/cqc-service/src/main/java/com/thing/cqc/rpcService/JsonCryptoUtils.java
-
4modules/filter-rule/src/main/java/com/thing/filter/rule/dto/FilterRuleDetailDTO.java
-
7modules/filter-rule/src/main/java/com/thing/filter/rule/enumeration/DataType.java
-
57modules/thing/src/main/java/com/thing/thing/dict/service/impl/IotThingDictServiceImpl.java
@ -0,0 +1,49 @@ |
|||||
|
package com.thing.carbon.pub.controller; |
||||
|
|
||||
|
|
||||
|
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; |
||||
|
import com.thing.carbon.pub.service.PubCockpitService; |
||||
|
import com.thing.common.core.web.response.Result; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
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 java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 企业注册 |
||||
|
* |
||||
|
* @author xc |
||||
|
* @since 3.0 2024-07-09 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("v2/pub/cockpit") |
||||
|
@Tag(name="公共服务侧大屏看板") |
||||
|
@RequiredArgsConstructor |
||||
|
public class PubCockpitController { |
||||
|
|
||||
|
@Autowired |
||||
|
private PubCockpitService pubCockpitService; |
||||
|
|
||||
|
@GetMapping("list") |
||||
|
@Operation(summary="左上角和地图得企业列表") |
||||
|
public Result<List<CockpitEnterpriseInfo>> list(){ |
||||
|
List<CockpitEnterpriseInfo> list = pubCockpitService.cockpitEnterpriseInfoList(); |
||||
|
return new Result<List<CockpitEnterpriseInfo>>().ok(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@GetMapping("statistics") |
||||
|
@Operation(summary="中间六个统计") |
||||
|
public Result<List<CockpitEnterpriseInfo>> statistics(){ |
||||
|
List<CockpitEnterpriseInfo> list = pubCockpitService.cockpitEnterpriseInfoList(); |
||||
|
return new Result<List<CockpitEnterpriseInfo>>().ok(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.thing.carbon.pub.dto; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
/** |
||||
|
* 企业列表详情 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Schema(description = "国网侧驾驶舱企业信息") |
||||
|
public class CockpitEnterpriseInfo { |
||||
|
@Schema(description = "企业名称") |
||||
|
private String name; |
||||
|
@Schema(description = "企业编码") |
||||
|
private String code; |
||||
|
@Schema(description = "企业区域id") |
||||
|
private String regionId; |
||||
|
@Schema(description = "碳足迹结果数量") |
||||
|
private String recordsCount; |
||||
|
@Schema(description = "产品数量") |
||||
|
private String productCount; |
||||
|
@Schema(description = "经纬度原始值") |
||||
|
private String lngLatStr; |
||||
|
@Schema(description = "经度") |
||||
|
private String lng; |
||||
|
@Schema(description = "纬度") |
||||
|
private String lat; |
||||
|
@Schema(description = "产品分类") |
||||
|
private String productType; |
||||
|
@Schema(description = "平均产品碳足迹") |
||||
|
private BigDecimal avgCarBon; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.thing.carbon.pub.dto; |
||||
|
|
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 国网侧驾驶舱中间六个统计信息 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Schema(description = "国网侧驾驶舱中间六个统计信息") |
||||
|
public class CockpitStatisticsDto { |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
package com.thing.carbon.pub.mapper; |
||||
|
|
||||
|
|
||||
|
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
@Mapper |
||||
|
public interface PubCockpitMapper { |
||||
|
List<CockpitEnterpriseInfo> cockpitEnterpriseInfoList(); |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.thing.carbon.pub.service; |
||||
|
|
||||
|
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface PubCockpitService { |
||||
|
|
||||
|
|
||||
|
List<CockpitEnterpriseInfo> cockpitEnterpriseInfoList(); |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.thing.carbon.pub.service.impl; |
||||
|
|
||||
|
import com.thing.carbon.pub.dto.CockpitEnterpriseInfo; |
||||
|
import com.thing.carbon.pub.mapper.CarbonPubSupplierMapper; |
||||
|
import com.thing.carbon.pub.mapper.PubCockpitMapper; |
||||
|
import com.thing.carbon.pub.service.PubCockpitService; |
||||
|
import org.apache.commons.lang3.ObjectUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.RoundingMode; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
@Service |
||||
|
public class PubCockpitServiceImpl implements PubCockpitService { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private PubCockpitMapper pubCockpitMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private CarbonPubSupplierMapper carbonPubSupplierMapper; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public List<CockpitEnterpriseInfo> cockpitEnterpriseInfoList() { |
||||
|
List<CockpitEnterpriseInfo> infoList = pubCockpitMapper.cockpitEnterpriseInfoList(); |
||||
|
infoList.forEach(temp->{ |
||||
|
if(ObjectUtils.isNotEmpty(temp.getLngLatStr())){ |
||||
|
String[] strs = temp.getLngLatStr().split(","); |
||||
|
temp.setLng(strs[0]); |
||||
|
temp.setLat(strs[1]); |
||||
|
} |
||||
|
//补全平均产品碳足迹值 |
||||
|
BigDecimal avgCarbon = carbonPubSupplierMapper.avgCarbonOfAllProduct(Long.parseLong(temp.getCode()),null,null); |
||||
|
temp.setAvgCarBon(avgCarbon.setScale(4, RoundingMode.UP)); |
||||
|
}); |
||||
|
return infoList; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.thing.carbon.pub.mapper.PubCockpitMapper"> |
||||
|
|
||||
|
<select id="cockpitEnterpriseInfoList" resultType="com.thing.carbon.pub.dto.CockpitEnterpriseInfo"> |
||||
|
SELECT |
||||
|
cps.NAME, |
||||
|
cps.code, |
||||
|
cps.region_id, |
||||
|
COALESCE ( t2.records_count, 0 ) AS records_count, |
||||
|
COALESCE ( t3.product_count, 0 ) AS product_count, |
||||
|
td.lng_lat as lngLatStr, |
||||
|
TEMP.product_type |
||||
|
FROM |
||||
|
carbon_pub_supplier cps |
||||
|
LEFT JOIN ( SELECT string_agg ( DISTINCT industry_sub, ',' ) AS product_type, tenant_code FROM iot_carbon_production_variety GROUP BY tenant_code ) TEMP ON cps.code = TEMP.tenant_code |
||||
|
LEFT JOIN ( |
||||
|
SELECT SUM |
||||
|
( pr_unit ) AS records_count, |
||||
|
tenant_code |
||||
|
FROM |
||||
|
( SELECT COUNT ( DISTINCT pr_code ) AS pr_unit, tenant_code, pr_code FROM carbon_pub_production_result GROUP BY product_id, pr_code, tenant_code ) t1 |
||||
|
GROUP BY |
||||
|
tenant_code |
||||
|
) t2 ON cps.code = t2.tenant_code |
||||
|
LEFT JOIN ( |
||||
|
SELECT SUM |
||||
|
( product_count ) AS product_count, |
||||
|
tenant_code |
||||
|
FROM |
||||
|
( SELECT COUNT ( DISTINCT product_id ) AS product_count, tenant_code FROM carbon_pub_production_result GROUP BY product_id, tenant_code ) t1 |
||||
|
GROUP BY |
||||
|
tenant_code |
||||
|
) t3 ON cps.code = t3.tenant_code |
||||
|
LEFT JOIN sys_tenant_detail td on cps.code = td.id |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue