| | |
| | | import com.fzzy.api.dto.GbCodingData; |
| | | import com.fzzy.api.dto.ReqGbCoding; |
| | | import com.fzzy.api.dto.RespGbCoding; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.entity.GbUnifiedCoding; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | | import com.fzzy.api.view.repository.GbUnifiedCodingRep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | import org.springframework.data.jpa.domain.Specification; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.persistence.criteria.CriteriaBuilder; |
| | | import javax.persistence.criteria.CriteriaQuery; |
| | | import javax.persistence.criteria.Predicate; |
| | |
| | | private GbUnifiedCodingRep codingRep; |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | @Autowired |
| | | private ApiCommonService apiCommonService; |
| | | |
| | | /** |
| | | * gbUnifiedCodingPR#pageList |
| | |
| | | } |
| | | str = (String) param.get("cfmc"); |
| | | if (StringUtils.isNotBlank(str)) { |
| | | Predicate predicate2 = cb.equal(root.get("cfmc"),str); |
| | | Predicate predicate2 = cb.equal(root.get("cfmc"), str); |
| | | predicates.add(predicate2); |
| | | } |
| | | str = (String) param.get("kqmc"); |
| | | if (StringUtils.isNotBlank(str)) { |
| | | Predicate predicate3 = cb.equal(root.get("kqmc"),str); |
| | | Predicate predicate3 = cb.equal(root.get("kqmc"), str); |
| | | predicates.add(predicate3); |
| | | } |
| | | return cb.and(predicates.toArray(new Predicate[0])); |
| | |
| | | return "执行失败:单位编码为空,请核查!"; |
| | | } |
| | | |
| | | String url = GB_CODING_URL; |
| | | List<ApiConfs> apiConfs = apiCommonService.listCacheConf(); |
| | | if (null != apiConfs || apiConfs.size() > 0) { |
| | | ApiConfs apiConf = apiConfs.get(0); |
| | | if (null != apiConf && StringUtils.isNotEmpty(apiConf.getGbCodingUrl())) { |
| | | url = apiConf.getGbCodingUrl(); |
| | | } |
| | | } |
| | | |
| | | //设置参数 |
| | | ReqGbCoding reqGbCoding = new ReqGbCoding(dwdm); |
| | | RespGbCoding respGbCoding = restTemplate.postForObject(GB_CODING_URL, reqGbCoding, RespGbCoding.class); |
| | | if(null == respGbCoding){ |
| | | RespGbCoding respGbCoding = restTemplate.postForObject(url, reqGbCoding, RespGbCoding.class); |
| | | if (null == respGbCoding) { |
| | | return "拉取数据失败,请重试!"; |
| | | } |
| | | if(!"0".equals(respGbCoding.getCode())){ |
| | | if (!"0".equals(respGbCoding.getCode())) { |
| | | return respGbCoding.getMsg(); |
| | | } |
| | | GbCodingData data = JSONObject.parseObject(JSONObject.toJSONString(respGbCoding.getData()), GbCodingData.class); |
| | | if(null == data || data.getList().isEmpty()){ |
| | | if (null == data || data.getList().isEmpty()) { |
| | | return "拉取数据为空,请重试!"; |
| | | } |
| | | for (GbUnifiedCoding gbUnifiedCoding : data.getList()) { |