OA和别的系统对接的java文件,调的websevice接口的参考实例


在这里插入图片描述

//代码块
package com.bj520.action;

import com.alibaba.fastjson.JSON;
import com.bj520.service.zs.Webfcs;
import com.bj520.service.zs.WebfcsLocator;
import com.bj520.util.LogUtil;
import com.bj520.util.ZsResultUtil;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

import javax.xml.rpc.ServiceException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**

    • Description: 追溯礼服转移回写
    • Created by cyb
    • Date:2019/12/18
      */

public class ZsLiFuZhuanYi implements Action {
private String status; // 0 未送审 1 送审 2门店接收

public String getStatus() {
    return status;
}

public void setStatus(String status) {
    this.status = status;
}

@Override
public String execute(RequestInfo request) {
    LogUtil log = new LogUtil("追溯礼服转移回写", request);
    String requestId = request.getRequestid();  //获取请求requestId
    String maintable = request.getRequestManager().getBillTableName(); //获取当前流程的数据表名称
    RecordSet rs = new RecordSet();
    String sql_wf;
    if (status.equals("0") || status.equals("1")) {
        sql_wf = "select d.zsid,d.zslx from " + maintable + " m ," + maintable + "_dt1 d " +
                " where m.id=d.mainid  and m.requestid=" + requestId;
    } else {
        sql_wf = "select d.message1,d.message2 from " + maintable + " m ," + maintable + "_dt2 d " +
                " where m.id=d.mainid and d.type='S' and m.requestid=" + requestId;
    }

    log.info(sql_wf);
    rs.execute(sql_wf);
    List<Map<String, String>> list = new ArrayList<>();
    while (rs.next()) {
        Map<String, String> map = new HashMap<>();
        map.put("iId", rs.getString(1));
        map.put("cType", rs.getString(2));
        map.put("cState", status);
        list.add(map);
    }
    Webfcs webfcs = new WebfcsLocator();
    String result;
    try {
        result = webfcs.getWebfcsSoap12().API_WRITER_FZADJUST(JSON.toJSONString(list));
        log.info(JSON.toJSONString(list));
        log.info(result);
        if (!ZsResultUtil.isSuccess(result)) {
            return FAILURE_AND_CONTINUE;
        }
    } catch (RemoteException | ServiceException e) {
        e.printStackTrace();
        log.info("Exception=>>>>>" + e.getMessage());
        return FAILURE_AND_CONTINUE;
    }
    log.end();
    return SUCCESS;

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值