package nckd.jimin.jyyy.hr.test;

import com.alibaba.fastjson.JSONArray;
import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.fileservice.FileServiceFactory;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.sdk.plugin.Plugin;
import kd.sdk.swc.hcdm.common.stdtab.ContrastPropResult;
import kd.sdk.swc.hcdm.common.stdtab.StdMatchParamWithDepEmp;
import kd.sdk.swc.hcdm.service.spi.SalaryStdQueryService;
import nckd.jimin.jyyy.hr.wtc.wtis.util.SyncPunchCardHelper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 单据操作插件
 */
public class PicTestPlugin extends AbstractOperationServicePlugIn implements Plugin {


    @Override
    public void afterExecuteOperationTransaction(AfterOperationArgs e) {
        super.afterExecuteOperationTransaction(e);
        DynamicObject[] bills = e.getDataEntities();
        List paramList = new ArrayList<>();
        StdMatchParamWithDepEmp param = new StdMatchParamWithDepEmp();
        param.setStdScmId(2193652343088628736L);
        param.setSalayStructureId(2193582497986514944L);
        param.setStandardItemId(2193580151457975296L);
        param.setUnionId("123");
        List<Long> list = new ArrayList<Long>();
        list.add(2188564502843231232L);
        Map map = new HashMap();
        map.put(1050L,list);
        param.setPersonPropValue(map);
        paramList.add(param);
        List a = SalaryStdQueryService.get().batchMatchStdTableWithDepEmp(paramList);

        System.out.println(a);

//        for (DynamicObject bill : bills) {
//            String fileName = bill.getString("nckd_filename");
//            String path = FileServiceFactory.getAttachmentFileService().getFileServiceExt().getRealPath(fileName);
//            System.out.println("--" + path);
//            DynamicObjectCollection cols = bill.getDynamicObjectCollection("123");
//            cols.getDeleteRows();
//
//            DynamicObject[] needUpdateBills = new DynamicObject[0];
//            OperationResult a = OperationServiceHelper.executeOperate("submit", "cas_recbill", needUpdateBills, OperateOption.create());
//        }
    }
}