|
@@ -81,13 +81,13 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Integer saveCustomerInfo(CustomerInfo customerInfo,SalesOrder salesOrder) throws Exception{
|
|
|
+ public Integer saveCustomerInfo(CustomerInfo customerInfo,SalesOrder salesOrder){
|
|
|
|
|
|
//添加客诉基本信息
|
|
|
Integer flag = 0;
|
|
|
flag = customerInfoMapper.insert(customerInfo);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加客诉失败");
|
|
|
+ throw new RuntimeException("添加客诉失败");
|
|
|
}
|
|
|
|
|
|
QuestionDescribe questionDescribe = new QuestionDescribe();
|
|
@@ -97,7 +97,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
questionDescribe.setDescribeHandleDesc(customerInfo.getDescribeHandleDesc()); //处理描述
|
|
|
flag = questionDescribeMapper.insert(questionDescribe);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加客诉失败");
|
|
|
+ throw new RuntimeException("添加客诉失败");
|
|
|
}
|
|
|
|
|
|
if ("2".equals(customerInfo.getCustomerIsVisit())) {
|
|
@@ -111,7 +111,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
visit.setVisitStatus(1); //回访状态
|
|
|
flag = visitMapper.addVisitInfo(visit);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加客诉失败");
|
|
|
+ throw new RuntimeException("添加客诉失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -143,17 +143,14 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
switch (customerInfo.getCustomerIsSolve()) { //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
case 3: //换新
|
|
|
|
|
|
- isReturn = customerService.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
- if(!isReturn){
|
|
|
- throw new Exception("生成退单失败");
|
|
|
- }
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
|
|
|
map = customerService.sendEfastOrder(customerCommon,salesOrder); //换新需要向Efast推送一条换新发货的订单
|
|
|
if(map.get("status") == 1){
|
|
|
customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId"))); //存放Efast订单编号
|
|
|
complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId"))); //仓储签收表添加 发货的Efast订单id
|
|
|
}else{
|
|
|
- throw new Exception("换新创建Efast订单失败");
|
|
|
+ throw new RuntimeException("换新创建Efast订单失败");
|
|
|
}
|
|
|
complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
@@ -162,17 +159,14 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
break;
|
|
|
case 4: //维修
|
|
|
|
|
|
- isReturn = customerService.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
- if(!isReturn){
|
|
|
- throw new Exception("生成退单失败");
|
|
|
- }
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
|
|
|
map = customerService.sendEfastOrder(customerCommon,salesOrder); //维修需要向Efast推送一条维修发货的订单
|
|
|
if(map.get("status") == 1){
|
|
|
customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId"))); //存放Efast订单编号
|
|
|
complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId"))); //仓储签收表添加 发货的Efast订单id
|
|
|
}else{
|
|
|
- throw new Exception("维修创建Efast订单失败");
|
|
|
+ throw new RuntimeException("维修创建Efast订单失败");
|
|
|
}
|
|
|
complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
@@ -185,15 +179,12 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId"))); //存放Efast订单编号
|
|
|
complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId"))); //仓储签收表添加 发货的Efast订单id
|
|
|
}else{
|
|
|
- throw new Exception("补发创建Efast订单失败");
|
|
|
+ throw new RuntimeException("补发创建Efast订单失败");
|
|
|
}
|
|
|
break;
|
|
|
case 6: //退货
|
|
|
|
|
|
- isReturn = customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
- if(!isReturn){
|
|
|
- throw new Exception("生成退单失败");
|
|
|
- }
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
|
|
|
complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
@@ -202,10 +193,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
break;
|
|
|
case 7: //无理由退货
|
|
|
|
|
|
- isReturn = customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
- if(!isReturn){
|
|
|
- throw new Exception("生成退单失败");
|
|
|
- }
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
|
|
|
complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
@@ -245,7 +233,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
break;
|
|
|
}
|
|
|
if (flag < 1) {
|
|
|
- throw new Exception("添加客诉处理结果失败");
|
|
|
+ throw new RuntimeException("添加客诉处理结果失败");
|
|
|
}
|
|
|
|
|
|
customerCommon.setRelationId(relationId);
|
|
@@ -309,7 +297,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void saveComplaintDetectInfo(ComplaintDetectInfo complaintDetectInfo,CustomerCommon customerCommon) throws Exception{
|
|
|
+ public void saveComplaintDetectInfo(ComplaintDetectInfo complaintDetectInfo,CustomerCommon customerCommon){
|
|
|
Integer flag = 0;
|
|
|
List<ComplaintDetectInfo> complaintDetectInfoList = new ArrayList<ComplaintDetectInfo>();
|
|
|
complaintDetectInfo.setCustomerId(customerCommon.getCustomerId()); //添加客诉
|
|
@@ -332,7 +320,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
flag = complaintDetectInfoMapper.insertList(complaintDetectInfoList);
|
|
|
}
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加品检失败");
|
|
|
+ throw new RuntimeException("添加品检失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -342,7 +330,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void saveComplaintSignclosedInfo(ComplaintSignclosedInfo complaintSignclosedInfo,CustomerCommon customerCommon)throws Exception{
|
|
|
+ public void saveComplaintSignclosedInfo(ComplaintSignclosedInfo complaintSignclosedInfo,CustomerCommon customerCommon){
|
|
|
Integer flag;
|
|
|
complaintSignclosedInfo.setSignclosedType(1); //客诉寄回
|
|
|
complaintSignclosedInfo.setSignclosedIsQuality(1); //是否平品检 1:需要品检
|
|
@@ -353,7 +341,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
complaintSignclosedInfo.setSignclosedIsFittings(2);
|
|
|
flag = complaintSignclosedInfoMapper.insert(complaintSignclosedInfo);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加签收失败");
|
|
|
+ throw new RuntimeException("添加签收失败");
|
|
|
}
|
|
|
|
|
|
//添加代签收表
|
|
@@ -388,7 +376,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
|
|
|
flag = complaintSignclosedProductInfoMapper.insertList(awaitingSignclosedProductInfoArrayList);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加签收产品失败");
|
|
|
+ throw new RuntimeException("添加签收产品失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -397,7 +385,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public Map<String,Object> sendEfastOrder(CustomerCommon customerCommon,SalesOrder salesOrder) throws Exception{
|
|
|
+ public Map<String,Object> sendEfastOrder(CustomerCommon customerCommon,SalesOrder salesOrder){
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
List<EfastOrder> orderList = new ArrayList<EfastOrder>();
|
|
|
List<OrderItem> itemList = new ArrayList<OrderItem>();
|
|
@@ -489,12 +477,12 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public Map<String,Object> sendEfastOrder(SalesOrder salesOrder) throws Exception{
|
|
|
+ public Map<String,Object> sendEfastOrder(SalesOrder salesOrder){
|
|
|
|
|
|
//添加订单数据
|
|
|
int orderNum = salesOrderMapper.addSalesOrder(salesOrder);
|
|
|
if (orderNum <= 0) {
|
|
|
- throw new Exception("添加订单失败");
|
|
|
+ throw new RuntimeException("添加订单失败");
|
|
|
}
|
|
|
for (SalesOrderItem item : salesOrder.getSalesOrderItemList()) {
|
|
|
item.setItemOrderId(salesOrder.getSalesId());
|
|
@@ -502,7 +490,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
//批量添加订单项数据
|
|
|
int itemNum = salesOrderMapper.addOrderItemList(salesOrder.getSalesOrderItemList());
|
|
|
if (itemNum <= 0) {
|
|
|
- throw new Exception("添加订单项失败");
|
|
|
+ throw new RuntimeException("添加订单项失败");
|
|
|
}
|
|
|
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
@@ -592,7 +580,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
if(oList != null && oList.size() > 0){
|
|
|
map.put("EfastOrderId",oList.get(0).getOrderId());
|
|
|
}else{
|
|
|
- throw new Exception("添加订单项失败");
|
|
|
+ throw new RuntimeException("添加订单项失败");
|
|
|
}
|
|
|
map.put("status",status);
|
|
|
return map;
|
|
@@ -603,17 +591,17 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* @param customerCommon
|
|
|
* @param salesOrder
|
|
|
* @return
|
|
|
- * @throws Exception
|
|
|
+ * @throws RuntimeException
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public boolean chargebackEfastOrder(CustomerCommon customerCommon, SalesOrder salesOrder,Integer status) throws Exception{
|
|
|
+ public void chargebackEfastOrder(CustomerCommon customerCommon, SalesOrder salesOrder,Integer status){
|
|
|
|
|
|
SalesOrder order = new SalesOrder();
|
|
|
order.setSalesId(salesOrder.getSalesId());
|
|
|
order.setSalesOrderStatus(status); //换货状态
|
|
|
Integer flag = salesOrderMapper.updateSalesOrder(order);
|
|
|
if(flag < 0){
|
|
|
- return false;
|
|
|
+ throw new RuntimeException("生成退单失败");
|
|
|
}
|
|
|
EfastOrder efastOrder = new EfastOrder();
|
|
|
List<EfastOrderItem> itemList = new ArrayList<>();
|
|
@@ -649,10 +637,8 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
}catch (Exception e){
|
|
|
logger.info("------将原订单生成退货订单报错------");
|
|
|
}
|
|
|
- if(fg){
|
|
|
- return true;
|
|
|
- }else{
|
|
|
- return false;
|
|
|
+ if(!fg){
|
|
|
+ throw new RuntimeException("生成退单失败");
|
|
|
}
|
|
|
}
|
|
|
|