|
|
|
@ -24,16 +24,22 @@ public class BillOrderServiceImpl implements BillOrderService {
|
|
|
|
|
private BillOrderMapper billOrderMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private BillMapper billMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerRelationAlipayMapper customerRelationAlipayMapper;
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getByBillId(String bill_id, int client_id) {
|
|
|
|
|
JSONObject bill = billMapper.findOne(bill_id);
|
|
|
|
|
if(bill.getIntValue("client_id")!= client_id){
|
|
|
|
|
throw new BadRequestException("You have no right to check this bill");
|
|
|
|
|
}
|
|
|
|
|
// TODO: 23/02/2018 kira
|
|
|
|
|
List<JSONObject> wechatBillOrders = billOrderMapper.findByBillIdWithWechatInfo(bill_id);
|
|
|
|
|
List<JSONObject> alipayBillOrders = billOrderMapper.findByBillIdWithAlipayInfo(bill_id);
|
|
|
|
|
wechatBillOrders.addAll(alipayBillOrders);
|
|
|
|
|
for (JSONObject order : wechatBillOrders) {
|
|
|
|
|
if("Alipay".equals(order.getString("channel"))){
|
|
|
|
|
JSONObject alipayInfo = customerRelationAlipayMapper.findCustomerByUserId(order.getString("customer_id"));
|
|
|
|
|
order.put("nickname",alipayInfo.getString("nickname"));
|
|
|
|
|
order.put("headimg",alipayInfo.getString("headimg"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return wechatBillOrders;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|