|  |  | 
 |  |  | import com.dy.pipIrrGlobal.command.enums.LastOperateENUM; | 
 |  |  | import com.dy.pipIrrGlobal.command.result.CommandResultCode; | 
 |  |  | import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoPr.PrCommonIntakesMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; | 
 |  |  | import com.dy.pipIrrGlobal.pojoPr.PrCommonIntakes; | 
 |  |  | import com.dy.pipIrrGlobal.pojoPr.PrController; | 
 |  |  | import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; | 
 |  |  | import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SeVirtualCardMapper seVirtualCardMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private PrCommonIntakesMapper prCommonIntakesMapper; | 
 |  |  |  | 
 |  |  |     public static ComSupport comSupport; | 
 |  |  |  | 
 |  |  | 
 |  |  |         rmCommandHistoryMapper.insert(rmCommandHistory); | 
 |  |  |         comId = rmCommandHistory.getComId(); | 
 |  |  |  | 
 |  |  |         // 添加常用取水口或更新使用信息 | 
 |  |  |         addCommonIntake(operator, intakeId); | 
 |  |  |  | 
 |  |  |         /** | 
 |  |  |          * 处理回调 | 
 |  |  |          * feature准备就绪后发送命令 | 
 |  |  | 
 |  |  |         if(commandCode.equals("92") || commandCode.equals("97")) { | 
 |  |  |             JSONObject job_response = (JSONObject) JSON.toJSON(response_CallBack); | 
 |  |  |             JSONObject job_param = (JSONObject) JSON.toJSON(param); | 
 |  |  |  | 
 |  |  |             JSONObject job_data = job_response.getJSONObject("content").getJSONObject("data"); | 
 |  |  |             job_data.remove("success"); | 
 |  |  |             job_data.put("intakeId", intakeId); | 
 |  |  |             job_data.put("rtuAddr", rtuAddr); | 
 |  |  |             job_data.put("vcNum", job_param.getString("icCardNo")); | 
 |  |  |             job_data.put("orderNo", job_param.getString("orderNo")); | 
 |  |  |  | 
 |  |  |             response_CallBack = JSON.parseObject(job_response.toJSONString(), BaseResponse.class); | 
 |  |  |             if(!job_data.getBoolean("success")) { | 
 |  |  |                 // 开关阀失败 | 
 |  |  |                 response_CallBack.setCode("10003"); | 
 |  |  |                 response_CallBack.setMsg(CommandResultCode.OPEN_CLOSE_FAIL.getMessage()); | 
 |  |  |                 response_CallBack.setSuccess(false); | 
 |  |  |             }else { | 
 |  |  |                 // 开关阀成功 | 
 |  |  |                 job_data.remove("success"); | 
 |  |  |                 job_data.put("intakeId", intakeId); | 
 |  |  |                 job_data.put("rtuAddr", rtuAddr); | 
 |  |  |                 if(job_param != null) { | 
 |  |  |                     job_data.put("vcNum", job_param.getString("icCardNo")); | 
 |  |  |                     job_data.put("orderNo", job_param.getString("orderNo")); | 
 |  |  |                 } | 
 |  |  |                 response_CallBack = JSON.parseObject(job_response.toJSONString(), BaseResponse.class); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 回调返回的内容,回调结果写入命令日志表的任务由中间件完成 | 
 |  |  |         return response_CallBack; | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加常用取水口或更新使用信息 | 
 |  |  |      * @param intakeId | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Integer addCommonIntake(Long operatorId, Long intakeId) { | 
 |  |  |         PrCommonIntakes commonIntake = prCommonIntakesMapper.selectByOperatorAndIntake(operatorId, intakeId); | 
 |  |  |         if(commonIntake == null) { | 
 |  |  |             commonIntake = new PrCommonIntakes(); | 
 |  |  |             commonIntake.setOperatorId(operatorId); | 
 |  |  |             commonIntake.setIntakeId(intakeId); | 
 |  |  |             commonIntake.setLastUsedTime(new Date()); | 
 |  |  |             commonIntake.setUsageCount(1); | 
 |  |  |             return prCommonIntakesMapper.insert(commonIntake); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         commonIntake.setLastUsedTime(new Date()); | 
 |  |  |         commonIntake.setUsageCount(commonIntake.getUsageCount() + 1); | 
 |  |  |         return prCommonIntakesMapper.updateByPrimaryKeySelective(commonIntake); | 
 |  |  |     } | 
 |  |  | } |