|
@@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fjhx.account.entity.account.po.AccountManagement;
|
|
|
import com.fjhx.account.entity.account.po.AccountRemainder;
|
|
|
+import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
|
import com.fjhx.account.mapper.account.AccountManagementMapper;
|
|
|
import com.fjhx.account.service.account.AccountManagementService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.account.service.account.AccountRemainderService;
|
|
|
+import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
|
import com.obs.services.internal.ServiceException;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import org.apache.poi.util.StringUtil;
|
|
@@ -21,6 +23,7 @@ import com.fjhx.account.entity.account.dto.AccountManagementSelectDto;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.fjhx.account.entity.account.dto.AccountManagementDto;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -38,6 +41,9 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
@Autowired
|
|
|
private AccountRemainderService accountRemainderService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AccountRunningWaterService accountRunningWaterService;
|
|
|
+
|
|
|
/**
|
|
|
* 账户-管理表分页
|
|
|
*/
|
|
@@ -76,6 +82,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
* 账户-管理表新增
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
public void add(AccountManagementDto accountManagementDto) {
|
|
|
//判断账户的别名是否已存在
|
|
|
List<AccountManagement> accountManagements = this.list(Wrappers.<AccountManagement>lambdaQuery()
|
|
@@ -93,6 +100,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
* 账户-管理表编辑
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
public void edit(AccountManagementDto accountManagementDto) {
|
|
|
//判断账户的别名是否已存在
|
|
|
List<AccountManagement> accountManagements = this.list(Wrappers.<AccountManagement>lambdaQuery()
|
|
@@ -113,7 +121,15 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
* 账户-管理表删除
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
public void delete(Long id) {
|
|
|
+ //查询流水表的信息
|
|
|
+ List<AccountRunningWater> accountRunningWaterList = accountRunningWaterService.list(Wrappers.<AccountRunningWater>lambdaQuery()
|
|
|
+ .eq(AccountRunningWater::getAccountManagementId, id));
|
|
|
+ //如果存在流水表的数据则不能删除账户表的信息
|
|
|
+ if (accountRunningWaterList.size()>0){
|
|
|
+ throw new ServiceException("无法删除,该账户已存在流水数据");
|
|
|
+ }
|
|
|
//删除账户-管理表的信息
|
|
|
this.removeById(id);
|
|
|
//删除账户-余额表的信息
|