上传文件前代码保存

This commit is contained in:
2024-11-29 14:45:56 +08:00
parent d6b81d4559
commit b443c006a7
9 changed files with 234 additions and 141 deletions

View File

@@ -141,6 +141,17 @@ public class SysOaAttendanceController extends BaseController {
return toAjax(iSysOaAttendanceService.deleteWithValidByIds(Arrays.asList(ids), true)); return toAjax(iSysOaAttendanceService.deleteWithValidByIds(Arrays.asList(ids), true));
} }
/**
* 删除人员考勤
*
* @param ids 主键串
*/
@Log(title = "人员考勤", businessType = BusinessType.DELETE)
@DeleteMapping("/all/{day}")
public R<Void> delOaAttendanceAll(@PathVariable Long day) {
return toAjax(iSysOaAttendanceService.delOaAttendanceAll(day));
}
/** /**
* 新增人员考勤 * 新增人员考勤

View File

@@ -17,4 +17,6 @@ import java.util.List;
public interface SysOaAttendanceMapper extends BaseMapperPlus<SysOaAttendanceMapper, SysOaAttendance, SysOaAttendanceVo> { public interface SysOaAttendanceMapper extends BaseMapperPlus<SysOaAttendanceMapper, SysOaAttendance, SysOaAttendanceVo> {
List<SysOaAttendanceVo> selectVoListAndTime(@Param("userId") Long userId, @Param("firstDay") Date firstDay, @Param("lastDay") Date lastDay); List<SysOaAttendanceVo> selectVoListAndTime(@Param("userId") Long userId, @Param("firstDay") Date firstDay, @Param("lastDay") Date lastDay);
int delOaAttendanceAll(@Param("firstDay") Date firstDay, @Param("lastDay")Date lastDay,@Param("day")Long day);
} }

View File

@@ -70,4 +70,10 @@ public interface ISysOaAttendanceService {
*/ */
List<LaborCostData> workerCalc(Date time); List<LaborCostData> workerCalc(Date time);
/**
* 删除当月某日所有人的签到记录
* @param day 日期
* @return
*/
int delOaAttendanceAll(Long day);
} }

View File

@@ -197,21 +197,11 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
*/ */
@Override @Override
public List<LaborCostData> workerCalc(Date time) { public List<LaborCostData> workerCalc(Date time) {
String firstDay = DateUtils.parseDateToStr("yyyy-MM-01", time);
String format = "yyyy-MM-";
// 计算某月的天数
Calendar calendar = Calendar.getInstance();
calendar.setTime(time);
String dateLength = String.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
// 将字符串拼接
format +=dateLength;
String lastDay = DateUtils.parseDateToStr(format, time);
// 查询所有的工人 // 查询所有的工人
List<Long> userIds = sysUserRoleMapper.selectUserIdsByRoleId(1852970465740505090L); List<Long> userIds = sysUserRoleMapper.selectUserIdsByRoleId(1852970465740505090L);
Date firstDay = getFirstDay(time);
Date lastDay = getLastDay(time);
List<LaborCostData> costDataList = new ArrayList<>(); List<LaborCostData> costDataList = new ArrayList<>();
for (Long userId : userIds) { for (Long userId : userIds) {
SysUserVo sysUser = BeanUtil.toBean(sysUserService.selectUserById(userId), SysUserVo.class); SysUserVo sysUser = BeanUtil.toBean(sysUserService.selectUserById(userId), SysUserVo.class);
@@ -219,12 +209,10 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
sysOaAttendanceVo.setUserId(sysUser.getUserId()); sysOaAttendanceVo.setUserId(sysUser.getUserId());
// 查询某月记录 // 查询某月记录
List<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.selectVoListAndTime(userId, DateUtils.parseDate(firstDay),DateUtils.parseDate(lastDay)); List<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.selectVoListAndTime(userId, firstDay,lastDay);
List<SysOaProjectVo> projectVos = new ArrayList<>(); List<SysOaProjectVo> projectVos = new ArrayList<>();
Double workTimes = 0.0; Double workTimes = 0.0;
System.out.println(sysOaAttendanceVos);
for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) { for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) {
SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId());
oaAttendanceVo.setColor(sysOaProjectVo.getColor()); oaAttendanceVo.setColor(sysOaProjectVo.getColor());
@@ -247,4 +235,33 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
return costDataList; return costDataList;
} }
/**
* 删除当月某日所有人的记录
* @param day 日期
* @return
*/
@Override
public int delOaAttendanceAll(Long day) {
Date now = new Date();
return baseMapper.delOaAttendanceAll(getFirstDay(now),getLastDay(now),day);
}
private Date getFirstDay(Date time){
String firstDay = DateUtils.parseDateToStr("yyyy-MM-01", time);
return DateUtils.parseDate(firstDay);
}
private Date getLastDay(Date time){
String format = "yyyy-MM-";
// 计算某月的天数
Calendar calendar = Calendar.getInstance();
calendar.setTime(time);
String dateLength = String.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
// 将字符串拼接
format +=dateLength;
return DateUtils.parseDate(DateUtils.parseDateToStr(format, time));
}
} }

View File

@@ -271,10 +271,7 @@ public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
//其中一条 //其中一条
sysOaOutWarehouses.forEach(sysOaOutWarehouse -> { sysOaOutWarehouses.forEach(sysOaOutWarehouse -> {
//选出相对应的 库存表中那一条的数据 //选出相对应的 库存表中那一条的数据
LambdaQueryWrapper<SysOaWarehouse> lqw2 = Wrappers.lambdaQuery(); SysOaWarehouse warehouse = warehouseMapper.selectVoByIdAndXml(sysOaOutWarehouse.getWarehouseId());
lqw2.eq(SysOaWarehouse::getId, sysOaOutWarehouse.getWarehouseId());
SysOaWarehouse warehouse = warehouseMapper.selectOne(lqw2);
// 恢复原本出库的数量 // 恢复原本出库的数量
warehouse.setInventory(warehouse.getInventory() + sysOaOutWarehouse.getAmount()); warehouse.setInventory(warehouse.getInventory() + sysOaOutWarehouse.getAmount());
warehouseMapper.updateById(warehouse); warehouseMapper.updateById(warehouse);

View File

@@ -45,5 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by soa.project_id group by soa.project_id
</select> </select>
<delete id="delOaAttendanceAll">
delete from sys_oa_attendance where
attendance_day = #{day}
and #{lastDay} > create_time
and create_time > #{firstDay}
</delete>
</mapper> </mapper>

View File

@@ -70,3 +70,14 @@ export function delOaAttendance(id) {
method: 'delete' method: 'delete'
}) })
} }
// 删除人员考勤
export function delOaAttendanceAll(id) {
return request({
url: '/oa/oaAttendance/all/' + id,
method: 'delete'
})
}

View File

@@ -1,13 +1,15 @@
<template> <template>
<div class="app-container" v-loading="loading"> <div class="app-container" v-loading="loading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="14"> <el-col :span="16">
签到表
<el-header> 签到表</el-header>
<table> <table>
<thead> <thead>
<tr> <tr>
<th width="80"></th> <th width="80"></th>
<th v-for="(item,index) in dateLength" :class="selectHead===index+1?'selectBox':''" @click="selectMany(index+1)"> <th v-for="(item,index) in dateLength" :class="selectHead===index+1?'selectBox':''"
@click="selectMany(index+1)">
{{ index + 1 }} {{ index + 1 }}
</th> </th>
</tr> </tr>
@@ -21,24 +23,26 @@
</tbody> </tbody>
</table> </table>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="8">
<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"> <el-card class="box-card">
<div slot="" class=""> <div slot="" class="">
<span><i class="el-icon-s-order"></i> 项目列表</span> <span><i class="el-icon-s-order"></i> 项目列表</span>
<!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>--> <!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>-->
</div> </div>
<div v-for="(item,index) in projectList" style="display: flex;justify-content: space-between"> <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 class="text" :style="{backgroundColor:item.color===''?'':item.color}" @click="signIn(item)">
{{ item.projectName }}
</el-button> </el-button>
<el-color-picker class="text" v-model="item.color" @change="changeItemColor(item)"></el-color-picker> <el-color-picker class="color-picker" v-model="item.color" @change="changeItemColor(item)"></el-color-picker>
</div> </div>
</el-card> </el-card>
</el-col>
<el-col :span="5">
<el-card class="box-card"> <el-card class="box-card">
<div slot="" class=""> <div slot="" class="">
<span><i class="el-icon-timer"></i>工作时长</span> <span><i class="el-icon-timer"></i>工作时长</span>
@@ -67,6 +71,8 @@
</el-select> </el-select>
</div> </div>
</el-card> </el-card>
</div>
</el-col> </el-col>
@@ -120,7 +126,8 @@
v-if="calcFlag" v-if="calcFlag"
@click="handleCalc(scope.row)" @click="handleCalc(scope.row)"
v-hasPermi="['oa:oaWarehouse:edit']" v-hasPermi="['oa:oaWarehouse:edit']"
>查看考勤结果</el-button> >查看考勤结果
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@@ -129,7 +136,8 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleCalc(scope.row)" @click="handleCalc(scope.row)"
v-hasPermi="['oa:oaWarehouse:edit']" v-hasPermi="['oa:oaWarehouse:edit']"
>请选择日期计算</el-button> >请选择日期计算
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -155,7 +163,6 @@
<h2>{{ date.getMonth() }} 月度工作签到情况</h2> <h2>{{ date.getMonth() }} 月度工作签到情况</h2>
<el-descriptions class="margin-top" title="报告详情" :column="3" :size="size" border> <el-descriptions class="margin-top" title="报告详情" :column="3" :size="size" border>
<template slot="extra"> <template slot="extra">
<div>总工作时长{{ calcResultItem.workTimes }}</div> <div>总工作时长{{ calcResultItem.workTimes }}</div>
@@ -205,8 +212,6 @@
</el-table> </el-table>
<div class="footer"> <div class="footer">
<p>© 2024 财务与签到报告 | 由公司财务部门生成</p> <p>© 2024 财务与签到报告 | 由公司财务部门生成</p>
</div> </div>
@@ -226,7 +231,14 @@
import {listWorker} from "@/api/system/user"; import {listWorker} from "@/api/system/user";
import {listProject, updateProject} from "@/api/oa/project"; import {listProject, updateProject} from "@/api/oa/project";
import {listOaAttendance} from "@/api/oa/oaAttendance"; import {listOaAttendance} from "@/api/oa/oaAttendance";
import {addBatchOaAttendance, addOaAttendance, getDateLength, workCalc} from "../../../api/oa/oaAttendance"; import {
addBatchOaAttendance,
addOaAttendance,
delOaAttendance,
getDateLength,
workCalc,
delOaAttendanceAll
} from "../../../api/oa/oaAttendance";
import item from "../../../layout/components/Sidebar/Item.vue"; import item from "../../../layout/components/Sidebar/Item.vue";
export default { export default {
@@ -260,8 +272,7 @@ export default {
status: undefined, status: undefined,
deptId: undefined deptId: undefined
}, },
calcUser:{ calcUser: {},
},
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 50, pageSize: 50,
@@ -299,19 +310,33 @@ export default {
methods: { methods: {
// 删除签到
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=>{
this.$modal.msgSuccess("操作成功");
this.getList();
})
}
},
// 查看计算结果 // 查看计算结果
handleCalc(row) { handleCalc(row) {
this.showCalc = true; this.showCalc = true;
this.calcUser = row this.calcUser = row
this.calcResultItem = this.calcResult.filter(item => item.sysUser.userId === this.calcUser.userId)[0] this.calcResultItem = this.calcResult.filter(item => item.sysUser.userId === this.calcUser.userId)[0]
this.calcResultAttendances = this.calcResultItem.attendances this.calcResultAttendances = this.calcResultItem.attendances
console.log(this.calcResultItem)
}, },
// 计算 // 计算
calcWork() { calcWork() {
workCalc(this.date).then(res => { workCalc(this.date).then(res => {
this.calcResult = res.data; this.calcResult = res.data;
this.calcFlag = true; this.calcFlag = true;
@@ -352,8 +377,10 @@ export default {
}, },
changeItemColor(item) { changeItemColor(item) {
updateProject(item); updateProject(item).then(res=>{
this.getList(); this.getList();
})
}, },
signIn(project) { signIn(project) {
// 一个签到 // 一个签到
@@ -378,9 +405,7 @@ export default {
} }
addOaAttendance(this.form).then(res => { addOaAttendance(this.form).then(res => {
this.selectUser = this.selectArrayIndex >= this.userList.length - 1 ? this.selectUser : this.userList[this.selectArrayIndex + 1] this.selectUser = this.selectArrayIndex >= this.userList.length - 1 ? this.selectUser : this.userList[this.selectArrayIndex + 1]
this.getList() this.getList()
}) })
} else { } else {
@@ -434,7 +459,26 @@ table {
.text { .text {
font-size: 16px; font-size: 16px;
width: 70%;
overflow: hidden;
text-overflow: ellipsis;
border-bottom: #cccccc 1px dashed; border-bottom: #cccccc 1px dashed;
margin: 5px 0; margin: 5px 0;
} }
.color-picker{
font-size: 16px;
width: 30%;
border-bottom: #cccccc 1px dashed;
margin: 5px 0;
}
.el-header, .el-footer {
background-color: #f6f6f6;
color: #333;
text-align: center;
line-height: 60px;
border-radius: 7px 7px 0 0;
}
</style> </style>

View File

@@ -547,8 +547,7 @@ export default {
this.loading = true; this.loading = true;
return delOaOutWarehouse(ids); return delOaOutWarehouse(ids);
}).then(() => { }).then(() => {
this.getList();
this.handleSearch(this.searchItem);
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }).catch(() => {
}).finally(() => { }).finally(() => {