package com.customization.htsc.cus;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.workflow.service.WorkflowShareService;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.htsc.workflow.util.WorkflowUtil;
import com.engine.workflow.cmd.requestForm.RequestSubmitCmd;
import com.engine.workflow.entity.requestForm.RequestOperationResultBean;
import tebie.applib.api.M;
import weaver.conn.ConnStatement;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.htsc.comInfo.PropBean;

import javax.servlet.http.HttpServletRequest;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Author:wanxq
 * Date:2021/5/31 14:53
 * Description: 流程提交后处理多人力资源字段的分组数据
 * Copyright:上海泛微网络科技股份有限公司
 */
@CommandDynamicProxy(target = RequestSubmitCmd.class, desc = "流程提交后处理多人力资源字段的分组情况")
public class MultiUserTypeHandleCmd extends AbstractCommandProxy<Map<String, Object>> {
    @Override
    public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
        RequestSubmitCmd requestSubmitCmd = (RequestSubmitCmd) targetCommand;
        HttpServletRequest request = requestSubmitCmd.getRequest();//从request中可以取到参数，不用以前的方法了
        int requestid = Util.getIntValue(request.getParameter("requestid"));
        //执行标准的业务处理
        Map<String, Object> result = nextExecute(targetCommand);
        RequestOperationResultBean resultBean = (RequestOperationResultBean) result.get("data");

        //保存多人力资源字段的数据结构
        if(requestid<0){
            requestid = (int) resultBean.getResultInfo().get("requestid");
        }
        WorkflowUtil.saveMultiUserTypeData(requestid,request);

        return result;
    }



    public static void main(String[] args) {
        System.out.println("field138531".substring(5));
    }
}
