|
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.imed.costaccount.common.exception.CostException;
|
|
|
+import com.imed.costaccount.common.util.UserContext;
|
|
|
import com.imed.costaccount.mapper.AccountingMapper;
|
|
|
import com.imed.costaccount.mapper.AccountingProductMapper;
|
|
|
import com.imed.costaccount.mapper.ProductMapper;
|
|
@@ -123,17 +124,16 @@ public class AccountingProductServiceImpl extends ServiceImpl<AccountingProductM
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public void saveAccountProduct(AccountProductSaveDTO accountProductSaveDTO, User user) {
|
|
|
- // TODO: 2021/8/4 校验这个 会计科目是否能绑定数据
|
|
|
Long accountId = accountProductSaveDTO.getId();
|
|
|
// 删除所有原来的关系
|
|
|
this.remove(new LambdaQueryWrapper<AccountingProduct>().eq(AccountingProduct::getAccountingId, accountId));
|
|
|
-
|
|
|
+ Long hospId = UserContext.getHospId();
|
|
|
List<Long> products = accountProductSaveDTO.getProducts();
|
|
|
List<AccountingProduct> accountingProducts = products.stream().map(i -> {
|
|
|
AccountingProduct accountingProduct = new AccountingProduct();
|
|
|
accountingProduct.setAccountingId(accountId)
|
|
|
.setProductId(i)
|
|
|
- .setHospId(user.getHospId())
|
|
|
+ .setHospId(hospId)
|
|
|
.setCreateTime(System.currentTimeMillis());
|
|
|
return accountingProduct;
|
|
|
}).collect(Collectors.toList());
|