|
@@ -13,6 +13,7 @@ import com.imed.costaccount.model.dto.AccountingSaveDTO;
|
|
import com.imed.costaccount.model.vo.AccountVO;
|
|
import com.imed.costaccount.model.vo.AccountVO;
|
|
import com.imed.costaccount.model.vo.SelectAccountingVO;
|
|
import com.imed.costaccount.model.vo.SelectAccountingVO;
|
|
import com.imed.costaccount.service.AccountingService;
|
|
import com.imed.costaccount.service.AccountingService;
|
|
|
|
+import com.imed.costaccount.service.CostShareParamService;
|
|
import com.imed.costaccount.utils.BeanUtil;
|
|
import com.imed.costaccount.utils.BeanUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,16 +27,22 @@ import java.util.stream.Collectors;
|
|
@Service("accountingService")
|
|
@Service("accountingService")
|
|
public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Accounting> implements AccountingService {
|
|
public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Accounting> implements AccountingService {
|
|
|
|
|
|
|
|
+ private final CostShareParamService shareParamService;
|
|
|
|
+
|
|
|
|
+ public AccountingServiceImpl(CostShareParamService shareParamService) {
|
|
|
|
+ this.shareParamService = shareParamService;
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取会计科目列表按收入支出类型
|
|
* 获取会计科目列表按收入支出类型
|
|
*
|
|
*
|
|
- * @param accountType 会计科目类型1.收入,2.支出
|
|
|
|
|
|
+ * @param accountType 会计科目类型1.收入,2.支出
|
|
* @param user
|
|
* @param user
|
|
|
|
+ * @param shareParamId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<AccountVO> getListByAccountType(Integer accountType, User user) {
|
|
|
|
|
|
+ public List<AccountVO> getListByAccountType(Integer accountType, User user, Integer shareParamId) {
|
|
// 1. 得到所有的会计科目
|
|
// 1. 得到所有的会计科目
|
|
List<Accounting> list = this.list(
|
|
List<Accounting> list = this.list(
|
|
new LambdaQueryWrapper<Accounting>()
|
|
new LambdaQueryWrapper<Accounting>()
|
|
@@ -48,6 +55,18 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
|
|
}
|
|
}
|
|
// 所有的
|
|
// 所有的
|
|
List<AccountVO> all = list.stream().map(i -> BeanUtil.convertObj(i, AccountVO.class)).collect(Collectors.toList());
|
|
List<AccountVO> all = list.stream().map(i -> BeanUtil.convertObj(i, AccountVO.class)).collect(Collectors.toList());
|
|
|
|
+ // 查询所有的已绑定的
|
|
|
|
+ if (Objects.nonNull(shareParamId)) {
|
|
|
|
+ List<Integer> ids = shareParamService.selectIsSelect(shareParamId);
|
|
|
|
+ if (CollUtil.isNotEmpty(ids)) {
|
|
|
|
+ all.forEach(i -> {
|
|
|
|
+ if (ids.contains(i.getId())) {
|
|
|
|
+ i.setIsSelect(true);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 顶层的
|
|
// 顶层的
|
|
List<AccountVO> parents = all.stream().filter(i -> i.getParentId() == 0).collect(Collectors.toList());
|
|
List<AccountVO> parents = all.stream().filter(i -> i.getParentId() == 0).collect(Collectors.toList());
|
|
List<AccountVO> accountVOS = new ArrayList<>();
|
|
List<AccountVO> accountVOS = new ArrayList<>();
|