Commit d3b83848 by 陶湘宇

配置文件控制定时器运行

parent 4b121214
......@@ -21,7 +21,7 @@ import cn.hutool.core.net.NetUtil;
@MapperScan({"cn.timer.api.dao"}) // 扫描的mapper
@ComponentScan(basePackages = {"cn.timer.api"})
@SpringBootApplication
@EnableScheduling
//@EnableScheduling
@EnableTransactionManagement
public class Application {
......
package cn.timer.api.config.schedule;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class SchedulerCondition implements Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
System.out.println("是否启动定时器"+context.getEnvironment().getProperty("enable.scheduling"));
return Boolean.valueOf(context.getEnvironment().getProperty("enable.scheduling"));
}
}
\ No newline at end of file
......@@ -5,7 +5,10 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import cn.timer.api.config.schedule.SchedulerCondition;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -21,15 +24,18 @@ import cn.timer.api.controller.kqgl.ClockInTool;
* 消息定时器
*
*/
@Slf4j
@Configuration // 1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
//@EnableScheduling // 2.开启定时任务
public class NewsTaskTiming {
@Autowired
private AlicloudSMS sms;
@Conditional(SchedulerCondition.class) //定时器开关
@Scheduled(cron = "0 0 8 * * ?")//早上八点
public void MessageAlert() throws ParseException {
log.info("消息定时器启动");
//当前时间
String nowdate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
......
......@@ -6,6 +6,7 @@ import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.config.schedule.SchedulerCondition;
import cn.timer.api.dao.insure.InsurePolicyMapper;
import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
......@@ -13,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -29,7 +31,7 @@ import java.util.stream.Collectors;
* @Date 2022/5/5 11:20
*/
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
//@EnableScheduling // 2.开启定时任务
@Slf4j
public class InsureTaskTiming {
@Autowired
......@@ -37,11 +39,12 @@ public class InsureTaskTiming {
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
@Conditional(SchedulerCondition.class) //定时器开关
@Scheduled(cron = "0/1 0 0 * * ?")//每月第一天
@Transactional(rollbackFor = Exception.class)
public void updateInsureStatusTask(){
try {
log.info("保单定时器");
Date now = DateUtil.date();
/*获取正常的保单*/
List<InsurePolicy> insurePolicyList = InsurePolicy.builder().build().selectList(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getStatus, "1").lt(InsurePolicy::getPolicyDateEnd, now));
......
......@@ -95,8 +95,19 @@ public class ClockInController {
private KqglAssoBcszMapper kqglassobcszmapper;
@Autowired
private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper;
//考勤组绑定的打卡方式
@Autowired
private AttGroupBinPunchModeMapper attgroupbinpunchmodemapper;
//考勤机
@Autowired
private AttendanceMachineMapper attendancemachinemapper;
//考勤地址
@Autowired
private PunchCardAddressMapper punchcardaddressmapper;
//考勤WIFI
@Autowired
private PunchCardWiFiMapper punchcardwifimapper;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("EEE");
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -2881,18 +2892,7 @@ public class ClockInController {
//***************************************************&**&******&***&****&***&**************************************************//
//**************************************************&&&&&&*****&&&******&&&****************************************************//
//*************************************************&******&****&********&******************************************************//
//考勤组绑定的打卡方式
@Autowired
private AttGroupBinPunchModeMapper attgroupbinpunchmodemapper;
//考勤机
@Autowired
private AttendanceMachineMapper attendancemachinemapper;
//考勤地址
@Autowired
private PunchCardAddressMapper punchcardaddressmapper;
//考勤WIFI
@Autowired
private PunchCardWiFiMapper punchcardwifimapper;
/**
* 获取考勤打卡数据------APP打卡
* @throws ParseException
......@@ -2900,10 +2900,10 @@ public class ClockInController {
@PostMapping(value = "/ClockData")
@ApiOperation(value = "获取考勤打卡数据------APP打卡", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 3)
public Result<Object> getAttClockData(@CurrentUser UserBean userBean,@RequestBody AttConditions attconditions) throws ParseException {
public Result<Object> getAttClockData(@CurrentUser UserBean userBean,@RequestBody AttConditions attconditions) {
try{
long nowdate = new Date().getTime();
String str = null;
if(!("").equals(attconditions.getDate())){
str = attconditions.getDate();
......@@ -2912,24 +2912,24 @@ public class ClockInController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
str = sdf.format(d);
}
//前一天时间
String yesterday = ClockInTool.requires_extra_times(str,-1,3,1);//前一天
Long startDateyesterday = DateUtil.getStartTime(0,DateUtil.getStringTime(yesterday,"yyyy-MM-dd")).getTime();
Long endDateyesterday = DateUtil.getnowEndTime(23,DateUtil.getStringTime(yesterday,"yyyy-MM-dd")).getTime();
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
String stampToDate = ClockInTool.stampToDate(String.valueOf(endDate));//当天打卡的最后时间
Timestamp d = Timestamp.valueOf(stampToDate);
Timestamp b = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));//当前时间
String now = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
if(attgro != null) {
//APP获取当前天的考勤信息
AttendanceCardListDto attdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),attconditions.getDate());
......@@ -2938,21 +2938,21 @@ public class ClockInController {
// attdate.setAttpr(dajllist);
int dkcs = 0;
int isxbdk = 0;
String yymmdd = str.substring(2, 10);
String nowattdate = yymmdd+" "+ClockInTool.dateToWeek2(str);
//查询当天考勤记录
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum(),nowattdate,userBean.getOrgCode());
if(dajllist_.size() > 0) {
dkcs = dajllist_.size();
isxbdk = dajllist_.get(dajllist_.size()-1).getSort();
}
if(attdate.getAttgrouptype() != 3) {
List<AttSchedule> attsch = attdate.getAttsch();
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && attsch.get(0).getId() != 0) {//班次不为空
int bc = 0;
int bsz = 0;
......@@ -2964,42 +2964,42 @@ public class ClockInController {
int sb1 = 0,xb1 = 0,sb2 = 0,xb2 = 0,sb3 = 0,xb3 = 0;
//先判断前一天是否存在次日打卡的方式
KqglAssoBcsz jianchashif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, attsch.get(0).getId()));
if(jianchashif.getIsSbdk1Cr() == 1) {
sb1 = 1;
if(jianchashif.getIsSbdk1Cr() == 1) {
sb1 = 1;
crlasttime = (str+" "+jianchashif.getSbdk1()+":00").replaceAll("\r|\n", "");}
if(jianchashif.getIsXbdk1Cr() == 1) {
xb1 = 1;
if(jianchashif.getIsXbdk1Cr() == 1) {
xb1 = 1;
crlasttime = (str+" "+jianchashif.getXbdk1()+":00").replaceAll("\r|\n", "");}
if(jianchashif.getIsSbdk2Cr() == 1) {
sb2 = 1;
if(jianchashif.getIsSbdk2Cr() == 1) {
sb2 = 1;
crlasttime = (str+" "+jianchashif.getSbdk2()+":00").replaceAll("\r|\n", "");}
if(jianchashif.getIsXbdk2Cr() == 1) {
xb2 = 1;
if(jianchashif.getIsXbdk2Cr() == 1) {
xb2 = 1;
crlasttime = (str+" "+jianchashif.getXbdk2()+":00").replaceAll("\r|\n", "");}
if(jianchashif.getIsSbdk3Cr() == 1) {
sb3 = 1;
if(jianchashif.getIsSbdk3Cr() == 1) {
sb3 = 1;
crlasttime = (str+" "+jianchashif.getSbdk3()+":00").replaceAll("\r|\n", "");}
if(jianchashif.getIsXbdk3Cr() == 1) {
xb3 = 1;
if(jianchashif.getIsXbdk3Cr() == 1) {
xb3 = 1;
crlasttime = (str+" "+jianchashif.getXbdk3()+":00").replaceAll("\r|\n", "");}
//
if(sb1 == 1 ||xb1 == 1 ||sb2 == 1 ||xb2 == 1 || sb3 == 1 ||xb3 == 1) {
//前一天的班次
AttendanceCardListDto beforeattdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),yesterday);
//前一天的打卡数据
// String yesterday = ClockInTool.requires_extra_times(now,-1,3,1);//前一天
// Long startDateyesterday = DateUtil.getStartTime(0,DateUtil.getStringTime(yesterday,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDateyesterday));//转换打卡时间格式
String yeboattdate = attdate_+" "+ClockInTool.dateToWeek2(yesterday);
//次日查询昨日考勤时 时间范围扩大到 昨日开始到今日结束
List<KqglAssoDkjl> dajllistbefo = kqglassodkjlmapper.getDetailedRecordClock(startDateyesterday,endDate,userBean.getEmpNum(),yeboattdate,userBean.getOrgCode());
List<AttSchedule> beforeattsch = beforeattdate.getAttsch();
int p = 0;
if(EmptyUtil.isNotEmpty(beforeattdate.getAttsch()) && beforeattsch.get(0).getId() != 0) {
int g = 1;
......@@ -3019,7 +3019,7 @@ public class ClockInController {
isdkjl = false;
}
}
if(dkjlbefo.getDktime() != null) {
bycf = false;
bc++;
......@@ -3027,7 +3027,7 @@ public class ClockInController {
}else {
attschbefo.setIsdk(0);
}
if(beforeattdate.getAttsch().size() == 2) {
if(befo.getStarttime() != 0 && befo.getEndtime() != 0) {
boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(befo.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(befo.getEndtime()),"yyyy-MM-dd HH:mm");
......@@ -3057,7 +3057,7 @@ public class ClockInController {
bc--;
attschbefo.setIsdk(0);
}
}else {
if(bycf) {
bc++;
......@@ -3065,9 +3065,9 @@ public class ClockInController {
}
}
}
Timestamp tt = Timestamp.valueOf(ClockInTool.stampToDate(String.valueOf(befo.getTime())));
if(attschbefo.getIsdk() == 1 && b.after(tt) && isdkjl) {
dkjlbefo.setStatus(17);//缺卡
dkjlbefo.setSort(befo.getSort());
......@@ -3075,18 +3075,18 @@ public class ClockInController {
//更新打卡关闭
attschbefo.setIsupdate(0);
}
attschbefo.setDajl(dkjlbefo);
attsch.add(p,attschbefo);
p++;
}
}
}
}
/****************昨日结束***************/
int bccs = attdate.getAttsch().size();
int r = 1;
// int bc = 0;
......@@ -3103,9 +3103,9 @@ public class ClockInController {
//有范围
if(ash.getStarttime() != 0 && ash.getEndtime() != 0) {
boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm");
String timme = ClockInTool.stampToDate2(String.valueOf(ash.getTime()));
if(r == 1) {
if(ectivedate) {
bsz = 1;
......@@ -3114,17 +3114,17 @@ public class ClockInController {
dk1 = false;
bc++;
ash.setIsdk(1);
if(!now.equals(timme)) {
ash.setIsupdate(0);
}else {
ash.setIsupdate(1);
}
}
}
if(r == 2) {
if(ectivedate) {
bsz = 1;
......@@ -3133,19 +3133,19 @@ public class ClockInController {
dk2 = false;
bc++;
ash.setIsdk(1);
if(!now.equals(timme)) {
ash.setIsupdate(0);
}else {
if(isxbdk == 2) {
ash.setIsupdate(1);
}
}
}
}
r++;
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
......@@ -3162,7 +3162,7 @@ public class ClockInController {
Timestamp a = Timestamp.valueOf(xbdk1);//下班
String sbdk1 = (str+" "+shif.getSbdk1()+":00").replaceAll("\r|\n", "");
Timestamp c = Timestamp.valueOf(sbdk1);//上班
if(r == 1) {
if (b.after(a) && b.after(c)) {// 当前时间大于下班打卡时间
bc++;
......@@ -3184,7 +3184,7 @@ public class ClockInController {
}
}
r++;
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
......@@ -3204,7 +3204,7 @@ public class ClockInController {
}else {
bc++;
ash.setIsdk(1);
if(ash.getSort() == 1) {
dk1 = false;
}
......@@ -3224,7 +3224,7 @@ public class ClockInController {
dk6 = false;
}
}
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
......@@ -3236,14 +3236,14 @@ public class ClockInController {
ash.setIsleave(1);
}
}
String afterday = ClockInTool.requires_extra_times(str,+1,3,1);//后一天
Long endDateafterday = DateUtil.getnowEndTime(23,DateUtil.getStringTime(afterday,"yyyy-MM-dd")).getTime();
if(sb1 == 1 ||xb1 == 1 || sb2 == 1 ||xb2 == 1 || sb3 == 1 ||xb3 == 1) {//当天存在次日打卡数据时 查询打卡记录范围应该是:当天的开始到后一天的结束
dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDateafterday,userBean.getEmpNum(),nowattdate,userBean.getOrgCode());
}
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
for(KqglAssoDkjl daj : dajllist_) {
if(ash.getId() == daj.getBcid() && ash.getSort() == daj.getSort()) {//班次id和打卡顺序对应
......@@ -3251,7 +3251,7 @@ public class ClockInController {
int bcid = dkjl.getBcid();
int results = dkjl.getResults();
KqglAssoBcsz bcsz = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, bcid));
if(now.equals(ClockInTool.stampToDate2(String.valueOf(ash.getTime())))) {
if(attdate.getAttsch().size() == 2) {
if(dkjl.getSort() == 2) {
......@@ -3267,7 +3267,7 @@ public class ClockInController {
}
}
}
if(bcsz != null && (dkjl.getSort())%2 > 0) {
int yxcdfzs = bcsz.getYxcdfzs();//允许迟到分钟数
int yzcdfzs = bcsz.getYzcdfzs();//严重迟到分钟数
......@@ -3288,7 +3288,7 @@ public class ClockInController {
dkjl.setStatus(16);//旷工迟到
}
}
if(bsz == 1) {
bc++;
ash.setIsdk(1);
......@@ -3299,12 +3299,12 @@ public class ClockInController {
BeanUtil.copyProperties(daj, dkjl,"attdate","remarks","userId","attime","dkmxid","commentary","punchequipment","punchmode");
}
}
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId()));
Timestamp tt = Timestamp.valueOf(ClockInTool.stampToDate(String.valueOf(ash.getTime())));
//处理下班不用打卡的数据
if(shif.getIsXbdk() == 1 && (ash.getSort())%2 == 0) {
if(shif.getIsXbdk() == 1 && (ash.getSort())%2 == 0) {
if(dkjl.getDktime() == null && b.after(tt)) {
dkjl.setDktime(ash.getTime());
dkjl.setStatus(1);
......@@ -3324,7 +3324,7 @@ public class ClockInController {
ash.setIsupdate(0);
ash.setIsdk(1);
}
//
if(ash.getIsdk() == 1 && b.after(tt) && dkjl.getDktime() == null && dkjl.getId() == null && dkcs > 0 && iscrdk) {
dkjl.setStatus(17);//缺卡
......@@ -3338,15 +3338,15 @@ public class ClockInController {
dkjl.setSort(ash.getSort());
dkjl.setId(888);
}
ash.setDajl(dkjl);//班次信息中插入打卡打卡 数据
/****/
//事务(请假,加班,调休,出差)
KqglAssoRelationSummary asssum1 = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, userBean.getEmpNum())
.eq(KqglAssoRelationSummary::getAppTime, str).eq(KqglAssoRelationSummary::getOrgCode, userBean.getOrgCode()).last("LIMIT 1"));
if(asssum1 != null) {
if(asssum1.getApprovalType() != 5) {
String startTime = asssum1.getStartTime();//
String endTime = asssum1.getEndTime();//
......@@ -3358,11 +3358,11 @@ public class ClockInController {
}
}
}
//0:无;1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假;11:加班;12:出差;13:外出
if(asssum1.getApprovalType() == 1) {
dkjl.setCalendar_status_type(11);
ash.setCalendar_status_type(11);
}else if(asssum1.getApprovalType() == 2) {
//请假
......@@ -3417,16 +3417,16 @@ public class ClockInController {
ash.setCalendar_status_type(0);
}
/****/
// ash.setDajl(dkjl);//班次信息中插入打卡打卡 数据
}
}
boolean lcdkgb = true;
if(attdate.getAttsch().size() == 2 && dkcs == 2 && now.equals(str)) {
lcdkgb = false;
KqglAssoDkjl dk = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getQyid, userBean.getOrgCode())
.eq(KqglAssoDkjl::getUserId, userBean.getEmpNum()).ge(KqglAssoDkjl::getDktime, startDate).le(KqglAssoDkjl::getDktime, endDate)
.ne(KqglAssoDkjl::getSort, 0).ne(KqglAssoDkjl::getStatus, 2).ne(KqglAssoDkjl::getStatus, 0)
......@@ -3440,7 +3440,7 @@ public class ClockInController {
}
}
}
//全部为缺卡时 没有打卡按钮显示
if(attsch.get(0).getDajl().getId() != null && iscrdk) {
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
......@@ -3460,7 +3460,7 @@ public class ClockInController {
}
}
}
//当天最后一个班打完后 打卡按钮全部不显示(没打卡的显示缺卡)
boolean isdkjj = true;
if(attdate.getAttsch().size() == 2) {
......@@ -3471,45 +3471,45 @@ public class ClockInController {
attsch.get(0).getDajl().setStatus(17);//缺卡
attsch.get(0).getDajl().setSort(attdate.getAttsch().get(0).getSort());
attsch.get(0).getDajl().setId(888);
attdate.getAttsch().get(0).setIsdk(1);
}
}
}else if(attdate.getAttsch().size() == 4) {
if(attsch.get(3).getDajl().getId() != null && attsch.get(3).getDajl().getDktime() != null) {
isdkjj = false;
if(attsch.get(0).getDajl().getId() == null && attsch.get(0).getDajl().getDktime() == null) {
attsch.get(0).getDajl().setDktime(null);
attsch.get(0).getDajl().setStatus(17);//缺卡
attsch.get(0).getDajl().setSort(attdate.getAttsch().get(0).getSort());
attsch.get(0).getDajl().setId(888);
attdate.getAttsch().get(0).setIsdk(1);
}
if(attsch.get(1).getDajl().getId() == null && attsch.get(1).getDajl().getDktime() == null && attsch.get(1).getDajl().getId() != 999) {
attsch.get(1).getDajl().setDktime(null);
attsch.get(1).getDajl().setStatus(17);//缺卡
attsch.get(1).getDajl().setSort(attdate.getAttsch().get(1).getSort());
attsch.get(1).getDajl().setId(888);
attdate.getAttsch().get(1).setIsdk(1);
}
if(attsch.get(2).getDajl().getId() == null && attsch.get(2).getDajl().getDktime() == null) {
attsch.get(2).getDajl().setDktime(null);
attsch.get(2).getDajl().setStatus(17);//缺卡
attsch.get(2).getDajl().setSort(attdate.getAttsch().get(2).getSort());
attsch.get(2).getDajl().setId(888);
attdate.getAttsch().get(2).setIsdk(1);
}
}
}else if(attdate.getAttsch().size() == 6) {
if(attsch.get(5).getDajl().getId() != null && attsch.get(5).getDajl().getDktime() != null) {
isdkjj = false;
if(attsch.get(0).getDajl().getId() == null && attsch.get(0).getDajl().getDktime() == null) {
attsch.get(0).getDajl().setDktime(null);
attsch.get(0).getDajl().setStatus(17);//缺卡
......@@ -3547,27 +3547,27 @@ public class ClockInController {
}
}
}
// System.out.println(attsch.get(attdate.getAttsch().size()-1).getTime());
//全部为 1 时 iscrdk
if(bccs == bc && b.before(d) && lcdkgb && isdkjj) {
KqglAssoDkjl dk = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getQyid, userBean.getOrgCode())
.eq(KqglAssoDkjl::getUserId, userBean.getEmpNum()).ge(KqglAssoDkjl::getDktime, startDate).le(KqglAssoDkjl::getDktime, endDate)
.ne(KqglAssoDkjl::getSort, 0).ne(KqglAssoDkjl::getStatus, 2).ne(KqglAssoDkjl::getStatus, 0)
.orderByDesc(KqglAssoDkjl::getSort).last("LIMIT 1"));
if(dk != null && attdate.getAttsch().size() != dk.getSort()) {
AttSchedule att = attsch.get(dk.getSort()-cr);
if(att.getDajl().getId() != null && att.getDajl().getStatus() != 17 && att.getDajl().getId() != 888) {
att.setIsdk(0);
AttSchedule attw = attsch.get(dk.getSort()-1);
attw.setIsupdate(1);
}else {
AttSchedule att1 = attsch.get(dk.getSort()+cr);
att1.setIsdk(0);
AttSchedule attw = attsch.get(dk.getSort()+cr-1);
attw.setIsupdate(1);
}
......@@ -3597,7 +3597,7 @@ public class ClockInController {
attcto.setIsdk(1);
}
}else if(attdate.getAttsch().size() == 4) {
AttSchedule attc = attsch.get(0);
if(attc.getDajl().getId() != null && attc.getDajl().getStatus() == 17 && attc.getDajl().getId() == 888) {
attc.getDajl().setId(null);
......@@ -3628,14 +3628,14 @@ public class ClockInController {
}
attc.setIsdk(0);
}
}
}
}
}
//没有打卡按钮时
for(int y=0;y<bc;y++) {
AttSchedule attc = attsch.get(y);
......@@ -3645,14 +3645,14 @@ public class ClockInController {
}
}
}
}else {
//休息的时候
// List<AttSchedule> attsch_ = new ArrayList<AttSchedule>();
// attdate.setAttsch(attsch_);
List<AttSchedule> attsch_ = new ArrayList<AttSchedule>();
if(dajllist_.size() > 0) {
for(int i=1;i<=dajllist_.size();i++){
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
......@@ -3684,12 +3684,12 @@ public class ClockInController {
attdate.setAttsch(attsch_);
}
}
}else {
//自由工时
List<AttSchedule> attsch = new ArrayList<AttSchedule>();
if(dajllist_.size() > 0) {
for(int i=1;i<=dajllist_.size();i++){
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
......@@ -3721,7 +3721,7 @@ public class ClockInController {
attdate.setAttsch(attsch);
}
}
List<TransactionApprovalDto> tranappr = new ArrayList<TransactionApprovalDto>();
//事务审批单
List<KqglAssoRelationSummary> trap = KqglAssoRelationSummary.builder().build().selectList(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, userBean.getEmpNum())
......@@ -3730,7 +3730,7 @@ public class ClockInController {
for(KqglAssoRelationSummary spnsw : trap) {
if(spnsw.getApprovalType() != 5) {
TransactionApprovalDto taap = TransactionApprovalDto.builder().build();
if(spnsw.getApprovalType() == 1) {
taap.setCalendar_status_type(11);
}else if(spnsw.getApprovalType() == 2) {
......@@ -3766,25 +3766,25 @@ public class ClockInController {
}else if(spnsw.getApprovalType() == 4) {
taap.setCalendar_status_type(13);
}
taap.setApproval_form(spnsw.getApprovalId());
tranappr.add(taap);
tranappr.add(taap);
attdate.setTranappr(tranappr);
}
}
}else {
attdate.setTranappr(tranappr);
}
//外勤 true:开 false:关
if(attgro.getIsWq() == 1) {
attdate.setFieldpersonnel(true);
}else {
attdate.setFieldpersonnel(false);
}
//打卡方式
List<AttGroupBinPunchMode> attmetlist = attgroupbinpunchmodemapper.selectByPrimaryByKqzId(attgro.getId());
for(AttGroupBinPunchMode agbp:attmetlist){
......@@ -3797,13 +3797,13 @@ public class ClockInController {
attdate.setAttwifi(true);
}
}
//详细打卡方式
List<AttClockMethod> akms = new ArrayList<AttClockMethod>();
for(AttGroupBinPunchMode abp:attmetlist){
if(abp.getType() == 1){
AttendanceMachine kqjs = attendancemachinemapper.selectByPrimaryKey(abp.getDkfsid());
AttendanceMachine kqjs = attendancemachinemapper.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
if(kqjs != null) {
akm.setName(kqjs.getName());// 打卡名称
......@@ -3815,7 +3815,7 @@ public class ClockInController {
}
akms.add(akm);
}else if(abp.getType() == 2){
PunchCardAddress kqdzs = punchcardaddressmapper.selectByPrimaryKey(abp.getDkfsid());
PunchCardAddress kqdzs = punchcardaddressmapper.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
if(kqdzs != null) {
akm.setName(kqdzs.getName());// 打卡名称
......@@ -3827,7 +3827,7 @@ public class ClockInController {
}
akms.add(akm);
}else{
PunchCardWiFi kqwfs = punchcardwifimapper.selectByPrimaryKey(abp.getDkfsid());
PunchCardWiFi kqwfs = punchcardwifimapper.selectByPrimaryKey(abp.getDkfsid());
AttClockMethod akm = AttClockMethod.builder().build();
if(kqwfs != null) {
akm.setName(kqwfs.getName());// 打卡名称
......@@ -3841,29 +3841,29 @@ public class ClockInController {
}
}
attdate.setMachine(akms);
//当天第一次打卡 前一天晚走小时**************************************************
double latetime_ = 0;//前天晚走时长(分钟)
Long changed_time = 0l;//晚到后应打卡时间
if(attdate.getAttgrouptype() != 3) {
List<AttSchedule> ash = attdate.getAttsch();
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ash.get(0).getId() != 0) {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.get(0).getId()));
if(shif != null) {
int dkcs_ = shif.getSxbcs();//上下班打卡次数
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
//统一分钟数
double xbwz1 = 0,xbwz2=0,xbwz3=0;
int sbwd1=0,sbwd2=0,sbwd3=0;
int arrive_late = 0;//晚到时间
String clock_date = "";//应打卡时间
Long latetime = 0l;//前天晚走时长(分钟)
KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
AttendanceCardListDto attdateyesterday;
long yesendtime1=0,yesendtime2=0,yesendtime3=0;
......@@ -3872,23 +3872,23 @@ public class ClockInController {
if(iswzwd > 0) {
//统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
String as = String.valueOf(Double.valueOf(shif.getSbwd1()) * 60);
sbwd1 = Integer.valueOf(as.replaceAll(regex, "$1$2"));//上班晚到1
xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
String qw = String.valueOf(Double.valueOf(shif.getSbwd2()) * 60);
sbwd2 = Integer.valueOf(qw.replaceAll(regex, "$1$2"));//上班晚到2
xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
String ed = String.valueOf(Double.valueOf(shif.getSbwd3()) * 60);
sbwd3 = Integer.valueOf(ed.replaceAll(regex, "$1$2"));//上班晚到3
//获取前一天最后下班的时间
yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum())
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode()));
attdateyesterday = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),yesterday);
List<AttSchedule> ashyes = attdateyesterday.getAttsch();
if(attdateyesterday.getAttsch().size() == 2 || attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yesendtime1 = ashyes.get(1).getTime();
......@@ -3899,7 +3899,7 @@ public class ClockInController {
if(attdateyesterday.getAttsch().size() == 6) {
yesendtime3 = ashyes.get(5).getTime();
}
if(yesterdaymx != null) {
if(dkcs_ == 1) {
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
......@@ -3915,7 +3915,7 @@ public class ClockInController {
}
}
}
if(latetime != 0) {
latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟)
if(latetime_ > xbwz1 && latetime_ < xbwz2) {
......@@ -3934,21 +3934,25 @@ public class ClockInController {
attdate.setChanged_time(changed_time);
}
}
}
return ResultUtil.data(attdate);
}else {
AttendanceCardListDto attdate_ = AttendanceCardListDto.builder().build();
return ResultUtil.data(attdate_,"未加入考勤组");
}
}catch (Exception e){
log.error("getAttClockData-erro:"+e.getStackTrace());
return ResultUtil.error("获取考勤组异常");
}
}
private SimpleDateFormat mat = new SimpleDateFormat("yyyy-MM-dd");
@Autowired
private KqglAssoTeshuMapper kqglassoteshumapper;
@Autowired
......@@ -3959,16 +3963,16 @@ public class ClockInController {
* APP 手机日历数据
* @param userBean
* @return
* @throws ParseException
* @throws ParseException
*/
@GetMapping(value = "/workbench_calendar/{date}")
@ApiOperation(value = "手机日历数据", httpMethod = "GET", notes = "查询数据")
public Result<Object> Workbench_calendar(@CurrentUser UserBean userBean,@PathVariable("date") String date) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
String current = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String yue = new SimpleDateFormat("yyyy-MM").format(new Date());
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM");
Date date_;
try {
......@@ -3978,68 +3982,68 @@ public class ClockInController {
date_=new Date();
}
// int dateOne= ClockInTool.getYearMonth(date_);
// 准备第一个模板,从字符串中提取出日期数字
String pat1 = "yyyy-MM" ;
// 准备第一个模板,从字符串中提取出日期数字
String pat1 = "yyyy-MM" ;
String pat = "yyyyMM";
SimpleDateFormat sdfi = new SimpleDateFormat(pat1) ; // 实例化模板对象
SimpleDateFormat sdf = new SimpleDateFormat(pat) ; // 实例化模板对象
Date d = null ;
try{
d = sdfi.parse(date) ; // 将给定的字符串中的日期提取出来
}catch(Exception e){ // 如果提供的字符串格式有错误,则进行异常处理
e.printStackTrace() ; // 打印异常信息
}
SimpleDateFormat sdfi = new SimpleDateFormat(pat1) ; // 实例化模板对象
SimpleDateFormat sdf = new SimpleDateFormat(pat) ; // 实例化模板对象
Date d = null ;
try{
d = sdfi.parse(date) ; // 将给定的字符串中的日期提取出来
}catch(Exception e){ // 如果提供的字符串格式有错误,则进行异常处理
e.printStackTrace() ; // 打印异常信息
}
int dateOne = Integer.valueOf(sdf.format(d));
int dangqian = Integer.valueOf(new SimpleDateFormat("yyyyMM").format(new Date()));//当前
List<WorkbenchCalendarDto> workcal = new ArrayList<WorkbenchCalendarDto>();
if(dateOne<=dangqian){
Long startMonth = 0l;
Long endMonth = 0l;
if(date == null || ("").equals(date)) {
Calendar c = Calendar.getInstance();
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
String first = mat.format(c.getTime());
startMonth = DateUtil.getStartTime(0,DateUtil.getStringTime(first,"yyyy-MM-dd")).getTime();
endMonth = new Date().getTime();
}else {
String time = date+"-01";
String sdaet = ClockInTool.getMinMonthDate(time);
startMonth = ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = ClockInTool.getMaxMonthDate(time);
endMonth = ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime();
if(date.equals(yue)) {
endMonth = new Date().getTime();
}
}
String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(df.format(startMonth),df.format(endMonth))).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(",");
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
for(String num : range) {
Long start_time = DateUtil.getStartTime(0,DateUtil.getStringTime(num,"yyyy-MM-dd")).getTime();
Long end_time = DateUtil.getnowEndTime(23,DateUtil.getStringTime(num,"yyyy-MM-dd")).getTime();
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
wocal.setDate(num);
if(attgro != null) {//有无考勤组
if(attgro != null) {//有无考勤组
AttendanceCardListDto attdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),num);//获取当天所打卡班次
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && attdate.getAttgrouptype() != 3) {//班次不为空
KqglAssoBcsz bcsts = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ashss.get(0).getId()));
if(ashss.get(0).getId() != 0) {
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()).eq(KqglAssoDkmx::getQyid, userBean.getOrgCode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));
......@@ -4063,7 +4067,7 @@ public class ClockInController {
}
}
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(dkmc.getSbdk2() != null && dkmc.getSbdk2jg() == 0 && dkmc.getXbdk2() != null && dkmc.getXbdk2jg() == 0) {
wocal.setCalendar_status(1);//打卡正常
......@@ -4078,12 +4082,12 @@ public class ClockInController {
wocal.setCalendar_status_type(0);
}
}else {
wocal.setCalendar_status(3);//打卡异常
wocal.setCalendar_status(3);//打卡异常
wocal.setCalendar_status_type(0);
}
}
}
if(attdate.getAttsch().size() == 6) {
if(dkmc.getSbdk3() != null && dkmc.getSbdk3jg() == 0 && dkmc.getXbdk3() != null && dkmc.getXbdk3jg() == 0) {
wocal.setCalendar_status(1);//打卡正常
......@@ -4098,12 +4102,12 @@ public class ClockInController {
wocal.setCalendar_status_type(0);
}
}else {
wocal.setCalendar_status(3);//打卡异常
wocal.setCalendar_status(3);//打卡异常
wocal.setCalendar_status_type(0);
}
}
}
// KqglAssoRelationSummary asssum = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, userBean.getEmpNum())
// .eq(KqglAssoRelationSummary::getAppTime, num).last("LIMIT 1"));
// if(asssum != null) {
......@@ -4113,7 +4117,7 @@ public class ClockInController {
wocal.setCalendar_status(3);//打卡异常
wocal.setCalendar_status_type(0);
}
//事务(请假,加班,调休,出差)
KqglAssoRelationSummary asssum = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, userBean.getEmpNum())
.eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getOrgCode, userBean.getOrgCode()).last("LIMIT 1"));
......@@ -4123,7 +4127,7 @@ public class ClockInController {
}else {
wocal.setCalendar_status(2);//事务(请假,加班,调休,出差)
}
//0:无;1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假;11:加班;12:出差;13:外出
if(asssum.getApprovalType() == 1) {
wocal.setCalendar_status_type(11);
......@@ -4171,22 +4175,22 @@ public class ClockInController {
}
workcal.add(wocal);
}
//当月后续补贴数据
if(date == null || ("").equals(date) || date.equals(yue)) {
int pbfs = 0;
String next_day = ClockInTool.requires_extra_times(current,1,2,1);
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
String last = mat.format(ca.getTime());
Long endMonth_ = DateUtil.getnowEndTime(23,DateUtil.getStringTime(last,"yyyy-MM-dd")).getTime();
String[] nextrangeArray=ClockInTool.listToString(ClockInTool.getDays(next_day,sdf1.format(endMonth_))).split(";");//目前为止所有日期
String[] nextrange=nextrangeArray[0].split(",");
String ttstr = date;//
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
if(attgro != null){//该员工是否加入到考勤组 排班方式 1:固定排班;2:自由排班;3:自由工时 计算出应出勤,实际出勤,休息天数
if(attgro.getPbfs() == 1){ //固定排班
pbfs = 1;
......@@ -4215,7 +4219,7 @@ public class ClockInController {
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++;
}
//目前为止应出勤天数
int w = 0,x=0;
int zj = 6;
......@@ -4229,7 +4233,7 @@ public class ClockInController {
ycqts = ycqtst;
w++;
}
}else {
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
......@@ -4297,7 +4301,7 @@ public class ClockInController {
int g = 0,x=0;
for(String num : nextrange) {
if(Arrays.binarySearch(ziyoupb, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
ycqts[g] = num;
ycqts[g] = num;
g++;
}else {
xxts[x] = num;
......@@ -4306,7 +4310,7 @@ public class ClockInController {
}
}
}
if(!(nextrange[0]).equals("")) {
for(String nus : nextrange) {
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
......@@ -4324,12 +4328,12 @@ public class ClockInController {
wocal.setCalendar_status_type(0);
}
}
workcal.add(wocal);
}
}
}
}else {
String time = date+"-01";
......@@ -4337,16 +4341,16 @@ public class ClockInController {
Long startMonth = ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime();
String edate = ClockInTool.getMaxMonthDate(time);
Long endMonth = ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime();
//固定排班
String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(df.format(startMonth),df.format(endMonth))).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(",");
/******************/
String[] ycqts = new String[31];//应上班的具体天数(yyyy-MM-dd)
String[] xxts = new String[31];//休息的具体天数(yyyy-MM-dd)
//考勤组信息
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode());
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode());
//固定排班
if(attgro.getPbfs() == 1) {
List<KqglAssoTeshu> bxdklist = kqglassoteshumapper.ShouldSpecialDatessetByKqzid(attgro.getId(), date,1);//当前月 必须打卡日期
......@@ -4374,7 +4378,7 @@ public class ClockInController {
needfig[e] = String.valueOf(awek.getType());//获取设置的应打卡周几
e++;
}
//目前为止应出勤天数
int w = 0,x=0;
int zj = 6;
......@@ -4410,7 +4414,7 @@ public class ClockInController {
}
}
/******************/
for(String num : range) {
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
wocal.setDate(num);
......@@ -4420,19 +4424,19 @@ public class ClockInController {
if(ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)) {
wocal.setCalendar_status(4);//
}
if(!ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(ycqts), num) && !ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(xxts), num)) {
wocal.setCalendar_status(0);//
}
workcal.add(wocal);
}
}
}
return ResultUtil.data(workcal, "操作成功!");
}
}
......@@ -10,8 +10,10 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import cn.timer.api.config.schedule.SchedulerCondition;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -61,7 +63,7 @@ import cn.timer.api.utils.DateUtil;
* 考勤报表汇总数据
*/
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
//@EnableScheduling // 2.开启定时任务
@Slf4j
public class AttendanceTaskTiming{
......@@ -93,13 +95,14 @@ public class AttendanceTaskTiming{
// @Scheduled(cron = "0 */2 * * * ?")
// @Scheduled(cron = "0 25 11 * * ?")
@Conditional(SchedulerCondition.class) //定时器开关
@Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行
public void AttendanceTask() throws ParseException {
boolean implement = true;
//逻辑
if(implement) {
log.info("AttendanceTask考勤数据统计开始");
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
......
......@@ -10,7 +10,10 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import cn.timer.api.config.schedule.SchedulerCondition;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -59,8 +62,9 @@ import cn.timer.api.utils.DateUtil;
/**
* @author Yl123 上月数据
*/
@Slf4j
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
//@Conditional(SchedulerCondition.class) //定时器开关
public class LastMonthtimingExport {
@Autowired
private KqglMainKqzMapper kqglmainkqzmapper;
......@@ -89,12 +93,13 @@ public class LastMonthtimingExport {
private static String lastDay;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
@Conditional(SchedulerCondition.class) //定时器开关
// @Scheduled(cron = "0 55 11 * * ?")
@Scheduled(cron = "0 0 4,20 * * ?")//每天上午4点,下午20点 执行
@Scheduled(cron = "0 0 4,20 * * ?")//每天上午4点,下午20点 执行
public void LastMonthtimingAttendanceTask() throws ParseException {
log.info("=======================================上月数据定时任务开始=======================================");
//获取前月的最后一天
Calendar cale = Calendar.getInstance();
cale.set(Calendar.DAY_OF_MONTH,0);//设置为1号,当前日期既为本月第一天
......
......@@ -13,9 +13,12 @@ import java.util.Locale;
import cn.hutool.core.collection.CollectionUtil;
import cn.timer.api.bean.xcgl.XcglAssoXzdadx;
import cn.timer.api.bean.xcgl.XcglAssoXzdaz;
import cn.timer.api.config.schedule.SchedulerCondition;
import cn.timer.api.dao.xcgl.XcglAssoXzdadxMapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -65,16 +68,18 @@ import javax.annotation.Resource;
*/
//@Component
//@Lazy
@Slf4j
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
//@EnableScheduling // 2.开启定时任务
public class SalaryTaskTiming{
// 薪酬管理-定薪
@Resource
private XcglAssoXzdadxMapper xcglassoxzdadxmapper;
//3.添加定时任务 每天凌晨1点执行一次
@Scheduled(cron = "0 0 1 * * ?")
@Conditional(SchedulerCondition.class) //定时器开关
@Scheduled(cron = "0 0 1 * * ?") //3.添加定时任务 每天凌晨1点执行一次
public void AttendanceTask() throws ParseException {
log.info("调薪记录生效定时任务");
// 使用状态(0:使用中;1:历史, 2: 未生效)
// 当前日期
String curDate = DateUtil.getStringFormat(new Date().getTime());
......
......@@ -101,7 +101,7 @@ spring:
protocol: smtp
host: smtp.163.com
username: youlingrc123@163.com
password: RIMBNJJQNKYNVUWL
password: youlingrc189
default-encoding: utf-8
properties:
mail:
......@@ -164,8 +164,8 @@ pagehelper:
#showSql
logging:
level:
root: ERROR
cn.timer.api.dao: error
root: INFO
cn.timer.api.dao: info
pattern:
console: '--%p--%m%n'
......
spring:
profiles:
active: dev
active: pro
#active: '@environment@'
enable:
scheduling: false
# 我是合同证照
[cn.timer.api.utils]
TimerUtil.start = 0/10 0 0 0 0 1/5
TimerUtil.start = 0/10 0 0 0 0 1/5
......@@ -69,7 +69,7 @@
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志 -->
<!--<totalSizeCap>1GB</totalSizeCap> -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
<maxFileSize>1024MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!--日志输出编码格式化 -->
......
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