Browse Source

Merge branch 'tall3' of dd.tall.wiki:ccsens_wiki/ccsenscloud into tall3

tall3
zhizhi wu 4 years ago
parent
commit
b198cfa5f8
  1. 7
      common/src/main/java/com/ccsens/common/bean/dto/CProjectDto.java
  2. 8
      common/src/main/java/com/ccsens/common/bean/dto/CTaskDto.java
  3. 106
      common/src/main/java/com/ccsens/common/bean/po/SysHolidays.java
  4. 711
      common/src/main/java/com/ccsens/common/bean/po/SysHolidaysExample.java
  5. 2
      common/src/main/java/com/ccsens/common/bean/vo/CProjectVo.java
  6. 6
      common/src/main/java/com/ccsens/common/bean/vo/CRoleVo.java
  7. 30
      common/src/main/java/com/ccsens/common/bean/vo/CTaskVo.java
  8. 9
      common/src/main/java/com/ccsens/common/persist/dao/ProMemberDao.java
  9. 7
      common/src/main/java/com/ccsens/common/persist/dao/ProParentTaskDao.java
  10. 10
      common/src/main/java/com/ccsens/common/persist/dao/ProProjectDao.java
  11. 38
      common/src/main/java/com/ccsens/common/persist/dao/ProRoleDao.java
  12. 8
      common/src/main/java/com/ccsens/common/persist/dao/ProTaskDetailDao.java
  13. 30
      common/src/main/java/com/ccsens/common/persist/mapper/SysHolidaysMapper.java
  14. 2
      common/src/main/java/com/ccsens/common/service/IProRoleService.java
  15. 19
      common/src/main/java/com/ccsens/common/service/IProjectService.java
  16. 9
      common/src/main/java/com/ccsens/common/service/ITaskService.java
  17. 752
      common/src/main/java/com/ccsens/common/service/ProRoleService.java
  18. 175
      common/src/main/java/com/ccsens/common/service/ProjectService.java
  19. 94
      common/src/main/java/com/ccsens/common/service/TaskService.java
  20. 4
      common/src/main/resources/application.yml
  21. 10
      common/src/main/resources/mapper_dao/ProMemberDao.xml
  22. 26
      common/src/main/resources/mapper_dao/ProParentTaskDao.xml
  23. 33
      common/src/main/resources/mapper_dao/ProProjectDao.xml
  24. 83
      common/src/main/resources/mapper_dao/ProRoleDao.xml
  25. 32
      common/src/main/resources/mapper_dao/ProTaskDetailDao.xml
  26. 258
      common/src/main/resources/mapper_raw/SysHolidaysMapper.xml
  27. 12
      signin/src/main/java/com/ccsens/signin/service/ProjectService.java
  28. 41
      tall/src/main/java/com/ccsens/tall/web/DebugController.java
  29. 2
      tall/src/main/resources/application-dev.yml
  30. 25
      util/src/main/java/com/ccsens/util/CodeError.java
  31. 1
      util/src/main/java/com/ccsens/util/RestTemplateUtil.java
  32. 7
      util/src/main/java/com/ccsens/util/cron/NatureConstant.java
  33. 139
      util/src/main/java/com/ccsens/util/cron/NatureToDate.java
  34. 202
      util/src/test/java/com/ccsens/util/DateTest.java
  35. 38
      util/src/test/java/com/ccsens/util/OtherTest.java

7
common/src/main/java/com/ccsens/common/bean/dto/CProjectDto.java

@ -49,4 +49,11 @@ public class CProjectDto {
@ApiModelProperty("所属角色的名称")
private String roleName;
}
@Data
@ApiModel("查询子项目信息")
public static class FindSonProject {
@ApiModelProperty("项目id")
private Long projectId;
}
}

8
common/src/main/java/com/ccsens/common/bean/dto/CTaskDto.java

@ -69,4 +69,12 @@ public class CTaskDto {
@ApiModelProperty("关联的绝对时间")
private Long timeDifference;
}
@Data
@ApiModel("查询子任务信息")
public static class FindSonTask{
@NotNull(message = "任务id不能为空")
@ApiModelProperty("任务详情id")
private Long detailId;
}
}

106
common/src/main/java/com/ccsens/common/bean/po/SysHolidays.java

@ -0,0 +1,106 @@
package com.ccsens.common.bean.po;
import java.io.Serializable;
import java.util.Date;
public class SysHolidays implements Serializable {
private Long id;
private String year;
private String holiday;
private String workday;
private Long operator;
private Date createdAt;
private Date updatedAt;
private Byte recStatus;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year == null ? null : year.trim();
}
public String getHoliday() {
return holiday;
}
public void setHoliday(String holiday) {
this.holiday = holiday == null ? null : holiday.trim();
}
public String getWorkday() {
return workday;
}
public void setWorkday(String workday) {
this.workday = workday == null ? null : workday.trim();
}
public Long getOperator() {
return operator;
}
public void setOperator(Long operator) {
this.operator = operator;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Byte getRecStatus() {
return recStatus;
}
public void setRecStatus(Byte recStatus) {
this.recStatus = recStatus;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", year=").append(year);
sb.append(", holiday=").append(holiday);
sb.append(", workday=").append(workday);
sb.append(", operator=").append(operator);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append("]");
return sb.toString();
}
}

711
common/src/main/java/com/ccsens/common/bean/po/SysHolidaysExample.java

@ -0,0 +1,711 @@
package com.ccsens.common.bean.po;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SysHolidaysExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysHolidaysExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andYearIsNull() {
addCriterion("year is null");
return (Criteria) this;
}
public Criteria andYearIsNotNull() {
addCriterion("year is not null");
return (Criteria) this;
}
public Criteria andYearEqualTo(String value) {
addCriterion("year =", value, "year");
return (Criteria) this;
}
public Criteria andYearNotEqualTo(String value) {
addCriterion("year <>", value, "year");
return (Criteria) this;
}
public Criteria andYearGreaterThan(String value) {
addCriterion("year >", value, "year");
return (Criteria) this;
}
public Criteria andYearGreaterThanOrEqualTo(String value) {
addCriterion("year >=", value, "year");
return (Criteria) this;
}
public Criteria andYearLessThan(String value) {
addCriterion("year <", value, "year");
return (Criteria) this;
}
public Criteria andYearLessThanOrEqualTo(String value) {
addCriterion("year <=", value, "year");
return (Criteria) this;
}
public Criteria andYearLike(String value) {
addCriterion("year like", value, "year");
return (Criteria) this;
}
public Criteria andYearNotLike(String value) {
addCriterion("year not like", value, "year");
return (Criteria) this;
}
public Criteria andYearIn(List<String> values) {
addCriterion("year in", values, "year");
return (Criteria) this;
}
public Criteria andYearNotIn(List<String> values) {
addCriterion("year not in", values, "year");
return (Criteria) this;
}
public Criteria andYearBetween(String value1, String value2) {
addCriterion("year between", value1, value2, "year");
return (Criteria) this;
}
public Criteria andYearNotBetween(String value1, String value2) {
addCriterion("year not between", value1, value2, "year");
return (Criteria) this;
}
public Criteria andHolidayIsNull() {
addCriterion("holiday is null");
return (Criteria) this;
}
public Criteria andHolidayIsNotNull() {
addCriterion("holiday is not null");
return (Criteria) this;
}
public Criteria andHolidayEqualTo(String value) {
addCriterion("holiday =", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayNotEqualTo(String value) {
addCriterion("holiday <>", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayGreaterThan(String value) {
addCriterion("holiday >", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayGreaterThanOrEqualTo(String value) {
addCriterion("holiday >=", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayLessThan(String value) {
addCriterion("holiday <", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayLessThanOrEqualTo(String value) {
addCriterion("holiday <=", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayLike(String value) {
addCriterion("holiday like", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayNotLike(String value) {
addCriterion("holiday not like", value, "holiday");
return (Criteria) this;
}
public Criteria andHolidayIn(List<String> values) {
addCriterion("holiday in", values, "holiday");
return (Criteria) this;
}
public Criteria andHolidayNotIn(List<String> values) {
addCriterion("holiday not in", values, "holiday");
return (Criteria) this;
}
public Criteria andHolidayBetween(String value1, String value2) {
addCriterion("holiday between", value1, value2, "holiday");
return (Criteria) this;
}
public Criteria andHolidayNotBetween(String value1, String value2) {
addCriterion("holiday not between", value1, value2, "holiday");
return (Criteria) this;
}
public Criteria andWorkdayIsNull() {
addCriterion("workday is null");
return (Criteria) this;
}
public Criteria andWorkdayIsNotNull() {
addCriterion("workday is not null");
return (Criteria) this;
}
public Criteria andWorkdayEqualTo(String value) {
addCriterion("workday =", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayNotEqualTo(String value) {
addCriterion("workday <>", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayGreaterThan(String value) {
addCriterion("workday >", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayGreaterThanOrEqualTo(String value) {
addCriterion("workday >=", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayLessThan(String value) {
addCriterion("workday <", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayLessThanOrEqualTo(String value) {
addCriterion("workday <=", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayLike(String value) {
addCriterion("workday like", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayNotLike(String value) {
addCriterion("workday not like", value, "workday");
return (Criteria) this;
}
public Criteria andWorkdayIn(List<String> values) {
addCriterion("workday in", values, "workday");
return (Criteria) this;
}
public Criteria andWorkdayNotIn(List<String> values) {
addCriterion("workday not in", values, "workday");
return (Criteria) this;
}
public Criteria andWorkdayBetween(String value1, String value2) {
addCriterion("workday between", value1, value2, "workday");
return (Criteria) this;
}
public Criteria andWorkdayNotBetween(String value1, String value2) {
addCriterion("workday not between", value1, value2, "workday");
return (Criteria) this;
}
public Criteria andOperatorIsNull() {
addCriterion("operator is null");
return (Criteria) this;
}
public Criteria andOperatorIsNotNull() {
addCriterion("operator is not null");
return (Criteria) this;
}
public Criteria andOperatorEqualTo(Long value) {
addCriterion("operator =", value, "operator");
return (Criteria) this;
}
public Criteria andOperatorNotEqualTo(Long value) {
addCriterion("operator <>", value, "operator");
return (Criteria) this;
}
public Criteria andOperatorGreaterThan(Long value) {
addCriterion("operator >", value, "operator");
return (Criteria) this;
}
public Criteria andOperatorGreaterThanOrEqualTo(Long value) {
addCriterion("operator >=", value, "operator");
return (Criteria) this;
}
public Criteria andOperatorLessThan(Long value) {
addCriterion("operator <", value, "operator");
return (Criteria) this;
}
public Criteria andOperatorLessThanOrEqualTo(Long value) {
addCriterion("operator <=", value, "operator");
return (Criteria) this;
}
public Criteria andOperatorIn(List<Long> values) {
addCriterion("operator in", values, "operator");
return (Criteria) this;
}
public Criteria andOperatorNotIn(List<Long> values) {
addCriterion("operator not in", values, "operator");
return (Criteria) this;
}
public Criteria andOperatorBetween(Long value1, Long value2) {
addCriterion("operator between", value1, value2, "operator");
return (Criteria) this;
}
public Criteria andOperatorNotBetween(Long value1, Long value2) {
addCriterion("operator not between", value1, value2, "operator");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;
}
public Criteria andCreatedAtIsNotNull() {
addCriterion("created_at is not null");
return (Criteria) this;
}
public Criteria andCreatedAtEqualTo(Date value) {
addCriterion("created_at =", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotEqualTo(Date value) {
addCriterion("created_at <>", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThan(Date value) {
addCriterion("created_at >", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("created_at >=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThan(Date value) {
addCriterion("created_at <", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtLessThanOrEqualTo(Date value) {
addCriterion("created_at <=", value, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtIn(List<Date> values) {
addCriterion("created_at in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotIn(List<Date> values) {
addCriterion("created_at not in", values, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtBetween(Date value1, Date value2) {
addCriterion("created_at between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andCreatedAtNotBetween(Date value1, Date value2) {
addCriterion("created_at not between", value1, value2, "createdAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNull() {
addCriterion("updated_at is null");
return (Criteria) this;
}
public Criteria andUpdatedAtIsNotNull() {
addCriterion("updated_at is not null");
return (Criteria) this;
}
public Criteria andUpdatedAtEqualTo(Date value) {
addCriterion("updated_at =", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotEqualTo(Date value) {
addCriterion("updated_at <>", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThan(Date value) {
addCriterion("updated_at >", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) {
addCriterion("updated_at >=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThan(Date value) {
addCriterion("updated_at <", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtLessThanOrEqualTo(Date value) {
addCriterion("updated_at <=", value, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtIn(List<Date> values) {
addCriterion("updated_at in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotIn(List<Date> values) {
addCriterion("updated_at not in", values, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtBetween(Date value1, Date value2) {
addCriterion("updated_at between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andUpdatedAtNotBetween(Date value1, Date value2) {
addCriterion("updated_at not between", value1, value2, "updatedAt");
return (Criteria) this;
}
public Criteria andRecStatusIsNull() {
addCriterion("rec_status is null");
return (Criteria) this;
}
public Criteria andRecStatusIsNotNull() {
addCriterion("rec_status is not null");
return (Criteria) this;
}
public Criteria andRecStatusEqualTo(Byte value) {
addCriterion("rec_status =", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotEqualTo(Byte value) {
addCriterion("rec_status <>", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThan(Byte value) {
addCriterion("rec_status >", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) {
addCriterion("rec_status >=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThan(Byte value) {
addCriterion("rec_status <", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusLessThanOrEqualTo(Byte value) {
addCriterion("rec_status <=", value, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusIn(List<Byte> values) {
addCriterion("rec_status in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotIn(List<Byte> values) {
addCriterion("rec_status not in", values, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusBetween(Byte value1, Byte value2) {
addCriterion("rec_status between", value1, value2, "recStatus");
return (Criteria) this;
}
public Criteria andRecStatusNotBetween(Byte value1, Byte value2) {
addCriterion("rec_status not between", value1, value2, "recStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

2
common/src/main/java/com/ccsens/common/bean/vo/CProjectVo.java

@ -35,6 +35,8 @@ public class CProjectVo {
private Long realDuration;
@ApiModelProperty("真实结束时间")
private Long realEndTime;
@ApiModelProperty("项目的url")
private String url;
}

6
common/src/main/java/com/ccsens/common/bean/vo/CRoleVo.java

@ -26,13 +26,13 @@ public class CRoleVo {
@ApiModelProperty("角色id")
private Long id;
@ApiModelProperty("是否是项目经理 0否 1是")
private Long pm;
private int pm;
@ApiModelProperty("是否是自己所属的角色 0否 1是")
private Long mine;
private int mine;
@ApiModelProperty("角色名")
private String name;
@ApiModelProperty("排序")
private Long sequence;
private int sequence;
}
@Data

30
common/src/main/java/com/ccsens/common/bean/vo/CTaskVo.java

@ -102,4 +102,34 @@ public class CTaskVo {
private Long parentTaskDetailId;
}
@Data
@ApiModel("子任务信息")
public static class SonTaskDetail{
@ApiModelProperty("任务详情id")
private Long detailId;
@ApiModelProperty("任务名称")
private String name;
@ApiModelProperty("任务描述")
private String description;
@ApiModelProperty("重复频率")
private String cycle;
//以下是任务关系表
@ApiModelProperty("计划开始时间")
private Long planStartTime;
@ApiModelProperty("计划时长")
private Long planDuration;
@ApiModelProperty("计划结束时间")
private Long planEndTime;
@ApiModelProperty("实际开始时间")
private Long realStartTime;
@ApiModelProperty("实际时长")
private Long realDuration;
@ApiModelProperty("实际结束时间")
private Long realEndTime;
@ApiModelProperty("任务完成状态 0未开始 1进行中 2暂停 3完成")
private Byte taskStatus;
}
}

9
common/src/main/java/com/ccsens/common/persist/dao/ProMemberDao.java

@ -4,6 +4,8 @@ import com.ccsens.common.persist.mapper.ProMemberMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@ -17,4 +19,11 @@ public interface ProMemberDao extends ProMemberMapper {
* @return 用户的成员id
*/
Long findUserOfMemberId(@Param("projectId") Long projectId,@Param("userId") Long userId);
/**
* 查询项目下的所有成员
* @param projectId 项目id
* @return 列表
*/
List<Long> queryMembersOfProject(@Param("projectId") Long projectId);
}

7
common/src/main/java/com/ccsens/common/persist/dao/ProParentTaskDao.java

@ -24,4 +24,11 @@ public interface ProParentTaskDao extends ProParentTaskMapper {
* @param newParentTaskList 任务关系列表
*/
void insertAllParentTask(@Param("newParentTaskList") List<ProParentTask> newParentTaskList);
/**
* 根据项目id查询所有一二级任务详情id
* @param projectId 项目id
* @return 一二级任务详情id列表
*/
List<Long> queryAllTaskIdByProjectId(@Param("projectId") Long projectId);
}

10
common/src/main/java/com/ccsens/common/persist/dao/ProProjectDao.java

@ -1,9 +1,12 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.dto.CProjectDto;
import com.ccsens.common.bean.vo.CProjectVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@ -16,4 +19,11 @@ public interface ProProjectDao{
* @return 项目详情
*/
CProjectVo.ProjectInfo findProjectById(@Param("projectId") Long projectId);
/**
* 查询子项目列表
* @param param 项目id
* @return 子项目列表
*/
List<CProjectVo.ProjectInfo> findSonProjectId(CProjectDto.FindSonProject param);
}

38
common/src/main/java/com/ccsens/common/persist/dao/ProRoleDao.java

@ -64,4 +64,42 @@ public interface ProRoleDao extends ProRoleMapper {
* @return 角色列表
*/
List<CRoleVo.AllRole> findAllRoleById(@Param("roleId") Long roleId);
/**
* 根据userId查询项目下所属的角色
* @param projectId
* @param userId
* @return
*/
List<ProRole> queryRoleByUserId(@Param("projectId")Long projectId, @Param("userId")Long userId);
/**
* 不是关注者查询可见角色
* @param projectId
* @param userRoleList
* @return
*/
List<CRoleVo.RoleInfo> notAttentionQueryRole(@Param("projectId")Long projectId, @Param("userRoleList")List<ProRole> userRoleList);
/**
* 是关注者查询可见角色
* @param projectId
* @return
*/
List<CRoleVo.RoleInfo> attentionQueryRole(@Param("projectId")Long projectId);
/**
* 查询用户配置的角色栏信息
* @param projectId
* @param userId
* @return
*/
List<Long> queryShowByUserAndProject(@Param("projectId")Long projectId, @Param("userId")Long userId);
/**
* 查询项目下的所有角色
* @param projectId 项目id
* @return 角色id列表
*/
List<Long> queryRoleListOfProject(@Param("projectId")Long projectId);
}

8
common/src/main/java/com/ccsens/common/persist/dao/ProTaskDetailDao.java

@ -1,5 +1,6 @@
package com.ccsens.common.persist.dao;
import com.ccsens.common.bean.dto.CTaskDto;
import com.ccsens.common.bean.po.ProTaskDetail;
import com.ccsens.common.bean.po.ProTaskStatusRecord;
import com.ccsens.common.bean.vo.CTaskVo;
@ -71,4 +72,11 @@ public interface ProTaskDetailDao extends ProTaskDetailMapper {
* @param newTaskDetailList 任务详情列表
*/
void insertAllTaskDetail(@Param("newTaskDetailList") List<ProTaskDetail> newTaskDetailList);
/**
* 查询子任务列表
* @param param 项目id
* @return 子任务列表
*/
List<CTaskVo.SonTaskDetail> findSonTask(CTaskDto.FindSonTask param);
}

30
common/src/main/java/com/ccsens/common/persist/mapper/SysHolidaysMapper.java

@ -0,0 +1,30 @@
package com.ccsens.common.persist.mapper;
import com.ccsens.common.bean.po.SysHolidays;
import com.ccsens.common.bean.po.SysHolidaysExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysHolidaysMapper {
long countByExample(SysHolidaysExample example);
int deleteByExample(SysHolidaysExample example);
int deleteByPrimaryKey(Long id);
int insert(SysHolidays record);
int insertSelective(SysHolidays record);
List<SysHolidays> selectByExample(SysHolidaysExample example);
SysHolidays selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysHolidays record, @Param("example") SysHolidaysExample example);
int updateByExample(@Param("record") SysHolidays record, @Param("example") SysHolidaysExample example);
int updateByPrimaryKeySelective(SysHolidays record);
int updateByPrimaryKey(SysHolidays record);
}

2
common/src/main/java/com/ccsens/common/service/IProRoleService.java

@ -8,4 +8,6 @@ public interface IProRoleService {
CRoleVo.QueryRole QueryShowRole(CRoleDto.QueryRoleById param, Long userId);
void updateShowRole(CRoleDto.UpdateRoleShow param, Long userId);
CRoleVo.QueryRole queryShowRole(CRoleDto.QueryRoleById param, Long userId);
}

19
common/src/main/java/com/ccsens/common/service/IProjectService.java

@ -3,6 +3,8 @@ package com.ccsens.common.service;
import com.ccsens.common.bean.dto.CProjectDto;
import com.ccsens.common.bean.vo.CProjectVo;
import java.util.List;
/**
* @author ma
*/
@ -25,7 +27,22 @@ public interface IProjectService {
/**
* 为复制的项目添加成员
* @return
*/
void addMemberForCopy(CProjectDto.MemberForProject param,Long userId);
/**
* 查询子项目信息
* @param param 项目id
* @param userId 用户id
* @return 子项目信息列表
*/
List<CProjectVo.ProjectInfo> findSonProject(CProjectDto.FindSonProject param, Long userId);
/**
* 删除项目及相关配置
* @param param 项目id
* @param userId 用户id
*/
void deleteProjectById(CProjectDto.ProjectById param, Long userId);
}

9
common/src/main/java/com/ccsens/common/service/ITaskService.java

@ -47,4 +47,13 @@ public interface ITaskService {
* @param updateTaskProcesses 任务信息
*/
void updateTaskProcess(List<CTaskDto.UpdateTaskProcess> updateTaskProcesses);
/**
*查询子任务
* @param param 任务id
* @param userId 用户id
* @return 子项目列表
*/
List<CTaskVo.SonTaskDetail> findSonTask(CTaskDto.FindSonTask param,Long userId);
}

752
common/src/main/java/com/ccsens/common/service/ProRoleService.java

@ -51,348 +51,348 @@ public class ProRoleService implements IProRoleService {
@Override
public CRoleVo.QueryRole QueryShowRole(CRoleDto.QueryRoleById param, Long userId) {
CRoleVo.QueryRole role = new CRoleVo.QueryRole();
//角色显示的角色
List<CRoleVo.RoleInfo> visibleList = new ArrayList<>();
//不显示的角色
List<CRoleVo.RoleInfo> invisibleList = new ArrayList<>();
//查询当前用户所属的角色的list
List<Long> roleIds = new ArrayList<>();
//对自己不可见的角色的list
List<Long> roleIds1 = new ArrayList<>();
//判断是否是关注者 用户不是项目下的成员 并且 用户是成员但不属于任何角色 就是关注者
// 判断用户是成员但是不属于任何角色 在成员表下查询到 成员信息
ProMemberExample proMemberExample = new ProMemberExample();
proMemberExample.createCriteria().andUserIdEqualTo(userId).andProjectIdEqualTo(param.getProjectId());
List<ProMember> proMembers = proMemberMapper.selectByExample(proMemberExample); //默认一个
//判断用户是不是项目下的成员
List<ProRole> proRoles = new ArrayList<>();
//排序后的
List<ProRole> proRoles1 = new ArrayList<>();
if (CollectionUtil.isNotEmpty(proMembers)) {
//判断用户是成员是不是有角色 通过成员id来判断
ProRoleMemberExample proRoleMemberExample = new ProRoleMemberExample();
proRoleMemberExample.createCriteria().andMemberIdEqualTo(proMembers.get(0).getId());
List<ProRoleMember> proRoleMembers = proRoleMemberMapper.selectByExample(proRoleMemberExample);
if (CollectionUtil.isNotEmpty(proRoleMembers)) {
//用户不是关注者 否 不是才是关注者
//用户有角色 角色是那个 查询当前用户所属的角色
Long roleId1 = 0L;
//List<Long> roleIds =null; //查询当前用户所属的角色
for (ProRoleMember proRoleMember : proRoleMembers) {
Long roleId = proRoleMember.getRoleId();//查询当前用户所属的角色 后端 前端
roleIds.add(roleId);
ProRoleRepulsionExample proRoleRepulsionExample = new ProRoleRepulsionExample();
proRoleRepulsionExample.createCriteria().andRepulsionRoleIdEqualTo(roleId);
List<ProRoleRepulsion> proRoleRepulsions = proRoleRepulsionMapper.selectByExample(proRoleRepulsionExample);
for (ProRoleRepulsion proRoleRepulsion : proRoleRepulsions) {
roleId1 = proRoleRepulsion.getRoleId();//对自己不可见的角色
//判断对自己不可见的角色是不是我的角色
roleIds1.add(roleId1); //前端
}
}
//查询项目下的所有角色 去除不可见角色 通过项目id查找角色id
ProRoleExample proRoleExample = new ProRoleExample();
proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
proRoles = proRoleMapper.selectByExample(proRoleExample); //前端 后端 UI
//在一个集合里面 去除另外一个集合 1 2 3 1 2
Iterator<ProRole> iterator7 = proRoles.iterator();
while (iterator7.hasNext()) {
ProRole proRole = iterator7.next();
if(roleIds1.size()> 0){ //不可见的角色大于0
for (int i = 0; i < roleIds1.size(); i++) {
int size = roleIds.size(); //当前用户只有一个角色
if(size == 1){
if (proRole.getId().equals(roleIds1.get(i))) {
iterator7.remove(); //去除不可见角色
}
}else {
//不可见角色没有
}
}
}
}
//进行排序 把项目经理拿出来
Iterator<ProRole> iterator5 = proRoles.iterator();
while (iterator5.hasNext()) {
ProRole proRole = iterator5.next();
String PM = labelDao.queryIsPm(proRole.getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是项目经理
proRoles1.add(proRole);
iterator5.remove(); //把项目经理角色拿出去
}
}
//进行排序 把我的角色拿出来
for (int i = 0; i < proRoles.size(); i++) {
//是否是mine 判断是不是自己的角色// 0否 1是
if(!roleIds.isEmpty()){
Iterator<Long> iterator6 = roleIds.iterator();
while (iterator6.hasNext()) {
Long roleId = iterator6.next();
Long id = proRoles.get(i).getId();
if (roleId.equals(id)) {
proRoles1.add(proRoles.get(i));
proRoles.remove(proRoles.get(i)); //把我的角色拿出去
}
}
}
}
//进行排序 把其他角色拿出来
for (int i = 0; i < proRoles.size(); i++) {
proRoles1.add(proRoles.get(i));
}
}else{ //用户是游客 是 查询所有 未设置对谁不可见信息 的角色 通过角色id去查找 role_id
ProRoleExample proRoleExample = new ProRoleExample();
proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
proRoles = proRoleMapper.selectByExample(proRoleExample);
if (ObjectUtil.isNotNull(proRoles)) {
Iterator<ProRole> iterator = proRoles.iterator();
while (iterator.hasNext()) {
ProRole proRole = iterator.next();
//查看是否设置不可见
ProRoleRepulsionExample proRoleRepulsionExample = new ProRoleRepulsionExample();
proRoleRepulsionExample.createCriteria().andRepulsionRoleIdEqualTo(proRole.getId());
List<ProRoleRepulsion> proRoleRepulsions = proRoleRepulsionMapper.selectByExample(proRoleRepulsionExample);
if (proRoleRepulsions.size()!=0) {
//查到就是设置过了 移除
iterator.remove();
}
}
Iterator<ProRole> iterator1 = proRoles.iterator();
while (iterator1.hasNext()) {
ProRole proRole = iterator1.next();
String PM = labelDao.queryIsPm(proRole.getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是项目经理
proRoles1.add(proRole);
iterator1.remove(); //把项目经理角色拿出去
}
}
//进行排序 把我的角色拿出来 本来就没有我的角色 不需要判断
//进行排序 把其他角色拿出来
for (int i = 0; i < proRoles.size(); i++) {
proRoles1.add(proRoles.get(i));
}
}
}
} else { //用户是游客 是 查询所有 未设置对谁不可见信息 的角色 通过角色id去查找 role_id
ProRoleExample proRoleExample = new ProRoleExample();
proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
proRoles = proRoleMapper.selectByExample(proRoleExample);
if (ObjectUtil.isNotNull(proRoles)) {
Iterator<ProRole> iterator = proRoles.iterator();
while (iterator.hasNext()) {
ProRole proRole = iterator.next();
//查看是否设置不可见
ProRoleRepulsionExample proRoleRepulsionExample = new ProRoleRepulsionExample();
proRoleRepulsionExample.createCriteria().andRepulsionRoleIdEqualTo(proRole.getId());
List<ProRoleRepulsion> proRoleRepulsions = proRoleRepulsionMapper.selectByExample(proRoleRepulsionExample);
if (proRoleRepulsions.size()!=0) {
//查到就是设置过了 移除
iterator.remove();
}
}
Iterator<ProRole> iterator1 = proRoles.iterator();
while (iterator1.hasNext()) {
ProRole proRole = iterator1.next();
String PM = labelDao.queryIsPm(proRole.getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是项目经理
proRoles1.add(proRole);
iterator1.remove(); //把项目经理角色拿出去
}
}
//进行排序 把我的角色拿出来 本来就没有我的角色 不需要判断
//进行排序 把其他角色拿出来
for (int i = 0; i < proRoles.size(); i++) {
proRoles1.add(proRoles.get(i));
}
}
}
//根据项目id和userId查询当前用户配置的角色栏信息
ProRoleShowExample proRoleShowExample = new ProRoleShowExample();
proRoleShowExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andUserIdEqualTo(userId);
List<ProRoleShow> proRoleShows = proRoleShowMapper.selectByExample(proRoleShowExample);
//循环所有的角色,判断是否在配置信息内 将角色信息放入“显示角色”的数组内 将角色放入“隐藏角色"数组
if (proRoleShows.size()!=0) { //配置过的
//通过
Iterator<ProRole> iterator = proRoles1.iterator();
while (iterator.hasNext()) {
ProRole proRole = iterator.next();
//用户下的角色id 去除 proRoleShows下的
Long id = proRole.getId();
for (int i = 0; i < proRoleShows.size(); i++) {
Long roleId = proRoleShows.get(i).getRoleId();
if(id.equals(roleId)){
iterator.remove();
}
}
}
//proRoles1里面就是没有设置过的
for (int i = 0; i < proRoles1.size(); i++) {
CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
RoleInfo1.setId(proRoles1.get(i).getId());
RoleInfo1.setName(proRoles1.get(i).getName());
//是否是pm
String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是
RoleInfo1.setPm(1L);
} else {
RoleInfo1.setPm(0L);
}
//是否是mine 判断是不是自己的角色// 0否 1是
if(roleIds.size()!=0){
for (Long roleId1 : roleIds) {
Long id1 = proRoles1.get(i).getId();
if (roleId1.equals(id1)) {
RoleInfo1.setMine(1L);
break;
} else {
RoleInfo1.setMine(0L);
}
}
}else {
RoleInfo1.setMine(0L);
}
//排序
RoleInfo1.setSequence((long) i+1);
invisibleList.add(RoleInfo1);
}
//proRoleShows里面就是设置过的 设置过的里面id是否设置了不可见
for (ProRoleShow proRoleShow : proRoleShows) {
ProRoleExample proRoleExample = new ProRoleExample();
proRoleExample.createCriteria().andIdEqualTo(proRoleShow.getRoleId());
List<ProRole> proRoles2 = proRoleMapper.selectByExample(proRoleExample);
CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
RoleInfo1.setId(proRoles2.get(0).getId());
RoleInfo1.setName(proRoles2.get(0).getName());
//是否是pm 0否 1 是 //通过标签来定义 5 和 2 34是
//通过角色表里面的标签id 去 标签表查询 label_type_id =5 在去标签类型表查5 和 level =2
String PM = labelDao.queryIsPm(proRoles2.get(0).getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是
RoleInfo1.setPm(1L);
} else {
RoleInfo1.setPm(0L);
}
//是否是mine 判断是不是自己的角色// 0否 1是
if(roleIds.size()!=0){
for (Long roleId1 : roleIds) {
Long id1 = proRoles2.get(0).getId();
if (roleId1.equals(id1)) {
RoleInfo1.setMine(1L);
break;
} else {
RoleInfo1.setMine(0L);
}
}
}else {
RoleInfo1.setMine(0L);
}
//排序
RoleInfo1.setSequence(Long.valueOf(proRoleShow.getSequence()));
visibleList.add(RoleInfo1);
}
} else {
//循环查询到的角色,放入“显示角色”的数组内 数组长度大于等于5
if(proRoles1.size()<6){
for (int i = 0; i < proRoles1.size(); i++) {
CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
RoleInfo1.setId(proRoles1.get(i).getId());
RoleInfo1.setName(proRoles1.get(i).getName());
//是否是pm
String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是
RoleInfo1.setPm(1L);
} else {
RoleInfo1.setPm(0L);
}
//是否是mine 判断是不是自己的角色// 0否 1是
if(roleIds.size()!=0){
for (Long roleId : roleIds) {
Long id = proRoles1.get(i).getId();
if (roleId.equals(id)) {
RoleInfo1.setMine(1L);
break;
} else {
RoleInfo1.setMine(0L);
}
}
}else {
RoleInfo1.setMine(0L);
}
//排序
RoleInfo1.setSequence((long) i+1);
visibleList.add(RoleInfo1);
}
}
if (proRoles1.size() >= 6) {
for (int i = 0; i < 5; i++) {
CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
RoleInfo1.setId(proRoles1.get(i).getId());
RoleInfo1.setName(proRoles1.get(i).getName());
//是否是pm
String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是
RoleInfo1.setPm(1L);
} else {
RoleInfo1.setPm(0L);
}
//是否是mine 判断是不是自己的角色// 0否 1是
if(roleIds.size()!=0){
for (Long roleId : roleIds) {
Long id = proRoles1.get(i).getId();
if (roleId.equals(id)) {
RoleInfo1.setMine(1L);
break;
} else {
RoleInfo1.setMine(0L);
}
}
}else {
RoleInfo1.setMine(0L);
}
//排序
RoleInfo1.setSequence((long) i+1);
visibleList.add(RoleInfo1);
}
//将剩下的角色放入“隐藏角色”数组
for (int i = 5; i < proRoles1.size(); i++) {
CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
RoleInfo1.setId(proRoles1.get(i).getId());
RoleInfo1.setName(proRoles1.get(i).getName());
//是否是pm
String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
if (StrUtil.isNotEmpty(PM)) { //是
RoleInfo1.setPm(1L);
} else {
RoleInfo1.setPm(0L);
}
//是否是mine 判断是不是自己的角色// 0否 1是
if(roleIds.size()!=0){
for (Long roleId : roleIds) {
Long id = proRoles1.get(i).getId();
if (roleId.equals(id)) {
RoleInfo1.setMine(1L);
break;
} else {
RoleInfo1.setMine(0L);
}
}
}else {
RoleInfo1.setMine(0L);
}
//排序
RoleInfo1.setSequence((long) (i-4)); //5-4
invisibleList.add(RoleInfo1);
}
}
}
role.setInvisibleList(invisibleList);
role.setVisibleList(visibleList);
// //角色显示的角色
// List<CRoleVo.RoleInfo> visibleList = new ArrayList<>();
// //不显示的角色
// List<CRoleVo.RoleInfo> invisibleList = new ArrayList<>();
// //查询当前用户所属的角色的list
// List<Long> roleIds = new ArrayList<>();
// //对自己不可见的角色的list
// List<Long> roleIds1 = new ArrayList<>();
// //判断是否是关注者 用户不是项目下的成员 并且 用户是成员但不属于任何角色 就是关注者
// // 判断用户是成员但是不属于任何角色 在成员表下查询到 成员信息
// ProMemberExample proMemberExample = new ProMemberExample();
// proMemberExample.createCriteria().andUserIdEqualTo(userId).andProjectIdEqualTo(param.getProjectId());
// List<ProMember> proMembers = proMemberMapper.selectByExample(proMemberExample); //默认一个
// //判断用户是不是项目下的成员
// List<ProRole> proRoles = new ArrayList<>();
// //排序后的
// List<ProRole> proRoles1 = new ArrayList<>();
// if (CollectionUtil.isNotEmpty(proMembers)) {
// //判断用户是成员是不是有角色 通过成员id来判断
// ProRoleMemberExample proRoleMemberExample = new ProRoleMemberExample();
// proRoleMemberExample.createCriteria().andMemberIdEqualTo(proMembers.get(0).getId());
// List<ProRoleMember> proRoleMembers = proRoleMemberMapper.selectByExample(proRoleMemberExample);
// if (CollectionUtil.isNotEmpty(proRoleMembers)) {
// //用户不是关注者 否 不是才是关注者
// //用户有角色 角色是那个 查询当前用户所属的角色
// Long roleId1 = 0L;
// //List<Long> roleIds =null; //查询当前用户所属的角色
// for (ProRoleMember proRoleMember : proRoleMembers) {
// Long roleId = proRoleMember.getRoleId();//查询当前用户所属的角色 后端 前端
// roleIds.add(roleId);
// ProRoleRepulsionExample proRoleRepulsionExample = new ProRoleRepulsionExample();
// proRoleRepulsionExample.createCriteria().andRepulsionRoleIdEqualTo(roleId);
// List<ProRoleRepulsion> proRoleRepulsions = proRoleRepulsionMapper.selectByExample(proRoleRepulsionExample);
// for (ProRoleRepulsion proRoleRepulsion : proRoleRepulsions) {
// roleId1 = proRoleRepulsion.getRoleId();//对自己不可见的角色
// //判断对自己不可见的角色是不是我的角色
// roleIds1.add(roleId1); //前端
// }
// }
// //查询项目下的所有角色 去除不可见角色 通过项目id查找角色id
// ProRoleExample proRoleExample = new ProRoleExample();
// proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
// proRoles = proRoleMapper.selectByExample(proRoleExample); //前端 后端 UI
// //在一个集合里面 去除另外一个集合 1 2 3 1 2
// Iterator<ProRole> iterator7 = proRoles.iterator();
// while (iterator7.hasNext()) {
// ProRole proRole = iterator7.next();
// if(roleIds1.size()> 0){ //不可见的角色大于0
// for (int i = 0; i < roleIds1.size(); i++) {
// int size = roleIds.size(); //当前用户只有一个角色
// if(size == 1){
// if (proRole.getId().equals(roleIds1.get(i))) {
// iterator7.remove(); //去除不可见角色
// }
// }else {
// //不可见角色没有
// }
// }
// }
// }
// //进行排序 把项目经理拿出来
// Iterator<ProRole> iterator5 = proRoles.iterator();
// while (iterator5.hasNext()) {
// ProRole proRole = iterator5.next();
// String PM = labelDao.queryIsPm(proRole.getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是项目经理
// proRoles1.add(proRole);
// iterator5.remove(); //把项目经理角色拿出去
// }
// }
// //进行排序 把我的角色拿出来
// for (int i = 0; i < proRoles.size(); i++) {
// //是否是mine 判断是不是自己的角色// 0否 1是
// if(!roleIds.isEmpty()){
// Iterator<Long> iterator6 = roleIds.iterator();
// while (iterator6.hasNext()) {
// Long roleId = iterator6.next();
// Long id = proRoles.get(i).getId();
// if (roleId.equals(id)) {
// proRoles1.add(proRoles.get(i));
// proRoles.remove(proRoles.get(i)); //把我的角色拿出去
// }
// }
// }
//
// }
// //进行排序 把其他角色拿出来
// for (int i = 0; i < proRoles.size(); i++) {
// proRoles1.add(proRoles.get(i));
// }
//
// }else{ //用户是游客 是 查询所有 未设置对谁不可见信息 的角色 通过角色id去查找 role_id
// ProRoleExample proRoleExample = new ProRoleExample();
// proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
// proRoles = proRoleMapper.selectByExample(proRoleExample);
// if (ObjectUtil.isNotNull(proRoles)) {
// Iterator<ProRole> iterator = proRoles.iterator();
// while (iterator.hasNext()) {
// ProRole proRole = iterator.next();
// //查看是否设置不可见
// ProRoleRepulsionExample proRoleRepulsionExample = new ProRoleRepulsionExample();
// proRoleRepulsionExample.createCriteria().andRepulsionRoleIdEqualTo(proRole.getId());
// List<ProRoleRepulsion> proRoleRepulsions = proRoleRepulsionMapper.selectByExample(proRoleRepulsionExample);
// if (proRoleRepulsions.size()!=0) {
// //查到就是设置过了 移除
// iterator.remove();
// }
// }
// Iterator<ProRole> iterator1 = proRoles.iterator();
// while (iterator1.hasNext()) {
// ProRole proRole = iterator1.next();
// String PM = labelDao.queryIsPm(proRole.getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是项目经理
// proRoles1.add(proRole);
// iterator1.remove(); //把项目经理角色拿出去
// }
// }
// //进行排序 把我的角色拿出来 本来就没有我的角色 不需要判断
// //进行排序 把其他角色拿出来
// for (int i = 0; i < proRoles.size(); i++) {
// proRoles1.add(proRoles.get(i));
// }
// }
// }
// } else { //用户是游客 是 查询所有 未设置对谁不可见信息 的角色 通过角色id去查找 role_id
// ProRoleExample proRoleExample = new ProRoleExample();
// proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId());
// proRoles = proRoleMapper.selectByExample(proRoleExample);
// if (ObjectUtil.isNotNull(proRoles)) {
// Iterator<ProRole> iterator = proRoles.iterator();
// while (iterator.hasNext()) {
// ProRole proRole = iterator.next();
// //查看是否设置不可见
// ProRoleRepulsionExample proRoleRepulsionExample = new ProRoleRepulsionExample();
// proRoleRepulsionExample.createCriteria().andRepulsionRoleIdEqualTo(proRole.getId());
// List<ProRoleRepulsion> proRoleRepulsions = proRoleRepulsionMapper.selectByExample(proRoleRepulsionExample);
// if (proRoleRepulsions.size()!=0) {
// //查到就是设置过了 移除
// iterator.remove();
// }
// }
// Iterator<ProRole> iterator1 = proRoles.iterator();
// while (iterator1.hasNext()) {
// ProRole proRole = iterator1.next();
// String PM = labelDao.queryIsPm(proRole.getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是项目经理
// proRoles1.add(proRole);
// iterator1.remove(); //把项目经理角色拿出去
// }
// }
// //进行排序 把我的角色拿出来 本来就没有我的角色 不需要判断
// //进行排序 把其他角色拿出来
// for (int i = 0; i < proRoles.size(); i++) {
// proRoles1.add(proRoles.get(i));
// }
// }
// }
//
//
// //根据项目id和userId查询当前用户配置的角色栏信息
// ProRoleShowExample proRoleShowExample = new ProRoleShowExample();
// proRoleShowExample.createCriteria().andProjectIdEqualTo(param.getProjectId()).andUserIdEqualTo(userId);
// List<ProRoleShow> proRoleShows = proRoleShowMapper.selectByExample(proRoleShowExample);
// //循环所有的角色,判断是否在配置信息内 将角色信息放入“显示角色”的数组内 将角色放入“隐藏角色"数组
// if (proRoleShows.size()!=0) { //配置过的
// //通过
// Iterator<ProRole> iterator = proRoles1.iterator();
// while (iterator.hasNext()) {
// ProRole proRole = iterator.next();
// //用户下的角色id 去除 proRoleShows下的
// Long id = proRole.getId();
// for (int i = 0; i < proRoleShows.size(); i++) {
// Long roleId = proRoleShows.get(i).getRoleId();
// if(id.equals(roleId)){
// iterator.remove();
// }
// }
// }
// //proRoles1里面就是没有设置过的
// for (int i = 0; i < proRoles1.size(); i++) {
// CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
// RoleInfo1.setId(proRoles1.get(i).getId());
// RoleInfo1.setName(proRoles1.get(i).getName());
// //是否是pm
// String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是
// RoleInfo1.setPm(1L);
// } else {
// RoleInfo1.setPm(0L);
// }
// //是否是mine 判断是不是自己的角色// 0否 1是
// if(roleIds.size()!=0){
// for (Long roleId1 : roleIds) {
// Long id1 = proRoles1.get(i).getId();
// if (roleId1.equals(id1)) {
// RoleInfo1.setMine(1L);
// break;
// } else {
// RoleInfo1.setMine(0L);
// }
// }
// }else {
// RoleInfo1.setMine(0L);
// }
// //排序
// RoleInfo1.setSequence((long) i+1);
// invisibleList.add(RoleInfo1);
// }
// //proRoleShows里面就是设置过的 设置过的里面id是否设置了不可见
// for (ProRoleShow proRoleShow : proRoleShows) {
// ProRoleExample proRoleExample = new ProRoleExample();
// proRoleExample.createCriteria().andIdEqualTo(proRoleShow.getRoleId());
// List<ProRole> proRoles2 = proRoleMapper.selectByExample(proRoleExample);
// CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
// RoleInfo1.setId(proRoles2.get(0).getId());
// RoleInfo1.setName(proRoles2.get(0).getName());
// //是否是pm 0否 1 是 //通过标签来定义 5 和 2 34是
// //通过角色表里面的标签id 去 标签表查询 label_type_id =5 在去标签类型表查5 和 level =2
// String PM = labelDao.queryIsPm(proRoles2.get(0).getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是
// RoleInfo1.setPm(1L);
// } else {
// RoleInfo1.setPm(0L);
// }
// //是否是mine 判断是不是自己的角色// 0否 1是
// if(roleIds.size()!=0){
// for (Long roleId1 : roleIds) {
// Long id1 = proRoles2.get(0).getId();
// if (roleId1.equals(id1)) {
// RoleInfo1.setMine(1L);
// break;
// } else {
// RoleInfo1.setMine(0L);
// }
// }
// }else {
// RoleInfo1.setMine(0L);
// }
// //排序
// RoleInfo1.setSequence(Long.valueOf(proRoleShow.getSequence()));
// visibleList.add(RoleInfo1);
// }
// } else {
// //循环查询到的角色,放入“显示角色”的数组内 数组长度大于等于5
// if(proRoles1.size()<6){
// for (int i = 0; i < proRoles1.size(); i++) {
// CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
// RoleInfo1.setId(proRoles1.get(i).getId());
// RoleInfo1.setName(proRoles1.get(i).getName());
// //是否是pm
// String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是
// RoleInfo1.setPm(1L);
// } else {
// RoleInfo1.setPm(0L);
// }
// //是否是mine 判断是不是自己的角色// 0否 1是
// if(roleIds.size()!=0){
// for (Long roleId : roleIds) {
// Long id = proRoles1.get(i).getId();
// if (roleId.equals(id)) {
// RoleInfo1.setMine(1L);
// break;
// } else {
// RoleInfo1.setMine(0L);
// }
// }
// }else {
// RoleInfo1.setMine(0L);
// }
// //排序
// RoleInfo1.setSequence((long) i+1);
// visibleList.add(RoleInfo1);
// }
// }
//
// if (proRoles1.size() >= 6) {
// for (int i = 0; i < 5; i++) {
// CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
// RoleInfo1.setId(proRoles1.get(i).getId());
// RoleInfo1.setName(proRoles1.get(i).getName());
// //是否是pm
// String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是
// RoleInfo1.setPm(1L);
// } else {
// RoleInfo1.setPm(0L);
// }
// //是否是mine 判断是不是自己的角色// 0否 1是
// if(roleIds.size()!=0){
// for (Long roleId : roleIds) {
// Long id = proRoles1.get(i).getId();
// if (roleId.equals(id)) {
// RoleInfo1.setMine(1L);
// break;
// } else {
// RoleInfo1.setMine(0L);
// }
// }
// }else {
// RoleInfo1.setMine(0L);
// }
//
// //排序
// RoleInfo1.setSequence((long) i+1);
// visibleList.add(RoleInfo1);
// }
//
// //将剩下的角色放入“隐藏角色”数组
// for (int i = 5; i < proRoles1.size(); i++) {
// CRoleVo.RoleInfo RoleInfo1 = new CRoleVo.RoleInfo();
// RoleInfo1.setId(proRoles1.get(i).getId());
// RoleInfo1.setName(proRoles1.get(i).getName());
// //是否是pm
// String PM = labelDao.queryIsPm(proRoles1.get(i).getLabelId());
// if (StrUtil.isNotEmpty(PM)) { //是
// RoleInfo1.setPm(1L);
// } else {
// RoleInfo1.setPm(0L);
// }
// //是否是mine 判断是不是自己的角色// 0否 1是
// if(roleIds.size()!=0){
// for (Long roleId : roleIds) {
// Long id = proRoles1.get(i).getId();
// if (roleId.equals(id)) {
// RoleInfo1.setMine(1L);
// break;
// } else {
// RoleInfo1.setMine(0L);
// }
// }
// }else {
// RoleInfo1.setMine(0L);
// }
// //排序
// RoleInfo1.setSequence((long) (i-4)); //5-4
// invisibleList.add(RoleInfo1);
// }
// }
// }
// role.setInvisibleList(invisibleList);
// role.setVisibleList(visibleList);
return role;
}
@ -428,4 +428,72 @@ public class ProRoleService implements IProRoleService {
}
@Override
public CRoleVo.QueryRole queryShowRole(CRoleDto.QueryRoleById param, Long userId) {
//返回的对象
CRoleVo.QueryRole queryRole = new CRoleVo.QueryRole();
List<CRoleVo.RoleInfo> visibleList = new ArrayList<>();
List<CRoleVo.RoleInfo> invisibleList = new ArrayList<>();
//查询当前用户在项目下的角色,没有则算作关注者
List<ProRole> userRoleList = proRoleDao.queryRoleByUserId(param.getProjectId(),userId);
//查询用户可见的角色
List<CRoleVo.RoleInfo> roleInfoList;
if(CollectionUtil.isNotEmpty(userRoleList)){
//不是关注者,查询可见的角色(完全屏蔽才不可见)
roleInfoList = proRoleDao.notAttentionQueryRole(param.getProjectId(),userRoleList);
}else {
//是关注者查询可见的角色(未设置过对谁不可见信息的角色)
roleInfoList = proRoleDao.attentionQueryRole(param.getProjectId());
}
//查询配置信息
List<Long> showRoleList = proRoleDao.queryShowByUserAndProject(param.getProjectId(),userId);
if(CollectionUtil.isNotEmpty(showRoleList)){
for (Long showRoleId : showRoleList) {
//循环配置内的信息去匹配角色列表,来确定角色该放在什么地方
for (CRoleVo.RoleInfo roleInfo : roleInfoList) {
if(showRoleId.equals(roleInfo.getId())){
//和配置内的信息相同则放入展示角色列表
visibleList.add(roleInfo);
//同时删除数组内的信息
roleInfoList.remove(roleInfo);
//跳出循环,开始配置信息内的下一个
break;
}
}
}
//剩下的角色全部放在不可见角色列表
invisibleList.addAll(roleInfoList);
}else {
//没有配置信息则按默认规则
if (CollectionUtil.isNotEmpty(roleInfoList)) {
//循环所有角色
for (CRoleVo.RoleInfo roleInfo : roleInfoList) {
//如果是项目经理,放入展示的角色
if (roleInfo.getPm() == 1) {
visibleList.add(roleInfo);
continue;
}
//是用户所属的角色,放入展示的角色列表
if (roleInfo.getMine() == 1) {
visibleList.add(roleInfo);
continue;
} else {
//不是用户所属的角色,但展示角色列表数量不足五个,
if (visibleList.size() < 5) {
visibleList.add(roleInfo);
continue;
}
}
//不满足上面条件的,放入不展示的角色列表
invisibleList.add(roleInfo);
}
}
}
queryRole.setVisibleList(visibleList);
queryRole.setInvisibleList(invisibleList);
return queryRole;
}
}

175
common/src/main/java/com/ccsens/common/service/ProjectService.java

@ -10,7 +10,12 @@ import com.ccsens.common.bean.po.*;
import com.ccsens.common.bean.vo.CProjectVo;
import com.ccsens.common.bean.vo.CTaskVo;
import com.ccsens.common.persist.dao.*;
import com.ccsens.common.persist.mapper.ProMemberStakeholderMapper;
import com.ccsens.common.persist.mapper.ProRoleShowMapper;
import com.ccsens.common.persist.mapper.ProTaskShareMapper;
import com.ccsens.common.persist.mapper.ProTaskStatusRecordMapper;
import com.ccsens.common.util.CommonCodeError;
import com.ccsens.util.PropUtil;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -19,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -65,6 +71,14 @@ public class ProjectService implements IProjectService{
private ProRoleMemberDao roleMemberDao;
@Resource
private UserDao userDao;
@Resource
private ProMemberStakeholderMapper memberStakeholderMapper;
@Resource
private ProTaskStatusRecordMapper taskStatusRecordMapper;
@Resource
private ProTaskShareMapper taskShareMapper;
@Resource
private ProRoleShowMapper roleShowMapper;
@Override
public CProjectVo.ProjectInfo findProjectById(CProjectDto.ProjectById param, Long userId) {
@ -438,5 +452,166 @@ public class ProjectService implements IProjectService{
}
}
@Override
public List<CProjectVo.ProjectInfo> findSonProject(CProjectDto.FindSonProject param, Long userId) {
ProTaskDetail projectInfo = taskDetailDao.selectByPrimaryKey(param.getProjectId());
if (ObjectUtil.isNull(projectInfo)) {
throw new BaseException(CommonCodeError.PROJECT_NOT_FOUND);
}
List<CProjectVo.ProjectInfo> projectInfos = projectDao.findSonProjectId(param);
if (CollectionUtil.isNotEmpty(projectInfos)) {
for (CProjectVo.ProjectInfo project : projectInfos) {
project.setUrl(PropUtil.domain);
}
}
return projectInfos;
}
@Override
public void deleteProjectById(CProjectDto.ProjectById param, Long userId) {
ProTaskDetail project = taskDetailDao.selectByPrimaryKey(param.getProjectId());
if (ObjectUtil.isNull(project)) {
throw new BaseException(CommonCodeError.PROJECT_NOT_FOUND);
}
//删除项目详情 删除项目相关
Long projectId = project.getId();
project.setRecStatus((byte)2);
taskDetailDao.updateByPrimaryKeySelective(project);
//删除之前的项目分解
ProTaskSubExample taskSubExample = new ProTaskSubExample();
taskSubExample.createCriteria().andTaskDetailIdEqualTo(projectId);
ProTaskSub taskSub = new ProTaskSub();
taskSub.setRecStatus((byte)2);
taskSubDao.updateByExampleSelective(taskSub,taskSubExample);
//删除之前的版本信息
ProTaskVersion taskVersion = new ProTaskVersion();
taskVersion.setRecStatus((byte)2);
ProTaskVersionExample taskVersionExample = new ProTaskVersionExample();
taskVersionExample.createCriteria().andTaskDetailIdEqualTo(projectId);
taskVersionDao.updateByExampleSelective(taskVersion,taskVersionExample);
//删除项目标签相关的
LabelBusiness labelBusiness = new LabelBusiness();
labelBusiness.setRecStatus((byte)2);
LabelBusinessExample labelBusinessExample = new LabelBusinessExample();
labelBusinessExample.createCriteria().andBusinessIdEqualTo(projectId);
labelBusinessDao.updateByExampleSelective(labelBusiness,labelBusinessExample);
//删除项目分享表
ProTaskShare taskShare = new ProTaskShare();
taskShare.setRecStatus((byte)2);
ProTaskShareExample taskShareExample = new ProTaskShareExample();
taskShareExample.createCriteria().andOriginalProjectIdEqualTo(projectId);
taskShareMapper.updateByExampleSelective(taskShare,taskShareExample);
//删除角色和成员
List<Long> roleIdList = roleDao.queryRoleListOfProject(project.getId());
ProRole role = new ProRole();
role.setRecStatus((byte)2);
ProRoleExample roleExample = new ProRoleExample();
roleExample.createCriteria().andIdIn(roleIdList);
roleDao.updateByExampleSelective(role,roleExample);
List<Long> memberIdList = memberDao.queryMembersOfProject(project.getId());
ProMember member = new ProMember();
member.setRecStatus((byte)2);
ProMemberExample memberExample = new ProMemberExample();
memberExample.createCriteria().andIdIn(memberIdList);
memberDao.updateByExampleSelective(member,memberExample);
//删除奖惩干系人
ProMemberStakeholder memberStakeholder = new ProMemberStakeholder();
memberStakeholder.setRecStatus((byte)2);
ProMemberStakeholderExample memberStakeholderExample = new ProMemberStakeholderExample();
memberStakeholderExample.createCriteria().andMemeberIdIn(memberIdList);
memberStakeholderMapper.updateByExampleSelective(memberStakeholder,memberStakeholderExample);
//删除对谁不可见
ProRoleRepulsion roleRepulsion = new ProRoleRepulsion();
roleRepulsion.setRecStatus((byte)2);
ProRoleRepulsionExample roleRepulsionExample = new ProRoleRepulsionExample();
roleRepulsionExample.createCriteria().andRoleIdIn(roleIdList);
roleRepulsionDao.updateByExampleSelective(roleRepulsion,roleRepulsionExample);
//删除角色成员关联
ProRoleMember roleMember = new ProRoleMember();
roleMember.setRecStatus((byte)2);
ProRoleMemberExample roleMemberExample = new ProRoleMemberExample();
roleMemberExample.createCriteria().andRoleIdIn(roleIdList);
roleMemberDao.updateByExampleSelective(roleMember,roleMemberExample);
//删除角色展示
ProRoleShow roleShow = new ProRoleShow();
roleShow.setRecStatus((byte)2);
ProRoleShowExample roleShowExample = new ProRoleShowExample();
roleShowExample.createCriteria().andRoleIdIn(roleIdList);
roleShowMapper.updateByExampleSelective(roleShow,roleShowExample);
//根据项目id查询所有一二级任务详情id 删除任务相关
List<Long> allTaskId = parentTaskDao.queryAllTaskIdByProjectId(projectId);
//删除所有的任务详情
ProTaskDetail taskDetail = new ProTaskDetail();
taskDetail.setRecStatus((byte)2);
ProTaskDetailExample taskDetailExample = new ProTaskDetailExample();
taskDetailExample.createCriteria().andIdIn(allTaskId);
taskDetailDao.updateByExampleSelective(taskDetail,taskDetailExample);
//删除所有的分解任务
ProTaskSub taskSub1 = new ProTaskSub();
taskSub1.setRecStatus((byte)2);
ProTaskSubExample taskSubExample1 = new ProTaskSubExample();
taskSubExample1.createCriteria().andTaskDetailIdIn(allTaskId);
List<ProTaskSub> taskSubList = taskSubDao.selectByExample(taskSubExample1);
List<Long> allSubTaskId = taskSubList.stream().map(ProTaskSub::getId).collect(Collectors.toList());
taskSubDao.updateByExampleSelective(taskSub1,taskSubExample1);
//删除所有的任务标签
LabelBusiness labelBusiness1 = new LabelBusiness();
labelBusiness1.setRecStatus((byte)2);
LabelBusinessExample labelBusinessExample1 = new LabelBusinessExample();
labelBusinessExample1.createCriteria().andBusinessIdIn(allTaskId);
labelBusinessDao.updateByExampleSelective(labelBusiness1,labelBusinessExample1);
//删除任务角色关联表
ProRoleTask roleTask = new ProRoleTask();
roleTask.setRecStatus((byte)2);
ProRoleTaskExample roleTaskExample = new ProRoleTaskExample();
roleTaskExample.createCriteria().andTaskIdIn(allTaskId);
roleTaskDao.updateByExampleSelective(roleTask,roleTaskExample);
//删除任务插件关联信息
ProTaskPlugin taskPlugin = new ProTaskPlugin();
taskPlugin.setRecStatus((byte)2);
ProTaskPluginExample taskPluginExample = new ProTaskPluginExample();
taskPluginExample.createCriteria().andTaskDetailIdIn(allTaskId);
taskPluginDao.updateByExampleSelective(taskPlugin,taskPluginExample);
//删除任务关系表
allTaskId.add(project.getId());
ProParentTask parentTask = new ProParentTask();
parentTask.setRecStatus((byte)2);
ProParentTaskExample parentTaskExample = new ProParentTaskExample();
parentTaskExample.createCriteria().andTaskDetailIdIn(allTaskId);
parentTaskDao.updateByExampleSelective(parentTask,parentTaskExample);
//删除任务流转表
ProTaskFlow taskFlow = new ProTaskFlow();
taskFlow.setRecStatus((byte)2);
ProTaskFlowExample taskFlowExample = new ProTaskFlowExample();
taskFlowExample.createCriteria().andTaskDetailIdIn(allTaskId);
taskFlowDao.updateByExampleSelective(taskFlow,taskFlowExample);
//删除任务上下道工序
ProTaskProcess taskProcess = new ProTaskProcess();
taskProcess.setRecStatus((byte)2);
ProTaskProcessExample taskProcessExample = new ProTaskProcessExample();
taskProcessExample.createCriteria().andTaskDetailIdIn(allTaskId);
taskProcessDao.updateByExampleSelective(taskProcess,taskProcessExample);
//删除任务状态记录表 分解任务id
ProTaskStatusRecord taskStatusRecord = new ProTaskStatusRecord();
taskStatusRecord.setRecStatus((byte)2);
ProTaskStatusRecordExample taskStatusRecordExample = new ProTaskStatusRecordExample();
taskStatusRecordExample.createCriteria().andTaskSubIdIn(allSubTaskId);
taskStatusRecordMapper.updateByExampleSelective(taskStatusRecord,taskStatusRecordExample);
//删除任务通知表
ProTaskNotify taskNotify = new ProTaskNotify();
taskNotify.setRecStatus((byte)2);
ProTaskNotifyExample taskNotifyExample = new ProTaskNotifyExample();
taskNotifyExample.createCriteria().andTaskDetailIdIn(allTaskId);
taskNotifyDao.updateByExampleSelective(taskNotify,taskNotifyExample);
//删除任务面板信息
ProTaskPanelInfo taskPanelInfo = new ProTaskPanelInfo();
taskPanelInfo.setRecStatus((byte)2);
ProTaskPanelInfoExample taskPanelInfoExample = new ProTaskPanelInfoExample();
taskPanelInfoExample.createCriteria().andTaskDetailIdIn(allTaskId);
taskPanelInfoDao.updateByExampleSelective(taskPanelInfo,taskPanelInfoExample);
}
}

94
common/src/main/java/com/ccsens/common/service/TaskService.java

@ -13,6 +13,7 @@ import com.ccsens.common.persist.dao.*;
import com.ccsens.common.persist.mapper.ProTaskStatusRecordMapper;
import com.ccsens.common.util.CommonCodeError;
import com.ccsens.common.util.Constant;
import com.ccsens.util.CodeError;
import com.ccsens.util.JacksonUtil;
import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
@ -194,20 +195,21 @@ public class TaskService implements ITaskService {
if (BooleanUtil.isFalse(isLook)) {
throw new BaseException(CommonCodeError.NOT_PERMISSION);
}
//查询当前角色是否项目经理
List<Long> roleIds = new ArrayList<>();
List<CRoleVo.AllRole> roleList = roleDao.findAllRoleById(param.getRoleId());
if (CollectionUtil.isNotEmpty(roleList)){
List<CRoleVo.AllRole> roles = roleList.stream().filter(allRole -> allRole.getId().equals(param.getRoleId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(roles)){
if (Constant.ROLE_LEVEL.PM.value.equals(roles.get(0).getLevel())){
List<Long> allRoleId = roleList.stream().map(CRoleVo.AllRole::getId).collect(Collectors.toList());
roleIds.addAll(allRoleId);
}else{
roleIds.add(param.getRoleId());
}
}
}
roleIds.add(param.getRoleId());
//查询当前角色是否项目经理
// List<CRoleVo.AllRole> roleList = roleDao.findAllRoleById(param.getRoleId());
// if (CollectionUtil.isNotEmpty(roleList)){
// List<CRoleVo.AllRole> roles = roleList.stream().filter(allRole -> allRole.getId().equals(param.getRoleId())).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(roles)){
// if (Constant.ROLE_LEVEL.PM.value.equals(roles.get(0).getLevel())){
// List<Long> allRoleId = roleList.stream().map(CRoleVo.AllRole::getId).collect(Collectors.toList());
// roleIds.addAll(allRoleId);
// }else{
// roleIds.add(param.getRoleId());
// }
// }
// }
List<CTaskVo.QueryTask> permanentGlobalTask = taskDetailDao.queryPermanentGlobalTask(roleIds);
//查找项目面板和插件信息
queryPluginForTask(permanentGlobalTask);
@ -222,20 +224,22 @@ public class TaskService implements ITaskService {
if (BooleanUtil.isFalse(isLook)) {
throw new BaseException(CommonCodeError.NOT_PERMISSION);
}
//查询当前角色是否项目经理
List<Long> roleIds = new ArrayList<>();
List<CRoleVo.AllRole> roleList = roleDao.findAllRoleById(param.getRoleId());
if (CollectionUtil.isNotEmpty(roleList)){
List<CRoleVo.AllRole> roles = roleList.stream().filter(allRole -> allRole.getId().equals(param.getRoleId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(roles)){
if (Constant.ROLE_LEVEL.PM.value.equals(roles.get(0).getLevel())){
List<Long> allRoleId = roleList.stream().map(CRoleVo.AllRole::getId).collect(Collectors.toList());
roleIds.addAll(allRoleId);
}else{
roleIds.add(param.getRoleId());
}
}
}
roleIds.add(param.getRoleId());
//查询当前角色是否项目经理
// List<Long> roleIds = new ArrayList<>();
// List<CRoleVo.AllRole> roleList = roleDao.findAllRoleById(param.getRoleId());
// if (CollectionUtil.isNotEmpty(roleList)){
// List<CRoleVo.AllRole> roles = roleList.stream().filter(allRole -> allRole.getId().equals(param.getRoleId())).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(roles)){
// if (Constant.ROLE_LEVEL.PM.value.equals(roles.get(0).getLevel())){
// List<Long> allRoleId = roleList.stream().map(CRoleVo.AllRole::getId).collect(Collectors.toList());
// roleIds.addAll(allRoleId);
// }else{
// roleIds.add(param.getRoleId());
// }
// }
// }
List<CTaskVo.QueryTask> globalTask = taskDetailDao.queryGlobalTask(roleIds, param.getTimeNode(), param.getTimeUnit());
queryPluginForTask(globalTask);
return globalTask;
@ -258,20 +262,22 @@ public class TaskService implements ITaskService {
if (BooleanUtil.isFalse(isLook)) {
throw new BaseException(CommonCodeError.NOT_PERMISSION);
}
//查询当前角色是否项目经理
List<Long> roleIds = new ArrayList<>();
List<CRoleVo.AllRole> roleList = roleDao.findAllRoleById(param.getRoleId());
if (CollectionUtil.isNotEmpty(roleList)){
List<CRoleVo.AllRole> roles = roleList.stream().filter(allRole -> allRole.getId().equals(param.getRoleId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(roles)){
if (Constant.ROLE_LEVEL.PM.value.equals(roles.get(0).getLevel())){
List<Long> allRoleId = roleList.stream().map(CRoleVo.AllRole::getId).collect(Collectors.toList());
roleIds.addAll(allRoleId);
}else{
roleIds.add(param.getRoleId());
}
}
}
roleIds.add(param.getRoleId());
//查询当前角色是否项目经理
// List<Long> roleIds = new ArrayList<>();
// List<CRoleVo.AllRole> roleList = roleDao.findAllRoleById(param.getRoleId());
// if (CollectionUtil.isNotEmpty(roleList)){
// List<CRoleVo.AllRole> roles = roleList.stream().filter(allRole -> allRole.getId().equals(param.getRoleId())).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(roles)){
// if (Constant.ROLE_LEVEL.PM.value.equals(roles.get(0).getLevel())){
// List<Long> allRoleId = roleList.stream().map(CRoleVo.AllRole::getId).collect(Collectors.toList());
// roleIds.addAll(allRoleId);
// }else{
// roleIds.add(param.getRoleId());
// }
// }
// }
//TODO 季度未实现
List<CTaskVo.QueryTask> regularTask = taskDetailDao.queryRegularTask(roleIds, param.getTimeUnit(), param.getTimeNode(), param.getQueryType(), query, timeFormat);
//如果该时段没有任务向上或向下补充
@ -578,4 +584,14 @@ public class TaskService implements ITaskService {
}
}
@Override
public List<CTaskVo.SonTaskDetail> findSonTask(CTaskDto.FindSonTask param, Long userId) {
ProTaskDetail proTaskDetail = taskDetailDao.selectByPrimaryKey(param.getDetailId());
if (ObjectUtil.isNull(proTaskDetail)) {
throw new BaseException(CommonCodeError.NOT_TASK);
}
return taskDetailDao.findSonTask(param);
}
}

4
common/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: util-dev,common
active: prod
include: util-prod,common

10
common/src/main/resources/mapper_dao/ProMemberDao.xml

@ -13,4 +13,14 @@
AND user_id = #{userId}
</select>
<select id="queryMembersOfProject" resultType="java.lang.Long">
SELECT
id
FROM
t_pro_member
WHERE
rec_status = 0
AND project_id = #{projectId}
</select>
</mapper>

26
common/src/main/resources/mapper_dao/ProParentTaskDao.xml

@ -30,4 +30,30 @@
AND pt.rec_status = 0 AND d.rec_status = 0
</select>
<select id="queryAllTaskIdByProjectId" resultType="java.lang.Long">
SELECT
task_detail_id
FROM
t_pro_parent_task
WHERE
rec_status = 0
AND parent_task_detail_id = #{projectId}
UNION ALL
SELECT
task_detail_id
FROM
t_pro_parent_task
WHERE
rec_status = 0
AND parent_task_detail_id IN (
SELECT
task_detail_id
FROM
t_pro_parent_task
WHERE
rec_status = 0
AND parent_task_detail_id = #{projectId}
)
</select>
</mapper>

33
common/src/main/resources/mapper_dao/ProProjectDao.xml

@ -25,4 +25,37 @@
s.plan_start_time DESC
LIMIT 1
</select>
<select id="findSonProjectId" resultType="com.ccsens.common.bean.vo.CProjectVo$ProjectInfo">
SELECT
d.id AS detailId,
d.`name`,
d.description,
d.cycle,
s.plan_start_time,
s.plan_duration,
s.plan_end_time,
s.real_start_time,
s.real_duration,
s.real_end_time,
s.task_status
FROM
t_pro_parent_task AS pt
LEFT JOIN t_pro_task_detail AS d ON d.id = pt.task_detail_id
LEFT JOIN t_pro_task_sub AS s ON s.task_detail_id = pt.task_detail_id
LEFT JOIN t_label_business AS lb ON pt.task_detail_id = lb.business_id
LEFT JOIN t_label AS l ON lb.label_id = l.id
LEFT JOIN t_label_type AS lt ON l.label_type_id = lt.id
WHERE
lb.rec_status = 0
AND pt.rec_status = 0
AND d.rec_status = 0
AND s.rec_status = 0
AND l.rec_status = 0
AND lt.rec_status = 0
AND l.`level` = 0
AND lt.label_type = 2
AND pt.parent_task_detail_id = #{projectId}
</select>
</mapper>

83
common/src/main/resources/mapper_dao/ProRoleDao.xml

@ -122,5 +122,88 @@
AND id = #{roleId}
)
</select>
<select id="queryRoleByUserId" resultType="com.ccsens.common.bean.po.ProRole">
SELECT
r.id,
r.`name`
FROM
t_pro_role r
LEFT JOIN t_pro_role_member rm on rm.role_id = r.id
LEFT JOIN t_pro_member m on m.id = rm.member_id
WHERE
r.project_id = #{projectId}
and m.user_id = #{userId}
and r.rec_status = 0
and rm.rec_status = 0
and m.rec_status = 0
</select>
<select id="notAttentionQueryRole" resultType="com.ccsens.common.bean.vo.CRoleVo$RoleInfo">
SELECT
r.id,
r.`name`,
if(l.`level` = 0,0,1) as pm,
if(r.id in
<foreach collection="userRoleList" index="index" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
,1,0) as mine
FROM
t_pro_role r
LEFT JOIN t_label l on r.label_id = l.id
LEFT JOIN t_pro_role_repulsion rr on r.id = rr.role_id and rr.rec_status = 0
WHERE
r.project_id = #{projectId}
and r.rec_status = 0
and l.`level` &lt; 2
and l.rec_status = 0
and
(
rr.repulsion_role_id in
<foreach collection="userRoleList" index="index" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
or
rr.id is null
)
GROUP BY r.id
</select>
<select id="attentionQueryRole" resultType="com.ccsens.common.bean.vo.CRoleVo$RoleInfo">
SELECT
r.id,
r.`name`,
if(l.`level` = 0,0,1) as pm,
0 as mine
FROM
t_pro_role r
LEFT JOIN t_label l on r.label_id = l.id
LEFT JOIN t_pro_role_repulsion rr on r.id = rr.role_id and rr.rec_status = 0
WHERE
r.project_id = #{projectId}
and r.rec_status = 0
and l.`level` &lt; 2
and l.rec_status = 0
and rr.id is null
GROUP BY r.id
</select>
<select id="queryShowByUserAndProject" resultType="java.lang.Long">
SELECT
*
FROM
t_pro_role_show
WHERE
project_id = #{projectId}
and user_id = #{userId}
</select>
<select id="queryRoleListOfProject" resultType="java.lang.Long">
SELECT
id
FROM
t_pro_role
WHERE
rec_status = 0
AND project_id = #{projectId}
</select>
</mapper>

32
common/src/main/resources/mapper_dao/ProTaskDetailDao.xml

@ -347,4 +347,36 @@
ORDER BY update_status_time
</select>
<select id="findSonTask" resultType="com.ccsens.common.bean.vo.CTaskVo$SonTaskDetail">
SELECT
d.id AS detailId,
d.`name`,
d.description,
d.cycle,
s.plan_start_time,
s.plan_duration,
s.plan_end_time,
s.real_start_time,
s.real_duration,
s.real_end_time,
s.task_status
FROM
t_pro_parent_task AS pt
LEFT JOIN t_pro_task_detail AS d ON d.id = pt.task_detail_id
LEFT JOIN t_pro_task_sub AS s ON s.task_detail_id = pt.task_detail_id
LEFT JOIN t_label_business AS lb ON pt.task_detail_id = lb.business_id
LEFT JOIN t_label AS l ON lb.label_id = l.id
LEFT JOIN t_label_type AS lt ON l.label_type_id = lt.id
WHERE
lb.rec_status = 0
AND pt.rec_status = 0
AND d.rec_status = 0
AND s.rec_status = 0
AND l.rec_status = 0
AND lt.rec_status = 0
AND l.`level` != 0
AND lt.label_type = 1
AND pt.parent_task_detail_id = #{detailId}
</select>
</mapper>

258
common/src/main/resources/mapper_raw/SysHolidaysMapper.xml

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.common.persist.mapper.SysHolidaysMapper">
<resultMap id="BaseResultMap" type="com.ccsens.common.bean.po.SysHolidays">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="year" jdbcType="VARCHAR" property="year" />
<result column="holiday" jdbcType="VARCHAR" property="holiday" />
<result column="workday" jdbcType="VARCHAR" property="workday" />
<result column="operator" jdbcType="BIGINT" property="operator" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, year, holiday, workday, operator, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.common.bean.po.SysHolidaysExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_sys_holidays
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_sys_holidays
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from t_sys_holidays
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.ccsens.common.bean.po.SysHolidaysExample">
delete from t_sys_holidays
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.common.bean.po.SysHolidays">
insert into t_sys_holidays (id, year, holiday,
workday, operator, created_at,
updated_at, rec_status)
values (#{id,jdbcType=BIGINT}, #{year,jdbcType=VARCHAR}, #{holiday,jdbcType=VARCHAR},
#{workday,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.common.bean.po.SysHolidays">
insert into t_sys_holidays
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="year != null">
year,
</if>
<if test="holiday != null">
holiday,
</if>
<if test="workday != null">
workday,
</if>
<if test="operator != null">
operator,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="recStatus != null">
rec_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="year != null">
#{year,jdbcType=VARCHAR},
</if>
<if test="holiday != null">
#{holiday,jdbcType=VARCHAR},
</if>
<if test="workday != null">
#{workday,jdbcType=VARCHAR},
</if>
<if test="operator != null">
#{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.common.bean.po.SysHolidaysExample" resultType="java.lang.Long">
select count(*) from t_sys_holidays
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update t_sys_holidays
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.year != null">
year = #{record.year,jdbcType=VARCHAR},
</if>
<if test="record.holiday != null">
holiday = #{record.holiday,jdbcType=VARCHAR},
</if>
<if test="record.workday != null">
workday = #{record.workday,jdbcType=VARCHAR},
</if>
<if test="record.operator != null">
operator = #{record.operator,jdbcType=BIGINT},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
<if test="record.updatedAt != null">
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update t_sys_holidays
set id = #{record.id,jdbcType=BIGINT},
year = #{record.year,jdbcType=VARCHAR},
holiday = #{record.holiday,jdbcType=VARCHAR},
workday = #{record.workday,jdbcType=VARCHAR},
operator = #{record.operator,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.common.bean.po.SysHolidays">
update t_sys_holidays
<set>
<if test="year != null">
year = #{year,jdbcType=VARCHAR},
</if>
<if test="holiday != null">
holiday = #{holiday,jdbcType=VARCHAR},
</if>
<if test="workday != null">
workday = #{workday,jdbcType=VARCHAR},
</if>
<if test="operator != null">
operator = #{operator,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.common.bean.po.SysHolidays">
update t_sys_holidays
set year = #{year,jdbcType=VARCHAR},
holiday = #{holiday,jdbcType=VARCHAR},
workday = #{workday,jdbcType=VARCHAR},
operator = #{operator,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

12
signin/src/main/java/com/ccsens/signin/service/ProjectService.java

@ -122,10 +122,10 @@ public class ProjectService implements IProjectService{
//查询项目列表
List<ProjectVo.QueryProject> projectList = projectDao.queryProjectList(param.getStartTime(), param.getEndTime(), userId);
//获取项目的时间范围
if (ObjectUtil.isNotNull(projectList)) {
if (CollectionUtil.isNotEmpty(projectList)) {
List<Long> projectStartTimeList = projectList.stream().map(ProjectVo.QueryProject::getStartTime).collect(Collectors.toList());
List<Long> projectEndTimeList = projectList.stream().map(ProjectVo.QueryProject::getEndTime).collect(Collectors.toList());
Long maxStartTime = Collections.max(projectStartTimeList);
Long maxStartTime = Collections.min(projectStartTimeList);
Long maxEndTime = Collections.max(projectEndTimeList);
realStartTime = maxStartTime >= param.getStartTime() ? maxStartTime : param.getStartTime();
@ -155,9 +155,11 @@ public class ProjectService implements IProjectService{
//比较参数时间与项目时间
for (int i = 0; i < dateList.size(); i++) {
haveProject.add("0");
for (int y = 0; y < realDateList.size(); y++) {
if (dateList.get(i).equals(realDateList.get(y))){
haveProject.set(i,"1");
if (CollectionUtil.isNotEmpty(projectList)) {
for (String realDate : realDateList) {
if (dateList.get(i).equals(realDate)) {
haveProject.set(i, "1");
}
}
}
}

41
tall/src/main/java/com/ccsens/tall/web/DebugController.java

@ -12,6 +12,7 @@ import com.ccsens.util.bean.message.common.InMessage;
import com.ccsens.util.bean.message.common.MessageConstant;
import com.ccsens.util.bean.message.common.MessageRule;
import com.ccsens.util.config.RabbitMQConfig;
import com.ccsens.util.exception.BaseException;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import io.swagger.annotations.Api;
@ -23,6 +24,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.junit.Test;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
@ -30,6 +32,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -55,6 +58,7 @@ public class DebugController {
@Resource
SqlSessionFactory sqlSessionFactory;
private static RestTemplateUtil util;
@ApiOperation(value = "/测试",notes = "")
@ApiImplicitParams({
@ -297,6 +301,43 @@ public class DebugController {
} catch (DocumentException e) {
System.out.println(e);
}
}
@ApiImplicitParams({
})
@RequestMapping(value = "/https", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public void httpsTest() throws Exception {
int year = 2021;
int month = 9;
String a = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query="+year+"%E5%B9%B4"+month+"%E6%9C%88&co=&resource_id=39043&t=1617089428269&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=wisetpl&cb=jQuery110203576901702188473_1617089118772&_=1617089118776";
long begin = System.currentTimeMillis();
String s = HttpsUtil.httpsRequest(a,"GET","");
System.out.println(s);
System.out.println(System.currentTimeMillis() - begin);
s = s.substring(s.indexOf("("));
s = s.substring(1, s.length() - 2);
Map<String, Object> map = (Map<String, Object>) JSONObject.parse(s);
List list = (List) map.get("data");
Map data = (Map) list.get(0);
List<Map> almanac = (List<Map>) data.get("almanac");
if(almanac == null || almanac.size() == 0) {
return;
}
for(int i = 1; i < almanac.size(); i++) {
String key = ((String)almanac.get(i).get("oDate")).substring(0, 10);
String status = (String)almanac.get(i - 1).get("status");
if("1".equals(status) || "2".equals(status)) {
System.out.println(key);
System.out.println(status);
}
}
}
}

2
tall/src/main/resources/application-dev.yml

@ -11,7 +11,7 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 192.168.0.99
host: dd.tall.wiki
#host: 127.0.0.1
password: 111111
port: 5672

25
util/src/main/java/com/ccsens/util/CodeError.java

@ -22,6 +22,31 @@ public class CodeError {
this.msg = msg;
this.success = success;
}
public Code addMsg(String msg){
if(this.msg.contains("错误:")){
this.msg = this.msg.substring(this.msg.indexOf("错误:") + 3);
}
this.msg = msg+"--错误:"+this.msg;
return this;
}
public Code addMsg(String sheetName,Integer rowNum){
if(this.msg.contains("错误:")){
this.msg = this.msg.substring(this.msg.indexOf("错误:") + 3);
}
this.msg = sheetName+"第"+rowNum+"行--错误:"+this.msg;
return this;
}
public Code addMsg(String sheetName,Integer rowNum,String value){
if(this.msg.contains("错误:")){
this.msg = this.msg.substring(this.msg.indexOf("错误:") + 3);
}
this.msg = sheetName+"第"+rowNum+"行["+value+"]--错误:"+this.msg;
return this;
}
}
}

1
util/src/main/java/com/ccsens/util/RestTemplateUtil.java

@ -60,6 +60,7 @@ public class RestTemplateUtil {
log.info("url:{}, params:{}", url, params);
ResponseEntity<String> entity = util.restTemplate.getForEntity(url, String.class);
log.info("entity:{}",entity);
// return entity;
return JSONObject.parseObject(entity.getBody(), returnClass);
}

7
util/src/main/java/com/ccsens/util/cron/NatureConstant.java

@ -53,9 +53,14 @@ public class NatureConstant {
public static final String WORKDAY_TIMME = "工作日([0-9"+CHINESE_NUM+"]*)点?小?时?";
public static final String WORKDAY_MONTH = "每月最后一个工作日";
public static final String WORKDAY_WEEK = "每周最后一个工作日";
public static final String WORKDAY_YEAR = "每年最后一个工作日";
public static final String WORKDAY = "每[周月年]最后一个工作日";
public static final String WORKDAY_TIMME = "工作日([0-9"+CHINESE_NUM+"]*)点?小?时?";
public static final String REDIS_YEAR_WORKDAY = "workday_";
}

139
util/src/main/java/com/ccsens/util/cron/NatureToDate.java

@ -1,12 +1,19 @@
package com.ccsens.util.cron;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.util.DateUtil;
import com.ccsens.util.RedisUtil;
import com.ccsens.util.StringUtil;
import com.ccsens.util.exception.BaseException;
import com.ccsens.util.message.SwitchoverProjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
@ -20,8 +27,8 @@ public class NatureToDate {
public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date start = sdf.parse("2019-09-1 0:00:00");
Date end = sdf.parse("2019-11-2 0:00:00");
Date start = sdf.parse("2021-08-05 0:00:00");
Date end = sdf.parse("2021-11-01 0:00:00");
// System.out.println("每周一:" + generateDates("每周一", start, end));
// System.out.println("每周二:" + generateDates("每周二", start, end));
@ -46,6 +53,7 @@ public class NatureToDate {
// System.out.println("第1天:" + generateDates("第1天", start, end));
// System.out.println("每40分钟:" + generateDates("每40分钟", start, end));
// System.out.println("每月15号下午5点:" + generateDates("每月15号下午5点", start, end));
System.out.println("每月最后一个工作日:" + generateDates("每年最后一个工作日", start, end));
// log.info("周一到周五 8点-9点: " + generateDates("周一到周五 18点", start, end));
// log.info("每年3月5号前: " + generateDates("每年03月05号前", start, end));
@ -63,9 +71,7 @@ public class NatureToDate {
* @param endDate
* @return
*/
public static List<CronConstant.TaskDate> generateDates(String nature, Date startDate, Date endDate) {
if (StringUtil.isEmpty(nature)) {
public static List<CronConstant.TaskDate> generateDates(String nature, Date startDate, Date endDate) { if (StringUtil.isEmpty(nature)) {
// TODO
throw new BaseException("重复内容为空");
}
@ -147,9 +153,117 @@ public class NatureToDate {
taskDates.add(taskDate);
return taskDates;
}
else if(StringUtil.isMatch(nature, NatureConstant.WORKDAY_MONTH)){
//每月最后一个工作日
getLastWorkdayByMonth(taskDates,startDate, endDate);
return taskDates;
}else if(StringUtil.isMatch(nature, NatureConstant.WORKDAY_WEEK)){
//每周最后一个工作日
getLastWorkdayByWeek(taskDates,startDate, endDate);
return taskDates;
}else if(StringUtil.isMatch(nature, NatureConstant.WORKDAY_YEAR)){
getLastWorkdayByYear(taskDates,startDate, endDate);
return taskDates;
}
return null;
}
/**
* 获取每周最后一个工作日
*/
private static void getLastWorkdayByWeek(List<CronConstant.TaskDate> taskDates, Date startDate, Date endDate) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
while (calendar.getTime().getTime() < endDate.getTime()) {
Date start = calendar.getTime();
calendar.add(Calendar.WEEK_OF_YEAR, 1);
calendar.set(Calendar.DAY_OF_WEEK, 1);
Date end = calendar.getTime().getTime() > endDate.getTime() ? endDate : calendar.getTime();
//获取当月最后一个工作日
getLastWorkday(taskDates,start,end);
calendar.add(Calendar.DAY_OF_MONTH, 1);
}
}
return null;
/**
* 获取每月最后一个工作日
*/
private static void getLastWorkdayByMonth(List<CronConstant.TaskDate> taskDates, Date startDate, Date endDate) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
while (calendar.getTime().getTime() < endDate.getTime()) {
//获取月开始时间
Date start = calendar.getTime();
//获取月结束时间
calendar.add(Calendar.MONTH, 1);
calendar.set(Calendar.DAY_OF_MONTH, 0);
Date end = calendar.getTime().getTime() > endDate.getTime() ? endDate : calendar.getTime();
//获取当月最后一个工作日
getLastWorkday(taskDates,start,end);
//加一个月(为下一个循环)
calendar.add(Calendar.MONTH, 1);
calendar.set(Calendar.DAY_OF_MONTH, 1);
}
}
/**
* 获取每年最后一个工作日
*/
private static void getLastWorkdayByYear(List<CronConstant.TaskDate> taskDates, Date startDate, Date endDate) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
while (calendar.getTime().getTime() < endDate.getTime()) {
//获取开始时间
Date start = calendar.getTime();
int last = calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
calendar.set(Calendar.DAY_OF_YEAR, last);
//获取当年最后一天
Date end = calendar.getTime();
getLastWorkday(taskDates,start,end);
calendar.add(Calendar.DAY_OF_YEAR, 1);
}
}
/**
* 获取指定时间范围内的最后一个工作日
*/
public static void getLastWorkday(List<CronConstant.TaskDate> taskDates, Date startDate, Date endDate) {
DateFormat df = new SimpleDateFormat("MM-dd");
DateFormat yearFormat = new SimpleDateFormat("yy");
//获取本年节假日信息
String holiday = "";
String overDay = "";
String key = NatureConstant.REDIS_YEAR_WORKDAY + yearFormat.format(startDate);
// Object o = redisUtil.get(key);
// if(ObjectUtil.isNull(o)){
//中国法定节假日期
holiday = "01-01,01-02,01-03,02-11,02-12,02-13,02-14,02-15,02-16,"
+ "02-17,04-03,04-04,04-05,05-01,05-02,05-03,05-04,05-05,06-12,06-13,"
+ "06-14,09-19,09-20,09-21,10-01,10-02,10-03,10-04,10-05,10-06,10-07";
// 节假前后加班日期
overDay = "02-07,02-20,04-25,05-08,09-18,09-26,10-09";
// }else {
//
// }
Calendar min = Calendar.getInstance();
Calendar max = Calendar.getInstance();
min.setTime(startDate);
max.setTime(endDate);
while (min.before(max)) {
int i = max.get(Calendar.DAY_OF_WEEK);
//是节假前后加班日期 || (不是周末 && 不是节假日)
if (overDay.contains(df.format(max.getTime())) || ((i != 1 && i != 7) && !holiday.contains(df.format(max.getTime())))) {
CronConstant.TaskDate taskDate = new CronConstant.TaskDate();
taskDate.setStartDate(DateUtil.getYMD(max.getTime()));
max.add(Calendar.DATE, 1);
taskDate.setEndDate(DateUtil.getYMD(max.getTime()));
taskDates.add(taskDate);
break;
}
max.add(Calendar.DATE, -1);
}
}
/**
@ -266,11 +380,14 @@ public class NatureToDate {
} else if (StringUtil.isMatch(nature, NatureConstant.WEEK_EVERY)){
String[] natureArr = nature.split(NatureConstant.SPACE);
} else if (nature.contains(NatureConstant.WORK_DAY)) {
//工作日
split[0] = nature.replaceAll("工作日","周1");
split[1] = nature.replaceAll("工作日","周6");
} else if (StringUtil.isMatch(nature, NatureConstant.BEFORE_YEAR_MONTH_DAY)){
}
// else if (nature.contains(NatureConstant.WORK_DAY)) {
//// //工作日
// split[0] = nature.replaceAll("工作日","周1");
// split[1] = nature.replaceAll("工作日","周6");
//
// }
else if (StringUtil.isMatch(nature, NatureConstant.BEFORE_YEAR_MONTH_DAY)){
//每年X月X号前
split[0] = "每年1月1号";
split[1] = nature.substring(0, nature.length() - 1);

202
util/src/test/java/com/ccsens/util/DateTest.java

@ -0,0 +1,202 @@
package com.ccsens.util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.util.cron.CronConstant;
public class DateTest {
//
// public static String sendGet(String url, String param) {
// String result = "";
// BufferedReader in = null;
// try {
// String urlNameString = url + "/" + param;
// URL realUrl = new URL(urlNameString);
// URLConnection connection = realUrl.openConnection();
// connection.setRequestProperty("accept", "*/*");
// connection.setRequestProperty("connection", "Keep-Alive");
// connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// connection.connect();
// in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
// String line;
// int cot = 0;
// while ((line = in.readLine()) != null) {
// result += line;
// }
// } catch (Exception e) {
// System.out.println("发送GET请求出现异常!" + e);
// e.printStackTrace();
// }
// finally {
// try {
// if (in != null) {
// in.close();
// }
// } catch (Exception e2) {
// e2.printStackTrace();
// }
// }
// return result;
// }
//
// static Map totalMap = new TreeMap();
//
// public static void main(String[] args) throws Exception {
//
// int startYear = 2021;//开始的年份
// int year = 8; //统计的年份
// loop("2021", "8");
//// for(int i = 0; i <= (year - 1); i++){
////// for(int j = 1; j <= 12; j++) {
//// loop(startYear + i + "", j + "");
////// }
//// }
//
// Iterator it = totalMap.keySet().iterator();
// while(it.hasNext()) {
// String temp = (String) it.next();
// System.out.println(temp + " " + totalMap.get(temp));
// }
//
// }
//
// public static void loop(String year, String month) throws Exception {
// String s = DateTest.sendGet("https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query="+year+"%E5%B9%B4"+month+"%E6%9C%88&co=&resource_id=39043&t=1617089428269&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=wisetpl&cb=jQuery110203576901702188473_1617089118772&_=1617089118776", "");
//
// String a = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query="+year+"%E5%B9%B4"+month+"%E6%9C%88&co=&resource_id=39043&t=1617089428269&ie=utf8&oe=gbk&cb=op_aladdin_callback&format=json&tn=wisetpl&cb=jQuery110203576901702188473_1617089118772&_=1617089118776";
// long a1 = System.currentTimeMillis();
// RestTemplateUtil.getForEntity(a,new HashMap<>(),StringBuilder.class);
// System.out.println(System.currentTimeMillis() - a1);
//
// s = s.substring(s.indexOf("("));
// s = s.substring(1, s.length() - 2);
// Map<String, Object> map = (Map<String, Object>) JSONObject.parse(s);
//
// List list = (List) map.get("data");
// Map data = (Map) list.get(0);
// List<Map> almanac = (List<Map>) data.get("almanac");
// if(almanac == null || almanac.size() == 0) {
// return;
// }
//
// for(int i = 1; i < almanac.size(); i++) {
// String key = ((String)almanac.get(i).get("oDate")).substring(0, 10);
// String status = (String)almanac.get(i - 1).get("status");
// if("1".equals(status) || "2".equals(status)) {
// totalMap.put(key, status);
// }
// }
//
// }
/*
*实现思路
*1. 判断指定日期是否掉是双休日
*2. 在通过获取指定日期的 月和日 判断是否是节假
*3. 判断是否有节假日 双休加班情况
*4. 如果上面的你已经了解那么得到工作日就简单了不写了自己通过需求加上
*/
public void isOverDay() { // 指定时间判断是否是双休日
String dates = "2013-05-13"; // 这里可以自定义
DateFormat df = new SimpleDateFormat("yy-MM-dd");
Date d;
try {
d = df.parse("");
if (d.getDay() == 0 || d.getDay() == 6) {
System.out.println("日期:[" + dates + "] 是双休日");
} else {
System.out.println("日期:[" + dates + "] 不是双休日");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void isHodliDays(List<CronConstant.TaskDate> taskDates, Date startDate, Date endDate) { // 判断是否滴节假日,是否有节假日加班
DateFormat df = new SimpleDateFormat("MM-dd");
//中国法定节假日期
String isHoliday = "01-01,01-02,01-03,02-11,02-12,02-13,02-14,02-15,02-16,"
+ "02-17,04-03,04-04,04-05,05-01,05-02,05-03,05-04,05-05,06-12,06-13,"
+ "06-14,09-19,09-20,09-21,10-01,10-02,10-03,10-04,10-05,10-06,10-07";
// 节假前后加班日期
String overDay = "02-07,02-20,04-25,05-08,09-18,09-26,10-09";
Calendar min = Calendar.getInstance();
Calendar max = Calendar.getInstance();
min.setTime(startDate);
max.setTime(endDate);
while (min.before(max)) {
int i = max.get(Calendar.DAY_OF_WEEK);
//是调休 || (不是周末 && 不是节假日)
if (overDay.contains(df.format(max.getTime())) || ((i != 1 && i != 7) && !isHoliday.contains(df.format(max.getTime())))) {
System.out.println(df.format(max.getTime())+"工作日");
CronConstant.TaskDate taskDate = new CronConstant.TaskDate();
taskDate.setStartDate(DateUtil.getYMD(max.getTime()));
max.add(Calendar.DATE, -1);
taskDate.setEndDate(DateUtil.getYMD(max.getTime()));
taskDates.add(taskDate);
break;
}
max.add(Calendar.DATE, -1);
}
}
public static void main(String[] args) throws Exception {
List<CronConstant.TaskDate> taskDates = new ArrayList<>();
Date s = new Date(1628148817000L);
Date e = new Date(1633851217000L);
DateFormat df = new SimpleDateFormat("yy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(s);
while (calendar.getTime().getTime() < e.getTime()) {
// //获取月开始时间
// Date start = calendar.getTime();
// //获取月结束时间
// calendar.add(Calendar.MONTH, 1);
// calendar.set(Calendar.DAY_OF_MONTH, 0);
// Date end = calendar.getTime().getTime() > e.getTime() ? e : calendar.getTime();
// //获取当月最后一个工作日
// isHodliDays(taskDates,start,end);
// //加一个月(为下一个循环)
// calendar.add(Calendar.MONTH, 1);
// calendar.set(Calendar.DAY_OF_MONTH, 1);
// System.out.println(df.format(calendar.getTime()));
// Date start = calendar.getTime();
// calendar.add(Calendar.WEEK_OF_YEAR, 1);
// calendar.set(Calendar.DAY_OF_WEEK, 1);
// Date end = calendar.getTime();
// //获取当月最后一个工作日
// isHodliDays(taskDates,start,end);
//
// System.out.println(df.format(calendar.getTime()));
// calendar.add(Calendar.DAY_OF_MONTH, 1);
// System.out.println(df.format(calendar.getTime()));
// System.out.println("====================================");
System.out.println(df.format(calendar.getTime()));
Date start = calendar.getTime();
int last = calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
calendar.set(Calendar.DAY_OF_YEAR, last);
Date end = calendar.getTime();
System.out.println(df.format(calendar.getTime()));
calendar.add(Calendar.DAY_OF_YEAR, 1);
System.out.println(df.format(calendar.getTime()));
// isHodliDays(taskDates,start,end);
}
System.out.println(taskDates);
}
}

38
util/src/test/java/com/ccsens/util/OtherTest.java

@ -14,6 +14,8 @@ import javax.annotation.Resource;
import javax.script.ScriptException;
import java.io.*;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
@ -25,6 +27,42 @@ public class OtherTest {
public static final String REGEX_PHONE = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,1-9]))\\d{8}$";
@Test
public void test15() {
String httpArg = "20211001";
String httpUrl = "http://api.goseek.cn/Tools/holiday";
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
httpUrl = httpUrl + "?date=" + httpArg;
int d=0;//工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2
try {
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sbf.append(strRead);
sbf.append("\r\n");
}
reader.close();
result = sbf.toString();
// JSONObject ob= JSONObject.fromObject(result);
// if(ob!=null){
// d=Integer.parseInt(ob.getString("data"));
// }
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void test2() throws ScriptException {
String str = "18200000000";

Loading…
Cancel
Save