Commit 65b467da authored by 王飞's avatar 王飞

Merge branch 'dev' into wangfei

parents f21f5f23 a602cf86
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 车企信息对象 t_automobile_enterprise
*
* @author gxk
* @date 2024-01-05
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "车企信息对象")
@TableName(value ="t_automobile_enterprise")
public class AutomobileEnterprise extends BaseEntity
{
/** 主键 */
@ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
/** 企业名称 */
@Excel(name = "企业名称")
@ApiModelProperty("企业名称")
private String enterpriseName;
/** 地址 */
@Excel(name = "地址")
@ApiModelProperty("地址")
private String address;
/** 邮编 */
@Excel(name = "邮编")
@ApiModelProperty("邮编")
private String postcode;
/** 企业联系人 */
@Excel(name = "企业联系人")
@ApiModelProperty("企业联系人")
private String enterpriseContact;
/** 联系电话 */
@Excel(name = "联系电话")
@ApiModelProperty("联系电话")
private String contactNumber;
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -54,4 +55,22 @@ public class ReviewDetailsResult implements Serializable {
@ApiModelProperty("关联的任务id")
private Long taskId;
}
\ No newline at end of file
/**
* 审核人id
*/
@ApiModelProperty("审核人id")
private Long userId;
/**
* 审核人姓名
*/
@ApiModelProperty("审核人姓名")
private String userName;
/**
* 最后修改时间
*/
@ApiModelProperty("最后修改时间")
private Date lastModifyTime;
}
......@@ -133,4 +133,14 @@ public class SystemReviewTask {
*/
private String file;
/**
* 提交人id
*/
private Long submitById;
/**
* 提交人姓名
*/
private String submitByName;
}
package com.ruoyi.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.AutomobileEnterprise;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
import org.springframework.stereotype.Repository;
/**
* 车企信息Mapper接口
*
* @author gxk
* @date 2024-01-05
*/
@Repository
public interface AutomobileEnterpriseMapper extends BaseMapper<AutomobileEnterprise>
{
/**
* 查询车企信息
*
* @param id 车企信息主键
* @return 车企信息
*/
public AutomobileEnterprise selectAutomobileEnterpriseById(Long id);
/**
* 查询车企信息列表
*
* @param automobileEnterprise 车企信息
* @return 车企信息集合
*/
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request);
/**
* 新增车企信息
*
* @param automobileEnterprise 车企信息
* @return 结果
*/
public int insertAutomobileEnterprise(AutomobileEnterprise automobileEnterprise);
/**
* 修改车企信息
*
* @param automobileEnterprise 车企信息
* @return 结果
*/
public int updateAutomobileEnterprise(AutomobileEnterprise automobileEnterprise);
}
......@@ -11,4 +11,11 @@ import java.util.List;
@Repository
public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
List<ReviewDetails> findByKeyPointList(@Param("reviewKeyPointList") List<ReviewKeyPoint> reviewKeyPointList);
/**
* 根据任务id查询没有回答细则的数量
* @param taskId
* @return
*/
List<ReviewDetails> findNoResult(@Param("taskId") Long taskId);
}
......@@ -17,6 +17,15 @@ import java.util.List;
public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResult> {
List<ReviewDetailsResult> findByTaskId(@Param("taskId") Long taskId);
ReviewDetailsResult findByTaskIdAndDetailsId(@Param("taskId") Long taskId,@Param("reviewDetailsId") Long reviewDetailsId);
/**
* 根据任务id查询不通过的数量
* @param taskId
* @return
*/
Long findNotPass(@Param("taskId") Long taskId);
}
......
......@@ -13,4 +13,7 @@ public interface StandardMapper extends BaseMapper<Standard> {
// 分页查询
List<Standard> findList(@Param("params") StandardListRequest request);
// 根据id查询
Standard findListById(@Param("id") Long Id);
}
......@@ -10,4 +10,7 @@ import java.util.List;
@Repository
public interface SystemReviewTaskMapper extends BaseMapper<SystemReviewTask> {
List<SystemReviewTask> findListByStatus(@Param("status") String status);
// 查询处理中的任务
List<SystemReviewTask> findListInProcess();
}
package com.ruoyi.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.AutomobileEnterprise;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
/**
* @author gxk
*/
public interface AutomobileEnterpriseService extends IService<AutomobileEnterprise>
{
/**
* 查询车企信息
*
* @param id 车企信息主键
* @return 车企信息
*/
public AutomobileEnterprise selectAutomobileEnterpriseById(Long id);
/**
* 查询车企信息列表
*
* @param request 车企信息
* @return 车企信息集合
*/
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request);
/**
* 新增车企信息
*
* @param automobileEnterprise 车企信息
* @return 结果
*/
public int insertAutomobileEnterprise(AutomobileEnterprise automobileEnterprise);
/**
* 修改车企信息
*
* @param automobileEnterprise 车企信息
* @return 结果
*/
public int updateAutomobileEnterprise(AutomobileEnterprise automobileEnterprise);
}
......@@ -2,6 +2,7 @@ package com.ruoyi.service;
import com.ruoyi.domain.ReviewDetailsResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
import java.util.List;
......@@ -14,4 +15,8 @@ public interface ReviewDetailsResultService extends IService<ReviewDetailsResult
List<ReviewDetailsResult> findByTaskId(Long taskId);
ReviewDetailsResult findByTaskIdAndDetailsId(Long taskId, Long reviewDetailsId);
void save(ReviewDetailsResultSaveRequest request);
}
......@@ -13,4 +13,7 @@ public interface StandardService extends IService<Standard> {
// 分页查询
List<Standard> findList(StandardListRequest request);
//根据id查询
Standard findListById(Long id);
}
......@@ -4,6 +4,7 @@ import com.ruoyi.domain.SystemReviewTask;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskSubmitRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import java.util.List;
......@@ -40,4 +41,16 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> {
*/
List<SystemReviewTask> findListByStatus(String status);
/**
* 查询处理中的任务
* @return
*/
List<SystemReviewTask> findListInProcess();
/**
* 提交审查问卷
* @param request
*/
void submit(SystemReviewTaskSubmitRequest request);
}
package com.ruoyi.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.AutomobileEnterpriseMapper;
import com.ruoyi.domain.AutomobileEnterprise;
import com.ruoyi.service.AutomobileEnterpriseService;
import org.springframework.transaction.annotation.Transactional;
/**
* 车企信息Service业务层处理
*
* @author gxk
* @date 2024-01-05
*/
@Service
@Transactional
public class AutomobileEnterpriseServiceImpl extends ServiceImpl<AutomobileEnterpriseMapper, AutomobileEnterprise> implements AutomobileEnterpriseService
{
@Autowired
private AutomobileEnterpriseMapper automobileEnterpriseMapper;
/**
* 查询车企信息
*
* @param id 车企信息主键
* @return 车企信息
*/
@Override
public AutomobileEnterprise selectAutomobileEnterpriseById(Long id)
{
return automobileEnterpriseMapper.selectAutomobileEnterpriseById(id);
}
/**
* 查询车企信息列表
*
* @param request 车企信息
* @return 车企信息
*/
@Override
public List<AutomobileEnterprise> selectAutomobileEnterpriseList(AutomobileEnterpriseListRequest request)
{
return automobileEnterpriseMapper.selectAutomobileEnterpriseList(request);
}
/**
* 新增车企信息
*
* @param automobileEnterprise 车企信息
* @return 结果
*/
@Override
public int insertAutomobileEnterprise(AutomobileEnterprise automobileEnterprise)
{
automobileEnterprise.setCreateTime(DateUtils.getNowDate());
automobileEnterprise.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.insert(automobileEnterprise);
}
/**
* 修改车企信息
*
* @param automobileEnterprise 车企信息
* @return 结果
*/
@Override
public int updateAutomobileEnterprise(AutomobileEnterprise automobileEnterprise)
{
automobileEnterprise.setUpdateTime(DateUtils.getNowDate());
automobileEnterprise.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
return automobileEnterpriseMapper.updateAutomobileEnterprise(automobileEnterprise);
}
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
......@@ -26,6 +30,39 @@ public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsRes
public List<ReviewDetailsResult> findByTaskId(Long taskId) {
return reviewDetailsResultMapper.findByTaskId(taskId);
}
@Override
public ReviewDetailsResult findByTaskIdAndDetailsId(Long taskId, Long reviewDetailsId) {
return reviewDetailsResultMapper.findByTaskIdAndDetailsId(taskId, reviewDetailsId);
}
@Override
public void save(ReviewDetailsResultSaveRequest request) {
ReviewDetailsResult result = reviewDetailsResultMapper.findByTaskIdAndDetailsId(request.getTaskId(), request.getReviewDetailsId());
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
if (result != null) {
// 更新
result.setPassed(request.getPassed());
result.setUserId(loginUser.getUserId());
result.setUserName(loginUser.getNickName());
result.setLastModifyTime(new Date());
this.baseMapper.updateById(result);
} else {
// 新增
ReviewDetailsResult reviewDetailsResult = new ReviewDetailsResult();
reviewDetailsResult.setTaskId(request.getTaskId());
reviewDetailsResult.setReviewDetailsId(request.getReviewDetailsId());
reviewDetailsResult.setPassed(request.getPassed());
reviewDetailsResult.setUserId(loginUser.getUserId());
reviewDetailsResult.setUserName(loginUser.getNickName());
reviewDetailsResult.setLastModifyTime(new Date());
this.baseMapper.insert(reviewDetailsResult);
}
}
}
......
......@@ -25,4 +25,14 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
public List<Standard> findList(StandardListRequest request) {
return standardMapper.findList(request);
}
/**
* 根据id查询
* @param id
* @return
*/
@Override
public Standard findListById(Long id) {
return standardMapper.findListById(id);
}
}
package com.ruoyi.service.impl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
......@@ -32,6 +35,10 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired
private SystemReviewTaskMapper systemReviewTaskMapper;
@Autowired
private ReviewDetailsResultMapper reviewDetailsResultMapper;
@Override
public void doStart(SystemReviewTask systemReviewTask) {
throw new ServiceException("不能开始一个已经开始的任务", HttpStatus.ERROR);
......@@ -41,11 +48,33 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
public void doSubmit(SystemReviewTask systemReviewTask) {
// TODO
// 1. 获取最新问卷
List<ReviewStandard> standardTree = reviewStandardService.findTree(systemReviewTask.getStandardId(), ReviewStandard.TYPE_SYSTEM);
// 2. 所有细则必须有对应答案
// 3. 答案的 id + text 必须与细则对应的答案一致
// 4. 将最终问卷归档到 standard 字段
// 5. 填充task_end_time
// 6. 修改任务状态为 FINISH
List<ReviewDetailsResult> results = reviewDetailsResultService.findByTaskId(systemReviewTask.getId());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult(standardTree, results);
systemReviewTask.setStandard(standardTree);
// 4. 填充task_end_time
systemReviewTask.setTaskEndTime(new Date());
// 5. 修改任务状态为 FINISH
systemReviewTask.setTaskStatus(SystemReviewTask.STATUS_FINISH);
// 6. 填写当前用户id
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
systemReviewTask.setSubmitById(loginUser.getUserId());
systemReviewTask.setSubmitByName(loginUser.getNickName());
// 7. 设置问卷结果
if (reviewDetailsResultMapper.findNotPass(systemReviewTask.getId()) > 0) {
systemReviewTask.setTaskResult("REJECT");
} else {
systemReviewTask.setTaskResult("PASS");
}
systemReviewTaskMapper.updateById(systemReviewTask);
}
@Override
......
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.*;
import com.ruoyi.mapper.ReviewDetailsMapper;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.mapper.SystemReviewTaskMapper;
import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskSubmitRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -42,6 +47,12 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Autowired
private ISysUserService sysUserService;
@Autowired
private StandardService standardService;
@Autowired
private ReviewDetailsMapper reviewDetailsMapper;
@Override
public void createTaskTest(SystemReviewTaskCreateRequest request) {
......@@ -49,6 +60,7 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
// 构建任务创建者
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser initiator = sysUserService.selectUserById(loginUser.getUserId());
Standard standard = standardService.findListById(request.getStandardId());
// 找到审查组长
SystemReviewTaskUserRelation leader = null;
......@@ -69,7 +81,11 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
.setBizInfo(request.getBizInfo())
.setLeaderId(leader.getUserId())
.setLeader(leader.getName())
.setCreateTime(new Date());
.setCreateTime(new Date())
.setStandardId(standard.getId())
.setName(standard.getName())
.setStandardNo(standard.getStandardNo())
.setFile(standard.getFile());
systemReviewTaskService.save(task);
......@@ -98,6 +114,22 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
return systemReviewTaskMapper.findListByStatus(status);
}
@Override
public List<SystemReviewTask> findListInProcess() {
return systemReviewTaskMapper.findListInProcess();
}
@Override
public void submit(SystemReviewTaskSubmitRequest request) {
List<ReviewDetails> detailsList = reviewDetailsMapper.findNoResult(request.getTaskId());
if (detailsList != null) {
throw new ServiceException("存在未填写的问卷,请填写完整", HttpStatus.ERROR, detailsList);
} else {
SystemReviewTask systemReviewTask = systemReviewTaskService.getById(request.getTaskId());
strategySystemReviewTaskContext.getResource(systemReviewTask.getTaskStatus()).doSubmit(systemReviewTask);
}
}
}
......
package com.ruoyi.web;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.web.request.AutomobileEnterpriseEditRequest;
import com.ruoyi.web.request.AutomobileEnterpriseGetInfoRequest;
import com.ruoyi.web.request.AutomobileEnterpriseListRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.AutomobileEnterprise;
import com.ruoyi.service.AutomobileEnterpriseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 车企信息Controller
*
* @author gxk
* @date 2024-01-05
*/
@Api(tags = {"车企信息"})
@RestController
@RequestMapping("/system/enterprise")
public class AutomobileEnterpriseController extends BaseController
{
@Autowired
private AutomobileEnterpriseService automobileEnterpriseService;
/**
* 查询车企信息列表
*/
@ApiOperation("分页查询车企信息列表")
@PostMapping("/list")
public TableDataInfo<AutomobileEnterprise> list(@Validated @RequestBody AutomobileEnterpriseListRequest request)
{
startPage();
List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request);
return getDataTable(list);
}
/**
* 导出车企信息列表
*/
@Log(title = "车企信息", businessType = BusinessType.EXPORT)
@ApiOperation("导出车企信息列表")
@PostMapping("/export")
public void export(HttpServletResponse response, AutomobileEnterpriseListRequest request)
{
List<AutomobileEnterprise> list = automobileEnterpriseService.selectAutomobileEnterpriseList(request);
ExcelUtil<AutomobileEnterprise> util = new ExcelUtil<AutomobileEnterprise>(AutomobileEnterprise.class);
util.exportExcel(response, list, "车企信息数据");
}
/**
* 获取车企信息详细信息
*/
@ApiOperation("获取车企信息详细信息")
@PostMapping("/getById")
public R<AutomobileEnterprise> getInfo(@Validated @RequestBody AutomobileEnterpriseGetInfoRequest request)
{
return R.ok(automobileEnterpriseService.selectAutomobileEnterpriseById(request.getId()));
}
/**
* 新增车企信息
*/
@ApiOperation("新增车企信息")
@Log(title = "车企信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
public R<Integer> add(@Validated @RequestBody AutomobileEnterprise automobileEnterprise)
{
return R.ok(automobileEnterpriseService.insertAutomobileEnterprise(automobileEnterprise));
}
/**
* 修改车企信息
*/
@ApiOperation("修改车企信息")
@Log(title = "车企信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public R<Integer> edit(@Validated @RequestBody AutomobileEnterprise automobileEnterprise)
{
return R.ok(automobileEnterpriseService.updateAutomobileEnterprise(automobileEnterprise));
}
/**
* 删除车企信息
*/
@ApiOperation("删除车企信息")
@Log(title = "车企信息", businessType = BusinessType.DELETE)
@PostMapping("/remove")
public R<Boolean> remove(@Validated @RequestBody AutomobileEnterpriseEditRequest request)
{
return R.ok(automobileEnterpriseService.removeBatchByIds(Arrays.asList(request.getIds())));
}
}
package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
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("审查细则的审查结果")
@RestController
@RequestMapping("/review/details/result")
public class ReviewDetailsResultController extends BaseController {
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@ApiOperation("保存审查结果")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "保存审查结果", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/save")
public R<String> save(@Validated @RequestBody ReviewDetailsResultSaveRequest request) {
reviewDetailsResultService.save(request);
return R.ok();
}
}
......@@ -4,11 +4,11 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.SystemReviewTask;
import com.ruoyi.service.SystemReviewTaskService;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskViewRequest;
import com.ruoyi.web.request.*;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -22,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@Api("体系审查任务")
@RestController
@RequestMapping("/system/review/task")
......@@ -57,4 +60,31 @@ public class SystemReviewTaskController extends BaseController {
systemReviewTaskService.start(request);
return R.ok();
}
@ApiOperation("提交审查问卷")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/submit")
public R<String> submit(@Validated @RequestBody SystemReviewTaskSubmitRequest request) {
systemReviewTaskService.submit(request);
return R.ok();
}
@ApiOperation("查询处理中的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findInProcess")
public TableDataInfo<SystemReviewTask> findInProcess(@Validated @RequestBody SystemReviewTaskFindInProcessRequest request) {
startPage(request);
return getDataTable(systemReviewTaskService.findListInProcess());
}
@ApiOperation("查询处理完成的任务")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/findInFinish")
public TableDataInfo<SystemReviewTask> findInFinish(@Validated @RequestBody SystemReviewTaskFindFinishRequest request) {
startPage(request);
return getDataTable(systemReviewTaskService.findListByStatus(SystemReviewTask.STATUS_FINISH));
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 车企信息DTO
* @author gxk
*/
@Data
@ApiModel
public class AutomobileEnterpriseEditRequest {
@ApiModelProperty("车企ID集合")
private Long[] ids;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 获取车企信息详细信息DTO
* @author gxk
*/
@Data
@ApiModel
public class AutomobileEnterpriseGetInfoRequest {
@ApiModelProperty("ID")
private Long id;
}
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;
/**
* 车企信息分页查询DTO
* @author gxk
*/
@Data
@ApiModel
public class AutomobileEnterpriseListRequest extends PageDomain {
/** 企业名称 */
@ApiModelProperty("企业名称")
private String enterpriseName;
/** 地址 */
@ApiModelProperty("地址")
private String address;
/** 邮编 */
@ApiModelProperty("邮编")
private String postcode;
/** 企业联系人 */
@ApiModelProperty("企业联系人")
private String enterpriseContact;
/** 联系电话 */
@ApiModelProperty("联系电话")
private String contactNumber;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "ReviewDetailsResultSaveRequest", description = "保存审查细则的审查结果")
@Data
public class ReviewDetailsResultSaveRequest {
/**
* 关联到的细则id
*/
@ApiModelProperty("关联到的细则id")
private Long reviewDetailsId;
/**
* 关联的任务id
*/
@ApiModelProperty("关联的任务id")
private Long taskId;
/**
* 审核是否通过(0未通过、1通过)
*/
@ApiModelProperty("审核是否通过(0未通过、1通过)")
private Integer passed;
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class SystemReviewTaskFindFinishRequest extends PageDomain {
}
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class SystemReviewTaskFindInProcessRequest extends PageDomain {
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "SystemReviewTaskSubmitRequest", description = "提交体系审查问卷")
@Data
public class SystemReviewTaskSubmitRequest {
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("图片地址")
private String imagesUrl;
}
<?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.ruoyi.mapper.AutomobileEnterpriseMapper">
<resultMap type="com.ruoyi.domain.AutomobileEnterprise" id="AutomobileEnterpriseResult">
<result property="id" column="id"/>
<result property="enterpriseName" column="enterprise_name"/>
<result property="address" column="address"/>
<result property="postcode" column="postcode"/>
<result property="enterpriseContact" column="enterprise_contact"/>
<result property="contactNumber" column="contact_number"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="deleted" column="deleted"/>
</resultMap>
<sql id="selectAutomobileEnterpriseVo">
select id,
enterprise_name,
address,
postcode,
enterprise_contact,
contact_number,
create_by,
create_time,
update_by,
update_time,
deleted
from t_automobile_enterprise
</sql>
<select id="selectAutomobileEnterpriseList" parameterType="com.ruoyi.domain.AutomobileEnterprise"
resultMap="AutomobileEnterpriseResult">
<include refid="selectAutomobileEnterpriseVo"/>
<where>
deleted = 0
<if test="enterpriseName != null and enterpriseName != ''">and enterprise_name like concat('%',
#{enterpriseName}, '%')
</if>
<if test="address != null and address != ''">and address like concat('%', #{address}, '%')</if>
<if test="postcode != null and postcode != ''">and postcode like concat('%', #{postcode}, '%')</if>
<if test="enterpriseContact != null and enterpriseContact != ''">
and enterprise_contact like concat('%', #{enterpriseContact}, '%')
</if>
<if test="contactNumber != null and contactNumber != ''">and contact_number like('%', #{contactNumber}, '%')</if>
</where>
</select>
<select id="selectAutomobileEnterpriseById" parameterType="Long" resultMap="AutomobileEnterpriseResult">
<include refid="selectAutomobileEnterpriseVo"/>
where id = #{id}
</select>
<insert id="insertAutomobileEnterprise" parameterType="com.ruoyi.domain.AutomobileEnterprise">
insert into t_automobile_enterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="enterpriseName != null">enterprise_name,</if>
<if test="address != null">address,</if>
<if test="postcode != null">postcode,</if>
<if test="enterpriseContact != null">enterprise_contact,</if>
<if test="contactNumber != null">contact_number,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="enterpriseName != null">#{enterpriseName},</if>
<if test="address != null">#{address},</if>
<if test="postcode != null">#{postcode},</if>
<if test="enterpriseContact != null">#{enterpriseContact},</if>
<if test="contactNumber != null">#{contactNumber},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateAutomobileEnterprise" parameterType="com.ruoyi.domain.AutomobileEnterprise">
update t_automobile_enterprise
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
<if test="address != null">address = #{address},</if>
<if test="postcode != null">postcode = #{postcode},</if>
<if test="enterpriseContact != null">enterprise_contact = #{enterpriseContact},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
</mapper>
......@@ -13,4 +13,8 @@
</foreach>
</select>
<select id="findNoResult" resultType="com.ruoyi.domain.ReviewDetails">
SELECT * FROM t_review_details WHERE id NOT IN (SELECT review_details_id FROM t_review_details_result WHERE task_id = #{taskId})
</select>
</mapper>
......@@ -21,4 +21,16 @@
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id FROM t_review_details_result WHERE task_id = #{taskId}
</select>
<select id="findByTaskIdAndDetailsId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id
FROM t_review_details_result
WHERE task_id = #{taskId} and review_details_id = #{reviewDetailsId}
</select>
<select id="findNotPass" resultType="long">
SELECT COUNT(*) sum FROM t_review_details_result
WHERE passed = 0 AND task_id = #{taskId}
</select>
</mapper>
......@@ -24,4 +24,9 @@
</where>
</select>
<select id="findListById" resultMap="BaseResultMap">
SELECT id, name, standard_no, file
FROM t_standard WHERE id = #{id}
</select>
</mapper>
......@@ -20,11 +20,20 @@
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="standardNo" column="standard_no" jdbcType="VARCHAR"/>
<result property="file" column="file" jdbcType="VARCHAR"/>
<result property="submitById" column="submit_by_id" jdbcType="BIGINT"/>
<result property="submitByName" column="submit_by_name" jdbcType="VARCHAR"/>
</resultMap>
<select id="findListByStatus" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file, submit_by_id, submit_by_name
FROM t_system_review_task WHERE task_status = #{status}
ORDER BY create_time DESC
</select>
<select id="findListInProcess" resultMap="BaseResultMap">
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, biz_info, create_time, standard_id, name, standard_no, file, submit_by_id, submit_by_name
FROM t_system_review_task WHERE task_status IN ('NEW','PENDING')
ORDER BY create_time DESC
</select>
</mapper>
......@@ -170,6 +170,11 @@ public class AjaxResult extends HashMap<String, Object>
return new AjaxResult(code, msg, null);
}
public static AjaxResult error(int code, String msg, Object data)
{
return new AjaxResult(code, msg, data);
}
/**
* 是否为成功消息
*
......
......@@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
/**
* Entity基类
*
*
* @author ruoyi
*/
public class BaseEntity implements Serializable
......@@ -38,7 +38,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
@TableField(fill = FieldFill.UPDATE)
private Date updateTime;
/** 备注 */
......
......@@ -19,7 +19,7 @@ import com.ruoyi.common.utils.StringUtils;
/**
* 全局异常处理器
*
*
* @author ruoyi
*/
@RestControllerAdvice
......@@ -60,7 +60,7 @@ public class GlobalExceptionHandler
Integer code = e.getCode();
Object data = e.getData();
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage(), data == null ? null : data);
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage(), data == null ? null : data) : AjaxResult.error(e.getMessage(), data == null ? null : data);
}
/**
......
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