zhanghongwei1 пре 1 година
родитељ
комит
7ff673e775

+ 18 - 0
src/main/java/com/persagy/calendar/controller/WorkCalendarDateController.java

@@ -2,6 +2,8 @@ package com.persagy.calendar.controller;
 
 import java.util.List;
 
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
@@ -48,6 +50,7 @@ import io.swagger.annotations.ApiOperation;
 @Api(tags = "工作历作息时间")
 @RestController
 @RequestMapping(value = "/v2.0/workCalendarDate", method = RequestMethod.POST)
+@Slf4j
 public class WorkCalendarDateController {
   
 	@Value("${integrated.calendar.group-code:BR}")
@@ -79,6 +82,11 @@ public class WorkCalendarDateController {
 		}*/
     	
     	if (StringUtil.isNotBlank(queryVO.getObjId())) {
+			if (StringUtils.isBlank(queryVO.getProjectId())) {
+				String objId = queryVO.getObjId();
+				queryVO.setProjectId(getProjectId(objId));
+			}
+
     		QueryWrapper<WorkCalendarObject> queryWrapper = new WorkCalendarObject.Builder().createQueryWrapper()
     				.projectIdEq(queryVO.getProjectId()).objectIdEq(queryVO.getObjId()).builderQueryWrapper();
 			WorkCalendarObject calendarObject = this.workCalendarObjectService.getOne(queryWrapper);
@@ -90,9 +98,19 @@ public class WorkCalendarDateController {
 			}
 			queryVO.setCalendarId(calendarObject.getCalendarId());
 		}
+
 		List<CalendarDateResult> dateList = this.workCalendarDateHandler.queryWorkCalendarDateList(queryVO);
 		return ResponseUtil.successResult(dateList, CollectionUtil.isEmpty(dateList) ? 0L : dateList.size());
     }
+
+	private String getProjectId(String objId) {
+		try {
+			return "Pj" + objId.substring(2, 12);
+		} catch (Exception ex) {
+			log.warn("WorkCalendarLabelHandler getProjectId error:", ex);
+		}
+		return "";
+	}
     
 	/**
      * 添加自定义作息时间