diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml
index 921b168295..0162e9d520 100644
--- a/epmet-module/data-statistical/data-statistical-server/pom.xml
+++ b/epmet-module/data-statistical/data-statistical-server/pom.xml
@@ -159,7 +159,7 @@
6379
123456
- false
+ true
122.152.200.70:8848
fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
index 77df964e59..b4d298fcc4 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
@@ -190,17 +190,19 @@ public class TopicServiceImpl implements TopicService {
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
+ //现在的目标日期是[T-1] OR [目标日期]
Date targetDateCheck = null == targetDate ? calendar.getTime() : targetDate;
-
+ //现在的日历对象是[T-1] OR [目标日期]
calendar.setTime(targetDateCheck);
//如果目标日期是当月的最后一天
//if(calendar.get(Calendar.DATE) == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)){
//求出这个月的第一天
- calendar.setTime(new Date());
+
calendar.set(Calendar.DAY_OF_MONTH, NumConstant.ONE);
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
+ //现在的日历对象是 [T-1]当月的第一天 OR [目标日期]当月的第一天
// isMonthEnd = true;
//}
diff --git a/epmet-module/epmet-job/epmet-job-client/src/main/java/com/epmet/dto/ScheduleJobTypeDTO.java b/epmet-module/epmet-job/epmet-job-client/src/main/java/com/epmet/dto/ScheduleJobTypeDTO.java
new file mode 100644
index 0000000000..5a22b63cea
--- /dev/null
+++ b/epmet-module/epmet-job/epmet-job-client/src/main/java/com/epmet/dto/ScheduleJobTypeDTO.java
@@ -0,0 +1,45 @@
+package com.epmet.dto;
+
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.hibernate.validator.constraints.Range;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description
+ * @ClassName ScheduleJobTypeDTO
+ * @Auth wangc
+ * @Date 2020-07-01 11:05
+ */
+@Data
+public class ScheduleJobTypeDTO implements Serializable {
+ private static final long serialVersionUID = 398827917988646220L;
+
+ private Long id;
+
+ @NotBlank(message = "{schedule.bean.require}", groups = DefaultGroup.class)
+ private String beanName;
+
+ private String params;
+
+ @NotBlank(message = "{schedule.cron.require}", groups = DefaultGroup.class)
+ private String cronExpression;
+
+ @Range(min=0, max=1, message = "{schedule.status.range}", groups = DefaultGroup.class)
+ private Integer status;
+
+ @ApiModelProperty(value = "备注")
+ private String remark;
+
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date createDate;
+
+ private String type;
+
+ private Integer order;
+}
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java
index e8f7614752..5c12cd27bf 100644
--- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java
@@ -17,6 +17,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ScheduleJobDTO;
+import com.epmet.dto.ScheduleJobTypeDTO;
import com.epmet.service.ScheduleJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -121,4 +122,10 @@ public class ScheduleJobController {
return new Result();
}
+ @GetMapping("pageByType")
+ public Result> pageByType(@ApiIgnore @RequestParam Map params){
+ PageData page = scheduleJobService.pageByType(params);
+
+ return new Result>().ok(page);
+ }
}
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/dao/ScheduleJobDao.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/dao/ScheduleJobDao.java
index 14744f4914..259dd99845 100644
--- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/dao/ScheduleJobDao.java
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/dao/ScheduleJobDao.java
@@ -9,9 +9,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.ScheduleJobTypeDTO;
import com.epmet.entity.ScheduleJobEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.PathVariable;
+import java.util.List;
import java.util.Map;
/**
@@ -26,4 +30,9 @@ public interface ScheduleJobDao extends BaseDao {
* 批量更新状态
*/
int updateBatch(Map map);
+
+ /**
+ * 拿到所有
+ * */
+ List selectAllJobs(@Param("beanName")String beanName);
}
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScheduleJobService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScheduleJobService.java
index 306a5d3e74..8ab151cdff 100644
--- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScheduleJobService.java
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScheduleJobService.java
@@ -11,6 +11,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ScheduleJobDTO;
+import com.epmet.dto.ScheduleJobTypeDTO;
import com.epmet.entity.ScheduleJobEntity;
import java.util.Map;
@@ -60,4 +61,6 @@ public interface ScheduleJobService extends BaseService {
* 恢复运行
*/
void resume(Long[] ids);
+
+ PageData pageByType(Map params);
}
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScheduleJobServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScheduleJobServiceImpl.java
index a2954e5c42..e8f0f55d97 100644
--- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScheduleJobServiceImpl.java
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScheduleJobServiceImpl.java
@@ -16,6 +16,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.ScheduleJobDao;
import com.epmet.dto.ScheduleJobDTO;
+import com.epmet.dto.ScheduleJobTypeDTO;
import com.epmet.entity.ScheduleJobEntity;
import com.epmet.enums.ScheduleStatusEnum;
import com.epmet.service.ScheduleJobService;
@@ -26,9 +27,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
+
@Service
public class ScheduleJobServiceImpl extends BaseServiceImpl implements ScheduleJobService {
@@ -66,6 +67,7 @@ public class ScheduleJobServiceImpl extends BaseServiceImpl pageByType(Map params) {
+
+ List all = baseDao.selectAllJobs((String)params.get("beanName"));
+ //1 dim
+ //2 stats
+
+ //2.1 publicity : 2.1.1article (daily) 2.1.2tag : 2.1.2.1used(daily monthly QuarterlyAndYearly) 2.1.2.2viewed(daily monthly QuarterlyAndYearly)
+ //2.2 project (agency grid)
+ //2.3 issue
+ //2.4 group : 2.4.1 agency(daily monthly) : 2.4.2 grid(daily)
+ //2.5 topic
+ //2.6 user
+ //3 other
+
+
+ List types = new LinkedList<>();
+ types.add("DIM");types.add("OTHER");types.add("USER");types.add("GROUP");types.add("TOPIC");types.add("PROJECT");
+ types.add("ISSUE");types.add("ARTICLE");types.add("TAGUSED");types.add("TAGVIEWED");
+ int otherOrder = 0;
+ for(ScheduleJobTypeDTO job : all){
+ if(job.getBeanName().toUpperCase().contains("DIM")){
+ job.setType("DIM");
+ job.setOrder(0);
+ }else if(job.getBeanName().toUpperCase().contains("TAGUSED")){
+ job.setType("TAGUSED");
+ if(job.getBeanName().toUpperCase().contains("DAILY")){
+ job.setOrder(0);
+ }else if(job.getBeanName().toUpperCase().contains("MONTHLY")){
+ job.setOrder(1);
+ }else{
+ job.setOrder(2);
+ }
+ }else if(job.getBeanName().toUpperCase().contains("TAGVIEWED")){
+ job.setType("TAGVIEWED");
+ if(job.getBeanName().toUpperCase().contains("DAILY")){
+ job.setOrder(0);
+ }else if(job.getBeanName().toUpperCase().contains("MONTHLY")){
+ job.setOrder(1);
+ }else{
+ job.setOrder(2);
+ }
+ }else if(job.getBeanName().toUpperCase().contains("PROJECT")){
+ job.setType("PROJECT");
+ if(job.getBeanName().toUpperCase().contains("AGENCY")){
+ job.setOrder(0);
+ }else{
+ job.setOrder(1);
+ }
+ }else if(job.getBeanName().toUpperCase().contains("ARTICLE")){
+ job.setType("ARTICLE");
+ job.setOrder(1);
+ }else if(job.getBeanName().toUpperCase().contains("ISSUE")){
+ job.setType("ISSUE");
+ job.setOrder(0);
+ }else if(job.getBeanName().toUpperCase().contains("GROUP")){
+ job.setType("GROUP");
+ if(job.getBeanName().toUpperCase().contains("AGENCY")){
+ if(job.getBeanName().toUpperCase().contains("DAILY")){
+ job.setOrder(0);
+ }else{
+ job.setOrder(1);
+ }
+ }else{
+ job.setOrder(2);
+ }
+ }else if(job.getBeanName().toUpperCase().contains("TOPIC")){
+ job.setType("TOPIC");
+ job.setOrder(0);
+ }else if(job.getBeanName().toUpperCase().contains("USER")){
+ job.setType("USER");
+ job.setOrder(0);
+ }else {
+ //other
+ job.setType("OTHER");
+ job.setOrder(otherOrder);
+ otherOrder++;
+ }
+ }
+
+ List jobList = new LinkedList<>();
+ types.forEach(type -> {
+ jobList.addAll(
+ all.stream().filter(job -> StringUtils.equals(job.getType(),type)).sorted(Comparator.comparing(ScheduleJobTypeDTO :: getOrder)).collect(Collectors.toList()));
+ });
+
+ Integer page = null == params.get("page") ? 1 : Integer.parseInt((String)params.get("page"));
+ Integer limit = null == params.get("limit") ? 10 : Integer.parseInt((String)params.get("limit"));
+ Integer startIndex = (page - 1) * limit;
+ Integer endIndex = 0;
+ if(jobList.size() - (page -1) * limit <= limit){
+ endIndex = jobList.size() ;
+ }else{
+ endIndex = startIndex + limit ;
+ }
+
+ return new PageData(jobList.subList(startIndex,endIndex),all.size());
+ }
+
+
}
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/resources/mapper/ScheduleJobDao.xml b/epmet-module/epmet-job/epmet-job-server/src/main/resources/mapper/ScheduleJobDao.xml
index cc612dfac7..b73d381cf6 100644
--- a/epmet-module/epmet-job/epmet-job-server/src/main/resources/mapper/ScheduleJobDao.xml
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/resources/mapper/ScheduleJobDao.xml
@@ -11,4 +11,13 @@
+
+