Browse Source

处理公共询价移动端报价的bug

hejq 8 years ago
parent
commit
8b2d5ed42d

+ 11 - 0
pom.xml

@@ -26,6 +26,12 @@
             <artifactId>ps-entity</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>net.sf.json-lib</groupId>
+            <artifactId>json-lib</artifactId>
+            <classifier>jdk15</classifier>
+        </dependency>
+
         <!-- spring boot -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -63,6 +69,11 @@
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>RELEASE</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 2 - 2
src/main/java/com/uas/ps/inquiry/controller/InquiryForSaleController.java

@@ -139,8 +139,8 @@ public class InquiryForSaleController {
      * @return
      */
     @RequestMapping(value = "/mobile/quote", method = RequestMethod.POST)
-    public ModelMap quote(Long inquiryItemId, Long enuu, Long useruu, Long leadtime, Double minPackQty, Double minOrderQty, String replies) throws Exception {
+    public ModelMap quote(Long inquiryItemId, Long en_uu, Long useruu, Long leadtime, Double minPackQty, Double minOrderQty, String replies) throws Exception {
         List<PublicInquiryReply> replyList = JSONObject.parseArray(replies, PublicInquiryReply.class);
-        return saleService.quoteInquiry(inquiryItemId, enuu, useruu, replyList, leadtime, minPackQty, minOrderQty);
+        return saleService.quoteInquiry(inquiryItemId, en_uu, useruu, replyList, leadtime, minPackQty, minOrderQty);
     }
 }

+ 1 - 1
src/main/java/com/uas/ps/inquiry/dao/PublicInquiryItemDao.java

@@ -29,7 +29,7 @@ public interface PublicInquiryItemDao extends JpaRepository<PublicInquiryItem, L
      * @date 2018-01-14 11:49
      * @return
      */
-    @Query("from PublicInquiryItem d where d.inquiry.enUU = :enUU and d.backStatus = :backStatus and nvl(d.sourceApp, ' ') <> 'B2B'")
+    @Query("from PublicInquiryItem d where d.inquiry.enUU = :enUU and d.backStatus = :backStatus and ifnull(d.sourceApp, ' ') <> 'B2B'")
     List<PublicInquiryItem> findByEnUUAndBackStatus(@Param("enUU") Long enUU, @Param("backStatus") short backStatus);
 
     /**

+ 119 - 7
src/main/java/com/uas/ps/inquiry/entity/MessageModel.java

@@ -3,7 +3,7 @@ package com.uas.ps.inquiry.entity;
 /**
  * 消息
  */
-public class MessageModel {
+public class MessageModel{
     /**
      * 消息类型
      */
@@ -13,23 +13,39 @@ public class MessageModel {
      */
     private String content;
     /**
-     * 消息接受者json信息
+     * 消息接收者uu
      */
-    private String receiver;
+    private Long receiverUu;
     /**
-     * 消息发送者json信息
+     * 消息接收者企业uu
      */
-    private String sender;
+    private Long receiverEnuu;
     /**
-     * 来源应用id
+     * 消息发送者
+     */
+    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;
     /**
@@ -44,4 +60,100 @@ public class MessageModel {
      * 接收应用(以","拼接应用名称)
      */
     private String consumerApp;
+
+    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;
+    }
 }

+ 13 - 1
src/main/java/com/uas/ps/inquiry/model/PublicInquiry.java

@@ -366,7 +366,19 @@ public class PublicInquiry implements Serializable {
 	public PublicInquiry(PurcInquiryInfo inquiry) {
         this.check = inquiry.getCheck();
         this.auditor = inquiry.getAuditor();
-        this.attachs = inquiry.getAttachs();
+        if (null != inquiry.getAttachs()) {
+        	Set<Attach> attachSet = new HashSet<Attach>();
+        	Attach attach = new Attach();
+        	for (Attach att : inquiry.getAttachs()) {
+        		attach.setDate(att.getDate());
+        		attach.setDescription(att.getDescription());
+        		attach.setName(att.getName());
+        		attach.setPath(att.getPath());
+        		attach.setSize(att.getSize());
+        		attachSet.add(attach);
+			}
+			this.attachs = attachSet;
+		}
         this.code = inquiry.getCode();
         this.date = inquiry.getDate();
         this.endDate = inquiry.getEndDate();

+ 13 - 13
src/main/java/com/uas/ps/inquiry/service/impl/InquiryForSaleServiceImpl.java

@@ -255,19 +255,19 @@ public class InquiryForSaleServiceImpl implements InquiryForSaleService {
         // 先判断客户询价单是否存在这张单据
         if (CollectionUtils.isEmpty(saleInquiries)) {
             inquiry = new PublicInquiry(item.getInquiry());
-                inquiry = inquiryDao.save(inquiry);
-                inquiryItem.setVendUU(enuu);
-                inquiryItem.setVendUserUU(useruu);
-                Enterprise enterprise = enterpriseDao.findOne(enuu);
-                inquiryItem.setVendName(enterprise.getEnName());
-                inquiryItem.setBusinessCode(enterprise.getBusinesscode());
-                inquiryItem = SaveInquiryItems(inquiry, inquiryItem);
-                if (null != inquiryItem.getId()) {
-                    map.put("content", inquiryItem.getId());
-                } else {
-                    map.put("content", false);
-                }
-                return map;
+            inquiry = inquiryDao.save(inquiry);
+            inquiryItem.setVendUU(enuu);
+            inquiryItem.setVendUserUU(useruu);
+            Enterprise enterprise = enterpriseDao.findOne(enuu);
+            inquiryItem.setVendName(enterprise.getEnName());
+            inquiryItem.setBusinessCode(enterprise.getBusinesscode());
+            inquiryItem = SaveInquiryItems(inquiry, inquiryItem);
+            if (null != inquiryItem.getId()) {
+                map.put("content", inquiryItem.getId());
+            } else {
+                map.put("content", false);
+            }
+            return map;
         } else {// 插入
             inquiry = saleInquiries.get(0);
             PublicInquiryItem purcItem = infoDao.findByVendUUAndSourceId(inquiryItem.getVendUU(), inquiryItem.getSourceId());

+ 8 - 2
src/main/java/com/uas/ps/inquiry/service/impl/PublicInquiryServiceImpl.java

@@ -129,7 +129,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      */
     private void notify(List<PurcInquiryItem> inquiryItems) {
         for (PurcInquiryItem item : inquiryItems) {
-            String url = "http:// 192.168.253.102:8080/productuser/getProductUsersByEnUUAndCmpCode";
+            String url = "http://192.168.253.12:24000/productuser/getProductUsersByEnUUAndCmpCode";
             JSONObject formData = new JSONObject();
             formData.put("enUU", item.getInquiry().getEnUU());
             formData.put("cmpCode", item.getCmpCode());
@@ -145,7 +145,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
                                 u.setEnterprise(e);
                             }
                             MessageModel model = new MessageModel();
-                            // TODO 设置消息模板
+                            model.setConsumerApp("PublicInquiry");
+                            model.setContent("发布公共询价信息,邀请您参与报价");
+                            model.setReceiverEnuu(user.getEnuu());
+                            model.setReceiverUu(u.getUserUU());
+                            model.setSenderEnuu(item.getInquiry().getEnUU());
+                            model.setSenderUu(item.getUserUU());
+                            HttpUtil.doPost("http://192.168.253.131:8080", FlexJsonUtils.toJson(model));
                         }
                     }
                 }