ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -34,59 +34,42 @@ private TContractService contractService; @Autowired private TBillService billService; @Autowired private TContractRentTypeService contractRentTypeService; // 每天凌晨00点执行的定时任务 用于生成违约金 // 用于更新违约金账单 @Scheduled(cron = "0 0 0 * * ?") public void dayOfProportionBill() { try { // 查询所有未缴费账单 List<TBill> list = billService.lambdaQuery().eq(TBill::getPayFeesStatus, 1).list(); for (TBill tBill : list) { if (tBill.getPayableFeesTime().isAfter(LocalDate.now())){ tBill.setPayFeesStatus("4"); } TContract contract = contractService.getById(tBill.getContractId()); LocalDate payableFeesTime = tBill.getPayableFeesTime(); LocalDateTime now = LocalDateTime.now(); // 计算两个时间相差多少个小时 long hours = ChronoUnit.HOURS.between(payableFeesTime, now); long l = hours / 72; if (l>0){ long l = hours / 24; if (l>3){ // 违约金比例 BigDecimal proportion = contract.getProportion(); // 应缴违约金 BigDecimal money = tBill.getOutstandingMoney().multiply(proportion); TBill changeBill = new TBill(); changeBill.setId(tBill.getId()); changeBill.setPayableFeesPenalty(money); billService.lockAndUpdateInfo(changeBill,2); // 按每天 待缴费金额 * XX% 增加违约金费用 if (tBill.getOutstandingMoney().compareTo(new BigDecimal("0"))==0){ tBill.setPayFeesStatus("3"); billService.updateById(tBill); continue; } BigDecimal money = tBill.getOutstandingMoney().multiply(proportion).setScale(2, BigDecimal.ROUND_DOWN); tBill.setOverDays((int) l); tBill.setPayableFeesPenalty((tBill.getPayableFeesPenalty()!=null?tBill.getPayableFeesPenalty():BigDecimal.ZERO).add(money)); } billService.updateById(tBill); } } catch (Exception e) { e.printStackTrace(); } } // 每天凌晨00点执行的定时任务 根据应缴费日期修改账单状态 @Scheduled(cron = "0 0 0 * * ?") public void dayOfEndBill() { try { List<TBill> list = billService.lambdaQuery().eq(TBill::getPayFeesStatus, "2").list(); for (TBill tBill : list) { if (tBill.getPayableFeesTime().equals(LocalDate.now())){ tBill.setPayFeesStatus("1"); } } billService.updateBatchById(list); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
@@ -109,6 +109,8 @@ return R.ok(myToDoVO); } @ApiOperation(value = "租户-当前在租房源") @PostMapping(value = "/tenant/myHouse") public R<List<MyHouseVO>> myHouse() { @@ -132,7 +134,7 @@ myToDoVO.setHouseAddress(tHouse.getHouseAddress()); myToDoVO.setMonthRent(contract.getMonthRent()); myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType())); myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth() + "月" : bill.getPayFeesTime().getMonth() + "月"); myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth().getValue() + "月" : bill.getPayFeesTime().getMonth().getValue() + "月"); myToDoVO.setHouseArea(tHouse.getHouseArea()); myToDoVO.setHouseType(tHouse.getHouseType()); myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime())); @@ -180,7 +182,7 @@ myToDoVO.setHouseAddress(tHouse.getHouseAddress()); myToDoVO.setMonthRent(contract.getMonthRent()); myToDoVO.setPayType(DictUtils.getDictLabel(DictConstants.DICT_TYPE_CONTRACT_PAY_TYPE, contract.getPayType())); myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth() + "月" : bill.getPayFeesTime().getMonth() + "月"); myToDoVO.setMonth(bill.getPayFeesTime() == null ? bill.getPayableFeesTime().getMonth().getValue() + "月" : bill.getPayFeesTime().getMonth().getValue() + "月"); myToDoVO.setHouseArea(tHouse.getHouseArea()); myToDoVO.setHouseType(tHouse.getHouseType()); myToDoVO.setEndTime(DateUtils.localDateTimeToStringYear(contract.getEndTime())); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FlowListenerService.java
@@ -745,6 +745,7 @@ contractService.updateContractAuditStatus(processParameter.getString("projectId"), submitStatus); // 生成验收记录 TContract contract = contractService.getById(processParameter.getString("projectId")); contract.setStatus("7"); TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord(); tCheckAcceptRecord.setContractId(contract.getId()); tCheckAcceptRecord.setHouseId(contract.getHouseId()); @@ -758,10 +759,11 @@ tCheckAcceptRecord.setCode(replace.substring(2)+String.format("%03d", size+1)); checkAcceptRecordMapper.insert(tCheckAcceptRecord); // 将所有未缴费账单设置未已失效 List<TBill> tBills = billService.list(new LambdaQueryWrapper<TBill>() .in(TBill::getPayFeesStatus, Arrays.asList("1,4")) .in(TBill::getPayFeesStatus, Arrays.asList("1,2,4")) .eq(TBill::getContractId, contract.getId())); for (TBill tBill : tBills) { tBill.setPayFeesStatus("5"); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java
@@ -132,11 +132,8 @@ } public static void main(String[] args) { // LocalDate now = LocalDate.now(); // String replace = (now + "").replace("-", ""); // System.err.println(replace.substring(2)); // // System.err.println(String.format("%03d",1)); String t = "1000438"; System.err.println("XN" + String.valueOf(t).substring(1)); } @Override public CheckAcceptRecordVO getCheckByContractId(String id) { ruoyi-system/src/main/resources/mapper/system/TFaultRepairMessageMapper.xml
@@ -158,6 +158,7 @@ t.create_by, t.update_by, t.disabled, t.code, i.item_name AS itemName, it.type_name AS itemTypeName, tnt.resident_name AS residentName