This commit is contained in:
2024-12-04 13:45:45 +08:00
parent b443c006a7
commit 9fd16697d5
7 changed files with 135 additions and 71 deletions

View File

@@ -136,6 +136,14 @@
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>

View File

@@ -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
# 数据库索引

View File

@@ -26,6 +26,9 @@ public class LaborCostData extends BaseEntity {
// 当月的所有签到信息
private List<SysOaAttendanceVo> attendances;
// 小时计时长
private Double hourWorkTime;
}

View File

@@ -79,4 +79,7 @@ public class SysOaAttendanceVo extends SysOaAttendance {
private String projectName;
// 小时计单个工作时间
private Double hourWorkTimes;
}

View File

@@ -166,9 +166,12 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
List<SysOaProjectVo> 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<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.selectVoListAndTime(userId, firstDay,lastDay);
List<SysOaProjectVo> 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);
}

View File

@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag"/>
<result property="count" column="count"/>
<result property="workTimes" column="work_times"/>
<result property="hourWorkTimes" column="hour_work_times"/>
</resultMap>
@@ -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
</select>

View File

@@ -3,7 +3,7 @@
<el-row :gutter="20">
<el-col :span="16">
<el-header> 签到表</el-header>
<el-header> 签到表</el-header>
<table>
<thead>
<tr>
@@ -17,62 +17,66 @@
<tbody>
<tr v-for="(item,index) in userList">
<td :class="(item.userId===selectUser.userId || selectAll)?'selectBox':''">{{ item.nickName }}</td>
<td v-for="(item2,index2) in dateLength" @click="selectAttendDay(item,index,index2+1)"
:style="{backgroundColor:(item.attendances.length>0 && item.attendances.findIndex(i=>i.attendanceDay === index2+1) >-1) ?item.attendances[item.attendances.findIndex(i=>i.attendanceDay === index2+1)].color:(index2+1===selectIndex&&(item.userId===selectUser.userId || selectAll)?'#f3ff52':'')}"></td>
<td style="font-size: small" v-for="(item2,index2) in dateLength" @click="selectAttendDay(item,index,index2+1)"
:style="{backgroundColor:(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.attendances[item.attendances.findIndex(i=>i.attendanceDay === index2+1)].color:'#fdf6e4'):
(index2+1===selectIndex&&(item.userId===selectUser.userId || selectAll)?'#f3ff52':'')}"
>{{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?'出差':''}}</td>
</tr>
</tbody>
</table>
</el-col>
<el-col :span="8">
<div>
<div>
<el-header> 操作栏</el-header>
<el-card class="box-card">
<el-button @click="removeAttendance" type="danger" plain>取消操作</el-button>
</el-card>
<el-card class="box-card">
<div slot="" class="">
<span><i class="el-icon-s-order"></i> 项目列表</span>
<!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>-->
<el-header> 操作栏</el-header>
<el-card class="box-card">
<el-button @click="removeAttendance" type="danger" plain>取消操作</el-button>
<el-button @click="toTravel" type="warning" plain>出差</el-button>
</el-card>
<el-card class="box-card">
<div slot="" class="">
<span><i class="el-icon-s-order"></i> 项目列表</span>
<!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>-->
</div>
<div v-for="(item,index) in projectList" style="display: flex;justify-content: space-between">
<el-button class="text" :style="{backgroundColor:item.color===''?'':item.color}" @click="signIn(item)">
{{ item.projectName }}
</el-button>
<el-color-picker class="color-picker" v-model="item.color"
@change="changeItemColor(item)"></el-color-picker>
</div>
</el-card>
<el-card class="box-card">
<div slot="" class="">
<span><i class="el-icon-timer"></i>工作时长</span>
<div style="margin: 20px 0 ">
<el-radio-group v-model="timeFlag">
<el-radio :label="0">天计</el-radio>
<el-radio :label="1">小时计</el-radio>
</el-radio-group>
</div>
<div v-for="(item,index) in projectList" style="display: flex;justify-content: space-between">
<el-button class="text" :style="{backgroundColor:item.color===''?'':item.color}" @click="signIn(item)">
{{ item.projectName }}
</el-button>
<el-color-picker class="color-picker" v-model="item.color" @change="changeItemColor(item)"></el-color-picker>
</div>
</el-card>
<el-card class="box-card">
<div slot="" class="">
<span><i class="el-icon-timer"></i>工作时长</span>
<div style="margin: 20px 0 ">
<el-radio-group v-model="timeFlag">
<el-radio :label="0">天计</el-radio>
<el-radio :label="1">小时计</el-radio>
</el-radio-group>
</div>
<el-select v-if="timeFlag===0" v-model="form.dayLength" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<el-select v-if="timeFlag===1" v-model="form.hour" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length_hour"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</div>
</el-card>
</div>
<el-select v-if="timeFlag===0" v-model="form.dayLength" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<el-select v-if="timeFlag===1" v-model="form.hour" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length_hour"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</div>
</el-card>
</div>
</el-col>
@@ -199,6 +203,9 @@
prop="projectName"
label="项目名"
width="180">
<template slot-scope="scope">
<div>{{scope.row.projectId===0?'出差':scope.row.projectName}}</div>
</template>
</el-table-column>
<el-table-column
prop="count"
@@ -209,10 +216,15 @@
prop="workTimes"
label="工作时长(天)">
</el-table-column>
<el-table-column
prop="hourWorkTimes"
label="工作时长(小时计)">
</el-table-column>
</el-table>
<div class="footer">
<p style="color: red">小时计与天计为单独记录计算</p>
<p>© 2024 财务与签到报告 | 由公司财务部门生成</p>
</div>
</div>
@@ -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%;