package weaver.interfaces.htsc.payment;

import com.engine.htsc.payment.util.BizUtils;
import com.engine.htsc.payment.util.PayUtil;
import weaver.general.BaseBean;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;

/**
 * Created by K1810006 on 2021/03/04.
 */
public class UpdatePaymentDataAction extends BaseBean implements Action {


	@Override
	public String execute(RequestInfo requestInfo) {

		String requestid = requestInfo.getRequestid();
		String tablename = requestInfo.getRequestManager().getBillTableName();

		try {
			writeLog(String.format("it流程更新合同信息UpdatePaymentData, requestid:%s; tablename: %s",
					requestid, tablename));
			boolean b = BizUtils.whetherItOrTy(requestid, tablename);
			writeLog(String.format("当前流程是否it付款, false为it付款 [%s]", b));
			if (!b) {
				PayUtil.updateItPaymentInfoToHT(requestid, tablename);
			}
		} catch (Exception e) {
			requestInfo.getRequestManager().setMessage("付款信息更新失败！");
			e.printStackTrace();
			return Action.FAILURE_AND_CONTINUE;
		}

		return Action.SUCCESS;
	}

}
