|  |  | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.core.env.Environment; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | 
 |  |  |      * @param automaticClose | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public Map planedOpenTimedClose(AutomaticClose automaticClose, Long planId, Byte operatetype, Date startTime, Integer duration) { | 
 |  |  |         Long intakeId = automaticClose.getIntakeId(); | 
 |  |  |         Long vcId = automaticClose.getVcId(); | 
 |  |  | 
 |  |  |             BaseResponse<Boolean> result = dealWithCommandResult(myParam); | 
 |  |  |             // 如果命令执行失败,则再次执行命令 | 
 |  |  |             if(!result.isSuccess()) { | 
 |  |  |                 myParam.setComId(new IDLongGenerator().generate()); | 
 |  |  |                 result = dealWithCommandResult(myParam); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  | 
 |  |  |             BaseResponse<Boolean> result = dealWithCommandResult(myParam); | 
 |  |  |             // 如果命令执行失败,则再次执行命令 | 
 |  |  |             if(!result.isSuccess()) { | 
 |  |  |                 myParam.setComId(new IDLongGenerator().generate()); | 
 |  |  |                 result = dealWithCommandResult(myParam); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  | 
 |  |  |      * @param operatetype | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public Map closeWx(ValveClose valve, Long planId, Byte operatetype) { | 
 |  |  |         String rtuAddr = valve.getRtuAddr(); | 
 |  |  |         String vcNum = valve.getVcNum(); | 
 |  |  | 
 |  |  |             irIntakeOperate.setOperateType(operatetype); | 
 |  |  |             irIntakeOperate.setCommandId(comId); | 
 |  |  |             irIntakeOperate.setIntakeId(intakeId); | 
 |  |  |             irIntakeOperate.setCommandResult((byte)1); | 
 |  |  |  | 
 |  |  |             Long id = addIntakeOperate(irIntakeOperate); | 
 |  |  |             if(id == null) { | 
 |  |  | 
 |  |  |             BaseResponse<Boolean> result = dealWithCommandResult(myParam); | 
 |  |  |             // 如果命令执行失败,则再次执行命令 | 
 |  |  |             if(!result.isSuccess()) { | 
 |  |  |                 myParam.setComId(new IDLongGenerator().generate()); | 
 |  |  |                 result = dealWithCommandResult(myParam); | 
 |  |  |             } | 
 |  |  |  |