New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtDataSet; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevRtSet; |
| | | import com.whyc.service.CKPowerDevBattRtDataSetService; |
| | | import com.whyc.service.CKPowerDevRtSetService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | | @Api(tags = "测控电源核容装置单体信息配置表") |
| | | @RequestMapping("ckPowerDevBattRtDataSet") |
| | | public class CKPowerDevBattRtDataSetController { |
| | | |
| | | @Autowired |
| | | private CKPowerDevBattRtDataSetService service; |
| | | |
| | | @ApiOperation("设置") |
| | | @PostMapping("update") |
| | | public Response update(@RequestBody CKPowerDevBattRtDataSet set){ |
| | | return service.update(set); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtStateSet; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevRtSet; |
| | | import com.whyc.service.CKPowerDevBattRtStateSetService; |
| | | import com.whyc.service.CKPowerDevRtSetService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | | @Api(tags = "蓄电池组组端以及主控信息实时状态设置表") |
| | | @RequestMapping("ckPowerDevBattRtStateSet") |
| | | public class CKPowerDevBattRtStateSetController { |
| | | |
| | | @Autowired |
| | | private CKPowerDevBattRtStateSetService service; |
| | | |
| | | @ApiOperation("设置") |
| | | @PostMapping("update") |
| | | public Response update(@RequestBody CKPowerDevBattRtStateSet set){ |
| | | return service.update(set); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtDataSet; |
| | | |
| | | public interface CKPowerDevBattRtDataSetMapper extends CustomMapper<CKPowerDevBattRtDataSet> { |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtStateSet; |
| | | |
| | | public interface CKPowerDevBattRtStateSetMapper extends CustomMapper<CKPowerDevBattRtStateSet> { |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.CMD_Constant; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.CKPowerDevBattRtDataSetMapper; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtDataSet; |
| | | import com.whyc.util.OpCmdUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class CKPowerDevBattRtDataSetService { |
| | | |
| | | @Resource |
| | | private CKPowerDevBattRtDataSetMapper mapper; |
| | | |
| | | public Response update(CKPowerDevBattRtDataSet set) { |
| | | mapper.update(set,null); |
| | | //读取opCmd返回是否成功 |
| | | QueryWrapper<CKPowerDevBattRtDataSet> query = Wrappers.query(); |
| | | return OpCmdUtil.getOpStatus(mapper, query, CMD_Constant.CMD_SetACDCARK_Signal,20,set.getBattIndex()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.CMD_Constant; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.CKPowerDevBattRtStateSetMapper; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevBattRtStateSet; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevSignalSet; |
| | | import com.whyc.util.OpCmdUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class CKPowerDevBattRtStateSetService { |
| | | |
| | | @Resource |
| | | private CKPowerDevBattRtStateSetMapper mapper; |
| | | |
| | | public Response update(CKPowerDevBattRtStateSet set) { |
| | | mapper.update(set,null); |
| | | //读取opCmd返回是否成功 |
| | | QueryWrapper<CKPowerDevSignalSet> query = Wrappers.query(); |
| | | return OpCmdUtil.getOpStatus(mapper, query, CMD_Constant.CMD_SetACDCARK_Signal,20,set.getBattIndex()); |
| | | } |
| | | } |
| | |
| | | mapper.update(set,null); |
| | | //读取opCmd返回是否成功 |
| | | QueryWrapper<CKPowerDevRtSet> query = Wrappers.query(); |
| | | return OpCmdUtil.getOpStatus(mapper, query, CMD_Constant.CMD_SetACDCARK_Telemetry,20); |
| | | return OpCmdUtil.getOpStatus(mapper, query, CMD_Constant.CMD_SetACDCARK_Telemetry,20,null); |
| | | } |
| | | |
| | | } |
| | |
| | | mapper.update(set,null); |
| | | //读取opCmd返回是否成功 |
| | | QueryWrapper<CKPowerDevSignalSet> query = Wrappers.query(); |
| | | return OpCmdUtil.getOpStatus(mapper, query, CMD_Constant.CMD_SetACDCARK_Signal,20); |
| | | return OpCmdUtil.getOpStatus(mapper, query, CMD_Constant.CMD_SetACDCARK_Signal,20,null); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.BeanUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.gson.JsonObject; |
| | | import com.whyc.constant.CMD_Constant; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.CustomMapper; |
| | |
| | | * @param queryWrapper |
| | | * @param opCmd 执行的操作输入 |
| | | * @param ackTimeLimitSecond 最大限制返回时间,单位秒 |
| | | * @param battIndex 电池组index,可传入[0,1]或者null |
| | | * @return 对比opCmd的操作输出,是否操作成功或者失败 |
| | | */ |
| | | public static Response getOpStatus(CustomMapper mapper, QueryWrapper<?> queryWrapper, Integer opCmd, Integer ackTimeLimitSecond) { |
| | | public static Response getOpStatus(CustomMapper mapper, QueryWrapper<?> queryWrapper, Integer opCmd, Integer ackTimeLimitSecond, Integer battIndex) { |
| | | try { |
| | | int count = ackTimeLimitSecond * 1000 / 250; |
| | | for (int i = 0; i < count; i++) { |
| | | queryWrapper.select("op_cmd").last(" limit 1"); |
| | | queryWrapper.select("op_cmd"); |
| | | if(battIndex != null){ |
| | | queryWrapper.eq("batt_index",battIndex); |
| | | } |
| | | queryWrapper.last(" limit 1"); |
| | | Object obj = mapper.selectOne(queryWrapper); |
| | | Class clazz = obj.getClass(); |
| | | |