diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/KwMerchantMeterDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/KwMerchantMeterDto.java index 28d2be354..f36fd4c5d 100644 --- a/mallinkService/src/main/java/com/iformall/domain/dto/KwMerchantMeterDto.java +++ b/mallinkService/src/main/java/com/iformall/domain/dto/KwMerchantMeterDto.java @@ -15,6 +15,7 @@ public class KwMerchantMeterDto extends BaseEntity { private String tenantId; + @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") private String merchantName; @@ -30,11 +31,9 @@ public class KwMerchantMeterDto extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId") private Integer subBusinessId; - - @io.swagger.annotations.ApiModelProperty(value="状态0使用1作废",name="status") + @io.swagger.annotations.ApiModelProperty(value="状态1使用0停用",name="status") private Integer status; - protected String sortColumns; @Override @@ -47,16 +46,8 @@ public class KwMerchantMeterDto extends BaseEntity { private Long merchantId; public static enum Field { - RecordStartTime_ASC("`recordStartTime` ASC"), - RecordStartTime_DESC("`recordStartTime` DESC"), - RecordEndTime_ASC("`recordEndTime` ASC"), - RecordEndTime_DESC("`recordEndTime` DESC"), - UsedPower_ASC("`usedPower` ASC"), - UsedPower_DESC("`usedPower` DESC"), - TotalEndTime_ASC("`totalPower` ASC"), - TotalEndTime_DESC("`totalPower` DESC"), - ReportTime_ASC("`reportTime` ASC"), - ReportTime_DESC("`reportTime` DESC"); + BusinessId_ASC("`business_id` ASC"), + BusinessId_DESC("`business_id` DESC"); private String value; Field(String value) { diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/KwMerchantMeterVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/KwMerchantMeterVo.java index 0a1946557..04fbffb3e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/KwMerchantMeterVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/KwMerchantMeterVo.java @@ -1,5 +1,6 @@ package com.iformall.domain.vo; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.iformall.domain.po.KwMeter; import lombok.Data; @@ -9,9 +10,20 @@ import java.util.List; /** * @author gongbiao */ +@JsonIgnoreProperties(value = {"handler"}) @Data public class KwMerchantMeterVo { + + @io.swagger.annotations.ApiModelProperty(value="商户ID",name="name") + private String id; + + @io.swagger.annotations.ApiModelProperty(value="商户状态",name="name") + private String status; + + @io.swagger.annotations.ApiModelProperty(value="租户ID",name="name") + private String tenantId; + @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") private String merchantName; @@ -22,10 +34,11 @@ public class KwMerchantMeterVo { private List shopVoList; @io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList") - private Integer meterCount; + private List meterList; + @io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList") - private List meterList; + private Integer meterCount; public Integer getMeterCount() { if (meterList.isEmpty()) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index 00b5123af..b8388c014 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -406,7 +406,7 @@ public class WxChartServiceImpl implements WxChartDataService { resultMap.put("lastUsedPower",lastMonthPower.getUsedPower()); - if (lastMonthPower.getTotalPower() !=null && currentPower.getTotalPower() != null) { + if (lastMonthPower.getTotalPower() !=null && currentPower.getTotalPower() != null && lastMonthPower.getTotalPower() !=0) { double hbd = (double) (currentPower.getTotalPower() - lastMonthPower.getTotalPower()) / lastMonthPower.getTotalPower() * 100; double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); resultMap.put("totalPowerRate", hb + "%"); @@ -414,14 +414,10 @@ public class WxChartServiceImpl implements WxChartDataService { resultMap.put("totalPowerRate", "--" + "%"); } - if (lastMonthPower.getUsedPower() !=null && currentPower.getUsedPower() != null) { - if(lastMonthPower.getUsedPower().equals(0)){ - resultMap.put("usedPowerRate", "0%"); - }else{ - double hbd = (double) (currentPower.getUsedPower() - lastMonthPower.getUsedPower()) / lastMonthPower.getUsedPower() * 100; - double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - resultMap.put("usedPowerRate", hb + "%"); - } + if (lastMonthPower.getUsedPower() !=null && currentPower.getUsedPower() != null && lastMonthPower.getUsedPower() !=0) { + double hbd = (double) (currentPower.getUsedPower() - lastMonthPower.getUsedPower()) / lastMonthPower.getUsedPower() * 100; + double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + resultMap.put("usedPowerRate", hb + "%"); } else { resultMap.put("usedPowerRate", "--" + "%"); } diff --git a/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml b/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml index 997fd19f5..023035aba 100644 --- a/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml +++ b/mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml @@ -56,15 +56,39 @@ + + + + + + + + + + + + + + + + + + + + + - - - - @@ -75,55 +99,37 @@ select="com.iformall.mapper.WxShopMapper.findShopVoList"> - + select="com.iformall.mapper.KwMerchantMeterMapper.findMeterList"> - `id`,`tenant_id`,`meter_id`,`merchant_id`,`status`,`create_time`,`update_time`, `name`, `link_phone` + `id`, `tenant_id`, `merchant_id`, `status`, `name`, `link_phone` - - where 1 = 1 - - - and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - + - select - - from kw_merchant_meter, wx_merchant -