master
wangning 7 years ago
parent db4e04451e
commit 4eaddd9cf1

@ -10,7 +10,6 @@ import au.com.royalpay.payment.manage.bill.core.BillService;
import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean;
import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.device.advise.AppClientController;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
@ -24,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@ -35,7 +35,7 @@ import javax.validation.Valid;
/** /**
* Created by yishuqian on 28/03/2017. * Created by yishuqian on 28/03/2017.
*/ */
@AppClientController @RestController
@RequestMapping("/api/v1.0/retail/app") @RequestMapping("/api/v1.0/retail/app")
public class RetailAppController { public class RetailAppController {
@Resource @Resource
@ -288,18 +288,26 @@ public class RetailAppController {
} }
@RequestMapping(value = "/bill/{bill_id}",method = RequestMethod.GET) @RequestMapping(value = "/bill/{bill_id}",method = RequestMethod.GET)
public JSONObject getBills(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public JSONObject getBills(@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 = "/bill",method = RequestMethod.PUT) @RequestMapping(value = "/bill",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 = "/bill/{bill_id}/close",method = RequestMethod.POST) @RequestMapping(value = "/bill/{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){
device = new JSONObject();
device.put("client_id",9);
billService.updateBillStatus(bill_id,"2"); billService.updateBillStatus(bill_id,"2");
} }
@RequestMapping(value = "/bill/orders/{bill_id}/",method = RequestMethod.GET) @RequestMapping(value = "/bill/orders/{bill_id}",method = RequestMethod.GET)
public List<JSONObject> getBillOrders(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){ public List<JSONObject> getBillOrders(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
device = new JSONObject();
device.put("client_id",9);
return billOrderService.getByBillId(bill_id,device.getIntValue("client_id")); return billOrderService.getByBillId(bill_id,device.getIntValue("client_id"));
} }
} }

@ -7,7 +7,7 @@ import java.math.BigDecimal;
*/ */
public class NewBillBean { public class NewBillBean {
private BigDecimal amount; private BigDecimal price;
private String currency; private String currency;
@ -19,11 +19,11 @@ public class NewBillBean {
this.currency = currency; this.currency = currency;
} }
public BigDecimal getAmount() { public BigDecimal getPrice() {
return amount; return price;
} }
public void setAmount(BigDecimal amount) { public void setPrice(BigDecimal price) {
this.amount = amount; this.price = price;
} }
} }

@ -17,7 +17,7 @@ public interface BillService {
void removeBill(String billId); void removeBill(String billId);
JSONObject save(int client_id,NewBillBean newBillBean); void save(int client_id,NewBillBean newBillBean);
List<JSONObject> getBills(int client_id); List<JSONObject> getBills(int client_id);

@ -30,6 +30,7 @@ public class BillOrderServiceImpl implements BillOrderService {
if(bill.getIntValue("client_id")!= client_id){ if(bill.getIntValue("client_id")!= client_id){
throw new BadRequestException("You have no right to check this bill"); 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> wechatBillOrders = billOrderMapper.findByBillIdWithWechatInfo(bill_id);
List<JSONObject> alipayBillOrders = billOrderMapper.findByBillIdWithAlipayInfo(bill_id); List<JSONObject> alipayBillOrders = billOrderMapper.findByBillIdWithAlipayInfo(bill_id);
wechatBillOrders.addAll(alipayBillOrders); wechatBillOrders.addAll(alipayBillOrders);

@ -12,7 +12,6 @@ import com.alibaba.fastjson.JSONObject;
import au.com.royalpay.payment.manage.bill.bean.NewBillBean; import au.com.royalpay.payment.manage.bill.bean.NewBillBean;
import au.com.royalpay.payment.manage.bill.core.BillService; import au.com.royalpay.payment.manage.bill.core.BillService;
import au.com.royalpay.payment.manage.mappers.bill.BillMapper; import au.com.royalpay.payment.manage.mappers.bill.BillMapper;
import au.com.royalpay.payment.manage.mappers.bill.BillOrderMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
/** /**
@ -22,18 +21,16 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
public class BillServiceImpl implements BillService { public class BillServiceImpl implements BillService {
@Resource @Resource
private BillMapper billMapper; private BillMapper billMapper;
@Resource
private BillOrderMapper billOrderMapper;
@Override @Override
public JSONObject save(int client_id,NewBillBean newBillBean) { public void save(int client_id,NewBillBean newBillBean) {
JSONObject record = new JSONObject(); JSONObject record = new JSONObject();
record.put("client_id",client_id); record.put("client_id",client_id);
record.put("amount",newBillBean.getAmount()); record.put("price",newBillBean.getPrice());
record.put("currency",newBillBean.getCurrency()); record.put("currency",newBillBean.getCurrency());
record.put("create_time", new Date()); record.put("create_time", new Date());
record.put("status", 1); record.put("status", 1);
return billMapper.save(record); billMapper.save(record);
} }
@Override @Override

@ -16,7 +16,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
@AutoMapper(tablename = "pmt_bill", pkName = "bill_id") @AutoMapper(tablename = "pmt_bill", pkName = "bill_id")
public interface BillMapper { public interface BillMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
JSONObject save(JSONObject record); int save(JSONObject record);
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
JSONObject findOne(@Param("bill_id") String bill_id); JSONObject findOne(@Param("bill_id") String bill_id);

@ -2,12 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.bill.BillOrderMapper"> <mapper namespace="au.com.royalpay.payment.manage.mappers.bill.BillOrderMapper">
<select id="findByBillIdWithWechatInfo" resultType="com.alibaba.fastjson.JSONObject"> <select id="findByBillIdWithWechatInfo" resultType="com.alibaba.fastjson.JSONObject">
select o.client_id,o.order_id,o.count,o.order_total_amount,o.order_status,o.create_time,o.currency,o.customer_id select o.client_id,o.order_id,o.order_total_amount,o.order_status,o.create_time,o.customer_id,
r.nickname,r.headimg r.nickname,r.headimg
from pmt_bill_order o left join sys_customer_relation r on r.wechat_openid = o.customer_id and o.channel = 'Wechat' and o.bill_id = #{bill_id} from pmt_bill_order o left join sys_customer_relation r on r.wechat_openid = o.customer_id and o.channel = 'Wechat' and o.bill_id = #{bill_id}
</select> </select>
<select id="findByBillIdWithAlipayInfo" resultType="com.alibaba.fastjson.JSONObject"> <select id="findByBillIdWithAlipayInfo" resultType="com.alibaba.fastjson.JSONObject">
select o.client_id,o.order_id,o.count,o.order_total_amount,o.order_status,o.create_time,o.currency,o.customer_id select o.client_id,o.order_id,o.order_total_amount,o.order_status,o.create_time,o.customer_id,
r.nickname,r.headimg r.nickname,r.headimg
from pmt_bill_order o left join sys_customer_relation_alipay r on r.alipay_uid = o.customer_id and o.channel = 'Alipay' and o.bill_id = #{bill_id} from pmt_bill_order o left join sys_customer_relation_alipay r on r.alipay_uid = o.customer_id and o.channel = 'Alipay' and o.bill_id = #{bill_id}
</select> </select>

Loading…
Cancel
Save