瀏覽代碼

07 30 8 fix some bugs

hr 4 年之前
父節點
當前提交
26ba22d2fb

+ 1 - 1
src/main/java/com/imed/costaccount/model/dto/AccountProductSaveDTO.java

@@ -19,6 +19,6 @@ public class AccountProductSaveDTO {
     private Integer id;
 
     @ApiModelProperty(name="products",value = "成本项目id列表")
-    @NotEmpty(message = "成本项目id不能为空")
+//    @NotEmpty(message = "成本项目id不能为空")
     private List<Integer> products;
 }

+ 12 - 9
src/main/java/com/imed/costaccount/service/impl/AccountingServiceImpl.java

@@ -40,7 +40,8 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
         List<Accounting> list = this.list(
                 new LambdaQueryWrapper<Accounting>()
                         .eq(Accounting::getHospId, user.getHospId())
-                .orderByDesc(Accounting::getCreateTime)
+                        .eq(Accounting::getAccountingType, accountType)
+                        .orderByDesc(Accounting::getCreateTime)
         );
         if (CollUtil.isEmpty(list)) {
             return Collections.emptyList();
@@ -59,6 +60,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
 
     /**
      * 递归处理
+     *
      * @param accountVO
      * @param list
      * @return
@@ -153,14 +155,14 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
     @Override
     public List<SelectAccountingVO> selectAccounting(User user) {
         List<Accounting> list = this.list(
-                new LambdaQueryWrapper<Accounting>().select(Accounting::getId,Accounting::getAccountingName,Accounting::getParentId,Accounting::getAllParentIds)
+                new LambdaQueryWrapper<Accounting>().select(Accounting::getId, Accounting::getAccountingName, Accounting::getParentId, Accounting::getAllParentIds)
                         .eq(Accounting::getHospId, user.getHospId())
         );
         if (CollUtil.isEmpty(list)) {
             return Collections.emptyList();
         }
         // 所有的
-        List<SelectAccountingVO> all = list.stream().map(i ->{
+        List<SelectAccountingVO> all = list.stream().map(i -> {
             SelectAccountingVO vo = new SelectAccountingVO();
             vo.setValue(i.getId());
             vo.setLabel(i.getAccountingName());
@@ -205,12 +207,12 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
      * @param user
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public void updateAccount(AccountingEditDTO accountingEditDTO, User user) {
         // TODO: 2021/7/28 追踪溯源需求不满足
         Integer id = accountingEditDTO.getId();
 //        this.checkAccountingCode(accountingEditDTO.getAccountingCode(), user.getHospId());
-        Accounting  one = this.baseMapper.selectOne(
+        Accounting one = this.baseMapper.selectOne(
                 new QueryWrapper<Accounting>().lambda()
                         .eq(Accounting::getAccountingCode, accountingEditDTO.getAccountingCode())
                         .eq(Accounting::getHospId, user.getHospId())
@@ -222,7 +224,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
             throw new CostException(500, "当前选中会计科目已被移除");
         }
         if (Objects.nonNull(one) && !byId.getAccountingCode().equals(one.getAccountingCode())) {
-                throw new CostException(500, "会计科目代码已存在,请重新生成");
+            throw new CostException(500, "会计科目代码已存在,请重新生成");
         }
         // 直接修改
         byId.setAccountingCode(accountingEditDTO.getAccountingCode());
@@ -269,7 +271,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
 //        return allParentIds;
 //    }
 
-    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public void saveAccount(AccountingEditDTO accountingEditDTO, User user, Accounting byId, Accounting accounting) {
         this.checkAccountingCode(accountingEditDTO.getAccountingCode(), user.getHospId());
         accounting.setAccountingCode(accounting.getAccountingCode());
@@ -295,6 +297,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
 
     /**
      * 得到自己还有所有的子节点
+     *
      * @param ids
      * @param accounts
      * @return
@@ -303,7 +306,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
 
         List<Accounting> list = this.list(
                 new LambdaQueryWrapper<Accounting>()
-                        .in(Accounting::getParentId, ids).eq(Accounting::getHospId,hospId)
+                        .in(Accounting::getParentId, ids).eq(Accounting::getHospId, hospId)
         );
         if (CollUtil.isEmpty(list)) {
             return accounts;
@@ -320,7 +323,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
      * @param user
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public void deleteAccount(Integer id, User user) {
         List<Accounting> list = new ArrayList<>();
         List<Accounting> andAllChild = this.getAndAllChild(Arrays.asList(id), user.getHospId(), list);