修改页面 数据展示, 调整打卡不在推送公众号数据

This commit is contained in:
andy 2025-09-03 08:46:16 +08:00
parent 17b44fef1e
commit ddb19b7759
5 changed files with 47 additions and 43 deletions

View File

@ -227,7 +227,8 @@ public class KQDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
RzAttendance beforeAttendance = rzAttendanceMapper.queryNowDayAttendanceByStatisticalIdAndDate(Long.valueOf(userId),DateUtils.addDays(date, -1)); RzAttendance beforeAttendance = rzAttendanceMapper.queryNowDayAttendanceByStatisticalIdAndDate(Long.valueOf(userId),DateUtils.addDays(date, -1));
if(beforeAttendance.getWorkStartTime() != null && beforeAttendance.getWorkEndTime() == null){ if(beforeAttendance.getWorkStartTime() != null && beforeAttendance.getWorkEndTime() == null){
notBeforeEndTimeMessage = " - 昨天未打下班卡"; notBeforeEndTimeMessage = " - 昨天未打下班卡";
sendAbnormalAttendance(userId, beforeAttendance.getWorkStartTime()); //上班打卡不在推送消息, 影响消息返回, 可能引发打卡异常
// sendAbnormalAttendance(userId, beforeAttendance.getWorkStartTime());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -235,19 +236,19 @@ public class KQDeviceExchangeProcessor implements PunchTheClockStrategyExchangeP
} }
return (rzAttendanceMapper.updateRzAttendance(attendance) > 0) ? initMessage(0, "打卡成功"+notBeforeEndTimeMessage) : initMessage(1, "打卡失败"+notBeforeEndTimeMessage); return (rzAttendanceMapper.updateRzAttendance(attendance) > 0) ? initMessage(0, "打卡成功"+notBeforeEndTimeMessage) : initMessage(1, "打卡失败"+notBeforeEndTimeMessage);
} }
//
@Async // @Async
public void sendAbnormalAttendance(Long userId, Date date){ // public void sendAbnormalAttendance(Long userId, Date date){
try { // try {
SysStaff sysStaff = sysStaffMapper.selectById(userId); // SysStaff sysStaff = sysStaffMapper.selectById(userId);
if(sysStaff != null && StringUtils.isNotEmpty(sysStaff.getOpenid())){ // if(sysStaff != null && StringUtils.isNotEmpty(sysStaff.getOpenid())){
SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId()); // SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId());
sendClientService.sendAbnormalAttendance(sysDept != null ? sysDept.getDeptName() : "未知",sysStaff.getName(), "昨天下班未打卡", date, sysStaff.getOpenid()); // sendClientService.sendAbnormalAttendance(sysDept != null ? sysDept.getDeptName() : "未知",sysStaff.getName(), "昨天下班未打卡", date, sysStaff.getOpenid());
} // }
} catch (Exception e) { // } catch (Exception e) {
log.error("推送公众号打卡异常失败, 原因为: {}", e.getMessage(), e); // log.error("推送公众号打卡异常失败, 原因为: {}", e.getMessage(), e);
} // }
} // }
/*** 撤销卡 /*** 撤销卡

View File

@ -1,5 +1,8 @@
package com.evo.common.controller; package com.evo.common.controller;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.evo.attendance.service.IRzAttendanceService; import com.evo.attendance.service.IRzAttendanceService;
import com.evo.attendance.service.IRzAttendanceStatisticalService; import com.evo.attendance.service.IRzAttendanceStatisticalService;
@ -12,6 +15,10 @@ import com.evo.personnelMatters.mapper.RzOverTimeMapper;
import com.evo.restaurant.service.IRzRestaurantStatisticsService; import com.evo.restaurant.service.IRzRestaurantStatisticsService;
import com.evo.system.domain.SysStaff; import com.evo.system.domain.SysStaff;
import com.evo.system.service.ISysStaffService; import com.evo.system.service.ISysStaffService;
import com.evo.wechat.TemplateMessageUtil;
import com.evo.wechat.dto.AbnormalAttendanceTemplate;
import com.evo.wechat.dto.MessageTemplate;
import com.evo.wechat.service.GZHAccessTokenService;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -57,6 +64,10 @@ public class TestController {
private IRzAttendanceService rzAttendanceService; private IRzAttendanceService rzAttendanceService;
@Resource @Resource
private RzAttendanceDetailService rzAttendanceDetailService; private RzAttendanceDetailService rzAttendanceDetailService;
@Resource
private GZHAccessTokenService gzhAccessTokenService;
/** /**
* 清洗加班 * 清洗加班
*/ */
@ -84,31 +95,20 @@ public class TestController {
@GetMapping("/message") @GetMapping("/message")
public String message(Model model, String code) { public String message(String openid) {
System.out.println(code); AbnormalAttendanceTemplate templateData = new AbnormalAttendanceTemplate();
// String res = AccessTokenUtil.accessToken2("wx268e32962db19f5f", "84a6065165ec82862c5e03a010a6dc6c", code);
// System.out.println(res);
// JSONObject obj = JSONObject.parseObject(res);
// String openid = obj.getString("openid");
SysStaff user = new SysStaff();
user.setOpenid(code);
model.addAttribute("user", user);
//model.addAttribute("openid", openid);
// ErrorData templateData = new ErrorData();
//
// templateData.setThing1((JSONObject)JSON.toJSON(Collections.asMap("value", "研发部")));
// templateData.setThing2((JSONObject)JSON.toJSON(Collections.asMap("value", "张三")));//动态跟换车牌号
// templateData.setConst4((JSONObject)JSON.toJSON(Collections.asMap("value", "昨天下班未打卡")));//动态跟换车牌号
// templateData.setTime6((JSONObject)JSON.toJSON(Collections.asMap("value", DateUtil.format(new Date(), "yyyy年MM月dd日"))));//动态跟换车牌号
//
// MessageTemplateSendData sendData = new MessageTemplateSendData();
// sendData.setTouser(openid);
// sendData.setTemplate_id("z9sy-38K-iC5MAWHbxcxwg1c-9oNTFWeCOoy6B6zdKY");
// sendData.setData((JSONObject)JSON.toJSON(templateData));
// TemplateMessageUtil.templateMessageSend(GZHAccessTokenService.gzhAccessToken(), sendData);
return "user_info.html"; templateData.setThing1((JSONObject) JSON.toJSON(Collections.asMap("value", "研发部")));
templateData.setThing2((JSONObject)JSON.toJSON(Collections.asMap("value", "张三")));//动态跟换车牌号
templateData.setConst4((JSONObject)JSON.toJSON(Collections.asMap("value", "昨天下班未打卡")));//动态跟换车牌号
templateData.setTime6((JSONObject)JSON.toJSON(Collections.asMap("value", DateUtil.format(new Date(), "yyyy年MM月dd日"))));//动态跟换车牌号
MessageTemplate sendData = new MessageTemplate();
sendData.setTouser(openid);
sendData.setTemplate_id("z9sy-38K-iC5MAWHbxcxwg1c-9oNTFWeCOoy6B6zdKY");
sendData.setData((JSONObject)JSON.toJSON(templateData));
return TemplateMessageUtil.templateMessageSend(gzhAccessTokenService.gzhAccessToken(), sendData);
} }

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>河北伊特机械设备有限公司-提交失败</title> <title>河北伊特机械设备制造有限公司-提交失败</title>
<!-- 引入Tailwind CSS --> <!-- 引入Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<!-- 引入Font Awesome --> <!-- 引入Font Awesome -->
@ -50,7 +50,8 @@
<div class="p-6 sm:p-8"> <div class="p-6 sm:p-8">
<!-- 标题区域 --> <!-- 标题区域 -->
<div class="text-center mb-6"> <div class="text-center mb-6">
<h1 class="text-2xl font-bold text-gray-900">河北伊特机械设备有限公司考勤系统</h1> <h1 class="text-2xl font-bold text-gray-900">河北伊特机械设备制造有限公司</h1>
<h1 class="text-2xl font-bold text-gray-900">考勤系统</h1>
<h2 class="text-2xl font-bold text-gray-900">信息提交结果</h2> <h2 class="text-2xl font-bold text-gray-900">信息提交结果</h2>
</div> </div>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>河北伊特机械设备有限公司-提交成功</title> <title>河北伊特机械设备制造有限公司-提交成功</title>
<!-- 引入Tailwind CSS --> <!-- 引入Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<!-- 引入Font Awesome --> <!-- 引入Font Awesome -->
@ -41,7 +41,8 @@
<div class="p-6 sm:p-8"> <div class="p-6 sm:p-8">
<!-- 标题区域 --> <!-- 标题区域 -->
<div class="text-center mb-8"> <div class="text-center mb-8">
<h1 class="text-2xl font-bold text-gray-900">河北伊特机械设备有限公司考勤系统</h1> <h1 class="text-2xl font-bold text-gray-900">河北伊特机械设备制造有限公司</h1>
<h1 class="text-2xl font-bold text-gray-900">考勤系统</h1>
<h2 class="text-2xl font-bold text-gray-900">信息提交结果</h2> <h2 class="text-2xl font-bold text-gray-900">信息提交结果</h2>
</div> </div>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>河北伊特机械设备有限公司-用户信息完善</title> <title>河北伊特机械设备制造有限公司-用户信息完善</title>
<!-- 引入Tailwind CSS --> <!-- 引入Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<!-- 引入Font Awesome --> <!-- 引入Font Awesome -->
@ -48,7 +48,8 @@
<div class="w-full max-w-md bg-white rounded-xl shadow-lg overflow-hidden"> <div class="w-full max-w-md bg-white rounded-xl shadow-lg overflow-hidden">
<div class="p-6 sm:p-8"> <div class="p-6 sm:p-8">
<div class="text-center mb-6"> <div class="text-center mb-6">
<h1 class="text-2xl font-bold text-gray-900">河北伊特机械制造有限公司考勤系统</h1> <h1 class="text-2xl font-bold text-gray-900">河北伊特机械设备制造有限公司</h1>
<h1 class="text-2xl font-bold text-gray-900">考勤系统</h1>
<p class="mt-2 text-sm text-gray-500">请填写以下信息并提交</p> <p class="mt-2 text-sm text-gray-500">请填写以下信息并提交</p>
</div> </div>