package com.kingdee.eas.custom.beisen.synchronouspos.osf;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.bsf.service.app.IHRMsfService;
import com.kingdee.bos.rabbitmq.guava.Lists;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.beisen.utils.BeiSenUtils;
import com.kingdee.eas.custom.beisen.utils.BeisenParamByPropertiesUtil;
import com.kingdee.eas.custom.beisen.utils.Helper;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.sql.Date;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* description: SynchronousPosOSFService
* date: 2025/7/11 17:46
* author: lhbj
* version: 1.0
*/
public class SynchronousPosOSFService implements IHRMsfService {
@Override
public Object process(Context context, Map map) throws EASBizException, BOSException {
//例:/server/properties/beisen/posConfig.properties
String path = (String) map.get("path");
String posId = (String) map.get("posId");
String syncStartTimeStr = (String) map.get("syncStartTimeStr");
String syncEndTimeStr = (String) map.get("syncEndTimeStr");
try {
BeisenParamByPropertiesUtil util = new BeisenParamByPropertiesUtil(path);
Map keyMap = util.getConfig();
return this._syncPosToBeiSen(context,keyMap,posId,syncStartTimeStr,syncEndTimeStr);
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException throwables) {
throwables.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
return null;
}
protected String _syncPosToBeiSen(Context ctx,Map keyMap, String posId, String syncStartTimeStr, String syncEndTimeStr) throws BOSException, SQLException, IOException, URISyntaxException {
List responseList =Lists.newArrayList();
List addNewList = this._sendAddNewPosToBeisen(ctx,keyMap,posId,syncStartTimeStr,syncEndTimeStr);
responseList.addAll(addNewList);
List editList = this._sendEditPosToBeisen(ctx,keyMap,posId,syncStartTimeStr,syncEndTimeStr);
responseList.addAll(editList);
return responseList.toString();
}
/**
* shr系统数据组装北森请求参数
*
* @param ctx
* @param keyMap
* @param sql
* @return
* @throws BOSException
* @throws SQLException
*/
protected List