生成合同

This commit is contained in:
1073413548 2024-09-06 09:09:12 +08:00
parent 90f6140c7b
commit c591aa3200
4 changed files with 17 additions and 7 deletions

View File

@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
@ -63,12 +64,16 @@ public class CalSalaryBatch {
/** /**
* 每月1日凌晨1点执行 * 每月1日凌晨1点执行
*/ */
@Scheduled(cron = "0 0 1 1 * ?") @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "30 40 23 * * ?")
public void execute(){ public void execute(){
log.info("员工提成批处理开始"); log.info("员工提成批处理开始");
LocalDate now = this.now == null ? LocalDate.now(): this.now; LocalDate now = this.now == null ? LocalDate.now(): this.now;
LocalDate lastDayOfLastMonth = now.with(TemporalAdjusters.firstDayOfMonth());//这个月第一天0分0秒 // LocalDate lastDayOfLastMonth = now.with(TemporalAdjusters.firstDayOfMonth());//这个月第一天0分0秒
LocalDate firstDayOfLastMonth = lastDayOfLastMonth.minusMonths(1);//上个月第一天0分0秒 // LocalDate firstDayOfLastMonth = lastDayOfLastMonth.minusMonths(1);//上个月第一天0分0秒
LocalDate firstDayOfLastMonth = now.with(TemporalAdjusters.firstDayOfMonth());//这个月第一天0分0秒
LocalDate lastDayOfLastMonth = firstDayOfLastMonth.plusMonths(1);//下个月第一天0分0秒
//删除该月历史数据 //删除该月历史数据
psSalaryMapper.delete(Wrappers.<PsSalary>lambdaQuery().eq(PsSalary::getSalaryMonth,DateUtils.toString(firstDayOfLastMonth,"yyyy-MM"))); psSalaryMapper.delete(Wrappers.<PsSalary>lambdaQuery().eq(PsSalary::getSalaryMonth,DateUtils.toString(firstDayOfLastMonth,"yyyy-MM")));
log.info("查询所有员工"); log.info("查询所有员工");
@ -154,8 +159,8 @@ public class CalSalaryBatch {
unfinCode = unfinistMap.get(userId).stream().map(PsContractInfo::getContractCode).toList(); unfinCode = unfinistMap.get(userId).stream().map(PsContractInfo::getContractCode).toList();
psSalary.setUnfinishContractCode(finistMap.get(userId).stream().map(PsContractInfo::getContractCode).collect(Collectors.joining(","))); psSalary.setUnfinishContractCode(finistMap.get(userId).stream().map(PsContractInfo::getContractCode).collect(Collectors.joining(",")));
} }
psSalary.setFinishContractCode(String.join(",",finCode)); // psSalary.setFinishContractCode(String.join(",",finCode));
psSalary.setUnfinishContractCode(String.join(",",unfinCode)); // psSalary.setUnfinishContractCode(String.join(",",unfinCode));
psSalaryMapper.insert(psSalary); psSalaryMapper.insert(psSalary);
List<PsSalaryContract> lis = new ArrayList<>(); List<PsSalaryContract> lis = new ArrayList<>();
if(CollectionUtils.isNotEmpty(finCode)) { if(CollectionUtils.isNotEmpty(finCode)) {
@ -172,6 +177,10 @@ public class CalSalaryBatch {
lis.addAll(unfin); lis.addAll(unfin);
} }
} }
lis.forEach(item->{
item.setUserId(user.getUserId());
item.setSalaryRatioDate(DateUtils.toDate(firstDayOfLastMonth));
});
salaryContractMapper.insertBatch(lis); salaryContractMapper.insertBatch(lis);
} }

View File

@ -16,7 +16,7 @@ import java.util.Map;
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
public class TaskPlanVo { public class TaskPlanVo {
/** /**
* 任务状态 * 任务状态
*/ */
private String state; private String state;

View File

@ -96,7 +96,7 @@ public abstract class ApproverAbstractServiceImpl implements ApproverService {
.like(StringUtils.isNotBlank(bo.getCustomName()),"cus.custom_name",bo.getCustomName()) .like(StringUtils.isNotBlank(bo.getCustomName()),"cus.custom_name",bo.getCustomName())
.like(StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name",bo.getCompanyName()) .like(StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name",bo.getCompanyName())
//销售经理姓名 //销售经理姓名
.exists(StringUtils.isNotBlank(bo.getCustomManagerName()),"select 1 from sys_user su where su.user_id = cus.custom_manager and su.nick_name like %"+bo.getCustomManagerName()+"%") .exists(StringUtils.isNotBlank(bo.getCustomManagerName()),"select 1 from sys_user su where su.user_id = cus.custom_manager and su.nick_name like '%"+bo.getCustomManagerName()+"%'")
.orderByAsc("app.approver_status").orderByDesc("app.apply_date"); .orderByAsc("app.approver_status").orderByDesc("app.apply_date");
Page<PsApproverRecordVo> res = recordMapper.selectPageApproverList(pageQuery.build(), lqw); Page<PsApproverRecordVo> res = recordMapper.selectPageApproverList(pageQuery.build(), lqw);
if(CollectionUtils.isNotEmpty(res.getRecords())){ if(CollectionUtils.isNotEmpty(res.getRecords())){

View File

@ -154,6 +154,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
planVo.setSecState(item.getAppointStatus()); planVo.setSecState(item.getAppointStatus());
} }
}); });
planVo.setState(baseMapper.selectById(id).getTaskStatus());
return planVo; return planVo;
} }
/** /**