更新9.28

This commit is contained in:
许允枞 2024-09-28 10:23:21 +08:00
parent bc76d42343
commit 6ecda2874a
4 changed files with 51 additions and 4 deletions

View File

@ -1,17 +1,24 @@
package com.ruoyi.cms.controller; package com.ruoyi.cms.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.cms.domain.vo.HitCompetitionStudentInfoImportVo; import com.ruoyi.cms.domain.vo.HitCompetitionStudentInfoImportVo;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.cms.domain.HitCompetitionStudentInfo; import com.ruoyi.cms.domain.HitCompetitionStudentInfo;
import com.ruoyi.cms.service.IHitCompetitionStudentInfoService; import com.ruoyi.cms.service.IHitCompetitionStudentInfoService;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.common.exception.job.TaskException;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
//import com.ruoyi.cms.task.HitTask; //import com.ruoyi.cms.task.HitTask;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.quartz.controller.SysJobController; import com.ruoyi.quartz.controller.SysJobController;
import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.domain.SysJob;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
@ -42,6 +49,8 @@ public class HitCompetitionStudentInfoController extends BaseController {
@Autowired @Autowired
private SysJobController sysJobController; private SysJobController sysJobController;
@Autowired
private ServerConfig serverConfig;
/** /**
@ -189,4 +198,33 @@ public class HitCompetitionStudentInfoController extends BaseController {
String message = hitCompetitionStudentInfoService.importData(hitList); String message = hitCompetitionStudentInfoService.importData(hitList);
return success(message); return success(message);
} }
@PostMapping("/uploadDsFile")
public AjaxResult importDsFile(@RequestParam("file")MultipartFile file,String phoneNumber){
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
HitCompetitionStudentInfo hitCompetitionStudentInfo = new HitCompetitionStudentInfo();
DateTime now = DateUtil.date();
hitCompetitionStudentInfo.setDsFile(fileName);
hitCompetitionStudentInfo.setUpdateTime(now);
LambdaQueryWrapper<HitCompetitionStudentInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HitCompetitionStudentInfo::getPhoneNumber, phoneNumber);
boolean update = hitCompetitionStudentInfoService.update(hitCompetitionStudentInfo, queryWrapper);
if (update) {
return success("上传成功");
}
return success("上传失败");
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
} }

View File

@ -117,6 +117,8 @@ public class HitCompetitionStudentInfo implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
private String dsFile;
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateBy; private String updateBy;
@TableField(exist = false) @TableField(exist = false)

View File

@ -75,19 +75,26 @@ spring:
database: 9 database: 9
# 密码 # 密码
password: Obr1234!@#$ password: Obr1234!@#$
# password: 123456
# password: # password:
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 60s
lettuce: lettuce:
cluster:
refresh:
adaptive: true
period: 10000
pool: pool:
# 连接池中的最小空闲连接 # 连接池中的最小空闲连接
min-idle: 0 min-idle: 0
# 连接池中的最大空闲连接 # 连接池中的最大空闲连接
max-idle: 8 max-idle: 8
# 连接池的最大数据库连接数 # 连接池的最大数据库连接数
max-active: 8 max-active: 20
# #连接池最大阻塞等待时间(使用负值表示没有限制) # #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms max-wait: 6000ms
time-between-eviction-runs: 1s
shutdown-timeout: 100ms
# token配置 # token配置
token: token:

View File

@ -111,7 +111,7 @@ public class SecurityConfig
.authorizeHttpRequests((requests) -> { .authorizeHttpRequests((requests) -> {
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login", "/register", "/captchaImage").permitAll() requests.antMatchers("/login", "/register", "/captchaImage","/system/hit_stu_info/uploadDsFile").permitAll()
// 静态资源可匿名访问 // 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()