From 258d27e9f977ddd8d560d899e14d4963923c6aab Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 23 Feb 2024 10:27:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=85=BC=E5=B2=97=E6=97=A0?= =?UTF-8?q?=E8=81=8C=E7=BA=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/out/LoginController.java | 2 ++ .../application/queryies/OrderQuery.java | 3 +- .../domain/repository/RouteRepository.java | 2 +- .../chint/domain/value_object/BaseQuery.java | 9 +++--- .../domain/value_object/OrderQueryData.java | 1 + .../repository/RouteRepositoryImpl.java | 2 +- .../rest/user/UserHttpRequestImpl.java | 28 +++++++++++++++---- .../java/com/chint/RouteApplicationTests.java | 4 +-- 8 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/chint/application/out/LoginController.java b/src/main/java/com/chint/application/out/LoginController.java index 43fd3bb2..e08933b7 100644 --- a/src/main/java/com/chint/application/out/LoginController.java +++ b/src/main/java/com/chint/application/out/LoginController.java @@ -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 不能为空"); diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index 8720d361..a56aa7cc 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -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 routeOrders = routeRepository.findByActualOrderNoNotNull(); + List routeOrders = routeRepository.findByActualOrderNoNotNull(queryData); routeOrders.forEach(RouteOrder::reloadStatus); if (approvalStatusCodes != null && !approvalStatusCodes.isEmpty()) { routeOrders = routeOrders.stream() diff --git a/src/main/java/com/chint/domain/repository/RouteRepository.java b/src/main/java/com/chint/domain/repository/RouteRepository.java index 58115232..ca8c398a 100644 --- a/src/main/java/com/chint/domain/repository/RouteRepository.java +++ b/src/main/java/com/chint/domain/repository/RouteRepository.java @@ -27,5 +27,5 @@ public interface RouteRepository { PageResult pageQuery(OrderQueryData orderQueryData); - List findByActualOrderNoNotNull(); + List findByActualOrderNoNotNull(OrderQueryData orderQueryData); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/value_object/BaseQuery.java b/src/main/java/com/chint/domain/value_object/BaseQuery.java index 3d93fdaa..ef1ad27e 100644 --- a/src/main/java/com/chint/domain/value_object/BaseQuery.java +++ b/src/main/java/com/chint/domain/value_object/BaseQuery.java @@ -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; } diff --git a/src/main/java/com/chint/domain/value_object/OrderQueryData.java b/src/main/java/com/chint/domain/value_object/OrderQueryData.java index b9c83034..503aec43 100644 --- a/src/main/java/com/chint/domain/value_object/OrderQueryData.java +++ b/src/main/java/com/chint/domain/value_object/OrderQueryData.java @@ -16,4 +16,5 @@ public class OrderQueryData extends BaseQuery { private List legTypes; private String orderNo; private String instructions; + private String keyWord; } diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java index 37e68089..17bd7b82 100644 --- a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java @@ -84,7 +84,7 @@ public class RouteRepositoryImpl implements RouteRepository { } @Override - public List findByActualOrderNoNotNull() { + public List findByActualOrderNoNotNull(OrderQueryData orderQueryData) { User currentUser = BaseContext.getCurrentUser(); return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString()); } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 6292a2b5..d294454e 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -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 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 { diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 41734d9b..512a508c 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -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); }