InsertSupplier.java 1.54 KB
package com.huaheng.test;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.huaheng.api.jindie.InvokeHelper;
import com.huaheng.api.jindie.domain.supplier.SelectSupplier;
import com.huaheng.api.jindie.domain.uri.JinDieApiUri;
import com.huaheng.pc.monitor.job.task.RyTask;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@SpringBootTest
@RunWith(SpringRunner.class)
public class InsertSupplier {
    @Resource
    private InvokeHelper invokeHelper;
    @Resource
    private RyTask rytask;
    @Test
    public void insert() throws Exception {
        /**
         * {
         * 	"data":{
         * 		"FormId":"BD_Supplier",
         * 		"FieldKeys":"FNUMBER,FNAME",
         * 		"StartRow":0,
         *      "Limit":2000
         *
         *   }
         * }
         */
        rytask.login("{ \"acctID\":\"630f56d628d385\", \"username\":\"administrator\", \"password\":\"CW@kd2022\", \"lcid\":\"2052\" }");
        SelectSupplier sup=new SelectSupplier();
        SelectSupplier.DataDTO dataDTO = new SelectSupplier.DataDTO();
        dataDTO.setFormId("BD_Supplier");
        dataDTO.setFieldKeys("FNUMBER,FNAME");
        dataDTO.setStartRow(2001);
        dataDTO.setLimit(2000);
        sup.setData(dataDTO);
        Gson gson = new Gson();
        String s = gson.toJson(sup);
        invokeHelper.selectSupplier(JinDieApiUri.INSERT_SUPPLIER.getApiUri(),s);
    }
}