提交 9c10ed92 authored 作者: 000516's avatar 000516 提交者: Coding

城市经理上传计划,只能上传次月计划

Merge Request: 城市经理上传计划,只能上传次月计划 Created By: @李秋林 Accepted By: @李秋林 URL: https://g-pkkp8204.coding.net/p/promotion/d/promotion-service/git/merge/297
......@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.ZoneId;
import java.util.Map;
import java.util.Objects;
......@@ -173,23 +174,24 @@ public class PromPlanCoreController {
@PostMapping("/save")
public R saveWebActivityPlan(@RequestBody ActivityPlanOperVo operVo){
boolean oneSelf = manageEmployeeQueryService.isOneSelf(operVo.getEmployeeNo());
// 1、归属人只能是城市经理
// 2、操作人如果是城市经理的话,操作人与归属人必需一致
if (!oneSelf){
throw new ParamException(RCode.ACTIVITY_PLAN_EMPLOYEE_ERROR);
}
// 操作人如果是城市经理的话,操作人与归属人必需一致
boolean operIsSelf = manageEmployeeQueryService.isOneSelf(operVo.getOperNo());
if (operIsSelf && !operVo.getEmployeeNo().equals(operVo.getOperNo())){
throw new ParamException(RCode.ACTIVITY_PLAN_EMPLOYEE_CREATE);
}
LocalDate localDate = operVo.getDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
// LocalDate nextMonthValue = LocalDate.now().plusMonths(1);
// if (operVo.getEmployeeNo().equals(operVo.getOperNo()) && (
// !YearMonth.from(localDate).equals(YearMonth.from(nextMonthValue))
// )) {
// throw new ParamException(RCode.NEXT_MONTH_PLAN_CREATE_ERROR);
// }
LocalDate nextMonthValue = LocalDate.now().plusMonths(1);
if (operVo.getEmployeeNo().equals(operVo.getOperNo()) && (
!YearMonth.from(localDate).equals(YearMonth.from(nextMonthValue))
)) {
throw new ParamException(RCode.NEXT_MONTH_PLAN_CREATE_ERROR);
}
// 上下班时间补充日期部分
operVo.setClockInTime(LocalDateTime.of(localDate,operVo.getInTime()));
operVo.setClockOutTime(LocalDateTime.of(localDate,operVo.getOutTime()));
......
......@@ -212,7 +212,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
LocalDate planDate = LocalDate.of(year, month, day);
// && monthInt != monthValue
if (monthInt != nextMonthValue && monthInt != monthValue) {
if (monthInt != nextMonthValue) {
dto.setErrorMsg("月份只能是次月;");
} else if (planDate.isBefore(LocalDate.now())) {
dto.setErrorMsg("日期不能是以前;");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论