Browse Source

更新快照查询方法

hejq 7 years ago
parent
commit
6d5dd59a80

+ 2 - 0
src/main/java/com/uas/platform/b2b/controller/SnapshotController.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2b.controller;
 
+import com.uas.platform.b2b.core.util.ContextUtils;
 import com.uas.platform.b2b.core.util.ThreadUtils;
 import com.uas.platform.b2b.model.Snapshot;
 import com.uas.platform.b2b.model.User;
@@ -87,6 +88,7 @@ public class SnapshotController {
 				}
 			}
 		}).run();
+		ContextUtils.getBean("snapshotController");
 		logger.info("cost -> " + (System.currentTimeMillis() - start));
 		return modelMap;
 	}

+ 196 - 0
src/main/java/com/uas/platform/b2b/model/util/SnapshotSqlUtil.java

@@ -0,0 +1,196 @@
+package com.uas.platform.b2b.model.util;
+
+/**
+ * 快照sql语句
+ *
+ * @author hejq
+ * @date 2018-08-21 18:15
+ */
+public class SnapshotSqlUtil {
+
+    /**
+     * 待处理招标单
+     */
+    public static final String SALE_TENDER_TODO_SQL = "select 'saletendertodo' as category, ? as enuu, count(1) as count from v$purc$tender" +
+            " where pt_ispublish = 1  and pt_overdue = 0 and pt_enuu = ?";
+
+    /**
+     * 待处理招标单(买家)
+     */
+    public static final String PURC_TENDER_TODO_SQL = "select 'tendertodo' as category, ? as enuu, count(1) as count from v$purc$tender" +
+            " left join sale$tender on st_code = pt_code and st_enuu = pt_enuu " +
+            " where pt_ispublish = 1 and v$purc$tender.pt_overdue = 0 and st_venduu = ?";
+
+    /**
+     * 待回复主动报价
+     */
+    public static final String SALE_QUOTATAION_TDOD_SQL = "select 'inquirytodo' as category, ? as enuu, count(1) as count from sale$quotationitem " +
+            "left join sale$quotation on qu_id = qd_quid  where qu_status = 100 and qu_enuu = ?";
+
+    /**
+     * 待报价模具询价
+     */
+    public static final String INQUIRY_MOULD_TODO_SQL = "select 'inquirymouldtodo' as category, ? as enuu, count(1) as count from purc$inquirymould " +
+            "where im_status = 200 and im_valid = 1 and im_overdue = 0 and im_venduu = ?";
+
+    /**
+     * 购物车
+     */
+    public static final String CART_TODO_SQL =  "select 'carttodo' as category, ? as enuu, count(1) as count from purc$orders where pu_status = 311 and pu_enuu = ?";
+
+    /**
+     * 待处理应收对账单
+     */
+    public static final String APCHECK_TODO_SQL =  "select 'carttodo' as category, ? as enuu, count(1) as count from purc$orders where pu_status = 311 and pu_enuu = ?";
+
+    /**
+     * 获取待处理应付对账单
+     */
+    public static final String ARCHECK_TODO_SQL = "select 'archecktoconfirm' as category, ? as enuu, count(1) as count from sale$archeck where sac_status = 200 and sac_enuu = ?";
+
+    /**
+     * 获取全部应付对账单
+     */
+    public static final String ARCHECK_ALL_SQL =  "select 'archeckall' as category, ? as enuu, count(1) as count from sale$archeck where sac_enuu = ?";
+
+    /**
+     * 获取全部应付发票
+     */
+    public static final String APBILL_ALL_SQL = "select 'apbillall' as category, ? as enuu, count(1) as count from purc$apbill where pad_venduu = ?";
+
+    /**
+     * 全部MRB
+     */
+    public static final String MRB_ALL_SQL = "select 'mrb' as category, ? as enuu, count(1) as count from purc$mrb where pm_venduu = ?";
+
+    /**
+     * 全部不良品出库
+     */
+    public static final String BADOUT_ALL_SQL = "select 'salebadout' as category, ? as enuu, count(1) as count from purc$badout where po_venduu = ?";
+
+    /**
+     * 全部不良品入库
+     */
+    public static final String BADIN_ALL_SQL = "select 'salebadin' as category, ? as enuu, count(1) as count from purc$badin where pb_venduu = ?";
+
+    /**
+     * 全部外单(客户)
+     */
+    public static final String MAKEOUT_ALL_SQL = "select 'makeoutorderall' as category,  ? as enuu, count(1) as count from  make$orders where ma_enuu = ?";
+
+    /**
+     * 全部客户委外验退单
+     */
+    public static final String MAKE_RETURN_ALL_SQL = "select 'makereturnall' as category, ? as enuu, count(1) as count from make$return where mr_venduu = ?";
+
+    /**
+     * 全部客户委外变更单
+     */
+    public static final String MAKE_CHANGE_ALL_SQL = "select 'makeorderchangeall' as category, ? as enuu, count(1) as count from make$changeitems where mcd_venduu = ?";
+
+    /**
+     * 全部客户委外单
+     */
+    public static final String MAKE_ALL_SQL = "select 'makeorder' as category, ? as enuu, count(1) as count from make$orders  where ma_venduu = ?";
+
+    /**
+     * 待处理客户委外单
+     */
+    public static final String MAKE_TODO_SQL = "select 'makeorder' as category, ? as enuu, count(1) as count from make$orders  where ma_status = 200 and ma_venduu = ?";
+
+    /**
+     * 已收料发货单
+     */
+    public static final String SALE_SEND_VERIFY_SQL = "select 'salesendverify' as category, ? as enuu, count(1) as count from sale$send where ss_verifystatus = 1 and ss_enuu = ?";
+
+    /**
+     * 全部发货单
+     */
+    public static final String SALE_SEND_ALL_SQL = "select 'salesend' as category, ? as enuu, count(1) as count from sale$send where ss_enuu = ?";
+
+    /**
+     * 全部认定单
+     */
+    public static final String APPROVAL_ALL_SQL = "select 'approval' as category, ? as enuu, count(1) as count from purc$proofingapproval where psa_enuu = ?";
+
+    /**
+     * 全部打样申请单
+     */
+    public static final String SAMPLE_ALL_SQL = "select 'sample' as category, ? as enuu, count(1) as count from  purc$proofingitems where ppi_venduu = ?";
+
+    /**
+     * 待送样打样申请单
+     */
+    public static final String SAMPLE_TODO_SQL = "select 'sampletodo' as category, ? as enuu, count(1) as count from  purc$proofingitems where ppi_status = 401 and ppi_venduu = ?";
+
+    /**
+     * 全部客户验退单
+     */
+    public static final String SALEORDER_RETURN_ALL_SQL = "select 'returnsall' as category, ? as enuu, count(1) as count from purc$return where pr_venduu = ?";
+
+    /**
+     * 全部客户验收单
+     */
+    public static final String SALEORDER_ACCEPT_ALL_SQL = "select 'acceptall' as category, ? as enuu, count(1) as count from purc$accept where pa_venduu = ?";
+
+    /**
+     * 全部送货提醒
+     */
+    public static final String SALENOTICE_ALL_SQL = "select 'notice' as category, ? as enuu, count(1) as count from purc$notice where pn_venduu = ?";
+
+    /**
+     * 待发货送货提醒
+     */
+    public static final String SALENOTICE_TODO_SQL = "select 'notice' as category, ? as enuu, count(1) as count from purc$notice where pn_status = 200 and pn_venduu = ?";
+
+    /**
+     * 待处理客户采购变更单
+     */
+    public static final String SALEORDER_CHANGE_TODO_SQL = "select 'orderchange' as category, ? as enuu, count(1) as count from purc$changes " +
+            "where pc_status = 200 and pc_unneedreply = 0 and pc_venduu = ?";
+
+    /**
+     * 全部客户采购变更单
+     */
+    public static final String SALEORDER_CHANGE_ALL_SQL = "select 'orderchangeall' as category, ? as enuu, count(1) as count from purc$changes where pc_venduu = ?";
+
+    /**
+     * 全部采购单
+     */
+    public static final String PURCHASE_ORDER_ALL_SQL = "select 'orderall' as category, ? as enuu, count(1) as count from purc$orders where pu_enuu = ?";
+
+    /**
+     * 待处理采购单
+     */
+    public static final String PURCHASE__ORDER_TODO_SQL = "select 'order' as category, ? as enuu, count(1) as count from purc$orders where pu_status = 200 and pu_end <> 1 and pu_enuu = ?";
+
+    /**
+     * 待处理采购询价单
+     */
+    public static final String PURCHASE_INQUIRY_TODO_SQL = "select 'purcinquiry' as category, ? as enuu, count(1) as count from v$purc$inquiryitems d" +
+            " left join v$purc$inquiry i on i.in_id = d.id_inid " +
+            " where d.id_status = 200 and i.in_overdue = 0 and i.in_enuu = ?";
+
+    /**
+     * 全部客户采购询价
+     */
+    public static final String SALE_INQUIRY_ALL_SQL = "select 'inquiryall' as category, ? as enuu, count(1) as count from v$purc$inquiryitems where id_venduu = ?";
+
+    /**
+     * 待处理客户采购询价
+     */
+    public static final String SALE_INQUIRY_TODO_SQL = "select 'inquiry' AS category, ? AS enuu, count(1) as count from v$purc$inquiryitems" +
+            " left join v$purc$inquiry on id_inid = in_id " +
+            "where id_status = 200 and in_overdue <> 1 and id_venduu = ?";
+
+    /**
+     * 全部客户委外验收单
+     */
+    public static final String MAKE_ACCEPT_ALL_SQL = "select 'makeacceptall' as category, ? as enuu, count(1) as count from make$accept where ma_venduu = ?";
+
+    /**
+     * 待评标采购招标
+     */
+    public static final String SALE_TENDER_WAITING_SQL = "select 'saletenderwaiting' as category, ? as enuu, count(1) as count from v$purc$tender " +
+            "where pt_ispublish = 1 and pt_overdue = 1 and pt_result = 0 and pt_status = '待评标' and pt_enuu = ?";
+}

+ 36 - 94
src/main/java/com/uas/platform/b2b/service/impl/SnapshotServiceImpl.java

@@ -2,6 +2,7 @@ package com.uas.platform.b2b.service.impl;
 
 import com.uas.platform.b2b.dao.CommonDao;
 import com.uas.platform.b2b.model.Snapshot;
+import com.uas.platform.b2b.model.util.SnapshotSqlUtil;
 import com.uas.platform.b2b.service.SnapshotService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,8 +35,6 @@ public class SnapshotServiceImpl implements SnapshotService {
         getInquiryAll(snapshots, enUU);
         // 获取待处理采购询价单
         getPurchaseInquiryTodo(snapshots, enUU);
-        // 获取全部采购订单
-        getPurchaseAll(snapshots, enUU);
         // 获取待回复采购订单
         getPurchaseOrderTodo(snapshots, enUU);
         // 获取全部采购订单
@@ -110,9 +109,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleTenderWaiting(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'saletenderwaiting' as category, ? as enuu, count(1) as count from v$purc$tender " +
-                "where pt_ispublish = 1 and pt_overdue = 1 and pt_result = 0 and pt_status = '待评标' and pt_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_TENDER_WAITING_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -122,9 +119,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleTenderTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'saletendertodo' as category, ? as enuu, count(1) as count from v$purc$tender" +
-                " where pt_ispublish = 1  and pt_overdue = 0 and pt_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_TENDER_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -134,10 +129,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getTenderTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'tendertodo' as category, ? as enuu, count(1) as count from v$purc$tender" +
-                " left join sale$tender on st_code = pt_code and st_enuu = pt_enuu " +
-                " where pt_ispublish = 1 and v$purc$tender.pt_overdue = 0 and st_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.PURC_TENDER_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -147,9 +139,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleQuotationTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'inquirytodo' as category, ? as enuu, count(1) as count from sale$quotationitem " +
-                "left join sale$quotation on qu_id = qd_quid  where qu_status = 100 and qu_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_QUOTATAION_TDOD_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -159,9 +149,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getInquiryMouldTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = " select 'inquirymouldtodo' as category, ? as enuu, count(1) as count from purc$inquirymould " +
-                "where im_status = 200 and im_valid = 1 and im_overdue = 0 and im_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.INQUIRY_MOULD_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -171,8 +159,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getCart(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'carttodo' as category, ? as enuu, count(1) as count from purc$orders where pu_status = 311 and pu_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.CART_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -182,8 +169,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getApcheckTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'apchecktodo' as category, ? as enuu, count(1) as count from purc$apcheck where pa_checkstatus = '未对账' and pa_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.APCHECK_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -193,8 +179,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getArCheckTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'archecktoconfirm' as category, ? as enuu, count(1) as count from sale$archeck where sac_status = 200 and sac_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.ARCHECK_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -204,8 +189,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getArCheckAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'archeckall' as category, ? as enuu, count(1) as count from sale$archeck where sac_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.ARCHECK_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -215,8 +199,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getApbillAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'apbillall' as category, ? as enuu, count(1) as count from purc$apbill where pad_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.APBILL_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -226,8 +209,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMrbAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'mrb' as category, ? as enuu, count(1) as count from purc$mrb where pm_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MRB_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -237,8 +219,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getBadOutAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'salebadout' as category, ? as enuu, count(1) as count from purc$badout where po_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.BADOUT_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -248,8 +229,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getBadInAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'salebadin' as category, ? as enuu, count(1) as count from purc$badin where pb_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.BADIN_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -259,8 +239,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMakeOutAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'makeoutorderall' as category,  ? as enuu, count(1) as count from  make$orders where ma_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MAKEOUT_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -270,8 +249,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMakeReturnAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'makereturnall' as category, ? as enuu, count(1) as count from make$return where mr_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MAKE_RETURN_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -281,8 +259,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMakeAcceptAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'makeacceptall' as category, ? as enuu, count(1) as count from make$accept where ma_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MAKE_ACCEPT_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -292,8 +269,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMakeChangeAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'makeorderchangeall' as category, ? as enuu, count(1) as count from make$changeitems where mcd_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MAKE_CHANGE_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -303,8 +279,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMakeOrderAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'makeorder' as category, ? as enuu, count(1) as count from make$orders  where ma_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MAKE_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -314,8 +289,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getMakeOrderTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'makeorder' as category, ? as enuu, count(1) as count from make$orders  where ma_status = 200 and ma_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.MAKE_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -325,8 +299,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleSendDone(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'salesendverify' as category, ? as enuu, count(1) as count from sale$send where ss_verifystatus = 1 and ss_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_SEND_VERIFY_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -336,8 +309,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleSendAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'salesend' as category, ? as enuu, count(1) as count from sale$send where ss_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_SEND_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -347,8 +319,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getApprovalAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'approval' as category, ? as enuu, count(1) as count from purc$proofingapproval where psa_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.APPROVAL_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -358,8 +329,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSampleAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'sample' as category, ? as enuu, count(1) as count from  purc$proofingitems where ppi_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SAMPLE_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -369,8 +339,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSampleTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'sample' as category, ? as enuu, count(1) as count from  purc$proofingitems where ppi_status = 401 and ppi_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SAMPLE_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -380,8 +349,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleOrderReturnAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'returnsall' as category, ? as enuu, count(1) as count from purc$return where pr_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALEORDER_RETURN_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -391,8 +359,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleOrderAcceptAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'acceptall' as category, ? as enuu, count(1) as count from purc$accept where pa_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALEORDER_ACCEPT_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -402,8 +369,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleOrderNoticeAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'notice' as category, ? as enuu, count(1) as count from purc$notice where pn_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALENOTICE_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -413,8 +379,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleOrderNoticeTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'notice' as category, ? as enuu, count(1) as count from purc$notice where pn_status = 200 and pn_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALENOTICE_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -424,9 +389,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleChangeTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'orderchange' as category, ? as enuu, count(1) as count from purc$changes " +
-                "where pc_status = 200 and pc_unneedreply = 0 and pc_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALEORDER_CHANGE_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -436,8 +399,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getSaleChangeAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'orderchangeall' as category, ? as enuu, count(1) as count from purc$changes where pc_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALEORDER_CHANGE_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -447,19 +409,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getPurchaseOrderAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'orderall' as category, ? as enuu, count(1) as count from purc$orders where pu_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
-    }
-
-    /**
-     * 获取全部采购订单
-     *
-     * @param snapshots 快照
-     * @param enUU 企业UU
-     */
-    private void getPurchaseAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'order' as category, ? as enuu, count(1) as count from purc$orders where pu_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.PURCHASE_ORDER_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -469,8 +419,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getPurchaseOrderTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'order' as category, ? as enuu, count(1) as count from purc$orders where pu_status = 200 and pu_end <> 1 and pu_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.PURCHASE__ORDER_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -480,10 +429,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getPurchaseInquiryTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'purcinquiry' as category, ? as enuu, count(1) as count from v$purc$inquiryitems d" +
-                " left join v$purc$inquiry i on i.in_id = d.id_inid " +
-                " where d.id_status = 200 and i.in_overdue = 0 and i.in_enuu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.PURCHASE_INQUIRY_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -493,8 +439,7 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getInquiryAll(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'inquiryall' as category, ? as enuu, count(1) as count from v$purc$inquiryitems where id_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_INQUIRY_ALL_SQL, Snapshot.class, enUU, enUU));
     }
 
     /**
@@ -504,9 +449,6 @@ public class SnapshotServiceImpl implements SnapshotService {
      * @param enUU 企业UU
      */
     private void getInquiryTodo(List<Snapshot> snapshots, Long enUU) {
-        String sql = "select 'inquiry' AS category, ? AS enuu, count(1) as count from v$purc$inquiryitems" +
-                " left join v$purc$inquiry on id_inid = in_id " +
-                "where id_status = 200 and in_overdue <> 1 and id_venduu = ?";
-        snapshots.addAll(commonDao.query(sql, Snapshot.class, enUU, enUU));
+        snapshots.addAll(commonDao.query(SnapshotSqlUtil.SALE_INQUIRY_TODO_SQL, Snapshot.class, enUU, enUU));
     }
 }