Commit cc1c880e by 东州 翁 Committed by chenzg

改良人事仪表盘60%

parent a9a55f64
......@@ -9,10 +9,14 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import cn.timer.api.dto.yggl.YgbintuDto;
import lombok.Getter;
import net.sf.ehcache.search.expression.Between;
/**
* @date 2020年3月23日
......@@ -168,4 +172,47 @@ public interface YgEnumInterface {
return result.type.toString();
}
}
/**
* 工龄
*/
@Getter
enum workage implements YgEnumInterface{
//NEW(0,183),HALF(1,365),ONE(2,548),ONEHALF(3,730),TWO(4,913),LONG(5,10000);
NEW(0,183,0),HALF(184,365,0),ONE(366,548,0),ONEHALF(549,730,0),TWO(731,1000,0),LONG(1001,10000,0);
private Integer begin;
private Integer end;
private Integer number;
workage(Integer begin, Integer end,Integer number) {
this.begin = begin;
this.end = end;
this.number = number;
}
public static Map<String, Integer> choose(List<YgbintuDto> bintu) {
for (YgbintuDto b : bintu) {
Integer index = b.getWorkage();
for (workage item : workage.values()) {
if (index>= item.begin && index<=item.end) {
item.number++;
System.out.println("item"+ item+":"+item.number);
}
}
}
Map<String, Integer> result = new HashMap<String, Integer>();
result.put("x<0.5", NEW.number);
result.put("0.5<x<1", HALF.number);
result.put("1<x<1.5", ONE.number);
result.put("1.5<x<2", ONEHALF.number);
result.put("2<x<3", TWO.number);
result.put("x++", LONG.number);
return result;
}
}
}
......@@ -8,6 +8,8 @@ package cn.timer.api.controller.yggl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
......@@ -15,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.transaction.Transactional;
......@@ -68,19 +71,23 @@ import cn.timer.api.dao.yggl.YgMzDtoMapper;
import cn.timer.api.dao.yggl.YgProDtoMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.yggl.YgglMainLzbMapper;
import cn.timer.api.dao.yggl.YgtitleDtoMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.YgAreaDto;
import cn.timer.api.dto.yggl.YgCartogramDto;
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.YgProDto;
import cn.timer.api.dto.yggl.YgQueryDto;
import cn.timer.api.dto.yggl.YgbintuDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
import cn.timer.api.dto.yggl.YgjgDto;
import cn.timer.api.dto.yggl.YgmzDto;
import cn.timer.api.dto.yggl.YgtitleDto;
import cn.timer.api.dto.yggl.YgzzDto;
import cn.timer.api.utils.Md5;
import cn.timer.api.utils.Result;
......@@ -122,6 +129,9 @@ public class YgglController {
//weng(民族)
@Autowired
private YgMzDtoMapper ygMzDtoMapper;
//weng(人事仪表盘)
@Autowired
private YgtitleDtoMapper ygtitleDtoMapper;
/**
* 获取员工档案
* @param
......@@ -1465,7 +1475,53 @@ public class YgglController {
return ResultUtil.data(map, "查询成功");
}
/**
* 获取成长记录表
* 员工信息统计图
* @return 成功信息(weng)
*/
@GetMapping("/Cartogram")
@ApiOperation(value = "获取员工管理统计图信息", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 63)
public Result<Map<String, Object>> ygCartogram(@CurrentUser UserBean userBean) {
List<YgbintuDto> bintu = ygglMainEmpMapper.rsybp();
bintu.stream().filter(bean ->{
if (bean.getAge() == null) {
bean.setAge(-1);
}
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);
}
return true;
}).collect(Collectors.toList());
YgtitleDto title = new LambdaQueryChainWrapper<YgtitleDto>(ygtitleDtoMapper).eq(YgtitleDto::getOrgCode, userBean.getOrgCode()).one();
//Map<String, List<YgbintuDto>> map = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getGw));岗位
//Map<String, List<YgbintuDto>> map = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm));部门
Map<String, Map<String, Long>> bmgw = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getBm,Collectors.groupingBy(YgbintuDto::getGw,Collectors.counting())));
Map<String, List<YgbintuDto>> edu = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getEduname));
Map<Integer, List<YgbintuDto>> jobStatus = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getJobStatus));
Map<String, List<YgbintuDto>> proname = bintu.stream().collect(Collectors.groupingBy(YgbintuDto::getProname));
Map<String, Integer> workage = YgEnumInterface.workage.choose(bintu);
System.out.println(bmgw);
System.out.println(edu);
System.out.println(jobStatus);
System.out.println(proname);
System.out.println(workage);
return ResultUtil.success();
}
/**
* 获取员工社保公积金
* @param
* @return
*/
......
......@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dto.yggl.YgCartogramDto;
import cn.timer.api.dto.yggl.YgQueryDto;
import cn.timer.api.dto.yggl.YgbintuDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
/**
......@@ -18,6 +20,12 @@ import cn.timer.api.dto.yggl.YgglCartogramDto;
*/
@Repository
public interface YgglMainEmpMapper extends BaseMapper<YgglMainEmp> {
/**
* 人事仪表盘
* @param userBean
* @return
*/
List<YgbintuDto> rsybp();
/**
* 查询员工信息
......
package cn.timer.api.dao.yggl;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.dto.yggl.YgtitleDto;
/**
* 人事仪表盘饼图表
* @author Tang 2019-11-15
*/
@Repository
public interface YgtitleDtoMapper extends BaseMapper<YgtitleDto> {
}
/**
* @date 2020年4月1日
* @author 翁东州
* @方法中文名称:
*/
package cn.timer.api.dto.yggl;
import io.swagger.annotations.ApiModelProperty;
/**
* @date 2020年4月1日
* @author 翁东州
* @方法中文名称:
*/
public class YgCartogramDto {
@ApiModelProperty(value="统计图--标头 ",example="标头")
private YgtitleDto ygtitleDto;
@ApiModelProperty(value="统计图--饼图和直方图 ",example="饼图和直方图")
private YgbintuDto ygbintuDto;
}
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("统计图--饼图和直方图")
public class YgbintuDto{
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer id;
@ApiModelProperty(value="年龄 ",example="省编码")
private Integer age;
@ApiModelProperty(value="部门岗位id",example="市编码")
private Integer bmgwId;
@ApiModelProperty(value="岗位名",example="市编码")
private String gw;
@ApiModelProperty(value="部门名",example="市编码")
private String bm;
@ApiModelProperty(value="籍贯省份",example="名字")
private String proname;
@ApiModelProperty(value="学历",example="名字")
private String eduname;
@ApiModelProperty(value="员工状态",example="名字")
private Integer jobStatus;
@ApiModelProperty(value="工龄天数",example="名字")
private Integer workage;
}
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 com.baomidou.mybatisplus.annotation.TableName;
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
@TableName("yggl_atta_title")
@ApiModel("统计图--标头")
public class YgtitleDto{
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="id编号",example="1")
private Integer id;
@ApiModelProperty(value="在职人数",example="1")
private Integer zaizhi;
@ApiModelProperty(value="本月新入职 ",example="1")
private Integer xinruzhi;
@ApiModelProperty(value="本月离职",example="1")
private Integer lizhi;
@ApiModelProperty(value="本月转正",example="1")
private Integer zhuanzhen;
@ApiModelProperty(value="平均年龄",example="22")
private Integer nianlin;
@ApiModelProperty(value="组织机构代码",example="117")
private Integer orgCode;
}
......@@ -54,6 +54,18 @@
<result column="appopenid" property="appopenid" />
</resultMap>
<resultMap id="Bintu" type="cn.timer.api.dto.yggl.YgbintuDto" >
<id column="id" property="id" />
<result column="age" property="age" />
<result column="bmgwId" property="bmgwId" />
<result column="gw" property="gw" />
<result column="bm" property="bm" />
<result column="proname" property="proname" />
<result column="eduname" property="eduname" />
<result column="jobStatus" property="jobStatus" />
<result column="workage" property="workage" />
</resultMap>
<sql id="Base_Column_List">
id,
emp_num,
......@@ -155,7 +167,16 @@
mpopenid YgglMainEmp_mpopenid,
appopenid YgglMainEmp_appopenid
</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
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 = 117 AND b.org_code =117;
</select>
<!-- 查询员工信息 搜索 分页 -->
<select id="queryEmpMessage" resultType="cn.timer.api.dto.yggl.YgQueryDto">
SELECT
......
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