|
@@ -1,7 +1,9 @@
|
|
|
package com.iamberry.rst.controllers.cm;
|
|
|
|
|
|
import com.iamberry.rst.core.cm.*;
|
|
|
-import com.iamberry.rst.core.order.*;
|
|
|
+import com.iamberry.rst.core.order.Product;
|
|
|
+import com.iamberry.rst.core.order.ProductColor;
|
|
|
+import com.iamberry.rst.core.order.ProductType;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
import com.iamberry.rst.core.sys.Admin;
|
|
|
import com.iamberry.rst.faces.cm.*;
|
|
@@ -9,7 +11,6 @@ import com.iamberry.rst.faces.order.EfastOrderService;
|
|
|
import com.iamberry.rst.faces.product.ProductService;
|
|
|
import com.iamberry.rst.faces.sms.SmsService;
|
|
|
import com.iamberry.rst.faces.sys.SysService;
|
|
|
-import com.iamberry.rst.service.cm.mapper.SalesOrderMapper;
|
|
|
import com.iamberry.rst.util.SmsConfig;
|
|
|
import com.iamberry.rst.utils.AdminUtils;
|
|
|
import com.iamberry.rst.utils.OrderNoUtil;
|
|
@@ -28,9 +29,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
+
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.MessageFormat;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Created by wxm
|
|
@@ -79,7 +84,6 @@ public class AdminCustomerController {
|
|
|
private SmsService smsService;
|
|
|
|
|
|
|
|
|
-
|
|
|
private Object lock = new Object();
|
|
|
|
|
|
|
|
@@ -162,17 +166,17 @@ public class AdminCustomerController {
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("customer:add:customer")
|
|
|
@RequestMapping(value = "/add_order_info")
|
|
|
- public ResponseJson addOrderInfo(HttpServletRequest request,SalesOrder salesOrder,String itemJson)throws Exception {
|
|
|
+ public ResponseJson addOrderInfo(HttpServletRequest request, SalesOrder salesOrder, String itemJson) throws Exception {
|
|
|
|
|
|
List<SalesOrderItem> list = new ArrayList<>();
|
|
|
JSONArray jsonArray = JSONArray.fromObject(itemJson);
|
|
|
list = (List) JSONArray.toCollection(jsonArray, SalesOrderItem.class);
|
|
|
|
|
|
- Integer salesAmount = 0;
|
|
|
+ Integer salesAmount = 0;
|
|
|
|
|
|
- for(int i=0;i<list.size();i++){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
SalesOrderItem salesOrderItem = list.get(i);
|
|
|
- if(salesOrderItem.getItemIsSource() == 1){ //产品来源 1:产品颜色表,2:配件表
|
|
|
+ if (salesOrderItem.getItemIsSource() == 1) { //产品来源 1:产品颜色表,2:配件表
|
|
|
Product product = productService.getProductById(salesOrderItem.getItemProductId());
|
|
|
ProductColor productColor = productService.getProduceColor(salesOrderItem.getItemProductId());
|
|
|
salesOrderItem.setItemProductType(product.getProductType());
|
|
@@ -184,9 +188,9 @@ public class AdminCustomerController {
|
|
|
salesOrderItem.setItemProductDiscount(productColor.getColorDiscount());
|
|
|
salesOrderItem.setItemIsSource(1);
|
|
|
salesAmount += productColor.getColorDiscount();
|
|
|
- }else if(salesOrderItem.getItemIsSource() == 2){
|
|
|
+ } else if (salesOrderItem.getItemIsSource() == 2) {
|
|
|
Product product = productService.getProductById(salesOrderItem.getItemProductId());
|
|
|
- FittingsInfo fittingsInfo = fittingsInfoService.getFittingsById( salesOrderItem.getItemColorId());
|
|
|
+ FittingsInfo fittingsInfo = fittingsInfoService.getFittingsById(salesOrderItem.getItemColorId());
|
|
|
salesOrderItem.setItemProductType(product.getProductType());
|
|
|
salesOrderItem.setItemProductName(product.getProductName());
|
|
|
salesOrderItem.setItemProductColor(fittingsInfo.getFittingsName());
|
|
@@ -231,14 +235,18 @@ public class AdminCustomerController {
|
|
|
//salesOrder = salesOrderService.addOrderAndIteminfo(salesOrder,list);
|
|
|
salesOrder.setSalesOrderItemList(list);
|
|
|
|
|
|
- Map<String,Object> map = customerService.sendEfastOrder(salesOrder);
|
|
|
- if(map.get("status") == 1){
|
|
|
- salesOrder.setSalesOrderId((String) map.get("EfastOrderId"));
|
|
|
- }else{
|
|
|
- return new ResponseJson(500, "添加订单失败!", 500);
|
|
|
+ try {
|
|
|
+ Map<String, Object> map = customerService.sendEfastOrder(salesOrder);
|
|
|
+ if (map.get("status") == 1) {
|
|
|
+ salesOrder.setSalesOrderId((String) map.get("EfastOrderId"));
|
|
|
+ } else {
|
|
|
+ return new ResponseJson(500, "添加订单失败!", 500);
|
|
|
+ }
|
|
|
+ } catch (RuntimeException e) {
|
|
|
+ return new ResponseJson(500, e.getMessage(), 500);
|
|
|
}
|
|
|
|
|
|
- Integer orderId =salesOrder.getSalesId();
|
|
|
+ Integer orderId = salesOrder.getSalesId();
|
|
|
ResponseJson rj = new ResponseJson(200, "添加成功", 200);
|
|
|
rj.addResponseKeyValue("orderId", orderId);
|
|
|
return rj;
|
|
@@ -332,7 +340,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
//获取登录人id
|
|
|
Integer loginAdminId = AdminUtils.getLoginAdminId();
|
|
|
- mv.addObject("loginAdminId",loginAdminId);
|
|
|
+ mv.addObject("loginAdminId", loginAdminId);
|
|
|
mv.addObject("typeList", typeList);
|
|
|
mv.addObject("complaintTypeList", complaintTypeList);
|
|
|
mv.addObject("adminList", adminList);
|
|
@@ -402,7 +410,7 @@ public class AdminCustomerController {
|
|
|
List<Admin> adminList = sysService.listSelectAdmin(admin);
|
|
|
//获取登录人id
|
|
|
Integer loginAdminId = AdminUtils.getLoginAdminId();
|
|
|
- mv.addObject("loginAdminId",loginAdminId);
|
|
|
+ mv.addObject("loginAdminId", loginAdminId);
|
|
|
mv.addObject("customerId", customerId);
|
|
|
mv.addObject("adminList", adminList);
|
|
|
return mv;
|
|
@@ -579,10 +587,14 @@ public class AdminCustomerController {
|
|
|
String sendProdcuesJson, String sendFittingsJson, String closedProdcuesJson, String closedFittingsJson) throws Exception {
|
|
|
Integer flag = 0;
|
|
|
JSONArray jsonArray;
|
|
|
- List<SendProdcue> sendProdcueList ;
|
|
|
- List<SendFitting> sendFittingList ;
|
|
|
- List<ClosedProdcue> closedProdcueList ;
|
|
|
- List<ClosedFitting> closedFittingList ;
|
|
|
+ List<SendProdcue> sendProdcueList;
|
|
|
+ List<SendFitting> sendFittingList;
|
|
|
+ List<ClosedProdcue> closedProdcueList;
|
|
|
+ List<ClosedFitting> closedFittingList;
|
|
|
+
|
|
|
+ Integer customerIsSolve = customerInfo.getCustomerIsSolve(); //处理类型
|
|
|
+ String phone = customerInfo.getCustomerTel(); //手机号码
|
|
|
+ Integer typeCompany = customerInfo.getTypeCompany(); // 所属商城 1:美国watero; 2:上朵电动牙刷 3:优尼雅净水机
|
|
|
|
|
|
jsonArray = JSONArray.fromObject(sendProdcuesJson);
|
|
|
sendProdcueList = (List) JSONArray.toCollection(jsonArray, SendProdcue.class);
|
|
@@ -603,22 +615,69 @@ public class AdminCustomerController {
|
|
|
|
|
|
customerInfo.setCustomerCommon(customerCommon);
|
|
|
String orderId = "";
|
|
|
- if(customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5 ){
|
|
|
+ if (customerInfo.getCustomerIsSolve() == 3 || customerInfo.getCustomerIsSolve() == 4 || customerInfo.getCustomerIsSolve() == 5) {
|
|
|
Integer adminId = AdminUtils.getLoginAdminId();
|
|
|
orderId = OrderNoUtil.createOrderCode(adminId);
|
|
|
}
|
|
|
customerInfo.setTransactionNumber(orderId);
|
|
|
|
|
|
- try{
|
|
|
+ try {
|
|
|
flag = customerService.saveCustomerInfo(customerInfo, salesOrder);
|
|
|
- }catch (RuntimeException e){
|
|
|
+ } catch (RuntimeException e) {
|
|
|
return new ResponseJson(500, e.getMessage(), 500);
|
|
|
}
|
|
|
if (flag < 1) {
|
|
|
return new ResponseJson(500, "添加客诉失败!", 500);
|
|
|
- } else {
|
|
|
- return new ResponseJson(200, "添加客诉成功!", 200);
|
|
|
}
|
|
|
+
|
|
|
+ //处理结果: 1:已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
|
|
|
+ if (customerIsSolve == 3 || customerIsSolve == 4 || customerIsSolve == 5 || customerIsSolve == 6 || customerIsSolve == 7) {
|
|
|
+ String solveMsg = "";
|
|
|
+ switch (customerIsSolve) {
|
|
|
+ case 3:
|
|
|
+ solveMsg = "为您更换新机";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ solveMsg = "为您维修机器";
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ solveMsg = "为您补发产品";
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ solveMsg = "为您办理退货";
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ solveMsg = "为您办理退货";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ String addCustomerSuccessMsg = "";
|
|
|
+ String typeMsg = "";
|
|
|
+ switch (typeCompany) {
|
|
|
+ case 1:
|
|
|
+ addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_WATERO;
|
|
|
+ typeMsg = "美国WaterO售后";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_SHANGDUO;
|
|
|
+ typeMsg = "上朵售后";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ addCustomerSuccessMsg = SmsConfig.ADD_CUSTOMER_SUCCESS_YULIA;
|
|
|
+ typeMsg = "YULIA售后";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Object [] msg = new Object[]{solveMsg,typeMsg};
|
|
|
+ String text = MessageFormat.format(addCustomerSuccessMsg, msg);
|
|
|
+ logger.info("添加客诉成功后,给 "+ phone +" 手机用户发送短信:" + text );
|
|
|
+ String result = smsService.sendOtherCMS(phone, text);
|
|
|
+
|
|
|
+ if (!"SUCCESS".equals(result)) {
|
|
|
+ return new ResponseJson(500, "添加客诉发送短信失败,失败原因:" + result, 500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ResponseJson(200, "添加客诉成功!", 200);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -644,29 +703,29 @@ public class AdminCustomerController {
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("customer:add:customer")
|
|
|
@RequestMapping("/send_phone_sms")
|
|
|
- public ResponseJson sendPhoneSms(HttpServletRequest request,String type,String phone,Integer typeCompany,ComplaintQuestionInfo complaintQuestionInfo) throws Exception {
|
|
|
+ public ResponseJson sendPhoneSms(HttpServletRequest request, String type, String phone, Integer typeCompany, ComplaintQuestionInfo complaintQuestionInfo) throws Exception {
|
|
|
String url = NameUtils.getConfig("website");
|
|
|
Integer flag = 1;
|
|
|
|
|
|
- if(typeCompany == null || typeCompany == 0){
|
|
|
+ if (typeCompany == null || typeCompany == 0) {
|
|
|
return new ResponseJson(500, "未获取到产品类型!", 500);
|
|
|
}
|
|
|
String con = "";
|
|
|
- if(type != null && !"".equals(type)){
|
|
|
- if( "p".equals(type)){ //problem" 问题处理; mailAddress:邮寄地址;
|
|
|
- if(complaintQuestionInfo.getQuestionId() == null || "".equals(complaintQuestionInfo.getQuestionId())){
|
|
|
+ if (type != null && !"".equals(type)) {
|
|
|
+ if ("p".equals(type)) { //problem" 问题处理; mailAddress:邮寄地址;
|
|
|
+ if (complaintQuestionInfo.getQuestionId() == null || "".equals(complaintQuestionInfo.getQuestionId())) {
|
|
|
complaintQuestionInfo.setQuestionState(1);
|
|
|
complaintQuestionInfo.setQuestionIsQcDetect(0);
|
|
|
- complaintQuestionInfo = complaintQuestionInfoService.insertBackInfo(complaintQuestionInfo);
|
|
|
- }else{
|
|
|
+ complaintQuestionInfo = complaintQuestionInfoService.insertBackInfo(complaintQuestionInfo);
|
|
|
+ } else {
|
|
|
complaintQuestionInfo.setSmallClassId(null); //不能修改小类类型
|
|
|
- flag = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
|
|
|
+ flag = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
|
|
|
if (flag < 1) {
|
|
|
return new ResponseJson(500, "问题修改失败!", 500);
|
|
|
}
|
|
|
}
|
|
|
- url += "/"+complaintQuestionInfo.getQuestionId();
|
|
|
- switch (typeCompany){
|
|
|
+ url += "/" + complaintQuestionInfo.getQuestionId();
|
|
|
+ switch (typeCompany) {
|
|
|
case 1:
|
|
|
con = SmsConfig.SEND_PRODUCT_SEND_WATERO;
|
|
|
break;
|
|
@@ -677,15 +736,15 @@ public class AdminCustomerController {
|
|
|
con = SmsConfig.SEND_PRODUCT_SEND_YULIA;
|
|
|
break;
|
|
|
}
|
|
|
- }else if( "m".equals(type)){
|
|
|
+ } else if ("m".equals(type)) {
|
|
|
|
|
|
- if(complaintQuestionInfo.getQuestionId() == null){
|
|
|
+ if (complaintQuestionInfo.getQuestionId() == null) {
|
|
|
return new ResponseJson(500, "未获取到邮寄信息!", 500);
|
|
|
}
|
|
|
complaintQuestionInfo.setQuestionName(null);
|
|
|
complaintQuestionInfo.setSmallClassId(null);
|
|
|
url += "/5";
|
|
|
- switch (typeCompany){
|
|
|
+ switch (typeCompany) {
|
|
|
case 1:
|
|
|
con = SmsConfig.SEND_PRODUCT_SMS_WATERO;
|
|
|
break;
|
|
@@ -700,18 +759,19 @@ public class AdminCustomerController {
|
|
|
}
|
|
|
|
|
|
String text = MessageFormat.format(con, url);
|
|
|
- logger.info("给 "+ phone +" 手机用户发送短信:" + text );
|
|
|
+ logger.info("给 " + phone + " 手机用户发送短信:" + text);
|
|
|
String result = smsService.sendOtherCMS(phone, text);
|
|
|
|
|
|
- if("SUCCESS".equals(result)){
|
|
|
- return new ResponseJson(200, "发送短信成功", 200);
|
|
|
- }else{
|
|
|
+ if ("SUCCESS".equals(result)) {
|
|
|
+ return new ResponseJson(200, "发送短信成功!", 200);
|
|
|
+ } else {
|
|
|
return new ResponseJson(500, "发送短信失败,失败原因:" + result, 500);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 进入回访完成页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -753,6 +813,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入回访信息详情
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -795,6 +856,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入问题描述页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -837,6 +899,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入修改换新页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -916,6 +979,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入修改维修页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -1008,7 +1072,7 @@ public class AdminCustomerController {
|
|
|
}*/
|
|
|
|
|
|
//修改维修信息
|
|
|
- int num = repairService.updateRepairInfo(repair,closedProducts,closedFittings);
|
|
|
+ int num = repairService.updateRepairInfo(repair, closedProducts, closedFittings);
|
|
|
if (num > 0) {
|
|
|
return new ResponseJson(200, "修改成功!", 200);
|
|
|
} else {
|
|
@@ -1018,6 +1082,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入修改退货页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -1090,6 +1155,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入修改补寄页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -1105,6 +1171,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入修改补寄信息页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
@@ -1171,6 +1238,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 进入修改退货页面
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -1186,6 +1254,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 获取无理由退货信息
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
@@ -1242,6 +1311,7 @@ public class AdminCustomerController {
|
|
|
|
|
|
/**
|
|
|
* 同步百胜订单
|
|
|
+ *
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
@@ -1251,7 +1321,7 @@ public class AdminCustomerController {
|
|
|
public ResponseJson syncEfastOrder() throws Exception {
|
|
|
int pageNo = 1;
|
|
|
int pageSize = 20;
|
|
|
- boolean flag = false; //控制是否还需要获取百胜订单信息
|
|
|
+ boolean flag = false; //控制是否还需要获取百胜订单信息
|
|
|
String date = "";
|
|
|
synchronized (lock) {
|
|
|
//根据时间排序查询订单信息
|