| | |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.mock.web.MockHttpServletRequest; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.jws.WebMethod; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.xml.ws.WebServiceContext; |
| | | import javax.xml.ws.handler.MessageContext; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | |
| | | @Service |
| | | @Slf4j |
| | | public class CodeDuckingSyncServiceImpl implements ICodeDuckingSyncService { |
| | | |
| | | @Value("${dataSyncPush.dataParamName:xmlData}") |
| | | public String DATA_PARAM_NAME; |
| | | @Value("${dataSyncPush.dataId:itemid}") |
| | |
| | | |
| | | @Autowired |
| | | private ICodeClassifyValueService codeClassifyValueService; |
| | | |
| | | @Autowired(required = false) |
| | | private AttributeMapConfig attributeMapConfig; |
| | | |
| | | /*** |
| | | * resdis缓存服务 |
| | | */ |
| | | @Resource |
| | | private BladeRedis bladeRedis; |
| | | |
| | | @Resource |
| | | private IDockingSysIntParamService dockingSysIntParamService; |
| | | |
| | | @Resource |
| | | private IDockingSysIntHeaderService dockingSysIntHeaderService; |
| | | |
| | | @Autowired(required = false) |
| | | private MdmSearchItemCodeProvider mdmSearchItemCodeProvider; |
| | | |
| | | @Autowired |
| | | HttpServletRequest request; |
| | | |
| | | @Override |
| | | public void DockingDataSyncScheduing() { |
| | | |
| | |
| | | }); |
| | | return R.success("手动推送完成,请核对是否推送成功"); |
| | | } |
| | | |
| | | private SearchItemDataVO initData(String status,String itemCode,String mmCode){ |
| | | SearchItemDataVO searchItemDataVO=new SearchItemDataVO(); |
| | | searchItemDataVO.setLastchangedon(new Date()); |
| | |
| | | |
| | | return request; |
| | | } |
| | | |
| | | /*** |
| | | * 同步型号代号 |
| | | */ |
| | |
| | | } |
| | | return codeOrderSecDTOList; |
| | | } |
| | | |
| | | /*** |
| | | * 读取属性映射配置信息 |
| | | * @param systemId |
| | |
| | | throw new Throwable("组织数据映射值失败"); |
| | | } |
| | | } |
| | | private void changeObjectToMap(SearchItemUpperCaseDataVO searchItemDataVO, String code, BladeUser user,String operation,List<ApplyDataVO> object){ |
| | | |
| | | private void changeObjectToMap(SearchItemUpperCaseDataVO searchItemDataVO, String code, BladeUser user,String operation,List<ApplyDataVO> object){ |
| | | ApplyDataVO applyDataVO=new ApplyDataVO(); |
| | | List<ProppertyVO> propList=new ArrayList<>(); |
| | | //String status= searchItemDataVO.getStatus();//数据状态 字符型,枚举值;制单:0;审批中:1;通过:2;驳回:3; |
| | |
| | | applyDataVO.setProp(propList); |
| | | object.add(applyDataVO); |
| | | } |
| | | private void initProperty(String key,String text,String value,List<ProppertyVO> propList){ |
| | | |
| | | private void initProperty(String key,String text,String value,List<ProppertyVO> propList){ |
| | | ProppertyVO vo=new ProppertyVO(); |
| | | vo.setKey(key); |
| | | vo.setText(StringUtils.isBlank(text)?"":text); |
| | | vo.setValue(StringUtils.isBlank(value)?"":value); |
| | | propList.add(vo); |
| | | } |
| | | |
| | | /*** |
| | | * 查询redis中数据,对比后插入dockingtask |
| | | * @param type |
| | |
| | | for (DockingTask dockingTask:dockingTaskList){ |
| | | //每个task一个事务,开启 |
| | | String paramString=""; |
| | | String sendString=""; |
| | | Object sendString=""; |
| | | String backString=""; |
| | | //查询系统接口信息,ip method,dataType |
| | | String systeminfooid = dockingTask.getSysInfoOid();//sysininfo 的oid |
| | |
| | | DockingSystemConfig dockingSystemConfig = dockingSystemConfigService.getById(systeminfooid); |
| | | String paramType = dockingSystemConfig.getParamType();//xml/json |
| | | if(paramType.equals(DATATYPE_JSON)){ |
| | | Object object = JSONObject.toJSON(jsonRootDataDTO); |
| | | sendString = object.toString(); |
| | | Object object = JSONObject.toJSON(jsonRootDataDTO); |
| | | sendString = object; |
| | | }else{ |
| | | //组织返回接口信息 |
| | | XStream xStream = new XStream(new DomDriver()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 发送编码主数据 |
| | | */ |
| | |
| | | for (DockingTask dockingTask:dockingTaskS){ |
| | | //每个task一个事务,开启 |
| | | String paramString=""; |
| | | String sendString=""; |
| | | Object sendString=""; |
| | | String backString=""; |
| | | try { |
| | | //查询系统接口信息,ip method,dataType |
| | |
| | | String paramType = dockingSystemConfig.getParamType();//xml/json |
| | | if (paramType.equals(DATATYPE_JSON)) { |
| | | Object object = JSONObject.toJSON(nodeJosnDTO); |
| | | sendString = object.toString(); |
| | | //sendString = object.toString(); |
| | | sendString = object; |
| | | } else { |
| | | //组织返回接口信息 |
| | | XStream xStream = new XStream(new DomDriver()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 调用接口 |
| | | * @param sendString |
| | | * 调用接口,传参为JSON时传object类型,Content-Type改为界面配置的 |
| | | * @param sendObject |
| | | * @param dockingSystemConfig |
| | | * @param dockingTask |
| | | * @throws Throwable |
| | | */ |
| | | private void callInterface(String sendString , DockingSystemConfig dockingSystemConfig,DockingTask dockingTask,String operation) throws Throwable{ |
| | | private void callInterface(Object sendObject, DockingSystemConfig dockingSystemConfig,DockingTask dockingTask,String operation) throws Throwable{ |
| | | String paramString = ""; |
| | | |
| | | String backString = ""; |
| | | String msg=""; |
| | | String sendString = sendObject.toString(); |
| | | String msg= "" ; |
| | | String url = dockingSystemConfig.getRequestUrl();//url |
| | | List<ResultNodeObjectDTO> resultNodeObjectDTOS =new ArrayList<>(); |
| | | try { |
| | |
| | | paramString = sendurl; |
| | | backString = HttpUtils.get(sendurl); |
| | | } else if (requestmethod.equals(URLTYPE_POST)) {//POST请求 |
| | | MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | for (DockingSysIntParam dockingSysIntParam : dockingSysIntParamList) { |
| | | params.add(dockingSysIntParam.getParamKey(), dockingSysIntParam.getParamValue()); |
| | | } |
| | | params.add(DATA_PARAM_NAME,sendString); |
| | | params.add(DATA_PARAM_NAME,sendObject); |
| | | paramString = params.toString(); |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | for (DockingSysIntHeader dockingSysIntHeader : dockingSysIntHeaderList) { |
| | | headers.add(dockingSysIntHeader.getHeaderKey(), dockingSysIntHeader.getHeaderValue()); |
| | | } |
| | | backString = HttpUtils.post(url, params, headers); |
| | | backString = HttpUtils.postByMediaType(url, params, headers,MediaType.valueOf(dockingSystemConfig.getContentType())); |
| | | } |
| | | if(backString.startsWith("\"")){ |
| | | backString=backString.substring(backString.indexOf("\"")+1); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /*** |
| | | * 查询需要集成的业务数据任务 |
| | | */ |
| | |
| | | List<DockingTask> dockingTaskDOS = dockingTaskService.list(queryWrapper); |
| | | sendpushClsfForService(dockingTaskDOS); |
| | | } |
| | | |
| | | public void initSysadmin(){ |
| | | SessionInfo sessionInfo = new SessionInfo(); |
| | | sessionInfo.setUserId("sysAdmin"); |
| | |
| | | sessionInfo.setUserSecret(UserSecretEnum.PRIVACY.getValue()+""); |
| | | WebUtil.setSessionInfo(sessionInfo); |
| | | } |
| | | |
| | | /** |
| | | * dockingdata根据oid修改sendflag |
| | | * @param oid |
| | |
| | | } |
| | | return u; |
| | | } |
| | | |
| | | } |
| | | |