Sfoglia il codice sorgente

报价时替代料赋值错误处理

dongbw 7 anni fa
parent
commit
b03707a44e

+ 76 - 74
src/main/java/com/uas/ps/inquiry/controller/InquiryForBuyerController.java

@@ -37,79 +37,6 @@ public class InquiryForBuyerController {
 
     private final static Logger log = Logger.getLogger(Logger.class);
 
-    /**
-     * 作为买家,保存更新公共询价单
-     *
-     * @param inquiry 询价信息
-     * @return
-     */
-    @HttpLog
-    @RequestMapping(value = "/save", method = RequestMethod.POST)
-    public String saveInquiry(@RequestBody PurcInquiry inquiry) throws Exception {
-        long start = System.currentTimeMillis();
-        inquiry = inquiryService.saveInquiry(inquiry);
-        log.info("/inquiry/buyer/save post 耗时:" + (System.currentTimeMillis() - start));
-        if (null != inquiry.getId()) {
-            logger.log("公共询价", "新增公共询价信息", "单号: " + inquiry.getCode() + "生成id: " + inquiry.getId(), inquiry.getRecorderUU(), inquiry.getEnUU(), InquirySource.PLAIN.name());
-            return JSONObject.toJSONString(inquiry);
-        } else {
-            logger.log("公共询价", "新增公共询价信息失败", "单号: " + inquiry.getCode(), inquiry.getRecorderUU(), inquiry.getEnUU(), InquirySource.PLAIN.name());
-            throw new Exception("保存失败");
-        }
-    }
-
-    /**
-     * 通过明细id对供应商报价进行审核操作
-     *
-     * @param id 报价明细id
-     * @param status 状态
-     * @return
-     * @throws Exception
-     */
-    @HttpLog
-    @RequestMapping(value = "/decide", method = RequestMethod.POST)
-    public void decideQuote(Long id, Short status, Long enuu, Long useruu) throws Exception {
-        logger.log("公共询价", "通过明细id对供应商报价进行审核操作", "id: " + id + ",采纳状态: " + status, useruu, enuu, InquirySource.PLAIN.name());
-        long start = System.currentTimeMillis();
-        inquiryService.decideQuote(id, status);
-        log.info("/inquiry/buyer/decide post 耗时:" + (System.currentTimeMillis() - start));
-    }
-
-    /**
-     * 通过明细id采纳供应商报价
-     *
-     * @param id 报价明细id
-     * @param status 状态
-     * @return
-     * @throws Exception
-     */
-    @HttpLog
-    @RequestMapping(value = "/adopt", method = RequestMethod.POST)
-    public void adoptQuote(Long id, Short status, Long enuu, Long useruu) throws Exception {
-        logger.log("公共询价", "通过明细id采纳供应商报价", "id: " + id + ",采纳状态: " + status, useruu, enuu, InquirySource.PLAIN.name());
-        long start = System.currentTimeMillis();
-        inquiryService.adpotQuote(id, status);
-        log.info("/inquiry/buyer/adopt post 耗时:" + (System.currentTimeMillis() - start));
-    }
-
-
-    /**
-     * 通过明细id拒绝供应商报价
-     *
-     * @param id 报价明细id
-     * @param status 状态
-     * @return
-     * @throws Exception
-     */
-    @HttpLog
-    @RequestMapping(value = "/refuse", method = RequestMethod.POST)
-    public void refuseQuote(Long id, Short status, Long enuu, Long useruu,String refusereason) throws Exception {
-        logger.log("公共询价", "通过明细id拒绝供应商报价", "id: " + id + ",采纳状态: " + status, useruu, enuu, InquirySource.PLAIN.name());
-        long start = System.currentTimeMillis();
-        inquiryService.refuseQuote(id, status,refusereason);
-        log.info("/inquiry/buyer/refuse post 耗时:" + (System.currentTimeMillis() - start));
-    }
-
     /**
      * 客户查询供应商报价详情
      *
@@ -199,7 +126,7 @@ public class InquiryForBuyerController {
         return page;
     }
 
-     /**
+    /**
      * 针对客户单个公共询价,查询供应商报价信息
      * @param id
      * @return
@@ -212,4 +139,79 @@ public class InquiryForBuyerController {
         log.info("/inquiry/buyer/quotation 耗时:" + (System.currentTimeMillis() - start));
         return itemInfo;
     }
+
+    /**
+     * 作为买家,保存更新公共询价单
+     *
+     * @param inquiry 询价信息
+     * @return
+     */
+    @HttpLog
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    public String saveInquiry(@RequestBody PurcInquiry inquiry) throws Exception {
+        long start = System.currentTimeMillis();
+        inquiry = inquiryService.saveInquiry(inquiry);
+        log.info("/inquiry/buyer/save post 耗时:" + (System.currentTimeMillis() - start));
+        if (null != inquiry.getId()) {
+            logger.log("公共询价", "新增公共询价信息", "单号: " + inquiry.getCode() + "生成id: " + inquiry.getId(), inquiry.getRecorderUU(), inquiry.getEnUU(), InquirySource.PLAIN.name());
+            return JSONObject.toJSONString(inquiry);
+        } else {
+            logger.log("公共询价", "新增公共询价信息失败", "单号: " + inquiry.getCode(), inquiry.getRecorderUU(), inquiry.getEnUU(), InquirySource.PLAIN.name());
+            throw new Exception("保存失败");
+        }
+    }
+
+    /**
+     * 通过明细id对供应商报价进行审核操作
+     *
+     * @param id 报价明细id
+     * @param status 状态
+     * @return
+     * @throws Exception
+     */
+    @HttpLog
+    @RequestMapping(value = "/decide", method = RequestMethod.POST)
+    public void decideQuote(Long id, Short status, Long enuu, Long useruu) throws Exception {
+        logger.log("公共询价", "通过明细id对供应商报价进行审核操作", "id: " + id + ",采纳状态: " + status, useruu, enuu, InquirySource.PLAIN.name());
+        long start = System.currentTimeMillis();
+        inquiryService.decideQuote(id, status);
+        log.info("/inquiry/buyer/decide post 耗时:" + (System.currentTimeMillis() - start));
+    }
+
+    /**
+     * 通过明细id采纳供应商报价
+     *
+     * @param id 报价明细id
+     * @param status 状态
+     * @return
+     * @throws Exception
+     */
+    @HttpLog
+    @RequestMapping(value = "/adopt", method = RequestMethod.POST)
+    public void adoptQuote(Long id, Short status, Long enuu, Long useruu) throws Exception {
+        logger.log("公共询价", "通过明细id采纳供应商报价", "id: " + id + ",采纳状态: " + status, useruu, enuu, InquirySource.PLAIN.name());
+        long start = System.currentTimeMillis();
+        inquiryService.adpotQuote(id, status);
+        log.info("/inquiry/buyer/adopt post 耗时:" + (System.currentTimeMillis() - start));
+    }
+
+
+    /**
+     * 通过明细id拒绝供应商报价
+     *
+     * @param id 报价明细id
+     * @param status 状态
+     * @return
+     * @throws Exception
+     */
+    @HttpLog
+    @RequestMapping(value = "/refuse", method = RequestMethod.POST)
+    public void refuseQuote(Long id, Short status, Long enuu, Long useruu,String refusereason) throws Exception {
+        logger.log("公共询价", "通过明细id拒绝供应商报价", "id: " + id + ",采纳状态: " + status, useruu, enuu, InquirySource.PLAIN.name());
+        long start = System.currentTimeMillis();
+        inquiryService.refuseQuote(id, status,refusereason);
+        log.info("/inquiry/buyer/refuse post 耗时:" + (System.currentTimeMillis() - start));
+    }
+
+
 }

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

@@ -8,12 +8,7 @@ import com.uas.ps.httplog.annotation.HttpLog;
 import com.uas.ps.inquiry.domain.IPage;
 import com.uas.ps.inquiry.entity.Constant;
 import com.uas.ps.inquiry.entity.InquirySource;
-import com.uas.ps.inquiry.model.Attach;
-import com.uas.ps.inquiry.model.InquiryEnRemind;
-import com.uas.ps.inquiry.model.InquiryRemind;
-import com.uas.ps.inquiry.model.PublicInquiry;
-import com.uas.ps.inquiry.model.PublicInquiryItem;
-import com.uas.ps.inquiry.model.PublicInquiryReply;
+import com.uas.ps.inquiry.model.*;
 import com.uas.ps.inquiry.page.PageInfo;
 import com.uas.ps.inquiry.page.SearchFilter;
 import com.uas.ps.inquiry.service.InquiryForSaleService;
@@ -49,6 +44,31 @@ public class InquiryForSaleController {
 
     private final static Logger log = Logger.getLogger(Logger.class);
 
+    /**
+     * 保存报价接口
+     *
+     * 后续统一使用
+     * @param publicInquiryItem 报价单内容
+     * @return
+     * @throws Exception
+     */
+    @HttpLog
+    @RequestMapping(value = "/item/saveQuote", method = RequestMethod.POST)
+    public ModelMap saveQuote(@RequestBody PublicInquiryItem publicInquiryItem) throws Exception {
+        Long start = System.currentTimeMillis();
+        ModelMap result = saleService.saveQuote(publicInquiryItem);
+        log.info("/inquiry/sale/item/saveQuote post 耗时:" + (System.currentTimeMillis() - start));
+        publicInquiryService.ReceiveMessage(publicInquiryItem, InquirySource.MALL.name());
+//        if (null != item) {
+//            PublicInquiry inquiry = item.getInquiry();
+//            inquiry.setQuteId(item.getId());
+//            return JSON.toJSONString(inquiry);
+//        } else {
+//            throw new Exception("保存失败");
+//        }
+        return result;
+    }
+
     /**
      * 通过ID查询报价详情
      *
@@ -102,77 +122,6 @@ public class InquiryForSaleController {
         }
     }
 
-    /**
-     * 作为卖家,新增报价
-     *
-     * @param item 前台数据
-     * @return
-     */
-    @Deprecated
-    @HttpLog
-    @RequestMapping(value = "/item/add", method = RequestMethod.POST)
-    public String saveInquiryItem(@RequestBody PublicInquiryItem item) throws Exception {
-        long start = System.currentTimeMillis();
-        item = saleService.add(item);
-        log.info("/inquiry/sale/item/add post 耗时:" + (System.currentTimeMillis() - start));
-        if (null != item.getId()) {
-            return JSONObject.toJSONString(item);
-        } else {
-            throw new Exception("保存失败");
-        }
-    }
-
-    /**
-     * 作为卖家,保存更新公共询价单
-     *
-     * @param item 前台数据
-     * @return
-     *   报价后续统一调用  /item/saveQuote 2018年7月10日 之后不在维护
-     */
-    @Deprecated
-    @HttpLog
-    @RequestMapping(value = "/item/save", method = RequestMethod.POST)
-    public String saveInquiryItems(@RequestBody PublicInquiryItem item) throws Exception {
-        long start = System.currentTimeMillis();
-        item = saleService.saveItem(item);
-        log.info("/inquiry/sale/item/save post 耗时:" + (System.currentTimeMillis() - start));
-        logger.log("公共询价", "作为卖家,对公共询价进行报价操作", "sourceid: " + item.getSourceId() == null ? null : item.getSourceId() + ", id" + item.getId(),
-                item.getVendUserUU(), item.getVendUU(), item.getQutoApp());
-        publicInquiryService.ReceiveMessage(item,InquirySource.MALL.name());
-        if (null != item) {
-            PublicInquiry inquiry = item.getInquiry();
-            inquiry.setQuteId(item.getId());
-            return JSON.toJSONString(inquiry);
-        } else {
-            throw new Exception("保存失败");
-        }
-    }
-
-    /**
-     * 保存报价接口
-     *
-     * 后续统一使用
-     * @param publicInquiryItem 报价单内容
-     * @return
-     * @throws Exception
-     */
-    @HttpLog
-    @RequestMapping(value = "/item/saveQuote", method = RequestMethod.POST)
-    public ModelMap saveQuote(@RequestBody PublicInquiryItem publicInquiryItem) throws Exception {
-        Long start = System.currentTimeMillis();
-        ModelMap result = saleService.saveQuote(publicInquiryItem);
-        log.info("/inquiry/sale/item/saveQuote post 耗时:" + (System.currentTimeMillis() - start));
-        publicInquiryService.ReceiveMessage(publicInquiryItem, InquirySource.MALL.name());
-//        if (null != item) {
-//            PublicInquiry inquiry = item.getInquiry();
-//            inquiry.setQuteId(item.getId());
-//            return JSON.toJSONString(inquiry);
-//        } else {
-//            throw new Exception("保存失败");
-//        }
-        return result;
-    }
-
     /**
      * 保存询价信息
      *
@@ -208,33 +157,6 @@ public class InquiryForSaleController {
         return item;
     }
 
-    /**
-     * 移动端转报价的功能
-     *                        2018年7月10日 15:24:55 之后app报价将调用统一报价接口 /inquiry/sale/item/saveQuote
-     * @param inquiryItemId 公共询价明细id
-     * @param en_uu 报价企业UU号
-     * @param replies 报价信息
-     * @param leadtime 交货周期
-     * @param minOrderQty 最小订购
-     * @param minPackQty 最小包装
-     * @return
-     */
-    @Deprecated
-    @HttpLog
-    @RequestMapping(value = "/mobile/quote", method = RequestMethod.POST)
-    public ModelMap quote(Long inquiryItemId, Long en_uu, Long useruu, Long leadtime, Double minPackQty, Double minOrderQty, String replies, String currency, Float taxrate) throws Exception {
-        long start = System.currentTimeMillis();
-        if (StringUtils.isEmpty(en_uu) || StringUtils.isEmpty(useruu)) {
-            throw new IllegalOperatorException("en_uu或useruu不能为空");
-        }
-        List<PublicInquiryReply> replyList = JSONObject.parseArray(replies, PublicInquiryReply.class);
-        logger.log("公共询价", "作为卖家,对公共询价进行报价操作", "sourceid: " + inquiryItemId,
-                useruu, en_uu, InquirySource.UU.name());
-        ModelMap map = saleService.quoteInquiry(inquiryItemId, en_uu, useruu, replyList, leadtime, minPackQty, minOrderQty, currency, taxrate);
-        log.info("/inquiry/sale/mobile/quote post 耗时:" + (System.currentTimeMillis() - start));
-        return map;
-    }
-
     /**
      * 通过用户信息查询推荐的询价列表
      *
@@ -314,4 +236,76 @@ public class InquiryForSaleController {
         return map;
     }
 
+    /**
+     * 移动端转报价的功能
+     *                        2018年7月10日 15:24:55 之后app报价将调用统一报价接口 /inquiry/sale/item/saveQuote
+     * @param inquiryItemId 公共询价明细id
+     * @param en_uu 报价企业UU号
+     * @param replies 报价信息
+     * @param leadtime 交货周期
+     * @param minOrderQty 最小订购
+     * @param minPackQty 最小包装
+     * @return
+     */
+    @Deprecated
+    @HttpLog
+    @RequestMapping(value = "/mobile/quote", method = RequestMethod.POST)
+    public ModelMap quote(Long inquiryItemId, Long en_uu, Long useruu, Long leadtime, Double minPackQty, Double minOrderQty, String replies, String currency, Float taxrate) throws Exception {
+        long start = System.currentTimeMillis();
+        if (StringUtils.isEmpty(en_uu) || StringUtils.isEmpty(useruu)) {
+            throw new IllegalOperatorException("en_uu或useruu不能为空");
+        }
+        List<PublicInquiryReply> replyList = JSONObject.parseArray(replies, PublicInquiryReply.class);
+        logger.log("公共询价", "作为卖家,对公共询价进行报价操作", "sourceid: " + inquiryItemId,
+                useruu, en_uu, InquirySource.UU.name());
+        ModelMap map = saleService.quoteInquiry(inquiryItemId, en_uu, useruu, replyList, leadtime, minPackQty, minOrderQty, currency, taxrate);
+        log.info("/inquiry/sale/mobile/quote post 耗时:" + (System.currentTimeMillis() - start));
+        return map;
+    }
+
+    /**
+     * 作为卖家,新增报价
+     *
+     * @param item 前台数据
+     * @return
+     */
+    @Deprecated
+    @HttpLog
+    @RequestMapping(value = "/item/add", method = RequestMethod.POST)
+    public String saveInquiryItem(@RequestBody PublicInquiryItem item) throws Exception {
+        long start = System.currentTimeMillis();
+        item = saleService.add(item);
+        log.info("/inquiry/sale/item/add post 耗时:" + (System.currentTimeMillis() - start));
+        if (null != item.getId()) {
+            return JSONObject.toJSONString(item);
+        } else {
+            throw new Exception("保存失败");
+        }
+    }
+
+    /**
+     * 作为卖家,保存更新公共询价单
+     *
+     * @param item 前台数据
+     * @return
+     *   报价后续统一调用  /item/saveQuote 2018年7月10日 之后不在维护
+     */
+    @Deprecated
+    @HttpLog
+    @RequestMapping(value = "/item/save", method = RequestMethod.POST)
+    public String saveInquiryItems(@RequestBody PublicInquiryItem item) throws Exception {
+        long start = System.currentTimeMillis();
+        item = saleService.saveItem(item);
+        log.info("/inquiry/sale/item/save post 耗时:" + (System.currentTimeMillis() - start));
+        logger.log("公共询价", "作为卖家,对公共询价进行报价操作", "sourceid: " + item.getSourceId() == null ? null : item.getSourceId() + ", id" + item.getId(),
+                item.getVendUserUU(), item.getVendUU(), item.getQutoApp());
+        publicInquiryService.ReceiveMessage(item,InquirySource.MALL.name());
+        if (null != item) {
+            PublicInquiry inquiry = item.getInquiry();
+            inquiry.setQuteId(item.getId());
+            return JSON.toJSONString(inquiry);
+        } else {
+            throw new Exception("保存失败");
+        }
+    }
 }

+ 19 - 18
src/main/java/com/uas/ps/inquiry/controller/PublicInquiryController.java

@@ -55,24 +55,6 @@ public class PublicInquiryController {
 
     private final static Logger log = Logger.getLogger(Logger.class);
 
-    /**
-     * 将客户的公共询价列表中一条数据转成询价报价单数据
-     *
-     * @param id     公共询价明细id
-     * @param enuu   报价企业UU
-     * @param useruu 报价个人UU
-     * @return
-     * @author hejq
-     * @date 2018-01-14 15:20
-     */
-    @HttpLog
-    @RequestMapping(value = "/turntoInquiry", method = RequestMethod.POST)
-    private ModelMap transtoInquiry(Long id, Long enuu, Long useruu) {
-        long start = System.currentTimeMillis();
-        ModelMap map = publicInquiryService.transtoInquiry(id, enuu, useruu);
-        log.info("/inquiry/public/turntoInquiry post 耗时:" + (System.currentTimeMillis() - start));
-        return map;
-    }
 
     /**
      * 通过分页参数和过滤条件查询公共询价列表信息
@@ -210,6 +192,25 @@ public class PublicInquiryController {
         return messages;
     }
 
+    /**
+     * 将客户的公共询价列表中一条数据转成询价报价单数据
+     *
+     * @param id     公共询价明细id
+     * @param enuu   报价企业UU
+     * @param useruu 报价个人UU
+     * @return
+     * @author hejq
+     * @date 2018-01-14 15:20
+     */
+    @HttpLog
+    @RequestMapping(value = "/turntoInquiry", method = RequestMethod.POST)
+    private ModelMap transtoInquiry(Long id, Long enuu, Long useruu) {
+        long start = System.currentTimeMillis();
+        ModelMap map = publicInquiryService.transtoInquiry(id, enuu, useruu);
+        log.info("/inquiry/public/turntoInquiry post 耗时:" + (System.currentTimeMillis() - start));
+        return map;
+    }
+
     /**
      * 获取附件信息
      *

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

@@ -758,8 +758,8 @@ public class InquiryForSaleServiceImpl implements InquiryForSaleService {
         inquiryItem.setVendUU(publicInquiryItem.getVendUU());
         inquiryItem.setVendUserUU(publicInquiryItem.getVendUserUU());
         inquiryItem.setReplaceCmpCode(publicInquiryItem.getReplaceCmpCode());
-        inquiryItem.setReplaceBrand(publicInquiryItem.getReplaceCmpCode());
-        inquiryItem.setReplaceSpec(publicInquiryItem.getReplaceCmpCode());
+        inquiryItem.setReplaceBrand(publicInquiryItem.getReplaceBrand());
+        inquiryItem.setReplaceSpec(publicInquiryItem.getReplaceSpec());
         inquiryItem.setIsReplace(publicInquiryItem.getIsReplace());
         if (CollectionUtils.isEmpty(saleInquiries)) {
             // 附件
@@ -799,6 +799,7 @@ public class InquiryForSaleServiceImpl implements InquiryForSaleService {
             result.put("content", inquiryItem);
             return result;
         } catch (Exception e) {
+            e.printStackTrace();
             result.put("message", e.getMessage());
             return result;
         }