| | |
| | | import com.ruoyi.account.api.vo.InvoiceInformationVo; |
| | | import com.ruoyi.account.service.TInvoiceInformationService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | @ApiOperation(value = "获取开票抬头数据列表", tags = {"小程序-充电发票"}) |
| | | public AjaxResult<List<InvoiceInformationVo>> getInvoiceInformationList(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TInvoiceInformation> list = invoiceInformationService.list(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getAppUserId, userId).eq(TInvoiceInformation::getDelFlag, 0)); |
| | | List<TInvoiceInformation> list = invoiceInformationService.list(new LambdaQueryWrapper<TInvoiceInformation>() |
| | | .eq(TInvoiceInformation::getAppUserId, userId).eq(TInvoiceInformation::getDelFlag, 0).orderByDesc(TInvoiceInformation::getIsDefault)); |
| | | List<InvoiceInformationVo> lists = new ArrayList<>(); |
| | | for (TInvoiceInformation tInvoiceInformation : list) { |
| | | InvoiceInformationVo vo = new InvoiceInformationVo(); |
| | |
| | | |
| | | |
| | | |
| | | @Log(title = "【我的】添加开票抬头数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PostMapping(value = "/addInvoiceInformation") |
| | | @ApiOperation(value = "添加开票抬头数据", tags = {"小程序-充电发票"}) |
| | |
| | | @ApiOperation(value = "获取开票抬头详情数据", tags = {"小程序-充电发票"}) |
| | | public AjaxResult<TInvoiceInformation> getInvoiceInformationInfo(@PathVariable String id){ |
| | | TInvoiceInformation information = invoiceInformationService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!information.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return AjaxResult.success(information); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "编辑开票抬头数据", tags = {"小程序-充电发票"}) |
| | | public AjaxResult editInvoiceInformation(@RequestBody TInvoiceInformation invoiceInformation){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TInvoiceInformation information = invoiceInformationService.getById(invoiceInformation.getId()); |
| | | if(!information.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | |
| | | //如果当前是默认抬头,则需要去除其他的默认配置 |
| | | if(null != invoiceInformation.getIsDefault() && 1 == invoiceInformation.getIsDefault()){ |
| | | TInvoiceInformation one = invoiceInformationService.getOne(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getDelFlag, 0) |