Commit 9f323783 by ilal

提交

parent 1b2a557c
......@@ -44,5 +44,8 @@ public class ZzglCodeLogin extends Model<ZzglCodeLogin> {
@ApiModelProperty(value = "vlaue ", example = "vlaue")
private String vlaue;
@ApiModelProperty(value = "vlaue ", example = "vlaue")
private Long datatime;
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.management.Query;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -909,7 +910,6 @@ public class LoginController {
@PostMapping(value = "/extracting_code")
@ApiOperation(value = "获取二维码", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Extracting_QR_code(HttpServletResponse response) throws Exception {
//生成数据块,传给客户端,同时二维码里的内容也是这个数据块
String timercode = String.valueOf(new Date().getTime());
String randomnum = String.valueOf((int)(1+Math.random()*(10-1+1)));//随机数
......@@ -918,34 +918,31 @@ public class LoginController {
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("type", "longin");
hashMap.put("scancode", key);
//转json格式,这里需要用到fastjson包
// String result = JSONObject.fromObject(hashMap).toString();
hashMap.put("code", "200");
hashMap.put("message", "");
hashMap.put("result", "true");
String result = new cn.hutool.json.JSONObject(hashMap).toString();//转化为json格式
System.out.println("全部信息="+result);//打印json串
// session.setAttribute(key,timercode);
// session.setAttribute(key+"_code","1");
ZzglCodeLogin.builder().keyCode(key).vlaue(timercode).build().insert();
ZzglCodeLogin.builder().keyCode(key+"_code").vlaue("1").build().insert();
ZzglCodeLogin.builder().keyCode(key).vlaue(timercode).datatime(new Date().getTime()).build().insert();
ZzglCodeLogin.builder().keyCode(key+"_code").vlaue("1").datatime(new Date().getTime()).build().insert();
// PrintWriter pw = response.getWriter();
ServletOutputStream pw = response.getOutputStream();
pw.print(result);
pw.flush();
pw.close();
return ResultUtil.data(key,"成功");
return null;
// return ResultUtil.data(key,"成功");
}
@PostMapping(value = "/scan_code_login")
@ApiOperation(value = "扫码登录", httpMethod = "POST", notes = "接口发布说明")
public Result<QyzxEmpLogin> Scan_code_login(@CurrentUser UserBean userBean,@RequestBody ScancodeloginparametersDto scancodelogin,HttpServletRequest request) throws ParseException {
public Result<QyzxEmpLogin> Scan_code_login(@RequestBody ScancodeloginparametersDto scancodelogin,HttpServletRequest request) throws ParseException {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
// String timer_code = session.getAttribute(scancodelogin.getKey()+"_code").toString(); //扫码状态
// String timercode = session.getAttribute(scancodelogin.getKey()).toString(); //扫码时间
ZzglCodeLogin colo = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
String timercode = colo.getVlaue();
......@@ -957,24 +954,35 @@ public class LoginController {
//key
//计算
//1:没人扫码 2:扫码成功 3:登录成功
//1:没人扫码 2:扫码成功 3:登录成功 4:过期
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(changed_time)));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd1.after(sd2)) {
if(timer_code.equals("1")) {
return ResultUtil.success("..没人扫码..");
//等待
return ResultUtil.success("1");
}else if(timer_code.equals("2")) {
return ResultUtil.success("扫码成功.");
//扫码成功
return ResultUtil.success("2");
}else if(timer_code.equals("3")){
ZzglCodeLogin num = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_empnum"));
int EmpNum = Integer.valueOf(num.getVlaue());
ZzglCodeLogin orco = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_orgcode"));
int OrgCode = Integer.valueOf(orco.getVlaue());
YgglMainEmp ygam = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, userBean.getEmpNum()).eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
YgglMainEmp ygam = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, EmpNum).eq(YgglMainEmp::getOrgCode, OrgCode));
if(ygam != null) {
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(QyzxEmpLogin::getPhone, ygam.getPhone()).one();
if (qyzxEmpLogin1 != null) {
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_code"));
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_empnum"));
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_orgcode"));
return loginhan(qyzxEmpLogin1, request);
}else {
return ResultUtil.error("登录失败");
......@@ -986,7 +994,8 @@ public class LoginController {
return ResultUtil.error("验证失败");
}
}else {
return ResultUtil.error("二维码已过期");
// return ResultUtil.error("二维码已过期");
return ResultUtil.success("4");
}
}
......@@ -999,10 +1008,7 @@ public class LoginController {
@ApiOperation(value = "手机端扫码登录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> scanLogin(@RequestBody ScancodeloginparametersDto scancodelogin) throws ParseException {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
if(scancodelogin.getKey() != null) {
// String timercode = session.getAttribute(scancodelogin.getKey()).toString(); //扫码时间
ZzglCodeLogin colo = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
if(colo != null) {
String timercode = colo.getVlaue();
......@@ -1013,9 +1019,7 @@ public class LoginController {
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(changed_time)));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd1.after(sd2)) {
// session.setAttribute(scancodelogin.getKey()+"_code","2");
ZzglCodeLogin.builder().vlaue("2").build().update(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_code"));
return ResultUtil.success("扫码成功");
}else {
return ResultUtil.error("二维码已过期");
......@@ -1023,11 +1027,9 @@ public class LoginController {
}else {
return ResultUtil.error("扫码失败");
}
}else {
return ResultUtil.error("验证失败");
}
}
@PostMapping(value = "/scanLoginOk")
......@@ -1036,34 +1038,19 @@ public class LoginController {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
if(scancodelogin.getKey() != null) {
// String timercode = session.getAttribute(scancodelogin.getKey()).toString(); //扫码时间
ZzglCodeLogin.builder().keyCode(scancodelogin.getKey()+"_empnum").vlaue(String.valueOf(userBean.getEmpNum())).datatime(new Date().getTime()).build().insert();
ZzglCodeLogin.builder().keyCode(scancodelogin.getKey()+"_orgcode").vlaue(String.valueOf(userBean.getOrgCode())).datatime(new Date().getTime()).build().insert();
ZzglCodeLogin colo = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
String timercode = colo.getVlaue();
timercode = ClockInTool.stampToDate(timercode);
long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(timercode, "+"+expiration_time)));
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(changed_time)));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd1.after(sd2)) {
ZzglCodeLogin.builder().vlaue("3").build().update(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_code"));
// session.setAttribute(scancodelogin.getKey()+"_code","3");
YgglMainEmp ygam = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, userBean.getEmpNum()).eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(ygam != null) {
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(QyzxEmpLogin::getPhone, ygam.getPhone()).one();
if (qyzxEmpLogin1 != null) {
return loginhan(qyzxEmpLogin1, request);
}else {
return ResultUtil.error("登录失败");
}
}else {
return ResultUtil.error("登录有误");
}
return ResultUtil.success("登录成功");
}else {
return ResultUtil.error("二维码已过期");
}
......
......@@ -1660,6 +1660,7 @@ public class ClockInController {
}else if(clock.getType() == 2){
if(dkmc.getSbdk1() != null && dkmc.getXbdk1() == null){
kskd = false;
atttype = clock.getType();
}else {
//最后一次卡的时候 再继续打视为更新最后一次打卡
kskd = true;//更新最后一次打卡
......@@ -2111,7 +2112,7 @@ public class ClockInController {
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(attendance_date));//转换打卡时间格式
//true:确认为最后一次打卡更新打卡时 之前打卡的一条数据变为“打卡更新数据”
if(kskd && (atttype == 2 || atttype == 4 || atttype == 6)) {
if(kskd && (atttype == 2 || atttype == 4 || atttype == 6) && attdate.getAttgrouptype() != 3) {
KqglAssoDkjl dkjj = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getUserId, userid).eq(KqglAssoDkjl::getType, 2)
.eq(KqglAssoDkjl::getSort, atttype).eq(KqglAssoDkjl::getQyid, qyid).eq(KqglAssoDkjl::getAttdate, attdate_+" "+ClockInTool.dateToWeek2(toweek)));
......@@ -2305,6 +2306,8 @@ public class ClockInController {
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) {
......@@ -2313,6 +2316,7 @@ public class ClockInController {
//打卡记录
// List<KqglAssoDkjl> dajllist = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
// attdate.setAttpr(dajllist);
int dkcs = 0;
if(attdate.getAttgrouptype() != 3) {
List<AttSchedule> attsch = attdate.getAttsch();
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && attsch.get(0).getId() != 0) {//班次不为空
......@@ -2324,13 +2328,42 @@ 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");
if(ectivedate) {
bsz = 1;
ash.setIsdk(0);
}else {
bc++;
ash.setIsdk(1);
String timme = ClockInTool.stampToDate2(String.valueOf(ash.getTime()));
if(r == 1) {
if(ectivedate) {
bsz = 1;
ash.setIsdk(0);
}else {
bc++;
ash.setIsdk(1);
if(!now.equals(timme)) {//小于
ash.setIsupdate(0);
}else {
ash.setIsupdate(1);
}
}
}
if(r == 2) {
if(ectivedate) {
bsz = 1;
ash.setIsdk(0);
}else {
bc++;
ash.setIsdk(1);
if(!now.equals(timme)) {//小于
ash.setIsupdate(0);
}else {
ash.setIsupdate(1);
}
}
}
r++;
//是否请假
KqglAssoRelationSummary leainv = kqglassorelationsummarymapper.leaveinvesti(userBean.getEmpNum(), 2, str,userBean.getOrgCode());
......@@ -2404,7 +2437,9 @@ public class ClockInController {
}
}
////
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
dkcs = dajllist_.size();
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
for(KqglAssoDkjl daj : dajllist_) {
if(ash.getId() == daj.getBcid() && ash.getSort() == daj.getSort()) {//班次id和打卡顺序对应
......@@ -2417,11 +2452,41 @@ public class ClockInController {
}
}
}
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId()));
if(shif.getIsXbdk() == 1 && (ash.getSort())%2 == 0) {
if(dkjl.getDktime() == null) {
KqglAssoDkjl dkjl_ = KqglAssoDkjl.builder().build();
dkjl_.setDktime(ash.getTime());
dkjl_.setStatus(1);
dkjl_.setSort(ash.getSort());
dkjl_.setId(999);
BeanUtil.copyProperties(dkjl_, dkjl);
}else {
dkjl.setStatus(1);
}
}
ash.setDajl(dkjl);
}
boolean lcdkgb = true;
if(attdate.getAttsch().size() == 2 && dkcs == 2) {
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)
.orderByDesc(KqglAssoDkjl::getSort).last("LIMIT 1"));
AttSchedule att = attsch.get(dk.getSort()-1);
att.setIsupdate(1);
AttSchedule attw = attsch.get(dk.getSort()-2);
attw.setIsupdate(0);
}
//全部为 1 时
if(bccs == bc && b.before(d)) {
if(bccs == bc && b.before(d) && lcdkgb) {
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)
......@@ -2453,25 +2518,41 @@ public class ClockInController {
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
if(dajllist_.size() > 0) {
for(KqglAssoDkjl ddk : dajllist_) {
BeanUtil.copyProperties(ddk, dkjl,"attdate","bcid","remarks","userId","attime","dkmxid","commentary","punchequipment","punchmode");
for(int i=1;i<=dajllist_.size();i++){
for(KqglAssoDkjl ddk : dajllist_) {
BeanUtil.copyProperties(ddk, dkjl,"attdate","bcid","remarks","userId","attime","dkmxid","commentary","punchequipment","punchmode");
}
AttSchedule ast = AttSchedule.builder().build();
ast.setId(0);
ast.setIsdk(1);
ast.setDajl(dkjl);
ast.setSort(i);
attsch.add(ast);
attdate.setAttsch(attsch);
}
KqglAssoDkjl dkjj_ = KqglAssoDkjl.builder().build();
AttSchedule ast_ = AttSchedule.builder().build();
ast_.setId(0);
ast_.setIsdk(0);
ast_.setDajl(dkjj_);
ast_.setSort(dajllist_.size() + 1);
attsch.add(ast_);
attdate.setAttsch(attsch);
}else {
KqglAssoDkjl dkjj = KqglAssoDkjl.builder().build();
AttSchedule ast = AttSchedule.builder().build();
ast.setId(0);
ast.setIsdk(1);
ast.setDajl(dkjl);
ast.setIsdk(0);
ast.setDajl(dkjj);
ast.setSort(1);
attsch.add(ast);
attdate.setAttsch(attsch);
}
KqglAssoDkjl dkjj = KqglAssoDkjl.builder().build();
AttSchedule ast = AttSchedule.builder().build();
ast.setId(0);
ast.setIsdk(0);
ast.setDajl(dkjj);
attsch.add(ast);
attdate.setAttsch(attsch);
}
//外勤 true:开 false:关
......
......@@ -118,10 +118,10 @@ public class AttendanceTaskTiming{
//typeid:1-员工 2-考勤组
// @Scheduled(cron = "0 37 18 * * ?") // 测试:5秒执行一次 0 0 19 * * ?
// @Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(cron = "0 47 8 * * ?")
@Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行
// @Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行
public void AttendanceTask() throws ParseException {
// boolean implement = false;
......
......@@ -116,13 +116,15 @@ public class SpmkServiceImpl implements SpmkService{
SpmkExecutor exe= null;
SpmkApproveExecuteRecord exere = SpmkApproveExecuteRecord.builder().build()
.selectOne(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().select(SpmkApproveExecuteRecord::getId).eq(SpmkApproveExecuteRecord::getApproveSummaryId , sum.getId()));
.selectOne(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().select(SpmkApproveExecuteRecord::getId).eq(SpmkApproveExecuteRecord::getApproveSummaryId , sum.getId())
.eq(SpmkApproveExecuteRecord::getSts, 1));
if(exere != null) {
exe = SpmkExecutor.builder().build().selectOne(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, exere.getId()));
}
if(exe != null) {
adD.setExecuteEmpNum(exe.getEmpNum());
adD.setExecuteSts(exe.getSts());
}
}
......
......@@ -48,5 +48,7 @@ public class SpmkApproveDetailDto {
private Integer sts;
private Integer executeEmpNum;//当前审批中 当前执行人的id
private Integer executeSts;
}
......@@ -83,7 +83,7 @@
where dkjl.attime &gt;= #{start}
and dkjl.attime &lt;= #{end}
and dkjl.user_id = #{userId,jdbcType=INTEGER}
and dkjl.status != 0
and dkjl.status not in (0,2)
</select>
<!--
......
......@@ -7,6 +7,7 @@
<id column="id" property="id" />
<result column="key_code" property="keyCode" />
<result column="vlaue" property="vlaue" />
<result column="datatime" property="datatime" />
</resultMap>
<sql id="Base_Column_List">
......
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