master
wangning 7 years ago
parent 2ecb3920e2
commit efd5d8d14d

@ -4,6 +4,7 @@ import au.com.royalpay.payment.core.exceptions.ParamInvalidException;
import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean;
import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.bill.core.BillOrderRelationService;
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;
@ -39,6 +40,8 @@ public class RetailAppController {
private RetailAppService retailAppService; private RetailAppService retailAppService;
@Resource @Resource
private SignInStatusManager signInStatusManager; private SignInStatusManager signInStatusManager;
@Resource
private BillOrderRelationService billOrderRelationService;
@RequestMapping(value = "/token", method = RequestMethod.PUT) @RequestMapping(value = "/token", method = RequestMethod.PUT)
public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) { public void updateDevToken(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @RequestBody JSONObject token) {
@ -279,4 +282,8 @@ public class RetailAppController {
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) {
return retailAppService.getAdDetail(device,article_id); return retailAppService.getAdDetail(device,article_id);
} }
@RequestMapping(value = "/bill/{bill_id}")
public List<JSONObject> getBills(@PathVariable("bill_id")String bill_id,@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device){
return billOrderRelationService.getByBillId(bill_id,device.getIntValue("client_id"));
}
} }

@ -0,0 +1,13 @@
package au.com.royalpay.payment.manage.bill.core;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
/**
* Created by wangning on 11/02/2018.
*/
public interface BillOrderRelationService {
List<JSONObject> getByBillId(String bill_id, int client_id);
}

@ -0,0 +1,12 @@
package au.com.royalpay.payment.manage.bill.core;
import com.google.gson.JsonObject;
/**
* Created by wangning on 11/02/2018.
*/
public interface BillService {
JsonObject getByBillId(String bill_id,int client_id);
}

@ -0,0 +1,35 @@
package au.com.royalpay.payment.manage.bill.core.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import au.com.royalpay.payment.manage.bill.core.BillOrderRelationService;
import au.com.royalpay.payment.manage.mappers.bill.BillMapper;
import au.com.royalpay.payment.manage.mappers.bill.BillOrderRelationMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
/**
* Created by wangning on 11/02/2018.
*/
@Service
public class BillOrderRelationServiceImpl implements BillOrderRelationService {
@Resource
private BillOrderRelationMapper billOrderRelationMapper;
@Resource
private BillMapper billMapper;
@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");
}
return billOrderRelationMapper.findByBillId(bill_id);
}
}

@ -0,0 +1,37 @@
package au.com.royalpay.payment.manage.bill.core.impl;
import com.google.gson.JsonObject;
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.BillOrderRelationMapper;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;
/**
* Created by wangning on 11/02/2018.
*/
@Service
public class BillServiceImpl implements BillService {
@Resource
private BillMapper billMapper;
@Resource
private BillOrderRelationMapper billOrderRelationMapper;
@Override
public 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");
}
return null;
}
}

@ -0,0 +1,28 @@
package au.com.royalpay.payment.manage.mappers.bill;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Create by yixian at 2017-12-19 19:09
*/
@AutoMapper(tablename = "pmt_bill", pkName = "bill_id")
public interface BillMapper {
@AutoSql(type = SqlType.INSERT)
JSONObject save(JSONObject record);
@AutoSql(type = SqlType.SELECT)
JSONObject findOne(@Param("bill_id") String bill_id);
@AutoSql(type = SqlType.UPDATE)
int update(JSONObject record);
@AutoSql(type = SqlType.SELECT)
JSONObject findByClientId(@Param("client_id") int client_id);
}

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.mappers.bill;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/**
* Create by yixian at 2017-12-19 19:09
*/
@AutoMapper(tablename = "pmt_bill_order_relation", pkName = "bill_id")
public interface BillOrderRelationMapper {
@AutoSql(type = SqlType.INSERT)
JSONObject save(JSONObject record);
@AutoSql(type = SqlType.SELECT)
List<JSONObject> findByBillId(@Param("bill_id") String bill_id);
@AutoSql(type = SqlType.UPDATE)
int update(JSONObject record);
@AutoSql(type = SqlType.SELECT)
JSONObject findByClientId(@Param("client_id") int client_id);
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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.BillMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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.BillOrderRelationMapper">
</mapper>
Loading…
Cancel
Save