|
|
@@ -1,11 +1,129 @@
|
|
|
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.PageHelperUtil;
|
|
|
+import com.sckw.core.model.page.PageResult;
|
|
|
+import com.sckw.core.utils.IdWorker;
|
|
|
+import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
|
|
|
+import com.sckw.payment.dao.KwpLedgerLogisticsOrderMapper;
|
|
|
+import com.sckw.payment.dao.KwpLedgerLogisticsTrackMapper;
|
|
|
+import com.sckw.payment.model.KwpLedgerLogistics;
|
|
|
+import com.sckw.payment.model.KwpLedgerLogisticsOrder;
|
|
|
+import com.sckw.payment.model.KwpLedgerLogisticsTrack;
|
|
|
+import com.sckw.payment.model.constant.LedgerLicEnum;
|
|
|
+import com.sckw.payment.model.dto.LedgerLogisticsDto;
|
|
|
+import com.sckw.payment.model.vo.req.LedgerReq;
|
|
|
+import com.sckw.payment.model.vo.req.LogisticsReq;
|
|
|
+import com.sckw.payment.model.vo.req.LogisticsSendReq;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @author xucaiqin
|
|
|
* @date 2023-07-10 16:38:36
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class KwpLedgerLogisticsService {
|
|
|
|
|
|
+ private final KwpLedgerLogisticsMapper logisticsMapper;
|
|
|
+ private final KwpLedgerLogisticsTrackMapper logisticsTrackMapper;
|
|
|
+ private final KwpLedgerLogisticsOrderMapper logisticsOrderMapper;
|
|
|
+
|
|
|
+ public PageResult pageList(LogisticsReq logisticsReq) {
|
|
|
+ //todo 查询缓存,获取客户企业id
|
|
|
+ String keywords = logisticsReq.getKeywords();
|
|
|
+ if (StringUtils.isNotBlank(keywords)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ PageHelper.startPage(logisticsReq.getPage(), logisticsReq.getPageSize());
|
|
|
+
|
|
|
+ List<LedgerLogisticsDto> kwpLedgerLogisticsList = logisticsMapper.pageSelect(logisticsReq);
|
|
|
+
|
|
|
+ return PageHelperUtil.getPageResult(new PageInfo<>(kwpLedgerLogisticsList));
|
|
|
+ }
|
|
|
+
|
|
|
+ public Object sendLedger(LogisticsSendReq logisticsReq) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Object sendLedgerDraft(LogisticsSendReq logisticsReq) {
|
|
|
+ /*插入物流对账单*/
|
|
|
+ KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
+ kwpLedgerLogistics.setId(new IdWorker(1).nextId());
|
|
|
+ kwpLedgerLogistics.setEntId(0L);//todo
|
|
|
+ kwpLedgerLogistics.setCheckEntId(logisticsReq.getCheckEntId());
|
|
|
+ kwpLedgerLogistics.setCarrierEntId(logisticsReq.getCarrierEntId());//todo
|
|
|
+ kwpLedgerLogistics.setLLedgerNo("");//todo
|
|
|
+ kwpLedgerLogistics.setName(logisticsReq.getName());
|
|
|
+ kwpLedgerLogistics.setStartTime(logisticsReq.getStartTime());
|
|
|
+ kwpLedgerLogistics.setEndTime(logisticsReq.getEndTime());
|
|
|
+ kwpLedgerLogistics.setTaxRate(new BigDecimal("0"));//todo
|
|
|
+ kwpLedgerLogistics.setTrading(logisticsReq.getTrading());//todo
|
|
|
+ //todo 查询运单
|
|
|
+
|
|
|
+ kwpLedgerLogistics.setUnloadAmount(new BigDecimal("0"));
|
|
|
+ kwpLedgerLogistics.setLoadAmount(new BigDecimal("0"));
|
|
|
+ kwpLedgerLogistics.setDeficitAmount(new BigDecimal("0"));
|
|
|
+ kwpLedgerLogistics.setLoseAmount(new BigDecimal("0"));
|
|
|
+ kwpLedgerLogistics.setTotalPrice(logisticsReq.getTotalPrice());
|
|
|
+ kwpLedgerLogistics.setSettlePrice(logisticsReq.getSettlePrice());
|
|
|
+ kwpLedgerLogistics.setActualPrice(new BigDecimal("0"));
|
|
|
+ kwpLedgerLogistics.setCheckPhone("");//取承运订单的第一条数据
|
|
|
+ kwpLedgerLogistics.setCheckUser("");
|
|
|
+ kwpLedgerLogistics.setCarrierPhone("");
|
|
|
+ kwpLedgerLogistics.setCarrierUser("");
|
|
|
+ kwpLedgerLogistics.setGenerateTime(null);
|
|
|
+ kwpLedgerLogistics.setUrl("");
|
|
|
+ kwpLedgerLogistics.setRemark(logisticsReq.getRemark());
|
|
|
+ kwpLedgerLogistics.setStatus(0);
|
|
|
+ kwpLedgerLogistics.setCreateBy(0L);
|
|
|
+ kwpLedgerLogistics.setCreateTime(LocalDateTime.now());
|
|
|
+ kwpLedgerLogistics.setUpdateBy(0L);
|
|
|
+ kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
+ kwpLedgerLogistics.setDelFlag(0);
|
|
|
+ logisticsMapper.insert(kwpLedgerLogistics);
|
|
|
+ /*插入对账关联物流运单*/
|
|
|
+ logisticsOrderMapper.insert(new KwpLedgerLogisticsOrder());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Integer remove(Long id) {
|
|
|
+ return logisticsMapper.deleteById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String backOrder(Long id) {
|
|
|
+ KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
+ kwpLedgerLogistics.setId(id);
|
|
|
+ kwpLedgerLogistics.setStatus(LedgerLicEnum.CANCEL.getStatus());
|
|
|
+ logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer doBack(LedgerReq ledgerReq) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|