Browse Source

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

# Conflicts:
#	watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java
wangxiaoming 7 years ago
parent
commit
3dca943674

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/Visit.java

@@ -15,6 +15,8 @@ public class Visit implements Serializable {
     private Integer customerId;
     //提醒人
     private Integer adminId;
+    //指定人
+    private Integer designated_admin_id;
     //回访人姓名
     private String visitName;
     //回访人手机号码
@@ -168,4 +170,12 @@ public class Visit implements Serializable {
     public void setVisitTimeSelect(Integer visitTimeSelect) {
         this.visitTimeSelect = visitTimeSelect;
     }
+
+    public Integer getDesignated_admin_id() {
+        return designated_admin_id;
+    }
+
+    public void setDesignated_admin_id(Integer designated_admin_id) {
+        this.designated_admin_id = designated_admin_id;
+    }
 }

+ 9 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/order/EfastOrder.java

@@ -19,6 +19,7 @@ public class EfastOrder implements Serializable{
     private static final long serialVersionUID = -930035471252331881L;
     private Integer oid;                        //订单id
     private String orderId;                     //订单号  -- 交易号
+    private String efastOrderId;        //用于存储efast的订单id, 推送时不用传
     private String orderAddressName;            //收货人姓名
     private String orderAddressTel;             //收货人电话
     private String orderOpenId;                 //收货人标识:身份证号/openid
@@ -247,4 +248,12 @@ public class EfastOrder implements Serializable{
     public void setOid(Integer oid) {
         this.oid = oid;
     }
+
+    public String getEfastOrderId() {
+        return efastOrderId;
+    }
+
+    public void setEfastOrderId(String efastOrderId) {
+        this.efastOrderId = efastOrderId;
+    }
 }

+ 8 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/order/EfastOrderService.java

@@ -5,6 +5,7 @@ import com.iamberry.rst.core.order.OrderItem;
 import net.sf.json.JSONObject;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by ${muzx} on 2017/5/25.
@@ -28,6 +29,13 @@ public interface EfastOrderService {
     void sendOrderInfoToEfast(List<EfastOrder> orderList, List<OrderItem> itemList) throws Exception;
 
     /**
+     * 将订单推送到百胜
+     *  调用 sendOrderInfoToEfast 方法,只是可以将 efast 的订单号返回回来
+     * @throws Exception
+     */
+    public Map<String,Object> sendOrder(List<EfastOrder> orderList, final List<OrderItem> itemList) throws Exception;
+
+    /**
      *  同步百胜订单状态
      * #date 2017年6月2日
      * @author muzx

+ 40 - 19
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/CustomerServiceImpl.java

@@ -11,6 +11,7 @@ import com.iamberry.rst.core.order.Product;
 import com.iamberry.rst.core.order.ProductColor;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.faces.cm.CustomerService;
+import com.iamberry.rst.faces.order.EfastOrderService;
 import com.iamberry.rst.service.address.mapper.AddressMapper;
 import com.iamberry.rst.service.cm.mapper.*;
 import com.iamberry.rst.service.order.EfastOrderServiceImpl;
@@ -68,6 +69,8 @@ public class CustomerServiceImpl implements CustomerService {
     private ComplaintSignclosedProductInfoMapper complaintSignclosedProductInfoMapper;
     @Autowired
     private FittingsInfoMapper fittingsInfoMapper;
+    @Autowired
+    private EfastOrderService efastOrderService;
 
 
     @Override
@@ -133,7 +136,7 @@ public class CustomerServiceImpl implements CustomerService {
             Map<String,Object> map;
             switch (customerInfo.getCustomerIsSolve()) {  //处理结果: 1:已解决  2:未解决 3:换新  4:维修 5:补发 6:退货 7:无理由退货
                 case 3: //换新
-                    map = this.sendEfastOrder(customerCommon);  //换新需要向Efast推送一条换新发货的订单
+                    map = this.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
@@ -146,7 +149,7 @@ public class CustomerServiceImpl implements CustomerService {
                     this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检
                     break;
                 case 4: //维修
-                    map = this.sendEfastOrder(customerCommon);  //维修需要向Efast推送一条维修发货的订单
+                    map = this.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
@@ -159,7 +162,7 @@ public class CustomerServiceImpl implements CustomerService {
                     this.saveComplaintDetectInfo(complaintDetectInfo,customerCommon);   //创建品检
                     break;
                 case 5: //补发  不用创建仓储签收任务
-                    map = this.sendEfastOrder(customerCommon);  //补发需要向Efast推送一条发货的订单
+                    map = this.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
@@ -352,14 +355,16 @@ public class CustomerServiceImpl implements CustomerService {
      * 向Efast推送订单  仅换新,维修 ,补发
      * @return
      */
-    public Map<String,Object> sendEfastOrder(CustomerCommon customerCommon){
+    @Transactional
+    public Map<String,Object> sendEfastOrder(CustomerCommon customerCommon,SalesOrder salesOrder) throws Exception{
         Map<String,Object> map = new HashMap<String,Object>();
-        EfastOrderServiceImpl efastOrderService = new EfastOrderServiceImpl();
         List<EfastOrder> orderList = new ArrayList<EfastOrder>();
         List<OrderItem> itemList = new ArrayList<OrderItem>();
 
         Integer num = 0;  //产品数量
         Integer amout = 0; //商品总价
+        String orderProductBarCode = "";    //产品sku
+        String productName = "";    //产品名称
         for(int i=0;i<customerCommon.getSendProdcues().size();i++){
             SendProdcue sendProdcue = customerCommon.getSendProdcues().get(i);
             OrderItem orderItem = new OrderItem();
@@ -368,6 +373,8 @@ public class CustomerServiceImpl implements CustomerService {
             orderItem.setItemProductPrice(sendProdcue.getProductColor().getColorPrice());
             orderItem.setItemColorBar(sendProdcue.getProductColor().getColorBar());
             itemList.add(orderItem);
+            orderProductBarCode = sendProdcue.getProductColor().getColorBar();
+            productName = sendProdcue.getSendProduceName();
             num += sendProdcue.getSendProdcueNumber();
             amout += sendProdcue.getProductColor().getColorPrice();
         }
@@ -375,7 +382,7 @@ public class CustomerServiceImpl implements CustomerService {
         EfastOrder efastOrder = new EfastOrder();
         efastOrder.setOrderAddressName(customerCommon.getRelationSendName());//收货人姓名
         efastOrder.setOrderAddressTel(customerCommon.getRelationSendTel());//收货人电话
-        efastOrder.setOrderOpenId("");//身份证
+        efastOrder.setOrderOpenId("1");//身份证
 
         String[] address = customerCommon.getRelationSendMergeAddress().split("-");
         efastOrder.setOrderProvince(address[0]);
@@ -388,31 +395,45 @@ public class CustomerServiceImpl implements CustomerService {
         efastOrder.setOrderAmount(amout);   //商品总价
         efastOrder.setOrderPayMoney(amout); //已付款
 
-        efastOrder.setOrderId(customerCommon.getTransactionNumber());   //外部交易号
+        //支付方式
+        switch (salesOrder.getSalesPayType()){
+            case 1: //微信支付
+                efastOrder.setOrderPayType(1);
+                break;
+            case 2: //现金支付
+                efastOrder.setOrderPayType(2);
+                break;
+            case 3:
+                break;
+            case 4: //刷卡支付
+                efastOrder.setOrderPayType(4);
+                break;
+            case 5: //支付宝支付
+                efastOrder.setOrderPayType(5);
+                break;
+        }
 
-        efastOrder.setOrderPayType(0);  //支付方式
+        efastOrder.setOrderProductBarCode(orderProductBarCode); //产品sku
+        efastOrder.setOrderProductName(productName);    //产品名称
+
+        efastOrder.setOrderId(customerCommon.getTransactionNumber());   //外部交易号
+        efastOrder.setOid(1);
 
         orderList.add(efastOrder);
 
         Integer status = 1;
+        Map<String,Object>  orderMap = new HashMap<String,Object>();
         try {
-            efastOrderService.sendOrderInfoToEfast(orderList,itemList);
+            orderMap = efastOrderService.sendOrder(orderList,itemList);
         } catch (Exception e) {
             status = 0;
         }
-        if(status == 0){
-            map.put("status",status);
-            map.put("EfastOrderId","");
-            return map;
-        }
-        EfastOrder efOrder = new EfastOrder();
-        try {
-            efOrder = efastOrderService.getOrderInfoFromEfast(customerCommon.getTransactionNumber());
-        } catch (Exception e) {
+        List<EfastOrder> oList = (List<EfastOrder>) orderMap.get("efastOrderList");
+        if(oList == null || oList.size() < 1){
             status = 0;
         }
         map.put("status",status);
-        map.put("EfastOrderId",efOrder.getOid());
+        map.put("EfastOrderId",oList.get(0).getEfastOrderId());
         return map;
     }
 

+ 4 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/complaintQuestionInfoMapper.xml

@@ -45,6 +45,9 @@
     question_not_solved_num
     from tb_rst_complaint_question
     <where>
+      <if test="questionId !=null">
+        AND question_id = #{questionId}
+      </if>
       <if test="smallClassId !=null">
         AND small_class_id = #{smallClassId}
       </if>
@@ -54,7 +57,7 @@
       AND question_state = 1
     </where>
     ORDER BY question_create_time DESC
-    limit 0,3
+    limit 0,5
   </select>
 
   <insert id="insert" parameterType="ComplaintQuestionInfo" >

+ 27 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/order/EfastOrderServiceImpl.java

@@ -49,15 +49,36 @@ public class EfastOrderServiceImpl implements EfastOrderService {
     //设置线程数为CPU核心数
     private static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(1);
 
+
+    private static List<EfastOrder> efastOrderList = new ArrayList<EfastOrder>();
+    private static String order_sn = "";
+    private static String transactionNumber = "";
+
+    @Override
+    public Map<String,Object> sendOrder(List<EfastOrder> orderList, final List<OrderItem> itemList) throws Exception {
+        Map<String,Object> map = new HashMap<>();
+        sendOrderInfoToEfast(orderList,itemList);
+        map.put("efastOrderList",efastOrderList);
+        return map;
+    }
+
     @Override
     public void sendOrderInfoToEfast(List<EfastOrder> orderList, final List<OrderItem> itemList) throws Exception {
         checkOrder(orderList,itemList);
         int i = 0;
+        efastOrderList = new ArrayList<EfastOrder>();
+        order_sn = "";
+        transactionNumber = "";
         for (final EfastOrder order : orderList){
             i++ ;
             try {
                 boolean flag = sendExcuteOneOrder(order, itemList);
                 if (flag) {
+                    EfastOrder eo = new EfastOrder();
+                    eo.setEfastOrderId(order_sn);
+                    eo.setOrderId(transactionNumber);
+                    efastOrderList.add(eo);
+
                     order.setReturnStatus("SUCCESS");
                     order.setReturnMsg("推送成功");
                 } else {
@@ -106,9 +127,13 @@ public class EfastOrderServiceImpl implements EfastOrderService {
             JSONObject jsonObject = JSONObject.fromObject(result);
             JSONObject respData = JSONObject.fromObject(jsonObject.get("resp_data"));
             String oderSn = respData.getString("oder_sn");
+
             if (oderSn != null) {
                 String msg = respData.getString("msg");
                 if ("success".equals(msg)) {
+
+                    order_sn = oderSn;
+                    transactionNumber = order.getOrderId();
                     return true;
                 }
             }
@@ -312,10 +337,12 @@ public class EfastOrderServiceImpl implements EfastOrderService {
             JSONObject respData = JSONObject.fromObject(jsonObject.get("resp_data"));
             // 发货状态 : shipping_status
             String shoppingStatus = respData.getString("shipping_status");
+            String shoppingOrderId = respData.getString("order_id");
 
             if(StringUtils.isNotEmpty(shoppingStatus)){
                 EfastOrder efastOrder = new EfastOrder();
                 efastOrder.setOrderStatus(Integer.parseInt(shoppingStatus));
+                efastOrder.setOrderId(shoppingOrderId);
                 return efastOrder;
             }
             logger.error("rst-获取百胜出错,订单号-->>" + orderid + ",百胜返回信息-->" + result);

+ 1 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/product/mapper/productMapper.xml

@@ -113,7 +113,7 @@
         select * from tb_rst_product_info where product_id = #{productId}
     </select>
 
-    <select id="getProduceColor"  resultType="product">
+    <select id="getProduceColor"  resultType="ProductColor">
         SELECT
             color_id,
             color_product_id,

+ 8 - 7
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -9,6 +9,7 @@ import com.iamberry.rst.core.sys.Admin;
 import com.iamberry.rst.faces.cm.*;
 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.utils.AdminUtils;
 import com.iamberry.rst.utils.OrderNoUtil;
@@ -69,6 +70,10 @@ public class AdminCustomerController {
     private NoreasonBackService noreasonBackService;
     @Autowired
     private ComplaintQuestionInfoService complaintQuestionInfoService;
+    @Autowired
+    private SmsService smsService;
+
+
 
     private Object lock = new Object();
 
@@ -478,9 +483,6 @@ public class AdminCustomerController {
         } else {
             return new ResponseJson(200, "添加客诉成功!", 200);
         }
-
-
-
     }
 
     /**
@@ -511,16 +513,15 @@ public class AdminCustomerController {
         Integer flag = 1;
         if(type != null && !"".equals(type)){
             if( "p".equals(type)){
-
-                flag =  complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
-
                 url += "/problem?questionId="+complaintQuestionInfo.getQuestionId();
             }else if( "m".equals(type)){
                 url += "/adress";
-
             }
         }
 
+        flag =  complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
+//        ResponseJson rj = smsService.sms(phone,1,);
+
         if (flag < 1) {
             return new ResponseJson(500, "发送短信失败!", 500);
         } else {

+ 6 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/ComplaintQuestionInfoController.java

@@ -25,6 +25,11 @@ import java.util.List;
 @RequestMapping("/admin/complaintQuestion")
 public class ComplaintQuestionInfoController {
 
+    /**
+     *  邮寄地址id
+     */
+    private Integer backOutQuestionId = 5;
+
     @Autowired
     private ComplaintTypeInfoService complaintTypeInfoService;
 
@@ -149,7 +154,7 @@ public class ComplaintQuestionInfoController {
         return msg;
     }
 
-    private Integer backOutQuestionId = 5;
+
     /**
      * 查询退回短信客诉问题
      *

+ 63 - 25
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/add_customer.ftl

@@ -189,7 +189,7 @@
                     <input type="text" class="input-text" value="" placeholder="请输入手机号" id="p-phone" name="">
                 </div>
                 <div class="formControls col-2 col-sm-2" style="width: 10%">
-                    <input type="button" class="btn btn-primary" value="发短信給用户" onclick="sendPhone('p',$('#p-msg'));">
+                    <input type="button" class="btn btn-primary" value="发短信給用户" onclick="sendPhone('p','p-msg');">
                 </div>
                 <div class="formControls col-2 col-sm-2 msg-phone">
                     <div id="p-msg" style="color: #e00"></div>
@@ -406,12 +406,9 @@
             </div>
             <div class="row cl" id="sendAddressInfo">
                 <label class="form-label col-1 col-sm-1"><span class="c-red">*</span>寄回信息:</label>
-                <div class="formControls col-5 col-sm-5">
-                        <textarea name="" cols="" rows="2" class="textarea" placeholder="说点什么...">邮寄地址:东莞清溪三中金龙工业区徐福记对面优尼雅电子科技,杨春有,13592708169邮寄备注:您好,麻烦您那边把机器邮寄前请将水箱、接水台中的水倒掉并擦干,不要留有水渍,避免运输途中水或奶粉
-                溅入机器内部造成不必要的损失;用原包装或泡沫等材质包裹好机身。避免运输途中造成机器     磕碰、损坏。
-请勿寄顺丰、圆通、EMS以及到付件快递,其他快递物流随意,寄回时,麻烦您在产品里面留下故障原因说明,
-提示:寄回后把单号给我们提供下然后提供下您的姓名、地址和电话方便我们修好后给您寄回去。</textarea>
-
+                <div class="formControls col-5 col-sm-5" style="height: 400px">
+                    <script id="sendAddressSms" type="text/plain" style="width:650px;height:250px;"></script>
+                    </script>
                 </div>
             </div>
             <div class="row cl" id="sendAddressByPhone" style="display: none;">
@@ -420,7 +417,7 @@
                     <input type="text" class="input-text" value="" placeholder="请输入手机号" id="m-phone" name="">
                 </div>
                 <div class="formControls col-2 col-sm-2" style="width: 10%">
-                    <input type="button" class="btn btn-primary" value="发短信給用户" onclick="sendPhone('m',);">
+                    <input type="button" class="btn btn-primary" value="发短信給用户" onclick="sendPhone('m','m-msg');">
                 </div>
                 <div class="formControls col-2 col-sm-2 msg-phone">
                     <div id="m-msg" style="color: #e00"></div>
@@ -586,6 +583,8 @@
     var describeContentText = UE.getEditor('describeContentText');
     /*处理描述*/
     var describeHandleDescText = UE.getEditor('describeHandleDescText');
+    /*邮寄地址*/
+    var sendAddressSms = UE.getEditor('sendAddressSms');;
 </script>
 <script type="text/javascript">
 
@@ -609,6 +608,9 @@
     /*全局标识当前状态  type : 1 :已解决  2:未解决  3:换新  4:维修  5:补发   6:退货  7:无理由退货*/
     var allCustomerType = 1;
 
+    /*  寄回地址的id */
+    var complaint_questionId = 5;
+
     /*初始化页面参数*/
     $(function () {
 
@@ -650,7 +652,7 @@
 
         /*监听问题关键字搜索*/
         $(document).on('click', '#search_button', function() {
-            initComplaintQuestionInfo();
+            initComplaintQuestionInfo("p");
         });
 
         /*搜索订单事件*/
@@ -837,6 +839,11 @@
                     break;
             }
         }else if(allCustomerInfoType == 2){ //售后
+
+//            var msg = UE.getEditor('sendAddressSms').getContent();
+//            if(msg == null || msg == ""){
+//                initComplaintQuestionInfo("m");
+//            }
             $("#renewed").show();
             $("#maintain").show();
             $("#reissue").show();
@@ -1020,38 +1027,58 @@
 
     /**
      * 搜索QA 显示
+     * type  p:问题qa;  m:邮寄qa
      */
-    function initComplaintQuestionInfo(){
-        var complaintId = $("[name='complaintId']").val();
-        var smallClassId = $("[name='smallClassId']").val();;
-        var questionName = $("[name='questionIdMsg']").val();;;
-        var html = "";
+    function initComplaintQuestionInfo(type){
+        var complaintId;
+        var smallClassId;
+        var questionName;
+        var questionId;
+        if(type == "p"){
+            complaintId = $("[name='complaintId']").val();
+            smallClassId = $("[name='smallClassId']").val();
+            questionName = $("[name='questionIdMsg']").val();
+        }else if(type == "m"){
+            questionId = complaint_questionId;
+        }
+
         $.ajax({
             type: "POST",
             data: {
                 complaintId : complaintId,
                 smallClassId : smallClassId,
-                questionName : questionName
+                questionName : questionName,
+                questionId : questionId
             },
             url: "${path}/admin/complaintQuestion/list_complaintQuestion",
             async: false,
             success: function(data){
-                if (data.returnCode == 200) {
-                    for(var i=0;i<data.returnMsg.complaintQuestionInfoList.length;i++){
-                        var complaintQuestion= data.returnMsg.complaintQuestionInfoList[i];
-                        html += '<li class="ask">'+ complaintQuestion.questionName +'' +
-                                '</li>' +
-                                '<li class="answer" style="height: 65px;overflow: hidden;">答:<span>'+ complaintQuestion.questionProfile +'</span><input class="quesId" value="'+ complaintQuestion.questionId +'"></li>';
+                if(type == "p"){
+                    var html = "";
+                    if (data.returnCode == 200) {
+                        for(var i=0;i<data.returnMsg.complaintQuestionInfoList.length;i++){
+                            var complaintQuestion= data.returnMsg.complaintQuestionInfoList[i];
+                            html += '<li class="ask">'+ complaintQuestion.questionName +'' +
+                                    '</li>' +
+                                    '<li class="answer" style="height: 65px;overflow: hidden;">答:<span>'+ complaintQuestion.questionProfile +'</span><input class="quesId" value="'+ complaintQuestion.questionId +'"></li>';
+                        }
+                    }else{
+                        html = '';
                     }
-                }else{
-                    html = '';
+                    $("#question").html(html);
+                    $(".dalog-ask").show();
+                }else if(type == "m"){
+                    var msg = "";
+                    if (data.returnCode == 200) {
+                        msg = data.returnMsg.complaintQuestionInfoList[0].questionProfile;
+                    }
+                    UE.getEditor('sendAddressSms').setContent(msg,false);
                 }
-                $("#question").html(html);
             },
             error: function(XmlHttpRequest, textStatus, errorThrown){
             }
         });
-        $(".dalog-ask").show();
+
     }
 
     /**
@@ -1063,6 +1090,7 @@
         var index = layer.load(1, {
             shade: [0.5,'#fff'] //0.1透明度的白色背景
         });
+
         var desc = "";
         var phone = "";
         var questionId = "";
@@ -1074,11 +1102,21 @@
             desc = UE.getEditor('describeContentText').getContent();
         }else if(type == "m"){
             phone = $("#m-phone").val();
+            questionId = complaint_questionId;
+            desc = UE.getEditor('describeContentText').getContent();
         }else{
             layer.close(index);
             layer.msg("发送报错", {icon: 5, time: 3000});
             return false;
         }
+
+        var reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
+        if(!reg.test(phone)){
+            layer.msg("手机号码格式不正确", {icon: 5, time: 3000});
+            layer.close(index);
+            return false;
+        }
+
         $.ajax({
             type: "POST",
             data: {