| | |
| | | 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; |
| | |
| | | |
| | | ServiceModel model = new ServiceModel(); |
| | | |
| | | @Resource |
| | | private Fbs9100_setparamService fbs9100_setparamService; |
| | | @Resource |
| | | private BattInfMapper mapper; |
| | | |
| | |
| | | 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; |
| | | } |
| | | { |
| | |
| | | uservice.add(ulog);//将用户的操作记录下来 |
| | | } |
| | | } |
| | | } else { |
| | | }else{ |
| | | flag = false; |
| | | } |
| | | if (flag) { |
| | |
| | | } |
| | | 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(); |
| | |
| | | //System.out.println(model); |
| | | return model; |
| | | } |
| | | |
| | | //删除电池组 |
| | | public ServiceModel delete(List<BattInf> list) { |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |