Commit 331b410bf84db1a2602e9685905e3c400fd8b12a

Authored by guzijian
1 parent b023da3f

fix: 修改接单公司判断更新,新增退出

trash-framework/src/main/java/com/trash/framework/config/SecurityConfig.java
@@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter @@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
119 .antMatchers("/druid/**").anonymous() 119 .antMatchers("/druid/**").anonymous()
120 .antMatchers("/user/login").anonymous() 120 .antMatchers("/user/login").anonymous()
121 .antMatchers("/user/send/verify").anonymous() 121 .antMatchers("/user/send/verify").anonymous()
122 - .antMatchers("/user/logout").anonymous() 122 +// .antMatchers("/user/logout").anonymous()
123 .antMatchers("/system/post/all").anonymous() 123 .antMatchers("/system/post/all").anonymous()
124 .antMatchers("/system/user/all").anonymous() 124 .antMatchers("/system/user/all").anonymous()
125 // .antMatchers("/workflow/add").anonymous()//测试 125 // .antMatchers("/workflow/add").anonymous()//测试
trash-garbage/src/main/java/com/trash/garbage/controller/GarbageUserController.java
@@ -8,9 +8,11 @@ import com.trash.garbage.pojo.dto.AddressDto; @@ -8,9 +8,11 @@ import com.trash.garbage.pojo.dto.AddressDto;
8 import com.trash.garbage.pojo.dto.LoginDto; 8 import com.trash.garbage.pojo.dto.LoginDto;
9 import com.trash.garbage.service.GarUserService; 9 import com.trash.garbage.service.GarUserService;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.http.HttpRequest;
11 import org.springframework.validation.annotation.Validated; 12 import org.springframework.validation.annotation.Validated;
12 import org.springframework.web.bind.annotation.*; 13 import org.springframework.web.bind.annotation.*;
13 14
  15 +import javax.servlet.http.HttpServletRequest;
14 import java.util.List; 16 import java.util.List;
15 17
16 /** 18 /**
@@ -34,6 +36,17 @@ public class GarbageUserController { @@ -34,6 +36,17 @@ public class GarbageUserController {
34 return Result.OK(garUserService.login(user)); 36 return Result.OK(garUserService.login(user));
35 } 37 }
36 38
  39 + /**
  40 + * 退出登录
  41 + *
  42 + * @param
  43 + * @return
  44 + */
  45 + @PostMapping("/logout")
  46 + public Result<String> logout(HttpServletRequest request) {
  47 + return Result.OK(garUserService.logout(request));
  48 + }
  49 +
37 @GetMapping("/send/verify") 50 @GetMapping("/send/verify")
38 public Result<?> sendVerify(@RequestParam("tel") String tel) { 51 public Result<?> sendVerify(@RequestParam("tel") String tel) {
39 try { 52 try {
@@ -69,7 +82,7 @@ public class GarbageUserController { @@ -69,7 +82,7 @@ public class GarbageUserController {
69 82
70 83
71 @PutMapping("/update") 84 @PutMapping("/update")
72 - public Result<?> updateUser(@RequestBody GarUser user){ 85 + public Result<?> updateUser(@RequestBody GarUser user) {
73 garUserService.updateUserInfo(user); 86 garUserService.updateUserInfo(user);
74 return Result.OK(); 87 return Result.OK();
75 } 88 }
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarOrder.java
@@ -34,7 +34,33 @@ public class GarOrder implements Serializable { @@ -34,7 +34,33 @@ public class GarOrder implements Serializable {
34 */ 34 */
35 private String garOrderHandlerId; 35 private String garOrderHandlerId;
36 36
37 - /** 37 + /**
  38 + * 车辆数量
  39 + */
  40 + private Integer garOrderCarNumber;
  41 +
  42 + /**
  43 + * 车子类型
  44 + */
  45 + private String garOrderCarType;
  46 +
  47 + public Integer getGarOrderCarNumber() {
  48 + return garOrderCarNumber;
  49 + }
  50 +
  51 + public void setGarOrderCarNumber(Integer garOrderCarNumber) {
  52 + this.garOrderCarNumber = garOrderCarNumber;
  53 + }
  54 +
  55 + public String getGarOrderCarType() {
  56 + return garOrderCarType;
  57 + }
  58 +
  59 + public void setGarOrderCarType(String garOrderCarType) {
  60 + this.garOrderCarType = garOrderCarType;
  61 + }
  62 +
  63 + /**
38 * 订单地址 64 * 订单地址
39 */ 65 */
40 private String garOrderAddress; 66 private String garOrderAddress;
@@ -345,10 +371,7 @@ public class GarOrder implements Serializable { @@ -345,10 +371,7 @@ public class GarOrder implements Serializable {
345 } 371 }
346 372
347 373
348 - public static long getSerialversionuid() {  
349 - return serialVersionUID;  
350 - }  
351 - 374 +
352 375
353 376
354 } 377 }
355 \ No newline at end of file 378 \ No newline at end of file
trash-garbage/src/main/java/com/trash/garbage/pojo/dto/OrderDto.java
1 package com.trash.garbage.pojo.dto; 1 package com.trash.garbage.pojo.dto;
2 2
3 -import com.baomidou.mybatisplus.annotation.TableId;  
4 import lombok.Data; 3 import lombok.Data;
5 4
6 import javax.validation.constraints.NotBlank; 5 import javax.validation.constraints.NotBlank;
@@ -61,6 +60,16 @@ public class OrderDto { @@ -61,6 +60,16 @@ public class OrderDto {
61 */ 60 */
62 private String garOrderCompanyTel; 61 private String garOrderCompanyTel;
63 62
  63 + /**
  64 + * 车辆数量
  65 + */
  66 + private Integer garOrderCarNumber;
  67 +
  68 + /**
  69 + * 车子类型
  70 + */
  71 + private String garOrderCarType;
  72 +
64 /** 73 /**
65 * 约定时间 74 * 约定时间
66 */ 75 */
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/OrderDetailVo.java
@@ -17,6 +17,7 @@ public class OrderDetailVo { @@ -17,6 +17,7 @@ public class OrderDetailVo {
17 private String garOrderHandlerId; 17 private String garOrderHandlerId;
18 18
19 private Integer garEvaluateFlag; 19 private Integer garEvaluateFlag;
  20 + private Boolean garHandleEvaluateFlag;
20 /** 21 /**
21 * 订单地址 22 * 订单地址
22 */ 23 */
@@ -99,6 +100,7 @@ public class OrderDetailVo { @@ -99,6 +100,7 @@ public class OrderDetailVo {
99 this.putDownImages = new ArrayList<>(); 100 this.putDownImages = new ArrayList<>();
100 this.putOnImages = new ArrayList<>(); 101 this.putOnImages = new ArrayList<>();
101 this.handleFlag = false; 102 this.handleFlag = false;
  103 + this.garHandleEvaluateFlag = true;
102 } 104 }
103 105
104 public String getGarOrderHandlerId() { 106 public String getGarOrderHandlerId() {
trash-garbage/src/main/java/com/trash/garbage/service/GarUserService.java
@@ -6,7 +6,9 @@ import com.trash.garbage.pojo.domain.GarUser; @@ -6,7 +6,9 @@ import com.trash.garbage.pojo.domain.GarUser;
6 import com.baomidou.mybatisplus.extension.service.IService; 6 import com.baomidou.mybatisplus.extension.service.IService;
7 import com.trash.garbage.pojo.dto.AddressDto; 7 import com.trash.garbage.pojo.dto.AddressDto;
8 import com.trash.garbage.pojo.dto.LoginDto; 8 import com.trash.garbage.pojo.dto.LoginDto;
  9 +import org.springframework.http.HttpRequest;
9 10
  11 +import javax.servlet.http.HttpServletRequest;
10 import java.util.List; 12 import java.util.List;
11 13
12 /** 14 /**
@@ -29,4 +31,6 @@ public interface GarUserService extends IService&lt;GarUser&gt; { @@ -29,4 +31,6 @@ public interface GarUserService extends IService&lt;GarUser&gt; {
29 String deleteAddress(String addressId); 31 String deleteAddress(String addressId);
30 32
31 void updateUserInfo(GarUser user); 33 void updateUserInfo(GarUser user);
  34 +
  35 + String logout(HttpServletRequest request);
32 } 36 }
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
@@ -3,6 +3,8 @@ package com.trash.garbage.service.impl; @@ -3,6 +3,8 @@ package com.trash.garbage.service.impl;
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5 5
  6 +import com.trash.enterprise.domain.TransportationEnterprise;
  7 +import com.trash.enterprise.service.ITransportationEnterpriseService;
6 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
8 import org.springframework.transaction.annotation.Transactional; 10 import org.springframework.transaction.annotation.Transactional;
@@ -56,6 +58,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -56,6 +58,9 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
56 @Autowired 58 @Autowired
57 private IDriverService driverService; 59 private IDriverService driverService;
58 60
  61 + @Autowired
  62 + private ITransportationEnterpriseService enterpriseService;
  63 +
59 @Override 64 @Override
60 @Transactional(rollbackFor = Exception.class) 65 @Transactional(rollbackFor = Exception.class)
61 public String saveOrder(OrderDto dto) { 66 public String saveOrder(OrderDto dto) {
@@ -90,10 +95,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -90,10 +95,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
90 BeanUtils.copyBeanProp(vo, order); 95 BeanUtils.copyBeanProp(vo, order);
91 DriverVo driverVo = new DriverVo(); 96 DriverVo driverVo = new DriverVo();
92 driverVo.setPhoneNo(tel); 97 driverVo.setPhoneNo(tel);
93 - driverVo.setCompanyId(Long.valueOf(order.getGarOrderCompanyId()));  
94 List<DriverVo> driverVos = driverService.selectDriverList(driverVo); 98 List<DriverVo> driverVos = driverService.selectDriverList(driverVo);
95 if (CollectionUtil.isNotEmpty(driverVos)) { 99 if (CollectionUtil.isNotEmpty(driverVos)) {
96 vo.setHandleFlag(true); 100 vo.setHandleFlag(true);
  101 + vo.setGarHandleEvaluateFlag(false);
97 } 102 }
98 List<GarOrderImage> imageList = garOrderImageService.list(qwi); 103 List<GarOrderImage> imageList = garOrderImageService.list(qwi);
99 for (GarOrderImage image : imageList) { 104 for (GarOrderImage image : imageList) {
@@ -116,7 +121,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -116,7 +121,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
116 GarUser user = garUserService.getById(userId); 121 GarUser user = garUserService.getById(userId);
117 LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>(); 122 LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>();
118 qw.orderByAsc(GarOrder::getGarEvaluateFlag, GarOrder::getGarOrderHandlerStatus); 123 qw.orderByAsc(GarOrder::getGarEvaluateFlag, GarOrder::getGarOrderHandlerStatus);
119 - // 居民用户 124 + // 居民用户
120 if (user.getGarUserType().equals(GlobalStatus.UserStatusEnum.NORMAL_USER.getDescription())) { 125 if (user.getGarUserType().equals(GlobalStatus.UserStatusEnum.NORMAL_USER.getDescription())) {
121 PageHelper.startPage(pageNo, pageSize); 126 PageHelper.startPage(pageNo, pageSize);
122 // 待清运 || 清运中 || 已完成 || 待支付 127 // 待清运 || 清运中 || 已完成 || 待支付
@@ -141,10 +146,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -141,10 +146,10 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
141 driver.setPhoneNo(user.getGarUserTel()); 146 driver.setPhoneNo(user.getGarUserTel());
142 List<DriverVo> driverList = driverService.selectDriverList(driver); 147 List<DriverVo> driverList = driverService.selectDriverList(driver);
143 DriverVo driverVo = driverList.get(0); 148 DriverVo driverVo = driverList.get(0);
144 - String companyId = String.valueOf(driverVo.getCompanyId()); 149 + TransportationEnterprise enterprise = enterpriseService.selectTransportationEnterpriseById(driverVo.getCompanyId());
145 PageHelper.startPage(pageNo, pageSize); 150 PageHelper.startPage(pageNo, pageSize);
146 if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type)) { 151 if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type)) {
147 - qw.eq(GarOrder::getGarOrderCompanyId, companyId) 152 + qw.eq(GarOrder::getGarOrderCompanyId, enterprise.getParentId())
148 .eq(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.NEW_ORDER.getValue()); 153 .eq(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.NEW_ORDER.getValue());
149 List<GarOrder> orderList = list(qw); 154 List<GarOrder> orderList = list(qw);
150 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); 155 PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize);
@@ -153,7 +158,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -153,7 +158,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
153 158
154 if (GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type) 159 if (GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type)
155 || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { 160 || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) {
156 - qw.eq(GarOrder::getGarOrderCompanyId, companyId) 161 + qw.eq(GarOrder::getGarOrderCompanyId, enterprise.getParentId())
157 .eq(GarOrder::getGarOrderHandlerId, user.getGarUserId()) 162 .eq(GarOrder::getGarOrderHandlerId, user.getGarUserId())
158 .eq(GarOrder::getGarOrderHandlerStatus, type); 163 .eq(GarOrder::getGarOrderHandlerStatus, type);
159 List<GarOrder> orderList = list(qw); 164 List<GarOrder> orderList = list(qw);
@@ -178,7 +183,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -178,7 +183,7 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
178 String userId = SecurityUtils.getLoginUser().getUser().getUserId(); 183 String userId = SecurityUtils.getLoginUser().getUser().getUserId();
179 GarUser user = garUserService.getById(userId); 184 GarUser user = garUserService.getById(userId);
180 // 运输员操作 TODO 公司所属 待清运- 》 清运中 185 // 运输员操作 TODO 公司所属 待清运- 》 清运中
181 - if (GlobalStatus.UserStatusEnum.DRIVER_USER.getDescription().equals(user.getGarUserType())){ 186 + if (GlobalStatus.UserStatusEnum.DRIVER_USER.getDescription().equals(user.getGarUserType())) {
182 if (order.getGarOrderHandlerStatus().equals(GlobalStatus.GarOrderStatus.NEW_ORDER.getValue()) 187 if (order.getGarOrderHandlerStatus().equals(GlobalStatus.GarOrderStatus.NEW_ORDER.getValue())
183 || GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(dto.getHandleType())) { 188 || GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(dto.getHandleType())) {
184 LambdaUpdateWrapper<GarOrder> uw = new LambdaUpdateWrapper<>(); 189 LambdaUpdateWrapper<GarOrder> uw = new LambdaUpdateWrapper<>();
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
@@ -28,7 +28,7 @@ import com.trash.garbage.mapper.GarUserMapper; @@ -28,7 +28,7 @@ import com.trash.garbage.mapper.GarUserMapper;
28 import com.trash.garbage.utils.*; 28 import com.trash.garbage.utils.*;
29 import org.apache.commons.codec.binary.Base64; 29 import org.apache.commons.codec.binary.Base64;
30 import org.springframework.beans.factory.annotation.Autowired; 30 import org.springframework.beans.factory.annotation.Autowired;
31 -import org.springframework.security.authentication.AuthenticationManager; 31 +import org.springframework.http.HttpRequest;
32 import org.springframework.security.core.authority.SimpleGrantedAuthority; 32 import org.springframework.security.core.authority.SimpleGrantedAuthority;
33 import org.springframework.security.core.userdetails.UsernameNotFoundException; 33 import org.springframework.security.core.userdetails.UsernameNotFoundException;
34 import org.springframework.stereotype.Service; 34 import org.springframework.stereotype.Service;
@@ -38,6 +38,7 @@ import javax.annotation.Resource; @@ -38,6 +38,7 @@ import javax.annotation.Resource;
38 import javax.crypto.Cipher; 38 import javax.crypto.Cipher;
39 import javax.crypto.spec.IvParameterSpec; 39 import javax.crypto.spec.IvParameterSpec;
40 import javax.crypto.spec.SecretKeySpec; 40 import javax.crypto.spec.SecretKeySpec;
  41 +import javax.servlet.http.HttpServletRequest;
41 import java.security.spec.AlgorithmParameterSpec; 42 import java.security.spec.AlgorithmParameterSpec;
42 import java.util.*; 43 import java.util.*;
43 import java.util.concurrent.TimeUnit; 44 import java.util.concurrent.TimeUnit;
@@ -70,7 +71,6 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt; @@ -70,7 +71,6 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
70 if (Objects.isNull(loginDto)) { 71 if (Objects.isNull(loginDto)) {
71 throw new UsernameNotFoundException("当前用户不存在!"); 72 throw new UsernameNotFoundException("当前用户不存在!");
72 } 73 }
73 - // TODO 微信登录  
74 if (loginDto.getLoginType().equals(GlobalStatus.UserStatusEnum.WX_LOGIN.getStatus())) { 74 if (loginDto.getLoginType().equals(GlobalStatus.UserStatusEnum.WX_LOGIN.getStatus())) {
75 String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getAppId() + "&secret=" + wxConfig.getSecret() + "&js_code=" + loginDto.getWxCode() + "&grant_type=authorization_code"; 75 String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getAppId() + "&secret=" + wxConfig.getSecret() + "&js_code=" + loginDto.getWxCode() + "&grant_type=authorization_code";
76 String body = HttpUtil.createGet(url).header("cache-control", "no-cache").execute().body(); 76 String body = HttpUtil.createGet(url).header("cache-control", "no-cache").execute().body();
@@ -217,6 +217,13 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt; @@ -217,6 +217,13 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
217 update(uw); 217 update(uw);
218 } 218 }
219 219
  220 + @Override
  221 + public String logout(HttpServletRequest request) {
  222 + String token = request.getHeader("Authorization");
  223 + tokenService.delLoginUser(token);
  224 + return "退出登录";
  225 + }
  226 +
220 227
221 /** 228 /**
222 * 微信小程序解密 229 * 微信小程序解密
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
@@ -26,6 +26,8 @@ @@ -26,6 +26,8 @@
26 <result property="garReason" column="gar_reason" jdbcType="VARCHAR"/> 26 <result property="garReason" column="gar_reason" jdbcType="VARCHAR"/>
27 <result property="garCancelFlag" column="gar_cancel_flag" jdbcType="TINYINT"/> 27 <result property="garCancelFlag" column="gar_cancel_flag" jdbcType="TINYINT"/>
28 <result property="garEvaluateFlag" column="gar_evaluate_flag" jdbcType="TINYINT"/> 28 <result property="garEvaluateFlag" column="gar_evaluate_flag" jdbcType="TINYINT"/>
  29 + <result property="garOrderCarNumber" column="gar_order_car_number" jdbcType="TINYINT"/>
  30 + <result property="garOrderCarType" column="gar_order_car_type" jdbcType="TINYINT"/>
29 </resultMap> 31 </resultMap>
30 32
31 <sql id="Base_Column_List"> 33 <sql id="Base_Column_List">
@@ -35,6 +37,7 @@ @@ -35,6 +37,7 @@
35 gar_order_trash_type,gar_order_contact_tel,gar_order_company_id, 37 gar_order_trash_type,gar_order_contact_tel,gar_order_company_id,
36 gar_order_company_name,gar_order_company_tel,gar_order_hander_status, 38 gar_order_company_name,gar_order_company_tel,gar_order_hander_status,
37 gar_order_agreement_time,gar_create_time,gar_update_time, 39 gar_order_agreement_time,gar_create_time,gar_update_time,
38 - gar_create_by,gar_update_by,gar_remark,gar_reason,gar_cancel_flag,gar_evaluate_flag 40 + gar_create_by,gar_update_by,gar_remark,gar_reason,gar_cancel_flag,
  41 + gar_evaluate_flag,gar_order_car_number,gar_order_car_type
39 </sql> 42 </sql>
40 </mapper> 43 </mapper>