Commit 9ca06afb422902b0d1af0182b1cc1e7271153ec0

Authored by liujun001
1 parent 14347a7c

优化车辆信息,将客户的数据拉入我们的库

trash-garbage/src/main/java/com/trash/garbage/mapper/GarOrderMapper.java
... ... @@ -41,7 +41,7 @@ public interface GarOrderMapper extends BaseMapper<GarOrder> {
41 41  
42 42 String queryCompanyIdByPhone(@Param("phone")String phone);
43 43  
44   - List<DockingQRCodeEntity> queryReportByCarCode(@Param("carCode") String carCode);
  44 + List<DockingQRCodeEntity> queryReportByCarCode(@Param("carCode") String carCode,@Param("dateStr") String dateStr);
45 45 }
46 46  
47 47  
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/DispatchDriverVo.java
... ... @@ -2,9 +2,11 @@ package com.trash.garbage.pojo.vo;
2 2  
3 3 import lombok.EqualsAndHashCode;
4 4 import lombok.ToString;
  5 +import org.apache.commons.lang3.StringUtils;
5 6  
6 7 import java.util.Collection;
7 8 import java.util.List;
  9 +import java.util.Objects;
8 10  
9 11 /**
10 12 * @author 20412
... ... @@ -25,6 +27,8 @@ public class DispatchDriverVo {
25 27  
26 28 private Collection<Personnel> personnelInfo;
27 29  
  30 + private Integer sortValue;
  31 +
28 32 /**
29 33 * 人员信息
30 34 */
... ... @@ -105,5 +109,18 @@ public class DispatchDriverVo {
105 109 this.licensePlateNumber = licensePlateNumber;
106 110 }
107 111  
108   -
  112 + public Integer getSortValue() {
  113 + if (Objects.isNull(sortValue)) {
  114 + if (StringUtils.equals(StringUtils.trim(containerVolume), "轻型货车") || StringUtils.equals(StringUtils.trim(containerVolume), "4方车")) {
  115 + sortValue = 1;
  116 + } else if (StringUtils.equals(StringUtils.trim(containerVolume), "中型货车") || StringUtils.equals(StringUtils.trim(containerVolume), "6方车")) {
  117 + sortValue = 2;
  118 + } else if (StringUtils.equals(StringUtils.trim(containerVolume), "中大型货车") || StringUtils.equals(StringUtils.trim(containerVolume), "8方车")) {
  119 + sortValue = 3;
  120 + } else {
  121 + sortValue = Integer.MAX_VALUE;
  122 + }
  123 + }
  124 + return sortValue;
  125 + }
109 126 }
... ...
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/LoginVo.java
... ... @@ -9,8 +9,17 @@ import java.util.List;
9 9 @EqualsAndHashCode
10 10 public class LoginVo {
11 11 private String token;
  12 + private String name;
12 13 private List<RuleVo> ruleVos;
13 14  
  15 + public String getName() {
  16 + return name;
  17 + }
  18 +
  19 + public void setName(String name) {
  20 + this.name = name;
  21 + }
  22 +
14 23 public String getToken() {
15 24 return token;
16 25 }
... ...
trash-garbage/src/main/java/com/trash/garbage/service/GarUserService.java
... ... @@ -40,4 +40,5 @@ public interface GarUserService extends IService&lt;GarUser&gt; {
40 40 List<GarUser> queryListByUser(GarUser garUser);
41 41  
42 42 LoginVo queryRole();
  43 + GarUser queryGarUserByTel(String tel);
43 44 }
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
... ... @@ -34,6 +34,8 @@ import com.trash.garbage.utils.SMSUtils;
34 34 import com.trash.garbage.utils.ValidateCodeUtil;
35 35 import org.apache.commons.collections4.CollectionUtils;
36 36 import org.apache.commons.lang3.StringUtils;
  37 +import org.apache.commons.lang3.time.DateUtils;
  38 +import org.apache.commons.lang3.time.FastDateFormat;
37 39 import org.apache.http.client.utils.HttpClientUtils;
38 40 import org.springframework.beans.BeanUtils;
39 41 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -98,6 +100,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
98 100 private String authorization;
99 101 @Value("${trash.remotePath}")
100 102 private String remotePath;
  103 + private FastDateFormat fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd");
101 104  
102 105 @Override
103 106 @Transactional(rollbackFor = Exception.class)
... ... @@ -661,6 +664,12 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
661 664 vo.setGarOrderHandleName(driverVos.get(0).getName());
662 665 vo.setGarOrderHandleTel(driverVos.get(0).getPhoneNo());
663 666 }
  667 + } else if (StringUtils.isNotEmpty(vo.getGarOrderCompanyTel())) {
  668 + TransportationEnterprise enterprise = transportationEnterpriseService.queryByServerPhone(vo.getGarOrderCompanyTel());
  669 + if(Objects.nonNull(enterprise)){
  670 + vo.setGarOrderHandleName(enterprise.getLegalRepresentative());
  671 + vo.setGarOrderHandleTel(enterprise.getLegalRepresentativePhone());
  672 + }
664 673 }
665 674 // 获取车辆信息
666 675 LambdaQueryWrapper<GarOrderCar> qwc = new LambdaQueryWrapper<>();
... ... @@ -768,6 +777,8 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
768 777 if (opt.isPresent()) {
769 778 JSONObject jsonObject = (JSONObject) opt.get();
770 779 params.put("adCodes", jsonObject.getString("code"));
  780 + } else {
  781 + params.put("adCodes", "no found");
771 782 }
772 783 }
773 784 }
... ... @@ -880,17 +891,21 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
880 891 if (Objects.isNull(source)) {
881 892 transportationEnterpriseService.save(transportationEnterprise);
882 893 } else {
  894 + TransportationEnterprise target = new TransportationEnterprise();
  895 + BeanUtils.copyProperties(transportationEnterprise, target);
883 896 TransportationEnterprise source1 = new TransportationEnterprise();
884 897 source1.setId(source.getId());
885 898 //transportationEnterprise.setId(jsonObject.get("id").toString());
886 899 source1.setName(source.getName());
887 900 source1.setAbbreviation(source.getAbbreviation());
888 901 source1.setOfficeAddress(source.getOfficeAddress());
889   - source1.setServicePhone(source.getServicePhone());
  902 + // source1.setServicePhone(source.getServicePhone());
890 903 source1.setLegalRepresentative(source.getLegalRepresentative());
891 904 source1.setLegalRepresentativePhone(source.getLegalRepresentativePhone());
892 905 source1.setCarNumber(0);
893   - if (Objects.equals(JSON.toJSONString(source1), JSON.toJSONString(transportationEnterprise))) {
  906 + target.setServicePhone(null);
  907 +
  908 + if (Objects.equals(JSON.toJSONString(source1), JSON.toJSONString(target))) {
894 909 continue;
895 910 } else {
896 911 transportationEnterpriseService.updateById(transportationEnterprise);
... ... @@ -1078,7 +1093,17 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1078 1093 List<GarOrderCar> carList = garOrderCarService.list(qwc);
1079 1094 if (CollectionUtils.isNotEmpty(carList)) {
1080 1095 Set<String> carTypes = carList.stream().map(GarOrderCar::getGarOrderCarType).collect(Collectors.toSet());
1081   - voList = voList.stream().filter(v -> carTypes.contains(v.getContainerVolume())).collect(Collectors.toList());
  1096 + if (CollectionUtils.isNotEmpty(carTypes)) {
  1097 + String[] carTypeStrs = {"4方车", "6方车", "8方车"};
  1098 + String[] carTypeStrs1 = {"轻型货车", "中型货车", "中大型货车"};
  1099 + int size = carTypeStrs.length;
  1100 + for (int i = 0; i < size; i++) {
  1101 + if (carTypes.contains(carTypeStrs[i])) {
  1102 + carTypes.add(carTypeStrs1[i]);
  1103 + }
  1104 + }
  1105 + }
  1106 + voList = voList.stream().filter(v -> carTypes.contains(v.getContainerVolume())).sorted(Comparator.comparing(DispatchDriverVo::getLicensePlateNumber)).sorted(Comparator.comparing(DispatchDriverVo::getSortValue)).collect(Collectors.toList());
1082 1107 }
1083 1108  
1084 1109 return voList;
... ... @@ -1269,6 +1294,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1269 1294 // String tel = SecurityUtils.getLoginUser().getUser().getPhonenumber();
1270 1295 // 选中的司机处理场所
1271 1296 List<DispatchDisposalVo> voList = disposalService.queryDisposalListWithDispatchStatus(orderId);
  1297 + if (CollectionUtils.isNotEmpty(voList)) {
  1298 + voList = voList.stream().sorted(Comparator.comparing(DispatchDisposalVo::getGarOrderDisposalCompanyName)).collect(Collectors.toList());
  1299 + }
1272 1300 return voList;
1273 1301 }
1274 1302  
... ... @@ -1516,7 +1544,8 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1516 1544  
1517 1545 @Override
1518 1546 public List<DockingQRCodeEntity> queryReportByCarCode(String carCode) {
1519   - return baseMapper.queryReportByCarCode(carCode);
  1547 + String dateStr = fastDateFormat.format(DateUtils.addDays(new Date(), -1));
  1548 + return baseMapper.queryReportByCarCode(carCode, dateStr);
1520 1549 }
1521 1550  
1522 1551  
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
... ... @@ -19,6 +19,7 @@ import com.trash.disposalSite.domain.DisposalSite;
19 19 import com.trash.disposalSite.service.IDisposalSiteService;
20 20 import com.trash.garbage.utils.SMSUtils;
21 21 import org.apache.commons.codec.binary.Base64;
  22 +import org.apache.commons.collections4.CollectionUtils;
22 23 import org.springframework.beans.factory.annotation.Autowired;
23 24 import org.springframework.security.core.authority.SimpleGrantedAuthority;
24 25 import org.springframework.security.core.userdetails.UsernameNotFoundException;
... ... @@ -167,6 +168,7 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
167 168 ruleVo.setTransportCompanyName(enterprise.getName());
168 169 ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.DRIVER_USER.getDescription());
169 170 vo.getRuleVos().add(ruleVo);
  171 + vo.setName(driverVo.getName());
170 172 }
171 173  
172 174 // 企业负责人 TODO
... ... @@ -179,6 +181,8 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
179 181 ruleVo.setTransportCompanyName(enterprise.getName());
180 182 ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription());
181 183 vo.getRuleVos().add(ruleVo);
  184 +
  185 + // vo.setName(enterprise.getName());
182 186 }
183 187  
184 188 // 处理场所 TODO
... ... @@ -192,6 +196,8 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
192 196 ruleVo.setTransportCompanyName(disposalSite.getName());
193 197 ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.DISPOSAL_SITE_USER.getDescription());
194 198 vo.getRuleVos().add(ruleVo);
  199 +
  200 + // vo.setName(disposalSite.getConstructionUnitPerson());
195 201 }
196 202 return vo;
197 203 }
... ... @@ -364,6 +370,14 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
364 370 return vo;
365 371 }
366 372  
  373 + @Override
  374 + public GarUser queryGarUserByTel(String tel) {
  375 + LambdaQueryWrapper<GarUser> wrapper = new LambdaQueryWrapper<>();
  376 + wrapper.eq(GarUser::getGarUserTel, tel);
  377 + List<GarUser> garUsers = list(wrapper);
  378 + return CollectionUtils.isEmpty(garUsers) ? null : garUsers.get(0);
  379 + }
  380 +
367 381 private LambdaQueryWrapper<GarUser> createQueryWrapperByUser(GarUser garUser) {
368 382 return new LambdaQueryWrapper<GarUser>()
369 383 .eq(StringUtils.isNotEmpty(garUser.getGarUserId()), GarUser::getGarUserId, garUser.getGarUserId())
... ...
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
... ... @@ -268,6 +268,7 @@
268 268 left join disposal_site ds on ds.id = gomd.gar_order_disposal_company_id
269 269 left join gar_order_match_handler gomh on gomh.gar_order_id =go2.gar_order_id
270 270 where gomh.gar_handler_car_code=#{carCode}
271   - and gomh.gar_order_handler_status = 1 AND gomh.gar_cancel_flag = 0
  271 + AND gomh.gar_cancel_flag = 0
  272 + and (go2.gar_create_time <![CDATA[ >= ]]>#{dateStr} or go2.gar_order_handler_status in(0,1))
272 273 </select>
273 274 </mapper>
... ...
trash-unit/src/main/java/com/trash/enterprise/mapper/TransportationEnterpriseMapper.java
1 1 package com.trash.enterprise.mapper;
2 2  
3 3 import com.trash.enterprise.domain.TransportationEnterprise;
  4 +import org.apache.ibatis.annotations.Param;
4 5  
5 6 import java.util.List;
6 7  
... ... @@ -22,6 +23,8 @@ public interface TransportationEnterpriseMapper
22 23  
23 24 TransportationEnterprise selectTransportationEnterpriseByIdStr(String id);
24 25  
  26 + List<TransportationEnterprise> queryByServerPhone(@Param("serverPhone") String serverPhone);
  27 +
25 28 /**
26 29 * 查询运输企业管理列表
27 30 *
... ...
trash-unit/src/main/java/com/trash/enterprise/service/ITransportationEnterpriseService.java
... ... @@ -22,6 +22,7 @@ public interface ITransportationEnterpriseService
22 22 TransportationEnterprise selectTransportationEnterpriseById(String id);
23 23  
24 24 TransportationEnterprise selectTransportationEnterpriseByIdStr(String id);
  25 + TransportationEnterprise queryByServerPhone(String phone);
25 26  
26 27 /**
27 28 * 查询运输企业管理列表
... ...
trash-unit/src/main/java/com/trash/enterprise/service/impl/TransportationEnterpriseServiceImpl.java
... ... @@ -6,6 +6,7 @@ import java.util.List;
6 6 import com.trash.common.config.trashConfig;
7 7 import com.trash.common.utils.DateUtils;
8 8 import com.trash.common.utils.SecurityUtils;
  9 +import org.apache.commons.collections4.CollectionUtils;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.stereotype.Service;
11 12 import com.trash.enterprise.mapper.TransportationEnterpriseMapper;
... ... @@ -42,6 +43,12 @@ public class TransportationEnterpriseServiceImpl implements ITransportationEnter
42 43 return transportationEnterpriseMapper.selectTransportationEnterpriseByIdStr(id);
43 44 }
44 45  
  46 + @Override
  47 + public TransportationEnterprise queryByServerPhone(String phone) {
  48 + List<TransportationEnterprise> enterprises = transportationEnterpriseMapper.queryByServerPhone(phone);
  49 + return CollectionUtils.isEmpty(enterprises) ? null : enterprises.get(0);
  50 + }
  51 +
45 52 /**
46 53 * 查询运输企业管理列表
47 54 *
... ...
trash-unit/src/main/resources/mapper/unit/TransportationEnterpriseMapper.xml
... ... @@ -47,6 +47,10 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
47 47 <sql id="selectTransportationEnterpriseVo">
48 48 select id, name, abbreviation, registration_area, transport_permission_date, enter_date, business_license_date, office_address, parking_lot_location, parking_area, (select count(id) from car_info where company_id = te.id) car_number, safety_manager_name, safety_manager_phone, social_uniform_credit_code_number, legal_representative, legal_representative_phone, safety_people_name, remark, transport_permission, enterprise_business_license, safety_officer_qualification_certificate, safety_certificate, car_park_panorama, business_unit, status, create_time, create_by, update_time, update_by, parent_id, company_type, credit_status, qr_code,service_phone,office_address_gps,offer,company_logo from transportation_enterprise te
49 49 </sql>
  50 + <sql id="selectTransportationEnterpriseVo1">
  51 + select id, name, abbreviation, registration_area, transport_permission_date, enter_date, business_license_date, office_address, parking_lot_location, parking_area, safety_manager_name, safety_manager_phone, social_uniform_credit_code_number, legal_representative, legal_representative_phone, safety_people_name, remark, transport_permission, enterprise_business_license, safety_officer_qualification_certificate, safety_certificate, car_park_panorama, business_unit, status, create_time, create_by, update_time, update_by, parent_id, company_type, credit_status, qr_code,service_phone,office_address_gps,offer,company_logo from transportation_enterprise te
  52 + </sql>
  53 +
50 54  
51 55 <select id="selectTransportationEnterpriseList" parameterType="TransportationEnterprise" resultMap="TransportationEnterpriseResult">
52 56 <include refid="selectTransportationEnterpriseVo"/>
... ... @@ -92,7 +96,11 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
92 96 <include refid="selectTransportationEnterpriseVo"/>
93 97 where id = #{id}
94 98 </select>
95   -
  99 + <select id="queryByServerPhone" resultType="com.trash.enterprise.domain.TransportationEnterprise">
  100 + <include refid="selectTransportationEnterpriseVo1"/>
  101 + where service_phone = #{serverPhone}
  102 + </select>
  103 +
96 104 <insert id="insertTransportationEnterprise" parameterType="TransportationEnterprise" useGeneratedKeys="true" keyProperty="id">
97 105 insert into transportation_enterprise
98 106 <trim prefix="(" suffix=")" suffixOverrides=",">
... ...