|
|
|
@ -358,9 +358,7 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
}
|
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
|
|
|
|
|
|
// PageList<JSONObject> orders = orderMapper.listOrdersByClients(params,
|
|
|
|
|
// new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
|
PageList<JSONObject> orders = orderMapper.listTransactionsForApp(params,
|
|
|
|
|
PageList<JSONObject> orders = orderMapper.listOrdersByClients(params,
|
|
|
|
|
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
|
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
|
|
|
|
|
ArrayList<String> date_contains = new ArrayList<>();
|
|
|
|
@ -391,6 +389,70 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return PageListUtils.buildPageListResult(orders);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject listOrdersNew(JSONObject device, AppQueryBean query) {
|
|
|
|
|
String clientType = device.getString("client_type");
|
|
|
|
|
DeviceRegister register = deviceSupport.findRegister(clientType);
|
|
|
|
|
int client_id = device.getIntValue("client_id");
|
|
|
|
|
JSONObject client = clientManager.getClientInfo(client_id);
|
|
|
|
|
String timezone = client.getString("timezone");
|
|
|
|
|
if (timezone != null && !timezone.isEmpty()) {
|
|
|
|
|
query.setTimezone(timezone);
|
|
|
|
|
}
|
|
|
|
|
JSONObject params = query.toParams();
|
|
|
|
|
setAllClientIds(params, client_id);
|
|
|
|
|
if (register.includeDevId()) {
|
|
|
|
|
params.put("dev_id", device.getString("dev_id"));
|
|
|
|
|
}
|
|
|
|
|
params.put("client_id", client_id);
|
|
|
|
|
|
|
|
|
|
PageList<JSONObject> orders = orderMapper.listTransactionsForApp(params,
|
|
|
|
|
new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc")));
|
|
|
|
|
TimeZoneUtils.switchTimeZone(orders, query.getTimezone(), "create_time", "transaction_time", "confirm_time");
|
|
|
|
|
ArrayList<String> date_contains = new ArrayList<>();
|
|
|
|
|
for (JSONObject order : orders) {
|
|
|
|
|
String customer_id = order.getString("customer_id");
|
|
|
|
|
if (StringUtils.isEmpty(customer_id)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
switch (order.getString("channel")) {
|
|
|
|
|
case "Alipay":
|
|
|
|
|
JSONObject alipayUser = customerRelationAlipayMapper.findCustomerByUserId(customer_id);
|
|
|
|
|
order.put("nickname", alipayUser.getString("nickname"));
|
|
|
|
|
order.put("headimg", alipayUser.getString("headimg"));
|
|
|
|
|
break;
|
|
|
|
|
case "Wechat":
|
|
|
|
|
JSONObject weUser = customerMapper.findCustomerByOpenId(customer_id);
|
|
|
|
|
order.put("nickname", weUser.getString("nickname"));
|
|
|
|
|
order.put("headimg", weUser.getString("headimg"));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Calendar calendar = (Calendar) order.get("create_time");
|
|
|
|
|
String trade_date = DateFormatUtils.format(calendar, "yyyy-MM-dd");
|
|
|
|
|
String trade_time = DateFormatUtils.format(calendar, "HH:mm:ss");
|
|
|
|
|
order.put("trade_date", trade_date);
|
|
|
|
|
order.put("trade_time", trade_time);
|
|
|
|
|
if (!date_contains.contains(trade_date)) {
|
|
|
|
|
String re_date = trade_date.replaceAll("-", "");
|
|
|
|
|
TradeLogQuery date_query = new TradeLogQuery();
|
|
|
|
|
date_query.setDatefrom(re_date);
|
|
|
|
|
date_query.setDateto(re_date);
|
|
|
|
|
// date_query.setStatus(OrderStatus.ALL);
|
|
|
|
|
if (params.containsKey("client_ids")) {
|
|
|
|
|
date_query.setClient_ids((String[]) params.get("client_ids"));
|
|
|
|
|
}
|
|
|
|
|
JSONObject date_params = date_query.toParams(query.getTimezone());
|
|
|
|
|
date_params.put("client_id", device.getIntValue("client_id"));
|
|
|
|
|
JSONObject analysis = orderMapper.analysisOrders(date_params);
|
|
|
|
|
order.put("date_total", analysis);
|
|
|
|
|
date_contains.add(trade_date);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return PageListUtils.buildPageListResult(orders);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject listOrdersShareCode(JSONObject device, AppQueryBean query) {
|
|
|
|
|
query.setGateway_app("11");
|
|
|
|
|