双重预防项目-国泰新华二开定制版
16639036659
2022-10-11 7e8d51b6a2d2892c8eca2c8cefd91f7d1b6f8f40
src/main/java/com/ruoyi/project/tr/baseCheckPoint/controller/BaseCheckPointController.java
@@ -10,6 +10,7 @@
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.doublePrevention.repository.param.PreventPointAndMeasureParams;
import com.ruoyi.doublePrevention.service.RiskService;
import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerInfoService;
import com.ruoyi.project.enumerate.TrEvaluationMethodDetailsEnum;
import com.ruoyi.project.enumerate.TrEvaluationMethodTypeEnum;
import com.ruoyi.project.system.dept.domain.Dept;
@@ -156,19 +157,29 @@
    @Log(title = "基础清单检查点", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    @Transactional
    public AjaxResult addSave(BaseCheckPoint baseCheckPoint)
    {
      //老代码改造
        int result = baseCheckPointService.insertBaseCheckPoint(baseCheckPoint);
        //todo ,此处改造,嵌入管控措施
        //todo-2022 ,此处改造,嵌入管控措施
        baseCheckPoint.getCheckPointId();
        //使用baseCheckPointId进行查询
//        BaseCheckPoint baseCheckPointById = baseCheckPointService.getBaseCheckPointById(baseCheckPoint.getCheckPointId());
        PreventPointAndMeasureParams pointAndMeasureParams = new PreventPointAndMeasureParams();
        //封装参数
        pointAndMeasureParams.setBaseCheckPointId(baseCheckPoint.getCheckPointId());
        pointAndMeasureParams.setControlMeasureId(baseCheckPoint.getControlMeasureId());//todo,该参数页面尚未封装进去
        pointAndMeasureParams.setControlMeasureId(baseCheckPoint.getControlMeasureId());// todo,该参数页面尚未封装进去
        pointAndMeasureParams.setRiskId(baseCheckPoint.getRiskId());
        riskService.insertPointAndMeasure(pointAndMeasureParams);
        int result1 = riskService.insertPointAndMeasure(pointAndMeasureParams);
        if (result1 < 1){
            throw new RuntimeException("新增异常,保存管控措施关系失败");
        }
        return toAjax(result);
    }
@@ -190,19 +201,38 @@
    @Log(title = "基础清单检查点", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    @Transactional
    public AjaxResult editSave(BaseCheckPoint baseCheckPoint)
    {
        return toAjax(baseCheckPointService.updateBaseCheckPoint(baseCheckPoint));
        int result = baseCheckPointService.updateBaseCheckPoint(baseCheckPoint);
        //todo-2022 ,此处改造,修改检查点与管控措施的关系----注,删除点,重加点
//        int result1 = riskService.updatePointAndMeasure(baseCheckPoint);
//        if (result1 < 1){
//            throw new RuntimeException("保存管控措施关系失败");
//        }
        return toAjax(result);
    }
    /**
     * 删除基础清单检查点
     */
    @Transactional
    @Log(title = "基础清单检查点", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(baseCheckPointService.deleteBaseCheckPointByIds(ids));
        //老代码
        int result = baseCheckPointService.deleteBaseCheckPointByIds(ids);
        //todo-2022 ,此处改造,删除检查点与管控措施的关系
        int result1 = riskService.deletePointAndMeasure(ids);
        if (result1 < 1){
            throw new RuntimeException("新增异常,保存管控措施关系失败");
        }
        return toAjax(result);
    }
}