Pu Zhibing
2024-10-12 7b477828acb81c542b34dc603511bf6bcbe88ca5
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -2,6 +2,8 @@
import cn.hutool.db.DaoTemplate;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,6 +19,7 @@
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.HttpUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
@@ -267,6 +270,37 @@
            TChargingOrder chargingOrder = chargingOrderService.getById(query.getOrderId());
            orderEvaluate.setAppUserCarId(chargingOrder.getAppUserCarId());
        }
        TAppUser appUser = appUserClient.getUserById(userid).getData();
        //检测敏感词
        String content = orderEvaluate.getContent();
        String token = appUserClient.getWXToken().getData();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("content", content);
        jsonObject.put("version", 2);
        jsonObject.put("scene", 2);
        jsonObject.put("openid", appUser.getWxOpenid());
        String post = HttpUtils.post("https://api.weixin.qq.com/wxa/msg_sec_check?access_token=" + token, jsonObject.toString());
        JSONObject object = JSONObject.parseObject(post);
        Integer errcode = object.getInteger("errcode");
        if(0 != errcode){
            throw new RuntimeException(object.getString("errmsg"));
        }
        JSONArray detail = object.getJSONArray("detail");
        for (int i = 0; i < detail.size(); i++) {
            JSONObject jsonObject1 = detail.getJSONObject(i);
            Integer errcode1 = jsonObject1.getInteger("errcode");
            if(0 == errcode1){
                String suggest = jsonObject1.getString("suggest");
                Integer label = jsonObject1.getInteger("label");
                String keyword = jsonObject1.getString("keyword");
                Integer prob = jsonObject1.getInteger("prob");
                if(("risky".equals(suggest) || "review".equals(suggest)) && 100 != label && StringUtils.isNotEmpty(keyword) && 80 <= prob){
                    content = content.replaceAll(keyword, "***");
                }
            }
        }
        orderEvaluate.setContent(content);
        this.save(orderEvaluate);
    
        List<Integer> tagIds = query.getTagIds();
@@ -284,7 +318,6 @@
            //积分
            Integer num1 = JSON.parseObject(credit).getInteger("num1");
            if(null != num1 && 0 < num1){
                TAppUser appUser = appUserClient.getUserById(userid).getData();
                if(null != appUser.getVipId()){
                    TVip vip = vipClient.getInfo1(appUser.getVipId()).getData();
                    Integer doubleIntegration = vip.getDoubleIntegration();