Commit 05ae6411 by dengshichuan

Merge branch 'wdz' into 'develop'

Wdz

See merge request 8timerv2/8timerapiv200!15
parents bea51ce9 8315a4c6
......@@ -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,7 @@ package cn.timer.api.controller.yggl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
......@@ -15,6 +16,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,6 +70,7 @@ 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;
......@@ -78,9 +81,11 @@ 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;
......@@ -123,6 +128,10 @@ public class YgglController {
@Autowired
private YgMzDtoMapper ygMzDtoMapper;
//weng(人事仪表盘)
@Autowired
private YgtitleDtoMapper ygtitleDtoMapper;
/**
* 获取员工档案
*
......@@ -1657,8 +1666,58 @@ public class YgglController {
}
/**
<<<<<<< HEAD
* 员工信息统计图
* @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();
}
/**
* 获取员工社保公积金
=======
* 获取成长记录表
*
>>>>>>> bea51ce9ef8860bb31a1d14ffce121313636951a
* @param
* @return
*/
......
package cn.timer.api.dao.htzz;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.htzz.HtzzAdminZzda;
/**
* 合同证照档案表
*
* @author Tang 2019-12-04
*/
@Repository
public interface HtzzAdminZzdaMapper extends BaseMapper<HtzzAdminZzda> {
}
package cn.timer.api.dao.htzz;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.htzz.HtzzAdminZzda;
/**
* 合同证照档案表
*
* @author Tang 2019-12-04
*/
@Repository
public interface HtzzAdminZzdaMapper extends BaseMapper<HtzzAdminZzda> {
}
package cn.timer.api.dao.htzz;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.htzz.HtzzAssoHtgx;
/**
* 合同关系表
*
* @author Tang 2019-12-18
*/
@Repository
public interface HtzzAssoHtgxMapper extends BaseMapper<HtzzAssoHtgx> {
}
package cn.timer.api.dao.htzz;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.htzz.HtzzAssoHtgx;
/**
* 合同关系表
*
* @author Tang 2019-12-18
*/
@Repository
public interface HtzzAssoHtgxMapper extends BaseMapper<HtzzAssoHtgx> {
}
package cn.timer.api.dao.htzz;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.htzz.HtzzAssoZztx;
/**
* 证照提醒表
*
* @author Tang 2019-12-04
*/
@Repository
public interface HtzzAssoZztxMapper extends BaseMapper<HtzzAssoZztx> {
public static void main(String[] args) {
DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
String a = format1.format(new Date());
System.err.println(a);
}
}
package cn.timer.api.dao.htzz;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.htzz.HtzzAssoZztx;
/**
* 证照提醒表
*
* @author Tang 2019-12-04
*/
@Repository
public interface HtzzAssoZztxMapper extends BaseMapper<HtzzAssoZztx> {
public static void main(String[] args) {
DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
String a = format1.format(new Date());
System.err.println(a);
}
}
package cn.timer.api.dao.yggl;
import java.util.List;
import org.springframework.stereotype.Repository;
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.YgQueryDto;
import cn.timer.api.dto.yggl.YgglCartogramDto;
/**
* 员工档案+统计图查询
*
* @author dsc 2019-11-23
*/
@Repository
public interface YgglMainEmpMapper extends BaseMapper<YgglMainEmp> {
/**
* 查询员工信息
* @param userBean
* @return
*/
List<YgQueryDto> queryEmpMessage(UserBean userBean);
/**
* 查询在职员工(试用员工人数+正式员工人数)
* @param userBean
* @return
*/
YgglCartogramDto queryInservice(UserBean userBean);
/**
* 查询当月入职人数
* @param userBean
* @return
*/
YgglCartogramDto queryInduction(UserBean userBean);
/**
* 查询本月转正人数
* @param userBean
* @return
*/
YgglCartogramDto queryPositive(UserBean userBean);
/**
* 查询员工平均年龄
* @param userBean
* @return
*/
YgglCartogramDto queryAvgAge(UserBean userBean);
/**
* 查询部门名称及人数
* @param userBean
* @return
*/
List<YgglCartogramDto> queryDepartmentNum(UserBean userBean);
/**
* 查询岗位名称及人数
* @param userBean
* @return
*/
List<YgglCartogramDto> queryJobsNum(UserBean userBean);
/**
* 学历及人数查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryEducation(UserBean userBean);
/**
* 员工年龄分布查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryEmpAge(UserBean userBean);
/**
* 籍贯统计(省份)人数分布查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryNativeplace(UserBean userBean);
/**
* 员工工龄分布查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryWorkingAge(UserBean userBean);
}
package cn.timer.api.dao.yggl;
import java.util.List;
import org.springframework.stereotype.Repository;
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;
/**
* 员工档案+统计图查询
*
* @author dsc 2019-11-23
*/
@Repository
public interface YgglMainEmpMapper extends BaseMapper<YgglMainEmp> {
/**
* 人事仪表盘
* @param userBean
* @return
*/
List<YgbintuDto> rsybp();
/**
* 查询员工信息
* @param userBean
* @return
*/
List<YgQueryDto> queryEmpMessage(UserBean userBean);
/**
* 查询在职员工(试用员工人数+正式员工人数)
* @param userBean
* @return
*/
YgglCartogramDto queryInservice(UserBean userBean);
/**
* 查询当月入职人数
* @param userBean
* @return
*/
YgglCartogramDto queryInduction(UserBean userBean);
/**
* 查询本月转正人数
* @param userBean
* @return
*/
YgglCartogramDto queryPositive(UserBean userBean);
/**
* 查询员工平均年龄
* @param userBean
* @return
*/
YgglCartogramDto queryAvgAge(UserBean userBean);
/**
* 查询部门名称及人数
* @param userBean
* @return
*/
List<YgglCartogramDto> queryDepartmentNum(UserBean userBean);
/**
* 查询岗位名称及人数
* @param userBean
* @return
*/
List<YgglCartogramDto> queryJobsNum(UserBean userBean);
/**
* 学历及人数查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryEducation(UserBean userBean);
/**
* 员工年龄分布查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryEmpAge(UserBean userBean);
/**
* 籍贯统计(省份)人数分布查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryNativeplace(UserBean userBean);
/**
* 员工工龄分布查询
* @param userBean
* @return
*/
List<YgglCartogramDto> queryWorkingAge(UserBean userBean);
}
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;
}
package cn.timer.api.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.timer.api.bean.htzz.HtzzAdminZzda;
import cn.timer.api.bean.htzz.HtzzAssoHtgx;
/**
* 记录当前时间循环输出 遍历合同提醒关系表,每天固定时间(8点)查询是否提醒
*
* @author Administrator
*
*/
@Component
@Lazy(false)
@EnableScheduling
public class RemindUtil {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
/**
* 间隔时间提醒 10min/次
*/
@Scheduled(fixedRate = 30 * 60 * 1000)
private void now() {
System.err.println("当前时间:" + dateFormat.format(new Date()));
}
/**
* 每天固定时间提醒
*/
@Scheduled(cron = "0 0 8 * * ?") // 每天8点扫一下看有没要提醒的,有就发一个
// @Scheduled(cron = "0 8 15 * * ?") // 测试合同提醒
public static void reportCurrentTime() {
List<HtzzAssoHtgx> htgxs = HtzzAssoHtgx.builder().build().selectAll();
for (HtzzAssoHtgx htgx : htgxs) {
QueryWrapper<HtzzAdminZzda> q = new QueryWrapper<HtzzAdminZzda>();
q.select("id", "zjmc", "txkg_type", "yxdqr").eq("id", htgx.getHtid()).eq("is_delete", 0).eq("txkg_type", 0);
HtzzAdminZzda zzda = HtzzAdminZzda.builder().build().selectOne(q);
if (zzda != null) {
String name = htgx.getName(); // 员工姓名
String phone = htgx.getPhone(); // 员工手机
String htname = zzda.getZjmc(); // 合同名称
Date now = new Date(); // 当前时间
Date dqsj = zzda.getYxdqr(); // 到期时间
String time = DateUtil.formatDate(dqsj); // 到期時間格式
Long betweenDay = DateUtil.between(dqsj, now, DateUnit.DAY); // 时间差天数
Long sjc = dqsj.getTime() - now.getTime(); // 时间差数值
System.err.println(betweenDay);
if (sjc > 0) {
if (betweenDay <= 1) {
AliyunSMS.tx(name, htname, time, phone); // 少于1天短信提醒
} else if (betweenDay == 3) {
AliyunSMS.tx(name, htname, time, phone); // 少于3天短信提醒
} else if (betweenDay == 7) {
AliyunSMS.tx(name, htname, time, phone); // 少于7天短信提醒
} else if (betweenDay == 30) {
AliyunSMS.tx(name, htname, time, phone); // 少于30天短信提醒
}
} else {
zzda.setTxkgType(1); // 关闭提醒
zzda.updateById();
}
}
}
}
package cn.timer.api.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.timer.api.bean.htzz.HtzzAdminZzda;
import cn.timer.api.bean.htzz.HtzzAssoHtgx;
/**
* 记录当前时间循环输出 遍历合同提醒关系表,每天固定时间(8点)查询是否提醒
*
* @author Administrator
*
*/
@Component
@Lazy(false)
@EnableScheduling
public class RemindUtil {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
/**
* 间隔时间提醒 10min/次
*/
@Scheduled(fixedRate = 30 * 60 * 1000)
private void now() {
System.err.println("当前时间:" + dateFormat.format(new Date()));
}
/**
* 每天固定时间提醒
*/
@Scheduled(cron = "0 0 8 * * ?") // 每天8点扫一下看有没要提醒的,有就发一个
// @Scheduled(cron = "0 8 15 * * ?") // 测试合同提醒
public static void reportCurrentTime() {
List<HtzzAssoHtgx> htgxs = HtzzAssoHtgx.builder().build().selectAll();
for (HtzzAssoHtgx htgx : htgxs) {
QueryWrapper<HtzzAdminZzda> q = new QueryWrapper<HtzzAdminZzda>();
q.select("id", "zjmc", "txkg_type", "yxdqr").eq("id", htgx.getHtid()).eq("is_delete", 0).eq("txkg_type", 0);
HtzzAdminZzda zzda = HtzzAdminZzda.builder().build().selectOne(q);
if (zzda != null) {
String name = htgx.getName(); // 员工姓名
String phone = htgx.getPhone(); // 员工手机
String htname = zzda.getZjmc(); // 合同名称
Date now = new Date(); // 当前时间
Date dqsj = zzda.getYxdqr(); // 到期时间
String time = DateUtil.formatDate(dqsj); // 到期時間格式
Long betweenDay = DateUtil.between(dqsj, now, DateUnit.DAY); // 时间差天数
Long sjc = dqsj.getTime() - now.getTime(); // 时间差数值
System.err.println(betweenDay);
if (sjc > 0) {
if (betweenDay <= 1) {
AliyunSMS.tx(name, htname, time, phone); // 少于1天短信提醒
} else if (betweenDay == 3) {
AliyunSMS.tx(name, htname, time, phone); // 少于3天短信提醒
} else if (betweenDay == 7) {
AliyunSMS.tx(name, htname, time, phone); // 少于7天短信提醒
} else if (betweenDay == 30) {
AliyunSMS.tx(name, htname, time, phone); // 少于30天短信提醒
}
} else {
zzda.setTxkgType(1); // 关闭提醒
zzda.updateById();
}
}
}
}
}
\ No newline at end of file
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