Commit c928be85 by lal Committed by chenzg

提交

parent 131e5ab3
......@@ -58,6 +58,7 @@ import cn.timer.api.dao.kqmk.KqglAssoBcszMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkjlMapper;
import cn.timer.api.dao.kqmk.KqglAssoDkmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglAssoRelationSummaryMapper;
import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AttClockMethod;
......@@ -89,6 +90,8 @@ public class ClockInController {
private KqglAssoDkjlMapper kqglassodkjlmapper;
@Autowired
private KqglAssoBcszMapper kqglassobcszmapper;
@Autowired
private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
......@@ -119,6 +122,7 @@ public class ClockInController {
String msg = "未知错误,请联系管理员";
int sbyf = 1;//0:失败;1:成功
int status_ = 0;
JSONObject jsonArray = new JSONObject(json);
String asDevId = jsonArray.get("dev_id").toString();//考勤机编码
......@@ -139,6 +143,8 @@ public class ClockInController {
/*******/
long time_ = DateUtil.getStringTime(sStdIoTime, "yyyy-MM-dd HH:mm:ss");//打卡时间戳
String putime = new SimpleDateFormat("yyyy-MM-dd").format(time_);//转换打卡时间格式 年月日
String putimehhmm = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_);//转换打卡时间格式 年月日
//打卡当天开始时间,打卡当天结束时间
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(putime,"yyyy-MM-dd")).getTime();
......@@ -233,6 +239,19 @@ public class ClockInController {
if(EmptyUtil.isEmpty(attdate.getAttsch())) {
msg = "当前未排班";
sbyf = 0;
status_ = 2;
}else {
//排查请假是否在最后一次打卡范围内 查询当月的请假所有日期
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userid, 2, putime,qyid);
boolean adopt = false;
if(leainv != null) {
adopt = ClockInTool.hourMinuteBetween(putimehhmm, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
msg = "已请假";
sbyf = 0;
status_ = 2;
}else {
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
......@@ -488,6 +507,8 @@ public class ClockInController {
punchstart = endtime3ks;
punchend = endtime3js;
}
if(clockt.getShifid() != 0) {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
......@@ -784,6 +805,7 @@ public class ClockInController {
sbyf = 0;
}
}
}
}else {
//自由工时打卡
Long stapclotime = attdate.getStapclotime();// 今天考勤 自由排班开始时间
......@@ -935,7 +957,8 @@ public class ClockInController {
}
}
}
int type,status = 0;
int type = 0,status = 0;
if(atttype != 0) {
if((atttype)%2 > 0){
type = 1;// 类型(类型 0:无排班打卡 1:上班 2:下班) punchcardtime == 0:无班次打卡
if(attdate.getAttgrouptype() != 3) {
......@@ -995,6 +1018,7 @@ public class ClockInController {
}
}
}
}
//第二次未超过应上班打卡时间 打卡为无效
if(sbdkkd) {
......@@ -1025,6 +1049,9 @@ public class ClockInController {
commentary = "打卡成功";
}else {
commentary = msg;
if(status_ == 2) {
status = status_;
}
}
//cardtype--1:GPS,2:WIFI,3:考勤机
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(time_).results(results).userId(userid).type(type).status(status).sort(atttype)
......@@ -2214,6 +2241,9 @@ public class ClockInController {
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()));//当前时间
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userBean.getEmpNum(),userBean.getOrgCode()); //考勤组信息
if(attgro != null) {
......@@ -2240,10 +2270,19 @@ public class ClockInController {
bc++;
ash.setIsdk(1);
}
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
if(leainv != null) {
String time = ClockInTool.stampToDate4(String.valueOf(ash.getTime()));//当天打卡的最后时间
adopt = ClockInTool.hourMinuteBetween(time, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
ash.setIsleave(1);
}
}else {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId()));
Timestamp b = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));//
String xbdk1 = (str+" "+shif.getXbdk1()+":00").replaceAll("\r|\n", "");
Timestamp a = Timestamp.valueOf(xbdk1);
String sbdk1 = (str+" "+shif.getSbdk1()+":00").replaceAll("\r|\n", "");
......@@ -2265,10 +2304,22 @@ public class ClockInController {
bsz = 1;
ash.setIsdk(0);
}else {
bc++;
ash.setIsdk(1);
}
}
r++;
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
if(leainv != null) {
String time = ClockInTool.stampToDate4(String.valueOf(ash.getTime()));//当天打卡的最后时间
adopt = ClockInTool.hourMinuteBetween(time, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
ash.setIsleave(1);
}
}
}else {
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");
......@@ -2279,6 +2330,17 @@ public class ClockInController {
bc++;
ash.setIsdk(1);
}
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
boolean adopt = false;
if(leainv != null) {
String time = ClockInTool.stampToDate4(String.valueOf(ash.getTime()));//当天打卡的最后时间
adopt = ClockInTool.hourMinuteBetween(time, leainv.getStartTime().substring(0, 16), leainv.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
}
if(adopt) {
ash.setIsleave(1);
}
}
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
......@@ -2298,9 +2360,12 @@ public class ClockInController {
}
//全部为 1 时
if(bccs == bc) {
if(bccs == bc && b.before(d)) {
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).orderByDesc(KqglAssoDkjl::getSort).last("LIMIT 1"));
.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());
att.setIsdk(0);
......@@ -2431,15 +2496,22 @@ public class ClockInController {
KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
AttendanceCardListDto attdateyesterday;
long yesendtime1=0,yesendtime2=0,yesendtime3=0;
String regex = "(\\d+)(?:(\\.\\d*[^0])|\\.)0*";
//存在晚走玩到
if(iswzwd > 0) {
//统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 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
sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 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
sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 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())
......@@ -2457,6 +2529,7 @@ public class ClockInController {
yesendtime3 = ashyes.get(5).getTime();
}
if(yesterdaymx != null) {
if(dkcs_ == 1) {
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60;
......@@ -2470,6 +2543,8 @@ public class ClockInController {
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60;
}
}
}
if(latetime != 0) {
latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟)
if(latetime_ > xbwz1 && latetime_ < xbwz2) {
......
......@@ -658,6 +658,7 @@ public class ClockInTool {
return res;
}
/**
* 时间戳转换时间
*/
......@@ -682,6 +683,18 @@ public class ClockInTool {
return res;
}
/**
* 时间戳转换时间
*/
public static String stampToDate4(String s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
long lt = new Long(s);
Date date = new Date(lt);
res = simpleDateFormat.format(date);
return res;
}
public static String Str_Time_formatting(String str,String Format) {
SimpleDateFormat sdf = new SimpleDateFormat(Format);
......
......@@ -31,7 +31,9 @@ import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.controller.kqgl.ClockInController;
import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.controller.kqgl.EmptyUtil;
import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
import cn.timer.api.dao.kqgl.PunchRecordMapper;
......@@ -43,7 +45,9 @@ import cn.timer.api.dao.kqmk.KqglAssoTeshuMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dao.qyzx.QyzxEntInfoMMapper;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttSubsidiaryDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.utils.DateUtil;
/**
......@@ -99,6 +103,10 @@ public class AttendanceTaskTiming{
private PunchRecordMapper punchrecordmapper;
@Autowired
private KqglAssoDkmxMapper kqglassodkmxmapper;
@Autowired
private ClockInController clockincontroller;
/**
* @return
* @throws ParseException
......@@ -109,7 +117,7 @@ public class AttendanceTaskTiming{
// @Scheduled(cron = "0 22 15 * * ?") // 测试:5秒执行一次 0 0 19 * * ?
// @Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(cron = "0 40 17 * * ?")
// @Scheduled(cron = "0 24 10 * * ?")
public void AttendanceTask() throws ParseException {
// boolean implement = false;
......@@ -179,12 +187,18 @@ public class AttendanceTaskTiming{
String[] sblacks = new String[31];//上班缺卡天数
String[] xblacks = new String[31];//下班缺卡天数
String[] dkjtts = new String[attendance.size()];//目前打卡日期明细
int bccs = 0;
if(attendance.size() > 0) {
dkjl = attendance.size();
for(PunchCardDetails pcd:attendance){
AttendanceCardListDto attdate = clockincontroller.MethodCall(org_code, user.getEmpnum(), pcd.getData());
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空
bccs = attdate.getAttsch().size();
}
dkjtts[dk] = pcd.getData();
dk++;
if(pcd.getYdkcs() == 2 || pcd.getYdkcs() == 4 || pcd.getYdkcs() == 6){
if(bccs == 2 || bccs == 4 || bccs == 6){
if(pcd.getSbdk1() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
......@@ -194,7 +208,7 @@ public class AttendanceTaskTiming{
xbqkcs++;
}
}
if(pcd.getYdkcs() == 4 || pcd.getYdkcs() == 6){
if(bccs == 4 || bccs == 6){
if(pcd.getSbdk2() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
......@@ -204,7 +218,7 @@ public class AttendanceTaskTiming{
xbqkcs++;
}
}
if(pcd.getYdkcs() == 6){
if(bccs == 6){
if(pcd.getSbdk3() == null){
sblacks[sbqkcs] = pcd.getData();
sbqkcs++;
......@@ -215,6 +229,12 @@ public class AttendanceTaskTiming{
}
}
}
sblacks = ClockInTool.deleteArrayNull(sblacks);
sbqkcs= sblacks.length;
xblacks = ClockInTool.deleteArrayNull(xblacks);
xbqkcs = xblacks.length;
}
//具体打卡时间入汇总表(打卡成功才会录入汇总表)
// KqglAssoMonthPunchSummary isyessum = KqglAssoMonthPunchSummary.builder().build().selectOne(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda()
......@@ -789,6 +809,4 @@ public class AttendanceTaskTiming{
// return null;
// }
}
}
......@@ -76,6 +76,7 @@ import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper;
import cn.timer.api.dao.spmk.SpmkCustomApprovalMapper;
import cn.timer.api.dao.spmk.SpmkExecutorMapper;
import cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper;
import cn.timer.api.dto.spmk.ApprovedQuantityDto;
import cn.timer.api.dto.spmk.ApprovingDto;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.FromData;
......@@ -926,4 +927,44 @@ public class SpmkController {
return ResultUtil.data(msg);
}
@PostMapping(value = "/approved_quantity")
@ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "")
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
int istartedit=0,ccme=0,iapprovedit=0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
qna.setIstartedit(istartedit);
qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit);
return ResultUtil.data(qna);
}
}
......@@ -23,4 +23,6 @@ public interface KqglAssoRelationSummaryMapper extends BaseMapper<KqglAssoRelati
List<KqglAssoRelationSummary> LeaveInvestigation(int userid,int approvaltype,String apptime,int orgcode);
KqglAssoRelationSummary selectTabledata(int userid,int approvaltype,String apptime);
KqglAssoRelationSummary leaveinvesti(int userid,int approvaltype,String apptime,int orgcode);
}
package cn.timer.api.dao.spmk;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -22,4 +24,6 @@ public interface SpmkApproveSummaryMapper extends BaseMapper<SpmkApproveSummary>
IPage<SpmkApproveSummary> selectPageByQueryForEmpNum(IPage<SpmkApproveSummary> page,@Param("param") MySummaryQueryDto mySummaryQueryDto);
List<SpmkApproveSummary> selectPageByQueryForEmpNum(@Param("param") MySummaryQueryDto mySummaryQueryDto);
}
......@@ -26,6 +26,7 @@ public class AttSchedule implements Serializable{
private Long starttime;
private Long endtime;
private int isleave;//是否请假
private int isupdate;//是否跟新打卡
private int isdk;//0:当前打卡 1:已过打卡
private KqglAssoDkjl dajl;
......
package cn.timer.api.dto.spmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ApprovedQuantityDto {
@ApiModelProperty(value = "我发起的", example = "11")
private Integer istartedit;
@ApiModelProperty(value = "抄送我的", example = "22")
private Integer ccme;
@ApiModelProperty(value = "我审批的", example = "33")
private Integer iapprovedit;
}
......@@ -24,16 +24,16 @@ public class MySummaryQueryDto extends Page{
private Integer empNum;
@ApiModelProperty(value = "关键字 标题/审批人名称/审批总汇id", example = "请假")
@ApiModelProperty(value = "关键字 标题/审批人名称/审批总汇id", example = "")
private String query;
@ApiModelProperty(value = "状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝", example = "0")
private Integer sts;
@ApiModelProperty(value = "开始时间 ", example = "2000-10-10 10:10:10")
@ApiModelProperty(value = "开始时间 ", example = "")
private String startTime;
@ApiModelProperty(value = "结束时间 ", example = "2020-10-10 10:10:10")
@ApiModelProperty(value = "结束时间 ", example = "")
private String endTime;
@NotNull(message = ValidationMsg.NOTNULL)
......
......@@ -68,6 +68,16 @@
and SUBSTR(res.app_time,1,7) = #{apptime}
GROUP BY res.start_time,res.end_time;
</select>
<select id="leaveinvesti" resultMap="BaseResultMap">
select res.start_time,
res.end_time
from kqgl_asso_relation_summary res
where res.user_id = #{userid}
and res.org_code = #{orgcode}
and res.approval_type = #{approvaltype}
and res.app_time = #{apptime}
GROUP BY res.start_time,res.end_time;
</select>
<select id="selectTabledata" resultMap="BaseResultMap">
select SUM(res.duration) as duration
......
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