Pu Zhibing
2024-09-20 a146097a15d719c60af3cdeb4de1f21aa7b5ca8d
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java
@@ -7,6 +7,7 @@
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.common.core.utils.WebUtils;
import com.ruoyi.common.core.web.page.PageInfo;
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;
@@ -97,12 +98,16 @@
    /**
     * 建桩申请
     */
    @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("验证码已过期,请重新获取验证码!");
        }
@@ -115,7 +120,7 @@
        return AjaxResult.ok(applyChargingPileService.save(dto));
    }
    @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE)
    @Log(title = "【申请建桩】添加建桩申请", businessType = BusinessType.INSERT)
    @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "建桩申请")
    @PostMapping(value = "/manage/add")
    public AjaxResult<Boolean> manageAdd(@RequestBody TApplyChargingPile dto) {
@@ -135,6 +140,7 @@
    @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "导出")
    @PutMapping(value = "/export")
    @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT)
    public R export(String landlordPhone,HttpServletResponse response) {
        try {
        response.setCharacterEncoding(Constants.UTF8);
@@ -247,11 +253,12 @@
    }
    @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);
        ChargingBillVO data = chargingOrderClient.chargingBillListR(chargingListQuery).getData();
@@ -288,8 +295,10 @@
    }
    @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();
        try {
            response.setCharacterEncoding(Constants.UTF8);
@@ -320,10 +329,13 @@
    }
    @ApiOperation(value = "导出", tags = {"管理后台-结算汇总表"})
    @GetMapping("/downloadSettlementTotal")
    public R downloadSettlementTotal(String time,HttpServletResponse response)
    @PutMapping("/downloadSettlementTotal")
    @Log(title = "【结算汇总表】下载汇总表", businessType = BusinessType.EXPORT)
    public R downloadSettlementTotal(@RequestBody ExportUidDto uid,HttpServletResponse response)
    {
        SettlementTotalVO data = chargingOrderClient.settlementTotalR(time).getData();
        SettlementTotalVO data = chargingOrderClient.settlementTotalR(uid.getTime()).getData();
        try {
            response.setCharacterEncoding(Constants.UTF8);
            response.setContentType("application/vnd.ms-excel");
@@ -336,7 +348,7 @@
        try {
            // excel模板封装
            ExcelWriterBuilder excelWriterBuilder = EasyExcelFactory.write(response.getOutputStream());
            InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"运营商名称1-充电桩名称1-结算对账单明细-结算月份1" + ".xlsx");
            InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("template/" +"结算汇总" + ".xlsx");
            // 自动释放资源
            try (ExcelWriter excelWriter = excelWriterBuilder.withTemplate(stream).build()) {
                WriteSheet writeSheet = EasyExcel.writerSheet().build();
@@ -353,7 +365,8 @@
        return R.ok();
    }
    @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"})
    @GetMapping("/downloadSettlement")
    @PutMapping("/downloadSettlement")
    @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT)
    public R downloadSettlement(String uid,HttpServletResponse response)
    {
        TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData();
@@ -405,7 +418,8 @@
    @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"})
    @GetMapping("/download")
    @PutMapping("/download")
    @Log(title = "【充电算账单】下载算账单", businessType = BusinessType.EXPORT)
    public R download(String uid,HttpServletResponse response)
    {
        ChargingListQuery chargingListQuery = new ChargingListQuery();
@@ -462,6 +476,7 @@
    @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());
@@ -470,6 +485,7 @@
    }
    @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "删除")
    @DeleteMapping(value = "/remark")
    @Log(title = "【申请建桩】删除建桩申请", businessType = BusinessType.DELETE)
    public AjaxResult remark(String ids) {
        String[] split = ids.split(",");