薪资发放情况

This commit is contained in:
GUO 2023-06-23 19:23:20 +08:00
parent cecc40d4fb
commit c69fd3e6c5
6 changed files with 97 additions and 26 deletions

View File

@ -13,6 +13,7 @@ import com.zhgd.jeecg.common.util.DateUtil;
import com.zhgd.xmgl.modules.project.entity.Project;
import com.zhgd.xmgl.modules.project.service.IProjectService;
import com.zhgd.xmgl.modules.worker.entity.WorkerWagesPayment;
import com.zhgd.xmgl.modules.worker.entity.vo.PaymentStatisticsVo;
import com.zhgd.xmgl.modules.worker.service.IWorkerMonthAttendanceStatisticsService;
import com.zhgd.xmgl.modules.worker.service.IWorkerWagesPaymentService;
import com.zhgd.xmgl.pdf.MyHeaderFooter2;
@ -386,4 +387,12 @@ public class WorkerWagesPaymentController {
}
return JSONUtil.toJsonStr(result);
}
@ApiOperation(value = "薪资发放情况", notes = "薪资发放情况", httpMethod = "GET")
@ApiImplicitParam(name = "payMonth", value = "工资发放月份 格式2022-05", paramType = "query", required = true, dataType = "String")
@GetMapping(value = "/getPaymentStatistics")
public Result<PaymentStatisticsVo> getPaymentStatistics() {
return Result.success(workerWagesPaymentService.getPaymentStatistics());
}
}

View File

@ -0,0 +1,18 @@
package com.zhgd.xmgl.modules.worker.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PaymentStatisticsVo {
@ApiModelProperty(value = "已发放项目数量")
private Integer unpaidProjectNum;
@ApiModelProperty(value = "未发放项目数量")
private Integer paidProjectNum;
@ApiModelProperty(value = "未发人员数量")
private Integer unpaidUserNum;
@ApiModelProperty(value = "已发人员数量")
private Integer paidUserNum;
@ApiModelProperty(value = "发放异常人员数量")
private Integer paidUserExceptionNum;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerWagesPayment;
import com.zhgd.xmgl.modules.worker.entity.vo.PaymentStatisticsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -25,4 +26,9 @@ public interface WorkerWagesPaymentMapper extends BaseMapper<WorkerWagesPayment>
List<EntityMap> selectWorkerWagesPaymentPageList(Page<EntityMap> page, @Param("param")Map<String, Object> map);
List<EntityMap> selectWorkerWagesPaymentDataList(HashMap<String, Object> param);
PaymentStatisticsVo getProjectPaymentStatistics(HashMap<String, Object> map);
PaymentStatisticsVo getUserPaymentStatistics(HashMap<String, Object> map);
}

View File

@ -3,7 +3,9 @@
<mapper namespace="com.zhgd.xmgl.modules.worker.mapper.WorkerWagesPaymentMapper">
<select id="selectWorkerWagesPaymentPageList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT a.id worker_id,a.worker_name,a.id_card,a.person_type,a.inService_type,b.team_name,c.department_name,en.enterprise_name,
SELECT a.id worker_id,a.worker_name,a.id_card,a.person_type,a.inService_type,
b.team_name,c.department_name,
en.enterprise_name,
wp.id,a.person_sn,a.project_sn,IFNULL(wp.pay_month,#{param.payMonth}) pay_month,wp.pay_gross,wp.pay_net,wp.balance_date,wp.pay_status,
wp.days,wp.work_hours,wp.bank_balance_date,a.pay_roll_bank_name,a.pay_roll_bank_number,
(CASE WHEN a.person_type=1 THEN b.team_name
@ -83,7 +85,23 @@
<if test="payStatus != null and payStatus != '' or payStatus == 0">
and IFNULL(wp.pay_status, 0) = #{payStatus}
</if>
</select>
<select id="getProjectPaymentStatistics" resultType="com.zhgd.xmgl.modules.worker.entity.vo.PaymentStatisticsVo">
SELECT
count( t.project_sn ) paidProjectNum,
count(*)- count( t.project_sn ) unpaidProjectNum
FROM
project p
LEFT JOIN ( SELECT DISTINCT wp.project_sn FROM worker_wages_payment wp JOIN project p1 where wp.pay_month = #{param.payMonth}) t ON t.project_sn = p.project_sn
</select>
<select id="getUserPaymentStatistics" resultType="com.zhgd.xmgl.modules.worker.entity.vo.PaymentStatisticsVo">
select ifnull(sum(if(wp.pay_status = 1, 1, 0)), 0) paidUserNum,
ifnull(sum(if(wp.pay_status = 0 or wp.pay_status is null, 1, 0)), 0) unpaidUserNum
from worker_info a
LEFT JOIN worker_wages_payment wp ON (a.person_sn = wp.person_sn and a.project_sn = wp.project_sn and
wp.pay_month = #{param.payMonth})
where a.inService_type=1
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerWagesPayment;
import com.zhgd.xmgl.modules.worker.entity.vo.PaymentStatisticsVo;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
@ -26,4 +27,6 @@ public interface IWorkerWagesPaymentService extends IService<WorkerWagesPayment>
List<EntityMap> selectWorkerWagesPaymentDataList(HashMap<String, Object> param);
Result uploadWagesPaymentExcel(MultipartFile excelFile, String projectSn);
PaymentStatisticsVo getPaymentStatistics();
}

View File

@ -9,6 +9,7 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.entity.WorkerWagesPayment;
import com.zhgd.xmgl.modules.worker.entity.vo.PaymentStatisticsVo;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
import com.zhgd.xmgl.modules.worker.mapper.WorkerWagesPaymentMapper;
import com.zhgd.xmgl.modules.worker.service.IWorkerWagesPaymentService;
@ -43,6 +44,15 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
@Override
public IPage<EntityMap> selectWorkerWagesPaymentPageList(Map<String, Object> map) {
getPayMonth(map);
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
Page<EntityMap> page = new Page<>(pageNo, pageSize);
List<EntityMap> list=workerWagesPaymentMapper.selectWorkerWagesPaymentPageList(page, map);
return page.setRecords(list);
}
private void getPayMonth(Map<String, Object> map) {
String payMonth= MapUtils.getString(map,"payMonth");
//工资发放记录默认查询上个月且只能一个月的查询
if(StringUtils.isEmpty(payMonth)){
@ -54,11 +64,6 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
payMonth=sdf1.format(calendar.getTime());
map.put("payMonth",payMonth);
}
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
Page<EntityMap> page = new Page<>(pageNo, pageSize);
List<EntityMap> list=workerWagesPaymentMapper.selectWorkerWagesPaymentPageList(page, map);
return page.setRecords(list);
}
@Override
@ -135,4 +140,16 @@ public class WorkerWagesPaymentServiceImpl extends ServiceImpl<WorkerWagesPaymen
}
return result;
}
@Override
public PaymentStatisticsVo getPaymentStatistics() {
HashMap<String, Object> map = new HashMap<>();
getPayMonth(map);
PaymentStatisticsVo vo = workerWagesPaymentMapper.getProjectPaymentStatistics(map);
PaymentStatisticsVo userVo = workerWagesPaymentMapper.getUserPaymentStatistics(map);
vo.setPaidUserNum(userVo.getPaidUserNum());
vo.setUnpaidUserNum(userVo.getUnpaidUserNum());
vo.setPaidUserExceptionNum(0);
return vo;
}
}