| | |
| | | import cn.huge.base.common.bo.R; |
| | | import cn.huge.base.common.utils.AesUtils; |
| | | import cn.huge.base.common.utils.HttpClientUtils; |
| | | import cn.huge.base.common.utils.ObjectUtils; |
| | | import cn.huge.module.grid.domain.dto.GridCompanyDTO; |
| | | import cn.huge.module.grid.domain.vo.*; |
| | | import com.alibaba.fastjson.JSON; |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.util.Base64; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.*; |
| | | |
| | | import static cn.huge.base.common.utils.AesUtils.KEY_ALGORITHM; |
| | | |
| | |
| | | return headVo; |
| | | } |
| | | |
| | | public Page pageQuery(GridCompanyVo gridCompanyVo) throws Exception { |
| | | Sort sort = Sort.by(Sort.Direction.DESC, "create_time"); |
| | | PageRequest pageRequest = PageRequest.of(gridCompanyVo.getPage()-1, gridCompanyVo.getPageSize(), sort); |
| | | // R<GridCompanyDTO> companyList = getCompanyList(gridCompanyVo); |
| | | String url = "http://183.2.142.21:9007/api/thrid/grid/company/get-company-list"; |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | String s = HttpClientUtils.httpPostRaw(url, JSON.toJSONString(gridCompanyVo), headers, "utf-8"); |
| | | R companyList = JSON.parseObject(s, R.class); |
| | | if(companyList.getCode() != 0){ |
| | | throw new Exception(companyList.getMsg()); |
| | | } |
| | | if(ObjectUtils.isNotEmpty(companyList)){ |
| | | GridCompanyDTO data = JSON.parseObject(JSON.toJSONString(companyList.getData()), GridCompanyDTO.class); |
| | | if(ObjectUtils.isNotEmpty(data)){ |
| | | List<GridCompanyDTO.UnitDTO> records = data.getRecords(); |
| | | return new PageImpl<>(records, pageRequest, data.getTotal()); |
| | | } |
| | | } |
| | | return new PageImpl<>(new ArrayList<>(), pageRequest, 0); |
| | | } |
| | | |
| | | } |