Просмотр исходного кода

[电表][修改]:电表导出模板接口

release_toaliyun_real
hupeng 6 лет назад
Родитель
Сommit
40eb804780
2 измененных файлов: 40 добавлений и 6 удалений
  1. +18
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/device/KwMeterController.java
  2. +22
    -3
      mallinkService/src/main/java/com/iformall/domain/po/KwMeter.java

+ 18
- 3
mallinkAdmin/src/main/java/com/iformall/controller/device/KwMeterController.java Просмотреть файл

@@ -12,6 +12,7 @@ import com.iformall.enums.EnumBoxStatus;
import com.iformall.enums.EnumMeterBindStatus; import com.iformall.enums.EnumMeterBindStatus;
import com.iformall.enums.EnumMeterStatus; import com.iformall.enums.EnumMeterStatus;
import com.iformall.exception.MallinkException; import com.iformall.exception.MallinkException;
import com.iformall.service.ExcelService;
import com.iformall.service.kw.KwBoxService; import com.iformall.service.kw.KwBoxService;
import com.iformall.service.kw.KwMerchantMeterService; import com.iformall.service.kw.KwMerchantMeterService;
import com.iformall.service.kw.KwMeterDataService; import com.iformall.service.kw.KwMeterDataService;
@@ -46,6 +47,10 @@ public class KwMeterController extends BaseController {
@Autowired @Autowired
private KwMerchantMeterService kwMerchantMeterService; private KwMerchantMeterService kwMerchantMeterService;


@Autowired
private ExcelService excelService;


@ApiOperation("设备列表") @ApiOperation("设备列表")
@GetMapping("list") @GetMapping("list")
@ApiImplicitParams({ @ApiImplicitParams({
@@ -134,10 +139,20 @@ public class KwMeterController extends BaseController {
return new ResultData(); return new ResultData();
} }


@RequestMapping("导出模板")
@GetMapping("/exportTemplate")
@SystemControllerLog(description = "电表管理-导出模板") @SystemControllerLog(description = "电表管理-导出模板")
public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { public void exportTemplate(HttpServletRequest request, HttpServletResponse response) {

List <KwMeter> meterList = new ArrayList<>();
KwMeter meter1 = new KwMeter();
meter1.setAddress("000020492980");
meter1.setPlace("1栋-3楼-2号电井");
meter1.setBrand("人民电器");
meter1.setModel("DS866");
meter1.setProtocol(0);
meter1.setBandrate(1200);
meter1.setBoxImei("865501040775810");
meter1.setMerchantName("富茂旗舰店");
meterList.add(meter1);
excelService.exportExcel(meterList, null, "电表模板", KwMeter.class, "电表模板.xlsx", response, true);
} }

} }

+ 22
- 3
mallinkService/src/main/java/com/iformall/domain/po/KwMeter.java Просмотреть файл

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


import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
@@ -35,21 +36,28 @@ public class KwMeter extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "tenantId", name = "tenantId") @io.swagger.annotations.ApiModelProperty(value = "tenantId", name = "tenantId")
private String tenantId; private String tenantId;



@Excel(name = "电表编号 *", width = 20, orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value = "电表编号", name = "address") @io.swagger.annotations.ApiModelProperty(value = "电表编号", name = "address")
private String address; private String address;


@Excel(name = "位置", width = 20, orderNum = "2")
@io.swagger.annotations.ApiModelProperty(value = "位置", name = "place")
private String place;

@Excel(name = "品牌", width = 20, orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value = "品牌", name = "brand") @io.swagger.annotations.ApiModelProperty(value = "品牌", name = "brand")
private String brand; private String brand;


@Excel(name = "型号", width = 20, orderNum = "4")
@io.swagger.annotations.ApiModelProperty(value = "型号", name = "model") @io.swagger.annotations.ApiModelProperty(value = "型号", name = "model")
private String model; private String model;


@io.swagger.annotations.ApiModelProperty(value = "位置", name = "place")
private String place;

@Excel(name = "协议(0,1-97协议,07协议)", width =30, orderNum = "5")
@io.swagger.annotations.ApiModelProperty(value = "协议(0,97协议)(1,07协议)", name = "protocol") @io.swagger.annotations.ApiModelProperty(value = "协议(0,97协议)(1,07协议)", name = "protocol")
private Integer protocol; private Integer protocol;


@Excel(name = "波特率(1200,2400,9600)", width = 30, orderNum = "6")
@io.swagger.annotations.ApiModelProperty(value = "波特率1200,2400,9600", name = "bandrate") @io.swagger.annotations.ApiModelProperty(value = "波特率1200,2400,9600", name = "bandrate")
private Integer bandrate; private Integer bandrate;


@@ -77,12 +85,23 @@ public class KwMeter extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "状态0绑定1未绑定", name = "bindStatus") @io.swagger.annotations.ApiModelProperty(value = "状态0绑定1未绑定", name = "bindStatus")
private Integer bindStatus; private Integer bindStatus;



@Excel(name = "采集设备号", width = 20, orderNum = "7")
@Transient
private String boxImei;

@Excel(name = "商户", width = 20, orderNum = "8")
@Transient
private String merchantName;

@Transient @Transient
private Integer merchantMeterStatus; private Integer merchantMeterStatus;


@Transient @Transient
protected KwMeterData latestRecord; protected KwMeterData latestRecord;




public static enum Field { public static enum Field {
Id_ASC("`id` ASC"), Id_ASC("`id` ASC"),
Id_DESC("`id` DESC"), Id_DESC("`id` DESC"),


Загрузка…
Отмена
Сохранить