| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | import com.dsh.course.feignClient.account.*; |
| | | 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 com.dsh.course.feignClient.competition.model.TCompetition; |
| | | import com.dsh.course.feignClient.other.SiteClient; |
| | | import com.google.common.collect.Lists; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.AppUserClient; |
| | | import com.dsh.course.feignClient.account.CityClient; |
| | | import com.dsh.course.feignClient.account.FinanceClient; |
| | | import com.dsh.course.feignClient.account.model.*; |
| | | import com.dsh.course.feignClient.competition.CompetitionClient; |
| | | import com.dsh.course.feignClient.course.CancelledClassesClient; |
| | | import com.dsh.course.feignClient.course.CoursePackagePaymentClient; |
| | | import com.dsh.course.feignClient.other.StoreClient; |
| | | import com.dsh.course.mapper.UserMapper; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.ICityService; |
| | | import com.dsh.guns.modular.system.service.IEvaluationService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.service.StoreConfigService; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 财务控制器 |
| | |
| | | @Autowired |
| | | private ICityService cityService; |
| | | @Autowired |
| | | private IRegionService regionService; |
| | | @Autowired |
| | | private FinanceClient financeClient; |
| | | @Autowired |
| | | private CancelledClassesClient cancelledClassesClient; |
| | | @Autowired |
| | | private StoreClient storeClient; |
| | | @Autowired |
| | | private CoursePackagePaymentClient coursePackagePaymentClient; |
| | | @Autowired |
| | | private VipPaymentClient vipPaymentClient; |
| | | @Autowired |
| | | private CompetitionClient competitionClient; |
| | | @Autowired |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | /** |
| | | * 跳转到充值记录页面 |
| | | */ |
| | | @RequestMapping("/rechargeRecords") |
| | | public String index(Model model) { |
| | | |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | model.addAttribute("userType",objectType); |
| | | // 去重 |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("objectType",objectType); |
| | | return PREFIX + "RechargeRecords.html"; |
| | |
| | | @ResponseBody |
| | | public List<RechargeRecordsVO> list(String province, String city, String name, String phone,String time,Integer type) { |
| | | RechargeRecordsQuery coachQuery = new RechargeRecordsQuery(); |
| | | coachQuery.setProvince(province); |
| | | coachQuery.setCity(city); |
| | | Region provinceCode = regionService.getOne(new QueryWrapper<Region>().eq("code", province)); |
| | | Region cityCode = regionService.getOne(new QueryWrapper<Region>().eq("code", city)); |
| | | if (provinceCode!=null){ |
| | | coachQuery.setProvince(provinceCode.getName()); |
| | | }else{ |
| | | coachQuery.setProvince(province); |
| | | } |
| | | if (cityCode!=null){ |
| | | coachQuery.setCity(cityCode.getName()); |
| | | }else{ |
| | | coachQuery.setCity(city); |
| | | } |
| | | coachQuery.setName(name); |
| | | |
| | | coachQuery.setPhone(phone); |
| | | coachQuery.setTime(time); |
| | | coachQuery.setType(type); |
| | |
| | | coachQuery.setType(type); |
| | | List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(coachQuery); |
| | | BigDecimal total = new BigDecimal("0.00"); |
| | | BigDecimal result = new BigDecimal("0.00"); |
| | | for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { |
| | | BigDecimal amount = rechargeRecordsVO.getAmount(); |
| | | total.add(amount); |
| | | total = total.add(amount); // 将新的值赋给total |
| | | result = result.add(amount); // 将新的值赋给result |
| | | } |
| | | return total; |
| | | } |
| | | /** |
| | | * 获取报名订单统计数据 |
| | | */ |
| | | @RequestMapping(value = "/getData") |
| | | @ResponseBody |
| | | public RegisterDataVO getData(String province,String city,Integer storeId,String registerTime |
| | | ,String userName,String phone,String studentName,String coursePackageName,String salesName,Integer orderSource) { |
| | | RegisterDataVO registerDataVO = new RegisterDataVO(); |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | query.setProvince(province); |
| | | query.setCity(city); |
| | | query.setStoreId(storeId); |
| | | query.setRegisterTime(registerTime); |
| | | query.setUserName(userName); |
| | | query.setUserIds(Lists.newArrayList()); |
| | | query.setPhone(phone); |
| | | query.setStudentName(studentName); |
| | | query.setStudentIds(Lists.newArrayList()); |
| | | query.setCoursePackageName(coursePackageName); |
| | | query.setSalesName(salesName); |
| | | query.setOrderSource(orderSource); |
| | | |
| | | AppUserByNameAndPhoneDTO appUserByNameAndPhoneDTO = new AppUserByNameAndPhoneDTO(); |
| | | appUserByNameAndPhoneDTO.setUserName(query.getUserName()); |
| | | appUserByNameAndPhoneDTO.setPhone(query.getPhone()); |
| | | List<TAppUser> tAppUsers = appUserClient.queryAPPUserByNameAndPhone(appUserByNameAndPhoneDTO); |
| | | // 使用 Stream API 将 tAppUsers 中的 id 收集到一个集合中 |
| | | List<Integer> userIds = tAppUsers.stream() |
| | | .map(TAppUser::getId) // 使用方法引用获取每个对象的 id |
| | | .collect(Collectors.toList()); |
| | | query.setUserIds(userIds); |
| | | if (userIds.size()!=0){ |
| | | List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query); |
| | | BigDecimal total = new BigDecimal("0.00"); |
| | | BigDecimal result = new BigDecimal("0.00"); |
| | | int playPaiCoin = 0 ; |
| | | for (RegisterOrderVO rechargeRecordsVO : registerOrderVOS) { |
| | | if (rechargeRecordsVO.getMoney()!=null){ |
| | | BigDecimal amount = rechargeRecordsVO.getMoney(); |
| | | total = total.add(amount); // 将新的值赋给total |
| | | result = result.add(amount); // 将新的值赋给result |
| | | } |
| | | if (rechargeRecordsVO.getPlayPaiCoin()!=null){ |
| | | playPaiCoin += rechargeRecordsVO.getPlayPaiCoin(); |
| | | } |
| | | } |
| | | registerDataVO.setCashPayment(total); |
| | | registerDataVO.setTotalOrder(registerOrderVOS.size()); |
| | | registerDataVO.setPlayPaiCoin(playPaiCoin); |
| | | } |
| | | return registerDataVO; |
| | | } |
| | | /** |
| | | * 跳转到消课记录页面 |
| | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("objectType",objectType); |
| | | return PREFIX + "CancelledClasses.html"; |
| | | } |
| | | /** |
| | | * 根据市获取门店 |
| | | */ |
| | | @RequestMapping(value = "/getStore") |
| | | @ResponseBody |
| | | public List<Store> getStore(String city) { |
| | | return storeClient.getStore(city); |
| | | } |
| | | /** |
| | | * 跳转到消课记录页面 |
| | | */ |
| | | @RequestMapping("/registrationOrder") |
| | | public String registrationOrder(Model model) { |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("userType",objectType); |
| | | model.addAttribute("roleType",objectType); |
| | | return PREFIX + "RegistrationOrder.html"; |
| | | } |
| | | /** |
| | | * 跳转到消课记录页面 |
| | | */ |
| | | @RequestMapping("/income") |
| | | public String income(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | model.addAttribute("roleType",objectType); |
| | | return PREFIX + "income.html"; |
| | | } |
| | | /** |
| | | * 获取收入管理列表 |
| | | */ |
| | | @RequestMapping(value = "/incomeListAll") |
| | | @ResponseBody |
| | | public List<IncomeVO> incomeListAll(String time,Integer incomeType,String userName,String amount) { |
| | | // 充值记录查询query |
| | | RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery(); |
| | | // 报名课程查询query |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | // 赛事活动查询query |
| | | CompetitionQuery competitionQuery = new CompetitionQuery(); |
| | | // 会员支付查询query |
| | | IncomeQuery incomeQuery = new IncomeQuery(); |
| | | // 场地预约记录查询query |
| | | SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); |
| | | AppUserByNameAndPhoneDTO appUserByNameAndPhoneDTO = new AppUserByNameAndPhoneDTO(); |
| | | appUserByNameAndPhoneDTO.setUserName(userName); |
| | | if (userName!=null){ |
| | | if (!userName.equals("")){ |
| | | List<TAppUser> tAppUsers = appUserClient.queryAPPUserByNameAndPhone(appUserByNameAndPhoneDTO); |
| | | // 用户ids |
| | | List<Integer> collect = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | competitionQuery.setUserIds(collect); |
| | | rechargeRecordsQuery.setUserIds(collect); |
| | | query.setUserIds(collect); |
| | | incomeQuery.setUserIds(collect); |
| | | siteBookingQuery.setUserIds(collect); |
| | | } |
| | | } |
| | | if (amount==null || amount.equals("")){ |
| | | siteBookingQuery.setAmount(null); |
| | | query.setAmount(null); |
| | | rechargeRecordsQuery.setAmount(null); |
| | | competitionQuery.setAmount(null); |
| | | incomeQuery.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)); |
| | | } |
| | | |
| | | siteBookingQuery.setTime(time); |
| | | query.setRegisterTime(time); |
| | | rechargeRecordsQuery.setTime(time); |
| | | competitionQuery.setTime(time); |
| | | incomeQuery.setTime(time); |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | IncomeVO incomeVO = new IncomeVO(); |
| | | List<IncomeVO> incomeVOS = new ArrayList<>(); |
| | | |
| | | if (roleType == 1){ |
| | | if ( incomeType==null || incomeType == 1){ |
| | | // 会员支付记录 |
| | | List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); |
| | | for (VipPayment vipPayment : vipPayments) { |
| | | |
| | | TAppUser tAppUser = appUserClient.queryById(vipPayment.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(vipPayment.getId()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(""); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setAmount(new BigDecimal(vipPayment.getAmount().toString())); |
| | | temp.setIncomeType(1); |
| | | temp.setState(vipPayment.getState()); |
| | | temp.setInsertTime(vipPayment.getInsertTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if ( incomeType==null || incomeType == 2) { |
| | | // 充值记录 |
| | | List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery); |
| | | for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { |
| | | TAppUser tAppUser = appUserClient.queryById(rechargeRecordsVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(rechargeRecordsVO.getId().intValue()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(""); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(rechargeRecordsVO.getInsertTime()); |
| | | if (rechargeRecordsVO.getAmount() != null) { |
| | | temp.setAmount(rechargeRecordsVO.getAmount()); |
| | | } |
| | | temp.setIncomeType(2); |
| | | temp.setState(rechargeRecordsVO.getPayStatus()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if ( incomeType==null || incomeType == 3) { |
| | | // 报名课程记录 |
| | | List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query); |
| | | for (RegisterOrderVO registerOrderVO : registerOrderVOS) { |
| | | if (registerOrderVO.getMoney() == null) { |
| | | continue; |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(registerOrderVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(registerOrderVO.getId().intValue()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(registerOrderVO.getStoreName()); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(registerOrderVO.getInsertTime()); |
| | | if (registerOrderVO.getMoney() != null) { |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | temp.setIncomeType(3); |
| | | temp.setState(registerOrderVO.getPayStatus()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if(roleType !=3) { |
| | | if (incomeType == null || incomeType == 4) { |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | | for (PaymentCompetition competition : competitions) { |
| | | if (competition.getPayStatus() == 3) { |
| | | continue; |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(competition.getAppUserId()); |
| | | Competition competition1 = competitionClient.queryById(competition.getCompetitionId()); |
| | | if (!competition1.getStoreId().equals("")){ |
| | | String[] split = competition1.getStoreId().split(","); |
| | | } |
| | | Store store = storeClient.getStoreById(Integer.valueOf(competition1.getStoreId())); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(competition.getId().intValue()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(store.getName()); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(competition.getInsertTime()); |
| | | |
| | | if (competition.getAmount() != null) { |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | temp.setIncomeType(4); |
| | | temp.setState(competition.getPayStatus()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | } |
| | | if (incomeType == null || incomeType == 5) { |
| | | // 预约场地 |
| | | List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if (siteBooking.getStatus() == 0 || siteBooking.getStatus() == 5 || siteBooking.getStatus() == 4) { |
| | | temp.setState(1); |
| | | } else { |
| | | temp.setState(2); |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(siteBooking.getAppUserId()); |
| | | Store store = storeClient.getStoreById(siteBooking.getStoreId()); |
| | | |
| | | temp.setId(siteBooking.getId()); |
| | | temp.setProvince(siteBooking.getProvince()); |
| | | temp.setCity(siteBooking.getCity()); |
| | | temp.setStoreName(store.getName()); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(siteBooking.getInsertTime()); |
| | | if (siteBooking.getPayMoney() != null) { |
| | | temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString())); |
| | | } |
| | | temp.setIncomeType(5); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | } |
| | | return incomeVOS; |
| | | } |
| | | |
| | | /** |
| | | * 获取收入管理列表 |
| | | */ |
| | | @RequestMapping(value = "/getIncomeData") |
| | | @ResponseBody |
| | | public Object getIncomeData(String time,Integer incomeType,String userName,String amount) { |
| | | // 充值记录查询query |
| | | RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery(); |
| | | // 报名课程查询query |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | // 赛事活动查询query |
| | | CompetitionQuery competitionQuery = new CompetitionQuery(); |
| | | // 会员支付查询query |
| | | IncomeQuery incomeQuery = new IncomeQuery(); |
| | | // 场地预约记录查询query |
| | | SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); |
| | | AppUserByNameAndPhoneDTO appUserByNameAndPhoneDTO = new AppUserByNameAndPhoneDTO(); |
| | | appUserByNameAndPhoneDTO.setUserName(userName); |
| | | if (userName!=null){ |
| | | if (!userName.equals("")){ |
| | | List<TAppUser> tAppUsers = appUserClient.queryAPPUserByNameAndPhone(appUserByNameAndPhoneDTO); |
| | | // 用户ids |
| | | List<Integer> collect = tAppUsers.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | competitionQuery.setUserIds(collect); |
| | | rechargeRecordsQuery.setUserIds(collect); |
| | | query.setUserIds(collect); |
| | | incomeQuery.setUserIds(collect); |
| | | siteBookingQuery.setUserIds(collect); |
| | | } |
| | | } |
| | | if (amount==null || amount.equals("")){ |
| | | siteBookingQuery.setAmount(null); |
| | | query.setAmount(null); |
| | | rechargeRecordsQuery.setAmount(null); |
| | | competitionQuery.setAmount(null); |
| | | incomeQuery.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)); |
| | | } |
| | | |
| | | siteBookingQuery.setTime(time); |
| | | query.setRegisterTime(time); |
| | | rechargeRecordsQuery.setTime(time); |
| | | competitionQuery.setTime(time); |
| | | incomeQuery.setTime(time); |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | IncomeVO incomeVO = new IncomeVO(); |
| | | List<IncomeVO> incomeVOS = new ArrayList<>(); |
| | | |
| | | if (roleType == 1){ |
| | | if ( incomeType==null || incomeType == 1){ |
| | | // 会员支付记录 |
| | | List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); |
| | | for (VipPayment vipPayment : vipPayments) { |
| | | |
| | | TAppUser tAppUser = appUserClient.queryById(vipPayment.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(vipPayment.getId()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(""); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setAmount(new BigDecimal(vipPayment.getAmount().toString())); |
| | | temp.setIncomeType(1); |
| | | temp.setState(vipPayment.getState()); |
| | | temp.setInsertTime(vipPayment.getInsertTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if ( incomeType==null || incomeType == 2) { |
| | | // 充值记录 |
| | | List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery); |
| | | for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { |
| | | TAppUser tAppUser = appUserClient.queryById(rechargeRecordsVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(rechargeRecordsVO.getId().intValue()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(""); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(rechargeRecordsVO.getInsertTime()); |
| | | if (rechargeRecordsVO.getAmount() != null) { |
| | | temp.setAmount(rechargeRecordsVO.getAmount()); |
| | | } |
| | | temp.setIncomeType(2); |
| | | temp.setState(rechargeRecordsVO.getState()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if ( incomeType==null || incomeType == 3) { |
| | | // 报名课程记录 |
| | | List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query); |
| | | for (RegisterOrderVO registerOrderVO : registerOrderVOS) { |
| | | if (registerOrderVO.getMoney() == null) { |
| | | continue; |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(registerOrderVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(registerOrderVO.getId().intValue()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(registerOrderVO.getStoreName()); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(registerOrderVO.getInsertTime()); |
| | | if (registerOrderVO.getMoney() != null) { |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | temp.setIncomeType(3); |
| | | temp.setState(registerOrderVO.getPayStatus()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | if(roleType !=3) { |
| | | if (incomeType == null || incomeType == 4) { |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | | for (PaymentCompetition competition : competitions) { |
| | | if (competition.getPayStatus() == 3) { |
| | | continue; |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(competition.getAppUserId()); |
| | | Competition competition1 = competitionClient.queryById(competition.getCompetitionId()); |
| | | Store store = storeClient.getStoreById(Integer.valueOf(competition1.getStoreId().split(",")[0])); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(competition.getId().intValue()); |
| | | temp.setProvince(tAppUser.getProvince()); |
| | | temp.setCity(tAppUser.getCity()); |
| | | temp.setStoreName(store.getName()); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(competition.getInsertTime()); |
| | | |
| | | if (competition.getAmount() != null) { |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | temp.setIncomeType(4); |
| | | temp.setState(competition.getPayStatus()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | } |
| | | if (incomeType == null || incomeType == 5) { |
| | | // 预约场地 |
| | | List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if (siteBooking.getStatus() == 0 || siteBooking.getStatus() == 5 || siteBooking.getStatus() == 4) { |
| | | temp.setState(1); |
| | | } else { |
| | | temp.setState(2); |
| | | } |
| | | TAppUser tAppUser = appUserClient.queryById(siteBooking.getAppUserId()); |
| | | Store store = storeClient.getStoreById(siteBooking.getStoreId()); |
| | | |
| | | temp.setId(siteBooking.getId()); |
| | | temp.setProvince(siteBooking.getProvince()); |
| | | temp.setCity(siteBooking.getCity()); |
| | | temp.setStoreName(store.getName()); |
| | | temp.setPayUser(tAppUser.getName()); |
| | | temp.setPhone(tAppUser.getPhone()); |
| | | temp.setInsertTime(siteBooking.getInsertTime()); |
| | | if (siteBooking.getPayMoney() != null) { |
| | | temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString())); |
| | | } |
| | | temp.setIncomeType(5); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | } |
| | | BigDecimal totalAmount = BigDecimal.ZERO; // 初始化累加变量为0 |
| | | |
| | | for (IncomeVO vo : incomeVOS) { |
| | | BigDecimal totalMoney = vo.getAmount(); |
| | | totalAmount = totalAmount.add(totalMoney); // 累加每个IncomeVO对象的amount |
| | | } |
| | | return totalAmount; |
| | | } |
| | | /** |
| | | * 获取消课记录 |
| | |
| | | coachQuery.setTime(beginTime); |
| | | return cancelledClassesClient.listAll(coachQuery); |
| | | } |
| | | /** |
| | | * 获取报名订单记录 |
| | | */ |
| | | @RequestMapping(value = "/registerListAll") |
| | | @ResponseBody |
| | | public List<RegisterOrderVO> registerListAll(String province,String city,Integer storeId,String registerTime |
| | | ,String userName,String phone,String studentName,String coursePackageName,String salesName,Integer orderSource) { |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | query.setProvince(province); |
| | | query.setCity(city); |
| | | query.setStoreId(storeId); |
| | | query.setRegisterTime(registerTime); |
| | | query.setUserName(userName); |
| | | query.setUserIds(Lists.newArrayList()); |
| | | query.setPhone(phone); |
| | | query.setStudentName(studentName); |
| | | query.setStudentIds(Lists.newArrayList()); |
| | | query.setCoursePackageName(coursePackageName); |
| | | query.setSalesName(salesName); |
| | | query.setOrderSource(orderSource); |
| | | AppUserByNameAndPhoneDTO appUserByNameAndPhoneDTO = new AppUserByNameAndPhoneDTO(); |
| | | appUserByNameAndPhoneDTO.setUserName(query.getUserName()); |
| | | appUserByNameAndPhoneDTO.setPhone(query.getPhone()); |
| | | List<TAppUser> tAppUsers = appUserClient.queryAPPUserByNameAndPhone(appUserByNameAndPhoneDTO); |
| | | // 使用 Stream API 将 tAppUsers 中的 id 收集到一个集合中 |
| | | List<Integer> userIds = tAppUsers.stream() |
| | | .map(TAppUser::getId) // 使用方法引用获取每个对象的 id |
| | | .collect(Collectors.toList()); |
| | | query.setUserIds(userIds); |
| | | if (userIds.size()==0){ |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | return coursePackagePaymentClient.listAllRegister(query); |
| | | } |
| | | |
| | | |
| | | |