| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | import com.dsh.course.feignClient.account.*; |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupIncomeVO; |
| | | import com.dsh.course.feignClient.communityWorldCup.WorldCupClient; |
| | | import com.dsh.course.feignClient.competition.model.Competition; |
| | | import com.dsh.course.feignClient.competition.model.CompetitionQuery; |
| | | import com.dsh.course.feignClient.competition.model.PaymentCompetition; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | |
| | | query.setProvince(province); |
| | | query.setCity(city); |
| | | query.setStoreId(storeId); |
| | | query.setInsertType(UserExt.getUser().getObjectType()); |
| | | if(UserExt.getUser().getObjectType()==2){ |
| | | List<Integer> operatorId = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", UserExt.getUser().getObjectId())).stream() |
| | |
| | | model.addAttribute("roleType",objectType); |
| | | return PREFIX + "Income.html"; |
| | | } |
| | | @Autowired |
| | | private WorldCupClient worldCupClient; |
| | | /** |
| | | * 获取收入管理列表 |
| | | */ |
| | | @RequestMapping(value = "/incomeListAll") |
| | | @ResponseBody |
| | | public List<IncomeVO> incomeListAll(String time,Integer incomeType,String userName,String amount) { |
| | | public List<IncomeVO> incomeListAll(String time,Integer incomeType,String userName,String amount) throws ParseException { |
| | | |
| | | // 充值记录查询query |
| | | RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery(); |
| | | // 报名课程查询query |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | query.setInsertType(UserExt.getUser().getObjectType()); |
| | | if(UserExt.getUser().getObjectType()==2){ |
| | | query.setStoresIds(storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",UserExt.getUser().getObjectId()) |
| | | ).stream().map(TStore::getId).collect(Collectors.toList())); |
| | | } |
| | | // 赛事活动查询query |
| | | CompetitionQuery competitionQuery = new CompetitionQuery(); |
| | | // 会员支付查询query |
| | | IncomeQuery incomeQuery = new IncomeQuery(); |
| | | // 场地预约记录查询query |
| | | SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); |
| | | // 世界杯记录查询query |
| | | WorldCupQuery worldCupQuery = new WorldCupQuery(); |
| | | AppUserByNameAndPhoneDTO appUserByNameAndPhoneDTO = new AppUserByNameAndPhoneDTO(); |
| | | appUserByNameAndPhoneDTO.setUserName(userName); |
| | | if (userName!=null){ |
| | |
| | | query.setUserIds(collect); |
| | | incomeQuery.setUserIds(collect); |
| | | siteBookingQuery.setUserIds(collect); |
| | | worldCupQuery.setUserIds(collect); |
| | | } |
| | | } |
| | | if (amount==null || amount.equals("")){ |
| | |
| | | rechargeRecordsQuery.setAmount(null); |
| | | competitionQuery.setAmount(null); |
| | | incomeQuery.setAmount(null); |
| | | worldCupQuery.setAmount(null); |
| | | }else { |
| | | siteBookingQuery.setAmount(new BigDecimal(amount)); |
| | | query.setAmount(new BigDecimal(amount)); |
| | | rechargeRecordsQuery.setAmount(new BigDecimal(amount)); |
| | | competitionQuery.setAmount(new BigDecimal(amount)); |
| | | incomeQuery.setAmount(new BigDecimal(amount)); |
| | | worldCupQuery.setAmount(new BigDecimal(amount)); |
| | | } |
| | | |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | // 拿到门店集合id |
| | | List<Integer> operatorId = storeService.list(new QueryWrapper<TStore>() |
| | |
| | | competitionQuery.setOperatorId(UserExt.getUser().getObjectId()); |
| | | siteBookingQuery.setStoreIds(operatorId); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==3){ |
| | | // 拿到门店集合id |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(UserExt.getUser().getObjectId()); |
| | | siteBookingQuery.setStoreIds(integers); |
| | | query.setStoresIds(integers); |
| | | competitionQuery.setStoreId(UserExt.getUser().getObjectId()); |
| | | } |
| | | |
| | | siteBookingQuery.setTime(time); |
| | | query.setRegisterTime(time); |
| | | rechargeRecordsQuery.setTime(time); |
| | | competitionQuery.setTime(time); |
| | | incomeQuery.setTime(time); |
| | | worldCupQuery.setTime(time); |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | IncomeVO incomeVO = new IncomeVO(); |
| | | List<IncomeVO> incomeVOS = new ArrayList<>(); |
| | | |
| | | if ( incomeType==null || incomeType == 1){ |
| | | // 会员支付记录 |
| | | List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); |
| | |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(vipPayment.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(vipPayment.getId()); |
| | | temp.setId(vipPayment.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(rechargeRecordsVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(rechargeRecordsVO.getId().intValue()); |
| | | temp.setId(rechargeRecordsVO.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(registerOrderVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(registerOrderVO.getId().intValue()); |
| | | temp.setId(registerOrderVO.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | temp.setIncomeType(3); |
| | | temp.setState(registerOrderVO.getPayStatus()); |
| | | if (registerOrderVO.getPayStatus() == 1){ |
| | | temp.setState(2); |
| | | } |
| | | if (registerOrderVO.getPayStatus() == 2){ |
| | | temp.setState(1); |
| | | } |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if(roleType !=3) { |
| | | |
| | | if (incomeType == null || incomeType == 4) { |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | |
| | | IncomeVO temp = new IncomeVO(); |
| | | TAppUser tAppUser = appUserClient.queryById(competition.getAppUserId()); |
| | | Competition competition1 = competitionClient.queryById(competition.getCompetitionId()); |
| | | if(null == competition1){ |
| | | continue; |
| | | } |
| | | if (!competition1.getStoreId().equals("")){ |
| | | String[] split = competition1.getStoreId().split(","); |
| | | List<Integer> list = new ArrayList<>(); |
| | |
| | | |
| | | temp.setStoreName(substring); |
| | | } |
| | | temp.setId(competition.getId().intValue()); |
| | | temp.setId(competition.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | temp.setIncomeType(4); |
| | | temp.setState(competition.getPayStatus()); |
| | | if (competition.getPayStatus() == 1){ |
| | | temp.setState(2); |
| | | }else if (competition.getPayStatus() == 2){ |
| | | temp.setState(1); |
| | | } |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (incomeType == null || incomeType == 5) { |
| | | // 预约场地 |
| | | List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); |
| | |
| | | TAppUser tAppUser = appUserClient.queryAppUser1(siteBooking.getAppUserId()); |
| | | Store store = storeClient.getStoreById(siteBooking.getStoreId()); |
| | | |
| | | temp.setId(siteBooking.getId()); |
| | | temp.setId(siteBooking.getId().toString()); |
| | | temp.setProvince(siteBooking.getProvince()); |
| | | temp.setCity(siteBooking.getCity()); |
| | | temp.setStoreName(store.getName()); |
| | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | if (roleType == 1 && (incomeType == null || incomeType == 6)){ |
| | | List<WorldCupIncomeVO> worldCupIncome = worldCupClient.getWorldCupIncome(worldCupQuery); |
| | | for (WorldCupIncomeVO worldCupIncomeVO : worldCupIncome) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(worldCupIncomeVO.getId()); |
| | | temp.setProvince(worldCupIncomeVO.getProvince()); |
| | | temp.setCity(worldCupIncomeVO.getCity()); |
| | | temp.setStoreName(worldCupIncomeVO.getStoreName()); |
| | | temp.setPayUser(worldCupIncomeVO.getUserName()); |
| | | temp.setPhone(worldCupIncomeVO.getPhone()); |
| | | temp.setAmount(new BigDecimal(worldCupIncomeVO.getAmount())); |
| | | temp.setIncomeType(6); |
| | | temp.setState(1); |
| | | temp.setInsertTime(simpleDateFormat.parse(worldCupIncomeVO.getPayTime())); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | return incomeVOS; |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/getIncomeData") |
| | | @ResponseBody |
| | | public Object getIncomeData(String time,Integer incomeType,String userName,String amount) { |
| | | public Object getIncomeData(String time,Integer incomeType,String userName,String amount) throws ParseException { |
| | | // 充值记录查询query |
| | | RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery(); |
| | | // 报名课程查询query |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | query.setInsertType(UserExt.getUser().getObjectType()); |
| | | query.setStoresIds(storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",UserExt.getUser().getObjectId())) |
| | | .stream().map(TStore::getId).collect(Collectors.toList())); |
| | | // 赛事活动查询query |
| | | CompetitionQuery competitionQuery = new CompetitionQuery(); |
| | | // 会员支付查询query |
| | | IncomeQuery incomeQuery = new IncomeQuery(); |
| | | // 场地预约记录查询query |
| | | SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); |
| | | // 世界杯查询query |
| | | WorldCupQuery worldCupQuery = new WorldCupQuery(); |
| | | AppUserByNameAndPhoneDTO appUserByNameAndPhoneDTO = new AppUserByNameAndPhoneDTO(); |
| | | appUserByNameAndPhoneDTO.setUserName(userName); |
| | | if (userName!=null){ |
| | |
| | | query.setUserIds(collect); |
| | | incomeQuery.setUserIds(collect); |
| | | siteBookingQuery.setUserIds(collect); |
| | | worldCupQuery.setUserIds(collect); |
| | | } |
| | | } |
| | | if (amount==null || amount.equals("")){ |
| | |
| | | rechargeRecordsQuery.setAmount(null); |
| | | competitionQuery.setAmount(null); |
| | | incomeQuery.setAmount(null); |
| | | worldCupQuery.setAmount(null); |
| | | }else { |
| | | siteBookingQuery.setAmount(new BigDecimal(amount)); |
| | | query.setAmount(new BigDecimal(amount)); |
| | | rechargeRecordsQuery.setAmount(new BigDecimal(amount)); |
| | | competitionQuery.setAmount(new BigDecimal(amount)); |
| | | incomeQuery.setAmount(new BigDecimal(amount)); |
| | | worldCupQuery.setAmount(new BigDecimal(amount)); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | // 拿到门店集合id |
| | |
| | | competitionQuery.setOperatorId(UserExt.getUser().getObjectId()); |
| | | siteBookingQuery.setStoreIds(operatorId); |
| | | } |
| | | |
| | | if (UserExt.getUser().getObjectType()==3){ |
| | | // 拿到门店集合id |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(UserExt.getUser().getObjectId()); |
| | | siteBookingQuery.setStoreIds(integers); |
| | | query.setStoresIds(integers); |
| | | competitionQuery.setStoreId(UserExt.getUser().getObjectId()); |
| | | } |
| | | siteBookingQuery.setTime(time); |
| | | query.setRegisterTime(time); |
| | | rechargeRecordsQuery.setTime(time); |
| | | competitionQuery.setTime(time); |
| | | incomeQuery.setTime(time); |
| | | worldCupQuery.setTime(time); |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | IncomeVO incomeVO = new IncomeVO(); |
| | | List<IncomeVO> incomeVOS = new ArrayList<>(); |
| | | |
| | | if ( incomeType==null || incomeType == 1){ |
| | | // 会员支付记录 |
| | | List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); |
| | |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(vipPayment.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(vipPayment.getId()); |
| | | temp.setId(vipPayment.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(rechargeRecordsVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(rechargeRecordsVO.getId().intValue()); |
| | | temp.setId(rechargeRecordsVO.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(registerOrderVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(registerOrderVO.getId().intValue()); |
| | | temp.setId(registerOrderVO.getId().toString()); |
| | | if (registerOrderVO.getPayStatus()==2) { |
| | | temp.setState(2); |
| | | } else { |
| | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if(roleType !=3) { |
| | | if (incomeType == null || incomeType == 4) { |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | |
| | | IncomeVO temp = new IncomeVO(); |
| | | TAppUser tAppUser = appUserClient.queryById(competition.getAppUserId()); |
| | | Competition competition1 = competitionClient.queryById(competition.getCompetitionId()); |
| | | if(null == competition1){ |
| | | continue; |
| | | } |
| | | if (!competition1.getStoreId().equals("")){ |
| | | String[] split = competition1.getStoreId().split(","); |
| | | List<Integer> list = new ArrayList<>(); |
| | |
| | | } else { |
| | | temp.setState(1); |
| | | } |
| | | temp.setId(competition.getId().intValue()); |
| | | temp.setId(competition.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | } |
| | | if (incomeType == null || incomeType == 5) { |
| | | // 预约场地 |
| | | List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); |
| | |
| | | TAppUser tAppUser = appUserClient.queryAppUser1(siteBooking.getAppUserId()); |
| | | Store store = storeClient.getStoreById(siteBooking.getStoreId()); |
| | | |
| | | temp.setId(siteBooking.getId()); |
| | | temp.setId(siteBooking.getId().toString()); |
| | | temp.setProvince(siteBooking.getProvince()); |
| | | temp.setCity(siteBooking.getCity()); |
| | | temp.setStoreName(store.getName()); |
| | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | |
| | | BigDecimal totalAmount = BigDecimal.ZERO; // 初始化累加变量为0 |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if (roleType == 1 && (incomeType == null || incomeType == 6)){ |
| | | List<WorldCupIncomeVO> worldCupIncome = worldCupClient.getWorldCupIncome(worldCupQuery); |
| | | for (WorldCupIncomeVO worldCupIncomeVO : worldCupIncome) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(worldCupIncomeVO.getId()); |
| | | temp.setProvince(worldCupIncomeVO.getProvince()); |
| | | temp.setCity(worldCupIncomeVO.getCity()); |
| | | temp.setStoreName(worldCupIncomeVO.getStoreName()); |
| | | temp.setPayUser(worldCupIncomeVO.getUserName()); |
| | | temp.setPhone(worldCupIncomeVO.getPhone()); |
| | | temp.setAmount(new BigDecimal(worldCupIncomeVO.getAmount())); |
| | | temp.setIncomeType(6); |
| | | temp.setState(1); |
| | | temp.setInsertTime(simpleDateFormat.parse(worldCupIncomeVO.getPayTime())); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | BigDecimal totalAmount = BigDecimal.ZERO; // 初始化累加变量为0 |
| | | for (IncomeVO vo : incomeVOS) { |
| | | if (vo.getAmount() == null ){ |
| | | BigDecimal temp = BigDecimal.ZERO; |
| | |
| | | if(UserExt.getUser().getObjectType()==3){ |
| | | coachQuery.setStoreId(UserExt.getUser().getObjectId()); |
| | | } |
| | | if(UserExt.getUser().getObjectType()==2){ |
| | | // 运营商门店ids |
| | | List<Integer> storeIds = storeService |
| | | .list(new QueryWrapper<TStore>().eq("operatorId", UserExt.getUser().getObjectId())) |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | coachQuery.setStoreIds(storeIds); |
| | | } |
| | | return cancelledClassesClient.listAll(coachQuery); |
| | | } |
| | | /** |
| | |
| | | query.setProvince(province); |
| | | query.setCity(city); |
| | | query.setStoreId(storeId); |
| | | query.setInsertType(UserExt.getUser().getObjectType()); |
| | | if(UserExt.getUser().getObjectType()==2){ |
| | | query.setStoresIds(storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",UserExt.getUser().getObjectId()) |