无关风月
2025-02-19 8ffb450a79194fc77bfc09eb867677e842121bc4
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
@@ -15,17 +15,18 @@
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.TBannerQuery;
import com.ruoyi.system.query.TBillQuery;
import com.ruoyi.system.query.TCheckAcceptRecordAppletQuery;
import com.ruoyi.system.query.TCheckAcceptRecordQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.MyHouseVO;
import com.ruoyi.system.vo.MyToDoVO;
import com.ruoyi.system.vo.PayListVO;
import com.ruoyi.system.vo.TBillVO;
import com.ruoyi.system.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.parser.Token;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@@ -56,7 +57,8 @@
    @Autowired
    private THouseService houseService;
    @Autowired
    private  TCheckAcceptRecordService checkAcceptRecordService;
    /**
     * 获取轮播图管理列表
     */
@@ -78,6 +80,11 @@
            myToDoVO.setContractCount((int) contractCount);
            List<String> contractIds = contractService.lambdaQuery().eq(TContract::getTenantId, loginUserApplet.getUserId()).list()
                    .stream().map(TContract::getId).collect(Collectors.toList());
            if (CollectionUtils.isEmpty(contractIds)){
                myToDoVO.setBillCount(0);
                myToDoVO.setContractCount(0);
                return R.ok(myToDoVO);
            }
            int billCount = billService.lambdaQuery().in(TBill::getContractId, contractIds).eq(TBill::getPayFeesStatus, 1).list().size();
            myToDoVO.setBillCount(billCount);
        }else {
@@ -96,16 +103,19 @@
            List<TContract> contractList = contractService.lambdaQuery().eq(TContract::getTenantId, loginUserApplet.getUserId())
                    .eq(TContract::getStatus, 4).list();
            List<THouse> houseList = houseService.list();
            List<TBill> bills = billService.lambdaQuery().eq(TBill::getPayFeesStatus,3).orderByDesc(TBill::getPayFeesTime).list();
            List<TBill> bills = billService.lambdaQuery().orderByDesc(TBill::getPayableFeesTime).list();
            for (TContract contract : contractList) {
                THouse tHouse = houseList.stream().filter(e -> e.getId().equals(contract.getHouseId())).findFirst().orElse(null);
                TBill bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null);
                TBill bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId())&&e.getPayFeesStatus().equals("3")).findFirst().orElse(null);
                if (bill==null){
                    bill = bills.stream().filter(e -> e.getContractId().equals(contract.getId())).findFirst().orElse(null);
                }
                if (tHouse!=null&& bill!=null){
                    MyHouseVO myToDoVO = new MyHouseVO();
                    myToDoVO.setHouseAddress(tHouse.getHouseAddress());
                    myToDoVO.setMonthRent(contract.getMonthRent());
                    myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE,contract.getPayType()));
                    myToDoVO.setMonth(bill.getPayFeesTime().getMonth()+"");
                    myToDoVO.setMonth(bill.getPayFeesTime()==null?bill.getPayableFeesTime().getMonth()+"月":bill.getPayFeesTime().getMonth()+"月");
                    myToDoVO.setHouseArea(tHouse.getHouseArea());
                    myToDoVO.setHouseType(tHouse.getHouseType());
                    myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime()));
@@ -151,6 +161,39 @@
        return R.ok(myToDoVO);
    }
    /**
     * 获取验收记录管理列表
     */
    @ApiOperation(value = "管理员-房屋验收单列表")
    @PostMapping(value = "/admin/houseCheck")
    public R<PageInfo<TCheckAcceptRecordVO>> houseCheck(@RequestBody TCheckAcceptRecordAppletQuery query) {
        return R.ok(checkAcceptRecordService.pageListApplet(query));
    }
    /**
     * 查看验收记录详情
     */
    @ApiOperation(value = "管理员-查看验收记录详情")
    @GetMapping(value = "/getDetailById")
    public R<TCheckAcceptRecordVO> getDetailById(@RequestParam String id) {
        TCheckAcceptRecord checkAcceptRecord = checkAcceptRecordService.getById(id);
        checkAcceptRecord.setCleanSituation(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getCleanSituation()));
        checkAcceptRecord.setOverallSituation(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getOverallSituation()));
        checkAcceptRecord.setDeviceSituation(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getDeviceSituation()));
        checkAcceptRecord.setFurnitureSituation(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CHECK_SITUATION,checkAcceptRecord.getFurnitureSituation()));
        TCheckAcceptRecordVO checkAcceptRecordVO = new TCheckAcceptRecordVO();
        BeanUtils.copyProperties(checkAcceptRecord, checkAcceptRecordVO);
        // 查询合同信息
        checkAcceptRecordVO.setContract(contractService.getById(checkAcceptRecord.getContractId()));
        // 查询房屋信息
        checkAcceptRecordVO.setHouse(houseService.getById(checkAcceptRecord.getHouseId()));
        return R.ok(checkAcceptRecordVO);
    }
    @ApiOperation(value = "管理员-新增验收")
    @GetMapping(value = "/addRecord")
    public R<TCheckAcceptRecordVO> getDetailById(@Validated @RequestBody TCheckAcceptRecord dto) {
        return R.ok();
    }
}