| | |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.other.api.feignClient.InvoiceTypeClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | private CouponClient couponClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | |
| | | |
| | | @Override |
| | | public PageInfo<TOrderInvoiceVO> pageList(TOrderInvoiceQuery query) { |
| | | applyPartnerSiteScope(query); |
| | | List<TAppUser> tAppUsers = new ArrayList<>(); |
| | | // 查询申请用户 |
| | | if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ |
| | |
| | | |
| | | @Override |
| | | public Map<String, Integer> statusCount(TOrderInvoiceQuery query) { |
| | | applyPartnerSiteScope(query); |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | List<TAppUser> tAppUsers = new ArrayList<>(); |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<TOrderInvoiceVO> export(TOrderInvoiceQuery query) { |
| | | applyPartnerSiteScope(query); |
| | | List<TAppUser> tAppUsers = new ArrayList<>(); |
| | | // 查询申请用户 |
| | | if (org.springframework.util.StringUtils.hasLength(query.getUserPhone())){ |
| | |
| | | return list; |
| | | } |
| | | |
| | | private void applyPartnerSiteScope(TOrderInvoiceQuery query) { |
| | | if (query == null) { |
| | | return; |
| | | } |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | if (sysUser == null || !Integer.valueOf(2).equals(sysUser.getRoleType())) { |
| | | return; |
| | | } |
| | | List<GetSiteListDTO> sites = siteClient.getSiteListByUserId(userId).getData(); |
| | | List<Integer> siteIds = sites == null ? new ArrayList<>() : sites.stream() |
| | | .map(GetSiteListDTO::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | if (query.getSiteId() != null) { |
| | | siteIds = siteIds.contains(query.getSiteId()) |
| | | ? Collections.singletonList(query.getSiteId()) |
| | | : Collections.singletonList(-1); |
| | | } |
| | | if (siteIds.isEmpty()) { |
| | | siteIds = Collections.singletonList(-1); |
| | | } |
| | | query.setSiteIds(siteIds); |
| | | } |
| | | |
| | | private void fillInvoiceDetailAmount(TOrderInvoiceVO invoice, List<TOrderInvoiceDetail> details) { |
| | | List<TOrderInvoiceDetail> currentDetails = details.stream() |
| | | .filter(t -> t.getOrderInvoiceId().equals(invoice.getId())) |