Commit 331b410bf84db1a2602e9685905e3c400fd8b12a
1 parent
b023da3f
fix: 修改接单公司判断更新,新增退出
Showing
9 changed files
with
83 additions
and
17 deletions
trash-framework/src/main/java/com/trash/framework/config/SecurityConfig.java
| ... | ... | @@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter |
| 119 | 119 | .antMatchers("/druid/**").anonymous() |
| 120 | 120 | .antMatchers("/user/login").anonymous() |
| 121 | 121 | .antMatchers("/user/send/verify").anonymous() |
| 122 | - .antMatchers("/user/logout").anonymous() | |
| 122 | +// .antMatchers("/user/logout").anonymous() | |
| 123 | 123 | .antMatchers("/system/post/all").anonymous() |
| 124 | 124 | .antMatchers("/system/user/all").anonymous() |
| 125 | 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 | 8 | import com.trash.garbage.pojo.dto.LoginDto; |
| 9 | 9 | import com.trash.garbage.service.GarUserService; |
| 10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | +import org.springframework.http.HttpRequest; | |
| 11 | 12 | import org.springframework.validation.annotation.Validated; |
| 12 | 13 | import org.springframework.web.bind.annotation.*; |
| 13 | 14 | |
| 15 | +import javax.servlet.http.HttpServletRequest; | |
| 14 | 16 | import java.util.List; |
| 15 | 17 | |
| 16 | 18 | /** |
| ... | ... | @@ -34,6 +36,17 @@ public class GarbageUserController { |
| 34 | 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 | 50 | @GetMapping("/send/verify") |
| 38 | 51 | public Result<?> sendVerify(@RequestParam("tel") String tel) { |
| 39 | 52 | try { |
| ... | ... | @@ -69,7 +82,7 @@ public class GarbageUserController { |
| 69 | 82 | |
| 70 | 83 | |
| 71 | 84 | @PutMapping("/update") |
| 72 | - public Result<?> updateUser(@RequestBody GarUser user){ | |
| 85 | + public Result<?> updateUser(@RequestBody GarUser user) { | |
| 73 | 86 | garUserService.updateUserInfo(user); |
| 74 | 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 | 34 | */ |
| 35 | 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 | 66 | private String garOrderAddress; |
| ... | ... | @@ -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 | 378 | \ No newline at end of file | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/pojo/dto/OrderDto.java
| 1 | 1 | package com.trash.garbage.pojo.dto; |
| 2 | 2 | |
| 3 | -import com.baomidou.mybatisplus.annotation.TableId; | |
| 4 | 3 | import lombok.Data; |
| 5 | 4 | |
| 6 | 5 | import javax.validation.constraints.NotBlank; |
| ... | ... | @@ -61,6 +60,16 @@ public class OrderDto { |
| 61 | 60 | */ |
| 62 | 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 | 17 | private String garOrderHandlerId; |
| 18 | 18 | |
| 19 | 19 | private Integer garEvaluateFlag; |
| 20 | + private Boolean garHandleEvaluateFlag; | |
| 20 | 21 | /** |
| 21 | 22 | * 订单地址 |
| 22 | 23 | */ |
| ... | ... | @@ -99,6 +100,7 @@ public class OrderDetailVo { |
| 99 | 100 | this.putDownImages = new ArrayList<>(); |
| 100 | 101 | this.putOnImages = new ArrayList<>(); |
| 101 | 102 | this.handleFlag = false; |
| 103 | + this.garHandleEvaluateFlag = true; | |
| 102 | 104 | } |
| 103 | 105 | |
| 104 | 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 | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
| 7 | 7 | import com.trash.garbage.pojo.dto.AddressDto; |
| 8 | 8 | import com.trash.garbage.pojo.dto.LoginDto; |
| 9 | +import org.springframework.http.HttpRequest; | |
| 9 | 10 | |
| 11 | +import javax.servlet.http.HttpServletRequest; | |
| 10 | 12 | import java.util.List; |
| 11 | 13 | |
| 12 | 14 | /** |
| ... | ... | @@ -29,4 +31,6 @@ public interface GarUserService extends IService<GarUser> { |
| 29 | 31 | String deleteAddress(String addressId); |
| 30 | 32 | |
| 31 | 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 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | |
| 6 | +import com.trash.enterprise.domain.TransportationEnterprise; | |
| 7 | +import com.trash.enterprise.service.ITransportationEnterpriseService; | |
| 6 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 9 | import org.springframework.stereotype.Service; |
| 8 | 10 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -56,6 +58,9 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 56 | 58 | @Autowired |
| 57 | 59 | private IDriverService driverService; |
| 58 | 60 | |
| 61 | + @Autowired | |
| 62 | + private ITransportationEnterpriseService enterpriseService; | |
| 63 | + | |
| 59 | 64 | @Override |
| 60 | 65 | @Transactional(rollbackFor = Exception.class) |
| 61 | 66 | public String saveOrder(OrderDto dto) { |
| ... | ... | @@ -90,10 +95,10 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 90 | 95 | BeanUtils.copyBeanProp(vo, order); |
| 91 | 96 | DriverVo driverVo = new DriverVo(); |
| 92 | 97 | driverVo.setPhoneNo(tel); |
| 93 | - driverVo.setCompanyId(Long.valueOf(order.getGarOrderCompanyId())); | |
| 94 | 98 | List<DriverVo> driverVos = driverService.selectDriverList(driverVo); |
| 95 | 99 | if (CollectionUtil.isNotEmpty(driverVos)) { |
| 96 | 100 | vo.setHandleFlag(true); |
| 101 | + vo.setGarHandleEvaluateFlag(false); | |
| 97 | 102 | } |
| 98 | 103 | List<GarOrderImage> imageList = garOrderImageService.list(qwi); |
| 99 | 104 | for (GarOrderImage image : imageList) { |
| ... | ... | @@ -116,7 +121,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 116 | 121 | GarUser user = garUserService.getById(userId); |
| 117 | 122 | LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>(); |
| 118 | 123 | qw.orderByAsc(GarOrder::getGarEvaluateFlag, GarOrder::getGarOrderHandlerStatus); |
| 119 | - // 居民用户 | |
| 124 | + // 居民用户 | |
| 120 | 125 | if (user.getGarUserType().equals(GlobalStatus.UserStatusEnum.NORMAL_USER.getDescription())) { |
| 121 | 126 | PageHelper.startPage(pageNo, pageSize); |
| 122 | 127 | // 待清运 || 清运中 || 已完成 || 待支付 |
| ... | ... | @@ -141,10 +146,10 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 141 | 146 | driver.setPhoneNo(user.getGarUserTel()); |
| 142 | 147 | List<DriverVo> driverList = driverService.selectDriverList(driver); |
| 143 | 148 | DriverVo driverVo = driverList.get(0); |
| 144 | - String companyId = String.valueOf(driverVo.getCompanyId()); | |
| 149 | + TransportationEnterprise enterprise = enterpriseService.selectTransportationEnterpriseById(driverVo.getCompanyId()); | |
| 145 | 150 | PageHelper.startPage(pageNo, pageSize); |
| 146 | 151 | if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type)) { |
| 147 | - qw.eq(GarOrder::getGarOrderCompanyId, companyId) | |
| 152 | + qw.eq(GarOrder::getGarOrderCompanyId, enterprise.getParentId()) | |
| 148 | 153 | .eq(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.NEW_ORDER.getValue()); |
| 149 | 154 | List<GarOrder> orderList = list(qw); |
| 150 | 155 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); |
| ... | ... | @@ -153,7 +158,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 153 | 158 | |
| 154 | 159 | if (GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type) |
| 155 | 160 | || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { |
| 156 | - qw.eq(GarOrder::getGarOrderCompanyId, companyId) | |
| 161 | + qw.eq(GarOrder::getGarOrderCompanyId, enterprise.getParentId()) | |
| 157 | 162 | .eq(GarOrder::getGarOrderHandlerId, user.getGarUserId()) |
| 158 | 163 | .eq(GarOrder::getGarOrderHandlerStatus, type); |
| 159 | 164 | List<GarOrder> orderList = list(qw); |
| ... | ... | @@ -178,7 +183,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 178 | 183 | String userId = SecurityUtils.getLoginUser().getUser().getUserId(); |
| 179 | 184 | GarUser user = garUserService.getById(userId); |
| 180 | 185 | // 运输员操作 TODO 公司所属 待清运- 》 清运中 |
| 181 | - if (GlobalStatus.UserStatusEnum.DRIVER_USER.getDescription().equals(user.getGarUserType())){ | |
| 186 | + if (GlobalStatus.UserStatusEnum.DRIVER_USER.getDescription().equals(user.getGarUserType())) { | |
| 182 | 187 | if (order.getGarOrderHandlerStatus().equals(GlobalStatus.GarOrderStatus.NEW_ORDER.getValue()) |
| 183 | 188 | || GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(dto.getHandleType())) { |
| 184 | 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 | 28 | import com.trash.garbage.utils.*; |
| 29 | 29 | import org.apache.commons.codec.binary.Base64; |
| 30 | 30 | import org.springframework.beans.factory.annotation.Autowired; |
| 31 | -import org.springframework.security.authentication.AuthenticationManager; | |
| 31 | +import org.springframework.http.HttpRequest; | |
| 32 | 32 | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| 33 | 33 | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| 34 | 34 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -38,6 +38,7 @@ import javax.annotation.Resource; |
| 38 | 38 | import javax.crypto.Cipher; |
| 39 | 39 | import javax.crypto.spec.IvParameterSpec; |
| 40 | 40 | import javax.crypto.spec.SecretKeySpec; |
| 41 | +import javax.servlet.http.HttpServletRequest; | |
| 41 | 42 | import java.security.spec.AlgorithmParameterSpec; |
| 42 | 43 | import java.util.*; |
| 43 | 44 | import java.util.concurrent.TimeUnit; |
| ... | ... | @@ -70,7 +71,6 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> |
| 70 | 71 | if (Objects.isNull(loginDto)) { |
| 71 | 72 | throw new UsernameNotFoundException("当前用户不存在!"); |
| 72 | 73 | } |
| 73 | - // TODO 微信登录 | |
| 74 | 74 | if (loginDto.getLoginType().equals(GlobalStatus.UserStatusEnum.WX_LOGIN.getStatus())) { |
| 75 | 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 | 76 | String body = HttpUtil.createGet(url).header("cache-control", "no-cache").execute().body(); |
| ... | ... | @@ -217,6 +217,13 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> |
| 217 | 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 | 26 | <result property="garReason" column="gar_reason" jdbcType="VARCHAR"/> |
| 27 | 27 | <result property="garCancelFlag" column="gar_cancel_flag" jdbcType="TINYINT"/> |
| 28 | 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 | 31 | </resultMap> |
| 30 | 32 | |
| 31 | 33 | <sql id="Base_Column_List"> |
| ... | ... | @@ -35,6 +37,7 @@ |
| 35 | 37 | gar_order_trash_type,gar_order_contact_tel,gar_order_company_id, |
| 36 | 38 | gar_order_company_name,gar_order_company_tel,gar_order_hander_status, |
| 37 | 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 | 42 | </sql> |
| 40 | 43 | </mapper> | ... | ... |