Procházet zdrojové kódy

[电表][修改]:商户电表接口完善

release_toaliyun_real
hupeng před 6 roky
rodič
revize
4be76e9c6a
4 změnil soubory, kde provedl 71 přidání a 65 odebrání
  1. +4
    -13
      mallinkService/src/main/java/com/iformall/domain/dto/KwMerchantMeterDto.java
  2. +15
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/KwMerchantMeterVo.java
  3. +5
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  4. +47
    -41
      mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml

+ 4
- 13
mallinkService/src/main/java/com/iformall/domain/dto/KwMerchantMeterDto.java Zobrazit soubor

@@ -15,6 +15,7 @@ public class KwMerchantMeterDto extends BaseEntity {


private String tenantId; private String tenantId;



@io.swagger.annotations.ApiModelProperty(value="商户名",name="name") @io.swagger.annotations.ApiModelProperty(value="商户名",name="name")
private String merchantName; private String merchantName;


@@ -30,11 +31,9 @@ public class KwMerchantMeterDto extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId") @io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId")
private Integer 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; private Integer status;



protected String sortColumns; protected String sortColumns;


@Override @Override
@@ -47,16 +46,8 @@ public class KwMerchantMeterDto extends BaseEntity {
private Long merchantId; private Long merchantId;


public static enum Field { 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; private String value;


Field(String value) { Field(String value) {


+ 15
- 2
mallinkService/src/main/java/com/iformall/domain/vo/KwMerchantMeterVo.java Zobrazit soubor

@@ -1,5 +1,6 @@
package com.iformall.domain.vo; package com.iformall.domain.vo;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.iformall.domain.po.KwMeter; import com.iformall.domain.po.KwMeter;
import lombok.Data; import lombok.Data;


@@ -9,9 +10,20 @@ import java.util.List;
/** /**
* @author gongbiao * @author gongbiao
*/ */
@JsonIgnoreProperties(value = {"handler"})
@Data @Data
public class KwMerchantMeterVo { 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") @io.swagger.annotations.ApiModelProperty(value="商户名",name="name")
private String merchantName; private String merchantName;


@@ -22,10 +34,11 @@ public class KwMerchantMeterVo {
private List<WxShopVo> shopVoList; private List<WxShopVo> shopVoList;


@io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList") @io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList")
private Integer meterCount;
private List<KwMeter> meterList;



@io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList") @io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList")
private List<KwMeter> meterList;
private Integer meterCount;


public Integer getMeterCount() { public Integer getMeterCount() {
if (meterList.isEmpty()) if (meterList.isEmpty())


+ 5
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java Zobrazit soubor

@@ -406,7 +406,7 @@ public class WxChartServiceImpl implements WxChartDataService {
resultMap.put("lastUsedPower",lastMonthPower.getUsedPower()); 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 hbd = (double) (currentPower.getTotalPower() - lastMonthPower.getTotalPower()) / lastMonthPower.getTotalPower() * 100;
double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
resultMap.put("totalPowerRate", hb + "%"); resultMap.put("totalPowerRate", hb + "%");
@@ -414,14 +414,10 @@ public class WxChartServiceImpl implements WxChartDataService {
resultMap.put("totalPowerRate", "--" + "%"); 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 { } else {
resultMap.put("usedPowerRate", "--" + "%"); resultMap.put("usedPowerRate", "--" + "%");
} }


+ 47
- 41
mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml Zobrazit soubor

@@ -56,15 +56,39 @@
<include refid="dynamicWhereConditions"/> <include refid="dynamicWhereConditions"/>
</select> </select>


<resultMap id="MeterBaseResultMap" type="com.iformall.domain.po.KwMeter">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="address" jdbcType="BIGINT" property="address"/>
<result column="brand" jdbcType="VARCHAR" property="brand"/>
<result column="place" jdbcType="VARCHAR" property="place"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
<result column="protocol" jdbcType="INTEGER" property="protocol"/>
<result column="bandrate" jdbcType="INTEGER" property="bandrate"/>
<result column="last_online_time" jdbcType="TIMESTAMP" property="lastOnlineTime"/>
<result column="online_status" jdbcType="INTEGER" property="onlineStatus"/>
<result column="config" jdbcType="VARCHAR" property="config"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="box_id" jdbcType="BIGINT" property="boxId"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="bind_status" jdbcType="INTEGER" property="bindStatus"/>
</resultMap>

<select id="findMeterList" parameterType="java.util.Map" resultMap="MeterBaseResultMap">
select m.* from kw_merchant_meter mm
left join kw_meter m on mm.`meter_id` = m.id
where mm.`status` = 0 and m.`bind_status` = 0
<if test=" null != merchantId ">
and mm.`merchant_id` = #{merchantId}
</if>
</select>



<resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.KwMerchantMeterVo"> <resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.KwMerchantMeterVo">
<id column="id" jdbcType="BIGINT" property="id"/> <id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="meter_id" jdbcType="BIGINT" property="meterId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="status" jdbcType="INTEGER" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>


<result column="name" jdbcType="VARCHAR" property="merchantName"/> <result column="name" jdbcType="VARCHAR" property="merchantName"/>
<result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
@@ -75,55 +99,37 @@
select="com.iformall.mapper.WxShopMapper.findShopVoList"> select="com.iformall.mapper.WxShopMapper.findShopVoList">
</collection> </collection>


<collection column="{merchantId=id}" property="shopVoList"
ofType="com.iformall.domain.vo.WxShopVo"
<collection column="{merchantId=id}" property="meterList"
ofType="com.iformall.domain.po.kwMeter"
javaType="java.util.List" javaType="java.util.List"
select="com.iformall.mapper.WxShopMapper.findShopVoList">
select="com.iformall.mapper.KwMerchantMeterMapper.findMeterList">
</collection> </collection>


</resultMap> </resultMap>


<sql id="allColumnsVo"> <sql id="allColumnsVo">
`id`,`tenant_id`,`meter_id`,`merchant_id`,`status`,`create_time`,`update_time`, `name`, `link_phone`
`id`, `tenant_id`, `merchant_id`, `status`, `name`, `link_phone`
</sql> </sql>


<sql id="dynamicWhereConditionsVo">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<select id="findListVo" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMapVo">
select <include refid="allColumnsVo"/>
from (
select merchant_id from kw_merchant_meter
where `status` = 0


<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>


<if test=" null != meterId ">
and `meter_id` = #{meterId}
</if>
<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
</if>


<if test=" null != status ">
and `status` = #{status}
</if>
group by merchant_id
) temp
, wx_merchant
where temp.merchant_id = id


<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findListVo" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMap">
select
<include refid="allColumnsVo"/>
from kw_merchant_meter, wx_merchant
<include refid="dynamicWhereConditionsVo"/>
</select> </select>


<update id="unbindBatch" parameterType="com.iformall.domain.po.KwMerchantMeter"> <update id="unbindBatch" parameterType="com.iformall.domain.po.KwMerchantMeter">


Načítá se…
Zrušit
Uložit