parent
371489a517
commit
01aa1a9ae8
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.pay.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.pay.domain.PaySalaryReport;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PayHomePageMapper {
|
||||||
|
@Select("SELECT IFNULL(COUNT(*), 0) FROM pay_employee_info WHERE deleted = 0 and tenant_id=#{tenantId}")
|
||||||
|
Integer getEmpCountData(Long tenantId);
|
||||||
|
|
||||||
|
@Select("select ifnull(count(*), 0) from pay_work_order_baohuo where deleted = 0 and tenant_id=#{tenantId}")
|
||||||
|
Integer getBaoHuoCountData(Long tenantId);
|
||||||
|
|
||||||
|
@Select("select ifnull(count(*), 0) from pay_work_order_tuzhi where deleted = 0 and tenant_id=#{tenantId}")
|
||||||
|
Integer getTuZhiCountData(Long tenantId);
|
||||||
|
|
||||||
|
@Select("SELECT IFNULL(COUNT(*), 0) FROM pay_products WHERE deleted = 0 and tenant_id=#{tenantId}")
|
||||||
|
Integer getProductData(Long tenantId);
|
||||||
|
|
||||||
|
/*@Select("select s.dept_name deptName,s.day_work_hours dayWorkHours,s.overtime_work_hours overtimeWorkHours,s.banggong_pay banggongPay" +
|
||||||
|
",s.shoud_pay_money shoudPayMoney,s.actually_pay_money actuallyPayMoney from sgr_salary_report s " +
|
||||||
|
"where s.year=(select max(year) from `sgr_salary_report`) and s.`month`=(select max(month) from `sgr_salary_report`) " +
|
||||||
|
"group by s.dept_name")*/
|
||||||
|
List<PaySalaryReport> getDeptPayData(Long tenantId);
|
||||||
|
|
||||||
|
List<PaySalaryReport> getMonthPayData(Long tenantId);
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.pay.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.pay.domain.PaySalaryReport;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface IPayHomePageService {
|
||||||
|
R<HashMap<String, Object>> getPanelData(Long tenantId);
|
||||||
|
|
||||||
|
R<List<Map<String, String>>> getChuQinData(Date date,Long tenantId);
|
||||||
|
|
||||||
|
TableDataInfo<PaySalaryReport> getDeptPayData(Long tenantId);
|
||||||
|
|
||||||
|
TableDataInfo<PaySalaryReport> getMonthPayData(Long tenantId);
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.ruoyi.pay.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.pay.domain.PaySalaryReport;
|
||||||
|
import com.ruoyi.pay.mapper.PayEmployeeInfoMapper;
|
||||||
|
import com.ruoyi.pay.mapper.PayHomePageMapper;
|
||||||
|
import com.ruoyi.pay.service.IPayHomePageService;
|
||||||
|
import com.ruoyi.pay.service.IPayRequireAttendanceReportService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class IPayHomePageServiceImpl implements IPayHomePageService {
|
||||||
|
private final PayHomePageMapper homePageMapper;
|
||||||
|
private final IPayRequireAttendanceReportService attendanceReportService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<HashMap<String, Object>> getPanelData(Long tenantId) {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
Integer empNum = homePageMapper.getEmpCountData(tenantId);
|
||||||
|
Integer baoHuoCountData = homePageMapper.getBaoHuoCountData(tenantId);
|
||||||
|
Integer tuZhiCountData = homePageMapper.getTuZhiCountData(tenantId);
|
||||||
|
Integer productData = homePageMapper.getProductData(tenantId);
|
||||||
|
|
||||||
|
map.put("empNum", empNum);
|
||||||
|
map.put("woNum", baoHuoCountData + tuZhiCountData);
|
||||||
|
map.put("prodNum", productData);
|
||||||
|
|
||||||
|
return R.ok(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<List<Map<String, String>>> getChuQinData(Date date,Long tenantId) {
|
||||||
|
// 获取最新的应出勤月份
|
||||||
|
Map<String, String> dateMap = attendanceReportService.getLatestYearAndMonth(tenantId);
|
||||||
|
String year = DateUtil.format(date, "yyyy");
|
||||||
|
String month = DateUtil.format(date, "MM");
|
||||||
|
if (ObjectUtil.isNotNull(dateMap) && dateMap.size() > 0) {
|
||||||
|
year = dateMap.get("year");
|
||||||
|
month = dateMap.get("month");
|
||||||
|
}
|
||||||
|
List<Map<String, String>> list = attendanceReportService.selectAttendanceReportByMonth(year, month,tenantId);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<PaySalaryReport> getDeptPayData(Long tenantId) {
|
||||||
|
List<PaySalaryReport> data = homePageMapper.getDeptPayData(tenantId);
|
||||||
|
return TableDataInfo.build(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<PaySalaryReport> getMonthPayData(Long tenantId) {
|
||||||
|
return TableDataInfo.build(homePageMapper.getMonthPayData(tenantId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.pay.mapper.PayHomePageMapper">
|
||||||
|
<resultMap type="PaySalaryReport" id="PaySalaryReportResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="year" column="year" />
|
||||||
|
<result property="month" column="month" />
|
||||||
|
<result property="deptId" column="dept_id" />
|
||||||
|
<result property="deptName" column="dept_name" />
|
||||||
|
<result property="employeeId" column="employee_id" />
|
||||||
|
<result property="employeeName" column="employee_name" />
|
||||||
|
<result property="basicSalary" column="basic_salary" />
|
||||||
|
<result property="actuallyDays" column="actually_days" />
|
||||||
|
<result property="actuallyHours" column="actually_hours" />
|
||||||
|
<result property="dayWorkHours" column="day_work_hours" />
|
||||||
|
<result property="workOrderHours" column="work_order_hours" />
|
||||||
|
<result property="overtimeWorkHours" column="overtime_work_hours" />
|
||||||
|
<result property="dayWorkPay" column="day_work_pay" />
|
||||||
|
<result property="workOrderPay" column="work_order_pay" />
|
||||||
|
<result property="overtime" column="overtime" />
|
||||||
|
<result property="banggongPay" column="banggong_pay" />
|
||||||
|
<result property="zhibanOrLahuo" column="zhiban_or_lahuo" />
|
||||||
|
<result property="holiday" column="holiday" />
|
||||||
|
<result property="post" column="post" />
|
||||||
|
<result property="phoneCharge" column="phone_charge" />
|
||||||
|
<result property="contract" column="contract" />
|
||||||
|
<result property="fullTime" column="full_time" />
|
||||||
|
<result property="diffOfLastMonth" column="diff_of_last_month" />
|
||||||
|
<result property="shoudPayMoney" column="shoud_pay_money" />
|
||||||
|
<result property="late" column="late" />
|
||||||
|
<result property="insurance" column="insurance" />
|
||||||
|
<result property="actuallyPayMoney" column="actually_pay_money" />
|
||||||
|
<result property="allButieData" column="all_butie_data" />
|
||||||
|
<result property="note" column="note" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectPaySalaryReportVo">
|
||||||
|
select id, year, month, dept_id, dept_name, employee_id, employee_name, basic_salary, actually_days, actually_hours, day_work_hours, work_order_hours, overtime_work_hours, day_work_pay, work_order_pay, zhiban_or_lahuo, overtime,banggong_pay, holiday, post, phone_charge, contract, full_time, diff_of_last_month, shoud_pay_money, late, insurance, actually_pay_money,all_butie_data, note from pay_salary_report
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getDeptPayData" resultMap="PaySalaryReportResult">
|
||||||
|
<!--<include refid="selectSgrSalaryReportVo"/> s-->
|
||||||
|
select year,month,dept_name,SUM(day_work_hours) day_work_hours,SUM(actually_pay_money) actually_pay_money from pay_salary_report s
|
||||||
|
where s.year=(select max(year) from `pay_salary_report` where tenant_id=#{tenantId}) and s.`month`=(select max(month) from `pay_salary_report` where `year`=(select max(year) from `pay_salary_report` where tenant_id=#{tenantId}))
|
||||||
|
and tenant_id=#{tenantId}
|
||||||
|
group by s.dept_name
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getMonthPayData" resultMap="PaySalaryReportResult">
|
||||||
|
SELECT s.`year`, s.`month`, SUM(actually_pay_money) actually_pay_money from `pay_salary_report` s where s.year=(select max(year) from `pay_salary_report` where tenant_id=#{tenantId}) and tenant_id=#{tenantId} group by s.`month`
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in new issue