|
@@ -1,7 +1,5 @@
|
|
|
package com.sckw.payment.service;
|
|
package com.sckw.payment.service;
|
|
|
|
|
|
|
|
-import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
import com.sckw.core.exception.BusinessException;
|
|
@@ -9,20 +7,18 @@ import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
|
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsOrderMapper;
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsOrderMapper;
|
|
|
-import com.sckw.payment.dao.KwpLedgerLogisticsTrackMapper;
|
|
|
|
|
-import com.sckw.payment.dao.KwpSettlementLogisticsMapper;
|
|
|
|
|
import com.sckw.payment.model.KwpLedgerLogistics;
|
|
import com.sckw.payment.model.KwpLedgerLogistics;
|
|
|
import com.sckw.payment.model.KwpLedgerLogisticsOrder;
|
|
import com.sckw.payment.model.KwpLedgerLogisticsOrder;
|
|
|
import com.sckw.payment.model.KwpLedgerLogisticsTrack;
|
|
import com.sckw.payment.model.KwpLedgerLogisticsTrack;
|
|
|
import com.sckw.payment.model.KwpSettlementLogistics;
|
|
import com.sckw.payment.model.KwpSettlementLogistics;
|
|
|
-import com.sckw.payment.model.constant.LedgerLicEnum;
|
|
|
|
|
|
|
+import com.sckw.payment.model.constant.LedgerEnum;
|
|
|
|
|
+import com.sckw.payment.model.constant.LedgerTrackEnum;
|
|
|
import com.sckw.payment.model.dto.LedgerLogisticsDto;
|
|
import com.sckw.payment.model.dto.LedgerLogisticsDto;
|
|
|
import com.sckw.payment.model.vo.req.*;
|
|
import com.sckw.payment.model.vo.req.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -35,12 +31,11 @@ import java.util.Objects;
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
-public class KwpLedgerLogisticsService {
|
|
|
|
|
-
|
|
|
|
|
|
|
+public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
|
|
+ private final KwpLedgerLogisticsTrackService logisticsTrackService;
|
|
|
|
|
+ private final KwpSettlementLogisticsService settlementLogisticsService;
|
|
|
private final KwpLedgerLogisticsMapper logisticsMapper;
|
|
private final KwpLedgerLogisticsMapper logisticsMapper;
|
|
|
- private final KwpLedgerLogisticsTrackMapper logisticsTrackMapper;
|
|
|
|
|
private final KwpLedgerLogisticsOrderMapper logisticsOrderMapper;
|
|
private final KwpLedgerLogisticsOrderMapper logisticsOrderMapper;
|
|
|
- private final KwpSettlementLogisticsMapper settlementLogisticsMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 分页查询物流对账单列表
|
|
* 分页查询物流对账单列表
|
|
@@ -90,8 +85,6 @@ public class KwpLedgerLogisticsService {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
kwpLedgerLogistics.setId(new IdWorker(1).nextId());
|
|
kwpLedgerLogistics.setId(new IdWorker(1).nextId());
|
|
|
kwpLedgerLogistics.setEntId(0L);//todo
|
|
kwpLedgerLogistics.setEntId(0L);//todo
|
|
|
- kwpLedgerLogistics.setCheckEntId(logisticsReq.getCheckEntId());
|
|
|
|
|
- kwpLedgerLogistics.setCarrierEntId(logisticsReq.getCarrierEntId());//todo
|
|
|
|
|
kwpLedgerLogistics.setLLedgerNo("");//todo
|
|
kwpLedgerLogistics.setLLedgerNo("");//todo
|
|
|
kwpLedgerLogistics.setName(logisticsReq.getName());
|
|
kwpLedgerLogistics.setName(logisticsReq.getName());
|
|
|
kwpLedgerLogistics.setStartTime(logisticsReq.getStartTime());
|
|
kwpLedgerLogistics.setStartTime(logisticsReq.getStartTime());
|
|
@@ -107,14 +100,10 @@ public class KwpLedgerLogisticsService {
|
|
|
kwpLedgerLogistics.setDeficitAmount(new BigDecimal("0"));
|
|
kwpLedgerLogistics.setDeficitAmount(new BigDecimal("0"));
|
|
|
kwpLedgerLogistics.setLoseAmount(new BigDecimal("0"));
|
|
kwpLedgerLogistics.setLoseAmount(new BigDecimal("0"));
|
|
|
kwpLedgerLogistics.setActualPrice(new BigDecimal("0"));
|
|
kwpLedgerLogistics.setActualPrice(new BigDecimal("0"));
|
|
|
- kwpLedgerLogistics.setCheckPhone("");//todo 取配置的数据
|
|
|
|
|
- kwpLedgerLogistics.setCheckUser("");
|
|
|
|
|
- kwpLedgerLogistics.setCarrierPhone("");
|
|
|
|
|
- kwpLedgerLogistics.setCarrierUser("");
|
|
|
|
|
kwpLedgerLogistics.setGenerateTime(null);
|
|
kwpLedgerLogistics.setGenerateTime(null);
|
|
|
kwpLedgerLogistics.setUrl("");
|
|
kwpLedgerLogistics.setUrl("");
|
|
|
kwpLedgerLogistics.setRemark(logisticsReq.getRemark());
|
|
kwpLedgerLogistics.setRemark(logisticsReq.getRemark());
|
|
|
- kwpLedgerLogistics.setStatus(LedgerLicEnum.SAVE.getStatus());
|
|
|
|
|
|
|
+ kwpLedgerLogistics.setStatus(LedgerEnum.SAVE.getStatus());
|
|
|
kwpLedgerLogistics.setCreateBy(0L);//todo
|
|
kwpLedgerLogistics.setCreateBy(0L);//todo
|
|
|
kwpLedgerLogistics.setCreateTime(LocalDateTime.now());
|
|
kwpLedgerLogistics.setCreateTime(LocalDateTime.now());
|
|
|
kwpLedgerLogistics.setUpdateBy(0L);
|
|
kwpLedgerLogistics.setUpdateBy(0L);
|
|
@@ -132,6 +121,7 @@ public class KwpLedgerLogisticsService {
|
|
|
kwpLedgerLogisticsOrder.setStatus(0);
|
|
kwpLedgerLogisticsOrder.setStatus(0);
|
|
|
logisticsOrderMapper.insert(kwpLedgerLogisticsOrder);
|
|
logisticsOrderMapper.insert(kwpLedgerLogisticsOrder);
|
|
|
}
|
|
}
|
|
|
|
|
+ logisticsTrackService.saveTrack(kwpLedgerLogistics.getId(), "", LedgerTrackEnum.SAVE);
|
|
|
return "保存成功";
|
|
return "保存成功";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -146,12 +136,10 @@ public class KwpLedgerLogisticsService {
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
throw new BusinessException("对账单不存在!");
|
|
throw new BusinessException("对账单不存在!");
|
|
|
}
|
|
}
|
|
|
- List<Integer> objects = Lists.newArrayList(LedgerLicEnum.BACK.getStatus(), LedgerLicEnum.SAVE.getStatus());
|
|
|
|
|
- if (!objects.contains(kwpLedgerLogistics.getStatus())) {
|
|
|
|
|
- throw new BusinessException("只有【已保存】和【已退回】的单据才支持删除!");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ deleteCheck(kwpLedgerLogistics.getStatus());
|
|
|
kwpLedgerLogistics.setDelFlag(1);
|
|
kwpLedgerLogistics.setDelFlag(1);
|
|
|
- return logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
|
|
+ logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
+ return logisticsTrackService.saveTrack(id, "", LedgerTrackEnum.DELETE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -165,11 +153,11 @@ public class KwpLedgerLogisticsService {
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
throw new BusinessException("对账单不存在!");
|
|
throw new BusinessException("对账单不存在!");
|
|
|
}
|
|
}
|
|
|
- if (LedgerLicEnum.TO_LEDGER.getStatus() != kwpLedgerLogistics.getStatus()) {
|
|
|
|
|
- throw new BusinessException("只有【待对账】的单据才支持撤销!");
|
|
|
|
|
- }
|
|
|
|
|
- kwpLedgerLogistics.setStatus(LedgerLicEnum.BACK.getStatus());
|
|
|
|
|
- return logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
|
|
+ revokeCheck(kwpLedgerLogistics.getStatus());
|
|
|
|
|
+
|
|
|
|
|
+ kwpLedgerLogistics.setStatus(LedgerEnum.BACK.getStatus());
|
|
|
|
|
+ logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
+ return logisticsTrackService.saveTrack(id, "", LedgerTrackEnum.REVOKE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -179,10 +167,7 @@ public class KwpLedgerLogisticsService {
|
|
|
* @return 物流对账单驳回记录
|
|
* @return 物流对账单驳回记录
|
|
|
*/
|
|
*/
|
|
|
public List<KwpLedgerLogisticsTrack> queryBack(Long id) {
|
|
public List<KwpLedgerLogisticsTrack> queryBack(Long id) {
|
|
|
- LambdaQueryWrapper<KwpLedgerLogisticsTrack> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- wrapper.eq(KwpLedgerLogisticsTrack::getLLedgerId, id);
|
|
|
|
|
- wrapper.eq(KwpLedgerLogisticsTrack::getDelFlag, 0);
|
|
|
|
|
- return logisticsTrackMapper.selectList(wrapper);
|
|
|
|
|
|
|
+ return logisticsTrackService.selectList(id, LedgerTrackEnum.REJECT);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -196,12 +181,7 @@ public class KwpLedgerLogisticsService {
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
throw new BusinessException("对账单不存在!");
|
|
throw new BusinessException("对账单不存在!");
|
|
|
}
|
|
}
|
|
|
- KwpLedgerLogisticsTrack kwpLedgerLogisticsTrack = new KwpLedgerLogisticsTrack();
|
|
|
|
|
- kwpLedgerLogisticsTrack.setId(new IdWorker(1).nextId());
|
|
|
|
|
- kwpLedgerLogisticsTrack.setLLedgerId(ledgerReq.getId());
|
|
|
|
|
- kwpLedgerLogisticsTrack.setRemark(ledgerReq.getRemark());
|
|
|
|
|
- kwpLedgerLogisticsTrack.setStatus(0);
|
|
|
|
|
- return logisticsTrackMapper.insert(kwpLedgerLogisticsTrack);
|
|
|
|
|
|
|
+ return logisticsTrackService.saveTrack(ledgerReq.getId(), ledgerReq.getRemark(), LedgerTrackEnum.REJECT);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -211,17 +191,18 @@ public class KwpLedgerLogisticsService {
|
|
|
* @param confirmReq
|
|
* @param confirmReq
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public Integer confirmOrder(LogisticsConfirmReq confirmReq) {
|
|
|
|
|
|
|
+ public Integer confirmOrder(LedgerConfirmReq confirmReq) {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(confirmReq.getId());
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(confirmReq.getId());
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
throw new BusinessException("对账单不存在!");
|
|
throw new BusinessException("对账单不存在!");
|
|
|
}
|
|
}
|
|
|
- kwpLedgerLogistics.setStatus(LedgerLicEnum.LEDGERED.getStatus());
|
|
|
|
|
|
|
+ kwpLedgerLogistics.setStatus(LedgerEnum.LEDGERED.getStatus());
|
|
|
kwpLedgerLogistics.setAuditPhone(confirmReq.getAuditPhone());
|
|
kwpLedgerLogistics.setAuditPhone(confirmReq.getAuditPhone());
|
|
|
kwpLedgerLogistics.setAuditUser(confirmReq.getAuditUser());
|
|
kwpLedgerLogistics.setAuditUser(confirmReq.getAuditUser());
|
|
|
kwpLedgerLogistics.setUrl(confirmReq.getUrl());
|
|
kwpLedgerLogistics.setUrl(confirmReq.getUrl());
|
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
- return logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
|
|
+ logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
|
|
+ return logisticsTrackService.saveTrack(confirmReq.getId(), "", LedgerTrackEnum.CONFIRM);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -236,12 +217,9 @@ public class KwpLedgerLogisticsService {
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
throw new BusinessException("对账单不存在!");
|
|
throw new BusinessException("对账单不存在!");
|
|
|
}
|
|
}
|
|
|
- if (LedgerLicEnum.LEDGERED.getStatus() != kwpLedgerLogistics.getStatus()) {
|
|
|
|
|
- throw new BusinessException("只有【已对账】的订单支持完成对账!");
|
|
|
|
|
- }
|
|
|
|
|
- kwpLedgerLogistics.setStatus(LedgerLicEnum.SUCCESS.getStatus());
|
|
|
|
|
- kwpLedgerLogistics.setAuditPhone(ledgerReq.getSuccessPhone());
|
|
|
|
|
- kwpLedgerLogistics.setAuditUser(ledgerReq.getSuccessUser());
|
|
|
|
|
|
|
+ successCheck(kwpLedgerLogistics.getStatus());
|
|
|
|
|
+
|
|
|
|
|
+ kwpLedgerLogistics.setStatus(LedgerEnum.SUCCESS.getStatus());
|
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
//生成结算单
|
|
//生成结算单
|
|
@@ -266,7 +244,9 @@ public class KwpLedgerLogisticsService {
|
|
|
kwpSettlementLogistics.setUpdateTime(LocalDateTime.now());
|
|
kwpSettlementLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
kwpSettlementLogistics.setDelFlag(0);
|
|
kwpSettlementLogistics.setDelFlag(0);
|
|
|
|
|
|
|
|
- settlementLogisticsMapper.insert(kwpSettlementLogistics);
|
|
|
|
|
|
|
+ settlementLogisticsService.save(kwpSettlementLogistics);
|
|
|
|
|
+
|
|
|
|
|
+ logisticsTrackService.saveTrack(ledgerReq.getId(), "", LedgerTrackEnum.SUCCESS);
|
|
|
return "对账完成";
|
|
return "对账完成";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|