whycrzg
2021-02-01 98be1b363a9fd17b9f5414d0ff442d2743ad9543
update
2个文件已修改
65 ■■■■■ 已修改文件
src/main/java/com/fgkj/controller/BattInfController.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/BattInfServices.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/BattInfController.java
@@ -7,6 +7,7 @@
import com.google.gson.GsonBuilder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -23,42 +24,57 @@
    //添加新的电池组
    @PostMapping("/")
    @ApiOperation(notes = "",value="添加新的电池组")
    @ApiOperation(notes = "TODO 未完成",value="添加新的电池组")
    public ServiceModel add(@RequestBody List<BattInf> list) {
        // List<BattInf> list= getGson("yyyy-MM-dd").fromJson(json, new TypeToken<List<BattInf>>(){}.getType());
        return service.add(list);
    }
    //修改电池组信息
    @PutMapping("/")
    @ApiOperation(notes = "",value="修改电池组信息")
    @ApiOperation(notes = "[{ \"stationId\": \"1000023\", \"stationName\": \"tt\", \"stationName1\": \"t1\", \"stationName2\": \"t2\", \"stationName3\": \"t3\", \"stationName4\": \"t4\", \"stationName5\": \"t5\", \"stationName6\": \"\", \"stationName7\": \"\", \"stationName8\": \"\", \"stationName9\": \"\", \"stationIp\": \"1\", \"fbsDeviceId\": 0, \"fbsDeviceIp\": \"127.0.0.1\", \"fbsDeviceIp_WG\": \"t\", \"fbsDeviceName\": \"t\", \"groupIndexInFBSDevice\": 0, \"battModel\": \"\", \"battGroupId\": 1000023, \"battGroupNum\": 0, \"battGroupName\": \"t\", \"floatVolLevel\": 0.0, \"offlineVolLevel\": 0.0, \"battFloatCurrent\": 0.0, \"deviceId\": \"\", \"deviceName\": \"\", \"monCount\": 0, \"monCapStd\": 0.0, \"monResStd\": 0.0, \"monSerStd\": 0.0, \"monTmpStd\": 0.0, \"monVolStd\": 0.0, \"monVolLowToAvg\": 0.0, \"battProducer\": \"\", \"battProductDate\": \"2020-12-31 11:52:56\", \"battProductDate1\": \"2020-12-31 11:52:56\", \"battInUseDate\": \"2020-12-31 11:52:56\", \"load_curr\": 0.0, \"disCurrMax\": 0.0, \"station_phone\": \"\", \"stationId_ex\": \"\", \"videoOrImage\": \"\", \"vol_grade\": 0.0, \"manufacturers\": \"\", \"assetequipment\": \"\", \"deviceclasspath\": \"\", \"deviceoperationdepartment\": \"\", \"propertyRightUnit\": \"\", \"propertyAttribute\": \"\", \"factoryNumber\": \"\", \"operationTeam\": \"\", \"deviceIdentityCode\": \"\", \"projectType\": \"\", \"batteryApplicationType\": \"\", \"singleRatedVoltage\": 0.0, \"remoteMonitor\": \"\", \"batttIndependentPlaced\": \"\", \"junChargeVoltageValue\": 0.0 }]",value="修改电池组信息")
    public ServiceModel update(@RequestBody List<BattInf> list) {
        // List<BattInf> list= getGson("yyyy-MM-dd").fromJson(json, new TypeToken<List<BattInf>>(){}.getType());
        return service.update(list);
    }
    //修改电池信息配置(ip地址,掩码和网关)
    @PostMapping("/ip")
    @ApiOperation(notes = "",value="修改电池信息配置(ip地址,掩码和网关)")
    public ServiceModel updateIp(@RequestBody BattInf binf) {
        // BattInf binf= getGson("yyyy-MM-dd").fromJson(json, BattInf.class);
        //System.out.println(binf);
    public ServiceModel updateIp(@RequestParam String fbsDeviceIp,@RequestParam String fbsDeviceIp_YM,@RequestParam String fbsDeviceIp_WG,@RequestParam Integer fbsDeviceId) {
        BattInf binf= new BattInf();
        binf.setFbsDeviceIp(fbsDeviceIp);
        binf.setFbsDeviceIp_YM(fbsDeviceIp_YM);
        binf.setFbsDeviceIp_WG(fbsDeviceIp_WG);
        binf.setFbsDeviceId(fbsDeviceId);
        return service.updateIp(binf);
    }
    //删除电池组
    @DeleteMapping("/")
    @ApiOperation(notes = "",value="删除电池组")
    public ServiceModel delete(@RequestBody List<BattInf> list) {
        // List<BattInf> list= getGson("yyyy-MM-dd").fromJson(json, new TypeToken<List<BattInf>>(){}.getType());
    //删除电池组 stationName日志记录使用
    @DeleteMapping("/")
    @ApiOperation(notes = "[{ \"battGroupId\": 1000021, \"stationName\": \"test\" }]",value="删除电池组")
    public ServiceModel delete(@RequestBody List<BattInf> list) {
        return service.delete(list);
    }
    //根据维护区和机房名称查询电池组信息
    @GetMapping("inform")
    @ApiOperation(notes = "",value="维护区和机房名称查询电池组信息")
    public ServiceModel searchInform(@RequestBody Batt_Maint_Dealarm bmd) {
        // Batt_Maint_Dealarm bmd = getGson().fromJson(json, Batt_Maint_Dealarm.class);
    @PostMapping("inform")
    @ApiOperation(notes = "stationName 为模糊查询条件",value="维护区和机房名称查询电池组信息")
    public ServiceModel searchInform(@ApiParam(value = "省",required = true) @RequestParam String stationName1, @ApiParam(value = "市",required = true)@RequestParam String stationName2, @ApiParam(value = "区",required = true)@RequestParam String stationName5, @ApiParam(value = "机房",required = true)@RequestParam String stationName3, @ApiParam(value = "页码",required = true)@RequestParam Integer pageNum, @ApiParam(value = "页面数量",required = true)@RequestParam Integer pageSize) {
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        bmd.setBinf(new BattInf());
        BattInf battInf = new BattInf();
        battInf.setStationName1(stationName1);
        battInf.setStationName2(stationName2);
        battInf.setStationName3(stationName3);
        battInf.setStationName5(stationName5);
        PageBean pageBean = new PageBean();
        pageBean.setPageSize(pageSize);
        pageBean.setPageNum(pageNum);
        bmd.setPageBean(pageBean);
        bmd.setBinf(battInf);
        return service.searchInform(bmd);
    }
    //添加站点时返回最大的机房id,设备id,电池组id
src/main/java/com/fgkj/services/BattInfServices.java
@@ -67,7 +67,7 @@
            int battgroupid = BattinfGroupFactory.searchMaxBattgroupId();
            int stationid = BattinfGroupFactory.searchStationId();
            // int dev_id=BattinfGroupFactory.searchmaxdev_id();
//        int dev_id=BattinfGroupFactory.searchmaxdev_id(list.get(0).getFbsDeviceId());
//        int dev_id=BattinfGroupFactory.searchmaxdev_id(list.get(0).getFbsDeviceId());    //TODO 方法名不一致
            for (int i = 0; i < list.size(); i++) {
                BattInf binf = list.get(i);
                if(!mapper.add(binf)){
@@ -147,6 +147,7 @@
    private Database_backupMapper backupmapper;
    //修改电池信息配置(ip地址,掩码和网关)
    public ServiceModel updateIp(BattInf binf) {
        ServiceModel model = new ServiceModel();
        //更新数据库备份标志表的标志
        boolean flag = backupmapper.updateBackupEn("tb_battinf") > 0;
        boolean b=mapper.updateIp(binf)>0;
@@ -186,10 +187,14 @@
        if(list!=null&&list.size()>0){
            for (int i = 0; i < list.size(); i++) {
                BattInf binf=list.get(i);
                if (mapper.del(binf)>0) {
                    flag = true;
                }else{
                    flag = false;
                try {
                    flag =mapper.del(binf)>0;
                } catch (Exception e) {
                    e.printStackTrace();
                    dataSourceTransactionManager.rollback(transactionStatus);
                    model.setCode(0);
                    model.setMsg("删除失败!");
                    return model;
                }
                {
                    String msg="删除"+binf.getStationName()+"机房"+binf.getBattGroupId()+"电池组的信息";