main
黄海 3 years ago
parent 7ec89d75dc
commit b0d96743c8

@ -10,6 +10,7 @@ import com.jfinal.ext.interceptor.POST;
import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.SqlPara;
import java.util.List;
@ -73,8 +74,26 @@ public class TouPiaoController extends Controller {
renderJson(kv);
}
public void tonji() {
/*
http://10.10.11.124:9000/FengHuang/TouPiao/TongJi?houxuanren_type_id=1
*/
public void TongJi(int houxuanren_type_id) {
/*
25251015
= 1.0 * / *10
= 1.0 * / *15
30
7
5232.
*/
int PingWeiHuiAllCount = tm.getTouPiaoRenSummary(1);
int QunZhongAllCount = tm.getTouPiaoRenSummary(2);
Kv kv = Kv.by("PingWeiHuiAllCount", PingWeiHuiAllCount).set("QunZhongAllCount", QunZhongAllCount).set("houxuanren_type_id", houxuanren_type_id);
SqlPara sq = Db.getSqlPara("TouPiao.TongJi", kv);
List<Record> list = Db.find(sq);
renderJson(CommonUtil.renderJsonForLayUI(list));
}
}

@ -68,4 +68,9 @@ public class TouPiaoModel {
}
Db.batchSave("t_toupiao_result", saveList, 100);
}
public int getTouPiaoRenSummary(int toupiaoren_type_id) {
String sql = "select count(1) as c from t_toupiao_toupiaoren where toupiaoren_type_id=?";
return Db.findFirst(sql, toupiaoren_type_id).getInt("c");
}
}

@ -0,0 +1,11 @@
#namespace("TouPiao")
#sql("TongJi")
select *,format(1.0 * ta.pingweihui_count /#(PingWeiHuiAllCount) *10 + 1.0*ta.qunzhong_count/#(QunZhongAllCount) *15,1) as score
from (select t1.houxuanren_tel,t1.houxuanren_name,t1.houxuanren_type_id,
(select count(1) from t_toupiao_result as t2 where t2.toupiaoren_type_id=1 and t1.houxuanren_tel=t2.toupiaoren_tel) as pingweihui_count,
(select count(1) from t_toupiao_result as t2 where t2.toupiaoren_type_id=2 and t1.houxuanren_tel=t2.toupiaoren_tel) as qunzhong_count
from t_toupiao_houxuanren as t1) as ta where ta.houxuanren_type_id=#(houxuanren_type_id)
order by 1.0 * ta.pingweihui_count /#(PingWeiHuiAllCount) *10 + 1.0*ta.qunzhong_count/#(QunZhongAllCount) *15 desc
#end
#end

@ -0,0 +1,11 @@
#namespace("TouPiao")
#sql("TongJi")
select *,format(1.0 * ta.pingweihui_count /#(PingWeiHuiAllCount) *10 + 1.0*ta.qunzhong_count/#(QunZhongAllCount) *15,1) as score
from (select t1.houxuanren_tel,t1.houxuanren_name,t1.houxuanren_type_id,
(select count(1) from t_toupiao_result as t2 where t2.toupiaoren_type_id=1 and t1.houxuanren_tel=t2.toupiaoren_tel) as pingweihui_count,
(select count(1) from t_toupiao_result as t2 where t2.toupiaoren_type_id=2 and t1.houxuanren_tel=t2.toupiaoren_tel) as qunzhong_count
from t_toupiao_houxuanren as t1) as ta where ta.houxuanren_type_id=#(houxuanren_type_id)
order by 1.0 * ta.pingweihui_count /#(PingWeiHuiAllCount) *10 + 1.0*ta.qunzhong_count/#(QunZhongAllCount) *15 desc
#end
#end
Loading…
Cancel
Save