master
wangning 7 years ago
parent 85e9c392f9
commit 7728c15c81

@ -286,26 +286,41 @@ public class RetailAppController {
} }
@RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET)
public JSONObject getAdDetail(@PathVariable String article_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject getAdDetail(@PathVariable String article_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
device = new JSONObject();
device.put("client_id",9);
return retailAppService.getAdDetail(device,article_id); return retailAppService.getAdDetail(device,article_id);
} }
@RequestMapping(value = "/bills/{bill_id}",method = RequestMethod.GET) @RequestMapping(value = "/bills/{bill_id}",method = RequestMethod.GET)
public JSONObject getBill(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public JSONObject getBill(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
device = new JSONObject();
device.put("client_id",9);
return billService.getBillDetail(bill_id,device.getIntValue("client_id")); return billService.getBillDetail(bill_id,device.getIntValue("client_id"));
} }
@RequestMapping(value = "/bills/list",method = RequestMethod.GET) @RequestMapping(value = "/bills/list",method = RequestMethod.GET)
public JSONObject getBills(QueryBillBean queryBillBean,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public JSONObject getBills(QueryBillBean queryBillBean,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
device = new JSONObject();
device.put("client_id",9);
return billService.queryBills(device.getIntValue("client_id"),queryBillBean); return billService.queryBills(device.getIntValue("client_id"),queryBillBean);
} }
@RequestMapping(value = "/bills",method = RequestMethod.PUT) @RequestMapping(value = "/bills",method = RequestMethod.PUT)
public void addBill(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody NewBillBean newBillBean){ public void addBill(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device,@RequestBody NewBillBean newBillBean){
device = new JSONObject();
device.put("client_id",9);
billService.save(device.getIntValue("client_id"),newBillBean); billService.save(device.getIntValue("client_id"),newBillBean);
} }
@RequestMapping(value = "/bills/{bill_id}/close",method = RequestMethod.POST) @RequestMapping(value = "/bills/{bill_id}/close",method = RequestMethod.POST)
public void closeBill(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public void closeBill(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
billService.updateBillStatus(bill_id,"2"); device = new JSONObject();
device.put("client_id",9);
billService.updateBillStatus(bill_id,"2",device.getIntValue("client_id"));
} }
@RequestMapping(value = "/bills/orders/{bill_id}",method = RequestMethod.GET) @RequestMapping(value = "/bills/orders/{bill_id}",method = RequestMethod.GET)
public List<JSONObject> getBillOrders(@PathVariable("bill_id")String bill_id, QueryBillOrderBean queryBillOrderBean,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public List<JSONObject> getBillOrders(@PathVariable("bill_id")String bill_id, QueryBillOrderBean queryBillOrderBean,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
device = new JSONObject();
device.put("client_id",9);
return billOrderService.query(bill_id,device.getIntValue("client_id"),queryBillOrderBean); return billOrderService.query(bill_id,device.getIntValue("client_id"),queryBillOrderBean);
} }
} }

@ -11,6 +11,16 @@ public class NewBillBean {
private String currency; private String currency;
private String remark;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getCurrency() { public String getCurrency() {
return currency; return currency;
} }

@ -12,7 +12,7 @@ public interface BillService {
JSONObject getBillDetail(String billId,int client_id); JSONObject getBillDetail(String billId,int client_id);
void updateBillStatus(String billId,String status); void updateBillStatus(String billId,String status,int client_id);
void removeBill(String billId); void removeBill(String billId);

@ -33,6 +33,7 @@ public class BillServiceImpl implements BillService {
record.put("client_id",client_id); record.put("client_id",client_id);
record.put("price",newBillBean.getPrice()); record.put("price",newBillBean.getPrice());
record.put("currency",newBillBean.getCurrency()); record.put("currency",newBillBean.getCurrency());
record.put("remark",newBillBean.getRemark());
record.put("create_time", new Date()); record.put("create_time", new Date());
record.put("status", 1); record.put("status", 1);
billMapper.save(record); billMapper.save(record);
@ -40,7 +41,7 @@ public class BillServiceImpl implements BillService {
@Override @Override
public JSONObject queryBills(int client_id, QueryBillBean queryBillBean) { public JSONObject queryBills(int client_id, QueryBillBean queryBillBean) {
PageList<JSONObject> list = billMapper.listWithOrderAnalysis(queryBillBean.toParams(), new PageBounds(queryBillBean.getPage(), queryBillBean.getLimit(), Order.formString("event_time.desc"))); PageList<JSONObject> list = billMapper.listWithOrderAnalysis(queryBillBean.toParams(), new PageBounds(queryBillBean.getPage(), queryBillBean.getLimit()));
return PageListUtils.buildPageListResult(list); return PageListUtils.buildPageListResult(list);
} }
@ -54,7 +55,11 @@ public class BillServiceImpl implements BillService {
} }
@Override @Override
public void updateBillStatus(String billId, String status) { public void updateBillStatus(String billId, String status,int client_id) {
JSONObject bill = billMapper.findOne(billId);
if (bill.getIntValue("client_id") != client_id) {
throw new BadRequestException("You have no right to check this bill");
}
JSONObject record = new JSONObject(); JSONObject record = new JSONObject();
record.put("bill_id", billId); record.put("bill_id", billId);
record.put("status", status); record.put("status", status);

@ -3,13 +3,13 @@
<mapper namespace="au.com.royalpay.payment.manage.mappers.bill.BillMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.bill.BillMapper">
<select id="listWithOrderAnalysis" resultType="com.alibaba.fastjson.JSONObject" > <select id="listWithOrderAnalysis" resultType="com.alibaba.fastjson.JSONObject" >
select b.bill_id,b.create_time,b.remark,b.price,count(o.bill_order_id) order_counts,sum(o.order_total_amount) order_total_amount from pmt_bill b left join pmt_bill_order o on b.bill_id = o.bill_id and o.order_status = 1 select b.bill_id,b.create_time,b.remark,b.price,count(o.bill_order_id) order_counts,sum(o.order_total_amount) order_total_amount from pmt_bill b right join pmt_bill_order o on b.bill_id = o.bill_id and o.order_status = 1
<where> <where>
<if test="param.status != null"> <if test="param.status != null">
and o.status = #{param.status} and o.status = #{param.status}
</if> </if>
</where> </where>
group by b.bill_id,b.create_time,b.remark,b.price group by b.bill_id,b.create_time,b.remark,b.price
order by b.create_time order by b.create_time desc
</select> </select>
</mapper> </mapper>

@ -17,7 +17,7 @@
where where
bill_id = #{bill_id} bill_id = #{bill_id}
<if test="param.status != null"> <if test="param.status != null">
order_status = #{param.status} and order_status = #{param.status}
</if> </if>
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save