renkang
2024-12-09 fe12fe0325c33867a4cb8387e4f19a0178e5e1a1
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwContractCloudController.java
@@ -9,6 +9,7 @@
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.model.YwContract;
import com.doumee.dao.business.model.YwContractBill;
import com.doumee.service.business.YwContractService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -37,14 +38,31 @@
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywcontract:create")
    public ApiResponse create(@RequestBody YwContract ywContract,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContract.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractService.create(ywContract));
    }
    @PreventRepeat
    @ApiOperation("根据参数预生成账单信息")
    @PostMapping("/getBillList")
    @CloudRequiredPermission("business:ywcontract:create")
    public ApiResponse< List<YwContractBill> > getBillList(@RequestBody YwContract ywContract, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContract.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractService.getBillList(ywContract));
    }
    @PreventRepeat
    @ApiOperation("退租")
    @PostMapping("/backRent")
    @CloudRequiredPermission("business:ywcontract:update")
    public ApiResponse backRent(@RequestBody YwContract ywContract,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContract.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractService.backRent(ywContract));
    }
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @CloudRequiredPermission("business:ywcontract:delete")
    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContractService.deleteById(id);
        ywContractService.deleteById(id,this.getLoginUser(token));
        return ApiResponse.success(null);
    }
@@ -57,7 +75,7 @@
        for (String id : idArray) {
            idList.add(Integer.valueOf(id));
        }
        ywContractService.deleteByIdInBatch(idList);
        ywContractService.deleteByIdInBatch(idList, this.getLoginUser(token));
        return ApiResponse.success(null);
    }
@@ -65,6 +83,7 @@
    @PostMapping("/updateById")
    @CloudRequiredPermission("business:ywcontract:update")
    public ApiResponse updateById(@RequestBody YwContract ywContract,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywContract.setLoginUserInfo(this.getLoginUser(token));
        ywContractService.updateById(ywContract);
        return ApiResponse.success(null);
    }
@@ -73,13 +92,31 @@
    @PostMapping("/page")
    @CloudRequiredPermission("business:ywcontract:query")
    public ApiResponse<PageData<YwContract>> findPage (@RequestBody PageWrap<YwContract> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywContractService.findPage(pageWrap));
    }
    @ApiOperation("列表")
    @PostMapping("/list")
    @CloudRequiredPermission("business:ywcontract:query")
    public ApiResponse<List<YwContract>> list (@RequestBody YwContract model,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywContractService.findList(model));
    }
    @ApiOperation("根据退租日期查询账单数据")
    @PostMapping("/findForBills")
    @CloudRequiredPermission("business:ywcontract:query")
    public ApiResponse<YwContract> findForBills (@RequestBody YwContract model,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywContractService.findForBills(model));
    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @CloudRequiredPermission("business:ywcontract:exportExcel")
    public void exportExcel (@RequestBody PageWrap<YwContract> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token));
        ExcelExporter.build(YwContract.class).export(ywContractService.findPage(pageWrap).getRecords(), "运维合同信息表", response);
    }