|
@@ -17,11 +17,13 @@ import com.fjhx.account.entity.account.po.AccountRemainder;
|
|
import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
|
|
import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
|
|
import com.fjhx.account.entity.tax.po.TaxRefundDetails;
|
|
import com.fjhx.account.entity.tax.po.TaxRefundDetails;
|
|
|
|
+import com.fjhx.account.entity.transaction.po.Transaction;
|
|
import com.fjhx.account.mapper.account.AccountRunningWaterMapper;
|
|
import com.fjhx.account.mapper.account.AccountRunningWaterMapper;
|
|
import com.fjhx.account.service.account.AccountManagementService;
|
|
import com.fjhx.account.service.account.AccountManagementService;
|
|
import com.fjhx.account.service.account.AccountRemainderService;
|
|
import com.fjhx.account.service.account.AccountRemainderService;
|
|
import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
import com.fjhx.account.service.tax.TaxRefundDetailsService;
|
|
import com.fjhx.account.service.tax.TaxRefundDetailsService;
|
|
|
|
+import com.fjhx.account.service.transaction.TransactionService;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
import com.fjhx.common.enums.PushBusinessTypeEnum;
|
|
import com.fjhx.common.enums.PushBusinessTypeEnum;
|
|
@@ -71,6 +73,8 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
private AccountManagementService accountManagementService;
|
|
private AccountManagementService accountManagementService;
|
|
@Autowired
|
|
@Autowired
|
|
private TaxRefundDetailsService taxRefundDetailsService;
|
|
private TaxRefundDetailsService taxRefundDetailsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TransactionService transactionService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Page<AccountRunningWaterVo> getPage(AccountRunningWaterSelectDto dto) {
|
|
public Page<AccountRunningWaterVo> getPage(AccountRunningWaterSelectDto dto) {
|
|
@@ -225,6 +229,21 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
|
|
|
this.save(dto);
|
|
this.save(dto);
|
|
|
|
|
|
|
|
+ //如果是往来
|
|
|
|
+ if (1 == dto.getIsTransaction()) {
|
|
|
|
+ //创建往来数据
|
|
|
|
+ Transaction transaction = new Transaction();
|
|
|
|
+ transaction.setDepartmentId(dto.getTransactionDeptId());
|
|
|
|
+ transaction.setType("10".equals(dto.getStatus()) ? 0 : 1);
|
|
|
|
+ transaction.setCurrency(dto.getCurrency());
|
|
|
|
+ transaction.setAmount(dto.getAmount());
|
|
|
|
+ transaction.setIsFlowingWater(1);
|
|
|
|
+ transaction.setAccountId(dto.getAccountManagementId());
|
|
|
|
+ transaction.setRemark(dto.getRemarks());
|
|
|
|
+ transaction.setAccountRunningWaterId(dto.getId());
|
|
|
|
+ transactionService.save(transaction);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 发送消息推送
|
|
// 发送消息推送
|
|
sendSocket(dto);
|
|
sendSocket(dto);
|
|
}
|
|
}
|
|
@@ -272,7 +291,7 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@DSTransactional
|
|
@DSTransactional
|
|
- public void edit(AccountRunningWater accountRunningWaterDto) {
|
|
|
|
|
|
+ public void edit(AccountRunningWaterDto accountRunningWaterDto) {
|
|
//先回滚历史数据
|
|
//先回滚历史数据
|
|
//获取历史的流水信息信息
|
|
//获取历史的流水信息信息
|
|
AccountRunningWater oldAccountRunningWater = getById(accountRunningWaterDto.getId());
|
|
AccountRunningWater oldAccountRunningWater = getById(accountRunningWaterDto.getId());
|
|
@@ -286,6 +305,26 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
changeRemainder(accountRunningWaterDto);
|
|
changeRemainder(accountRunningWaterDto);
|
|
|
|
|
|
this.updateById(accountRunningWaterDto);
|
|
this.updateById(accountRunningWaterDto);
|
|
|
|
+
|
|
|
|
+ //修改往来信息
|
|
|
|
+ if (0 == accountRunningWaterDto.getIsTransaction()) {
|
|
|
|
+ //如果不是往来(删除往来数据,防止原来是往来改为不是往来)
|
|
|
|
+ transactionService.remove(q -> q.eq(Transaction::getAccountRunningWaterId, accountRunningWaterDto.getId()));
|
|
|
|
+ } else {
|
|
|
|
+ //如果是往来(添加/修改)往来信息,防止原来不是往来修改成往来
|
|
|
|
+ Transaction transaction = transactionService.getOne(q -> q.eq(Transaction::getAccountRunningWaterId, accountRunningWaterDto.getId()));
|
|
|
|
+ transaction = ObjectUtil.isNotEmpty(transaction) ? transaction : new Transaction();
|
|
|
|
+
|
|
|
|
+ transaction.setDepartmentId(accountRunningWaterDto.getTransactionDeptId());
|
|
|
|
+ transaction.setType("10".equals(accountRunningWaterDto.getStatus()) ? 0 : 1);
|
|
|
|
+ transaction.setCurrency(accountRunningWaterDto.getCurrency());
|
|
|
|
+ transaction.setAmount(accountRunningWaterDto.getAmount());
|
|
|
|
+ transaction.setIsFlowingWater(1);
|
|
|
|
+ transaction.setAccountId(accountRunningWaterDto.getAccountManagementId());
|
|
|
|
+ transaction.setRemark(accountRunningWaterDto.getRemarks());
|
|
|
|
+ transaction.setAccountRunningWaterId(accountRunningWaterDto.getId());
|
|
|
|
+ transactionService.saveOrUpdate(transaction);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@DSTransactional
|
|
@DSTransactional
|
|
@@ -302,6 +341,11 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
changeRemainder(accountRunningWater);
|
|
changeRemainder(accountRunningWater);
|
|
|
|
|
|
this.removeById(id);
|
|
this.removeById(id);
|
|
|
|
+
|
|
|
|
+ //删除往来
|
|
|
|
+ if (1 == accountRunningWater.getIsTransaction()) {
|
|
|
|
+ transactionService.remove(q -> q.eq(Transaction::getAccountRunningWaterId, id));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -450,7 +494,8 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
/**
|
|
/**
|
|
* 余额操作
|
|
* 余额操作
|
|
*/
|
|
*/
|
|
- private void changeRemainder(AccountRunningWater accountRunningWater) {
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void changeRemainder(AccountRunningWater accountRunningWater) {
|
|
// 修改账户余额表的余额
|
|
// 修改账户余额表的余额
|
|
AccountRemainder accountRemainder = accountRemainderService.getOne(q -> q
|
|
AccountRemainder accountRemainder = accountRemainderService.getOne(q -> q
|
|
.eq(AccountRemainder::getAccountManagementId, accountRunningWater.getAccountManagementId())
|
|
.eq(AccountRemainder::getAccountManagementId, accountRunningWater.getAccountManagementId())
|