申请开具发票 添加权限验证
This commit is contained in:
parent
8f6cfa6008
commit
52957a38be
@ -407,11 +407,24 @@ public class SybPayController {
|
|||||||
* 申请开具发票
|
* 申请开具发票
|
||||||
*/
|
*/
|
||||||
@PostMapping("/apply_invoice")
|
@PostMapping("/apply_invoice")
|
||||||
public String applyInvoice(@RequestBody ApplyInvoiceQo applyInvoiceQo) {
|
public String applyInvoice(@RequestHeader(value = "Authorization") String token, @RequestBody ApplyInvoiceQo applyInvoiceQo) {
|
||||||
try {
|
try {
|
||||||
|
// 验证token
|
||||||
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
|
if (sysUserEntity == null) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
|
}
|
||||||
|
|
||||||
Long id = applyInvoiceQo.getId();
|
Long id = applyInvoiceQo.getId();
|
||||||
TranQueryEntity tranQueryEntity = tranQueryDao.findById(id).get();
|
TranQueryEntity tranQueryEntity = tranQueryDao.findById(id).get();
|
||||||
|
|
||||||
|
Long orderid = tranQueryEntity.getOrderid();
|
||||||
|
Integer userId = unitOrderPayDao.findById(orderid).get().getUserId();
|
||||||
|
if (!sysUserEntity.getId().equals(userId)) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "您无权限对此订单开具发票", locale);
|
||||||
|
}
|
||||||
|
|
||||||
tranQueryEntity.setInvoiceStatus(InvoiceStatus.inInvoicing.getValue());
|
tranQueryEntity.setInvoiceStatus(InvoiceStatus.inInvoicing.getValue());
|
||||||
tranQueryDao.saveAndFlush(tranQueryEntity);
|
tranQueryDao.saveAndFlush(tranQueryEntity);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user