Commit 9b39ddcfeb7d181b46084cd96aeecbc1f8b33431

Authored by liujun001
1 parent eeab4029

按需修改用户评价

trash-garbage/src/main/java/com/trash/garbage/pojo/vo/OrderDetailVo.java
@@ -95,7 +95,7 @@ public class OrderDetailVo { @@ -95,7 +95,7 @@ public class OrderDetailVo {
95 * @param null 95 * @param null
96 * @return null 96 * @return null
97 */ 97 */
98 - private List<DisposalSiteVo> disposalSites; 98 + private List<DisposalSiteVo> disposalSites;
99 99
100 /** 100 /**
101 * 订单状态 101 * 订单状态
@@ -151,6 +151,13 @@ public class OrderDetailVo { @@ -151,6 +151,13 @@ public class OrderDetailVo {
151 private Integer garOrderStatus; 151 private Integer garOrderStatus;
152 152
153 private String garHandlerCarCode; 153 private String garHandlerCarCode;
  154 + /**
  155 + * 是否有用户的评价,默认值是0,默认没有
  156 + *
  157 + * @author liujun
  158 + * @date 2024/6/20 14:39
  159 + */
  160 + private Integer haveEvaluateOfClient = 0;
154 161
155 public OrderDetailVo() { 162 public OrderDetailVo() {
156 this.currentImages = new ArrayList<>(); 163 this.currentImages = new ArrayList<>();
@@ -426,4 +433,12 @@ public class OrderDetailVo { @@ -426,4 +433,12 @@ public class OrderDetailVo {
426 public void setGarTimeOutFlag(Integer garTimeOutFlag) { 433 public void setGarTimeOutFlag(Integer garTimeOutFlag) {
427 this.garTimeOutFlag = garTimeOutFlag; 434 this.garTimeOutFlag = garTimeOutFlag;
428 } 435 }
  436 +
  437 + public Integer getHaveEvaluateOfClient() {
  438 + return haveEvaluateOfClient;
  439 + }
  440 +
  441 + public void setHaveEvaluateOfClient(Integer haveEvaluateOfClient) {
  442 + this.haveEvaluateOfClient = haveEvaluateOfClient;
  443 + }
429 } 444 }
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderEvaluateService.java
1 package com.trash.garbage.service; 1 package com.trash.garbage.service;
2 2
3 -import com.trash.garbage.pojo.domain.GarOrderEvaluate;  
4 import com.baomidou.mybatisplus.extension.service.IService; 3 import com.baomidou.mybatisplus.extension.service.IService;
5 -import org.apache.ibatis.annotations.Param; 4 +import com.trash.garbage.pojo.domain.GarOrderEvaluate;
6 5
7 import java.util.List; 6 import java.util.List;
8 7
@@ -14,4 +13,6 @@ import java.util.List; @@ -14,4 +13,6 @@ import java.util.List;
14 public interface GarOrderEvaluateService extends IService<GarOrderEvaluate> { 13 public interface GarOrderEvaluateService extends IService<GarOrderEvaluate> {
15 14
16 List<GarOrderEvaluate> queryEvaluateByEnterpriseIds( List<Long> enterpriseIds, Integer value); 15 List<GarOrderEvaluate> queryEvaluateByEnterpriseIds( List<Long> enterpriseIds, Integer value);
  16 +
  17 + Integer countId(GarOrderEvaluate evaluate);
17 } 18 }
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderEvaluateServiceImpl.java
1 package com.trash.garbage.service.impl; 1 package com.trash.garbage.service.impl;
2 2
3 import cn.hutool.core.collection.CollectionUtil; 3 import cn.hutool.core.collection.CollectionUtil;
  4 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6 +import com.trash.garbage.mapper.GarOrderEvaluateMapper;
5 import com.trash.garbage.pojo.domain.GarOrderEvaluate; 7 import com.trash.garbage.pojo.domain.GarOrderEvaluate;
6 import com.trash.garbage.service.GarOrderEvaluateService; 8 import com.trash.garbage.service.GarOrderEvaluateService;
7 -import com.trash.garbage.mapper.GarOrderEvaluateMapper;  
8 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
9 10
10 import java.util.ArrayList; 11 import java.util.ArrayList;
@@ -26,6 +27,15 @@ public class GarOrderEvaluateServiceImpl extends ServiceImpl&lt;GarOrderEvaluateMap @@ -26,6 +27,15 @@ public class GarOrderEvaluateServiceImpl extends ServiceImpl&lt;GarOrderEvaluateMap
26 } 27 }
27 return baseMapper.queryEvaluateByEnterpriseIds(enterpriseIds,value); 28 return baseMapper.queryEvaluateByEnterpriseIds(enterpriseIds,value);
28 } 29 }
  30 +
  31 + @Override
  32 + public Integer countId(GarOrderEvaluate evaluate) {
  33 + LambdaQueryWrapper<GarOrderEvaluate> wrapper = new LambdaQueryWrapper<>(evaluate);
  34 + wrapper.select(GarOrderEvaluate::getGarEvaluateId);
  35 + return count(wrapper);
  36 + }
  37 +
  38 +
29 } 39 }
30 40
31 41
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
@@ -132,14 +132,29 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt; @@ -132,14 +132,29 @@ public class GarOrderServiceImpl extends ServiceImpl&lt;GarOrderMapper, GarOrder&gt;
132 public OrderDetailVo queryOrderDetail(String id) { 132 public OrderDetailVo queryOrderDetail(String id) {
133 133
134 GarUser user = garUserService.getById(SecurityUtils.getLoginUser().getUser().getUserId()); 134 GarUser user = garUserService.getById(SecurityUtils.getLoginUser().getUser().getUserId());
  135 + OrderDetailVo orderDetailVo = null;
135 if (user.getGarUserType().equals(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription()) 136 if (user.getGarUserType().equals(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription())
136 || user.getGarUserType().equals(GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription())) { 137 || user.getGarUserType().equals(GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription())) {
137 - return getOrderDetailVoResponsible(id, user); 138 + orderDetailVo = getOrderDetailVoResponsible(id, user);
138 } 139 }
139 // 订单分发获取 驾驶员 140 // 订单分发获取 驾驶员
140 if (user.getGarUserType().equals(GlobalStatus.GarUserStatusEnum.DRIVER_USER.getDescription())) { 141 if (user.getGarUserType().equals(GlobalStatus.GarUserStatusEnum.DRIVER_USER.getDescription())) {
141 - return getOrderDetailVoDriver(id, user); 142 + orderDetailVo = getOrderDetailVoDriver(id, user);
142 } 143 }
  144 +
  145 + if (Objects.equals(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription(), user.getGarUserType()) && Objects.nonNull(orderDetailVo)) {
  146 + //查询是否有用户评价
  147 + GarOrderEvaluate evaluate = new GarOrderEvaluate();
  148 + evaluate.setGarOrderId(id);
  149 + int count = garOrderEvaluateService.countId(evaluate);
  150 +
  151 + orderDetailVo.setHaveEvaluateOfClient(count == 0 ? 0 : 1);
  152 + }
  153 +
  154 + if (Objects.nonNull(orderDetailVo)) {
  155 + return orderDetailVo;
  156 + }
  157 +
143 throw new BizException(ResultCode.CODE_500, "没有当前角色"); 158 throw new BizException(ResultCode.CODE_500, "没有当前角色");
144 } 159 }
145 160