|
|
@@ -1,20 +1,22 @@
|
|
|
package com.sckw.payment.controller;
|
|
|
|
|
|
-import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.excel.utils.ExcelUtil;
|
|
|
import com.sckw.payment.model.constant.TradeUnitType;
|
|
|
-import com.sckw.payment.model.dto.ISettlement;
|
|
|
+import com.sckw.payment.model.dto.SettlementTradeDto;
|
|
|
import com.sckw.payment.model.vo.req.SettlementTradeReq;
|
|
|
-import com.sckw.payment.model.vo.res.SettlementLogisticsVo;
|
|
|
+import com.sckw.payment.model.vo.res.SettlementTradeVo;
|
|
|
import com.sckw.payment.service.KwpSettlementTradeService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.Valid;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+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;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -39,7 +41,7 @@ public class KwpSettlementTradeController {
|
|
|
* @param settlementReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(name = "收款-销售结算单列表", path = "pageSellList")
|
|
|
+ @PostMapping("pageSellList")
|
|
|
public HttpResult pageListCollection(@RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.setUnitType(TradeUnitType.PURCHASE);
|
|
|
settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
|
|
|
@@ -53,7 +55,7 @@ public class KwpSettlementTradeController {
|
|
|
* @param settlementReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(name = "收款-表头统计数量", path = "getSellCount")
|
|
|
+ @PostMapping("getSellCount")
|
|
|
public HttpResult getCount(@RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.setUnitType(TradeUnitType.PURCHASE);
|
|
|
settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
|
|
|
@@ -68,7 +70,7 @@ public class KwpSettlementTradeController {
|
|
|
* @param settlementReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(name = "收款-表尾金额结算数据", path = "getSellSum")
|
|
|
+ @PostMapping("getSellSum")
|
|
|
public HttpResult getSellSum(@RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.check();
|
|
|
settlementReq.setUnitType(TradeUnitType.PURCHASE);
|
|
|
@@ -77,18 +79,19 @@ public class KwpSettlementTradeController {
|
|
|
return HttpResult.ok(kwpSettlementTradeService.getCountListCollection(settlementReq));
|
|
|
}
|
|
|
|
|
|
- @PostMapping(name = "收款-根据ids导出销售结算单列表", path = "exportCollection")
|
|
|
+ /**
|
|
|
+ * 导出销售结算单列表
|
|
|
+ *
|
|
|
+ * @param response
|
|
|
+ * @param settlementReq
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("exportCollection")
|
|
|
public HttpResult exportCollection(HttpServletResponse response, @RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.check();
|
|
|
- List<ISettlement> list;
|
|
|
settlementReq.setUnitType(TradeUnitType.PURCHASE);
|
|
|
settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
|
|
|
- if (CollectionUtils.isEmpty(settlementReq.getIdList())) {
|
|
|
- PageRes<ISettlement> pageResult = kwpSettlementTradeService.pageListCollection(settlementReq);
|
|
|
- list = pageResult.getList();
|
|
|
- } else {
|
|
|
- list = kwpSettlementTradeService.selectList(settlementReq.getIdList(), TradeUnitType.PURCHASE);
|
|
|
- }
|
|
|
+ List<SettlementTradeDto> list = kwpSettlementTradeService.exportList(settlementReq, settlementReq.getIdList());
|
|
|
return this.export(response, list);
|
|
|
}
|
|
|
|
|
|
@@ -101,7 +104,7 @@ public class KwpSettlementTradeController {
|
|
|
* @param settlementReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(name = "付款-采购结算单列表", path = "pagePurchaseList")
|
|
|
+ @PostMapping("pagePurchaseList")
|
|
|
public HttpResult pageListPayment(@RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.check();
|
|
|
settlementReq.setUnitType(TradeUnitType.SELL);
|
|
|
@@ -115,7 +118,7 @@ public class KwpSettlementTradeController {
|
|
|
* @param settlementReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(name = "收款-表头统计数量", path = "getPurchaseCount")
|
|
|
+ @PostMapping("getPurchaseCount")
|
|
|
public HttpResult getPurchaseCount(@RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.check();
|
|
|
settlementReq.setUnitType(TradeUnitType.SELL);
|
|
|
@@ -130,7 +133,7 @@ public class KwpSettlementTradeController {
|
|
|
* @param settlementReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping(name = "收款-物流结算订单列表头部汇总数量", path = "getPurchaseSum")
|
|
|
+ @PostMapping("getPurchaseSum")
|
|
|
public HttpResult getCountListPayment(@RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.check();
|
|
|
settlementReq.setUnitType(TradeUnitType.SELL);
|
|
|
@@ -139,36 +142,38 @@ public class KwpSettlementTradeController {
|
|
|
return HttpResult.ok(kwpSettlementTradeService.getCountListCollection(settlementReq));
|
|
|
}
|
|
|
|
|
|
- @PostMapping(name = "付款-根据ids导出采购结算单列表", path = "exportPayment")
|
|
|
+ /**
|
|
|
+ * 导出采购结算单列表
|
|
|
+ *
|
|
|
+ * @param response
|
|
|
+ * @param settlementReq
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("exportPayment")
|
|
|
public HttpResult exportPayment(HttpServletResponse response, @RequestBody @Valid SettlementTradeReq settlementReq) {
|
|
|
settlementReq.check();
|
|
|
- List<ISettlement> list;
|
|
|
settlementReq.setUnitType(TradeUnitType.SELL);
|
|
|
settlementReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
|
|
|
- if (CollectionUtils.isEmpty(settlementReq.getIdList())) {
|
|
|
- PageRes<ISettlement> pageResult = kwpSettlementTradeService.pageListCollection(settlementReq);
|
|
|
- list = pageResult.getList();
|
|
|
- } else {
|
|
|
- list = kwpSettlementTradeService.selectList(settlementReq.getIdList(), TradeUnitType.SELL);
|
|
|
- }
|
|
|
+ List<SettlementTradeDto> list = kwpSettlementTradeService.exportList(settlementReq, settlementReq.getIdList());
|
|
|
return this.export(response, list);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 导出
|
|
|
*
|
|
|
* @author Aick Spt
|
|
|
* @date 2023-07-24 15:49
|
|
|
*/
|
|
|
- private HttpResult export(HttpServletResponse response, List<ISettlement> list) {
|
|
|
+ private HttpResult export(HttpServletResponse response, List<SettlementTradeDto> list) {
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return HttpResult.error("没有可导出的数据");
|
|
|
}
|
|
|
- List<SettlementLogisticsVo> collect = list.stream().map(a -> {
|
|
|
- SettlementLogisticsVo settlementLogisticsVo = new SettlementLogisticsVo();
|
|
|
- BeanUtils.copyProperties(a, settlementLogisticsVo);
|
|
|
- return settlementLogisticsVo;
|
|
|
+ List<SettlementTradeVo> collect = list.stream().map(a -> {
|
|
|
+ SettlementTradeVo settlementTradeVo = new SettlementTradeVo();
|
|
|
+ BeanUtils.copyProperties(a, settlementTradeVo);
|
|
|
+ return settlementTradeVo;
|
|
|
}).collect(Collectors.toList());
|
|
|
- ExcelUtil.downData(response, SettlementLogisticsVo.class, collect);
|
|
|
+ ExcelUtil.downData(response, SettlementTradeVo.class, collect);
|
|
|
return null;
|
|
|
}
|
|
|
|