24282 1 rok pred
rodič
commit
259999e4c9

+ 39 - 0
sd-business/src/main/java/com/sd/business/controller/statement/StatementOfAccountMergeController.java

@@ -0,0 +1,39 @@
+package com.sd.business.controller.statement;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.sd.business.entity.statement.dto.StatementOfAccountMergePageDto;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+import com.sd.business.service.statement.StatementOfAccountMergeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 对账单 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@RestController
+@RequestMapping("/statementOfAccountMerge")
+public class StatementOfAccountMergeController {
+
+    @Autowired
+    private StatementOfAccountMergeService statementOfAccountMergeService;
+
+    /**
+     * 对账报表分页
+     */
+    @PostMapping("/page")
+    public Page<StatementOfAccountVo> page(@Validated @RequestBody StatementOfAccountMergePageDto dto) {
+        return statementOfAccountMergeService.getPage(dto);
+    }
+
+
+}

+ 0 - 48
sd-business/src/main/java/com/sd/business/controller/statement/Test.java

@@ -1,48 +0,0 @@
-package com.sd.business.controller.statement;
-
-import com.sd.business.entity.statement.vo.DocumentBySkuVo;
-import com.sd.framework.util.TemplateExcelUtil;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@RestController
-@RequestMapping("/open")
-public class Test {
-
-
-    @GetMapping("/a")
-    public void test(HttpServletResponse response) throws IOException {
-        Map<String, Object> map = new HashMap<>();
-
-        List<DocumentBySkuVo> list = new ArrayList<>();
-        DocumentBySkuVo documentBySkuVo1 = DocumentBySkuVo.builder()
-                .skuSpecCode("test01")
-                .skuSpecName("测试1")
-                .quantity(new BigDecimal("102"))
-                .build();
-        DocumentBySkuVo documentBySkuVo2 = DocumentBySkuVo.builder()
-                .skuSpecCode("test02")
-                .skuSpecName("测试2")
-                .quantity(new BigDecimal("107"))
-                .build();
-        list.add(documentBySkuVo1);
-        list.add(documentBySkuVo2);
-        list.add(documentBySkuVo1);
-
-        map.put("totalQuantity", BigDecimal.TEN);
-        map.put("totalSubtotal", new BigDecimal("124.65"));
-        map.put("department", "宝恒晟B1");
-
-        TemplateExcelUtil.writeBrowser("skuDocument.xlsx", "sku对账单", response, list, map);
-    }
-
-}

+ 24 - 0
sd-business/src/main/java/com/sd/business/entity/statement/dto/StatementOfAccountMergePageDto.java

@@ -0,0 +1,24 @@
+package com.sd.business.entity.statement.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+@Getter
+@Setter
+public class StatementOfAccountMergePageDto extends BaseSelectDto {
+
+    /**
+     * 对账类型(1月度 2季度 3年度 4自定义)
+     */
+    @NotNull(message = "对账类型不能为空")
+    private Integer type;
+
+    /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+}

+ 2 - 7
sd-business/src/main/java/com/sd/business/entity/statement/po/StatementOfAccount.java

@@ -33,14 +33,9 @@ public class StatementOfAccount extends BasePo {
     private Long departmentId;
 
     /**
-     * 对账时间段开始时间
+     * 对账时间
      */
-    private Date timePeriodBegin;
-
-    /**
-     * 对账时间段结束时间
-     */
-    private Date timePeriodEnd;
+    private Date timePeriod;
 
     /**
      * 类型 1用户自建 2系统生成

+ 23 - 0
sd-business/src/main/java/com/sd/business/service/statement/StatementOfAccountMergeService.java

@@ -0,0 +1,23 @@
+package com.sd.business.service.statement;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.sd.business.entity.statement.dto.StatementOfAccountMergePageDto;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+
+/**
+ * <p>
+ * 对账单 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+public interface StatementOfAccountMergeService {
+
+    /**
+     * 对账报表分页
+     */
+    Page<StatementOfAccountVo> getPage(StatementOfAccountMergePageDto dto);
+
+
+}

+ 49 - 0
sd-business/src/main/java/com/sd/business/service/statement/impl/StatementOfAccountMergeServiceImpl.java

@@ -0,0 +1,49 @@
+package com.sd.business.service.statement.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.exception.ServiceException;
+import com.sd.business.entity.statement.dto.StatementOfAccountMergePageDto;
+import com.sd.business.entity.statement.vo.StatementOfAccountVo;
+import com.sd.business.service.statement.StatementOfAccountMergeService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 对账单 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-31
+ */
+@Service
+public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMergeService {
+
+
+    @Override
+    public Page<StatementOfAccountVo> getPage(StatementOfAccountMergePageDto dto) {
+
+
+        switch (dto.getType()) {
+            case 1:
+
+                break;
+            case 2:
+
+                break;
+            case 3:
+
+                break;
+            case 4:
+
+                break;
+            default:
+                throw new ServiceException("未知对账类型");
+        }
+
+
+        return null;
+    }
+
+
+}

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

@@ -80,8 +80,8 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
         IWrapper<StatementOfAccount> wrapper = getWrapper();
         wrapper.like("soa", StatementOfAccount::getCode, dto.getCode());
         wrapper.eq("soa", StatementOfAccount::getDepartmentId, dto.getDepartmentId());
-        wrapper.ge("soa", StatementOfAccount::getCreateTime, dto.getBeginTime());
-        wrapper.le("soa", StatementOfAccount::getCreateTime, dto.getEndTime());
+        wrapper.ge("soa", StatementOfAccount::getTimePeriod, dto.getBeginTime());
+        wrapper.le("soa", StatementOfAccount::getTimePeriod, dto.getEndTime());
         wrapper.orderByDesc("soa", StatementOfAccount::getId);
 
         Page<StatementOfAccountVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
@@ -420,13 +420,13 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
 
         List<DocumentBySkuVo> list = getDocumentBySku(id);
 
-        Date timePeriodBegin = statementOfAccount.getTimePeriodBegin();
-        Date timePeriodEnd = statementOfAccount.getTimePeriodEnd();
+        Date timePeriod = statementOfAccount.getTimePeriod();
+        String timePeriodStr = timePeriod != null ? DateUtil.formatDate(timePeriod) : StringPool.EMPTY;
 
         Map<String, Object> map = new HashMap<>();
-        map.put("department", department.getName());
-        map.put("beginDate", timePeriodBegin != null ? DateUtil.formatDate(timePeriodBegin) : StringPool.EMPTY);
-        map.put("endDate", timePeriodEnd != null ? DateUtil.formatDate(timePeriodEnd) : StringPool.EMPTY);
+        map.put("department", department.getName() + " - ");
+        map.put("beginDate", timePeriodStr);
+        map.put("endDate", timePeriodStr);
         map.put("totalQuantity", StreamUtil.bigDecimalAdd(list, DocumentBySkuVo::getQuantity));
         map.put("totalSubtotal", StreamUtil.bigDecimalAdd(list, DocumentBySkuVo::getSubtotal));
 
@@ -443,13 +443,13 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
 
         List<DocumentByBomVo> list = getDocumentByBom(id);
 
-        Date timePeriodBegin = statementOfAccount.getTimePeriodBegin();
-        Date timePeriodEnd = statementOfAccount.getTimePeriodEnd();
+        Date timePeriod = statementOfAccount.getTimePeriod();
+        String timePeriodStr = timePeriod != null ? DateUtil.formatDate(timePeriod) : StringPool.EMPTY;
 
         Map<String, Object> map = new HashMap<>();
-        map.put("department", department.getName());
-        map.put("beginDate", timePeriodBegin != null ? DateUtil.formatDate(timePeriodBegin) : StringPool.EMPTY);
-        map.put("endDate", timePeriodEnd != null ? DateUtil.formatDate(timePeriodEnd) : StringPool.EMPTY);
+        map.put("department", department.getName() + " - ");
+        map.put("beginDate", timePeriodStr);
+        map.put("endDate", timePeriodStr);
         map.put("totalSubtotal", StreamUtil.bigDecimalAdd(list, DocumentByBomVo::getSubtotal));
         map.put("totalLaserLogoSummary", StreamUtil.bigDecimalAdd(list, DocumentByBomVo::getLaserLogoSummary));
         map.put("totalLaserMitochondrialSummary", StreamUtil.bigDecimalAdd(list, DocumentByBomVo::getLaserMitochondrialSummary));
@@ -504,13 +504,13 @@ public class StatementOfAccountServiceImpl extends ServiceImpl<StatementOfAccoun
             }
         }
 
-        Date timePeriodBegin = statementOfAccount.getTimePeriodBegin();
-        Date timePeriodEnd = statementOfAccount.getTimePeriodEnd();
+        Date timePeriod = statementOfAccount.getTimePeriod();
+        String timePeriodStr = timePeriod != null ? DateUtil.formatDate(timePeriod) : StringPool.EMPTY;
 
         Map<String, Object> map = new HashMap<>();
-        map.put("department", department.getName());
-        map.put("beginDate", timePeriodBegin != null ? DateUtil.formatDate(timePeriodBegin) : StringPool.EMPTY);
-        map.put("endDate", timePeriodEnd != null ? DateUtil.formatDate(timePeriodEnd) : StringPool.EMPTY);
+        map.put("department", department.getName() + " - ");
+        map.put("beginDate", timePeriodStr);
+        map.put("endDate", timePeriodStr);
         map.put("all", all);
 
         TemplateExcelUtil.writeBrowser("orderDocument.xlsx", "订单对账单",

+ 1 - 5
sd-business/src/main/resources/mapper/statement/StatementOfAccountMapper.xml

@@ -5,12 +5,8 @@
         select soa.id,
                soa.code,
                soa.department_id,
-               soa.time_period_begin,
-               soa.time_period_end,
-               soa.create_user,
+               soa.time_period,
                soa.create_time,
-               soa.update_user,
-               soa.update_time,
                d.name departmentName
         from statement_of_account soa
                  left join department d on d.id = soa.department_id

BIN
sd-starter/src/main/resources/template/bomDocument.xlsx


BIN
sd-starter/src/main/resources/template/orderDocument.xlsx


BIN
sd-starter/src/main/resources/template/skuDocument.xlsx


+ 1 - 2
sd-wln/src/main/java/com/sd/wln/service/impl/WlnStatementOfAccountImpl.java

@@ -87,8 +87,7 @@ public class WlnStatementOfAccountImpl implements WlnStatementOfAccount {
                 tempStatementOfAccount.setId(IdWorker.getId());
                 tempStatementOfAccount.setCode(codeMap.get("code"));
                 tempStatementOfAccount.setDepartmentId(departmentId);
-                tempStatementOfAccount.setTimePeriodBegin(beginDay);
-                tempStatementOfAccount.setTimePeriodEnd(endDay);
+                tempStatementOfAccount.setTimePeriod(date);
                 tempStatementOfAccount.setType(2);
                 saveStatementOfAccountList.add(tempStatementOfAccount);
                 return tempStatementOfAccount;