public Record getAssigneeUserRecord(String modelName, String activityId, String instanceId) {try {Record record=new Record();String sql = Db.queryStr("SELECT `SQL` FROM BPM_ACTIVITY_ASSIGNEE WHERE MODEL_ID=? AND ACTIVITY_ID=?",modelName, activityId);// AssertUtils.notBlank(sql, "未配置正确的用户查询SQL");if (StringUtils.isBlank(sql))return null;if (sql.indexOf("?") != -1) {// 如果有参数,就用参数record= Db.findFirst(sql, instanceId);//查询字典表的原任务领取人的次数String queryTime = Db.queryStr(" SELECT DICT_ID from sys_dict_entry WHERE DICT_TYPE_ID = 'query_time' and sys_status = 1 ");// 查询原任务领取人睡眠的时间String sleepTime = Db.queryStr(" SELECT DICT_ID from sys_dict_entry WHERE DICT_TYPE_ID = 'sleep_time' and sys_status = 1 ");if (record == null) {for(int a= Integer.valueOf(queryTime);a>0;a--){ //如果超过了a次后,还是未查询到,就暂不查询原任务领取人了。//延迟10秒Thread.currentThread();Thread.sleep(Long.valueOf(sleepTime));//再次查询record= Db.findFirst(sql, instanceId);if (record != null) {break;}}return record;}else {return record;}} else {// 没参数, 就不使用参数,因为,用来代替【接收消息】的那个人工活动实际上不需要关心业务主键,我们也就不需要流程实例id了// 也为了方便区分,那就直接不用参数了,配置的sql可以类似:// SELECT * FROM SYS_USER WHERE user_code='qhyf01'return Db.findFirst(sql);}} catch (Exception e) {logger.error("根据流程实例id[{}]查询模型[{}]的活动[{}]指派人dn失败", instanceId, modelName, activityId, e);}return null;}