Commit 418d3413386dc68f1b6b4385f7280d880d467988
Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
Showing
4 changed files
with
75 additions
and
40 deletions
trash-garbage/src/main/java/com/trash/garbage/controller/GarbageOrderController.java
| @@ -101,7 +101,7 @@ public class GarbageOrderController { | @@ -101,7 +101,7 @@ public class GarbageOrderController { | ||
| 101 | 101 | ||
| 102 | @RequestMapping("/upload") | 102 | @RequestMapping("/upload") |
| 103 | public Result<?> uploadFile(@RequestParam("file") MultipartFile file) { | 103 | public Result<?> uploadFile(@RequestParam("file") MultipartFile file) { |
| 104 | - log.info("上传文件"); | 104 | +// log.info("上传文件"); |
| 105 | String fileName = null; | 105 | String fileName = null; |
| 106 | try { // 上传文件路径 | 106 | try { // 上传文件路径 |
| 107 | String filePath = trashConfig.getUploadPath(); | 107 | String filePath = trashConfig.getUploadPath(); |
| @@ -110,14 +110,14 @@ public class GarbageOrderController { | @@ -110,14 +110,14 @@ public class GarbageOrderController { | ||
| 110 | } catch (IOException e) { | 110 | } catch (IOException e) { |
| 111 | e.printStackTrace(); | 111 | e.printStackTrace(); |
| 112 | System.out.println("上传文件失败"); | 112 | System.out.println("上传文件失败"); |
| 113 | - log.error("上传文件失败,请稍后再试",e); | 113 | +// log.error("上传文件失败,请稍后再试",e); |
| 114 | throw new BizException(ResultCode.CODE_400, ResultCode.CODE_400.getMsg()); | 114 | throw new BizException(ResultCode.CODE_400, ResultCode.CODE_400.getMsg()); |
| 115 | } | 115 | } |
| 116 | String url = serverConfig.getUrl() + fileName; | 116 | String url = serverConfig.getUrl() + fileName; |
| 117 | Map<String, String> urlMap = new HashMap<>(); | 117 | Map<String, String> urlMap = new HashMap<>(); |
| 118 | urlMap.put("url", url); | 118 | urlMap.put("url", url); |
| 119 | urlMap.put("fileName", fileName); | 119 | urlMap.put("fileName", fileName); |
| 120 | - log.info("上传文件完成"); | 120 | +// log.info("上传文件完成"); |
| 121 | return Result.OK(urlMap, "图片上传成功"); | 121 | return Result.OK(urlMap, "图片上传成功"); |
| 122 | } | 122 | } |
| 123 | 123 |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
| @@ -13,10 +13,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | @@ -13,10 +13,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 14 | import com.github.pagehelper.PageHelper; | 14 | import com.github.pagehelper.PageHelper; |
| 15 | import com.github.pagehelper.PageInfo; | 15 | import com.github.pagehelper.PageInfo; |
| 16 | +import com.google.gson.Gson; | ||
| 17 | +import com.google.gson.reflect.TypeToken; | ||
| 16 | import com.trash.carInfo.domain.CarInfo; | 18 | import com.trash.carInfo.domain.CarInfo; |
| 17 | import com.trash.carInfo.domain.vo.CarInfoVo; | 19 | import com.trash.carInfo.domain.vo.CarInfoVo; |
| 18 | import com.trash.carInfo.mapper.CarInfoMapper; | 20 | import com.trash.carInfo.mapper.CarInfoMapper; |
| 19 | import com.trash.carInfo.service.impl.CarInfoServiceImpl; | 21 | import com.trash.carInfo.service.impl.CarInfoServiceImpl; |
| 22 | +import com.trash.common.config.trashConfig; | ||
| 20 | import com.trash.common.core.redis.RedisCache; | 23 | import com.trash.common.core.redis.RedisCache; |
| 21 | import com.trash.common.utils.RemoteServerUtils; | 24 | import com.trash.common.utils.RemoteServerUtils; |
| 22 | import com.trash.common.utils.SecurityUtils; | 25 | import com.trash.common.utils.SecurityUtils; |
| @@ -1000,7 +1003,6 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -1000,7 +1003,6 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 1000 | return pageInfo; | 1003 | return pageInfo; |
| 1001 | } | 1004 | } |
| 1002 | 1005 | ||
| 1003 | - | ||
| 1004 | @Override | 1006 | @Override |
| 1005 | public PageInfo dockingUpEnterpriseList(TransportationEnterprise dto) { | 1007 | public PageInfo dockingUpEnterpriseList(TransportationEnterprise dto) { |
| 1006 | // 1)支持选择企业"所属区域"(长沙市内的)展示区域内所有企业 | 1008 | // 1)支持选择企业"所属区域"(长沙市内的)展示区域内所有企业 |
| @@ -1050,15 +1052,39 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -1050,15 +1052,39 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 1050 | log.error("请求的确信息异常", e); | 1052 | log.error("请求的确信息异常", e); |
| 1051 | } | 1053 | } |
| 1052 | } | 1054 | } |
| 1055 | + | ||
| 1056 | + Map<String, Object> params = new HashMap<>(); | ||
| 1057 | + if (StringUtils.isNotEmpty(tel)) { | ||
| 1058 | + params.put("phoneNo", tel); | ||
| 1059 | + } | ||
| 1053 | 1060 | ||
| 1054 | - // 修改这里,将name参数传递给request方法 | ||
| 1055 | - List<TransportationEnterprise> list = garTransportationEnterpriseService.request(tel, areaCode, officeAddress, name); | 1061 | + if (StringUtils.isNotEmpty(areaCode)) { |
| 1062 | + params.put("adCodes", areaCode); | ||
| 1063 | + } | ||
| 1056 | 1064 | ||
| 1057 | - // 后续代码保持不变... | ||
| 1058 | - if (CollectionUtils.isNotEmpty(list) && StringUtils.isNotEmpty(tel)) { | ||
| 1059 | - String telStr = tel; | ||
| 1060 | - list = list.stream().filter(t -> StringUtils.equals(telStr, t.getServicePhone())).collect(Collectors.toList()); | 1065 | + if (StringUtils.isNotEmpty(officeAddress)) { |
| 1066 | + params.put("officeAddress", officeAddress); | ||
| 1061 | } | 1067 | } |
| 1068 | + if (StringUtils.isNotEmpty(name)) { | ||
| 1069 | + params.put("name", name); | ||
| 1070 | + } | ||
| 1071 | + | ||
| 1072 | + params.put("tag", "1"); | ||
| 1073 | + | ||
| 1074 | + JSONArray array = RemoteServerUtils.getCompanyList(params,trashConfig.getToken()); | ||
| 1075 | + | ||
| 1076 | + Gson g = new Gson(); | ||
| 1077 | + | ||
| 1078 | + List<TransportationEnterprise> list = g.fromJson(array.toJSONString(), new TypeToken<List<TransportationEnterprise>>(){}.getType()); | ||
| 1079 | + | ||
| 1080 | +// // 修改这里,将name参数传递给request方法 | ||
| 1081 | +// List<TransportationEnterprise> list = garTransportationEnterpriseService.request(tel, areaCode, officeAddress, name); | ||
| 1082 | + | ||
| 1083 | + // 后续代码保持不变... | ||
| 1084 | +// if (CollectionUtils.isNotEmpty(array) && StringUtils.isNotEmpty(tel)) { | ||
| 1085 | +// String telStr = tel; | ||
| 1086 | +// array = array.stream().filter(t -> StringUtils.equals(telStr, t.getServicePhone())).collect(Collectors.toList()); | ||
| 1087 | +// } | ||
| 1062 | 1088 | ||
| 1063 | // saveOrUpdate(list); | 1089 | // saveOrUpdate(list); |
| 1064 | Integer pageNum = ServletUtils.getParameterToInt("pageNum"); | 1090 | Integer pageNum = ServletUtils.getParameterToInt("pageNum"); |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarTransportationEnterpriseServiceImpl.java
| @@ -3,10 +3,14 @@ package com.trash.garbage.service.impl; | @@ -3,10 +3,14 @@ package com.trash.garbage.service.impl; | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | +import com.google.gson.Gson; | ||
| 7 | +import com.google.gson.reflect.TypeToken; | ||
| 8 | +import com.trash.common.utils.RemoteServerUtils; | ||
| 6 | import com.trash.enterprise.domain.TransportationEnterprise; | 9 | import com.trash.enterprise.domain.TransportationEnterprise; |
| 7 | import com.trash.garbage.service.GarTransportationEnterpriseService; | 10 | import com.trash.garbage.service.GarTransportationEnterpriseService; |
| 8 | import com.trash.garbage.utils.HttpUtil; | 11 | import com.trash.garbage.utils.HttpUtil; |
| 9 | import org.apache.commons.lang3.StringUtils; | 12 | import org.apache.commons.lang3.StringUtils; |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
| 11 | 15 | ||
| 12 | import java.util.*; | 16 | import java.util.*; |
| @@ -40,11 +44,16 @@ public class GarTransportationEnterpriseServiceImpl implements GarTransportation | @@ -40,11 +44,16 @@ public class GarTransportationEnterpriseServiceImpl implements GarTransportation | ||
| 40 | if (StringUtils.isNotEmpty(name)) { | 44 | if (StringUtils.isNotEmpty(name)) { |
| 41 | params.put("name", name); | 45 | params.put("name", name); |
| 42 | } | 46 | } |
| 47 | + | ||
| 48 | + | ||
| 43 | System.out.println(HttpUtil.doGet("/api/gpsservice/cs/companies/simple/list?tag=1", params)); | 49 | System.out.println(HttpUtil.doGet("/api/gpsservice/cs/companies/simple/list?tag=1", params)); |
| 44 | 50 | ||
| 45 | return HttpUtil.doGet("/api/gpsservice/cs/companies/simple/list?tag=1", params); | 51 | return HttpUtil.doGet("/api/gpsservice/cs/companies/simple/list?tag=1", params); |
| 46 | } | 52 | } |
| 47 | 53 | ||
| 54 | + | ||
| 55 | + @Autowired | ||
| 56 | + private com.trash.common.config.trashConfig trashConfig; | ||
| 48 | // 实现接口中定义的三个参数的request方法 | 57 | // 实现接口中定义的三个参数的request方法 |
| 49 | @Override | 58 | @Override |
| 50 | public List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress) { | 59 | public List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress) { |
| @@ -53,31 +62,31 @@ public class GarTransportationEnterpriseServiceImpl implements GarTransportation | @@ -53,31 +62,31 @@ public class GarTransportationEnterpriseServiceImpl implements GarTransportation | ||
| 53 | 62 | ||
| 54 | // 新增的四个参数的request方法 | 63 | // 新增的四个参数的request方法 |
| 55 | public List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress, String name) { | 64 | public List<TransportationEnterprise> request(String tel, String adCodes, String officeAddress, String name) { |
| 56 | - String json = requestStr(tel, adCodes, officeAddress, name); // 传递name参数 | ||
| 57 | - if (StringUtils.isEmpty(json)) { | ||
| 58 | - return Collections.emptyList(); | 65 | + |
| 66 | + Map<String, Object> params = new HashMap<>(); | ||
| 67 | + if (StringUtils.isNotEmpty(tel)) { | ||
| 68 | + params.put("phoneNo", tel); | ||
| 59 | } | 69 | } |
| 60 | - List<TransportationEnterprise> list = new ArrayList<>(); | ||
| 61 | - Map<String, Object> hash = JSON.parseObject(json, HashMap.class); | ||
| 62 | - if (Objects.nonNull(hash)) { | ||
| 63 | - if (Objects.nonNull(hash.get("code")) && StringUtils.equals(hash.get("code").toString(), "200")) { | ||
| 64 | - if (Objects.nonNull(hash.get("result")) && hash.get("result") instanceof JSONArray) { | ||
| 65 | - JSONArray jsonArray = (JSONArray) hash.get("result"); | ||
| 66 | - for (Object object : jsonArray) { | ||
| 67 | - JSONObject jsonObject = (JSONObject) object; | ||
| 68 | - TransportationEnterprise transportationEnterprise = new TransportationEnterprise(); | ||
| 69 | - transportationEnterprise.setId(StringUtils.replace(jsonObject.get("id").toString(), "zxljqy", "")); | ||
| 70 | - transportationEnterprise.setName(jsonObject.getString("name")); | ||
| 71 | - transportationEnterprise.setAbbreviation(jsonObject.getString("abbreviation")); | ||
| 72 | - transportationEnterprise.setOfficeAddress(jsonObject.getString("officeAddress")); | ||
| 73 | - transportationEnterprise.setServicePhone(jsonObject.getString("servicePhone")); | ||
| 74 | - transportationEnterprise.setLegalRepresentative(jsonObject.getString("principal")); | ||
| 75 | - transportationEnterprise.setLegalRepresentativePhone(jsonObject.getString("principalPhoneNo")); | ||
| 76 | - list.add(transportationEnterprise); | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - } | 70 | + |
| 71 | + if (StringUtils.isNotEmpty(adCodes)) { | ||
| 72 | + params.put("adCodes", adCodes); | ||
| 80 | } | 73 | } |
| 74 | + | ||
| 75 | + if (StringUtils.isNotEmpty(officeAddress)) { | ||
| 76 | + params.put("officeAddress", officeAddress); | ||
| 77 | + } | ||
| 78 | + if (StringUtils.isNotEmpty(name)) { | ||
| 79 | + params.put("name", name); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + params.put("tag", "1"); | ||
| 83 | + | ||
| 84 | + JSONArray array = RemoteServerUtils.getCompanyList(params,trashConfig.getToken()); | ||
| 85 | + | ||
| 86 | + Gson g = new Gson(); | ||
| 87 | + | ||
| 88 | + List<TransportationEnterprise> list = g.fromJson(array.toJSONString(), new TypeToken<List<TransportationEnterprise>>(){}.getType()); | ||
| 89 | + | ||
| 81 | return list; | 90 | return list; |
| 82 | } | 91 | } |
| 83 | } | 92 | } |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
| @@ -262,14 +262,14 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | @@ -262,14 +262,14 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | ||
| 262 | vo.getRuleVos().add(ruleVo); | 262 | vo.getRuleVos().add(ruleVo); |
| 263 | 263 | ||
| 264 | } | 264 | } |
| 265 | -// for (LoginVo.RuleVo r : vo.getRuleVos()){ | ||
| 266 | -// //排除驾驶员、企业负责人、处理场所 | ||
| 267 | -// if(r.getUserType().equals(GlobalStatus.GarUserStatusEnum.DISPOSAL_SITE_USER.getDescription()) || r.getUserType().equals(GlobalStatus.GarUserStatusEnum.DRIVER_USER.getDescription()) || r.getUserType().equals(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription())){ | ||
| 268 | -// vo.setTestUser(true); | ||
| 269 | -// } | ||
| 270 | -// } | ||
| 271 | - | 265 | + for (LoginVo.RuleVo r : vo.getRuleVos()){ |
| 266 | + //排除驾驶员、企业负责人、处理场所 | ||
| 267 | + if(r.getUserType().equals(GlobalStatus.GarUserStatusEnum.DISPOSAL_SITE_USER.getDescription()) || r.getUserType().equals(GlobalStatus.GarUserStatusEnum.DRIVER_USER.getDescription()) || r.getUserType().equals(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription())){ | ||
| 268 | + vo.setTestUser(true); | ||
| 269 | + } | ||
| 270 | + } | ||
| 272 | 271 | ||
| 272 | + | ||
| 273 | this.saveOrUpdate(nUser); | 273 | this.saveOrUpdate(nUser); |
| 274 | return vo; | 274 | return vo; |
| 275 | } | 275 | } |