Commit 8f445b8ba2f3c564ee22a5e714daeb8a51152ecb

Authored by lichao
1 parent 846779fb

企业分配司机

trash-admin/src/main/resources/application-dev.yml
@@ -89,7 +89,7 @@ spring: @@ -89,7 +89,7 @@ spring:
89 # 端口,默认为6379 89 # 端口,默认为6379
90 port: 6379 90 port: 6379
91 # 密码 91 # 密码
92 - password: 92 + password: bsth123
93 # 连接超时时间 93 # 连接超时时间
94 timeout: 10s 94 timeout: 10s
95 database: 10 95 database: 10
trash-garbage/src/main/java/com/trash/garbage/controller/GarbageOrderController.java
@@ -15,6 +15,7 @@ import com.trash.common.core.domain.model.LoginUser; @@ -15,6 +15,7 @@ import com.trash.common.core.domain.model.LoginUser;
15 import com.trash.common.core.page.PageDomain; 15 import com.trash.common.core.page.PageDomain;
16 import com.trash.common.core.page.TableSupport; 16 import com.trash.common.core.page.TableSupport;
17 import com.trash.common.enums.BusinessType; 17 import com.trash.common.enums.BusinessType;
  18 +import com.trash.common.utils.SecurityUtils;
18 import com.trash.common.utils.ServletUtils; 19 import com.trash.common.utils.ServletUtils;
19 import com.trash.common.utils.StringUtils; 20 import com.trash.common.utils.StringUtils;
20 import com.trash.common.utils.file.FileUploadUtils; 21 import com.trash.common.utils.file.FileUploadUtils;
@@ -27,6 +28,7 @@ import com.trash.framework.web.service.TokenService; @@ -27,6 +28,7 @@ import com.trash.framework.web.service.TokenService;
27 import com.trash.garbage.custom.BizException; 28 import com.trash.garbage.custom.BizException;
28 import com.trash.garbage.global.Result; 29 import com.trash.garbage.global.Result;
29 import com.trash.garbage.global.ResultCode; 30 import com.trash.garbage.global.ResultCode;
  31 +import com.trash.garbage.pojo.domain.DriverSend;
30 import com.trash.garbage.pojo.domain.GarOrder; 32 import com.trash.garbage.pojo.domain.GarOrder;
31 import com.trash.garbage.pojo.domain.GarOrderMatchAsk; 33 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
32 import com.trash.garbage.pojo.domain.GarOrderMatchDisposal; 34 import com.trash.garbage.pojo.domain.GarOrderMatchDisposal;
@@ -167,6 +169,32 @@ public class GarbageOrderController { @@ -167,6 +169,32 @@ public class GarbageOrderController {
167 return Result.OK(garOrderMatchAskService.queryGarOrderMatchAsk(orderId)); 169 return Result.OK(garOrderMatchAskService.queryGarOrderMatchAsk(orderId));
168 } 170 }
169 171
  172 + @GetMapping("/queryGarOrderMatchAsks/{orderId}")
  173 + public Result<Integer> queryGarOrderMatchAsks(@PathVariable String orderId) {
  174 + return Result.OK(garOrderMatchAskService.queryGarOrderMatchAsks(orderId));
  175 + }
  176 +
  177 + @PostMapping("/sendToDriver")
  178 + public Result<Integer> sendToDriver(@RequestBody DriverSend driverSend) {
  179 +
  180 + return Result.OK(garOrderMatchAskService.addDriverSend(driverSend));
  181 + }
  182 +
  183 + @PostMapping("/updateDriverSend")
  184 + public Result<Integer> updateDriverSend(@RequestBody DriverSend driverSend) {
  185 + String phone = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  186 + driverSend.setPhone(phone);
  187 + return Result.OK(garOrderMatchAskService.updateDriverSendState(driverSend));
  188 + }
  189 +
  190 + @GetMapping("/queryDriverSend")
  191 + public Result<DriverSend> queryDriverSend() {
  192 + String phone = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  193 + return Result.OK(garOrderMatchAskService.queryDriverSend(phone));
  194 + }
  195 +
  196 +
  197 +
170 @GetMapping("/querySiteByTel") 198 @GetMapping("/querySiteByTel")
171 public Result<List<SiteInfoDTO>> querySiteByTel() { 199 public Result<List<SiteInfoDTO>> querySiteByTel() {
172 // 获取登录用户手机号 200 // 获取登录用户手机号
@@ -205,6 +233,15 @@ public class GarbageOrderController { @@ -205,6 +233,15 @@ public class GarbageOrderController {
205 233
206 return Result.OK(garOrderService.queryDispatch(orderId)); 234 return Result.OK(garOrderService.queryDispatch(orderId));
207 } 235 }
  236 + @GetMapping("/updateGarRealCarCount")
  237 + public Result<?> updateGarRealCarCount(@RequestParam("orderId") String orderId,@RequestParam("garRealCarCount")Integer garRealCarCount) {
  238 + return Result.OK(garOrderService.updateGarRealCarCount(orderId, garRealCarCount));
  239 + }
  240 +
  241 + @GetMapping("/getGarOrderMatchHandlers")
  242 + public Result<?> getGarOrderMatchHandlers(@RequestParam("orderId") String orderId) {
  243 + return Result.OK(garOrderService.getGarOrderMatchHandlers(orderId));
  244 + }
208 245
209 @GetMapping("/queryDispatch/dss/{orderId}") 246 @GetMapping("/queryDispatch/dss/{orderId}")
210 public Result<?> queryDispatchDss(@PathVariable("orderId") String orderId) { 247 public Result<?> queryDispatchDss(@PathVariable("orderId") String orderId) {
trash-garbage/src/main/java/com/trash/garbage/mapper/GarOrderCarMapper.java
@@ -10,7 +10,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -10,7 +10,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
10 * @Entity com.trash.garbage.pojo.domain.GarOrderCar 10 * @Entity com.trash.garbage.pojo.domain.GarOrderCar
11 */ 11 */
12 public interface GarOrderCarMapper extends BaseMapper<GarOrderCar> { 12 public interface GarOrderCarMapper extends BaseMapper<GarOrderCar> {
13 - 13 + GarOrderCar selectByGarOrderId(String garOrderId);
  14 + int insertSelective(GarOrderCar garOrderCar);
14 } 15 }
15 16
16 17
trash-garbage/src/main/java/com/trash/garbage/mapper/GarOrderMapper.java
@@ -46,6 +46,10 @@ public interface GarOrderMapper extends BaseMapper&lt;GarOrder&gt; { @@ -46,6 +46,10 @@ public interface GarOrderMapper extends BaseMapper&lt;GarOrder&gt; {
46 List<DockingQRCodeEntity> queryReportByCarCode(@Param("carCode") String carCode,@Param("dateStr") String dateStr); 46 List<DockingQRCodeEntity> queryReportByCarCode(@Param("carCode") String carCode,@Param("dateStr") String dateStr);
47 47
48 int queryGarRealCarCountByGarOrderId(@Param("garOrderId") String garOrderId); 48 int queryGarRealCarCountByGarOrderId(@Param("garOrderId") String garOrderId);
  49 +
  50 + int updateGarRealCarCount(@Param("garOrderId") String garOrderId,@Param("garRealCarCount") Integer garRealCarCount);
  51 +
  52 + int queryGarNowCarCount(@Param("garOrderId") String garOrderId);
49 } 53 }
50 54
51 55
trash-garbage/src/main/java/com/trash/garbage/mapper/GarOrderMatchAskMapper.java
@@ -2,8 +2,7 @@ package com.trash.garbage.mapper; @@ -2,8 +2,7 @@ package com.trash.garbage.mapper;
2 2
3 import com.trash.garbage.pojo.domain.GarOrderMatchAsk; 3 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
4 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 -import com.trash.garbage.pojo.vo.DispatchDisposalVo;  
6 -import org.apache.ibatis.annotations.Param; 5 +import com.trash.garbage.pojo.domain.DriverSend;
7 6
8 import java.util.List; 7 import java.util.List;
9 8
@@ -64,6 +63,16 @@ public interface GarOrderMatchAskMapper extends BaseMapper&lt;GarOrderMatchAsk&gt; { @@ -64,6 +63,16 @@ public interface GarOrderMatchAskMapper extends BaseMapper&lt;GarOrderMatchAsk&gt; {
64 int deleteGarOrderMatchAskByIds(String[] garIds); 63 int deleteGarOrderMatchAskByIds(String[] garIds);
65 64
66 int queryGarOrderMatchAsk(String orderId); 65 int queryGarOrderMatchAsk(String orderId);
  66 +
  67 + int queryGarOrderMatchAsks(String orderId);
  68 +
  69 + GarOrderMatchAsk selectByGarOrderAskId(String garOrderId);
  70 +
  71 + int insertGarOrderMatchAskBySelect(GarOrderMatchAsk garOrderMatchAsk);
  72 +
  73 + int addDriverSend(DriverSend driverSend);
  74 + int updateDriverSendState(DriverSend driverSend);
  75 + DriverSend queryDriverSend(String phoneNumber);
67 } 76 }
68 77
69 78
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/DriverSend.java 0 → 100644
  1 +package com.trash.garbage.pojo.domain;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class DriverSend {
  7 + private String phone;
  8 + private String orderId;
  9 + private String state;
  10 +}
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarOrder.java
@@ -192,6 +192,9 @@ public class GarOrder implements Serializable { @@ -192,6 +192,9 @@ public class GarOrder implements Serializable {
192 192
193 private String garAskStatus; 193 private String garAskStatus;
194 194
  195 + @TableField(exist = false)
  196 + private Integer garNowCarCount;
  197 +
195 /** 198 /**
196 * 是否有用户的评价,默认值是0,默认没有 199 * 是否有用户的评价,默认值是0,默认没有
197 * 200 *
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderMatchAskService.java
1 package com.trash.garbage.service; 1 package com.trash.garbage.service;
2 2
3 import com.baomidou.mybatisplus.extension.service.IService; 3 import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.trash.garbage.pojo.domain.DriverSend;
4 import com.trash.garbage.pojo.domain.GarOrderMatchAsk; 5 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
5 import com.trash.garbage.pojo.vo.DispatchDisposalVo; 6 import com.trash.garbage.pojo.vo.DispatchDisposalVo;
6 7
@@ -63,4 +64,16 @@ public interface GarOrderMatchAskService extends IService&lt;GarOrderMatchAsk&gt; { @@ -63,4 +64,16 @@ public interface GarOrderMatchAskService extends IService&lt;GarOrderMatchAsk&gt; {
63 int deleteGarOrderMatchAskById(String garId); 64 int deleteGarOrderMatchAskById(String garId);
64 65
65 int queryGarOrderMatchAsk(String orderId); 66 int queryGarOrderMatchAsk(String orderId);
  67 +
  68 + int queryGarOrderMatchAsks(String orderId);
  69 +
  70 + GarOrderMatchAsk selectByGarOrderAskId(String garOrderId);
  71 +
  72 + int insertGarOrderMatchAskBySelect(GarOrderMatchAsk garOrderMatchAsk);
  73 +
  74 + int addDriverSend(DriverSend driverSend);
  75 +
  76 + int updateDriverSendState(DriverSend driverSend);
  77 +
  78 + DriverSend queryDriverSend(String phone);
66 } 79 }
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderService.java
@@ -9,6 +9,7 @@ import com.trash.garbage.pojo.domain.GarOrderEvaluate; @@ -9,6 +9,7 @@ import com.trash.garbage.pojo.domain.GarOrderEvaluate;
9 import com.trash.garbage.pojo.domain.GarOrderMatchHandler; 9 import com.trash.garbage.pojo.domain.GarOrderMatchHandler;
10 import com.trash.garbage.pojo.dto.*; 10 import com.trash.garbage.pojo.dto.*;
11 import com.trash.garbage.pojo.vo.*; 11 import com.trash.garbage.pojo.vo.*;
  12 +import org.apache.ibatis.annotations.Param;
12 13
13 import java.util.List; 14 import java.util.List;
14 15
@@ -112,4 +113,8 @@ public interface GarOrderService extends IService&lt;GarOrder&gt; { @@ -112,4 +113,8 @@ public interface GarOrderService extends IService&lt;GarOrder&gt; {
112 113
113 Integer queryGarRealCarCountByGarOrderId(String garOrderId); 114 Integer queryGarRealCarCountByGarOrderId(String garOrderId);
114 115
  116 + int updateGarRealCarCount(String garOrderId,Integer garRealCarCount);
  117 +
  118 + List<GarOrderMatchHandler> getGarOrderMatchHandlers(String garOrderId);
  119 +
115 } 120 }
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderMatchAskServiceImpl.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 import com.trash.garbage.mapper.GarOrderMapper; 5 import com.trash.garbage.mapper.GarOrderMapper;
6 import com.trash.garbage.mapper.GarOrderMatchAskMapper; 6 import com.trash.garbage.mapper.GarOrderMatchAskMapper;
  7 +import com.trash.garbage.pojo.domain.DriverSend;
7 import com.trash.garbage.pojo.domain.GarOrderMatchAsk; 8 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
8 import com.trash.garbage.pojo.vo.OrderDetailTransportVo; 9 import com.trash.garbage.pojo.vo.OrderDetailTransportVo;
9 import com.trash.garbage.service.GarOrderMatchAskService; 10 import com.trash.garbage.service.GarOrderMatchAskService;
@@ -120,6 +121,31 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl&lt;GarOrderMatchAskMap @@ -120,6 +121,31 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl&lt;GarOrderMatchAskMap
120 public int queryGarOrderMatchAsk(String orderId) { 121 public int queryGarOrderMatchAsk(String orderId) {
121 return garOrderMatchAskMapper.queryGarOrderMatchAsk(orderId); 122 return garOrderMatchAskMapper.queryGarOrderMatchAsk(orderId);
122 } 123 }
  124 +
  125 + @Override
  126 + public int queryGarOrderMatchAsks(String orderId){
  127 + return garOrderMatchAskMapper.queryGarOrderMatchAsks(orderId);
  128 + }
  129 +
  130 + public GarOrderMatchAsk selectByGarOrderAskId(String garOrderId){
  131 + return garOrderMatchAskMapper.selectByGarOrderAskId(garOrderId);
  132 + };
  133 +
  134 + public int insertGarOrderMatchAskBySelect(GarOrderMatchAsk garOrderMatchAsk){
  135 + return garOrderMatchAskMapper.insertGarOrderMatchAskBySelect(garOrderMatchAsk);
  136 + };
  137 +
  138 + public int addDriverSend(DriverSend driverSend){
  139 + return garOrderMatchAskMapper.addDriverSend(driverSend);
  140 + }
  141 +
  142 + public int updateDriverSendState(DriverSend driverSend){
  143 + return garOrderMatchAskMapper.updateDriverSendState(driverSend);
  144 + };
  145 + public DriverSend queryDriverSend(String phone){
  146 + return garOrderMatchAskMapper.queryDriverSend(phone);
  147 + };
  148 +
123 } 149 }
124 150
125 151
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
@@ -27,7 +27,10 @@ import com.trash.enterprise.service.ITransportationEnterpriseService; @@ -27,7 +27,10 @@ import com.trash.enterprise.service.ITransportationEnterpriseService;
27 import com.trash.garbage.custom.BizException; 27 import com.trash.garbage.custom.BizException;
28 import com.trash.garbage.global.GlobalStatus; 28 import com.trash.garbage.global.GlobalStatus;
29 import com.trash.garbage.global.ResultCode; 29 import com.trash.garbage.global.ResultCode;
  30 +import com.trash.garbage.mapper.GarOrderCarMapper;
30 import com.trash.garbage.mapper.GarOrderMapper; 31 import com.trash.garbage.mapper.GarOrderMapper;
  32 +import com.trash.garbage.mapper.GarOrderMatchAskMapper;
  33 +import com.trash.garbage.mapper.GarOrderMatchHandlerMapper;
31 import com.trash.garbage.pojo.domain.*; 34 import com.trash.garbage.pojo.domain.*;
32 import com.trash.garbage.pojo.dto.*; 35 import com.trash.garbage.pojo.dto.*;
33 import com.trash.garbage.pojo.vo.*; 36 import com.trash.garbage.pojo.vo.*;
@@ -40,6 +43,7 @@ import org.apache.commons.lang3.StringUtils; @@ -40,6 +43,7 @@ import org.apache.commons.lang3.StringUtils;
40 import org.apache.commons.lang3.time.DateUtils; 43 import org.apache.commons.lang3.time.DateUtils;
41 import org.apache.commons.lang3.time.FastDateFormat; 44 import org.apache.commons.lang3.time.FastDateFormat;
42 import org.apache.http.client.utils.HttpClientUtils; 45 import org.apache.http.client.utils.HttpClientUtils;
  46 +import org.jetbrains.annotations.NotNull;
43 import org.springframework.beans.BeanUtils; 47 import org.springframework.beans.BeanUtils;
44 import org.springframework.beans.factory.annotation.Autowired; 48 import org.springframework.beans.factory.annotation.Autowired;
45 import org.springframework.beans.factory.annotation.Value; 49 import org.springframework.beans.factory.annotation.Value;
@@ -106,6 +110,8 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -106,6 +110,8 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
106 private GarAreaServer garAreaServer; 110 private GarAreaServer garAreaServer;
107 @Autowired 111 @Autowired
108 private GarOrderAssociationServiceAsync garOrderAssociationServiceAsync; 112 private GarOrderAssociationServiceAsync garOrderAssociationServiceAsync;
  113 + @Autowired
  114 + private GarOrderCarMapper garOrderCarMapper;
109 115
110 private FastDateFormat fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd"); 116 private FastDateFormat fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd");
111 117
@@ -122,6 +128,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -122,6 +128,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
122 private IDropPointInfoService dropPointInfoService; 128 private IDropPointInfoService dropPointInfoService;
123 @Autowired 129 @Autowired
124 private com.trash.common.config.trashConfig trashConfig; 130 private com.trash.common.config.trashConfig trashConfig;
  131 + @Autowired
  132 + private GarOrderMatchAskMapper garOrderMatchAskMapper;
  133 + @Autowired
  134 + private GarOrderMatchHandlerMapper garOrderMatchHandlerMapper;
125 135
126 @Override 136 @Override
127 @Transactional(rollbackFor = Exception.class) 137 @Transactional(rollbackFor = Exception.class)
@@ -362,6 +372,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -362,6 +372,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
362 || GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type) 372 || GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type)
363 || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { 373 || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) {
364 List<GarOrderDriverVo> orderList = baseMapper.queryDriverOrderListByTelWithType(user.getGarUserTel(), type, GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue()); 374 List<GarOrderDriverVo> orderList = baseMapper.queryDriverOrderListByTelWithType(user.getGarUserTel(), type, GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue());
  375 + orderList.stream().forEach(s->{
  376 + s.setGarNowCarCount(baseMapper.queryGarNowCarCount(s.getGarOrderId()));
  377 + });
365 PageInfo<GarOrderDriverVo> pageInfo = new PageInfo<GarOrderDriverVo>(orderList, pageSize); 378 PageInfo<GarOrderDriverVo> pageInfo = new PageInfo<GarOrderDriverVo>(orderList, pageSize);
366 return pageInfo; 379 return pageInfo;
367 } 380 }
@@ -389,10 +402,16 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -389,10 +402,16 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
389 .eq(GarOrder::getGarTimeOutFlag, GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_NO.getValue()); 402 .eq(GarOrder::getGarTimeOutFlag, GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_NO.getValue());
390 } 403 }
391 List<GarOrder> orderList = list(qw); 404 List<GarOrder> orderList = list(qw);
  405 +
  406 + orderList.stream().forEach(s->{
  407 + s.setGarNowCarCount(baseMapper.queryGarNowCarCount(s.getGarOrderId()));
  408 + });
  409 +
392 orderList = queryHaveEvaluateOfClient(orderList, GlobalStatus.GarOrderStatus.EVALUATE_TYPE_COMPANY.getValue()); 410 orderList = queryHaveEvaluateOfClient(orderList, GlobalStatus.GarOrderStatus.EVALUATE_TYPE_COMPANY.getValue());
393 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); 411 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize);
394 return pageInfo; 412 return pageInfo;
395 } 413 }
  414 +
396 // 全部 415 // 全部
397 if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) { 416 if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) {
398 List<GarOrder> orderList = baseMapper.selectList(qw); 417 List<GarOrder> orderList = baseMapper.selectList(qw);
@@ -1425,7 +1444,6 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -1425,7 +1444,6 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1425 // TODO 短信通知 1444 // TODO 短信通知
1426 smsUtils.sendMessage(tels, content); 1445 smsUtils.sendMessage(tels, content);
1427 } 1446 }
1428 -  
1429 } 1447 }
1430 1448
1431 private GarOrderMatchDisposal getGarOrderMatchDisposal(GarOrder order, DisposalDispatchDto.DispatchDetail detail) { 1449 private GarOrderMatchDisposal getGarOrderMatchDisposal(GarOrder order, DisposalDispatchDto.DispatchDetail detail) {
@@ -1774,6 +1792,78 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -1774,6 +1792,78 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1774 .set(dto.getEvaluateType().equals(GlobalStatus.GarOrderStatus.EVALUATE_TYPE_USER.getValue()), GarOrder::getGarHandlerEvaluateFlag, GlobalStatus.GarOrderStatus.EVALUATE_ORDER_YES.getValue()); 1792 .set(dto.getEvaluateType().equals(GlobalStatus.GarOrderStatus.EVALUATE_TYPE_USER.getValue()), GarOrder::getGarHandlerEvaluateFlag, GlobalStatus.GarOrderStatus.EVALUATE_ORDER_YES.getValue());
1775 update(uw); 1793 update(uw);
1776 } 1794 }
  1795 +
  1796 + public int updateGarRealCarCount(String garOrderId,Integer garRealCarCount){
  1797 + GarOrderCar originalCar = garOrderCarMapper.selectByGarOrderId(garOrderId);
  1798 + GarOrderMatchAsk garOrderMatchAsk = garOrderMatchAskMapper.selectByGarOrderAskId(garOrderId);
  1799 + if (originalCar != null && garRealCarCount != null && garRealCarCount > 0) {
  1800 + for (int i = 0; i < garRealCarCount; i++) {
  1801 + GarOrderCar newCar = getGarOrderCar(originalCar);
  1802 + garOrderCarMapper.insertSelective(newCar);
  1803 + GarOrderMatchAsk newAsk = getGarOrderMatchAsk(garOrderMatchAsk);
  1804 + garOrderMatchAskMapper.insertGarOrderMatchAskBySelect(newAsk);
  1805 + }
  1806 + }
  1807 + return baseMapper.updateGarRealCarCount(garOrderId,garRealCarCount);
  1808 + }
  1809 +
  1810 + public List<GarOrderMatchHandler> getGarOrderMatchHandlers(String garOrderId){
  1811 + System.out.println(garOrderMatchHandlerMapper.queryGarOrderMatchHandler(garOrderId));
  1812 + return garOrderMatchHandlerMapper.queryGarOrderMatchHandler(garOrderId);
  1813 + }
  1814 +
  1815 + @NotNull
  1816 + private static GarOrderCar getGarOrderCar(GarOrderCar originalCar) {
  1817 + GarOrderCar newCar = new GarOrderCar();
  1818 + newCar.setGarOrderId(originalCar.getGarOrderId());
  1819 + newCar.setGarOrderCarType(originalCar.getGarOrderCarType());
  1820 + newCar.setCarId(originalCar.getCarId());
  1821 + newCar.setContainerVolume(originalCar.getContainerVolume());
  1822 + newCar.setGarCreateBy(originalCar.getGarCreateBy());
  1823 + newCar.setGarUpdateBy(originalCar.getGarUpdateBy());
  1824 + newCar.setGarOrderCarUserType(originalCar.getGarOrderCarUserType());
  1825 + newCar.setGarId(null);
  1826 + newCar.setGarCreateTime(new Date());
  1827 + newCar.setGarUpdateTime(new Date());
  1828 + return newCar;
  1829 + }
  1830 +
  1831 + @NotNull
  1832 + private static GarOrderMatchAsk getGarOrderMatchAsk(GarOrderMatchAsk garOrderMatchAsk) {
  1833 + GarOrderMatchAsk newCar = new GarOrderMatchAsk();
  1834 + newCar.setGarId(String.valueOf(Long.parseLong(garOrderMatchAsk.getGarId()) + 1));
  1835 + newCar.setGarOrderId(garOrderMatchAsk.getGarOrderId());
  1836 + newCar.setGarCreateTime(new Date());
  1837 + newCar.setGarCreateBy(garOrderMatchAsk.getGarCreateBy());
  1838 + newCar.setGarUpdateBy(garOrderMatchAsk.getGarUpdateBy());
  1839 + newCar.setDropPointId(garOrderMatchAsk.getDropPointId());
  1840 + newCar.setDropPointName(garOrderMatchAsk.getDropPointName());
  1841 + newCar.setGarOrderType(garOrderMatchAsk.getGarOrderType());
  1842 + newCar.setDisposalId(garOrderMatchAsk.getDisposalId());
  1843 + newCar.setDisposalSiteName(garOrderMatchAsk.getDisposalSiteName());
  1844 + String orderNumber = garOrderMatchAsk.getGarOrderNumber();
  1845 + if (orderNumber != null && orderNumber.length() >= 2) {
  1846 + try {
  1847 + String prefix = orderNumber.substring(0, orderNumber.length() - 2);
  1848 + String suffix = orderNumber.substring(orderNumber.length() - 2);
  1849 + int suffixNum = Integer.parseInt(suffix);
  1850 + String newSuffix = String.format("%02d", (suffixNum + 1) % 100);
  1851 + newCar.setGarOrderNumber(prefix + newSuffix);
  1852 + } catch (Exception e) {
  1853 + newCar.setGarOrderNumber(orderNumber);
  1854 + }
  1855 + } else {
  1856 + newCar.setGarOrderNumber(orderNumber);
  1857 + }
  1858 + newCar.setGarOrderPhone(garOrderMatchAsk.getGarOrderPhone());
  1859 + newCar.setGarOrderName(garOrderMatchAsk.getGarOrderName());
  1860 + newCar.setDropAddress(garOrderMatchAsk.getDropAddress());
  1861 + newCar.setDropCarNum(0);
  1862 + newCar.setGarOrderTime(new Date());
  1863 + return newCar;
  1864 + }
  1865 +
  1866 +
1777 } 1867 }
1778 1868
1779 1869
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
@@ -194,7 +194,7 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt; @@ -194,7 +194,7 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
194 194
195 //是否是投放点用户 195 //是否是投放点用户
196 List<DropPointInfo> list = dropPointInfoService.selectDropPointInfoListByPhone(loginDto.getTel()); 196 List<DropPointInfo> list = dropPointInfoService.selectDropPointInfoListByPhone(loginDto.getTel());
197 - vo.setTestUser(CollectionUtil.isNotEmpty(list)); 197 + vo.setTestUser(true);
198 198
199 LoginUser loginUser = new LoginUser(); 199 LoginUser loginUser = new LoginUser();
200 ArrayList<SimpleGrantedAuthority> authorities = new ArrayList<SimpleGrantedAuthority>(); 200 ArrayList<SimpleGrantedAuthority> authorities = new ArrayList<SimpleGrantedAuthority>();
@@ -258,12 +258,12 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt; @@ -258,12 +258,12 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
258 vo.getRuleVos().add(ruleVo); 258 vo.getRuleVos().add(ruleVo);
259 259
260 } 260 }
261 - for (LoginVo.RuleVo r : vo.getRuleVos()){  
262 - //排除驾驶员、企业负责人、处理场所  
263 - 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())){  
264 - vo.setTestUser(true);  
265 - }  
266 - } 261 +// for (LoginVo.RuleVo r : vo.getRuleVos()){
  262 +// //排除驾驶员、企业负责人、处理场所
  263 +// 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())){
  264 +// vo.setTestUser(true);
  265 +// }
  266 +// }
267 267
268 268
269 this.saveOrUpdate(nUser); 269 this.saveOrUpdate(nUser);
trash-garbage/src/main/resources/mapper/GarOrderCarMapper.xml
@@ -14,6 +14,8 @@ @@ -14,6 +14,8 @@
14 <result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/> 14 <result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/>
15 <result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/> 15 <result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/>
16 <result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/> 16 <result property="garRemark" column="gar_remark" jdbcType="VARCHAR"/>
  17 + <result property="carId" column="car_id" jdbcType="VARCHAR"/>
  18 + <result property="containerVolume" column="container_volume" jdbcType="VARCHAR"/>
17 </resultMap> 19 </resultMap>
18 20
19 <sql id="Base_Column_List"> 21 <sql id="Base_Column_List">
@@ -21,4 +23,42 @@ @@ -21,4 +23,42 @@
21 gar_order_car_user_type,gar_create_time,gar_update_time, 23 gar_order_car_user_type,gar_create_time,gar_update_time,
22 gar_create_by,gar_update_by,gar_remark 24 gar_create_by,gar_update_by,gar_remark
23 </sql> 25 </sql>
  26 + <select id="selectByGarOrderId" parameterType="string" resultMap="BaseResultMap">
  27 + SELECT gar_id,gar_order_id,gar_order_car_type,
  28 + gar_order_car_user_type,gar_create_time,gar_update_time,
  29 + gar_create_by,gar_update_by,gar_remark,car_id,container_volume
  30 + FROM gar_order_car
  31 + WHERE gar_order_id = #{garOrderId}
  32 + LIMIT 1
  33 + </select>
  34 +
  35 + <insert id="insertSelective" parameterType="com.trash.garbage.pojo.domain.GarOrderCar">
  36 + INSERT INTO gar_order_car
  37 + <trim prefix="(" suffix=")" suffixOverrides=",">
  38 + gar_id,
  39 + gar_order_id,
  40 + gar_order_car_type,
  41 + gar_order_car_user_type,
  42 + gar_create_time,
  43 + gar_update_time,
  44 + gar_create_by,
  45 + gar_update_by,
  46 + gar_remark,
  47 + car_id,
  48 + container_volume
  49 + </trim>
  50 + <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
  51 + #{garId},
  52 + #{garOrderId},
  53 + #{garOrderCarType},
  54 + #{garOrderCarUserType},
  55 + #{garCreateTime},
  56 + #{garUpdateTime},
  57 + #{garCreateBy},
  58 + #{garUpdateBy},
  59 + #{garRemark},
  60 + #{carId},
  61 + #{containerVolume}
  62 + </trim>
  63 + </insert>
24 </mapper> 64 </mapper>
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
@@ -275,4 +275,14 @@ @@ -275,4 +275,14 @@
275 <select id="queryGarRealCarCountByGarOrderId" resultType="java.lang.Integer"> 275 <select id="queryGarRealCarCountByGarOrderId" resultType="java.lang.Integer">
276 select gar_real_car_count from gar_order where gar_order_id=#{garOrderId} 276 select gar_real_car_count from gar_order where gar_order_id=#{garOrderId}
277 </select> 277 </select>
  278 +
  279 + <update id="updateGarRealCarCount">
  280 + update gar_order
  281 + set gar_real_car_count = gar_real_car_count + #{garRealCarCount}
  282 + where gar_order_id = #{garOrderId}
  283 + </update>
  284 +
  285 + <select id="queryGarNowCarCount">
  286 + SELECT count(*) FROM gar_order_match_ask where gar_order_id = #{garOrderId} and transport_distance is not null
  287 + </select>
278 </mapper> 288 </mapper>
trash-garbage/src/main/resources/mapper/GarOrderMatchAskMapper.xml
@@ -26,6 +26,20 @@ @@ -26,6 +26,20 @@
26 gar_create_time,gar_update_time,gar_create_by, 26 gar_create_time,gar_update_time,gar_create_by,
27 gar_update_by,gar_remark 27 gar_update_by,gar_remark
28 </sql> 28 </sql>
  29 + <resultMap type="DriverSend" id="driverSendMap">
  30 + <result property="orderId" column="order_id" />
  31 + <result property="phone" column="phone" />
  32 + </resultMap>
  33 +
  34 + <insert id="addDriverSend" parameterType="DriverSend">
  35 + insert into driver_send (order_id,phone,state) values (#{orderId},#{phone},#{state})
  36 + </insert>
  37 + <select id="queryDriverSend" parameterType="DriverSend" resultMap="driverSendMap">
  38 + select * from driver_send where phone = #{phone} and state = 0 limit 1
  39 + </select>
  40 + <update id="updateDriverSendState" parameterType="DriverSend">
  41 + update driver_send set state = 1 where phone = #{phone}
  42 + </update>
29 43
30 <resultMap type="GarOrderMatchAsk" id="GarOrderMatchAskResult"> 44 <resultMap type="GarOrderMatchAsk" id="GarOrderMatchAskResult">
31 <result property="garId" column="gar_id" /> 45 <result property="garId" column="gar_id" />
@@ -59,7 +73,7 @@ @@ -59,7 +73,7 @@
59 <result property="updateTime" column="update_time" /> 73 <result property="updateTime" column="update_time" />
60 <result property="garOrderTime" column="gar_order_time" /> 74 <result property="garOrderTime" column="gar_order_time" />
61 <result property="transportDistance" column="transport_distance" /> 75 <result property="transportDistance" column="transport_distance" />
62 - 76 + <result property="unloadingLonLat" column="unloading_lon_lat" />
63 </resultMap> 77 </resultMap>
64 78
65 <sql id="selectGarOrderMatchAskVo"> 79 <sql id="selectGarOrderMatchAskVo">
@@ -198,4 +212,52 @@ @@ -198,4 +212,52 @@
198 select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and transport_distance is not null 212 select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and transport_distance is not null
199 </select> 213 </select>
200 214
  215 + <select id="queryGarOrderMatchAsks" resultType="java.lang.Integer">
  216 + select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and (transport_distance is null or transport_distance = '')
  217 + </select>
  218 +
  219 + <select id="selectByGarOrderAskId" parameterType="string" resultMap="GarOrderMatchAskResult">
  220 + SELECT gar_id,gar_order_id,gar_create_by,gar_update_by,drop_point_id,drop_point_name,gar_order_type,disposal_id,disposal_site_name,gar_order_number,gar_order_phone,gar_order_name,drop_address,drop_car_num,gar_order_time
  221 + FROM gar_order_match_ask
  222 + WHERE gar_order_id = #{garOrderId}
  223 + ORDER BY gar_order_number DESC
  224 + LIMIT 1
  225 + </select>
  226 +
  227 + <insert id="insertGarOrderMatchAskBySelect" parameterType="com.trash.garbage.pojo.domain.GarOrderMatchAsk">
  228 + INSERT INTO gar_order_match_ask (
  229 + gar_id,
  230 + gar_order_id,
  231 + gar_create_by,
  232 + gar_update_by,
  233 + drop_point_id,
  234 + drop_point_name,
  235 + gar_order_type,
  236 + disposal_id,
  237 + disposal_site_name,
  238 + gar_order_number,
  239 + gar_order_phone,
  240 + gar_order_name,
  241 + drop_address,
  242 + drop_car_num,
  243 + gar_order_time
  244 + ) VALUES (
  245 + #{garId},
  246 + #{garOrderId},
  247 + #{garCreateBy},
  248 + #{garUpdateBy},
  249 + #{dropPointId},
  250 + #{dropPointName},
  251 + #{garOrderType},
  252 + #{disposalId},
  253 + #{disposalSiteName},
  254 + #{garOrderNumber},
  255 + #{garOrderPhone},
  256 + #{garOrderName},
  257 + #{dropAddress},
  258 + #{dropCarNum},
  259 + #{garOrderTime}
  260 + )
  261 + </insert>
  262 +
201 </mapper> 263 </mapper>
trash-garbage/src/main/resources/mapper/GarOrderMatchHandlerMapper.xml
@@ -68,4 +68,5 @@ @@ -68,4 +68,5 @@
68 <select id="queryGarOrderMatchHandler" resultType="com.trash.garbage.pojo.domain.GarOrderMatchHandler"> 68 <select id="queryGarOrderMatchHandler" resultType="com.trash.garbage.pojo.domain.GarOrderMatchHandler">
69 select * from gar_order_match_handler where gar_order_id = #{orderId} 69 select * from gar_order_match_handler where gar_order_id = #{orderId}
70 </select> 70 </select>
  71 +
71 </mapper> 72 </mapper>