|
@@ -9,6 +9,7 @@ import com.iamberry.rst.core.order.*;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
import com.iamberry.rst.faces.cm.CustomerCommonService;
|
|
|
import com.iamberry.rst.faces.cm.CustomerService;
|
|
|
+import com.iamberry.rst.faces.cm.ProcMethodService;
|
|
|
import com.iamberry.rst.faces.cm.RelationOrderService;
|
|
|
import com.iamberry.rst.faces.order.EfastOrderService;
|
|
|
import com.iamberry.rst.service.address.mapper.AddressMapper;
|
|
@@ -81,6 +82,10 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
private CustomerCommonService customerCommonService;
|
|
|
@Autowired
|
|
|
private RelationOrderService relationOrderService;
|
|
|
+ @Autowired
|
|
|
+ private ProcMethodService procMethodService;
|
|
|
+ @Autowired
|
|
|
+ private CmRelationMapper cmRelationMapper;
|
|
|
|
|
|
@Override
|
|
|
public CustomerInfo getCustomerInfo(Integer customerId) {
|
|
@@ -130,156 +135,72 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
logger.info("-----------添加客诉-添加客诉回访信息---------------");
|
|
|
}
|
|
|
|
|
|
- if (2 == customerInfo.getCustomerCounselType() &&
|
|
|
- (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ||
|
|
|
- customerInfo.getCustomerIsSolve() == 6 || customerInfo.getCustomerIsSolve() == 7)
|
|
|
- ){
|
|
|
-
|
|
|
+ ProcMethod procMethod = procMethodService.getProcMethodById(customerInfo.getProcMethodId());
|
|
|
+ if (2 == customerInfo.getCustomerCounselType() && (procMethod.getProcMethodIsBack()==1||procMethod.getProcMethodIsSend()==1)){
|
|
|
if(isNeedSelectOrder == 1){
|
|
|
SalesOrder so = new SalesOrder();
|
|
|
if(salesOrder.getIds()!= null && salesOrder.getIds().indexOf("_") > -1){
|
|
|
String[] salesIds = salesOrder.getIds().split("_");
|
|
|
so.setSalesIds(salesIds);
|
|
|
orderList = salesOrderMapper.listSalesOrder(so);
|
|
|
- logger.info("-----------添加客诉-查询订单--------------");
|
|
|
if(orderList == null || orderList.size() < 1){
|
|
|
- logger.info("-----------添加客诉-订单为空-请重新添加订单 --------------");
|
|
|
throw new RuntimeException("添加客诉-订单为空-请重新添加订单");
|
|
|
}
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("添加客诉-订单为空-请重新添加订单");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- CustomerCommon customerCommon = customerInfo.getCustomerCommon();
|
|
|
- customerCommon.setCustomerId(customerInfo.getCustomerId());
|
|
|
- customerCommon.setRelationBackStatus(1);
|
|
|
- customerCommon.setRelationSendStatus(1);
|
|
|
- customerCommon.setRelationState(1);
|
|
|
- customerCommon.setTransactionNumber(customerInfo.getTransactionNumber());
|
|
|
-
|
|
|
+ logger.info("-----------添加客诉-添加订单 --------------");
|
|
|
+
|
|
|
+ CmRelation cmRelation = customerInfo.getCmRelation();
|
|
|
+ cmRelation.setCustomerId(customerInfo.getCustomerId());
|
|
|
+ cmRelation.setRelationBackStatus(1);
|
|
|
+ cmRelation.setRelationSendStatus(1);
|
|
|
+ cmRelation.setRelationState(1);
|
|
|
+
|
|
|
|
|
|
- customerCommon.setRelationIsTransfer(0);
|
|
|
- customerCommon.setRelationBackPostage(0);
|
|
|
+ cmRelation.setRelationIsTransfer(0);
|
|
|
+ cmRelation.setRelationBackPostage(0);
|
|
|
+ cmRelation.setRelationBackName(cmRelation.getRelationSendName());
|
|
|
+ cmRelation.setRelationBackTel(cmRelation.getRelationSendTel());
|
|
|
|
|
|
- customerCommon.setRelationBackName(customerCommon.getRelationSendName());
|
|
|
- customerCommon.setRelationBackTel(customerCommon.getRelationSendTel());
|
|
|
-
|
|
|
-
|
|
|
- customerService.setName(customerCommon);
|
|
|
+
|
|
|
+ customerService.setName(cmRelation);
|
|
|
logger.info("-----------添加客诉-初始化产品,配件信息--------------");
|
|
|
|
|
|
ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();
|
|
|
ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo();
|
|
|
- Map<String,Object> map;
|
|
|
- boolean isReturn = false;
|
|
|
- switch (customerInfo.getCustomerIsSolve()) {
|
|
|
- case 3:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
- case 4:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
- case 5:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
- case 6:
|
|
|
-
|
|
|
-
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
- case 7:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
+
|
|
|
+ customerService.chargebackEfastOrder(customerCommon,salesOrder,2);
|
|
|
+ map = customerService.sendEfastOrder(customerCommon,salesOrder);
|
|
|
+ if(map.get("status") == 1){
|
|
|
+ customerCommon.setRelationBackEfastOrderId(String.valueOf(map.get("EfastOrderId")));
|
|
|
+ complaintSignclosedInfo.setNewEfastId(String.valueOf(map.get("EfastOrderId")));
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("换新创建Efast订单失败");
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-创建仓储/品检成功--------------");
|
|
|
- customerCommon.setSignclosedId(complaintSignclosedInfo.getSignclosedId());
|
|
|
+ complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId());
|
|
|
+ customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);
|
|
|
+ complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId());
|
|
|
+ customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);
|
|
|
|
|
|
+ logger.info("-----------添加客诉-创建仓储/品检成功--------------");
|
|
|
|
|
|
-
|
|
|
- Object object = CustomerCommonUtil.getRelation(customerInfo.getCustomerIsSolve(), customerCommon);
|
|
|
+ cmRelation.setSignclosedId(complaintSignclosedInfo.getSignclosedId());
|
|
|
|
|
|
- Integer relationId = 0;
|
|
|
- Integer orderStatus = 1;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ flag = cmRelationMapper.save(cmRelation);
|
|
|
if (flag < 1) {
|
|
|
throw new RuntimeException("添加客诉处理结果失败");
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-添加换新/维修/补发/退货/无理由退货信息成功--------------");
|
|
|
+ logger.info("-----------添加客诉-添加客诉处理成功--------------");
|
|
|
|
|
|
|
|
|
List<RelationOrder> relationOrderList = new ArrayList<>();
|
|
|
for (SalesOrder sor : orderList) {
|
|
|
RelationOrder ro = new RelationOrder();
|
|
|
- ro.setRelationType(customerInfo.getCustomerIsSolve());
|
|
|
- ro.setRelationId(relationId);
|
|
|
+ ro.setRelationId(cmRelation.getRelationId());
|
|
|
ro.setSalesId(sor.getSalesId());
|
|
|
ro.setRelationCustomerId(customerInfo.getCustomerId());
|
|
|
relationOrderList.add(ro);
|
|
@@ -290,26 +211,24 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
throw new RuntimeException("添加客诉,关联订单失败");
|
|
|
}
|
|
|
}
|
|
|
+ logger.info("-----------添加客诉-添加处理与订单关联表--------------");
|
|
|
|
|
|
for (SalesOrder sor : orderList) {
|
|
|
SalesOrder newOrder = new SalesOrder();
|
|
|
newOrder.setSalesId(sor.getSalesId());
|
|
|
- newOrder.setSalesOrderStatus(orderStatus);
|
|
|
+ newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
|
|
|
flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
if(flag < 1){
|
|
|
throw new RuntimeException("添加客诉,修改订单失败");
|
|
|
}
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-添加处理与订单关联表--------------");
|
|
|
-
|
|
|
- customerCommon.setRelationId(relationId);
|
|
|
- CustomerCommonUtil.setProduceOrFitting(customerInfo.getCustomerIsSolve(),customerCommon);
|
|
|
-
|
|
|
- if(customerCommon.getClosedProdcues() != null && customerCommon.getClosedProdcues().size()>0){
|
|
|
- closedProdcueMapper.insert(customerCommon.getClosedProdcues());
|
|
|
+ logger.info("-----------添加客诉-修改订单--------------");
|
|
|
+ CustomerCommonUtil.setProduceOrFitting(cmRelation);
|
|
|
+ if(cmRelation.getClosedProdcues() != null && cmRelation.getClosedProdcues().size()>0){
|
|
|
+ closedProdcueMapper.insert(cmRelation.getClosedProdcues());
|
|
|
}
|
|
|
- if(customerCommon.getSendProdcues() != null && customerCommon.getSendProdcues().size() > 0){
|
|
|
- sendProdcueMapper.insert(customerCommon.getSendProdcues());
|
|
|
+ if(cmRelation.getSendProdcues() != null && cmRelation.getSendProdcues().size() > 0){
|
|
|
+ sendProdcueMapper.insert(cmRelation.getSendProdcues());
|
|
|
}
|
|
|
logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
|
|
|
}
|
|
@@ -821,53 +740,43 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
|
|
|
|
|
|
* 产品配件初始化
|
|
|
- * @param cc
|
|
|
+ * @param cr
|
|
|
*/
|
|
|
+ @Override
|
|
|
@Transactional
|
|
|
- public void setName(CustomerCommon cc){
|
|
|
- for (int i=0;i<cc.getSendProdcues().size();i++) {
|
|
|
- ProductColor productColor = productMapper.getProductBySku(cc.getSendProdcues().get(i).getColorBar());
|
|
|
- cc.getSendProdcues().get(i).setProductColor(productColor);
|
|
|
- cc.getSendProdcues().get(i).setColorId(productColor.getColorId());
|
|
|
-
|
|
|
+ public void setName(CmRelation cr) {
|
|
|
+ for (int i=0;i<cr.getSendProdcues().size();i++) {
|
|
|
+ ProductColor productColor = productMapper.getProductBySku(cr.getSendProdcues().get(i).getColorBar());
|
|
|
+ cr.getSendProdcues().get(i).setProductColor(productColor);
|
|
|
+ cr.getSendProdcues().get(i).setColorId(productColor.getColorId());
|
|
|
Product product = productMapper.getProduce(productColor.getColorProductId());
|
|
|
- cc.getSendProdcues().get(i).setProductId(product.getProductId());
|
|
|
- cc.getSendProdcues().get(i).setSendProduceName(product.getProductName());
|
|
|
- cc.getSendProdcues().get(i).setProductType(product.getProductType());
|
|
|
- cc.getSendProdcues().get(i).setProductNumber(product.getProductNumber());
|
|
|
- }
|
|
|
- for (int i=0;i<cc.getSendFittings().size();i++) {
|
|
|
- FittingsInfo fittingsInfo = productMapper.getFittingsBySku( cc.getSendFittings().get(i).getColorBar());
|
|
|
- cc.getSendFittings().get(i).setFittingsId(fittingsInfo.getFittingsId());
|
|
|
- cc.getSendFittings().get(i).setProductId(fittingsInfo.getFittingsId());
|
|
|
- cc.getSendFittings().get(i).setSendFittingsName(fittingsInfo.getFittingsName());
|
|
|
-
|
|
|
- Product product = productMapper.getProduce(fittingsInfo.getProductId());
|
|
|
- cc.getSendFittings().get(i).setSendFittingsName(product.getProductName());
|
|
|
+ cr.getSendProdcues().get(i).setProductId(product.getProductId());
|
|
|
+ cr.getSendProdcues().get(i).setSendProduceName(product.getProductName());
|
|
|
+ cr.getSendProdcues().get(i).setProductType(product.getProductType());
|
|
|
+ cr.getSendProdcues().get(i).setProductNumber(product.getProductNumber());
|
|
|
}
|
|
|
- for (int i=0;i<cc.getClosedProdcues().size();i++) {
|
|
|
- ProductColor productColor = productMapper.getProductBySku(cc.getClosedProdcues().get(i).getColorBar());
|
|
|
- cc.getClosedProdcues().get(i).setProductColor(productColor);
|
|
|
- cc.getClosedProdcues().get(i).setColorId(productColor.getColorId());
|
|
|
-
|
|
|
+ for (int i=0;i<cr.getClosedProdcues().size();i++) {
|
|
|
+ ProductColor productColor = productMapper.getProductBySku(cr.getClosedProdcues().get(i).getColorBar());
|
|
|
+ cr.getClosedProdcues().get(i).setProductColor(productColor);
|
|
|
+ cr.getClosedProdcues().get(i).setColorId(productColor.getColorId());
|
|
|
Product product = productMapper.getProduce(productColor.getColorProductId());
|
|
|
- cc.getClosedProdcues().get(i).setProductId(product.getProductId());
|
|
|
- cc.getClosedProdcues().get(i).setClosedProductName(product.getProductName());
|
|
|
- cc.getClosedProdcues().get(i).setProductType(product.getProductType());
|
|
|
- cc.getClosedProdcues().get(i).setProductNumber(product.getProductNumber());
|
|
|
- }
|
|
|
- for (int i=0;i<cc.getClosedFittings().size();i++) {
|
|
|
- FittingsInfo fittingsInfo = productMapper.getFittingsBySku(cc.getClosedFittings().get(i).getColorBar());
|
|
|
- cc.getClosedFittings().get(i).setFittingsId(fittingsInfo.getFittingsId());
|
|
|
- cc.getClosedFittings().get(i).setProductId(fittingsInfo.getProductId());
|
|
|
- cc.getClosedFittings().get(i).setClosedFittingsName(fittingsInfo.getFittingsName());
|
|
|
-
|
|
|
- Product product = productMapper.getProduce(fittingsInfo.getProductId());
|
|
|
- cc.getClosedFittings().get(i).setClosedProductName(product.getProductName());
|
|
|
+ cr.getClosedProdcues().get(i).setProductId(product.getProductId());
|
|
|
+ cr.getClosedProdcues().get(i).setClosedProductName(product.getProductName());
|
|
|
+ cr.getClosedProdcues().get(i).setProductType(product.getProductType());
|
|
|
+ cr.getClosedProdcues().get(i).setProductNumber(product.getProductNumber());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
+ * 产品配件初始化
|
|
|
+ * @param cc
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void setName(CustomerCommon cc){
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
* 添加品检
|
|
|
* @param complaintDetectInfo
|
|
|
* @param customerCommon
|