Commit 3a7a3c3d by 东州 翁 Committed by chenzg

2020.4.7,更改了人事仪表盘接口显示的数据格式

parent f3fa4a40
......@@ -14,6 +14,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......@@ -81,6 +82,7 @@ import cn.timer.api.dto.yggl.YgAreaDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.dto.yggl.YgDrjqbDto;
import cn.timer.api.dto.yggl.YgDrsDto;
import cn.timer.api.dto.yggl.YgKVDto;
import cn.timer.api.dto.yggl.YgProDto;
import cn.timer.api.dto.yggl.YgQueryDto;
import cn.timer.api.dto.yggl.YgbintuDto;
......@@ -1679,38 +1681,51 @@ public class YgglController {
public Result<YgCartogramDto> ygCartogram(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
List<YgbintuDto> bintu = ygglMainEmpMapper.rsybp(orgCode);
bintu.stream().filter(bean ->{
if (bean.getAge() == null) {
bean.setAge(0);
}
if (bean.getBm() == null) {
bean.setBm("未分配");
}
if (bean.getGw() == null) {
bean.setGw("未分配");
}
if (bean.getProname() == null) {
bean.setProname("未分配");
}
if (bean.getEduname() == null) {
bean.setEduname("未分配");
}
if (bean.getJobStatus() == null) {
bean.setJobStatus(-1);
}
if (bean.getWorkage() == null) {
bean.setWorkage(-1);
}
return true;
}).collect(Collectors.toList());
/*
* bintu.stream().filter(bean ->{ if (bean.getAge() == null) { bean.setAge(0); }
* if (bean.getBm() == null) { bean.setBm("未分配"); } if (bean.getGw() == null) {
* bean.setGw("未分配"); } if (bean.getProname() == null) { bean.setProname("未分配");
* } if (bean.getEduname() == null) { bean.setEduname("未分配"); } if
* (bean.getJobStatus() == null) { bean.setJobStatus(-1); } if
* (bean.getWorkage() == null) { bean.setWorkage(-1); } return true;
* }).collect(Collectors.toList());
*/
Map<String, Long> gw = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getGw,Collectors.counting()));
List<YgKVDto> gwList = new ArrayList<YgKVDto>();
for(Map.Entry<String, Long> entry : gw.entrySet()) {
gwList.add(new YgKVDto(entry.getKey(),entry.getValue().toString()));
}
Map<String, Long> bm = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm,Collectors.counting()));
List<YgKVDto> bmList = new ArrayList<YgKVDto>();
for(Map.Entry<String, Long> entry : bm.entrySet()) {
bmList.add(new YgKVDto(entry.getKey(),entry.getValue().toString()));
}
//Map<String, Map<String, Long>> bmgw = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm,Collectors.groupingBy(YgbintuDto::getGw,Collectors.counting())));
Map<String, Long> edu = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getEduname,Collectors.counting()));
List<YgKVDto> eduList = new ArrayList<YgKVDto>();
for(Map.Entry<String, Long> entry : edu.entrySet()) {
eduList.add(new YgKVDto(entry.getKey(),entry.getValue().toString()));
}
Map<Integer,Long> jobStatus = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getJobStatus,Collectors.counting()));
List<YgKVDto> jobStatusList = new ArrayList<YgKVDto>();
for(Entry<Integer, Long> entry : jobStatus.entrySet()) {
jobStatusList.add(new YgKVDto(entry.getKey().toString(),entry.getValue().toString()));
}
Map<String, Long> proname = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getProname,Collectors.counting()));
List<YgKVDto> pronameList = new ArrayList<YgKVDto>();
for(Entry<String, Long> entry : proname.entrySet()) {
pronameList.add(new YgKVDto(entry.getKey().toString(),entry.getValue().toString()));
}
Map<String, Integer> workage = YgEnumInterface.workage.choose(bintu);
List<YgKVDto> workageList = new ArrayList<YgKVDto>();
for(Entry<String, Integer> entry : workage.entrySet()) {
workageList.add(new YgKVDto(entry.getKey().toString(),entry.getValue().toString()));
}
Map<String, Integer> age = YgEnumInterface.age.choose(bintu);
List<YgKVDto> ageList = new ArrayList<YgKVDto>();
for(Entry<String, Integer> entry : age.entrySet()) {
ageList.add(new YgKVDto(entry.getKey().toString(),entry.getValue().toString()));
}
//在职
Integer zaizhi = jobStatus.get(1).intValue()+jobStatus.get(2).intValue();
//本月新入职
......@@ -1728,13 +1743,13 @@ public class YgglController {
ybp.setZhuanzhen(zhuanzhen);
ybp.setNianlin(nianlin);
ybp.setBm(bm);
ybp.setGw(gw);
ybp.setEdu(edu);
ybp.setJobStatus(jobStatus);
ybp.setProname(proname);
ybp.setWorkage(workage);
ybp.setAge(age);
ybp.setBm(bmList);
ybp.setGw(gwList);
ybp.setEdu(eduList);
ybp.setJobStatus(jobStatusList);
ybp.setProname(pronameList);
ybp.setWorkage(workageList);
ybp.setAge(ageList);
return ResultUtil.data(ybp, "获取员工管理统计图信息成功!");
}
/**
......
package cn.timer.api.dto.yggl;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.persistence.GeneratedValue;
......@@ -47,33 +48,25 @@ public class YgCartogramDto implements Serializable{
private Integer nianlin;
@ApiModelProperty(value="部门")
private Map<String, Long> bm;
private List<YgKVDto> bm;
@ApiModelProperty(value="岗位")
private Map<String, Long> gw;
private List<YgKVDto> gw;
@ApiModelProperty(value="学历")
private Map<String, Long> edu;
private List<YgKVDto> edu;
@ApiModelProperty(value="工作状态")
private Map<Integer,Long> jobStatus;
private List<YgKVDto> jobStatus;
@ApiModelProperty(value="省份")
private Map<String, Long> proname;
private List<YgKVDto> proname;
@ApiModelProperty(value="工作日")
private Map<String, Integer> workage;
private List<YgKVDto> workage;
@ApiModelProperty(value="年龄")
private Map<String, Integer> age;
private List<YgKVDto> age;
//方法中文名称:
public void setBmgw(Map<String, Map<String, Long>> bmgw2) {
// TODO Auto-generated method stub
}
}
package cn.timer.api.dto.yggl;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2019-11-15
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("统计图--键值对Dto")
public class YgKVDto{
@ApiModelProperty(value="键 ")
private String name;
@ApiModelProperty(value="值")
private String value;
}
......@@ -169,13 +169,13 @@
</sql>
<!-- rsybp人事仪表盘 -->
<select id="rsybp" resultMap="Bintu">
SELECT e.id AS id,e.age AS age,e.bmgw_id AS bmgwId,b.`name` AS gw,bb.`name` AS bm, p.`name` AS proname,d.`name` AS eduname,e.job_status AS jobStatus,datediff(CURDATE(),e.rz_time) AS workage
SELECT e.id AS id,IFNULL(e.age,0) AS age,IFNULL(e.bmgw_id,0) AS bmgwId,IFNULL(b.`name`,'null') AS gw,IFNULL(bb.`name`,'null') AS bm,IFNULL( p.`name`,'null') AS proname,IFNULL(d.`name` ,'null')AS eduname,IFNULL(e.job_status,0) AS jobStatus,IFNULL(datediff(CURDATE(),e.rz_time),0)AS workage
FROM yggl_main_emp e
LEFT JOIN zzgl_bmgw_m b ON b.id = e.bmgw_id
LEFT JOIN zzgl_bmgw_m bb ON bb.id = b.up_id
LEFT JOIN province_class p ON left (e.`jg`,2) = p.province
LEFT JOIN education_class d ON d.number = e.edu
WHERE e.org_code = #{orgCode}
WHERE e.org_code = 117
</select>
<!-- benyueLz本月离职人数 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment