Browse Source

Merge branch 'fearure-inuiry-message-hyy-20180424' into fearure-inuiry-message-hyy-20180502

hubert 7 years ago
parent
commit
1bca886cdb

+ 53 - 2
src/main/java/com/uas/platform/b2c/common/message/controller/InternalMessageController.java

@@ -1,13 +1,22 @@
 package com.uas.platform.b2c.common.message.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.alibaba.fastjson.parser.Feature;
 import com.uas.platform.b2c.common.message.service.InternalMessageService;
+import com.uas.platform.b2c.core.config.MessageConf;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.model.Status;
+import com.uas.platform.core.util.HttpUtil;
+import com.uas.sso.support.Page;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
+import com.uas.platform.b2c.common.message.model.MessageModel;
+import java.util.HashMap;
+import com.uas.platform.b2c.core.utils.ContextUtils;
 
 /**
  * 站内信接口
@@ -17,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
 @RestController
 @RequestMapping("/internalmessage-service")
 public class InternalMessageController {
+    private static final String MESSAGE_PUBLIC_SERVICE_URL = ContextUtils.getBean(MessageConf.class).getMessagePublicServiceDevUrl();
 
     private final InternalMessageService internalMessageService;
 
@@ -38,21 +48,62 @@ public class InternalMessageController {
     }
 
 
-    /**
+/*    *//**
      * 分页获取消息 (用户)
      * @param recRole 接收角色
      * @param timeSorting 时间排序
      * @param classes 消息分类
      * @param page 分页参数
      * @return
-     */
+     *//*
     @RequestMapping(value = "/private", method = RequestMethod.GET)
     public ModelMap getMessagePagePrivate(@RequestParam(value = "recRole", defaultValue = "BUYER") String recRole, @RequestParam("timeSorting") String timeSorting, @RequestParam("classes") String classes, PageParams page) {
         ModelMap map = new ModelMap();
         map.put("messages", internalMessageService.getMessagePage(SystemSession.getUser().getUserUU(), (SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu(): null), recRole, timeSorting, classes, page));
         return map;
+    }*/
+
+    /**
+     * 获取公共消息的方法
+     *
+     * @author dongbw
+     * @param pageParams 分页参数
+     * @param isRead 阅读状态 1已读 0 未读
+
+     * @return
+     * @throws Exception
+     */
+    @SuppressWarnings("unchecked")
+    @RequestMapping(value = "/private", method = RequestMethod.GET)
+    public static Page<MessageModel> getMessagesPagePrivate(PageParams pageParams, Short isRead) throws Exception {
+
+
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("receiverUu", SystemSession.getUser().getUserUU());
+        params.put("receiverEnuu", SystemSession.getUser().getEnterprise().getUu());
+        params.put("consumerApp", "B2B");
+//        params.put("pageParams", FlexJsonUtils.toJsonDeep(pageParams));
+        params.put("page", pageParams.getPage());
+        params.put("count", pageParams.getCount());
+        params.put("sorting", pageParams.getSorting());
+        params.put("isRead", isRead);
+
+        HttpUtil.Response res = HttpUtil.sendGetRequest(MESSAGE_PUBLIC_SERVICE_URL + "/messages", params);
+        if (HttpStatus.OK.value() == res.getStatusCode()) {
+            if (null != res.getResponseText()) {
+                System.out.println(res.getResponseText());
+
+                return (Page) JSONObject.parseObject(res.getResponseText(), new TypeReference<Page<MessageModel>>() {
+                }, new Feature[0]);
+            }
+        } else {
+            throw new RuntimeException("获取消息失败");
+        }
+        return null;
     }
 
+
+
     /**
      * 阅读消息
      * @param id

+ 253 - 0
src/main/java/com/uas/platform/b2c/common/message/model/MessageModel.java

@@ -0,0 +1,253 @@
+package com.uas.platform.b2c.common.message.model;
+
+import java.util.Date;
+
+/**
+ * 消息公共服务接收实体
+ */
+public class MessageModel{
+
+    /**
+     * 消息id
+     */
+    private Long id;
+
+    /**
+     * 阅读状态
+     * 1 已阅
+     * 0 未读
+     */
+    private Short isRead;
+
+    /**
+     * 生成时间
+     */
+    private Date createTime;
+
+    /**
+     * 在b2b中拿到消息之后,拼接url(公共服务中无此字段)
+     */
+    private String url;
+
+    /**
+     * 来源id (拼接跳转详情URL)
+     */
+    private Long sourceId;
+
+    /**
+     * 消息备注(保存用于短信模版的单号参数)
+     */
+    private String remark;
+
+    /**
+     * 消息类型
+     */
+    private String type;
+
+    /**
+     * 消息内容
+     */
+    private String content;
+
+    /**
+     * 消息接收者uu
+     */
+    private Long receiverUu;
+
+    /**
+     * 消息接收者企业uu
+     */
+    private Long receiverEnuu;
+
+    /**
+     * 消息发送者
+     */
+    private Long senderUu;
+
+    /**
+     * 消息发送者企业uu
+     */
+    private Long senderEnuu;
+
+    /**
+     * 来源应用
+     */
+    private String producerApp;
+
+    /**
+     * 消费类型(所有应用共享:"PUBLIC",单个应用独享:"SINGLE",多个应用共享:"MULTI")
+     */
+    private String consumeType;
+
+    /**
+     * 推送方式类型
+     * 邮件、短信、IM:"MAIL_AND_SM_AND_IM"
+     * 邮件、短信:"MAIL_AND_SM"
+     * 邮件、IM:"MAIL_AND_IM"
+     * 短信、IM:"SM_AND_IM"
+     * 邮件:"MAIL"
+     * 短信:"SM"
+     * IM:"IM"
+     * 不发送:"DONT_SEND"
+     */
+    private String smsType;
+
+    /**
+     * 邮件模板id
+     */
+    private String mailTemplate;
+
+    /**
+     * 短息模板id
+     */
+    private String smTemplate;
+
+    /**
+     * 接收应用(以","拼接应用名称)
+     */
+    private String consumerApp;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Short getIsRead() {
+        return isRead;
+    }
+
+    public void setIsRead(Short isRead) {
+        this.isRead = isRead;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Long getReceiverUu() {
+        return receiverUu;
+    }
+
+    public void setReceiverUu(Long receiverUu) {
+        this.receiverUu = receiverUu;
+    }
+
+    public Long getReceiverEnuu() {
+        return receiverEnuu;
+    }
+
+    public void setReceiverEnuu(Long receiverEnuu) {
+        this.receiverEnuu = receiverEnuu;
+    }
+
+    public Long getSenderUu() {
+        return senderUu;
+    }
+
+    public void setSenderUu(Long senderUu) {
+        this.senderUu = senderUu;
+    }
+
+    public Long getSenderEnuu() {
+        return senderEnuu;
+    }
+
+    public void setSenderEnuu(Long senderEnuu) {
+        this.senderEnuu = senderEnuu;
+    }
+
+    public String getProducerApp() {
+        return producerApp;
+    }
+
+    public void setProducerApp(String producerApp) {
+        this.producerApp = producerApp;
+    }
+
+    public String getConsumeType() {
+        return consumeType;
+    }
+
+    public void setConsumeType(String consumeType) {
+        this.consumeType = consumeType;
+    }
+
+    public String getSmsType() {
+        return smsType;
+    }
+
+    public void setSmsType(String smsType) {
+        this.smsType = smsType;
+    }
+
+    public String getMailTemplate() {
+        return mailTemplate;
+    }
+
+    public void setMailTemplate(String mailTemplate) {
+        this.mailTemplate = mailTemplate;
+    }
+
+    public String getSmTemplate() {
+        return smTemplate;
+    }
+
+    public void setSmTemplate(String smTemplate) {
+        this.smTemplate = smTemplate;
+    }
+
+    public String getConsumerApp() {
+        return consumerApp;
+    }
+
+    public void setConsumerApp(String consumerApp) {
+        this.consumerApp = consumerApp;
+    }
+
+    public Long getSourceId() {
+        return sourceId;
+    }
+
+    public void setSourceId(Long sourceId) {
+        this.sourceId = sourceId;
+    }
+}

+ 15 - 0
src/main/java/com/uas/platform/b2c/core/config/MessageConf.java

@@ -63,6 +63,21 @@ public class MessageConf {
 	@Value("#{message.plaformB2cSupplyChainTemplateId}")
 	private String supplyChain;
 
+	/**
+	 * 消息公共服务地址
+	 * @return
+	 */
+	@Value("#{message.messagePublicServiceDevUrl}")
+	private String messagePublicServiceDevUrl;
+
+	public String getMessagePublicServiceDevUrl() {
+		return messagePublicServiceDevUrl;
+	}
+
+	public void setMessagePublicServiceDevUrl(String messagePublicServiceDevUrl) {
+		this.messagePublicServiceDevUrl = messagePublicServiceDevUrl;
+	}
+
 	public String getTplNotifySupplierAfterCommit() {
 		return tplNotifySupplierAfterCommit;
 	}

+ 0 - 1
src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/KindServiceImpl.java

@@ -108,7 +108,6 @@ public class KindServiceImpl implements KindService {
         }
         return kindPropertyUas;
     }
-
     @Override
     public Map<String, List<KindUas>> getParentsByKindCode(String kindCode) {
         Map<Long, Kind> maps = new HashMap<>();

+ 3 - 1
src/main/resources/dev/message.properties

@@ -4,4 +4,6 @@ plaformB2cBrandApprovedTemplateId=5b5effdf-5562-45f7-9021-18f21e29bec6
 plaformB2cBrandUnproveTemplateId=03b3d658-cd92-43a0-a53f-103492cfc595
 plaformB2cComponentApprovedTemplateId=36812a85-d0f9-4d2a-a7aa-62319f092b6f
 plaformB2cComponentUnproveTemplateId=6228240a-93ba-405f-851c-f874a6c99864
-plaformB2cSupplyChainTemplateId=b28337ba-f115-4f11-b457-15d558443160
+plaformB2cSupplyChainTemplateId=b28337ba-f115-4f11-b457-15d558443160
+
+messagePublicServiceDevUrl=http://218.17.158.219:24000/message

+ 1 - 1
src/main/resources/dev/sys.properties

@@ -46,7 +46,7 @@ productServiceIp=http://192.168.253.12:24000
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292
 
 #inquiry service url
-inquiryServiceUrl=http://218.17.158.219:24000
+inquiryServiceUrl=http://10.1.51.96:8080/
 inquiryServiceInnerUrl=http://218.17.158.219:24000
 
 #b2b

BIN
src/main/webapp/resources/img/seekPurchase/refuse.png


BIN
src/main/webapp/resources/img/seekPurchase/refused.png


+ 2 - 2
src/main/webapp/resources/js/common/query/seekPurchase.js

@@ -52,8 +52,8 @@ define([ 'ngResource' ], function() {
         method: 'GET'
       },
       updateSeekPurchaseStatus: {
-        url: 'http://218.17.158.219:24000/inquiry/buyer/decide',
-        method: 'POST'
+              url: 'http://218.17.158.219:24000/inquiry/buyer/decide',
+              method: 'POST'
       },
       getSeekPurchaseBomListPage: {
         url: 'http://218.17.158.219:24000/inquiry/buyer/inquiryList',

+ 32 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/seek_purchase_ctrl.js

@@ -483,6 +483,38 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             });
           }
 
+
+
+              //  点击拒绝,选择理由
+              $scope.currentRefuseOffer = {};
+              $scope.showCurrentRefuseOffer = false;
+              $scope.setActiveRefuse = function (of) {
+                  $scope.currentRefuseOffer = of;
+                  $scope.setShowCurrentRefuseOffer(true);
+              }
+
+              $scope.setShowCurrentRefuseOffer = function (flag) {
+                  $scope.showCurrentRefuseOffer = flag;
+              }
+
+              $scope.choice = '采购需求变更';
+
+              // 选择理由
+              $scope.refuse = function (choice) {
+                  $http({
+                      method: 'POST',
+                      dataType: 'json',
+                      url: seekUrl + '/inquiry/buyer/refuse',
+                      params: {id:  $scope.currentRefuseOffer.id, status: -1, refusereason: choice}
+                  }).success(function (data) {
+                      toaster.pop('refuse', '已拒绝报价');
+                      $scope.setShowCurrentRefuseOffer(false);
+                      $scope.seekPurchaseTableParams.reload();
+                  }).error(function (response) {
+                      toaster.pop('error', response);
+                  });
+              }
+
           $scope.offerCount = 0;
           $scope.goodsCount = 0;
           $scope.currentSeek = {};

+ 47 - 14
src/main/webapp/resources/view/usercenter/forstore/seekPurchase.html

@@ -353,7 +353,7 @@
     }
     .seek-purchase .seek-purchase-content >table >tbody tr.expand-row table tbody tr td.operate > span {
         display: inline-block;
-        width: 64px;
+        width: 39px;
         height: 24px;
         line-height: 24px;
         text-align: center;
@@ -364,6 +364,9 @@
         font-size: 12px;
         border-radius: 2px;
     }
+    td.operate .seek-btn {
+        margin-left: 13px;
+    }
     .seek-purchase .seek-purchase-content >table >tbody tr.expand-row .all-buy {
         height: 39px;
         line-height: 39px;
@@ -690,6 +693,15 @@
         background: #4290f7;
         margin: 18px 0 13px 0;
         border-radius: 2px;
+        color: #fff;
+    }
+    .seek-purchase .link-saler-box .select-adder {
+        display: inline-block;
+        width: 127px;
+        height: 22px;
+        border-radius: 2px;
+        border: 1px solid #a7a8a8;
+        padding: 0 20px 0 6px;
     }
     .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large .fl {
         margin-right: 37px;
@@ -1182,7 +1194,9 @@
                                             </div>
 
                                             <img ng-if="of.agreed == 1" src="static/img/seekPurchase/recieved.png" alt="" class="ng-scope">
-                                            <span ng-if="seek.agreed != 1" ng-click="adopt(of.id)">采纳报价</span>
+                                            <img ng-if="of.agreed == -1" src="static/img/seekPurchase/refused.png" alt="" class="ng-scope">
+                                            <span class="seek-btn" ng-if="!seek.agreed && !of.agreed" ng-click="adopt(of.id)">采纳</span>
+                                            <a class="seek-btn" ng-if="!of.agreed" ng-click="setActiveRefuse(of)">拒绝</a>
                                         </td>
                                     </tr>
                                     </tbody>
@@ -1298,16 +1312,35 @@
             </div>
         </div>
     </div>
-    <!--<div class="com-mall-del-box link-saler-box" ng-if="linkBoxIndex > -1">-->
-        <!--<div class="title">-->
-            <!--<i ng-click="setLinkBoxIndex(-1)"></i>-->
-        <!--</div>-->
-        <!--<div class="content">-->
-            <!--<p><i class="fa fa-exclamation-circle"></i>抱歉,暂时无法与卖家在线沟通!</p>-->
-            <!--<p>卖家联系电话:<span ng-bind="currentSeek.qutations[linkBoxIndex].userTel || '-'"></span></p>-->
-            <!--<div>-->
-                <!--<a ng-click="setLinkBoxIndex(-1)">我知道了</a>-->
-            <!--</div>-->
-        <!--</div>-->
-    <!--</div>-->
+    <!--<div class="com-mall-del-box link-saler-box" ng-if="linkBoxIndex > -1">
+        <div class="title">
+            <i ng-click="setLinkBoxIndex(-1)"></i>
+        </div>
+        <div class="content">
+            <p><i class="fa fa-exclamation-circle"></i>抱歉,暂时无法与卖家在线沟通!</p>
+            <p>卖家联系电话:<span ng-bind="currentSeek.qutations[linkBoxIndex].userTel"></span></p>
+            <div>
+                <a ng-click="setLinkBoxIndex(-1)">我知道了</a>
+            </div>
+        </div>
+    </div>-->
+    <div class="com-mall-del-box link-saler-box" ng-if="showCurrentRefuseOffer">
+        <div class="title">
+            <i  ng-click="setShowCurrentRefuseOffer(false)"></i>
+        </div>
+        <div class="content">
+            <p><i class="fa fa-exclamation-circle"></i>拒绝报价原因:
+                <select class="select-adder" ng-model="choice">
+                    <option value="采购需求变更">采购需求变更</option>
+                    <option value="需进一步了解原因">需进一步了解原因</option>
+                    <option value="已选定合适供应商">已选定合适供应商</option>
+                    <option value="交期过长">交期过长</option>
+                </select>
+            </p>
+            <div>
+                <a ng-click="refuse(choice)">确定</a>
+                <a ng-click="setShowCurrentRefuseOffer(false)">关闭</a>
+            </div>
+        </div>
+    </div>
 </div>