update code

dev
lijun 2024-11-15 22:35:37 +08:00
parent 00b199b034
commit d89aed535d
5 changed files with 287 additions and 31 deletions

View File

@ -26,6 +26,25 @@ export function listByMonth(query) {
params: query
})
}
// 查询两个日期之间某人的工资
export function listByBetweenDay(query) {
return request({
url: '/project/unitpay/listByBetweenDay',
method: 'get',
params: query
})
}
// 按两个日期之间的时间差分组统计工资
export function listGroupBetweenDay(query) {
return request({
url: '/project/unitpay/listGroupBetweenDay',
method: 'get',
params: query
})
}
// 查询劳资管理详细
export function getUnitpay(id) {

View File

@ -1,5 +1,5 @@
<template>
<div class="app-container">
<div class="app-container pay-query-main">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="项目名称" prop="projectId">
<el-select v-model="queryParams.projectId" filterable placeholder="请选择项目" @change="doQuerySub">
@ -13,13 +13,15 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="日期" prop="subDeptId" v-if="activeName == 'day'">
<el-date-picker v-model="queryParams.attendanceDay" style="margin:0px 10px;" type="date" placeholder="选择日期"
<el-form-item label="姓名" prop="workerName">
<el-input v-model="queryParams.workerName"/>
</el-form-item>
<el-form-item label="日期" >
<el-date-picker v-model="queryParams.attendanceDay1" style="margin:0px 10px;" type="date" placeholder="选择日期"
@change="handleQuery">
</el-date-picker>
</el-form-item>
<el-form-item label="月份" prop="subDeptId" v-if="activeName == 'month'">
<el-date-picker v-model="queryParams.attendanceMonth" style="margin:0px 10px;" type="month" placeholder="请选择月份"
-
<el-date-picker v-model="queryParams.attendanceDay2" style="margin:0px 10px;" type="date" placeholder="选择日期"
@change="handleQuery">
</el-date-picker>
</el-form-item>
@ -27,22 +29,59 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button type="success" v-if="total>0" @click="doExport"></el-button>
</el-form-item>
</el-form>
</el-form>
<div>
<el-table v-loading="loading" :data="attendanceList" height="60vh" class="my-table">
<el-table-column label="照片" align="center" prop="id">
<template slot-scope="{ row }">
<el-image :src="row.scanPhoto || row.workerPhoto" :preview-src-list="[row.scanPhoto || row.workerPhoto]"
style="height: 60px" />
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="workerName" />
<el-table-column label="籍贯" align="center" prop="nativePlace" />
<el-table-column label="性别" align="center" prop="attendanceType">
<template slot-scope="{ row }">{{
row.workerGender == 1 ? "女" : "男"
}}</template>
</el-table-column>
<el-table-column label="分包商名称" align="center" prop="companyName" />
<el-table-column label="所属班组" align="center" prop="groupName" />
<el-table-column label="工种" align="center" prop="workTypeName" />
<el-table-column label="出勤天数" align="center" prop="pay" v-if="type=='month'">
<template slot-scope="{ row }">{{row.days }}</template>
</el-table-column>
<el-table-column label="出勤日期" align="center" prop="pay" v-if="type=='day'">
<template slot-scope="{ row }">
<span>{{(row.attendanceTime||row.attendanceOutTime)|formatDate }}</span>
</template>
</el-table-column>
<el-table-column label="工资" align="center" prop="pay">
<template slot-scope="{ row }">
<span >{{(row.pay/100.0).toFixed(2)}}</span>
<span v-if="false" >
{{(row.unitPay/100.0).toFixed(2)}}*{{row.days}}={{(row.pay/100.0).toFixed(2)}}
</span>
</template>
</el-table-column>
<div slot="empty">
<el-empty v-if="total==0" image="./images/empty.svg"></el-empty>
</div>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</div>
<el-tabs type="card" v-model="activeName" @tab-click="doTabClick">
<el-tab-pane label="日工资列表" name="day">
<DayPay ref="day" @update="dataChange" :getPrjInfo="getPrjInfo" type="index" v-if="activeName == 'day'"></DayPay>
</el-tab-pane>
<el-tab-pane label="月工资列表" name="month">
<MonthPay ref="month" @update="dataChange" :getPrjInfo="getPrjInfo" type="index" v-if="activeName == 'month'"></MonthPay>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import DayPay from './dayPay.vue'
import MonthPay from './monthPay.vue'
import {listByBetweenDay,listGroupBetweenDay} from '@/api/project/unitpay'
export default {
components:{
DayPay,MonthPay
@ -55,15 +94,20 @@ export default {
activeName: 'day',
//
queryParams: {
pageNum: 1,
pageSize: 10,
projectId: null,
subDeptId: null,
attendanceDay:new Date(),
attendanceMonth:new Date(),
workerName:'',
attendanceDay1:new Date(),
attendanceDay2:null,
},
//
projectOptions: [],
depts: [],
total:0,
total: 0,
attendanceList:[],
type:'',
};
},
created() {
@ -90,12 +134,14 @@ export default {
} else {
this.queryParams.subDeptId = '';
}
this.loading=false;
return;
}
this.$api.publics.queryUnitList({
projectId: prjId,
unitTypes: "2".split(","),
}).then((d) => {
this.loading=false;
let objs = d.rows || [];
if (!this.prjDept2) {
this.prjDept2 = {};
@ -122,17 +168,66 @@ export default {
});
},
handleQuery() {
if(this.activeName=='day'){
this.$refs.day.doQuery();
this.queryParams.pageNum=1;
this.getList();
},
getPostData(){
let postData={
projectId:this.queryParams.projectId,
deptId:this.queryParams.subDeptId,
pageNum:this.queryParams.pageNum,
pageSize:this.queryParams.pageSize
};
if(this.queryParams.workerName.trim()){
this.type='day';
postData.workerName=this.queryParams.workerName.trim();
}else{
this.$refs.month.doQuery();
this.type='month';
}
if(this.queryParams.attendanceDay1){
postData.attendanceTime=this.$dt(this.queryParams.attendanceDay1).format("YYYY-MM-DD");
}
if(this.queryParams.attendanceDay2){
postData.attendanceOutTime=this.$dt(this.queryParams.attendanceDay1).format("YYYY-MM-DD");
}
return postData;
},
getList(){
this.loading = true;
let ajaxFun=listByBetweenDay;
let postData=this.getPostData();
if(this.type=='month'){
ajaxFun=listGroupBetweenDay;
}
ajaxFun(postData).then(response=>{
this.attendanceList = (response.rows || []).map((it) => {
if (it.vendorsCode != "yanzhu") {
let dt1 = it.attendanceTime;
let dt2 = it.attendanceOutTime;
if (!dt1 || !dt2 || dt1 == dt2) {
let dt = dt1 || dt2;
if (it.remark == "E") {
it.attendanceTime = dt;
it.attendanceOutTime = "";
} else {
it.attendanceTime = "";
it.attendanceOutTime = dt;
}
}
}
it.scanPhoto =it.scanPhoto && it.scanPhoto.indexOf("/profile") == 0 ? "/jhapi" + it.scanPhoto : it.scanPhoto;
return it;
});
this.total = response.total;
this.loading = false;
});
},
doTabClick(){
setTimeout(this.handleQuery,1000);
},
doExport(){
let postData=this.getPrjInfo();
let postData=this.getPostData();
let tmps=this.projectOptions.filter(d=>d.id==this.queryParams.projectId);
let name=tmps.length>0?tmps[0].projectName:"";
if(this.queryParams.subDeptId){
@ -141,10 +236,8 @@ export default {
name+="_"+tmps[0].deptName;
}
}
name+="_"+this.$dt(postData.attendanceTime).format(this.activeName=="day"?"YYYY年MM月DD日":"YYYY年MM月");
name+=`_[${new Date().getTime()}].xlsx`
postData.attendanceTime=this.$dt(postData.attendanceTime).format("YYYY-MM-DD");
let url=this.activeName=="day"?"project/unitpay/exportDay":"project/unitpay/exportMonth";
name+=`_工资管理_[${new Date().getTime()}].xlsx`
let url=this.type=="day"?"project/unitpay/exportBetweenDay":"project/unitpay/exportGroupBetweenDay";
this.download(
url,
{
@ -156,3 +249,11 @@ export default {
}
};
</script>
<style lang="scss">
.pay-query-main{
font-size: 12px;
.el-table.my-table{
height: calc(100vh - 292px) !important;
}
}
</style>

View File

@ -90,6 +90,60 @@ public class SurProjectAttendanceUnitpayController extends BaseController
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:unitpay:list')")
@GetMapping("/listByBetweenDay")
public TableDataInfo listByBetweenDay(SurProjectAttendanceData attWhere)
{
attWhere.setAttendanceOutTime(attWhere.getAttendanceOutTime());
startPage();
String tmp=attWhere.getAttendanceTime();
if(StrUtil.isNotEmpty(tmp)){
int year= DateUtil.parse(tmp).year();
attWhere.setYear(year);
}
List<SurProjectAttendanceData> list = surProjectAttendanceDataService.selectSurProjectAttendanceDataList(attWhere);
SurProjectAttendanceUnitpay payWhere=new SurProjectAttendanceUnitpay();
payWhere.setCfgId(attWhere.getCfgid());
List<SurProjectAttendanceUnitpay> payList= surProjectAttendanceUnitpayService.selectSurProjectAttendanceUnitpayList(payWhere);
for(SurProjectAttendanceData it :list){
it.setDays(1l);
it.setPay(surProjectAttendanceUnitpayService.getPay(payList,it));
}
return getDataTable(list);
}
/**
*
* @param attWhere
* @return
*/
@PreAuthorize("@ss.hasPermi('project:unitpay:list')")
@GetMapping("/listGroupBetweenDay")
public TableDataInfo listGroupBetweenDay(SurProjectAttendanceData attWhere)
{
startPage();
String tmp=attWhere.getAttendanceTime();
if(StrUtil.isNotEmpty(tmp)){
int year= DateUtil.parse(tmp).year();
attWhere.setYear(year);
}
List<SurProjectAttendanceData> list = surProjectAttendanceDataService.selectSurProjectAttendanceDataListByMonth(attWhere);
SurProjectAttendanceUnitpay payWhere=new SurProjectAttendanceUnitpay();
payWhere.setCfgId(attWhere.getCfgid());
List<SurProjectAttendanceUnitpay> payList= surProjectAttendanceUnitpayService.selectSurProjectAttendanceUnitpayList(payWhere);
for(SurProjectAttendanceData it :list){
it.setPay(surProjectAttendanceUnitpayService.getPay(payList,it));
}
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('project:unitpay:list')")
@GetMapping("/listByMonth")
public TableDataInfo listByMonth(SurProjectAttendanceData attWhere)
@ -115,7 +169,7 @@ public class SurProjectAttendanceUnitpayController extends BaseController
}
/**
*
*
*/
@PreAuthorize("@ss.hasPermi('project:unitpay:export')")
@Log(title = "劳资管理", businessType = BusinessType.EXPORT)
@ -123,7 +177,7 @@ public class SurProjectAttendanceUnitpayController extends BaseController
public void exportDay(HttpServletResponse response, SurProjectAttendanceData attWhere)
{
Date dt=DateUtil.parse(attWhere.getAttendanceTime());
attWhere.setAttendanceOutTime(attWhere.getAttendanceOutTime());
attWhere.setAttendanceOutTime(attWhere.getAttendanceTime());
String tmp=attWhere.getAttendanceTime();
if(StrUtil.isNotEmpty(tmp)){
int year= DateUtil.parse(tmp).year();
@ -145,7 +199,7 @@ public class SurProjectAttendanceUnitpayController extends BaseController
}
/**
*
*
*/
@PreAuthorize("@ss.hasPermi('project:unitpay:export')")
@Log(title = "劳资管理", businessType = BusinessType.EXPORT)
@ -173,6 +227,60 @@ public class SurProjectAttendanceUnitpayController extends BaseController
util.exportExcel(response, exportList, "劳务工资-月工资"+DateUtil.format(dt,"YYYY年MM月"));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:unitpay:export')")
@Log(title = "劳资管理", businessType = BusinessType.EXPORT)
@PostMapping("/exportGroupBetweenDay")
public void exportGroupBetweenDay(HttpServletResponse response, SurProjectAttendanceData attWhere)
{
String tmp=attWhere.getAttendanceTime();
if(StrUtil.isNotEmpty(tmp)){
int year= DateUtil.parse(tmp).year();
attWhere.setYear(year);
}
List<SurProjectAttendanceData> list = surProjectAttendanceDataService.selectSurProjectAttendanceDataListByMonth(attWhere);
SurProjectAttendanceUnitpay payWhere=new SurProjectAttendanceUnitpay();
payWhere.setCfgId(attWhere.getCfgid());
List<SurProjectAttendanceUnitpay> payList= surProjectAttendanceUnitpayService.selectSurProjectAttendanceUnitpayList(payWhere);
List<ExportAttendancMonth> exportList=new ArrayList<>();
for(SurProjectAttendanceData it :list){
it.setPay(surProjectAttendanceUnitpayService.getPay(payList,it));
exportList.add(ExportAttendancMonth.NEW(it));
}
ExcelUtil<ExportAttendancMonth> util = new ExcelUtil<ExportAttendancMonth>(ExportAttendancMonth.class);
util.exportExcel(response, exportList, "劳务工资-工资");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:unitpay:export')")
@Log(title = "劳资管理", businessType = BusinessType.EXPORT)
@PostMapping("/exportBetweenDay")
public void exportBetWeenDay(HttpServletResponse response, SurProjectAttendanceData attWhere)
{
Date dt=DateUtil.parse(attWhere.getAttendanceTime());
String tmp=attWhere.getAttendanceTime();
if(StrUtil.isNotEmpty(tmp)){
int year= DateUtil.parse(tmp).year();
attWhere.setYear(year);
}
List<SurProjectAttendanceData> list = surProjectAttendanceDataService.selectSurProjectAttendanceDataList(attWhere);
SurProjectAttendanceUnitpay payWhere=new SurProjectAttendanceUnitpay();
payWhere.setCfgId(attWhere.getCfgid());
List<SurProjectAttendanceUnitpay> payList= surProjectAttendanceUnitpayService.selectSurProjectAttendanceUnitpayList(payWhere);
List<ExportAttendancDay> exportList=new ArrayList<ExportAttendancDay>();
for(SurProjectAttendanceData it :list){
it.setDays(1l);
it.setPay(surProjectAttendanceUnitpayService.getPay(payList,it));
exportList.add(ExportAttendancDay.NEW(it));
}
ExcelUtil<ExportAttendancDay> util = new ExcelUtil<ExportAttendancDay>(ExportAttendancDay.class);
util.exportExcel(response, exportList, "劳务工资-工资");
}
/**
*
*/

View File

@ -1,5 +1,6 @@
package com.yanzhu.jh.project.domain.vo;
import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.annotation.Excel;
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
@ -25,6 +26,8 @@ public class ExportAttendancDay {
private String groupName;
@Excel(name = "工种")
private String workTypeName;
@Excel(name = "出勤日期")
private String attendanceDate;
@Excel(name = "日工资")
private BigDecimal pay;
@Excel(name = "工种日工资")
@ -41,10 +44,23 @@ public class ExportAttendancDay {
d.groupName=it.getGroupName();
d.workTypeName = it.getWorkTypeName();
d.pay=BigDecimal.valueOf(it.getPay()/100.0);
if(it.getAttendanceTime()!=null){
d.attendanceDate= DateUtil.formatDate(DateUtil.parse(it.getAttendanceTime()));
}else if(it.getAttendanceOutTime()!=null){
d.attendanceDate= DateUtil.formatDate(DateUtil.parse(it.getAttendanceOutTime()));
}
d.unitPay=BigDecimal.valueOf(it.getUnitPay()/100.0);
return d;
}
public String getAttendanceDate() {
return attendanceDate;
}
public void setAttendanceDate(String attendanceDate) {
this.attendanceDate = attendanceDate;
}
public String getProjectName() {
return projectName;
}

View File

@ -509,9 +509,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projectId != null ">and cfgid in (select id from sur_project_attendance_cfg where projectId = #{projectId}
<if test="deptId != null "> and sub_dept_id = #{deptId}</if>
)</if>
<if test="attendanceTime!=null or attendanceOutTime!=null">
<if test="attendanceTime!=null and attendanceOutTime!=null">
AND (date(attendance_time) &gt;= date(#{attendanceTime}) or date(attendance_out_time) &gt;= date(#{attendanceTime}))
AND (date(attendance_time) &lt;= date(#{attendanceOutTime}) or date(attendance_out_time) &lt;= date(#{attendanceOutTime}))
</if>
AND (date(attendance_time) &gt;= date(#{attendanceTime}) or date(attendance_out_time) &gt;= date(#{attendanceTime}))
AND (date(attendance_time) &lt;= date(#{attendanceOutTime}) or date(attendance_out_time) &lt;= date(#{attendanceOutTime}))
<if test="attendanceTime==null and attendanceOutTime!=null">
AND (date(attendance_time) &lt;= date(#{attendanceOutTime}) or date(attendance_out_time) &lt;= date(#{attendanceOutTime}))
</if>
<if test="attendanceTime!=null and attendanceOutTime==null">
AND (date(attendance_time) &gt;= date(#{attendanceTime}) or date(attendance_out_time) &gt;= date(#{attendanceTime}))
</if>
</if>
</where>
)
SELECT a.*, b.days
@ -520,6 +531,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE b.rn = 1
order by a.workerId
</select>
<select id="todayAttendance" parameterType="SurProjectAttendanceData" resultMap="SurProjectAttendanceDataResult">
select ady.* from sur_project_attendance_data_${year} ady
left join sur_project sp on sp.id = ady.projectId