同步机票退款代码
This commit is contained in:
parent
f4bc30ecf8
commit
426016cf13
|
@ -12,6 +12,8 @@ import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
|||
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
|
||||
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.google.gson.Gson;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/public/CTrip")
|
||||
public class CTripNoteController {
|
||||
|
@ -57,7 +60,9 @@ public class CTripNoteController {
|
|||
@Transactional
|
||||
@PostMapping("/status")
|
||||
public CTripStatusResponse statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) {
|
||||
String productType = cTripStatusNotification.getProductType();
|
||||
Gson gson = new Gson();
|
||||
log.info(gson.toJson(cTripStatusNotification));
|
||||
String productType = cTripStatusNotification.getProductType();
|
||||
String orderStatus = cTripStatusNotification.getOrderStatus();
|
||||
String orderId = cTripStatusNotification.getOrderId();
|
||||
String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId, C_TRIP_REQUEST_SECRET);
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.chint.dc.api.dto.DataCenterOption;
|
|||
import com.chint.dc.api.service.DataCenterService;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.service.JTCompanyDomainService;
|
||||
import com.chint.interfaces.rest.user.dto.AccessKeyDTO;
|
||||
import com.chint.interfaces.rest.user.dto.UserDataDTO;
|
||||
import com.google.gson.Gson;
|
||||
|
@ -13,6 +14,7 @@ import org.apache.http.client.HttpClient;
|
|||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -33,6 +35,9 @@ public class UserSFRequest {
|
|||
@Value("${sf.openApiBaseUrl}")
|
||||
private String OPENAI_BASE_URL;
|
||||
|
||||
@Autowired
|
||||
private JTCompanyDomainService jtCompanyDomainService;
|
||||
|
||||
private AccessKeyDTO akSkLoad() {
|
||||
String asSkUrl = AK_BASE_URL + GET_AK_URL + "?systemId=" + systemId;
|
||||
HttpClient client = HttpClients.createDefault();
|
||||
|
@ -73,25 +78,34 @@ public class UserSFRequest {
|
|||
}
|
||||
|
||||
|
||||
public List<UserDataDTO> getUserSFDataFromOpenApiBatch() {
|
||||
Gson gson = new Gson();
|
||||
AccessKeyDTO akSkLoad = akSkLoad();
|
||||
DataCenterOption option = new DataCenterOption();
|
||||
option.setSk(akSkLoad.sk);
|
||||
option.setAk(akSkLoad.ak);
|
||||
option.setUrl(OPENAI_BASE_URL);
|
||||
DataCenterService dataCenterService = new DataCenterService(option);
|
||||
LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||
map.put("start", 1);
|
||||
map.put("pageSize", 99);
|
||||
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||
Type type = new TypeToken<List<UserDataDTO>>() {
|
||||
}.getType();
|
||||
List<UserDataDTO> userDataDTOs = gson.fromJson(result.getData().toString(), type);
|
||||
public List<User> getUserSFDataFromOpenApiBatch() {
|
||||
int start;
|
||||
int pageSize = 1000;
|
||||
int page = 1;
|
||||
|
||||
for (UserDataDTO userDataDTO : userDataDTOs) {
|
||||
System.out.println(gson.toJson(userDataDTO));
|
||||
while (true){
|
||||
start = (page - 1) * 1000;
|
||||
Gson gson = new Gson();
|
||||
AccessKeyDTO akSkLoad = akSkLoad();
|
||||
DataCenterOption option = new DataCenterOption();
|
||||
option.setSk(akSkLoad.sk);
|
||||
option.setAk(akSkLoad.ak);
|
||||
option.setUrl(OPENAI_BASE_URL);
|
||||
DataCenterService dataCenterService = new DataCenterService(option);
|
||||
LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||
map.put("start", start);
|
||||
map.put("pageSize", pageSize);
|
||||
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||
Type type = new TypeToken<List<UserDataDTO>>() {
|
||||
}.getType();
|
||||
List<UserDataDTO> userDataDTOs = gson.fromJson(result.getData().toString(), type);
|
||||
|
||||
userDataDTOs.stream().filter(it-> jtCompanyDomainService.ifCompanyInJT(null, it.getCompany()));
|
||||
}
|
||||
return userDataDTOs;
|
||||
|
||||
|
||||
|
||||
|
||||
// return userDataDTOs.stream().toList().stream().map(UserDataDTO::getLoginUsername).toList();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue