ソースを参照

财务管理-支出管理-设备激活费明细

tanbin 1 年間 前
コミット
bf96d7c10d

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

@@ -28,6 +28,31 @@ public class DeviceAlgorithmChargingHisController {
 
     private DeviceAlgorithmChargingHistoryServiceImpl deviceAlgorithmChargingHistoryService;
 
+
+    @PostMapping("mySpendPage")
+    @ApiOperation("财务管理-支出管理-设备激活费明细")
+    public R<PageBean<DeviceAlgorithmChargingHistoryDto.MySpendPageVO>> mySpendPage(@RequestBody @Validated DeviceAlgorithmChargingHistoryDto.PageByTopMerc page) {
+        page.setCurMercId(MercAuthUtils.getMercId());
+        return deviceAlgorithmChargingHistoryService.mySpendPage(page);
+    }
+
+    @PostMapping("mySpendPageCount")
+    @ApiOperation("财务管理-支出管理-设备激活费统计")
+    public R<Integer> mySpendPageCount(@RequestBody @Validated DeviceAlgorithmChargingHistoryDto.PageByTopMerc page) {
+        page.getPage().setSize(-1);
+        page.setCurMercId(MercAuthUtils.getMercId());
+        PageBean<DeviceAlgorithmChargingHistoryDto.MySpendPageVO> pageVoPageBean = R.feignCheckData(deviceAlgorithmChargingHistoryService.mySpendPage(page));
+        List<DeviceAlgorithmChargingHistoryDto.MySpendPageVO> records = pageVoPageBean.getRecords();
+        int totalMoney = 0;
+        if (CollUtil.isNotEmpty(records)) {
+            for (DeviceAlgorithmChargingHistoryDto.MySpendPageVO r : records) {
+                totalMoney += r.getChargingMoney();
+            }
+        }
+        return R.ok(totalMoney);
+    }
+
+
     @PostMapping("pageByTopMerc")
     @ApiOperation("加盟商-服务费管理-设备激活费明细")
     public R<PageBean<DeviceAlgorithmChargingHistoryDto.PageByTopMercVO>> pageByTopMerc(@RequestBody @Validated DeviceAlgorithmChargingHistoryDto.PageByTopMerc page) {

+ 40 - 0
device-api-service/src/main/java/com/xy/service/DeviceAlgorithmChargingHistoryServiceImpl.java

@@ -119,4 +119,44 @@ public class DeviceAlgorithmChargingHistoryServiceImpl extends ServiceImpl<Devic
         return R.ok(voPageBean);
 
     }
+
+    /**
+     * 财务管理-支出管理-设备激活费明细
+     *
+     * @param page
+     * @return
+     */
+    public R<PageBean<DeviceAlgorithmChargingHistoryDto.MySpendPageVO>> mySpendPage(DeviceAlgorithmChargingHistoryDto.PageByTopMerc page) {
+        Long curMercId = page.getCurMercId();
+        List<Long> mercIds = new ArrayList<>();
+        //指定商户ID
+        mercIds.add(curMercId);
+        PageBean pageBean = page.getPage();
+        LambdaQueryWrapper<DeviceAlgorithmChargingHistory> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(page, DeviceAlgorithmChargingHistory.class)
+                .ge(DeviceAlgorithmChargingHistory::getCreateTime, page.getBeginCreateTime())
+                .le(DeviceAlgorithmChargingHistory::getCreateTime, page.getEndCreateTime())
+                .in(DeviceAlgorithmChargingHistory::getMercId, mercIds)
+                .build()
+                .orderByDesc(!Emptys.check(pageBean.getOrders()), DeviceAlgorithmChargingHistory::getCreateTime);
+        IPage<DeviceAlgorithmChargingHistory> iPage = page(toIPage(pageBean), lambdaQueryWrapper);
+        PageBean<DeviceAlgorithmChargingHistoryDto.MySpendPageVO> voPageBean = toPageBean(DeviceAlgorithmChargingHistoryDto.MySpendPageVO.class, iPage);
+        List<DeviceAlgorithmChargingHistoryDto.MySpendPageVO> records = voPageBean.getRecords();
+        if (Emptys.check(records)) {
+
+
+            List<Long> deviceIds = records.stream().map(DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getDeviceId).distinct().collect(Collectors.toList());
+
+            List<DeviceInfoDto.Vo> deviceList = R.feignCheckData(deviceInfoService.listCommon(new DeviceInfoDto.ListCommon().setDeviceIds(deviceIds)));
+            Map<Long, DeviceInfoDto.Vo> devcieMap = deviceList.stream().collect(Collectors.toMap(DeviceInfoDto.Vo::getDeviceId, d -> d));
+            copy(records)
+                    .target(() -> orderMercManageService.list(new OrderMercManageDto.SelectList().setId(new JArrayList<>(records).getProperty(DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getOrderId))).getData()
+                            , DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getOrderId, DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getFiles, OrderMercManageDto.Vo::getId, OrderMercManageDto.Vo::getFiles
+                    ).target(() -> mercService.list(new MercDto.SelectList().setMercIds(new JArrayList<>(records).getProperty(DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getMercId).comparing())).getData()
+                            , DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getMercId, DeviceAlgorithmChargingHistoryDto.MySpendPageVO::getMercName, MercDto.Vo::getId, MercDto.Vo::getName)
+                    .builder();
+
+        }
+        return R.ok(voPageBean);
+
+    }
 }

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

@@ -33,6 +33,61 @@ public class DeviceAlgorithmChargingHistoryDto {
 
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class MySpendPageVO {
+
+
+        @ApiModelProperty(value = "代理商金额")
+        private Integer agentMoney;
+
+        @ApiModelProperty(value = "id")
+        private Long id;
+
+        @ApiModelProperty(value = "商户id")
+        private Long mercId;
+        @ApiModelProperty(value = "商户名称")
+        private String mercName;
+        @ApiModelProperty(value = "订单id")
+        private String orderId;
+
+        @ApiModelProperty(value = "设备id")
+        private Long deviceId;
+
+        @ApiModelProperty(value = "算法id")
+        private Long algorithmId;
+
+        @ApiModelProperty(value = "名称")
+        private String name;
+
+        @ApiModelProperty(value = "充值金额")
+        private Integer chargingMoney;
+
+        @ApiModelProperty(value = "充值数量")
+        private Integer chargingSize;
+
+        @ApiModelProperty(value = "充值方式")
+        private Integer chargingType;
+
+        @ApiModelProperty(value = "状态")
+        private Integer status;
+
+        @ApiModelProperty(value = "创建时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime createTime;
+
+        @ApiModelProperty(value = "更新时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime updateTime;
+
+        @ApiModelProperty(value = "备注")
+        private String note;
+
+        @ApiModelProperty(value = "附件")
+        private String files;
+
+    }
+
     @Data
     @Accessors(chain = true)
     public static class PageByTopMercVO {