|
@@ -7,10 +7,7 @@ import com.iamberry.rst.core.fm.ComplaintDetectInfo;
|
|
|
import com.iamberry.rst.core.fm.ComplaintSignclosedInfo;
|
|
|
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.cm.*;
|
|
|
import com.iamberry.rst.faces.order.EfastOrderService;
|
|
|
import com.iamberry.rst.service.address.mapper.AddressMapper;
|
|
|
import com.iamberry.rst.service.cm.mapper.*;
|
|
@@ -150,88 +147,68 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
throw new RuntimeException("添加客诉-订单为空-请重新添加订单");
|
|
|
}
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-添加订单 --------------");
|
|
|
+ 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
|
|
|
- cmRelation.setRelationIsTransfer(0); //是否已转账邮费
|
|
|
- cmRelation.setRelationBackPostage(0); //邮费默认为0
|
|
|
- cmRelation.setRelationBackName(cmRelation.getRelationSendName()); //姓名
|
|
|
- cmRelation.setRelationBackTel(cmRelation.getRelationSendTel()); //电话号码
|
|
|
+ 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
|
|
|
+ cmRelation.setRelationIsTransfer(0); //是否已转账邮费
|
|
|
+ cmRelation.setRelationBackPostage(0); //邮费默认为0
|
|
|
+ cmRelation.setRelationBackName(cmRelation.getRelationSendName()); //姓名
|
|
|
+ cmRelation.setRelationBackTel(cmRelation.getRelationSendTel()); //电话号码
|
|
|
|
|
|
/* 初始化产品类型,名称,配件名称 */
|
|
|
- customerService.setName(cmRelation);
|
|
|
- logger.info("-----------添加客诉-初始化产品,配件信息--------------");
|
|
|
-
|
|
|
- ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo(); //品质检测
|
|
|
- ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo(); //客诉-签收表
|
|
|
-
|
|
|
- /* 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订单失败");
|
|
|
- }
|
|
|
- complaintSignclosedInfo.setOldEfastId(salesOrder.getSalesOrderId()); //原有订单的Efast的订单编号
|
|
|
- customerService.saveComplaintSignclosedInfo(complaintSignclosedInfo,customerCommon);//创建仓储任务
|
|
|
- complaintDetectInfo.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储签收id
|
|
|
- customerService.saveComplaintDetectInfo(complaintDetectInfo,customerCommon); //创建品检*/
|
|
|
-
|
|
|
- logger.info("-----------添加客诉-创建仓储/品检成功--------------");
|
|
|
-
|
|
|
- cmRelation.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
|
|
|
+ customerService.setName(cmRelation);
|
|
|
+ logger.info("-----------添加客诉-初始化产品,配件信息--------------");
|
|
|
|
|
|
/*添加处理方式*/
|
|
|
- flag = cmRelationMapper.save(cmRelation);
|
|
|
- if (flag < 1) {
|
|
|
- throw new RuntimeException("添加客诉处理结果失败");
|
|
|
- }
|
|
|
- logger.info("-----------添加客诉-添加客诉处理成功--------------");
|
|
|
+ flag = cmRelationMapper.save(cmRelation);
|
|
|
+ if (flag < 1) {
|
|
|
+ throw new RuntimeException("添加客诉处理结果失败");
|
|
|
+ }
|
|
|
+ logger.info("-----------添加客诉-添加客诉处理成功--------------");
|
|
|
|
|
|
/*添加客诉-添加处理与订单关联表*/
|
|
|
- List<RelationOrder> relationOrderList = new ArrayList<>();
|
|
|
- for (SalesOrder sor : orderList) {
|
|
|
- RelationOrder ro = new RelationOrder();
|
|
|
- ro.setRelationId(cmRelation.getRelationId());
|
|
|
- ro.setSalesId(sor.getSalesId());
|
|
|
- ro.setRelationCustomerId(customerInfo.getCustomerId());
|
|
|
- relationOrderList.add(ro);
|
|
|
- }
|
|
|
- if(relationOrderList != null && relationOrderList.size() > 0){
|
|
|
- flag = relationOrderService.saveList(relationOrderList);
|
|
|
- if(flag < 1){
|
|
|
- throw new RuntimeException("添加客诉,关联订单失败");
|
|
|
- }
|
|
|
- }
|
|
|
- logger.info("-----------添加客诉-添加处理与订单关联表--------------");
|
|
|
-
|
|
|
- for (SalesOrder sor : orderList) {
|
|
|
- SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
|
|
|
- newOrder.setSalesId(sor.getSalesId());
|
|
|
- newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
|
|
|
- flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
- if(flag < 1){
|
|
|
- throw new RuntimeException("添加客诉,修改订单失败");
|
|
|
- }
|
|
|
- }
|
|
|
- logger.info("-----------添加客诉-修改订单--------------");
|
|
|
- CustomerCommonUtil.setProduceOrFitting(cmRelation);
|
|
|
- if(cmRelation.getClosedProdcues() != null && cmRelation.getClosedProdcues().size()>0){
|
|
|
- closedProdcueMapper.insert(cmRelation.getClosedProdcues());
|
|
|
+ List<RelationOrder> relationOrderList = new ArrayList<>();
|
|
|
+ for (SalesOrder sor : orderList) {
|
|
|
+ RelationOrder ro = new RelationOrder();
|
|
|
+ ro.setRelationId(cmRelation.getRelationId());
|
|
|
+ ro.setSalesId(sor.getSalesId());
|
|
|
+ ro.setRelationCustomerId(customerInfo.getCustomerId());
|
|
|
+ relationOrderList.add(ro);
|
|
|
+ }
|
|
|
+ if(relationOrderList != null && relationOrderList.size() > 0){
|
|
|
+ flag = relationOrderService.saveList(relationOrderList);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("添加客诉,关联订单失败");
|
|
|
}
|
|
|
- if(cmRelation.getSendProdcues() != null && cmRelation.getSendProdcues().size() > 0){
|
|
|
- sendProdcueMapper.insert(cmRelation.getSendProdcues());
|
|
|
+ }
|
|
|
+ logger.info("-----------添加客诉-添加处理与订单关联表--------------");
|
|
|
+
|
|
|
+ for (SalesOrder sor : orderList) {
|
|
|
+ SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
|
|
|
+ newOrder.setSalesId(sor.getSalesId());
|
|
|
+ newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
|
|
|
+ flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("添加客诉,修改订单失败");
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
|
|
|
}
|
|
|
+ logger.info("-----------添加客诉-修改订单--------------");
|
|
|
+ CustomerCommonUtil.setProduce(cmRelation);
|
|
|
+ if(cmRelation.getClosedProdcues() != null && cmRelation.getClosedProdcues().size()>0){
|
|
|
+ closedProdcueMapper.insert(cmRelation.getClosedProdcues());
|
|
|
+ }
|
|
|
+ if(cmRelation.getSendProdcues() != null && cmRelation.getSendProdcues().size() > 0){
|
|
|
+ sendProdcueMapper.insert(cmRelation.getSendProdcues());
|
|
|
+ }
|
|
|
+ logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
|
|
|
+
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
@@ -240,23 +217,19 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
@Transactional
|
|
|
public Integer updateCustomerInfo(CustomerInfo customerInfo,SalesOrder salesOrder){
|
|
|
Integer isNeedSelectOrder = customerInfo.getIsNeedSelectOrder();
|
|
|
- //查询旧的客诉类型信息
|
|
|
- CustomerCommon cc = customerInfo.getCustomerCommon();
|
|
|
- cc.setCustomerId(customerInfo.getCustomerId());
|
|
|
- List<CustomerCommon> ccList = customerCommonService.listCustomerCommon(cc);
|
|
|
- /*if(ccList.size() > 0){
|
|
|
- cc = ccList.get(0);
|
|
|
- }*/
|
|
|
+ //当前处理信息
|
|
|
+ CmRelation cr = cmRelationMapper.getCmRelationByCustomerId(customerInfo.getCustomerId());
|
|
|
+
|
|
|
//删除旧的售后数据
|
|
|
- customerService.deleteCustomerAfterSales(customerInfo);
|
|
|
+ customerService.deleteCustomerAfterSales(customerInfo,cr);
|
|
|
|
|
|
- List<SalesOrder> orderList = new ArrayList<>();
|
|
|
+ List<SalesOrder> orderList = new ArrayList<SalesOrder>();
|
|
|
|
|
|
//修改客诉基本信息
|
|
|
Integer flag = 0;
|
|
|
flag = customerInfoMapper.updateCustomerInfo(customerInfo);
|
|
|
if(flag < 1){
|
|
|
- throw new RuntimeException("修改客诉失败");
|
|
|
+ throw new RuntimeException("修改客诉失败-修改客诉基本信息失败");
|
|
|
}
|
|
|
logger.info("-----------修改客诉-修改客诉基本信息---------------");
|
|
|
|
|
@@ -266,8 +239,12 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
questionDescribe.setDescribeTitle(customerInfo.getDescribeTitle()); //客诉问题标题
|
|
|
questionDescribe.setDescribeContent(customerInfo.getDescribeContent()); //客诉问题描述
|
|
|
questionDescribe.setDescribeHandleDesc(customerInfo.getDescribeHandleDesc()); //处理描述
|
|
|
- questionDescribeMapper.updateByPrimaryKeySelective(questionDescribe);
|
|
|
+ flag = questionDescribeMapper.updateByPrimaryKeySelective(questionDescribe);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("修改客诉失败-修改客诉问题信息失败");
|
|
|
+ }
|
|
|
logger.info("-----------修改客诉-修改客诉问题---------------");
|
|
|
+
|
|
|
if ("2".equals(customerInfo.getCustomerIsVisit())) {
|
|
|
Visit visit = new Visit();
|
|
|
visit.setCustomerId(customerInfo.getCustomerId());
|
|
@@ -280,202 +257,98 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
visit.setVisitStatus(1); //回访状态
|
|
|
flag = visitMapper.addVisitInfo(visit);
|
|
|
if(flag < 1){
|
|
|
- throw new RuntimeException("修改客诉回访失败");
|
|
|
+ throw new RuntimeException("修改客诉失败-修改客诉回访失败");
|
|
|
}
|
|
|
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());
|
|
|
+ CmRelation cmRelation = customerInfo.getCmRelation();
|
|
|
+ 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){
|
|
|
+ throw new RuntimeException("添加客诉-订单为空-请重新添加订单");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("添加客诉-订单查询出错-请重新添加订单");
|
|
|
}
|
|
|
}
|
|
|
+ logger.info("-----------添加客诉-添加订单 --------------");
|
|
|
+ }
|
|
|
+ cmRelation.setRelationId(cr.getRelationId());
|
|
|
+ cmRelation.setRelationDesc(cr.getRelationDesc());//备注
|
|
|
+ if (procMethod.getProcMethodIsBack()==2) {
|
|
|
+ cmRelation.setRelationBackStatus(1); //寄回状态 1:未寄回
|
|
|
+ cmRelation.setRelationIsTransfer(0); //是否已转账邮费
|
|
|
+ cmRelation.setRelationBackPostage(0); //邮费
|
|
|
+ cmRelation.setRelationBackLogisticsCompany("");//寄回物流公司
|
|
|
+ cmRelation.setRelationBackLogisticsNo("");//寄回物流单号
|
|
|
+ cmRelation.setRelationAlipay("");//转账账户
|
|
|
+ cmRelation.setRelationAlipayName("");//转账账户 (账户姓名)
|
|
|
+ }
|
|
|
+ if (procMethod.getProcMethodIsSend()==2) {
|
|
|
+ cmRelation.setRelationSendStatus(1); //寄送状态 1:未寄送
|
|
|
+ cmRelation.setRelationSendLogisticsCompany("");//寄送物流公司
|
|
|
+ cmRelation.setRelationSendLogisticsNo("");//寄送物流单号
|
|
|
+ }
|
|
|
+ /* 初始化产品类型,名称,配件名称 */
|
|
|
+ customerService.setName(cmRelation);
|
|
|
+ logger.info("-----------修改客诉-初始化产品,配件信息--------------");
|
|
|
|
|
|
- CustomerCommon customerCommon = customerInfo.getCustomerCommon();
|
|
|
- if(ccList.size() > 0){
|
|
|
- cc = ccList.get(0);
|
|
|
- customerCommon.setRelationBackStatus(cc.getRelationBackStatus() == null ? 1:cc.getRelationBackStatus()); //寄回状态 1:未寄回
|
|
|
- customerCommon.setRelationSendStatus(cc.getRelationSendStatus() == null ? 1:cc.getRelationSendStatus()); //寄送状态 1:未寄送
|
|
|
- customerCommon.setRelationIsTransfer(cc.getRelationIsTransfer() == null ? 0:cc.getRelationIsTransfer()); //是否已转账邮费
|
|
|
- customerCommon.setRelationBackPostage(cc.getRelationBackPostage() == null ? 0:cc.getRelationBackPostage()); //邮费
|
|
|
- //旧的物流公司物流单号支付宝信息 邮费状态 efast订单号
|
|
|
- customerCommon.setRelationBackLogisticsCompany(cc.getRelationBackLogisticsCompany());//寄回物流公司
|
|
|
- customerCommon.setRelationBackLogisticsNo(cc.getRelationBackLogisticsNo());//寄回物流单号
|
|
|
- customerCommon.setRelationAlipay(cc.getRelationAlipay());//转账账户
|
|
|
- customerCommon.setRelationAlipayName(cc.getRelationAlipayName());//转账账户 (账户姓名)
|
|
|
- customerCommon.setRelationDesc(cc.getRelationDesc());//备注
|
|
|
- customerCommon.setRelationSendLogisticsCompany(cc.getRelationSendLogisticsCompany());//寄送物流公司
|
|
|
- customerCommon.setRelationSendLogisticsNo(cc.getRelationSendLogisticsNo());//寄送物流单号
|
|
|
- customerCommon.setSalesOrderId(cc.getSalesOrderId());//efast订单号
|
|
|
- }else{
|
|
|
- customerCommon.setRelationBackStatus(1); //寄回状态 1:未寄回
|
|
|
- customerCommon.setRelationSendStatus(1); //寄送状态 1:未寄送
|
|
|
- customerCommon.setRelationIsTransfer(0); //是否已转账邮费 0:不需要
|
|
|
- customerCommon.setRelationBackPostage(0); //邮费默认为0
|
|
|
- }
|
|
|
- customerCommon.setCustomerId(customerInfo.getCustomerId()); //设置客诉id
|
|
|
- customerCommon.setRelationState(1); //状态 默认使用中 //新
|
|
|
- if(isNeedSelectOrder == 1){
|
|
|
- customerCommon.setOrderId(salesOrder.getSalesId()); //订单id //新
|
|
|
- }
|
|
|
- customerCommon.setTransactionNumber(customerInfo.getTransactionNumber()); //外部交易号
|
|
|
- customerCommon.setIsNeedSelectOrder(isNeedSelectOrder); //是否需要添加订单
|
|
|
- customerCommon.setRelationBackName(customerCommon.getRelationSendName()); //姓名//新
|
|
|
- customerCommon.setRelationBackTel(customerCommon.getRelationSendTel()); //电话号码//新
|
|
|
-
|
|
|
- /* 初始化产品类型,名称,配件名称 */
|
|
|
- customerService.setName(customerCommon);
|
|
|
- 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;
|
|
|
- }
|
|
|
- logger.info("-----------修改客诉-创建仓储/品检成功--------------");
|
|
|
- customerCommon.setSignclosedId(complaintSignclosedInfo.getSignclosedId()); //设置仓储id
|
|
|
-
|
|
|
- Object object = CustomerCommonUtil.getRelation(customerInfo.getCustomerIsSolve(), customerCommon);
|
|
|
- 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;
|
|
|
-// }
|
|
|
- if (flag < 1) {
|
|
|
- throw new RuntimeException("添加客诉处理结果失败");
|
|
|
- }
|
|
|
- logger.info("-----------修改客诉-添加换新/维修/补发/退货/无理由退货信息成功--------------");
|
|
|
-
|
|
|
- /*添加客诉-添加处理与订单关联表*/
|
|
|
- List<RelationOrder> relationOrderList = new ArrayList<>();
|
|
|
- for (SalesOrder sor : orderList) {
|
|
|
- RelationOrder ro = new RelationOrder();
|
|
|
- ro.setRelationType(customerInfo.getCustomerIsSolve());
|
|
|
- ro.setRelationId(relationId);
|
|
|
- ro.setSalesId(sor.getSalesId());
|
|
|
- ro.setRelationCustomerId(customerInfo.getCustomerId());
|
|
|
- relationOrderList.add(ro);
|
|
|
- }
|
|
|
- if(relationOrderList != null && relationOrderList.size() > 0){
|
|
|
- flag = relationOrderService.saveList(relationOrderList);
|
|
|
- if(flag < 1){
|
|
|
- throw new RuntimeException("添加客诉,关联订单失败");
|
|
|
- }
|
|
|
- }
|
|
|
+ ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo(); //品质检测
|
|
|
+ ComplaintSignclosedInfo complaintSignclosedInfo = new ComplaintSignclosedInfo(); //客诉-签收表
|
|
|
+ Map<String,Object> map;
|
|
|
+ boolean isReturn = false;
|
|
|
+ logger.info("-----------修改客诉-创建仓储/品检成功--------------");
|
|
|
|
|
|
- for (SalesOrder sor : orderList) {
|
|
|
- SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
|
|
|
- newOrder.setSalesId(sor.getSalesId());
|
|
|
- newOrder.setSalesOrderStatus(orderStatus);
|
|
|
- flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
- if(flag < 1){
|
|
|
- throw new RuntimeException("添加客诉,修改订单状态失败");
|
|
|
- }
|
|
|
+ flag = cmRelationMapper.update(cmRelation);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("修改客诉-修改处理信息失败");
|
|
|
+ }
|
|
|
+ logger.info("-----------修改客诉-修改处理信息失败--------------");
|
|
|
+
|
|
|
+ /*添加客诉-添加处理与订单关联表*/
|
|
|
+ List<RelationOrder> relationOrderList = new ArrayList<>();
|
|
|
+ for (SalesOrder sor : orderList) {
|
|
|
+ RelationOrder ro = new RelationOrder();
|
|
|
+ ro.setRelationId(cmRelation.getRelationId());
|
|
|
+ ro.setSalesId(sor.getSalesId());
|
|
|
+ ro.setRelationCustomerId(customerInfo.getCustomerId());
|
|
|
+ relationOrderList.add(ro);
|
|
|
+ }
|
|
|
+ if(relationOrderList != null && relationOrderList.size() > 0){
|
|
|
+ flag = relationOrderService.saveList(relationOrderList);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("添加客诉,关联订单失败");
|
|
|
}
|
|
|
- logger.info("-----------添加客诉-添加处理与订单关联表--------------");
|
|
|
+ }
|
|
|
|
|
|
- customerCommon.setRelationId(relationId);
|
|
|
- if(customerCommon.getIsNeedSelectOrder() == 1){
|
|
|
- CustomerCommonUtil.setProduceOrFitting(customerInfo.getCustomerIsSolve(),customerCommon);
|
|
|
- if(customerCommon.getClosedProdcues() != null && customerCommon.getClosedProdcues().size() > 0){
|
|
|
- closedProdcueMapper.insert(customerCommon.getClosedProdcues());
|
|
|
- }
|
|
|
- if(customerCommon.getSendProdcues() != null && customerCommon.getSendProdcues().size() > 0){
|
|
|
- sendProdcueMapper.insert(customerCommon.getSendProdcues());
|
|
|
- }
|
|
|
- logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
|
|
|
+ for (SalesOrder sor : orderList) {
|
|
|
+ SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
|
|
|
+ newOrder.setSalesId(sor.getSalesId());
|
|
|
+ newOrder.setSalesOrderStatus(procMethod.getProcTypeId());
|
|
|
+ flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("添加客诉,修改订单状态失败");
|
|
|
}
|
|
|
}
|
|
|
+ logger.info("-----------添加客诉-添加处理与订单关联表--------------");
|
|
|
+
|
|
|
+ logger.info("-----------添加客诉-修改订单--------------");
|
|
|
+ CustomerCommonUtil.setProduce(cmRelation);
|
|
|
+ if(cmRelation.getClosedProdcues() != null && cmRelation.getClosedProdcues().size()>0){
|
|
|
+ closedProdcueMapper.insert(cmRelation.getClosedProdcues());
|
|
|
+ }
|
|
|
+ if(cmRelation.getSendProdcues() != null && cmRelation.getSendProdcues().size() > 0){
|
|
|
+ sendProdcueMapper.insert(cmRelation.getSendProdcues());
|
|
|
+ }
|
|
|
+ logger.info("-----------添加客诉-寄回寄出产品配件成功--------------");
|
|
|
+
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
@@ -485,158 +358,45 @@ public class CustomerServiceImpl implements CustomerService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void deleteCustomerAfterSales(CustomerInfo customer){
|
|
|
+ public void deleteCustomerAfterSales(CustomerInfo customer,CmRelation cmRelation){
|
|
|
+ Integer flag = 0;
|
|
|
CustomerInfo customerInfo = customerInfoMapper.getCustomerInfo(customer.getCustomerId());
|
|
|
+
|
|
|
//删除回访信息
|
|
|
if ("2".equals(customerInfo.getCustomerIsVisit())){
|
|
|
- visitMapper.deleteByPrimaryKey(customer.getCustomerId());
|
|
|
+ flag = visitMapper.deleteByPrimaryKey(customer.getCustomerId());
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("修改客诉-删除回访,删除回访失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //查询旧客诉类型,判断是否修改了客诉类型
|
|
|
- Integer oldIsSolve = customerInfo.getCustomerIsSolve();// //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
+ //删除寄出寄回产品
|
|
|
ClosedProdcue closedrecord = new ClosedProdcue();
|
|
|
- ClosedFitting closedRecord = new ClosedFitting();
|
|
|
SendProdcue sendProdcue = new SendProdcue();
|
|
|
- SendFitting sendFitting = new SendFitting();
|
|
|
- CustomerCommon customerCommon = customerInfo.getCustomerCommon();
|
|
|
- SalesOrder salesOrder = new SalesOrder();
|
|
|
- if(oldIsSolve > 2){
|
|
|
- customerCommon = customerInfo.getCustomerCommon();
|
|
|
- customerCommon.setCustomerId(customerInfo.getCustomerId()); //设置客诉id
|
|
|
- customerCommon.setRelationBackStatus(1); //寄回状态 1:未寄回
|
|
|
- customerCommon.setRelationSendStatus(1); //寄送状态 1:未寄送
|
|
|
- customerCommon.setRelationState(1); //状态 默认使用中
|
|
|
- customerCommon.setTransactionNumber(customerInfo.getTransactionNumber()); //外部交易号
|
|
|
- customerCommon.setRelationIsTransfer(0); //是否已转账邮费 0:不需要
|
|
|
- customerCommon.setRelationBackPostage(0); //邮费默认为0
|
|
|
- customerCommon.setRelationBackName(customerCommon.getRelationSendName()); //姓名
|
|
|
- customerCommon.setRelationBackTel(customerCommon.getRelationSendTel()); //电话号码
|
|
|
- /* 初始化产品类型,名称,配件名称 */
|
|
|
- /*customerService.setName(customerCommon);*/
|
|
|
- }
|
|
|
- Integer relationId = 0;
|
|
|
-// switch (oldIsSolve){
|
|
|
-// case 3:
|
|
|
-// //删除换新数据
|
|
|
-// Renewed renewed = new Renewed();
|
|
|
-// renewed.setCustomerId(customer.getCustomerId());
|
|
|
-// //查询换新数据id
|
|
|
-// renewed = renewedMapper.getRenewedInfo(renewed);
|
|
|
-// relationId = renewed.getRenewedId();
|
|
|
-// if(customer.getCustomerIsSolve() < 3){ //从维修换货补发修改为已解决或未解决时,原订单生成退单
|
|
|
-// //salesOrder = salesOrderMapper.getSalesOrderById(renewed.getOrderId()); //salesOrder.getSalesId() 全场最佳,就你戏多
|
|
|
-// //customerCommon.setOrderId(renewed.getOrderId()); //订单id
|
|
|
-// SendProdcue record = new SendProdcue();
|
|
|
-// record.setRelationId(renewed.getRenewedId());
|
|
|
-// customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(record));
|
|
|
-// customerService.setName(customerCommon);
|
|
|
-// //customerService.chargebackEfastOrder(customerCommon,salesOrder,8,2);
|
|
|
-// }
|
|
|
-// //删除寄出寄回产品
|
|
|
-// closedRecord.setRelationId(renewed.getRenewedId());
|
|
|
-// closedFittingMapper.deleteByPrimaryKey(closedRecord);
|
|
|
-// closedrecord.setRelationId(renewed.getRenewedId());
|
|
|
-// closedProdcueMapper.deleteByPrimaryKey(closedrecord);
|
|
|
-// sendProdcue.setRelationId(renewed.getRenewedId());
|
|
|
-// sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
|
|
|
-// sendFitting.setRelationId(renewed.getRenewedId());
|
|
|
-// sendFittingMapper.deleteByPrimaryKey(sendFitting);
|
|
|
-// renewedMapper.deleteByPrimaryKey(renewed);
|
|
|
-// break;
|
|
|
-// case 4:
|
|
|
-// //删除维修数据
|
|
|
-// Repair repair = new Repair();
|
|
|
-// repair.setCustomerId(customer.getCustomerId());
|
|
|
-// //查询维修数据id
|
|
|
-// repair = repairMapper.getRepairInfo(repair);
|
|
|
-// relationId = repair.getRepairId();
|
|
|
-// if(customer.getCustomerIsSolve() < 3) { //从维修换货补发修改为已解决或未解决时,原订单生成退单
|
|
|
-// //salesOrder = salesOrderMapper.getSalesOrderById(repair.getOrderId());
|
|
|
-// //customerCommon.setOrderId(repair.getOrderId()); //订单id
|
|
|
-// SendProdcue record = new SendProdcue();
|
|
|
-// record.setRelationId(repair.getRepairId());
|
|
|
-// customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(record));
|
|
|
-// customerService.setName(customerCommon);
|
|
|
-// //customerService.chargebackEfastOrder(customerCommon, salesOrder, 8,2); //从维修换货补发修改为已解决或未解决时,原订单生成退单
|
|
|
-// }
|
|
|
-// //删除寄出寄回产品
|
|
|
-// closedRecord.setRelationId(repair.getRepairId());
|
|
|
-// closedFittingMapper.deleteByPrimaryKey(closedRecord);
|
|
|
-// closedrecord.setRelationId(repair.getRepairId());
|
|
|
-// closedProdcueMapper.deleteByPrimaryKey(closedrecord);
|
|
|
-// sendProdcue.setRelationId(repair.getRepairId());
|
|
|
-// sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
|
|
|
-// sendFitting.setRelationId(repair.getRepairId());
|
|
|
-// sendFittingMapper.deleteByPrimaryKey(sendFitting);
|
|
|
-// repairMapper.deleteByPrimaryKey(repair);
|
|
|
-// break;
|
|
|
-// case 5:
|
|
|
-// //删除补发数据
|
|
|
-// Reissue reissue = new Reissue();
|
|
|
-// reissue.setCustomerId(customer.getCustomerId());
|
|
|
-// //查询补发数据id
|
|
|
-// reissue = reissueMapper.getReissue(reissue);
|
|
|
-// relationId = reissue.getReissueId();
|
|
|
-// if(customer.getCustomerIsSolve() < 3) { //从维修换货补发修改为已解决或未解决时,原订单生成退单
|
|
|
-// //salesOrder = salesOrderMapper.getSalesOrderById(reissue.getOrderId());
|
|
|
-// //customerCommon.setOrderId(reissue.getOrderId()); //订单id
|
|
|
-// SendProdcue record = new SendProdcue();
|
|
|
-// record.setRelationId(reissue.getReissueId());
|
|
|
-// customerCommon.setSendProdcues(sendProdcueMapper.listSendProdcue(record));
|
|
|
-// customerService.setName(customerCommon);
|
|
|
-// //customerService.chargebackEfastOrder(customerCommon, salesOrder, 8,2); //从维修换货补发修改为已解决或未解决时,原订单生成退单
|
|
|
-// }
|
|
|
-// //删除寄出产品
|
|
|
-// sendProdcue.setRelationId(reissue.getReissueId());
|
|
|
-// sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
|
|
|
-// sendFitting.setRelationId(reissue.getReissueId());
|
|
|
-// sendFittingMapper.deleteByPrimaryKey(sendFitting);
|
|
|
-// reissueMapper.deleteByPrimaryKey(reissue);
|
|
|
-// break;
|
|
|
-// case 6:
|
|
|
-// //删除退货数据
|
|
|
-// BackGoods backGoods = new BackGoods();
|
|
|
-// backGoods.setCustomerId(customer.getCustomerId());
|
|
|
-// //查询维修数据id
|
|
|
-// backGoods = backGoodsMapper.getBackGoods(backGoods);
|
|
|
-// relationId = backGoods.getBackGoodsId();
|
|
|
-// //删除寄出寄回产品
|
|
|
-// closedRecord.setRelationId(backGoods.getBackGoodsId());
|
|
|
-// closedFittingMapper.deleteByPrimaryKey(closedRecord);
|
|
|
-// closedrecord.setRelationId(backGoods.getBackGoodsId());
|
|
|
-// closedProdcueMapper.deleteByPrimaryKey(closedrecord);
|
|
|
-// backGoodsMapper.deleteByPrimaryKey(backGoods);
|
|
|
-// break;
|
|
|
-// case 7:
|
|
|
-// //删除无理由退货数据
|
|
|
-// NoreasonBack noreasonBack = new NoreasonBack();
|
|
|
-// noreasonBack.setCustomerId(customer.getCustomerId());
|
|
|
-// //查询维修数据id
|
|
|
-// noreasonBack = noreasonBackMapper.getNoreasonBack(noreasonBack);
|
|
|
-// relationId = noreasonBack.getNoreasonBackId();
|
|
|
-// //删除寄出寄回产品
|
|
|
-// closedRecord.setRelationId(noreasonBack.getNoreasonBackId());
|
|
|
-// closedFittingMapper.deleteByPrimaryKey(closedRecord);
|
|
|
-// closedrecord.setRelationId(noreasonBack.getNoreasonBackId());
|
|
|
-// closedProdcueMapper.deleteByPrimaryKey(closedrecord);
|
|
|
-// noreasonBackMapper.deleteByPrimaryKey(noreasonBack);
|
|
|
-// break;
|
|
|
-// }
|
|
|
+ closedrecord.setRelationId(cmRelation.getRelationId());
|
|
|
+ closedProdcueMapper.deleteByPrimaryKey(closedrecord);
|
|
|
+ sendProdcue.setRelationId(cmRelation.getRelationId());
|
|
|
+ sendProdcueMapper.deleteByPrimaryKey(sendProdcue);
|
|
|
|
|
|
/*恢复订单状态*/
|
|
|
RelationOrder relationOrder = new RelationOrder();
|
|
|
- relationOrder.setRelationType(oldIsSolve);
|
|
|
- relationOrder.setRelationId(relationId);
|
|
|
+ relationOrder.setRelationId(cmRelation.getRelationId());
|
|
|
List<RelationOrder> relationOrderList = relationOrderService.getRelationOrderList(relationOrder);
|
|
|
for (int k=0; k<relationOrderList.size();k++){
|
|
|
SalesOrder newOrder = new SalesOrder(); //salesOrderStatus
|
|
|
newOrder.setSalesId(relationOrderList.get(k).getSalesId());
|
|
|
newOrder.setSalesOrderStatus(1); //恢复订单到之前的状态
|
|
|
- Integer flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
+ flag = salesOrderMapper.updateSalesOrder(newOrder);
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("修改客诉-恢复订单状态,恢复订单状态失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* 删除掉订单与处理的关联表 */
|
|
|
- relationOrderService.deleteByRelationId(relationId);
|
|
|
+ flag = relationOrderService.deleteByRelationId(cmRelation.getRelationId());
|
|
|
+ if(flag < 1){
|
|
|
+ throw new RuntimeException("修改客诉-恢复订单状态,恢复订单状态失败");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|