bug修改
This commit is contained in:
parent
115a07de9d
commit
704bd94130
|
|
@ -23,7 +23,7 @@ public interface RemoteJobService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/ownJob/update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/ownJob/update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public AjaxResult update(@RequestPart(value = "month") String month, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public AjaxResult update(@RequestPart(value = "month") String month,@RequestPart(value = "proId") Integer proId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public class RemoteJobFallbackFactory implements FallbackFactory<RemoteJobServic
|
||||||
log.error("文件上传调用失败:{}", throwable.getMessage());
|
log.error("文件上传调用失败:{}", throwable.getMessage());
|
||||||
return new RemoteJobService(){
|
return new RemoteJobService(){
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult update(String month, String source) {
|
public AjaxResult update(String month, Integer proId, String source) {
|
||||||
return AjaxResult.error("三表一册更新报错:" + throwable.getMessage());
|
return AjaxResult.error("三表一册更新报错:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ public class PmProjectController extends BaseController {
|
||||||
*/
|
*/
|
||||||
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
|
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
|
||||||
@PostMapping("/updateSalary")
|
@PostMapping("/updateSalary")
|
||||||
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->封档")
|
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->修改代扣代缴")
|
||||||
public AjaxResult updateSalary(@Validated @RequestBody List<UserWagePayVo> userWagePay) {
|
public AjaxResult updateSalary(@Validated @RequestBody List<UserWagePayVo> userWagePay) {
|
||||||
try {
|
try {
|
||||||
int res = pmProjectService.updateSalary(userWagePay);
|
int res = pmProjectService.updateSalary(userWagePay);
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,17 @@ public class RepairCardApplyController extends BaseController {
|
||||||
return repairCardApplyMapper.saverepairCardApply(cardApplyDto, new FileBasicMsgDto(listFile, files));
|
return repairCardApplyMapper.saverepairCardApply(cardApplyDto, new FileBasicMsgDto(listFile, files));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工程是否封档
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/getProSalaryStatus")
|
||||||
|
public AjaxResult getProSalaryStatus(@RequestBody RepairCardApplyDto o) {
|
||||||
|
return repairCardApplyMapper.getProSalaryStatus(o);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改补卡申请(驳回后重新提交)
|
* 修改补卡申请(驳回后重新提交)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.bonus.bmw.domain.po.PmSubCompany;
|
||||||
import com.bonus.bmw.domain.vo.*;
|
import com.bonus.bmw.domain.vo.*;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -127,4 +128,6 @@ public interface PmProjectMapper {
|
||||||
int getSealStatus(ProMonthTable proMonthTable);
|
int getSealStatus(ProMonthTable proMonthTable);
|
||||||
|
|
||||||
int updateDataStatus(ProMonthTable proMonthTable);
|
int updateDataStatus(ProMonthTable proMonthTable);
|
||||||
|
|
||||||
|
void updateMonthSalary( @Param("netSalary") BigDecimal netSalary, @Param("monthId") String monthId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,4 +56,6 @@ public interface RepairCardApplyMapper {
|
||||||
Integer getPlayCardByWorkIdAndAttDay(RepairCardRecordDto repairCardRecord);
|
Integer getPlayCardByWorkIdAndAttDay(RepairCardRecordDto repairCardRecord);
|
||||||
|
|
||||||
List<RepairCardApplyDto> getRepairCardApplyByProMonth(RepairCardApplyDto cardApplyDto);
|
List<RepairCardApplyDto> getRepairCardApplyByProMonth(RepairCardApplyDto cardApplyDto);
|
||||||
|
|
||||||
|
String getSalaryStatus(RepairCardApplyDto cardApplyDto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,6 @@ public interface RepairCardApplyService {
|
||||||
List<CardStatisticsDto> getCardStatistics(RepairCardApplyDto cardApply);
|
List<CardStatisticsDto> getCardStatistics(RepairCardApplyDto cardApply);
|
||||||
|
|
||||||
AjaxResult updateRepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto);
|
AjaxResult updateRepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto);
|
||||||
|
|
||||||
|
AjaxResult getProSalaryStatus(RepairCardApplyDto o);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -252,6 +253,8 @@ public class PmProjectServiceImpl implements PmProjectService {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回单上传
|
* 回单上传
|
||||||
*/
|
*/
|
||||||
|
|
@ -290,7 +293,14 @@ public class PmProjectServiceImpl implements PmProjectService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateSalary(List<UserWagePayVo> userWagePay) {
|
public int updateSalary(List<UserWagePayVo> userWagePay) {
|
||||||
return pmProjectMapper.updateSalary(userWagePay);
|
int i = pmProjectMapper.updateSalary(userWagePay);
|
||||||
|
if(i>0){
|
||||||
|
BigDecimal sum = userWagePay.stream()
|
||||||
|
.map(UserWagePayVo::getActualMoney)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
pmProjectMapper.updateMonthSalary(sum, userWagePay.get(0).getMonthId());
|
||||||
|
}
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -317,7 +327,7 @@ public class PmProjectServiceImpl implements PmProjectService {
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult updateThreeTableOneRoster(ProMonthTable proMonthTable) {
|
public AjaxResult updateThreeTableOneRoster(ProMonthTable proMonthTable) {
|
||||||
try {
|
try {
|
||||||
remoteJobService.update(proMonthTable.getTableMonth(), SecurityConstants.INNER);
|
remoteJobService.update(proMonthTable.getTableMonth(), Math.toIntExact(proMonthTable.getProId()), SecurityConstants.INNER);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.bonus.bmw.domain.po.MapBeanPo;
|
||||||
import com.bonus.bmw.domain.po.PmProject;
|
import com.bonus.bmw.domain.po.PmProject;
|
||||||
import com.bonus.bmw.mapper.PmProjectMapper;
|
import com.bonus.bmw.mapper.PmProjectMapper;
|
||||||
import com.bonus.bmw.mapper.RepairCardApplyMapper;
|
import com.bonus.bmw.mapper.RepairCardApplyMapper;
|
||||||
import com.bonus.bmw.service.PmProjectService;
|
|
||||||
import com.bonus.bmw.service.RepairCardApplyService;
|
import com.bonus.bmw.service.RepairCardApplyService;
|
||||||
import com.bonus.common.core.constant.Constants;
|
import com.bonus.common.core.constant.Constants;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
|
|
@ -130,6 +129,11 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto) {
|
public AjaxResult saverepairCardApply(RepairCardApplyDto cardApplyDto, FileBasicMsgDto fileBasicMsgDto) {
|
||||||
cardApplyDto.setApplyUser(SecurityUtils.getLoginUser().getUsername());
|
cardApplyDto.setApplyUser(SecurityUtils.getLoginUser().getUsername());
|
||||||
|
// //查询工程月份是否封档
|
||||||
|
// boolean isClose =repairCardApplyMapper.getSalaryStatus(cardApplyDto);
|
||||||
|
// if (isClose) {
|
||||||
|
// return AjaxResult.error("工程"+cardApplyDto.getRepairMonth()+"已封档,无法再 补卡");
|
||||||
|
// }
|
||||||
Integer num = repairCardApplyMapper.saverepairCardApply(cardApplyDto);
|
Integer num = repairCardApplyMapper.saverepairCardApply(cardApplyDto);
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
repairCardApplyMapper.saverepairCardDetails(cardApplyDto.getId(), cardApplyDto.getRepairCardRecords());
|
repairCardApplyMapper.saverepairCardDetails(cardApplyDto.getId(), cardApplyDto.getRepairCardRecords());
|
||||||
|
|
@ -177,6 +181,12 @@ public class RepairCardApplyServiceImpl implements RepairCardApplyService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getProSalaryStatus(RepairCardApplyDto o) {
|
||||||
|
String isClose =repairCardApplyMapper.getSalaryStatus(o);
|
||||||
|
return AjaxResult.success(isClose);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer delRepairCardApply(RepairCardApplyDto cardApplyDto) {
|
public Integer delRepairCardApply(RepairCardApplyDto cardApplyDto) {
|
||||||
Integer i = repairCardApplyMapper.delRepairCardApply(cardApplyDto);
|
Integer i = repairCardApplyMapper.delRepairCardApply(cardApplyDto);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@
|
||||||
INNER JOIN pm_project pp
|
INNER JOIN pm_project pp
|
||||||
ON bwem.pro_id = pp.id and pp.is_active = 1
|
ON bwem.pro_id = pp.id and pp.is_active = 1
|
||||||
<where>
|
<where>
|
||||||
bwem.is_active = 1 and bwem.ein_status = 2 and bwem.is_upload_file = 0
|
bwem.ein_status = 2 and bwem.is_upload_file = 0
|
||||||
<if test="subComId != null">
|
<if test="subComId != null">
|
||||||
AND pp.sub_com_id
|
AND pp.sub_com_id
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -309,4 +309,4 @@
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@
|
||||||
left join pm_project pp on pp.id = tpmt.pro_id
|
left join pm_project pp on pp.id = tpmt.pro_id
|
||||||
left join pm_sub_company psc on pp.sub_com_id = psc.id
|
left join pm_sub_company psc on pp.sub_com_id = psc.id
|
||||||
<where>
|
<where>
|
||||||
|
tpmt.status != 0
|
||||||
<if test="proName != null">
|
<if test="proName != null">
|
||||||
and pp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
and pp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -329,4 +330,7 @@
|
||||||
update tb_pro_month_table set is_update = '0' where table_month = #{tableMonth}
|
update tb_pro_month_table set is_update = '0' where table_month = #{tableMonth}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateMonthSalary">
|
||||||
|
update tb_pro_month_table set net_salary = #{netSalary} where id = #{monthId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -345,4 +345,14 @@
|
||||||
AND DATE_FORMAT(brcd.current_day, '%Y-%m') = #{repairMonth}
|
AND DATE_FORMAT(brcd.current_day, '%Y-%m') = #{repairMonth}
|
||||||
AND brca.pro_id = #{proId}
|
AND brca.pro_id = #{proId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getSalaryStatus" resultType="java.lang.String">
|
||||||
|
SELECT
|
||||||
|
if(`status` = 2, 1, 0) as status
|
||||||
|
FROM
|
||||||
|
tb_pro_month_table
|
||||||
|
WHERE
|
||||||
|
table_month = #{repairMonth}
|
||||||
|
AND pro_id = #{proId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
Left join bm_worker_ein_msg bwem on pp.id = bwem.pro_id and bwem.is_active = 1 and bwem.worker_id = #{workerId}
|
Left join bm_worker_ein_msg bwem on pp.id = bwem.pro_id and bwem.is_active = 1 and bwem.worker_id = #{workerId}
|
||||||
</if>
|
</if>
|
||||||
<where>
|
<where>
|
||||||
pp.is_active = 1
|
pp.is_active = 1 and pp.pro_status != 4
|
||||||
<if test="subComId != null">
|
<if test="subComId != null">
|
||||||
and pp.sub_com_id = #{subComId}
|
and pp.sub_com_id = #{subComId}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ public class JobController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("update")
|
@PostMapping("update")
|
||||||
public AjaxResult update(String month) {
|
public AjaxResult update(String month,Integer proId) {
|
||||||
try {
|
try {
|
||||||
service.update(month);
|
service.update(month,proId);
|
||||||
return AjaxResult.success("更新成功");
|
return AjaxResult.success("更新成功");
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
return AjaxResult.error("三表一册更新报错");
|
return AjaxResult.error("三表一册更新报错");
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,5 @@ package com.bonus.job.service;
|
||||||
public interface JobService
|
public interface JobService
|
||||||
{
|
{
|
||||||
|
|
||||||
void update(String month);
|
void update(String month,Integer proId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public class JobServiceImpl implements JobService
|
||||||
private ThreeTableOneRosterTask threeTableOneRosterTask;
|
private ThreeTableOneRosterTask threeTableOneRosterTask;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(String month) {
|
public void update(String month, Integer proId) {
|
||||||
threeTableOneRosterTask.createThreeTableOneRosterData();
|
threeTableOneRosterTask.createThreeTableOneRosterData(month, proId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,121 @@ public class ThreeTableOneRosterTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三表一册 更新 手动
|
||||||
|
* 每月1号生成上月数据
|
||||||
|
*/
|
||||||
|
public void createThreeTableOneRosterData(String month, Integer proId){
|
||||||
|
try{
|
||||||
|
// 解析年月
|
||||||
|
YearMonth yearMonth = YearMonth.parse(month);
|
||||||
|
// 计算本月第一天
|
||||||
|
LocalDate firstDayOfLastMonth = yearMonth.atDay(1);
|
||||||
|
// 计算下个月第一天
|
||||||
|
LocalDate firstDayOfThisMonth = yearMonth.plusMonths(1).atDay(1);
|
||||||
|
// 计算本月总天数
|
||||||
|
int daysInLastMonth = yearMonth.lengthOfMonth();
|
||||||
|
String startTime = firstDayOfLastMonth.format(FORMATTER)+" 00:00:00";
|
||||||
|
String endTime = firstDayOfThisMonth.format(FORMATTER)+" 00:00:00";
|
||||||
|
//先去检测上一月是否已经生成三表一册
|
||||||
|
boolean isExist = mapper.getThreeTableOneRosterDataByLastMonth(month);
|
||||||
|
//更新指定工程数据
|
||||||
|
List<MapBeanVo> listPro = new ArrayList<>();
|
||||||
|
MapBeanVo vo = new MapBeanVo();
|
||||||
|
vo.setId(proId);
|
||||||
|
listPro.add(vo);
|
||||||
|
List<ThreeTableOneRosterPo> listRosterAll = new ArrayList<>();
|
||||||
|
listPro.forEach(mapBeanVo -> {
|
||||||
|
//每个工程去循环生成
|
||||||
|
//1.花名册
|
||||||
|
List<ThreeTableOneRosterPo> listRoster = mapper.getWorkerRosterData(month,startTime,endTime,mapBeanVo.getId());
|
||||||
|
//2.农民工实名制工资信息报审表
|
||||||
|
List<ThreeTableOneRosterPo> listApply = mapper.getWorkerApplyData(month,mapBeanVo.getId());
|
||||||
|
//3.考勤明细表
|
||||||
|
List<ThreeTableOneRosterPo> listAtt = mapper.getWorkerAttData(month,mapBeanVo.getId());
|
||||||
|
List<ThreeTableOneRosterPo> listAttDeal = dealAttData(listAtt,yearMonth);
|
||||||
|
//4.农民工资支付表
|
||||||
|
// 数据串联生成工资支付数据
|
||||||
|
// 通过workerId,proId将listApply、listAttDeal数据填充到listRoster
|
||||||
|
// 先将listApply按workerId和proId分组
|
||||||
|
Map<String, ThreeTableOneRosterPo> applyMap = listApply.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
item -> item.getWorkerId() + "_" + item.getProId(),
|
||||||
|
item -> item,
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
));
|
||||||
|
|
||||||
|
// 将listAttDeal按workerId和proId分组
|
||||||
|
Map<String, ThreeTableOneRosterPo> attDealMap = listAttDeal.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
item -> item.getWorkerId() + "_" + item.getProId(),
|
||||||
|
item -> item,
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
));
|
||||||
|
|
||||||
|
// 遍历listRoster,填充数据
|
||||||
|
listRoster.forEach(roster -> {
|
||||||
|
String key = roster.getWorkerId() + "_" + roster.getProId();
|
||||||
|
roster.setIsOnJob(roster.getLastExitTime() != null && !roster.getLastExitTime().isEmpty() ? "0" : "1");
|
||||||
|
roster.setMonthDay(daysInLastMonth);
|
||||||
|
// 从listApply中查找匹配的数据
|
||||||
|
ThreeTableOneRosterPo applyData = applyMap.get(key);
|
||||||
|
if (applyData != null) {
|
||||||
|
// 填充apply相关字段
|
||||||
|
roster.setBankName(applyData.getBankName());
|
||||||
|
roster.setBankCardCode(applyData.getBankCardCode());
|
||||||
|
roster.setBankIdentifierCode(applyData.getBankIdentifierCode());
|
||||||
|
roster.setContractId(applyData.getContractId());
|
||||||
|
roster.setPriceWage(applyData.getPriceWage());
|
||||||
|
roster.setPayment(applyData.getPayment());
|
||||||
|
roster.setPayDay(applyData.getPayDay());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从listAttDeal中查找匹配的数据
|
||||||
|
ThreeTableOneRosterPo attDealData = attDealMap.get(key);
|
||||||
|
if (attDealData != null) {
|
||||||
|
// 填充attDeal相关字段
|
||||||
|
roster.setAttendanceDay(attDealData.getAttendanceDay());
|
||||||
|
roster.setAttendanceNum(attDealData.getAttendanceNum());
|
||||||
|
roster.setRepairNum(attDealData.getRepairNum());
|
||||||
|
roster.setCheckDay(attDealData.getCheckDay());
|
||||||
|
// 根据实际需要填充其他字段
|
||||||
|
}
|
||||||
|
// 计算工资,使用精度计算,如果有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);
|
||||||
|
});
|
||||||
|
listRosterAll.addAll(listRoster);
|
||||||
|
});
|
||||||
|
if(!listRosterAll.isEmpty()){
|
||||||
|
//插入数据
|
||||||
|
if(isExist){
|
||||||
|
mapper.deleteWorkerPay(month);
|
||||||
|
}
|
||||||
|
mapper.insertWorkerPay(listRosterAll);
|
||||||
|
//获取整合数据
|
||||||
|
List<AttProMonthPo> listRosterMonthAll = mapper.getProMonthData(month);
|
||||||
|
for (AttProMonthPo attProMonthPo : listRosterMonthAll) {
|
||||||
|
Integer id =mapper.getProMonthDataByTable(attProMonthPo);
|
||||||
|
if(id!=null && id>0){
|
||||||
|
attProMonthPo.setId(id);
|
||||||
|
attProMonthPo.setStatus(1);
|
||||||
|
mapper.updateProMonthData(attProMonthPo);
|
||||||
|
}else{
|
||||||
|
attProMonthPo.setStatus(1);
|
||||||
|
mapper.insertProMonthData(attProMonthPo);
|
||||||
|
}
|
||||||
|
mapper.updateMonthId(attProMonthPo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("人员入场更新表失败,{}",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<ThreeTableOneRosterPo> dealAttData(List<ThreeTableOneRosterPo> listAtt, YearMonth lastMonth) {
|
private List<ThreeTableOneRosterPo> dealAttData(List<ThreeTableOneRosterPo> listAtt, YearMonth lastMonth) {
|
||||||
// 按照 workerId 分组
|
// 按照 workerId 分组
|
||||||
Map<Integer, List<ThreeTableOneRosterPo>> groupedByWorkerId = listAtt.stream()
|
Map<Integer, List<ThreeTableOneRosterPo>> groupedByWorkerId = listAtt.stream()
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,11 @@ public class WorkerEinDayRecordTask{
|
||||||
try{
|
try{
|
||||||
//非上海内工程
|
//非上海内工程
|
||||||
List<BmWorkerBlackJob> list = mapper.getWorkerExitThan30Day();
|
List<BmWorkerBlackJob> list = mapper.getWorkerExitThan30Day();
|
||||||
int count = mapper.insertWorkerBlack(list);
|
if(list != null && !list.isEmpty()){
|
||||||
logger.info("更新超30天未上传离场文件人员去失信人员成功,{}",count);
|
int count = mapper.insertWorkerBlack(list);
|
||||||
mapper.updateWorkerEinDayRecordBlackStatus(list);
|
logger.info("更新超30天未上传离场文件人员去失信人员成功,{}",count);
|
||||||
|
mapper.updateWorkerEinDayRecordBlackStatus(list);
|
||||||
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.error("人员入场更新表失败,{}",e.getMessage());
|
logger.error("人员入场更新表失败,{}",e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,36 +107,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="getWorkerRosterData" resultType="com.bonus.job.domain.ThreeTableOneRosterPo">
|
<select id="getWorkerRosterData" resultType="com.bonus.job.domain.ThreeTableOneRosterPo">
|
||||||
SELECT
|
SELECT
|
||||||
d.pro_id,
|
d.pro_id,
|
||||||
d.pro_name,
|
d.pro_name,
|
||||||
d.att_month,
|
d.att_month,
|
||||||
d.sub_id,
|
d.sub_id,
|
||||||
d.sub_name,
|
d.sub_name,
|
||||||
d.team_id,
|
d.team_id,
|
||||||
d.team_name,
|
d.team_name,
|
||||||
d.worker_id,
|
d.worker_id,
|
||||||
pw.`name`,
|
pw.`name`,
|
||||||
if(pw.sex = '男',1,0) as sex,
|
IF(pw.sex = '男', 1, 0) AS sex,
|
||||||
d.post_id,
|
d.post_id,
|
||||||
d.post_name,
|
d.post_name,
|
||||||
d.id_number,
|
d.id_number,
|
||||||
pw.address,
|
pw.address,
|
||||||
pw.phone,
|
pw.phone,
|
||||||
'花名册备注' as remark,
|
'' AS remark,
|
||||||
-- 正确的最早入场时间:所有与8月相关的入场中最早的
|
MIN(p.ein_time) AS first_ein_time,
|
||||||
MIN(p.ein_time) AS first_ein_time,
|
(
|
||||||
-- 获取最后一次“相关入场”的出场时间(即使为 null)
|
-- 子查询:获取该工人在该项目上,9月份相关记录中【最后一次入场】的 exit_time
|
||||||
(
|
SELECT p2.exit_time
|
||||||
SELECT p2.exit_time
|
FROM bm_worker_ein_pro_record p2
|
||||||
FROM bm_worker_ein_pro_record p2
|
WHERE
|
||||||
WHERE p2.worker_id = d.worker_id
|
p2.worker_id = d.worker_id
|
||||||
AND p2.pro_id = d.pro_id
|
AND p2.pro_id = d.pro_id
|
||||||
AND (
|
AND (
|
||||||
-- 情况1:入场在8月内
|
-- 条件:与2025-09有交集
|
||||||
(p2.ein_time >= #{startTime} AND p2.ein_time < #{endTime})
|
(p2.ein_time >= #{startTime} AND p2.ein_time < #{endTime})
|
||||||
OR
|
OR (p2.ein_time < #{startTime} AND (p2.exit_time IS NULL OR p2.exit_time >= #{startTime}))
|
||||||
-- 情况2:入场在8月前,但8月仍在场
|
|
||||||
(p2.ein_time < #{startTime} AND p2.exit_time >= #{startTime})
|
|
||||||
)
|
)
|
||||||
ORDER BY p2.ein_time DESC
|
ORDER BY p2.ein_time DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
|
@ -144,21 +142,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_day_record d
|
bm_worker_ein_day_record d
|
||||||
LEFT JOIN pm_worker pw ON pw.id = d.worker_id
|
LEFT JOIN pm_worker pw ON pw.id = d.worker_id
|
||||||
LEFT JOIN
|
LEFT JOIN bm_worker_ein_pro_record p ON p.worker_id = d.worker_id
|
||||||
bm_worker_ein_pro_record p
|
AND p.pro_id = d.pro_id
|
||||||
ON d.worker_id = p.worker_id
|
|
||||||
AND d.pro_id = p.pro_id
|
|
||||||
AND (
|
AND (
|
||||||
-- 同样条件:只关联与8月出勤相关的出入记录
|
|
||||||
(p.ein_time >= #{startTime} AND p.ein_time < #{endTime})
|
(p.ein_time >= #{startTime} AND p.ein_time < #{endTime})
|
||||||
OR
|
OR (p.ein_time < #{startTime} AND (p.exit_time IS NULL OR p.exit_time >= #{startTime}))
|
||||||
(p.ein_time < #{startTime} AND p.exit_time >= #{startTime})
|
|
||||||
)
|
)
|
||||||
WHERE
|
WHERE
|
||||||
d.pro_id = #{proId}
|
d.pro_id = #{proId}
|
||||||
AND d.att_month = #{attMonth}
|
AND d.att_month = #{attMonth}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
d.worker_id;
|
d.worker_id
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getWorkerApplyData" resultType="com.bonus.job.domain.ThreeTableOneRosterPo">
|
<select id="getWorkerApplyData" resultType="com.bonus.job.domain.ThreeTableOneRosterPo">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue