From 5fa6e6f8410ef9d057174bcff2a3c5038c54a551 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期日, 27 四月 2025 18:41:20 +0800 Subject: [PATCH] bug修改 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 98 insertions(+), 13 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java index a596a85..23c3862 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java @@ -5,12 +5,9 @@ import com.ruoyi.common.constant.AmountConstant; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.DisabledEnum; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.OrderNos; -import com.ruoyi.common.utils.SmsUtil; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.TencentMailUtil; +import com.ruoyi.common.utils.*; import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.system.dto.BillStatisticsDto; import com.ruoyi.system.dto.CachPayDto; @@ -40,6 +37,7 @@ import com.taxi591.bankapi.dto.ChargeBillRequest; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; +import org.joda.time.LocalDateTime; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -108,6 +106,12 @@ return info; } + public PageInfo<TBillDto> queryPageForApplet(TBillQuery query){ + PageInfo<TBill> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); + PageInfo<TBillDto> info = tBillMapper.pageForApplet(pageInfo, query); + return info; + } + @Override public List<String> getBillIds(TBillQuery query) { List<TBillDto> billDtos = tBillMapper.getBillList(query); @@ -150,6 +154,7 @@ if (presist.getPayFeesStatus().equals("3")){ throw new ServiceException("该账单已缴费完成"); } + switch (type){ // 仅更新除金额字段外的属性 case 1: @@ -182,6 +187,7 @@ BigDecimal outstand = presist.getPayableFeesMoney() .add(save.getPayableFeesPenalty()) .subtract(presist.getPayFeesMoney()); + save.setOutstandingMoney(outstand); } //处理缴费金额 @@ -195,7 +201,7 @@ .subtract(save.getPayFeesMoney()); save.setOutstandingMoney(outstand); //抵扣金额就是缴费金额 - save.setDeductionMoney(tBill.getPayableFeesMoney()); + save.setDeductionMoney(tBill.getPayFeesMoney()); save.setPreOutstand(presist.getOutstandingMoney()); if (outstand.compareTo(BigDecimal.ZERO)<=0){ save.setPayFeesStatus("3"); @@ -205,6 +211,7 @@ break; } + save.setBusinessDeptId(presist.getBusinessDeptId()); updateById(save); return save; }finally { @@ -247,6 +254,7 @@ @Override @Transactional(rollbackFor = Exception.class) public void saveBill(TbillSaveDto bill) { + bill.setManualAddition(DisabledEnum.YES.getCode()); save(bill); if (bill.getBillType().equals("3")){ if (bill.getDetails()==null || bill.getDetails().size()==0){ @@ -301,6 +309,7 @@ TFlowManagement save = new TFlowManagement(); save.setPayType(3); save.setPayer(dto.getPayer()); + save.setBusinessDeptId(bill.getBusinessDeptId()); save.setPayTime(bankflow.getPayTime()); save.setSysSerialNumber(OrderNos.getDid(30)); save.setBankSerialNumber(bankflow.getBankSerialNumber()); @@ -326,6 +335,7 @@ save.setPayType(3); save.setPayer(dto.getPayer()); save.setPayTime(billSave.getPayFeesTime()); + save.setBusinessDeptId(bill.getBusinessDeptId()); save.setSysSerialNumber(OrderNos.getDid(30)); save.setFlowType(1); save.setPaymentBillId(back.getId()); @@ -382,6 +392,7 @@ TFlowManagement saveFlow = new TFlowManagement(); saveFlow.setPayType(1); saveFlow.setPayer(order.getUserId()); + saveFlow.setBusinessDeptId(bill.getBusinessDeptId()); saveFlow.setPayTime(DateUtils.dateToLocalDateTime(save.getPayTime())); saveFlow.setSysSerialNumber(OrderNos.getDid(30)); saveFlow.setBankSerialNumber(save.getPayNo()); @@ -408,6 +419,7 @@ } } + /** * 根据发票编号查询账单列表 @@ -549,6 +561,7 @@ TFlowManagement save = new TFlowManagement(); save.setPayType(3); save.setPayer(dto.getPayer()); + save.setBusinessDeptId(bill.getBusinessDeptId()); save.setPayTime(bankflow!=null?bankflow.getPayTime():DateUtils.dateToLocalDateTime(new Date())); save.setSysSerialNumber(OrderNos.getDid()); save.setBankSerialNumber(bankflow!=null?bankflow.getBankSerialNumber():null); @@ -563,12 +576,12 @@ } @Override - public BillStatisticsDto statistics(String busDeptId) { + public BillStatisticsDto statistics(TBillQuery query) { BillStatisticsDto dto = new BillStatisticsDto(); - dto.setRent(getBaseMapper().statisticsAllRent(busDeptId)); - dto.setNopay(getBaseMapper().statisticsNoPay(busDeptId)); - dto.setPayed(getBaseMapper().statisticsPayed(busDeptId)); - dto.setOverdue(getBaseMapper().statisticsOverdue(busDeptId)); + dto.setRent(getBaseMapper().statisticsAllRent(query)); + dto.setNopay(getBaseMapper().statisticsNoPay(query)); + dto.setPayed(getBaseMapper().statisticsPayed(query)); + dto.setOverdue(getBaseMapper().statisticsOverdue(query)); return dto; } @@ -582,7 +595,79 @@ * @return */ @Override - public List<ScreenRentRankVO> getStreetRentRank() { - return baseMapper.getStreetRentRank(); + public List<ScreenRentRankVO> getStreetRentRank(String businessDeptId) { + return baseMapper.getStreetRentRank(businessDeptId); } + /** + * 查询季付账单 + * @param businessDeptId + * @return + */ + @Override + public List<TBill> getJiFuBillList(String businessDeptId) { + return baseMapper.getJiFuBillList(businessDeptId,null,null); + } + + /** + * 查询当前季度的季付账单 + * @param businessDeptId + * @param first + * @param last + * @return + */ + @Override + public List<TBill> getJiFuBillListByTime(String businessDeptId, Date first, Date last) { + return baseMapper.getJiFuBillList(businessDeptId,first,last); + } + + @Override + public void editAmount(TbillSaveDto bill) { + String requestId = UUID.fastUUID().toString(); + String lockkey = CacheConstants.BILL_UPDATE_LOCK_KEY + bill.getId(); + boolean isok = redisCache.trylockLoop(lockkey, requestId, 60); + if (isok){ + try { + TBill presist = getById(bill.getId()); + TBill save = new TBill(); + save.setId(bill.getId()); + BigDecimal preOutstand = presist.getOutstandingMoney(); + // 如果传入的金额小于0,则是扣减,如果大于0,是增加金额,增加金额只加入欠费金额中 + if (bill.getEditAmount().compareTo(BigDecimal.ZERO)<0 + && presist.getPayableFeesPenalty().compareTo(BigDecimal.ZERO)>0){ + BigDecimal prePayableFeesPenalty = presist.getPayableFeesPenalty(); + //违约金大于调整金额,够减 + if (prePayableFeesPenalty.compareTo(bill.getEditAmount().abs())>=0){ + BigDecimal afterPenalty = prePayableFeesPenalty.add(bill.getEditAmount()); + save.setPayableFeesPenalty(afterPenalty); + }else{ + BigDecimal afterPenalty = BigDecimal.ZERO; + save.setPayableFeesPenalty(afterPenalty); + } + } + BigDecimal afterOutstand = preOutstand.add(bill.getEditAmount()); + save.setOutstandingMoney(afterOutstand); + updateById(save); + }finally { + redisCache.unlock(lockkey,requestId); + } + } + + //todo 记录金额修改记录 +// TFlowManagement flow = new TFlowManagement(); +// flow.setPayType(3); +// flow.setPayer("管理员修改"); +// flow.setBusinessDeptId(presist.getBusinessDeptId()); +// flow.setPayTime(DateUtils.dateToLocalDateTime(new Date())); +// flow.setSysSerialNumber(OrderNos.getDid(30)); +// flow.setFlowType(1); +// flow.setPaymentBillId(back.getId()); +// flow.setDeductionMoney(back.getDeductionMoney()); +// flow.setFlowMoney(save.getOutstandingMoney()); +// flow.setRemainingMoney(back.getOutstandingMoney()); +// flow.setPreOutstand(back.getPreOutstand()); +// flow.setCreateBy(SecurityUtils.getUsername()); +// tFlowManagementService.save(flow); + } + + } -- Gitblit v1.7.1