appbanner图

This commit is contained in:
2026-02-11 10:45:31 +08:00
parent 65f5755422
commit 9714e97a71
6 changed files with 42 additions and 33 deletions
@@ -3,9 +3,8 @@ package com.renkang.bank.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -73,7 +72,7 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
// 动态排序 // 动态排序
if (StringUtils.isNotBlank(dto.getColumn())) { if (StringUtils.isNotBlank(dto.getColumn())) {
// 驼峰转下划线 // 驼峰转下划线
String column = StrUtil.toUnderlineCase(dto.getColumn()); String column = CharSequenceUtil.toUnderlineCase(dto.getColumn());
if ("asc".equalsIgnoreCase(dto.getOrder())) { if ("asc".equalsIgnoreCase(dto.getOrder())) {
queryWrapper.orderByAsc(column); queryWrapper.orderByAsc(column);
} else { } else {
@@ -101,11 +100,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
vo.setSexName(ObjectUtil.isNotNull(loginUser.getSex()) && loginUser.getSex().equals(1) ? "" : ""); vo.setSexName(ObjectUtil.isNotNull(loginUser.getSex()) && loginUser.getSex().equals(1) ? "" : "");
vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null); vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null);
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(vo.getOrgCode())); SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(vo.getOrgCode()));
if (ObjUtil.isNotEmpty(secondDepart)) { if (ObjectUtil.isNotEmpty(secondDepart)) {
vo.setDeptName(secondDepart.getDepartName()); vo.setDeptName(secondDepart.getDepartName());
} }
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(vo.getOrgCode())); SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(vo.getOrgCode()));
if (ObjUtil.isNotEmpty(thirdDepart)) { if (ObjectUtil.isNotEmpty(thirdDepart)) {
vo.setOrgName(thirdDepart.getDepartName()); vo.setOrgName(thirdDepart.getDepartName());
} }
} }
@@ -249,11 +248,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
vo.setSexName(ObjectUtil.isNotNull(loginUser.getSex()) && loginUser.getSex().equals(1) ? "" : ""); vo.setSexName(ObjectUtil.isNotNull(loginUser.getSex()) && loginUser.getSex().equals(1) ? "" : "");
vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null); vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null);
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode())); SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
if (ObjUtil.isNotEmpty(secondDepart)) { if (ObjectUtil.isNotEmpty(secondDepart)) {
vo.setDeptName(secondDepart.getDepartName()); vo.setDeptName(secondDepart.getDepartName());
} }
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode())); SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
if (ObjUtil.isNotEmpty(thirdDepart)) { if (ObjectUtil.isNotEmpty(thirdDepart)) {
vo.setOrgName(thirdDepart.getDepartName()); vo.setOrgName(thirdDepart.getDepartName());
} }
} }
@@ -343,11 +342,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
vo.setWorkNo(loginUser.getWorkNo()); vo.setWorkNo(loginUser.getWorkNo());
vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null); vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null);
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode())); SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
if (ObjUtil.isNotEmpty(secondDepart)) { if (ObjectUtil.isNotEmpty(secondDepart)) {
vo.setDeptName(secondDepart.getDepartName()); vo.setDeptName(secondDepart.getDepartName());
} }
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode())); SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
if (ObjUtil.isNotEmpty(thirdDepart)) { if (ObjectUtil.isNotEmpty(thirdDepart)) {
vo.setOrgName(thirdDepart.getDepartName()); vo.setOrgName(thirdDepart.getDepartName());
} }
} }
@@ -463,7 +462,7 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
.apply("DATE_FORMAT(create_time, '%Y-%m-%d') = {0}", DateUtil.today()) .apply("DATE_FORMAT(create_time, '%Y-%m-%d') = {0}", DateUtil.today())
); );
double sum = details.stream().map(UserPointsDetails::getPoints).mapToDouble(BigDecimal::doubleValue).sum(); double sum = details.stream().map(UserPointsDetails::getPoints).mapToDouble(BigDecimal::doubleValue).sum();
userPoints.setLatestAddDaySum(new BigDecimal(sum).add(pointsRule.getPoints())); userPoints.setLatestAddDaySum(BigDecimal.valueOf(sum).add(pointsRule.getPoints()));
} }
break; break;
case TYPE_2_USE: case TYPE_2_USE:
@@ -674,11 +673,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
vo.setAvatar(loginUser.getAvatar()); vo.setAvatar(loginUser.getAvatar());
vo.setSex(loginUser.getSex()); vo.setSex(loginUser.getSex());
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode())); SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
if (ObjUtil.isNotEmpty(secondDepart)) { if (ObjectUtil.isNotEmpty(secondDepart)) {
vo.setDeptName(secondDepart.getDepartName()); vo.setDeptName(secondDepart.getDepartName());
} }
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode())); SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
if (ObjUtil.isNotEmpty(thirdDepart)) { if (ObjectUtil.isNotEmpty(thirdDepart)) {
vo.setOrgName(thirdDepart.getDepartName()); vo.setOrgName(thirdDepart.getDepartName());
} }
} }
@@ -1,11 +1,9 @@
package org.jeecg.modules.api.controller; package org.jeecg.modules.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.api.service.SysBannerApiService; import org.jeecg.modules.api.service.SysBannerApiService;
import org.jeecg.modules.system.entity.SysBanner;
import org.jeecg.modules.system.entity.SysBannerDO; import org.jeecg.modules.system.entity.SysBannerDO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -13,7 +11,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@@ -31,19 +28,11 @@ public class SysBannerApiController {
return sysBannerApiService.selectBannerList(showLocation); return sysBannerApiService.selectBannerList(showLocation);
} }
// @Operation(summary = "轮播图-app轮播图列表", description = "轮播图-app轮播图列表")
// @GetMapping(value = "/app/list") @Operation(summary = "轮播图-app轮播图列表(返回所有)", description = "查询轮播图列表")
// public Result<List<SysBanner>> appBannerList(@RequestParam(name = "showLocation") String showLocation) { @GetMapping("/selectAllBannerList")
// Date date = new Date(); public Result<List<SysBannerDO>> selectAllBannerList() {
// List<SysBanner> list = sysBannerApiService.list(new LambdaQueryWrapper<SysBanner>() return Result.ok(sysBannerApiService.selectAllBannerList());
// .select(SysBanner::getId, SysBanner::getPhotoUrl, SysBanner::getJumpUrl, SysBanner::getTfJump, SysBanner::getMemo) }
// .eq(SysBanner::getShowLocation, showLocation)
// .eq(SysBanner::getStatus, 1)
// .and(wrapper -> wrapper.eq(SysBanner::getIsLongTermEffective, 1)
// .or(wrapper1 -> wrapper1.eq(SysBanner::getIsLongTermEffective, 0).ge(SysBanner::getStartTime, date).le(SysBanner::getEndTime, date)))
// .orderByDesc(SysBanner::getSort)
// );
// return Result.OK(list);
// }
} }
@@ -7,4 +7,7 @@ import java.util.List;
public interface SysBannerApiService { public interface SysBannerApiService {
Result<List<SysBannerDO>> selectBannerList(String showLocation); Result<List<SysBannerDO>> selectBannerList(String showLocation);
List<SysBannerDO> selectAllBannerList();
} }
@@ -2,6 +2,7 @@ package org.jeecg.modules.api.service.impl;
import com.aliyuncs.utils.StringUtils; import com.aliyuncs.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -29,19 +31,29 @@ public class SysBannerApiServiceImpl implements SysBannerApiService {
@Override @Override
public Result<List<SysBannerDO>> selectBannerList(String showLocation) { public Result<List<SysBannerDO>> selectBannerList(String showLocation) {
if (StringUtils.isEmpty(showLocation)) { if (StringUtils.isEmpty(showLocation)) {
return Result.error("请选择展示的位置"); return Result.error("请选择展示的位置");
} }
List<SysBannerDO> list = healthHolidayMapper.selectBannerList(showLocation); List<SysBannerDO> list = healthHolidayMapper.selectBannerList(showLocation);
// 添加长期有效的banner // 添加长期有效的banner
list.addAll(getLongTermEffectiveBanner(showLocation)); list.addAll(getLongTermEffectiveBanner(showLocation));
// 去重返回 // 去重返回
return Result.ok(list.stream().distinct().collect(Collectors.toList())); return Result.ok(list.stream().distinct().collect(Collectors.toList()));
} }
@Override
public List<SysBannerDO> selectAllBannerList() {
Date date = new Date();
return sysBannerMapper.selectJoinList(SysBannerDO.class, new MPJLambdaQueryWrapper<SysBanner>()
.selectAll(SysBanner.class)
.eq(SysBanner::getStatus, 1)
.and(wrapper -> wrapper.eq(SysBanner::getIsLongTermEffective, 1)
.or(wrapper1 -> wrapper1.eq(SysBanner::getIsLongTermEffective, 0).ge(SysBanner::getStartTime, date).le(SysBanner::getEndTime, date)))
.orderByAsc(SysBanner::getShowLocation)
.orderByAsc(SysBanner::getSort)
);
}
private List<SysBannerDO> getLongTermEffectiveBanner(String showLocation) { private List<SysBannerDO> getLongTermEffectiveBanner(String showLocation) {
LambdaQueryWrapper<SysBanner> queryWrapper = GlobalUtils.getLambdaQueryWrapper(); LambdaQueryWrapper<SysBanner> queryWrapper = GlobalUtils.getLambdaQueryWrapper();
queryWrapper.eq(SysBanner::getIsLongTermEffective, CommonConstant.YES) queryWrapper.eq(SysBanner::getIsLongTermEffective, CommonConstant.YES)
@@ -2,6 +2,7 @@ package org.jeecg.modules.system.entity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
@Data @Data
public class SysBannerDO { public class SysBannerDO {
@@ -17,4 +18,8 @@ public class SysBannerDO {
@Schema(title = "跳转参数") @Schema(title = "跳转参数")
private String jumpUrl; private String jumpUrl;
@Dict(dicCode = "show_location")
@Schema(title = "展示位置")
private String showLocation;
} }
@@ -2,6 +2,7 @@ package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.system.entity.SysBanner; import org.jeecg.modules.system.entity.SysBanner;
@@ -12,7 +13,7 @@ import org.jeecg.modules.system.entity.SysBanner;
* @Version: V1.0 * @Version: V1.0
*/ */
@Mapper @Mapper
public interface SysBannerMapper extends BaseMapper<SysBanner> { public interface SysBannerMapper extends MPJBaseMapper<SysBanner> {
/** /**
* 分页列表查询 * 分页列表查询
* *