Commit 8315a4c6 by 东州 翁

Merge branch 'develop' of 120.24.24.239:8timerv2/8timerapiv200 into wdz

# Conflicts:
#	src/main/java/cn/timer/api/controller/yggl/YgglController.java
parents a28cc7ad bea51ce9
......@@ -130,7 +130,7 @@ public class YgglMainEmp extends Model<YgglMainEmp> {
@ApiModelProperty(value="工作性质 1全职、2实习生、3兼职、4劳务派遣、5劳务、6派遣、7外包、8退休返聘",example="101")
private Integer jobType;
@ApiModelProperty(value="员工状态 1正式、2试用、3离职中、4已离职",example="101")
@ApiModelProperty(value="员工状态 1试用、2正式、3离职中、4已离职",example="101")
private Integer jobStatus;
@ApiModelProperty(value="入职日期 ",example="客户注册后的时间为入职时间")
......
package cn.timer.api.config.quartz;
//@Configuration
public class SchedulerConfig {
// @Bean(name = "SchedulerFactory")
// public SchedulerFactoryBean schedulerFactoryBean() throws IOException {
// SchedulerFactoryBean factory = new SchedulerFactoryBean();
// factory.setQuartzProperties(quartzProperties());
// return factory;
// }
//
// @Bean
// public Properties quartzProperties() throws IOException {
// PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
// propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties"));
// // 在quartz.properties中的属性被读取并注入后再初始化对象
// propertiesFactoryBean.afterPropertiesSet();
// return propertiesFactoryBean.getObject();
// }
//
// /*
// * quartz初始化监听器
// */
// @Bean
// public QuartzInitializerListener executorListener() {
// return new QuartzInitializerListener();
// }
//
// /*
// * 通过SchedulerFactoryBean获取Scheduler的实例
// */
// @Bean(name = "Scheduler")
// public Scheduler scheduler() throws IOException {
// return schedulerFactoryBean().getScheduler();
// }
}
package cn.timer.api.dao.htzz;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.timer.api.bean.htzz.HtzzAdminZzda;
/**
* 合同证照档案表
*
* @author Tang 2019-12-04
*/
@Repository
public interface HtzzAdminZzdaMapper extends IService<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.extension.service.IService;
import cn.timer.api.bean.htzz.HtzzAssoHtgx;
/**
* 合同关系表
*
* @author Tang 2019-12-18
*/
@Repository
public interface HtzzAssoHtgxMapper extends IService<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 org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.timer.api.bean.htzz.HtzzAssoZztx;
/**
* 证照提醒表
*
* @author Tang 2019-12-04
*/
@Repository
public interface HtzzAssoZztxMapper extends IService<HtzzAssoZztx> {
}
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.quartz;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.PageInfo;
import cn.timer.api.bean.quartz.JobAndTrigger;
@Repository
public interface JobAndTriggerMapper extends BaseMapper<JobAndTrigger> {
public PageInfo<JobAndTrigger> getJobAndTriggerDetails(@RequestParam(value = "pageNum") Integer pageNum,
@RequestParam(value = "pageSize") Integer pageSize);
}
\ No newline at end of file
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.quartz.JobAndTriggerMapper">
<select id="getJobAndTriggerDetails"
resultType="cn.timer.api.bean.quartz.JobAndTrigger">
SELECT
qrtz_job_details.JOB_NAME,
qrtz_job_details.JOB_GROUP,
qrtz_job_details.JOB_CLASS_NAME,
qrtz_triggers.TRIGGER_NAME,
qrtz_triggers.TRIGGER_GROUP,
qrtz_cron_triggers.CRON_EXPRESSION,
qrtz_cron_triggers.TIME_ZONE_ID
FROM
qrtz_job_details
JOIN qrtz_triggers
JOIN qrtz_cron_triggers ON
qrtz_job_details.JOB_NAME =
qrtz_triggers.JOB_NAME
AND
qrtz_triggers.TRIGGER_NAME = qrtz_cron_triggers.TRIGGER_NAME
AND
qrtz_triggers.TRIGGER_GROUP = qrtz_cron_triggers.TRIGGER_GROUP
</select>
</mapper>
\ 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