| | |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.permission.PermissionService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.lucene.config.CmnConst; |
| | | import com.product.lucene.util.FileUtils; |
| | | import com.product.util.BaseUtil; |
| | |
| | | |
| | | /** |
| | | * 获取文档检索配置信息(权限,功能名称,跳转按钮) |
| | | * @param json |
| | | * @param function_uuid |
| | | * @param service_uuid |
| | | * |
| | | * @param json 检索文件对应信息 |
| | | * @param function_uuid 所属功能UUID |
| | | * @param service_uuid 附件UUID |
| | | */ |
| | | public void getConfig(JSONObject json, String function_uuid, String uuid) { |
| | | |
| | | FieldSetEntity fseConfig=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_DOCUMENT_SEARCH, "function_uuid=?", new Object[] {function_uuid}, false); |
| | | StringBuilder searchConfigSql = new StringBuilder(); |
| | | searchConfigSql.append("SELECT ") |
| | | .append(" A.uuid,A.function_uuid,A.function_button_uuid,A.table_name,") |
| | | .append(" A.attachment_file,A.org_fields,A.user_fields,title_field,time_field,") |
| | | .append(" B.function_name,C.button_name") |
| | | .append(" FROM product_sys_document_search A") |
| | | .append(" LEFT JOIN product_sys_functions B ON A.function_uuid = B.uuid") |
| | | .append(" LEFT JOIN product_sys_function_buttons C ON A.function_button_uuid = C.uuid") |
| | | .append(" WHERE function_uuid=?"); |
| | | |
| | | //获取文档检索配置 |
| | | FieldSetEntity fseConfig = baseDao.getFieldSetBySQL(searchConfigSql.toString(), new Object[] {function_uuid}, false); |
| | | if (fseConfig!=null) { |
| | | |
| | | FieldSetEntity fseFunction=baseDao.getFieldSetEntity(CoreConst.PRODUCT_SYS_FUNCTIONS, function_uuid, false); |
| | | //获取跳转按钮 并 判断跳转权限 |
| | | String buttonName = fseConfig.getString(CoreConst.BUTTON_NAME); |
| | | if (BaseUtil.strIsNull(buttonName)) { |
| | | json.put(CmnConst.IS_PERSSION, 2); |
| | | }else { |
| | | json.put(CmnConst.SKIPBUTTON, fseConfig.getString(CoreConst.BUTTON_NAME)); |
| | | } |
| | | |
| | | //获取权限过滤字段 |
| | | String org_fields=fseConfig.getString(CmnConst.ORG_FIELDS); |
| | | String user_fields=fseConfig.getString(CmnConst.USER_FIELDS); |
| | | |
| | | //获取附件信息 |
| | | //获取附件信息,结合数据权限字段,生成原数据的过滤SQL |
| | | FieldSetEntity fseAttachment=baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_ATTACHMENTS, uuid, false); |
| | | baseDao.loadPromptData(fseAttachment); |
| | | if (fseAttachment!=null) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //获取原数据 |
| | | FieldSetEntity fseService=baseDao.getFieldSetEntityByFilter(fseAttachment.getString(CmnConst.ATTACHMENT_DATA_TABLE), filter.toString(), new Object[] {uuid}, false); |
| | | if (fseService==null) {//权限过滤无原数据 |
| | | if (fseService==null) { |
| | | //获取无权限过滤的原数据 |
| | | FieldSetEntity fseService2=baseDao.getFieldSetEntityByFilter(fseAttachment.getString(CmnConst.ATTACHMENT_DATA_TABLE), fseAttachment.getString(CmnConst.ATTACHMENT_DATA_FIELD)+"=?", new Object[] {uuid}, false); |
| | | if (fseService2==null) { |
| | | // json.put("date_time", fseService2.getString(fseConfig.getString("time_field"))); |
| | | json.put(CmnConst.TITLE, "无相关业务数据"); |
| | | json.put(CoreConst.FUNCTION_NAME, fseFunction.getString(CoreConst.FUNCTION_NAME)); |
| | | json.put(CmnConst.TITLE, "业务数据不存在"); |
| | | json.put(CmnConst.IS_PERSSION, 1); |
| | | }else { |
| | | json.put(CmnConst.SERVICE_UUID, fseService2.getString(CoreConst.UUID)); |
| | | json.put(CmnConst.DATE_TIME, fseService2.getString(fseConfig.getString(CmnConst.TIME_FIELD))); |
| | | json.put(CmnConst.TITLE, fseService2.getString(fseConfig.getString(CmnConst.TITLE_FIELD))); |
| | | json.put(CoreConst.FUNCTION_NAME, fseFunction.getString(CoreConst.FUNCTION_NAME)); |
| | | json.put(CmnConst.IS_PERSSION, 0); |
| | | } |
| | | |
| | | }else { |
| | | |
| | | //判断是否为文档管理功能,并处理单位文档和个人文档权限 |
| | | if("e4fa2c88-88a4-4ef4-9020-ebbe0440b4cf".equals(function_uuid)) { |
| | | if(!SpringMVCContextHolder.getCurrentUserId().equals(fseService.getString(CoreConst.CREATED_BY))) { |
| | | json.put(CmnConst.IS_PERSSION, 0); |
| | | } |
| | | }else if ("01513ff6-c758-4384-b861-e58dfe146fdd".equals(function_uuid)) { |
| | | //获取单位文档所属目录权限 |
| | | FieldSetEntity fseDirectRight = baseDao.getFieldSetByFilter(CmnConst.PRODUCT_OA_DIRECTORY_RIGHTS, "directory_uuid=?", new Object[] {fseService.getString(CmnConst.DIRECTORY_UUID)}, false); |
| | | if (fseDirectRight == null) { |
| | | json.put(CmnConst.IS_PERSSION, 0); |
| | | }else { |
| | | boolean succ= BaseUtil.multipleTypeConcat(fseDirectRight.getString(CmnConst.STORAGE_UUID), SpringMVCContextHolder.getCurrentUserId()); |
| | | if (!succ) { |
| | | json.put(CmnConst.IS_PERSSION, 0); |
| | | } |
| | | } |
| | | } |
| | | json.put(CmnConst.SERVICE_UUID, fseService.getString(CoreConst.UUID)); |
| | | json.put(CmnConst.DATE_TIME, fseService.getString(fseConfig.getString(CmnConst.TIME_FIELD))); |
| | | json.put(CmnConst.TITLE, fseService.getString(fseConfig.getString(CmnConst.TITLE_FIELD))); |
| | | json.put(CoreConst.FUNCTION_NAME, fseFunction.getString(CoreConst.FUNCTION_NAME)); |
| | | } |
| | | json.put(CoreConst.FUNCTION_NAME, fseConfig.getString(CoreConst.FUNCTION_NAME)); |
| | | json.put(CoreConst.CREATED_BY, fseAttachment.getString(CoreConst.CREATED_BY)); |
| | | } |
| | | } |