| | |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.*; |
| | | import com.dsh.guns.modular.system.service.*; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | 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 java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | 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"; |
| | | * } |
| | | * |
| | | * @RequestMapping(value = "/listAll") |
| | | * @ResponseBody |
| | | * public List<RechargeRecordsVO> list(String province, String city, String name, String phone, String time, Integer type) { |
| | | * RechargeRecordsQuery coachQuery = new RechargeRecordsQuery(); |
| | | * 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); |
| | | * return financeClient.rechargeList(coachQuery); |
| | | * } |
| | | * |
| | | * @RequestMapping(value = "/getAmount") |
| | | * @ResponseBody |
| | | * public BigDecimal getAmount(String province, String city, String name, String phone, String time, Integer type) { |
| | | * RechargeRecordsQuery coachQuery = new RechargeRecordsQuery(); |
| | | * coachQuery.setProvince(province); |
| | | * coachQuery.setCity(city); |
| | | * coachQuery.setName(name); |
| | | * coachQuery.setPhone(phone); |
| | | * coachQuery.setTime(time); |
| | | * coachQuery.setType(type); |
| | | * List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(coachQuery); |
| | | * BigDecimal total = new BigDecimal("0.00"); |
| | | * for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { |
| | | * total = total.add(rechargeRecordsVO.getAmount()); |
| | | * } |
| | | * return total; |
| | | * } |
| | | */ |
| | | @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"; |
| | | } |
| | | /** |
| | | * 获取充值记录 |
| | | */ |
| | | @RequestMapping(value = "/listAll") |
| | | @ResponseBody |
| | | public List<RechargeRecordsVO> list(String province, String city, String name, String phone,String time,Integer type) { |
| | | RechargeRecordsQuery coachQuery = new RechargeRecordsQuery(); |
| | | 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); |
| | | return financeClient.rechargeList(coachQuery); |
| | | } |
| | | |
| | | /** |
| | | * 获取充值记录 |
| | | */ |
| | | @RequestMapping(value = "/getAmount") |
| | | /** 充值记录功能已下线,避免通过历史菜单或直接 URL 继续访问。 */ |
| | | @RequestMapping({"/rechargeRecords", "/listAll", "/getAmount"}) |
| | | @ResponseBody |
| | | public BigDecimal getAmount(String province, String city, String name, String phone, String time, Integer type) { |
| | | RechargeRecordsQuery coachQuery = new RechargeRecordsQuery(); |
| | | coachQuery.setProvince(province); |
| | | coachQuery.setCity(city); |
| | | coachQuery.setName(name); |
| | | coachQuery.setPhone(phone); |
| | | coachQuery.setTime(time); |
| | | 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 = total.add(amount); // 将新的值赋给total |
| | | result = result.add(amount); // 将新的值赋给result |
| | | } |
| | | return total; |
| | | public ResultUtil rechargeRecordsUnavailable() { |
| | | return ResultUtil.error("充值记录功能暂不提供"); |
| | | } |
| | | /** |
| | | * 获取报名订单统计数据 |
| | |
| | | List<Integer> operatorId = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId", UserExt.getUser().getObjectId())).stream() |
| | | .map(TStore::getId).collect(Collectors.toList()); |
| | | if (operatorId.isEmpty()){ |
| | | operatorId.add(0); |
| | | } |
| | | query.setStoresIds(operatorId); |
| | | competitionQuery.setOperatorId(UserExt.getUser().getObjectId()); |
| | | |
| | | siteBookingQuery.setStoreIds(operatorId); |
| | | } |
| | | if (UserExt.getUser().getObjectType()==3){ |
| | |
| | | temp.setStoreName(""); |
| | | temp.setAmount(new BigDecimal(vipPayment.getAmount().toString())); |
| | | temp.setIncomeType(1); |
| | | temp.setState(vipPayment.getState()); |
| | | temp.setState(2); |
| | | temp.setInsertTime(vipPayment.getInsertTime()); |
| | | if (UserExt.getUser().getObjectType()!=1){ |
| | | break; |
| | |
| | | temp.setAmount(rechargeRecordsVO.getAmount()); |
| | | } |
| | | temp.setIncomeType(2); |
| | | temp.setState(rechargeRecordsVO.getPayStatus()); |
| | | temp.setState(2); |
| | | |
| | | incomeVOS.add(temp); |
| | | } |
| | |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | temp.setIncomeType(3); |
| | | if (registerOrderVO.getPayStatus() == 1){ |
| | | |
| | | temp.setState(2); |
| | | } |
| | | if (registerOrderVO.getPayStatus() == 2){ |
| | | temp.setState(1); |
| | | } |
| | | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | |
| | | if(null == competition1){ |
| | | continue; |
| | | } |
| | | if (!competition1.getStoreId().equals("")){ |
| | | String[] split = competition1.getStoreId().split(","); |
| | | String competitionStoreIds = resolveCompetitionStoreIds(competition, competition1); |
| | | if (ToolUtil.isNotEmpty(competitionStoreIds)){ |
| | | String[] split = competitionStoreIds.split(","); |
| | | List<Integer> list = new ArrayList<>(); |
| | | for (String s : split) { |
| | | list.add(Integer.valueOf(s)); |
| | |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | temp.setIncomeType(4); |
| | | if (competition.getPayStatus() == 1){ |
| | | |
| | | temp.setState(2); |
| | | }else if (competition.getPayStatus() == 2){ |
| | | temp.setState(1); |
| | | } |
| | | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | |
| | | 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.queryAppUser1(siteBooking.getAppUserId()); |
| | | Store store = storeClient.getStoreById(siteBooking.getStoreId()); |
| | | |
| | |
| | | temp.setPhone(worldCupIncomeVO.getPhone()); |
| | | temp.setAmount(new BigDecimal(worldCupIncomeVO.getAmount())); |
| | | temp.setIncomeType(6); |
| | | temp.setState(1); |
| | | temp.setState(2); |
| | | temp.setInsertTime(simpleDateFormat.parse(worldCupIncomeVO.getPayTime())); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // 推荐:一行代码解决 |
| | | incomeVOS.sort(Comparator.comparing( |
| | | IncomeVO::getInsertTime, |
| | | Comparator.nullsLast(Comparator.reverseOrder()) |
| | | )); |
| | | return incomeVOS; |
| | | } |
| | | |
| | |
| | | temp.setStoreName(""); |
| | | temp.setAmount(new BigDecimal(vipPayment.getAmount().toString())); |
| | | temp.setIncomeType(1); |
| | | temp.setState(vipPayment.getState()); |
| | | temp.setState(2); |
| | | temp.setInsertTime(vipPayment.getInsertTime()); |
| | | if (UserExt.getUser().getObjectType()!=1){ |
| | | break; |
| | |
| | | temp.setAmount(rechargeRecordsVO.getAmount()); |
| | | } |
| | | temp.setIncomeType(2); |
| | | temp.setState(rechargeRecordsVO.getPayStatus()); |
| | | |
| | | temp.setState(2); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | |
| | | TAppUser tAppUser = appUserClient.queryById(registerOrderVO.getAppUserId()); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setId(registerOrderVO.getId().toString()); |
| | | if (registerOrderVO.getPayStatus()==2) { |
| | | temp.setState(2); |
| | | } else { |
| | | temp.setState(1); |
| | | } |
| | | |
| | | temp.setState(2); |
| | | |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | | temp.setProvince(tAppUser.getProvince()); |
| | |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | temp.setIncomeType(3); |
| | | temp.setState(registerOrderVO.getPayStatus()); |
| | | temp.setState(2); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | |
| | | if(null == competition1){ |
| | | continue; |
| | | } |
| | | if (!competition1.getStoreId().equals("")){ |
| | | String[] split = competition1.getStoreId().split(","); |
| | | String competitionStoreIds = resolveCompetitionStoreIds(competition, competition1); |
| | | if (ToolUtil.isNotEmpty(competitionStoreIds)){ |
| | | String[] split = competitionStoreIds.split(","); |
| | | List<Integer> list = new ArrayList<>(); |
| | | for (String s : split) { |
| | | list.add(Integer.valueOf(s)); |
| | |
| | | |
| | | temp.setStoreName(substring); |
| | | } |
| | | if (competition.getPayStatus()==2) { |
| | | |
| | | temp.setState(2); |
| | | } else { |
| | | temp.setState(1); |
| | | } |
| | | |
| | | temp.setId(competition.getId().toString()); |
| | | if (tAppUser!=null){ |
| | | if (tAppUser.getProvince()!=null){ |
| | |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | temp.setIncomeType(4); |
| | | temp.setState(competition.getPayStatus()); |
| | | temp.setState(2); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | temp.setState(2); |
| | | TAppUser tAppUser = appUserClient.queryAppUser1(siteBooking.getAppUserId()); |
| | | Store store = storeClient.getStoreById(siteBooking.getStoreId()); |
| | | |
| | |
| | | temp.setPhone(worldCupIncomeVO.getPhone()); |
| | | temp.setAmount(new BigDecimal(worldCupIncomeVO.getAmount())); |
| | | temp.setIncomeType(6); |
| | | temp.setState(1); |
| | | temp.setState(2); |
| | | temp.setInsertTime(simpleDateFormat.parse(worldCupIncomeVO.getPayTime())); |
| | | incomeVOS.add(temp); |
| | | } |
| | |
| | | return coursePackagePaymentClient.listAllRegister(query); |
| | | } |
| | | |
| | | /** |
| | | * 获取收入记录对应的门店归属;新订单使用下单快照,兼容未回填的历史订单。 |
| | | * |
| | | * @param paymentCompetition 活动支付记录 |
| | | * @param competition 活动当前信息 |
| | | * @return 逗号分隔的门店 ID 列表 |
| | | */ |
| | | private String resolveCompetitionStoreIds(PaymentCompetition paymentCompetition, Competition competition) { |
| | | if (ToolUtil.isNotEmpty(paymentCompetition.getCompetitionStoreIds())) { |
| | | return paymentCompetition.getCompetitionStoreIds(); |
| | | } |
| | | return competition.getStoreId(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |