yupeng
2025-02-26 12e6270e9fb0de04ac075c5c4a28c4151874f379
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java
@@ -6,16 +6,18 @@
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.system.dto.*;
import com.ruoyi.system.model.TBill;
import com.ruoyi.system.model.TBillDetail;
import com.ruoyi.system.query.TBillQuery;
import com.ruoyi.system.service.TBillDetailService;
import com.ruoyi.system.service.TBillService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
 * <p>
@@ -32,7 +34,8 @@
    @Autowired
    TBillService tBillService;
    @Autowired
    TBillDetailService tBillDetailService;
    @PreAuthorize("@ss.hasPermi('system:bill:list')")
@@ -50,6 +53,22 @@
        tBillService.saveBill(bill);
        return R.ok();
    }
    @ApiOperation("通过ID查找详情")
    @GetMapping("getDetailById")
    public R<TBillDto> getDetailById(@Validated @NotEmpty String id){
        TBillDto dto = tBillService.getDetailByBillId(id);
        if (dto.getBillType().equals("3")){
            List<TBillDetail> details = tBillDetailService.getByBillId(id);
            for (TBillDetail detail : details) {
                if (detail.getLiveType()==1)dto.setWater(detail); //水费
                else dto.setElect(detail);  //电费
            }
        }
        return R.ok(dto);
    }
    @PreAuthorize("@ss.hasPermi('system:bill:checkOfflinePay')")
    @ApiOperation("确认线下缴费")
    @PostMapping("checkOfflinePay")
@@ -83,5 +102,8 @@
    }
}