|
|
|
<%@ page import="weaver.general.*" %>
|
|
|
|
<%@page import="weaver.conn.RecordSet"%>
|
|
|
|
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
|
|
|
<%@ page import="java.util.*" %>
|
|
|
|
<%@ page import="com.engine.matfron.entity.OptionVO" %>
|
|
|
|
<%@ page import="com.engine.matfron.entity.SeriesParam" %>
|
|
|
|
<%@ page import="java.text.DecimalFormat" %>
|
|
|
|
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
|
|
|
|
<jsp:useBean id="bb" class="weaver.general.BaseBean" scope="page" />
|
|
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
|
|
|
|
|
|
|
<%
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
OptionVO optionVO = getPortalEthnic();
|
|
|
|
jsonObject.put("data",optionVO);
|
|
|
|
|
|
|
|
%>
|
|
|
|
<%=jsonObject.toString() %>
|
|
|
|
|
|
|
|
<%!
|
|
|
|
|
|
|
|
public OptionVO getPortalEthnic() {
|
|
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.00");
|
|
|
|
|
|
|
|
String fieldid = "27";
|
|
|
|
String fieldname = "field"+fieldid ;
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
List<String> colorList = Arrays.asList("#6e94f3","#faf0e6","#7cfc00","#ao20f0","#00ced1","#83d8ae","#697695","#8ac9e9","#9933fa","#c0ff3e","#ffe4c4","#cd6090");
|
|
|
|
LinkedList<SeriesParam> seriesData = new LinkedList<>();
|
|
|
|
LinkedList<String> nameSet = new LinkedList<>();
|
|
|
|
|
|
|
|
rs.executeQuery(" select t."+fieldname+",k.selectname as name,count(1) as sums" +
|
|
|
|
" from cus_fielddata t\n" +
|
|
|
|
" inner join hrmresource h on h.id = t.id\n" +
|
|
|
|
" left join cus_selectitem k on k.selectvalue = t."+fieldname+"\n" +
|
|
|
|
" where k.fieldid="+fieldid+" \n" +
|
|
|
|
" and t."+fieldname+" is not null \n" +
|
|
|
|
" and t.scope = 'HrmCustomFieldByInfoType' and t.scopeid='3' \n" +
|
|
|
|
" and h.status in(0,1,2,3)" +
|
|
|
|
" and (h.belongto is null or h.belongto = -1 ) " +
|
|
|
|
" group by t."+fieldname+",k.selectname \n" +
|
|
|
|
"");
|
|
|
|
while (rs.next()) {
|
|
|
|
Random random = new Random();
|
|
|
|
String color = colorList.get(random.nextInt(colorList.size()));
|
|
|
|
String name = Util.null2String(rs.getString("name"));
|
|
|
|
seriesData.add(SeriesParam.builder().value(Util.getDoubleValue(rs.getString("sums"))).name(name).color(color).build());
|
|
|
|
nameSet.add(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
double percentage = seriesData.stream().mapToDouble(SeriesParam::getValue).sum();
|
|
|
|
seriesData.forEach(item -> item.setValue(Double.valueOf(df.format((item.getValue() * 100) / percentage))));
|
|
|
|
|
|
|
|
|
|
|
|
return OptionVO.builder()
|
|
|
|
.titleText("人员类型")
|
|
|
|
.legendDataTwo(nameSet)
|
|
|
|
.seriesData(seriesData)
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|