whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/services/Process_surveyService.java
@@ -1,25 +1,29 @@
package com.fgkj.services;
import com.fgkj.util.*;
import com.fgkj.dto.Process_survey;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_log;
import com.fgkj.mapper.ProcessServerDao;
import com.fgkj.mapper.UinfDaoFactory;
import com.fgkj.mapper.impl.Process_surveyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import com.fgkj.util.ActionUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
public class Process_surveyService {
   @Autowired
   @Resource
   private Process_surveyMapper mapper;
   @Resource
   private User_logService uservice;
   //根据进程名字,将服务是否开启的标识符改为0
   public ServiceModel update(Object obj){
   public ServiceModel update(Process_survey survey){
      ServiceModel model = new ServiceModel();
      boolean bl=mapper.update(obj);
      boolean bl=mapper.update(survey);
      
      if(bl){
         model.setCode(1);
@@ -31,8 +35,10 @@
      return model;
   }
   //界面修改进程名字和超时时间
   public ServiceModel updateAll(Object obj){
   @Transactional
   public ServiceModel updateAll(Process_survey obj){
      ServiceModel model = new ServiceModel();
      System.out.println("obj = " + obj);
      boolean bl=mapper.updateAll(obj);
      if(bl){
         model.setCode(1);
@@ -44,13 +50,25 @@
      return model;
   }
   //界面修改进程同服务对应的标识位
   public ServiceModel updateFlag(Object obj){
   @Transactional
   public ServiceModel updateFlag(Process_survey process) {
      ServiceModel model = new ServiceModel();
      boolean bl=mapper.updateFlag(obj);
      if(bl){
      boolean bl = true;
      try {
         bl = mapper.updateFlag(process) > 0;
      } catch (Exception e) {
         e.printStackTrace();
         model.setCode(0);
         model.setMsg("修改失败!");
         return model;
      }
      if (bl) {
         String msg = "重启" + process.getServerName() + "服务";
         User_log ulog = UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
         uservice.add(ulog);//将用户的操作记录下来
         model.setCode(1);
         model.setMsg("修改成功!");
      }else{
      } else {
         model.setCode(0);
         model.setMsg("修改失败!");
      }