|
@@ -9,7 +9,6 @@ import com.iamberry.rst.faces.cm.CustomerService;
|
|
|
import com.iamberry.rst.service.cm.mapper.*;
|
|
|
import com.iamberry.rst.service.order.EfastOrderServiceImpl;
|
|
|
import com.iamberry.rst.util.PageUtil;
|
|
|
-import freemarker.ext.beans.HashAdapter;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -39,17 +38,28 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
@Autowired
|
|
|
private ClosedProdcueMapper closedProdcueMapper;
|
|
|
@Autowired
|
|
|
+ private SendProdcueMapper sendProdcueMapper;
|
|
|
+ @Autowired
|
|
|
+ private SendFittingMapper sendFittingMapper;
|
|
|
+ @Autowired
|
|
|
+ private SalesOrderMapper salesOrderMapper;
|
|
|
+ @Autowired
|
|
|
+ private CustomerService customerService;
|
|
|
+ @Autowired
|
|
|
private VisitMapper visitMapper; //回访
|
|
|
@Autowired
|
|
|
private ComplaintSignclosedInfoMapper complaintSignclosedInfoMapper; //仓储
|
|
|
@Autowired
|
|
|
private ComplaintDetectInfoMapper complaintDetectInfoMapper; //品检
|
|
|
- @Autowired
|
|
|
- private SalesOrderMapper salesOrderMapper; //订单
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CustomerInfo getCustomerInfo(Integer customerId) {
|
|
|
+ return customerInfoMapper.getCustomerInfo(customerId);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Integer saveCustomerInfo(CustomerInfo customerInfo,SalesOrder salesOrder) {
|
|
|
+ public Integer saveCustomerInfo(CustomerInfo customerInfo,SalesOrder salesOrder,Map<String,Object> produceMap) {
|
|
|
|
|
|
salesOrder = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());
|
|
|
|
|
@@ -214,7 +224,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
EfastOrderServiceImpl efastOrderService = new EfastOrderServiceImpl();
|
|
|
List<EfastOrder> orderList = new ArrayList<EfastOrder>();
|
|
|
- List<OrderItem > itemList = new ArrayList<OrderItem>();
|
|
|
+ List<OrderItem> itemList = new ArrayList<OrderItem>();
|
|
|
// try {
|
|
|
// efastOrderService.sendOrderInfoToEfast(orderList,itemList);
|
|
|
// } catch (Exception e) {
|
|
@@ -227,11 +237,6 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public CustomerInfo getCustomerInfo(Integer customerId) {
|
|
|
- return customerInfoMapper.getCustomerInfo(customerId);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public Integer updateCustomerInfo(CustomerInfo record) {
|
|
|
return customerInfoMapper.updateCustomerInfo(record);
|
|
|
}
|
|
@@ -314,7 +319,8 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CustomerCommon getCustomerInfo(CustomerInfo customerInfo) {
|
|
|
+ public Map<String,Object> getCustomerInfo(CustomerInfo customerInfo) {
|
|
|
+ Map<String,Object> map = new HashMap<String,Object>();
|
|
|
CustomerCommon customerCommon = new CustomerCommon();
|
|
|
//查询客诉列表
|
|
|
List<CustomerInfo> customerList = customerInfoMapper.listCustomer(customerInfo);
|
|
@@ -322,42 +328,42 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
return null;
|
|
|
}
|
|
|
CustomerInfo customer = customerList.get(0);
|
|
|
+ map.put("customer",customer);
|
|
|
+ int orderId = 0;
|
|
|
switch (customer.getCustomerIsSolve().intValue()) {
|
|
|
case 3://换新
|
|
|
- //查询售后换新集合
|
|
|
Renewed renewedInfo = new Renewed();
|
|
|
renewedInfo.setRenewedState(1);
|
|
|
renewedInfo.setCustomerId(customerInfo.getCustomerId());
|
|
|
- List<Renewed> renewedList = renewedMapper.listRenewed(renewedInfo);
|
|
|
- if (renewedList == null || renewedList.size() == 0) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- renewedInfo = renewedList.get(0);
|
|
|
- customerCommon = CustomerCommon.getCustomerCommon(3, renewedInfo);
|
|
|
+ //查询售后换新详情
|
|
|
+ renewedInfo = renewedMapper.getRenewedInfo(renewedInfo);
|
|
|
+ orderId = renewedInfo.getOrderId();
|
|
|
+ customerCommon = CustomerCommon.getCustomerCommon(3,renewedInfo);
|
|
|
+ customerCommon = customerService.selectProdcueAndFitting(customerCommon,3);
|
|
|
break;
|
|
|
case 4://维修
|
|
|
- //查询售后维修集合
|
|
|
Repair repairInfo = new Repair();
|
|
|
repairInfo.setRepairState(1);
|
|
|
repairInfo.setCustomerId(customerInfo.getCustomerId());
|
|
|
- List<Repair> repairList = repairMapper.listRepair(repairInfo);
|
|
|
- if (repairList == null || repairList.size() == 0) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- repairInfo = repairList.get(0);
|
|
|
- customerCommon = CustomerCommon.getCustomerCommon(4, repairInfo);
|
|
|
+ //查询售后维修集合
|
|
|
+ repairInfo = repairMapper.getRepairInfo(repairInfo);
|
|
|
+ orderId = repairInfo.getOrderId();
|
|
|
+ customerCommon = CustomerCommon.getCustomerCommon(4,repairInfo);
|
|
|
+ customerCommon = customerService.selectProdcueAndFitting(customerCommon,4);
|
|
|
break;
|
|
|
case 5://补发
|
|
|
- //查询售后补发集合
|
|
|
Reissue reissueInfo = new Reissue();
|
|
|
reissueInfo.setReissueState(1);
|
|
|
reissueInfo.setCustomerId(customerInfo.getCustomerId());
|
|
|
+ //查询售后补发集合
|
|
|
List<Reissue> reissueList = reissueMapper.listReissue(reissueInfo);
|
|
|
if (reissueList == null || reissueList.size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
reissueInfo = reissueList.get(0);
|
|
|
- customerCommon = CustomerCommon.getCustomerCommon(5, reissueInfo);
|
|
|
+ orderId = reissueInfo.getOrderId();
|
|
|
+ customerCommon = CustomerCommon.getCustomerCommon(5,reissueInfo);
|
|
|
+ customerCommon = customerService.selectProdcueAndFitting(customerCommon,5);
|
|
|
break;
|
|
|
case 6://退货
|
|
|
//查询售后退货集合
|
|
@@ -369,7 +375,9 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
return null;
|
|
|
}
|
|
|
backGoodsInfo = backGoodsList.get(0);
|
|
|
- customerCommon = CustomerCommon.getCustomerCommon(6, backGoodsInfo);
|
|
|
+ orderId = backGoodsInfo.getOrderId();
|
|
|
+ customerCommon = CustomerCommon.getCustomerCommon(6,backGoodsInfo);
|
|
|
+ customerCommon = customerService.selectProdcueAndFitting(customerCommon,6);
|
|
|
break;
|
|
|
case 7://无理由退货
|
|
|
//查询售后无理由退货集合
|
|
@@ -381,9 +389,113 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
return null;
|
|
|
}
|
|
|
noreasonBackInfo = noreasonBackList.get(0);
|
|
|
- customerCommon = CustomerCommon.getCustomerCommon(7, noreasonBackInfo);
|
|
|
+ orderId = noreasonBackInfo.getOrderId();
|
|
|
+ customerCommon = CustomerCommon.getCustomerCommon(7,noreasonBackInfo);
|
|
|
+ customerCommon = customerService.selectProdcueAndFitting(customerCommon,7);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ SalesOrder salesOrder = new SalesOrder();
|
|
|
+ salesOrder.setSalesId(orderId);
|
|
|
+ //查询订单信息
|
|
|
+ List<SalesOrder> orderList = salesOrderMapper.listSalesOrder(salesOrder);
|
|
|
+ if (orderList != null && orderList.size() > 0) {
|
|
|
+ SalesOrder order = orderList.get(0);
|
|
|
+ SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
+ salesOrderItem.setItemOrderId(order.getSalesId());
|
|
|
+ order.setSalesOrderItemList(salesOrderMapper.listSalesOrderItem(salesOrderItem));
|
|
|
+ map.put("salesOrder",order);
|
|
|
+ } else {
|
|
|
+ map.put("salesOrder",null);
|
|
|
+ }
|
|
|
+ map.put("customerCommon",customerCommon);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CustomerCommon selectProdcueAndFitting(CustomerCommon customerCommon, int isSolve) {
|
|
|
+ if (customerCommon == null || customerCommon.getRelationId() == null) {
|
|
|
+ return customerCommon;
|
|
|
+ }
|
|
|
+ List<SendProdcue> sendProdcues = null;
|
|
|
+ List<SendFitting> sendFittings = null;
|
|
|
+ List<ClosedFitting> closedfittings = null;
|
|
|
+ List<ClosedProdcue> closedProdcues = null;
|
|
|
+ SendProdcue sendProdcue = new SendProdcue();
|
|
|
+ SendFitting sendFitting = new SendFitting();
|
|
|
+ ClosedFitting fitting = new ClosedFitting();
|
|
|
+ ClosedProdcue closedProdcue = new ClosedProdcue();
|
|
|
+ switch (isSolve) {
|
|
|
+ case 3://换新
|
|
|
+ sendProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ sendProdcue.setSendProduceType(3);
|
|
|
+ //查询寄出产品集合
|
|
|
+ sendProdcues = sendProdcueMapper.listSendProdcue(sendProdcue);
|
|
|
+ sendFitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ sendFitting.setSendFittingType(3);
|
|
|
+ //查询寄出配件集合
|
|
|
+ sendFittings = sendFittingMapper.listSendFitting(sendFitting);
|
|
|
+ fitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ fitting.setClosedFittingType(3);
|
|
|
+ //查询寄回配件集合
|
|
|
+ closedfittings = closedFittingMapper.listClosedFitting(fitting);
|
|
|
+ closedProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ closedProdcue.setClosedProdcueType(3);
|
|
|
+ //查询寄回产品集合
|
|
|
+ closedProdcues = closedProdcueMapper.listclosedProdcue(closedProdcue);
|
|
|
+ break;
|
|
|
+ case 4://维修
|
|
|
+ sendProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ sendProdcue.setSendProduceType(4);
|
|
|
+ //查询寄出产品集合
|
|
|
+ sendProdcues = sendProdcueMapper.listSendProdcue(sendProdcue);
|
|
|
+ sendFitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ sendFitting.setSendFittingType(4);
|
|
|
+ //查询寄出配件集合
|
|
|
+ sendFittings = sendFittingMapper.listSendFitting(sendFitting);
|
|
|
+ fitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ fitting.setClosedFittingType(4);
|
|
|
+ //查询寄回配件集合
|
|
|
+ closedfittings = closedFittingMapper.listClosedFitting(fitting);
|
|
|
+ closedProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ closedProdcue.setClosedProdcueType(4);
|
|
|
+ //查询寄回产品集合
|
|
|
+ closedProdcues = closedProdcueMapper.listclosedProdcue(closedProdcue);
|
|
|
+ break;
|
|
|
+ case 5://补发
|
|
|
+ sendProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ sendProdcue.setSendProduceType(5);
|
|
|
+ //查询寄出产品集合
|
|
|
+ sendProdcues = sendProdcueMapper.listSendProdcue(sendProdcue);
|
|
|
+ sendFitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ sendFitting.setSendFittingType(5);
|
|
|
+ //查询寄出配件集合
|
|
|
+ sendFittings = sendFittingMapper.listSendFitting(sendFitting);
|
|
|
+ break;
|
|
|
+ case 6://退货
|
|
|
+ fitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ fitting.setClosedFittingType(6);
|
|
|
+ //查询寄回配件集合
|
|
|
+ closedfittings = closedFittingMapper.listClosedFitting(fitting);
|
|
|
+ closedProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ closedProdcue.setClosedProdcueType(6);
|
|
|
+ //查询寄回产品集合
|
|
|
+ closedProdcues = closedProdcueMapper.listclosedProdcue(closedProdcue);
|
|
|
+ break;
|
|
|
+ case 7://无理由退货
|
|
|
+ fitting.setRelationId(customerCommon.getRelationId());
|
|
|
+ fitting.setClosedFittingType(7);
|
|
|
+ //查询寄回配件集合
|
|
|
+ closedfittings = closedFittingMapper.listClosedFitting(fitting);
|
|
|
+ closedProdcue.setRelationId(customerCommon.getRelationId());
|
|
|
+ closedProdcue.setClosedProdcueType(7);
|
|
|
+ //查询寄回产品集合
|
|
|
+ closedProdcues = closedProdcueMapper.listclosedProdcue(closedProdcue);
|
|
|
break;
|
|
|
}
|
|
|
+ customerCommon.setClosedFittings(closedfittings);
|
|
|
+ customerCommon.setClosedProdcues(closedProdcues);
|
|
|
+ customerCommon.setSendProdcues(sendProdcues);
|
|
|
+ customerCommon.setSendFittings(sendFittings);
|
|
|
return customerCommon;
|
|
|
}
|
|
|
|