兼容兼岗无职级问题

This commit is contained in:
lulz1 2024-02-23 10:27:01 +08:00
parent ec9a797ad2
commit 258d27e9f9
8 changed files with 37 additions and 14 deletions

View File

@ -11,6 +11,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.Result;
import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
import com.chint.interfaces.rest.ly.LYUserRequest;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,6 +56,7 @@ public class LoginController {
UserLoginResult userLoginResult = authenticateService
.authenticateEmployeeNo(userLoginParam);
if (billcode != null) {
if (companycode == null) {
throw new OrderException("companycode 不能为空");

View File

@ -17,6 +17,7 @@ import com.chint.domain.service.OrderDomainService;
import com.chint.domain.value_object.*;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.PageResult;
import com.chint.infrastructure.util.StringCheck;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
@ -61,7 +62,7 @@ public class OrderQuery {
if ((approvalStatusCodes != null && !approvalStatusCodes.isEmpty()) || (legTypes != null && !legTypes.isEmpty())) {
Integer pageNum = queryData.getPageNum();
Integer pageSize = queryData.getPageSize();
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull();
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull(queryData);
routeOrders.forEach(RouteOrder::reloadStatus);
if (approvalStatusCodes != null && !approvalStatusCodes.isEmpty()) {
routeOrders = routeOrders.stream()

View File

@ -27,5 +27,5 @@ public interface RouteRepository {
PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData);
List<RouteOrder> findByActualOrderNoNotNull();
List<RouteOrder> findByActualOrderNoNotNull(OrderQueryData orderQueryData);
}

View File

@ -4,16 +4,17 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
public class BaseQuery {
private Integer pageNum = 1;
private Integer pageSize = 10;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private LocalDateTime startDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private LocalDateTime endDate;
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
private LocalDate startDate;
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
private LocalDate endDate;
@ApiModelProperty("排序字段")
private Integer sort = 0;
}

View File

@ -16,4 +16,5 @@ public class OrderQueryData extends BaseQuery {
private List<Integer> legTypes;
private String orderNo;
private String instructions;
private String keyWord;
}

View File

@ -84,7 +84,7 @@ public class RouteRepositoryImpl implements RouteRepository {
}
@Override
public List<RouteOrder> findByActualOrderNoNotNull() {
public List<RouteOrder> findByActualOrderNoNotNull(OrderQueryData orderQueryData) {
User currentUser = BaseContext.getCurrentUser();
return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString());
}

View File

@ -12,6 +12,7 @@ import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.service.RankDomainService;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.user.dto.*;
import com.google.gson.Gson;
@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.Constant.*;
@ -110,15 +112,32 @@ public class UserHttpRequestImpl implements UserHttpRequest {
user.setManaLevel(userData.getCust_manaLevel());
user.setProfLevel(userData.getCust_profLevel());
} else {
fromJson.stream()
.filter(userData -> userData.getCompany().equals(newCompanyCode))
.findFirst()
.ifPresent(userData -> {
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());
});
@ -130,7 +149,6 @@ public class UserHttpRequestImpl implements UserHttpRequest {
}
private TravelRankDTO loadTravelRank(TravelRankParam travelRankParam) {
TravelRankResponseDTO travelRankResponseDTO = postRequest.post(travelRankUrl, travelRankParam, TravelRankResponseDTO.class);
try {

View File

@ -38,10 +38,10 @@ class RouteApplicationTests {
void loginSign() {
String sfno = "230615020";
String syscode = "FFSC";
String billcode = "ABC10337191351";
String billcode = "KKDD12321412323";
String companycode = "A30000001";
String sec = "Superdandan";
String timespan = "987654321";
String timespan = "12312321412312";
String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan);
System.out.println(s);
}