diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index b38993c..e4bc78a 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -136,6 +136,14 @@ ${project.artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index a894fbc..b17547a 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -49,7 +49,7 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) - url: jdbc:mysql://49.233.157.185:3306/fad_oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true + url: jdbc:mysql://110.41.139.73:3306/fad_oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true username: root password: WANGyu11! # 从库数据源 @@ -57,7 +57,7 @@ spring: lazy: true type: ${spring.datasource.type} driverClassName: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://49.233.157.185:3306/fad_oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true + url: jdbc:mysql://110.41.139.73:3306/fad_oa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true username: password: # oracle: @@ -102,7 +102,7 @@ spring: spring: redis: # 地址 - host: 49.233.157.185 + host: 110.41.139.73 # 端口,默认为6379 port: 6379 # 数据库索引 diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/LaborCostData.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/LaborCostData.java index 3cd3307..58cd5ad 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/LaborCostData.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/LaborCostData.java @@ -26,6 +26,9 @@ public class LaborCostData extends BaseEntity { // 当月的所有签到信息 private List attendances; + // 小时计时长 + private Double hourWorkTime; + } diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaAttendanceVo.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaAttendanceVo.java index 3fc39fd..74d2012 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaAttendanceVo.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/domain/vo/SysOaAttendanceVo.java @@ -79,4 +79,7 @@ public class SysOaAttendanceVo extends SysOaAttendance { private String projectName; + // 小时计单个工作时间 + private Double hourWorkTimes; + } diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java index 6baed61..8634d06 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java @@ -166,9 +166,12 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService { List projectVos = new ArrayList<>(); for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) { - SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); - oaAttendanceVo.setColor(sysOaProjectVo.getColor()); - projectVos.add(sysOaProjectVo); + // 当projectId等于0时代表 当前为出差状态 + if(oaAttendanceVo.getProjectId()!=0){ + SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); + oaAttendanceVo.setColor(sysOaProjectVo.getColor()); + projectVos.add(sysOaProjectVo); + } } sysUser.setProjects(projectVos); sysUser.setAttendances(sysOaAttendanceVos); @@ -212,15 +215,19 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService { List sysOaAttendanceVos = baseMapper.selectVoListAndTime(userId, firstDay,lastDay); List projectVos = new ArrayList<>(); Double workTimes = 0.0; - + Double hourWorkTimes = 0.0; for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) { - SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); - oaAttendanceVo.setColor(sysOaProjectVo.getColor()); - oaAttendanceVo.setSysOaProjectVo(sysOaProjectVo); - oaAttendanceVo.setProjectName(sysOaProjectVo.getProjectName()); - projectVos.add(sysOaProjectVo); - workTimes+=oaAttendanceVo.getWorkTimes(); + // 出差问题解决 + if (oaAttendanceVo.getProjectId()!=0){ + SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); + oaAttendanceVo.setColor(sysOaProjectVo.getColor()); + oaAttendanceVo.setSysOaProjectVo(sysOaProjectVo); + oaAttendanceVo.setProjectName(sysOaProjectVo.getProjectName()); + projectVos.add(sysOaProjectVo); + workTimes+=oaAttendanceVo.getWorkTimes(); + hourWorkTimes += oaAttendanceVo.getHourWorkTimes(); + } } projectVos.stream().distinct().collect(Collectors.toList()); LaborCostData laborCostData = new LaborCostData(); @@ -228,6 +235,7 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService { laborCostData.setAttendances(sysOaAttendanceVos); laborCostData.setSysUser(sysUser); laborCostData.setWorkTimes(workTimes); + laborCostData.setHourWorkTime(hourWorkTimes); costDataList.add(laborCostData); } diff --git a/ruoyi-oa/src/main/resources/mapper/oa/SysOaAttendanceMapper.xml b/ruoyi-oa/src/main/resources/mapper/oa/SysOaAttendanceMapper.xml index 35a39cf..ab77bb2 100644 --- a/ruoyi-oa/src/main/resources/mapper/oa/SysOaAttendanceMapper.xml +++ b/ruoyi-oa/src/main/resources/mapper/oa/SysOaAttendanceMapper.xml @@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -37,11 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ANY_VALUE(remark), ANY_VALUE(del_flag), count(*) as count, - sum(day_length) as work_times + sum(day_length) as work_times, + sum(hour) as hour_work_times from sys_oa_attendance soa where user_id = #{userId} and #{lastDay} > create_time and create_time > #{firstDay} + and del_flag = '0' group by soa.project_id diff --git a/ruoyi-ui/src/views/oa/attendance/index.vue b/ruoyi-ui/src/views/oa/attendance/index.vue index bb535e0..59bcb3e 100644 --- a/ruoyi-ui/src/views/oa/attendance/index.vue +++ b/ruoyi-ui/src/views/oa/attendance/index.vue @@ -3,7 +3,7 @@ - 签到表 + 签到表 @@ -17,62 +17,66 @@ - +
{{ item.nickName }}{{item.attendances.length>0 && item.attendances.findIndex(i=>i.attendanceDay === index2+1) >-1 && item.attendances[item.attendances.findIndex(i=>i.attendanceDay === index2+1)].projectId===0?'出差':''}}
-
+
- 操作栏 - - 取消操作 - - -
- 项目列表 - + 操作栏 + + 取消操作 + 出差 + + +
+ 项目列表 + +
+
+ + {{ item.projectName }} + + +
+
+ +
+ 工作时长 +
+ + 天计 + 小时计 +
-
- - {{ item.projectName }} - - -
- - -
- 工作时长 -
- - 天计 - 小时计 - -
- - - - - - - -
-
-
+ + + + + + +
+
+
@@ -199,6 +203,9 @@ prop="projectName" label="项目名" width="180"> + + +
@@ -310,16 +322,41 @@ export default { methods: { + // 出差标记 + toTravel(){ + if (!this.selectAll) { + this.form = { + projectId: 0, + userId: this.selectUser.userId, + attendanceDay: this.selectIndex, + } + addOaAttendance(this.form).then(res => { + this.getList() + this.selectUser = this.selectArrayIndex >= this.userList.length - 1 ? this.selectUser : this.userList[this.selectArrayIndex + 1] + + }) + } else { + this.form = { + projectId: 0, + attendanceDay: this.selectIndex, + } + // 集体赋予状态 + addBatchOaAttendance(this.form).then(res => { + this.getList() + }) + } + }, + // 删除签到 - removeAttendance(){ - if (!this.selectAll){ - const attendanceId = this.selectUser.attendances.find(item=>item.attendanceDay===this.selectIndex).id - delOaAttendance(attendanceId).then(res=>{ + removeAttendance() { + if (!this.selectAll) { + const attendanceId = this.selectUser.attendances.find(item => item.attendanceDay === this.selectIndex).id + delOaAttendance(attendanceId).then(res => { this.$modal.msgSuccess("操作成功"); this.getList(); }) - }else{ - delOaAttendanceAll(this.selectIndex).then(res=>{ + } else { + delOaAttendanceAll(this.selectIndex).then(res => { this.$modal.msgSuccess("操作成功"); this.getList(); }) @@ -368,16 +405,17 @@ export default { listOaAttendance(this.queryParams).then(res => { this.userList = res.data; this.total = res.total; + this.loading = false; }); listProject(this.projectQueryParams).then(response => { this.projectList = response.rows; this.total = response.total; - this.loading = false; + }) }, changeItemColor(item) { - updateProject(item).then(res=>{ + updateProject(item).then(res => { this.getList(); }) @@ -465,7 +503,8 @@ table { border-bottom: #cccccc 1px dashed; margin: 5px 0; } -.color-picker{ + +.color-picker { font-size: 16px; width: 30%;