package com.vci.ubcs.example.service.impl; import com.vci.ubcs.example.service.ICalledIntegrationService; import com.vci.ubcs.example.util.HttpUtils; import com.vci.ubcs.example.util.WsClientUtil; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * 统一申请接口:UBCS编码资源管理系统,被其他集成的系统的通用接口调用示例 * @author ludc * @date 2024/2/27 20:34 */ @Service public class CalledIntegrationServiceImpl implements ICalledIntegrationService { /** * 统一申请接口URL */ private String UNIAPPLYURL = "http://localhost/ubcs-code/applyCode"; /** * 标准申请接口URL */ private String UNIAPPLYBZURL = "http://localhost/ubcs-code/applyCodeBZ"; /** * 对编码系统的统一申请接口调用,rest方式 */ @Override public void sendApplyCodeByRest() { // 组织数据 MultiValueMap params = new LinkedMultiValueMap<>(); params.add("dataType","json"); //params.add("dataType","xml");根据需求自行选择 params.add("dataString","");//根据需求自行组织json格式或者xml格式的数据 // 是xml时的格式示例: /*
*/ // 是json时的格式示例 params.add( "dataString", "\"data\": { \"classifys\": { \"classify\": [ { \"classCode\": \"1025\", \"fullclsfNamePath\": \"\", \"library\": \"10\", \"sections\": { \"section\": [ { \"name\": \"分类号\", \"value\": \"1025\" }, { \"name\": \"顺序号\", \"value\": \"\" } ] }, \"obejects\": { \"obeject\": [ { \"code\": \"\", \"id\": \"\", \"status\": \"Released\", \"operate\": \"create\", \"creator\": \"0000\", \"prop\": [ { \"key\": \"name\", \"text\": \"名称\", \"value\": \"\" } ] } ] } } ], \"systemId\": \"ERP\", \"user\": { \"ip\": \"127.0.0.1\", \"trueName\": \"00000\", \"userName\": \"test\" } } } " ); MultiValueMap headers = new LinkedMultiValueMap<>(); String res = HttpUtils.post(UNIAPPLYURL,params,headers); } /** * 对编码系统统一申请接口调用,WebService方式 */ @Override public void sendApplyCodeByWebService() { MultiValueMap params = new LinkedMultiValueMap<>(); params.add("dataType","json"); MultiValueMap headers = new LinkedMultiValueMap<>(); } }