diff --git a/haiwei-activiti/src/main/java/com/haiwei/activiti/controller/ExperimentRequestController.java b/haiwei-activiti/src/main/java/com/haiwei/activiti/controller/ExperimentRequestController.java index 3077e0d..96b14ef 100644 --- a/haiwei-activiti/src/main/java/com/haiwei/activiti/controller/ExperimentRequestController.java +++ b/haiwei-activiti/src/main/java/com/haiwei/activiti/controller/ExperimentRequestController.java @@ -185,7 +185,7 @@ public class ExperimentRequestController extends BaseController } /** - * 修改实验申请信息 + * 修改实验申请信息交流内容 */ @GetMapping("/editCommunicationContent/{objid}") public String editCommunicationContent(@PathVariable("objid") Long objid, ModelMap mmap) @@ -197,7 +197,7 @@ public class ExperimentRequestController extends BaseController } /** - * 修改实验申请信息 + * 修改实验申请信息准备工具 */ @GetMapping("/editTools/{objid}") public String editTools(@PathVariable("objid") Long objid, ModelMap mmap) @@ -208,7 +208,9 @@ public class ExperimentRequestController extends BaseController return prefix + "/editTools"; } - + /** + * 修改实验申请信息实验结果 + */ @GetMapping("/editResult/{objid}") public String editResult(@PathVariable("objid") Long objid, ModelMap mmap) { diff --git a/haiwei-activiti/src/main/java/com/haiwei/activiti/service/impl/ExperimentRequestServiceImpl.java b/haiwei-activiti/src/main/java/com/haiwei/activiti/service/impl/ExperimentRequestServiceImpl.java index e592d74..d6d770b 100644 --- a/haiwei-activiti/src/main/java/com/haiwei/activiti/service/impl/ExperimentRequestServiceImpl.java +++ b/haiwei-activiti/src/main/java/com/haiwei/activiti/service/impl/ExperimentRequestServiceImpl.java @@ -56,18 +56,13 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService return experimentRequestMapper.selectExperimentRequestList(experimentRequest); } - /** - * 新增实验申请信息 - * - * @param experimentRequest 实验申请信息 - * @return 结果 - */ + /** * 插入实验请求的方法 * @param experimentRequest 实验请求对象 * @return 插入操作的结果,返回影响的行数 */ - @Transactional + @Transactional( rollbackFor = Exception.class ) @Override public int insertExperimentRequest(ExperimentRequest experimentRequest) { // 设置实验请求的状态为1 @@ -82,8 +77,7 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService int i = experimentRequestMapper.insertExperimentRequest(experimentRequest); // 获取第一个实验请求的主键objId Long obj = experimentRequest.getObjid(); - - + // 创建实验请求关系对象 ExperimentRequestRelation experimentRequestRelation = new ExperimentRequestRelation(); // 设置项目ID为查询到的对象ID @@ -102,9 +96,6 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService - - - /** * 修改实验申请信息 * @@ -121,24 +112,23 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService public int updateExperimentRequest(ExperimentRequest experimentRequest) { // 获取当前用户的主体信息 Subject subject = ShiroUtils.getSubject(); + //获取当前时间 + Date nowDate = DateUtils.getNowDate(); // 创建一个新的实验请求关系对象 ExperimentRequestRelation experimentRequestRelation = new ExperimentRequestRelation(); - // 设置项目ID为实验请求对象的ID experimentRequestRelation.setPojectId(experimentRequest.getObjid()); - // 设置状态为实验请求对象的状态 experimentRequestRelation.setStatus(experimentRequest.getStatus()); // 根据实验请求关系对象查询相关记录列表 List timeList = experimentRequestRelationMapper .selectExperimentRequestRelationList(experimentRequestRelation); - - Date nowDate = DateUtils.getNowDate(); + // 如果查询结果不为空,则进行更新操作 if (!timeList.isEmpty()) { - // 设置更新时间为当前时间 + // 设置更新时间为当前时间,数据库只有更新时间这一个,没有创建时间 experimentRequestRelation.setUpdateTime(nowDate); // 设置对象ID为查询到的第一条记录的对象ID @@ -148,7 +138,7 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService experimentRequestRelationMapper.updateExperimentRequestRelation(experimentRequestRelation); } else { // 如果查询结果为空,则进行插入操作 - // 设置更新时间为当前时间 + // 设置更新时间为当前时间,数据库只有更新时间这一个,没有创建时间 experimentRequestRelation.setUpdateTime(nowDate); // 插入新的实验请求关系记录 @@ -157,7 +147,6 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService // 设置实验请求对象的更新时间为当前时间 experimentRequest.setUpdateTime(nowDate); - // 更新实验请求记录并返回受影响的行数 return experimentRequestMapper.updateExperimentRequest(experimentRequest); } diff --git a/haiwei-activiti/src/main/resources/mapper/activiti/ExperimentRequestMapper.xml b/haiwei-activiti/src/main/resources/mapper/activiti/ExperimentRequestMapper.xml index 5337938..8fc0baf 100644 --- a/haiwei-activiti/src/main/resources/mapper/activiti/ExperimentRequestMapper.xml +++ b/haiwei-activiti/src/main/resources/mapper/activiti/ExperimentRequestMapper.xml @@ -50,6 +50,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where objid = #{objid} + + insert into experiment_request