教育训练处考试制证系统后端
“djh”
2025-04-24 f9cb0f3f384279b2cbe87c35dde3ba573a0197f3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.ruoyi;
 
import com.alibaba.fastjson2.JSONObject;
import com.gkhy.exam.institutionalaccess.model.req.ThCertReqDTO;
import com.gkhy.exam.institutionalaccess.service.TripartiteInterfaceService;
import com.ruoyi.common.core.domain.model.InstitutionUser;
import com.ruoyi.common.signature.AESUtils;
import com.ruoyi.framework.security.context.ThreeInContextHolder;
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.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
 
 
import java.time.LocalDateTime;
import java.util.*;
 
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RuoYiApplication.class)
@ActiveProfiles("dev")
@Slf4j
public class CertTest {
    @Autowired
    private TripartiteInterfaceService tripartiteInterfaceService;
 
    @Test
    public void testCertInsert() throws Exception {
        ThreeInContextHolder.setContext(new InstitutionUser().setId(1L).setInstitutionalName("test"));
        List<ThCertReqDTO>thCertDTOs=new ArrayList<>();
        ThCertReqDTO thCertDTO = new ThCertReqDTO();
        thCertDTO.setUuid(UUID.randomUUID().toString());
        thCertDTO.setName("王五");
        thCertDTO.setIdcard("123456789012345679");
        thCertDTO.setBatchUuid("1ef0b81f-dcb7-62a9-ad8f-63e252089bc8");
        thCertDTO.setTrainOrgName("1234567890123");
        thCertDTO.setCertTime(LocalDateTime.now());
        thCertDTO.setCertUrl("https://p26.toutiaoimg.com/origin/tos-cn-i-qvj2lq49k0/22f10850c5234b5285350743cfa16357");
        thCertDTOs.add(thCertDTO);
        String jsonString = JSONObject.toJSONString(thCertDTOs);
        JSONObject object=new JSONObject();
        object.put("data", AESUtils.encrypt(jsonString));
        tripartiteInterfaceService.receiveCerts(object);
    }
 
 
}