| | |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.Api1101; |
| | | import com.fzzy.api.entity.Api1103; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.utils.RedisUtil; |
| | | import com.fzzy.api.view.repository.Api1101Rep; |
| | | import com.fzzy.api.view.repository.Api1103Rep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.push.gd2022.dto.*; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwApi1101; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwReqDto; |
| | | import com.fzzy.push.shjdjw2023.dto.ShjdjwRespDto; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ApiCommonService apiCommonService; |
| | | |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | @Autowired |
| | | private Api1101Rep api1101Rep; |
| | | @Autowired |
| | | private Api1103Rep api1103Rep; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | GD2022ResponseDto responseDto = Shjdjw2023HttpClientUtil.postPushData(conf.getApiUrl() + inteId, jsonData, conf); |
| | | ShjdjwRespDto responseDto = Shjdjw2023HttpClientUtil.postPushData(conf.getApiUrl(), jsonData, conf); |
| | | responseDto.setBizId(bizId); |
| | | apiLog.setStatus(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getMsg()); |
| | | apiLog.setStatus(responseDto.getCode() == 1 ? 0 : responseDto.getCode()); |
| | | apiLog.setResult(responseDto.getDescription()); |
| | | apiLogRep.save(apiLog); |
| | | ResponseDto resd = new ResponseDto(); |
| | | resd.setSuccess(responseDto.getCode() == 200 ? 0 : responseDto.getCode()); |
| | | resd.setMsg(responseDto.getMsg()); |
| | | resd.setSuccess(responseDto.getCode() == 1 ? 0 : responseDto.getCode()); |
| | | resd.setMsg(responseDto.getDescription()); |
| | | //updateGD2022AuthToken(responseDto,conf, token); |
| | | return resd; |
| | | } catch (Exception e) { |
| | |
| | | private String getJsonData(String inteId, Object data, String interfaceId) { |
| | | ShjdjwReqDto<Object> dto = new ShjdjwReqDto<>(); |
| | | dto.setId(getDataId(interfaceId)); |
| | | List<Object> list = new ArrayList<>(); |
| | | //转换封装 |
| | | if (Constant.API_CODE_1101.equals(inteId)) { |
| | | dto.setData(data); |
| | | } else if (Constant.API_CODE_1202.equals(inteId)) { |
| | | |
| | | |
| | | dto.setData(data); |
| | | } else { |
| | | dto.setData(data); |
| | | if (Constant.API_CODE_1102.equals(inteId)) { |
| | | ShjdjwApi1101 shjdjwApi1101 = new ShjdjwApi1101(); |
| | | BeanUtils.copyProperties(data, shjdjwApi1101); |
| | | //查询单位信息 |
| | | List<Api1101> listApi1101 = api1101Rep.findPushData(shjdjwApi1101.getKqdm()); |
| | | Api1101 api1101 = null; |
| | | if(null != listApi1101 && listApi1101.size() > 0){ |
| | | api1101 = listApi1101.get(0); |
| | | } |
| | | |
| | | if(null != api1101){ |
| | | shjdjwApi1101.setDwmc(api1101.getDwmc()); |
| | | shjdjwApi1101.setKqs(api1101.getKqs()); |
| | | } |
| | | //查询仓房信息 |
| | | List<Api1103> listApi1103 = api1103Rep.findPushData(shjdjwApi1101.getKqdm()); |
| | | if(null != listApi1103 && listApi1103.size() > 0){ |
| | | for(int i = 0; i < listApi1103.size(); i++){ |
| | | if(i == 0){ |
| | | shjdjwApi1101.setCfmc(listApi1103.get(i).getCfmc()); |
| | | }else { |
| | | shjdjwApi1101.setCfmc(shjdjwApi1101.getCfmc() + "#" + listApi1103.get(i).getCfmc()); |
| | | } |
| | | } |
| | | } |
| | | //单位信息封装 |
| | | list.add(shjdjwApi1101); |
| | | } else if (Constant.API_CODE_1202.equals(inteId)) { |
| | | list.add(data); |
| | | } else { |
| | | list.add(data); |
| | | } |
| | | dto.setData(list); |
| | | return JSON.toJSONString(dto); |
| | | } |
| | | |
| | |
| | | */ |
| | | private String getDataId(String inteId) { |
| | | switch (inteId) { |
| | | case "1101": |
| | | case "1102": |
| | | //单位接口编码 |
| | | return ShjdjwApiCodeConstant.API_CODE_LS1101; |
| | | case "1202": |
| | | return ShjdjwApiCodeConstant.API_CODE_LS1302; |