|
@@ -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);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 订单详情
|