Преглед на файлове

Merge branch 'master' of http://git.zthymaoyi.com/gongdecai/wangluohuoyun

ccjgmwz преди 3 години
родител
ревизия
90bf6e69cb

+ 1 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/OrderInfo.java

@@ -374,7 +374,7 @@ public class OrderInfo extends BaseModel<OrderInfo> {
      * 综合评分
      */
     @TableField(exist = false)
-    private Integer zong;
+    private String zong;
     /**
      * 车辆信息
      */

+ 45 - 75
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/OrderInfoServiceImpl.java

@@ -19,12 +19,15 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static com.gexin.rp.sdk.base.uitls.AppConditions.OptType.or;
+
 /**
  * <p>
  * 记录订单详情信息 服务实现类
@@ -168,125 +171,92 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
     @Override
     public OrderInfo selectHaoPing(String commonId,String evaluateFlag) {
         OrderInfo orderInfo = new OrderInfo();
+        //好评率
         String hao = "";
-        Integer zong = 0;
+        //综合评分
+        Double zong = 0.0;
+        //查询评价数
+        Integer evaluateInfoCount3 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
+                .eq("evaluatored_id", commonId).eq("delete_flag","0"));
+        //查询评价集合
+        List<EvaluateInfo> evaluateInfos = evaluateInfoService.selectList(new EntityWrapper<EvaluateInfo>()
+                .eq("evaluatored_id", commonId));
         if ("1".equals(evaluateFlag)){
             //查询司机发运次数
             Integer count = this.selectCount(new EntityWrapper<OrderInfo>()
                     .eq("common_id", commonId).eq("order_status_key","23").eq("delete_flag","0"));
             orderInfo.setCountFa(String.valueOf(count));
-
+            //查询好评数
             Integer evaluateInfoCount = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-                    .gt("satisfaction", "4")
+                    .eq("satisfaction", "4")
+                    .eq("evaluatored_id", commonId));
+            Integer evaluateInfoCount2 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
+                    .eq("satisfaction", "5")
                     .eq("evaluatored_id", commonId));
-            orderInfo.setHaoPing(evaluateInfoCount);
+            orderInfo.setHaoPing(evaluateInfoCount+evaluateInfoCount2);
+            //查询差评数
             Integer evaluateInfoCount1 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
                     .eq("satisfaction", "1")
                     .eq("evaluatored_id", commonId));
             orderInfo.setChaPing(evaluateInfoCount1);
             //好评率
-            if (evaluateInfoCount >= 20 && count != 0) {
-                hao = String.valueOf(evaluateInfoCount / count * 100 + "%");
+            if (evaluateInfoCount3 >= 20 && count != 0) {
+                hao = String.valueOf((evaluateInfoCount+evaluateInfoCount2) / evaluateInfoCount3 * 100 + "%");
             }
-
-            List<EvaluateInfo> evaluateInfos = evaluateInfoService.selectList(new EntityWrapper<EvaluateInfo>()
-                    .eq("evaluatored_id", commonId));
+            //综合评分
             if (CollectionUtil.isNotEmpty(evaluateInfos)) {
+                //总分
                 int fen = 0;
                 for (int i = 0; i < evaluateInfos.size(); i++) {
-                    fen = fen + Integer.parseInt(evaluateInfos.get(i).getComprehensiveSatisfaction());
+                    fen = fen + Integer.parseInt(evaluateInfos.get(i).getDriverCredit()) + Integer.parseInt(evaluateInfos.get(i).getTranEfficiency()) +
+                    Integer.parseInt(evaluateInfos.get(i).getTranSafety()) + Integer.parseInt(evaluateInfos.get(i).getServiceQuality()) +
+                    Integer.parseInt(evaluateInfos.get(i).getSatisfaction());
                 }
                 if (fen != 0) {
-                    zong = fen / (evaluateInfos.size() * 5);
+                    zong = Double.valueOf(fen * 5) / (evaluateInfos.size() * 25);
                 }
             }
         }else {
+            //查询货主发运次数
             Integer count = this.selectCount(new EntityWrapper<OrderInfo>()
                     .eq("cargo_common_id", commonId).eq("cargo_owner_status_key","23").eq("delete_flag","0"));
             orderInfo.setCountFa(String.valueOf(count));
-
+            //查询好评数
             Integer evaluateInfoCount = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-                    .gt("satisfaction", "4")
+                    .ge("comprehensive_satisfaction", "4")
+                    .eq("evaluatored_id", commonId));
+            Integer evaluateInfoCount2 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
+                    .eq("comprehensive_satisfaction", "5")
                     .eq("evaluatored_id", commonId));
-            orderInfo.setHaoPing(evaluateInfoCount);
+            orderInfo.setHaoPing(evaluateInfoCount+evaluateInfoCount2);
+            //查询差评数
             Integer evaluateInfoCount1 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-                    .eq("satisfaction", "1")
+                    .eq("comprehensive_satisfaction", "1")
                     .eq("evaluatored_id", commonId));
             orderInfo.setChaPing(evaluateInfoCount1);
             //好评率
-            if (evaluateInfoCount >= 20 && count != 0) {
-                hao = String.valueOf(evaluateInfoCount / count * 100 + "%");
+            if (evaluateInfoCount3 >= 20 && count != 0) {
+                hao = String.valueOf((evaluateInfoCount+evaluateInfoCount2) / evaluateInfoCount3 * 100 + "%");
             }
-            List<EvaluateInfo> evaluateInfos = evaluateInfoService.selectList(new EntityWrapper<EvaluateInfo>()
-                    .eq("evaluatored_id", commonId));
+            //综合评分
             if (CollectionUtil.isNotEmpty(evaluateInfos)) {
                 int fen = 0;
                 for (int i = 0; i < evaluateInfos.size(); i++) {
-                    fen = fen + Integer.parseInt(evaluateInfos.get(i).getComprehensiveSatisfaction());
+                    fen = fen + Integer.parseInt(evaluateInfos.get(i).getOwnerCredit())
+                            + Integer.parseInt(evaluateInfos.get(i).getFreightPayment())
+                            + Integer.parseInt(evaluateInfos.get(i).getComprehensiveSatisfaction());
                 }
                 if (fen != 0) {
-                    zong = fen / (evaluateInfos.size() * 5);
+                    zong = Double.valueOf(fen * 5) / (evaluateInfos.size() * 15);
                 }
             }
         }
         orderInfo.setHaoPingLv(hao);
-        orderInfo.setZong(zong);
+        DecimalFormat df = new DecimalFormat("0.0");
+        orderInfo.setZong(df.format(zong));
         return orderInfo;
     }
 
-//        if(count == 0){
-//             count = this.selectCount(new EntityWrapper<OrderInfo>()
-//                    .eq("cargo_common_id", commonId));
-//            Integer evaluateInfoCount = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-//                    .eq("satisfaction", "5")
-//            .eq("owner_id",commonId));
-//            orderInfo.setHaoPing(evaluateInfoCount);
-//            Integer evaluateInfoCount1 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-//                    .eq("satisfaction", "1")
-//                    .eq("owner_id",commonId));
-//            orderInfo.setChaPing(evaluateInfoCount1);
-//            if (evaluateInfoCount >= 20 && count != 0) {
-//                hao = String.valueOf(evaluateInfoCount/count*100+"%");
-//            }
-//            List<EvaluateInfo> evaluateInfos = evaluateInfoService.selectList(new EntityWrapper<EvaluateInfo>()
-//            .eq("owner_id",commonId));
-//            if(CollectionUtil.isNotEmpty(evaluateInfos)){
-//                int fen = 0;
-//                for(int i=0;i<evaluateInfos.size();i++){
-//
-//                    fen = fen+Integer.parseInt(evaluateInfos.get(i).getComprehensiveSatisfaction());
-//                }
-//                if(fen!= 0){
-//                    zong=fen/(evaluateInfos.size()*5);
-//                }
-//            }
-//        }
-//        else{
-//            Integer evaluateInfoCount = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-//                    .eq("satisfaction", "5")
-//                     .eq("driver_id",commonId));
-//            orderInfo.setHaoPing(evaluateInfoCount);
-//            Integer evaluateInfoCount1 = evaluateInfoService.selectCount(new EntityWrapper<EvaluateInfo>()
-//                    .eq("satisfaction", "1")
-//                    .eq("driver_id",commonId));
-//            orderInfo.setChaPing(evaluateInfoCount1);
-//            if (evaluateInfoCount >= 20 && count != 0) {
-//                hao = String.valueOf(evaluateInfoCount/count*100+"%");
-//            }
-//            List<EvaluateInfo> evaluateInfos = evaluateInfoService.selectList(new EntityWrapper<EvaluateInfo>()
-//                    .eq("driver_id",commonId));
-//            if(CollectionUtil.isNotEmpty(evaluateInfos)){
-//                int fen = 0;
-//                for(int i=0;i<evaluateInfos.size();i++){
-//
-//                    fen = fen+Integer.parseInt(evaluateInfos.get(i).getComprehensiveSatisfaction());
-//                }
-//                if(fen!= 0){
-//                    zong=fen/(evaluateInfos.size()*5);
-//                }
-//            }
-//        }
-
 
     /**
      * 订单详情

+ 8 - 4
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/EvaluateInfoMapper.xml

@@ -10,10 +10,12 @@
         delete_flag = '0'
         <if test="haoType == 1">
             <if test="searchType == 1">
-                AND satisfaction >= 4
+                AND satisfaction = 4
+                OR satisfaction = 5 AND evaluatored_id = #{evaluatoredId}
             </if>
             <if test="searchType == 2">
-                AND comprehensive_satisfaction >= 4
+                AND comprehensive_satisfaction = 4
+                OR comprehensive_satisfaction = 5 AND evaluatored_id = #{evaluatoredId}
             </if>
         </if>
         <if test="haoType == 2">
@@ -72,10 +74,12 @@
         delete_flag = '0'
         <if test="haoType == 1">
             <if test="searchType == 1">
-                AND satisfaction >= 4
+                AND satisfaction = 4
+                OR satisfaction = 5 AND evaluatored_id = #{evaluatoredId}
             </if>
             <if test="searchType == 2">
-                AND comprehensive_satisfaction >= 4
+                AND comprehensive_satisfaction = 4
+                OR comprehensive_satisfaction = 5 AND evaluatored_id = #{evaluatoredId}
             </if>
         </if>
         <if test="haoType == 2">