| | |
| | | |
| | | import com.alibaba.cloud.commons.lang.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.shaded.com.google.protobuf.ServiceException; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.thoughtworks.xstream.XStream; |
| | |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.WebUtil; |
| | | import com.xkcoding.http.support.Http; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.map.CaseInsensitiveMap; |
| | | import org.springblade.core.redis.cache.BladeRedis; |
| | |
| | | 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.HttpMethod; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.mock.web.MockHttpServletRequest; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Value("${erp.item.btmName:XHDH}") |
| | | public String btmName; |
| | | |
| | | @Value("${erp.item.bearer:bearer: Bearer 7fc32939-0a59-da71-a6e6-6b0d37b53e8a}") |
| | | private String ERPXHDHAUTH; |
| | | |
| | | @Value("${erp.item.url:http://127.0.0.1/api/pp/pp/ext/extend/v1.0}") |
| | | private String ERPXHDHURL; |
| | | |
| | | @Value("${erp.item.tenant:10000}") |
| | | private String ERPXHDHTENANT; |
| | | |
| | | |
| | | /** |
| | | * 业务类型的服务 |
| | | */ |
| | | @Autowired |
| | | private IBtmTypeClient btmTypeClient; |
| | | |
| | | /** |
| | | * 通用查询 |
| | | */ |
| | | @Resource |
| | | private CommonsMapper commonsMapper; |
| | | |
| | | @Resource |
| | | private MdmEngineService mdmEngineServiceI; |
| | | |
| | | /** |
| | | * 批量处理的服务 |
| | | */ |
| | | @Resource |
| | | private MdmIOService mdmIOService; |
| | | |
| | | @Resource |
| | | private IPasswordFreeLoginService passwordFreeLoginService; |
| | | |
| | | @Resource |
| | | private IDockingLogeService dockingLogeService; |
| | | |
| | | @Resource |
| | | private IDockingDataService dockingDataService; |
| | | |
| | | @Resource |
| | | private IDockingTaskService dockingTaskService; |
| | | |
| | | @Resource |
| | | private IDockingSystemConfigService dockingSystemConfigService; |
| | | |
| | | @Resource |
| | | private ICodeClassifyService codeClassifyService; |
| | | |
| | |
| | | * 同步型号代号 |
| | | */ |
| | | @Override |
| | | public void saveItemDataSyncScheduing(String endDate) { |
| | | public void saveItemDataSyncScheduing(String endDate) throws ServiceException { |
| | | String paramString=""; |
| | | String backString="成功"; |
| | | String msg="成功"; |
| | |
| | | Map<String,String>searchDataMap= VciBaseUtil.objectToMapString(searchItemParam); |
| | | try { |
| | | paramString=JSONObject.toJSON(searchItemParam).toString(); |
| | | String res= mdmSearchItemCodeProvider.getppModelByElem(searchItemParam); |
| | | SearchItemVO searchItemVO = JSONObject.toJavaObject(JSONObject.parseObject(res), SearchItemVO.class); |
| | | /**SearchItemVO searchItemVO=new SearchItemVO(); |
| | | List<SearchItemDataVO> data=new ArrayList<>(); |
| | | SearchItemDataVO searchItemDataVO1=initData("1","","pro-00001"); |
| | | SearchItemDataVO searchItemDataVO2=initData("0","item-00001",""); |
| | | data.add(searchItemDataVO1); |
| | | data.add(searchItemDataVO2); |
| | | //searchItemVO.setData(data); |
| | | searchItemVO.setCode("200");**/ |
| | | //searchItemVO.setMsg(""); |
| | | // TODO: 改为使用HttpUtils方式进行申请,因为现在申请用之前的方式会报错 |
| | | LinkedMultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | headers.add("Authorization",ERPXHDHAUTH); |
| | | headers.add("X-ECC-Current-Tenant",ERPXHDHTENANT); |
| | | headers.add("Accept-Language","zh-CHS"); |
| | | headers.add("Content-Type",MediaType.APPLICATION_JSON.toString()); |
| | | String res = HttpUtils.request(ERPXHDHURL+"/getppModelByElemNew",paramString,headers, HttpMethod.POST,MediaType.APPLICATION_JSON); |
| | | // String res= mdmSearchItemCodeProvider.getppModelByElem(searchItemParam); |
| | | SearchItemVO searchItemVO = JSONObject.toJavaObject(JSONObject.parseObject(res), SearchItemVO.class); |
| | | if (searchItemVO != null) { |
| | | BladeUser finalUser; |
| | | paramString = JSONObject.toJSON(searchItemVO).toString(); |
| | |
| | | } |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | ; |
| | | log.error("查询失败--->" + e); |
| | | success = false; |
| | | backString = "查询失败--->" + e; |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | throw new Throwable("接口未返回信息"); |
| | | throw new Throwable("接口未返回信息"); |
| | | } |
| | | }catch (Throwable e1){ |
| | | e1.printStackTrace(); |
| | |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | log.error(e.getMessage()); |
| | | throw new VciBaseException(e.getMessage()); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | throw new ServiceException(e1.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | for (DockingSysIntHeader dockingSysIntHeader : dockingSysIntHeaderList) { |
| | | headers.add(dockingSysIntHeader.getHeaderKey(), dockingSysIntHeader.getHeaderValue()); |
| | | } |
| | | backString = HttpUtils.postByMediaType(url, params, headers,MediaType.valueOf(dockingSystemConfig.getContentType())); |
| | | backString = HttpUtils.postByMediaType( |
| | | url, |
| | | params, |
| | | headers, |
| | | Func.isNotBlank(dockingSystemConfig.getContentType()) ? MediaType.valueOf(dockingSystemConfig.getContentType()):MediaType.APPLICATION_FORM_URLENCODED |
| | | ); |
| | | } |
| | | if(backString.startsWith("\"")){ |
| | | backString=backString.substring(backString.indexOf("\"")+1); |