package com.weaver.seconddev.chapanda.kaixinyi.esb;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.chapanda.kaixinyi.constant.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;

import java.util.*;

@Service("Esb2KaixinyAction")
public class Esb2KaixinyAction implements EsbServerlessRpcRemoteInterface {
    private final static Logger log = LoggerFactory.getLogger(Esb2KaixinyAction.class);

    @Override
    public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
        log.error("Esb2DmpGetGmvCron start");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat sdf1 = new SimpleDateFormat("HHmmss");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String uuid = UUID.randomUUID().toString().replace("-", "");

        JSONObject dataJson = new JSONObject();
        dataJson.put("OPENVER", Constants.OPENVER);
        dataJson.put("OPENTRANSCODE", Constants.OPENTRANSCODE);
        dataJson.put("OPENMERNAME", Constants.OPENMERNAME);
        dataJson.put("OPENBUSITYPE", Constants.OPENBUSITYPE);
        dataJson.put("OPENLAUNCHDATE", sdf.format(new Date()));
        dataJson.put("OPENLAUNCHTIME", sdf1.format(new Date()));
        dataJson.put("OPENMERFLOWID", "IFOPH5SIMULATOR" + sdf2.format(new Date()));

        dataJson.put("USER_ID", "1399999999");
        dataJson.put("CORP_ID", "1399999999");
        dataJson.put("PAY_NAME", "2025年06月薪酬发放");
        dataJson.put("PAY_FLAG", "1");
        dataJson.put("SETT_ACC", "1");
        dataJson.put("PAY_CNY", "001");
        dataJson.put("FLOW_ID", "001");


        JSONArray payDetail = new JSONArray();
        JSONObject payDetailJson = new JSONObject();
        payDetailJson.put("NUM","");
        payDetailJson.put("EMP_NAM","");
        payDetailJson.put("ID_TYP","");
        payDetailJson.put("ID_NO","");
        payDetailJson.put("CARD_NO","");
        payDetailJson.put("BANK_NO","");
        payDetailJson.put("PAY_AMT","");
        payDetailJson.put("CNY","");
        payDetailJson.put("CYFG","");
        payDetailJson.put("PAY_TYPE","");
        payDetailJson.put("TRN_ABS","");
        payDetailJson.put("TAX_ID","");
        payDetailJson.put("OTHER_BANK_MOB","");
        payDetail.add(payDetail);
        dataJson.put("LIST", payDetail);

        Map<String, Object> actionMap = new HashMap<String, Object>();
        actionMap.put("code",200);
        actionMap.put("msg","Esb2DmpGetGmvCron");

        return WeaResult.success(actionMap);
    }

}
