master
wangning 7 years ago
parent e503e7dca1
commit 9467e91794

@ -1046,7 +1046,17 @@ public class RetailAppServiceImp implements RetailAppService {
devId = device.getString("dev_id");
}
Date to = DateUtils.addDays(date, 1);
List<JSONObject> transactions = transactionMapper.listDailyTransactions(date, to, devId, device.getIntValue("client_id"));
String [] param_client_ids = null;
if(StringUtils.isEmpty(app_client_ids)) {
JSONArray client_ids = clientManager.getAllClientIds(device.getIntValue("client_id"));
if (client_ids.size() > 1) {
param_client_ids = new String[client_ids.size()];
client_ids.toArray(param_client_ids);
}
}else {
param_client_ids = app_client_ids.split(",");
}
List<JSONObject> transactions = transactionMapper.listDailyTransactions(date, to, devId, device.getIntValue("client_id"),param_client_ids);
if (transactions.isEmpty()) {
throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone);
}
@ -1066,16 +1076,7 @@ public class RetailAppServiceImp implements RetailAppService {
}
JSONObject res = new JSONObject();
res.put("transactions", transactions);
String [] param_client_ids = null;
if(StringUtils.isEmpty(app_client_ids)) {
JSONArray client_ids = clientManager.getAllClientIds(device.getIntValue("client_id"));
if (client_ids.size() > 1) {
param_client_ids = new String[client_ids.size()];
client_ids.toArray(param_client_ids);
}
}else {
param_client_ids = app_client_ids.split(",");
}
JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"),param_client_ids);

@ -106,7 +106,7 @@ public interface TransactionMapper {
@AdvanceSelect(addonWhereClause = "transaction_type='Credit'")
int countOrders(@Param("client_id") int client_id);
List<JSONObject> listDailyTransactions(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId);
List<JSONObject> listDailyTransactions(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId,@Param("client_ids")String [] client_ids);
JSONObject analysisRetailDailyReport(@Param("from") Date from, @Param("to") Date to, @Param("dev_id") String devId, @Param("client_id") int clientId,@Param("client_ids")String [] client_ids);

@ -659,9 +659,17 @@
LEFT JOIN pmt_orders o on o.order_id=t.order_id
LEFT JOIN pmt_refunds r on r.refund_id=t.refund_id
WHERE t.transaction_time>=#{from} and t.transaction_time<#{to} and t.channel!='Settlement'
and t.client_id=#{client_id}
]]>
<if test="dev_id!=null">and t.device_id=#{dev_id}</if>
<if test="client_ids!=null">
AND t.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null">
and t.client_id=#{client_id}
</if>
order by t.transaction_time asc
</select>
<select id="analysisRetailDailyReport" resultType="com.alibaba.fastjson.JSONObject">

Loading…
Cancel
Save