|
@ -1,9 +1,11 @@
|
|
package com.yihu.wlyy.service.app.express;
|
|
package com.yihu.wlyy.service.app.express;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.dict.DmExpressagePriceEntity;
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressageLog;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressageLog;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
|
|
|
|
import com.yihu.wlyy.repository.dict.DmExpressagePriceDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageLogDao;
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageLogDao;
|
|
@ -59,6 +61,9 @@ public class SFExpressService extends BaseService {
|
|
@Autowired
|
|
@Autowired
|
|
private SFUtils SFUtils;
|
|
private SFUtils SFUtils;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private JpaTransactionManager transactionManager;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionLogDao prescriptionLogDao;
|
|
private PrescriptionLogDao prescriptionLogDao;
|
|
|
|
|
|
@ -66,7 +71,7 @@ public class SFExpressService extends BaseService {
|
|
private PrescriptionDao prescriptionDao;
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private JpaTransactionManager transactionManager;
|
|
|
|
|
|
private DmExpressagePriceDao dmExpressagePriceDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
|
|
private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
|
|
@ -391,13 +396,13 @@ public class SFExpressService extends BaseService {
|
|
|
|
|
|
//根据快递单号获取处方配送详细信息
|
|
//根据快递单号获取处方配送详细信息
|
|
PrescriptionExpressage sfexpress = prescriptionExpressageDao.findByPrescriptionExpressMailno(mailno);
|
|
PrescriptionExpressage sfexpress = prescriptionExpressageDao.findByPrescriptionExpressMailno(mailno);
|
|
|
|
|
|
|
|
//根据快递单号获取本地的路由信息
|
|
List<PrescriptionExpressageLog> localroutinfos = prescriptionExpressageLogDao.findByPrescriptionCode(sfexpress.getPrescriptionCode());
|
|
List<PrescriptionExpressageLog> localroutinfos = prescriptionExpressageLogDao.findByPrescriptionCode(sfexpress.getPrescriptionCode());
|
|
|
|
|
|
|
|
//需要增量更新到本地的路由信息集合
|
|
List<PrescriptionExpressageLog> newroutinfolist = new ArrayList<>();
|
|
List<PrescriptionExpressageLog> newroutinfolist = new ArrayList<>();
|
|
|
|
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
|
|
|
|
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事务隔离级别,开启新事务
|
|
TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
|
|
TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
|
|
try {
|
|
try {
|
|
|
|
|
|
@ -412,6 +417,7 @@ public class SFExpressService extends BaseService {
|
|
|
|
|
|
for (PrescriptionExpressageLog pushlog: pushSFLogs) {
|
|
for (PrescriptionExpressageLog pushlog: pushSFLogs) {
|
|
|
|
|
|
|
|
//判断是否有已收件的路由节点
|
|
if("已收件".equals(pushlog.getAcceptRemark())){
|
|
if("已收件".equals(pushlog.getAcceptRemark())){
|
|
isContainEndRoutInfo = true;
|
|
isContainEndRoutInfo = true;
|
|
}
|
|
}
|
|
@ -429,7 +435,7 @@ public class SFExpressService extends BaseService {
|
|
prescriptionExpressageLogDao.save(newroutinfolist);
|
|
prescriptionExpressageLogDao.save(newroutinfolist);
|
|
}
|
|
}
|
|
|
|
|
|
//如果路由信息节点包含了"已收件"节点,这修改处方派送状态为完成,增加物流派送日志为完成
|
|
|
|
|
|
//如果路由信息节点包含了"已收件"节点,则修改处方状态为完成,增加物流派送日志为完成
|
|
if(isContainEndRoutInfo){
|
|
if(isContainEndRoutInfo){
|
|
//修改处方状态为完成
|
|
//修改处方状态为完成
|
|
prescriptionDao.updateStatus(sfexpress.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
prescriptionDao.updateStatus(sfexpress.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
|
|
@ -453,4 +459,26 @@ public class SFExpressService extends BaseService {
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据收寄地址获取快递费用
|
|
|
|
* @param d_province 省份名称
|
|
|
|
* @param d_city 城市名称
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public DmExpressagePriceEntity getSFExpressPrice(String d_province, String d_city) {
|
|
|
|
String end_address_name = "";
|
|
|
|
|
|
|
|
if("厦门市".equals(d_city)){
|
|
|
|
end_address_name = "同城";
|
|
|
|
}else{
|
|
|
|
if("福建省".equals(d_province)){
|
|
|
|
end_address_name = "省内";
|
|
|
|
}else{
|
|
|
|
end_address_name = d_city;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DmExpressagePriceEntity sfprice = dmExpressagePriceDao.getExprePriceEntityByCodeAndEndAdressName("shunfeng",end_address_name);
|
|
|
|
return sfprice;
|
|
|
|
}
|
|
}
|
|
}
|