package com.sa.ibiz.demo.demoapp.controller;

import lombok.Data;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.sa.ibiz.demo.ibizutil.domain.ActionResult;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sa.ibiz.demo.ibizutil.errors.BadRequestAlertException;
import org.springframework.validation.annotation.Validated;
import org.springframework.http.ResponseEntity;
import com.fasterxml.jackson.databind.JsonNode;
import com.sa.ibiz.demo.ibizutil.errors.BadRequestAlertException;
import java.io.InputStream;
import com.fasterxml.jackson.databind.ObjectMapper;

@RestController
@RequestMapping("/demoapp/app/demoapp")
public class DemoAppController{

	@Data
	static protected class AppData{
		private String remotetag = null;
		private ObjectNode localdata = null;
	}
	
	@RequestMapping("getappdata")
    public ResponseEntity<AppData> getAppData(@Validated HttpServletRequest request){
    		AppData appData = new AppData();
    		fillAppData(appData);
    		return ResponseEntity.ok().body(appData);
    }
    
    protected void fillAppData(@Validated AppData appData){
    
    }

	@RequestMapping("/getdemodel/orgsector")
    public ResponseEntity<JsonNode> getOrgsectorDEModel(){
		return getDEModel("/demodel/OrgSector.json");
	}

	@RequestMapping("/getdemodel/wxmedia")
    public ResponseEntity<JsonNode> getWxmediaDEModel(){
		return getDEModel("/demodel/WXMedia.json");
	}

	@RequestMapping("/getdemodel/wfusergroup")
    public ResponseEntity<JsonNode> getWfusergroupDEModel(){
		return getDEModel("/demodel/WFUserGroup.json");
	}

	@RequestMapping("/getdemodel/wfassistwork")
    public ResponseEntity<JsonNode> getWfassistworkDEModel(){
		return getDEModel("/demodel/WFAssistWork.json");
	}

	@RequestMapping("/getdemodel/wfcustomprocess")
    public ResponseEntity<JsonNode> getWfcustomprocessDEModel(){
		return getDEModel("/demodel/WFCustomProcess.json");
	}

	@RequestMapping("/getdemodel/codeitem")
    public ResponseEntity<JsonNode> getCodeitemDEModel(){
		return getDEModel("/demodel/CodeItem.json");
	}

	@RequestMapping("/getdemodel/userroletype")
    public ResponseEntity<JsonNode> getUserroletypeDEModel(){
		return getDEModel("/demodel/UserRoleType.json");
	}

	@RequestMapping("/getdemodel/loginaccount")
    public ResponseEntity<JsonNode> getLoginaccountDEModel(){
		return getDEModel("/demodel/LoginAccount.json");
	}

	@RequestMapping("/getdemodel/wfucpolicy")
    public ResponseEntity<JsonNode> getWfucpolicyDEModel(){
		return getDEModel("/demodel/WFUCPolicy.json");
	}

	@RequestMapping("/getdemodel/qj")
    public ResponseEntity<JsonNode> getQjDEModel(){
		return getDEModel("/demodel/QJ.json");
	}

	@RequestMapping("/getdemodel/msgsendqueuehis")
    public ResponseEntity<JsonNode> getMsgsendqueuehisDEModel(){
		return getDEModel("/demodel/MsgSendQueueHis.json");
	}

	@RequestMapping("/getdemodel/wfusergroupdetail")
    public ResponseEntity<JsonNode> getWfusergroupdetailDEModel(){
		return getDEModel("/demodel/WFUserGroupDetail.json");
	}

	@RequestMapping("/getdemodel/tssditem")
    public ResponseEntity<JsonNode> getTssditemDEModel(){
		return getDEModel("/demodel/TSSDItem.json");
	}

	@RequestMapping("/getdemodel/file")
    public ResponseEntity<JsonNode> getFileDEModel(){
		return getDEModel("/demodel/File.json");
	}

	@RequestMapping("/getdemodel/zjsy")
    public ResponseEntity<JsonNode> getZjsyDEModel(){
		return getDEModel("/demodel/ZJSY.json");
	}

	@RequestMapping("/getdemodel/wfstepdata")
    public ResponseEntity<JsonNode> getWfstepdataDEModel(){
		return getDEModel("/demodel/WFStepData.json");
	}

	@RequestMapping("/getdemodel/portalpage")
    public ResponseEntity<JsonNode> getPortalpageDEModel(){
		return getDEModel("/demodel/PortalPage.json");
	}

	@RequestMapping("/getdemodel/userroledefield")
    public ResponseEntity<JsonNode> getUserroledefieldDEModel(){
		return getDEModel("/demodel/UserRoleDEField.json");
	}

	@RequestMapping("/getdemodel/xm")
    public ResponseEntity<JsonNode> getXmDEModel(){
		return getDEModel("/demodel/XM.json");
	}

	@RequestMapping("/getdemodel/ht")
    public ResponseEntity<JsonNode> getHtDEModel(){
		return getDEModel("/demodel/HT.json");
	}

	@RequestMapping("/getdemodel/sysadmin")
    public ResponseEntity<JsonNode> getSysadminDEModel(){
		return getDEModel("/demodel/SysAdmin.json");
	}

	@RequestMapping("/getdemodel/wfuser")
    public ResponseEntity<JsonNode> getWfuserDEModel(){
		return getDEModel("/demodel/WFUser.json");
	}

	@RequestMapping("/getdemodel/bgyp")
    public ResponseEntity<JsonNode> getBgypDEModel(){
		return getDEModel("/demodel/BGYP.json");
	}

	@RequestMapping("/getdemodel/dedatachg2")
    public ResponseEntity<JsonNode> getDedatachg2DEModel(){
		return getDEModel("/demodel/DEDataChg2.json");
	}

	@RequestMapping("/getdemodel/tssdengine")
    public ResponseEntity<JsonNode> getTssdengineDEModel(){
		return getDEModel("/demodel/TSSDEngine.json");
	}

	@RequestMapping("/getdemodel/tssdpolicyowner")
    public ResponseEntity<JsonNode> getTssdpolicyownerDEModel(){
		return getDEModel("/demodel/TSSDPolicyOwner.json");
	}

	@RequestMapping("/getdemodel/userdict")
    public ResponseEntity<JsonNode> getUserdictDEModel(){
		return getDEModel("/demodel/UserDict.json");
	}

	@RequestMapping("/getdemodel/zcmx")
    public ResponseEntity<JsonNode> getZcmxDEModel(){
		return getDEModel("/demodel/ZCMX.json");
	}

	@RequestMapping("/getdemodel/orgunitcat")
    public ResponseEntity<JsonNode> getOrgunitcatDEModel(){
		return getDEModel("/demodel/OrgUnitCat.json");
	}

	@RequestMapping("/getdemodel/wfstepinst")
    public ResponseEntity<JsonNode> getWfstepinstDEModel(){
		return getDEModel("/demodel/WFStepInst.json");
	}

	@RequestMapping("/getdemodel/loginlog")
    public ResponseEntity<JsonNode> getLoginlogDEModel(){
		return getDEModel("/demodel/LoginLog.json");
	}

	@RequestMapping("/getdemodel/sysadminfunc")
    public ResponseEntity<JsonNode> getSysadminfuncDEModel(){
		return getDEModel("/demodel/SysAdminFunc.json");
	}

	@RequestMapping("/getdemodel/datasyncagent")
    public ResponseEntity<JsonNode> getDatasyncagentDEModel(){
		return getDEModel("/demodel/DataSyncAgent.json");
	}

	@RequestMapping("/getdemodel/codelist")
    public ResponseEntity<JsonNode> getCodelistDEModel(){
		return getDEModel("/demodel/CodeList.json");
	}

	@RequestMapping("/getdemodel/services")
    public ResponseEntity<JsonNode> getServicesDEModel(){
		return getDEModel("/demodel/Services.json");
	}

	@RequestMapping("/getdemodel/dataaudit")
    public ResponseEntity<JsonNode> getDataauditDEModel(){
		return getDEModel("/demodel/DataAudit.json");
	}

	@RequestMapping("/getdemodel/orgtype")
    public ResponseEntity<JsonNode> getOrgtypeDEModel(){
		return getDEModel("/demodel/OrgType.json");
	}

	@RequestMapping("/getdemodel/userroledatadetail")
    public ResponseEntity<JsonNode> getUserroledatadetailDEModel(){
		return getDEModel("/demodel/UserRoleDataDetail.json");
	}

	@RequestMapping("/getdemodel/tssdgroupdetail")
    public ResponseEntity<JsonNode> getTssdgroupdetailDEModel(){
		return getDEModel("/demodel/TSSDGroupDetail.json");
	}

	@RequestMapping("/getdemodel/dataauditdetail")
    public ResponseEntity<JsonNode> getDataauditdetailDEModel(){
		return getDEModel("/demodel/DataAuditDetail.json");
	}

	@RequestMapping("/getdemodel/wfappsetting")
    public ResponseEntity<JsonNode> getWfappsettingDEModel(){
		return getDEModel("/demodel/WFAppSetting.json");
	}

	@RequestMapping("/getdemodel/bgypsq")
    public ResponseEntity<JsonNode> getBgypsqDEModel(){
		return getDEModel("/demodel/BGYPSQ.json");
	}

	@RequestMapping("/getdemodel/wfinstance")
    public ResponseEntity<JsonNode> getWfinstanceDEModel(){
		return getDEModel("/demodel/WFInstance.json");
	}

	@RequestMapping("/getdemodel/wfaction")
    public ResponseEntity<JsonNode> getWfactionDEModel(){
		return getDEModel("/demodel/WFAction.json");
	}

	@RequestMapping("/getdemodel/userroledata")
    public ResponseEntity<JsonNode> getUserroledataDEModel(){
		return getDEModel("/demodel/UserRoleData.json");
	}

	@RequestMapping("/getdemodel/userroledetail")
    public ResponseEntity<JsonNode> getUserroledetailDEModel(){
		return getDEModel("/demodel/UserRoleDetail.json");
	}

	@RequestMapping("/getdemodel/userrole")
    public ResponseEntity<JsonNode> getUserroleDEModel(){
		return getDEModel("/demodel/UserRole.json");
	}

	@RequestMapping("/getdemodel/df")
    public ResponseEntity<JsonNode> getDfDEModel(){
		return getDEModel("/demodel/DF.json");
	}

	@RequestMapping("/getdemodel/datasyncin2")
    public ResponseEntity<JsonNode> getDatasyncin2DEModel(){
		return getDEModel("/demodel/DataSyncIn2.json");
	}

	@RequestMapping("/getdemodel/wxaccesstoken")
    public ResponseEntity<JsonNode> getWxaccesstokenDEModel(){
		return getDEModel("/demodel/WXAccessToken.json");
	}

	@RequestMapping("/getdemodel/ycsq")
    public ResponseEntity<JsonNode> getYcsqDEModel(){
		return getDEModel("/demodel/YCSQ.json");
	}

	@RequestMapping("/getdemodel/dataentity")
    public ResponseEntity<JsonNode> getDataentityDEModel(){
		return getDEModel("/demodel/DataEntity.json");
	}

	@RequestMapping("/getdemodel/userobject")
    public ResponseEntity<JsonNode> getUserobjectDEModel(){
		return getDEModel("/demodel/UserObject.json");
	}

	@RequestMapping("/getdemodel/orgsecusertype")
    public ResponseEntity<JsonNode> getOrgsecusertypeDEModel(){
		return getDEModel("/demodel/OrgSecUserType.json");
	}

	@RequestMapping("/getdemodel/ppmodel")
    public ResponseEntity<JsonNode> getPpmodelDEModel(){
		return getDEModel("/demodel/PPModel.json");
	}

	@RequestMapping("/getdemodel/userroledataaction")
    public ResponseEntity<JsonNode> getUserroledataactionDEModel(){
		return getDEModel("/demodel/UserRoleDataAction.json");
	}

	@RequestMapping("/getdemodel/org")
    public ResponseEntity<JsonNode> getOrgDEModel(){
		return getDEModel("/demodel/Org.json");
	}

	@RequestMapping("/getdemodel/tssdtasktype")
    public ResponseEntity<JsonNode> getTssdtasktypeDEModel(){
		return getDEModel("/demodel/TSSDTaskType.json");
	}

	@RequestMapping("/getdemodel/querymodel")
    public ResponseEntity<JsonNode> getQuerymodelDEModel(){
		return getDEModel("/demodel/QueryModel.json");
	}

	@RequestMapping("/getdemodel/system")
    public ResponseEntity<JsonNode> getSystemDEModel(){
		return getDEModel("/demodel/System.json");
	}

	@RequestMapping("/getdemodel/wfactor")
    public ResponseEntity<JsonNode> getWfactorDEModel(){
		return getDEModel("/demodel/WFActor.json");
	}

	@RequestMapping("/getdemodel/wfworklist")
    public ResponseEntity<JsonNode> getWfworklistDEModel(){
		return getDEModel("/demodel/WFWorkList.json");
	}

	@RequestMapping("/getdemodel/wfworkflow")
    public ResponseEntity<JsonNode> getWfworkflowDEModel(){
		return getDEModel("/demodel/WFWorkflow.json");
	}

	@RequestMapping("/getdemodel/wxentapp")
    public ResponseEntity<JsonNode> getWxentappDEModel(){
		return getDEModel("/demodel/WXEntApp.json");
	}

	@RequestMapping("/getdemodel/wfversion")
    public ResponseEntity<JsonNode> getWfversionDEModel(){
		return getDEModel("/demodel/WFVersion.json");
	}

	@RequestMapping("/getdemodel/wftmpstepactor")
    public ResponseEntity<JsonNode> getWftmpstepactorDEModel(){
		return getDEModel("/demodel/WFTmpStepActor.json");
	}

	@RequestMapping("/getdemodel/wfusercandidate")
    public ResponseEntity<JsonNode> getWfusercandidateDEModel(){
		return getDEModel("/demodel/WFUserCandidate.json");
	}

	@RequestMapping("/getdemodel/userdictitem")
    public ResponseEntity<JsonNode> getUserdictitemDEModel(){
		return getDEModel("/demodel/UserDictItem.json");
	}

	@RequestMapping("/getdemodel/userroleres")
    public ResponseEntity<JsonNode> getUserroleresDEModel(){
		return getDEModel("/demodel/UserRoleRes.json");
	}

	@RequestMapping("/getdemodel/msgsendqueue")
    public ResponseEntity<JsonNode> getMsgsendqueueDEModel(){
		return getDEModel("/demodel/MsgSendQueue.json");
	}

	@RequestMapping("/getdemodel/wfreminder")
    public ResponseEntity<JsonNode> getWfreminderDEModel(){
		return getDEModel("/demodel/WFReminder.json");
	}

	@RequestMapping("/getdemodel/zb")
    public ResponseEntity<JsonNode> getZbDEModel(){
		return getDEModel("/demodel/ZB.json");
	}

	@RequestMapping("/getdemodel/registry")
    public ResponseEntity<JsonNode> getRegistryDEModel(){
		return getDEModel("/demodel/Registry.json");
	}

	@RequestMapping("/getdemodel/userdgtheme")
    public ResponseEntity<JsonNode> getUserdgthemeDEModel(){
		return getDEModel("/demodel/UserDGTheme.json");
	}

	@RequestMapping("/getdemodel/wfuserassist")
    public ResponseEntity<JsonNode> getWfuserassistDEModel(){
		return getDEModel("/demodel/WFUserAssist.json");
	}

	@RequestMapping("/getdemodel/orgsecuser")
    public ResponseEntity<JsonNode> getOrgsecuserDEModel(){
		return getDEModel("/demodel/OrgSecUser.json");
	}

	@RequestMapping("/getdemodel/kq")
    public ResponseEntity<JsonNode> getKqDEModel(){
		return getDEModel("/demodel/KQ.json");
	}

	@RequestMapping("/getdemodel/dedatachg")
    public ResponseEntity<JsonNode> getDedatachgDEModel(){
		return getDEModel("/demodel/DEDataChg.json");
	}

	@RequestMapping("/getdemodel/wfsystemuser")
    public ResponseEntity<JsonNode> getWfsystemuserDEModel(){
		return getDEModel("/demodel/WFSystemUser.json");
	}

	@RequestMapping("/getdemodel/userdictcat")
    public ResponseEntity<JsonNode> getUserdictcatDEModel(){
		return getDEModel("/demodel/UserDictCat.json");
	}

	@RequestMapping("/getdemodel/user")
    public ResponseEntity<JsonNode> getUserDEModel(){
		return getDEModel("/demodel/User.json");
	}

	@RequestMapping("/getdemodel/wxaccount")
    public ResponseEntity<JsonNode> getWxaccountDEModel(){
		return getDEModel("/demodel/WXAccount.json");
	}

	@RequestMapping("/getdemodel/msgtemplate")
    public ResponseEntity<JsonNode> getMsgtemplateDEModel(){
		return getDEModel("/demodel/MsgTemplate.json");
	}

	@RequestMapping("/getdemodel/datasyncout")
    public ResponseEntity<JsonNode> getDatasyncoutDEModel(){
		return getDEModel("/demodel/DataSyncOut.json");
	}

	@RequestMapping("/getdemodel/wfstepactor")
    public ResponseEntity<JsonNode> getWfstepactorDEModel(){
		return getDEModel("/demodel/WFStepActor.json");
	}

	@RequestMapping("/getdemodel/wfiaaction")
    public ResponseEntity<JsonNode> getWfiaactionDEModel(){
		return getDEModel("/demodel/WFIAAction.json");
	}

	@RequestMapping("/getdemodel/pvpart")
    public ResponseEntity<JsonNode> getPvpartDEModel(){
		return getDEModel("/demodel/PVPart.json");
	}

	@RequestMapping("/getdemodel/tssdtasklog")
    public ResponseEntity<JsonNode> getTssdtasklogDEModel(){
		return getDEModel("/demodel/TSSDTaskLog.json");
	}

	@RequestMapping("/getdemodel/wxorgsector")
    public ResponseEntity<JsonNode> getWxorgsectorDEModel(){
		return getDEModel("/demodel/WXOrgSector.json");
	}

	@RequestMapping("/getdemodel/msgaccountdetail")
    public ResponseEntity<JsonNode> getMsgaccountdetailDEModel(){
		return getDEModel("/demodel/MsgAccountDetail.json");
	}

	@RequestMapping("/getdemodel/usergroup")
    public ResponseEntity<JsonNode> getUsergroupDEModel(){
		return getDEModel("/demodel/UserGroup.json");
	}

	@RequestMapping("/getdemodel/unires")
    public ResponseEntity<JsonNode> getUniresDEModel(){
		return getDEModel("/demodel/UniRes.json");
	}

	@RequestMapping("/getdemodel/tssdtask")
    public ResponseEntity<JsonNode> getTssdtaskDEModel(){
		return getDEModel("/demodel/TSSDTask.json");
	}

	@RequestMapping("/getdemodel/userroledefields")
    public ResponseEntity<JsonNode> getUserroledefieldsDEModel(){
		return getDEModel("/demodel/UserRoleDEFields.json");
	}

	@RequestMapping("/getdemodel/tssdgroup")
    public ResponseEntity<JsonNode> getTssdgroupDEModel(){
		return getDEModel("/demodel/TSSDGroup.json");
	}

	@RequestMapping("/getdemodel/wfstep")
    public ResponseEntity<JsonNode> getWfstepDEModel(){
		return getDEModel("/demodel/WFStep.json");
	}

	@RequestMapping("/getdemodel/wfuiwizard")
    public ResponseEntity<JsonNode> getWfuiwizardDEModel(){
		return getDEModel("/demodel/WFUIWizard.json");
	}

	@RequestMapping("/getdemodel/datasyncin")
    public ResponseEntity<JsonNode> getDatasyncinDEModel(){
		return getDEModel("/demodel/DataSyncIn.json");
	}

	@RequestMapping("/getdemodel/dedatachgdisp")
    public ResponseEntity<JsonNode> getDedatachgdispDEModel(){
		return getDEModel("/demodel/DEDataChgDisp.json");
	}

	@RequestMapping("/getdemodel/wxmessage")
    public ResponseEntity<JsonNode> getWxmessageDEModel(){
		return getDEModel("/demodel/WXMessage.json");
	}

	@RequestMapping("/getdemodel/usergroupdetail")
    public ResponseEntity<JsonNode> getUsergroupdetailDEModel(){
		return getDEModel("/demodel/UserGroupDetail.json");
	}

	@RequestMapping("/getdemodel/userroledatas")
    public ResponseEntity<JsonNode> getUserroledatasDEModel(){
		return getDEModel("/demodel/UserRoleDatas.json");
	}

	@RequestMapping("/getdemodel/msgaccount")
    public ResponseEntity<JsonNode> getMsgaccountDEModel(){
		return getDEModel("/demodel/MsgAccount.json");
	}

	@RequestMapping("/getdemodel/tssdpolicy")
    public ResponseEntity<JsonNode> getTssdpolicyDEModel(){
		return getDEModel("/demodel/TSSDPolicy.json");
	}

	@RequestMapping("/getdemodel/dalog")
    public ResponseEntity<JsonNode> getDalogDEModel(){
		return getDEModel("/demodel/DALog.json");
	}

	@RequestMapping("/getdemodel/tssdtaskpolicy")
    public ResponseEntity<JsonNode> getTssdtaskpolicyDEModel(){
		return getDEModel("/demodel/TSSDTaskPolicy.json");
	}

	@RequestMapping("/getdemodel/wfdynamicuser")
    public ResponseEntity<JsonNode> getWfdynamicuserDEModel(){
		return getDEModel("/demodel/WFDynamicUser.json");
	}

	@RequestMapping("/getdemodel/bgypsqmx")
    public ResponseEntity<JsonNode> getBgypsqmxDEModel(){
		return getDEModel("/demodel/BGYPSQMX.json");
	}

	@RequestMapping("/getdemodel/orguserlevel")
    public ResponseEntity<JsonNode> getOrguserlevelDEModel(){
		return getDEModel("/demodel/OrgUserLevel.json");
	}

	@RequestMapping("/getdemodel/datasyncout2")
    public ResponseEntity<JsonNode> getDatasyncout2DEModel(){
		return getDEModel("/demodel/DataSyncOut2.json");
	}

	@RequestMapping("/getdemodel/orguser")
    public ResponseEntity<JsonNode> getOrguserDEModel(){
		return getDEModel("/demodel/OrgUser.json");
	}


    /**
    * 获取实体模型数据
    * @param filePath 模型文件路径
    * @return
    */
    public ResponseEntity<JsonNode> getDEModel(String filePath){
        JsonNode jsonNode;
        try{
			InputStream in = this.getClass().getResourceAsStream(filePath);
			jsonNode = new ObjectMapper().readTree(in);
        }
        catch(Exception ex){
        	throw new BadRequestAlertException("操作发生错误","","");
        }
        	return ResponseEntity.ok().body(jsonNode);
        }
}