appbanner图
This commit is contained in:
+11
-12
@@ -3,9 +3,8 @@ package com.renkang.bank.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
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.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -73,7 +72,7 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
|
||||
// 动态排序
|
||||
if (StringUtils.isNotBlank(dto.getColumn())) {
|
||||
// 驼峰转下划线
|
||||
String column = StrUtil.toUnderlineCase(dto.getColumn());
|
||||
String column = CharSequenceUtil.toUnderlineCase(dto.getColumn());
|
||||
if ("asc".equalsIgnoreCase(dto.getOrder())) {
|
||||
queryWrapper.orderByAsc(column);
|
||||
} else {
|
||||
@@ -101,11 +100,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
|
||||
vo.setSexName(ObjectUtil.isNotNull(loginUser.getSex()) && loginUser.getSex().equals(1) ? "女" : "男");
|
||||
vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null);
|
||||
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(vo.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(secondDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(secondDepart)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(vo.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(thirdDepart)) {
|
||||
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.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null);
|
||||
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(secondDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(secondDepart)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(thirdDepart)) {
|
||||
vo.setOrgName(thirdDepart.getDepartName());
|
||||
}
|
||||
}
|
||||
@@ -343,11 +342,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
|
||||
vo.setWorkNo(loginUser.getWorkNo());
|
||||
vo.setAge(ObjectUtil.isNotNull(loginUser.getAge()) && loginUser.getAge() > 0 ? loginUser.getAge() : null);
|
||||
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(secondDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(secondDepart)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(thirdDepart)) {
|
||||
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())
|
||||
);
|
||||
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;
|
||||
case TYPE_2_USE:
|
||||
@@ -674,11 +673,11 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
|
||||
vo.setAvatar(loginUser.getAvatar());
|
||||
vo.setSex(loginUser.getSex());
|
||||
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(secondDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(secondDepart)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
if (ObjectUtil.isNotEmpty(thirdDepart)) {
|
||||
vo.setOrgName(thirdDepart.getDepartName());
|
||||
}
|
||||
}
|
||||
|
||||
+6
-17
@@ -1,11 +1,9 @@
|
||||
package org.jeecg.modules.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.api.service.SysBannerApiService;
|
||||
import org.jeecg.modules.system.entity.SysBanner;
|
||||
import org.jeecg.modules.system.entity.SysBannerDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@@ -31,19 +28,11 @@ public class SysBannerApiController {
|
||||
return sysBannerApiService.selectBannerList(showLocation);
|
||||
}
|
||||
|
||||
// @Operation(summary = "轮播图-app轮播图列表", description = "轮播图-app轮播图列表")
|
||||
// @GetMapping(value = "/app/list")
|
||||
// public Result<List<SysBanner>> appBannerList(@RequestParam(name = "showLocation") String showLocation) {
|
||||
// Date date = new Date();
|
||||
// List<SysBanner> list = sysBannerApiService.list(new LambdaQueryWrapper<SysBanner>()
|
||||
// .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);
|
||||
// }
|
||||
|
||||
@Operation(summary = "轮播图-app轮播图列表(返回所有)", description = "查询轮播图列表")
|
||||
@GetMapping("/selectAllBannerList")
|
||||
public Result<List<SysBannerDO>> selectAllBannerList() {
|
||||
return Result.ok(sysBannerApiService.selectAllBannerList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
@@ -7,4 +7,7 @@ import java.util.List;
|
||||
|
||||
public interface SysBannerApiService {
|
||||
Result<List<SysBannerDO>> selectBannerList(String showLocation);
|
||||
|
||||
List<SysBannerDO> selectAllBannerList();
|
||||
|
||||
}
|
||||
|
||||
+15
-3
@@ -2,6 +2,7 @@ package org.jeecg.modules.api.service.impl;
|
||||
|
||||
import com.aliyuncs.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -29,19 +31,29 @@ public class SysBannerApiServiceImpl implements SysBannerApiService {
|
||||
|
||||
@Override
|
||||
public Result<List<SysBannerDO>> selectBannerList(String showLocation) {
|
||||
|
||||
if (StringUtils.isEmpty(showLocation)) {
|
||||
return Result.error("请选择展示的位置");
|
||||
}
|
||||
|
||||
List<SysBannerDO> list = healthHolidayMapper.selectBannerList(showLocation);
|
||||
|
||||
// 添加长期有效的banner
|
||||
list.addAll(getLongTermEffectiveBanner(showLocation));
|
||||
// 去重返回
|
||||
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) {
|
||||
LambdaQueryWrapper<SysBanner> queryWrapper = GlobalUtils.getLambdaQueryWrapper();
|
||||
queryWrapper.eq(SysBanner::getIsLongTermEffective, CommonConstant.YES)
|
||||
|
||||
+5
@@ -2,6 +2,7 @@ package org.jeecg.modules.system.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
@Data
|
||||
public class SysBannerDO {
|
||||
@@ -17,4 +18,8 @@ public class SysBannerDO {
|
||||
|
||||
@Schema(title = "跳转参数")
|
||||
private String jumpUrl;
|
||||
|
||||
@Dict(dicCode = "show_location")
|
||||
@Schema(title = "展示位置")
|
||||
private String showLocation;
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.system.entity.SysBanner;
|
||||
|
||||
@@ -12,7 +13,7 @@ import org.jeecg.modules.system.entity.SysBanner;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysBannerMapper extends BaseMapper<SysBanner> {
|
||||
public interface SysBannerMapper extends MPJBaseMapper<SysBanner> {
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user