Commit 57257640f5149f5db28d46cce52286210342668a

Authored by youxiw2000
2 parents ca15ec7c bbf81559

Merge branch 'dev' of http://61.169.120.202:8888/youxiw20000/trash into

dev

# Conflicts:
#	trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
trash-garbage/src/main/java/com/trash/garbage/controller/GarbageOrderController.java
... ... @@ -15,6 +15,7 @@ import com.trash.common.core.domain.model.LoginUser;
15 15 import com.trash.common.core.page.PageDomain;
16 16 import com.trash.common.core.page.TableSupport;
17 17 import com.trash.common.enums.BusinessType;
  18 +import com.trash.common.utils.SecurityUtils;
18 19 import com.trash.common.utils.ServletUtils;
19 20 import com.trash.common.utils.StringUtils;
20 21 import com.trash.common.utils.file.FileUploadUtils;
... ... @@ -27,6 +28,7 @@ import com.trash.framework.web.service.TokenService;
27 28 import com.trash.garbage.custom.BizException;
28 29 import com.trash.garbage.global.Result;
29 30 import com.trash.garbage.global.ResultCode;
  31 +import com.trash.garbage.pojo.domain.DriverSend;
30 32 import com.trash.garbage.pojo.domain.GarOrder;
31 33 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
32 34 import com.trash.garbage.pojo.domain.GarOrderMatchDisposal;
... ... @@ -167,6 +169,46 @@ public class GarbageOrderController {
167 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 + @GetMapping("/queryErrType")
  178 + public Result<Integer> queryErrType() {
  179 + String phone = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  180 + return Result.OK(garOrderMatchAskService.queryErrType(phone));
  181 + }
  182 +
  183 + @GetMapping("/queryCarCode")
  184 + public Result<List<GarOrderMatchAsk>> queryCarCode(@RequestParam String orderId) {
  185 + return Result.OK(garOrderMatchAskService.queryCarCode(orderId));
  186 + }
  187 +
  188 + @PostMapping("/sendToDriver")
  189 + public Result<Integer> sendToDriver(@RequestBody DriverSend driverSend) {
  190 + String phone = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  191 + driverSend.setPhone(phone);
  192 + driverSend.setState("0");
  193 + return Result.OK(garOrderMatchAskService.addDriverSend(driverSend));
  194 + }
  195 +
  196 + @PostMapping("/updateDriverSend")
  197 + public Result<Integer> updateDriverSend(@RequestBody DriverSend driverSend) {
  198 + String phone = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  199 + driverSend.setPhone(phone);
  200 + driverSend.setState("1");
  201 + return Result.OK(garOrderMatchAskService.updateDriverSendState(driverSend));
  202 + }
  203 +
  204 + @GetMapping("/queryDriverSend")
  205 + public Result<DriverSend> queryDriverSend() {
  206 + String phone = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  207 + return Result.OK(garOrderMatchAskService.queryDriverSend(phone));
  208 + }
  209 +
  210 +
  211 +
170 212 @GetMapping("/querySiteByTel")
171 213 public Result<List<SiteInfoDTO>> querySiteByTel() {
172 214 // 获取登录用户手机号
... ... @@ -205,6 +247,15 @@ public class GarbageOrderController {
205 247  
206 248 return Result.OK(garOrderService.queryDispatch(orderId));
207 249 }
  250 + @GetMapping("/updateGarRealCarCount")
  251 + public Result<?> updateGarRealCarCount(@RequestParam("orderId") String orderId,@RequestParam("garRealCarCount")Integer garRealCarCount) {
  252 + return Result.OK(garOrderService.updateGarRealCarCount(orderId, garRealCarCount));
  253 + }
  254 +
  255 + @GetMapping("/getGarOrderMatchHandlers")
  256 + public Result<?> getGarOrderMatchHandlers(@RequestParam("orderId") String orderId) {
  257 + return Result.OK(garOrderService.getGarOrderMatchHandlers(orderId));
  258 + }
208 259  
209 260 @GetMapping("/queryDispatch/dss/{orderId}")
210 261 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 10 * @Entity com.trash.garbage.pojo.domain.GarOrderCar
11 11 */
12 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 46 List<DockingQRCodeEntity> queryReportByCarCode(@Param("carCode") String carCode,@Param("dateStr") String dateStr);
47 47  
48 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 2  
3 3 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
4 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 7 import java.util.List;
9 8  
... ... @@ -64,6 +63,20 @@ public interface GarOrderMatchAskMapper extends BaseMapper&lt;GarOrderMatchAsk&gt; {
64 63 int deleteGarOrderMatchAskByIds(String[] garIds);
65 64  
66 65 int queryGarOrderMatchAsk(String orderId);
  66 +
  67 + int queryGarOrderMatchAsks(String orderId);
  68 +
  69 + int queryErrType(String phone);
  70 +
  71 + GarOrderMatchAsk selectByGarOrderAskId(String garOrderId);
  72 +
  73 + List<GarOrderMatchAsk> queryCarCode(String orderId);
  74 +
  75 + int insertGarOrderMatchAskBySelect(GarOrderMatchAsk garOrderMatchAsk);
  76 +
  77 + int addDriverSend(DriverSend driverSend);
  78 + int updateDriverSendState(DriverSend driverSend);
  79 + DriverSend queryDriverSend(String phoneNumber);
67 80 }
68 81  
69 82  
... ...
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,7 +192,44 @@ public class GarOrder implements Serializable {
192 192  
193 193 private String garAskStatus;
194 194  
195   - /**
  195 + @TableField(exist = false)
  196 + private Integer garNowCarCount;
  197 +
  198 +
  199 +
  200 + public String getGarOrderHandlerStatusStr() {
  201 + return garOrderHandlerStatusStr;
  202 + }
  203 +
  204 + public void setGarOrderHandlerStatusStr(String garOrderHandlerStatusStr) {
  205 + this.garOrderHandlerStatusStr = garOrderHandlerStatusStr;
  206 + }
  207 +
  208 + public String getGarCancelFlagStr() {
  209 + return garCancelFlagStr;
  210 + }
  211 +
  212 + public void setGarCancelFlagStr(String garCancelFlagStr) {
  213 + this.garCancelFlagStr = garCancelFlagStr;
  214 + }
  215 +
  216 + public Boolean getNeedFollowCar() {
  217 + return needFollowCar;
  218 + }
  219 +
  220 + public void setNeedFollowCar(Boolean needFollowCar) {
  221 + this.needFollowCar = needFollowCar;
  222 + }
  223 +
  224 + public Integer getGarNowCarCount() {
  225 + return garNowCarCount;
  226 + }
  227 +
  228 + public void setGarNowCarCount(Integer garNowCarCount) {
  229 + this.garNowCarCount = garNowCarCount;
  230 + }
  231 +
  232 + /**
196 233 * 是否有用户的评价,默认值是0,默认没有
197 234 *
198 235 * @author liujun
... ...
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderMatchAskService.java
1 1 package com.trash.garbage.service;
2 2  
3 3 import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.trash.garbage.pojo.domain.DriverSend;
4 5 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
5 6 import com.trash.garbage.pojo.vo.DispatchDisposalVo;
6 7  
... ... @@ -63,4 +64,20 @@ public interface GarOrderMatchAskService extends IService&lt;GarOrderMatchAsk&gt; {
63 64 int deleteGarOrderMatchAskById(String garId);
64 65  
65 66 int queryGarOrderMatchAsk(String orderId);
  67 +
  68 + int queryGarOrderMatchAsks(String orderId);
  69 +
  70 + List<GarOrderMatchAsk> queryCarCode(String orderId);
  71 +
  72 + int queryErrType(String phone);
  73 +
  74 + GarOrderMatchAsk selectByGarOrderAskId(String garOrderId);
  75 +
  76 + int insertGarOrderMatchAskBySelect(GarOrderMatchAsk garOrderMatchAsk);
  77 +
  78 + int addDriverSend(DriverSend driverSend);
  79 +
  80 + int updateDriverSendState(DriverSend driverSend);
  81 +
  82 + DriverSend queryDriverSend(String phone);
66 83 }
... ...
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderService.java
... ... @@ -9,6 +9,7 @@ import com.trash.garbage.pojo.domain.GarOrderEvaluate;
9 9 import com.trash.garbage.pojo.domain.GarOrderMatchHandler;
10 10 import com.trash.garbage.pojo.dto.*;
11 11 import com.trash.garbage.pojo.vo.*;
  12 +import org.apache.ibatis.annotations.Param;
12 13  
13 14 import java.util.List;
14 15  
... ... @@ -112,4 +113,8 @@ public interface GarOrderService extends IService&lt;GarOrder&gt; {
112 113  
113 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 4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 5 import com.trash.garbage.mapper.GarOrderMapper;
6 6 import com.trash.garbage.mapper.GarOrderMatchAskMapper;
  7 +import com.trash.garbage.pojo.domain.DriverSend;
7 8 import com.trash.garbage.pojo.domain.GarOrderMatchAsk;
8 9 import com.trash.garbage.pojo.vo.OrderDetailTransportVo;
9 10 import com.trash.garbage.service.GarOrderMatchAskService;
... ... @@ -120,6 +121,37 @@ public class GarOrderMatchAskServiceImpl extends ServiceImpl&lt;GarOrderMatchAskMap
120 121 public int queryGarOrderMatchAsk(String orderId) {
121 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 +
  149 + public List<GarOrderMatchAsk> queryCarCode(String orderId){
  150 + return garOrderMatchAskMapper.queryCarCode(orderId);
  151 + }
  152 + public int queryErrType(String phone){
  153 + return garOrderMatchAskMapper.queryErrType(phone);
  154 + }
123 155 }
124 156  
125 157  
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
... ... @@ -30,7 +30,10 @@ import com.trash.enterprise.service.ITransportationEnterpriseService;
30 30 import com.trash.garbage.custom.BizException;
31 31 import com.trash.garbage.global.GlobalStatus;
32 32 import com.trash.garbage.global.ResultCode;
  33 +import com.trash.garbage.mapper.GarOrderCarMapper;
33 34 import com.trash.garbage.mapper.GarOrderMapper;
  35 +import com.trash.garbage.mapper.GarOrderMatchAskMapper;
  36 +import com.trash.garbage.mapper.GarOrderMatchHandlerMapper;
34 37 import com.trash.garbage.pojo.domain.*;
35 38 import com.trash.garbage.pojo.dto.*;
36 39 import com.trash.garbage.pojo.vo.*;
... ... @@ -43,6 +46,7 @@ import org.apache.commons.lang3.StringUtils;
43 46 import org.apache.commons.lang3.time.DateUtils;
44 47 import org.apache.commons.lang3.time.FastDateFormat;
45 48 import org.apache.http.client.utils.HttpClientUtils;
  49 +import org.jetbrains.annotations.NotNull;
46 50 import org.springframework.beans.BeanUtils;
47 51 import org.springframework.beans.factory.annotation.Autowired;
48 52 import org.springframework.beans.factory.annotation.Value;
... ... @@ -109,9 +113,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
109 113 private GarAreaServer garAreaServer;
110 114 @Autowired
111 115 private GarOrderAssociationServiceAsync garOrderAssociationServiceAsync;
112   -
113 116 @Autowired
114 117 private CarInfoMapper carInfoMapper;
  118 + @Autowired
  119 + private GarOrderCarMapper garOrderCarMapper;
115 120  
116 121 private FastDateFormat fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd");
117 122  
... ... @@ -128,6 +133,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
128 133 private IDropPointInfoService dropPointInfoService;
129 134 @Autowired
130 135 private com.trash.common.config.trashConfig trashConfig;
  136 + @Autowired
  137 + private GarOrderMatchAskMapper garOrderMatchAskMapper;
  138 + @Autowired
  139 + private GarOrderMatchHandlerMapper garOrderMatchHandlerMapper;
131 140  
132 141 @Override
133 142 @Transactional(rollbackFor = Exception.class)
... ... @@ -350,6 +359,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
350 359 .eq(GarOrder::getGarTimeOutFlag, GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_NO.getValue());
351 360 }
352 361 List<GarOrder> orderList = list(qw);
  362 + orderList.stream().forEach(s->{
  363 + s.setGarNowCarCount(baseMapper.queryGarNowCarCount(s.getGarOrderId()));
  364 + });
353 365 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize);
354 366 return pageInfo;
355 367 }
... ... @@ -357,6 +369,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
357 369 // 全部
358 370 if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) {
359 371 List<GarOrder> orderList = list(qw);
  372 + orderList.stream().forEach(s->{
  373 + s.setGarNowCarCount(baseMapper.queryGarNowCarCount(s.getGarOrderId()));
  374 + });
360 375 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize);
361 376 return pageInfo;
362 377 }
... ... @@ -368,6 +383,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
368 383 || GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type)
369 384 || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) {
370 385 List<GarOrderDriverVo> orderList = baseMapper.queryDriverOrderListByTelWithType(user.getGarUserTel(), type, GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue());
  386 + orderList.stream().forEach(s->{
  387 + s.setGarNowCarCount(baseMapper.queryGarNowCarCount(s.getGarOrderId()));
  388 + });
371 389 PageInfo<GarOrderDriverVo> pageInfo = new PageInfo<GarOrderDriverVo>(orderList, pageSize);
372 390 return pageInfo;
373 391 }
... ... @@ -395,10 +413,16 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
395 413 .eq(GarOrder::getGarTimeOutFlag, GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_NO.getValue());
396 414 }
397 415 List<GarOrder> orderList = list(qw);
  416 +
  417 + orderList.stream().forEach(s->{
  418 + s.setGarNowCarCount(baseMapper.queryGarNowCarCount(s.getGarOrderId()));
  419 + });
  420 +
398 421 orderList = queryHaveEvaluateOfClient(orderList, GlobalStatus.GarOrderStatus.EVALUATE_TYPE_COMPANY.getValue());
399 422 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize);
400 423 return pageInfo;
401 424 }
  425 +
402 426 // 全部
403 427 if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) {
404 428 List<GarOrder> orderList = baseMapper.selectList(qw);
... ... @@ -1431,7 +1455,6 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1431 1455 // TODO 短信通知
1432 1456 smsUtils.sendMessage(tels, content);
1433 1457 }
1434   -
1435 1458 }
1436 1459  
1437 1460 private GarOrderMatchDisposal getGarOrderMatchDisposal(GarOrder order, DisposalDispatchDto.DispatchDetail detail) {
... ... @@ -1780,6 +1803,81 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
1780 1803 .set(dto.getEvaluateType().equals(GlobalStatus.GarOrderStatus.EVALUATE_TYPE_USER.getValue()), GarOrder::getGarHandlerEvaluateFlag, GlobalStatus.GarOrderStatus.EVALUATE_ORDER_YES.getValue());
1781 1804 update(uw);
1782 1805 }
  1806 +
  1807 + public int updateGarRealCarCount(String garOrderId,Integer garRealCarCount){
  1808 + GarOrderCar originalCar = garOrderCarMapper.selectByGarOrderId(garOrderId);
  1809 + GarOrderMatchAsk garOrderMatchAsk = garOrderMatchAskMapper.selectByGarOrderAskId(garOrderId);
  1810 + if (originalCar != null && garRealCarCount != null && garRealCarCount > 0) {
  1811 + for (int i = 0; i < garRealCarCount; i++) {
  1812 + GarOrderCar newCar = getGarOrderCar(originalCar);
  1813 + garOrderCarMapper.insertSelective(newCar);
  1814 + if(garOrderMatchAsk != null){
  1815 + GarOrderMatchAsk newAsk = getGarOrderMatchAsk(garOrderMatchAsk);
  1816 + garOrderMatchAskMapper.insertGarOrderMatchAskBySelect(newAsk);
  1817 + }
  1818 + }
  1819 + }
  1820 + return baseMapper.updateGarRealCarCount(garOrderId,garRealCarCount);
  1821 + }
  1822 +
  1823 + public List<GarOrderMatchHandler> getGarOrderMatchHandlers(String garOrderId){
  1824 + System.out.println(garOrderMatchHandlerMapper.queryGarOrderMatchHandler(garOrderId));
  1825 + return garOrderMatchHandlerMapper.queryGarOrderMatchHandler(garOrderId);
  1826 + }
  1827 +
  1828 + @NotNull
  1829 + private static GarOrderCar getGarOrderCar(GarOrderCar originalCar) {
  1830 + GarOrderCar newCar = new GarOrderCar();
  1831 + newCar.setGarOrderId(originalCar.getGarOrderId());
  1832 + newCar.setGarOrderCarType(originalCar.getGarOrderCarType());
  1833 + newCar.setCarId(originalCar.getCarId());
  1834 + newCar.setContainerVolume(originalCar.getContainerVolume());
  1835 + newCar.setGarCreateBy(originalCar.getGarCreateBy());
  1836 + newCar.setGarUpdateBy(originalCar.getGarUpdateBy());
  1837 + newCar.setGarOrderCarUserType(originalCar.getGarOrderCarUserType());
  1838 + newCar.setGarId(null);
  1839 + newCar.setGarCreateTime(new Date());
  1840 + newCar.setGarUpdateTime(new Date());
  1841 + return newCar;
  1842 + }
  1843 +
  1844 + @NotNull
  1845 + private static GarOrderMatchAsk getGarOrderMatchAsk(GarOrderMatchAsk garOrderMatchAsk) {
  1846 +
  1847 + GarOrderMatchAsk newCar = new GarOrderMatchAsk();
  1848 + newCar.setGarId(String.valueOf(Long.parseLong(garOrderMatchAsk.getGarId()) + 1));
  1849 + newCar.setGarOrderId(garOrderMatchAsk.getGarOrderId());
  1850 + newCar.setGarCreateTime(new Date());
  1851 + newCar.setGarCreateBy(garOrderMatchAsk.getGarCreateBy());
  1852 + newCar.setGarUpdateBy(garOrderMatchAsk.getGarUpdateBy());
  1853 + newCar.setDropPointId(garOrderMatchAsk.getDropPointId());
  1854 + newCar.setDropPointName(garOrderMatchAsk.getDropPointName());
  1855 + newCar.setGarOrderType(garOrderMatchAsk.getGarOrderType());
  1856 + newCar.setDisposalId(garOrderMatchAsk.getDisposalId());
  1857 + newCar.setDisposalSiteName(garOrderMatchAsk.getDisposalSiteName());
  1858 + String orderNumber = garOrderMatchAsk.getGarOrderNumber();
  1859 + if (orderNumber != null && orderNumber.length() >= 2) {
  1860 + try {
  1861 + String prefix = orderNumber.substring(0, orderNumber.length() - 2);
  1862 + String suffix = orderNumber.substring(orderNumber.length() - 2);
  1863 + int suffixNum = Integer.parseInt(suffix);
  1864 + String newSuffix = String.format("%02d", (suffixNum + 1) % 100);
  1865 + newCar.setGarOrderNumber(prefix + newSuffix);
  1866 + } catch (Exception e) {
  1867 + newCar.setGarOrderNumber(orderNumber);
  1868 + }
  1869 + } else {
  1870 + newCar.setGarOrderNumber(orderNumber);
  1871 + }
  1872 + newCar.setGarOrderPhone(garOrderMatchAsk.getGarOrderPhone());
  1873 + newCar.setGarOrderName(garOrderMatchAsk.getGarOrderName());
  1874 + newCar.setDropAddress(garOrderMatchAsk.getDropAddress());
  1875 + newCar.setDropCarNum(0);
  1876 + newCar.setGarOrderTime(new Date());
  1877 + return newCar;
  1878 + }
  1879 +
  1880 +
1783 1881 }
1784 1882  
1785 1883  
... ...
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
... ... @@ -140,29 +140,40 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
140 140 throw new BizException(ResultCode.CODE_500, "解密失败");
141 141 }
142 142 }
143   -
144   - // 查询用户
145   - QueryWrapper<GarUser> qw = new QueryWrapper<>();
  143 +
146 144 GarUser nUser = null;
147   - qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel());
148   - if(loginDto.getCode() == null && loginDto.getPassword() != null){
149   - qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel());
150   - if(loginDto.getSignin() != 1){
151   - nUser = this.getOne(qw);
152   - if (Objects.isNull(nUser)) {
153   - throw new UsernameNotFoundException("当前用户不存在!");
154   - }
155   - if(!new BCryptPasswordEncoder().matches(loginDto.getPassword(),nUser.getPassword())){
156   - throw new UsernameNotFoundException("密码错误!");
157   - }
158   - }
159   - }else{
160   - // 验证码验证
161   - String code = redisCache.getCacheObject(GlobalRedisProperties.REDIS_USER_CODE.getValue() + loginDto.getTel());
162   - if (loginDto.getCode() == null || !loginDto.getCode().equals(code)) {
163   - throw new BizException(ResultCode.CODE_400, "验证码错误!!");
164   - }
  145 + if (loginDto.getSignin() != 1 && StringUtils.isNotEmpty(loginDto.getNickname())) {
  146 + QueryWrapper<GarUser> qw = new QueryWrapper<>();
  147 + qw.lambda().eq(GarUser::getGarUserName, loginDto.getNickname());
165 148 nUser = this.getOne(qw);
  149 + if (Objects.isNull(nUser)) {
  150 + throw new UsernameNotFoundException("当前用户不存在!");
  151 + }
  152 + if (!new BCryptPasswordEncoder().matches(loginDto.getPassword(), nUser.getPassword())) {
  153 + throw new UsernameNotFoundException("密码错误!");
  154 + }
  155 + loginDto.setTel(nUser.getGarUserTel());
  156 + } else {
  157 + QueryWrapper<GarUser> qw = new QueryWrapper<>();
  158 + qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel());
  159 + if(loginDto.getCode() == null && loginDto.getPassword() != null){
  160 + qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel());
  161 + if(loginDto.getSignin() != 1){
  162 + nUser = this.getOne(qw);
  163 + if (Objects.isNull(nUser)) {
  164 + throw new UsernameNotFoundException("当前用户不存在!");
  165 + }
  166 + if(!new BCryptPasswordEncoder().matches(loginDto.getPassword(),nUser.getPassword())){
  167 + throw new UsernameNotFoundException("密码错误!");
  168 + }
  169 + }
  170 + }else{
  171 + String code = redisCache.getCacheObject(GlobalRedisProperties.REDIS_USER_CODE.getValue() + loginDto.getTel());
  172 + if (loginDto.getCode() == null || !loginDto.getCode().equals(code)) {
  173 + throw new BizException(ResultCode.CODE_400, "验证码错误!!");
  174 + }
  175 + nUser = this.getOne(qw);
  176 + }
166 177 }
167 178  
168 179 if (Objects.isNull(nUser)) {
... ... @@ -287,9 +298,8 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
287 298 //随机生成6位数字验证码
288 299 String validateCode = ValidateCodeUtil.generatorCode(4);
289 300 //给用户发送验证码
290   -// SMSUtils.sendMessage("", tel, validateCode.toString(), "");
  301 + smsUtils.sendMessage(tel, validateCode.toString());
291 302 // 保存redis
292   - System.out.println("code:" + validateCode);
293 303 redisCache.setCacheObject(GlobalRedisProperties.REDIS_USER_CODE.getValue() + tel, validateCode, 60, TimeUnit.SECONDS);
294 304 return validateCode;
295 305 }
... ...
trash-garbage/src/main/resources/mapper/GarOrderCarMapper.xml
... ... @@ -14,6 +14,8 @@
14 14 <result property="garCreateBy" column="gar_create_by" jdbcType="VARCHAR"/>
15 15 <result property="garUpdateBy" column="gar_update_by" jdbcType="VARCHAR"/>
16 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 19 </resultMap>
18 20  
19 21 <sql id="Base_Column_List">
... ... @@ -21,4 +23,42 @@
21 23 gar_order_car_user_type,gar_create_time,gar_update_time,
22 24 gar_create_by,gar_update_by,gar_remark
23 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 64 </mapper>
... ...
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
... ... @@ -275,4 +275,14 @@
275 275 <select id="queryGarRealCarCountByGarOrderId" resultType="java.lang.Integer">
276 276 select gar_real_car_count from gar_order where gar_order_id=#{garOrderId}
277 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 288 </mapper>
... ...
trash-garbage/src/main/resources/mapper/GarOrderMatchAskMapper.xml
... ... @@ -26,6 +26,21 @@
26 26 gar_create_time,gar_update_time,gar_create_by,
27 27 gar_update_by,gar_remark
28 28 </sql>
  29 + <resultMap type="DriverSend" id="driverSendMap">
  30 + <result property="orderId" column="order_id" />
  31 + <result property="phone" column="phone" />
  32 + <result property="state" column="state" />
  33 + </resultMap>
  34 +
  35 + <insert id="addDriverSend" parameterType="DriverSend">
  36 + insert into driver_send (order_id,phone,state) values (#{orderId},#{phone},#{state})
  37 + </insert>
  38 + <select id="queryDriverSend" parameterType="DriverSend" resultMap="driverSendMap">
  39 + select * from driver_send where phone = #{phone} and state = 0 limit 1
  40 + </select>
  41 + <update id="updateDriverSendState" parameterType="DriverSend">
  42 + update driver_send set state = 1 where phone = #{phone}
  43 + </update>
29 44  
30 45 <resultMap type="GarOrderMatchAsk" id="GarOrderMatchAskResult">
31 46 <result property="garId" column="gar_id" />
... ... @@ -59,7 +74,7 @@
59 74 <result property="updateTime" column="update_time" />
60 75 <result property="garOrderTime" column="gar_order_time" />
61 76 <result property="transportDistance" column="transport_distance" />
62   -
  77 + <result property="unloadingLonLat" column="unloading_lon_lat" />
63 78 </resultMap>
64 79  
65 80 <sql id="selectGarOrderMatchAskVo">
... ... @@ -198,4 +213,63 @@
198 213 select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and transport_distance is not null
199 214 </select>
200 215  
  216 + <select id="queryErrType" resultType="java.lang.Integer">
  217 + select count(*) from gar_order_match_ask where gar_order_handler_tel = #{phone} and gar_order_type = 1
  218 + </select>
  219 +
  220 + <select id="queryCarCode" parameterType="string" resultMap="GarOrderMatchAskResult">
  221 + SELECT gar_order_handler_name,gar_handler_car_code
  222 + FROM gar_order_match_ask
  223 + WHERE gar_order_id = #{garOrderId}
  224 + group by gar_handler_car_code
  225 + </select>
  226 +
  227 + <select id="queryGarOrderMatchAsks" resultType="java.lang.Integer">
  228 + select COUNT(*) from gar_order_match_ask where gar_order_id = #{orderId} and (transport_distance is null or transport_distance = '')
  229 + </select>
  230 +
  231 + <select id="selectByGarOrderAskId" parameterType="string" resultMap="GarOrderMatchAskResult">
  232 + 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
  233 + FROM gar_order_match_ask
  234 + WHERE gar_order_id = #{garOrderId}
  235 + ORDER BY gar_order_number DESC
  236 + LIMIT 1
  237 + </select>
  238 +
  239 + <insert id="insertGarOrderMatchAskBySelect" parameterType="com.trash.garbage.pojo.domain.GarOrderMatchAsk">
  240 + INSERT INTO gar_order_match_ask (
  241 + gar_id,
  242 + gar_order_id,
  243 + gar_create_by,
  244 + gar_update_by,
  245 + drop_point_id,
  246 + drop_point_name,
  247 + gar_order_type,
  248 + disposal_id,
  249 + disposal_site_name,
  250 + gar_order_number,
  251 + gar_order_phone,
  252 + gar_order_name,
  253 + drop_address,
  254 + drop_car_num,
  255 + gar_order_time
  256 + ) VALUES (
  257 + #{garId},
  258 + #{garOrderId},
  259 + #{garCreateBy},
  260 + #{garUpdateBy},
  261 + #{dropPointId},
  262 + #{dropPointName},
  263 + #{garOrderType},
  264 + #{disposalId},
  265 + #{disposalSiteName},
  266 + #{garOrderNumber},
  267 + #{garOrderPhone},
  268 + #{garOrderName},
  269 + #{dropAddress},
  270 + #{dropCarNum},
  271 + #{garOrderTime}
  272 + )
  273 + </insert>
  274 +
201 275 </mapper>
... ...
trash-garbage/src/main/resources/mapper/GarOrderMatchHandlerMapper.xml
... ... @@ -68,4 +68,5 @@
68 68 <select id="queryGarOrderMatchHandler" resultType="com.trash.garbage.pojo.domain.GarOrderMatchHandler">
69 69 select * from gar_order_match_handler where gar_order_id = #{orderId}
70 70 </select>
  71 +
71 72 </mapper>
... ...