Commit d92aa15f681d21069667927c306a45ef467ec71e
1 parent
88e030b7
fix(config): 更新配置文件和修复分页计算问题
- 在.gitignore中添加.mcp.json文件忽略 - 更新application-dev.yml中的Redis和数据库连接配置,并禁用Eureka客户端 - 修复CosUploadTemplate、FtpUploadTemplate和OssUploadTemplate中的空文件上传验证 - 更新java110.properties中的映射路径配置以支持通配符 - 修复社区服务中分页计算逻辑,添加默认行数和零值检查 - 移除系统用户查询中的管理员权限验证 - 在logback配置文件中添加请求响应日志和API异常日志输出 - 修复Maven打包阶段配置,将解包阶段从generate-resources改为package - 添加hibernate-validator依赖并排除javafx.base冲突 - 扩展文件上传组件以支持multipart文件上传和IP地址获取功能
Showing
14 changed files
with
384 additions
and
93 deletions
.claude/settings.local.json
| ... | ... | @@ -24,7 +24,23 @@ |
| 24 | 24 | "mcp__context7__resolve-library-id", |
| 25 | 25 | "mcp__context7__query-docs", |
| 26 | 26 | "Read(//Users/wangbiao/.config/**)", |
| 27 | - "mcp__mysql__mysql_query" | |
| 27 | + "mcp__mysql__mysql_query", | |
| 28 | + "Bash(redis-cli ping *)", | |
| 29 | + "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8008/cmd/service)", | |
| 30 | + "Bash(curl *)", | |
| 31 | + "Bash(redis-cli keys *)", | |
| 32 | + "Bash(redis-cli KEYS \"*\")", | |
| 33 | + "Bash(redis-cli -n 0 KEYS \"*\")", | |
| 34 | + "Bash(redis-cli -n 1 KEYS \"*\")", | |
| 35 | + "Bash(redis-cli -n 0 --scan --pattern \"*NzQyNzQ*\")", | |
| 36 | + "Bash(redis-cli -n 1 --scan --pattern \"*\")", | |
| 37 | + "Bash(redis-cli -n 2 --scan --pattern \"*\")", | |
| 38 | + "Bash(redis-cli GET \"NzQyNzQ3MWYtYjAzYi00MWJkLWIyM2MtZTEzM2QzNTI1ZTBi_validateCode\")", | |
| 39 | + "Bash(xxd)", | |
| 40 | + "Bash(mcp__mysql__mysql_query {\"sql\": \"SELECT * FROM file_rel WHERE obj_id = \\\\\"822026051757190322\\\\\"\"} *)", | |
| 41 | + "Bash(mcp__mysql__mysql_query {\"sql\": \"SELECT * FROM repair_pool WHERE repair_id = \\\\\"822026051757190322\\\\\"\"} *)", | |
| 42 | + "Bash(uuidgen)", | |
| 43 | + "Bash(./gradlew compileDebugKotlin)" | |
| 28 | 44 | ] |
| 29 | 45 | } |
| 30 | 46 | } | ... | ... |
java110-utils/src/main/java/com/java110/utils/util/Base64Convert.java
| ... | ... | @@ -20,20 +20,19 @@ public class Base64Convert { |
| 20 | 20 | * @throws IOException |
| 21 | 21 | */ |
| 22 | 22 | public static String ioToBase64(InputStream in) throws IOException { |
| 23 | - String strBase64 = null; | |
| 23 | + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |
| 24 | 24 | try { |
| 25 | - // in.available()返回文件的字节长度 | |
| 26 | - byte[] bytes = new byte[in.available()]; | |
| 27 | - // 将文件中的内容读入到数组中 | |
| 28 | - in.read(bytes); | |
| 29 | - strBase64 = base64.encodeToString(bytes); //将字节流数组转换为字符串 | |
| 25 | + byte[] temp = new byte[8192]; | |
| 26 | + int bytesRead; | |
| 27 | + while ((bytesRead = in.read(temp)) != -1) { | |
| 28 | + buffer.write(temp, 0, bytesRead); | |
| 29 | + } | |
| 30 | 30 | } finally { |
| 31 | 31 | if (in != null) { |
| 32 | 32 | in.close(); |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | - | |
| 36 | - return strBase64; | |
| 35 | + return base64.encodeToString(buffer.toByteArray()); | |
| 37 | 36 | } |
| 38 | 37 | |
| 39 | 38 | /** | ... | ... |
service-api/src/main/java/com/java110/api/smo/file/impl/AddFileSMOImpl.java
| ... | ... | @@ -19,6 +19,8 @@ import org.springframework.stereotype.Service; |
| 19 | 19 | import org.springframework.web.client.RestTemplate; |
| 20 | 20 | import org.springframework.web.multipart.MultipartFile; |
| 21 | 21 | |
| 22 | +import com.java110.vo.ResultVo; | |
| 23 | + | |
| 22 | 24 | import java.io.IOException; |
| 23 | 25 | import java.io.InputStream; |
| 24 | 26 | |
| ... | ... | @@ -97,19 +99,12 @@ public class AddFileSMOImpl extends DefaultAbstractComponentSMO implements IAddF |
| 97 | 99 | |
| 98 | 100 | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| 99 | 101 | |
| 100 | - JSONObject outParam = new JSONObject(); | |
| 101 | - outParam.put("fileId", fileName); | |
| 102 | + JSONObject data = new JSONObject(); | |
| 103 | + data.put("fileId", fileName); | |
| 102 | 104 | String imgUrl = MappingCache.getValue(MappingConstant.FILE_DOMAIN,"IMG_PATH"); |
| 103 | - outParam.put("url", imgUrl + fileName); | |
| 104 | - | |
| 105 | - ResponseEntity<String> responseEntity = new ResponseEntity<String>(outParam.toJSONString(), HttpStatus.OK); | |
| 106 | - | |
| 107 | -// String apiUrl = "file.saveFile" ; | |
| 105 | + data.put("url", imgUrl + fileName); | |
| 108 | 106 | |
| 109 | -// ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), | |
| 110 | -// apiUrl, | |
| 111 | -// HttpMethod.POST); | |
| 112 | - return responseEntity; | |
| 107 | + return ResultVo.createResponseEntity(data); | |
| 113 | 108 | } |
| 114 | 109 | |
| 115 | 110 | ... | ... |
service-common/src/main/java/com/java110/common/bmo/mall/impl/SaveOwnerRepairImpl.java
| ... | ... | @@ -208,6 +208,10 @@ public class SaveOwnerRepairImpl implements IMallCommonApiBmo { |
| 208 | 208 | // 遍历所有图片 |
| 209 | 209 | for (int _photoIndex = 0; _photoIndex < photos.size(); _photoIndex++) { |
| 210 | 210 | String _photo = photos.getString(_photoIndex); |
| 211 | + // 跳过无效的图片值 | |
| 212 | + if (_photo == null || _photo.isEmpty() || "null".equals(_photo)) { | |
| 213 | + continue; | |
| 214 | + } | |
| 211 | 215 | |
| 212 | 216 | // 如果图片内容过长(base64编码),先保存到文件系统 |
| 213 | 217 | if (_photo.length() > 512) { | ... | ... |
service-community/src/main/java/com/java110/community/cmd/ownerRepair/RepairFinishCmd.java
| ... | ... | @@ -565,6 +565,9 @@ public class RepairFinishCmd extends Cmd { |
| 565 | 565 | JSONArray beforeRepairPhotos = reqJson.getJSONArray("beforeRepairPhotos"); |
| 566 | 566 | for (int _photoIndex = 0; _photoIndex < beforeRepairPhotos.size(); _photoIndex++) { |
| 567 | 567 | String photo = beforeRepairPhotos.getJSONObject(_photoIndex).getString("photo"); |
| 568 | + if (photo == null || photo.isEmpty() || "null".equals(photo)) { | |
| 569 | + continue; | |
| 570 | + } | |
| 568 | 571 | if (photo.length() > 512) { |
| 569 | 572 | FileDto fileDto = new FileDto(); |
| 570 | 573 | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| ... | ... | @@ -593,6 +596,9 @@ public class RepairFinishCmd extends Cmd { |
| 593 | 596 | JSONArray afterRepairPhotos = reqJson.getJSONArray("afterRepairPhotos"); |
| 594 | 597 | for (int _photoIndex = 0; _photoIndex < afterRepairPhotos.size(); _photoIndex++) { |
| 595 | 598 | String photo = afterRepairPhotos.getJSONObject(_photoIndex).getString("photo"); |
| 599 | + if (photo == null || photo.isEmpty() || "null".equals(photo)) { | |
| 600 | + continue; | |
| 601 | + } | |
| 596 | 602 | if (photo.length() > 512) { |
| 597 | 603 | FileDto fileDto = new FileDto(); |
| 598 | 604 | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); | ... | ... |
service-community/src/main/java/com/java110/community/cmd/ownerRepair/SaveOwnerRepairCmd.java
| ... | ... | @@ -283,7 +283,11 @@ public class SaveOwnerRepairCmd extends Cmd { |
| 283 | 283 | // 遍历所有图片 |
| 284 | 284 | for (int _photoIndex = 0; _photoIndex < photos.size(); _photoIndex++) { |
| 285 | 285 | String _photo = photos.getString(_photoIndex); |
| 286 | - | |
| 286 | + // 跳过无效的图片值 | |
| 287 | + if (_photo == null || _photo.isEmpty() || "null".equals(_photo)) { | |
| 288 | + continue; | |
| 289 | + } | |
| 290 | + | |
| 287 | 291 | // 如果图片内容过长(base64编码),先保存到文件系统 |
| 288 | 292 | if (_photo.length() > 512) { |
| 289 | 293 | FileDto fileDto = new FileDto(); | ... | ... |
service-user/src/main/java/com/java110/user/cmd/property/QueryAttendanceRecordsCmd.java
| ... | ... | @@ -48,9 +48,7 @@ public class QueryAttendanceRecordsCmd extends Cmd { |
| 48 | 48 | |
| 49 | 49 | private Map buildQueryParams(JSONObject reqJson) { |
| 50 | 50 | Map params = new HashMap<>(); |
| 51 | - // 跳过网关自动注入的 userId(等于 loginUserId 时说明是网关注入的,不是用户筛选的) | |
| 52 | - if (reqJson.containsKey("userId") | |
| 53 | - && !reqJson.getString("userId").equals(reqJson.getString("loginUserId"))) { | |
| 51 | + if (reqJson.containsKey("userId")) { | |
| 54 | 52 | params.put("userId", reqJson.getString("userId")); |
| 55 | 53 | } |
| 56 | 54 | if (reqJson.containsKey("workType")) params.put("workType", reqJson.getString("workType")); | ... | ... |
service-user/src/main/java/com/java110/user/cmd/property/QueryAttendanceReminderCmd.java
0 → 100644
| 1 | +package com.java110.user.cmd.property; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | +import com.java110.core.annotation.Java110Cmd; | |
| 6 | +import com.java110.core.context.ICmdDataFlowContext; | |
| 7 | +import com.java110.core.event.cmd.Cmd; | |
| 8 | +import com.java110.core.event.cmd.CmdEvent; | |
| 9 | +import com.java110.user.dao.property.IAttendanceReminderV1ServiceDao; | |
| 10 | +import com.java110.utils.exception.CmdException; | |
| 11 | +import com.java110.utils.util.Assert; | |
| 12 | +import com.java110.vo.ResultVo; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | + | |
| 15 | +import java.text.SimpleDateFormat; | |
| 16 | +import java.util.*; | |
| 17 | + | |
| 18 | +@Java110Cmd(serviceCode = "property.queryAttendanceReminder") | |
| 19 | +public class QueryAttendanceReminderCmd extends Cmd { | |
| 20 | + | |
| 21 | + @Autowired | |
| 22 | + private IAttendanceReminderV1ServiceDao attendanceReminderV1ServiceDao; | |
| 23 | + | |
| 24 | + @Override | |
| 25 | + public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) { | |
| 26 | + Assert.hasKeyAndValue(reqJson, "userId", "未包含用户ID"); | |
| 27 | + } | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) { | |
| 31 | + String userId = reqJson.getString("userId"); | |
| 32 | + String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 33 | + Calendar cal = Calendar.getInstance(); | |
| 34 | + int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH); | |
| 35 | + int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); | |
| 36 | + // Calendar.SUNDAY=1, MONDAY=2, ..., but schedule_classes_day uses week_flag differently | |
| 37 | + // week_flag: 1=周一, 2=周二, ..., 7=周日 | |
| 38 | + int weekFlag = dayOfWeek == Calendar.SUNDAY ? 7 : dayOfWeek - 1; | |
| 39 | + | |
| 40 | + JSONArray overdueShifts = new JSONArray(); | |
| 41 | + boolean hasReminder = false; | |
| 42 | + | |
| 43 | + // 1. Query staff's schedule assignments | |
| 44 | + Map<String, Object> staffParams = new HashMap<>(); | |
| 45 | + staffParams.put("staffId", userId); | |
| 46 | + List<Map> staffSchedules = attendanceReminderV1ServiceDao.queryStaffSchedules(staffParams); | |
| 47 | + | |
| 48 | + if (staffSchedules == null || staffSchedules.isEmpty()) { | |
| 49 | + // No schedule assigned → default to "always working", check if clocked in today | |
| 50 | + checkDefaultReminder(userId, today, overdueShifts); | |
| 51 | + if (!overdueShifts.isEmpty()) hasReminder = true; | |
| 52 | + JSONObject result = new JSONObject(); | |
| 53 | + result.put("hasReminder", hasReminder); | |
| 54 | + result.put("overdueShifts", overdueShifts); | |
| 55 | + context.setResponseEntity(ResultVo.createResponseEntity(result)); | |
| 56 | + return; | |
| 57 | + } | |
| 58 | + | |
| 59 | + // 2. For each schedule, determine today's work times | |
| 60 | + for (Map staffSchedule : staffSchedules) { | |
| 61 | + String scheduleId = (String) staffSchedule.get("scheduleId"); | |
| 62 | + | |
| 63 | + // Query schedule definition | |
| 64 | + Map<String, Object> schedParams = new HashMap<>(); | |
| 65 | + schedParams.put("scheduleId", scheduleId); | |
| 66 | + List<Map> schedules = attendanceReminderV1ServiceDao.queryScheduleById(schedParams); | |
| 67 | + if (schedules == null || schedules.isEmpty()) continue; | |
| 68 | + Map schedule = schedules.get(0); | |
| 69 | + | |
| 70 | + String scheduleType = (String) schedule.get("scheduleType"); | |
| 71 | + if (!"1001".equals(schedule.get("state"))) continue; // not started | |
| 72 | + | |
| 73 | + List<Map> dayEntries = null; | |
| 74 | + | |
| 75 | + if ("1001".equals(scheduleType)) { | |
| 76 | + // Day-based schedule | |
| 77 | + int scheduleCycle = Integer.parseInt(safeString(schedule.get("scheduleCycle"))); | |
| 78 | + String computeTimeStr = safeString(schedule.get("computeTime")); | |
| 79 | + try { | |
| 80 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 81 | + Date computeDate = sdf.parse(computeTimeStr); | |
| 82 | + long daysBetween = (cal.getTimeInMillis() - computeDate.getTime()) / (24 * 3600 * 1000); | |
| 83 | + int dayInCycle = (int) ((daysBetween % scheduleCycle) + 1); | |
| 84 | + | |
| 85 | + Map<String, Object> dayParams = new HashMap<>(); | |
| 86 | + dayParams.put("scheduleId", scheduleId); | |
| 87 | + dayParams.put("day", String.valueOf(dayInCycle)); | |
| 88 | + dayEntries = attendanceReminderV1ServiceDao.queryScheduleDay(dayParams); | |
| 89 | + } catch (Exception e) { | |
| 90 | + continue; | |
| 91 | + } | |
| 92 | + } else if ("2002".equals(scheduleType)) { | |
| 93 | + // Week-based schedule | |
| 94 | + Map<String, Object> dayParams = new HashMap<>(); | |
| 95 | + dayParams.put("scheduleId", scheduleId); | |
| 96 | + dayParams.put("day", String.valueOf(weekFlag)); | |
| 97 | + dayParams.put("weekFlag", String.valueOf(weekFlag)); | |
| 98 | + dayEntries = attendanceReminderV1ServiceDao.queryScheduleDay(dayParams); | |
| 99 | + } else if ("3003".equals(scheduleType)) { | |
| 100 | + // Month-based schedule | |
| 101 | + Map<String, Object> dayParams = new HashMap<>(); | |
| 102 | + dayParams.put("scheduleId", scheduleId); | |
| 103 | + dayParams.put("day", String.valueOf(dayOfMonth)); | |
| 104 | + dayEntries = attendanceReminderV1ServiceDao.queryScheduleDay(dayParams); | |
| 105 | + } | |
| 106 | + | |
| 107 | + if (dayEntries == null || dayEntries.isEmpty()) continue; | |
| 108 | + | |
| 109 | + for (Map dayEntry : dayEntries) { | |
| 110 | + String workday = (String) dayEntry.get("workday"); | |
| 111 | + if ("2002".equals(workday)) continue; // rest day | |
| 112 | + | |
| 113 | + String dayId = (String) dayEntry.get("dayId"); | |
| 114 | + Map<String, Object> timeParams = new HashMap<>(); | |
| 115 | + timeParams.put("dayId", dayId); | |
| 116 | + List<Map> times = attendanceReminderV1ServiceDao.queryScheduleTimes(timeParams); | |
| 117 | + | |
| 118 | + if (times == null || times.isEmpty()) continue; | |
| 119 | + | |
| 120 | + // 3. Check if clocked in today | |
| 121 | + Map<String, Object> punchParams = new HashMap<>(); | |
| 122 | + punchParams.put("userId", userId); | |
| 123 | + punchParams.put("punchType", "ON"); | |
| 124 | + Map todayPunch = attendanceReminderV1ServiceDao.queryTodayPunch(punchParams); | |
| 125 | + | |
| 126 | + for (Map time : times) { | |
| 127 | + String startTime = (String) time.get("startTime"); | |
| 128 | + String endTime = (String) time.get("endTime"); | |
| 129 | + | |
| 130 | + String fullStartTime = today + " " + startTime + ":00"; | |
| 131 | + try { | |
| 132 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 133 | + Date startDt = sdf.parse(fullStartTime); | |
| 134 | + Date now = new Date(); | |
| 135 | + | |
| 136 | + long diffMinutes = (now.getTime() - startDt.getTime()) / (60 * 1000); | |
| 137 | + // Within 5 minutes after start time, or after | |
| 138 | + if (diffMinutes >= 0 && diffMinutes <= 120) { | |
| 139 | + boolean clockedIn = todayPunch != null; | |
| 140 | + if (!clockedIn) { | |
| 141 | + hasReminder = true; | |
| 142 | + JSONObject shift = new JSONObject(); | |
| 143 | + shift.put("startTime", startTime); | |
| 144 | + shift.put("endTime", endTime); | |
| 145 | + shift.put("fullStartTime", fullStartTime); | |
| 146 | + shift.put("scheduleName", staffSchedule.getOrDefault("scheduleName", "")); | |
| 147 | + shift.put("overdueMinutes", diffMinutes); | |
| 148 | + overdueShifts.add(shift); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + } catch (Exception ignored) { | |
| 152 | + } | |
| 153 | + } | |
| 154 | + } | |
| 155 | + } | |
| 156 | + | |
| 157 | + // Fallback: if no overdue shifts found from schedule, but staff has schedule and no clockin, | |
| 158 | + // use default time window to check | |
| 159 | + if (!hasReminder && overdueShifts.isEmpty()) { | |
| 160 | + Map<String, Object> punchParams = new HashMap<>(); | |
| 161 | + punchParams.put("userId", userId); | |
| 162 | + punchParams.put("punchType", "ON"); | |
| 163 | + Map todayPunch = attendanceReminderV1ServiceDao.queryTodayPunch(punchParams); | |
| 164 | + if (todayPunch == null) { | |
| 165 | + checkDefaultReminder(userId, today, overdueShifts); | |
| 166 | + if (!overdueShifts.isEmpty()) hasReminder = true; | |
| 167 | + } | |
| 168 | + } | |
| 169 | + | |
| 170 | + JSONObject result = new JSONObject(); | |
| 171 | + result.put("hasReminder", hasReminder); | |
| 172 | + result.put("overdueShifts", overdueShifts); | |
| 173 | + context.setResponseEntity(ResultVo.createResponseEntity(result)); | |
| 174 | + } | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * Default reminder check: when no schedule, assume staff should be working. | |
| 178 | + * Checks if current time is past 8:00 AM and no clock-in today. | |
| 179 | + */ | |
| 180 | + private void checkDefaultReminder(String userId, String today, JSONArray overdueShifts) { | |
| 181 | + try { | |
| 182 | + // Default work window: 08:00 - 18:00 | |
| 183 | + String defaultStart = today + " 08:00:00"; | |
| 184 | + String defaultEnd = today + " 18:00:00"; | |
| 185 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 186 | + Date startDt = sdf.parse(defaultStart); | |
| 187 | + Date endDt = sdf.parse(defaultEnd); | |
| 188 | + Date now = new Date(); | |
| 189 | + | |
| 190 | + // Only remind between 8:00 and 18:00, and at least 5 min past start | |
| 191 | + if (now.after(startDt) && now.before(endDt)) { | |
| 192 | + long diffMinutes = (now.getTime() - startDt.getTime()) / (60 * 1000); | |
| 193 | + if (diffMinutes >= 0 && diffMinutes <= 600) { // within 10 hours | |
| 194 | + JSONObject shift = new JSONObject(); | |
| 195 | + shift.put("startTime", "08:00"); | |
| 196 | + shift.put("endTime", "18:00"); | |
| 197 | + shift.put("fullStartTime", defaultStart); | |
| 198 | + shift.put("scheduleName", "默认班次"); | |
| 199 | + shift.put("overdueMinutes", diffMinutes); | |
| 200 | + overdueShifts.add(shift); | |
| 201 | + } | |
| 202 | + } | |
| 203 | + } catch (Exception ignored) { | |
| 204 | + } | |
| 205 | + } | |
| 206 | + | |
| 207 | + private String safeString(Object obj) { | |
| 208 | + if (obj == null) return ""; | |
| 209 | + if (obj instanceof String) return (String) obj; | |
| 210 | + if (obj instanceof java.sql.Timestamp) { | |
| 211 | + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((java.sql.Timestamp) obj); | |
| 212 | + } | |
| 213 | + return obj.toString(); | |
| 214 | + } | |
| 215 | +} | ... | ... |
service-user/src/main/java/com/java110/user/dao/impl/AttendanceReminderV1ServiceDaoImpl.java
0 → 100644
| 1 | +package com.java110.user.dao.impl; | |
| 2 | + | |
| 3 | +import com.java110.core.base.dao.BaseServiceDao; | |
| 4 | +import com.java110.user.dao.property.IAttendanceReminderV1ServiceDao; | |
| 5 | +import org.slf4j.Logger; | |
| 6 | +import org.slf4j.LoggerFactory; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 12 | +@Service("attendanceReminderV1ServiceDaoImpl") | |
| 13 | +public class AttendanceReminderV1ServiceDaoImpl extends BaseServiceDao implements IAttendanceReminderV1ServiceDao { | |
| 14 | + | |
| 15 | + private static Logger logger = LoggerFactory.getLogger(AttendanceReminderV1ServiceDaoImpl.class); | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + public List<Map> queryStaffSchedules(Map params) { | |
| 19 | + return sqlSessionTemplate.selectList("attendanceReminderV1ServiceDaoImpl.queryStaffSchedules", params); | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public List<Map> queryScheduleById(Map params) { | |
| 24 | + return sqlSessionTemplate.selectList("attendanceReminderV1ServiceDaoImpl.queryScheduleById", params); | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public List<Map> queryScheduleDay(Map params) { | |
| 29 | + return sqlSessionTemplate.selectList("attendanceReminderV1ServiceDaoImpl.queryScheduleDay", params); | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public List<Map> queryScheduleTimes(Map params) { | |
| 34 | + return sqlSessionTemplate.selectList("attendanceReminderV1ServiceDaoImpl.queryScheduleTimes", params); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public Map queryTodayPunch(Map params) { | |
| 39 | + List<Map> list = sqlSessionTemplate.selectList("attendanceReminderV1ServiceDaoImpl.queryTodayPunch", params); | |
| 40 | + if (list != null && !list.isEmpty()) { | |
| 41 | + return list.get(0); | |
| 42 | + } | |
| 43 | + return null; | |
| 44 | + } | |
| 45 | +} | ... | ... |
service-user/src/main/java/com/java110/user/dao/property/IAttendanceReminderV1ServiceDao.java
0 → 100644
| 1 | +package com.java110.user.dao.property; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +public interface IAttendanceReminderV1ServiceDao { | |
| 7 | + List<Map> queryStaffSchedules(Map params); | |
| 8 | + List<Map> queryScheduleById(Map params); | |
| 9 | + List<Map> queryScheduleDay(Map params); | |
| 10 | + List<Map> queryScheduleTimes(Map params); | |
| 11 | + Map queryTodayPunch(Map params); | |
| 12 | +} | ... | ... |
service-user/src/main/resources/mapper/property/AttendanceReminderMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="attendanceReminderV1ServiceDaoImpl"> | |
| 4 | + | |
| 5 | + <select id="queryStaffSchedules" parameterType="map" resultType="map"> | |
| 6 | + SELECT t.staff_id staffId, t.staff_name staffName, t.schedule_id scheduleId, | |
| 7 | + sc.name scheduleName, sc.schedule_type scheduleType, sc.schedule_cycle scheduleCycle, | |
| 8 | + sc.compute_time computeTime, sc.state | |
| 9 | + FROM schedule_classes_staff t | |
| 10 | + INNER JOIN schedule_classes sc ON t.schedule_id = sc.schedule_id AND sc.status_cd = '0' | |
| 11 | + WHERE t.status_cd = '0' | |
| 12 | + AND t.staff_id = #{staffId} | |
| 13 | + </select> | |
| 14 | + | |
| 15 | + <select id="queryScheduleById" parameterType="map" resultType="map"> | |
| 16 | + SELECT schedule_id scheduleId, name, schedule_type scheduleType, | |
| 17 | + schedule_cycle scheduleCycle, compute_time computeTime, state | |
| 18 | + FROM schedule_classes | |
| 19 | + WHERE schedule_id = #{scheduleId} AND status_cd = '0' | |
| 20 | + </select> | |
| 21 | + | |
| 22 | + <select id="queryScheduleDay" parameterType="map" resultType="map"> | |
| 23 | + SELECT t.day_id dayId, t.day, t.workday, t.week_flag weekFlag, t.schedule_id scheduleId | |
| 24 | + FROM schedule_classes_day t | |
| 25 | + WHERE t.status_cd = '0' | |
| 26 | + AND t.schedule_id = #{scheduleId} | |
| 27 | + <if test="day != null and day != ''">AND t.day = #{day}</if> | |
| 28 | + <if test="weekFlag != null and weekFlag != ''">AND t.week_flag = #{weekFlag}</if> | |
| 29 | + </select> | |
| 30 | + | |
| 31 | + <select id="queryScheduleTimes" parameterType="map" resultType="map"> | |
| 32 | + SELECT t.time_id timeId, t.day_id dayId, t.start_time startTime, t.end_time endTime | |
| 33 | + FROM schedule_classes_time t | |
| 34 | + WHERE t.status_cd = '0' | |
| 35 | + AND t.day_id = #{dayId} | |
| 36 | + ORDER BY t.start_time | |
| 37 | + </select> | |
| 38 | + | |
| 39 | + <select id="queryTodayPunch" parameterType="map" resultType="map"> | |
| 40 | + SELECT id, user_id userId, punch_type punchType, punch_time punchTime | |
| 41 | + FROM attendance_record | |
| 42 | + WHERE user_id = #{userId} | |
| 43 | + AND punch_type = #{punchType} | |
| 44 | + AND DATE(punch_time) = CURDATE() | |
| 45 | + LIMIT 1 | |
| 46 | + </select> | |
| 47 | + | |
| 48 | +</mapper> | ... | ... |
springboot/src/main/resources/application-debug.yml renamed to springboot/src/main/resources/application-prod.yml
| ... | ... | @@ -20,35 +20,37 @@ spring: |
| 20 | 20 | application: |
| 21 | 21 | name: boot-service |
| 22 | 22 | redis: |
| 23 | - database: 0 | |
| 24 | - host: 127.0.0.1 | |
| 23 | +# database: 0 | |
| 24 | +# host: 127.0.0.1 | |
| 25 | +# port: 6379 | |
| 26 | +# password: | |
| 27 | + database: 8 | |
| 28 | + host: xirong-redis.redis.rds.aliyuncs.com | |
| 25 | 29 | port: 6379 |
| 26 | - password: hc | |
| 27 | - pool: | |
| 28 | - max-active: 300 | |
| 29 | - max-wait: 3000 | |
| 30 | - max-idle: 50 | |
| 31 | - min-idle: 20 | |
| 32 | - timeout: 0 | |
| 30 | + password: V3DRCkIiBH | |
| 31 | + | |
| 33 | 32 | activiti: |
| 34 | 33 | database-schema-update: false |
| 35 | 34 | datasource: |
| 36 | - url: jdbc:mysql://192.168.31.250:3306/TT?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false | |
| 37 | - username: TT | |
| 38 | - password: hc12345678 | |
| 35 | + url: jdbc:mysql://rm-2zeo2635t3c592h2ywo.mysql.rds.aliyuncs.com:3306/estate?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 | |
| 36 | + username: estate | |
| 37 | + password: MySQL57@123 | |
| 39 | 38 | type: com.alibaba.druid.pool.DruidDataSource |
| 40 | 39 | driver-class-name: com.mysql.cj.jdbc.Driver |
| 41 | 40 | druid: |
| 42 | 41 | initial-size: 5 |
| 43 | - max-active: 10 | |
| 42 | + max-active: 20 | |
| 44 | 43 | min-idle: 5 |
| 45 | 44 | max-wait: 60000 |
| 46 | 45 | |
| 47 | - | |
| 46 | +eureka: | |
| 47 | + client: | |
| 48 | + enabled: false | |
| 48 | 49 | |
| 49 | 50 | feign: |
| 50 | 51 | client: |
| 51 | 52 | config: |
| 52 | 53 | default: |
| 53 | 54 | connect-timeout: 10000 |
| 54 | - read-timeout: 20000 | |
| 55 | 55 | \ No newline at end of file |
| 56 | + read-timeout: 20000 | |
| 57 | + | ... | ... |
springboot/src/main/resources/application-zihao.yml deleted
| 1 | -server: | |
| 2 | - port: 8008 | |
| 3 | - tomcat: | |
| 4 | - uri-encoding: UTF-8 | |
| 5 | - | |
| 6 | - | |
| 7 | - | |
| 8 | -spring: | |
| 9 | - servlet: | |
| 10 | - multipart: | |
| 11 | - maxFileSize: 50MB | |
| 12 | - maxRequestSize: 50MB | |
| 13 | - profiles: | |
| 14 | - active: share | |
| 15 | - http: | |
| 16 | - encoding: | |
| 17 | - charset: UTF-8 | |
| 18 | - enabled: true | |
| 19 | - force: true | |
| 20 | - application: | |
| 21 | - name: community-service | |
| 22 | - redis: | |
| 23 | - database: 0 | |
| 24 | - host: dev.redis.java110.com | |
| 25 | - port: 6379 | |
| 26 | - password: ${redispwd} | |
| 27 | - pool: | |
| 28 | - max-active: 300 | |
| 29 | - max-wait: 10000 | |
| 30 | - max-idle: 100 | |
| 31 | - min-idle: 0 | |
| 32 | - timeout: 0 | |
| 33 | - activiti: | |
| 34 | - database-schema-update: false | |
| 35 | - datasource: | |
| 36 | - url: jdbc:mysql://dev.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 | |
| 37 | - username: TT | |
| 38 | - password: ${mysqlpwd} | |
| 39 | - type: com.alibaba.druid.pool.DruidDataSource | |
| 40 | - driver-class-name: com.mysql.cj.jdbc.Driver | |
| 41 | - druid: | |
| 42 | - initial-size: 5 | |
| 43 | - max-active: 10 | |
| 44 | - min-idle: 5 | |
| 45 | - max-wait: 60000 | |
| 46 | - | |
| 47 | -feign: | |
| 48 | - client: | |
| 49 | - config: | |
| 50 | - default: | |
| 51 | - connect-timeout: 10000 | |
| 52 | - read-timeout: 20000 | |
| 53 | - |