Browse Source

select语句更新

Hu Jie 8 years ago
parent
commit
9dd9d03678
45 changed files with 681 additions and 612 deletions
  1. 6 6
      pom.xml
  2. 1 31
      src/main/java/com/uas/platform/b2b/controller/BaseInfoController.java
  3. 0 45
      src/main/java/com/uas/platform/b2b/controller/ProductUserBatchController.java
  4. 0 78
      src/main/java/com/uas/platform/b2b/erp/controller/ErpVendorRecommendController.java
  5. 9 9
      src/main/java/com/uas/platform/b2b/erp/controller/VendorRecommendController.java
  6. 3 12
      src/main/java/com/uas/platform/b2b/erp/model/PurchaseTenderErp.java
  7. 1 1
      src/main/java/com/uas/platform/b2b/erp/model/SaleTenderErp.java
  8. 1 1
      src/main/java/com/uas/platform/b2b/mobile/service/impl/MobileTaskServiceImpl.java
  9. 12 12
      src/main/java/com/uas/platform/b2b/mobile/service/impl/WorkScheduleServiceImpl.java
  10. 20 18
      src/main/java/com/uas/platform/b2b/model/MakeAcceptItem.java
  11. 1 15
      src/main/java/com/uas/platform/b2b/model/MakeReturnItem.java
  12. 1 1
      src/main/java/com/uas/platform/b2b/model/Product.java
  13. 1 1
      src/main/java/com/uas/platform/b2b/model/PublicInquiryInfo.java
  14. 1 1
      src/main/java/com/uas/platform/b2b/model/PublicInquiryItemInfo.java
  15. 19 17
      src/main/java/com/uas/platform/b2b/model/PurchaseBadOutItem.java
  16. 1 1
      src/main/java/com/uas/platform/b2b/model/PurchaseInquiry.java
  17. 1 1
      src/main/java/com/uas/platform/b2b/model/PurchaseInquiryMould.java
  18. 1 1
      src/main/java/com/uas/platform/b2b/model/PurchaseTender.java
  19. 1 1
      src/main/java/com/uas/platform/b2b/model/SaleQuotation.java
  20. 1 1
      src/main/java/com/uas/platform/b2b/model/SaleQuotationAll.java
  21. 7 5
      src/main/java/com/uas/platform/b2b/model/SaleQuotationDone.java
  22. 3 14
      src/main/java/com/uas/platform/b2b/model/SaleTender.java
  23. 1 1
      src/main/java/com/uas/platform/b2b/service/BaseInfoService.java
  24. 2 5
      src/main/java/com/uas/platform/b2b/service/VendorService.java
  25. 4 4
      src/main/java/com/uas/platform/b2b/service/impl/ApbillAdjustmentServiceImpl.java
  26. 18 2
      src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java
  27. 2 2
      src/main/java/com/uas/platform/b2b/service/impl/EnterpriseServiceImpl.java
  28. 1 1
      src/main/java/com/uas/platform/b2b/service/impl/PubInquiryServiceImpl.java
  29. 4 4
      src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java
  30. 1 1
      src/main/java/com/uas/platform/b2b/service/impl/PurchaseInquiryServiceImpl.java
  31. 1 1
      src/main/java/com/uas/platform/b2b/service/impl/PurchaseOrderServiceImpl.java
  32. 1 1
      src/main/java/com/uas/platform/b2b/service/impl/RoleServiceImpl.java
  33. 5 36
      src/main/java/com/uas/platform/b2b/service/impl/SaleQuotationServiceImpl.java
  34. 149 81
      src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java
  35. 3 9
      src/main/java/com/uas/platform/b2b/v2/controller/InviteRecordController.java
  36. 0 13
      src/main/java/com/uas/platform/b2b/v2/model/Invitation.java
  37. 15 40
      src/main/java/com/uas/platform/b2b/v2/service/impl/InviteRecordServiceImpl.java
  38. 351 69
      src/main/webapp/resources/js/index/app.js
  39. 1 5
      src/main/webapp/resources/js/index/services/BaseInfo.js
  40. 7 17
      src/main/webapp/resources/tpl/index/baseInfo/modal/quotation_modal.html
  41. 2 6
      src/main/webapp/resources/tpl/index/purc/pubInquiry.html
  42. 0 8
      src/main/webapp/resources/tpl/index/sale/inquiry.html
  43. 4 32
      src/main/webapp/resources/tpl/index/sale/pubinquiry.html
  44. 0 2
      src/main/webapp/resources/tpl/index/sale/pubinquiry_detail.html
  45. 18 0
      src/main/webapp/resources/tpl/index/sale/quotation_new.html

+ 6 - 6
pom.xml

@@ -9,6 +9,7 @@
         <groupId>com.uas.platform</groupId>
         <artifactId>platform</artifactId>
         <version>0.0.1-SNAPSHOT</version>
+        <relativePath>../platform</relativePath>
     </parent>
     <profiles>
         <profile>
@@ -19,7 +20,6 @@
                 <!-- static plugin -->
                 <static-path>static</static-path>
             </properties>
-
         </profile>
         <profile>
             <!-- 测试环境 -->
@@ -287,11 +287,11 @@
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
 
-        <!--<dependency>-->
-            <!--<groupId>com.uas.sso</groupId>-->
-            <!--<artifactId>sso-common</artifactId>-->
-            <!--<version>0.0.1-SNAPSHOT</version>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>com.uas.sso</groupId>
+            <artifactId>sso-common</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
 
         <dependency>
             <groupId>com.uas.ps</groupId>

+ 1 - 31
src/main/java/com/uas/platform/b2b/controller/BaseInfoController.java

@@ -481,37 +481,7 @@ public class BaseInfoController {
 	@ResponseBody
 	public SPage<UserSpaceDetail> getUserSpaceDetails(PageParams params, String keyword)
 			throws Exception {
-		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
-		pageParams.getFilters().put("searchstatus", Constant.YES);
-		// 排序条件
-		List<Sort> sortList = new ArrayList<>();
-		sortList.add(new Sort("status", false, Type.LONG, new Long(1)));
-		sortList.add(new Sort("id", true, Type.LONG, new Long(1)));
-		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
-		return baseInfoService.getUserSpaceDetails(pageParams, keyword);
-	}
-
-	/**
-	 * 顶部通过关键词查询账户中心的相关的企业信息
-	 *
-	 * @param keyword
-	 * @param params
-	 * @return
-	 * @throws Exception
-	 */
-	@RequestMapping(value = "/getUserSpaceDetails/done", method = RequestMethod.GET)
-	@ResponseBody
-	public SPage<UserSpaceDetail> getUserSpaceDetailsDone(PageParams params, String keyword)
-			throws Exception {
-		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
-		pageParams.getFilters().put("searchstatus", Constant.YES);
-		pageParams.getFilters().put("status", Status.ENABLED.value());
-		// 排序条件
-		List<Sort> sortList = new ArrayList<>();
-		sortList.add(new Sort("status", false, Type.LONG, new Long(1)));
-		sortList.add(new Sort("id", true, Type.LONG, new Long(1)));
-		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
-		return baseInfoService.getUserSpaceDetails(pageParams, keyword);
+		return baseInfoService.getUserSpaceDetails(params, keyword);
 	}
 	
 	/**

+ 0 - 45
src/main/java/com/uas/platform/b2b/controller/ProductUserBatchController.java

@@ -1,45 +0,0 @@
-package com.uas.platform.b2b.controller;
-
-import com.uas.platform.b2b.service.PurchaseInquiryService;
-import com.uas.platform.b2b.service.PurchaseOrderService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * Created by dongbw
- * 18/03/18 11:34.
- */
-@RestController
-@RequestMapping("/batch/covertouser")
-public class ProductUserBatchController {
-
-    @Autowired
-    private PurchaseInquiryService purchaseInquiryService;
-
-    @Autowired
-    private PurchaseOrderService purchaseOrderService;
-
-    /**
-     * 根据企业UU批量处理询价单明细中的物料转入供应商报价人个人物料
-     * @param enUU 采购方企业UU
-     */
-    @RequestMapping(value = "/inquiryItem", method = RequestMethod.GET)
-    public void coverInquiryItemProdToUser (Long enUU) throws Exception {
-        //TODO 添加不需要enUU的处理
-        System.out.println("进入接口");
-        purchaseInquiryService.coverInquiryItemProdToUser(enUU);
-    }
-
-    /**
-     * 根据企业UU批量处理采购单中的物料转入供应商报价人个人物料
-     * @param enUU 采购方企业UU
-     */
-    @RequestMapping(value = "/purchaseOrder", method = RequestMethod.GET)
-    public void coverPurchaseOrderItemProdToUser (Long enUU) throws Exception {
-        //TODO 添加不需要enUU的处理
-        System.out.println("进入接口");
-        purchaseOrderService.coverPurchaseOrderItemProdToUser(enUU);
-    }
-}

+ 0 - 78
src/main/java/com/uas/platform/b2b/erp/controller/ErpVendorRecommendController.java

@@ -1,78 +0,0 @@
-package com.uas.platform.b2b.erp.controller;
-
-import com.uas.account.support.Page;
-import com.uas.platform.b2b.erp.model.VendorRecommend;
-import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
-import com.uas.platform.b2b.model.Product;
-import com.uas.platform.b2b.service.VendorService;
-import com.uas.platform.b2b.support.SystemSession;
-import com.uas.platform.core.logging.BufferedLoggerManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * 供应商推荐 -- 2018年4月8日 21:57:40  因为UAS不能立刻同时发布,所以保留原接口
- * Created by dongbw
- * 18/01/18 14:00.
- */
-@RestController
-@RequestMapping("/erp/recommend")
-public class ErpVendorRecommendController {
-
-    @Autowired
-    private VendorService vendorService;
-
-    private final static ErpBufferedLogger logger = BufferedLoggerManager.getLogger(ErpBufferedLogger.class);
-
-    /**
-     * 获取当前企业推荐供应商
-     *
-     * @param productMatchCondition 物料模糊匹配条件
-     * @param enterpriseMatchCondition 企业搜索匹配条件
-     * @param page 页面
-     * @param size 每页条数
-     * @return
-     */
-    @RequestMapping(value = "/list", method = RequestMethod.GET)
-    public Page<VendorRecommend> getVendorRecommend (String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
-        Long enUU = SystemSession.getUser().getEnterprise().getUu();
-        Page<VendorRecommend> vendorRecommendPage = vendorService.getVendorRecommend(enUU, productMatchCondition, enterpriseMatchCondition, page, size);
-//        logger.log("供应商推荐","获取当前企业推荐供应商:" + enUU, vendorRecommendPage.getNumberOfElements());
-        return vendorRecommendPage;
-    }
-
-    /**
-     * 根据条件获取物料型号和品牌值对(UAS品牌和型号联想词接口)
-     *
-     * @param field 需要的字段名
-     * @param condition 物料模糊匹配条件
-     * @return 物料型号和品牌值对List
-     */
-    @RequestMapping(value = "/product/associate", method = RequestMethod.GET)
-    public List<Product> getProductAssociate (String field, String condition) {
-        List<Product> products = vendorService.getProductAssociate(field, condition);
-//        logger.log("供应商推荐","根据条件获取物料型号和品牌值对", products.size());
-        return products;
-    }
-
-    /**
-     * 获取推荐企业物料列表(匹配到的排前面)
-     * @param page 页数
-     * @param size 每页条数
-     * @param vendUU 推荐供应商企业UU
-     * @param productMatchCondition 列表的物料匹配搜索条件  不带where
-     * @param whereCondition where条件(product的筛选条件拼接) 不带where
-     * @return
-     */
-    @RequestMapping(value = "/detail", method = RequestMethod.GET)
-    public Page<Product> getVendorRecommendDetail(int page, int size, Long vendUU, String productMatchCondition, String whereCondition) {
-        Long enUU = SystemSession.getUser().getEnterprise().getUu();
-        Page<Product> productPage = vendorService.getProductsByVendorRecommend(page, size, enUU, vendUU, productMatchCondition, whereCondition);
-//        logger.log("供应商推荐","获取当前企业推荐供应商:" + enUU, productPage.getNumberOfElements());
-        return productPage;
-    }
-}

+ 9 - 9
src/main/java/com/uas/platform/b2b/erp/controller/VendorRecommendController.java

@@ -5,6 +5,7 @@ import com.uas.platform.b2b.erp.model.VendorRecommend;
 import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
 import com.uas.platform.b2b.model.Product;
 import com.uas.platform.b2b.service.VendorService;
+import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,7 +20,7 @@ import java.util.List;
  * 18/01/18 14:00.
  */
 @RestController
-@RequestMapping("/public/recommend")
+@RequestMapping("/erp/recommend")
 public class VendorRecommendController {
 
     @Autowired
@@ -37,9 +38,9 @@ public class VendorRecommendController {
      * @return
      */
     @RequestMapping(value = "/list", method = RequestMethod.GET)
-    public Page<VendorRecommend> getVendorRecommend (Long enUU, String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
-        Page<VendorRecommend> vendorRecommendPage = vendorService.getVendorRecommend(enUU, productMatchCondition, enterpriseMatchCondition, page, size);
-//        logger.log("供应商推荐","获取当前企业推荐供应商:" + enUU, vendorRecommendPage.getNumberOfElements());
+    public Page<VendorRecommend> getVendorRecommend (String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
+        Page<VendorRecommend> vendorRecommendPage = vendorService.getVendorRecommend(productMatchCondition, enterpriseMatchCondition, page, size);
+        logger.log("供应商推荐","获取当前企业推荐供应商:" + SystemSession.getUser().getEnterprise().getUu(), vendorRecommendPage.getNumberOfElements());
         return vendorRecommendPage;
     }
 
@@ -53,7 +54,7 @@ public class VendorRecommendController {
     @RequestMapping(value = "/product/associate", method = RequestMethod.GET)
     public List<Product> getProductAssociate (String field, String condition) {
         List<Product> products = vendorService.getProductAssociate(field, condition);
-//        logger.log("供应商推荐","根据条件获取物料型号和品牌值对", products.size());
+        logger.log("供应商推荐","根据条件获取物料型号和品牌值对" + SystemSession.getUser().getEnterprise().getUu(), products.size());
         return products;
     }
 
@@ -61,16 +62,15 @@ public class VendorRecommendController {
      * 获取推荐企业物料列表(匹配到的排前面)
      * @param page 页数
      * @param size 每页条数
-     * @param enUU 当前企业UU
      * @param vendUU 推荐供应商企业UU
      * @param productMatchCondition 列表的物料匹配搜索条件  不带where
      * @param whereCondition where条件(product的筛选条件拼接) 不带where
      * @return
      */
     @RequestMapping(value = "/detail", method = RequestMethod.GET)
-    public Page<Product> getVendorRecommendDetail(int page, int size, Long enUU, Long vendUU, String productMatchCondition, String whereCondition) {
-        Page<Product> productPage = vendorService.getProductsByVendorRecommend(page, size, enUU, vendUU, productMatchCondition, whereCondition);
-//        logger.log("供应商推荐","获取当前企业推荐供应商:" + enUU, productPage.getNumberOfElements());
+    public Page<Product> getVendorRecommendDetail(int page, int size, Long vendUU, String productMatchCondition, String whereCondition) {
+        Page<Product> productPage = vendorService.getProductsByVendorRecommend(page, size, vendUU, productMatchCondition, whereCondition);
+        logger.log("供应商推荐","获取当前企业推荐供应商:" + SystemSession.getUser().getEnterprise().getUu(), productPage.getNumberOfElements());
         return productPage;
     }
 }

+ 3 - 12
src/main/java/com/uas/platform/b2b/erp/model/PurchaseTenderErp.java

@@ -3,17 +3,8 @@ package com.uas.platform.b2b.erp.model;
 import com.uas.platform.b2b.model.Attach;
 import com.uas.platform.b2b.model.Enterprise;
 
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
+import javax.persistence.*;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.Set;
 
@@ -22,7 +13,7 @@ import java.util.Set;
  * Created by dongbw on 17/03/07 11:16.
  */
 
-@Table(name = "purc$tender")
+@Table(name = "v$purc$tender")
 @Entity
 public class PurchaseTenderErp {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/erp/model/SaleTenderErp.java

@@ -13,7 +13,7 @@ import java.util.Set;
  * Created by dongbw on 17/03/07 11:16.
  */
 
-@Table(name = "sale$tender")
+@Table(name = "v$sale$tender")
 @Entity
 public class SaleTenderErp implements Serializable {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/mobile/service/impl/MobileTaskServiceImpl.java

@@ -129,7 +129,7 @@ public class MobileTaskServiceImpl implements MobileTaskService {
 			List<AppFlowOperation> lastProcess = commonDao
 					.query("select * from( select t.fop_caller caller, t.fop_dealname dealname, t.fop_dealtime dealtime from mobile$flowoperation t where t.fop_nodeenuu = "
 							+ enuu + " and t.fop_nodelevel = " + (nowProcess.get(0).getNodelevel() - 1)
-							+ " and t.fop_sourceid = " + nowProcess.get(0).getSourceid() + ")", AppFlowOperation.class);
+							+ " and t.fop_sourceid = " + nowProcess.get(0).getSourceid() + ") a", AppFlowOperation.class);
 			if (!CollectionUtils.isEmpty(lastProcess)) {
 				map.put("lastProcessTime", lastProcess.get(0).getDealtime());
 				if (nowProcess.get(0).getDealname() != null) {

+ 12 - 12
src/main/java/com/uas/platform/b2b/mobile/service/impl/WorkScheduleServiceImpl.java

@@ -58,7 +58,7 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
 					+ "d.opd_actdate mpd_actdate, d.opd_outdate mpd_outdate, d.opd_recorddate mpd_recorddate, d.opd_status mpd_status, d.opd_statuscode mpd_statuscode, "
 					+ "d.opd_distance mpd_distance, d.opd_longitude mpd_longitude, d.opd_latitude mpd_latitude, d.opd_company mpd_company, d.opd_firsttime mpd_firsttime, "
 					+ "d.opd_lasttime mpd_lasttime from mobile$outplandetail d where d.opd_opid = o.op_id and o.op_enuu = "
-					+ enuu + " and o.op_recordercode = " + emcode + " and to_char(d.opd_arrivedate,'yyyymm') = '" + date
+					+ enuu + " and o.op_recordercode = " + emcode + " and date_format(d.opd_arrivedate,'%Y%m') = '" + date
 					+ "')";
 			List<OutPlan> meOutPlans = commonDao.query(sql, OutPlan.class);
 			List<OutPlanInfo> planInfos = new ArrayList<OutPlanInfo>();
@@ -92,13 +92,13 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
 					+ "t.ta_doman doman, t.ta_domancode domancode, t.ta_startdate startdate, t.ta_enddate enddate, t.ta_status status, "
 					+ "t.ta_statuscode statuscode, t.ta_recorddate recorddate, t.ta_uu uu, t.ta_taskname taskname  from office$task t where "
 					+ "ta_uu = " + enuu + " and ta_domancode = " + emcode
-					+ " and  to_char(ta_startdate,'yyyymm') = '" + date + "'";
+					+ " and  date_format(ta_startdate,'%Y%m') = '" + date + "'";
 			// 录入人是自己而且是待确认的
 			String metaskSql = "select t.ta_id id, t.ta_code code, t.ta_detail detail, t.ta_recordercode recordercode, t.ta_recorder recorder, "
 					+ "t.ta_doman doman, t.ta_domancode domancode, t.ta_startdate startdate, t.ta_enddate enddate, t.ta_status status, "
 					+ "t.ta_statuscode statuscode, t.ta_recorddate recorddate, t.ta_uu uu, t.ta_taskname taskname  from office$task t where "
-					+ "ta_uu = " + enuu + " and ta_recordercode = " + emcode + "and ta_domancode <>" + emcode
-					+ " and ta_status = '待确认'" + " and  to_char(ta_startdate,'yyyymm') = '" + date + "'";
+					+ "ta_uu = " + enuu + " and ta_recordercode = " + emcode + " and ta_domancode <>" + emcode
+					+ " and ta_status = '待确认'" + " and  date_format(ta_startdate,'%Y%m') = '" + date + "'";
 			List<OfficeTask> task = commonDao.query(taskSql, OfficeTask.class);
 			List<OfficeTask> meTask = commonDao.query(metaskSql, OfficeTask.class);
 			task.addAll(meTask);
@@ -117,7 +117,7 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
 						+ "d.opd_actdate mpd_actdate, d.opd_outdate mpd_outdate, d.opd_recorddate mpd_recorddate, d.opd_status mpd_status, d.opd_statuscode mpd_statuscode, "
 						+ "d.opd_distance mpd_distance, d.opd_longitude mpd_longitude, d.opd_latitude mpd_latitude, d.opd_company mpd_company, d.opd_firsttime mpd_firsttime, "
 						+ "d.opd_lasttime mpd_lasttime from mobile$outplandetail d where d.opd_opid = o.op_id and o.op_enuu = "
-						+ enuu + " and to_char(d.opd_arrivedate,'yyyymm') = '" + date + "')";
+						+ enuu + " and date_format(d.opd_arrivedate,'%Y%m') = '" + date + "')";
 				List<OutPlan> outPlans = commonDao.query(outsql, OutPlan.class);
 				List<OutPlanInfo> othOutPlans = new ArrayList<OutPlanInfo>();
 				if (!CollectionUtils.isEmpty(outPlans)) {
@@ -150,7 +150,7 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
 				String othtaSql = "select o.ta_id id, o.ta_code code, o.ta_detail detail, o.ta_recordercode recordercode, "
 						+ "o.ta_recorder recorder, o.ta_doman doman, o.ta_domancode domancode, o.ta_startdate startdate, "
 						+ "o.ta_enddate enddate,o.ta_status status, o.ta_recorddate recorddate,o.ta_uu uu, o.ta_taskname taskname from office$task o where o.ta_uu = "
-						+ enuu + " and to_char(ta_startdate,'yyyymm') = '" + date + "'";
+						+ enuu + " and date_format(ta_startdate,'%Y%m') = '" + date + "'";
 				List<OfficeTask> tasks = commonDao.query(othtaSql, OfficeTask.class);
 				List<OfficeTask> othTasks = new ArrayList<OfficeTask>();
 				if (!CollectionUtils.isEmpty(tasks)) {
@@ -203,9 +203,9 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
 	public List<VisitRecord> getRecordsInOneMonth(Long emuu, Long enuu, String date) {
 		String sql = "select p.vr_detail vr_detail, p.vr_emname vr_emname, p.vr_id vr_id, p.vr_startdate vr_startdate, p.vr_cuaddress vr_cuaddress, "
 				+ "p.vr_title vr_title, p.vr_enddate vr_enddate, p.vr_cucontact vr_cucontact, p.vr_cuname vr_cuname, p.vr_date vr_date from mobile$visitrecord p where "
-				+ "vr_emuu = " + emuu + " and vr_enuu = " + enuu + "and (to_char(vr_startdate,'yyyymm') = '" + date
-				+ "' or ( vr_startdate is null and to_char(vr_enddate,'yyyymm') = '" + date
-				+ "') or (vr_startdate is null and vr_enddate is null and to_char(vr_date,'yyyymm') = '" + date + "'))";
+				+ "vr_emuu = " + emuu + " and vr_enuu = " + enuu + " and (date_format(vr_startdate,'%Y%m') = '" + date
+				+ "' or ( vr_startdate is null and date_format(vr_enddate,'%Y%m') = '" + date
+				+ "') or (vr_startdate is null and vr_enddate is null and date_format(vr_date,'%Y%m') = '" + date + "'))";
 		List<VisitRecord> records = commonDao.query(sql, VisitRecord.class);
 		return records;
 	}
@@ -214,9 +214,9 @@ public class WorkScheduleServiceImpl implements WorkScheduleService {
 	public List<VisitRecord> getRecordsInOneMonth(Long enuu, String date) {
 		String sql = "select p.vr_detail vr_detail, p.vr_emname vr_emname, p.vr_id vr_id, p.vr_startdate vr_startdate, p.vr_cuaddress vr_cuaddress, "
 				+ "p.vr_title vr_title, p.vr_enddate vr_enddate, p.vr_cucontact vr_cucontact, p.vr_cuname vr_cuname,  p.vr_date vr_date  from mobile$visitrecord p where "
-				+ "vr_enuu = " + enuu + "and (to_char(vr_startdate,'yyyymm') = '" + date
-				+ "' or ( vr_startdate is null and to_char(vr_enddate,'yyyymm') = '" + date
-				+ "') or (vr_startdate is null and vr_enddate is null and to_char(vr_date,'yyyymm') = '" + date + "'))";
+				+ "vr_enuu = " + enuu + "and (date_format(vr_startdate,'%Y%m') = '" + date
+				+ "' or ( vr_startdate is null and date_format(vr_enddate,'%Y%m') = '" + date
+				+ "') or (vr_startdate is null and vr_enddate is null and date_format(vr_date,'%Y%m') = '" + date + "'))";
 		List<VisitRecord> records = commonDao.query(sql, VisitRecord.class);
 		return records;
 	}

+ 20 - 18
src/main/java/com/uas/platform/b2b/model/MakeAcceptItem.java

@@ -1,10 +1,26 @@
 package com.uas.platform.b2b.model;
 
-import com.alibaba.fastjson.annotation.JSONField;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
 import org.codehaus.jackson.annotate.JsonIgnore;
 
-import javax.persistence.*;
-import java.util.*;
+import com.alibaba.fastjson.annotation.JSONField;
 
 /**
  * 买家委外验收明细
@@ -92,12 +108,6 @@ public class MakeAcceptItem {
 	@Column(name = "mai_erpdate")
 	private Date erpDate;
 
-    /**
-     * 本次对账数量
-     */
-	@Column(name = "mai_ycheckqty")
-    private Integer checkQty;
-
 	public Long getId() {
 		return id;
 	}
@@ -196,15 +206,7 @@ public class MakeAcceptItem {
 		this.erpDate = erpDate;
 	}
 
-    public Integer getCheckQty() {
-        return checkQty;
-    }
-
-    public void setCheckQty(Integer checkQty) {
-        this.checkQty = checkQty;
-    }
-
-    /**
+	/**
 	 * 将明细的重复数据去除
 	 * 
 	 * @param items

+ 1 - 15
src/main/java/com/uas/platform/b2b/model/MakeReturnItem.java

@@ -92,12 +92,6 @@ public class MakeReturnItem {
 	@Column(name = "mri_erpdate")
 	private Date erpDate;
 
-    /**
-     * 本次对账数量
-     */
-	@Column(name = "mri_ycheckqty")
-    private Integer checkQty;
-
 	public Long getId() {
 		return id;
 	}
@@ -196,15 +190,7 @@ public class MakeReturnItem {
 		this.erpDate = erpDate;
 	}
 
-    public Integer getCheckQty() {
-        return checkQty;
-    }
-
-    public void setCheckQty(Integer checkQty) {
-        this.checkQty = checkQty;
-    }
-
-    /**
+	/**
 	 * 将明细的重复数据去除
 	 * 
 	 * @param items

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/Product.java

@@ -26,7 +26,7 @@ import java.util.Set;
  *
  */
 @Entity
-@Table(name = "products", indexes = {@Index(name = "enuu_code_unique", columnList = "pr_enuu,pr_code", unique = true)})
+@Table(name = "v$products", indexes = {@Index(name = "enuu_code_unique", columnList = "pr_enuu,pr_code", unique = true)})
 @Logger
 public class Product {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/PublicInquiryInfo.java

@@ -15,7 +15,7 @@ import java.util.Set;
  *    </pre>
  * @author hejq 2018-01-06
  */
-@Table(name = "public$inquiry")
+@Table(name = "v$public$inquiry")
 @Entity
 public class PublicInquiryInfo implements Serializable {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/PublicInquiryItemInfo.java

@@ -16,7 +16,7 @@ import java.util.*;
  *
  * @author hejq 2018-01-06
  */
-@Table(name = "public$inquiryitems")
+@Table(name = "v$public$inquiryitems")
 @Entity
 public class PublicInquiryItemInfo implements Serializable {
 

+ 19 - 17
src/main/java/com/uas/platform/b2b/model/PurchaseBadOutItem.java

@@ -1,10 +1,26 @@
 package com.uas.platform.b2b.model;
 
-import com.alibaba.fastjson.annotation.JSONField;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
 import org.codehaus.jackson.annotate.JsonIgnore;
 
-import javax.persistence.*;
-import java.util.*;
+import com.alibaba.fastjson.annotation.JSONField;
 
 /**
  * 买家的不良品入库明细
@@ -88,12 +104,6 @@ public class PurchaseBadOutItem {
 	@Column(name = "poi_erpdate")
 	private Date erpDate;
 
-	/**
-	 * 本次对账数量
-	 */
-	@Column(name = "poi_ycheckqty")
-	private Integer checkQty;
-
 	public Long getId() {
 		return id;
 	}
@@ -192,14 +202,6 @@ public class PurchaseBadOutItem {
 		this.erpDate = erpDate;
 	}
 
-	public Integer getCheckQty() {
-		return checkQty;
-	}
-
-	public void setCheckQty(Integer checkQty) {
-		this.checkQty = checkQty;
-	}
-
 	public static List<PurchaseBadOut> distinct(List<PurchaseBadOutItem> items) {
 		List<PurchaseBadOut> accepts = new ArrayList<PurchaseBadOut>();
 		Set<Long> keys = new HashSet<Long>();

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/PurchaseInquiry.java

@@ -32,7 +32,7 @@ import java.util.Set;
  * @author yingp
  * 
  */
-@Table(name = "purc$inquiry", indexes = {@Index(name = "unique_enuu_code", columnList = "in_enuu,in_code", unique = true)})
+@Table(name = "v$purc$inquiry", indexes = {@Index(name = "unique_enuu_code", columnList = "in_enuu,in_code", unique = true)})
 @Entity
 public class PurchaseInquiry implements Serializable {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/PurchaseInquiryMould.java

@@ -20,7 +20,7 @@ import java.util.Set;
  *
  */
 
-@Table(name = "purc$inquirymould")
+@Table(name = "v$purc$inquirymould")
 @Entity
 public class PurchaseInquiryMould implements Serializable {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/PurchaseTender.java

@@ -11,7 +11,7 @@ import java.util.Set;
  * Created by dongbw on 17/03/07 11:16.
  */
 
-@Table(name = "purc$tender", indexes = {@Index(name= "unique_enuu_code", columnList = "pt_enuu,pt_code", unique = true)})
+@Table(name = "v$purc$tender", indexes = {@Index(name= "unique_enuu_code", columnList = "pt_enuu,pt_code", unique = true)})
 @Entity
 public class PurchaseTender implements Serializable {
     /**

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/SaleQuotation.java

@@ -30,7 +30,7 @@ import com.alibaba.fastjson.annotation.JSONField;
  * @author yingp
  * 
  */
-@Table(name = "sale$quotation")
+@Table(name = "v$sale$quotation")
 @Entity
 public class SaleQuotation implements Serializable {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/SaleQuotationAll.java

@@ -26,7 +26,7 @@ import javax.persistence.Table;
  * @author yingp
  * 
  */
-@Table(name = "sale$quotation")
+@Table(name = "v$sale$quotation")
 @Entity
 public class SaleQuotationAll implements Serializable {
 

+ 7 - 5
src/main/java/com/uas/platform/b2b/model/SaleQuotationDone.java

@@ -1,6 +1,8 @@
 package com.uas.platform.b2b.model;
 
-import org.hibernate.annotations.Where;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
 
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -13,10 +15,10 @@ import javax.persistence.JoinColumn;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
 import javax.persistence.OrderBy;
+import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Set;
+
+import org.hibernate.annotations.Where;
 
 /**
  * 平台里面,供应商发起的主动报价单<br>
@@ -26,7 +28,7 @@ import java.util.Set;
  * @author yingp
  *
  */
-@Table(name = "sale$quotation")
+@Table(name = "v$sale$quotation")
 @Where(clause = "(qu_status = 101 or qu_status = 311) and qu_agreed is null and qu_overdue = 0")
 @Entity
 public class SaleQuotationDone implements Serializable {

+ 3 - 14
src/main/java/com/uas/platform/b2b/model/SaleTender.java

@@ -1,22 +1,11 @@
 package com.uas.platform.b2b.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import com.uas.platform.b2b.erp.model.SaleTenderItemErp;
 import com.uas.platform.b2b.temporary.model.TenderContactInfo;
 import org.codehaus.jackson.annotate.JsonIgnore;
 
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.OrderBy;
-import javax.persistence.Table;
+import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Set;
@@ -28,7 +17,7 @@ import java.util.Set;
  * Created by dongbw on 17/03/07 11:16.
  */
 
-@Table(name = "sale$tender") // v$sale$tender_b2b
+@Table(name = "v$sale$tender_b2b")
 @Entity
 public class SaleTender implements Serializable, Comparable<SaleTender> {
 

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/BaseInfoService.java

@@ -98,7 +98,7 @@ public interface BaseInfoService {
 	 * @return
 	 * @throws Exception
 	 */
-	SPage<UserSpaceDetail> getUserSpaceDetails(com.uas.search.b2b.model.PageParams params, String keyword) throws Exception;
+	SPage<UserSpaceDetail> getUserSpaceDetails(PageParams params, String keyword) throws Exception;
 
 	/**
 	 * 通过id获取附件信息

+ 2 - 5
src/main/java/com/uas/platform/b2b/service/VendorService.java

@@ -124,7 +124,6 @@ public interface VendorService {
 	/**
 	 * 获取当前企业推荐供应商
 	 *
-     * @param enUU 当前企业UU
 	 * @param productMatchCondition 物料模糊匹配条件
 	 * @param enterpriseMatchCondition 企业搜索匹配条件
 	 * @param productCondition 物料精确匹配条件
@@ -132,7 +131,7 @@ public interface VendorService {
 	 * @param size 每页条数
 	 * @return
 	 */
-	com.uas.account.support.Page<VendorRecommend> getVendorRecommend(Long enUU, String productMatchCondition, String enterpriseMatchCondition, int page, int size);
+	com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String productMatchCondition, String enterpriseMatchCondition, int page, int size);
 
 	/**
 	 * 获取推荐企业物料列表(匹配到的排前面)
@@ -140,11 +139,9 @@ public interface VendorService {
 	 * @param size 每页条数
 	 * @param productMatchCondition 列表的物料匹配搜索条件
 	 * @param whereCondition where条件(product的筛选条件拼接)
-     * @param enUU 当前企业UU
-     * @param vendUU 供应商企业UU
 	 * @return
 	 */
-    com.uas.account.support.Page<Product> getProductsByVendorRecommend(int page, int size, Long enUU, Long vendUU, String productMatchCondition,  String whereCondition);
+    com.uas.account.support.Page<Product> getProductsByVendorRecommend(int page, int size, Long vendUU, String productMatchCondition,  String whereCondition);
 
 	/**
 	 * 根据条件获取物料型号和品牌值对

+ 4 - 4
src/main/java/com/uas/platform/b2b/service/impl/ApbillAdjustmentServiceImpl.java

@@ -94,14 +94,14 @@ public class ApbillAdjustmentServiceImpl implements ApbillAdjustmentService {
 			}
 		}
 		if (fromDate != null) {
-			querySql = querySql + " and t.aa_orderdate>=" + "to_date('"
+			querySql = querySql + " and t.aa_orderdate>=" + "str_to_date('"
 					+ new java.sql.Date(new Date(fromDate).getTime())
-					+ "','yyyy-mm-dd')";
+					+ "','%Y-%m-%d')";
 		}
 		if (endDate != null) {
-			querySql = querySql + " and t.aa_orderdate <=" + "to_date('"
+			querySql = querySql + " and t.aa_orderdate <=" + "str_to_date('"
 					+ new java.sql.Date(new Date(endDate).getTime())
-					+ "','yyyy-mm-dd')";
+					+ "','%Y-%m-%d')";
 		}
 		Object[] args = new Object[] { enuu };
 		if (!CollectionUtils.isEmpty(filter)) {

+ 18 - 2
src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java

@@ -497,6 +497,14 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 		}
 	}
 
+    /**
+     * 删除个人物料库的数据
+     * @param id
+     */
+    private void deleteUserProduct(Long id) {
+        commonDao.getJdbcTemplate().execute("delete product$users where pu_prid = " + id);
+    }
+
     @Override
 	public Vendor addCust(BasePartnersInfo partner) {
 		Enterprise enter = enterpriseDao.findEnterpriseByEnBussinessCode(partner.getVendUID());
@@ -549,8 +557,16 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 	}
 
 	@Override
-	public SPage<UserSpaceDetail> getUserSpaceDetails(com.uas.search.b2b.model.PageParams params, String keyword) throws Exception {
-		SPage<com.uas.account.entity.UserSpaceDetail> details = searchService.searchUserSpaceDetailCheckIds(keyword, params);
+	public SPage<UserSpaceDetail> getUserSpaceDetails(PageParams params, String keyword) throws Exception {
+		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
+		pageParams.getFilters().put("searchstatus", Constant.YES);
+		// 排序条件
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("status", false, Type.LONG, new Long(1)));
+		sortList.add(new Sort("id", true, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		SPage<com.uas.account.entity.UserSpaceDetail> details = searchService.searchUserSpaceDetailCheckIds(keyword,
+				pageParams);
 		SPage<UserSpaceDetail> userSpaceDetails = new SPage<UserSpaceDetail>();
 		List<UserSpaceDetail> spaceDetails = new ArrayList<UserSpaceDetail>();
 		if (!CollectionUtils.isEmpty(details.getContent())) {

+ 2 - 2
src/main/java/com/uas/platform/b2b/service/impl/EnterpriseServiceImpl.java

@@ -763,9 +763,9 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         int rn = pageSize * (pageNumber -1) + 1;
 	    int rownum = pageNumber * pageSize;
 		String sql = "select * from(" +
-                "select en_name name, en_uu uu, to_char(en_time, 'yyyy-mm-dd') registerdate from sec$enterprises " ;
+                "select en_name name, en_uu uu, date_format(en_time, '%Y-%m-%d') registerdate from sec$enterprises " ;
 	    if (!StringUtils.isEmpty(registerdate)) {
-	        sql = sql + "where to_char(en_time, 'yyyy-mm-dd') >= '" + registerdate + "' ";
+	        sql = sql + "where date_format(en_time, '%Y-%m-%d') >= '" + registerdate + "' ";
         }
         sql = sql + "order by en_time asc) a limit " + rn + " , " + (rownum-rn);
 		return commonDao.query(sql, EnterpriseNameAndUU.class);

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/PubInquiryServiceImpl.java

@@ -562,7 +562,7 @@ public class PubInquiryServiceImpl implements PubInquiryService {
     @Override
     public ModelMap refuseInquiry(Long id) throws Exception {
         ModelMap map = new ModelMap();
-        InquiryUtils.decide(id, Constant.NO);
+        InquiryUtils.decide(id, Constant.YES);
         map.put("success", "操作成功");
         return map;
     }

+ 4 - 4
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -554,12 +554,12 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
 			}
 		}
 		if (fromDate != null) {
-			sql = sql + " and PA_BEGINDATE>=" + "to_date('" + new java.sql.Date(new Date(fromDate).getTime())
-					+ "','yyyy-mm-dd')";
+			sql = sql + " and PA_BEGINDATE>=" + "str_to_date('" + new java.sql.Date(new Date(fromDate).getTime())
+					+ "','%Y-%m-%d')";
 		}
 		if (endDate != null) {
-			sql = sql + " and PA_ENDDATE<=" + "to_date('" + new java.sql.Date(new Date(endDate).getTime())
-					+ "','yyyy-mm-dd')";
+			sql = sql + " and PA_ENDDATE<=" + "str_to_date('" + new java.sql.Date(new Date(endDate).getTime())
+					+ "','%Y-%m-%d')";
 		}
 		Object[] args = new Object[] { enUu };
 		if (!CollectionUtils.isEmpty(filter)) {

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/PurchaseInquiryServiceImpl.java

@@ -559,7 +559,7 @@ public class PurchaseInquiryServiceImpl implements PurchaseInquiryService {
         int page = 1;
 		int i = 0;
         String countSql = "select count(1) from (select id_prid,id_venduu,id_venduseruu,count(1) as nums from purc$inquiryitems left join purc$inquiry on id_inid = in_id" +
-				"        where id_venduseruu is not null and id_status = 201 and in_enuu = " + enUU + " group by id_prid,id_venduseruu,id_venduu order by count(1) desc)";
+				"        where id_venduseruu is not null and id_status = 201 and in_enuu = " + enUU + " group by id_prid,id_venduseruu,id_venduu order by count(1) desc) a";
         Integer count = commonDao.queryForObject(countSql, Integer.class);
 		System.out.println("循环次数:" + Math.ceil((double)count / (double)size));
         for (; page <= Math.ceil((double)count / (double)size); page++ ) {

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/PurchaseOrderServiceImpl.java

@@ -1407,7 +1407,7 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
 		int page = 1;
 		int i = 0;
 		String countSql = "select count(1) from (select pd_prid,pu_venduu,pu_venduseruu,count(1) from purc$orderitems " +
-				"left join purc$orders on pd_puid = pu_id where pu_venduseruu is not null and pu_enuu = "  + enUU + " group by pd_prid,pu_venduseruu,pu_venduu)";
+				"left join purc$orders on pd_puid = pu_id where pu_venduseruu is not null and pu_enuu = "  + enUU + " group by pd_prid,pu_venduseruu,pu_venduu) a";
 		Integer count = commonDao.queryForObject(countSql, Integer.class);
 //		// 已操作的物料ids  需要venduseruu也一样才确认是同一个,不多做操作
 //		Set<String> ids = new HashSet<>();

+ 1 - 1
src/main/java/com/uas/platform/b2b/service/impl/RoleServiceImpl.java

@@ -137,7 +137,7 @@ public class RoleServiceImpl implements RoleService {
 
     @Override
     public List<Role> findByEnUUAndUserUU(Long enUU, Long userUU) {
-	    String sql = "select s.role_enuu enUU,s.role_desc as \"desc\",s.role_name name,s.role_id id from sec$roles s left join sec$userrole r " +
+	    String sql = "select s.role_enuu enUU,s.role_desc as `desc`,s.role_name name,s.role_id id from sec$roles s left join sec$userrole r " +
                 "on s.role_id = r.role_id where s.role_enuu = " + enUU +" and r.user_uu = " + userUU;
 	    List<Role> roles = commonDao.query(sql, Role.class);
         return roles;

+ 5 - 36
src/main/java/com/uas/platform/b2b/service/impl/SaleQuotationServiceImpl.java

@@ -1,7 +1,6 @@
 package com.uas.platform.b2b.service.impl;
 
 import com.uas.platform.b2b.core.util.ContextUtils;
-import com.uas.platform.b2b.core.util.ThreadUtils;
 import com.uas.platform.b2b.dao.*;
 import com.uas.platform.b2b.erp.model.Inquiry;
 import com.uas.platform.b2b.event.SaleQuotationDecideReleaseEvent;
@@ -10,13 +9,10 @@ import com.uas.platform.b2b.model.*;
 import com.uas.platform.b2b.service.ProductUsersService;
 import com.uas.platform.b2b.service.SaleQuotationService;
 import com.uas.platform.b2b.support.SystemSession;
-import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.exception.NotFoundException;
-import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.Status;
-import com.uas.platform.core.persistence.Logger;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
 import com.uas.search.b2b.model.SPage;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,11 +52,6 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
 	@Autowired
     private ProductUsersService productUsersService;
 
-	@Autowired
-    private VendorDao vendorDao;
-
-    private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
-
 	@Override
 	public void save(List<SaleQuotationItem> items) {
 		saleQuotationItemDao.save(items);
@@ -121,37 +112,15 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
 		item.getQuotation().setEnUU(SystemSession.getUser().getEnterprise().getUu());
 		item.getQuotation().setUserUU(SystemSession.getUser().getUserUU());
 		item.setNumber((short) 1);
-		final SaleQuotationItem newItem = saleQuotationItemDao.save(item);
+		SaleQuotationItem newItem = saleQuotationItemDao.save(item);
 		List<SaleQuotationItem> list = new ArrayList<SaleQuotationItem>();
 		list.add(newItem);
-        ThreadUtils.task(new Runnable() {
-            @Override
-            public void run() {
-                // 更新我的物料库信息
-                productUsersService.coverToMyProduct(newItem.getProductId(), SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU(), "主动报价");
-            }
-        }).run();
-        checkCust(item.getQuotation().getCustUU(), item.getQuotation().getEnUU(), item.getQuotation().getCustUserUU(), item.getQuotation().getUserUU());
-        return newItem;
+        // 更新我的物料库信息
+        productUsersService.coverToMyProduct(item.getProductId(), SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU(), "主动报价");
+		return newItem;
 	}
 
-    private void checkCust(Long custUU, Long enUU, Long custUserUU, Long userUU) {
-        List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(custUU, enUU);
-        if (CollectionUtils.isEmpty(vendors)) {
-            // 添加客户
-            Vendor vendor = new Vendor();
-            vendor.setCustswitch(Constant.YES);
-            vendor.setVendswitch(Constant.YES);
-            vendor.setMyEnUU(custUU);
-            vendor.setMyUserUU(custUserUU);
-            vendor.setVendEnUU(enUU);
-            vendor.setVendUserUU(userUU);
-            vendor = vendorDao.save(vendor);
-            logger.log("添加客户", "通过主动报价自动添加客户", "关联id: " + vendor.getId());
-        }
-    }
-
-    @Override
+	@Override
 	public SaleQuotationItem findItemById(Long id) {
 		SaleQuotationItem item = null;
 		List<SaleQuotationItem> items = saleQuotationItemDao.findByQuid(id);

+ 149 - 81
src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java

@@ -306,7 +306,6 @@ public class VendorsServiceImpl implements VendorService {
 	/**
 	 * 获取当前企业推荐供应商
 	 *
-	 * @param enUU 当前企业UU
 	 * @param productMatchCondition 物料模糊匹配条件
 	 * @param enterpriseMatchCondition 企业搜索匹配条件
 	 * @param page 页面
@@ -314,17 +313,11 @@ public class VendorsServiceImpl implements VendorService {
 	 * @return
 	 */
 	@Override
-	public com.uas.account.support.Page<VendorRecommend> getVendorRecommend(Long enUU, String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
+	public com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
 		long start = System.currentTimeMillis();
-//		final Long enUU = SystemSession.getUser().getEnterprise().getUu();
-        if (null == enUU) {
-            // 设置测试企业 - 优软测试二
-            enUU = 10030994L;
-        }
-        if (StringUtils.isEmpty(productMatchCondition) || productMatchCondition.contains("1=1")) {
+		final Long enUU = SystemSession.getUser().getEnterprise().getUu();
+		if (StringUtils.isEmpty(productMatchCondition)) {
 			productMatchCondition = " 1=1 ";
-		} else {
-        	productMatchCondition = productMatchCondition + " and pr_issale = 1 and pr_b2bdisabled <> 1";
 		}
 		if (StringUtils.isEmpty(enterpriseMatchCondition)) {
 			enterpriseMatchCondition = " 1=1 ";
@@ -332,21 +325,21 @@ public class VendorsServiceImpl implements VendorService {
 		// 查询所有的企业信息
 		StringBuffer enterpriseSql = new StringBuffer();
 		enterpriseSql.append("select en.en_uu, en.en_name, en.en_shortname, en.en_address, en.en_tel, en.en_email, en.en_corporation, en.en_businesscode, en.en_profession, en.en_tags, en.en_contactman, en.en_contacttel from sec$enterprises en right join (" +
-				" select en_uu, count(1) as counts from sec$enterprises left join v$products on en_uu = pr_enuu where ").append(productMatchCondition).append(" and en_uu <> ")
-				.append(enUU).append(" and en_name not like '%测试%' and lower(en_name) not like '%test%' and ").append(enterpriseMatchCondition).append(" group by en_uu order by count(1) desc" +
-				" ) a on en.en_uu = a.en_uu order by en.en_weight desc, counts desc");
+				" select en_uu from sec$enterprises left join v$products on en_uu = pr_enuu  where ").append(productMatchCondition).append(" and pr_b2bdisabled <> 1 " +
+				" and en_uu <> ").append(enUU).append(" and en_name not like '%测试%' and en_name not like '%test%' and ").append(enterpriseMatchCondition).append(" group by en_uu order by count(1) desc" +
+				" ) a on en.en_uu = a.en_uu order by en.en_weight desc");
 		// rownum 控制
-		String rownumSql = ") t where rownum <= " + page * size + ") s where r1 > " + (page - 1) * size;
+		String rownumSql = ") t limit " + (page - 1) * size+ "," + (page * size - (page - 1) * size)  ;
 		// 查找非供应商的卖当前商品的企业UU
 		StringBuffer vendorRecommendUusSql = new StringBuffer();
-		vendorRecommendUusSql.append("select s.*,( select wm_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$products where pr_enuu=en_uu and ")
-				.append(productMatchCondition).append(" and pr_issale = 1 and pr_b2bdisabled <> 1 and instr(Pr_Title,'测试')<1 and instr(lower(Pr_Title),'test')<1 " +
-				" and rownum<5 ) productInfo, (select 1 from purc$vendors where ve_vendenuu = en_uu and ve_myenuu = ").append(enUU)
-				.append(") isVendor from (select t.*,rownum as r1 from (").append(enterpriseSql).append(rownumSql);
+		vendorRecommendUusSql.append("select t.*,( select group_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$products where pr_enuu=en_uu and ").append(productMatchCondition)
+				.append(" and exists (select 1 from v$products B where B.pr_cmpcode = pr_cmpcode and B.pr_enuu = ").append(enUU)
+				.append(") limit 4 ) productInfo, (select 1 from purc$vendors where ve_vendenuu = en_uu and ve_myenuu = ")
+				.append(enUU).append(") isVendor from (").append(enterpriseSql).append(rownumSql);
 		// 因为需求更改为所有有销售产品的企业都会被返回,所以total直接取除本企业外其他有销售产品的企业数即可,之前的匹配企业数不再返回
 		StringBuffer totalSql = new StringBuffer().append(" select count(1) from (select en_uu from sec$enterprises left join " +
-				" v$products on en_uu = pr_enuu where en_name not like '%测试%' and lower(en_name) not like '%test%' and en_uu <> ")
-				.append(enUU).append(" and ").append(productMatchCondition).append(" and ").append(enterpriseMatchCondition).append(" group by en_uu)");
+				" v$products on en_uu = pr_enuu where pr_b2bdisabled <> 1 and en_name not like '%测试%' and en_name not like '%test%' and en_uu <> ")
+				.append(enUU).append(" and ").append(productMatchCondition).append(" and ").append(enterpriseMatchCondition).append(" group by en_uu) a");
 //        System.out.println("SQL:" + vendorRecommendUusSql.toString());
 //        System.out.println("NUM_SQL:" + totalSql.toString());
 		Integer total = commonDao.queryForObject(totalSql.toString(), Integer.class);
@@ -355,6 +348,97 @@ public class VendorsServiceImpl implements VendorService {
 		return new com.uas.account.support.Page<VendorRecommend>(page, size, vendorRecommends, total);
 	}
 
+//	/**
+//	 * 组装物料匹配条件
+//	 * @param enUU  企业UU
+//	 * @param productMatchCondition 物料模糊匹配条件
+//	 * @param productCondition 物料精确匹配条件
+//	 * @return
+//	 */
+//	private String concatProductCondition(Long enUU, String productMatchCondition, String productCondition) {
+//		// 先查询当前企业的采购物料(待购&&不在售)的标准物料标准料号
+//		StringBuffer productMatchSql = new StringBuffer();
+//		if (null != productMatchCondition && !"".equals(productMatchCondition)) {
+//			productMatchSql.append(" and ").append(productMatchCondition);
+//		}
+//		// productCondition 不为空时,使用其中条件进行精确匹配
+//		if (null != productCondition && !"".equals(productCondition)) {
+//			JSONObject prodCondition = JSON.parseObject(productCondition);
+//			String code = (String) prodCondition.get("pr_code");
+//			String title = (String) prodCondition.get("pr_title");
+//			String spec = (String) prodCondition.get("pr_spec");
+//			if (null != code && !"".equals(code)) {
+//				List<Product> products = productDao.findByEnUUAndCode(enUU, code);
+//				// 已上传的,标准物料使用原厂型号精确匹配,并根据物料名称模糊搜索, 非标物料使用物料名称模糊搜索
+//				if (!CollectionUtils.isEmpty(products)) {
+//					Product product = products.get(0);
+//					productMatchSql.append(" and pr.pr_title like '%").append(product.getTitle()).append("%' ");
+//					if (product.getStandard() == 1) {
+//						productMatchSql.append(" and pr.pr_cmpcode = ").append(product.getCmpCode());
+//					}
+//				} else {
+//					if (null != title && !"".equals(title)) {
+//						productMatchSql.append(" and pr.pr_title like '%").append(title).append("%' ");
+//					}
+//				}
+//			} else if (null != title && !"".equals(title)) {
+//				productMatchSql.append(" and pr.pr_title like '%").append(title).append("%' ");
+//			} else if (null != spec && !"".equals(spec)) {
+//				productMatchSql.append(" and pr.pr_spec like '%").append(spec).append("%' ");
+//			}
+//		}
+//		return productMatchSql.toString();
+//	}
+
+//	/**
+//	 * 根据供应商UU返回供应商推荐信息列表
+//	 * @param enUU 本企业UU
+//	 * @param vendorRecommends 供应商推荐实体 ,仅包含enuu和hitNums
+//	 * @param page 页数
+//	 * @param size 每页条数
+//	 * @param total 总条数
+//	 * @return 供应商推荐page
+//	 */
+//	private com.uas.account.support.Page<VendorRecommend> getVendorRecommendByVendUUs(Long enUU, List<VendorRecommend> vendorRecommends, int page, int size, Integer total) {
+//		long start = System.currentTimeMillis();
+//		List<VendorRecommend> content = new ArrayList<>();
+//		for (VendorRecommend vendorRecommend : vendorRecommends) {
+//            Long vendUU = vendorRecommend.getEn_uu();
+//            Enterprise enterprise = enterPriseDao.findOne(vendorRecommend.getEn_uu());
+//		    if (null != enterprise) {
+//                vendorRecommend = covert(enterprise, vendorRecommend);
+//                content.add(vendorRecommend);
+//            }
+//		}
+//		System.out.println("处理完所有数据:" + (System.currentTimeMillis() - start));
+//		// 返回分页信息
+//		return new com.uas.account.support.Page<VendorRecommend>(page, size, content, total);
+//	}
+//
+//	/**
+//	 * 企业信息转换为推荐供应商信息
+//	 * @param enterprise 企业信息
+//     * @param vendorRecommend 包含enuu 和hitNums 的供应商推荐信息
+//	 * @return
+//	 */
+//	private VendorRecommend covert(Enterprise enterprise, VendorRecommend vendorRecommend) {
+//		vendorRecommend.setEn_address(enterprise.getEnAddress());
+//		vendorRecommend.setEn_businesscode(enterprise.getEnBussinessCode());
+//		vendorRecommend.setEn_contactman(enterprise.getContactMan());
+//		vendorRecommend.setEn_contacttel(enterprise.getContactTel());
+//		vendorRecommend.setEn_corporation(enterprise.getEnCorporation());
+//		vendorRecommend.setEn_email(enterprise.getEnEmail());
+//		vendorRecommend.setEn_name(enterprise.getEnName());
+//		vendorRecommend.setEn_profession(enterprise.getProfession());
+//		vendorRecommend.setEn_shortname(enterprise.getEnShortname());
+//		vendorRecommend.setEn_tags(enterprise.getTags());
+//		vendorRecommend.setEn_tel(enterprise.getEnTel());
+//		vendorRecommend.setEn_uu(enterprise.getUu());
+//		if (!StringUtils.isEmpty(vendorRecommend.getProductInfo())) {
+//			vendorRecommend.setProductInfo(vendorRecommend.getProductInfo().replace("()", " "));
+//		}
+//		return vendorRecommend;
+//	}
 
 	/**
 	 * 获取推荐企业物料列表(匹配到的排前面)
@@ -367,68 +451,53 @@ public class VendorsServiceImpl implements VendorService {
 	 * @return
 	 */
 	@Override
-	public com.uas.account.support.Page<Product> getProductsByVendorRecommend(int page, int size, Long enUU, Long vendUU, String productMatchCondition, String whereCondition) {
-		// 如果enUU不为空按之前的处理,为空另外处理
-		if (StringUtils.isEmpty(whereCondition)) {
+	public com.uas.account.support.Page<Product> getProductsByVendorRecommend(int page, int size, Long vendUU, String productMatchCondition, String whereCondition) {
+		System.out.println("进入方法:" + System.currentTimeMillis());
+		if (!StringUtils.isEmpty(whereCondition)) {
 			whereCondition = " 1 = 1 ";
 		}
-		List<Product> products = new ArrayList<>();
-		if (null != enUU) {
-			System.out.println("进入方法:" + System.currentTimeMillis());
-			long start = System.currentTimeMillis();
-			// UAS企业UU
-//		Long enUU = SystemSession.getUser().getEnterprise().getUu();
-			StringBuffer cmpCodesSql = new StringBuffer();
-			cmpCodesSql.append("select 1 from v$products where pr_cmpcode = p1.pr_cmpcode and pr_enuu = ")
-					.append(enUU).append(" and nvl(pr_issale,0) <> 1 and pr_ispurchase = 1 and pr_b2bdisabled <> 1 and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%' ");
-//			if (null != productMatchCondition) {
-//				cmpCodesSql.append(" and ").append(productMatchCondition);
-//			}
-			// 查找匹配在售物料的语句
-			StringBuffer productsMatchSql = new StringBuffer();
-			productsMatchSql.append("select pr_id from (select pr_id from v$products p1 where exists (").append(cmpCodesSql).append(") and p1.pr_enuu = ").append(vendUU)
-					.append(" and p1.pr_issale = 1 and p1.pr_b2bdisabled <> 1 and p1.Pr_Title not like '%测试%' and lower(p1.Pr_Title) not like '%test%' and p1.Pr_code not like '%测试%' and lower(p1.Pr_code) not like '%test%' and ")
-					.append(whereCondition).append(" order by pr_standard desc, pr_id desc)");
-			// 查找不匹配但是在售物料的语句  union all 方便排序
-			StringBuffer notMatchProductsSql = new StringBuffer();
-			notMatchProductsSql.append("select pr_id from (select pr_id from v$products p1 where not exists (").append(cmpCodesSql).append(") and p1.pr_enuu = ").append(vendUU)
-					.append(" and p1.pr_issale = 1 and p1.pr_b2bdisabled <> 1 and p1.Pr_Title not like '%测试%' and lower(p1.Pr_Title) not like '%test%' and p1.Pr_code not like '%测试%' and lower(p1.Pr_code) not like '%test%' and ")
-					.append(whereCondition).append(" order by pr_standard desc, pr_id desc)");
-			// 物料id
-			StringBuffer idSql = new StringBuffer();
-			// rownum 控制
-			String rownumSql = " t where rownum <= " + page * size + ") where r1 > " + (page - 1) * size;
-			idSql.append("select pr_id from (select t.*,rownum as r1 from (").append(productsMatchSql).append(" union all ").append(notMatchProductsSql)
-					.append(")").append(rownumSql);
-			List<Long> matchedIds = commonDao.queryForList(productsMatchSql.toString(), Long.class);
-			List<Long> ids = commonDao.queryForList(idSql.toString(), Long.class);
-//			System.out.println("id:" + idSql);
-			for (Long id : ids) {
-				Product product = productDao.findOne(id);
-				if (matchedIds.contains(id)) {
-					StringBuffer matchCodeSql = new StringBuffer();
-					matchCodeSql.append("select wm_concat(pr_code) from v$products where pr_b2bdisabled <> 1 and pr_enuu = ")
-							.append(enUU).append(" and pr_cmpcode = '").append(product.getCmpCode()).append("'").append(" and rownum <= 5");
-					String matchCodes = commonDao.queryForObject(matchCodeSql.toString(), String.class);
-					product.setIfMatched(matchCodes);
-				}
-				products.add(product);
-			}
-			System.out.println("返回数据:" + (System.currentTimeMillis() - start));
-		} else {
-			String prodSql = "select a.* from (select t.*,rownum as r1 from (select pr_id id, pr_code code, pr_title title, pr_spec spec, pr_cmpcode cmpCode, pr_unit unit, pr_kind kind, "
-					+ "pr_minpack minPack, pr_minOrder minOrder, pr_brand brand, pr_standard standard, pr_issale isSale, pr_ispurchase isPurchase from v$products where pr_enuu = "
-					+ vendUU + " and pr_issale = 1 and pr_b2bdisabled <> 1 and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%' and "
-					+ whereCondition + " order by pr_issale desc, pr_standard desc, pr_id desc) t where rownum <= " + page * size + ") a where r1 > " + (page - 1) * size;
-			System.out.println("无UU:" + prodSql);
-			products = commonDao.query(prodSql, Product.class);
-
+		long start = System.currentTimeMillis();
+		// UAS企业UU
+		Long enUU = SystemSession.getUser().getEnterprise().getUu();
+		StringBuffer cmpCodesSql = new StringBuffer();
+		cmpCodesSql.append("select 1 from v$products where pr_cmpcode = p1.pr_cmpcode and pr_enuu = ")
+				.append(enUU).append(" and pr_b2bdisabled <> 1 ");
+		if (null != productMatchCondition) {
+			cmpCodesSql.append(" and ").append(productMatchCondition);
 		}
-		String countSql = "select count(1) from v$products where pr_enuu = " + vendUU
-				+ " and pr_issale = 1 and pr_b2bdisabled <> 1 and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%' and "
-				+ whereCondition;
+		// 查找匹配在售物料的语句
+		StringBuffer productsMatchSql = new StringBuffer();
+		productsMatchSql.append("select pr_id from (select pr_id from v$products p1 where exists (").append(cmpCodesSql)
+				.append(") and p1.pr_enuu = ").append(vendUU).append(" and p1.pr_b2bdisabled <> 1 and ")
+				.append(null != whereCondition ? whereCondition : "").append(" order by pr_code desc) a");
+		// 查找不匹配但是在售物料的语句  union all 方便排序
+		StringBuffer notMatchProductsSql = new StringBuffer();
+		notMatchProductsSql.append("select pr_id from (select pr_id from v$products p1 where not exists (").append(cmpCodesSql)
+				.append(") and p1.pr_enuu = ").append(vendUU).append(" and p1.pr_b2bdisabled <> 1 and ")
+				.append(null != whereCondition ? whereCondition : "").append(" order by pr_code desc)");
+		// 物料id
+		StringBuffer idSql = new StringBuffer();
+		String countSql = "select count(1) from v$products where pr_enuu = " + vendUU + " and pr_b2bdisabled <> 1 and " + whereCondition;
+		// rownum 控制
+		String rownumSql = " t limit" + (page - 1) * size + ", " + (page * size -(page - 1) * size);
+		idSql.append("select pr_id from (").append(productsMatchSql).append(" union all ").append(notMatchProductsSql)
+				.append(") b").append(rownumSql);
+		List<Long> matchedIds = commonDao.queryForList(productsMatchSql.toString(), Long.class);
 		Integer count = commonDao.queryForObject(countSql, Integer.class);
-//		System.out.println("count:" + countSql);
+		List<Long> ids = commonDao.queryForList(idSql.toString(), Long.class);
+		List<Product> products = new ArrayList<>();
+		for (Long id : ids) {
+		    Product product = productDao.findOne(id);
+		    if (matchedIds.contains(id)) {
+		    	StringBuffer matchCodeSql = new StringBuffer();
+		    	matchCodeSql.append("select group_concat(pr_code) from v$products where pr_b2bdisabled <> 1 and pr_enuu = ")
+						.append(enUU).append(" and pr_cmpcode = '").append(product.getCmpCode()).append("'").append(" limit 20");
+		    	String matchCodes = commonDao.queryForObject(matchCodeSql.toString(), String.class);
+		    	product.setIfMatched(matchCodes);
+			}
+		    products.add(product);
+        }
+		System.out.println("返回数据:" + (System.currentTimeMillis() - start));
 		return new com.uas.account.support.Page<>(page, size, products, count);
 	}
 
@@ -445,9 +514,8 @@ public class VendorsServiceImpl implements VendorService {
 			return null;
 		}
 		String value = field.replace("pr_", "");
-		String productSql = "select " + field + " as " + value +" from (" +
-				" select " + field + " from v$products where " + condition + " group by " + field + " order by count(1) desc" +
-				") where rownum <= 10";
+		String productSql = "select " + field + " as " + value +"from v$products where " + condition + " group by " + field + " order by count(1) desc" +
+				"limit 10";
 		return commonDao.query(productSql, Product.class);
 	}
 

+ 3 - 9
src/main/java/com/uas/platform/b2b/v2/controller/InviteRecordController.java

@@ -24,8 +24,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -143,9 +141,8 @@ public class InviteRecordController {
      * @return
      */
     @RequestMapping(value = "/add", method = RequestMethod.POST)
-    private ModelMap addInvitation(String jsonStr) throws UnsupportedEncodingException {
-        String str = URLDecoder.decode(jsonStr, "UTF-8");
-        InvitationRecord record = JSON.parseObject(str, InvitationRecord.class);
+    private ModelMap addInvitation(String jsonStr) {
+        InvitationRecord record = JSON.parseObject(jsonStr, InvitationRecord.class);
         Long enUU = checkByBusinessCode(record.getEnuu(), record.getBussinesscode());
         Long userUU = checkByUserTel(record.getUseruu(), record.getUserTel());
         record.setEnuu(enUU);
@@ -185,12 +182,9 @@ public class InviteRecordController {
      * @return
      */
     @RequestMapping(value = "/count/groupBydate", method = RequestMethod.GET)
-    private List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year, String businessCode, String userTel) throws IllegalAccessException {
+    private List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year, String businessCode, String userTel) {
         enUU = checkByBusinessCode(enUU, businessCode);
         userUU = checkByUserTel(userUU, userTel);
-        if (StringUtils.isEmpty(enUU)) {
-            throw new IllegalAccessException("企业UU号不能为空");
-        }
         if (StringUtils.isEmpty(year)) {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
             year = sdf.format(new Date());

+ 0 - 13
src/main/java/com/uas/platform/b2b/v2/model/Invitation.java

@@ -37,11 +37,6 @@ public class Invitation {
      */
     private Integer doneCount;
 
-    /**
-     * 企业UU
-     */
-    private Long enUU;
-
     public Long getUserUU() {
         return userUU;
     }
@@ -89,12 +84,4 @@ public class Invitation {
     public void setDoneCount(Integer doneCount) {
         this.doneCount = doneCount;
     }
-
-    public Long getEnUU() {
-        return enUU;
-    }
-
-    public void setEnUU(Long enUU) {
-        this.enUU = enUU;
-    }
 }

+ 15 - 40
src/main/java/com/uas/platform/b2b/v2/service/impl/InviteRecordServiceImpl.java

@@ -137,9 +137,9 @@ public class InviteRecordServiceImpl implements InviteRecordService {
         Integer allNum = 0;
         Integer todoNum = 0;
         Integer doneNum = 0;
-        String allSql = "select COALESCE(sum(count), 0) from v$invitation where useruu = " + userUU;
-        String todoSql = "select COALESCE(sum(count), 0) from v$invitation where active = 0 and useruu = " + userUU;
-        String doneSql = "select COALESCE(sum(count), 0) from v$invitation where active = 1 and useruu = " + userUU;
+        String allSql = "select ifnull(sum(count), 0) from v$invitation where useruu = " + userUU;
+        String todoSql = "select ifnull(sum(count), 0) from v$invitation where active = 0 and useruu = " + userUU;
+        String doneSql = "select ifnull(sum(count), 0) from v$invitation where active = 1 and useruu = " + userUU;
         allNum = commonDao.queryForObject(allSql, Integer.class);
         todoNum = commonDao.queryForObject(todoSql, Integer.class);
         doneNum = commonDao.queryForObject(doneSql, Integer.class);
@@ -159,13 +159,9 @@ public class InviteRecordServiceImpl implements InviteRecordService {
      */
     @Override
     public List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year) {
-        String sql = "select substr(time, -2) month,in_enuu enUU,count(1) count from(" +
-                "select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + ")" +
-                "where time like '%" + year + "%' group by time,in_enuu order by time";
+        String sql = "select time, count, 0 as doneCount,substr(time, -2) month from v$invitation_all where time like '%" + year + "%' and useruu = " + userUU + "order by time asc";
         List<Invitation> all = commonDao.query(sql, Invitation.class);
-        String sql1 = "select substr(time, -2) month,in_enuu enUU,count(1) count from(" +
-                "select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + " and COALESCE(in_active,0) = 1)" +
-                "where time like '%" + year + "%' group by time,in_enuu order by time";
+        String sql1 = "select time, count doneCount,substr(time, -2) month from v$invitation where time like'%" + year + "%' and useruu = " + userUU + "and active = 1";
         List<Invitation> done = commonDao.query(sql1, Invitation.class);
         if (!CollectionUtils.isEmpty(all) && !CollectionUtils.isEmpty(done)) {
             for (Invitation a : all) {
@@ -240,40 +236,19 @@ public class InviteRecordServiceImpl implements InviteRecordService {
                 contactTel = cu.getUserTel();
             }
         }
-        final String enName = v.getEnName();
-        final String contactTel1 = contactTel;
-        final String adminTel1 = adnimTel;
-        final String userName = user.getUserName();
-        final String custName = c.getEnName();
         // 发送短信通知
         if (adnimTel.equals(contactTel)) {// 相同的人调用通知接口
-            ThreadUtils.task(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        smsService.send(messageConf.getMsgAddPartForB2B(), adminTel1,
-                                new Object[] { userName, custName, enName });
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }).run();
-
+            try {
+                smsService.send(messageConf.getMsgAddPartForB2B(), adnimTel,
+                        new Object[] { user.getUserName(), c.getEnName(), v.getEnName() });
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         } else { // 针对不同的人调用不同的接口
-            ThreadUtils.task(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        // 发送给管理员
-                        sendMsgToManager(enName, adminTel1);
-
-                        // 发送给联系人
-                        sendMsgToManager(enName, contactTel1);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }).run();
+            // 发送给管理员
+            sendMsgToManager(v.getEnName(), adnimTel);
+            // 发送给联系人
+            sendMsgToContact(v.getEnName(), contactTel, user.getUserName(), adnimTel);
         }
         String result = AccountUtils.addNewRecord(record);
         JSONObject object = JSON.parseObject(result);

+ 351 - 69
src/main/webapp/resources/js/index/app.js

@@ -368,10 +368,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         }).state('sale.quotation.new', {
             url: "/new",
             templateUrl: "static/tpl/index/sale/quotation_new.html",
-            controller: 'SaleQuotationNewCtrl',
-            params: {
-                'inquiryItem': null
-            }
+            controller: 'SaleQuotationNewCtrl'
         }).state('sale.quotation.list', {
             url: "/list",
             templateUrl: "static/tpl/index/sale/quotation_list.html",
@@ -598,9 +595,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             controller: 'AddPartnersCtrl'
         }).state('baseInfo.partner_searchresult', {
             url: '/search',
-            params: {
-                'active': 'done'
-            },
             templateUrl: "static/tpl/index/baseInfo/searchresult.html",
             controller: 'EnterpriseSearchCtrl'
         }).state('baseInfo.invitation', {
@@ -1348,7 +1342,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             modalInstance.result.then(function (data) {
                 InvitationRecord.invite({formStore: data}, {}, function (data) {
                     if (data.success) {
-                        // toaster.pop('success', '提示', data.success);
+                        toaster.pop('success', '提示', data.success);
                     }
                     if (data.error) {
                         toaster.pop('error', '提示', data.error);
@@ -4357,15 +4351,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 toaster.pop('error', '数据加载失败', response.data);
             })
         }
-
-        $scope.isoverdue = function(time) {
-            var timeSpan = new Date().getTime();
-            if (time > timeSpan) {
-                return false;
-            } else {
-                return true;
-            }
-        }
     }]);
 
     // 询价单明细
@@ -6016,8 +6001,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                         }
                     });
 
-                    modalInstance.result.then(function () {
-                        loadData();
+                    modalInstance.result.then(function (data) {
+                        $scope.tableParams.reload();
                     }, function () {
 
                     });
@@ -6454,6 +6439,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             // var file = $scope.myFiles;
             if (file.length > 0) {
                 for (var i = 0; i < file.length; i++) {
+                    console.log(file[i].name);
                     var flag = true;
 
                     if (mould.sellAttachs.length > 0) {
@@ -6489,6 +6475,23 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         // 保存并确认报价
         $scope.onReplyClick = function (mould, withSteps) {
             $scope.loading = true;
+////			var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
+//			var file = mould.attachs[0];
+//			$scope.mould  = mould;
+//			$upload.upload({
+//				url: 'sale/mould/' + mould.id + '/send',
+//				method: 'POST',
+//				file: file,
+//				data: {
+//					json: $scope.mould
+//				}
+//			}).success(function(res){
+//				console.log("success");
+//				console.log(res);
+//			}).error(function(res){
+//				console.log("failure");
+//			});
+
             if (withSteps) {
                 PurcInquiryMould.reply({id: mould.id}, mould, function () {
                     $scope.loading = false;
@@ -6713,6 +6716,21 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         $scope.onReplyClick = function (mould, withSteps) {
             $scope.loading = true;
+//			var file = mould.attachs[0];
+//			$scope.mould  = mould;
+//			$upload.upload({
+//				url: 'sale/mould/' + mould.id + '/send',
+//				method: 'POST',
+//				file: file,
+//				data: {
+//					json: $scope.mould
+//				}
+//			}).success(function(res){
+//
+//			}).error(function(res){
+//				console.log(res);
+//			});
+
             if (withSteps) {
                 PurcInquiryMould.reply({id: mould.id}, mould, function () {
                     $scope.loading = false;
@@ -7009,33 +7027,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             }
         };
 
-        // 根据传入的询价相关的信息封装成报价需要的信息
-        if ($stateParams.inquiryItem != null) {
-            var item = $stateParams.inquiryItem;
-            $scope.item.quotation.cust = item.inquiry.enterprise;
-            $scope.item.quotation.custUser = item.user;
-            $scope.item.quotation.custUserUU = item.userUU;
-            if ($scope.item.quotation.custUserUU == null) {
-                $scope.item.quotation.custUserUU = item.inquiry.recorderUU;
-            }
-            if (item.product == null || item.product.id == null) {
-                toaster.pop('info', '暂未匹配到物料信息,请手动选择');
-            } else {
-                $scope.item.product = item.product;
-                if (item.replies.length > 0) {
-                    $scope.item.prices = item.replies;
-                    angular.forEach($scope.item.prices, function(price) {
-                        price.id = null;
-                    });
-                }
-                $scope.item.quotation.taxrate = item.taxrate;
-                $scope.item.minPackQty = item.minPackQty;
-                $scope.item.minOrderQty = item.minOrderQty;
-                $scope.item.leadtime = item.leadtime;
-                $scope.item.quotation.currency = item.currency;
-            }
-        }
-
         // 保存
         $scope.save = function () {
             var valid = true;
@@ -7051,10 +7042,15 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if (!$scope.item.quotation.code) //新增,设单号
                     $scope.item.quotation.code = 'BJ' + $filter('date')(new Date(), 'yyMMddHHmmss_sss');
                 $scope.item.quotation.custUU = $scope.item.quotation.cust.uu;
-                if ($scope.item.quotation.custUserUU == null) {
-                    $scope.item.quotation.custUserUU = $scope.item.quotation.custUser.userUU;
-                }
+                $scope.item.quotation.custUserUU = $scope.item.quotation.custUser.userUU;
                 $scope.item.productId = $scope.item.product.id;
+                // $scope.item.quotation.status = 100;//在录入
+                // if ($scope.item.quotation.date instanceof Date) {
+                //     $scope.item.quotation.date = $scope.item.quotation.date.getTime();
+                // }
+                // if ($scope.item.quotation.endDate instanceof Date) {
+                //     $scope.item.quotation.endDate = $scope.item.quotation.endDate.getTime();
+                // }
                 Quotation.save({}, $scope.item, function (data) {
                     $scope.loading = false;
                     $scope.item = data;
@@ -7096,9 +7092,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if (!$scope.item.quotation.code) //新增,设单号
                     $scope.item.quotation.code = 'BJ' + $filter('date')(new Date(), 'yyMMddHHmmss_sss');
                 $scope.item.quotation.custUU = $scope.item.quotation.cust.uu;
-                if ($scope.item.quotation.custUserUU == null) {
-                    $scope.item.quotation.custUserUU = $scope.item.quotation.custUser.userUU;
-                }
+                $scope.item.quotation.custUserUU = $scope.item.quotation.custUser.userUU;
                 $scope.item.productId = $scope.item.product.id;
                 // $scope.item.quotation.status = 101;//已提交
                 if ($scope.item.quotation.date instanceof Date) {
@@ -14780,7 +14774,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             }, function (response) {
 
             });
-        };
+        }
+        ;
 
         // 查找供应商
         $scope.dbfindVend = function () {
@@ -20979,14 +20974,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     }]);
 
     // 企业圈搜索结果
-    app.controller('EnterpriseSearchCtrl', ['$scope', 'getAccountUserSpace', 'ngTableParams', '$filter', 'BaseService', 'toaster', 'AddPartner', '$rootScope', '$modal', 'InvitationRecord', '$stateParams', function ($scope, getAccountUserSpace, ngTableParams, $filter, BaseService, toaster, AddPartner, $rootScope, $modal, InvitationRecord, $stateParams) {
+    app.controller('EnterpriseSearchCtrl', ['$scope', 'getAccountUserSpace', 'ngTableParams', '$filter', 'BaseService', 'toaster', 'AddPartner', '$rootScope', '$modal', 'InvitationRecord', function ($scope, getAccountUserSpace, ngTableParams, $filter, BaseService, toaster, AddPartner, $rootScope, $modal, InvitationRecord) {
         $scope.status = 'add';
         BaseService.scrollBackToTop();
-        if ($stateParams.active != null) {
-            $scope.active = $stateParams.active;
-        } else {
-            $scope.active = 'all';
-        }
+        $scope.active = 'all';
         $scope.agreedText = '全部';
         $scope.dateZoneText = '一个月内';
         $scope.condition = {dateZone: 1};
@@ -21091,7 +21082,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             modalInstance.result.then(function (data) {
                 InvitationRecord.invite({formStore: data}, {}, function (data) {
                     if (data.success) {
-                        // toaster.pop('success', '提示', data.success);
+                        toaster.pop('success', '提示', data.success);
                         $scope.tableParams.reload();
                     }
                     if (data.error) {
@@ -21492,7 +21483,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             modalInstance.result.then(function (data) {
                 InvitationRecord.invite({formStore: data}, {}, function (data) {
                     if (data.success) {
-                        // toaster.pop('success', '提示', data.success);
+                        toaster.pop('success', '提示', data.success);
                         $scope.tableParams.reload();
                     }
                     if (data.error) {
@@ -23507,6 +23498,15 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             }
         };
 
+        // // 设置阅读状态
+        // $scope.setReadStatus = function(msg) {
+        //     if(!msg.read) {
+        //         PurcInquiry.setStatus({id: msg.inid}, {}, function(data) {
+        //
+        //         });
+        //     }
+        // }
+
         $scope.searchMethod = false;
         var getService = function () {
             return $scope.searchMethod ? PubInquirySearchInfo : PubInquiryNoSearchInfo;
@@ -23534,6 +23534,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if ($scope.active == 'overdue') {
                     $scope.active = 'end';
                 }
+                /*getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
+                    $scope.loading = false;
+                    if (page) {
+                        params.total(page.totalElement);
+                        $defer.resolve(page.content);
+                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
+                    }
+                }, function (response) {
+                    $scope.loading = false;
+                    toaster.pop('error', '数据加载失败', response.data);
+                });*/
                 AccountEnterprise.get({}, function(data) {
                     $scope.currentEn = data;
                     publicInquiry.getUrl({}, function(data) {
@@ -23550,6 +23561,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                             if (response) {
                                 params.total(response.totalElements);
                                 $defer.resolve(response.content);
+                                // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
                             }
                         }).error(function (err) {
                             $scope.loading = false;
@@ -23560,6 +23572,264 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             }
         });
 
+        //获得各分类未阅读数量
+        // var getUnreadCount = function () {
+        //     PurcInquiry.getUnreadCount(null, function (data) {
+        //         $scope.unread = data;
+        //     });
+        // };
+        // getUnreadCount();
+
+        // //设置单据已读
+        // $scope.setOrdersRead = function (id) {
+        //     // 如果单据本身已读,则不发送请求修改数据
+        //     if (!$scope.isUnread(id)){
+        //         return;
+        //     }
+        //     var sourceId = [];
+        //     sourceId.push(id);
+        //     PurcInquiry.setRead({}, sourceId, function (message) {
+        //         getUnreadCount();
+        //         removeByValue($scope.unreadCode, id);
+        //     });
+        // };
+
+        // $scope.setOrdersReadByState = function () {
+        //     if (!$scope.unread.replied || $scope.unread.replied == 0) {
+        //         return;
+        //     }
+        //     PurcInquiry.setReadByState({}, function () {
+        //         getUnreadIds();
+        //         getUnreadCount();
+        //     });
+        // };
+
+        // var getUnreadIds = function () {
+        //     PurcInquiry.getUnreadIds({}, "", function (message) {
+        //         $scope.unreadCode = message.content;
+        //     });
+        // };
+        // getUnreadIds();
+
+        $scope.isUnread = function (id) {
+            for (var i in $scope.unreadCode) {
+                if (id == $scope.unreadCode[i]) {
+                    return true;
+                }
+            }
+        };
+
+        $scope.getMinDate = function (item) {
+            return $filter('date')(item.inquiry.date, 'yyyy-MM-dd');
+        };
+        $scope.replyPrices = [];
+        $scope.replylapQtys = [];
+        $scope.replyPrices.push(true);
+        $scope.replylapQtys.push(true);
+        $scope.addStep = function (inquiryItem) {
+            $scope.replyPrices.push(true);
+            if (inquiryItem.replies.length >= 10) {
+                toaster.pop('warning', '提示', '最多支持10个分段!');
+            } else {
+                inquiryItem.replies.push({});
+                if (inquiryItem.replies.length != 1) {
+                    $scope.replyPrices.push(true);
+                    $scope.replylapQtys.push(true);
+                }
+            }
+        };
+        $scope.removeStep = function (inquiryItem, stepIndex) {
+            inquiryItem.replies.splice(stepIndex, 1);
+            $scope.replyPrices.splice(stepIndex, 1);
+            $scope.replylapQtys.splice(stepIndex, 1);
+        };
+
+        $scope.openDatePicker = function ($event, item, openParam) {
+            $event.preventDefault();
+            $event.stopPropagation();
+            item[openParam] = !item[openParam];
+        };
+
+        $scope.openFilterDatePicker = function ($event, item, openParam) {
+            $event.preventDefault();
+            $event.stopPropagation();
+            item[openParam] = !item[openParam];
+            if ($scope.condition.dateFrom && $scope.condition.dateTo && !item[openParam]) {
+                $scope.tableParams.reload();
+            }
+        };
+
+        $scope.getHistory = function (item) {
+            if (!item.history) {
+                publicInquiry.getHistory({itemId: item.id}, function (data) {
+                    item.history = data;
+                });
+            }
+        };
+
+        // 报价
+        $scope.quote = function(inquiryItem) {
+            $modal.open({
+                animation: true,
+                templateUrl: 'static/tpl/index/sale/modal/quote_inquiry.html',
+                controller: 'QuoteInquiryCtrl',
+                resolve: {
+                    inquiryItem: function () {
+                        return inquiryItem
+                    }
+                }
+            }).result.then(function (data) {
+
+            }, function () {})
+        };
+
+        $scope.deleteAttach = function (attaches, index) {
+            attaches.splice(index, 1);
+        };
+
+        $scope.onReplyClick = function (item, withSteps) {
+            if (item.vendFromDate instanceof Date) {
+                item.vendFromDate = item.vendFromDate.getTime();
+            }
+            if (item.vendToDate instanceof Date) {
+                item.vendToDate = item.vendToDate.getTime();
+            }
+            if (item.vendFromDate > item.vendToDate) {
+                toaster.pop('warning', '警告', '有效开始日期不能超过有效截止日期');
+                return;
+            }
+            var replies = [];
+            // 判断分段数是否合法
+            var valid = true;
+            var validLapQty = 0;
+            angular.forEach(item.replies, function (r, i) {
+                if ((i > 0 ? r.lapQty : 1) || r.price) {
+                    replies.push(r);
+                }
+                // 直接比较是字符串比较,需要先转换再比较  2017年9月7日 15:05:51
+                if (i > 0 && parseInt(r.lapQty) <= parseInt(item.replies[i - 1].lapQty) || r.lapQty == null) {
+                    valid = false;
+                    validLapQty = r.lapQty;
+                }
+            });
+            item.replies = replies;
+            $scope.loading = true;
+            if (!valid) {
+                if (validLapQty) {
+                    toaster.pop('info', '提示', '分段' + validLapQty + '小于等于了上一分段数,不能保存!');
+                } else {
+                    toaster.pop('info', '提示', '分段数量不合法,不能保存!');
+                }
+                $scope.loading = false;
+            } else {
+                var file = item.myFiles, file = file && file.length > 0 ? file[0] : null;
+                if (withSteps) { // 保存并报价
+                    if(null != file) {
+                        $upload.upload({
+                            url: 'sale/pubInquiry/addAttach',
+                            file: file,
+                            method: 'POST',
+                            data: {
+                                item: item,
+                                method: 'reply'
+                            }
+                        }).success(function (data) {
+                            if (data.item) {
+                                item = data.item;
+                            }
+                            $scope.loading = false;
+                            toaster.pop('info', '提示', '报价成功');
+                            $scope.tableParams.reload();
+                        }).error(function (data) {
+                            $scope.loading = false;
+                            toaster.pop('error', '附件上传失败');
+                        });
+                    } else {
+                        publicInquiry.reply({itemId: item.id, token: $scope.token}, item, function (data) {
+                            $scope.loading = false;
+                            toaster.pop('info', '提示', '报价成功');
+                            $scope.tableParams.reload();
+                        }, function (response) {
+                            $scope.loading = false;
+                            toaster.pop('error', '询价失效', response.data);
+                        });
+                    }
+                } else {  // 保存
+                    if(null != file) {
+                        $upload.upload({
+                            url: 'sale/pubInquiry/addAttach',
+                            file: file,
+                            method: 'POST',
+                            data: {
+                                item: item,
+                                method: 'save'
+                            }
+                        }).success(function (data) {
+                            if (data.item) {
+                                item = data.item;
+                            }
+                            $scope.loading = false;
+                            toaster.pop('info', '提示', '保存成功');
+                            $scope.tableParams.reload();
+                        }).error(function (data) {
+                            $scope.loading = false;
+                            toaster.pop('error', '附件上传失败');
+                        });
+                    } else {
+                        publicInquiry.saveItem({itemId: item.id, token: $scope.token}, item, function (data) {
+                            $scope.loading = false;
+                            toaster.pop('info', '提示', '保存成功');
+                            $scope.tableParams.reload();
+                        }, function (response) {
+                            $scope.loading = false;
+                            toaster.pop('error', '保存失败', response.data);
+                        });
+                    }
+                }
+            }
+        };
+
+        $scope.isValid = function (item, withSteps) {
+            var bool = item.leadtime && item.replies && item.replies[0].price > 0;
+            if (!withSteps || !bool)
+                return bool;
+            angular.forEach(item.replies, function (r, i) {
+                $scope.verifylapQty(r.lapQty, i, item);
+                bool = (i > 0 ? r.lapQty : 1) && r.price && $scope.replylapQtys[i];
+            });
+            return bool;
+        };
+
+        $scope.verifylapQty = function (value, index, inquiryItem) {
+            value = parseInt(value);
+            var regex = /^\d+(.\d{1,5})?$/;
+            var valid = true;
+            angular.forEach(inquiryItem.replies, function(reply, $index) {
+                if ($index < index && reply.lapQty >= value) {
+                    valid = false;
+                }
+            });
+            $scope.replylapQtys[index] = regex.test(value) && valid;
+        };
+
+        $scope.minOrderQtyVerify = $scope.minPackQtyVerify = $scope.leadtimeVerify = true;
+        $scope.verify = function (value, type) {
+            var regex = /^\d+(.\d{1,5})?$/;//
+            switch (type) {
+                case 'minOrderQty':
+                    $scope.minOrderQtyVerify = regex.test(value);
+                    break;
+                case 'minPackQty':
+                    $scope.minPackQtyVerify = regex.test(value);
+                    break;
+                case 'leadtime':
+                    $scope.leadtimeVerify = regex.test(value);
+                    break;
+                default:
+                    $scope.replyPrices[type] = regex.test(value);
+                    break;
+            }
+        }
         // 搜索框回车
         $scope.onSearch = function (keyword) {
             // 每次搜索重置获取数据方法
@@ -23576,14 +23846,15 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.tableParams.reload();
         }
 
-        // 判断是否过期
-        $scope.isoverdue = function(time) {
-            var timeSpan = new Date().getTime();
-            if (time > timeSpan) {
-                return false;
-            } else {
-                return true;
-            }
+        // 导出
+        $scope.exportXls = function () {
+            PurcInquiry.exportXls({}, {}, function (data) {
+                if (data.success) {
+                    window.location.href = 'sale/inquiry/xls?_state='+$scope.active+'&searchFilter='+encodeURIComponent(angular.toJson($scope.searchFilterXls));
+                }
+            }, function (response) {
+                toaster.pop('error', '数据加载失败', response.data);
+            })
         }
     }]);
 
@@ -23871,6 +24142,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 if ($scope.active == 'overdue') {
                     $scope.active = 'end';
                 }
+               /* getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
+                    $scope.loading = false;
+                    if (page) {
+                        params.total(page.totalElement);
+                        $defer.resolve(page.content);
+                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
+                    }
+                }, function (response) {
+                    $scope.loading = false;
+                    toaster.pop('error', '数据加载失败', response.data);
+                });*/
                 AccountEnterprise.get({}, function(data) {
                     $scope.currentEn = data;
                     publicInquiry.getUrl({}, function(data) {

+ 1 - 5
src/main/webapp/resources/js/index/services/BaseInfo.js

@@ -299,11 +299,7 @@ define(['ngResource'], function() {
 		return $resource('product/baseInfo/getUserSpaceDetails', {}, {
 			getAll: {
 				isArray: false
-			},
-            getDone: {
-                url: 'product/baseInfo/getUserSpaceDetails/done',
-                method: 'GET'
-            },
+			}
 		})
 	}]).factory('AddPartner', ['$resource', function($resource) {
 		return $resource('addpartner', {}, {

+ 7 - 17
src/main/webapp/resources/tpl/index/baseInfo/modal/quotation_modal.html

@@ -138,7 +138,7 @@
             <div class="form-group">
                 <label for="inputEmail3" class="col-xs-4 control-label">最小订购</label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail3" placeholder="请输入最小订购数" ng-model="inquiryItem.minOrderQty" ng-pattern="/^[0-9]*[1-9][0-9]*$/">
+                    <input type="text" class="form-control" id="inputEmail3" placeholder="1000" ng-model="inquiryItem.minOrderQty" ng-pattern="/^[0-9]*[1-9][0-9]*$/">
                 </div>
             </div>
         </div>
@@ -146,7 +146,7 @@
             <div class="form-group">
                 <label for="inputEmail1" class="col-xs-4 control-label">最小包装</label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail1" placeholder="请输入最小包装数" ng-model="inquiryItem.minPackQty" ng-pattern="/^[0-9]*[1-9][0-9]*$/">
+                    <input type="text" class="form-control" id="inputEmail1" placeholder="1000" ng-model="inquiryItem.minPackQty" ng-pattern="/^[0-9]*[1-9][0-9]*$/">
                 </div>
             </div>
         </div>
@@ -154,7 +154,7 @@
             <div class="form-group">
                 <label for="inputEmail2" class="col-xs-4 control-label text-inverse">交货周期(天)</label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail2" placeholder="请输入交货周期" ng-model="inquiryItem.leadtime" ng-pattern="/^[0-9]*[1-9][0-9]*$/" ng-required="true">
+                    <input type="text" class="form-control" id="inputEmail2" placeholder="20" ng-model="inquiryItem.leadtime" ng-pattern="/^[0-9]*[1-9][0-9]*$/" ng-required="true">
                 </div>
             </div>
         </div>
@@ -172,7 +172,7 @@
             <div class="form-group">
                 <label for="inputEmail4" class="col-xs-4 control-label">税率(%)</label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail4" placeholder="请输入税率" ng-model="inquiryItem.taxrate" ng-pattern="/^((\d|[123456789]\d)(\.\d+)?)$/">
+                    <input type="text" class="form-control" id="inputEmail4" placeholder="10" ng-model="inquiryItem.taxrate" ng-pattern="/^((\d|[123456789]\d)(\.\d+)?)$/">
                 </div>
             </div>
         </div>
@@ -180,7 +180,7 @@
             <div class="form-group">
                 <label for="inputEmail5" class="col-xs-4 control-label">供应商型号</label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail5" placeholder="请输入供应商型号" ng-model="inquiryItem.vendorprodcode">
+                    <input type="text" class="form-control" id="inputEmail5" placeholder="1000" ng-model="inquiryItem.vendorprodcode">
                 </div>
             </div>
         </div>
@@ -191,7 +191,7 @@
                 <label for="inputEmail6" class="col-xs-4 control-label">分段数量
                     <span ng-bind="$index + 1" ng-if="inquiryItem.replies.length > 1"></span></label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail6" ng-model="reply.lapQty" placeholder="请输入分段数量" ng-pattern="/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/" ng-required="true" ng-disabled="$first">
+                    <input type="text" class="form-control" id="inputEmail6" ng-model="reply.lapQty" ng-pattern="/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/" ng-required="true" ng-disabled="$first">
                 </div>
             </div>
         </div>
@@ -200,22 +200,12 @@
                 <label for="inputEmail7" class="col-xs-4 control-label text-inverse">价格
                     <span ng-bind="$index + 1" ng-if="inquiryItem.replies.length > 1"></span></label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail7" ng-model="reply.price" placeholder="请输入价格" ng-pattern="/^(([0-9]+\.[0-9]{1,3})|([0-9]*[1-9][0-9]*\.[0-9]{1,3})|([0-9]*[1-9][0-9]*))$/" ng-required="true">
+                    <input type="text" class="form-control" id="inputEmail7" ng-model="reply.price" ng-pattern="/^(([0-9]+\.[0-9]{1,3})|([0-9]*[1-9][0-9]*\.[0-9]{1,3})|([0-9]*[1-9][0-9]*))$/" ng-required="true">
                 </div>
             </div>
         </div>
         <a ng-click="removeStep(inquiryItem, $index)" ng-if="!$first"><i class="fa fa-trash"></i></a>
     </div>
-    <div class="row">
-        <div class="col-xs-12 form-horizontal">
-            <div class="form-group">
-                <label for="inputEmail4" class="col-xs-2 control-label">备注</label>
-                <div class="col-xs-10">
-                    <input type="text" class="form-control" id="inputEmail8" ng-model="inquiryItem.remark" placeholder="请输入备注(100字以内)" maxlength="100">
-                </div>
-            </div>
-        </div>
-    </div>
     <div class="modal-file" ng-if="imgPreviewName">
         <span>附件:</span><a ng-bind="imgPreviewName" style="margin-left:10px;"></a>
     </div>

+ 2 - 6
src/main/webapp/resources/tpl/index/purc/pubInquiry.html

@@ -505,9 +505,6 @@ margin-left: 55px;
 				<div ng-if="inquiryItem.attachUrl" class="text-muted">
 					<i class="fa fa-paperclip fa-fw" style="color: #ffa340; font-size: 18px;"></i>附件:<a class="file" href="{{inquiryItem.attachUrl}}" target="_blank">{{::inquiryItem.attachName}}</a>
 				</div>
-                <div ng-if="inquiryItem.remark" class="text-muted">
-                    备注:<span ng-bind="inquiryItem.remark"></span>
-                </div>
 			</td>
 			<td class="text-center">
 				<div ng-bind="inquiryItem.product.unit"></div>
@@ -630,9 +627,8 @@ margin-left: 55px;
 			<td class="text-center br-l">
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.agreed == null && inquiryItem.invalid != 1" class="block">
 					<div ng-if="inquiryItem.replies.length > 0" class="text-muted" style="padding-top: 50px;">
-						<a ng-click="accept(inquiryItem.id)">采纳</a>
-						<a ng-click="refuse(inquiryItem.id)">拒绝</a>
-					</div>
+						<a ng-click="accept(inquiryItem.id);setOrdersRead(inquiryItem.id)">采纳</a>
+						<a ng-click="refuse(inquiryItem.id);setOrdersRead(inquiryItem.id)">拒绝</a></div>
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.agreed == null && inquiryItem.invalid == 1" class="block">
 					<span class="text-trans text-light">已失效</span>

+ 0 - 8
src/main/webapp/resources/tpl/index/sale/inquiry.html

@@ -513,21 +513,15 @@
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.agreed == 1 && inquiryItem.invalid != 1" class="block">
 					<span class="text-trans success">已采纳</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.invalid == 1" class="block">
 					<span class="text-trans text-light">已失效</span>
 				</div>
 				<div ng-if="inquiryItem.status == 314" class="block">
 					<span class="text-trans text-light">已作废</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.agreed == 0" class="block">
 					<span class="text-trans error">未采纳</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 				<div ng-if="inquiryItem.status == 200">
 					<div ng-if="inquiryItem.inquiry.overdue == 0 && inquiryItem.inquiry.check != 1">
@@ -558,8 +552,6 @@
 					</div>
 					<div ng-if="inquiryItem.inquiry.overdue == 1" class="block">
 						<span class="text-trans error">已过期</span>
-                        <br><br>
-                        <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 					</div>
 				</div>
 			</td>

+ 4 - 32
src/main/webapp/resources/tpl/index/sale/pubinquiry.html

@@ -87,14 +87,8 @@
 	.order-table .order-bd .product {
 		padding-left: 20px;
 	}
-	.order-table .order-bd .product .dropdown-toggle >span{
-		display:inline-block;
-		vertical-align: top;
+	.order-table .order-bd .product .dropdown-toggle span{
 		color:#333;
-		width:250px;
-		overflow: hidden;
-		text-overflow:ellipsis;
-		white-space:nowrap;
 	}
 	.order-table .order-bd .product .dropdown-toggle{
 		position:relative;
@@ -158,7 +152,6 @@
 		/*background: #f5f5f5;*/
 	}
 	.order-table{
-		table-layout:fixed;
 		background: #fff;
 	}
 	.menu .new-dot{
@@ -181,22 +174,12 @@
 		font-size: 14px;
 		color:#999;
 		font-style:normal;
-		word-break:break-all;
 	}
 	.order-table .order-bd td span{
 		font-size: 14px;
 		color:#999;
 		font-style:normal;
 	}
-	.order-table .order-bd td span.lang{
-		cursor:pointer;
-		width:160px;
-		display:inline-block;
-		overflow: hidden;
-		-ms-text-overflow: ellipsis;
-		text-overflow: ellipsis;
-		white-space:nowrap;
-	}
 </style>
 <div class="block" id="public">
 	<div class="loading in" ng-class="{'in': loading}">
@@ -309,7 +292,7 @@
 	<table class="order-table block" ng-table="tableParams">
 		<thead>
 		<tr class="header">
-			<th width="330">产品型号</th>
+			<th>产品型号</th>
 			<th width="160">品牌</th>
 			<th width="110">分段数量</th>
 			<th width="90">价格</th>
@@ -376,7 +359,7 @@
 				币别:<span ng-bind="::(isUser?'-':inquiryItem.currency)"></span>
 			</td>
 			<td>
-				税率:<span ng-bind="::inquiryItem.taxrate || 0"></span>%
+				税率:<span>17</span>%
 			</td>
 			<td class="text-right" colspan="2" class="order-sum">
 				<div ng-if="inquiryItem.replyable">
@@ -412,13 +395,10 @@
 				</div>
                 <div ng-if="inquiryItem.attachUrl" class="text-muted">
                     <i class="fa fa-paperclip fa-fw" style="color: #ffa340; font-size: 18px;"></i>附件:<a class="file" href="{{inquiryItem.attachUrl}}" target="_blank">{{::inquiryItem.attachName}}</a>
-                </div>
-                <div ng-if="inquiryItem.remark" class="text-muted">
-                    备注:<span ng-bind="inquiryItem.remark"></span>
                 </div>
 			</td>
 			<td class="text-center">
-				<span class="lang" ng-bind="inquiryItem.product.brand || inquiryItem.inbrand || '-'" title="{{inquiryItem.product.brand || inquiryItem.inbrand || '-'}}"></span>
+				<span ng-bind="inquiryItem.product.brand || inquiryItem.inbrand || '-'"></span>
 			</td>
 			<td class="text-center">
 				<div ng-repeat="reply in inquiryItem.replies">
@@ -443,23 +423,15 @@
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.agreed == 1 && inquiryItem.invalid != 1" class="block">
 					<span class="text-trans success">已采纳</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.invalid == 1" class="block">
 					<span class="text-trans text-light">已失效</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 				<div ng-if="inquiryItem.status == 314" class="block">
 					<span class="text-trans text-light">已作废</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 				<div ng-if="inquiryItem.status == 201 && inquiryItem.agreed == 0" class="block">
 					<span class="text-trans error">未采纳</span>
-                    <br><br>
-                    <a ui-sref="sale.quotation.new({inquiryItem:inquiryItem})">我要报价</a>
 				</div>
 			</td>
 		</tr>

+ 0 - 2
src/main/webapp/resources/tpl/index/sale/pubinquiry_detail.html

@@ -152,8 +152,6 @@
 				<span>报价截止</span><em ng-bind="::inquiry.endDate | date:'yyyy-MM-dd'"></em>
 			</li>
 		</ul>
-		<span style="font-size: 14px; font-weight: bold; width: 25%">备注</span>
-		<span ng-bind="inquiryItem.remark" style="font-size: 14px;font-style: normal;color: #999;width: 75%"></span>
 	</div>
 	<table class="table">
 		<thead>

+ 18 - 0
src/main/webapp/resources/tpl/index/sale/quotation_new.html

@@ -408,6 +408,24 @@
 					   placeholder="只可以为正整数" ng-readonly="!item.$editing" ng-required="true" ng-disabled="isDisabled()">
 				<span class="text-inverse text-bold">* </span>
 			</div>
+			<!--<label class="col-sm-2 control-label">价格有效日期:</label>
+			<div class="col-sm-4">
+				<div class="input-group">
+					<input ng-model="item.quotation.endDate" type="text" class="form-control" id="endDate"
+						   placeholder="" datepicker-popup="yyyy-MM-dd" is-open="item.$endDateOpen"
+						   min-date="getMinDate()" ng-required="true" ng-disabled="true"
+						   current-text="今天" clear-text="清除" close-text="关闭"
+						   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+						   ng-focus="openDatePicker($event, item.$endDateOpen)" ng-readonly="!item.$editing">
+					<span class="input-group-btn">
+						<button type="button" class="btn btn-default btn-sm" ng-disabled="!item.$editing || isDisabled()"
+								ng-click="openDatePicker($event, item.$endDateOpen)" >
+							<i class="fa fa-calendar"></i>
+						</button>
+					</span>
+					<span class="text-inverse text-bold" style="right:-10px">* </span>
+				</div>
+			</div>-->
 		</div>
 		<div class="form-group form-group-sm">
 			<label for="currency" class="col-sm-2 control-label">币别:</label>