| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | import java.time.LocalDateTime; |
| | | import java.math.BigDecimal; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.ExportUidDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TSettlementConfirm; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | import com.ruoyi.order.api.vo.*; |
| | | |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.codec.CharEncoding; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | |
| | | @Autowired |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService, RedisService redisService) { |
| | |
| | | /** |
| | | * 建桩申请 |
| | | */ |
| | | @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-建桩申请"},value = "建桩申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPileDTO dto) { |
| | | // 验证验证码 |
| | | String code = redisService.getCacheObject(dto.getLandlordPhone() + Constants.APPLY_CHARGING); |
| | | String code; |
| | | if(dto.getLandlordHandling().equals(1)){ |
| | | code = redisService.getCacheObject(dto.getLandlordPhone() + Constants.APPLY_CHARGING); |
| | | }else { |
| | | code = redisService.getCacheObject(dto.getAgentPhone() + Constants.APPLY_CHARGING); |
| | | } |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | |
| | | dto.setAppUserId(userId); |
| | | return AjaxResult.ok(applyChargingPileService.save(dto)); |
| | | } |
| | | |
| | | @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/add"}, logical = Logical.OR) |
| | | @Log(title = "【申请建桩】添加建桩申请", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "建桩申请") |
| | | @PostMapping(value = "/manage/add") |
| | | public AjaxResult<Boolean> manageAdd(@RequestBody TApplyChargingPile dto) { |
| | | |
| | | return AjaxResult.ok(applyChargingPileService.save(dto)); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "列表") |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Page<TApplyChargingPile>> page(ApplyChargingQuery applyChargingQuery) { |
| | | public AjaxResult<Page<TApplyChargingPile>> page(@RequestBody ApplyChargingQuery applyChargingQuery) { |
| | | Page<TApplyChargingPile> page = applyChargingPileService.lambdaQuery() |
| | | .like(applyChargingQuery.getLandlordPhone() != null && !applyChargingQuery.getLandlordPhone().equals(""), TApplyChargingPile::getLandlordPhone, applyChargingQuery.getLandlordPhone()) |
| | | .orderByDesc(BasePojo::getCreateTime ) |
| | | .page(Page.of(applyChargingQuery.getPageCurr(), applyChargingQuery.getPageSize())); |
| | | return AjaxResult.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/export"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) |
| | | public R export(String landlordPhone,HttpServletResponse response) { |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | |
| | | applyChargingPileExportDto.setIs3("否"); |
| | | } |
| | | exportDtos.add(applyChargingPileExportDto); |
| | | |
| | | } |
| | | |
| | | // excel模板封装 |
| | | ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream()); |
| | | InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"充电桩申请记录" + ".xlsx"); |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeBill/download"}, logical = Logical.OR) |
| | | @ApiOperation(value = "下载-已出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/downloadBill") |
| | | public R downloadBill(String uid,HttpServletResponse response) |
| | | @PutMapping("/downloadBill") |
| | | @Log(title = "【充电算账单】下载算账单", businessType = BusinessType.EXPORT) |
| | | public R downloadBill(@RequestBody ExportUidDto uid, HttpServletResponse response) |
| | | { |
| | | ChargingListQuery chargingListQuery = new ChargingListQuery(); |
| | | chargingListQuery.setUid(uid); |
| | | chargingListQuery.setUid(uid.getUid()); |
| | | chargingListQuery.setPageCurr(1); |
| | | chargingListQuery.setPageSize(99999); |
| | | chargingListQuery.setPageSize(9999999); |
| | | ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData(); |
| | | |
| | | List<ChargingBillVO> chargingBillVOS = new ArrayList<>(); |
| | |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("月账单-"+data.getCategory()+"-"+data.getBillWeek()+"-"+data.getSiteName(), CharEncoding.UTF_8) + ".xlsx"); |
| | | // URLEncoder.encode("月账单-"+data.getCategory()+"-"+data.getBillWeek()+"-"+data.getSiteName(), CharEncoding.UTF_8) + ".xlsx"); |
| | | URLEncoder.encode("月账单", CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
| | | FillConfig fillConfig2 = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", data.getExportList()), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", data.getExportList()), fillConfig2, writeSheet); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @GetMapping("/downloadSettlement") |
| | | public R downloadSettlement(String uid,HttpServletResponse response) |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/accountSettlementStatement/download"}, logical = Logical.OR) |
| | | @ApiOperation(value = "下载", tags = {"管理后台-账户结算账单"}) |
| | | @PutMapping("/downloadAccount") |
| | | @Log(title = "【账户结算账单】下载账单", businessType = BusinessType.EXPORT) |
| | | public R downloadAccount(@RequestBody ChargingListQuery dto,HttpServletResponse response) |
| | | { dto.setPageCurr(1); |
| | | dto.setPageSize(99999999); |
| | | AccountListVO data = orderClient.accountBillList(dto).getData(); |
| | | List<TChargingOrder> collect = data.getOrderList().stream().distinct().collect(Collectors.toList()); |
| | | int i = 1; |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | |
| | | for (TChargingOrder chargingOrder : collect) { |
| | | bigDecimal = bigDecimal.add(chargingOrder.getRefundAmount()); |
| | | if (chargingOrder.getRechargePaymentType()!=null){ |
| | | switch (chargingOrder.getRechargePaymentType()){ |
| | | case 1: |
| | | chargingOrder.setPayPlatform("微信"); |
| | | chargingOrder.setRechargePaymentType1("微信小程序支付"); |
| | | break; |
| | | case 2: |
| | | chargingOrder.setPayPlatform("支付宝"); |
| | | chargingOrder.setRechargePaymentType1("支付宝小程序支付"); |
| | | break; |
| | | } |
| | | } |
| | | chargingOrder.setXuhao(i); |
| | | i++; |
| | | } |
| | | collect.get(0).setTotal(bigDecimal); |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("账户结算账单", CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | try { |
| | | // excel模板封装 |
| | | ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream()); |
| | | InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"账户结算账单" + ".xlsx"); |
| | | // 自动释放资源 |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", collect), fillConfig, writeSheet); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | } catch (IOException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/summarySettlement/export", "/balanceSheetRecord/download"}, logical = Logical.OR) |
| | | @ApiOperation(value = "导出", tags = {"管理后台-结算汇总表"}) |
| | | @PutMapping("/downloadSettlementTotal") |
| | | @Log(title = "【结算汇总表】下载汇总表", businessType = BusinessType.EXPORT) |
| | | public R downloadSettlementTotal(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | SettlementTotalVO data = chargingOrderClient.settlementTotalR(uid.getTime(),userId).getData(); |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("结算确认单", CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | try { |
| | | // excel模板封装 |
| | | ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream()); |
| | | InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"结算汇总" + ".xlsx"); |
| | | // 自动释放资源 |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", data.getList1()), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", data.getList2()), fillConfig, writeSheet); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | } catch (IOException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @PutMapping("/downloadSettlement") |
| | | @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT) |
| | | public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData(); |
| | | for (TChargingOrder chargingOrder : data.getList()) { |
| | | SettlementExportVO settlementExportVO = new SettlementExportVO(); |
| | | BeanUtils.copyProperties(data, settlementExportVO); |
| | | List<Site> data3 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (data3!=null && (!data3.isEmpty())){ |
| | | TAppUser data4 = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | if (data4.getVipId()== null ){ |
| | | settlementExportVO.setVipType("非会员"); |
| | | }else{ |
| | | List<Integer> vipIds = new ArrayList<>(); |
| | | //获取会员map |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds); |
| | | settlementExportVO.setVipType(vipMap.getData().get(data4.getVipId())); |
| | | } |
| | | settlementExportVO.setPhone(data4.getPhone()); |
| | | settlementExportVO.setRealName(data4.getName()); |
| | | if (chargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data5 = appUserCarClient.getCarByIds(Arrays.asList(chargingOrder.getAppUserCarId())).getData(); |
| | | if (!data5.isEmpty()){ |
| | | settlementExportVO.setLicensePlate(data5.get(0).getLicensePlate()); |
| | | settlementExportVO.setVehicleModel(data5.get(0).getVehicleModel()); |
| | | settlementExportVO.setVehicleBrand(data5.get(0).getVehicleBrand()); |
| | | } |
| | | |
| | | }else{ |
| | | settlementExportVO.setLicensePlate(chargingOrder.getPlateNum()); |
| | | } |
| | | settlementExportVO.setSiteCode(data3.get(0).getCode()); |
| | | settlementExportVO.setSiteName(data3.get(0).getName()); |
| | | settlementExportVO.setCity(data3.get(0).getCity()); |
| | | settlementExportVO.setDistricts(data3.get(0).getDistricts()); |
| | | Partner data1 = siteClient.getPartnerR(data3.get(0).getPartnerId()).getData(); |
| | | if (data1!=null){ |
| | | settlementExportVO.setPartnerName(data1.getName()); |
| | | } |
| | | switch (data3.get(0).getSiteType()){ |
| | | case 0: |
| | | settlementExportVO.setSiteType("其他"); |
| | | break; |
| | | case 1: |
| | | settlementExportVO.setSiteType("公共"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setSiteType("个人"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setSiteType("公交(专业)"); |
| | | break; |
| | | case 4: |
| | | settlementExportVO.setSiteType("环卫(专用)"); |
| | | break; |
| | | case 5: |
| | | settlementExportVO.setSiteType("物流(专用)"); |
| | | break; |
| | | case 6: |
| | | settlementExportVO.setSiteType("出租车(专用)"); |
| | | break; |
| | | } |
| | | switch (data3.get(0).getStatus()){ |
| | | case 1: |
| | | settlementExportVO.setSiteStatus("正常使用"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setSiteStatus("维修中"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setSiteStatus("关闭下线"); |
| | | break; |
| | | } |
| | | switch (data3.get(0).getBusinessCategory()){ |
| | | case 1: |
| | | settlementExportVO.setBusinessCategory("直营"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setBusinessCategory("非直营"); |
| | | break; |
| | | } |
| | | // todo 查询站点计费策略名称 |
| | | // settlementExportVO.setAccountingStrategy(); |
| | | |
| | | |
| | | } |
| | | TChargingGun data4 = chargingGunClient.getChargingGunById(settlementExportVO.getChargingGunId()) |
| | | .getData(); |
| | | if (data4!=null){ |
| | | settlementExportVO.setName(data4.getName()); |
| | | settlementExportVO.setDeviceCode(data4.getCode()); |
| | | } |
| | | |
| | | settlementExportVO.setElectronicType("转售"); |
| | | settlementExportVO.setPayTypeName("线上结算"); |
| | | LocalDateTime createTime = settlementExportVO.getCreateTime(); |
| | | LocalDateTime startTime = settlementExportVO.getStartTime(); |
| | | LocalDateTime endTime = settlementExportVO.getEndTime(); |
| | | settlementExportVO.setCreateTime1(createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | settlementExportVO.setStartTime1(startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | settlementExportVO.setEndTime1(endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | if (chargingOrder.getStatus()!=null){ |
| | | switch (chargingOrder.getStatus()){ |
| | | case 0: |
| | | settlementExportVO.setStatusName("未知"); |
| | | break; |
| | | case 1: |
| | | settlementExportVO.setStatusName("等待中/已插枪"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setStatusName("启动中"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setStatusName("充电中"); |
| | | break; |
| | | case 4: |
| | | settlementExportVO.setStatusName("停止中"); |
| | | break; |
| | | case 5: |
| | | settlementExportVO.setStatusName("已结束"); |
| | | break; |
| | | |
| | | } |
| | | } |
| | | settlementExportVO.setOrderTypeName("充电订单"); |
| | | settlementExportVO.setChargingType("单桩双充"); |
| | | settlementExportVO.setIsFree("否"); |
| | | settlementExportVO.setAverageElectronic(""); |
| | | settlementExportVO.setAverageServiceChargeReal(""); |
| | | settlementExportVO.setAverageServiceCharge(""); |
| | | // 获取充电时间 |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5.getCumulative_charging_time()!=null){ |
| | | settlementExportVO.setChargingSecond(data5.getCumulative_charging_time()+""); |
| | | |
| | | } |
| | | } |
| | | // 获取开始SOC 结束soc |
| | | if (chargingOrder.getCode()!=null){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | if (data6!=null && !data6.isEmpty()){ |
| | | int min = 100; |
| | | int max = 0; |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { |
| | | if (uploadRealTimeMonitoringData.getSoc()>max){ |
| | | max = uploadRealTimeMonitoringData.getSoc(); |
| | | } |
| | | if (uploadRealTimeMonitoringData.getSoc()!=0 &&uploadRealTimeMonitoringData.getSoc()<min){ |
| | | min = uploadRealTimeMonitoringData.getSoc(); |
| | | } |
| | | } |
| | | settlementExportVO.setEndSoc(max+""); |
| | | settlementExportVO.setStartSoc(min+""); |
| | | } |
| | | } |
| | | settlementExportVO.setIsSoc("否"); |
| | | settlementExportVO.setSocType(""); |
| | | settlementExportVO.setSocValue(""); |
| | | settlementExportVO.setUserType("普通个人用户"); |
| | | |
| | | if (chargingOrder.getVipDiscountAmount()!=null && chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0){ |
| | | settlementExportVO.setIsPlus("是"); |
| | | |
| | | }else { |
| | | settlementExportVO.setIsPlus("否"); |
| | | |
| | | } |
| | | settlementExportVO.setUserCode(""); |
| | | |
| | | |
| | | settlementExportVO.setConfirmCode(data.getConfirmCode()); |
| | | settlementExportVO.setCompanyName("四川明星新能源有限科技公司"); |
| | | settlementExportVO.setMoneyType("线上计费"); |
| | | settlementExportVO.setDeviceType("设备直连(自由集控)"); |
| | | settlementExportVO.setBeforePayType("先付后退"); |
| | | settlementExportVO.setIsSafe("是"); |
| | | // 顶部合计数据 |
| | | data.setServiceChargeTotal(data.getServiceCharge().add(data.getVenue()) |
| | | .add(data.getVenue()).add(data.getMaintain()).add(data.getClean())+""); |
| | | |
| | | data.setServicePartnerString(data.getServicePartner()+"%"); |
| | | BigDecimal bigDecimal = new BigDecimal("100"); |
| | | data.setPlatformString(bigDecimal.subtract(data.getServicePartner())+"%"); |
| | | } |
| | | |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | data.setSiteName(data1.get(0).getName()); |
| | |
| | | // 自动释放资源 |
| | | try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) { |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
| | | WriteSheet writeSheet2 = EasyExcel.writerSheet().build(); |
| | | WriteSheet writeSheet3 = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", chargingBillVOS), fillConfig, writeSheet2); |
| | | excelWriter.fill(new FillWrapper("data3", data.getList()), fillConfig, writeSheet3); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) |
| | | @GetMapping("/download") |
| | | public R download(String uid,HttpServletResponse response) |
| | | @PutMapping("/download") |
| | | @Log(title = "【充电算账单】下载算账单", businessType = BusinessType.EXPORT) |
| | | public R download(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | ChargingListQuery chargingListQuery = new ChargingListQuery(); |
| | | chargingListQuery.setUid(uid); |
| | | chargingListQuery.setUid(uid.getUid()); |
| | | chargingListQuery.setPageCurr(1); |
| | | chargingListQuery.setPageSize(99999); |
| | | chargingListQuery.setPageSize(9999999); |
| | | ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData(); |
| | | |
| | | List<ChargingBillVO> chargingBillVOS = new ArrayList<>(); |
| | |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-disposition"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + |
| | | URLEncoder.encode("月账单-"+data.getCategory()+data.getBillWeek()+data.getSiteName(), CharEncoding.UTF_8) + ".xlsx"); |
| | | // URLEncoder.encode("月账单-"+data.getCategory()+data.getBillWeek()+data.getSiteName(), CharEncoding.UTF_8) + ".xlsx"); |
| | | URLEncoder.encode("月账单", CharEncoding.UTF_8) + ".xlsx"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | return R.fail("excel导出失败!"); |
| | | } |
| | |
| | | ); |
| | | return pattern.matcher(url).matches(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/select"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "详情") |
| | | @PostMapping(value = "/detail/{id}") |
| | | public AjaxResult<TApplyChargingPile> detail(@PathVariable Integer id) { |
| | | |
| | | return AjaxResult.ok(applyChargingPileService.getById(id)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/remark"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "修改备注") |
| | | @PostMapping(value = "/remark") |
| | | @Log(title = "【申请建桩】修改备注", businessType = BusinessType.UPDATE) |
| | | public AjaxResult<TApplyChargingPile> remark(@RequestBody ApplyChargingRemarkDto applyChargingRemarkDt) { |
| | | TApplyChargingPile byId = applyChargingPileService.getById(applyChargingRemarkDt.getId()); |
| | | byId.setRemark(applyChargingRemarkDt.getRemark()); |
| | | applyChargingPileService.updateById(byId); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/del"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "删除") |
| | | @DeleteMapping(value = "/remark") |
| | | @Log(title = "【申请建桩】删除建桩申请", businessType = BusinessType.DELETE) |
| | | public AjaxResult remark(String ids) { |
| | | |
| | | String[] split = ids.split(","); |