فهرست منبع

顶级商户导设备激活算法费用明细

tanbin 1 سال پیش
والد
کامیت
2617770054

+ 28 - 0
device-api-service-merc-mini/src/main/java/com/xy/controller/DeviceAlgorithmChargingHisController.java

@@ -1,11 +1,14 @@
 package com.xy.controller;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
 import com.xy.annotate.RestMappingController;
 import com.xy.dto.DeviceAlgorithmChargingDto;
 import com.xy.dto.DeviceAlgorithmChargingHistoryDto;
 import com.xy.dto.DeviceSimChargeDto;
 import com.xy.service.DeviceAlgorithmChargingHistoryServiceImpl;
 import com.xy.service.DeviceAlgorithmChargingServiceImpl;
+import com.xy.util.ExcelUtils;
 import com.xy.utils.MercAuthUtils;
 import com.xy.utils.PageBean;
 import com.xy.utils.R;
@@ -16,6 +19,11 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
+
 @AllArgsConstructor
 @Api(tags = "小程序-设备算法计费表")
 @RestMappingController("merc-mini/deviceAlgorithmChargingHis")
@@ -29,4 +37,24 @@ public class DeviceAlgorithmChargingHisController {
         page.setCurMercId(MercAuthUtils.getMercId());
         return deviceAlgorithmChargingHistoryService.pageByTopMerc(page);
     }
+
+    @ApiOperation("顶级商户导设备激活算法费用明细")
+    @PostMapping("exportPageByTopMerc")
+    public void exportPageByTopMerc(HttpServletResponse response, @RequestBody @Valid DeviceAlgorithmChargingHistoryDto.PageByTopMerc page) throws IOException {
+        page.setCurMercId(MercAuthUtils.getMercId());
+        R<PageBean<DeviceAlgorithmChargingHistoryDto.PageByTopMercVO>> data = deviceAlgorithmChargingHistoryService.pageByTopMerc(page);
+        List<DeviceAlgorithmChargingHistoryDto.PageByTopMercVO> records = data.getData().getRecords();
+        if (CollUtil.isNotEmpty(records)) {
+            for (DeviceAlgorithmChargingHistoryDto.PageByTopMercVO record : records) {
+                Integer status = record.getStatus();
+                if (status.intValue() != 2) {
+                    record.setCreateTime(null);
+                }
+            }
+        }
+        List<DeviceAlgorithmChargingHistoryDto.PageExcelVo> deviceExcelVOS = BeanUtil.copyToList(records, DeviceAlgorithmChargingHistoryDto.PageExcelVo.class);
+        // 输出
+        ExcelUtils.write(response, "设备激活算法费用明细.xls", "设备激活算法费明细", DeviceAlgorithmChargingHistoryDto.PageExcelVo.class, deviceExcelVOS);
+    }
+
 }

+ 8 - 0
device-api-service-merc-mini/src/main/java/com/xy/controller/DeviceSimChargeController.java

@@ -68,6 +68,14 @@ public class DeviceSimChargeController {
         page.setCurMercId(MercAuthUtils.getMercId());
         R<PageBean<DeviceSimChargeDto.PageByTopMercVO>> data = deviceSimChargeService.pageByTopMerc(page);
         List<DeviceSimChargeDto.PageByTopMercVO> records = data.getData().getRecords();
+        if (CollUtil.isNotEmpty(records)) {
+            for (DeviceSimChargeDto.PageByTopMercVO record : records) {
+                Integer status = record.getStatus();
+                if (status.intValue() != 2) {
+                    record.setCreateTime(null);
+                }
+            }
+        }
         List<DeviceSimChargeDto.PageExcelVo> deviceExcelVOS = BeanUtil.copyToList(records, DeviceSimChargeDto.PageExcelVo.class);
         // 输出
         ExcelUtils.write(response, "流量卡费用明细.xls", "流量卡费用明细", DeviceSimChargeDto.PageExcelVo.class, deviceExcelVOS);

+ 2 - 1
device-api/src/main/java/com/xy/consts/DictConsts.java

@@ -55,6 +55,7 @@ public class DictConsts {
      * 费用支付状态
      */
     public static final String ORDER_MERC_MANAGE_STATUS = "order_merc_manage_status";
- 
+    public static final String ALGORITHM_TYPES = "algorithm_types";
+
 
 }

+ 69 - 0
device-api/src/main/java/com/xy/dto/DeviceAlgorithmChargingHistoryDto.java

@@ -1,6 +1,12 @@
 package com.xy.dto;
 
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.NumberFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.xy.annotate.DictFormat;
+import com.xy.consts.DictConsts;
+import com.xy.convert.CustomFenToYuanConverter;
+import com.xy.convert.DictConvert;
 import com.xy.utils.PageBean;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -83,6 +89,69 @@ public class DeviceAlgorithmChargingHistoryDto {
 
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class PageExcelVo {
+ 
+//        @ExcelProperty("说明")
+//        @ApiModelProperty(value = "备注")
+//        private String note;
+
+
+        @ExcelProperty("商户名称")
+        @ApiModelProperty(value = "商户名称")
+        private String mercName;
+
+        @ExcelProperty("缴费单号")
+        @ApiModelProperty(value = "缴费单号")
+        private String orderId;
+        @ExcelProperty("设备编号")
+        @ApiModelProperty(value = "设备id")
+        private Long deviceId;
+
+        @ExcelProperty(value = "算法类型", converter = DictConvert.class)
+        @DictFormat(DictConsts.ALGORITHM_TYPES)
+        @ApiModelProperty(value = "算法类型")
+        private Long algorithmId;
+
+//        @ApiModelProperty(value = "名称")
+//        private String name;
+
+        @ExcelProperty(value = "实缴金额", converter = CustomFenToYuanConverter.class)
+        @NumberFormat("#0.00")
+        @ApiModelProperty(value = "实缴金额")
+        private Integer chargingMoney;
+
+        @ApiModelProperty(value = "代理商费用")
+        @ExcelProperty(value = "代理商费用", converter = CustomFenToYuanConverter.class)
+        @NumberFormat("#0.00")
+        private Integer agentMoney;
+
+
+        @ExcelProperty("缴费数量(笔)")
+        @ApiModelProperty(value = "缴费数量")
+        private Integer chargingSize;
+
+
+        @ExcelProperty(value = "缴费方式", converter = DictConvert.class)
+        @DictFormat(DictConsts.ORDER_MERC_MANAGE_PAY_TYPE)
+        @ApiModelProperty(value = "缴费方式")
+        private Integer chargingType;
+
+        @ExcelProperty(value = "支付状态", converter = DictConvert.class)
+        @DictFormat(DictConsts.ORDER_MERC_MANAGE_STATUS)
+        @ApiModelProperty(value = "支付状态")
+        private Integer status;
+
+
+        @ExcelProperty("支付时间")
+        @ApiModelProperty(value = "缴费时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime createTime;
+
+
+    }
+
     @Data
     @Accessors(chain = true)
     public static class PageByTopMerc {

+ 2 - 21
device-api/src/main/java/com/xy/dto/DeviceSimChargeDto.java

@@ -45,25 +45,6 @@ public class DeviceSimChargeDto {
     @Data
     @Accessors(chain = true)
     public static class PageExcelVo {
-
-
-        @ExcelProperty("设备编号")
-        @ApiModelProperty(value = "设备编号")
-        private Long deviceId;
-        @ExcelProperty(value = "实缴金额", converter = CustomFenToYuanConverter.class)
-        @NumberFormat("#0.00")
-        @ApiModelProperty(value = "续费金额")
-        private Integer chargingMoney;
-
-        @ExcelProperty("续费数量(年)")
-        @ApiModelProperty(value = "续费数量")
-        private Integer chargingSize;
-        @ExcelProperty(value = "续费方式", converter = DictConvert.class)
-        @DictFormat(DictConsts.ORDER_MERC_MANAGE_PAY_TYPE)
-        @ApiModelProperty(value = "续费方式")
-        private Integer chargingType;
-
-
         @ExcelProperty("商户名称")
         @ApiModelProperty(value = "商户名称")
         private String mercName;
@@ -87,7 +68,7 @@ public class DeviceSimChargeDto {
         @NumberFormat("#0.00")
         private Integer agentMoney;
 
-        @ExcelProperty("续费时长")
+        @ExcelProperty("续费时长(年)")
         @ApiModelProperty(value = "数量")
         private Integer size;
 
@@ -183,7 +164,7 @@ public class DeviceSimChargeDto {
             }
             return page;
         }
-        
+
 
         @ApiModelProperty(value = "创建时间-起")
         @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")