修复误删代码

This commit is contained in:
lulz1 2024-02-25 22:17:17 +08:00
parent 07685dbd35
commit 93a001ce6a
4 changed files with 80 additions and 74 deletions

View File

@ -1,9 +1,9 @@
package com.chint.interfaces.rest.user; package com.chint.interfaces.rest.user;
//import com.chint.dc.api.DataCenterResult; import com.chint.dc.api.DataCenterResult;
//import com.chint.dc.api.dto.DataCenterOption; import com.chint.dc.api.dto.DataCenterOption;
//import com.chint.dc.api.service.DataCenterService; import com.chint.dc.api.service.DataCenterService;
import com.chint.domain.aggregates.standards.Ranks; import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
@ -14,6 +14,7 @@ import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.user.dto.*; import com.chint.interfaces.rest.user.dto.*;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
@ -21,15 +22,20 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.SFConstant.OPENAI_BASE_URL;
import static com.chint.infrastructure.constant.SFConstant.USER_DATA_PATH;
@Service @Service
public class UserHttpRequestImpl implements UserHttpRequest { public class UserHttpRequestImpl implements UserHttpRequest {
private final String asSkUrl = SFConstant.AK_BASE_URL + SFConstant.GET_AK_URL + "?systemId=" + SFConstant.SYSTEM_ID; private final String asSkUrl = SFConstant.AK_BASE_URL + SFConstant.GET_AK_URL + "?systemId=" + SFConstant.SYSTEM_ID;
private final String userUrl = SFConstant.OPENAI_BASE_URL + SFConstant.USER_DATA_PATH; private final String userUrl = OPENAI_BASE_URL + USER_DATA_PATH;
private final String travelRankUrl = SFConstant.TRAVEL_RANK_BASE_URL + SFConstant.TRAVEL_RANK_PATH; private final String travelRankUrl = SFConstant.TRAVEL_RANK_BASE_URL + SFConstant.TRAVEL_RANK_PATH;
@Autowired @Autowired
@ -72,73 +78,73 @@ public class UserHttpRequestImpl implements UserHttpRequest {
} }
private User loadSFInfo(User user) { private User loadSFInfo(User user) {
// Gson gson = new Gson(); Gson gson = new Gson();
// AccessKeyDTO akSkLoad = akSkLoad(); AccessKeyDTO akSkLoad = akSkLoad();
// DataCenterOption option = new DataCenterOption(); DataCenterOption option = new DataCenterOption();
// option.setSk(akSkLoad.sk); option.setSk(akSkLoad.sk);
// option.setAk(akSkLoad.ak); option.setAk(akSkLoad.ak);
// option.setUrl(OPENAI_BASE_URL); option.setUrl(OPENAI_BASE_URL);
// DataCenterService dataCenterService = new DataCenterService(option); DataCenterService dataCenterService = new DataCenterService(option);
// LinkedHashMap map = new LinkedHashMap<String, Object>(); LinkedHashMap map = new LinkedHashMap<String, Object>();
// map.put("LoginUsername", user.getEmployeeNo().toString()); map.put("LoginUsername", user.getEmployeeNo().toString());
// map.put("start", 0); map.put("start", 0);
// map.put("pageSize", 99); map.put("pageSize", 99);
// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
// Type type = new TypeToken<List<UserDataDTO>>() { Type type = new TypeToken<List<UserDataDTO>>() {
// }.getType(); }.getType();
// if (result.getData() != null) { if (result.getData() != null) {
// String companyCode = user.getCompanyCode(); String companyCode = user.getCompanyCode();
// if (companyCode == null) { if (companyCode == null) {
// companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode(); companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
// } }
// String newCompanyCode = companyCode; String newCompanyCode = companyCode;
// List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
// if (fromJson.size() == 1) { if (fromJson.size() == 1) {
// UserDataDTO userData = fromJson.get(0); UserDataDTO userData = fromJson.get(0);
// user.setCompanyCode(userData.getCompany()); user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus()); user.setWorkStatus(userData.getStatus());
// user.setGender(userData.getGender()); user.setGender(userData.getGender());
// user.setName(userData.getUname()); user.setName(userData.getUname());
// user.setPhoneNumber(userData.getMobilePhone()); user.setPhoneNumber(userData.getMobilePhone());
// user.setManaLevel(userData.getCust_manaLevel()); user.setManaLevel(userData.getCust_manaLevel());
// user.setProfLevel(userData.getCust_profLevel()); user.setProfLevel(userData.getCust_profLevel());
// } else { } else {
// Optional<UserDataDTO> first; Optional<UserDataDTO> first;
//
// //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
// if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
// first = fromJson.stream()
// .filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
// .findFirst();
//
// } else {
// first = fromJson.stream()
// .filter(userData -> userData.getCompany().equals(newCompanyCode))
// .findFirst();
// }
// first.ifPresent(
// userData -> {
// user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus());
// user.setGender(userData.getGender());
// user.setName(userData.getUname());
// user.setPhoneNumber(userData.getMobilePhone());
// }
// );
// fromJson.stream()
// .filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
// .findFirst()
// .ifPresent(userData -> {
// user.setManaLevel(userData.getCust_manaLevel());
// user.setProfLevel(userData.getCust_profLevel());
// });
// }
// return user;
// } else {
// throw new RuntimeException("用户数据不存在");
// }
return null; //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
first = fromJson.stream()
.filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
.findFirst();
} else {
first = fromJson.stream()
.filter(userData -> userData.getCompany().equals(newCompanyCode))
.findFirst();
}
first.ifPresent(
userData -> {
user.setCompanyCode(userData.getCompany());
user.setWorkStatus(userData.getStatus());
user.setGender(userData.getGender());
user.setName(userData.getUname());
user.setPhoneNumber(userData.getMobilePhone());
}
);
fromJson.stream()
.filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
.findFirst()
.ifPresent(userData -> {
user.setManaLevel(userData.getCust_manaLevel());
user.setProfLevel(userData.getCust_profLevel());
});
}
return user;
} else {
throw new RuntimeException("用户数据不存在");
}
// return null;
} }

View File

@ -149,7 +149,7 @@ public class CTripTest {
System.out.println(response); System.out.println(response);
} }
@Test // @Test
void searchAndHandlerData(){ void searchAndHandlerData(){
BaseContext.setCurrentUser(user); BaseContext.setCurrentUser(user);
SupplierCallbackData supplierCallbackData = SupplierCallbackData supplierCallbackData =

View File

@ -293,7 +293,7 @@ public class LYTest {
} }
//超标 //超标
@Test // @Test
void exceedStandard() { void exceedStandard() {
BPMBaseRequest bpmRequest = new BPMBaseRequest(); BPMBaseRequest bpmRequest = new BPMBaseRequest();
Gson gson = new Gson(); Gson gson = new Gson();
@ -318,7 +318,7 @@ public class LYTest {
} }
//改签 //改签
@Test // @Test
void reschedule() { void reschedule() {
BPMBaseRequest bpmRequest = new BPMBaseRequest(); BPMBaseRequest bpmRequest = new BPMBaseRequest();
Gson gson = new Gson(); Gson gson = new Gson();

View File

@ -43,7 +43,7 @@ class RouteApplicationTests {
LocalDateTime parse = LocalDateTime.parse("2024-04-15 23:59:00", dateTimeFormatter); LocalDateTime parse = LocalDateTime.parse("2024-04-15 23:59:00", dateTimeFormatter);
System.out.println(parse); System.out.println(parse);
} }
@Test // @Test
void loginSign() { void loginSign() {
String sfno = "230615020"; String sfno = "230615020";
String syscode = "abc"; String syscode = "abc";