| | |
| | | |
| | | 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.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; |
| | |
| | | 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; |
| | |
| | | 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 = "管理后台-修改密码") |
| | | 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) { |
| | |
| | | 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()){ |
| | |
| | | // 周 |
| | | // 获取本周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: |
| | |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | homeVO.setCourseOffOnline(split[4]); |
| | | Integer i = Integer.valueOf(homeExport.getCourseCount()); |
| | | Integer i1 = Integer.valueOf(split[4]); |
| | | homeExport.setCourseCount((i-i1)+""); |
| | | } |
| | | List<HomeExport> homeExports = new ArrayList<>(); |
| | | homeExports.add(homeExport); |