From dd663d0ac783755d889e270eee57ee58630c88c8 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 28 二月 2025 17:46:52 +0800 Subject: [PATCH] 冥想2.0新增代码 --- xinquan-modules/xinquan-system/src/main/java/com/xinquan/system/controller/HomeController.java | 199 +++++++++++++++++++++++++++++++++++-------------- 1 files changed, 141 insertions(+), 58 deletions(-) diff --git a/xinquan-modules/xinquan-system/src/main/java/com/xinquan/system/controller/HomeController.java b/xinquan-modules/xinquan-system/src/main/java/com/xinquan/system/controller/HomeController.java index 943a12c..00b076f 100644 --- a/xinquan-modules/xinquan-system/src/main/java/com/xinquan/system/controller/HomeController.java +++ b/xinquan-modules/xinquan-system/src/main/java/com/xinquan/system/controller/HomeController.java @@ -3,11 +3,18 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; +import com.xinquan.common.core.constant.CacheConstants; import com.xinquan.common.core.domain.R; +import com.xinquan.common.core.exception.ServiceException; import com.xinquan.common.core.utils.DateUtils; import com.xinquan.common.core.utils.WebUtils; import com.xinquan.common.core.utils.page.BeanUtils; import com.xinquan.common.core.utils.page.PageDTO; +import com.xinquan.common.core.web.domain.BaseModel; +import com.xinquan.common.log.annotation.Log; +import com.xinquan.common.log.enums.BusinessType; +import com.xinquan.common.redis.service.RedisService; +import com.xinquan.common.security.utils.SecurityUtils; import com.xinquan.course.api.domain.Course; import com.xinquan.course.api.domain.CourseCategory; import com.xinquan.course.api.domain.CourseDTO; @@ -16,10 +23,15 @@ import com.xinquan.order.api.domain.Order; import com.xinquan.order.api.domain.vo.HomeDto; import com.xinquan.order.api.feign.RemoteOrderService; +import com.xinquan.system.api.domain.SysUser; import com.xinquan.system.api.domain.vo.HomeVO; import com.xinquan.system.domain.Banner; +import com.xinquan.system.domain.Turn; +import com.xinquan.system.domain.Version; import com.xinquan.system.domain.export.HomeExport; import com.xinquan.system.service.BannerService; +import com.xinquan.system.service.ISysUserService; +import com.xinquan.system.service.TurnService; import com.xinquan.user.api.feign.RemoteAppUserService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -64,7 +76,45 @@ private RemoteMeditationService remoteMeditationService; @Resource private RemoteOrderService remoteOrderService; + @Resource + private ISysUserService sysUserService; + @Resource + private RedisService redisService; + @Resource + private TurnService turnService; + @GetMapping("/getTurn") + @ApiOperation(value = "IOS获取是否跳转三方支付", tags = "IOS获取是否跳转三方支付") + public R getTurn() { + Turn one = turnService.getOne(null); + if (one.getIsTurn()==1){ + return R.ok(true); + }else{ + return R.ok(false); + } + } + + + @GetMapping("/updatePassword") + @ApiOperation(value = "管理后台-修改密码", tags = "管理后台-修改密码") + @Log(title = "【修改密码】修改密码", businessType = BusinessType.UPDATE) + + public R updatePassword(String userName,String password) { + SysUser one = sysUserService.lambdaQuery() + .eq(SysUser::getUserType, "00") + .eq(SysUser::getDelFlag, "0") + .eq(SysUser::getUserName, userName).one(); + + if (one!=null){ +// if (one.getStatus().equals("1")){ +// return R.fail("账号已被冻结"); +// } + one.setPassword(SecurityUtils.encryptPassword(password)); + sysUserService.updateById(one); + return R.ok(); + } + return R.fail("修改失败,账号不存在"); + } @PostMapping("/homeStatistics") @ApiOperation(value = "首页统计",tags = "管理后台-首页统计") public R<HomeVO> bannerList(@RequestBody HomeDto homeDto) { @@ -117,6 +167,9 @@ if (!StringUtils.hasLength(homeDto.getTime())){ homeDto.setTime("1"); } + if (homeDto.getTimeType()==null){ + homeDto.setTimeType(5); + } List<Order> data6 = remoteOrderService.getOrderList(homeDto.getStatus(), homeDto.getTimeType(), homeDto.getTime()).getData(); homeVO.setOrderCount(data6.size()+""); @@ -130,7 +183,7 @@ Map<String, Object> x = new HashMap<>(); Map<String, Object> x1 = new HashMap<>(); Map<String, Object> x2 = new HashMap<>(); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd"); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("d"); SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); switch (homeDto.getTimeType()){ @@ -187,14 +240,14 @@ // 周 // 获取本周7天 格式为dd - calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); for (int i = 1; i <= 7; i++) { Date time = calendar.getTime(); String format1 = simpleDateFormat.format(time); x.put(format1,0); x1.put(format1,0); x2.put(format1,0); - calendar.add(Calendar.DAY_OF_MONTH, 1); + calendar.add(Calendar.DAY_OF_WEEK, 1); } break; case 4: @@ -210,16 +263,41 @@ calendar.add(Calendar.DAY_OF_MONTH, 1); } break; - } - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - List<LocalDate> localDates = generateDateList(homeDto.getTime()); - for (LocalDate localDate : localDates) { - x.put(localDate+"",0); - x1.put(localDate+"",0); - x2.put(localDate+"",0); - } + case 5: + String startTime = null; + String endTime = null; + if (org.springframework.util.StringUtils.hasLength(homeDto.getTime())){ + String[] split = homeDto.getTime().split(" - "); + startTime = split[0]; + endTime = split[1]; + // 将其转化为LocalDate + LocalDate startLocalDate = LocalDate.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + LocalDate endLocalDate = LocalDate.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + // 将startLocalDate到endLocalDate之间的每一天的日期,包括startLocalDate和endLocalDate + List<LocalDate> localDates = new ArrayList<>(); + while (!startLocalDate.isAfter(endLocalDate)) { + // 将startLocalDate转化为格式为yyyy-MM-dd格式字符串 + String format1 = startLocalDate.format(DateTimeFormatter.ofPattern("d")); + x.put(format1,0); + x1.put(format1,0); + x2.put(format1,0); + localDates.add(startLocalDate); + startLocalDate = startLocalDate.plusDays(1); + } + } + + break; } +// if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ +// List<LocalDate> localDates = generateDateList(homeDto.getTime()); +// for (LocalDate localDate : localDates) { +// x.put(localDate+"",0); +// x1.put(localDate+"",0); +// x2.put(localDate+"",0); +// } +// +// } for (Order order : data6) { int value = order.getCreateTime().getMonth().getValue(); int value1 = order.getCreateTime().getDayOfMonth(); @@ -230,32 +308,29 @@ switch (homeDto.getTimeType()){ case 1: // 获取订单月份 - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x.put(localDate+"",(int)x.get(value+"")+1); - }else{ + if (StringUtils.hasLength(homeDto.getTime())&&x.get(value+"")!=null){ x.put(value+"",(int)x.get(value+"")+1); } break; case 2: Date date = new Date(); String format = simpleDateFormat.format(date); - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x.put(localDate+"",(int)x.get(value+"")+1); - }else{ - x.put(format,(int)x.get(format)+1); + if (StringUtils.hasLength(homeDto.getTime())&&x.get(value1+"")!=null){ + x.put(value1+"",(int)x.get(value1+"")+1); } break; case 3: - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x.put(localDate+"",(int)x.get(value+"")+1); - }else{ + if (StringUtils.hasLength(homeDto.getTime())&&x.get(value1+"")!=null){ x.put(value1+"",(int)x.get(value1+"")+1); } break; case 4: - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x.put(localDate+"",(int)x.get(value+"")+1); - }else{ + if (StringUtils.hasLength(homeDto.getTime())&&x.get(value1+"")!=null){ + x.put(value1+"",(int)x.get(value1+"")+1); + } + break; + case 5: + if (StringUtils.hasLength(homeDto.getTime())&&x.get(value1+"")!=null){ x.put(value1+"",(int)x.get(value1+"")+1); } break; @@ -265,33 +340,31 @@ switch (homeDto.getTimeType()){ case 1: // 获取订单月份 - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x1.put(localDate+"",(int)x1.get(value+"")+1); - }else{ + if (StringUtils.hasLength(homeDto.getTime())&&x1.get(value+"")!=null){ x1.put(value+"",(int)x1.get(value+"")+1); } break; case 2: Date date = new Date(); String format = simpleDateFormat.format(date); - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x1.put(localDate+"",(int)x1.get(value+"")+1); - }else{ - x1.put(format,(int)x1.get(format)+1); + if (StringUtils.hasLength(homeDto.getTime())&&x1.get(value1+"")!=null){ + x1.put(value1+"",(int)x1.get(value1+"")+1); + } break; case 3: - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x1.put(localDate+"",(int)x1.get(value+"")+1); - }else{ - x1.put(value+"",(int)x1.get(value+"")+1); + if (StringUtils.hasLength(homeDto.getTime())&&x1.get(value1+"")!=null){ + x1.put(value1+"",(int)x1.get(value1+"")+1); } break; case 4: - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x1.put(localDate+"",(int)x1.get(value+"")+1); - }else{ - x1.put(value+"",(int)x1.get(value+"")+1); + if (StringUtils.hasLength(homeDto.getTime())&&x1.get(value1+"")!=null){ + x1.put(value1+"",(int)x1.get(value1+"")+1); + } + break; + case 5: + if (StringUtils.hasLength(homeDto.getTime())&&x1.get(value1+"")!=null){ + x1.put(value1+"",(int)x1.get(value1+"")+1); } break; } @@ -300,33 +373,33 @@ switch (homeDto.getTimeType()){ case 1: // 获取订单月份 - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x2.put(localDate+"",(int)x2.get(value+"")+1); - }else{ + if (StringUtils.hasLength(homeDto.getTime())&&x2.get(value+"")!=null){ x2.put(value+"",(int)x2.get(value+"")+1); } break; case 2: Date date = new Date(); String format = simpleDateFormat.format(date); - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x2.put(localDate+"",(int)x2.get(value+"")+1); - }else{ - x2.put(format,(int)x2.get(format)+1); + if (StringUtils.hasLength(homeDto.getTime())&&x2.get(value1+"")!=null){ + x2.put(value1+"",(int)x2.get(value1+"")+1); + } break; case 3: - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x2.put(localDate+"",(int)x2.get(value+"")+1); - }else{ - x2.put(value+"",(int)x2.get(value+"")+1); + if (StringUtils.hasLength(homeDto.getTime())&&x2.get(value1+"")!=null){ + + x2.put(value1+"",(int)x2.get(value1+"")+1); } break; case 4: - if (StringUtils.hasLength(homeDto.getTime())&&(!homeDto.getTime().equals("1"))){ - x2.put(localDate+"",(int)x2.get(value+"")+1); - }else{ - x2.put(value+"",(int)x2.get(value+"")+1); + if (StringUtils.hasLength(homeDto.getTime())&&x2.get(value1+"")!=null){ + + x2.put(value1+"",(int)x2.get(value1+"")+1); + } + break; + case 5: + if (StringUtils.hasLength(homeDto.getTime())&&x2.get(value1+"")!=null){ + x2.put(value1+"",(int)x2.get(value1+"")+1); } break; } @@ -367,10 +440,6 @@ @ApiOperation(value = "首页统计-导出",tags = "管理后台-首页统计") public void homeStatisticsExport() { HomeVO homeVO = new HomeVO(); -// homeVO.setOrderMoney(); -// homeVO.setOrderCount(); -// homeVO.setOrderList(); -// homeVO.setOrderTimeList(); // 查询用户总数、非会员数、月卡会员数、季卡会员数、年卡会员数 String data = remoteAppUserService.getUserCount().getData(); if (data!=null){ @@ -412,6 +481,16 @@ HomeExport homeExport = new HomeExport(); BeanUtils.copyProperties(homeVO, homeExport); + if (data1!=null){ + String[] split = data1.split(","); + homeVO.setCourseCount(split[0]); + homeVO.setCourseFree(split[1]); + homeVO.setCourseVip(split[2]); + homeVO.setCoursePay(split[3]); + homeVO.setCourseOffOnline(split[4]); + Integer i = Integer.valueOf(homeExport.getCourseCount()); + Integer i1 = Integer.valueOf(split[4]); + } List<HomeExport> homeExports = new ArrayList<>(); homeExports.add(homeExport); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), HomeExport.class, homeExports); @@ -478,6 +557,8 @@ @ApiImplicitParams({ @ApiImplicitParam(value = "ids", name = "ids", required = true, dataType = "String"), }) + @Log(title = "【banner】批量删除banner", businessType = BusinessType.DELETE) + public R deleteBatch( @RequestParam(value = "ids") String ids) { @@ -487,6 +568,7 @@ } @PostMapping("/addBanner") @ApiOperation(value = "添加banner",tags = "管理后台banner") + @Log(title = "【banner】添加", businessType = BusinessType.INSERT) public R addBanner(@RequestBody Banner banner) { @@ -495,6 +577,7 @@ } @PostMapping("/updateBanner") @ApiOperation(value = "修改banner",tags = "管理后台banner") + @Log(title = "【banner】修改", businessType = BusinessType.UPDATE) public R updateBanner(@RequestBody Banner banner) { -- Gitblit v1.7.1