|
@@ -8,6 +8,8 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -51,6 +53,7 @@ import cn.hutool.core.util.BooleanUtil;
|
|
|
* @since 2021年3月3日: 下午6:14:49
|
|
|
*/
|
|
|
@Component
|
|
|
+@Slf4j
|
|
|
public class WorkCalendarLabelHandler {
|
|
|
|
|
|
public static final String LABEL_COLUMN = "GROUP_CODE, PROJECT_ID, CALENDAR_ID, DICT_TYPE, DICT_CODE, DIY_LABEL, DIY_VALUE, LABEL_DATE, CONVERT(SUBSTR(LABEL_DATE, 5, 2), SIGNED) AS labelMonth, CREATE_TIME, UPDATE_TIME, UPDATE_USER";
|
|
@@ -79,6 +82,12 @@ public class WorkCalendarLabelHandler {
|
|
|
public List<WorkCalendarLabel> queryCalendarLabelList(WorkCalendarLabelQueryVO queryVO) {
|
|
|
// 获取字典类型的级别
|
|
|
int dictTypeLevel = this.workCalendarDictService.getDictTypeLevel(queryVO.getGroupCode(), queryVO.getDictType());
|
|
|
+
|
|
|
+ // 获取字典类型的级别 Bd Pj37030300011 f5546f29cd64d75b57514cbb621da48
|
|
|
+ if (StringUtils.isBlank(queryVO.getProjectId()) && StringUtils.isNotBlank(queryVO.getObjId())) {
|
|
|
+ String objId = queryVO.getObjId();
|
|
|
+ queryVO.setProjectId(getProjectId(objId));
|
|
|
+ }
|
|
|
|
|
|
// 如果条件为对象ID,且属于工作历级别的类型,反查出工作历ID,再进行查询
|
|
|
if (StringUtil.isNotBlank(queryVO.getObjId()) && dictTypeLevel == 2) {
|
|
@@ -99,6 +108,15 @@ public class WorkCalendarLabelHandler {
|
|
|
.labelDateGe(queryVO.getLabelDateStart()).labelDateLe(queryVO.getLabelDateEnd()).builderQueryWrapper();
|
|
|
return this.workCalendarLabelService.list(queryWrapper.select(LABEL_COLUMN).orderByAsc(Lists.newArrayList("LABEL_DATE", "ID")));
|
|
|
}
|
|
|
+
|
|
|
+ private String getProjectId(String objId) {
|
|
|
+ try {
|
|
|
+ return "Pj" + objId.substring(2, 12);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.warn("WorkCalendarLabelHandler getProjectId error:", ex);
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询标签的有效期,仅允许查询某一项目、某一标签对应的有效期
|
|
@@ -121,6 +139,12 @@ public class WorkCalendarLabelHandler {
|
|
|
}
|
|
|
queryVO.setCalendarId(calendarObject.getCalendarId());
|
|
|
}
|
|
|
+
|
|
|
+ // 获取字典类型的级别 Bd Pj37030300011 f5546f29cd64d75b57514cbb621da48
|
|
|
+ if (StringUtils.isBlank(queryVO.getProjectId()) && StringUtils.isNotBlank(queryVO.getObjId())) {
|
|
|
+ String objId = queryVO.getObjId();
|
|
|
+ queryVO.setProjectId(getProjectId(objId));
|
|
|
+ }
|
|
|
|
|
|
QueryWrapper<WorkCalendarLabel> queryWrapper = new WorkCalendarLabel.Builder().createQueryWrapper().groupCodeEq(queryVO.getGroupCode())
|
|
|
.projectIdEq(queryVO.getProjectId(), dictTypeLevel).calendarIdEq(queryVO.getCalendarId(), dictTypeLevel)
|