|
|
@@ -149,6 +149,7 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
}
|
|
|
if (ObjectUtils.isNotNull(accounts.getParentId())) {
|
|
|
selectSuperiorCode(accounts, accounts.getParentId());
|
|
|
+
|
|
|
} else {
|
|
|
accounts.setFullName(accounts.getCnName());
|
|
|
}
|
|
|
@@ -270,6 +271,8 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R detele(String ids) {
|
|
|
if (finVouchersItemsService.count(new LambdaQueryWrapper<FinVouchersItems>()
|
|
|
.apply("find_in_set(account_id,'" + ids + "')")
|
|
|
@@ -278,6 +281,29 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
.eq(FinVouchersItems::getBranchId, deptUtils.getDeptPid())) > 0) {
|
|
|
throw new RuntimeException("该科目已存在凭证,删除失败");
|
|
|
}
|
|
|
+ List<Long> idList = Func.toLongList(ids);
|
|
|
+ List<Accounts> accountsList = baseMapper.selectList(new LambdaQueryWrapper<Accounts>()
|
|
|
+ .in(Accounts::getId, idList));
|
|
|
+ List<Accounts> accountsPiIdList = baseMapper.selectList(new LambdaQueryWrapper<Accounts>()
|
|
|
+ .eq(Accounts::getTenantId, AuthUtil.getTenantId()));
|
|
|
+ List<Accounts> accountsList1 = new ArrayList<>();
|
|
|
+ for (Accounts item : accountsList) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getParentId()) && 0 != item.getParentId()) {
|
|
|
+ if (!accountsPiIdList.isEmpty()) {
|
|
|
+ Accounts accounts = accountsPiIdList.stream().filter(e -> e.getId().equals(item.getParentId())).findFirst().orElse(null);
|
|
|
+ if (accounts != null) {
|
|
|
+ if (accountsPiIdList.stream().noneMatch(e -> e.getParentId().equals(accounts.getId())
|
|
|
+ && !e.getId().equals(item.getId()))) {
|
|
|
+ accounts.setIsDetail(1);
|
|
|
+ accountsList1.add(accounts);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!accountsList1.isEmpty()) {
|
|
|
+ this.updateBatchById(accountsList1);
|
|
|
+ }
|
|
|
return R.status(SqlHelper.retBool(baseMapper.deleteBatchIds(Func.toLongList(ids))));
|
|
|
}
|
|
|
|
|
|
@@ -373,13 +399,13 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
String startMonth = "";
|
|
|
String endYear = "";
|
|
|
String endMonth = "";
|
|
|
- if (ObjectUtils.isNotNull(accountsDTO.getStartDate())) {
|
|
|
- String[] startDate = accountsDTO.getStartDate().split("-");
|
|
|
+ if (ObjectUtils.isNotNull(accountsDTO.getStartYear())) {
|
|
|
+ String[] startDate = accountsDTO.getStartYear().split("-");
|
|
|
startYear = startDate[0];
|
|
|
startMonth = startDate[1];
|
|
|
}
|
|
|
- if (ObjectUtils.isNotNull(accountsDTO.getEndDate())) {
|
|
|
- String[] endDate = accountsDTO.getEndDate().split("-");
|
|
|
+ if (ObjectUtils.isNotNull(accountsDTO.getEndYear())) {
|
|
|
+ String[] endDate = accountsDTO.getEndYear().split("-");
|
|
|
endYear = endDate[0];
|
|
|
endMonth = endDate[1];
|
|
|
}
|
|
|
@@ -404,8 +430,10 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
.eq(FinVouchersItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FinVouchersItems::getBranchId, deptUtils.getDeptPid())
|
|
|
.eq(FinVouchersItems::getAccountId, accountsDTO.getAccIds())
|
|
|
- .ge(ObjectUtils.isNotNull(accountsDTO.getStartDate()), FinVouchersItems::getVoucherDate, accountsDTO.getStartDate())
|
|
|
- .le(ObjectUtils.isNotNull(accountsDTO.getEndDate()), FinVouchersItems::getVoucherDate, accountsDTO.getEndDate())
|
|
|
+ .ge(ObjectUtils.isNotNull(startYear), FinVouchersItems::getAccountYear, startYear)
|
|
|
+ .le(ObjectUtils.isNotNull(endYear), FinVouchersItems::getAccountYear, endYear)
|
|
|
+ .ge(ObjectUtils.isNotNull(startMonth), FinVouchersItems::getAccountMonth, startMonth)
|
|
|
+ .le(ObjectUtils.isNotNull(endMonth), FinVouchersItems::getAccountMonth, endMonth)
|
|
|
.like(ObjectUtils.isNotNull(accountsDTO.getDescr()), FinVouchersItems::getDescr, accountsDTO.getDescr());
|
|
|
if (1 == accountsDTO.getAccType()) {
|
|
|
lambdaQueryWrapper.eq(ObjectUtils.isNotNull(accountsDTO.getCorpId()), FinVouchersItems::getCorpId, accountsDTO.getCorpId());
|
|
|
@@ -447,7 +475,7 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
for (FinVouchersItems vouchersItems : finVouchersItems) {
|
|
|
AccountsDetail detail = new AccountsDetail();
|
|
|
detail.setVoucherId(vouchersItems.getPid());
|
|
|
- detail.setVoucherDate(vouchersItems.getAccountYear() + "-" + vouchersItems.getAccountMonth() + vouchersItems.getAccountDay());
|
|
|
+ detail.setVoucherDate(vouchersItems.getAccountYear() + "-" + vouchersItems.getAccountMonth() + "-" + vouchersItems.getAccountDay());
|
|
|
detail.setVoucherNo(vouchersItems.getVoucherNo());
|
|
|
if (ObjectUtils.isNotNull(vouchersItems.getCorpCnName())) {
|
|
|
vouchersItems.setDescr(vouchersItems.getDescr() + "-" + vouchersItems.getCorpCnName());
|
|
|
@@ -663,10 +691,26 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
.le(ObjectUtils.isNotNull(accountsDTO.getLevelEnd()), Accounts::getLevel, accountsDTO.getLevelEnd())
|
|
|
);
|
|
|
//查询所有科目对应凭证明细数据
|
|
|
+ String startYear = "";
|
|
|
+ String startMonth = "";
|
|
|
+ String endYear = "";
|
|
|
+ String endMonth = "";
|
|
|
+ if (ObjectUtils.isNotNull(accountsDTO.getStartYear())) {
|
|
|
+ String[] startDate = accountsDTO.getStartYear().split("-");
|
|
|
+ startYear = startDate[0];
|
|
|
+ startMonth = startDate[1];
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(accountsDTO.getEndYear())) {
|
|
|
+ String[] endDate = accountsDTO.getEndYear().split("-");
|
|
|
+ endYear = endDate[0];
|
|
|
+ endMonth = endDate[1];
|
|
|
+ }
|
|
|
List<FinVouchersItems> finVouchersItemsList = finVouchersItemsService.list(new LambdaQueryWrapper<FinVouchersItems>()
|
|
|
.eq(FinVouchersItems::getIsDeleted, 0)
|
|
|
- .ge(ObjectUtils.isNotNull(accountsDTO.getStartDate()), FinVouchersItems::getVoucherDate, accountsDTO.getStartDate())
|
|
|
- .le(ObjectUtils.isNotNull(accountsDTO.getEndDate()), FinVouchersItems::getVoucherDate, accountsDTO.getEndDate())
|
|
|
+ .ge(ObjectUtils.isNotNull(startYear), FinVouchersItems::getAccountYear, startYear)
|
|
|
+ .le(ObjectUtils.isNotNull(endYear), FinVouchersItems::getAccountYear, endYear)
|
|
|
+ .ge(ObjectUtils.isNotNull(startMonth), FinVouchersItems::getAccountMonth, startMonth)
|
|
|
+ .le(ObjectUtils.isNotNull(endMonth), FinVouchersItems::getAccountMonth, endMonth)
|
|
|
.eq(FinVouchersItems::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FinVouchersItems::getBranchId, deptUtils.getDeptPid())
|
|
|
.apply("find_in_set(account_id,'" + accountsDTO.getAccIds() + "')"));
|
|
|
@@ -795,6 +839,8 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
|
|
|
} else {
|
|
|
accounts.setFullName(accounts1.getCnName() + "/" + accounts.getCnName());
|
|
|
}
|
|
|
+ accounts1.setIsDetail(0);
|
|
|
+ baseMapper.updateById(accounts1);
|
|
|
/*if (ObjectUtils.isNotNull(accounts1.getParentCode())) {
|
|
|
this.selectSuperiorCode(accounts, accounts1.getParentId());
|
|
|
}*/
|