Browse Source

统计某年某月询价明细总数

scr 7 years ago
parent
commit
8116365960

+ 48 - 31
src/main/java/com/uas/ps/inquiry/controller/PublicInquiryController.java

@@ -21,11 +21,13 @@ import com.uas.ps.inquiry.service.AttachService;
 import com.uas.ps.inquiry.service.InquiryForSaleService;
 import com.uas.ps.inquiry.service.PublicInquiryService;
 import com.uas.ps.inquiry.support.InquiryBufferedLogger;
+
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.rmi.AccessException;
 import java.util.List;
 import java.util.Map;
+
 import javassist.NotFoundException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -40,7 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 公共询价接口路径
- *
+ * <p>
  * Created by hejq on 2018-01-13.
  */
 @RestController
@@ -61,8 +63,8 @@ public class PublicInquiryController {
     /**
      * 将买家ERP的公共询价写到公共询价服务中心
      *
-     * @param data 封装的data
-     * @param enuu 询价企业UU
+     * @param data    封装的data
+     * @param enuu    询价企业UU
      * @param address 询价企业地址信息
      * @return
      * @throws UnsupportedEncodingException
@@ -96,9 +98,9 @@ public class PublicInquiryController {
     /**
      * (针对客户)获取公共询价服务中心供应商的报价信息
      *
+     * @param enuu 询价企业UU
      * @author hejq
      * @date 2018-01-14 15:20
-     * @param enuu 询价企业UU
      */
     @HttpLog
     @RequestMapping(value = "/quotation", method = RequestMethod.GET)
@@ -172,12 +174,12 @@ public class PublicInquiryController {
     /**
      * 将客户的公共询价列表中一条数据转成询价报价单数据
      *
-     * @author hejq
-     * @date 2018-01-14 15:20
-     * @param id 公共询价明细id
-     * @param enuu 报价企业UU
+     * @param id     公共询价明细id
+     * @param enuu   报价企业UU
      * @param useruu 报价个人UU
      * @return
+     * @author hejq
+     * @date 2018-01-14 15:20
      */
     @HttpLog
     @RequestMapping(value = "/turntoInquiry", method = RequestMethod.POST)
@@ -188,11 +190,11 @@ public class PublicInquiryController {
     /**
      * 通过分页参数和过滤条件查询公共询价列表信息
      *
-     * @author hejq
-     * @date 2018-01-17 10:27
-     * @param pageInfo 分页参数
+     * @param pageInfo     分页参数
      * @param searchFilter 过滤条件
      * @return
+     * @author hejq
+     * @date 2018-01-17 10:27
      */
     @HttpLog
     @RequestMapping(method = RequestMethod.GET)
@@ -213,7 +215,7 @@ public class PublicInquiryController {
     /**
      * 针对商城,查询已发布的公共询价信息
      *
-     * @param pageInfo 分页信息
+     * @param pageInfo     分页信息
      * @param searchFilter 过滤条件
      * @return
      */
@@ -238,20 +240,20 @@ public class PublicInquiryController {
     /**
      * 移动端查询公共询价列表信息
      *
-     * @param page 页码
-     * @param size 每页大小
-     * @param en_uu 企业UU
-     * @param _state 过滤状态
-     * @param keyword 搜索词
+     * @param page     页码
+     * @param size     每页大小
+     * @param en_uu    企业UU
+     * @param _state   过滤状态
+     * @param keyword  搜索词
      * @param user_tel 电话
      * @param fromDate 开始日期
-     * @param endDate 截止日期
+     * @param endDate  截止日期
      * @return
      */
     @HttpLog
     @RequestMapping(value = "/mobile", method = RequestMethod.GET)
     public ModelMap publincInquiry(Integer page, Integer size, Long en_uu, String _state,
-                                                    String keyword, String user_tel, Long fromDate, Long endDate) {
+                                   String keyword, String user_tel, Long fromDate, Long endDate) {
         ModelMap map = new ModelMap();
         PageInfo pageInfo = new PageInfo();
         if (page == null || page == 0) {
@@ -301,20 +303,20 @@ public class PublicInquiryController {
     /**
      * 移动端查询公共询价列表信息
      *
-     * @param page 页码
-     * @param size 每页大小
-     * @param en_uu 企业UU
-     * @param _state 过滤状态
-     * @param keyword 搜索词
+     * @param page     页码
+     * @param size     每页大小
+     * @param en_uu    企业UU
+     * @param _state   过滤状态
+     * @param keyword  搜索词
      * @param user_tel 电话
      * @param fromDate 开始日期
-     * @param endDate 截止日期
+     * @param endDate  截止日期
      * @return
      */
     @HttpLog
     @RequestMapping(value = "/mobile/v2", method = RequestMethod.GET)
     public ModelMap publicInquiry(Integer page, Integer size, Long en_uu, String _state,
-                                   String keyword, String user_tel, Long fromDate, Long endDate) {
+                                  String keyword, String user_tel, Long fromDate, Long endDate) {
         ModelMap map = new ModelMap();
         PageInfo pageInfo = new PageInfo();
         if (page == null || page == 0) {
@@ -363,12 +365,12 @@ public class PublicInquiryController {
 
     /**
      * 通过分页信息和过滤条件查询已转报价的信息
-     * 
-     * @author hejq
-     * @date 2018-01-18 15:36
+     *
      * @param pageInfo 分页参数
-     * @param filter 过滤条件
+     * @param filter   过滤条件
      * @return
+     * @author hejq
+     * @date 2018-01-18 15:36
      */
     @HttpLog
     @RequestMapping(value = "/quotation/list", method = RequestMethod.GET)
@@ -395,6 +397,7 @@ public class PublicInquiryController {
 
     /**
      * 通过id查询单个已转报价的信息
+     *
      * @param id
      * @return
      */
@@ -409,6 +412,7 @@ public class PublicInquiryController {
 
     /**
      * 商城获取采纳列表
+     *
      * @param pageInfo
      * @param filter
      * @param _state
@@ -470,6 +474,7 @@ public class PublicInquiryController {
 
     /**
      * 商城-采购排行榜
+     *
      * @return
      */
     @HttpLog
@@ -482,7 +487,7 @@ public class PublicInquiryController {
      * 通过明细id查询该条询价的详情
      *
      * @param itemId 明细id
-     * @param enuu enuu
+     * @param enuu   enuu
      * @return
      */
     @HttpLog
@@ -494,10 +499,22 @@ public class PublicInquiryController {
 
     /**
      * 公共询价单明细总数
+     *
      * @return
      */
     @RequestMapping(value = "/getPurcInquiryItemCount", method = RequestMethod.GET)
     public ModelMap getPurcInquiryItemCount() {
         return publicInquiryService.getPurcInquiryItemCount();
     }
+
+    /**
+     * 公共询价单明细某年某月总数
+     *
+     * @param month
+     * @return
+     */
+    @RequestMapping(value = "/getPurcInquiryItemCountByMonth", method = RequestMethod.GET)
+    public ModelMap getPurcInquiryItemCountByMonth(Integer year, Integer month) {
+        return publicInquiryService.countByMonth(year, month);
+    }
 }

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

@@ -3,15 +3,25 @@ package com.uas.ps.inquiry.dao;
 import com.uas.ps.inquiry.model.PurcInquiryItemInfo;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
 /**
  * 询价明细数据库操作
- *  <pre>
+ * <pre>
  *      明细带出主表信息,列表查询使用
  *  </pre>
  * Created by hejq on 2018-01-17.
  */
 @Repository
 public interface PurcInquiryItemInfoDao extends JpaSpecificationExecutor<PurcInquiryItemInfo>, JpaRepository<PurcInquiryItemInfo, Long> {
+
+    /**
+     * 查询某年某月的询价明细总数
+     *
+     * @param month
+     * @return
+     */
+    @Query(value = "select count(*) from purc$puinquiryitems where year(id_date)=?1 and month(id_date) = ?2", nativeQuery = true)
+    Long countByMonth(Integer year, Integer month);
 }

+ 46 - 31
src/main/java/com/uas/ps/inquiry/service/PublicInquiryService.java

@@ -5,15 +5,17 @@ import com.uas.ps.inquiry.entity.*;
 import com.uas.ps.inquiry.model.*;
 import com.uas.ps.inquiry.page.PageInfo;
 import com.uas.ps.inquiry.page.SearchFilter;
+
 import java.util.List;
 import java.util.Map;
+
 import javassist.NotFoundException;
 import org.springframework.data.domain.Page;
 import org.springframework.ui.ModelMap;
 
 /**
  * 公共询价接口
- *
+ * <p>
  * Created by hejq on 2018-01-13.
  */
 public interface PublicInquiryService {
@@ -21,32 +23,32 @@ public interface PublicInquiryService {
     /**
      * 保存公共询价信息
      *
+     * @param inquiries erp传入公共询价的信息
+     * @param enuu      询价企业UU号
+     * @param address   询价企业地址
      * @author hejq
      * @date 2018-01-14 11:45
-     * @param inquiries erp传入公共询价的信息
-     * @param enuu 询价企业UU号
-     * @param address 询价企业地址
      */
     void save(List<BatchInquiry> inquiries, Long enuu, String address) throws NotFoundException;
 
     /**
      * 将ERP传入的inquiry信息转成公共询价服务中心需要的信息
      *
-     * @author hejq
-     * @date 2018-01-14 11:45
      * @param inquiries 将ERP传入的inquiry信息
-     * @param enuu 询价企业UU号
+     * @param enuu      询价企业UU号
      * @return
+     * @author hejq
+     * @date 2018-01-14 11:45
      */
     List<PurcInquiry> covert(List<BatchInquiry> inquiries, Long enuu, String address) throws NotFoundException;
 
     /**
      * erp提交审核时,公共询价服务中心单据禁用报价功能
      *
+     * @param inquiries erp询价信息
+     * @param enuu      询价企业UU号
      * @author hejq
      * @date 2018-01-14 11:45
-     * @param inquiries erp询价信息
-     * @param enuu 询价企业UU号
      */
     void updateStatus(List<BatchInquiry> inquiries, Long enuu);
 
@@ -54,9 +56,9 @@ public interface PublicInquiryService {
      * 查询供应商的报价信息
      *
      * @param enuu 企业uu
+     * @return
      * @author hejq
      * @date 2018-01-14 11:45
-     * @return
      */
     List<InquiryDetail> findNotUploadReply(Long enuu);
 
@@ -64,9 +66,9 @@ public interface PublicInquiryService {
      * 将平台的公共询价转成ERP的对应的字段
      *
      * @param notUploadReply 未下载的供应商报价信息
+     * @return
      * @author hejq
      * @date 2018-01-14 11:51
-     * @return
      */
     List<InquiryDetail> convertPublicInquiryReply(List<PublicInquiryItem> notUploadReply);
 
@@ -82,65 +84,66 @@ public interface PublicInquiryService {
     /**
      * ERP提交公共询价单之后,更新平台状态,让公共询价服务中心询价单不能进行报价操作
      *
+     * @param inquiries 询价信息
      * @author hejq
      * @date 2018-01-14 12:20
-     * @param inquiries 询价信息
      */
     void updateInquiryStatus(List<InquiryDetail> inquiries, Long enuu);
 
     /**
      * ERP对报价信息的采纳状态上传到公共询价服务中心
      *
+     * @param decides 采纳信息
      * @author hejq
      * @date 2018-01-14 12:24
-     * @param decides 采纳信息
      */
     void onReplyDecide(List<InquiryDecide> decides, Long enuu);
 
     /**
      * 将ERP的报价采纳信息转为公共询价服务中心需要的信息
-     * 
+     *
+     * @param decides erp报价采纳信息
      * @author hejq
      * @date 2018-01-14 12:26
-     * @param decides erp报价采纳信息
      */
     List<PublicInquiryItem> convertInquiryDecide(List<InquiryDecide> decides);
 
     /**
      * 买家ERP作废询价单后,修改公共询价服务中心里面的状态
      *
+     * @param inquiries 询价信息
+     * @param enuu      企业UU
      * @author hejq
      * @date 2018-01-14 12:28
-     * @param inquiries 询价信息
-     * @param enuu 企业UU
      */
     void onReplyInvalid(List<Inquiry> inquiries, Long enuu);
 
     /**
      * 将公共询价列表转成需要报价的询价单,类型是公共询价
      *
-     * @author hejq
-     * @date 2018-01-14 14:46
-     * @param id 询价明细id
-     * @param enuu 报价企业UU
+     * @param id     询价明细id
+     * @param enuu   报价企业UU
      * @param useruu 报价人uu
      * @return
+     * @author hejq
+     * @date 2018-01-14 14:46
      */
     ModelMap transtoInquiry(Long id, Long enuu, Long useruu);
 
     /**
      * 通过分页参数和过滤条件查询报价信息
      *
-     * @author hejq
-     * @date 2018-01-17 10:30
-     * @param info 分页参数
+     * @param info   分页参数
      * @param filter 过滤条件
      * @return
+     * @author hejq
+     * @date 2018-01-17 10:30
      */
     IPage<PublicInquiryItemInfo> findByPageInfo(PageInfo info, SearchFilter filter);
 
     /**
      * 通过id查询单个已转报价的信息
+     *
      * @param id
      * @return
      */
@@ -148,6 +151,7 @@ public interface PublicInquiryService {
 
     /**
      * 商城获取采纳列表
+     *
      * @param info
      * @param filter
      * @return
@@ -156,11 +160,12 @@ public interface PublicInquiryService {
 
     /**
      * 通过分页参数和过滤条件查询公共询价价信息
-     * @author hejq
-     * @date 2018-01-18 15:32
+     *
      * @param info
      * @param filter
      * @return
+     * @author hejq
+     * @date 2018-01-18 15:32
      */
     IPage<PurcInquiryItemInfo> findTodoByPageInfo(PageInfo info, SearchFilter filter);
 
@@ -168,7 +173,7 @@ public interface PublicInquiryService {
      * 根据传入条件封装查询条件
      *
      * @param pageInfo 分页参数
-     * @param state 过滤条件
+     * @param state    过滤条件
      * @return
      */
     PageInfo covert(PageInfo pageInfo, String state, Short overdue);
@@ -186,7 +191,7 @@ public interface PublicInquiryService {
      * 消息推送
      *
      * @param inquiryItems 询价明细
-     * @param sourceApp 应用来源
+     * @param sourceApp    应用来源
      * @throws Exception
      */
     void notifyMessage(List<PurcInquiryItem> inquiryItems, String sourceApp) throws Exception;
@@ -194,7 +199,7 @@ public interface PublicInquiryService {
     /**
      * 针对供应商,客户对报价采纳结果进行消息通知
      *
-     * @param item 询价明细
+     * @param item      询价明细
      * @param sourceApp 来源
      */
     void notifyDecide(PublicInquiryItem item, String sourceApp);
@@ -209,6 +214,7 @@ public interface PublicInquiryService {
 
     /**
      * 商城-采购排行榜
+     *
      * @return
      */
     List<Map<String, Object>> findCodeRankingList();
@@ -232,7 +238,7 @@ public interface PublicInquiryService {
     /**
      * 消息推送
      *
-     * @param item 询价明细
+     * @param item      询价明细
      * @param sourceApp 应用来源
      * @return
      */
@@ -241,7 +247,7 @@ public interface PublicInquiryService {
     /**
      * 消息推送
      *
-     * @param item 询价明细
+     * @param item      询价明细
      * @param sourceApp 应用来源
      * @return
      */
@@ -258,8 +264,17 @@ public interface PublicInquiryService {
 
     /**
      * 公共询价单明细总数
+     *
      * @return
      */
     ModelMap getPurcInquiryItemCount();
+
+    /**
+     * 查询某年某月的询价明细总数
+     *
+     * @param month
+     * @return
+     */
+    ModelMap countByMonth(Integer year, Integer month);
 }
 

+ 104 - 74
src/main/java/com/uas/ps/inquiry/service/impl/PublicInquiryServiceImpl.java

@@ -38,7 +38,7 @@ import java.util.*;
 
 /**
  * 公共询价接口实现
- *
+ * <p>
  * Created by hejq on 2018-01-13.
  */
 @Service
@@ -175,8 +175,8 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      * 保存公共询价信息
      *
      * @param inquiries erp传入公共询价的信息
-     * @param enuu 询价企业UU号
-     * @param address 询价企业地址
+     * @param enuu      询价企业UU号
+     * @param address   询价企业地址
      */
     @Override
     public void save(List<BatchInquiry> inquiries, Long enuu, String address) throws NotFoundException {
@@ -219,19 +219,19 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      * 消息推送
      *
      * @param inquiryItems 询价明细
-     * @param sourceApp 消息来源应用
+     * @param sourceApp    消息来源应用
      */
     @Override
     public void notifyMessage(List<PurcInquiryItem> inquiryItems, String sourceApp) throws Exception {
-        final String CONSUMERAPP ="MALL,B2B";
+        final String CONSUMERAPP = "MALL,B2B";
         for (PurcInquiryItem item : inquiryItems) {
-           String cmpCode = null;
-           if (item.getCmpCode() != null) {
-               cmpCode = item.getCmpCode();
-           } else if (null != item.getProductId()) {
-               Product product = productDao.findOne(item.getProductId());
-               cmpCode = product.getCmpCode();
-           }
+            String cmpCode = null;
+            if (item.getCmpCode() != null) {
+                cmpCode = item.getCmpCode();
+            } else if (null != item.getProductId()) {
+                Product product = productDao.findOne(item.getProductId());
+                cmpCode = product.getCmpCode();
+            }
             if (null != cmpCode) {
                 String url = PS_PRODUCT_URL + "/productuser/getProductUsersByEnUUAndCmpCode";
                 JSONObject formData = new JSONObject();
@@ -325,13 +325,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
             public Predicate toPredicate(Root<ProductReplace> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                 final PredicateFactory<ProductReplace> factory = new PredicateFactory<>();
                 factory.add(PredicateUtils.ne("userUU", userUU, false));
-                factory.add(PredicateUtils.and (PredicateUtils.isNotNull("ptrCmpcode"), PredicateUtils.eq("ptrCmpcode", cmpCode, false)));
+                factory.add(PredicateUtils.and(PredicateUtils.isNotNull("ptrCmpcode"), PredicateUtils.eq("ptrCmpcode", cmpCode, false)));
                 query.where(factory.toPredicate(root, query, cb));
                 return null;
             }
         });
         if (!CollectionUtils.isEmpty(productReplacesList)) {
-            for (ProductReplace productReplace:productReplacesList) {
+            for (ProductReplace productReplace : productReplacesList) {
                 ProductUsers user = new ProductUsers();
                 user.setEnuu(productReplace.getEnuu());
                 user.setUseruu(productReplace.getUserUU());
@@ -354,7 +354,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
     /**
      * 通过查询的个人物料相关联的信息,自动生成推荐的报价的数据
      *
-     * @param item 报价明细
+     * @param item  报价明细
      * @param users 用户信息
      */
     private void remindInquiry(final PurcInquiryItem item, final List<ProductUsers> users) {
@@ -450,13 +450,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      * 将ERP传入的inquiry信息转成公共询价服务中心需要的信息
      *
      * @param inquiries 将ERP传入的inquiry信息
-     * @param enuu 询价企业UU号
-     * @param address 询价企业地址
+     * @param enuu      询价企业UU号
+     * @param address   询价企业地址
      * @return
      */
     @Override
     public List<PurcInquiry> covert(List<BatchInquiry> inquiries, Long enuu, String address) throws NotFoundException {
-        List<PurcInquiry>  purcInquiries = new ArrayList<PurcInquiry>();
+        List<PurcInquiry> purcInquiries = new ArrayList<PurcInquiry>();
         if (!CollectionUtils.isEmpty(inquiries)) {
             for (BatchInquiry inquiry : inquiries) {
                 PurcInquiry old = purcInquiryDao.findByCodeAndEnUU(inquiry.getBi_code(), enuu);
@@ -528,7 +528,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      * erp提交审核时,公共询价服务中心单据禁用报价功能
      *
      * @param inquiries erp询价信息
-     * @param enuu 询价企业UU号
+     * @param enuu      询价企业UU号
      */
     @Override
     public void updateStatus(List<BatchInquiry> inquiries, Long enuu) {
@@ -547,7 +547,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      */
     @Override
     public List<InquiryDetail> findNotUploadReply(Long enuu) {
-        List<PublicInquiryItem> items =  publicInquiryItemDao.findByEnUUAndBackStatus(enuu, (short) Status.NOT_UPLOAD.value());
+        List<PublicInquiryItem> items = publicInquiryItemDao.findByEnUUAndBackStatus(enuu, (short) Status.NOT_UPLOAD.value());
         if (!CollectionUtils.isEmpty(items)) {
             // 防止下载过程中进行操作,这里设置一个下载中的状态
             Set<Long> ids = new HashSet<>();
@@ -640,7 +640,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
     /**
      * 针对供应商,客户对报价结果发送消息通知
      *
-     * @param item 询价明细
+     * @param item      询价明细
      * @param sourceApp 应用来源
      */
     @Override
@@ -716,7 +716,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
      * 买家ERP作废询价单后,修改公共询价服务中心里面的状态
      *
      * @param inquiries 询价信息
-     * @param enuu 企业UU
+     * @param enuu      企业UU
      * @author hejq
      * @date 2018-01-14 12:28
      */
@@ -885,7 +885,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
                         }
                         item = publicInquiryItemDao.findOne(idid);
                         //回复清单更新
-                        if(replies.size() > 0) {
+                        if (replies.size() > 0) {
                             for (PublicInquiryReply reply1 : replies) {
                                 jdbcTemplate.update("update public$inquiryreply set ir_idid = " + idid + "where ir_id = " + reply1.getId());
                             }
@@ -980,7 +980,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
     /**
      * 查询公共询价列表信息
      *
-     * @param info 分页参数
+     * @param info   分页参数
      * @param filter 过滤条件
      * @return
      */
@@ -1113,7 +1113,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
         }
         String sql = "select * from (select p.id_id id, p.id_prodtitle prodTitle, p.id_date as date, i.in_enuu enuu from purc$puinquiryitems p left join purc$puinquiry i on i.in_id = p.id_inid where 1=1";
         if (enuu != null) {
-            sql = sql + " and i.in_enuu <> " + enuu ;
+            sql = sql + " and i.in_enuu <> " + enuu;
         }
         sql = sql + " and COALESCE(p.id_overdue, 0) <> 1 order by p.id_id desc) i limit " + size;
         List<PurcInquiryItem> items = jdbcTemplate.query(sql, new BeanPropertyRowMapper<PurcInquiryItem>(PurcInquiryItem.class));
@@ -1154,6 +1154,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
 
     /**
      * 商城-采购排行榜
+     *
      * @return
      */
     @Override
@@ -1172,7 +1173,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
     @Override
     public PurcInquiryItemInfo findItemByItemId(Long itemId, Long enuu) {
         PurcInquiryItemInfo itemInfo = inquiryItemInfoDao.findOne(itemId);
-         PublicInquiryItem item = publicInquiryItemDao.findByVendUUAndSourceId(enuu, itemInfo.getId());
+        PublicInquiryItem item = publicInquiryItemDao.findByVendUUAndSourceId(enuu, itemInfo.getId());
         itemInfo.setQuoted(Constant.NO);
         if (null != item) {
             itemInfo.setAgreed(item.getAgreed());
@@ -1192,6 +1193,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
 
     /**
      * 通过id查询单个已转报价的信息
+     *
      * @param id
      * @return
      */
@@ -1230,13 +1232,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
                         itemInfo.setAgreed(Constant.YES);
                     }
                     itemInfo.setQuoted(Constant.NO);
-                   if (remind.getStatus().equals(Status.SUBMITTED.value())) {
-                       itemInfo.setQuoted(Constant.YES);
-                       itemInfo.setQuteId(remind.getNewId());
-                   }
-                   if (itemInfo.getRemainingTime() <= 0) {
-                       itemInfo.setOverdue(Constant.YES);
-                   }
+                    if (remind.getStatus().equals(Status.SUBMITTED.value())) {
+                        itemInfo.setQuoted(Constant.YES);
+                        itemInfo.setQuteId(remind.getNewId());
+                    }
+                    if (itemInfo.getRemainingTime() <= 0) {
+                        itemInfo.setOverdue(Constant.YES);
+                    }
                     infoList.add(itemInfo);
                 }
             }
@@ -1247,62 +1249,63 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
     /**
      * 针对供应商,客户将拒绝理由发送信息给供应商
      *
-     * @param item 询价明细
+     * @param item      询价明细
      * @param sourceApp 应用来源
      * @throws Exception
      */
     @Override
     public Page<MessageModel> refuseMessage(PublicInquiryItem item, String sourceApp) {
-        if (null != item.getVendUU() && null != item.getVendUserUU() ) {
-                final String SMS_TYPE = "SM"; //发送信息
-                final String CONSUMERAPP ="MALL";
-                List<MessageModel> models = new ArrayList<MessageModel>();
-                String Buyer=item.getInquiry().getEnName() == null ? item.getInquiry().getRecorder():item.getInquiry().getEnName();
-                String cmpCode = item.getCmpCode();
-                String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
-                String content= "因"+item.getRefusereason() + "," + Buyer + "【未采纳】您关于“型号:" + cmp + "”的报价。期待与您的下次合作!" ;
-                MessageModel model = new MessageModel();
-                model.setType(INQUIRY_DECIDE_TYPE_MALL);
-                model.setProducerApp(sourceApp);
-                model.setConsumerType(CUST_TYPE);
-                model.setConsumerApp(CONSUMERAPP);
-                model.setContent(content);
-                model.setRemark(String.valueOf(item.getInquiry().getId()));
-                model.setSourceId(item.getId());
-                model.setReceiverEnuu(item.getVendUU());
-                model.setReceiverUu(item.getVendUserUU());
-                model.setSenderEnuu(item.getInquiry().getEnUU());
-                if (null != item.getUserUU() || null != item.getInquiry().getRecorderUU()) {
-                    model.setSenderUu(item.getUserUU() != null ? item.getUserUU() : item.getInquiry().getRecorderUU());
-                } else {
-                    Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
-                    model.setSenderUu(null != enterprise ? enterprise.getAdminUU() : 0L);
-                }
-                model.setSmsType(SMS_TYPE);
-                models.add(model);
-                if (!CollectionUtils.isEmpty(models)) {
-                    sendMessage(models);
-                }
+        if (null != item.getVendUU() && null != item.getVendUserUU()) {
+            final String SMS_TYPE = "SM"; //发送信息
+            final String CONSUMERAPP = "MALL";
+            List<MessageModel> models = new ArrayList<MessageModel>();
+            String Buyer = item.getInquiry().getEnName() == null ? item.getInquiry().getRecorder() : item.getInquiry().getEnName();
+            String cmpCode = item.getCmpCode();
+            String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
+            String content = "因" + item.getRefusereason() + "," + Buyer + "【未采纳】您关于“型号:" + cmp + "”的报价。期待与您的下次合作!";
+            MessageModel model = new MessageModel();
+            model.setType(INQUIRY_DECIDE_TYPE_MALL);
+            model.setProducerApp(sourceApp);
+            model.setConsumerType(CUST_TYPE);
+            model.setConsumerApp(CONSUMERAPP);
+            model.setContent(content);
+            model.setRemark(String.valueOf(item.getInquiry().getId()));
+            model.setSourceId(item.getId());
+            model.setReceiverEnuu(item.getVendUU());
+            model.setReceiverUu(item.getVendUserUU());
+            model.setSenderEnuu(item.getInquiry().getEnUU());
+            if (null != item.getUserUU() || null != item.getInquiry().getRecorderUU()) {
+                model.setSenderUu(item.getUserUU() != null ? item.getUserUU() : item.getInquiry().getRecorderUU());
+            } else {
+                Enterprise enterprise = enterpriseDao.findOne(item.getInquiry().getEnUU());
+                model.setSenderUu(null != enterprise ? enterprise.getAdminUU() : 0L);
             }
+            model.setSmsType(SMS_TYPE);
+            models.add(model);
+            if (!CollectionUtils.isEmpty(models)) {
+                sendMessage(models);
+            }
+        }
         return null;
 
     }
+
     /**
      * 针对供应商,把客户采纳报价的消息发送给供应商
      *
-     * @param item 询价明细
+     * @param item      询价明细
      * @param sourceApp 应用来源
      * @throws Exception
      */
     @Override
     public Page<MessageModel> adoptMessage(PublicInquiryItem item, String sourceApp) {
-        if (null != item.getVendUU() && null != item.getVendUserUU() ) {
+        if (null != item.getVendUU() && null != item.getVendUserUU()) {
             final String SMS_TYPE = "SM"; //发送信息
-            final String CONSUMERAPP ="MALL";
+            final String CONSUMERAPP = "MALL";
             List<MessageModel> models = new ArrayList<MessageModel>();
             String cmpCode = item.getCmpCode();
             String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
-            String content= item.getInquiry().getEnName()+"【已采纳】您关于'型号:'" + cmp + "的报价,期待与您的合作!" ;
+            String content = item.getInquiry().getEnName() + "【已采纳】您关于'型号:'" + cmp + "的报价,期待与您的合作!";
             MessageModel model = new MessageModel();
             model.setType(INQUIRY_DECIDE_TYPE_MALL);
             model.setProducerApp(sourceApp);
@@ -1332,13 +1335,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
 
     @Override
     public Page<MessageModel> ReceiveMessage(PublicInquiryItem item, String sourceApp) {
-        if (null != item.getVendUU() && null != item.getVendUserUU() ) {
+        if (null != item.getVendUU() && null != item.getVendUserUU()) {
             final String SMS_TYPE = "SM"; //发送信息
-            final String CONSUMERAPP ="MALL";
+            final String CONSUMERAPP = "MALL";
             List<MessageModel> models = new ArrayList<MessageModel>();
             String cmpCode = item.getCmpCode();
             String cmp = cmpCode.length() > 10 ? cmpCode.substring(0, 10).concat("...") : cmpCode;
-            String content= "您收到了"+item.getVendName()+"关于“型号:"+ cmp +"“的报价,马上去看一看吧!";
+            String content = "您收到了" + item.getVendName() + "关于“型号:" + cmp + "“的报价,马上去看一看吧!";
 
             MessageModel model = new MessageModel();
             model.setType(INQUIRY_TYPE_MALL);
@@ -1370,9 +1373,36 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
 
     @Override
     public ModelMap getPurcInquiryItemCount() {
-        ModelMap result = new ModelMap();
-        Long count = inquiryItemInfoDao.count();
-        result.put("count", count);
+        ModelMap result = null;
+        try {
+            result = new ModelMap();
+            Long count = inquiryItemInfoDao.count();
+            result.put("count", count);
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+        return result;
+    }
+
+    /**
+     * 查询某年某月的询价明细总数
+     *
+     * @param month
+     * @return
+     */
+    public ModelMap countByMonth(Integer year, Integer month) {
+        ModelMap result = null;
+        try {
+            result = new ModelMap();
+            Long count = inquiryItemInfoDao.countByMonth(year, month);
+            result.put("count", count);
+            result.put("success", "true");
+        } catch (Exception e) {
+            result.put("message", e.getMessage());
+            result.put("success", false);
+            e.printStackTrace();
+        }
         return result;
     }
 }