job工资按照实际合同来
This commit is contained in:
parent
f0248a1079
commit
8320d97e12
|
|
@ -415,6 +415,23 @@ public class PmProjectController extends BaseController {
|
|||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工资核定详情
|
||||
*/
|
||||
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
|
||||
@GetMapping("/getSalaryByWorkerId")
|
||||
@SysLog(title = "三表一册-工资核定详情", businessType = OperaType.QUERY, module = "三表一册->工资核定详情")
|
||||
public AjaxResult getSalaryByWorkerId(ProMonthTable proMonthTable) {
|
||||
try {
|
||||
List<ProMonthTable> list = pmProjectService.getSalaryByWorkerId(proMonthTable);
|
||||
return success(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出农民工花名册
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -132,4 +132,17 @@ public class ProMonthTable {
|
|||
* 工程状态 字典表选,但直接存值
|
||||
*/
|
||||
private String proStatus;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private String workerId;
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
private String attDay;
|
||||
/**
|
||||
* 工时单价
|
||||
*/
|
||||
private String priceWage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,4 +130,6 @@ public interface PmProjectMapper {
|
|||
int updateDataStatus(ProMonthTable proMonthTable);
|
||||
|
||||
void updateMonthSalary( @Param("netSalary") BigDecimal netSalary, @Param("monthId") String monthId);
|
||||
|
||||
List<ProMonthTable> getSalaryByWorkerId(ProMonthTable proMonthTable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,6 @@ public interface PmProjectService {
|
|||
AjaxResult getSealStatus(ProMonthTable proMonthTable);
|
||||
|
||||
AjaxResult updateThreeTableOneRoster(ProMonthTable proMonthTable);
|
||||
|
||||
List<ProMonthTable> getSalaryByWorkerId(ProMonthTable proMonthTable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -338,4 +335,9 @@ public class PmProjectServiceImpl implements PmProjectService {
|
|||
int i = pmProjectMapper.updateDataStatus(proMonthTable);
|
||||
return i>0?AjaxResult.success():AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProMonthTable> getSalaryByWorkerId(ProMonthTable proMonthTable) {
|
||||
return pmProjectMapper.getSalaryByWorkerId(proMonthTable);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,4 +333,19 @@
|
|||
<update id="updateMonthSalary">
|
||||
update tb_pro_month_table set net_salary = #{netSalary} where id = #{monthId}
|
||||
</update>
|
||||
|
||||
<select id="getSalaryByWorkerId" resultType="com.bonus.bmw.domain.vo.ProMonthTable">
|
||||
SELECT
|
||||
bap.att_day,
|
||||
if(bwc.day_rate is null,0,bwc.day_rate) as price_wage
|
||||
FROM
|
||||
bm_worker_ein_day_record d
|
||||
LEFT JOIN pm_worker pw ON pw.id = d.worker_id
|
||||
inner JOIN bm_att_person bap ON bap.att_day = d.ein_day and bap.pro_id = d.pro_id and bap.worker_id = d.worker_id
|
||||
LEFT JOIN bm_worker_contract bwc on d.contract_id = bwc.id
|
||||
WHERE
|
||||
d.pro_id = #{proId}
|
||||
AND d.att_month = #{tableMonth}
|
||||
and d.worker_id = #{workerId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -26,4 +26,9 @@ public class WorkerAttDayVo {
|
|||
*/
|
||||
private String isRepair;
|
||||
|
||||
/**
|
||||
* 当日工资标准
|
||||
*/
|
||||
private double priceWage;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,4 +112,8 @@ public interface WorkerJobMapper {
|
|||
List<PmWorkerJob> getNoContractWorker();
|
||||
|
||||
void updateWorkerContractByList(List<PmWorkerJob> list);
|
||||
|
||||
List<PmWorkerJob> getWorkerContractToday(String startDate);
|
||||
|
||||
void updateWorkerContractByListToday(List<PmWorkerJob> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -131,14 +130,17 @@ public class ThreeTableOneRosterTask {
|
|||
roster.setAttendanceNum(attDealData.getAttendanceNum());
|
||||
roster.setRepairNum(attDealData.getRepairNum());
|
||||
roster.setCheckDay(attDealData.getCheckDay());
|
||||
roster.setPayMoney(attDealData.getPayMoney());
|
||||
roster.setDeductMoney(0.0);
|
||||
roster.setActualMoney(attDealData.getPayMoney());
|
||||
// 根据实际需要填充其他字段
|
||||
}
|
||||
// 计算工资,使用精度计算,如果有null返回0
|
||||
double calculatePayMoney = Optional.ofNullable(roster.getPriceWage()).orElse(0.0) *
|
||||
Optional.ofNullable(roster.getAttendanceNum()).orElse(0);
|
||||
roster.setPayMoney(calculatePayMoney);
|
||||
roster.setDeductMoney(0.0);
|
||||
roster.setActualMoney(calculatePayMoney);
|
||||
// double calculatePayMoney = Optional.ofNullable(roster.getPriceWage()).orElse(0.0) *
|
||||
// Optional.ofNullable(roster.getAttendanceNum()).orElse(0);
|
||||
// roster.setPayMoney(calculatePayMoney);
|
||||
// roster.setDeductMoney(0.0);
|
||||
// roster.setActualMoney(calculatePayMoney);
|
||||
});
|
||||
listRosterAll.addAll(listRoster);
|
||||
});
|
||||
|
|
@ -261,14 +263,17 @@ public class ThreeTableOneRosterTask {
|
|||
roster.setAttendanceNum(attDealData.getAttendanceNum());
|
||||
roster.setRepairNum(attDealData.getRepairNum());
|
||||
roster.setCheckDay(attDealData.getCheckDay());
|
||||
roster.setPayMoney(attDealData.getPayMoney());
|
||||
roster.setDeductMoney(0.0);
|
||||
roster.setActualMoney(attDealData.getPayMoney());
|
||||
// 根据实际需要填充其他字段
|
||||
}
|
||||
// 计算工资,使用精度计算,如果有null返回0
|
||||
double calculatePayMoney = Optional.ofNullable(roster.getPriceWage()).orElse(0.0) *
|
||||
Optional.ofNullable(roster.getAttendanceNum()).orElse(0);
|
||||
roster.setPayMoney(calculatePayMoney);
|
||||
roster.setDeductMoney(0.0);
|
||||
roster.setActualMoney(calculatePayMoney);
|
||||
// double calculatePayMoney = Optional.ofNullable(roster.getPriceWage()).orElse(0.0) *
|
||||
// Optional.ofNullable(roster.getAttendanceNum()).orElse(0);
|
||||
// roster.setPayMoney(calculatePayMoney);
|
||||
// roster.setDeductMoney(0.0);
|
||||
// roster.setActualMoney(calculatePayMoney);
|
||||
});
|
||||
listRosterAll.addAll(listRoster);
|
||||
});
|
||||
|
|
@ -318,9 +323,11 @@ public class ThreeTableOneRosterTask {
|
|||
//计算出勤天数
|
||||
int attNum = 0;
|
||||
int repairNum = 0;
|
||||
double salary = 0.0;
|
||||
for (WorkerAttDayVo attendanceDay : attendanceDays) {
|
||||
if("1".equals(attendanceDay.getIsAtt())){
|
||||
attNum++;
|
||||
salary += attendanceDay.getPriceWage();
|
||||
if("1".equals(attendanceDay.getIsRepair())){
|
||||
repairNum++;
|
||||
}
|
||||
|
|
@ -329,6 +336,7 @@ public class ThreeTableOneRosterTask {
|
|||
baseData.setAttendanceNum(attNum);
|
||||
baseData.setRepairNum(repairNum);
|
||||
baseData.setCheckDay(attNum-repairNum);
|
||||
baseData.setPayMoney( Math.round(salary * 100.0) / 100.0);
|
||||
JSONArray o = (JSONArray)JSON.toJSON(attendanceDays);
|
||||
// 将处理后的考勤日数据设置到基础数据中
|
||||
baseData.setAttendanceDay(JSON.toJSONString(o));
|
||||
|
|
@ -382,11 +390,12 @@ public class ThreeTableOneRosterTask {
|
|||
// 查找该日期是否有考勤记录
|
||||
ThreeTableOneRosterPo einForDate = einByDate.get(dateStr);
|
||||
if (einForDate != null) {
|
||||
// 存在考勤记录
|
||||
// 存在入场记录
|
||||
dayRecord.setIsEin("1"); // 在场
|
||||
// 检查是否有打卡记录
|
||||
if (einForDate.getAttDay() != null) {
|
||||
dayRecord.setIsAtt("1"); // 打卡
|
||||
dayRecord.setPriceWage(einForDate.getPriceWage());
|
||||
}else{
|
||||
dayRecord.setIsAtt("0");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,13 +37,24 @@ public class WorkerEinDayRecordTask{
|
|||
updateWorkerEinDayRecord(dateList);
|
||||
updateWorkerContract();
|
||||
//当天合同以最新的为准
|
||||
updateWorkerContractToday(startDate);
|
||||
}catch (Exception e){
|
||||
logger.error("人员入场更新表失败,{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 不传更新,当天
|
||||
* 当天合同以最新的为准
|
||||
*/
|
||||
private void updateWorkerContractToday(String startDate) {
|
||||
List<PmWorkerJob> list = mapper.getWorkerContractToday(startDate);
|
||||
if(list != null && !list.isEmpty()){
|
||||
mapper.updateWorkerContractByListToday(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 以最新合同id,更新所有没有合同id的人员入场记录
|
||||
*/
|
||||
public void updateWorkerContract(){
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -218,7 +218,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getWorkerAttData" resultType="com.bonus.job.domain.ThreeTableOneRosterPo">
|
||||
|
||||
SELECT
|
||||
d.pro_id,
|
||||
d.pro_name,
|
||||
|
|
@ -234,15 +233,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
d.id_number,
|
||||
d.ein_day,
|
||||
bap.att_day,
|
||||
bap.is_repair
|
||||
bap.is_repair,
|
||||
if(bwc.day_rate is null,0,bwc.day_rate) as price_wage
|
||||
FROM
|
||||
bm_worker_ein_day_record d
|
||||
LEFT JOIN pm_worker pw ON pw.id = d.worker_id
|
||||
LEFT JOIN bm_att_person bap ON bap.att_day = d.ein_day and bap.pro_id = d.pro_id and bap.worker_id = d.worker_id
|
||||
LEFT JOIN bm_worker_contract bwc on d.contract_id = bwc.id
|
||||
WHERE
|
||||
d.pro_id = #{proId}
|
||||
AND d.att_month = #{attMonth}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getWorkerPayData" resultType="com.bonus.job.domain.ThreeTableOneRosterPo">
|
||||
|
|
@ -400,4 +400,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update bm_worker_ein_day_record set contract_id = #{item.contractId} where worker_id = #{item.workerId} and pro_id = #{item.proId} and contract_id is null
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getWorkerContractToday" resultType="com.bonus.job.domain.PmWorkerJob">
|
||||
SELECT
|
||||
bwer.worker_id,
|
||||
bwer.pro_id,
|
||||
bwer.ein_day,
|
||||
bwc.id as contract_id
|
||||
FROM
|
||||
bm_worker_ein_day_record bwer
|
||||
INNER JOIN bm_worker_contract bwc ON bwer.worker_id = bwc.worker_id
|
||||
AND bwc.pro_id = bwer.pro_id
|
||||
AND bwc.is_active = 1
|
||||
WHERE
|
||||
bwer.ein_day = #{startDate}
|
||||
AND bwer.contract_id != bwc.id
|
||||
</select>
|
||||
|
||||
<update id="updateWorkerContractByListToday">
|
||||
<foreach item="item" collection="list" index="index" separator=";">
|
||||
update bm_worker_ein_day_record set contract_id = #{item.contractId} where worker_id = #{item.workerId} and pro_id = #{item.proId} and ein_day = #{item.einDay}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue