|
@@ -2,6 +2,7 @@ package com.fjhx.victoriatourist.service.logistics.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
@@ -20,12 +21,14 @@ import com.fjhx.kd100.util.KD100Result;
|
|
|
import com.fjhx.kd100.util.KD100Util;
|
|
|
import com.fjhx.purchase.entity.purchase.po.Purchase;
|
|
|
import com.fjhx.purchase.service.purchase.PurchaseService;
|
|
|
+import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
|
|
|
import com.fjhx.victoriatourist.entity.logistics.dto.LogisticsInfosDto;
|
|
|
import com.fjhx.victoriatourist.entity.logistics.dto.LogisticsInfosSelectDto;
|
|
|
import com.fjhx.victoriatourist.entity.logistics.po.LogisticsDetails;
|
|
|
import com.fjhx.victoriatourist.entity.logistics.po.LogisticsInfos;
|
|
|
import com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo;
|
|
|
import com.fjhx.victoriatourist.mapper.logistics.LogisticsInfosMapper;
|
|
|
+import com.fjhx.victoriatourist.service.deliver.DeliverGoodsService;
|
|
|
import com.fjhx.victoriatourist.service.jd.JdBackService;
|
|
|
import com.fjhx.victoriatourist.service.logistics.LogisticsDetailsService;
|
|
|
import com.fjhx.victoriatourist.service.logistics.LogisticsInfosService;
|
|
@@ -68,6 +71,8 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
private ISysRoleService sysRoleService;
|
|
|
@Autowired
|
|
|
private ConfigInfoService configInfoService;
|
|
|
+ @Autowired
|
|
|
+ private DeliverGoodsService deliverGoodsService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -86,10 +91,10 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
wrapper.and(q -> q.like("li", LogisticsInfos::getCode, dto.getKeyword())
|
|
|
.or().like("IF( li.business_type IN ( 1, 5 ), p.contractCode, li.business_code ) ", dto.getKeyword())
|
|
|
.or().in("li", LogisticsInfos::getLogisticsCompanyCode, companyCodes)
|
|
|
- .or(flag).like(flag,"pi.custom_code", dto.getKeyword())
|
|
|
- .or(flag).like(flag,"pi.name", dto.getKeyword())
|
|
|
+ .or(flag).like(flag, "pi.custom_code", dto.getKeyword())
|
|
|
+ .or(flag).like(flag, "pi.name", dto.getKeyword())
|
|
|
//采购到货 采购退货 来源
|
|
|
- .or().inSql("p.id","select pd.purchase_id from bytesailing_purchase.purchase_detail pd LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id where ( pi.`name` LIKE CONCAT( '%', '"+dto.getKeyword()+"', '%' ) OR pi.custom_code LIKE CONCAT( '%', '"+dto.getKeyword()+"', '%' ))")
|
|
|
+ .or().inSql("p.id", "select pd.purchase_id from bytesailing_purchase.purchase_detail pd LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id where ( pi.`name` LIKE CONCAT( '%', '" + dto.getKeyword() + "', '%' ) OR pi.custom_code LIKE CONCAT( '%', '" + dto.getKeyword() + "', '%' ))")
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -184,7 +189,10 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
|
|
|
@Override
|
|
|
public void edit(LogisticsInfosDto logisticsInfosDto) {
|
|
|
- if (logisticsInfosDto.getIsKd100() == 1) {
|
|
|
+ //只在生产环境调用Kd100
|
|
|
+ String activeProfile = SpringUtil.getActiveProfile();
|
|
|
+
|
|
|
+ if ("prod".equals(activeProfile) && logisticsInfosDto.getIsKd100() == 1) {
|
|
|
//发起快递100订阅
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.KD100);
|
|
|
Integer state = KD100Util.monitor(logisticsInfosDto.getLogisticsCompanyCode(), logisticsInfosDto.getCode(), logisticsInfosDto.getId(), logisticsInfosDto.getBusinessType(), LogisticsInfos.class).getState();
|
|
@@ -194,6 +202,15 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
}
|
|
|
|
|
|
this.updateById(logisticsInfosDto);
|
|
|
+
|
|
|
+ //更新发货单号
|
|
|
+ if (ObjectUtil.equals(logisticsInfosDto.getBusinessType(), 1)) {
|
|
|
+ deliverGoodsService.update(q -> q
|
|
|
+ .eq(DeliverGoods::getId, logisticsInfosDto.getBusinessId())
|
|
|
+ .set(DeliverGoods::getLogisticsCompanyCode, logisticsInfosDto.getLogisticsCompanyCode())
|
|
|
+ .set(DeliverGoods::getCode, logisticsInfosDto.getCode())
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -205,7 +222,7 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
public KD100Result getLogistics(Long id) {
|
|
|
LogisticsInfos logisticsInfo = this.getById(id);
|
|
|
Assert.notEmpty(logisticsInfo, "没有找到物流信息");
|
|
|
- return KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(),logisticsInfo.getPhone());
|
|
|
+ return KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(), logisticsInfo.getPhone());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -213,7 +230,7 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
public void dataInfoEdit(Long id) {
|
|
|
LogisticsInfos logisticsInfo = getById(id);
|
|
|
Assert.notEmpty(logisticsInfo, "没有找到物流信息");
|
|
|
- KD100Result kd100Result = KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(),logisticsInfo.getPhone());
|
|
|
+ KD100Result kd100Result = KD100Util.queryTrack(logisticsInfo.getLogisticsCompanyCode(), logisticsInfo.getCode(), logisticsInfo.getPhone());
|
|
|
Integer state = kd100Result.getState();
|
|
|
if (ObjectUtil.notEqual(state, logisticsInfo.getLogisticsStatus())) {
|
|
|
//原来是异常物流信息 限制刷新到状态就添加订阅
|