Commit 8a856380 authored by 高滢's avatar 高滢
parents a859bbfb ff4e5d3e
...@@ -3,6 +3,8 @@ package com.ruoyi.mapper; ...@@ -3,6 +3,8 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.ReviewStandard; import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewStandardListByPageRequest; import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse; import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -30,4 +32,6 @@ public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> { ...@@ -30,4 +32,6 @@ public interface ReviewStandardMapper extends BaseMapper<ReviewStandard> {
* @return * @return
*/ */
List<ReviewStandardTestInspectionContentResponse> selectTestInspectionContent(Long id); List<ReviewStandardTestInspectionContentResponse> selectTestInspectionContent(Long id);
List<ReviewStandardListResponse> findReviewStandardList(ReviewStandardListRequest request);
} }
...@@ -3,7 +3,9 @@ package com.ruoyi.service; ...@@ -3,7 +3,9 @@ package com.ruoyi.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.ReviewStandard; import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.web.request.ReviewStandardListByPageRequest; import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse; import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
...@@ -43,4 +45,11 @@ public interface ReviewStandardService extends IService<ReviewStandard> { ...@@ -43,4 +45,11 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
* @return * @return
*/ */
List<ReviewStandardTestInspectionContentResponse> selectTestInspectionContent(Long id); List<ReviewStandardTestInspectionContentResponse> selectTestInspectionContent(Long id);
/**
* 查询标准要求
* @param request
* @return
*/
List<ReviewStandardListResponse> findReviewStandardList(ReviewStandardListRequest request);
} }
...@@ -18,7 +18,7 @@ public interface TaskService extends IService<Task> { ...@@ -18,7 +18,7 @@ public interface TaskService extends IService<Task> {
*/ */
List<Task> findList(TaskListRequest request); List<Task> findList(TaskListRequest request);
void createTask(TaskCreateRequest request,Long userId); void createTask(TaskCreateRequest request);
/** /**
* 查询进行中的任务 * 查询进行中的任务
......
...@@ -6,7 +6,9 @@ import com.ruoyi.domain.*; ...@@ -6,7 +6,9 @@ import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewStandardMapper; import com.ruoyi.mapper.ReviewStandardMapper;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.web.request.ReviewStandardListByPageRequest; import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardListRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse; import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -98,6 +100,11 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper, ...@@ -98,6 +100,11 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
return list; return list;
} }
@Override
public List<ReviewStandardListResponse> findReviewStandardList(ReviewStandardListRequest request) {
return reviewStandardMapper.findReviewStandardList(request);
}
/** /**
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中 * 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* @param reviewStandardList * @param reviewStandardList
......
...@@ -92,7 +92,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -92,7 +92,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
@Override @Override
public void createTask(TaskCreateRequest request,Long userId) { public void createTask(TaskCreateRequest request) {
// 构建任务创建者 // 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
...@@ -167,9 +167,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -167,9 +167,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
taskStateFacade.doCreate(task, request.getTaskList()); taskStateFacade.doCreate(task, request.getTaskList());
TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(userId); TaskGetInfoResponse temporaryStorageTask = taskService.getByUserId(loginUser.getUserId());
if(temporaryStorageTask != null) {
taskMapper.deleteById(temporaryStorageTask.getId()); taskMapper.deleteById(temporaryStorageTask.getId());
}
} }
@Override @Override
...@@ -219,7 +220,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -219,7 +220,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
BeanUtils.copyBeanProp(task, request); BeanUtils.copyBeanProp(task, request);
Task oldTask = taskMapper.selectById(request.getId()); Task oldTask = taskMapper.selectById(request.getId());
if (task.getTaskStatus() == Task.TASK_STATUS_NEW) {
if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() == null) { if(request.getTaskList().contains(Task.SUB_TASK_GRFIS) && oldTask.getCarReviewTaskId() == null) {
// 保存车型审查问卷任务 // 保存车型审查问卷任务
TaskCreateRequest createRequest = new TaskCreateRequest(); TaskCreateRequest createRequest = new TaskCreateRequest();
...@@ -238,6 +239,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -238,6 +239,8 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if ( !request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() != null) { if ( !request.getTaskList().contains(Task.SUB_TASK_SRAIF) && oldTask.getSystemReviewTaskId() != null) {
systemReviewTaskMapper.deleteById(oldTask.getSystemReviewTaskId()); systemReviewTaskMapper.deleteById(oldTask.getSystemReviewTaskId());
} }
taskStateFacade.doCreate(task, request.getTaskList());
}
taskService.updateById(task); taskService.updateById(task);
...@@ -280,31 +283,25 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -280,31 +283,25 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if (sampleRelations.size() != 0 && sampleRelations != null) { if (sampleRelations.size() != 0 && sampleRelations != null) {
// 获取之前的第一个企业名称 // 获取之前的第一个企业名称
TaskSampleRelation taskSampleRelation = sampleRelations.get(0); TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId()); Sample oldSample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
// 获取编辑任务后的第一个企业名称 // 获取编辑任务后的第一个企业名称
TaskSampleRelation taskSampleRelation1 = relations.get(0); TaskSampleRelation newTaskSampleRelation = relations.get(0);
Sample sample1 = sampleManagementMapper.selectSampleManagementById(taskSampleRelation1.getSampleId()); Sample newSample = sampleManagementMapper.selectSampleManagementById(newTaskSampleRelation.getSampleId());
// 第一个企业名称不相同则修改 // 第一个企业名称不相同则修改
if (!Objects.equals(sample.getManufacturingEnterprise(), sample1.getManufacturingEnterprise())){ if (!Objects.equals(oldSample.getManufacturingEnterprise(), newSample.getManufacturingEnterprise())){
Task task1 = taskMapper.selectById(request.getId()); // 留档文件
// 体系审查对应的留档文件 List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList = reviewEnterpriseArchiveMapper.findList(request.getId());
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList = reviewEnterpriseArchiveMapper.findList(task1.getSystemReviewTaskId());
if (reviewEnterpriseArchiveList.size() != 0 && reviewEnterpriseArchiveList != null) {
for (ReviewEnterpriseArchive reviewEnterpriseArchive : reviewEnterpriseArchiveList) { for (ReviewEnterpriseArchive reviewEnterpriseArchive : reviewEnterpriseArchiveList) {
reviewEnterpriseArchive.setEnterpriseName(sample1.getManufacturingEnterprise()); reviewEnterpriseArchive.setEnterpriseName(newSample.getManufacturingEnterprise());
} }
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList); reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList);
// 车辆对应的留档文件
List<ReviewEnterpriseArchive> reviewEnterpriseArchiveList1 = reviewEnterpriseArchiveMapper.findList(task1.getCarReviewTaskId());
for (ReviewEnterpriseArchive reviewEnterpriseArchive1 : reviewEnterpriseArchiveList1) {
reviewEnterpriseArchive1.setEnterpriseName(sample1.getManufacturingEnterprise());
} }
reviewEnterpriseArchiveService.updateBatchById(reviewEnterpriseArchiveList1);
} }
} }
} }
...@@ -405,20 +402,24 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -405,20 +402,24 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
} }
// 任务组长
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
}
// 暂存
taskService.save(task);
if (auditors.size() != 0 && auditors != null) {
// 构建并保存该任务所关联的审核组信息 // 构建并保存该任务所关联的审核组信息
for(TaskUserRelation auditor : auditors) { for(TaskUserRelation auditor : auditors) {
auditor.setTaskId(task.getId()); auditor.setTaskId(task.getId());
} }
taskUserRelationService.saveBatch(auditors); taskUserRelationService.saveBatch(auditors);
// 任务组长
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
} }
// 暂存
taskService.save(task);
// 保存关联的整车样品信息 // 保存关联的整车样品信息
......
...@@ -46,7 +46,7 @@ public class AutomobileEnterpriseController extends BaseController ...@@ -46,7 +46,7 @@ public class AutomobileEnterpriseController extends BaseController
@PostMapping("/list") @PostMapping("/list")
public TableDataInfo<AutomobileEnterprise> list(@Validated @RequestBody AutomobileEnterpriseListRequest request) public TableDataInfo<AutomobileEnterprise> list(@Validated @RequestBody AutomobileEnterpriseListRequest request)
{ {
startPage(); startPage(request);
List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request); List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request);
return getDataTable(list); return getDataTable(list);
} }
......
package com.ruoyi.web;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewKeyPointService;
import com.ruoyi.web.request.KeyPointFindListRequest;
import com.ruoyi.web.request.TaskFindPendingRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "审查要点")
@RestController
@RequestMapping("/review/keypoint")
public class ReviewKeyPointController extends BaseController {
@Autowired
private ReviewKeyPointService reviewKeyPointService;
@ApiOperation("查询审查要点")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findKeyPointList")
public TableDataInfo<ReviewStandard> findKeyPointList(@Validated @RequestBody KeyPointFindListRequest request) {
// return getDataTable(reviewKeyPointService.findKeyPointList(request));
return null;
}
}
...@@ -7,20 +7,19 @@ import com.ruoyi.common.core.domain.R; ...@@ -7,20 +7,19 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.ReviewStandard; import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewStandardService; import com.ruoyi.service.ReviewStandardService;
import com.ruoyi.web.request.ReviewStandardInspectionContentRequest; import com.ruoyi.web.request.*;
import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import com.ruoyi.web.request.ReviewStandardTestInspectionContentRequest;
import com.ruoyi.web.response.ReviewStandardInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardInspectionContentResponse;
import com.ruoyi.web.response.ReviewStandardListResponse;
import com.ruoyi.web.response.ReviewStandardResponse; import com.ruoyi.web.response.ReviewStandardResponse;
import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse; import com.ruoyi.web.response.ReviewStandardTestInspectionContentResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -72,4 +71,12 @@ public class ReviewStandardController extends BaseController { ...@@ -72,4 +71,12 @@ public class ReviewStandardController extends BaseController {
List<ReviewStandardTestInspectionContentResponse> response = reviewStandardService.selectTestInspectionContent(request.getId()); List<ReviewStandardTestInspectionContentResponse> response = reviewStandardService.selectTestInspectionContent(request.getId());
return R.ok(response); return R.ok(response);
} }
@ApiOperation("查询标注要求列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findReviewStandardList")
public TableDataInfo<ReviewStandardListResponse> findReviewStandardList(@Validated @RequestBody ReviewStandardListRequest request) {
return getDataTable(reviewStandardService.findReviewStandardList(request));
}
} }
...@@ -58,7 +58,7 @@ public class TaskController extends BaseController { ...@@ -58,7 +58,7 @@ public class TaskController extends BaseController {
@Log(title = "总任务", businessType = BusinessType.INSERT) @Log(title = "总任务", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/add") @RequestMapping(method = RequestMethod.POST, value = "/add")
public R<String> createTask(@Validated @RequestBody TaskCreateRequest request) { public R<String> createTask(@Validated @RequestBody TaskCreateRequest request) {
taskService.createTask(request,getUserId()); taskService.createTask(request);
return R.ok(); return R.ok();
} }
......
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ApiModel(value = "KeyPointFindListRequest", description = "查询审查要点")
@Data
public class KeyPointFindListRequest {
@ApiModelProperty("审查要点")
private String text;
@ApiModelProperty("总标准ID")
@NotNull(message = "总标准ID不能为空")
private Long standardId;
@ApiModelProperty("标准类型[system、car、test]")
@NotNull(message = "标准类型不能为空")
@NotEmpty(message = "标准类型不能为空")
private String type;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel(value = "ReviewStandardListRequest", description = "查询标准要求")
@Data
public class ReviewStandardListRequest {
@ApiModelProperty("章节")
private String chapter;
@ApiModelProperty("要求")
private String text;
@ApiModelProperty("分类要求[system、car、test]")
private String type;
}
package com.ruoyi.web.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "ReviewStandardListResponse", description = "查询标准要求")
public class ReviewStandardListResponse {
@ApiModelProperty("ID")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("章节")
private String chapter;
@ApiModelProperty("文本内容")
private String text;
}
...@@ -27,6 +27,9 @@ public class TaskFindResponse { ...@@ -27,6 +27,9 @@ public class TaskFindResponse {
@ApiModelProperty("标准名称(检验依据)") @ApiModelProperty("标准名称(检验依据)")
private String name; private String name;
@ApiModelProperty("标准号")
private String standardNo;
@ApiModelProperty("任务编号") @ApiModelProperty("任务编号")
private String taskNo; private String taskNo;
......
...@@ -33,9 +33,25 @@ ...@@ -33,9 +33,25 @@
from t_automobile_enterprise from t_automobile_enterprise
</sql> </sql>
<sql id="selectAutomobileEnterpriseListSQL">
select ae.id,
ae.enterprise_name,
ae.address,
ae.postcode,
ae.enterprise_contact,
ae.contact_number,
su.nick_name create_by,
ae.create_time,
ae.update_by,
ae.update_time,
ae.deleted
from t_automobile_enterprise ae
left join sys_user su on ae.create_by = su.user_id
</sql>
<select id="selectAutomobileEnterpriseList" parameterType="com.ruoyi.domain.AutomobileEnterprise" <select id="selectAutomobileEnterpriseList" parameterType="com.ruoyi.domain.AutomobileEnterprise"
resultMap="AutomobileEnterpriseResult"> resultMap="AutomobileEnterpriseResult">
<include refid="selectAutomobileEnterpriseVo"/> <include refid="selectAutomobileEnterpriseListSQL"/>
<where> <where>
deleted = 0 deleted = 0
<if test="enterpriseName != null and enterpriseName != ''">and enterprise_name like concat('%', <if test="enterpriseName != null and enterpriseName != ''">and enterprise_name like concat('%',
......
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
</resultMap> </resultMap>
<resultMap id="StandardListResultMap" type="com.ruoyi.web.response.ReviewStandardListResponse">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="chapter" column="chapter" jdbcType="VARCHAR"/>
<result property="text" column="text" jdbcType="VARCHAR"/>
</resultMap>
<select id="findTree" resultMap="StandardTreeResultMap"> <select id="findTree" resultMap="StandardTreeResultMap">
SELECT id, chapter, text, standard_id, name, standard_no, file, conformity, inconformity FROM t_review_standard; SELECT id, chapter, text, standard_id, name, standard_no, file, conformity, inconformity FROM t_review_standard;
</select> </select>
...@@ -62,6 +68,18 @@ ...@@ -62,6 +68,18 @@
WHERE WHERE
usecase.review_standard_id = #{id} usecase.review_standard_id = #{id}
</select> </select>
<select id="findReviewStandardList" resultType="com.ruoyi.web.response.ReviewStandardListResponse">
SELECT id,chapter,text FROM t_review_standard
<where>
type = #{type}
<if test="chapter != null and chapter != ''">
and chapter like concat('%', #{chapter}, '%')
</if>
<if test="text != null and text != ''">
and text like concat('%', #{text}, '%')
</if>
</where>
</select>
</mapper> </mapper>
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
<result property="leader" column="leader" jdbcType="VARCHAR"/> <result property="leader" column="leader" jdbcType="VARCHAR"/>
<result property="reviewStatus" column="review_status" jdbcType="VARCHAR"/> <result property="reviewStatus" column="review_status" jdbcType="VARCHAR"/>
<result property="carReviewStatus" column="car_review_status" jdbcType="VARCHAR"/> <result property="carReviewStatus" column="car_review_status" jdbcType="VARCHAR"/>
<result property="standardNo" column="standard_no" jdbcType="BIGINT"/>
</resultMap> </resultMap>
<select id="findList" parameterType="com.ruoyi.web.request.TaskListRequest" resultMap="BaseResultMap"> <select id="findList" parameterType="com.ruoyi.web.request.TaskListRequest" resultMap="BaseResultMap">
...@@ -87,6 +88,7 @@ ...@@ -87,6 +88,7 @@
t.leader_id,t.leader, t.leader_id,t.leader,
t.task_begin_time, t.task_begin_time,
t.product_model, t.product_model,
t.standard_no,
srt.task_begin_time system_task_begin_time, srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time, srt.task_end_time system_task_end_time,
srt.task_status review_status, srt.task_status review_status,
...@@ -167,6 +169,7 @@ ...@@ -167,6 +169,7 @@
t.leader_id,t.leader, t.leader_id,t.leader,
t.task_begin_time, t.task_begin_time,
t.task_end_time, t.task_end_time,
t.standard_no,
srt.task_begin_time system_task_begin_time, srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time, srt.task_end_time system_task_end_time,
srt.task_status review_status, srt.task_status review_status,
......
...@@ -89,16 +89,16 @@ ...@@ -89,16 +89,16 @@
</appender> </appender>
<!-- 系统模块日志级别控制 --> <!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="debug" /> <logger name="com.ruoyi" level="INFO" />
<!-- Spring日志级别控制 --> <!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" /> <logger name="org.springframework" level="warn" />
<root level="debug"> <root level="INFO">
<appender-ref ref="console" /> <appender-ref ref="console" />
</root> </root>
<!--系统操作日志--> <!--系统操作日志-->
<root level="debug"> <root level="INFO">
<appender-ref ref="file_info" /> <appender-ref ref="file_info" />
<appender-ref ref="file_error" /> <appender-ref ref="file_error" />
<appender-ref ref="console"/> <appender-ref ref="console"/>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
</root> </root>
<!--系统用户操作日志--> <!--系统用户操作日志-->
<logger name="sys-user" level="debug"> <logger name="sys-user" level="INFO">
<appender-ref ref="sys-user"/> <appender-ref ref="sys-user"/>
<appender-ref ref="console" /> <appender-ref ref="console" />
</logger> </logger>
......
...@@ -26,6 +26,9 @@ public class MybatisPlusConfig ...@@ -26,6 +26,9 @@ public class MybatisPlusConfig
interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());
// 阻断插件 // 阻断插件
interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); interceptor.addInnerInterceptor(blockAttackInnerInterceptor());
// %转意
interceptor.addInnerInterceptor(percentEscapeInterceptor());
return interceptor; return interceptor;
} }
...@@ -57,4 +60,14 @@ public class MybatisPlusConfig ...@@ -57,4 +60,14 @@ public class MybatisPlusConfig
{ {
return new BlockAttackInnerInterceptor(); return new BlockAttackInnerInterceptor();
} }
/**
* %转意
* @return
*/
public PercentEscapeInterceptor percentEscapeInterceptor() {
return new PercentEscapeInterceptor();
}
} }
\ No newline at end of file
package com.ruoyi.framework.config;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import com.ruoyi.common.utils.StringUtils;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;
public class PercentEscapeInterceptor implements InnerInterceptor {
@Override
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
String sql = boundSql.getSql().toLowerCase();
// 判断是否包含 参数 及 like 查询
if (!sql.contains(" like ") || !sql.contains("?")) {
return;
}
// 获取关键字的个数(去重),获取 到 like 查询 的 key
String[] strList = sql.split("\\?");
Set<String> keyNames = new HashSet<>();
for (int i = 0; i < strList.length; i++) {
if (strList[i].toLowerCase().contains(" like ")) {
String keyName = boundSql.getParameterMappings().get(i).getProperty();
keyNames.add(keyName);
}
}
MetaObject metaObject = ms.getConfiguration().newMetaObject(parameter);
for (String keyName : keyNames) {
Object value = metaObject.getValue(keyName);
if (value instanceof String) {
if (isconvert((String) value)) {
metaObject.setValue(keyName, convert((String) value));
}
}
}
}
private String convert(String before) {
if (StringUtils.isNotBlank(before)) {
before = before.replaceAll("\\\\", "");
before = before.replaceAll("_", "\\\\_");
before = before.replaceAll("%", "\\\\%");
}
return before;
}
private boolean isconvert(String str) {
return str.contains("\\") || str.contains("_") || str.contains("%");
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment