whycrzh
2021-01-22 681f7e5160e01532964fac73f857c9fc4b0ce538
update battInf.ip
4个文件已修改
62 ■■■■ 已修改文件
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/Database_backupMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/BattInfServices.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java
@@ -38,7 +38,8 @@
    public int update(BattInf obj);
    //修改电池信息配置(ip地址,掩码和网关)
    public boolean updateIp(Object obj);
    @Update("update db_battinf.tb_battinf set FbsDeviceIp=#{fbsDeviceIp},FbsDeviceIp_YM=#{fbsDeviceIp_YM},FbsDeviceIp_WG=#{fbsDeviceIp_WG} where FbsDeviceId=#{fbsDeviceId}")
    public int updateIp(BattInf obj);
    
    //删除电池组(多个)
    @Delete("delete from db_battinf.tb_battinf where battgroupid=#{battGroupId}")
src/main/java/com/fgkj/mapper/impl/Database_backupMapper.java
@@ -40,6 +40,8 @@
    
    //查询个数
    public int searchNum(Database_backup obj);
    @Update("update web_site.tb_database_backup set backup_en =1 where table_name=#{table_name}")
    int updateBackupEn(String table_name);
}
src/main/java/com/fgkj/services/BattInfServices.java
@@ -1,22 +1,31 @@
package com.fgkj.services;
import ch.qos.logback.core.db.dialect.DBUtil;
import com.fgkj.db.DBUtil1;
import com.fgkj.dto.*;
import com.fgkj.mapper.BattTestData;
import com.fgkj.mapper.BattinfGroupFactory;
import com.fgkj.mapper.ProcessServerDao;
import com.fgkj.mapper.UinfDaoFactory;
import com.fgkj.mapper.*;
import com.fgkj.mapper.impl.BattInfMapper;
import com.fgkj.mapper.impl.Database_backupMapper;
import com.fgkj.mapper.impl.Process_surveyMapper;
import com.fgkj.mapper.impl.ram.Fbs9100_setparamMapper;
import com.fgkj.services.ram.Fbs9100_setparamService;
import com.fgkj.util.ActionUtil;
import com.fgkj.util.DateUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Priority;
import javax.annotation.Resource;
import java.lang.annotation.Target;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -28,6 +37,8 @@
    ServiceModel model = new ServiceModel();
    @Resource
    private Fbs9100_setparamService fbs9100_setparamService;
    @Resource
    private BattInfMapper mapper;
@@ -100,9 +111,7 @@
            for (int i = 0; i < list.size(); i++) {
                BattInf binf = list.get(i);
//                System.out.println("binf = " + binf);
                if (mapper.update(binf)>0) {
                    flag = true;
                }else{
                if (!(mapper.update(binf)>0)) {
                    flag = false;
                }
                {
@@ -111,7 +120,7 @@
                    uservice.add(ulog);//将用户的操作记录下来
                }
            }
        } else {
        }else{
            flag = false;
        }
        if (flag) {
@@ -126,12 +135,17 @@
        }
        return model;
    }
    @Resource
    private Database_backupMapper backupmapper;
    //修改电池信息配置(ip地址,掩码和网关)
    public ServiceModel updateIp(Object obj) {
        BattInf binf=(BattInf) obj;
        boolean b=mapper.updateIp(obj);
    public ServiceModel updateIp(BattInf binf) {
        //更新数据库备份标志表的标志
        boolean flag = backupmapper.updateBackupEn("tb_battinf") > 0;
        boolean b=mapper.updateIp(binf)>0;
        if(b){
            boolean bl=fbs9100SetParamMapper.sendCmdToFBS9100Dev(binf.getNum(),0, binf.getFbsDeviceId());
            boolean bl = fbs9100_setparamService.sendCmdToFBS9100Dev(binf.getNum(), 0, binf.getFbsDeviceId());
            if(bl){
                //将6185的服务设为重启
                Process_survey process=new Process_survey();
@@ -155,6 +169,7 @@
        //System.out.println(model);
        return model;
    }
    //删除电池组
    public ServiceModel delete(List<BattInf> list) {
        TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
@@ -212,14 +227,24 @@
    }
    public ServiceModel searchAll() {
        List list = mapper.searchAll();
        ServiceModel model = new ServiceModel();
        List<Integer> list = mapper.searchAll();
        /*for (int i = 0; i < 100; i++) {
            System.out.println(list.get(i));
        }
        System.out.println("查询结束。。。");*/
        if (list != null && list.size() > 0) {
            ArrayList<Integer> last = new ArrayList<>();
            for (int i = 0; i < list.size(); i++) {
                Integer num = list.get(i);
                if (num.equals(0)) {
                    continue;
                } else {
                    last.add(list.get(i));
                }
            }
            model.setCode(1);
            model.setData(list);
            model.setData(last);
        }
        return model;
    }
src/main/resources/mapper/BattInfMapper.xml
@@ -4299,7 +4299,7 @@
    </insert>
<!--    <update id="update"></update>-->
    <update id="updateIp"></update>
<!--    <update id="updateIp"></update>-->
<!--    <delete id="del"></delete>-->
    <select id="searchInform" resultType="java.util.List"></select>
    <select id="searchMaxId" resultType="java.util.List"></select>