|
@@ -74,8 +74,6 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
@Autowired
|
|
|
private EfastOrderService efastOrderService;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public CustomerInfo getCustomerInfo(Integer customerId) {
|
|
|
return customerInfoMapper.getCustomerInfo(customerId);
|
|
@@ -83,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();
|
|
@@ -99,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())) {
|
|
@@ -113,7 +111,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
visit.setVisitStatus(1); //回访状态
|
|
|
flag = visitMapper.addVisitInfo(visit);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加客诉失败");
|
|
|
+ throw new RuntimeException("添加客诉失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -136,7 +134,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
customerCommon.setRelationBackPostage(0); //邮费默认为0
|
|
|
|
|
|
/* 初始化产品类型,名称,配件名称 */
|
|
|
- this.setName(customerCommon);
|
|
|
+ customerService.setName(customerCommon);
|
|
|
|
|
|
ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo(); //品质检测
|
|
|
ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo(); //客诉-签收表
|
|
@@ -145,62 +143,62 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
switch (customerInfo.getCustomerIsSolve()) { //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
case 3: //换新
|
|
|
|
|
|
- isReturn = this.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
|
|
|
- map = this.sendEfastOrder(customerCommon,salesOrder); //换新需要向Efast推送一条换新发货的订单
|
|
|
+ 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的订单编号
|
|
|
- this.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
+ customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
+ customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
break;
|
|
|
case 4: //维修
|
|
|
|
|
|
- isReturn = this.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,2); //原订单生成退单
|
|
|
|
|
|
- map = this.sendEfastOrder(customerCommon,salesOrder); //维修需要向Efast推送一条维修发货的订单
|
|
|
+ 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的订单编号
|
|
|
- this.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
+ customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
+ customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
break;
|
|
|
case 5: //补发 不用创建仓储签收任务
|
|
|
- map = this.sendEfastOrder(customerCommon,salesOrder); //补发需要向Efast推送一条发货的订单
|
|
|
+ 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订单失败");
|
|
|
}
|
|
|
break;
|
|
|
case 6: //退货
|
|
|
|
|
|
- isReturn = this.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
|
|
|
complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- this.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
+ customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
+ customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
break;
|
|
|
case 7: //无理由退货
|
|
|
|
|
|
- isReturn = this.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
|
|
|
complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- this.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
+ customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
+ customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
break;
|
|
|
}
|
|
|
customerCommon.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
|
|
@@ -235,7 +233,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
break;
|
|
|
}
|
|
|
if (flag < 1) {
|
|
|
- throw new Exception("添加客诉处理结果失败");
|
|
|
+ throw new RuntimeException("添加客诉处理结果失败");
|
|
|
}
|
|
|
|
|
|
customerCommon.setRelationId(relationId);
|
|
@@ -263,7 +261,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* 产品配件初始化
|
|
|
* @param cc
|
|
|
*/
|
|
|
- private void setName(CustomerCommon cc){
|
|
|
+ public void setName(CustomerCommon cc){
|
|
|
for (int i=0;i<cc.getSendProdcues().size();i++) {
|
|
|
Product product = productMapper.getProduce(cc.getSendProdcues().get(i).getProductId());
|
|
|
cc.getSendProdcues().get(i).setSendProduceName(product.getProductName());
|
|
@@ -299,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()); //添加客诉
|
|
@@ -322,7 +320,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
flag = complaintDetectInfoMapper.insertList(complaintDetectInfoList);
|
|
|
}
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加品检失败");
|
|
|
+ throw new RuntimeException("添加品检失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -332,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:需要品检
|
|
@@ -343,7 +341,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
complaintSignclosedInfo.setSignclosedIsFittings(2);
|
|
|
flag = complaintSignclosedInfoMapper.insert(complaintSignclosedInfo);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加签收失败");
|
|
|
+ throw new RuntimeException("添加签收失败");
|
|
|
}
|
|
|
|
|
|
//添加代签收表
|
|
@@ -378,7 +376,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
|
|
|
flag = complaintSignclosedProductInfoMapper.insertList(awaitingSignclosedProductInfoArrayList);
|
|
|
if(flag < 1){
|
|
|
- throw new Exception("添加签收产品失败");
|
|
|
+ throw new RuntimeException("添加签收产品失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -387,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>();
|
|
@@ -479,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());
|
|
@@ -492,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>();
|
|
@@ -582,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;
|
|
@@ -593,19 +591,18 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
* @param customerCommon
|
|
|
* @param salesOrder
|
|
|
* @return
|
|
|
- * @throws Exception
|
|
|
+ * @throws RuntimeException
|
|
|
*/
|
|
|
@Transactional
|
|
|
- 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){
|
|
|
-// throw new Exception("退货失败");
|
|
|
-// }
|
|
|
-
|
|
|
+ if(flag < 0){
|
|
|
+ throw new RuntimeException("生成退单失败");
|
|
|
+ }
|
|
|
EfastOrder efastOrder = new EfastOrder();
|
|
|
List<EfastOrderItem> itemList = new ArrayList<>();
|
|
|
|
|
@@ -640,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("生成退单失败");
|
|
|
}
|
|
|
}
|
|
|
|