|
@@ -5,14 +5,8 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import com.jpsoft.shinestar.modules.base.dto.ApprovalDTO;
|
|
|
-import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
|
|
|
-import com.jpsoft.shinestar.modules.base.entity.PersonInfo;
|
|
|
-import com.jpsoft.shinestar.modules.base.entity.PersonPopedom;
|
|
|
-import com.jpsoft.shinestar.modules.base.entity.PersonRoleInfo;
|
|
|
-import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
|
|
|
-import com.jpsoft.shinestar.modules.base.service.PersonInfoService;
|
|
|
-import com.jpsoft.shinestar.modules.base.service.PersonPopedomService;
|
|
|
-import com.jpsoft.shinestar.modules.base.service.PersonRoleInfoService;
|
|
|
+import com.jpsoft.shinestar.modules.base.entity.*;
|
|
|
+import com.jpsoft.shinestar.modules.base.service.*;
|
|
|
import com.jpsoft.shinestar.modules.business.dto.YearRequestForLeaveDetailDTO;
|
|
|
import com.jpsoft.shinestar.modules.business.dto.YearRequestForLeaveInfoDTO;
|
|
|
import com.jpsoft.shinestar.modules.business.entity.YearRequestForLeaveInfo;
|
|
@@ -33,7 +27,9 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
@@ -63,6 +59,12 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
@Autowired
|
|
|
private CompanyInfoService companyInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HolidayCompanyService holidayCompanyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private HolidayInfoService holidayInfoService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "请假记录分页")
|
|
|
@PostMapping(value = "pageList")
|
|
@@ -118,15 +120,15 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
yearRequestForLeaveInfoDTO.setStatus(yearRequestForLeaveInfo.getStatus());
|
|
|
|
|
|
yearRequestForLeaveInfoDTO.setStatusN(TypeNameUtil.getExamineTypeName(yearRequestForLeaveInfo.getStatus().toString()));
|
|
|
- yearRequestForLeaveInfoDTO.setStartTime(DateUtil.format(yearRequestForLeaveInfo.getStartTime(),"yyyy-MM-dd"));
|
|
|
+ yearRequestForLeaveInfoDTO.setStartTime(DateUtil.format(yearRequestForLeaveInfo.getStartTime(), "yyyy-MM-dd"));
|
|
|
yearRequestForLeaveInfoDTO.setStartTimeQuantum(yearRequestForLeaveInfo.getStartTimeQuantum());
|
|
|
- yearRequestForLeaveInfoDTO.setEndTime(DateUtil.format(yearRequestForLeaveInfo.getEndTime(),"yyyy-MM-dd"));
|
|
|
+ yearRequestForLeaveInfoDTO.setEndTime(DateUtil.format(yearRequestForLeaveInfo.getEndTime(), "yyyy-MM-dd"));
|
|
|
yearRequestForLeaveInfoDTO.setEndTimeQuantum(yearRequestForLeaveInfo.getEndTimeQuantum());
|
|
|
- if (yearRequestForLeaveInfoDTO.getStatus() == 0){
|
|
|
+ if (yearRequestForLeaveInfoDTO.getStatus() == 0) {
|
|
|
yearRequestForLeaveInfoDTO.setMergeStatus("0");
|
|
|
yearRequestForLeaveInfoDTO.setMergeStatusN("年假待审核");
|
|
|
}
|
|
|
- if (yearRequestForLeaveInfoDTO.getStatus() == 3){
|
|
|
+ if (yearRequestForLeaveInfoDTO.getStatus() == 3) {
|
|
|
yearRequestForLeaveInfoDTO.setMergeStatus("3");
|
|
|
yearRequestForLeaveInfoDTO.setMergeStatusN("年假已拒绝");
|
|
|
}
|
|
@@ -167,12 +169,12 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
@ApiImplicitParam(name = "activityId", value = "步骤id", required = true, paramType = "form"),
|
|
|
@ApiImplicitParam(name = "draft", value = "状态(0:草稿,1:提交)", required = true, paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<Map> submitYearRequest(String id,String draft,
|
|
|
- String startTime, String endTime,
|
|
|
- String startTimeQuantum,String endTimeQuantum,
|
|
|
- String imageUrl,String reason,String days,
|
|
|
- String formId,String activityId,
|
|
|
- String token, @RequestAttribute String subject) {
|
|
|
+ public MessageResult<Map> submitYearRequest(String id, String draft,
|
|
|
+ String startTime, String endTime,
|
|
|
+ String startTimeQuantum, String endTimeQuantum,
|
|
|
+ String imageUrl, String reason, String days,
|
|
|
+ String formId, String activityId,
|
|
|
+ String token, @RequestAttribute String subject) {
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
@@ -186,7 +188,18 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
PersonInfo person = personInfoService.get(Long.parseLong(subject));
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
- String ide = yearRequestForLeaveInfoService.leaveSubmit(personPopedom,startTime,endTime, startTimeQuantum, endTimeQuantum, imageUrl,reason,days,formId,activityId,draft,id);
|
|
|
+ if (person.getWorkStatus().equals("3")) {
|
|
|
+ //正在出差中
|
|
|
+ throw new Exception("您的工作状态为出差,不能申请年假,请先结束出差再申请!");
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean rs = yearRequestForLeaveInfoService.isHoliday(startTime, endTime);
|
|
|
+ if(rs){
|
|
|
+ //当前时间范围包含节假日
|
|
|
+ throw new Exception("当前日期范围包含节假日,不能申请年假,请重新选择!");
|
|
|
+ }
|
|
|
+
|
|
|
+ String ide = yearRequestForLeaveInfoService.leaveSubmit(personPopedom, startTime, endTime, startTimeQuantum, endTimeQuantum, imageUrl, reason, days, formId, activityId, draft, id);
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -260,7 +273,6 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
|
|
|
-
|
|
|
//主业务
|
|
|
YearRequestForLeaveInfo yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(id);
|
|
|
|
|
@@ -271,31 +283,29 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("name", yearRequestForLeavePerson.getName());
|
|
|
- map.put("faceImageUrl",yearRequestForLeavePerson.getFaceImageUrl());
|
|
|
+ map.put("faceImageUrl", yearRequestForLeavePerson.getFaceImageUrl());
|
|
|
map.put("imageUrl", yearRequestForLeaveInfo.getImageUrl());
|
|
|
map.put("status", yearRequestForLeaveInfo.getStatus());
|
|
|
map.put("statusName", TypeNameUtil.getExamineTypeName(yearRequestForLeaveInfo.getStatus().toString()));
|
|
|
- map.put("startTime", DateUtil.format(yearRequestForLeaveInfo.getStartTime(),"yyyy-MM-dd"));
|
|
|
- map.put("startTimeQuantum",yearRequestForLeaveInfo.getStartTimeQuantum());
|
|
|
- map.put("endTime",DateUtil.format(yearRequestForLeaveInfo.getEndTime(),"yyyy-MM-dd"));
|
|
|
- map.put("endTimeQuantum",yearRequestForLeaveInfo.getEndTimeQuantum());
|
|
|
- map.put("days",yearRequestForLeaveInfo.getDays());
|
|
|
- map.put("reason",yearRequestForLeaveInfo.getReason());
|
|
|
- map.put("createTime",DateUtil.format(yearRequestForLeaveInfo.getCreateTime(),"yyyy-MM-dd HH:mm"));
|
|
|
-
|
|
|
-
|
|
|
- if (yearRequestForLeaveInfo.getStatus() == 0){
|
|
|
- map.put("mergeStatus","0");
|
|
|
- map.put("mergeStatusN","年假待审核");
|
|
|
+ map.put("startTime", DateUtil.format(yearRequestForLeaveInfo.getStartTime(), "yyyy-MM-dd"));
|
|
|
+ map.put("startTimeQuantum", yearRequestForLeaveInfo.getStartTimeQuantum());
|
|
|
+ map.put("endTime", DateUtil.format(yearRequestForLeaveInfo.getEndTime(), "yyyy-MM-dd"));
|
|
|
+ map.put("endTimeQuantum", yearRequestForLeaveInfo.getEndTimeQuantum());
|
|
|
+ map.put("days", yearRequestForLeaveInfo.getDays());
|
|
|
+ map.put("reason", yearRequestForLeaveInfo.getReason());
|
|
|
+ map.put("createTime", DateUtil.format(yearRequestForLeaveInfo.getCreateTime(), "yyyy-MM-dd HH:mm"));
|
|
|
+
|
|
|
+
|
|
|
+ if (yearRequestForLeaveInfo.getStatus() == 0) {
|
|
|
+ map.put("mergeStatus", "0");
|
|
|
+ map.put("mergeStatusN", "年假待审核");
|
|
|
}
|
|
|
- if (yearRequestForLeaveInfo.getStatus() == 3){
|
|
|
- map.put("mergeStatus","3");
|
|
|
- map.put("mergeStatusN","年假已拒绝");
|
|
|
+ if (yearRequestForLeaveInfo.getStatus() == 3) {
|
|
|
+ map.put("mergeStatus", "3");
|
|
|
+ map.put("mergeStatusN", "年假已拒绝");
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
messageResult.setData(map);
|
|
|
messageResult.setCode(200);
|
|
|
messageResult.setResult(true);
|
|
@@ -508,25 +518,25 @@ public class YearRequestForLeaveInfoApiController {
|
|
|
PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
|
|
|
|
|
|
Page<YearRequestForLeaveInfo> page = new Page<>();
|
|
|
- if (type == 0){
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
- searchParams.put("type","0");
|
|
|
- searchParams.put("approvalPersonPopedomId",personPopedom.getId());
|
|
|
+ if (type == 0) {
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("type", "0");
|
|
|
+ searchParams.put("approvalPersonPopedomId", personPopedom.getId());
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("a.create_time","desc"));
|
|
|
- page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ sortList.add(new Sort("a.create_time", "desc"));
|
|
|
+ page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
|
|
|
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//操作人的公司
|
|
|
CompanyInfo companyInfo = companyInfoService.get(personPopedom.getCompanyId());
|
|
|
- List<CompanyInfo> companyInfoList = companyInfoService.findAllCompanyByCode("%"+companyInfo.getId()+"%");
|
|
|
- Map<String,Object> searchParams = new HashMap<>();
|
|
|
- searchParams.put("type","1");
|
|
|
- searchParams.put("inCompanyInfo",companyInfoList);
|
|
|
+ List<CompanyInfo> companyInfoList = companyInfoService.findAllCompanyByCode("%" + companyInfo.getId() + "%");
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+ searchParams.put("type", "1");
|
|
|
+ searchParams.put("inCompanyInfo", companyInfoList);
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("a.approved_time","desc"));
|
|
|
- page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
+ sortList.add(new Sort("a.approved_time", "desc"));
|
|
|
+ page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
}
|
|
|
|
|
|
/*List<PersonRoleInfo> personRoleInfoList = personRoleInfoService.findParentId(personPopedom.getPersonRoleId());
|