|
|
@@ -8,8 +8,11 @@ import com.uas.platform.b2b.search.SearchService;
|
|
|
import com.uas.platform.b2b.service.PurcOrderChangeService;
|
|
|
import com.uas.platform.b2b.service.PurchaseOrderChangeService;
|
|
|
import com.uas.platform.b2b.service.UserService;
|
|
|
+import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
import com.uas.platform.b2b.support.SPageUtils;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
+import com.uas.platform.b2b.support.UsageBufferedLogger;
|
|
|
+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.PageParams;
|
|
|
@@ -22,7 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -47,6 +52,8 @@ public class PurcOrderChangeController {
|
|
|
@Autowired
|
|
|
private PurchaseOrderChangeService purchaseOrderChangeService;
|
|
|
|
|
|
+ private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
+
|
|
|
/**
|
|
|
* 查询可以做采购变更单的采购单
|
|
|
*
|
|
|
@@ -75,20 +82,100 @@ public class PurcOrderChangeController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 以客户的角度,查询所有的采购变更单
|
|
|
+ * 以客户的角度,查询所有采购变更单
|
|
|
*
|
|
|
* @param params 分页信息
|
|
|
* @param searchFilter 过滤条件
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(value = "/info", params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
+ @RequestMapping(value = "/info",method = RequestMethod.GET)
|
|
|
public SPage<PurchaseOrderChange> getAllPurcOrderChange(PageParams params, String searchFilter) {
|
|
|
SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
- // 当前登录企业作为供应商
|
|
|
+ // 当前登录企业作为买方
|
|
|
+ if (!StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ pageParams.getFilters().put("pc_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("pc_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseOrderChangeIds(filter.getKeyword(), pageParams);
|
|
|
+ } else {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ return SPageUtils.covertSPage(orderChangeService.findByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 以客户的角度,查询采购变更单(待确认)
|
|
|
+ *
|
|
|
+ * @param params 分页信息
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/info", params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
+ public SPage<PurchaseOrderChange> getPurcOrderChangeTodo(PageParams params, String searchFilter) {
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为买方
|
|
|
if (!StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
pageParams.getFilters().put("pc_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
pageParams.getFilters().put("pc_status", Status.NOT_REPLY.value());
|
|
|
+ pageParams.getFilters().put("pc_unneedreply", Constant.NO);
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("pc_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseOrderChangeIds(filter.getKeyword(), pageParams);
|
|
|
+ } else {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("status",Status.NOT_REPLY.value());
|
|
|
+ pageInfo.filter("unNeedReply",Constant.NO);
|
|
|
+ return SPageUtils.covertSPage(orderChangeService.findByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 以客户的角度,查询采购变更单(已处理)
|
|
|
+ *
|
|
|
+ * @param params 分页信息
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/info", params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
+ public SPage<PurchaseOrderChange> getPurcOrderChangeDone(PageParams params, String searchFilter) {
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为买方
|
|
|
+ if (!StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ pageParams.getFilters().put("pc_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageParams.getFilters().put("pc_status", Status.REPLIED.value());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("pc_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchPurchaseOrderChangeIds(filter.getKeyword(), pageParams);
|
|
|
+ } else {
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("status",Status.REPLIED.value());
|
|
|
+ return SPageUtils.covertSPage(orderChangeService.findByPageInfo(pageInfo, filter));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 以客户的角度,查询采购变更单(无需确认)
|
|
|
+ *
|
|
|
+ * @param params 分页信息
|
|
|
+ * @param searchFilter 过滤条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/info", params = RequestState.UNREAD, method = RequestMethod.GET)
|
|
|
+ public SPage<PurchaseOrderChange> getPurcOrderChangeUnread(PageParams params, String searchFilter) {
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
|
|
|
+ // 当前登录企业作为买方
|
|
|
+ if (!StringUtils.isEmpty(filter.getKeyword())) {
|
|
|
+ pageParams.getFilters().put("pc_enuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
pageParams.getFilters().put("pc_unneedreply", Constant.YES);
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
sortList.add(new Sort("pc_id", false, Sort.Type.LONG, new Long(1)));
|
|
|
@@ -97,10 +184,122 @@ public class PurcOrderChangeController {
|
|
|
} else {
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("unNeedReply",Constant.YES);
|
|
|
return SPageUtils.covertSPage(orderChangeService.findByPageInfo(pageInfo, filter));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出 -全部
|
|
|
+ * @param params
|
|
|
+ * @param searchFilter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls", method = RequestMethod.GET)
|
|
|
+ public ModelAndView exportChanges(PageParams params, String searchFilter) {
|
|
|
+ PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ params.setPage(1);
|
|
|
+ params.setCount(SearchConstants.TOP_NUM);
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ ModelAndView modelAndView = new ModelAndView();
|
|
|
+ modelAndView.addObject("dateFormat", dateFormat);
|
|
|
+ modelAndView.addObject("state", "全部");
|
|
|
+ modelAndView.addObject("data", filter.getKeyword() == null ? orderChangeService.findByPageInfo(pageInfo, filter).getContent()
|
|
|
+ : getAllPurcOrderChange(params, searchFilter).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/sale/purcChange", "客户采购变更单列表_全部"));
|
|
|
+ logger.log("客户采购变更单", "导出Excel列表", "导出全部Excel列表");
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出 -已处理
|
|
|
+ * @param params
|
|
|
+ * @param searchFilter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls",params = RequestState.DONE, method = RequestMethod.GET)
|
|
|
+ public ModelAndView exportChangesDone(PageParams params, String searchFilter) {
|
|
|
+ PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("status",Status.REPLIED.value());
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ params.setPage(1);
|
|
|
+ params.setCount(SearchConstants.TOP_NUM);
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ ModelAndView modelAndView = new ModelAndView();
|
|
|
+ modelAndView.addObject("dateFormat", dateFormat);
|
|
|
+ modelAndView.addObject("state", "已处理");
|
|
|
+ modelAndView.addObject("data", filter.getKeyword() == null ? orderChangeService.findByPageInfo(pageInfo, filter).getContent()
|
|
|
+ : getPurcOrderChangeDone(params, searchFilter).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/sale/purcChange", "客户采购变更单列表_已处理"));
|
|
|
+ logger.log("客户采购变更单", "导出Excel列表", "导出已处理Excel列表");
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出 -待确认
|
|
|
+ * @param params
|
|
|
+ * @param searchFilter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls",params = RequestState.TODO, method = RequestMethod.GET)
|
|
|
+ public ModelAndView exportChangesTodo(PageParams params, String searchFilter) {
|
|
|
+ PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("status",Status.NOT_REPLY.value());
|
|
|
+ pageInfo.filter("unNeedReply",Constant.NO);
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ params.setPage(1);
|
|
|
+ params.setCount(SearchConstants.TOP_NUM);
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ ModelAndView modelAndView = new ModelAndView();
|
|
|
+ modelAndView.addObject("dateFormat", dateFormat);
|
|
|
+ modelAndView.addObject("state", "待确认");
|
|
|
+ modelAndView.addObject("data", filter.getKeyword() == null ? orderChangeService.findByPageInfo(pageInfo, filter).getContent()
|
|
|
+ : getPurcOrderChangeTodo(params, searchFilter).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/sale/purcChange", "客户采购变更单列表_待确认"));
|
|
|
+ logger.log("客户采购变更单", "导出Excel列表", "导出待确认Excel列表");
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出 -无需确认
|
|
|
+ * @param params
|
|
|
+ * @param searchFilter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls",params = RequestState.UNREAD, method = RequestMethod.GET)
|
|
|
+ public ModelAndView exportChangesUnread(PageParams params, String searchFilter) {
|
|
|
+ PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
|
|
|
+ pageInfo.filter("enUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ pageInfo.filter("unNeedReply",Constant.YES);
|
|
|
+ SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
|
|
|
+ params.setPage(1);
|
|
|
+ params.setCount(SearchConstants.TOP_NUM);
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ ModelAndView modelAndView = new ModelAndView();
|
|
|
+ modelAndView.addObject("dateFormat", dateFormat);
|
|
|
+ modelAndView.addObject("state", "已处理");
|
|
|
+ modelAndView.addObject("data", filter.getKeyword() == null ? orderChangeService.findByPageInfo(pageInfo, filter).getContent()
|
|
|
+ : getPurcOrderChangeUnread(params, searchFilter).getContent());
|
|
|
+ modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/sale/purcChange", "客户采购变更单列表_无需确认"));
|
|
|
+ logger.log("客户采购变更单", "导出Excel列表", "导出无需确认Excel列表");
|
|
|
+ return modelAndView;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出权限判断
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/xls/permission", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ModelMap exportPermission() {
|
|
|
+ return new ModelMap("success", true);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 作为买家,根据变更单ID查找采购变更单(含明细)
|
|
|
*
|