|
@@ -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()); //设置客诉id
|
|
|
- customerCommon.setRelationBackStatus(1); //寄回状态 1:未寄回
|
|
|
- customerCommon.setRelationSendStatus(1); //寄送状态 1:未寄送
|
|
|
- customerCommon.setRelationState(1); //状态 默认使用中
|
|
|
- customerCommon.setTransactionNumber(customerInfo.getTransactionNumber()); //外部交易号
|
|
|
-
|
|
|
+ logger.info("-----------添加客诉-添加订单 --------------");
|
|
|
+
|
|
|
+ CmRelation cmRelation = customerInfo.getCmRelation();
|
|
|
+ cmRelation.setCustomerId(customerInfo.getCustomerId());
|
|
|
+ cmRelation.setRelationBackStatus(1); //寄回状态 1:未寄回
|
|
|
+ cmRelation.setRelationSendStatus(1); //寄送状态 1:未寄送
|
|
|
+ cmRelation.setRelationState(1); //状态 默认使用中
|
|
|
+ //cmRelation.setTransactionNumber(customerInfo.getTransactionNumber()); //外部交易号
|
|
|
// TODO: 2018/3/27 是否转账邮费,默认为不需要转账 : 0
|
|
|
- customerCommon.setRelationIsTransfer(0); //是否已转账邮费
|
|
|
- customerCommon.setRelationBackPostage(0); //邮费默认为0
|
|
|
+ cmRelation.setRelationIsTransfer(0); //是否已转账邮费
|
|
|
+ cmRelation.setRelationBackPostage(0); //邮费默认为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()) { //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
- case 3: //换新
|
|
|
-// 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 RuntimeException("换新创建Efast订单失败");
|
|
|
-// }
|
|
|
- //complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- //customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
- //complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- //customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
- break;
|
|
|
- case 4: //维修
|
|
|
-// 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 RuntimeException("维修创建Efast订单失败");
|
|
|
-// }
|
|
|
- //complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- //customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
- //complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- //customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
- break;
|
|
|
- case 5: //补发 不用创建仓储签收任务
|
|
|
-// 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 RuntimeException("补发创建Efast订单失败");
|
|
|
-// }
|
|
|
- break;
|
|
|
- case 6: //退货
|
|
|
-
|
|
|
-// customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
|
|
|
- //complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- //customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
- //complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- //customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
- break;
|
|
|
- case 7: //无理由退货
|
|
|
-
|
|
|
-// customerService.chargebackEfastOrder(customerCommon,salesOrder,3); //原订单生成退单
|
|
|
-
|
|
|
- //complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- //customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
- //complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- //customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检
|
|
|
- break;
|
|
|
+ /* Map<String,Object> map;
|
|
|
+ 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 RuntimeException("换新创建Efast订单失败");
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-创建仓储/品检成功--------------");
|
|
|
- customerCommon.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
|
|
|
+ complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
+ customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
+ complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
+ customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检*/
|
|
|
|
|
|
+ logger.info("-----------添加客诉-创建仓储/品检成功--------------");
|
|
|
|
|
|
- /*将公共的对象 转换换新/维修/退款等*/
|
|
|
- Object object = CustomerCommonUtil.getRelation(customerInfo.getCustomerIsSolve(), customerCommon);
|
|
|
+ cmRelation.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
|
|
|
|
|
|
- Integer relationId = 0;
|
|
|
- Integer orderStatus = 1;
|
|
|
-// switch (customerInfo.getCustomerIsSolve()) { //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
-// case 3: //换新
|
|
|
-// Renewed renewed = (Renewed) object;
|
|
|
-// flag = renewedMapper.insert(renewed);
|
|
|
-// relationId = renewed.getRenewedId();
|
|
|
-// orderStatus = 2;
|
|
|
-// break;
|
|
|
-// case 4: //维修
|
|
|
-// Repair repair = (Repair) object;
|
|
|
-// flag = repairMapper.insert(repair);
|
|
|
-// relationId = repair.getRepairId();
|
|
|
-// orderStatus = 4;
|
|
|
-// break;
|
|
|
-// case 5: //补发
|
|
|
-// Reissue reissue = (Reissue) object;
|
|
|
-// flag = reissueMapper.insert(reissue);
|
|
|
-// relationId = reissue.getReissueId();
|
|
|
-// orderStatus = 5;
|
|
|
-// break;
|
|
|
-// case 6: //退货
|
|
|
-// BackGoods backGoods = (BackGoods) object;
|
|
|
-// flag = backGoodsMapper.insert(backGoods);
|
|
|
-// relationId = backGoods.getBackGoodsId();
|
|
|
-// orderStatus = 3;
|
|
|
-// break;
|
|
|
-// case 7: //无理由退货
|
|
|
-// NoreasonBack noreasonBack = (NoreasonBack) object;
|
|
|
-// flag = noreasonBackMapper.insert(noreasonBack);
|
|
|
-// relationId = noreasonBack.getNoreasonBackId();
|
|
|
-// orderStatus = 3;
|
|
|
-// break;
|
|
|
-// }
|
|
|
+ /*添加处理方式*/
|
|
|
+ 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(); //salesOrderStatus
|
|
|
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
|