|
|
@@ -3,11 +3,12 @@ package com.railway.business.safetool.service.impl;
|
|
|
import com.railway.business.safetool.domain.SecExperiment;
|
|
|
import com.railway.business.safetool.domain.SecExperimentTool;
|
|
|
import com.railway.business.safetool.domain.vo.SecExpAddParmVo;
|
|
|
-import com.railway.business.safetool.domain.vo.SecExpDetailVo;
|
|
|
import com.railway.business.safetool.domain.vo.SecExpEndParmVo;
|
|
|
+import com.railway.business.safetool.domain.vo.SecExpInfoVo;
|
|
|
import com.railway.business.safetool.domain.vo.SecExpListParmVo;
|
|
|
import com.railway.business.safetool.domain.vo.SecExpListVo;
|
|
|
import com.railway.business.safetool.domain.vo.SecExpNQParmVo;
|
|
|
+import com.railway.business.safetool.domain.vo.SecExpToolsVo;
|
|
|
import com.railway.business.safetool.mapper.SecExperimentMapper;
|
|
|
import com.railway.business.safetool.mapper.SecExperimentToolMapper;
|
|
|
import com.railway.business.safetool.mapper.SecScheduledMapper;
|
|
|
@@ -18,106 +19,107 @@ import java.util.List;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
/**
|
|
|
-* 送检记录表
|
|
|
-* @author lijie
|
|
|
-* @date 2021/12/25
|
|
|
-*/
|
|
|
+ * 送检记录表
|
|
|
+ *
|
|
|
+ * @author lijie
|
|
|
+ * @date 2021/12/25
|
|
|
+ */
|
|
|
@Service
|
|
|
public class SecExperimentServiceImpl implements ISecExperimentService {
|
|
|
|
|
|
- private final SecScheduledMapper scheduledMapper;
|
|
|
- private final SecExperimentMapper secExperimentMapper;
|
|
|
- private final SecExperimentToolMapper secExperimentToolMapper;
|
|
|
-
|
|
|
- public SecExperimentServiceImpl(
|
|
|
- SecScheduledMapper scheduledMapper,
|
|
|
- SecExperimentMapper secExperimentMapper,
|
|
|
- SecExperimentToolMapper secExperimentToolMapper) {
|
|
|
- this.scheduledMapper = scheduledMapper;
|
|
|
- this.secExperimentMapper = secExperimentMapper;
|
|
|
- this.secExperimentToolMapper = secExperimentToolMapper;
|
|
|
- }
|
|
|
+ private final SecScheduledMapper scheduledMapper;
|
|
|
+ private final SecExperimentMapper secExperimentMapper;
|
|
|
+ private final SecExperimentToolMapper secExperimentToolMapper;
|
|
|
|
|
|
- /**
|
|
|
- * 新增
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public int create(SecExpAddParmVo secExpAddParmVo) {
|
|
|
- secExpAddParmVo.setCreateby(SecurityUtils.getUsername());
|
|
|
- int r = secExperimentMapper.insertExp(secExpAddParmVo);
|
|
|
+ public SecExperimentServiceImpl(
|
|
|
+ SecScheduledMapper scheduledMapper,
|
|
|
+ SecExperimentMapper secExperimentMapper,
|
|
|
+ SecExperimentToolMapper secExperimentToolMapper) {
|
|
|
+ this.scheduledMapper = scheduledMapper;
|
|
|
+ this.secExperimentMapper = secExperimentMapper;
|
|
|
+ this.secExperimentToolMapper = secExperimentToolMapper;
|
|
|
+ }
|
|
|
|
|
|
- if(r>0){
|
|
|
- String secid = secExpAddParmVo.getSecid();
|
|
|
- String expid = secExpAddParmVo.getId();
|
|
|
- String createby = SecurityUtils.getUsername();
|
|
|
- secExperimentMapper.insertTool(secid,expid,createby);
|
|
|
- }
|
|
|
- //设置已送检状态
|
|
|
- if(r>0){
|
|
|
- r =scheduledMapper.updateScheduled(secExpAddParmVo.getSecid(),"1");
|
|
|
- }
|
|
|
- return r;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int create(SecExpAddParmVo secExpAddParmVo) {
|
|
|
+ secExpAddParmVo.setCreateby(SecurityUtils.getUsername());
|
|
|
+ int r = secExperimentMapper.insertExp(secExpAddParmVo);
|
|
|
|
|
|
+ if (r > 0) {
|
|
|
+ String secid = secExpAddParmVo.getSecid();
|
|
|
+ String expid = secExpAddParmVo.getId();
|
|
|
+ String createby = SecurityUtils.getUsername();
|
|
|
+ secExperimentMapper.insertTool(secid, expid, createby);
|
|
|
+ }
|
|
|
+ //设置已送检状态
|
|
|
+ if (r > 0) {
|
|
|
+ r = scheduledMapper.updateScheduled(secExpAddParmVo.getSecid(), "1");
|
|
|
+ }
|
|
|
+ return r;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 更新
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public int update(SecExpEndParmVo p) {
|
|
|
- SecExperiment secExperiment = new SecExperiment();
|
|
|
- BeanUtils.copyProperties(p,secExperiment);
|
|
|
- secExperiment.setState("1");
|
|
|
- secExperiment.setExpDate(new Date());
|
|
|
- secExperiment.setUpdateTime(new Date());
|
|
|
- secExperiment.setUpdateBy(SecurityUtils.getUsername());
|
|
|
- int r = secExperimentMapper.update(secExperiment);
|
|
|
- if(r>0){
|
|
|
- //设置待送检状态
|
|
|
- r =secExperimentMapper.updateScheduled(secExperiment.getId(),"0");
|
|
|
- }
|
|
|
- return r;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 更新
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int update(SecExpEndParmVo p) {
|
|
|
+ SecExperiment secExperiment = new SecExperiment();
|
|
|
+ BeanUtils.copyProperties(p, secExperiment);
|
|
|
+ secExperiment.setState("1");
|
|
|
+ secExperiment.setExpDate(new Date());
|
|
|
+ secExperiment.setUpdateTime(new Date());
|
|
|
+ secExperiment.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ int r = secExperimentMapper.update(secExperiment);
|
|
|
+ if (r > 0) {
|
|
|
+ //设置待送检状态
|
|
|
+ r = secExperimentMapper.updateScheduled(secExperiment.getId(), "0");
|
|
|
+ }
|
|
|
+ return r;
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 设置安全工具
|
|
|
- * @param p 设置参数
|
|
|
- * @return 设置结果
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public int nq(SecExpNQParmVo p) {
|
|
|
- SecExperimentTool set = new SecExperimentTool();
|
|
|
- BeanUtils.copyProperties(p,set);
|
|
|
- set.setUpdateTime(new Date());
|
|
|
- set.setUpdateBy(SecurityUtils.getUsername());
|
|
|
- return secExperimentToolMapper.update(set);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 获取单个
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<SecExpDetailVo> getInfo(String id) {
|
|
|
+ /**
|
|
|
+ * 设置安全工具
|
|
|
+ *
|
|
|
+ * @param p 设置参数
|
|
|
+ * @return 设置结果
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int nq(SecExpNQParmVo p) {
|
|
|
+ SecExperimentTool set = new SecExperimentTool();
|
|
|
+ BeanUtils.copyProperties(p, set);
|
|
|
+ set.setUpdateTime(new Date());
|
|
|
+ set.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ return secExperimentToolMapper.update(set);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取单个
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public SecExpInfoVo getInfo(String id) {
|
|
|
|
|
|
- List<SecExpDetailVo> r = secExperimentMapper.getInfo(id);
|
|
|
- r.forEach( vo->
|
|
|
- vo.setC(vo.getBaseSafetyTools().size()+"")
|
|
|
- );
|
|
|
- return r;
|
|
|
+ SecExpInfoVo r = secExperimentMapper.getInfo(id);
|
|
|
+ List<SecExpToolsVo> baseSafetyTools = secExperimentMapper.listSafetyTools(id);
|
|
|
+ r.setBaseSafetyTools(baseSafetyTools);
|
|
|
+ return r;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 查询列表
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<SecExpListVo> getList(SecExpListParmVo parm) {
|
|
|
- parm.setDeptId(SecurityUtils.getLoginUser().getDeptId());
|
|
|
- return secExperimentMapper.getList(parm);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 查询列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<SecExpListVo> getList(SecExpListParmVo parm) {
|
|
|
+ parm.setDeptId(SecurityUtils.getLoginUser().getDeptId());
|
|
|
+ return secExperimentMapper.getList(parm);
|
|
|
+ }
|
|
|
}
|