Commit d1ba992a09ac067ebe2f8b8ea5465f8230b38715

Authored by lichao
1 parent 5ee98a6d

时间排序

trash-garbage/src/main/java/com/trash/garbage/service/GarTransportationEnterpriseService.java
... ... @@ -7,6 +7,9 @@ import java.util.List;
7 7 public interface GarTransportationEnterpriseService {
8 8 String requestStr(String tel,String adCodes,String officeAddress);
9 9  
10   - List<TransportationEnterprise> request(String tel,String adCodes,String officeAddress);
  10 + // 实现接口中定义的三个参数的request方法
  11 + List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress);
  12 +
  13 + List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress, String name);
11 14  
12 15 }
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
... ... @@ -770,7 +770,8 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
770 770 LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>();
771 771 qw.like(StringUtils.isNotEmpty(dto.getGarOrderCompanyName()), GarOrder::getGarOrderCompanyName, dto.getGarOrderCompanyName())
772 772 .eq(dto.getGarOrderHandlerStatus() != null, GarOrder::getGarOrderHandlerStatus, dto.getGarOrderHandlerStatus())
773   - .eq(dto.getGarCancelFlag() != null, GarOrder::getGarCancelFlag, dto.getGarCancelFlag());
  773 + .eq(dto.getGarCancelFlag() != null, GarOrder::getGarCancelFlag, dto.getGarCancelFlag())
  774 + .orderByDesc(GarOrder::getGarOrderAgreementTime); // 添加按创建时间倒序排序
774 775 List<GarOrder> list = list(qw);
775 776 PageInfo<GarOrder> pageInfo = new PageInfo<>(list);
776 777 return pageInfo;
... ... @@ -965,10 +966,11 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
965 966 return pageInfo;
966 967 }
967 968  
  969 +
968 970 @Override
969 971 public PageInfo dockingUpEnterpriseList(TransportationEnterprise dto) {
970   - // 1)支持选择企业“所属区域”(长沙市内的)展示区域内所有企业
971   - // 2)支持选择车辆“车辆类型”展示有该车辆类型的企业
  972 + // 1)支持选择企业"所属区域"(长沙市内的)展示区域内所有企业
  973 + // 2)支持选择车辆"车辆类型"展示有该车辆类型的企业
972 974 // TODO 车辆类型暂时不考虑
973 975  
974 976 Map<String, String> headers = new HashMap<>();
... ... @@ -978,6 +980,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
978 980 String tel = null;
979 981 String areaCode = null;
980 982 String officeAddress = null;
  983 + String name = null; // 添加name变量
981 984  
982 985 if (StringUtils.isNotEmpty(dto.getServicePhone())) {
983 986 tel = dto.getServicePhone();
... ... @@ -987,6 +990,11 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
987 990 officeAddress = dto.getRegistrationArea();
988 991 }
989 992  
  993 + // 添加对企业名称的处理
  994 + if (StringUtils.isNotEmpty(dto.getName())) {
  995 + name = dto.getName();
  996 + }
  997 +
990 998 if (StringUtils.isNotEmpty(dto.getRegistrationArea())) {
991 999 try {
992 1000 JSONArray jsonArray = garAreaServer.request();
... ... @@ -1009,7 +1017,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1009 1017 }
1010 1018 }
1011 1019  
1012   - List<TransportationEnterprise> list = garTransportationEnterpriseService.request(tel, areaCode, officeAddress);
  1020 + // 修改这里,将name参数传递给request方法
  1021 + List<TransportationEnterprise> list = garTransportationEnterpriseService.request(tel, areaCode, officeAddress, name);
  1022 +
  1023 + // 后续代码保持不变...
1013 1024 if (CollectionUtils.isNotEmpty(list) && StringUtils.isNotEmpty(tel)) {
1014 1025 String telStr = tel;
1015 1026 list = list.stream().filter(t -> StringUtils.equals(telStr, t.getServicePhone())).collect(Collectors.toList());
... ... @@ -1220,7 +1231,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1220 1231  
1221 1232 String tel = SecurityUtils.getLoginUser().getUser().getPhonenumber();
1222 1233  
1223   - List<TransportationEnterprise> enterprises = garTransportationEnterpriseService.request(tel, null, null);
  1234 + List<TransportationEnterprise> enterprises = garTransportationEnterpriseService.request(tel, null, null, null);
1224 1235 if (CollectionUtils.isEmpty(enterprises)) {
1225 1236 return Collections.emptyList();
1226 1237 }
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarTransportationEnterpriseServiceImpl.java
... ... @@ -11,10 +11,18 @@ import org.springframework.stereotype.Service;
11 11  
12 12 import java.util.*;
13 13  
  14 +
14 15 @Service
15 16 public class GarTransportationEnterpriseServiceImpl implements GarTransportationEnterpriseService {
  17 +
  18 + // 实现接口中定义的三个参数的requestStr方法
16 19 @Override
17   - public String requestStr(String tel, String adCodes,String officeAddress) {
  20 + public String requestStr(String tel, String adCodes, String officeAddress) {
  21 + return requestStr(tel, adCodes, officeAddress, null); // 调用四个参数的版本,name传null
  22 + }
  23 +
  24 + // 新增的四个参数的requestStr方法
  25 + public String requestStr(String tel, String adCodes, String officeAddress, String name) {
18 26 Map<String, Object> params = new HashMap<>();
19 27 if (StringUtils.isNotEmpty(tel)) {
20 28 params.put("phoneNo", tel);
... ... @@ -24,16 +32,27 @@ public class GarTransportationEnterpriseServiceImpl implements GarTransportation
24 32 params.put("adCodes", adCodes);
25 33 }
26 34  
27   - if (StringUtils.isNotEmpty(adCodes)) {
  35 + if (StringUtils.isNotEmpty(officeAddress)) {
28 36 params.put("officeAddress", officeAddress);
29 37 }
30 38  
  39 + // 添加名称模糊查询参数
  40 + if (StringUtils.isNotEmpty(name)) {
  41 + params.put("name", name);
  42 + }
  43 +
31 44 return HttpUtil.doGet("/api/gpsservice/cs/companies/simple/list?tag=1", params);
32 45 }
33 46  
  47 + // 实现接口中定义的三个参数的request方法
34 48 @Override
35   - public List<TransportationEnterprise> request(String tel, String adCodes,String officeAddress) {
36   - String json = requestStr(tel, adCodes,officeAddress);
  49 + public List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress) {
  50 + return request(tel, adCodes, officeAddress, null); // 调用四个参数的版本,name传null
  51 + }
  52 +
  53 + // 新增的四个参数的request方法
  54 + public List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress, String name) {
  55 + String json = requestStr(tel, adCodes, officeAddress, name); // 传递name参数
37 56 if (StringUtils.isEmpty(json)) {
38 57 return Collections.emptyList();
39 58 }
... ... @@ -47,7 +66,6 @@ public class GarTransportationEnterpriseServiceImpl implements GarTransportation
47 66 JSONObject jsonObject = (JSONObject) object;
48 67 TransportationEnterprise transportationEnterprise = new TransportationEnterprise();
49 68 transportationEnterprise.setId(StringUtils.replace(jsonObject.get("id").toString(), "zxljqy", ""));
50   - //transportationEnterprise.setId(jsonObject.get("id").toString());
51 69 transportationEnterprise.setName(jsonObject.getString("name"));
52 70 transportationEnterprise.setAbbreviation(jsonObject.getString("abbreviation"));
53 71 transportationEnterprise.setOfficeAddress(jsonObject.getString("officeAddress"));
... ...
trash-ui/dist.zip deleted 100644 → 0
No preview for this file type