Compare commits

...

84 Commits

Author SHA1 Message Date
wangxy 11667d7a94 feat:修改是否允许账户多终端同时登录
4 months ago
wangxy a75988ff23 feat:修改是否允许账户多终端同时登录
10 months ago
wangxy 7601783018 feat:mybatisPlus增强
11 months ago
wangxy a500900a89 feat:mybatisPlus增强
11 months ago
wangxy 74b3e88c32 feat:文件上传校验
11 months ago
wangxy 3a541458ca feat:单元测试类集成
11 months ago
wangxy 6fffe167fe feat:sonarlint代码扫描规范性修改修改
11 months ago
wangxy be765dda3c fix:代码坏味道修改
11 months ago
wangxy 6b0a027bed fix:代码坏味道修改
11 months ago
wangxy 4a4bb437eb fix:代码坏味道修改
11 months ago
wangxy 85c8218384 fix:登录实现密码加密传输
11 months ago
wangxy 4db10d2a52 fix:登录实现滑块
11 months ago
wangxy 7b38348144 fix:登录实现滑块
11 months ago
wangxy b1d10b5cf4 fix:公告查询接口开发
11 months ago
wangxy b7c2c1f447 fix:公告查询接口开发
11 months ago
wangxy 1cd05b8285 fix:公告查询接口开发
11 months ago
wangxy 19069e7901 fix:公告查询接口开发
11 months ago
wangxy cf4c8aac93 fix:公告查询接口开发
11 months ago
wangxy 60db10f47e fix:文件上传校验接口开发
11 months ago
wangxy 161750b1c0 fix:平均分接口开发
11 months ago
wangxy 5159b6c264 fix:平均分接口开发
12 months ago
wangxy 63305048e1 fix:平均分接口开发
12 months ago
wangxy ec33c1bd7b fix:平均分接口开发
12 months ago
wangxy 36d7fd9570 fix:平均分接口开发
12 months ago
wangxy b80d83cd8f fix:评分列表接口重构
12 months ago
wangxy 6790427619 fix:添加用户id
12 months ago
wangxy 1c550a1acb fix:添加用户id
12 months ago
wangxy c7abb39cdb fix:添加用户id
12 months ago
wangxy 1094c9f25f fix:添加用户id
12 months ago
wangxy 429c0c0841 fix:添加用户id
12 months ago
wangxy 1bf4568242 fix:添加用户id
12 months ago
wangxy 16a5068fa3 fix:文件下载
12 months ago
wangxy 5462de7913 fix:文件下载
12 months ago
wangxy 302cfbd79e fix:参数类型查询权限
12 months ago
wangxy 7ba1e8dea5 fix:参数类型查询权限
12 months ago
wangxy b380d7860e fix:参数类型查询权限
12 months ago
wangxy c5f2ad6a04 fix:参数类型查询权限
12 months ago
wangxy 06343de2e0 fix:参数类型查询权限
12 months ago
wangxy cf02e3fae6 fix:参数类型查询权限
12 months ago
wangxy e55718fc35 fix:参数类型查询权限
12 months ago
wangxy 4b3cff7fa3 fix:参数类型查询权限
12 months ago
wangxy 16e3901490 fix:参数类型查询权限
12 months ago
wangxy a678a07d60 fix:参数类型查询权限
12 months ago
wangxy b42bc3287e fix:评分提交
12 months ago
wangxy e7c37e268b fix:评分提交
12 months ago
wangxy 2a69514f3c fix:评分提交
12 months ago
wangxy bff66bb474 fix:评分提交
12 months ago
wangxy 00294d9397 fix:审核列表查询
12 months ago
wangxy d79afeb92f fix:审核列表查询
12 months ago
wangxy e42d7f066a fix:审核列表查询
12 months ago
wangxy a183def797 fix:审核列表查询
12 months ago
wangxy d38fcc2e67 fix:多材料校验提交
12 months ago
wangxy 62ee0c0518 fix:多材料校验提交
12 months ago
wangxy 00be845212 fix:多材料校验提交
12 months ago
wangxy 12ccac7031 fix:多材料校验提交
12 months ago
wangxy 38f2af6906 fix:多材料校验提交
12 months ago
wangxy 7291e1bf54 fix:材料校验提交
12 months ago
wangxy 58567b69e0 fix:材料校验提交
12 months ago
wangxy 44ae25719f fix:材料校验提交
12 months ago
wangxy e119a53554 fix:材料校验提交
12 months ago
wangxy 16d991dfc5 fix:材料校验提交
12 months ago
wangxy cc9be8dabc fix:材料校验提交
12 months ago
wangxy ddff2f4308 fix:材料校验提交
12 months ago
wangxy 3ce787aa67 fix:材料校验提交
12 months ago
wangxy e25564aea2 fix:材料校验提交
12 months ago
wangxy 98b556816e fix:材料校验提交
12 months ago
wangxy 077fe62e57 fix:材料校验提交
12 months ago
wangxy 18c28a8974 fix:奖项评分提交
12 months ago
wangxy 49c8857de1 fix:奖项评分提交
12 months ago
wangxy 3a6a80347b fix:奖项评分提交
12 months ago
wangxy e38f89f066 fix:奖项类型退回提交
12 months ago
wangxy d82138925d fix:奖项类型退回提交
12 months ago
wangxy 15f5b26d3b fix:奖项类型退回提交
12 months ago
wangxy 7cf9595bb2 fix:奖项类型申请提交
12 months ago
wangxy 052fa1655c fix:奖项类型枚举提交
12 months ago
wangxy 8ece7d658c fix:生成applyId方法
12 months ago
wangxy c54adee9b7 fix:生成applyId方法
12 months ago
wangxy fe82bfde7b fix:申请表
12 months ago
wangxy 2846bcdbb1 feat:测试
12 months ago
wangxy ef89c82b91 feat:测试
12 months ago
wangxy a870471cbf fix:用户注册绑定添加事务
12 months ago
wangxy f7acbe966e fix:用户注册绑定角色权限
12 months ago
wangxy 5337945ac4 代码提交
1 year ago
wangxy 4dd019efef 代码提交
1 year ago

@ -68,6 +68,14 @@
<version>2.1.0</version>
</dependency>
<!--单元测试-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>

@ -1,94 +0,0 @@
package com.hyp.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.hyp.common.config.HypConfig;
import com.hyp.common.constant.CacheConstants;
import com.hyp.common.constant.Constants;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.core.redis.RedisCache;
import com.hyp.common.utils.sign.Base64;
import com.hyp.common.utils.uuid.IdUtils;
import com.hyp.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
*
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = HypConfig.getCaptchaType();
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

@ -0,0 +1,35 @@
package com.hyp.web.controller.common;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* packageName com.hyp.web.controller.common
*
* @author wangxy
* @version JDK 8
* @className CaptchaEnabledController
* @date 2024/4/28
* @description B
*/
@RestController
public class CaptchaEnabledController {
@Autowired
private ISysConfigService configService;
/**
*
*/
@GetMapping("/captchaEnabled")
public AjaxResult captchaEnabled() {
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
return ajax;
}
}

@ -44,12 +44,9 @@ public class CommonController
* @param delete
*/
@GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.checkAllowDownload(fileName))
{
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
try {
if (!FileUtils.checkAllowDownload(fileName)) {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
@ -58,13 +55,10 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
if (delete) {
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
@ -73,10 +67,8 @@ public class CommonController
*
*/
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
public AjaxResult uploadFile(MultipartFile file) throws Exception {
try {
// 上传文件路径
String filePath = HypConfig.getUploadPath();
// 上传并返回新文件名称
@ -88,9 +80,7 @@ public class CommonController
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
}
catch (Exception e)
{
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@ -99,18 +89,15 @@ public class CommonController
*
*/
@PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
{
try
{
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
try {
// 上传文件路径
String filePath = HypConfig.getUploadPath();
List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = new ArrayList<String>();
for (MultipartFile file : files)
{
for (MultipartFile file : files) {
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
@ -125,9 +112,7 @@ public class CommonController
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax;
}
catch (Exception e)
{
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@ -137,12 +122,9 @@ public class CommonController
*/
@GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throws Exception {
try {
if (!FileUtils.checkAllowDownload(resource)) {
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
@ -154,9 +136,7 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
} catch (Exception e) {
log.error("下载文件失败", e);
}
}

@ -0,0 +1,242 @@
package com.hyp.web.controller.manager;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.core.domain.entity.SysDictData;
import com.hyp.common.core.domain.entity.SysUser;
import com.hyp.common.core.domain.model.LoginUser;
import com.hyp.common.enums.ApplyStatusEnum;
import com.hyp.common.exception.ServiceException;
import com.hyp.common.utils.SecurityUtils;
import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.RewFileRelation;
import com.hyp.system.domain.RewScoreInfo;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.dto.ApplyInfoListSaveDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.system.domain.vo.FileRelationVO;
import com.hyp.system.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* packageName com.hyp.web.controller.manager
*
* @author wangxy
* @version JDK 8
* @className RewApplyInfoListManager
* @date 2024/4/11
* @description
*/
@Component
public class ApplyInfoListManager {
@Resource
private RewApplyInfoListService applyInfoListService;
@Resource
private RewScoreInfoService scoreInfoService;
@Resource
private ISysDictDataService dictDataService;
@Resource
private RewFileRelationService relationService;
@Resource
private ISysDictTypeService dictTypeService;
/**
*
*
* @param null
* @return
*/
private static final String REW_APPLY_TYPE = "rew_apply_type";
public List<ApplyInfoListVO> selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO){
if (!SysUser.isAdmin(SecurityUtils.getUserId())){
applyInfoListDTO.setCreateId(SecurityUtils.getUserId());
}
return applyInfoListService.selectApplyInfoList(applyInfoListDTO);
}
public List<ApplyInfoListVO> selectAduitInfoList(ApplyInfoListDTO applyInfoListDTO){
return applyInfoListService.selectApplyInfoList(applyInfoListDTO);
}
public List<ApplyInfoListVO> selectScoreInfoList(ApplyInfoListDTO applyInfoListDTO){
List<ApplyInfoListVO> applyInfoListVOS = applyInfoListService.selectApplyInfoList(applyInfoListDTO);
applyInfoListVOS.forEach(applyInfoListVO -> {
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
Integer count = scoreInfoService.lambdaQuery()
.eq(RewScoreInfo::getApplyId, applyInfoListVO.getApplyId())
.eq(RewScoreInfo::getCreateId, SecurityUtils.getUserId()).count();
if (count > 0) {
applyInfoListVO.setScoreStatus(1);
}
} else if (SysUser.isAdmin(SecurityUtils.getUserId())) {
Integer count = scoreInfoService.lambdaQuery()
.eq(RewScoreInfo::getApplyId, applyInfoListVO.getApplyId()).count();
if (count > 0) {
applyInfoListVO.setScoreStatus(1);
}
}
});
return applyInfoListVOS;
}
/**
*
* applyId
* @param applyType
* @return com.hyp.system.domain.vo.ApplyInfoListVO
*/
@Transactional(rollbackFor = Exception.class)
public ApplyInfoListVO getApplyId(String applyType){
LoginUser loginUser = SecurityUtils.getLoginUser();
List<RewApplyInfoList> list = applyInfoListService.lambdaQuery()
.eq(RewApplyInfoList::getApplyType, applyType)
.eq(RewApplyInfoList::getCreateId, loginUser.getUserId())
.ne(RewApplyInfoList::getApplyStatus,ApplyStatusEnum.END.getType())
.list();
if(CollUtil.isNotEmpty(list)){
throw new ServiceException("该用户已申请,不能重复申请!");
}
RewApplyInfoList applyInfoList = new RewApplyInfoList();
applyInfoList.setApplyType(applyType);
String name = dictDataService.selectDictLabel(REW_APPLY_TYPE, applyType);
if(StringUtils.isNotBlank(name)){
applyInfoList.setApplyName(name);
}
applyInfoList.setApplyStatus(ApplyStatusEnum.SAVE.getType());
applyInfoList.setCreateId(loginUser.getUserId());
applyInfoList.setCreateBy(loginUser.getUsername());
applyInfoList.setUpdateTime(new Date());
applyInfoList.setCreateTime(new Date());
applyInfoListService.save(applyInfoList);
return Convert.convert(ApplyInfoListVO.class, applyInfoList);
}
/**
*
*
* @param applyInfoListSaveDTO
* @return boolean
*/
@Transactional(rollbackFor = Exception.class)
public boolean submit(ApplyInfoListSaveDTO applyInfoListSaveDTO){
LoginUser loginUser = SecurityUtils.getLoginUser();
RewApplyInfoList applyInfoList = applyInfoListService.getById(applyInfoListSaveDTO.getApplyId());
if(Objects.nonNull(applyInfoList)){
applyInfoList.setAppTime(new Date());
applyInfoList.setUpdateBy(loginUser.getUsername());
applyInfoList.setIsReward(applyInfoListSaveDTO.getIsReward());
applyInfoList.setApplyStatus(ApplyStatusEnum.SUBMIT.getType());
}
return applyInfoListService.saveOrUpdate(applyInfoList);
}
/**
*
*
* @param applyId
* @return boolean
*/
public boolean deleteById(String applyId){
relationService.lambdaUpdate()
.eq(RewFileRelation::getApplyId, applyId)
.remove();
return applyInfoListService.removeById(applyId);
}
/**
*
*
* @param applyId
* @return com.hyp.system.domain.vo.ApplyInfoListVO
*/
public ApplyInfoListVO detail(String applyId){
RewApplyInfoList applyInfoList = applyInfoListService.getById(applyId);
ApplyInfoListVO applyInfoListVO = Convert.convert(ApplyInfoListVO.class, applyInfoList);
List<RewFileRelation> list = relationService.lambdaQuery().eq(RewFileRelation::getApplyId, applyId).list();
List<FileRelationVO> fileRelationVOList = Convert.toList(FileRelationVO.class, list);
if(CollUtil.isNotEmpty(fileRelationVOList)){
applyInfoListVO.setFileRelationVOList(fileRelationVOList);
}
return applyInfoListVO;
}
/**
*
*
* @param applyId
* @return boolean
*/
public boolean approved(String applyId){
return applyInfoListService.lambdaUpdate()
.eq(RewApplyInfoList::getApplyId, applyId)
.set(RewApplyInfoList::getApplyStatus, ApplyStatusEnum.AUDIT.getType())
.set(RewApplyInfoList::getAuthTime, new Date())
.update();
}
/**
*
* 退
* @param applyId
* @param applyMsg
* @return boolean
*/
public boolean applyBack(String applyId,String applyMsg){
return applyInfoListService.lambdaUpdate()
.eq(RewApplyInfoList::getApplyId, applyId)
.set(RewApplyInfoList::getApplyStatus, ApplyStatusEnum.BACK.getType())
.set(Objects.nonNull(applyMsg), RewApplyInfoList::getApplyMsg, applyMsg)
.set(RewApplyInfoList::getAuthTime, new Date())
.update();
}
/**
*
*
* @param applyId
* @param applyType
* @return com.hyp.common.core.domain.AjaxResult
*/
public AjaxResult checkUploadFile(String applyId,String applyType){
List<SysDictData> list = dictTypeService.selectDictDataByType(applyType);
if(CollUtil.isNotEmpty(list)){
for(SysDictData sysDictData : list){
List<RewFileRelation> fileRelations = relationService.lambdaQuery()
.eq(RewFileRelation::getApplyId, applyId)
.eq(RewFileRelation::getFileCode, sysDictData.getDictValue()).list();
if(CollUtil.isEmpty(fileRelations)){
return AjaxResult.error("《"+sysDictData.getDictLabel()+"》"+"材料存在未上传情况,请检查");
}
}
}
return AjaxResult.success();
}
}

@ -0,0 +1,233 @@
package com.hyp.web.controller.manager;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hyp.common.config.HypConfig;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.exception.ServiceException;
import com.hyp.common.utils.file.FileUploadUtils;
import com.hyp.common.utils.file.FileUtils;
import com.hyp.framework.config.ServerConfig;
import com.hyp.system.domain.RewFileRelation;
import com.hyp.system.service.RewFileRelationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* packageName com.hyp.web.controller.manager
*
* @author wangxy
* @version JDK 8
* @className FileRelationManager
* @date 2024/4/12
* @description
*/
@Component
public class FileRelationManager {
@Resource
private RewFileRelationService fileRelationService;
@Resource
private ServerConfig serverConfig;
/**
*
*
*/
private static final Integer FILE_STATE_WTG = 2;
/**
*
*
* @return boolean
*/
public boolean delFile(String fileId){
RewFileRelation fileRelation = fileRelationService.getById(fileId);
if(Objects.isNull(fileRelation)){
throw new ServiceException("文件不存在");
}
FileUtil.del(fileRelation.getFilePath());
return fileRelationService.removeById(fileId);
}
/**
*
*
* @param applyId
* @param fileCode
* @param fileState
* @return boolean
*/
public boolean filePass( String applyId, String fileCode, Integer fileState){
return fileRelationService.lambdaUpdate()
.eq(RewFileRelation::getApplyId,applyId)
.eq(RewFileRelation::getFileCode,fileCode)
.set(RewFileRelation::getFileState,fileState)
.update();
}
/**
*
*
* @param fileId
* @param fileState
* @return boolean
*/
public boolean pass( String fileId, Integer fileState){
return fileRelationService.lambdaUpdate()
.eq(RewFileRelation::getFileId,fileId)
.set(RewFileRelation::getFileState,fileState)
.update();
}
/**
*
*
* @param applyId
* @return com.hyp.common.core.domain.AjaxResult
*/
public AjaxResult checkFile(String applyId){
List<RewFileRelation> list = fileRelationService.lambdaQuery()
.eq(RewFileRelation::getApplyId, applyId)
.list();
if(CollUtil.isNotEmpty(list)){
for(RewFileRelation rewFileRelation : list){
if(Objects.equals(rewFileRelation.getFileState(),FILE_STATE_WTG) || Objects.isNull(rewFileRelation.getFileState())){
return AjaxResult.error("材料存在未审核情况,请检查");
}
}
}
return AjaxResult.success();
}
/**
*
*
* @param applyId
* @param filename
* @param fileCode
* @param url
* @param originalFilename
* @return com.hyp.system.domain.RewFileRelation
*/
@Transactional(rollbackFor = Exception.class)
public RewFileRelation save(String applyId,String filename,String fileCode,String url,String originalFilename){
RewFileRelation rewFileRelation = new RewFileRelation();
rewFileRelation.setApplyId(applyId);
rewFileRelation.setFileName(filename);
rewFileRelation.setFileCode(fileCode);
rewFileRelation.setFilePath(url);
rewFileRelation.setRealName(originalFilename);
fileRelationService.save(rewFileRelation);
return rewFileRelation;
}
/**
*
*
* @param files
* @param applyId
* @param filename
* @param fileCode
* @return java.util.List<com.hyp.system.domain.RewFileRelation>
*/
@Transactional(rollbackFor = Exception.class)
public List<RewFileRelation> saveBatch(List<MultipartFile> files,
String applyId,
String filename,
String fileCode) throws IOException {
List<RewFileRelation> fileRelations = new ArrayList<>();
// 上传文件路径
String filePath = HypConfig.getUploadPath();
for (MultipartFile file : files) {
if (!file.isEmpty()) {
// 上传并返回新文件名称
String fileNames = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileNames;
if(StringUtils.isBlank(filename)){
filename = fileNames;
}
RewFileRelation rewFileRelation = new RewFileRelation();
rewFileRelation.setApplyId(applyId);
rewFileRelation.setFileName(filename);
rewFileRelation.setFileCode(fileCode);
rewFileRelation.setFilePath(url);
rewFileRelation.setRealName(FileUtils.getNameNotSuffix(file.getOriginalFilename()));
fileRelations.add(rewFileRelation);
}
}
fileRelationService.saveBatch(fileRelations);
return fileRelations;
}
/**
*
*
* @param fileId
* @return java.lang.String
*/
public String getFilePath(String fileId){
RewFileRelation fileRelation = fileRelationService.getById(fileId);
if(Objects.nonNull(fileRelation)){
return fileRelation.getFilePath();
}
return null;
}
/**
*
*
* @param fileId
* @return java.lang.String
*/
public String getRealName(String fileId){
RewFileRelation fileRelation = fileRelationService.getById(fileId);
if(Objects.nonNull(fileRelation)){
return fileRelation.getRealName();
}
return null;
}
/**
*
*
* @param applyId
* @param fileCode
* @return java.util.List<com.hyp.system.domain.RewFileRelation>
*/
public List<RewFileRelation> getFileInfo(String applyId,String fileCode){
LambdaQueryWrapper<RewFileRelation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RewFileRelation::getApplyId,applyId);
queryWrapper.eq(Objects.nonNull(fileCode), RewFileRelation::getFileCode, fileCode);
return fileRelationService.list(queryWrapper);
}
/**
*
*
* @return java.util.List<com.hyp.system.domain.RewFileRelation>
*/
public RewFileRelation getRewFileRelation(String fileId){
return fileRelationService.getById(fileId);
}
}

@ -0,0 +1,117 @@
package com.hyp.web.controller.manager;
import cn.hutool.core.convert.Convert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hyp.common.core.domain.entity.SysUser;
import com.hyp.common.core.domain.model.LoginUser;
import com.hyp.common.enums.ApplyStatusEnum;
import com.hyp.common.utils.SecurityUtils;
import com.hyp.common.utils.StringUtils;
import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.RewScoreInfo;
import com.hyp.system.domain.dto.ScoreInfoSaveDTO;
import com.hyp.system.domain.vo.RewScoreInfoVO;
import com.hyp.system.service.RewApplyInfoListService;
import com.hyp.system.service.RewScoreInfoService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* packageName com.hyp.web.controller.manager
*
* @author wangxy
* @version JDK 8
* @className ScoreInfoManager
* @date 2024/4/12
* @description
*/
@Component
public class ScoreInfoManager {
@Resource
private RewScoreInfoService scoreInfoService;
@Resource
private RewApplyInfoListService applyInfoListService;
/**
*
*
* @param scoreInfo
* @return boolean
*/
@Transactional(rollbackFor = Exception.class)
public boolean saveOrUpdate(ScoreInfoSaveDTO scoreInfo){
LoginUser loginUser = SecurityUtils.getLoginUser();
RewScoreInfo rewScoreInfo = Convert.convert(RewScoreInfo.class, scoreInfo);
rewScoreInfo.setCreateId(loginUser.getUserId());
if(StringUtils.isNotEmpty(scoreInfo.getScoreId())){
rewScoreInfo.setUpdateTime(new Date());
rewScoreInfo.setUpdateBy(loginUser.getUsername());
}else{
rewScoreInfo.setCreateTime(new Date());
rewScoreInfo.setCreateBy(loginUser.getUsername());
}
scoreInfoService.saveOrUpdate(rewScoreInfo);
return submit(rewScoreInfo.getApplyId());
}
/**
*
*
* @param applyId
* @return java.util.List<com.hyp.system.domain.RewScoreInfo>
*/
public RewScoreInfoVO getScoreInfo(String applyId){
RewScoreInfoVO rewScoreInfoVO = new RewScoreInfoVO();
LambdaQueryWrapper<RewScoreInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(RewScoreInfo::getApplyId,applyId);
if (!SysUser.isAdmin(SecurityUtils.getUserId())){
queryWrapper.eq(RewScoreInfo::getCreateId, SecurityUtils.getUserId());
}else {
rewScoreInfoVO.setAvgScore(avgRewScore(applyId));
}
queryWrapper.orderByDesc(RewScoreInfo::getScore);
List<RewScoreInfo> list = scoreInfoService.list(queryWrapper);
rewScoreInfoVO.setRewScoreInfos(list);
return rewScoreInfoVO;
}
/**
*
*
* @param applyId
* @return boolean
*/
public boolean submit(String applyId){
return applyInfoListService.lambdaUpdate()
.eq(RewApplyInfoList::getApplyId, applyId)
.set(RewApplyInfoList::getApplyStatus, ApplyStatusEnum.END.getType())
.set(RewApplyInfoList::getUpdateTime, new Date())
.update();
}
/**
*
*
* @param applyId
* @return java.lang.String
*/
public String avgRewScore(String applyId){
return scoreInfoService.avgRewScore(applyId);
}
}

@ -4,9 +4,9 @@ import com.hyp.common.core.text.Convert;
import com.hyp.common.utils.StringUtils;
import com.hyp.system.domain.SysNotice;
import com.hyp.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -23,7 +23,7 @@ import java.util.List;
@Component
public class SysNoticeManager {
@Autowired
@Resource
private ISysNoticeService noticeService;
/**
@ -32,7 +32,6 @@ public class SysNoticeManager {
* @param notice
* @return java.util.List<com.hyp.system.domain.SysNotice>
*/
public List<SysNotice> selectNoticeList(SysNotice notice){
return noticeService.selectNoticeList(notice);
}
@ -43,7 +42,6 @@ public class SysNoticeManager {
* @param notice
* @return boolean
*/
public boolean saveOrUpdate(SysNotice notice){
if(StringUtils.isNotEmpty(notice.getNoticeId())){
notice.setUpdateTime(new Date());
@ -59,7 +57,6 @@ public class SysNoticeManager {
* @param noticeId
* @return com.hyp.system.domain.SysNotice
*/
public SysNotice selectNoticeById(String noticeId){
return noticeService.getById(noticeId);
}
@ -70,7 +67,6 @@ public class SysNoticeManager {
* @param ids
* @return boolean
*/
public boolean removeByIds(String ids){
return noticeService.removeByIds(Arrays.asList(Convert.toStrArray(ids)));
}
@ -79,4 +75,9 @@ public class SysNoticeManager {
return noticeService.removeByIds(Arrays.asList(noticeIds));
}
public SysNotice getNotice(){
return noticeService.lambdaQuery().orderByDesc(SysNotice::getUpdateTime).list().get(0);
}
}

@ -0,0 +1,80 @@
package com.hyp.web.controller.reward;
import com.hyp.common.annotation.Log;
import com.hyp.common.core.controller.BaseController;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.core.page.TableDataInfo;
import com.hyp.common.enums.BusinessType;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.dto.ApplyInfoListSaveDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.web.controller.manager.ApplyInfoListManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* packageName com.hyp.web.controller.apply
*
* @author wangxy
* @version JDK 8
* @className ApplyController
* @date 2024/4/10
* @description
*/
@Api("申请")
@RestController
@RequestMapping("/reward/apply")
public class ApplyController extends BaseController {
@Resource
private ApplyInfoListManager applyInfoListManager;
@ApiOperation("申请列表")
@GetMapping("/list")
public TableDataInfo list(ApplyInfoListDTO applyInfoListDTO) {
startPage();
List<ApplyInfoListVO> list = applyInfoListManager.selectApplyInfoList(applyInfoListDTO);
return getDataTable(list);
}
@ApiOperation("根据奖项类型生成applyId")
@Log(title = "申请保存", businessType = BusinessType.INSERT)
@GetMapping(value = "/getApplyId")
public AjaxResult getApplyId(@RequestParam String applyType) {
return success(applyInfoListManager.getApplyId(applyType));
}
@ApiOperation("提交申请")
@Log(title = "提交申请", businessType = BusinessType.UPDATE)
@PostMapping("/submit")
public AjaxResult submit(@Validated @RequestBody ApplyInfoListSaveDTO applyInfoSaveDTO) {
return toAjax(applyInfoListManager.submit(applyInfoSaveDTO));
}
@ApiOperation("删除申请")
@Log(title = "删除申请", businessType = BusinessType.DELETE)
@DeleteMapping("/delete/{applyId}")
public AjaxResult delete(@PathVariable String applyId) {
return toAjax(applyInfoListManager.deleteById(applyId));
}
@ApiOperation("申请详细")
@GetMapping(value = "/detail/{applyId}")
public AjaxResult detail(@PathVariable String applyId) {
return success(applyInfoListManager.detail(applyId));
}
@ApiOperation("材料上传校验")
@GetMapping("/checkUploadFile")
public AjaxResult checkUploadFile(@RequestParam String applyId,
@RequestParam String applyType){
return applyInfoListManager.checkUploadFile(applyId,applyType);
}
}

@ -0,0 +1,55 @@
package com.hyp.web.controller.reward;
import com.hyp.common.core.controller.BaseController;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.core.page.TableDataInfo;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.web.controller.manager.ApplyInfoListManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* packageName com.hyp.web.controller.reward
*
* @author wangxy
* @version JDK 8
* @className AuditController
* @date 2024/4/15
* @description
*/
@Api("审核")
@RestController
@RequestMapping("/reward/audit")
public class AuditController extends BaseController {
@Resource
private ApplyInfoListManager applyInfoListManager;
@ApiOperation("审核列表")
@GetMapping("/list")
public TableDataInfo list(ApplyInfoListDTO applyInfoListDTO) {
startPage();
List<ApplyInfoListVO> list = applyInfoListManager.selectAduitInfoList(applyInfoListDTO);
return getDataTable(list);
}
@ApiOperation("审核通过")
@GetMapping(value = "/approved/{applyId}")
public AjaxResult approved(@PathVariable String applyId) {
return toAjax(applyInfoListManager.approved(applyId));
}
@ApiOperation("审核不通过")
@GetMapping(value = "/applyBack")
public AjaxResult applyBack(@RequestParam String applyId,
@RequestParam(required = false) String applyMsg) {
return toAjax(applyInfoListManager.applyBack(applyId,applyMsg));
}
}

@ -0,0 +1,197 @@
package com.hyp.web.controller.reward;
import com.hyp.common.annotation.Log;
import com.hyp.common.config.HypConfig;
import com.hyp.common.constant.Constants;
import com.hyp.common.core.controller.BaseController;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.enums.BusinessType;
import com.hyp.common.exception.ServiceException;
import com.hyp.common.utils.HypFileUtil;
import com.hyp.common.utils.file.FileUploadUtils;
import com.hyp.common.utils.file.FileUtils;
import com.hyp.framework.config.ServerConfig;
import com.hyp.system.domain.RewFileRelation;
import com.hyp.web.controller.manager.FileRelationManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;
import java.util.Objects;
/**
* packageName com.hyp.web.controller.reward
*
* @author wangxy
* @version JDK 8
* @className FileRelationController
* @date 2024/4/12
* @description
*/
@Api("文件")
@RestController
@RequestMapping("/reward/file")
@Slf4j
public class FileRelationController extends BaseController {
@Resource
private FileRelationManager fileRelationManager;
@Resource
private ServerConfig serverConfig;
@ApiOperation("文件上传")
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file,
@RequestParam String applyId,
@RequestParam(required = false) String filename,
@RequestParam String fileCode) {
try {
if(file.isEmpty()){
throw new ServiceException("上传文件不能为空");
}
// 上传文件路径
String filePath = HypConfig.getUploadPath();
// 上传并返回新文件名称
String fileNames = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileNames;
if(StringUtils.isBlank(filename)){
filename = fileNames;
}
String originalFilename = FileUtils.getNameNotSuffix(file.getOriginalFilename()) ;
return AjaxResult.success(fileRelationManager.save(applyId,filename,fileCode,url,originalFilename));
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
*
*/
@ApiOperation("多文件上传")
@PostMapping("/uploads")
public AjaxResult uploadFiles(List<MultipartFile> files,
@RequestParam String applyId,
@RequestParam(required = false) String filename,
@RequestParam String fileCode){
try {
return AjaxResult.success(fileRelationManager.saveBatch(files,applyId,filename,fileCode));
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
@ApiOperation("材料预览")
@GetMapping("fileView/{fileId}")
public void fileView(@PathVariable String fileId, HttpServletResponse response) throws IOException {
String filePath = fileRelationManager.getFilePath(fileId);
String fileName = fileRelationManager.getRealName(fileId);
String encodedFileName = new String(fileName.getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1);
InputStream in = null;
OutputStream out = null;
try {
response.setHeader("content-disposition", "attachment;filename=" + encodedFileName + ".pdf");
// 设置文件ContentType类型这样设置会自动判断下载文件类型
response.setContentType("application/octet-stream;charset=utf-8");
File file = new File(filePath);
in = Files.newInputStream(file.toPath());
// 从response对象获取输出流
out = response.getOutputStream();
// 将输入流中的数据读取出来,写到输出流中
for (int b = -1; (b = in.read()) != -1; ) {
out.write(b);
}
} catch (Exception e) {
log.error("获取文件流失败:", e.getMessage(), e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
log.error(e.getMessage(), e);
} finally {
if (out != null) {
out.close();
}
}
}
}
}
@ApiOperation("材料删除")
@Log(title = "材料删除", businessType = BusinessType.DELETE)
@GetMapping("/delFile/{fileId}")
public AjaxResult delFile(@PathVariable String fileId){
return toAjax(fileRelationManager.delFile(fileId));
}
@ApiOperation("材料审核通过id")
@GetMapping("/filePass")
public AjaxResult pass(@RequestParam String fileId,
@RequestParam Integer fileState){
return toAjax(fileRelationManager.pass(fileId,fileState));
}
@ApiOperation("材料校验")
@GetMapping("/checkFile/{applyId}")
public AjaxResult checkFile(@PathVariable String applyId){
return fileRelationManager.checkFile(applyId);
}
@ApiOperation("文件查询")
@GetMapping("/getFileInfo")
public AjaxResult getFileInfo(@RequestParam String applyId,
@RequestParam(required = false) String fileCode) {
return success(fileRelationManager.getFileInfo(applyId,fileCode));
}
@ApiOperation("文件下载")
@GetMapping("/download")
public void fileDownload(String fileId, HttpServletResponse response, HttpServletRequest request) {
try {
RewFileRelation rewFileRelation = fileRelationManager.getRewFileRelation(fileId);
if(Objects.isNull(rewFileRelation)){
throw new ServiceException("下载文件不存在");
}
String fileName = rewFileRelation.getFilePath();
if (!FileUtils.checkAllowDownload(fileName)) {
throw new ServiceException(com.hyp.common.utils.StringUtils.format("资源文件({})非法,不允许下载。 ", fileName));
}
// 本地资源路径
String localPath = HypConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(fileName, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
}

@ -0,0 +1,79 @@
package com.hyp.web.controller.reward;
import com.hyp.common.annotation.Log;
import com.hyp.common.core.controller.BaseController;
import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.core.page.TableDataInfo;
import com.hyp.common.enums.BusinessType;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.dto.ScoreInfoSaveDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.web.controller.manager.ApplyInfoListManager;
import com.hyp.web.controller.manager.ScoreInfoManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* packageName com.hyp.web.controller.reward
*
* @author wangxy
* @version JDK 8
* @className RewScoreInfoController
* @date 2024/4/12
* @description
*/
@Api("评分")
@RestController
@RequestMapping("/reward/score")
public class ScoreInfoController extends BaseController {
@Resource
private ScoreInfoManager scoreInfoManager;
@Resource
private ApplyInfoListManager applyInfoListManager;
@ApiOperation("评分列表")
@GetMapping("/list")
public TableDataInfo list(ApplyInfoListDTO applyInfoListDTO) {
startPage();
List<ApplyInfoListVO> list = applyInfoListManager.selectScoreInfoList(applyInfoListDTO);
return getDataTable(list);
}
@ApiOperation("评分保存")
@Log(title = "评分保存", businessType = BusinessType.INSERT)
@PostMapping("/save")
public AjaxResult save(@Validated @RequestBody ScoreInfoSaveDTO scoreInfo) {
return toAjax(scoreInfoManager.saveOrUpdate(scoreInfo));
}
@ApiOperation("评分查询")
@GetMapping("/getScoreInfo")
public AjaxResult getScoreInfo(@RequestParam String applyId) {
return success(scoreInfoManager.getScoreInfo(applyId));
}
@ApiOperation("评分提交")
@GetMapping(value = "/submit/{applyId}")
public AjaxResult submit(@PathVariable String applyId) {
return toAjax(scoreInfoManager.submit(applyId));
}
}

@ -78,7 +78,7 @@ public class SysDictDataController extends BaseController
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
data = new ArrayList<>();
}
return success(data);
}

@ -2,6 +2,8 @@ package com.hyp.web.controller.system;
import java.util.List;
import java.util.Set;
import com.hyp.common.utils.sign.RsaUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -36,21 +38,21 @@ public class SysLoginController
/**
*
*
*
* @param loginBody
* @return
*/
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody)
{
public AjaxResult login(@RequestBody LoginBody loginBody) throws Exception {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
String token = loginService.login(loginBody.getUsername(),
RsaUtils.decryptByPrivateKey(loginBody.getPassword()), loginBody.getCode());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
*
*

@ -3,6 +3,8 @@ package com.hyp.web.controller.system;
import java.util.List;
import com.hyp.web.controller.manager.SysNoticeManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@ -26,6 +28,7 @@ import com.hyp.system.domain.SysNotice;
*
* @author ruoyi
*/
@Api("通知公告")
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
@ -89,4 +92,11 @@ public class SysNoticeController extends BaseController
{
return toAjax(sysNoticeManager.deleteNoticeByIds(noticeIds));
}
@ApiOperation("查询公告")
@GetMapping("/getNotice")
public AjaxResult getNotice() {
return success(sysNoticeManager.getNotice());
}
}

@ -52,7 +52,7 @@ public class SysPostController extends BaseController
public void export(HttpServletResponse response, SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
ExcelUtil<SysPost> util = new ExcelUtil<>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
}

@ -113,9 +113,9 @@ public class SwaggerConfig
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题:若依管理系统_接口文档")
.title("标题:黄炎培申报管理系统_接口文档")
// 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
.description("描述:具体包括申请、审核、评分模块...")
// 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本

@ -7,8 +7,8 @@ spring:
# 主库数据源
master:
url: jdbc:mysql://192.168.254.123:3306/hyp-web?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: ENC(etefRyjDjElO785sByVlQQ==)
password: ENC(WpGUIh5Xfv2mU/Ssjd0hj1mMKGC/1XIr)
username: ENC(KO9kwXTPL1XJaMYHWxnbzA==)
password: ENC(Wx/75yN9OnFEhUDp+L+vUQwmGBiZlIyL)
# password: qwer1234
# 从库数据源
slave:

@ -7,11 +7,11 @@ hyp:
# 版权年份
copyrightYear: 2024
# 文件路径 示例( Windows配置D:/hyp/uploadPathLinux配置 /home/hyp/uploadPath
profile: D:/hyp/uploadPath
profile: /home/hyp/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: char
# captchaType: char
# 开发环境配置
server:
@ -52,14 +52,14 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: dev
active: prod
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
max-file-size: 100MB
# 设置总上传的文件大小
max-request-size: 20MB
max-request-size: 200MB
# 服务模块
devtools:
restart:
@ -68,7 +68,7 @@ spring:
# redis 配置
redis:
# 地址
host: 192.168.254.197
host: 192.168.254.180
# 端口默认为6379
port: 6379
# 数据库索引
@ -96,9 +96,11 @@ token:
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
# 是否允许账户多终端同时登录true允许 false不允许
soloLogin: false
# MyBatis配置
mybatis:
# MyBatis Plus配置
mybatis-plus:
# 搜索指定包别名
typeAliasesPackage: com.hyp.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
@ -131,4 +133,21 @@ xss:
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
urlPatterns: /system/*,/monitor/*,/tool/*,/reward/*
# 滑块验证码
aj:
captcha:
# 缓存类型
cache-type: redis
# blockPuzzle 滑块 clickWord 文字点选 default默认两者都实例化
type: blockPuzzle
# 右下角显示字
water-mark:
# 校验滑动拼图允许误差偏移量(默认5像素)
slip-offset: 5
# aes加密坐标开启或者禁用(true|false)
aes-status: true
# 滑动干扰项(0/1/2)
interference-options: 0

@ -6,7 +6,7 @@ import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
public class EncFactory {
public static void main(String[] args) {
String securityKey = "NBPLUS"; // 加密秘钥
String data = "qwer1234"; // 需要加密的字符串
String data = "wangxy123@"; // 需要加密的字符串
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();

@ -0,0 +1,23 @@
package com.hyp;
import com.hyp.common.constant.HttpStatus;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.transaction.annotation.Transactional;
import org.junit.jupiter.api.Assertions;
@SpringBootTest
@Transactional(rollbackFor = Exception.class)
@Rollback
public class HypApplicationTest {
@Test
public void test(){
Assertions.assertEquals(200, HttpStatus.SUCCESS);
}
}

@ -0,0 +1,24 @@
package com.hyp.manager;
import com.hyp.HypApplicationTest;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.web.controller.manager.ApplyInfoListManager;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
class ApplyInfoListManagerTest extends HypApplicationTest {
@Autowired
private ApplyInfoListManager applyInfoListManager;
@Test
void objectTest() {
ApplyInfoListVO detail = applyInfoListManager.detail("1c1e0cfeec36fa881d7cb8d82dd9d036");
Assertions.assertNotNull(detail);
}
}

@ -143,6 +143,11 @@
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>

@ -170,4 +170,10 @@ public class Constants
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.hyp.common.utils.file", "com.hyp.common.config", "com.hyp.generator" };
/**
* redis key
*/
public static final String LOGIN_USERID_KEY = "login_userid:";
}

@ -27,6 +27,11 @@ public class LoginBody
*/
private String uuid;
/**
* key
*/
private String roleKey;
public String getUsername()
{
return username;
@ -66,4 +71,12 @@ public class LoginBody
{
this.uuid = uuid;
}
public String getRoleKey() {
return roleKey;
}
public void setRoleKey(String roleKey) {
this.roleKey = roleKey;
}
}

@ -0,0 +1,32 @@
package com.hyp.common.enums;
import lombok.Getter;
/**
*
*
* @author wangxy
* @date 2024/4/11 9:15
*/
@Getter
public enum ApplyStatusEnum {
SAVE(0, "待提交"),
SUBMIT(1, "待审核"),
AUDIT(2, "待评分"),
BACK(3, "已退回"),
END(4, "已评分");
private Integer type;
private String desc;
ApplyStatusEnum(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
}

@ -0,0 +1,32 @@
package com.hyp.common.enums;
import lombok.Getter;
/**
*
*
* @author wangxy
* @date 2024/4/11 9:15
*/
@Getter
public enum ApplyTypeEnum {
CATEGORY("rew_excellent_category", "优秀学校奖(学校类)"),
TRAINING("rew_excellent_training", "优秀学校奖(培训机构类)"),
PRINCIPAL("rew_principal_award", "杰出校长奖"),
TEACHER("rew_teacher_award", "杰出教师奖"),
CONTRIBUTION("rew_contribution_award", "杰出贡献奖");
private String type;
private String desc;
ApplyTypeEnum(String type, String desc) {
this.type = type;
this.desc = desc;
}
}

@ -0,0 +1,131 @@
package com.hyp.common.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@Slf4j
public class HypFileUtil extends FileUtil {
public static final String IE_FLAG_MISE = "msie";
public static final String IE_FLAG_TRIDENT = "trident";
public static final String IE_FLAG_EDGE = "edge";
/**
* MultipartFileFile
*/
public static File toFile(MultipartFile multipartFile) {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = "." + getExtensionName(fileName);
File file = null;
try {
// 用uuid作为文件名防止生成的临时文件重复
file = File.createTempFile(IdUtil.simpleUUID(), prefix);
// MultipartFile to File
multipartFile.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
/**
* .
*/
public static String getExtensionName(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return filename;
}
/**
*
*/
public static String getFileNameNoEx(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length()))) {
return filename.substring(0, dot);
}
}
return filename;
}
public static File upload(MultipartFile file, String uploadDir, String applyId){
String suffix = getExtensionName(file.getOriginalFilename());
String fileId = RandomUtil.randomNumbers(32);
String dateDir = DateUtil.format(DateUtil.date(),"yyyyMMdd");
//上传文件以后的存储路径
String separator = File.separator;
String filePath = uploadDir + separator + dateDir + separator + applyId + separator + fileId + "." + suffix;
try {
File upFile = new File(filePath).getCanonicalFile();
// 检测是否存在目录
if (!upFile.getParentFile().exists()) {
upFile.getParentFile().mkdirs();
}
log.info("上传文件路径:{}", filePath);
// 文件写入
file.transferTo(upFile);
return upFile;
} catch (IOException e) {
throw new RuntimeException("上传失败");
}
}
public static void downLoadFile(String filePath, String fileName, HttpServletRequest request, HttpServletResponse response) {
File f = null;
try {
f = FileUtil.newFile(filePath);
if (!f.exists()) {
response.sendError(404, "File not found!");
return;
}
} catch (IOException e) {
log.error(e.getMessage(), e);
}
try (BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
OutputStream out = response.getOutputStream();) {
byte[] buf = new byte[1024];
int len = 0;
// 在线打开方式
String userAgent = request.getHeader("User-Agent").toLowerCase();
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.reset();
// 解决申报系统异步下载跨域问题
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
// 纯下载方式
response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", fileName));
response.setContentType("application/x-msdownload;charset=UTF-8");
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
while ((len = br.read(buf)) > 0) {
out.write(buf, 0, len);
}
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
}

@ -25,7 +25,7 @@ public class FileUploadUtils
/**
* 50M
*/
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
public static final long DEFAULT_MAX_SIZE = 200 * 1024 * 1024;
/**
* 100

@ -0,0 +1,155 @@
package com.hyp.common.utils.sign;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* packageName com.hyp.common.utils.sign
*
* @author wangxy
* @version JDK 8
* @className RsaUtils
* @date 2024/4/28
* @description RSA
*/
public class RsaUtils {
// Rsa 私钥
public static String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY"
+ "7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN"
+ "PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA"
+ "kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow"
+ "cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv"
+ "DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh"
+ "YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3"
+ "UP8iWi1Qw0Y=";
/**
*
*
* @param text
* @return
*/
public static String decryptByPrivateKey(String text) throws Exception
{
return decryptByPrivateKey(privateKey, text);
}
/**
*
*
* @param publicKeyString
* @param text
* @return
*/
public static String decryptByPublicKey(String publicKeyString, String text) throws Exception
{
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
*
*
* @param privateKeyString
* @param text
* @return
*/
public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception
{
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
*
*
* @param privateKeyString
* @param text
* @return
*/
public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception
{
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
*
*
* @param publicKeyString
* @param text
* @return
*/
public static String encryptByPublicKey(String publicKeyString, String text) throws Exception
{
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
* RSA
*
* @return
*/
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException
{
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
return new RsaKeyPair(publicKeyString, privateKeyString);
}
/**
* RSA
*/
public static class RsaKeyPair
{
private final String publicKey;
private final String privateKey;
public RsaKeyPair(String publicKey, String privateKey)
{
this.publicKey = publicKey;
this.privateKey = privateKey;
}
public String getPublicKey()
{
return publicKey;
}
public String getPrivateKey()
{
return privateKey;
}
}
}

@ -35,16 +35,11 @@
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
<!-- 验证码 -->
<!-- 滑块验证码 -->
<dependency>
<groupId>pro.fessional</groupId>
<artifactId>kaptcha</artifactId>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
<groupId>com.github.anji-plus</groupId>
<artifactId>captcha-spring-boot-starter</artifactId>
<version>1.2.7</version>
</dependency>
<!-- 获取系统信息 -->

@ -1,83 +0,0 @@
package com.hyp.framework.config;
import java.util.Properties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import static com.google.code.kaptcha.Constants.*;
/**
*
*
* @author ruoyi
*/
@Configuration
public class CaptchaConfig
{
@Bean(name = "captchaProducer")
public DefaultKaptcha getKaptchaBean()
{
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
Properties properties = new Properties();
// 是否有边框 默认为true 我们可以自己设置yesno
properties.setProperty(KAPTCHA_BORDER, "yes");
// 验证码文本字符颜色 默认为Color.BLACK
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black");
// 验证码图片宽度 默认为200
properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160");
// 验证码图片高度 默认为50
properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
// 验证码文本字符大小 默认为40
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38");
// KAPTCHA_SESSION_KEY
properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode");
// 验证码文本字符长度 默认为5
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4");
// 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
// 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
Config config = new Config(properties);
defaultKaptcha.setConfig(config);
return defaultKaptcha;
}
@Bean(name = "captchaProducerMath")
public DefaultKaptcha getKaptchaBeanMath()
{
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
Properties properties = new Properties();
// 是否有边框 默认为true 我们可以自己设置yesno
properties.setProperty(KAPTCHA_BORDER, "yes");
// 边框颜色 默认为Color.BLACK
properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90");
// 验证码文本字符颜色 默认为Color.BLACK
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue");
// 验证码图片宽度 默认为200
properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160");
// 验证码图片高度 默认为50
properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
// 验证码文本字符大小 默认为40
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35");
// KAPTCHA_SESSION_KEY
properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
// 验证码文本生成器
properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.hyp.framework.config.KaptchaTextCreator");
// 验证码文本字符间距 默认为2
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3");
// 验证码文本字符长度 默认为5
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6");
// 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
// 验证码噪点颜色 默认为Color.BLACK
properties.setProperty(KAPTCHA_NOISE_COLOR, "white");
// 干扰实现类
properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise");
// 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
Config config = new Config(properties);
defaultKaptcha.setConfig(config);
return defaultKaptcha;
}
}

@ -1,68 +0,0 @@
package com.hyp.framework.config;
import java.util.Random;
import com.google.code.kaptcha.text.impl.DefaultTextCreator;
/**
*
*
* @author ruoyi
*/
public class KaptchaTextCreator extends DefaultTextCreator
{
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
@Override
public String getText()
{
Integer result = 0;
Random random = new Random();
int x = random.nextInt(10);
int y = random.nextInt(10);
StringBuilder suChinese = new StringBuilder();
int randomoperands = random.nextInt(3);
if (randomoperands == 0)
{
result = x * y;
suChinese.append(CNUMBERS[x]);
suChinese.append("*");
suChinese.append(CNUMBERS[y]);
}
else if (randomoperands == 1)
{
if ((x != 0) && y % x == 0)
{
result = y / x;
suChinese.append(CNUMBERS[y]);
suChinese.append("/");
suChinese.append(CNUMBERS[x]);
}
else
{
result = x + y;
suChinese.append(CNUMBERS[x]);
suChinese.append("+");
suChinese.append(CNUMBERS[y]);
}
}
else
{
if (x >= y)
{
result = x - y;
suChinese.append(CNUMBERS[x]);
suChinese.append("-");
suChinese.append(CNUMBERS[y]);
}
else
{
result = y - x;
suChinese.append(CNUMBERS[y]);
suChinese.append("-");
suChinese.append(CNUMBERS[x]);
}
}
suChinese.append("=?@" + result);
return suChinese.toString();
}
}

@ -1,134 +0,0 @@
package com.hyp.framework.config;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import javax.sql.DataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.io.VFS;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.util.ClassUtils;
import com.hyp.common.utils.StringUtils;
/**
* Mybatis*
*
* @author ruoyi
*/
@Configuration
public class MyBatisConfig
{
@Autowired
private Environment env;
static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
public static String setTypeAliasesPackage(String typeAliasesPackage)
{
ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
List<String> allResult = new ArrayList<String>();
try
{
for (String aliasesPackage : typeAliasesPackage.split(","))
{
List<String> result = new ArrayList<String>();
aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
Resource[] resources = resolver.getResources(aliasesPackage);
if (resources != null && resources.length > 0)
{
MetadataReader metadataReader = null;
for (Resource resource : resources)
{
if (resource.isReadable())
{
metadataReader = metadataReaderFactory.getMetadataReader(resource);
try
{
result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
}
}
}
if (result.size() > 0)
{
HashSet<String> hashResult = new HashSet<String>(result);
allResult.addAll(hashResult);
}
}
if (allResult.size() > 0)
{
typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
}
else
{
throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
}
}
catch (IOException e)
{
e.printStackTrace();
}
return typeAliasesPackage;
}
public Resource[] resolveMapperLocations(String[] mapperLocations)
{
ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
List<Resource> resources = new ArrayList<Resource>();
if (mapperLocations != null)
{
for (String mapperLocation : mapperLocations)
{
try
{
Resource[] mappers = resourceResolver.getResources(mapperLocation);
resources.addAll(Arrays.asList(mappers));
}
catch (IOException e)
{
// ignore
}
}
}
return resources.toArray(new Resource[resources.size()]);
}
@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
{
String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
String mapperLocations = env.getProperty("mybatis.mapperLocations");
String configLocation = env.getProperty("mybatis.configLocation");
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
VFS.addImplClass(SpringBootVFS.class);
//final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource);
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
return sessionFactory.getObject();
}
}

@ -0,0 +1,62 @@
package com.hyp.framework.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
/**
* packageName com.hyp.framework.config
*
* @author wangxy
* @version JDK 8
* @className MybatisPlusConfig
* @date 2024/5/21
* @description MybatisPlus
*/
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(paginationInnerInterceptor());
// 乐观锁插件
interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());
// 阻断插件
interceptor.addInnerInterceptor(blockAttackInnerInterceptor());
return interceptor;
}
/**
* https://baomidou.com/guide/interceptor-pagination.html
*/
public PaginationInnerInterceptor paginationInnerInterceptor() {
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
// 设置数据库类型为mysql
paginationInnerInterceptor.setDbType(DbType.MYSQL);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInnerInterceptor.setMaxLimit(-1L);
return paginationInnerInterceptor;
}
/**
* https://baomidou.com/guide/interceptor-optimistic-locker.html
*/
public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() {
return new OptimisticLockerInnerInterceptor();
}
/**
* https://baomidou.com/guide/interceptor-block-attack.html
*/
public BlockAttackInnerInterceptor blockAttackInnerInterceptor() {
return new BlockAttackInnerInterceptor();
}
}

@ -110,8 +110,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 对于登录login 注册register 滑块验证码/captcha/get /captcha/check 获取验证码开关 /captchaEnabled 允许匿名访问
.antMatchers("/login", "/register", "/captcha/get", "/captcha/check", "/captchaEnabled","/system/dict/data/type/**").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

@ -29,10 +29,9 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
{
@Autowired
private TokenService tokenService;
/**
* 退
*
*
* @return
*/
@Override
@ -44,7 +43,7 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler
{
String userName = loginUser.getUsername();
// 删除用户缓存记录
tokenService.delLoginUser(loginUser.getToken());
tokenService.delLoginUser(loginUser.getToken(), loginUser.getUser().getUserId());
// 记录用户退出日志
AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, MessageUtils.message("user.logout.success")));
}

@ -0,0 +1,58 @@
package com.hyp.framework.web.service;
import java.util.concurrent.TimeUnit;
import org.springframework.data.redis.core.StringRedisTemplate;
import com.anji.captcha.service.CaptchaCacheService;
import javax.annotation.Resource;
/**
* packageName com.hyp.framework.web.service
*
* @author wangxy
* @version JDK 8
* @className CaptchaRedisService
* @date 2024/4/28
* @description
*/
public class CaptchaRedisService implements CaptchaCacheService {
@Resource
private StringRedisTemplate stringRedisTemplate;
@Override
public void set(String key, String value, long expiresInSeconds)
{
stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);
}
@Override
public boolean exists(String key)
{
return Boolean.TRUE.equals(stringRedisTemplate.hasKey(key));
}
@Override
public void delete(String key)
{
stringRedisTemplate.delete(key);
}
@Override
public String get(String key)
{
return stringRedisTemplate.opsForValue().get(key);
}
@Override
public Long increment(String key, long val)
{
return stringRedisTemplate.opsForValue().increment(key, val);
}
@Override
public String type()
{
return "redis";
}
}

@ -1,13 +1,18 @@
package com.hyp.framework.web.service;
import javax.annotation.Resource;
import com.anji.captcha.model.common.ResponseModel;
import com.anji.captcha.model.vo.CaptchaVO;
import com.anji.captcha.service.CaptchaService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import com.hyp.common.constant.CacheConstants;
import com.hyp.common.constant.Constants;
import com.hyp.common.constant.UserConstants;
import com.hyp.common.core.domain.entity.SysUser;
@ -16,7 +21,6 @@ import com.hyp.common.core.redis.RedisCache;
import com.hyp.common.exception.ServiceException;
import com.hyp.common.exception.user.BlackListException;
import com.hyp.common.exception.user.CaptchaException;
import com.hyp.common.exception.user.CaptchaExpireException;
import com.hyp.common.exception.user.UserNotExistsException;
import com.hyp.common.exception.user.UserPasswordNotMatchException;
import com.hyp.common.utils.DateUtils;
@ -31,12 +35,11 @@ import com.hyp.system.service.ISysUserService;
/**
*
*
*
* @author ruoyi
*/
@Component
public class SysLoginService
{
public class SysLoginService {
@Autowired
private TokenService tokenService;
@ -45,56 +48,65 @@ public class SysLoginService
@Autowired
private RedisCache redisCache;
@Autowired
private ISysUserService userService;
@Autowired
private ISysConfigService configService;
@Autowired
@Lazy
private CaptchaService captchaService;
// 是否允许账户多终端同时登录true允许 false不允许
@Value("${token.soloLogin}")
private boolean soloLogin;
/**
*
*
*
* @param username
* @param password
* @param code
* @param uuid
* @param code
* @return
*/
public String login(String username, String password, String code, String uuid)
{
public String login(String username, String password, String code) {
// 验证码校验
validateCaptcha(username, code, uuid);
validateCaptcha(username, code);
// 登录前置校验
loginPreCheck(username, password);
// 用户验证
Authentication authentication = null;
try
{
try {
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken);
}
catch (Exception e)
{
if (e instanceof BadCredentialsException)
{
} catch (Exception e) {
if (e instanceof BadCredentialsException) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
else
{
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage());
}
}
finally
{
} finally {
AuthenticationContextHolder.clearContext();
}
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
if (!soloLogin)
{
// 如果用户不允许多终端同时登录,清除缓存信息
String userIdKey = Constants.LOGIN_USERID_KEY + loginUser.getUser().getUserId();
String userKey = redisCache.getCacheObject(userIdKey);
if (StringUtils.isNotEmpty(userKey))
{
redisCache.deleteObject(userIdKey);
redisCache.deleteObject(userKey);
}
}
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
@ -102,27 +114,18 @@ public class SysLoginService
/**
*
*
*
* @param username
* @param code
* @param uuid
* @param code
* @return
*/
public void validateCaptcha(String username, String code, String uuid)
{
public void validateCaptcha(String username, String code) {
boolean captchaEnabled = configService.selectCaptchaEnabled();
if (captchaEnabled)
{
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
if (captcha == null)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha))
{
if (captchaEnabled) {
CaptchaVO captchaVO = new CaptchaVO();
captchaVO.setCaptchaVerification(code);
ResponseModel response = captchaService.verification(captchaVO);
if (!response.isSuccess()) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException();
}
@ -131,35 +134,31 @@ public class SysLoginService
/**
*
*
* @param username
* @param password
*/
public void loginPreCheck(String username, String password)
{
public void loginPreCheck(String username, String password) {
// 用户名或密码为空 错误
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
{
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null")));
throw new UserNotExistsException();
}
// 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
{
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
// 用户名不在指定范围内 错误
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
{
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException();
}
// IP黑名单校验
String blackStr = configService.selectConfigByKey("sys.login.blackIPList");
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr()))
{
if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked")));
throw new BlackListException();
}
@ -170,12 +169,12 @@ public class SysLoginService
*
* @param userId ID
*/
public void recordLoginInfo(Long userId)
{
public void recordLoginInfo(Long userId) {
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setLoginIp(IpUtils.getIpAddr());
sysUser.setLoginDate(DateUtils.getNowDate());
userService.updateUserProfile(sysUser);
}
}

@ -1,5 +1,9 @@
package com.hyp.framework.web.service;
import com.hyp.common.core.domain.entity.SysRole;
import com.hyp.system.domain.SysUserRole;
import com.hyp.system.mapper.SysUserRoleMapper;
import com.hyp.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.hyp.common.constant.CacheConstants;
@ -17,6 +21,11 @@ import com.hyp.framework.manager.AsyncManager;
import com.hyp.framework.manager.factory.AsyncFactory;
import com.hyp.system.service.ISysConfigService;
import com.hyp.system.service.ISysUserService;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
*
@ -35,61 +44,77 @@ public class SysRegisterService
@Autowired
private RedisCache redisCache;
@Autowired
private SysUserRoleMapper userRoleMapper;
@Autowired
private ISysRoleService roleService;
/**
*
*/
public String register(RegisterBody registerBody)
{
@Transactional(rollbackFor = Exception.class)
public String register(RegisterBody registerBody) {
String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword();
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
// 验证码开关
boolean captchaEnabled = configService.selectCaptchaEnabled();
if (captchaEnabled)
{
/*boolean captchaEnabled = configService.selectCaptchaEnabled();
if (captchaEnabled) {
validateCaptcha(username, registerBody.getCode(), registerBody.getUuid());
}
}*/
if (StringUtils.isEmpty(username))
{
if (StringUtils.isEmpty(username)) {
msg = "用户名不能为空";
}
else if (StringUtils.isEmpty(password))
{
} else if (StringUtils.isEmpty(password)) {
msg = "用户密码不能为空";
}
else if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
{
} else if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
msg = "账户长度必须在2到20个字符之间";
}
else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
{
} else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
msg = "密码长度必须在5到20个字符之间";
}
else if (!userService.checkUserNameUnique(sysUser))
{
} else if (!userService.checkUserNameUnique(sysUser)) {
msg = "保存用户'" + username + "'失败,注册账号已存在";
}
else
{
} else {
sysUser.setNickName(username);
sysUser.setPassword(SecurityUtils.encryptPassword(password));
boolean regFlag = userService.registerUser(sysUser);
if (!regFlag)
{
//注册绑定角色
roleBinding(sysUser, registerBody.getRoleKey());
if (!regFlag) {
msg = "注册失败,请联系系统管理人员";
}
else
{
} else {
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success")));
}
}
return msg;
}
/**
*
*
* @param sysUser
* @param roleKey
* @return void
*/
public void roleBinding(SysUser sysUser,String roleKey) {
//注册绑定角色
userRoleMapper.deleteUserRoleByUserId(sysUser.getUserId());
List<SysUserRole> list = new ArrayList<>();
SysUserRole ur = new SysUserRole();
ur.setUserId(sysUser.getUserId());
SysRole sysRole = roleService.selectRoleByKey(roleKey);
if(Objects.nonNull(sysRole)){
ur.setRoleId(sysRole.getRoleId());
}
list.add(ur);
userRoleMapper.batchUserRole(list);
}
/**
*
*
@ -98,17 +123,14 @@ public class SysRegisterService
* @param uuid
* @return
*/
public void validateCaptcha(String username, String code, String uuid)
{
public void validateCaptcha(String username, String code, String uuid) {
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey);
if (captcha == null)
{
if (captcha == null) {
throw new CaptchaExpireException();
}
if (!code.equalsIgnoreCase(captcha))
{
if (!code.equalsIgnoreCase(captcha)) {
throw new CaptchaException();
}
}

@ -45,6 +45,11 @@ public class TokenService
@Value("${token.expireTime}")
private int expireTime;
// 是否允许账户多终端同时登录true允许 false不允许
@Value("${token.soloLogin}")
private boolean soloLogin;
protected static final long MILLIS_SECOND = 1000;
protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
@ -96,13 +101,18 @@ public class TokenService
/**
*
*/
public void delLoginUser(String token)
public void delLoginUser(String token, Long userId)
{
if (StringUtils.isNotEmpty(token))
{
String userKey = getTokenKey(token);
redisCache.deleteObject(userKey);
}
if (!soloLogin && StringUtils.isNotNull(userId))
{
String userIdKey = getUserIdKey(userId);
redisCache.deleteObject(userIdKey);
}
}
/**
@ -151,8 +161,17 @@ public class TokenService
// 根据uuid将loginUser缓存
String userKey = getTokenKey(loginUser.getToken());
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
if (!soloLogin)
{
// 缓存用户唯一标识,防止同一帐号,同时登录
String userIdKey = getUserIdKey(loginUser.getUser().getUserId());
redisCache.setCacheObject(userIdKey, userKey, expireTime, TimeUnit.MINUTES);
}
}
/**
*
*
@ -228,4 +247,9 @@ public class TokenService
{
return CacheConstants.LOGIN_TOKEN_KEY + uuid;
}
private String getUserIdKey(Long userId)
{
return Constants.LOGIN_USERID_KEY + userId;
}
}

@ -0,0 +1,72 @@
package com.hyp.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.util.Date;
import com.hyp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
*
* @author wangxy
* @TableName rew_apply_info_list
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class RewApplyInfoList extends BaseEntity {
/**
*
*/
@TableId(type = IdType.ASSIGN_UUID)
private String applyId;
/**
*
*/
private String applyName;
/**
*
*/
private String applyType;
/**
*
*/
private Integer isReward;
/**
* 0 123退
*/
private Integer applyStatus;
/**
*
*/
private Date appTime;
/**
* 退
*/
private String applyMsg;
/**
*
*/
private Date authTime;
/**
* id
*/
private Long createId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,58 @@
package com.hyp.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
*
* @author wangxy
* @TableName rew_file_relation
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class RewFileRelation implements Serializable {
/**
*
*/
@TableId(type = IdType.ASSIGN_UUID)
private String fileId;
/**
* id
*/
private String applyId;
/**
*
*/
private String fileName;
/**
*
*/
private String fileCode;
/**
*
*/
private String filePath;
/**
*
*/
private String realName;
/**
* 12
*/
private Integer fileState;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,49 @@
package com.hyp.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.hyp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
*
* @author wangxy
* @TableName rew_score_info
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class RewScoreInfo extends BaseEntity {
/**
*
*/
@TableId(type = IdType.ASSIGN_UUID)
private String scoreId;
/**
*
*/
private String score;
/**
* id
*/
private String applyId;
/**
* id
*/
private Long createId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,48 @@
package com.hyp.system.domain.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hyp.common.core.domain.BaseEntity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
* @author wangxy
* @TableName rew_apply_info_list
*/
@Data
public class ApplyInfoListDTO extends BaseEntity {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
*
*/
private String applyName;
/**
*
*/
@NotBlank(message = "奖项类型不能为空")
private String applyType;
/**
* 0 123退
*/
@NotBlank(message = "申请状态不能为空")
private String applyStatus;
/**
* id
*/
private Long createId;
}

@ -0,0 +1,40 @@
package com.hyp.system.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* packageName com.hyp.system.domain.dto
*
* @author wangxy
* @version JDK 8
* @className ApplyInfoListSaveDTO
* @date 2024/4/11
* @description
*/
@Data
public class ApplyInfoListSaveDTO implements Serializable {
/**
* id
*/
@NotBlank(message = "申请id不能为空")
private String applyId;
/**
*
*/
@NotNull(message = "是否获得过奖不能为空")
private Integer isReward;
}

@ -0,0 +1,36 @@
package com.hyp.system.domain.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
*
* @author wangxy
* @TableName rew_score_info
*/
@Data
public class ScoreInfoSaveDTO implements Serializable {
/**
*
*/
private String scoreId;
/**
*
*/
private String score;
/**
* id
*/
@NotBlank(message = "申请id不能为空")
private String applyId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,86 @@
package com.hyp.system.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hyp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
*
* @author wangxy
* @TableName rew_apply_info_list
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ApplyInfoListVO extends BaseEntity {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
*
*/
private String applyId;
/**
*
*/
private String applyName;
/**
*
*/
private String applyType;
/**
*
*/
private Integer isReward;
/**
* 0 123退
*/
private Integer applyStatus;
/**
*
*/
private Date appTime;
/**
* 退
*/
private String applyMsg;
/**
*
*/
private Date authTime;
/**
* id
*/
private Long createId;
private Integer scoreStatus = 0;
/**
*
*/
private List<FileRelationVO> fileRelationVOList;
}

@ -0,0 +1,56 @@
package com.hyp.system.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
*
* @author wangxy
* @TableName rew_file_relation
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class FileRelationVO implements Serializable {
/**
*
*/
private String fileId;
/**
* id
*/
private String applyId;
/**
*
*/
private String fileName;
/**
*
*/
private String fileCode;
/**
*
*/
private String filePath;
/**
*
*/
private String realName;
/**
* 12
*/
private Integer fileState;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,29 @@
package com.hyp.system.domain.vo;
import com.hyp.system.domain.RewScoreInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* packageName com.hyp.system.domain.vo
*
* @author wangxy
* @version JDK 8
* @className RewScoreInfoVO
* @date 2024/4/23
* @description
*/
@Data
public class RewScoreInfoVO implements Serializable {
private List<RewScoreInfo> rewScoreInfos;
/**
*
*
*/
private String avgScore;
}

@ -0,0 +1,34 @@
package com.hyp.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author wangxy
* @description rew_apply_info_list()Mapper
* @createDate 2024-04-11 09:11:34
* @Entity generator.domain.RewApplyInfoList
*/
@Mapper
public interface RewApplyInfoListMapper extends BaseMapper<RewApplyInfoList> {
/**
*
*
* @param applyInfoListDTO
* @return java.util.List<com.hyp.system.domain.vo.ApplyInfoListVO>
*/
List<ApplyInfoListVO> selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO);
}

@ -0,0 +1,21 @@
package com.hyp.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyp.system.domain.RewFileRelation;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 13560
* @description rew_file_relation()Mapper
* @createDate 2024-04-11 09:17:57
* @Entity generator.domain.RewFileRelation
*/
@Mapper
public interface RewFileRelationMapper extends BaseMapper<RewFileRelation> {
}

@ -0,0 +1,28 @@
package com.hyp.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyp.system.domain.RewScoreInfo;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author wangxy
* @description rew_score_info()Mapper
* @createDate 2024-04-11 09:20:53
* @Entity generator.domain.RewScoreInfo
*/
@Mapper
public interface RewScoreInfoMapper extends BaseMapper<RewScoreInfo> {
String avgRewScore(String applyId);
}

@ -4,12 +4,14 @@ import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyp.system.domain.SysNotice;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author ruoyi
*/
@Mapper
public interface SysNoticeMapper extends BaseMapper<SysNotice>
{
/**

@ -104,4 +104,12 @@ public interface SysRoleMapper
* @return
*/
public int deleteRoleByIds(Long[] roleIds);
/**
* key
*
* @param roleKey Key
* @return
*/
public SysRole selectRoleByKey(String roleKey);
}

@ -170,4 +170,13 @@ public interface ISysRoleService
* @return
*/
public int insertAuthUsers(Long roleId, Long[] userIds);
/**
* key
*
* @param roleKey Key
* @return
*/
public SysRole selectRoleByKey(String roleKey);
}

@ -0,0 +1,27 @@
package com.hyp.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import java.util.List;
/**
* @author wangxy
* @description rew_apply_info_list()Service
* @createDate 2024-04-11 09:11:34
*/
public interface RewApplyInfoListService extends IService<RewApplyInfoList> {
/**
*
*
* @param applyInfoListDTO
* @return java.util.List<com.hyp.system.domain.vo.ApplyInfoListVO>
*/
List<ApplyInfoListVO> selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO);
}

@ -0,0 +1,14 @@
package com.hyp.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyp.system.domain.RewFileRelation;
/**
* @author wangxy
* @description rew_file_relation()Service
* @createDate 2024-04-11 09:17:57
*/
public interface RewFileRelationService extends IService<RewFileRelation> {
}

@ -0,0 +1,17 @@
package com.hyp.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hyp.system.domain.RewScoreInfo;
/**
* @author wangxy
* @description rew_score_info()Service
* @createDate 2024-04-11 09:20:53
*/
public interface RewScoreInfoService extends IService<RewScoreInfo> {
String avgRewScore(String applyId);
}

@ -0,0 +1,44 @@
package com.hyp.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.system.mapper.RewApplyInfoListMapper;
import com.hyp.system.service.RewApplyInfoListService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author wangxy
* @description rew_apply_info_list()Service
* @createDate 2024-04-11 09:11:34
*/
@Service
public class RewApplyInfoListServiceImpl extends ServiceImpl<RewApplyInfoListMapper, RewApplyInfoList>
implements RewApplyInfoListService {
@Resource
private RewApplyInfoListMapper applyInfoListMapper;
/**
*
*
* @param applyInfoListDTO
* @return java.util.List<com.hyp.system.domain.vo.ApplyInfoListVO>
*/
@Override
public List<ApplyInfoListVO> selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO)
{
return applyInfoListMapper.selectApplyInfoList(applyInfoListDTO);
}
}

@ -0,0 +1,22 @@
package com.hyp.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hyp.system.domain.RewFileRelation;
import com.hyp.system.mapper.RewFileRelationMapper;
import com.hyp.system.service.RewFileRelationService;
import org.springframework.stereotype.Service;
/**
* @author wangxy
* @description rew_file_relation()Service
* @createDate 2024-04-11 09:17:57
*/
@Service
public class RewFileRelationServiceImpl extends ServiceImpl<RewFileRelationMapper, RewFileRelation>
implements RewFileRelationService {
}

@ -0,0 +1,45 @@
package com.hyp.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hyp.system.domain.RewScoreInfo;
import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.system.mapper.RewApplyInfoListMapper;
import com.hyp.system.mapper.RewScoreInfoMapper;
import com.hyp.system.service.RewScoreInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author wangxy
* @description rew_score_info()Service
* @createDate 2024-04-11 09:20:53
*/
@Service
public class RewScoreInfoServiceImpl extends ServiceImpl<RewScoreInfoMapper, RewScoreInfo>
implements RewScoreInfoService {
@Resource
private RewScoreInfoMapper rewScoreInfoMapper;
/**
*
*
* @param applyId
* @return java.util.List<com.hyp.system.domain.vo.ApplyInfoListVO>
*/
@Override
public String avgRewScore(String applyId)
{
return rewScoreInfoMapper.avgRewScore(applyId);
}
}

@ -421,4 +421,17 @@ public class SysRoleServiceImpl implements ISysRoleService
}
return userRoleMapper.batchUserRole(list);
}
/**
* ID
*
* @param roleKey KEY
* @return
*/
@Override
public SysRole selectRoleByKey(String roleKey)
{
return roleMapper.selectRoleByKey(roleKey);
}
}

@ -0,0 +1,54 @@
<?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.hyp.system.mapper.RewApplyInfoListMapper">
<resultMap id="BaseResultMap" type="com.hyp.system.domain.RewApplyInfoList">
<id property="applyId" column="apply_id" jdbcType="VARCHAR"/>
<result property="applyName" column="apply_name" jdbcType="VARCHAR"/>
<result property="applyType" column="apply_type" jdbcType="VARCHAR"/>
<result property="isReward" column="is_reward" jdbcType="INTEGER"/>
<result property="applyStatus" column="apply_status" jdbcType="INTEGER"/>
<result property="appTime" column="app_time" jdbcType="TIMESTAMP"/>
<result property="applyMsg" column="apply_msg" jdbcType="VARCHAR"/>
<result property="authTime" column="auth_time" jdbcType="TIMESTAMP"/>
<result property="createId" column="create_id" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
apply_id,apply_name,apply_type,
is_reward,apply_status,app_time,
apply_msg,auth_time,create_id,
create_by,create_time,update_by,
update_time,remark
</sql>
<select id="selectApplyInfoList" parameterType="com.hyp.system.domain.dto.ApplyInfoListDTO" resultType="com.hyp.system.domain.vo.ApplyInfoListVO">
select <include refid="Base_Column_List"/>
from rew_apply_info_list t
<trim prefix="where" prefixOverrides="and|or">
<if test="applyName != null and applyName != ''">
and t.apply_name like concat('%',#{applyName},'%')
</if>
<if test="applyType != null and applyType != ''">
and t.apply_type = #{applyType}
</if>
<if test="createId != null">
and t.create_id = #{createId}
</if>
<if test="createBy != null and createBy != ''">
and t.create_by like concat('%',#{createBy},'%')
</if>
<if test="applyStatus != null and applyStatus != ''">
and apply_status in
<foreach item="item" index="index" collection="applyStatus.split(',')" open="(" separator="," close=")">'${item}'</foreach>
</if>
</trim>
order by t.update_time desc
</select>
</mapper>

@ -0,0 +1,22 @@
<?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.hyp.system.mapper.RewFileRelationMapper">
<resultMap id="BaseResultMap" type="com.hyp.system.domain.RewFileRelation">
<id property="fileId" column="file_id" jdbcType="VARCHAR"/>
<result property="applyId" column="apply_id" jdbcType="VARCHAR"/>
<result property="fileName" column="file_name" jdbcType="VARCHAR"/>
<result property="fileCode" column="file_code" jdbcType="VARCHAR"/>
<result property="filePath" column="file_path" jdbcType="VARCHAR"/>
<result property="realName" column="real_name" jdbcType="VARCHAR"/>
<result property="fileState" column="file_state" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
file_id,apply_id,file_name,
file_code,file_path,real_name,
file_state
</sql>
</mapper>

@ -0,0 +1,27 @@
<?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.hyp.system.mapper.RewScoreInfoMapper">
<resultMap id="BaseResultMap" type="com.hyp.system.domain.RewScoreInfo">
<id property="scoreId" column="score_id" jdbcType="VARCHAR"/>
<result property="score" column="score" jdbcType="VARCHAR"/>
<result property="applyId" column="apply_id" jdbcType="VARCHAR"/>
<result property="createId" column="create_id" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
score_id,score,apply_id,
create_id,create_by,create_time,
update_by,update_time,remark
</sql>
<select id="avgRewScore" resultType="java.lang.String" parameterType="String">
SELECT AVG(t.score) as avgScore from rew_score_info t where t.apply_id = #{applyId}
</select>
</mapper>

@ -92,8 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
@ -148,5 +149,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{roleId}
</foreach>
</delete>
<select id="selectRoleByKey" parameterType="String" resultType="com.hyp.common.core.domain.entity.SysRole">
<include refid="selectRoleVo"/>
where r.role_key = #{roleKey}
</select>
</mapper>
Loading…
Cancel
Save