Bläddra i källkod

新增对账单父类条件

fgd 1 år sedan
förälder
incheckning
0d873897d8

+ 13 - 12
sd-business/src/main/java/com/sd/business/controller/statement/StatementOfAccountController.java

@@ -3,6 +3,7 @@ package com.sd.business.controller.statement;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.annotation.NonInterception;
 import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.statement.dto.DocumentInfoSelectDto;
 import com.sd.business.entity.statement.dto.FileUploadDto;
 import com.sd.business.entity.statement.dto.StatementOfAccountDto;
 import com.sd.business.entity.statement.dto.StatementOfAccountSelectDto;
@@ -91,24 +92,24 @@ public class StatementOfAccountController {
      * sku对账
      */
     @PostMapping("/getDocumentBySku")
-    public List<DocumentBySkuVo> getDocumentBySku(@RequestBody BaseSelectDto dto) {
-        return statementOfAccountService.getSkuDocument(Collections.singletonList(dto.getId()));
+    public List<DocumentBySkuVo> getDocumentBySku(@RequestBody DocumentInfoSelectDto dto) {
+        return statementOfAccountService.getSkuDocument(Collections.singletonList(dto.getId()), dto.getOrderClassify());
     }
 
     /**
      * bom对账
      */
     @PostMapping("/getDocumentByBom")
-    public List<DocumentByBomVo> getDocumentByBom(@RequestBody BaseSelectDto dto) {
-        return statementOfAccountService.getBomDocument(Collections.singletonList(dto.getId()));
+    public List<DocumentByBomVo> getDocumentByBom(@RequestBody DocumentInfoSelectDto dto) {
+        return statementOfAccountService.getBomDocument(Collections.singletonList(dto.getId()), dto.getOrderClassify());
     }
 
     /**
      * 订单对账
      */
     @PostMapping("/getDocumentByOrder")
-    public List<DocumentByOrderVo> getDocumentByOrder(@RequestBody BaseSelectDto dto) {
-        return statementOfAccountService.getOrderDocument(Collections.singletonList(dto.getId()));
+    public List<DocumentByOrderVo> getDocumentByOrder(@RequestBody DocumentInfoSelectDto dto) {
+        return statementOfAccountService.getOrderDocument(Collections.singletonList(dto.getId()), dto.getOrderClassify());
     }
 
     /**
@@ -116,8 +117,8 @@ public class StatementOfAccountController {
      */
     @NonInterception
     @GetMapping("/exportDocumentBySku")
-    public void exportDocumentBySku(BaseSelectDto dto) {
-        statementOfAccountService.export(dto.getId(), 1);
+    public void exportDocumentBySku(DocumentInfoSelectDto dto) {
+        statementOfAccountService.export(dto.getId(), dto.getOrderClassify(), 1);
     }
 
     /**
@@ -125,16 +126,16 @@ public class StatementOfAccountController {
      */
     @NonInterception
     @GetMapping("/exportDocumentByBom")
-    public void exportDocumentByBom(BaseSelectDto dto) {
-        statementOfAccountService.export(dto.getId(), 2);
+    public void exportDocumentByBom(DocumentInfoSelectDto dto) {
+        statementOfAccountService.export(dto.getId(), dto.getOrderClassify(), 2);
     }
 
     /**
      * 导出订单对账单
      */
     @GetMapping("/exportDocumentByOrder")
-    public void exportDocumentByOrder(BaseSelectDto dto) {
-        statementOfAccountService.export(dto.getId(), 3);
+    public void exportDocumentByOrder(DocumentInfoSelectDto dto) {
+        statementOfAccountService.export(dto.getId(), dto.getOrderClassify(), 3);
     }
 
     /**

+ 2 - 2
sd-business/src/main/java/com/sd/business/service/statement/StatementOfAccountExportService.java

@@ -7,11 +7,11 @@ public interface StatementOfAccountExportService {
     /**
      * 导出sku对账单
      */
-    void exportDocumentBySku(List<Long> idList, String departmentName, String beginDate, String endDate);
+    void exportDocumentBySku(List<Long> idList, String departmentName, String beginDate, String endDate, Integer orderClassify);
 
     /**
      * 导出bom对账单
      */
-    void exportDocumentByBom(List<Long> idList, String departmentName, String beginDate, String endDate);
+    void exportDocumentByBom(List<Long> idList, String departmentName, String beginDate, String endDate, Integer orderClassify);
 
 }

+ 7 - 6
sd-business/src/main/java/com/sd/business/service/statement/StatementOfAccountService.java

@@ -55,17 +55,17 @@ public interface StatementOfAccountService extends BaseService<StatementOfAccoun
     /**
      * sku对账
      */
-    List<DocumentBySkuVo> getSkuDocument(List<Long> statementOfAccountId);
+    List<DocumentBySkuVo> getSkuDocument(List<Long> statementOfAccountId, Integer orderClassify);
 
     /**
      * bom对账
      */
-    List<DocumentByBomVo> getBomDocument(List<Long> statementOfAccountId);
+    List<DocumentByBomVo> getBomDocument(List<Long> statementOfAccountId, Integer orderClassify);
 
     /**
      * 订单对账
      */
-    List<DocumentByOrderVo> getOrderDocument(List<Long> statementOfAccountId);
+    List<DocumentByOrderVo> getOrderDocument(List<Long> statementOfAccountId, Integer orderClassify);
 
     /**
      * 订单对账
@@ -75,10 +75,11 @@ public interface StatementOfAccountService extends BaseService<StatementOfAccoun
     /**
      * 导出
      *
-     * @param id   对账单id
-     * @param type 1sku 2bom 3订单
+     * @param id            对账单id
+     * @param orderClassify 订单分类
+     * @param type          1sku 2bom 3订单
      */
-    void export(Long id, int type);
+    void export(Long id, Integer orderClassify, int type);
 
     /**
      * 获取万里牛单号

+ 4 - 4
sd-business/src/main/java/com/sd/business/service/statement/impl/StatementOfAccountExportServiceImpl.java

@@ -26,9 +26,9 @@ public class StatementOfAccountExportServiceImpl implements StatementOfAccountEx
     private StatementOfAccountService statementOfAccountService;
 
     @Override
-    public void exportDocumentBySku(List<Long> idList, String departmentName, String beginDate, String endDate) {
+    public void exportDocumentBySku(List<Long> idList, String departmentName, String beginDate, String endDate, Integer orderClassify) {
 
-        List<DocumentBySkuVo> list = statementOfAccountService.getSkuDocument(idList);
+        List<DocumentBySkuVo> list = statementOfAccountService.getSkuDocument(idList, orderClassify);
 
         Map<String, Object> map = new HashMap<>();
         map.put("department", StrUtil.isBlank(departmentName) ? StringPool.EMPTY : departmentName + StringPool.DASH);
@@ -41,9 +41,9 @@ public class StatementOfAccountExportServiceImpl implements StatementOfAccountEx
     }
 
     @Override
-    public void exportDocumentByBom(List<Long> idList, String departmentName, String beginDate, String endDate) {
+    public void exportDocumentByBom(List<Long> idList, String departmentName, String beginDate, String endDate, Integer orderClassify) {
 
-        List<DocumentByBomVo> list = statementOfAccountService.getBomDocument(idList);
+        List<DocumentByBomVo> list = statementOfAccountService.getBomDocument(idList, orderClassify);
 
         Map<String, Object> map = new HashMap<>();
         map.put("department", StrUtil.isBlank(departmentName) ? StringPool.EMPTY : departmentName + StringPool.DASH);

+ 7 - 6
sd-business/src/main/java/com/sd/business/service/statement/impl/StatementOfAccountMergeServiceImpl.java

@@ -184,17 +184,17 @@ public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMer
 
     @Override
     public List<DocumentBySkuVo> getDocumentBySku(GetDocumentDto dto) {
-        return statementOfAccountService.getSkuDocument(getIdList(dto));
+        return statementOfAccountService.getSkuDocument(getIdList(dto), dto.getOrderClassify());
     }
 
     @Override
     public List<DocumentByBomVo> getDocumentByBom(GetDocumentDto dto) {
-        return statementOfAccountService.getBomDocument(getIdList(dto));
+        return statementOfAccountService.getBomDocument(getIdList(dto), dto.getOrderClassify());
     }
 
     @Override
     public List<DocumentByOrderVo> getDocumentByOrder(GetDocumentDto dto) {
-        return statementOfAccountService.getOrderDocument(getIdList(dto));
+        return statementOfAccountService.getOrderDocument(getIdList(dto), dto.getOrderClassify());
     }
 
     @Override
@@ -209,17 +209,18 @@ public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMer
         String departmentName = dto.getDepartmentName();
         String beginDate = dto.getBeginDate();
         String endDate = dto.getEndDate();
+        Integer orderClassify = dto.getOrderClassify();
 
         switch (type) {
             case 1:
-                statementOfAccountExportService.exportDocumentBySku(idList, departmentName, beginDate, endDate);
+                statementOfAccountExportService.exportDocumentBySku(idList, departmentName, beginDate, endDate, orderClassify);
                 break;
             case 2:
-                statementOfAccountExportService.exportDocumentByBom(idList, departmentName, beginDate, endDate);
+                statementOfAccountExportService.exportDocumentByBom(idList, departmentName, beginDate, endDate, orderClassify);
                 break;
             case 3:
                 excelGenerateLogService.generateExcel(ExcelTypeEnum.STATISTICS_DOCUMENT_BY_ORDER,
-                        new DocumentByOrderExcelExportStrategy(idList, departmentName, beginDate, endDate),
+                        new DocumentByOrderExcelExportStrategy(idList, departmentName, beginDate, endDate, orderClassify),
                         DateUtil.formatDate(new Date()) + " 对账报表");
                 break;
             default:

+ 15 - 12
sd-business/src/main/java/com/sd/business/service/statement/impl/StatementOfAccountServiceImpl.java

@@ -250,10 +250,10 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
     }
 
     @Override
-    public List<DocumentBySkuVo> getSkuDocument(List<Long> statementOfAccountIdList) {
+    public List<DocumentBySkuVo> getSkuDocument(List<Long> statementOfAccountIdList, Integer orderClassify) {
 
         // 获取订单id列表
-        List<Long> orderIdList = getOrderIdList(statementOfAccountIdList);
+        List<Long> orderIdList = getOrderIdList(statementOfAccountIdList, orderClassify);
 
         if (orderIdList.isEmpty()) {
             return Collections.emptyList();
@@ -315,10 +315,10 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
     }
 
     @Override
-    public List<DocumentByBomVo> getBomDocument(List<Long> statementOfAccountIdList) {
+    public List<DocumentByBomVo> getBomDocument(List<Long> statementOfAccountIdList, Integer orderClassify) {
 
         // 获取订单id列表
-        List<Long> orderIdList = getOrderIdList(statementOfAccountIdList);
+        List<Long> orderIdList = getOrderIdList(statementOfAccountIdList, orderClassify);
         if (orderIdList.isEmpty()) {
             return Collections.emptyList();
         }
@@ -437,10 +437,12 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
     }
 
     @Override
-    public List<DocumentByOrderVo> getOrderDocument(List<Long> statementOfAccountId) {
+    public List<DocumentByOrderVo> getOrderDocument(List<Long> statementOfAccountId, Integer orderClassify) {
 
         Assert.notEmpty(statementOfAccountId, "对账单id不能为空");
-        List<OrderInfo> orderList = orderService.list(q -> q.in(OrderInfo::getStatementOfAccountId, statementOfAccountId));
+        List<OrderInfo> orderList = orderService.list(q -> q
+                .in(OrderInfo::getStatementOfAccountId, statementOfAccountId)
+                .eq(OrderInfo::getClassify, orderClassify));
 
         return getOrderDocumentByOrderList(orderList);
     }
@@ -508,7 +510,7 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
     }
 
     @Override
-    public void export(Long id, int type) {
+    public void export(Long id, Integer orderClassify, int type) {
 
         StatementOfAccount statementOfAccount = getById(id);
         Assert.notNull(statementOfAccount, "没有找到对账单");
@@ -524,14 +526,14 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
 
         switch (type) {
             case 1:
-                statementOfAccountExportService.exportDocumentBySku(idList, departmentName, date, date);
+                statementOfAccountExportService.exportDocumentBySku(idList, departmentName, date, date, orderClassify);
                 break;
             case 2:
-                statementOfAccountExportService.exportDocumentByBom(idList, departmentName, date, date);
+                statementOfAccountExportService.exportDocumentByBom(idList, departmentName, date, date, orderClassify);
                 break;
             case 3:
                 excelGenerateLogService.generateExcel(ExcelTypeEnum.STATISTICS_DOCUMENT_BY_ORDER,
-                        new DocumentByOrderExcelExportStrategy(idList, departmentName, date, date),
+                        new DocumentByOrderExcelExportStrategy(idList, departmentName, date, date, orderClassify),
                         DateUtil.formatDate(new Date()) + " 对账单");
                 break;
             default:
@@ -550,9 +552,10 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
     /**
      * 根据对账单id获取对账订单id列表
      */
-    private List<Long> getOrderIdList(List<Long> statementOfAccountIdList) {
+    private List<Long> getOrderIdList(List<Long> statementOfAccountIdList, Integer orderClassify) {
         Assert.notEmpty(statementOfAccountIdList, "对账单id不能为空");
-        List<OrderInfo> orderList = orderService.list(q -> q.in(OrderInfo::getStatementOfAccountId, statementOfAccountIdList));
+        List<OrderInfo> orderList = orderService.list(q -> q.in(OrderInfo::getStatementOfAccountId, statementOfAccountIdList)
+                .eq(OrderInfo::getClassify, orderClassify));
         return orderList.stream().map(BaseIdPo::getId).collect(Collectors.toList());
     }
 

+ 4 - 2
sd-business/src/main/java/com/sd/business/strategy/impl/DocumentByOrderExcelExportStrategy.java

@@ -41,19 +41,21 @@ public class DocumentByOrderExcelExportStrategy implements ExcelExportStrategy<M
     private final String departmentName;
     private final String beginDate;
     private final String endDate;
+    private final Integer orderClassify;
 
     private List<DocumentByOrderVo> list;
 
-    public DocumentByOrderExcelExportStrategy(List<Long> idList, String departmentName, String beginDate, String endDate) {
+    public DocumentByOrderExcelExportStrategy(List<Long> idList, String departmentName, String beginDate, String endDate, Integer orderClassify) {
         this.idList = idList;
         this.departmentName = departmentName;
         this.beginDate = beginDate;
         this.endDate = endDate;
+        this.orderClassify = orderClassify;
     }
 
     @Override
     public Map<String, Object> getData() {
-        list = statementOfAccountService.getOrderDocument(idList);
+        list = statementOfAccountService.getOrderDocument(idList, orderClassify);
 
         BigDecimal all = BigDecimal.ZERO;