SyncZhongLiDataComponentTest.java 2.03 KB
package cn.com.glsx.stdinterface.modules.component;

import cn.com.glsx.Application;
import cn.com.glsx.stdinterface.modules.entity.WorkOrder;
import cn.com.glsx.stdinterface.modules.mapper.WorkOrderMapper;
import cn.com.glsx.stdinterface.modules.model.SyncInstallDataRequest;
import cn.com.glsx.stdinterface.modules.util.zlgj.ZLUtils;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SyncZhongLiDataComponentTest {

    @Autowired
    private SyncZhongLiDataComponent syncZhongLiDataComponent;

    @Autowired
    private WorkOrderMapper workOrderMapper;

    @Test
    public void syncZhongLiInstallTime() {
        WorkOrder workOrder = workOrderMapper.selectByOrderNo("2022121516000001");
        syncZhongLiDataComponent.syncZhongLiInstallTime(workOrder);
    }

    @Test
    public void test01() {
        SyncInstallDataRequest syncInstallDataRequest = new SyncInstallDataRequest();
        syncInstallDataRequest.setAppcode("2022121516000001");
        syncInstallDataRequest.setInstallationEndTime("2022-12-15 16:40:31");
        long currentTime = 1688106964842L;
        String sign01 = ZLUtils.getSign(JSON.toJSONString(syncInstallDataRequest), currentTime);
        System.out.println("sign01= " + sign01);

        String data = JSON.toJSONString(syncInstallDataRequest);
        System.out.println("data = " + data);
        String sign02 = ZLUtils.getSign(data, currentTime);
        System.out.println("sign02 = " + sign02);

        String a = "{\"appcode\":\"2022121516000001\",\"installationEndTime\":\"2022-12-15 16:40:31\"}";
        String sign03 = ZLUtils.getSign(a, currentTime);
        System.out.println("sign03 = " + sign03);
    }

}