瀏覽代碼

08 28 04 归集列表

hr 4 年之前
父節點
當前提交
23dfe37051

+ 3 - 0
src/main/java/com/imed/costaccount/model/vo/NavVO.java

@@ -16,6 +16,9 @@ public class NavVO {
 
     private String name;
 
+    @JsonIgnore
+    private Integer orderNum;
+
 //    @JsonIgnore
     private String icon;
 

+ 8 - 1
src/main/java/com/imed/costaccount/service/CostCostingGroupService.java

@@ -5,7 +5,6 @@ import com.imed.costaccount.common.util.PageUtils;
 import com.imed.costaccount.common.util.Result;
 import com.imed.costaccount.model.CostCostingGroup;
 import com.imed.costaccount.model.User;
-import com.imed.costaccount.model.dto.StartDTO;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
@@ -62,5 +61,13 @@ public interface CostCostingGroupService extends IService<CostCostingGroup> {
      * @return List
      */
     List<CostCostingGroup> getByYearAndDate(Integer year, Integer month, Long hospId);
+
+    /**
+     * 撤销分摊
+     * @param year
+     * @param month
+     * @param hospId
+     */
+    void cancelAllocation(Integer year, Integer month, Long hospId);
 }
 

+ 29 - 1
src/main/java/com/imed/costaccount/service/impl/CostCostingGroupServiceImpl.java

@@ -12,6 +12,7 @@ import com.imed.costaccount.common.util.*;
 import com.imed.costaccount.constants.NumberConstant;
 import com.imed.costaccount.common.enums.DateStyleEnum;
 import com.imed.costaccount.mapper.AllocationMapper;
+import com.imed.costaccount.mapper.AllocationQueryMapper;
 import com.imed.costaccount.mapper.CostCostingGroupMapper;
 import com.imed.costaccount.model.*;
 import com.imed.costaccount.model.vo.*;
@@ -42,19 +43,21 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
     private final ResponsibilityService responsibilityService;
 
     private final AllocationMapper allocationMapper;
+    private final AllocationQueryMapper allocationQueryMapper;
 
 
     public CostCostingGroupServiceImpl(CostIncomeGroupServiceImpl costIncomeGroupService,
                                        AccountingService accountingService,
                                        AccountingProductService accountingProductService,
                                        CostIncomeFileService costIncomeFileService,
-                                       ResponsibilityService responsibilityService, AllocationMapper allocationMapper) {
+                                       ResponsibilityService responsibilityService, AllocationMapper allocationMapper, AllocationQueryMapper allocationQueryMapper) {
         this.costIncomeGroupService = costIncomeGroupService;
         this.accountingService = accountingService;
         this.accountingProductService = accountingProductService;
         this.costIncomeFileService = costIncomeFileService;
         this.responsibilityService = responsibilityService;
         this.allocationMapper = allocationMapper;
+        this.allocationQueryMapper = allocationQueryMapper;
     }
 
     /**
@@ -450,4 +453,29 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
                         .eq(CostCostingGroup::getHospId, hospId)
         );
     }
+
+    /**
+     * 撤销分摊
+     *
+     * @param year
+     * @param month
+     * @param hospId
+     */
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
+    public void cancelAllocation(Integer year, Integer month, Long hospId) {
+        allocationMapper.delete(
+                new LambdaQueryWrapper<Allocation>()
+                        .eq(Allocation::getDateYear, year)
+                        .eq(Allocation::getDateMonth, month)
+                        .eq(Allocation::getHospId, hospId)
+        );
+
+        allocationQueryMapper.delete(
+                new LambdaQueryWrapper<AllocationQuery>()
+                        .eq(AllocationQuery::getDateYear, year)
+                        .eq(AllocationQuery::getDateMonth, month)
+                        .eq(AllocationQuery::getHospId, hospId)
+        );
+    }
 }

+ 2 - 4
src/main/java/com/imed/costaccount/service/impl/MenuServiceImpl.java

@@ -23,10 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -193,6 +190,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
             navVOList.addAll(navs);
         }
         navVOList.removeIf(next -> CollUtil.isEmpty(next.getChildren()));
+        navVOList = navVOList.stream().sorted((Comparator.comparingInt(NavVO::getOrderNum))).collect(Collectors.toList());
         return navVOList;
     }
 

+ 8 - 0
src/main/java/com/imed/costaccount/web/CostCostingGroupController.java

@@ -70,9 +70,17 @@ public class CostCostingGroupController extends AbstractController {
         return Result.ok(pageUtils);
     }
 
+    @ApiOperation("撤销分摊")
+    @PostMapping("/cancelAllocation")
+    public Result cancelAllocation(@RequestParam Integer year, @RequestParam Integer month) {
+        costCostingGroupService.cancelAllocation(year, month,getHospId());
+        return Result.ok();
+    }
+
     @ApiOperation("开始分摊")
     @PostMapping("/startAllocation")
     public Result startAllocation(@RequestBody @Valid StartDTO startDTO) {
+
 //        costCostingGroupService.startAllocation(startDTO, getHospId());
         allocationService.startAllocation(startDTO, getHospId());
         return Result.ok();

+ 1 - 10
src/main/resources/mapper/CostCostingGroupMapper.xml

@@ -32,7 +32,7 @@
         ccg.date_month as month,
         ccg.amount as amount,
         ccg.department_code as departCode,
-        sd.department_name as departName,
+        ccg.department_name as departName,
         ccg.responsibility_code as responsibilityCode,
         cr.responsibility_name as responsibilityName,
         ccg.account_code as accountCode,
@@ -41,8 +41,6 @@
         cp.product_name as productName,
         ccg.file_id as fileId
         from cost_costing_group ccg
-        left join sys_department sd
-        on ccg.hosp_id = sd.hosp_id and ccg.department_code = sd.department_code
         left join cost_responsibility cr
         on ccg.responsibility_code = cr.responsibility_code and ccg.hosp_id = cr.hosp_id
         left join cost_accounting ca on ccg.account_code = ca.accounting_code and ccg.hosp_id = ca.hosp_id
@@ -58,7 +56,6 @@
         <if test="accountCode != null and accountCode != ''">
             and ccg.account_code = #{accountCode}
         </if>
-        and sd.delete_time = 0
         and cr.delete_time = 0
         and ca.delete_time = 0
         limit #{startIndex},#{pageSize}
@@ -67,8 +64,6 @@
         select
         count(*)
         from cost_costing_group ccg
-        left join sys_department sd
-        on ccg.hosp_id = sd.hosp_id and ccg.department_code = sd.department_code
         left join cost_responsibility cr
         on ccg.responsibility_code = cr.responsibility_code and ccg.hosp_id = cr.hosp_id
         left join cost_accounting ca on ccg.account_code = ca.accounting_code and ccg.hosp_id = ca.hosp_id
@@ -84,7 +79,6 @@
         <if test="accountCode != null and accountCode != ''">
             and ccg.account_code = #{accountCode}
         </if>
-        and sd.delete_time = 0
         and cr.delete_time = 0
         and ca.delete_time = 0
     </select>
@@ -92,8 +86,6 @@
         select
         sum(ccg.amount)
         from cost_costing_group ccg
-        left join sys_department sd
-        on ccg.hosp_id = sd.hosp_id and ccg.department_code = sd.department_code
         left join cost_responsibility cr
         on ccg.responsibility_code = cr.responsibility_code and ccg.hosp_id = cr.hosp_id
         left join cost_accounting ca on ccg.account_code = ca.accounting_code and ccg.hosp_id = ca.hosp_id
@@ -109,7 +101,6 @@
         <if test="accountCode != null and accountCode != ''">
             and ccg.account_code = #{accountCode}
         </if>
-        and sd.delete_time = 0
         and cr.delete_time = 0
         and ca.delete_time = 0
     </select>