| | |
| | | import cc.mrbird.febs.mall.service.MallInvoiceService; |
| | | import cc.mrbird.febs.mall.vo.AdminMallOrderInfoVo; |
| | | import cc.mrbird.febs.mall.vo.ApiMallInvoiceVo; |
| | | import cc.mrbird.febs.pay.service.WxFaPiaoService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | private final MallOrderInfoMapper mallOrderInfoMapper; |
| | | private final MallOrderItemMapper mallOrderItemMapper; |
| | | private final RedisUtils redisUtils; |
| | | private final WxFaPiaoService wxFaPiaoService; |
| | | @Override |
| | | public FebsResponse getInvoices(ApiMallInvoiceDto apiMallInvoiceDto) { |
| | | MallMember member = LoginUserUtil.getLoginUser(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse addInvoiceUrl(MallInvoice mallInvoice) { |
| | | Long id = mallInvoice.getId(); |
| | | MallInvoice mallInvoiceOld = this.baseMapper.selectById(id); |
| | |
| | | this.baseMapper.updateById(mallInvoiceOld); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse updateInvoiceDetail(Long id) { |
| | | MallInvoice mallInvoice = this.baseMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallInvoice)){ |
| | | return new FebsResponse().fail().message("开票信息异常。"); |
| | | } |
| | | String fapiaoApplyId = mallInvoice.getFapiaoApplyId(); |
| | | try { |
| | | String userInvoiceInfo = wxFaPiaoService.getUserInvoiceInfo(fapiaoApplyId); |
| | | JSONObject userInvoiceInfoJson = JSONUtil.parseObj(userInvoiceInfo); |
| | | mallInvoice.setState(1); |
| | | mallInvoice.setType(userInvoiceInfoJson.getStr("type")); |
| | | mallInvoice.setName(userInvoiceInfoJson.getStr("name")); |
| | | mallInvoice.setTaxpayerId(userInvoiceInfoJson.getStr("taxpayer_id")); |
| | | mallInvoice.setAddress(userInvoiceInfoJson.getStr("address")); |
| | | mallInvoice.setTelephone(userInvoiceInfoJson.getStr("telephone")); |
| | | mallInvoice.setBankName(userInvoiceInfoJson.getStr("bank_name")); |
| | | mallInvoice.setBankAccount(userInvoiceInfoJson.getStr("bank_account")); |
| | | this.baseMapper.updateById(mallInvoice); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |