【积分银行】积分
This commit is contained in:
+97
@@ -0,0 +1,97 @@
|
||||
package com.renkang.bank.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.renkang.bank.model.dto.PointsRulePageDTO;
|
||||
import com.renkang.bank.model.po.PointsRule;
|
||||
import com.renkang.bank.service.IPointsRuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author pj
|
||||
* @version 1.0
|
||||
* @description: 积分规则
|
||||
* @date 2026/2/5 17:53
|
||||
*/
|
||||
@Tag(name = "积分规则")
|
||||
@RestController
|
||||
@RequestMapping("/bank/pointsRule")
|
||||
public class PointsRuleController extends JeecgController<PointsRule, IPointsRuleService> {
|
||||
|
||||
@Autowired
|
||||
private IPointsRuleService iPointsRuleService;
|
||||
|
||||
@Operation(summary = "积分规则-分页列表", description = "积分规则-分页列表")
|
||||
// @RequiresPermissions("bank:points_rule:add")
|
||||
@PostMapping(value = "/pageList")
|
||||
public Result<IPage<PointsRule>> pageList(@RequestBody PointsRulePageDTO dto) {
|
||||
return Result.OK(iPointsRuleService.pageList(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "积分规则-添加", description = "积分规则-添加")
|
||||
// @RequiresPermissions("bank:points_rule:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Integer> add(@RequestBody PointsRule pointsRule) {
|
||||
return Result.OK("添加成功", iPointsRuleService.add(pointsRule));
|
||||
}
|
||||
|
||||
@Operation(summary = "积分规则-修改", description = "积分规则-修改")
|
||||
// @RequiresPermissions("bank:points_rule:edit")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<Integer> edit(@RequestBody PointsRule pointsRule) {
|
||||
return Result.OK("修改成功", iPointsRuleService.edit(pointsRule));
|
||||
}
|
||||
|
||||
@Operation(summary = "积分规则-修改状态", description = "积分规则-修改状态")
|
||||
// @RequiresPermissions("bank:points_rule:edit")
|
||||
@GetMapping(value = "/editStatus")
|
||||
public Result<Integer> editStatus(@RequestParam(name = "id") Long id, @RequestParam(name = "status") Integer status) {
|
||||
return Result.OK("修改成功", iPointsRuleService.editStatus(id, status));
|
||||
}
|
||||
|
||||
@Operation(summary = "积分规则-详情", description = "积分规则-详情")
|
||||
// @RequiresPermissions("bank:points_rule:byId")
|
||||
@GetMapping(value = "/byId")
|
||||
public Result<PointsRule> byId(@RequestParam(name = "id") String id) {
|
||||
return Result.OK(iPointsRuleService.byId(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "积分规则-删除", description = "积分规则-删除")
|
||||
// @RequiresPermissions("bank:points_rule:del")
|
||||
@GetMapping(value = "/delete")
|
||||
public Result<Integer> delete(@RequestParam(name = "id") String id) {
|
||||
return Result.OK("删除成功", iPointsRuleService.delete(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "积分规则-批量删除", description = "积分规则-批量删除")
|
||||
// @RequiresPermissions("bank:points_rule:del")
|
||||
@GetMapping(value = "/deleteBatch")
|
||||
public Result<Integer> deleteBatch(@RequestParam(name = "ids") String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return Result.error("请选择需要删除的积分规则");
|
||||
}
|
||||
return Result.OK("删除成功", iPointsRuleService.deleteBatch(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param conHealthInfo
|
||||
*/
|
||||
@Operation(summary = "积分规则-导出", description = "积分规则-导出")
|
||||
// @RequiresPermissions("bank:points_rule:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, PointsRule conHealthInfo) {
|
||||
return super.exportXls(request, conHealthInfo, PointsRule.class, "积分规则");
|
||||
}
|
||||
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.renkang.bank.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.renkang.bank.model.dto.UpdUserPointsDTO;
|
||||
import com.renkang.bank.model.dto.UserPointsPageDTO;
|
||||
import com.renkang.bank.model.dto.UserPointsRankingDTO;
|
||||
import com.renkang.bank.model.po.UserPointsDetails;
|
||||
import com.renkang.bank.model.vo.*;
|
||||
import com.renkang.bank.service.IUserPointsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pj
|
||||
* @version 1.0
|
||||
* @description: 用户积分汇总表
|
||||
* @date 2026/2/5 16:42
|
||||
*/
|
||||
@Tag(name = "用户积分信息")
|
||||
@RestController
|
||||
@RequestMapping("/bank/userPoints")
|
||||
public class UserPointsController {
|
||||
|
||||
@Autowired
|
||||
private IUserPointsService iUserPointsService;
|
||||
|
||||
@Operation(summary = "测试积分变更", description = "测试积分变更")
|
||||
@PostMapping(value = "/updateUserPoints")
|
||||
public Result<Boolean> updateUserPoints(@RequestBody UpdUserPointsDTO dto) {
|
||||
return Result.OK(iUserPointsService.updateUserPoints(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-分页列表", description = "用户积分信息-分页列表")
|
||||
@PostMapping(value = "/pageList")
|
||||
public Result<IPage<UserPointsListVO>> pageList(@RequestBody UserPointsPageDTO dto) {
|
||||
return Result.OK(iUserPointsService.pageList(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-积分明细", description = "用户积分信息-积分明细")
|
||||
@PostMapping(value = "/detailPageList")
|
||||
public Result<IPage<UserPointsDetails>> detailPageList(@RequestBody UserPointsPageDTO dto) {
|
||||
return Result.OK(iUserPointsService.detailPageList(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-扣除积分", description = "用户积分信息-扣除积分")
|
||||
@PostMapping(value = "/deductPoint")
|
||||
public Result<Boolean> deductPoint(@RequestBody UpdUserPointsDTO dto) {
|
||||
return Result.OK(iUserPointsService.deductPoint(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-员工打卡监测", description = "用户积分信息-员工打卡监测")
|
||||
@PostMapping(value = "/clockInMonitor")
|
||||
public Result<IPage<UserPointsMonitorVO>> clockInMonitor(@RequestBody UserPointsPageDTO dto) {
|
||||
return Result.OK(iUserPointsService.clockInMonitor(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-app我的积分", description = "用户积分信息-app我的积分")
|
||||
@GetMapping(value = "/app/myPoints")
|
||||
public Result<UserPointsInfoVO> myPoints() {
|
||||
return Result.OK(iUserPointsService.myPoints());
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-app积分任务", description = "用户积分信息-app积分任务")
|
||||
@GetMapping(value = "/app/pointsTaskList")
|
||||
public Result<List<UserPointsTaskVO>> pointsTaskList() {
|
||||
return Result.OK(iUserPointsService.pointsTaskList());
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-app积分打卡", description = "用户积分信息-app积分打卡")
|
||||
@PostMapping(value = "/app/pointCheckIn")
|
||||
public Result<Boolean> pointCheckIn(@RequestBody UpdUserPointsDTO dto) {
|
||||
return Result.OK(iUserPointsService.pointCheckIn(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-app积分明细", description = "用户积分信息-app积分明细")
|
||||
@PostMapping(value = "/app/pointRecord")
|
||||
public Result<IPage<UserPointRecordVO>> pointRecord(@RequestBody UserPointsPageDTO dto) {
|
||||
return Result.OK(iUserPointsService.pointRecord(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "用户积分信息-app积分榜单", description = "用户积分信息-app积分榜单")
|
||||
@PostMapping(value = "/app/pointRanking")
|
||||
public Result<IPage<UserPointRankingVO>> pointRanking(@RequestBody UserPointsRankingDTO dto) {
|
||||
return Result.OK(iUserPointsService.pointRanking(dto));
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.renkang.bank.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.renkang.bank.model.po.PointsRule;
|
||||
import com.renkang.bank.model.vo.UserPointsTaskVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PointsRuleMapper extends MPJBaseMapper<PointsRule> {
|
||||
|
||||
List<UserPointsTaskVO> pointsTaskList(@Param("userId") String userId);
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.renkang.bank.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.renkang.bank.model.po.UserPointsDetails;
|
||||
import com.renkang.bank.model.vo.UserPointRankingVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Mapper
|
||||
public interface UserPointsDetailsMapper extends MPJBaseMapper<UserPointsDetails> {
|
||||
|
||||
IPage<UserPointRankingVO> pointRanking(IPage<UserPointRankingVO> page, Date startTime, Date endTime, String secondOrgCode);
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.renkang.bank.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.renkang.bank.model.po.UserPoints;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author: pj
|
||||
* @description: 用户积分
|
||||
* @date 2026/2/5 16:47
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserPointsMapper extends MPJBaseMapper<UserPoints> {
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.renkang.bank.mapper.PointsRuleMapper">
|
||||
|
||||
<select id="pointsTaskList" resultType="com.renkang.bank.model.vo.UserPointsTaskVO">
|
||||
SELECT
|
||||
a.id as ruleId,
|
||||
a.frequency,
|
||||
a.rule_category,
|
||||
a.rule_desc,
|
||||
a.icon,
|
||||
a.points,
|
||||
CASE
|
||||
WHEN a.frequency = 1 THEN -- 单次
|
||||
IF(COUNT(b.id) > 0, 1, 0)
|
||||
WHEN a.frequency = 2 THEN -- 日/次
|
||||
IF(COUNT(CASE WHEN DATE(b.create_time) = CURDATE() THEN 1 END) > 0, 1, 0)
|
||||
WHEN a.frequency = 3 THEN -- 周/次
|
||||
IF(COUNT(CASE WHEN YEARWEEK(b.create_time, 1) = YEARWEEK(CURDATE(), 1) THEN 1 END) > 0, 1, 0)
|
||||
WHEN a.frequency = 4 THEN -- 月/次
|
||||
IF(COUNT(CASE WHEN DATE_FORMAT(b.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') THEN 1 END) > 0, 1, 0)
|
||||
WHEN a.frequency = 5 THEN -- 季度/次
|
||||
IF(COUNT(CASE WHEN QUARTER(b.create_time) = QUARTER(CURDATE()) AND YEAR(b.create_time) = YEAR(CURDATE()) THEN 1
|
||||
END) > 0, 1, 0)
|
||||
WHEN a.frequency = 6 THEN -- 年/次
|
||||
IF(COUNT(CASE WHEN YEAR(b.create_time) = YEAR(CURDATE()) THEN 1 END) > 0, 1, 0)
|
||||
ELSE 0
|
||||
END AS clockInStatus
|
||||
FROM
|
||||
bank_points_rule a
|
||||
LEFT JOIN bank_user_points_details b ON b.user_id = #{userId}
|
||||
AND b.change_type = 1
|
||||
AND b.business_id = a.id
|
||||
GROUP BY
|
||||
a.id,a.frequency
|
||||
order by a.frequency
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.renkang.bank.mapper.UserPointsDetailsMapper">
|
||||
|
||||
<select id="pointRanking" resultType="com.renkang.bank.model.vo.UserPointRankingVO">
|
||||
WITH UserPointsSummary AS (
|
||||
SELECT
|
||||
a.user_id,
|
||||
SUM( CASE WHEN a.change_type = 1 THEN a.points ELSE 0 END ) - SUM( CASE WHEN a.change_type = 2 THEN a.points
|
||||
ELSE 0 END ) AS pointSum
|
||||
FROM
|
||||
bank_user_points_details a
|
||||
INNER JOIN bank_user_points b ON a.user_id = b.user_id
|
||||
<if test="null != secondOrgCode and '' != secondOrgCode">
|
||||
AND b.org_code like concat(#{secondOrgCode},'%')
|
||||
</if>
|
||||
<where>
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND a.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
a.user_id
|
||||
) SELECT
|
||||
ROW_NUMBER() OVER ( ORDER BY pointSum DESC ) AS ranking,
|
||||
user_id,
|
||||
pointSum
|
||||
FROM
|
||||
UserPointsSummary
|
||||
ORDER BY
|
||||
pointSum DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.renkang.bank.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.renkang.bank.model.dto.PointsRulePageDTO;
|
||||
import com.renkang.bank.model.po.PointsRule;
|
||||
|
||||
public interface IPointsRuleService extends IService<PointsRule> {
|
||||
|
||||
IPage<PointsRule> pageList(PointsRulePageDTO dto);
|
||||
|
||||
int add(PointsRule pointsRule);
|
||||
|
||||
int edit(PointsRule pointsRule);
|
||||
|
||||
PointsRule byId(String id);
|
||||
|
||||
int delete(String id);
|
||||
|
||||
int editStatus(Long id, Integer status);
|
||||
|
||||
int deleteBatch(String ids);
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.renkang.bank.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.renkang.bank.model.dto.UpdUserPointsDTO;
|
||||
import com.renkang.bank.model.dto.UserPointsPageDTO;
|
||||
import com.renkang.bank.model.dto.UserPointsRankingDTO;
|
||||
import com.renkang.bank.model.po.UserPointsDetails;
|
||||
import com.renkang.bank.model.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IUserPointsService {
|
||||
|
||||
boolean updateUserPoints(UpdUserPointsDTO dto);
|
||||
|
||||
IPage<UserPointsListVO> pageList(UserPointsPageDTO dto);
|
||||
|
||||
IPage<UserPointsDetails> detailPageList(UserPointsPageDTO dto);
|
||||
|
||||
boolean deductPoint(UpdUserPointsDTO dto);
|
||||
|
||||
IPage<UserPointsMonitorVO> clockInMonitor(UserPointsPageDTO dto);
|
||||
|
||||
UserPointsInfoVO myPoints();
|
||||
|
||||
List<UserPointsTaskVO> pointsTaskList();
|
||||
|
||||
boolean pointCheckIn(UpdUserPointsDTO dto);
|
||||
|
||||
IPage<UserPointRecordVO> pointRecord(UserPointsPageDTO dto);
|
||||
|
||||
IPage<UserPointRankingVO> pointRanking(UserPointsRankingDTO dto);
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
package com.renkang.bank.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.renkang.bank.mapper.PointsRuleMapper;
|
||||
import com.renkang.bank.model.dto.PointsRulePageDTO;
|
||||
import com.renkang.bank.model.po.PointsRule;
|
||||
import com.renkang.bank.service.IPointsRuleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.global.GlobalUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author pj
|
||||
* @version 1.0
|
||||
* @description: 积分规则
|
||||
* @date 2026/2/5 18:01
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PointsRuleServiceImpl extends ServiceImpl<PointsRuleMapper, PointsRule> implements IPointsRuleService {
|
||||
|
||||
@Override
|
||||
public IPage<PointsRule> pageList(PointsRulePageDTO dto) {
|
||||
Page<PointsRule> page = new Page<>(dto.getPageNo(), dto.getPageSize());
|
||||
LambdaQueryWrapper<PointsRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotBlank(dto.getRuleDesc()), PointsRule::getRuleDesc, dto.getRuleDesc());
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(dto.getRuleCategory()), PointsRule::getRuleDesc, dto.getRuleCategory());
|
||||
queryWrapper.eq(ObjectUtil.isNotNull(dto.getStatus()), PointsRule::getRuleDesc, dto.getStatus());
|
||||
queryWrapper.orderByDesc(PointsRule::getCreateTime);
|
||||
return baseMapper.selectPage(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int add(PointsRule pointsRule) {
|
||||
String userId = GlobalUtils.getLoginUser().getId();
|
||||
Date date = new Date();
|
||||
pointsRule.setCreateUser(userId);
|
||||
pointsRule.setLastModifyDate(date);
|
||||
pointsRule.setCreateTime(date);
|
||||
return baseMapper.insert(pointsRule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int edit(PointsRule pointsRule) {
|
||||
pointsRule.setLastModifyDate(new Date());
|
||||
return baseMapper.updateById(pointsRule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointsRule byId(String id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(String id) {
|
||||
return baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int editStatus(Long id, Integer status) {
|
||||
return baseMapper.update(new LambdaUpdateWrapper<PointsRule>()
|
||||
.eq(PointsRule::getId, id)
|
||||
.set(PointsRule::getStatus, status)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids) {
|
||||
return baseMapper.deleteBatchIds(Arrays.asList(ids.split(",")));
|
||||
}
|
||||
}
|
||||
+452
@@ -0,0 +1,452 @@
|
||||
package com.renkang.bank.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
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;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.renkang.bank.constant.HealthBankConstants;
|
||||
import com.renkang.bank.enums.PointsSourceEnum;
|
||||
import com.renkang.bank.mapper.PointsRuleMapper;
|
||||
import com.renkang.bank.mapper.UserPointsDetailsMapper;
|
||||
import com.renkang.bank.mapper.UserPointsMapper;
|
||||
import com.renkang.bank.model.dto.UpdUserPointsDTO;
|
||||
import com.renkang.bank.model.dto.UserPointsPageDTO;
|
||||
import com.renkang.bank.model.dto.UserPointsRankingDTO;
|
||||
import com.renkang.bank.model.po.PointsRule;
|
||||
import com.renkang.bank.model.po.UserPoints;
|
||||
import com.renkang.bank.model.po.UserPointsDetails;
|
||||
import com.renkang.bank.model.vo.*;
|
||||
import com.renkang.bank.service.IUserPointsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.exception.ExceptionAssertsUtil;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.global.GlobalUtils;
|
||||
import org.jeecg.modules.manager.ISysCache;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author pj
|
||||
* @version 1.0
|
||||
* @description: 用户积分
|
||||
* @date 2026/2/5 16:49
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoints> implements IUserPointsService {
|
||||
|
||||
private final PointsRuleMapper pointsRuleMapper;
|
||||
private final UserPointsDetailsMapper userPointsDetailsMapper;
|
||||
private final ISysBaseAPI iSysBaseAPI;
|
||||
private final ISysCache sysCache;
|
||||
|
||||
@Override
|
||||
public IPage<UserPointsListVO> pageList(UserPointsPageDTO dto) {
|
||||
Page<UserPointsListVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
|
||||
MPJLambdaWrapper<UserPoints> queryWrapper = new MPJLambdaWrapper<>();
|
||||
if (StringUtils.isNotBlank(dto.getRealName()) || StringUtils.isNotBlank(dto.getWorkNo())) {
|
||||
//根据姓名和工号查询用户
|
||||
List<String> userIdList = iSysBaseAPI.getUserIdsByDepartAndUsername(null, dto.getRealName(), null, dto.getWorkNo());
|
||||
queryWrapper.in(!userIdList.isEmpty(), UserPoints::getUserId, userIdList);
|
||||
}
|
||||
// 动态排序
|
||||
if (StringUtils.isNotBlank(dto.getColumn())) {
|
||||
// 驼峰转下划线
|
||||
String column = StrUtil.toUnderlineCase(dto.getColumn());
|
||||
if ("asc".equalsIgnoreCase(dto.getOrder())) {
|
||||
queryWrapper.orderByAsc(column);
|
||||
} else {
|
||||
queryWrapper.orderByDesc(column);
|
||||
}
|
||||
} else {
|
||||
// 默认排序
|
||||
queryWrapper.orderByDesc(UserPoints::getLastAddDate);
|
||||
}
|
||||
if (StringUtils.isNotBlank(dto.getOrgCode())) {
|
||||
queryWrapper.likeRight(UserPoints::getOrgCode, dto.getOrgCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(dto.getDeptCode())) {
|
||||
queryWrapper.likeRight(UserPoints::getOrgCode, dto.getDeptCode());
|
||||
}
|
||||
Page<UserPointsListVO> voPage = baseMapper.selectJoinPage(page, UserPointsListVO.class, queryWrapper);
|
||||
List<String> userIds = voPage.getRecords().stream().map(UserPoints::getUserId).collect(Collectors.toList());
|
||||
if (!userIds.isEmpty()) {
|
||||
List<LoginUser> loginUsers = iSysBaseAPI.listUserByIdsNew(userIds);
|
||||
voPage.getRecords().forEach(vo -> {
|
||||
LoginUser loginUser = loginUsers.stream().filter(user -> user.getId().equals(vo.getUserId())).findFirst().orElse(null);
|
||||
if (loginUser != null) {
|
||||
vo.setRealName(loginUser.getRealname());
|
||||
vo.setWorkNo(loginUser.getWorkNo());
|
||||
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)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(vo.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
vo.setOrgName(thirdDepart.getDepartName());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return voPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UserPointsDetails> detailPageList(UserPointsPageDTO dto) {
|
||||
if (StringUtils.isBlank(dto.getUserId())) {
|
||||
ExceptionAssertsUtil.fail("用户id不能为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(dto.getChangeType())) {
|
||||
ExceptionAssertsUtil.fail("收支类型不能为空");
|
||||
}
|
||||
Page<UserPointsDetails> page = new Page<>(dto.getPageNo(), dto.getPageSize());
|
||||
LambdaQueryWrapper<UserPointsDetails> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(UserPointsDetails::getId, UserPointsDetails::getBusinessInfo,
|
||||
UserPointsDetails::getPoints, UserPointsDetails::getCreateTime, UserPointsDetails::getChangeType);
|
||||
queryWrapper.eq(UserPointsDetails::getUserId, dto.getUserId());
|
||||
queryWrapper.eq(UserPointsDetails::getChangeType, dto.getChangeType());
|
||||
queryWrapper.orderByDesc(UserPointsDetails::getCreateTime);
|
||||
return userPointsDetailsMapper.selectPage(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deductPoint(UpdUserPointsDTO dto) {
|
||||
dto.setSourceType(PointsSourceEnum.TYPE_2_VIOLATION.getSource());
|
||||
return updateUserPoints(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UserPointsMonitorVO> clockInMonitor(UserPointsPageDTO dto) {
|
||||
Page<UserPointsMonitorVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
|
||||
MPJLambdaWrapper<UserPointsDetails> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(UserPointsDetails.class);
|
||||
queryWrapper.select(PointsRule::getFrequency);
|
||||
queryWrapper.eq(UserPointsDetails::getChangeType, 1);
|
||||
if (StringUtils.isNotBlank(dto.getRealName()) || StringUtils.isNotBlank(dto.getWorkNo())) {
|
||||
//根据姓名和工号查询用户
|
||||
List<String> userIdList = iSysBaseAPI.getUserIdsByDepartAndUsername(null, dto.getRealName(), null, dto.getWorkNo());
|
||||
queryWrapper.in(!userIdList.isEmpty(), UserPoints::getUserId, userIdList);
|
||||
}
|
||||
// 动态排序
|
||||
|
||||
queryWrapper.orderByDesc(UserPointsDetails::getCreateTime);
|
||||
if (StringUtils.isNotBlank(dto.getOrgCode())) {
|
||||
queryWrapper.likeRight(UserPoints::getOrgCode, dto.getOrgCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(dto.getDeptCode())) {
|
||||
queryWrapper.likeRight(UserPoints::getOrgCode, dto.getDeptCode());
|
||||
}
|
||||
queryWrapper.leftJoin(PointsRule.class, PointsRule::getId, UserPointsDetails::getBusinessId);
|
||||
Page<UserPointsMonitorVO> voPage = userPointsDetailsMapper.selectJoinPage(page, UserPointsMonitorVO.class, queryWrapper);
|
||||
List<String> userIds = voPage.getRecords().stream().map(UserPointsMonitorVO::getUserId).collect(Collectors.toList());
|
||||
if (!userIds.isEmpty()) {
|
||||
List<LoginUser> loginUsers = iSysBaseAPI.listUserByIdsNew(userIds);
|
||||
voPage.getRecords().forEach(vo -> {
|
||||
LoginUser loginUser = loginUsers.stream().filter(user -> user.getId().equals(vo.getUserId())).findFirst().orElse(null);
|
||||
if (loginUser != null) {
|
||||
vo.setRealName(loginUser.getRealname());
|
||||
vo.setWorkNo(loginUser.getWorkNo());
|
||||
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)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
vo.setOrgName(thirdDepart.getDepartName());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return voPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户积分
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateUserPoints(UpdUserPointsDTO dto) {
|
||||
LoginUser loginUser = GlobalUtils.getLoginUser();
|
||||
log.info("------用户:{}({})开始更新积分,入参:{}------", loginUser.getRealname(), loginUser.getUsername(), dto);
|
||||
PointsSourceEnum sourceEnum = PointsSourceEnum.getBySource(dto.getSourceType());
|
||||
if (sourceEnum == null) {
|
||||
log.error("积分类型不存在");
|
||||
ExceptionAssertsUtil.fail("积分类型不存在");
|
||||
}
|
||||
String userId;
|
||||
if (dto.getSourceType().equals(PointsSourceEnum.TYPE_2_VIOLATION.getSource())) {
|
||||
if (StringUtils.isBlank(dto.getUserId())) {
|
||||
log.error("扣减用户id不能为空");
|
||||
ExceptionAssertsUtil.fail("扣减用户id不能为空");
|
||||
}
|
||||
//违规扣除
|
||||
userId = dto.getUserId();
|
||||
} else {
|
||||
userId = GlobalUtils.getLoginUser().getId();
|
||||
}
|
||||
UserPoints userPoints = baseMapper.selectOne(new LambdaQueryWrapper<UserPoints>()
|
||||
.eq(UserPoints::getUserId, userId)
|
||||
);
|
||||
boolean isAdd = false;
|
||||
Date date = new Date();
|
||||
UserPointsDetails userPointsDetails = new UserPointsDetails();
|
||||
if (userPoints == null) {
|
||||
isAdd = true;
|
||||
userPoints = new UserPoints();
|
||||
userPoints.setUserId(userId);
|
||||
userPoints.setOrgCode(loginUser.getOrgCode());
|
||||
userPoints.setCreateTime(date);
|
||||
userPointsDetails.setBeforePoints(new BigDecimal(0));
|
||||
} else {
|
||||
userPointsDetails.setBeforePoints(userPoints.getPoints());
|
||||
}
|
||||
userPointsDetails.setUserId(userId);
|
||||
switch (sourceEnum) {
|
||||
case TYPE_1_SURVEY:
|
||||
// 积分打卡
|
||||
PointsRule pointsRule = pointsRuleMapper.selectById(dto.getBusinessId());
|
||||
if (pointsRule == null) {
|
||||
log.error("积分规则不存在");
|
||||
ExceptionAssertsUtil.fail("积分规则不存在");
|
||||
}
|
||||
checkUserPoints(pointsRule, userId);
|
||||
userPointsDetails.setPoints(pointsRule.getPoints());
|
||||
userPointsDetails.setChangeType(HealthBankConstants.CHANGE_TYPE_ADD);
|
||||
userPointsDetails.setSource(sourceEnum.getSource());
|
||||
userPointsDetails.setBusinessId(dto.getBusinessId());
|
||||
userPointsDetails.setBusinessInfo(pointsRule.getRuleDesc());
|
||||
userPointsDetails.setOperatorId(userId);
|
||||
if (StringUtils.isNotBlank(dto.getRemark())) {
|
||||
userPointsDetails.setRemark(dto.getRemark());
|
||||
}
|
||||
if (isAdd) {
|
||||
userPoints.setPoints(pointsRule.getPoints());
|
||||
userPoints.setAddPointsSum(userPoints.getPoints());
|
||||
userPoints.setDeductPointsSum(BigDecimal.valueOf(0));
|
||||
userPoints.setLatestAddDaySum(userPoints.getPoints());
|
||||
userPoints.setLatestDeductDaySum(BigDecimal.valueOf(0));
|
||||
userPoints.setLastAddDate(date);
|
||||
} else {
|
||||
userPoints.setPoints(userPoints.getPoints().add(pointsRule.getPoints()));
|
||||
userPoints.setAddPointsSum(userPoints.getAddPointsSum().add(pointsRule.getPoints()));
|
||||
List<UserPointsDetails> details = userPointsDetailsMapper.selectList(new LambdaQueryWrapper<UserPointsDetails>()
|
||||
.eq(UserPointsDetails::getUserId, userId)
|
||||
.eq(UserPointsDetails::getChangeType, HealthBankConstants.CHANGE_TYPE_ADD)
|
||||
.apply("DATE_FORMAT(create_time, '%Y-%m-%d') = '" + DateUtil.today() + "'")
|
||||
);
|
||||
double sum = details.stream().map(UserPointsDetails::getPoints).mapToDouble(BigDecimal::doubleValue).sum();
|
||||
userPoints.setLatestAddDaySum(new BigDecimal(sum).add(pointsRule.getPoints()));
|
||||
}
|
||||
break;
|
||||
case TYPE_2_USE:
|
||||
// 礼品兑换
|
||||
userPoints.setLastDeductDate(date);
|
||||
break;
|
||||
case TYPE_2_VIOLATION:
|
||||
// 违规扣除
|
||||
if (isAdd) {
|
||||
ExceptionAssertsUtil.fail("用户积分不存在");
|
||||
}
|
||||
userPoints.setDeductPointsSum(userPoints.getDeductPointsSum().add(dto.getPoints()));
|
||||
userPoints.setPoints(userPoints.getPoints().subtract(dto.getPoints()));
|
||||
userPointsDetails.setPoints(dto.getPoints());
|
||||
userPointsDetails.setRemark(dto.getRemark());
|
||||
userPointsDetails.setSource(sourceEnum.getSource());
|
||||
userPointsDetails.setChangeType(HealthBankConstants.CHANGE_TYPE_DEDUCT);
|
||||
userPointsDetails.setOperatorId(GlobalUtils.getLoginUser().getId());
|
||||
break;
|
||||
case TYPE_2_EXPIRED:
|
||||
// 过期清除
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
userPointsDetails.setCreateTime(date);
|
||||
userPointsDetails.setAfterPoints(userPoints.getPoints());
|
||||
userPoints.setLastVaryDate(date);
|
||||
boolean b = this.saveOrUpdate(userPoints);
|
||||
if (b) {
|
||||
b = userPointsDetailsMapper.insert(userPointsDetails) > 0;
|
||||
}
|
||||
log.info("======用户:{}({})更新积分结果:{}======", loginUser.getRealname(), loginUser.getUsername(), b);
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户积分
|
||||
*
|
||||
* @param pointsRule 积分规则
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
public void checkUserPoints(PointsRule pointsRule, String userId) {
|
||||
LambdaQueryWrapper<UserPointsDetails> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserPointsDetails::getUserId, userId);
|
||||
wrapper.eq(UserPointsDetails::getBusinessId, pointsRule.getId());
|
||||
Long c;
|
||||
Date date = new Date();
|
||||
switch (pointsRule.getFrequency()) {
|
||||
// 单次:检查用户是否已经获得过该积分
|
||||
case 1:
|
||||
break;
|
||||
// 日/次:检查用户当天是否已经获得过该积分
|
||||
case 2:
|
||||
DateTime startOfDay = DateUtil.beginOfDay(date);
|
||||
DateTime endOfDay = DateUtil.endOfDay(date);
|
||||
wrapper.between(UserPointsDetails::getCreateTime, startOfDay, endOfDay);
|
||||
c = userPointsDetailsMapper.selectCount(wrapper);
|
||||
if (c > 0) {
|
||||
ExceptionAssertsUtil.fail("本日已获得该积分");
|
||||
}
|
||||
break;
|
||||
// 周/次:检查用户本周是否已经获得过该积分
|
||||
case 3:
|
||||
DateTime startOfWeek = DateUtil.beginOfWeek(date);
|
||||
DateTime endOfWeek = DateUtil.endOfWeek(date);
|
||||
wrapper.between(UserPointsDetails::getCreateTime, startOfWeek, endOfWeek);
|
||||
c = userPointsDetailsMapper.selectCount(wrapper);
|
||||
if (c > 0) {
|
||||
ExceptionAssertsUtil.fail("本周已获得该积分");
|
||||
}
|
||||
break;
|
||||
// 月/次:检查用户本月是否已经获得过该积分
|
||||
case 4:
|
||||
DateTime startOfMonth = DateUtil.beginOfMonth(date);
|
||||
DateTime endOfMonth = DateUtil.endOfMonth(date);
|
||||
wrapper.between(UserPointsDetails::getCreateTime, startOfMonth, endOfMonth);
|
||||
c = userPointsDetailsMapper.selectCount(wrapper);
|
||||
if (c > 0) {
|
||||
ExceptionAssertsUtil.fail("本月已获得该积分");
|
||||
}
|
||||
break;
|
||||
// 季度/次:检查用户本季度是否已经获得过该积分
|
||||
case 5:
|
||||
DateTime startOfQuarter = DateUtil.beginOfQuarter(date);
|
||||
DateTime endOfQuarter = DateUtil.endOfQuarter(date);
|
||||
wrapper.between(UserPointsDetails::getCreateTime, startOfQuarter, endOfQuarter);
|
||||
c = userPointsDetailsMapper.selectCount(wrapper);
|
||||
if (c > 0) {
|
||||
ExceptionAssertsUtil.fail("本季度已获得该积分");
|
||||
}
|
||||
break;
|
||||
// 年/次:检查用户本年度是否已经获得过该积分
|
||||
case 6:
|
||||
DateTime startOfYear = DateUtil.beginOfYear(date);
|
||||
DateTime endOfYear = DateUtil.endOfYear(date);
|
||||
wrapper.between(UserPointsDetails::getCreateTime, startOfYear, endOfYear);
|
||||
c = userPointsDetailsMapper.selectCount(wrapper);
|
||||
if (c > 0) {
|
||||
ExceptionAssertsUtil.fail("本年度已获得该积分");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// 未知规则类型,默认不处理
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPointsInfoVO myPoints() {
|
||||
String userId = GlobalUtils.getLoginUser().getId();
|
||||
UserPoints userPoints = baseMapper.selectOne(new LambdaQueryWrapper<UserPoints>()
|
||||
.eq(UserPoints::getUserId, userId)
|
||||
);
|
||||
UserPointsInfoVO vo = new UserPointsInfoVO();
|
||||
if (userPoints != null) {
|
||||
vo.setPoints(userPoints.getPoints());
|
||||
vo.setAddPointsSum(userPoints.getAddPointsSum());
|
||||
vo.setExchangePointsSum(userPoints.getExchangePointsSum());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserPointsTaskVO> pointsTaskList() {
|
||||
String userId = GlobalUtils.getLoginUser().getId();
|
||||
return pointsRuleMapper.pointsTaskList(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pointCheckIn(UpdUserPointsDTO dto) {
|
||||
dto.setSourceType(PointsSourceEnum.TYPE_1_SURVEY.getSource());
|
||||
return updateUserPoints(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UserPointRecordVO> pointRecord(UserPointsPageDTO dto) {
|
||||
if (ObjectUtil.isNull(dto.getChangeType())) {
|
||||
ExceptionAssertsUtil.fail("收支类型不能为空");
|
||||
}
|
||||
String userId = GlobalUtils.getLoginUser().getId();
|
||||
Page<UserPointRecordVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
|
||||
MPJLambdaWrapper<UserPointsDetails> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.eq(UserPointsDetails::getUserId, userId);
|
||||
wrapper.eq(UserPointsDetails::getChangeType, dto.getChangeType());
|
||||
wrapper.orderByDesc(UserPointsDetails::getCreateTime);
|
||||
return userPointsDetailsMapper.selectJoinPage(page, UserPointRecordVO.class, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UserPointRankingVO> pointRanking(UserPointsRankingDTO dto) {
|
||||
String orgCode = GlobalUtils.getLoginUser().getOrgCode();
|
||||
String secondOrgCode = GlobalUtils.getSecondDepartOrgCode(orgCode);
|
||||
Page<UserPointRankingVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
|
||||
Date startTime = null;
|
||||
Date endTime = null;
|
||||
Date now = new Date();
|
||||
if (StringUtils.isNotBlank(dto.getRankType())) {
|
||||
if ("1".equals(dto.getRankType())) {
|
||||
// 获取本周的开始时间(周一)
|
||||
startTime = DateUtil.beginOfWeek(now, true);
|
||||
// 获取本周的结束时间(周日)
|
||||
endTime = DateUtil.endOfWeek(now, true);
|
||||
} else if ("2".equals(dto.getRankType())) {
|
||||
// 获取本月的开始时间
|
||||
startTime = DateUtil.beginOfMonth(now);
|
||||
// 获取本月的结束时间
|
||||
endTime = DateUtil.endOfMonth(now);
|
||||
}
|
||||
}
|
||||
IPage<UserPointRankingVO> voiPage = userPointsDetailsMapper.pointRanking(page, startTime, endTime, secondOrgCode);
|
||||
List<String> userIds = voiPage.getRecords().stream().map(UserPointRankingVO::getUserId).collect(Collectors.toList());
|
||||
List<LoginUser> loginUsers = iSysBaseAPI.listUserByIdsNew(userIds);
|
||||
voiPage.getRecords().forEach(vo -> {
|
||||
loginUsers.forEach(loginUser -> {
|
||||
if (vo.getUserId().equals(loginUser.getId())) {
|
||||
vo.setRealName(loginUser.getRealname());
|
||||
vo.setAvatar(loginUser.getAvatar());
|
||||
vo.setSex(loginUser.getSex());
|
||||
SysDepart secondDepart = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(secondDepart)) {
|
||||
vo.setDeptName(secondDepart.getDepartName());
|
||||
}
|
||||
SysDepart thirdDepart = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(loginUser.getOrgCode()));
|
||||
if (ObjUtil.isNotEmpty(thirdDepart)) {
|
||||
vo.setOrgName(thirdDepart.getDepartName());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return voiPage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user