|
|
@@ -1,21 +1,19 @@
|
|
|
package com.uas.ps.inquiry.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.uas.ps.inquiry.entity.BatchInquiry;
|
|
|
-import com.uas.ps.inquiry.entity.Inquiry;
|
|
|
-import com.uas.ps.inquiry.entity.InquiryDecide;
|
|
|
-import com.uas.ps.inquiry.entity.InquiryDetail;
|
|
|
-import com.uas.ps.inquiry.model.PublicInquiryItem;
|
|
|
+import com.uas.ps.inquiry.entity.*;
|
|
|
import com.uas.ps.inquiry.model.PublicInquiryItemInfo;
|
|
|
+import com.uas.ps.inquiry.model.PublicInquiryReply;
|
|
|
import com.uas.ps.inquiry.model.PurcInquiryItemInfo;
|
|
|
+import com.uas.ps.inquiry.page.FilterCondition;
|
|
|
import com.uas.ps.inquiry.page.PageInfo;
|
|
|
import com.uas.ps.inquiry.page.SearchFilter;
|
|
|
-import com.uas.ps.inquiry.page.exception.IllegalOperatorException;
|
|
|
import com.uas.ps.inquiry.service.PublicInquiryService;
|
|
|
import javassist.NotFoundException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
@@ -44,7 +42,7 @@ public class PublicInquiryController {
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.POST)
|
|
|
- public void saveInquiries(@RequestParam("data") String data, @RequestParam("enuu") Long enuu, @RequestParam("address") String address) throws NotFoundException, UnsupportedEncodingException {
|
|
|
+ public void saveInquiries(@RequestParam("data") String data, Long enuu, String address) throws NotFoundException, UnsupportedEncodingException {
|
|
|
String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
address = URLDecoder.decode(address, "UTF-8");
|
|
|
List<BatchInquiry> inquiries = JSONObject.parseArray(jsonStr, BatchInquiry.class);
|
|
|
@@ -72,7 +70,7 @@ public class PublicInquiryController {
|
|
|
* @date 2018-01-14 15:20
|
|
|
* @param enuu 询价企业UU
|
|
|
*/
|
|
|
- @RequestMapping(value = "/infos", method = RequestMethod.GET)
|
|
|
+ @RequestMapping(value = "/quotation", method = RequestMethod.GET)
|
|
|
public List<InquiryDetail> getReply(Long enuu) {
|
|
|
List<InquiryDetail> details = publicInquiryService.findNotUploadReply(enuu);
|
|
|
return details;
|
|
|
@@ -86,7 +84,7 @@ public class PublicInquiryController {
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@RequestMapping(value = "/reply/back", method = RequestMethod.POST)
|
|
|
- public void onReplySuccess(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ public void onReplySuccess(@RequestParam("data") String data, Long enuu) throws UnsupportedEncodingException {
|
|
|
String[] idArray = URLDecoder.decode(data, "UTF-8").split(",");
|
|
|
publicInquiryService.onReplyUploadSuccess(idArray);
|
|
|
}
|
|
|
@@ -98,7 +96,7 @@ public class PublicInquiryController {
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@RequestMapping(value = "/checking", method = RequestMethod.POST)
|
|
|
- public void checkInquiry(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ public void checkInquiry(@RequestParam("data") String data, Long enuu) throws UnsupportedEncodingException {
|
|
|
String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
List<Inquiry> inquiries = JSONObject.parseArray(jsonStr, Inquiry.class);
|
|
|
publicInquiryService.updateInquiryStatus(inquiries);
|
|
|
@@ -111,7 +109,7 @@ public class PublicInquiryController {
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@RequestMapping(value = "/reply/decide", method = RequestMethod.POST)
|
|
|
- public void onReplyDecide(@RequestParam("data") String data, @RequestParam("enuu") Long enuu) throws UnsupportedEncodingException {
|
|
|
+ public void onReplyDecide(@RequestParam("data") String data, Long enuu) throws UnsupportedEncodingException {
|
|
|
String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
List<InquiryDecide> decides = JSONObject.parseArray(jsonStr, InquiryDecide.class);
|
|
|
publicInquiryService.onReplyDecide(decides, enuu);
|
|
|
@@ -125,7 +123,7 @@ public class PublicInquiryController {
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
@RequestMapping(value = "/invalid", method = RequestMethod.POST)
|
|
|
- public void onReplyInvalid(@RequestParam("data") String data, @RequestParam("enuu") Long enuu) throws UnsupportedEncodingException {
|
|
|
+ public void onReplyInvalid(@RequestParam("data") String data, Long enuu) throws UnsupportedEncodingException {
|
|
|
String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
List<Inquiry> inquiries = JSONObject.parseArray(jsonStr, Inquiry.class);
|
|
|
publicInquiryService.onReplyInvalid(inquiries, enuu);
|
|
|
@@ -166,7 +164,7 @@ public class PublicInquiryController {
|
|
|
* @param page 页码
|
|
|
* @param size 每页大小
|
|
|
* @param en_uu 企业UU
|
|
|
- * @param state 过滤状态
|
|
|
+ * @param _state 过滤状态
|
|
|
* @param keyword 搜索词
|
|
|
* @param user_tel 电话
|
|
|
* @param fromDate 开始日期
|
|
|
@@ -174,16 +172,45 @@ public class PublicInquiryController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/mobile", method = RequestMethod.GET)
|
|
|
- public Page<PurcInquiryItemInfo> publincInquiry(Integer page, Integer size, Long en_uu, String state,
|
|
|
+ public ModelMap publincInquiry(Integer page, Integer size, Long en_uu, String _state,
|
|
|
String keyword, String user_tel, Long fromDate, Long endDate) {
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
PageInfo pageInfo = new PageInfo();
|
|
|
- pageInfo.setPageNumber(page);
|
|
|
- pageInfo.setPageSize(size);
|
|
|
+ if (page == 0) {
|
|
|
+ pageInfo.setPageNumber(1);
|
|
|
+ } else {
|
|
|
+ pageInfo.setPageNumber(page);
|
|
|
+ }
|
|
|
+ if (size == 0) {
|
|
|
+ pageInfo.setPageSize(5);
|
|
|
+ } else {
|
|
|
+ pageInfo.setPageSize(size);
|
|
|
+ }
|
|
|
+ pageInfo.setOffset(pageInfo.getPageSize() * (pageInfo.getPageNumber() - 1));
|
|
|
SearchFilter filter = new SearchFilter();
|
|
|
filter.setFromDate(fromDate);
|
|
|
filter.setEndDate(endDate);
|
|
|
filter.setKeyword(keyword);
|
|
|
- return publicInquiryService.findTodoByPageInfo(pageInfo, filter);
|
|
|
+ if (StringUtils.hasText(_state)) {
|
|
|
+ if (_state.equals(OrderStatus.end.name())) {
|
|
|
+ pageInfo.filter("overdue", Constant.YES);
|
|
|
+ map.put("content", publicInquiryService.findTodoByPageInfo(pageInfo, filter).getContent());
|
|
|
+ return map;
|
|
|
+ } else if (_state.equals(OrderStatus.invalid)) {
|
|
|
+ pageInfo.filter("invalid", Constant.YES);
|
|
|
+ map.put("content", publicInquiryService.findTodoByPageInfo(pageInfo, filter).getContent());
|
|
|
+ return map;
|
|
|
+ } else if (_state.equals(OrderStatus.done.name())) {
|
|
|
+ filter.setVendUU(en_uu);
|
|
|
+ filter.setKeyword(keyword);
|
|
|
+ map.put("content", publicInquiryService.findByPageInfo(pageInfo, filter).getContent());
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ map.put("content", publicInquiryService.findTodoByPageInfo(pageInfo, filter).getContent());
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -192,18 +219,21 @@ public class PublicInquiryController {
|
|
|
* @author hejq
|
|
|
* @date 2018-01-18 15:36
|
|
|
* @param pageInfo 分页参数
|
|
|
- * @param searchFilter 过滤条件
|
|
|
+ * @param filter 过滤条件
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/quotation/list", method = RequestMethod.GET)
|
|
|
- public Page<PublicInquiryItem> getQuotation(PageInfo pageInfo, SearchFilter searchFilter) {
|
|
|
+ public Page<PublicInquiryItemInfo> getQuotation(PageInfo pageInfo, String filter, String _state) {
|
|
|
+ SearchFilter searchFilter = JSONObject.parseObject(filter, SearchFilter.class);
|
|
|
if (null != searchFilter.getVendUU()) {
|
|
|
pageInfo.filter("vendUU", searchFilter.getVendUU());
|
|
|
} else if (null != searchFilter.getEnUU()) {
|
|
|
- pageInfo.filter("inquiry.enUU", searchFilter.getVendUU());
|
|
|
- } else {
|
|
|
- throw new IllegalOperatorException("参数格式不对");
|
|
|
+ pageInfo.filter("inquiry.enUU", searchFilter.getEnUU());
|
|
|
}
|
|
|
- return publicInquiryService.findByPageInfo(pageInfo, searchFilter);
|
|
|
+ if (null != _state) {
|
|
|
+ pageInfo = publicInquiryService.covert(pageInfo, _state);
|
|
|
+ }
|
|
|
+ return publicInquiryService.findByPageInfo(pageInfo, searchFilter);
|
|
|
}
|
|
|
+
|
|
|
}
|