[学习笔记]调用外部接口

package com.skyland.interactions.service;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.EntityManager;

import org.json.JSONException;
import org.json.JSONObject;

import system.SysOrganization;
import system.SysUserAccount;

import com.skyland.dynajpa.DynaEntityManagerFactory;
import com.skyland.interactions.action.InteractionDataHelper;
import com.skyland.property.PropCustomer;
import com.skyland.utils.HttpInvoker;


/**
 * @author limiao
 * 
 *         readContentFromPost
 * 
 */
public class PropertyService {

    public String updatePropertys() {
        try {
            String mess = "";
            EntityManager jpa=DynaEntityManagerFactory.getInstance().createEntityManager();

            com.skyland.accesslog.AccessLogAppenderFactory.getInstance()
                    .getAppender().log("调用呼叫中心接口", "业主资料实时推送", "数据:" + 1);

            String url = "/tianli/Owner_Details"; 
            Map<String, String> paramsMap = new HashMap<String, String>();

            paramsMap.put("PropRegion_ID", "1801");
            paramsMap.put("PropBuilding_ID", "2205");
            paramsMap.put("Floor", "10");
            paramsMap.put("PropRoom_ID", "5713");
            paramsMap.put("RoomNo", "5-324");
            paramsMap.put("CustomerName", "孙小九");
            paramsMap.put("Telephone", "13061974393");
            paramsMap.put("BuildArea", "60.4");
            paramsMap.put("ReceiveTime", "2016-03-01");
            String res = HttpInvoker.readContentFromPost(url, paramsMap);
            // com.skyland.accesslog.AccessLogAppenderFactory.getInstance().getAppender().log("调用呼叫中心接口回","更新工单状态"," 返回数据:"+res);
            return res;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }


    public String updateSysUserAccount() {
        try {
            EntityManager jpa=DynaEntityManagerFactory.getInstance().createEntityManager();

            String mess = "";
            com.skyland.accesslog.AccessLogAppenderFactory.getInstance()
                    .getAppender()
                    .log("调用呼叫中心接口", "用户信息实时推送接口", "数据:" + 2);

            String url = "/tianli/SysUserAccount"; 
            Map<String, String> paramsMap = new HashMap<String, String>();
            paramsMap.put("SysUserAccount_ID", "1601");
            paramsMap.put("LoginID", "LH");
            paramsMap.put("JobNo", "LH10021");
            paramsMap.put("UserName", "李辉");
            paramsMap.put("Status", "0");
            paramsMap.put("LineProp", "一线人员");
            paramsMap.put("MobilePhone", "1361816787");
            paramsMap.put("EMail", " [email protected]");
            paramsMap.put("DeleteFlag", "否");
            paramsMap.put("SysOrganization_ID", "3004");
            String res = HttpInvoker.readContentFromPost(url, paramsMap);
            // com.skyland.accesslog.AccessLogAppenderFactory.getInstance().getAppender().log("调用呼叫中心接口回","更新工单状态"," 返回数据:"+res);
            return res;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }


    public String updateSysOrganization() {
        try {
            EntityManager jpa=DynaEntityManagerFactory.getInstance().createEntityManager();
            String mess = "";
            com.skyland.accesslog.AccessLogAppenderFactory.getInstance()
                    .getAppender()
                    .log("调用呼叫中心接口", "公司机构实时推送接口", "数据:" + 3);
            String url = "/tianli/company";  
            Map<String, String> paramsMap = new HashMap<String, String>();
            paramsMap.put("SysOrganization_ID", "3007");
            paramsMap.put("OrgName", "工程部");
            paramsMap.put("ParentID", "0");
            paramsMap.put("DeleteFlag", "否");
            String res = HttpInvoker.readContentFromPost(url, paramsMap);
            // com.skyland.accesslog.AccessLogAppenderFactory.getInstance().getAppender().log("调用呼叫中心接口回","更新工单状态"," 返回数据:"+res);
            return res;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }

}

你可能感兴趣的:([学习笔记]调用外部接口)