whycxzp
2023-05-11 6987cd2cd95d8d978b9657eb5be07ee960ca96f3
设置参数
2个文件已修改
93 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/Fbs9100SetparamController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/Fbs9100SetparamService.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/Fbs9100SetparamController.java
@@ -189,4 +189,34 @@
    public Response updateKgdyParam(@RequestBody Fbs9100Setparam a059setParam) {
        return service.updateKgdyParam(a059setParam);
    }
    @ApiOperation(tags = "设置参数", value = "读取参数-配网电源")
    @GetMapping("searchPW")
    public Response searchPW(@RequestParam int devId){
        return service.searchPW(devId);
    }
    @ApiOperation(tags = "设置参数", value = "设置参数-配网电源")
    @PostMapping("updatePW")
    public Response updatePW(@RequestBody Fbs9100Setparam param) {
        return service.updatePW(param);
    }
    @ApiOperation(tags = "设置参数", value = "设置参数-配网电源-启动充电测试|放电测试")
    @PostMapping("updatePWStartTest")
    public Response updatePWStartTest(@RequestParam int devId,@RequestParam int opCmd,@RequestParam int testCmd) {
        return service.updatePWStartTest(devId,opCmd,testCmd);
    }
    @ApiOperation(tags = "设置参数", value = "设置参数-配网电源-停止测试")
    @PostMapping("updatePWStopTest")
    public Response updatePWStopTest(@RequestParam int devId) {
        return service.updatePWStopTest(devId);
    }
    @ApiOperation(tags = "设置参数", value = "设置参数-配网电源-重启设备")
    @PostMapping("updatePWRestartDevice")
    public Response updatePWRestartDevice(@RequestParam int devId) {
        return service.updatePWRestartDevice(devId);
    }
}
src/main/java/com/whyc/service/Fbs9100SetparamService.java
@@ -462,7 +462,7 @@
            case FBS9100_ComBase.CMD_Start: m_cmd_ack = FBS9100_ComBase.CMD_StartAck; break;
            case FBS9100_ComBase.CMD_Stop: m_cmd_ack = FBS9100_ComBase.CMD_StopAck; break;
            case FBS9100_ComBase.CMD_EOperatingSwitch_ControlSwitch: m_cmd_ack = FBS9100_ComBase.CMD_EOperatingSwitch_ControlSwitchAck; break;
            case FBS9100_ComBase.CMD_ResetSystem: m_cmd_ack = FBS9100_ComBase.CMD_ResetSystemAck; break;
            default:
                return false;
        }
@@ -635,4 +635,65 @@
        }
        return new Response().set(1, bl, bl == true ? "修改参数成功!" : "设置并联电源参数失败,请检查网络!");
    }
    public Response searchPW(int devId) {
        int opCmd = FBS9100_ComBase.CMD_GetDischargeParm;
        return searchParam(devId,opCmd);
    }
    private Response searchParam(int devId, int opCmd) {
        boolean res = sendCmdToDev(opCmd, devId);
        Fbs9100Setparam fbs9100Setparam = null;
        if(res){
            QueryWrapper<Fbs9100Setparam> query = Wrappers.query();
            query.eq("dev_id",devId).last(" limit 1");
            fbs9100Setparam = mapper.selectOne(query);
        }
        return new Response().setII(1, res, fbs9100Setparam, res ? "读取参数成功" : "读取参数失败,请检查网络");
    }
    public Response updatePW(Fbs9100Setparam param) {
        Long devId = param.getDevId();
        UpdateWrapper<Fbs9100Setparam> update = Wrappers.update();
        update.set("DisCurr",param.getDisCurr())
                .set("DisCap",param.getDisCap())
                .set("DisTime",param.getDisTime())
                .set("GroupVol_LOW",param.getGroupvolLow())
                .set("BattGroupNum",param.getBattGroupNum())
                .set("DCVolHighLimit",param.getDCVolHighLimit())
                .set("ChargeCurrSet",param.getChargeCurrSet())
                .eq("dev_id",devId);
        mapper.update(null,update);
        boolean res = sendCmdToDev(FBS9100_ComBase.CMD_SetDischargeParm, devId.intValue());
        return new Response().set(1, res, res ? "修改参数成功" : "设置参数失败,请检查网络");
    }
    public Response updateOpCmdAndTestCmd(int devId,int opCmd,int testCmd) {
        UpdateWrapper<Fbs9100Setparam> update = Wrappers.update();
        update.set("TestCmd",testCmd).eq("dev_id",devId);
        Boolean res=mapper.update(null,update)==1;
        boolean res2=false;
        if(res){
            res2=sendCmdToDev(opCmd,devId);
        }
        return new Response().set(1,res2, res2 ?"启动测试成功!":"启动测试失败,请检查网络!");
    }
    public Response updateOpCmd(int devId,int opCmd) {
        boolean res = sendCmdToDev(opCmd,devId);
        return new Response().set(1,res, res ?"停止测试成功!":"停止测试失败,请检查网络!");
    }
    public Response updatePWStartTest(int devId,int opCmd,int testCmd) {
        return updateOpCmdAndTestCmd(devId,opCmd,testCmd);
    }
    public Response updatePWStopTest(int devId) {
        return updateOpCmd(devId,FBS9100_ComBase.CMD_Stop);
    }
    public Response updatePWRestartDevice(int devId) {
        return updateOpCmd(devId,FBS9100_ComBase.CMD_ResetSystem);
    }
}