页面导览
This commit is contained in:
parent
3f2a845c44
commit
0fb641bbd6
|
@ -2,6 +2,7 @@ package com.ruoyi.common.core.domain.entity;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.Max;
|
||||
|
@ -131,6 +132,9 @@ public class User extends BaseEntity implements LogBizParam
|
|||
@ApiModelProperty("分成延迟到账时间(小时)")
|
||||
private Integer bonusDelay;
|
||||
|
||||
@Excel(name = "导览列表")
|
||||
private List<String> guides;
|
||||
|
||||
public User(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.sql.CallableStatement;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -32,20 +33,20 @@ public abstract class AbstractSplitListTypeHandler<O> extends BaseTypeHandler<Li
|
|||
public List<O> getNullableResult(ResultSet rs, String columnName)
|
||||
throws SQLException {
|
||||
String data = rs.getString(columnName);
|
||||
return StringUtils.isBlank(data) ? Collections.emptyList() : parseToList(data, DELIMITER);
|
||||
return StringUtils.isBlank(data) ? new ArrayList<>() : parseToList(data, DELIMITER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<O> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String data = rs.getString(columnIndex);
|
||||
return StringUtils.isBlank(data) ? Collections.emptyList() : parseToList(data, DELIMITER);
|
||||
return StringUtils.isBlank(data) ? new ArrayList<>() : parseToList(data, DELIMITER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<O> getNullableResult(CallableStatement cs, int columnIndex)
|
||||
throws SQLException {
|
||||
String data = cs.getString(columnIndex);
|
||||
return StringUtils.isBlank(data) ? Collections.emptyList() : parseToList(data, DELIMITER);
|
||||
return StringUtils.isBlank(data) ? new ArrayList<>() : parseToList(data, DELIMITER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.ruoyi.common.mybatis.typehandler;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 2024/4/22
|
||||
*/
|
||||
|
@ -13,8 +13,9 @@ public class StringSplitListTypeHandler extends AbstractSplitListTypeHandler<Str
|
|||
/**
|
||||
* 转换为列表
|
||||
*
|
||||
* @param data
|
||||
* @param delimiter
|
||||
* @param data 要转换的字符串
|
||||
* @param delimiter 分隔符
|
||||
* @return 可修改的字符串列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> parseToList(String data, String delimiter) {
|
||||
|
@ -22,6 +23,7 @@ public class StringSplitListTypeHandler extends AbstractSplitListTypeHandler<Str
|
|||
return new ArrayList<>();
|
||||
}
|
||||
String[] split = data.split(delimiter);
|
||||
return Arrays.asList(split);
|
||||
// 使用ArrayList包装Arrays.asList的结果,确保返回的列表是可修改的
|
||||
return new ArrayList<>(Arrays.asList(split));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,10 +31,7 @@ public class AgreementServiceImpl implements AgreementService
|
|||
{
|
||||
@Autowired
|
||||
private AgreementMapper agreementMapper;
|
||||
@Autowired
|
||||
private AreaService areaService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
|
|
|
@ -146,4 +146,5 @@ public interface DeptService
|
|||
* 查询所有部门名称列表
|
||||
*/
|
||||
List<DeptNameVO> selectAllDeptNameList();
|
||||
|
||||
}
|
||||
|
|
|
@ -175,4 +175,5 @@ public interface UserMapper
|
|||
* 查询用户余额
|
||||
*/
|
||||
public BigDecimal selectSumOfBalance(UserQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="UserVO" id="SysUserResult" autoMapping="true">
|
||||
<id property="userId" column="user_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="guides" column="guides" typeHandler="com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler" />
|
||||
<association property="dept" javaType="Dept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" column="user_id" select="selectUserRoleByUserId"/>
|
||||
</resultMap>
|
||||
|
@ -67,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
u.withdraw_service_value,
|
||||
u.area_id,
|
||||
u.bonus_delay,
|
||||
u.guides,
|
||||
d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
|
@ -302,6 +304,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="withdrawServiceValue != null">withdraw_service_value,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="bonusDelay != null">bonus_delay,</if>
|
||||
<if test="guides != null">guides,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
|
@ -327,6 +330,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="withdrawServiceValue != null">#{withdrawServiceValue},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="bonusDelay != null">#{bonusDelay},</if>
|
||||
<if test="guides != null">#{guides,typeHandler=com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
@ -358,6 +362,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="withdrawServiceValue != null">withdraw_service_value = #{withdrawServiceValue},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="bonusDelay != null">bonus_delay = #{bonusDelay},</if>
|
||||
<if test="guides != null">guides = #{guides,typeHandler=com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
|
|
|
@ -279,4 +279,9 @@ public interface UserService
|
|||
* 更新用户实名信息
|
||||
*/
|
||||
int updateUserRealName(RealName data);
|
||||
|
||||
/**
|
||||
* 已读导览
|
||||
*/
|
||||
public int readGuide(Long userId, String key);
|
||||
}
|
||||
|
|
|
@ -10,16 +10,12 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.validation.Validator;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bst.app.service.impl.AppConverterImpl;
|
||||
import com.ruoyi.bst.app.service.impl.AppServiceImpl;
|
||||
import com.ruoyi.bst.balanceLog.domain.BalanceLog;
|
||||
import com.ruoyi.bst.balanceLog.domain.enums.BalanceLogBstType;
|
||||
import com.ruoyi.bst.balanceLog.service.BalanceLogService;
|
||||
|
@ -66,11 +62,6 @@ import com.ruoyi.system.userRole.mapper.UserRoleMapper;
|
|||
public class UserServiceImpl implements UserService
|
||||
{
|
||||
|
||||
private final AppServiceImpl appServiceImpl;
|
||||
|
||||
private final AppConverterImpl appConverterImpl;
|
||||
private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
|
@ -119,12 +110,6 @@ public class UserServiceImpl implements UserService
|
|||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
UserServiceImpl(AppConverterImpl appConverterImpl, AppServiceImpl appServiceImpl) {
|
||||
this.appConverterImpl = appConverterImpl;
|
||||
this.appServiceImpl = appServiceImpl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
@ -871,4 +856,26 @@ public class UserServiceImpl implements UserService
|
|||
data.setIsReal(true);
|
||||
return userMapper.updateUser(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readGuide(Long userId, String key) {
|
||||
if (userId == null || StringUtils.isBlank(key)) {
|
||||
return 0;
|
||||
}
|
||||
UserVO user = this.selectUserById(userId);
|
||||
if (user == null ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
List<String> guides = user.getGuides();
|
||||
if (guides == null) {
|
||||
guides = new ArrayList<>();
|
||||
}
|
||||
guides.add(key);
|
||||
|
||||
User data = new User();
|
||||
data.setUserId(userId);
|
||||
data.setGuides(guides);
|
||||
return userMapper.updateUser(data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
@ -272,4 +273,15 @@ public class SysUserController extends BaseController
|
|||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 已读导览
|
||||
*/
|
||||
@PutMapping("/guide")
|
||||
@Anonymous
|
||||
public AjaxResult guide(String key)
|
||||
{
|
||||
return success(userService.readGuide(getUserId(), key));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user