|
@@ -16,22 +16,24 @@ 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.jd.po.JdBack;
|
|
|
+import com.fjhx.victoriatourist.entity.jd.po.JdBackDetails;
|
|
|
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.jd.JdBackDetailsService;
|
|
|
+import com.fjhx.victoriatourist.service.jd.JdBackService;
|
|
|
import com.fjhx.victoriatourist.service.logistics.LogisticsDetailsService;
|
|
|
import com.fjhx.victoriatourist.service.logistics.LogisticsInfosService;
|
|
|
import com.fjhx.victoriatourist.utils.Assert;
|
|
|
import com.fjhx.victoriatourist.utils.LogisticsConstant;
|
|
|
-import com.fjhx.wms.entity.stock.vo.StockVo;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -54,6 +56,10 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
LogisticsDetailsService logisticsDetailsService;
|
|
|
@Autowired
|
|
|
PurchaseService purchaseService;
|
|
|
+ @Autowired
|
|
|
+ JdBackService jdBackService;
|
|
|
+ @Autowired
|
|
|
+ JdBackDetailsService jdBackDetailsService;
|
|
|
|
|
|
@Override
|
|
|
public Page<LogisticsInfosVo> getPage(LogisticsInfosSelectDto dto) {
|
|
@@ -111,14 +117,19 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
logisticsDetailsService.save(logisticsDetails);
|
|
|
}
|
|
|
|
|
|
+ @DSTransactional
|
|
|
@EventListener
|
|
|
public void kd100EventListener(Kd100CallbackEvent event) {
|
|
|
LogisticsInfo logisticsInfo = event.getLogisticsInfo();
|
|
|
//监听物流状态变化
|
|
|
if (KD100Util.getTableName(LogisticsInfos.class).equals(logisticsInfo.getTableName())) {
|
|
|
LogisticsInfos byId = getById(logisticsInfo.getBusinessId());
|
|
|
- byId.setLogisticsStatus(logisticsInfo.getState());
|
|
|
- updateById(byId);
|
|
|
+ if (ObjectUtil.notEqual(logisticsInfo.getState(), byId.getLogisticsStatus())) {
|
|
|
+ byId.setLogisticsStatus(logisticsInfo.getState());
|
|
|
+ updateById(byId);
|
|
|
+ //如果是京东退货且物流状态为完成
|
|
|
+ updateJdBack(byId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -140,6 +151,7 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @DSTransactional
|
|
|
public void dataInfoEdit(Long id) {
|
|
|
LogisticsInfos logisticsInfo = getById(id);
|
|
|
Assert.notEmpty(logisticsInfo, "没有找到物流信息");
|
|
@@ -148,6 +160,8 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
if (ObjectUtil.notEqual(state, logisticsInfo.getLogisticsStatus())) {
|
|
|
logisticsInfo.setLogisticsStatus(state);
|
|
|
updateById(logisticsInfo);
|
|
|
+ //如果是京东退货且物流状态为完成
|
|
|
+ updateJdBack(logisticsInfo);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -173,4 +187,24 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
|
|
|
updateById(logisticsInfo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 如果物流状态完成,更新京东退货状态,添加待质检数据
|
|
|
+ */
|
|
|
+ public void updateJdBack(LogisticsInfos logisticsInfo) {
|
|
|
+ if (ObjectUtil.isEmpty(logisticsInfo) || ObjectUtil.isEmpty(logisticsInfo.getLogisticsStatus())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (logisticsInfo.getLogisticsStatus() == 15 && logisticsInfo.getBusinessType() == 4) {
|
|
|
+ //京东退货状态修改添加待质检数据
|
|
|
+ JdBack jdBack = jdBackService.getById(logisticsInfo.getBusinessId());
|
|
|
+ if (ObjectUtil.isNotEmpty(jdBack)) {
|
|
|
+ jdBack.setStatus(3);//待质检
|
|
|
+ jdBackService.updateById(jdBack);
|
|
|
+ //创建待质检记录
|
|
|
+ List<JdBackDetails> jdBackDetailsList = jdBackDetailsService.list(q -> q.eq(JdBackDetails::getJdBackId, logisticsInfo.getBusinessId()));
|
|
|
+ jdBackService.createJdBackQualityWait(jdBackDetailsList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|