订单列表优化
This commit is contained in:
+36
-13
@@ -27,6 +27,7 @@ import com.bms.price.domain.PrcBillingTaskRetryTask;
|
||||
import com.bms.price.domain.vo.TabOrderMonitorQuery;
|
||||
import com.bms.price.domain.vo.TabOrderMonitorVo;
|
||||
import com.bms.price.domain.vo.TabOrderProductCheckResult;
|
||||
import com.bms.price.oracle.CustomerKeywordResolver;
|
||||
import com.bms.price.oracle.TabOrderMonitorService;
|
||||
import com.bms.price.oracle.TabOrderProductCheckService;
|
||||
import com.bms.price.search.BillSearchPage;
|
||||
@@ -54,6 +55,9 @@ public class TabOrderMonitorController extends BaseController
|
||||
@Autowired
|
||||
private IBillSearchStore billSearchStore;
|
||||
|
||||
@Autowired
|
||||
private CustomerKeywordResolver customerKeywordResolver;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:orderSource:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TabOrderMonitorQuery query)
|
||||
@@ -61,12 +65,14 @@ public class TabOrderMonitorController extends BaseController
|
||||
TableDataInfo rsp = new TableDataInfo();
|
||||
rsp.setCode(HttpStatus.SUCCESS);
|
||||
rsp.setMsg("\u67e5\u8be2\u6210\u529f");
|
||||
if (!hasRequiredFilters(query))
|
||||
if (!hasListFilters(query))
|
||||
{
|
||||
rsp.setRows(Collections.emptyList());
|
||||
rsp.setTotal(0L);
|
||||
return rsp;
|
||||
}
|
||||
// 在切换 Oracle 数据源之前,把客户名称解析为客户代码
|
||||
customerKeywordResolver.resolve(query);
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
int pageNum = pageDomain.getPageNum() == null ? 1 : pageDomain.getPageNum().intValue();
|
||||
int pageSize = pageDomain.getPageSize() == null ? 10 : pageDomain.getPageSize().intValue();
|
||||
@@ -87,6 +93,7 @@ public class TabOrderMonitorController extends BaseController
|
||||
{
|
||||
return error("customerCodes and pickup time required");
|
||||
}
|
||||
customerKeywordResolver.resolve(query);
|
||||
TabOrderProductCheckResult data = tabOrderProductCheckService.check(query);
|
||||
return success(data);
|
||||
}
|
||||
@@ -103,6 +110,7 @@ public class TabOrderMonitorController extends BaseController
|
||||
{
|
||||
return error("productCode required");
|
||||
}
|
||||
customerKeywordResolver.resolve(query);
|
||||
return success(tabOrderMonitorService.selectOrderIdsByProduct(query));
|
||||
}
|
||||
|
||||
@@ -115,6 +123,7 @@ public class TabOrderMonitorController extends BaseController
|
||||
{
|
||||
return error("customerCodes and pickup time required");
|
||||
}
|
||||
customerKeywordResolver.resolve(query);
|
||||
tabOrderMonitorService.count(query);
|
||||
String asyncTaskId = UUID.randomUUID().toString().replace("-", "");
|
||||
tabOrderSyncAsyncRunner.put(asyncTaskId, PrcBillingTaskRetryTask.STATUS_PENDING, 0, "queued",
|
||||
@@ -211,25 +220,39 @@ public class TabOrderMonitorController extends BaseController
|
||||
return prefix + "_" + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询:有任一单号即可查询;无单号时必须客户(名称或代码)+提货时间。
|
||||
*/
|
||||
private static boolean hasListFilters(TabOrderMonitorQuery query)
|
||||
{
|
||||
return hasRequiredFilters(query) || hasNonBlankItem(query.getOrderIdentifiers());
|
||||
}
|
||||
|
||||
private static boolean hasRequiredFilters(TabOrderMonitorQuery query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
boolean hasCustomer = false;
|
||||
if (query.getCustomerCodes() != null)
|
||||
{
|
||||
for (String code : query.getCustomerCodes())
|
||||
{
|
||||
if (StringUtils.isNotEmpty(code))
|
||||
{
|
||||
hasCustomer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean hasCustomer = hasNonBlankItem(query.getCustomerCodes())
|
||||
|| hasNonBlankItem(query.getCustomerKeywords());
|
||||
boolean hasTime = StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime());
|
||||
return hasCustomer && hasTime;
|
||||
}
|
||||
|
||||
private static boolean hasNonBlankItem(List<String> list)
|
||||
{
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (String item : list)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user