|
|
@@ -1,21 +1,28 @@
|
|
|
package com.sckw.payment.service;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.payment.dao.KwpSettlementLogisticsMapper;
|
|
|
-import com.sckw.payment.model.dto.LedgerLogisticsDto;
|
|
|
+import com.sckw.payment.model.KwpLedgerTradeTrack;
|
|
|
+import com.sckw.payment.model.KwpSettlementLogistics;
|
|
|
+import com.sckw.payment.model.constant.LedgerTrackEnum;
|
|
|
+import com.sckw.payment.model.constant.SettlementEnum;
|
|
|
+import com.sckw.payment.model.dto.LedgerTradeDto;
|
|
|
import com.sckw.payment.model.dto.SettlementLogisticsDto;
|
|
|
import com.sckw.payment.model.vo.req.SettlementReq;
|
|
|
+import com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo;
|
|
|
+import com.sckw.payment.utils.CommonValidator;
|
|
|
+import jakarta.validation.constraints.NotNull;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
- * @author xucaiqin
|
|
|
+ * @author Aick Spt
|
|
|
* @date 2023-07-10 16:38:36
|
|
|
*/
|
|
|
@AllArgsConstructor
|
|
|
@@ -23,29 +30,66 @@ import java.util.List;
|
|
|
public class KwpSettlementLogisticsService {
|
|
|
private final KwpSettlementLogisticsMapper settlementLogisticsMapper;
|
|
|
|
|
|
+ public SettlementLogisticsStatusCountVo getCountList() {
|
|
|
+ SettlementLogisticsStatusCountVo settlementLogisticsStatusCountVos = new SettlementLogisticsStatusCountVo();
|
|
|
+ LambdaQueryWrapper<KwpSettlementLogistics> wrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ settlementLogisticsStatusCountVos.setAllCount(settlementLogisticsMapper.selectCount(wrapper));
|
|
|
+
|
|
|
+ wrapper.eq(KwpSettlementLogistics::getStatus, SettlementEnum.WAITING_PAYMENT.getStatus());//待结算
|
|
|
+ settlementLogisticsStatusCountVos.setWaitingPaymentCount(settlementLogisticsMapper.selectCount(wrapper));
|
|
|
+
|
|
|
+ wrapper.clear();
|
|
|
+ wrapper.eq(KwpSettlementLogistics::getStatus, SettlementEnum.PARTIAL_PAYMENT.getStatus());//部分结算
|
|
|
+ settlementLogisticsStatusCountVos.setPartialPaymentCount(settlementLogisticsMapper.selectCount(wrapper));
|
|
|
+
|
|
|
+ wrapper.clear();
|
|
|
+ wrapper.eq(KwpSettlementLogistics::getStatus, SettlementEnum.ALL_PAYMENT.getStatus());//全部结算
|
|
|
+ settlementLogisticsStatusCountVos.setAllPaymentCount(settlementLogisticsMapper.selectCount(wrapper));
|
|
|
+
|
|
|
+ return settlementLogisticsStatusCountVos;
|
|
|
+ }
|
|
|
+
|
|
|
public PageRes<SettlementLogisticsDto> pageList(SettlementReq settlementReq) {
|
|
|
- //todo 查询缓存,获取客户企业id
|
|
|
- String keywords = settlementReq.getKeywords();
|
|
|
- if (StringUtils.isNotBlank(keywords)) {
|
|
|
- System.out.println("关键之:" + keywords);
|
|
|
- }
|
|
|
- PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
|
|
|
+ CommonValidator.isValidCoexisting(settlementReq.getStartCreateTime(), settlementReq.getEndCreateTime(), "");
|
|
|
+ CommonValidator.isValidCoexisting(settlementReq.getStartReceiptTime(), settlementReq.getEndReceiptTime(), "预计收款开始和结束时间");
|
|
|
|
|
|
+ PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
|
|
|
List<SettlementLogisticsDto> kwpLedgerLogisticsList = settlementLogisticsMapper.pageSelect(settlementReq);
|
|
|
|
|
|
+ // 对查询结果进行处理,转换 status 到 desc
|
|
|
+ for (SettlementLogisticsDto entity : kwpLedgerLogisticsList) {
|
|
|
+ entity.setStatusText(SettlementEnum.getStatusDesc(entity.getStatus()));
|
|
|
+ entity.setResiduePrice(entity.getLedgerSettlePrice().subtract(entity.getActualPrice()));
|
|
|
+ entity.setCreateByText("创建人名称");
|
|
|
+ entity.setUpdateByText("更新人名称");
|
|
|
+ }
|
|
|
return new PageRes<>(new PageInfo<>(kwpLedgerLogisticsList));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查物流结算订单
|
|
|
+ *
|
|
|
+ * @param ids 物流结算订单集合List<Long>
|
|
|
+ * @author Aick Spt
|
|
|
+ * @date 2023-07-21 16:16
|
|
|
+ */
|
|
|
+ public List<SettlementLogisticsDto> selectList(List<Long> ids) {
|
|
|
+ return settlementLogisticsMapper.selectIds(ids);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 结算-物流订单详情
|
|
|
- * @author Administrator
|
|
|
- * @date 2023-07-19 09:11
|
|
|
+ *
|
|
|
* @param id 结算物流订单id
|
|
|
+ * @author Aick Spt
|
|
|
+ * @date 2023-07-19 09:11
|
|
|
*/
|
|
|
- public SettlementLogisticsDto detail(String id){
|
|
|
- SettlementLogisticsDto settlementLogistics = settlementLogisticsMapper.detail(id);
|
|
|
- return settlementLogistics;
|
|
|
+ public SettlementLogisticsDto detail(Long id) {
|
|
|
+ return settlementLogisticsMapper.detail(id);
|
|
|
}
|
|
|
|
|
|
}
|