//代码块
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
*/
- 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;
}
}