From 411f3275d09e2963eb1150b0c9dd559a4abfd9e3 Mon Sep 17 00:00:00 2001 From: wujianwei <wjw@11.com> Date: 星期三, 13 八月 2025 14:38:08 +0800 Subject: [PATCH] 新增日志 --- service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java | 73 ++++++++++++++++++++++++++++++++++++ 1 files changed, 72 insertions(+), 1 deletions(-) diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java index 765e21a..d3fa8a3 100644 --- a/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java +++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/EstimatedReceivableServiceImpl.java @@ -1,9 +1,16 @@ package com.ruoyi.cwgl.service.impl; +import java.util.Date; import java.util.List; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import javax.annotation.Resource; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.cwgl.mapper.EstimatedReceivableLogMapper; +import com.ruoyi.cwgl.service.IEstimatedReceivableLogService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.scheduling.annotation.Async; @@ -33,7 +40,8 @@ protected final Logger logger = LoggerFactory.getLogger(getClass()); @Resource private EstimatedReceivableMapper estimatedReceivableMapper; - + @Autowired + private IEstimatedReceivableLogService logService; /** * 鏌ヨ棰勪及搴旀敹绠$悊 @@ -129,6 +137,8 @@ public int updateEstimatedReceivable(EstimatedReceivable estimatedReceivable) { estimatedReceivable.setUpdateTime(DateUtils.getNowDate()); + String username = SecurityUtils.getUsername(); + logService.insertEstimatedReceivableLog("淇敼搴旀敹",estimatedReceivable.getId(),username); return estimatedReceivableMapper.updateEstimatedReceivable(estimatedReceivable); } @@ -179,4 +189,65 @@ { return estimatedReceivableMapper.deleteEstimatedReceivableById(id); } + + @Override + public int confirm(Integer id) { + EstimatedReceivable estimatedReceivable = estimatedReceivableMapper.selectEstimatedReceivableById(id); + if (estimatedReceivable==null){ + throw new ServiceException("鏁版嵁涓嶅瓨鍦�"); + } + if (estimatedReceivable.getIsConfirmed().equals(2)) { + throw new ServiceException("璇ユ暟鎹凡浣滃簾"); + + } + if (estimatedReceivable.getIsConfirmed().equals(1)) { + throw new ServiceException("鏃犻渶閲嶅纭"); + + } + String username = SecurityUtils.getUsername(); + + logService.insertEstimatedReceivableLog("纭搴旀敹",id,username); + estimatedReceivable.setIsConfirmed(1); + estimatedReceivable.setConfirmBy(username); + estimatedReceivable.setConfirmTime(new Date()); + return estimatedReceivableMapper.updateEstimatedReceivable(estimatedReceivable); + } + + @Override + public int cancel(Integer id) { + EstimatedReceivable estimatedReceivable = estimatedReceivableMapper.selectEstimatedReceivableById(id); + if (estimatedReceivable==null){ + throw new ServiceException("鏁版嵁涓嶅瓨鍦�"); + } + if (estimatedReceivable.getIsConfirmed().equals(2)) { + throw new ServiceException("璇ユ暟鎹凡浣滃簾"); + + } + if (estimatedReceivable.getIsConfirmed().equals(0)) { + throw new ServiceException("鏃犻渶閲嶅鍙栨秷"); + + } + String username = SecurityUtils.getUsername(); + + logService.insertEstimatedReceivableLog("鍙栨秷搴旀敹",id,username); + estimatedReceivable.setIsConfirmed(0); + return estimatedReceivableMapper.updateEstimatedReceivable(estimatedReceivable); + } + + @Override + public int invalid(Integer id) { + EstimatedReceivable estimatedReceivable = estimatedReceivableMapper.selectEstimatedReceivableById(id); + if (estimatedReceivable==null){ + throw new ServiceException("鏁版嵁涓嶅瓨鍦�"); + } + if (estimatedReceivable.getIsConfirmed().equals(2)) { + throw new ServiceException("鏃犻渶閲嶅浣滃簾"); + + } + String username = SecurityUtils.getUsername(); + + logService.insertEstimatedReceivableLog("浣滃簾搴旀敹",id,username); + estimatedReceivable.setIsConfirmed(2); + return estimatedReceivableMapper.updateEstimatedReceivable(estimatedReceivable); + } } -- Gitblit v1.8.0