Pu Zhibing
2025-05-16 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OrderEvaluateServiceImpl.java
@@ -4,6 +4,8 @@
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity;
import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService;
import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics;
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.OrderEvaluateMapper;
@@ -12,6 +14,7 @@
import com.stylefeng.guns.modular.system.model.SensitiveWords;
import com.stylefeng.guns.modular.system.service.IOrderEvaluateService;
import com.stylefeng.guns.modular.system.service.ISystemNoticeService;
import com.stylefeng.guns.modular.system.util.DateUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
@@ -19,9 +22,8 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -44,6 +46,9 @@
    @Autowired
    private IOrderCrossCityService orderCrossCityService;
    @Autowired
    private IOrderLogisticsService orderLogisticsService;
@@ -61,11 +66,12 @@
    public ResultUtil saveData(Integer orderId, Integer orderType, Integer fraction, String content, Integer language) throws Exception {
        if(ToolUtil.isNotEmpty(content)){
            if(null != content && content.length() > 500){
                return ResultUtil.error(language == 1 ? "评价内容过长" : language == 2 ? "The evaluation is too long" : "Contenu trop long de l’évaluation");
                return ResultUtil.error(language == 1 ? "评价内容过长" : language == 2 ? "Rating-content is overlong." : "Le contenu de l’évaluation est trop long.");
            }
            content = content.toLowerCase();
            List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null);
            for(SensitiveWords s : sensitiveWords){
                content = content.replaceAll(s.getContent(), "***");
            for(SensitiveWords s : sensitiveWords) {
                content = content.replaceAll(s.getContent().toLowerCase(), "***");
            }
        }
        OrderEvaluate orderEvaluate = new OrderEvaluate();
@@ -87,6 +93,11 @@
                driverId = orderCrossCity.getDriverId();
                uid = orderCrossCity.getUserId();
                break;
            case 4:
                OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId);
                driverId = orderLogistics.getDriverId();
                uid = orderLogistics.getUserId();
                break;
        }
        orderEvaluate.setOrderId(orderId);
@@ -98,7 +109,7 @@
        orderEvaluate.setUserId(uid);
        this.insert(orderEvaluate);
        systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功添加订单评价,谢谢使用!" : language == 2 ? "You have successfully added the order evaluation, thank you for using!" : "Vous avez ajouté une évaluation de commande avec succès. Merci d’utiliser!", uid, 1);
        systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功添加订单评价,谢谢使用!" : language == 2 ? "You've added the rating successfully, thank you for using I-GO" : "Vous avez ajouté l’évaluation avec succès, merci d’utiliser I-GO", uid, 1);
        return ResultUtil.success(orderEvaluate.getId());
    }
@@ -110,9 +121,16 @@
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> queryOrderEvaluate(Integer driverId, Integer pageNum, Integer size) throws Exception {
    public List<Map<String, Object>> queryOrderEvaluate(Integer language, Integer driverId, Integer pageNum, Integer size) throws Exception {
        pageNum = (pageNum - 1) * size;
        return orderEvaluateMapper.queryOrderEvaluate(driverId, pageNum, size);
        List<Map<String, Object>> list = orderEvaluateMapper.queryOrderEvaluate(driverId, pageNum, size);
        for (Map<String, Object> map : list) {
            if(null != map.get("time")){
                String time = map.get("time").toString();
                map.put("time", DateUtil.conversionFormat(language, time));
            }
        }
        return list;
    }