提交代码修改为准
This commit is contained in:
1 parent
eaad94f10b
commit
9dff23fc68
22 files changed
+373
-299
No files matched your search
+7
-1
@@ -54,7 +54,7 @@
|
||||
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
|
||||
<maven-war-plugin.version>3.2.2</maven-war-plugin.version>
|
||||
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
|
||||
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
|
||||
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
||||
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
|
||||
<!-- 打包默认跳过测试 -->
|
||||
<skipTests>true</skipTests>
|
||||
@@ -460,6 +460,12 @@
|
||||
<groups>${profiles.active}</groups>
|
||||
<!-- 排除标签 -->
|
||||
<excludedGroups>exclude</excludedGroups>
|
||||
<parallel>none</parallel> <!-- 彻底禁用并行 -->
|
||||
<threadCount>1</threadCount> <!-- 单线程 -->
|
||||
<forkCount>1</forkCount> <!-- 单独 fork 进程 -->
|
||||
<reuseForks>false</reuseForks> <!-- 不重用 fork -->
|
||||
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
|
||||
<timeout>60000</timeout> <!-- 60秒超时 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- 统一版本号管理 -->
|
||||
|
||||
@@ -112,12 +112,7 @@
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-xg</artifactId>
|
||||
</dependency>
|
||||
<!-- 学工管理-学生信息管理模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-xg-xx</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 招生就业管理模块 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package org.dromara.common.web.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.format.FormatterRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
@Configuration
|
||||
public class DateFormatConfig implements WebMvcConfigurer {
|
||||
private static final String[] patterns = new String[] {
|
||||
"yyyy-MM-dd HH:mm:ss",
|
||||
"yyyy-MM-dd"
|
||||
// 你可以继续添加其他格式,比如"yyyy/MM/dd"等
|
||||
};
|
||||
|
||||
@Override
|
||||
public void addFormatters(FormatterRegistry registry) {
|
||||
registry.addConverter(String.class, Date.class, source -> {
|
||||
if (source == null || source.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (String pattern : patterns) {
|
||||
try {
|
||||
return new SimpleDateFormat(pattern).parse(source.trim());
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("日期格式错误:" + source);
|
||||
});
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -28,9 +28,10 @@ public class HqSatCategory extends TenantEntity {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 删除标志
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
*/
|
||||
private Long deleted;
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
@@ -62,5 +63,4 @@ public class HqSatCategory extends TenantEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public class HqSatOption extends TenantEntity {
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Long deleted;
|
||||
|
||||
/**
|
||||
@@ -57,5 +58,4 @@ public class HqSatOption extends TenantEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -30,6 +30,7 @@ public class HqSatQuestion extends TenantEntity {
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Long deleted;
|
||||
|
||||
/**
|
||||
@@ -72,5 +73,4 @@ public class HqSatQuestion extends TenantEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+1
-2
@@ -29,7 +29,7 @@ public class HqSatCategoryBo extends BaseEntity {
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
private Long deleted;
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 分类编码
|
||||
@@ -63,5 +63,4 @@ public class HqSatCategoryBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
+20
-6
@@ -1,16 +1,18 @@
|
||||
package org.dromara.hq.domain.bo;
|
||||
|
||||
import org.dromara.hq.domain.HqSatSurvey;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.hq.domain.HqSatSurvey;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 问卷业务对象 hq_sat_survey
|
||||
@@ -66,14 +68,26 @@ public class HqSatSurveyBo extends BaseEntity {
|
||||
* 开始时间
|
||||
*/
|
||||
@NotNull(message = "开始时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@NotNull(message = "结束时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 开始时间查询参数(字符串格式)
|
||||
*/
|
||||
private String startTimeStr;
|
||||
|
||||
/**
|
||||
* 结束时间查询参数(字符串格式)
|
||||
*/
|
||||
private String endTimeStr;
|
||||
|
||||
/**
|
||||
* 最大提交次数
|
||||
*/
|
||||
|
||||
+7
-6
@@ -40,7 +40,7 @@ public class HqSatCategoryServiceImpl implements IHqSatCategoryService {
|
||||
* @return 题目分类
|
||||
*/
|
||||
@Override
|
||||
public HqSatCategoryVo queryById(Long id){
|
||||
public HqSatCategoryVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class HqSatCategoryServiceImpl implements IHqSatCategoryService {
|
||||
LambdaQueryWrapper<HqSatCategory> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(HqSatCategory::getId);
|
||||
lqw.eq(bo.getDeleted() != null, HqSatCategory::getDeleted, bo.getDeleted());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCategoryCode()), HqSatCategory::getCategoryCode, bo.getCategoryCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCategoryCode()), HqSatCategory::getCategoryCode, bo.getCategoryCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), HqSatCategory::getCategoryName, bo.getCategoryName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCategoryDesc()), HqSatCategory::getCategoryDesc, bo.getCategoryDesc());
|
||||
lqw.eq(bo.getSortOrder() != null, HqSatCategory::getSortOrder, bo.getSortOrder());
|
||||
@@ -116,8 +116,8 @@ public class HqSatCategoryServiceImpl implements IHqSatCategoryService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HqSatCategory entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
private void validEntityBeforeSave(HqSatCategory entity) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,9 +129,10 @@ public class HqSatCategoryServiceImpl implements IHqSatCategoryService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
// 逻辑删除实现
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -40,7 +40,7 @@ public class HqSatOptionServiceImpl implements IHqSatOptionService {
|
||||
* @return 评分选项
|
||||
*/
|
||||
@Override
|
||||
public HqSatOptionVo queryById(Long id){
|
||||
public HqSatOptionVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class HqSatOptionServiceImpl implements IHqSatOptionService {
|
||||
LambdaQueryWrapper<HqSatOption> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(HqSatOption::getId);
|
||||
lqw.eq(bo.getDeleted() != null, HqSatOption::getDeleted, bo.getDeleted());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOptionText()), HqSatOption::getOptionText, bo.getOptionText());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getOptionText()), HqSatOption::getOptionText, bo.getOptionText());
|
||||
lqw.eq(bo.getOptionValue() != null, HqSatOption::getOptionValue, bo.getOptionValue());
|
||||
lqw.eq(bo.getSortOrder() != null, HqSatOption::getSortOrder, bo.getSortOrder());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), HqSatOption::getStatus, bo.getStatus());
|
||||
@@ -115,8 +115,8 @@ public class HqSatOptionServiceImpl implements IHqSatOptionService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HqSatOption entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
private void validEntityBeforeSave(HqSatOption entity) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,8 +128,8 @@ public class HqSatOptionServiceImpl implements IHqSatOptionService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
+8
-7
@@ -40,7 +40,7 @@ public class HqSatQuestionServiceImpl implements IHqSatQuestionService {
|
||||
* @return 题库
|
||||
*/
|
||||
@Override
|
||||
public HqSatQuestionVo queryById(Long id){
|
||||
public HqSatQuestionVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@@ -75,8 +75,9 @@ public class HqSatQuestionServiceImpl implements IHqSatQuestionService {
|
||||
LambdaQueryWrapper<HqSatQuestion> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(HqSatQuestion::getId);
|
||||
lqw.eq(bo.getDeleted() != null, HqSatQuestion::getDeleted, bo.getDeleted());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionTitle()), HqSatQuestion::getQuestionTitle, bo.getQuestionTitle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionContent()), HqSatQuestion::getQuestionContent, bo.getQuestionContent());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getQuestionTitle()), HqSatQuestion::getQuestionTitle, bo.getQuestionTitle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionContent()), HqSatQuestion::getQuestionContent,
|
||||
bo.getQuestionContent());
|
||||
lqw.eq(bo.getCategoryId() != null, HqSatQuestion::getCategoryId, bo.getCategoryId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQuestionType()), HqSatQuestion::getQuestionType, bo.getQuestionType());
|
||||
lqw.eq(bo.getIsRequired() != null, HqSatQuestion::getIsRequired, bo.getIsRequired());
|
||||
@@ -118,8 +119,8 @@ public class HqSatQuestionServiceImpl implements IHqSatQuestionService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HqSatQuestion entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
private void validEntityBeforeSave(HqSatQuestion entity) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,8 +132,8 @@ public class HqSatQuestionServiceImpl implements IHqSatQuestionService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
if (isValid) {
|
||||
// TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
+48
-2
@@ -40,6 +40,9 @@ import org.dromara.common.core.exception.ServiceException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* 问卷Service业务层处理
|
||||
*
|
||||
@@ -107,8 +110,35 @@ public class HqSatSurveyServiceImpl implements IHqSatSurveyService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSurveyInstruction()), HqSatSurvey::getSurveyInstruction,
|
||||
bo.getSurveyInstruction());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTargetGroup()), HqSatSurvey::getTargetGroup, bo.getTargetGroup());
|
||||
lqw.eq(bo.getStartTime() != null, HqSatSurvey::getStartTime, bo.getStartTime());
|
||||
lqw.eq(bo.getEndTime() != null, HqSatSurvey::getEndTime, bo.getEndTime());
|
||||
// 处理时间查询参数:优先使用字符串格式的时间参数
|
||||
Date startTimeQuery = null;
|
||||
Date endTimeQuery = null;
|
||||
|
||||
// 如果有字符串格式的时间参数,优先使用
|
||||
if (StringUtils.isNotBlank(bo.getStartTimeStr())) {
|
||||
startTimeQuery = parseDateTime(bo.getStartTimeStr());
|
||||
} else if (bo.getStartTime() != null) {
|
||||
startTimeQuery = bo.getStartTime();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(bo.getEndTimeStr())) {
|
||||
endTimeQuery = parseDateTime(bo.getEndTimeStr());
|
||||
} else if (bo.getEndTime() != null) {
|
||||
endTimeQuery = bo.getEndTime();
|
||||
}
|
||||
|
||||
// 时间范围查询逻辑:
|
||||
// 如果用户选择了开始时间,查找预约开始时间 >= 用户选择时间的记录
|
||||
// 这样查询出的记录的开始时间都会比用户选择的时间晚或相等(用户选择的时间比数据库中的早)
|
||||
lqw.ge(startTimeQuery != null, HqSatSurvey::getStartTime, startTimeQuery);
|
||||
|
||||
// 如果用户选择了结束时间,查找预约结束时间 <= 用户选择时间的记录
|
||||
// 这样查询出的记录的结束时间都会比用户选择的时间早或相等(用户选择的时间比数据库中的晚)
|
||||
lqw.le(endTimeQuery != null, HqSatSurvey::getEndTime, endTimeQuery);
|
||||
|
||||
// lqw.eq(bo.getStartTime() != null, HqSatSurvey::getStartTime,
|
||||
// bo.getStartTime());
|
||||
// lqw.eq(bo.getEndTime() != null, HqSatSurvey::getEndTime, bo.getEndTime());
|
||||
lqw.eq(bo.getMaxSubmitTimes() != null, HqSatSurvey::getMaxSubmitTimes, bo.getMaxSubmitTimes());
|
||||
lqw.eq(bo.getIsAnonymous() != null, HqSatSurvey::getIsAnonymous, bo.getIsAnonymous());
|
||||
lqw.eq(bo.getIsPublished() != null, HqSatSurvey::getIsPublished, bo.getIsPublished());
|
||||
@@ -123,6 +153,22 @@ public class HqSatSurveyServiceImpl implements IHqSatSurveyService {
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期时间字符串
|
||||
*/
|
||||
private Date parseDateTime(String dateTimeStr) {
|
||||
if (StringUtils.isBlank(dateTimeStr)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.parse(dateTimeStr);
|
||||
} catch (ParseException e) {
|
||||
log.warn("日期格式解析失败: {}", dateTimeStr, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增问卷
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user