三表一册数据来源
This commit is contained in:
parent
e67f6b8bb8
commit
43f47ec34d
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bonus.job.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AttProMonthPo {
|
||||||
|
private Integer proId;
|
||||||
|
private String month;
|
||||||
|
private Integer rosterNum;
|
||||||
|
private Integer attendanceNum;
|
||||||
|
private Integer repairNum;
|
||||||
|
private Integer salaryNum;
|
||||||
|
private Integer subNum;
|
||||||
|
private Integer teamNum;
|
||||||
|
private Double grossSalary;
|
||||||
|
private Double netSalary;
|
||||||
|
private Integer payNum;
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package com.bonus.job.mapper;
|
package com.bonus.job.mapper;
|
||||||
|
|
||||||
import com.bonus.job.domain.BmWorkerBlackJob;
|
import com.bonus.job.domain.*;
|
||||||
import com.bonus.job.domain.MapBeanVo;
|
|
||||||
import com.bonus.job.domain.PmWorkerJob;
|
|
||||||
import com.bonus.job.domain.ThreeTableOneRosterPo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -92,4 +89,12 @@ public interface WorkerJobMapper {
|
||||||
boolean getThreeTableOneRosterDataByLastMonth(String string);
|
boolean getThreeTableOneRosterDataByLastMonth(String string);
|
||||||
|
|
||||||
void deleteWorkerPay(String lastMonth);
|
void deleteWorkerPay(String lastMonth);
|
||||||
|
|
||||||
|
List<AttProMonthPo> getProMonthData(String lastMonth);
|
||||||
|
|
||||||
|
boolean getProMonthDataByTable(AttProMonthPo attProMonthPo);
|
||||||
|
|
||||||
|
void insertProMonthData(AttProMonthPo attProMonthPo);
|
||||||
|
|
||||||
|
void updateProMonthData(AttProMonthPo attProMonthPo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.job.task;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.bonus.job.domain.AttProMonthPo;
|
||||||
import com.bonus.job.domain.MapBeanVo;
|
import com.bonus.job.domain.MapBeanVo;
|
||||||
import com.bonus.job.domain.ThreeTableOneRosterPo;
|
import com.bonus.job.domain.ThreeTableOneRosterPo;
|
||||||
import com.bonus.job.domain.WorkerAttDayVo;
|
import com.bonus.job.domain.WorkerAttDayVo;
|
||||||
|
|
@ -133,6 +134,16 @@ public class ThreeTableOneRosterTask {
|
||||||
mapper.deleteWorkerPay(lastMonth.toString());
|
mapper.deleteWorkerPay(lastMonth.toString());
|
||||||
}
|
}
|
||||||
mapper.insertWorkerPay(listRosterAll);
|
mapper.insertWorkerPay(listRosterAll);
|
||||||
|
//获取整合数据
|
||||||
|
List<AttProMonthPo> listRosterMonthAll = mapper.getProMonthData(lastMonth.toString());
|
||||||
|
for (AttProMonthPo attProMonthPo : listRosterMonthAll) {
|
||||||
|
boolean isExistMonth =mapper.getProMonthDataByTable(attProMonthPo);
|
||||||
|
if(isExistMonth){
|
||||||
|
mapper.updateProMonthData(attProMonthPo);
|
||||||
|
}else{
|
||||||
|
mapper.insertProMonthData(attProMonthPo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.error("人员入场更新表失败,{}",e.getMessage());
|
logger.error("人员入场更新表失败,{}",e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -299,4 +299,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<delete id="deleteWorkerPay">
|
<delete id="deleteWorkerPay">
|
||||||
delete from tb_pro_month_table_roster where month = #{lastMonth}
|
delete from tb_pro_month_table_roster where month = #{lastMonth}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getProMonthData" resultType="com.bonus.job.domain.AttProMonthPo">
|
||||||
|
SELECT
|
||||||
|
pro_id,
|
||||||
|
`month`,
|
||||||
|
count(user_id) AS rosterNum,
|
||||||
|
sum(attendance_num) AS attendanceNum,
|
||||||
|
sum(repair_num) AS repairNum,
|
||||||
|
count(user_id) AS salaryNum,
|
||||||
|
count(DISTINCT sub_id) AS subNum,
|
||||||
|
count(DISTINCT team_id) AS teamNum,
|
||||||
|
sum(pay_money) AS grossSalary,
|
||||||
|
sum(actual_money) AS netSalary,
|
||||||
|
count(user_id) AS payNum
|
||||||
|
FROM
|
||||||
|
tb_pro_month_table_roster
|
||||||
|
WHERE
|
||||||
|
`month` = #{lastMonth}
|
||||||
|
GROUP BY
|
||||||
|
pro_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getProMonthDataByTable" resultType="boolean">
|
||||||
|
SELECT
|
||||||
|
COUNT(1) AS count
|
||||||
|
FROM
|
||||||
|
tb_pro_month_table
|
||||||
|
WHERE
|
||||||
|
table_month = #{month} and pro_id = #{proId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertProMonthData">
|
||||||
|
insert into tb_pro_month_table(pro_id,table_month,roster_num,attendance_num,repair_num,salary_num,sub_num,team_num,gross_salary,net_salary,pay_num)
|
||||||
|
values(#{proId},#{month},#{rosterNum},#{attendanceNum},#{repairNum},#{salaryNum},#{subNum},#{teamNum},#{grossSalary},#{netSalary},#{payNum})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateProMonthData">
|
||||||
|
update tb_pro_month_table set roster_num=#{rosterNum},attendance_num=#{attendanceNum},repair_num=#{repairNum},salary_num=#{salaryNum},
|
||||||
|
sub_num=#{subNum},team_num=#{teamNum},gross_salary=#{grossSalary},net_salary=#{netSalary},pay_num=#{payNum}
|
||||||
|
where pro_id=#{proId} and table_month=#{month}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue