45 changed files with 5078 additions and 5 deletions
@ -0,0 +1,15 @@ |
|||
package com.ccsens.ptccsens.bean.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class PluginDto { |
|||
@Data |
|||
public static class WbsMember{ |
|||
//成员id
|
|||
private Long id; |
|||
//userId
|
|||
private Long userId; |
|||
|
|||
} |
|||
} |
@ -0,0 +1,194 @@ |
|||
package com.ccsens.ptccsens.bean.po; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
public class ProUser implements Serializable { |
|||
private Long id; |
|||
|
|||
private String name; |
|||
|
|||
private Byte gender; |
|||
|
|||
private String avatarUrl; |
|||
|
|||
private String country; |
|||
|
|||
private String province; |
|||
|
|||
private String city; |
|||
|
|||
private String phone; |
|||
|
|||
private String idCard; |
|||
|
|||
private Byte power; |
|||
|
|||
private String deviceId; |
|||
|
|||
private Byte authType; |
|||
|
|||
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 getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name == null ? null : name.trim(); |
|||
} |
|||
|
|||
public Byte getGender() { |
|||
return gender; |
|||
} |
|||
|
|||
public void setGender(Byte gender) { |
|||
this.gender = gender; |
|||
} |
|||
|
|||
public String getAvatarUrl() { |
|||
return avatarUrl; |
|||
} |
|||
|
|||
public void setAvatarUrl(String avatarUrl) { |
|||
this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim(); |
|||
} |
|||
|
|||
public String getCountry() { |
|||
return country; |
|||
} |
|||
|
|||
public void setCountry(String country) { |
|||
this.country = country == null ? null : country.trim(); |
|||
} |
|||
|
|||
public String getProvince() { |
|||
return province; |
|||
} |
|||
|
|||
public void setProvince(String province) { |
|||
this.province = province == null ? null : province.trim(); |
|||
} |
|||
|
|||
public String getCity() { |
|||
return city; |
|||
} |
|||
|
|||
public void setCity(String city) { |
|||
this.city = city == null ? null : city.trim(); |
|||
} |
|||
|
|||
public String getPhone() { |
|||
return phone; |
|||
} |
|||
|
|||
public void setPhone(String phone) { |
|||
this.phone = phone == null ? null : phone.trim(); |
|||
} |
|||
|
|||
public String getIdCard() { |
|||
return idCard; |
|||
} |
|||
|
|||
public void setIdCard(String idCard) { |
|||
this.idCard = idCard == null ? null : idCard.trim(); |
|||
} |
|||
|
|||
public Byte getPower() { |
|||
return power; |
|||
} |
|||
|
|||
public void setPower(Byte power) { |
|||
this.power = power; |
|||
} |
|||
|
|||
public String getDeviceId() { |
|||
return deviceId; |
|||
} |
|||
|
|||
public void setDeviceId(String deviceId) { |
|||
this.deviceId = deviceId == null ? null : deviceId.trim(); |
|||
} |
|||
|
|||
public Byte getAuthType() { |
|||
return authType; |
|||
} |
|||
|
|||
public void setAuthType(Byte authType) { |
|||
this.authType = authType; |
|||
} |
|||
|
|||
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(", name=").append(name); |
|||
sb.append(", gender=").append(gender); |
|||
sb.append(", avatarUrl=").append(avatarUrl); |
|||
sb.append(", country=").append(country); |
|||
sb.append(", province=").append(province); |
|||
sb.append(", city=").append(city); |
|||
sb.append(", phone=").append(phone); |
|||
sb.append(", idCard=").append(idCard); |
|||
sb.append(", power=").append(power); |
|||
sb.append(", deviceId=").append(deviceId); |
|||
sb.append(", authType=").append(authType); |
|||
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(); |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,22 @@ |
|||
package com.ccsens.ptccsens.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class TaskVo { |
|||
|
|||
@Data |
|||
@ApiModel("项目下的任务") |
|||
public static class TaskOfProject { |
|||
@ApiModelProperty("任务详情id") |
|||
private Long detailId; |
|||
@ApiModelProperty("任务名称") |
|||
private String name; |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.bean.po.LabelBusiness; |
|||
import com.ccsens.ptccsens.persist.mapper.LabelBusinessMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface LabelBusinessDao extends LabelBusinessMapper { |
|||
|
|||
/** |
|||
* 根据业务id集合查询任务标签表 |
|||
* @param businessIdList 业务id集合 |
|||
* @return 任务标签集合 |
|||
*/ |
|||
List<LabelBusiness> findBusinessLabelByBid(@Param("businessIdList") List<Long> businessIdList); |
|||
|
|||
/** |
|||
* 保存全部任务标签关系 |
|||
* @param businessLabelList 任务标签关系列表 |
|||
*/ |
|||
void insertAllBusinessLabel(@Param("businessLabelList") List<LabelBusiness> businessLabelList); |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.persist.mapper.LabelMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
@Repository |
|||
public interface LabelDao extends LabelMapper { |
|||
|
|||
|
|||
String queryIsPm(Long labelId); |
|||
|
|||
Long getLabelByTypeAndLevel(@Param("type") int type, @Param("level") int level); |
|||
|
|||
/** |
|||
* 根据业务id和类型删除关联标签信息 |
|||
* @param businessId 业务id |
|||
* @param type 业务类型 |
|||
*/ |
|||
void delByBusinessIdAndType(@Param("businessId") Long businessId, @Param("type") byte type); |
|||
|
|||
Long getLabelByName(@Param("type") int type, @Param("sysRole") String sysRole); |
|||
|
|||
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.bean.po.ProParentTask; |
|||
import com.ccsens.ptccsens.persist.mapper.ProParentTaskMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
public interface ProParentTaskDao extends ProParentTaskMapper { |
|||
|
|||
// /**
|
|||
// * 根据项目id查找一级任务列表
|
|||
// * @param oldProjectId 项目id
|
|||
// * @return 一级任务列表
|
|||
// */
|
|||
// List<TallTaskVo.TaskDetail> findTaskByParentId(@Param("oldProjectId") Long oldProjectId);
|
|||
|
|||
/** |
|||
* 保存所有任务关系 |
|||
* @param newParentTaskList 任务关系列表 |
|||
*/ |
|||
void insertAllParentTask(@Param("newParentTaskList") List<ProParentTask> newParentTaskList); |
|||
|
|||
/** |
|||
* 根据项目id查询所有一二级任务详情id |
|||
* @param projectId 项目id |
|||
* @return 一二级任务详情id列表 |
|||
*/ |
|||
List<Long> queryAllTaskIdByProjectId(@Param("projectId") Long projectId); |
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.bean.po.ProRole; |
|||
import com.ccsens.ptccsens.persist.mapper.ProRoleMapper; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProRoleDao extends ProRoleMapper { |
|||
|
|||
/** |
|||
* 根据角色id查找项目id |
|||
* @param roleId 角色id |
|||
* @return 项目id |
|||
*/ |
|||
Long findRoleOfProjectId(@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<TallRoleVo.RoleInfo> notAttentionQueryRole(@Param("projectId") Long projectId, @Param("userRoleList") List<ProRole> userRoleList); |
|||
|
|||
/** |
|||
* 是关注者,查询可见角色 |
|||
* @param projectId |
|||
* @return |
|||
*/ |
|||
List<TallRoleVo.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); |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.persist.mapper.ProRoleMemberMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProRoleMemberDao extends ProRoleMemberMapper { |
|||
|
|||
/** |
|||
* 查找成员所属的所有角色 |
|||
* @param memberId 成员id |
|||
* @return 所有所属角色id |
|||
*/ |
|||
List<Long> findMemberOfRoleIds(@Param("memberId") Long memberId); |
|||
|
|||
// /**
|
|||
// * 根据成员id和角色id查询
|
|||
// * @param userOfMemberId 成员id
|
|||
// * @param roleId 角色id
|
|||
// * @return 角色成员信息
|
|||
// */
|
|||
// ProRoleMember queryByRoleAndMember(@Param("memberId") Long userOfMemberId, @Param("roleId") Long roleId);
|
|||
//
|
|||
// /**
|
|||
// * 删除该角色和成员的关联信息
|
|||
// * @param roleId 角色id
|
|||
// */
|
|||
// void delByRoleId(@Param("roleId") Long roleId);
|
|||
//
|
|||
// /**
|
|||
// * 删除该成员和角色的关联信息
|
|||
// * @param memberId 成员id
|
|||
// */
|
|||
// void delByMemberId(@Param("memberId") Long memberId);
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.persist.mapper.ProRoleRepulsionMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProRoleRepulsionDao extends ProRoleRepulsionMapper { |
|||
|
|||
/** |
|||
* 查看该角色排斥的所有角色 |
|||
* @param roleId 角色id |
|||
* @return 排斥的角色id |
|||
*/ |
|||
List<Long> findRepulsionByRoleId(@Param("roleId") Long roleId); |
|||
|
|||
// /**
|
|||
// * 查询角色的不可见列表
|
|||
// * @param oldRoleList 角色列表
|
|||
// * @return 不可见列表
|
|||
// */
|
|||
// List<ProRoleRepulsion> findRepulsionByRoleIdList(@Param("oldRoleList") List<ProRole> oldRoleList);
|
|||
//
|
|||
// /**
|
|||
// * 批量插入角色的不可见列表
|
|||
// * @param newRoleRepulsionList 不可见列表
|
|||
// */
|
|||
// void insertRoleRepulsionList(@Param("newRoleRepulsionList") List<ProRoleRepulsion> newRoleRepulsionList);
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.persist.mapper.ProRoleTaskMapper; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProRoleTaskDao extends ProRoleTaskMapper { |
|||
|
|||
// /**
|
|||
// * 根据角色id查找所有角色任务关系
|
|||
// * @param oldRoleIdList 角色id集合
|
|||
// * @return 角色任务关系列表
|
|||
// */
|
|||
// List<ProRoleTask> findRoleTaskByRoleId(@Param("roleIds") List<Long> oldRoleIdList);
|
|||
//
|
|||
// /**
|
|||
// * 保存所有的角色任务关系
|
|||
// * @param newRoleTaskList 角色任务关系列表
|
|||
// */
|
|||
// void insertAllRoleTask(@Param("roleTaskList") List<ProRoleTask> newRoleTaskList);
|
|||
//
|
|||
// /**
|
|||
// * 查询我负责的任务
|
|||
// * @param taskDetailId 任务详情id
|
|||
// * @param userOfRoles 角色id列表
|
|||
// * @return 角色任务id
|
|||
// */
|
|||
// List<Long> isMyTask(@Param("taskDetailId") Long taskDetailId, @Param("roleIdList") List<Long> userOfRoles);
|
|||
|
|||
/** |
|||
* 根据任务id查找任务下的检查人 |
|||
* @param detailId 任务详情id |
|||
* @return 检查人列表 |
|||
*/ |
|||
List<TallTaskVo.CheckerOfTask> queryCheckerOfTask(@Param("detailId") Long detailId); |
|||
|
|||
// /**
|
|||
// * 删除任务和角色的关联关系
|
|||
// * @param detailId 任务id
|
|||
// * @param roleDuty 类型(0负责人 1检查人)
|
|||
// */
|
|||
// void delByTaskDetailIdAndType(@Param("detailId") Long detailId, @Param("roleDuty") byte roleDuty);
|
|||
} |
@ -1,12 +1,81 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.bean.dto.TaskDto; |
|||
import com.ccsens.ptccsens.bean.po.ProTaskSub; |
|||
import com.ccsens.ptccsens.bean.vo.TaskVo; |
|||
import com.ccsens.ptccsens.persist.mapper.ProTaskDetailMapper; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface ProTaskDetailDao { |
|||
import java.util.List; |
|||
|
|||
public interface ProTaskDetailDao extends ProTaskDetailMapper { |
|||
/** |
|||
* 根据任务详情id查找项目id |
|||
* @param taskDetailId 任务ID |
|||
* @return 项目ID |
|||
*/ |
|||
Long projectIdByTaskDetailId(@Param("taskDetailId") Long taskDetailId); |
|||
|
|||
/** |
|||
* 根据角色查找永久日常任务 |
|||
* @param roleIdList 角色id |
|||
* @return 永久日常任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryPermanentGlobalTask(@Param("roleIdList") List<Long> roleIdList); |
|||
|
|||
/** |
|||
* 根据角色和时间节点查找日常任务 |
|||
* @param roleIdList 角色id集合 |
|||
* @param timeNode 时间节点 |
|||
* @param timeUnit 时间颗粒度 |
|||
* @return 日常任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryGlobalTask(@Param("roleIdList") List<Long> roleIdList, @Param("timeNode") Long timeNode, @Param("timeUnit") int timeUnit); |
|||
|
|||
/** |
|||
* 根据时间和角色查找定期任务 |
|||
* @param roleIdList 角色id集合 |
|||
* @param timeUnit 时间单位 |
|||
* @param timeNode 时间节点 |
|||
* @param queryType 查询类型 |
|||
* @param query 查询颗粒度数量 |
|||
* @param timeFormat 时间格式 |
|||
* @return 定期任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> queryRegularTask(@Param("roleIdList") List<Long> roleIdList, @Param("timeUnit") int timeUnit, @Param("timeNode") Long timeNode |
|||
, @Param("queryType") int queryType, @Param("query") String query, @Param("timeFormat") String timeFormat); |
|||
|
|||
/** |
|||
* 继续向上/向下查找 |
|||
* @param roleIdList 角色id集合 |
|||
* @param timeUnit 时间单位 |
|||
* @param timeNode 时间节点 |
|||
* @param queryType 查询类型 |
|||
* @param query 查询颗粒度数量 |
|||
* @param timeFormat 时间格式 |
|||
* @return 定期任务列表 |
|||
*/ |
|||
List<TallTaskVo.QueryTask> continueQueryTask(@Param("roleIdList") List<Long> roleIdList, @Param("timeUnit") int timeUnit, @Param("timeNode") Long timeNode |
|||
, @Param("queryType") int queryType, @Param("query") String query, @Param("timeFormat") String timeFormat); |
|||
|
|||
|
|||
void insertSelectiveList(@Param("proTaskSubList") List<ProTaskSub> proTaskSubList); |
|||
|
|||
/** |
|||
* 根据任务名和项目id查找当前时间下的任务的分解id |
|||
* @param taskName 任务名 |
|||
* @param projectId 项目id |
|||
* @param now 当前时间 |
|||
* @return 返回任务分解id |
|||
*/ |
|||
Long getNowTask(@Param("taskName") String taskName, @Param("projectId") Long projectId, @Param("now") long now); |
|||
|
|||
/** |
|||
* 查询项目下的所有任务 |
|||
* @param param 项目id 任务名称 |
|||
* @return 任务列表 |
|||
*/ |
|||
List<TaskVo.TaskOfProject> queryTaskOfProject(TaskDto.QueryTaskOfProject param); |
|||
|
|||
} |
|||
|
@ -0,0 +1,40 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.persist.mapper.ProTaskPluginMapper; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProTaskPluginDao extends ProTaskPluginMapper { |
|||
/** |
|||
* 根据任务id查询已配置的插件 |
|||
* @param detailTaskId 任务详情id |
|||
* @return 插件列表 |
|||
*/ |
|||
List<TallTaskVo.TaskPluginInfo> queryTaskOfPlugin(@Param("detailTaskId") Long detailTaskId); |
|||
|
|||
// /**
|
|||
// * 根据任务id列表查询任务插件
|
|||
// * @param oldTaskIdList 任务id列表
|
|||
// * @return 任务插件列表
|
|||
// */
|
|||
// List<ProTaskPlugin> findPluginByTaskIdList(@Param("oldTaskIdList") List<Long> oldTaskIdList);
|
|||
//
|
|||
// /**
|
|||
// * 添加所有的任务插件列表
|
|||
// * @param taskPluginList 任务插件列表
|
|||
// */
|
|||
// void insertAllTaskPlugin(@Param("taskPluginList") List<ProTaskPlugin> taskPluginList);
|
|||
//
|
|||
// /**
|
|||
// * 删除任务关联的插件信息
|
|||
// * @param taskDetailId 任务id
|
|||
// */
|
|||
// void delByTaskDetailId(@Param("taskDetailId") Long taskDetailId);
|
|||
} |
@ -0,0 +1,43 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.bean.po.ProTaskSub; |
|||
import com.ccsens.ptccsens.persist.mapper.ProTaskSubMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProTaskSubDao extends ProTaskSubMapper { |
|||
|
|||
/** |
|||
* 查询任务详情的分解任务 |
|||
* @param taskDetailId 任务详情id |
|||
* @return 分解任务列表 |
|||
*/ |
|||
List<ProTaskSub> findSubTaskByDetail(@Param("id") Long taskDetailId); |
|||
|
|||
/** |
|||
* 保存所有的分解任务 |
|||
* @param newTaskSubList 分解任务列表 |
|||
*/ |
|||
void insertAllTaskSub(@Param("newTaskSubList") List<ProTaskSub> newTaskSubList); |
|||
|
|||
/** |
|||
* 查找下一个分解任务 |
|||
* @param nextTaskDetailId 任务详情id |
|||
* @param planTime 计划开始时间 |
|||
* @return 分解任务 |
|||
*/ |
|||
ProTaskSub findNextTaskSub(@Param("nextTaskDetailId") Long nextTaskDetailId, @Param("planTime") Long planTime); |
|||
|
|||
/** |
|||
* 删除分解的任务 |
|||
* @param taskDetailId 任务详情id |
|||
*/ |
|||
void deleteOldSubTask(@Param("taskDetailId") Long taskDetailId); |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.bean.po.ProTaskVersion; |
|||
import com.ccsens.ptccsens.persist.mapper.ProTaskVersionMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* @author AUSU |
|||
*/ |
|||
@Repository |
|||
public interface ProTaskVersionDao extends ProTaskVersionMapper { |
|||
|
|||
/** |
|||
* 根据项目id查询版本信息 |
|||
* @param id 项目id |
|||
* @return 版本信息 |
|||
*/ |
|||
ProTaskVersion findVersionByProjectId(@Param("projectId") Long id); |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
|
|||
import com.ccsens.ptccsens.bean.vo.ProjectVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Repository |
|||
public interface ProjectDao { |
|||
|
|||
List<ProjectVo.SysProject> queryByCreator(@Param("userId") Long userId); |
|||
|
|||
/** |
|||
* 根据项目id查询项目 |
|||
* @param projectId 项目id |
|||
* @return 项目信息 |
|||
*/ |
|||
ProjectVo.SysProject selectById(@Param("projectId") Long projectId); |
|||
|
|||
/** |
|||
* 逻辑删除项目 |
|||
* @param projectId 项目id |
|||
*/ |
|||
void updateStatusById(@Param("projectId") Long projectId); |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.ccsens.ptccsens.persist.dao; |
|||
|
|||
import com.ccsens.ptccsens.bean.po.ProUser; |
|||
import com.ccsens.ptccsens.persist.mapper.ProUserMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface UserDao extends ProUserMapper { |
|||
|
|||
/** |
|||
* 通过手机号获取userId |
|||
* @param phone |
|||
* @return |
|||
*/ |
|||
ProUser getUserIdByPhone(@Param("phone") String phone); |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.ccsens.ptccsens.persist.mapper; |
|||
|
|||
import com.ccsens.ptccsens.bean.po.ProUser; |
|||
import com.ccsens.ptccsens.bean.po.ProUserExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface ProUserMapper { |
|||
long countByExample(ProUserExample example); |
|||
|
|||
int deleteByExample(ProUserExample example); |
|||
|
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
int insert(ProUser record); |
|||
|
|||
int insertSelective(ProUser record); |
|||
|
|||
List<ProUser> selectByExample(ProUserExample example); |
|||
|
|||
ProUser selectByPrimaryKey(Long id); |
|||
|
|||
int updateByExampleSelective(@Param("record") ProUser record, @Param("example") ProUserExample example); |
|||
|
|||
int updateByExample(@Param("record") ProUser record, @Param("example") ProUserExample example); |
|||
|
|||
int updateByPrimaryKeySelective(ProUser record); |
|||
|
|||
int updateByPrimaryKey(ProUser record); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface IImportService { |
|||
/** |
|||
* 读取excel |
|||
* @param path 路径 |
|||
* @param userId userId |
|||
* @throws Exception 异常 |
|||
*/ |
|||
TallProjectVo.ProjectInfo importWbs(String path, Long userId, Long projectId) throws Exception; |
|||
|
|||
} |
@ -0,0 +1,903 @@ |
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import cn.hutool.core.lang.Snowflake; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.ccsens.ptccsens.bean.dto.RoleDto; |
|||
import com.ccsens.ptccsens.bean.dto.TaskDto; |
|||
import com.ccsens.ptccsens.bean.po.*; |
|||
import com.ccsens.ptccsens.util.Constant; |
|||
import com.ccsens.ptccsens.bean.vo.ProjectVo; |
|||
import com.ccsens.ptccsens.persist.dao.*; |
|||
import com.ccsens.ptccsens.persist.mapper.ProMemberStakeholderMapper; |
|||
import com.ccsens.ptccsens.util.BasicsCodeError; |
|||
import com.ccsens.ptccsens.util.BasicsConstant; |
|||
import com.ccsens.util.ExcelUtil; |
|||
import com.ccsens.util.StringUtil; |
|||
import com.ccsens.util.cron.CronConstant; |
|||
import com.ccsens.util.cron.NatureToDate; |
|||
import com.ccsens.util.exception.BaseException; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.xssf.usermodel.XSSFCell; |
|||
import org.apache.poi.xssf.usermodel.XSSFRow; |
|||
import org.apache.poi.xssf.usermodel.XSSFSheet; |
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.FileInputStream; |
|||
import java.io.InputStream; |
|||
import java.util.*; |
|||
import java.util.regex.Matcher; |
|||
import java.util.regex.Pattern; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class ImportService implements IImportService { |
|||
|
|||
@Resource |
|||
private Snowflake snowflake; |
|||
@Resource |
|||
private ProTaskDetailDao taskDetailDao; |
|||
@Resource |
|||
private ProTaskSubDao taskSubDao; |
|||
@Resource |
|||
private ProTaskVersionDao taskVersionDao; |
|||
@Resource |
|||
private LabelDao labelDao; |
|||
@Resource |
|||
private ProRoleDao roleDao; |
|||
@Resource |
|||
private ProMemberDao memberDao; |
|||
@Resource |
|||
private ProRoleMemberDao roleMemberDao; |
|||
@Resource |
|||
private ProMemberStakeholderMapper memberStakeholderMapper; |
|||
@Resource |
|||
private ProRoleRepulsionDao repulsionDao; |
|||
@Resource |
|||
private LabelBusinessDao labelBusinessDao; |
|||
@Resource |
|||
private ProParentTaskDao parentTaskMapper; |
|||
@Resource |
|||
private ProRoleTaskDao roleTaskMapper; |
|||
@Resource |
|||
private UserDao userDao; |
|||
@Resource |
|||
private ProjectDao projectDao; |
|||
@Resource |
|||
private PluginDao taskPluginDao; |
|||
@Resource |
|||
private ProTaskPluginDao proTaskPluginDao; |
|||
|
|||
|
|||
/** |
|||
* 读取wbs文件 |
|||
* @param path 路径 |
|||
* @param userId userId |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@Override |
|||
public TallProjectVo.ProjectInfo importWbs(String path, Long userId, Long projectId) throws Exception { |
|||
TallProjectVo.ProjectInfo projectInfo = new TallProjectVo.ProjectInfo(); |
|||
//获取excel文件
|
|||
InputStream is = new FileInputStream(path); |
|||
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(is); |
|||
//角色
|
|||
Map<String, Long> roleMap = new HashMap<>(); |
|||
//成员
|
|||
Map<String, RoleDto.WbsMember> memberMap = new HashMap<>(); |
|||
//任务
|
|||
Map<String, Object> taskMap = new HashMap<>(); |
|||
|
|||
//读取文件
|
|||
readExcel(xssfWorkbook, userId, roleMap, memberMap, taskMap,projectId,projectInfo); |
|||
|
|||
//读取插件配置表
|
|||
readPluginConfig(xssfWorkbook,taskMap); |
|||
|
|||
return projectInfo; |
|||
} |
|||
|
|||
/** |
|||
* 读取插件配置表 |
|||
*/ |
|||
private void readPluginConfig(XSSFWorkbook wb, Map<String, Object> taskMap) { |
|||
//获取插件配置表Sheet
|
|||
XSSFSheet wbsSheet = wb.getSheet(BasicsConstant.WbsExcel.WBS_PLUGIN_CONFIG); |
|||
if (ObjectUtil.isNotNull(wbsSheet)) { |
|||
for (int i = 0; i <= wbsSheet.getLastRowNum(); i++) { |
|||
//获取行
|
|||
XSSFRow row = wbsSheet.getRow(i); |
|||
if (row == null) { |
|||
continue; |
|||
} |
|||
//序号
|
|||
String sequence = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0))); |
|||
//任务名
|
|||
String taskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
if(StrUtil.isEmpty(taskName)){ |
|||
continue; |
|||
} |
|||
//插件1
|
|||
String pluginParam1 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
//插件2
|
|||
String pluginParam2 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
//插件3
|
|||
String pluginParam3 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
Object o = taskMap.get(sequence + "_" + taskName); |
|||
if(ObjectUtil.isNull(o)){ |
|||
continue; |
|||
} |
|||
TaskDto.TaskPluginId taskPlugin = (TaskDto.TaskPluginId) o; |
|||
if(StrUtil.isNotEmpty(pluginParam1)){ |
|||
//修改插件表的param
|
|||
taskPluginDao.updateParamById(pluginParam1,taskPlugin.getTaskPluginId1()); |
|||
} |
|||
if(StrUtil.isNotEmpty(pluginParam2)){ |
|||
//修改插件表的param
|
|||
taskPluginDao.updateParamById(pluginParam2,taskPlugin.getTaskPluginId2()); |
|||
} |
|||
if(StrUtil.isNotEmpty(pluginParam3)){ |
|||
//修改插件表的param
|
|||
taskPluginDao.updateParamById(pluginParam3,taskPlugin.getTaskPluginId3()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 读取每个sheet |
|||
*/ |
|||
private void readExcel(XSSFWorkbook wb, Long userId, Map<String, Long> roleMap, Map<String, RoleDto.WbsMember> memberMap, Map<String, Object> taskMap, Long projectId, TallProjectVo.ProjectInfo projectInfo) { |
|||
//获取wbsSheet
|
|||
XSSFSheet wbsSheet = wb.getSheet(BasicsConstant.WbsExcel.WBS_SHEET); |
|||
if (ObjectUtil.isNull(wbsSheet)) { |
|||
throw new BaseException(BasicsCodeError.NOT_WBS_SHEET); |
|||
} |
|||
//获取项目成员表
|
|||
XSSFSheet memberSheet = wb.getSheet(BasicsConstant.WbsExcel.MEMBER_SHEET); |
|||
if (ObjectUtil.isNull(memberSheet)) { |
|||
throw new BaseException(BasicsCodeError.NOT_MEMBER_SHEET); |
|||
} |
|||
//读取项目信息和任务分解信息的开始结束行
|
|||
int projectStart = 0; |
|||
int taskStart = 0; |
|||
for (int i = 0; i <= wbsSheet.getLastRowNum(); i++) { |
|||
//获取行
|
|||
XSSFRow xssfRow = wbsSheet.getRow(i); |
|||
if (xssfRow == null) { |
|||
continue; |
|||
} |
|||
//获取第一列
|
|||
XSSFCell xssfCell = xssfRow.getCell(0); |
|||
if (xssfCell == null) { |
|||
continue; |
|||
} |
|||
String s = ExcelUtil.getCellValue(xssfCell); |
|||
//获取项目开始行
|
|||
if (s.indexOf(BasicsConstant.WbsExcel.PROJECT_INFO_TITLE) == 0) { |
|||
projectStart = i + 1; |
|||
} |
|||
//获取任务开始行
|
|||
if (s.indexOf(BasicsConstant.WbsExcel.TASK_INFO_TITLE) == 0) { |
|||
taskStart = i + 1; |
|||
} |
|||
} |
|||
if (projectStart == 0) { |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER); |
|||
} |
|||
if (taskStart == 0) { |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_TASK_HEADER); |
|||
} |
|||
//添加项目
|
|||
ProjectVo.SysProject project = readProject(wbsSheet, projectStart, userId,projectId); |
|||
if(ObjectUtil.isNull(project)){ |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER); |
|||
} |
|||
//读取成员表
|
|||
readMemberSheet(memberSheet,project,roleMap,memberMap); |
|||
//添加任务
|
|||
readTask(wbsSheet,taskStart,project,roleMap,taskMap); |
|||
//获取用户列表
|
|||
Set<Long> userIdSet = new HashSet<>(); |
|||
userIdSet.add(userId); |
|||
//处理创建人的权限问题(添加创建人角色)
|
|||
//查找创建者标签id
|
|||
Long roleLabelId = labelDao.getLabelByTypeAndLevel(5, 5); |
|||
//添加创建者角色
|
|||
ProRole role = new ProRole(); |
|||
role.setId(snowflake.nextId()); |
|||
role.setName("创建者"); |
|||
role.setProjectId(project.getId()); |
|||
role.setLabelId(roleLabelId); |
|||
roleDao.insertSelective(role); |
|||
//查找创建者在项目下的成员信息
|
|||
Long memberId = null; |
|||
if(CollectionUtil.isNotEmpty(memberMap)){ |
|||
for(RoleDto.WbsMember member : memberMap.values()){ |
|||
if(ObjectUtil.isNotNull(member.getUserId())){ |
|||
if(member.getUserId().equals(userId)){ |
|||
memberId = member.getId(); |
|||
} |
|||
userIdSet.add(member.getUserId()); |
|||
} |
|||
} |
|||
} |
|||
//如果当前用户不是项目成员,则添加为成员
|
|||
if(ObjectUtil.isNull(memberId)){ |
|||
//添加成员至数据库
|
|||
ProMember proMember = new ProMember(); |
|||
proMember.setId(snowflake.nextId()); |
|||
proMember.setProjectId(projectId); |
|||
proMember.setUserId(userId); |
|||
memberDao.insertSelective(proMember); |
|||
memberId = proMember.getId(); |
|||
} |
|||
//添加当前用户未创建者
|
|||
//添加角色成员关联信息
|
|||
ProRoleMember roleMember = new ProRoleMember(); |
|||
roleMember.setId(snowflake.nextId()); |
|||
roleMember.setRoleId(role.getId()); |
|||
roleMember.setMemberId(memberId); |
|||
roleMemberDao.insertSelective(roleMember); |
|||
|
|||
// //TODO 在tall客户端添加项目和用户的关联信息
|
|||
// ProjectDto.SaveProjectDto saveProjectDto = new ProjectDto.SaveProjectDto();
|
|||
// saveProjectDto.setId(project.getId());
|
|||
// saveProjectDto.setName(project.getName());
|
|||
// saveProjectDto.setStartTime(project.getBeginTime());
|
|||
// saveProjectDto.setEndTime(project.getEndTime());
|
|||
// saveProjectDto.setUrl(PropUtil.domain);
|
|||
//
|
|||
// saveProjectDto.setUserIdList(userIdSet);
|
|||
// JsonResponse jsonResponse = tall3FeignClient.saveProjectList(saveProjectDto);
|
|||
// if (null == jsonResponse){
|
|||
// throw new BaseException(BasicsCodeError.FEIGN_ERROR);
|
|||
// }
|
|||
|
|||
//获取项目信息
|
|||
// BeanUtil.copyProperties(saveProjectDto,projectInfo);
|
|||
} |
|||
|
|||
/** |
|||
* 读取项目信息 |
|||
*/ |
|||
private ProjectVo.SysProject readProject(XSSFSheet wbsSheet, int projectStart, Long userId, Long projectId) { |
|||
ProjectVo.SysProject project = new ProjectVo.SysProject(); |
|||
// TODO 查询是否项目是否存在
|
|||
if (ObjectUtil.isNotNull(projectId)) { |
|||
project = projectDao.selectById(projectId); |
|||
if (ObjectUtil.isNotNull(project)) { |
|||
project.setId(projectId); |
|||
project.setImportType((byte)1); |
|||
//删除之前的项目详情
|
|||
projectDao.updateStatusById(projectId); |
|||
//删除之前的项目分解
|
|||
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); |
|||
} |
|||
} |
|||
//获取项目信息的那一行
|
|||
XSSFRow row = wbsSheet.getRow(projectStart + 1); |
|||
if (ObjectUtil.isNull(row)) { |
|||
throw new BaseException(BasicsCodeError.WSB_NOT_PROJECT_HEADER); |
|||
} |
|||
//项目名
|
|||
String projectName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0))); |
|||
//详情
|
|||
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
//项目时间
|
|||
String address = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
//开始时间
|
|||
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
//结束时间
|
|||
String endTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
//版本
|
|||
String version = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5))); |
|||
if (StrUtil.isEmpty(projectName)) { |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_PROJECT_NAME.addMsg(wbsSheet.getSheetName(),projectStart+1)); |
|||
} |
|||
//项目名不能重复(当前用户创建的项目内名字不能重复)
|
|||
//根据userId查找已创建的项目
|
|||
List<ProjectVo.SysProject> sysProjectList = projectDao.queryByCreator(userId); |
|||
if(CollectionUtil.isNotEmpty(sysProjectList)){ |
|||
sysProjectList.forEach(p -> { |
|||
if(projectName.equalsIgnoreCase(p.getName())){ |
|||
//如果名称重复则提示错误信息
|
|||
throw new BaseException(BasicsCodeError.PROJECT_NAME_REPEAT.addMsg(wbsSheet.getSheetName(),projectStart+1,projectName)); |
|||
} |
|||
}); |
|||
} |
|||
//判断时间是否正确
|
|||
String begin = ExcelUtil.getCellValue(row.getCell(3)); |
|||
String end = ExcelUtil.getCellValue(row.getCell(4)); |
|||
if (StrUtil.isEmpty(begin) || StrUtil.isEmpty(end)) { |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_PROJECT_TIME.addMsg(wbsSheet.getSheetName(),projectStart+1)); |
|||
} |
|||
long bTime; |
|||
long eTime; |
|||
try { |
|||
bTime = Long.parseLong(beginTime); |
|||
eTime = Long.parseLong(endTime); |
|||
} catch (Exception e) { |
|||
//日期格式错误
|
|||
throw new BaseException(BasicsCodeError.WBS_PROJECT_TIME_ERROR.addMsg(wbsSheet.getSheetName(),projectStart+1)); |
|||
} |
|||
//添加项目信息(任务详情)
|
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
if (0 == project.getImportType()) { |
|||
taskDetail.setId(snowflake.nextId()); |
|||
} |
|||
if (1 == project.getImportType()) { |
|||
taskDetail.setId(projectId); |
|||
} |
|||
taskDetail.setName(projectName); |
|||
taskDetail.setDescription(description); |
|||
if (0 == project.getImportType()){ |
|||
taskDetailDao.insertSelective(taskDetail); |
|||
} |
|||
if (1 == project.getImportType()){ |
|||
taskDetailDao.updateByPrimaryKeySelective(taskDetail); |
|||
} |
|||
project.setId(taskDetail.getId()); |
|||
project.setName(projectName); |
|||
//添加(任务分解)
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetail.getId()); |
|||
taskSub.setPlanStartTime(bTime); |
|||
taskSub.setPlanEndTime(eTime); |
|||
taskSub.setPlanDuration(eTime - bTime); |
|||
taskSubDao.insertSelective(taskSub); |
|||
project.setBeginTime(bTime); |
|||
project.setEndTime(eTime); |
|||
//添加版本信息
|
|||
ProTaskVersion taskVersion = new ProTaskVersion(); |
|||
taskVersion.setId(snowflake.nextId()); |
|||
taskVersion.setTaskDetailId(taskDetail.getId()); |
|||
taskVersion.setTaskVersionInfo(version); |
|||
taskVersion.setAddress(address); |
|||
taskVersionDao.insertSelective(taskVersion); |
|||
//查找项目标签
|
|||
Long labelId = labelDao.getLabelByTypeAndLevel(1, 0); |
|||
//添加任务标签关联信息
|
|||
saveLabelTask(taskDetail.getId(), labelId); |
|||
|
|||
return project; |
|||
} |
|||
|
|||
/** |
|||
* 添加任务标签关联 |
|||
*/ |
|||
private void saveLabelTask(Long taskDetailId, Long labelId) { |
|||
//添加标签
|
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setId(snowflake.nextId()); |
|||
labelBusiness.setBusinessType((byte) 0); |
|||
labelBusiness.setBusinessId(taskDetailId); |
|||
labelBusiness.setLabelId(labelId); |
|||
labelBusinessDao.insertSelective(labelBusiness); |
|||
} |
|||
|
|||
/** |
|||
* 读取项目成员表 |
|||
*/ |
|||
private void readMemberSheet(XSSFSheet memberSheet, ProjectVo.SysProject project, Map<String, Long> roleMap, Map<String, RoleDto.WbsMember> memberMap) { |
|||
//系统角色id
|
|||
Long sysRoleId = null; |
|||
//项目角色id
|
|||
Long roleId = null; |
|||
//如果是修改WBS,先进行删除
|
|||
if (1 == project.getImportType()){ |
|||
//删除角色和成员
|
|||
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); |
|||
repulsionDao.updateByExampleSelective(roleRepulsion,roleRepulsionExample); |
|||
//删除角色成员关联
|
|||
ProRoleMember roleMember = new ProRoleMember(); |
|||
roleMember.setRecStatus((byte)2); |
|||
ProRoleMemberExample roleMemberExample = new ProRoleMemberExample(); |
|||
roleMemberExample.createCriteria().andRoleIdIn(roleIdList); |
|||
roleMemberDao.updateByExampleSelective(roleMember,roleMemberExample); |
|||
} |
|||
|
|||
for (int i = 2; i <= memberSheet.getLastRowNum(); i++) { |
|||
//获取当前行
|
|||
XSSFRow row = memberSheet.getRow(i); |
|||
if(ObjectUtil.isNull(row)){ continue; } |
|||
//系统角色名
|
|||
String sysRole = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
if(StrUtil.isEmpty(sysRole) && ObjectUtil.isNull(sysRoleId)){ |
|||
continue; |
|||
} |
|||
//验证系统角色(查询标签)
|
|||
if(StrUtil.isNotEmpty(sysRole) && !"/".equalsIgnoreCase(sysRole)){ |
|||
Long labelId = labelDao.getLabelByName(5,sysRole); |
|||
if(ObjectUtil.isNull(labelId)){ |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIRST_ROLE.addMsg(memberSheet.getSheetName(),i+1,sysRole)); |
|||
} |
|||
sysRoleId = labelId; |
|||
} |
|||
//项目角色
|
|||
String roleName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
if((StrUtil.isEmpty(roleName) || "/".equalsIgnoreCase(roleName)) && ObjectUtil.isNull(roleId)){ continue; } |
|||
//成员
|
|||
String memberName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
|
|||
//角色手机号
|
|||
String memberPhone = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
if((StrUtil.isNotEmpty(memberName) && !"/".equalsIgnoreCase(memberName)) && (StrUtil.isEmpty(memberPhone) || !memberPhone.matches(Constant.PHONE_REGEX))){ |
|||
throw new BaseException(BasicsCodeError.WBS_PHONE_ERROR.addMsg(memberSheet.getSheetName(),i+1,memberPhone)); |
|||
} |
|||
//奖惩干系人
|
|||
String stakeholderName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5))); |
|||
//干系人电话
|
|||
String stakeholderPhone = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6))); |
|||
if((StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(stakeholderName)) && (StrUtil.isEmpty(stakeholderPhone) || !stakeholderPhone.matches(Constant.PHONE_REGEX))){ |
|||
throw new BaseException(BasicsCodeError.WBS_PHONE_ERROR.addMsg(memberSheet.getSheetName(),i+1,stakeholderName)); |
|||
} |
|||
//添加角色
|
|||
if(StrUtil.isNotEmpty(roleName) && !"/".equalsIgnoreCase(roleName)){ |
|||
ProRole role = new ProRole(); |
|||
role.setId(snowflake.nextId()); |
|||
role.setName(roleName); |
|||
role.setProjectId(project.getId()); |
|||
role.setLabelId(sysRoleId); |
|||
roleDao.insertSelective(role); |
|||
roleId = role.getId(); |
|||
roleMap.put(roleName,role.getId()); |
|||
} |
|||
//添加成员
|
|||
if(StrUtil.isNotEmpty(memberName) && !"/".equalsIgnoreCase(roleName)){ |
|||
//如果成员名和手机号重复当做一个人来处理
|
|||
RoleDto.WbsMember wbsMembers = memberMap.get(memberName + "_" + memberPhone); |
|||
Long memberId = null; |
|||
if(ObjectUtil.isNotNull(wbsMembers)){ |
|||
memberId = wbsMembers.getId(); |
|||
} |
|||
if(ObjectUtil.isNull(memberId)){ |
|||
//TODO 根据成员手机号查找userId 成员关联userId
|
|||
|
|||
//根据手机号获取userId
|
|||
ProUser user = userDao.getUserIdByPhone(memberPhone); |
|||
if(ObjectUtil.isNull(user)){ |
|||
//TODO 如果未查到用户则添加一条新的用户信息
|
|||
user = new ProUser(); |
|||
user.setId(snowflake.nextId()); |
|||
user.setPhone(memberPhone); |
|||
userDao.insertSelective(user); |
|||
} |
|||
Long userId = user.getId(); |
|||
//添加成员至数据库
|
|||
ProMember proMember = new ProMember(); |
|||
proMember.setId(snowflake.nextId()); |
|||
proMember.setName(memberName); |
|||
proMember.setPhone(memberPhone); |
|||
proMember.setProjectId(project.getId()); |
|||
proMember.setUserId(userId); |
|||
memberDao.insertSelective(proMember); |
|||
RoleDto.WbsMember member = new RoleDto.WbsMember(proMember.getId(),userId); |
|||
memberMap.put(memberName+"_"+memberPhone,member); |
|||
memberId = proMember.getId(); |
|||
} |
|||
//添加角色成员关联信息
|
|||
ProRoleMember roleMember = new ProRoleMember(); |
|||
roleMember.setId(snowflake.nextId()); |
|||
roleMember.setRoleId(roleId); |
|||
roleMember.setMemberId(memberId); |
|||
roleMemberDao.insertSelective(roleMember); |
|||
//添加奖惩干系人
|
|||
if(StrUtil.isNotEmpty(stakeholderName) && !"/".equalsIgnoreCase(roleName)){ |
|||
//TODO 根据干系人手机号查找userId 奖惩干系人关联userId
|
|||
ProUser user = userDao.getUserIdByPhone(stakeholderPhone); |
|||
if(ObjectUtil.isNull(user)){ |
|||
//TODO 如果未查到用户则添加一条新的用户信息
|
|||
user = new ProUser(); |
|||
user.setId(snowflake.nextId()); |
|||
user.setPhone(stakeholderPhone); |
|||
userDao.insertSelective(user); |
|||
} |
|||
Long userId = user.getId(); |
|||
ProMemberStakeholder memberStakeholder = new ProMemberStakeholder(); |
|||
memberStakeholder.setId(snowflake.nextId()); |
|||
memberStakeholder.setMemeberId(memberId); |
|||
memberStakeholder.setStakeholderName(stakeholderName); |
|||
memberStakeholder.setStakeholderPhone(stakeholderPhone); |
|||
memberStakeholder.setUserId(userId); |
|||
memberStakeholderMapper.insertSelective(memberStakeholder); |
|||
} |
|||
} |
|||
} |
|||
//添加对谁不可见
|
|||
roleRepulsion(memberSheet, roleMap); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 处理对谁不可见 |
|||
*/ |
|||
private void roleRepulsion(XSSFSheet memberSheet, Map<String, Long> roleMap) { |
|||
//角色排斥表需要的角色id
|
|||
Long roleIdRepulsion = null; |
|||
for (int i = 2; i <= memberSheet.getLastRowNum(); i++) { |
|||
//获取当前行
|
|||
XSSFRow row = memberSheet.getRow(i); |
|||
if(ObjectUtil.isNull(row)){ continue; } |
|||
//项目角色
|
|||
String roleName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
if(StrUtil.isNotEmpty(roleName)){ |
|||
roleIdRepulsion = roleMap.get(roleName); |
|||
} |
|||
if(ObjectUtil.isNull(roleIdRepulsion)){ |
|||
continue; |
|||
} |
|||
//对谁不可见
|
|||
String repulsion = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(7))); |
|||
if(StrUtil.isEmpty(repulsion)){ |
|||
continue; |
|||
} |
|||
//分解对谁不可见
|
|||
String[] split = repulsion.split(Constant.STRING_REGEX); |
|||
for (String repulsionName : split) { |
|||
Long repulsionId = roleMap.get(repulsionName); |
|||
if (ObjectUtil.isNull(repulsionId)) { |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(memberSheet.getSheetName(),i+1,repulsionName)); |
|||
} |
|||
//添加数据
|
|||
ProRoleRepulsion roleRepulsion = new ProRoleRepulsion(); |
|||
roleRepulsion.setId(snowflake.nextId()); |
|||
roleRepulsion.setRoleId(roleIdRepulsion); |
|||
roleRepulsion.setRepulsionRoleId(repulsionId); |
|||
repulsionDao.insertSelective(roleRepulsion); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 读取任务信息 |
|||
*/ |
|||
private void readTask(XSSFSheet wbsSheet, int taskStart, ProjectVo.SysProject project, Map<String, Long> roleMap, Map<String, Object> taskMap) { |
|||
|
|||
//一级任务id
|
|||
Long firstTaskId = null; |
|||
Long taskStartTime = project.getBeginTime(); |
|||
|
|||
//如果是修改WBS需要先删除
|
|||
if (1 == project.getImportType()) { |
|||
List<Long> allTaskId = parentTaskMapper.queryAllTaskIdByProjectId(project.getId()); |
|||
//删除所有的任务详情
|
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
taskDetail.setRecStatus((byte)2); |
|||
ProTaskDetailExample taskDetailExample = new ProTaskDetailExample(); |
|||
taskDetailExample.createCriteria().andIdIn(allTaskId); |
|||
taskDetailDao.updateByExampleSelective(taskDetail,taskDetailExample); |
|||
//删除所有的分解任务
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setRecStatus((byte)2); |
|||
ProTaskSubExample taskSubExample = new ProTaskSubExample(); |
|||
taskSubExample.createCriteria().andTaskDetailIdIn(allTaskId); |
|||
taskSubDao.updateByExampleSelective(taskSub,taskSubExample); |
|||
//删除所有的任务标签
|
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setRecStatus((byte)2); |
|||
LabelBusinessExample labelBusinessExample = new LabelBusinessExample(); |
|||
labelBusinessExample.createCriteria().andBusinessIdIn(allTaskId); |
|||
labelBusinessDao.updateByExampleSelective(labelBusiness,labelBusinessExample); |
|||
//删除任务角色关联表
|
|||
ProRoleTask roleTask = new ProRoleTask(); |
|||
roleTask.setRecStatus((byte)2); |
|||
ProRoleTaskExample roleTaskExample = new ProRoleTaskExample(); |
|||
roleTaskExample.createCriteria().andTaskIdIn(allTaskId); |
|||
roleTaskMapper.updateByExampleSelective(roleTask,roleTaskExample); |
|||
//删除任务插件关联信息
|
|||
ProTaskPlugin taskPlugin = new ProTaskPlugin(); |
|||
taskPlugin.setRecStatus((byte)2); |
|||
ProTaskPluginExample taskPluginExample = new ProTaskPluginExample(); |
|||
taskPluginExample.createCriteria().andTaskDetailIdIn(allTaskId); |
|||
proTaskPluginDao.updateByExampleSelective(taskPlugin,taskPluginExample); |
|||
//删除任务关系表
|
|||
allTaskId.add(project.getId()); |
|||
ProParentTask parentTask = new ProParentTask(); |
|||
parentTask.setRecStatus((byte)2); |
|||
ProParentTaskExample parentTaskExample = new ProParentTaskExample(); |
|||
parentTaskExample.createCriteria().andTaskDetailIdIn(allTaskId); |
|||
parentTaskMapper.updateByExampleSelective(parentTask,parentTaskExample); |
|||
} |
|||
|
|||
for (int i = taskStart + 1; i <= wbsSheet.getLastRowNum(); i++) { |
|||
//获取当前行
|
|||
XSSFRow row = wbsSheet.getRow(i); |
|||
if(ObjectUtil.isNull(row)){ continue; } |
|||
//序号
|
|||
String sequence = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(0))); |
|||
//一级任务名
|
|||
String firstTaskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1))); |
|||
if(StrUtil.isEmpty(firstTaskName) && ObjectUtil.isNull(firstTaskId)){ |
|||
continue; |
|||
} |
|||
if(StrUtil.isNotEmpty(firstTaskName)){ |
|||
//添加一级任务
|
|||
firstTaskId = saveFirstTask(project, firstTaskName); |
|||
} |
|||
//二级任务名
|
|||
String taskName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(2))); |
|||
if(StrUtil.isEmpty(taskName)){ |
|||
continue; |
|||
} |
|||
//任务描述
|
|||
String description = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(3))); |
|||
//重要性标签
|
|||
String vitalLabel = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(7))); |
|||
//负责人
|
|||
String executorRole = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(8))); |
|||
//开始时间
|
|||
String beginTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(4))); |
|||
//结束时间
|
|||
String endTime = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(5))); |
|||
//时长
|
|||
String duration = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(6))); |
|||
//插件
|
|||
String plugin1 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(12))); |
|||
String plugin2 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(13))); |
|||
String plugin3 = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(14))); |
|||
if(StrUtil.isNotEmpty(taskName)){ |
|||
//添加二级任务信息(任务详情)
|
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
taskDetail.setId(snowflake.nextId()); |
|||
taskDetail.setName(taskName); |
|||
taskDetail.setDescription(description); |
|||
taskDetailDao.insertSelective(taskDetail); |
|||
//任务关联信息(关联一级任务)
|
|||
ProParentTask parentTask = new ProParentTask(); |
|||
parentTask.setId(snowflake.nextId()); |
|||
parentTask.setTaskDetailId(taskDetail.getId()); |
|||
parentTask.setParentTaskDetailId(firstTaskId); |
|||
parentTaskMapper.insertSelective(parentTask); |
|||
//查找重要性标签
|
|||
Long labelId = labelDao.getLabelByName(2,vitalLabel); |
|||
if(ObjectUtil.isNull(labelId)){ |
|||
throw new BaseException(BasicsCodeError.TASK_VITAL_LABEL_ERROR.addMsg(wbsSheet.getSheetName(),i+1,vitalLabel)); |
|||
} |
|||
LabelBusiness labelBusiness = new LabelBusiness(); |
|||
labelBusiness.setId(snowflake.nextId()); |
|||
labelBusiness.setBusinessType((byte) 0); |
|||
labelBusiness.setBusinessId(taskDetail.getId()); |
|||
labelBusiness.setLabelId(labelId); |
|||
labelBusinessDao.insertSelective(labelBusiness); |
|||
//任务和角色关联
|
|||
if(StrUtil.isEmpty(executorRole)){ |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,executorRole)); |
|||
} |
|||
String[] split = executorRole.split(Constant.STRING_REGEX); |
|||
for (String repulsionName : split) { |
|||
Long executorRoleId = roleMap.get(repulsionName); |
|||
if(ObjectUtil.isNull(executorRoleId)){ |
|||
throw new BaseException(BasicsCodeError.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName(),i+1,repulsionName)); |
|||
} |
|||
ProRoleTask roleTask = new ProRoleTask(); |
|||
roleTask.setId(snowflake.nextId()); |
|||
roleTask.setRoleId(executorRoleId); |
|||
roleTask.setTaskId(taskDetail.getId()); |
|||
roleTaskMapper.insertSelective(roleTask); |
|||
} |
|||
|
|||
//处理时间、添加任务分解、添加任务标签
|
|||
taskStartTime = taskSaveTime(taskStartTime, project, beginTime, endTime, duration, taskDetail.getId(),wbsSheet,i+1); |
|||
//添加时间颗粒度标签并关联
|
|||
Long timeLabel = labelDao.getLabelByTypeAndLevel(0, 4); |
|||
saveLabelTask(taskDetail.getId(),timeLabel); |
|||
//TODO 插件
|
|||
Long taskPlugin1 = plugin(plugin1,taskDetail.getId(),1,wbsSheet,i+1); |
|||
Long taskPlugin2 = plugin(plugin2,taskDetail.getId(),2,wbsSheet,i+1); |
|||
Long taskPlugin3 = plugin(plugin3,taskDetail.getId(),3,wbsSheet,i+1); |
|||
TaskDto.TaskPluginId taskPlugin = new TaskDto.TaskPluginId(taskPlugin1,taskPlugin2,taskPlugin3); |
|||
taskMap.put(sequence + "_" + taskName, taskPlugin); |
|||
} |
|||
//TODO 检查人
|
|||
//TODO 及时奖惩
|
|||
//TODO 交付物
|
|||
//TODO 添加默认插件
|
|||
} |
|||
} |
|||
private Long plugin(String plugin, Long taskId, int row, XSSFSheet wbsSheet, int errorRow) { |
|||
Long taskPlugin = null; |
|||
if(StrUtil.isNotEmpty(plugin)){ |
|||
//根据插件名称查找插件id
|
|||
// Long pluginId = taskPluginDao.getPluginIdByName(plugin);
|
|||
Long pluginId = 1L; |
|||
if(ObjectUtil.isNull(pluginId)){ |
|||
throw new BaseException(BasicsCodeError.PLUGIN_NAME_ERROR.addMsg(wbsSheet.getSheetName(),errorRow,plugin)); |
|||
} |
|||
//添加插件
|
|||
ProTaskPlugin proTaskPlugin = new ProTaskPlugin(); |
|||
proTaskPlugin.setId(snowflake.nextId()); |
|||
proTaskPlugin.setTaskDetailId(taskId); |
|||
proTaskPlugin.setPluginId(pluginId); |
|||
proTaskPlugin.setPlginRow(row); |
|||
proTaskPlugin.setPlginCol(1); |
|||
proTaskPlugin.setRowspan(1); |
|||
proTaskPlugin.setColspan(1); |
|||
proTaskPluginDao.insertSelective(proTaskPlugin); |
|||
taskPlugin = proTaskPlugin.getId(); |
|||
} |
|||
return taskPlugin; |
|||
} |
|||
|
|||
private Long taskSaveTime(Long taskStartTime, ProjectVo.SysProject project, String beginTime, String endTime, String duration, Long taskDetailId, XSSFSheet wbsSheet, int row) { |
|||
|
|||
if(StrUtil.isEmpty(beginTime) || "日常".equalsIgnoreCase(beginTime)){ |
|||
if(StrUtil.isEmpty(beginTime) && StrUtil.isNotEmpty(duration)){ |
|||
//获取时长内的字符串
|
|||
String str = "[0-9]"; |
|||
Pattern pStr = Pattern.compile(str); |
|||
Matcher mStr = pStr.matcher(duration); |
|||
String trimStr = mStr.replaceAll("").trim(); |
|||
Long aLong = Constant.WBS_DURATION.get(trimStr); |
|||
if(ObjectUtil.isNull(aLong)){ |
|||
throw new BaseException(BasicsCodeError.WBS_PROJECT_TIME_ERROR.addMsg(wbsSheet.getSheetName(),row)); |
|||
} |
|||
//获取字符串内的数字
|
|||
String num = "[^0-9]"; |
|||
Pattern pNum = Pattern.compile(num); |
|||
Matcher mNum = pNum.matcher(duration); |
|||
String trimNum = mNum.replaceAll("").trim(); |
|||
//计算时长
|
|||
Long durationTime = Long.parseLong(trimNum) * aLong; |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetailId); |
|||
taskSub.setPlanDuration(durationTime); |
|||
taskSub.setPlanStartTime(taskStartTime); |
|||
taskStartTime += durationTime; |
|||
taskSub.setPlanEndTime(taskStartTime); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//查找定期任务标签并关联任务
|
|||
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3); |
|||
saveLabelTask(taskDetailId,taskLabel); |
|||
|
|||
}else { |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetailId); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//查找日常任务标签并关联信息
|
|||
Long label = labelDao.getLabelByTypeAndLevel(1, 2); |
|||
saveLabelTask(taskDetailId,label); |
|||
} |
|||
}else { |
|||
Long bTime; |
|||
Long eTime; |
|||
try { |
|||
bTime = Long.parseLong(beginTime); |
|||
eTime = StrUtil.isEmpty(endTime) ? project.getEndTime() : Long.parseLong(endTime); |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetailId); |
|||
taskSub.setPlanEndTime(eTime); |
|||
taskSub.setPlanStartTime(bTime); |
|||
taskSub.setPlanDuration(eTime - bTime); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//查找定期任务标签并关联任务
|
|||
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3); |
|||
saveLabelTask(taskDetailId,taskLabel); |
|||
// //添加时间颗粒度标签并关联
|
|||
// Long timeLabel = subLabelDao.getLabelByTypeAndLevel(0, 4);
|
|||
// saveLabelTask(taskDetailId,timeLabel);
|
|||
}catch (Exception e){ |
|||
Date startDate = new Date(project.getBeginTime()); |
|||
Date endDate = new Date(project.getEndTime()); |
|||
try { |
|||
List<CronConstant.TaskDate> taskDateList = |
|||
NatureToDate.generateDates(beginTime, startDate, endDate); |
|||
if (CollectionUtil.isEmpty(taskDateList)) { |
|||
return taskStartTime; |
|||
} |
|||
List<ProTaskSub> proTaskSubList = new ArrayList<>(); |
|||
for (CronConstant.TaskDate taskDate : taskDateList) { |
|||
|
|||
ProTaskSub proTaskSub = new ProTaskSub(); |
|||
proTaskSub.setId(snowflake.nextId()); |
|||
proTaskSub.setTaskDetailId(taskDetailId); |
|||
proTaskSub.setPlanStartTime(taskDate.getStartDate().getTime()); |
|||
proTaskSub.setPlanEndTime(taskDate.getEndDate().getTime()); |
|||
proTaskSub.setPlanDuration(proTaskSub.getPlanEndTime() - proTaskSub.getPlanStartTime()); |
|||
proTaskSubList.add(proTaskSub); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(proTaskSubList)){ |
|||
taskDetailDao.insertSelectiveList(proTaskSubList); |
|||
} |
|||
//查找定期任务标签并关联任务
|
|||
Long taskLabel = labelDao.getLabelByTypeAndLevel(1, 3); |
|||
saveLabelTask(taskDetailId,taskLabel); |
|||
}catch (Exception e1){ |
|||
throw new BaseException(String.valueOf(e1)); |
|||
// throw new BaseException(SportsCodeError.WBS_PROJECT_TIME_ERROR);
|
|||
} |
|||
} |
|||
} |
|||
return taskStartTime; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 添加一级任务 |
|||
*/ |
|||
private Long saveFirstTask(ProjectVo.SysProject project, String firstTaskName) { |
|||
//TODO 一级任务负责人是项目经理
|
|||
Long firstTaskId; |
|||
ProTaskDetail taskDetail = new ProTaskDetail(); |
|||
taskDetail.setId(snowflake.nextId()); |
|||
taskDetail.setName(firstTaskName); |
|||
taskDetailDao.insertSelective(taskDetail); |
|||
firstTaskId = taskDetail.getId(); |
|||
//添加任务分解
|
|||
ProTaskSub taskSub = new ProTaskSub(); |
|||
taskSub.setId(snowflake.nextId()); |
|||
taskSub.setTaskDetailId(taskDetail.getId()); |
|||
taskSub.setPlanStartTime(project.getBeginTime()); |
|||
taskSub.setPlanEndTime(project.getEndTime()); |
|||
taskSub.setPlanDuration(project.getEndTime() - project.getBeginTime()); |
|||
taskSubDao.insertSelective(taskSub); |
|||
//任务关联信息(关联项目)
|
|||
ProParentTask parentTask = new ProParentTask(); |
|||
parentTask.setId(snowflake.nextId()); |
|||
parentTask.setTaskDetailId(taskDetail.getId()); |
|||
parentTask.setParentTaskDetailId(project.getId()); |
|||
parentTaskMapper.insertSelective(parentTask); |
|||
//查找一级任务标签
|
|||
Long labelId = labelDao.getLabelByTypeAndLevel(1, 1); |
|||
//添加任务标签关联信息
|
|||
saveLabelTask(taskDetail.getId(), labelId); |
|||
return firstTaskId; |
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,587 @@ |
|||
//package com.ccsens.ptos_zero.service;
|
|||
//
|
|||
//import cn.hutool.core.collection.CollectionUtil;
|
|||
//import com.ccsens.ptos_zero.bean.po.ProRole;
|
|||
//import com.ccsens.ptos_zero.persist.dao.ProRoleDao;
|
|||
//import com.ccsensptos.tallsdk.bean.dto.ProjectDto;
|
|||
//import com.ccsensptos.tallsdk.bean.dto.RoleDto;
|
|||
//import com.ccsensptos.tallsdk.bean.dto.TaskDto;
|
|||
//import com.ccsensptos.tallsdk.bean.vo.ProjectVo;
|
|||
//import com.ccsensptos.tallsdk.bean.vo.RoleVo;
|
|||
//import com.ccsensptos.tallsdk.bean.vo.TaskVo;
|
|||
//import com.ccsensptos.tallsdk.service.ITallService;
|
|||
//import lombok.extern.slf4j.Slf4j;
|
|||
//import org.springframework.stereotype.Service;
|
|||
//import org.springframework.transaction.annotation.Propagation;
|
|||
//import org.springframework.transaction.annotation.Transactional;
|
|||
//import org.springframework.web.multipart.MultipartFile;
|
|||
//
|
|||
//import javax.annotation.Resource;
|
|||
//import java.util.ArrayList;
|
|||
//import java.util.List;
|
|||
//
|
|||
///**
|
|||
// * @author 逗
|
|||
// */
|
|||
//@Slf4j
|
|||
//@Service
|
|||
//@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|||
//public class TallService implements ITallService {
|
|||
//
|
|||
// @Resource
|
|||
// private ProRoleDao proRoleDao;
|
|||
//
|
|||
//
|
|||
// @Override
|
|||
// public List<ProjectVo.ProjectInfo> queryProjectByUser(String token,ProjectDto.QueryProjectDto param) {
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public RoleVo.QueryRole queryShowRole(String token,RoleDto.QueryRoleById param) {
|
|||
// //TODO 通过token向tall获取用户信息,
|
|||
// Long userId = null;
|
|||
//
|
|||
// //返回的对象
|
|||
// RoleVo.QueryRole queryRole = new RoleVo.QueryRole();
|
|||
// List<RoleVo.RoleInfo> visibleList = new ArrayList<>();
|
|||
// List<RoleVo.RoleInfo> invisibleList = new ArrayList<>();
|
|||
//
|
|||
// //查询当前用户在项目下的角色,没有则算作关注者
|
|||
// List<ProRole> userRoleList = proRoleDao.queryRoleByUserId(param.getProjectId(),userId);
|
|||
// //查询用户可见的角色
|
|||
// List<RoleVo.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 (RoleVo.RoleInfo roleInfo : roleInfoList) {
|
|||
// if(showRoleId.equals(roleInfo.getId())){
|
|||
// //和配置内的信息相同则放入展示角色列表
|
|||
// visibleList.add(roleInfo);
|
|||
// //同时删除数组内的信息
|
|||
// roleInfoList.remove(roleInfo);
|
|||
// //跳出循环,开始配置信息内的下一个
|
|||
// break;
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
// //剩下的角色全部放在不可见角色列表
|
|||
// invisibleList.addAll(roleInfoList);
|
|||
// }else {
|
|||
// //没有配置信息则按默认规则
|
|||
// if (CollectionUtil.isNotEmpty(roleInfoList)) {
|
|||
// //循环所有角色
|
|||
// for (RoleVo.RoleInfo roleInfo : roleInfoList) {
|
|||
// //如果是项目经理,放入展示的角色
|
|||
// if (roleInfo.getPm() == 1) {
|
|||
// visibleList.add(roleInfo);
|
|||
// continue;
|
|||
// }
|
|||
// //是用户所属的角色,放入展示的角色列表
|
|||
// if (roleInfo.getMine() == 1) {
|
|||
// visibleList.add(roleInfo);
|
|||
// continue;
|
|||
// } else {
|
|||
// //不是用户所属的角色,但展示角色列表数量不足设置的数量
|
|||
//
|
|||
// //展示数量等于0,展示全部
|
|||
// if(param.getNum() == 0){
|
|||
// visibleList.add(roleInfo);
|
|||
// continue;
|
|||
// }
|
|||
// //不是用户所属的角色,但展示角色列表数量不足五个,
|
|||
// if (visibleList.size() < param.getNum()) {
|
|||
// visibleList.add(roleInfo);
|
|||
// continue;
|
|||
// }
|
|||
// }
|
|||
// //不满足上面条件的,放入不展示的角色列表
|
|||
// invisibleList.add(roleInfo);
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
// queryRole.setVisibleList(visibleList);
|
|||
// queryRole.setInvisibleList(invisibleList);
|
|||
// return queryRole;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<TaskVo.QueryTask> queryPermanentGlobalTask(String token,TaskDto.QueryPermanentGlobalTask param) {
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<TaskVo.QueryTask> queryGlobalTask(String token,TaskDto.QueryGlobalTask param) {
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<TaskVo.QueryTask> queryRegularTask(String token,TaskDto.QueryRegularTask param) {
|
|||
// return null;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<ProjectVo.ProjectInfo> importWbs(String token,MultipartFile params) {
|
|||
// return null;
|
|||
// }
|
|||
//}
|
|||
package com.ccsens.ptccsens.service; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.io.FileUtil; |
|||
import cn.hutool.core.util.BooleanUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.ccsens.ptccsens.bean.po.ProRole; |
|||
import com.ccsens.ptccsens.bean.po.ProRoleExample; |
|||
import com.ccsens.ptccsens.bean.po.ProUser; |
|||
import com.ccsens.ptccsens.persist.dao.*; |
|||
import com.ccsens.ptccsens.util.BasicsCodeError; |
|||
import com.ccsens.ptccsens.util.Constant; |
|||
import com.ccsens.util.CodeEnum; |
|||
import com.ccsens.util.WebConstant; |
|||
import com.ccsens.util.exception.BaseException; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallProjectDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallRoleDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTaskDto; |
|||
import com.ccsensptos.tallsdk.bean.dto.TallTokenDto; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallProjectVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallRoleVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTaskVo; |
|||
import com.ccsensptos.tallsdk.bean.vo.TallTokenVo; |
|||
import com.ccsensptos.tallsdk.service.ITallService; |
|||
import com.ccsensptos.tallsdk.util.TokenUtil; |
|||
import lombok.SneakyThrows; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.io.File; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class TallService implements ITallService { |
|||
|
|||
@Resource |
|||
private ProRoleDao proRoleDao; |
|||
@Resource |
|||
private ProTaskDetailDao taskDetailDao; |
|||
@Resource |
|||
private ProRoleDao roleDao; |
|||
@Resource |
|||
private ProMemberDao memberDao; |
|||
@Resource |
|||
private ProRoleRepulsionDao roleRepulsionDao; |
|||
@Resource |
|||
private ProRoleMemberDao roleMemberDao; |
|||
@Resource |
|||
private ProRoleTaskDao roleTaskDao; |
|||
@Resource |
|||
private ProTaskPluginDao taskPluginDao; |
|||
@Resource |
|||
private IImportService importService; |
|||
@Resource |
|||
private UserDao userDao; |
|||
|
|||
|
|||
@SneakyThrows |
|||
@Override |
|||
public TallProjectVo.ProjectInfo importWbs(String token, MultipartFile params) { |
|||
// //TODO 根据token获取用户信息
|
|||
// TallTokenVo.UserIdByToken userByToken = TokenUtil.getUserByToken(new TallTokenDto.GetUserByToken(token, "appId", "secret"));
|
|||
// //通过手机号获取用户在服务内的userId
|
|||
ProUser user = new ProUser(); |
|||
// if(ObjectUtil.isNotNull(userByToken) && StrUtil.isNotBlank(userByToken.getPhone())){
|
|||
// user = userDao.getUserIdByPhone(userByToken.getPhone());
|
|||
// }
|
|||
// if(user == null){
|
|||
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
|||
// }
|
|||
|
|||
// if(ObjectUtil.isNull(userByToken)){
|
|||
// throw new BaseException(CodeEnum.NOT_LOGIN);
|
|||
// }
|
|||
String ext = FileUtil.extName(params.getOriginalFilename()); |
|||
if(StrUtil.isEmpty(ext) || !Constant.WbsExcel.WBS_FILE_FORMAT.contains(ext)){ |
|||
throw new BaseException(BasicsCodeError.FILE_FORMAT_ERROR); |
|||
} |
|||
//文件路径
|
|||
String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; |
|||
String extraPath = DateUtil.format(new Date(), "yyyyMMdd"); |
|||
String path = extraPath + File.separator + IdUtil.simpleUUID() + "." + ext; |
|||
//转成file
|
|||
File file = new File(dir + extraPath); |
|||
if (!file.exists()) { |
|||
file.mkdirs(); |
|||
} |
|||
String fullPath = dir + File.separator + path; |
|||
FileUtil.writeFromStream(params.getInputStream(), fullPath); |
|||
|
|||
//导入数据库
|
|||
return importService.importWbs(fullPath,user.getId(),null); |
|||
} |
|||
|
|||
@Override |
|||
public List<TallProjectVo.ProjectInfo> queryProjectByUser(String token, TallProjectDto.QueryProjectDto param) { |
|||
TallTokenVo.UserIdByToken userByToken = TokenUtil.getUserByToken(new TallTokenDto.GetUserByToken(token, "appId", "secret")); |
|||
|
|||
List<TallProjectVo.ProjectInfo> projectInfos = new ArrayList<>(); |
|||
TallProjectVo.ProjectInfo projectInfo = new TallProjectVo.ProjectInfo(); |
|||
projectInfo.setId(1L); |
|||
projectInfo.setName("零号项目"); |
|||
projectInfo.setUrl("http://127.0.0.1:7310"); |
|||
projectInfo.setBusinessCode("zero"); |
|||
projectInfo.setDomainCode("tall_dh"); |
|||
projectInfos.add(projectInfo); |
|||
return projectInfos; |
|||
} |
|||
|
|||
@Override |
|||
public TallRoleVo.QueryRole queryShowRole(String token, TallRoleDto.QueryRoleById param) { |
|||
//TODO 通过token向tall获取用户信息,
|
|||
TallTokenVo.UserIdByToken userByToken = TokenUtil.getUserByToken(new TallTokenDto.GetUserByToken(token, "appId", "secret")); |
|||
if(ObjectUtil.isNull(userByToken)){ |
|||
throw new BaseException(CodeEnum.NOT_LOGIN); |
|||
} |
|||
|
|||
//返回的对象
|
|||
TallRoleVo.QueryRole queryRole = new TallRoleVo.QueryRole(); |
|||
List<TallRoleVo.RoleInfo> visibleList = new ArrayList<>(); |
|||
List<TallRoleVo.RoleInfo> invisibleList = new ArrayList<>(); |
|||
|
|||
//查询当前用户在项目下的角色,没有则算作关注者
|
|||
List<ProRole> userRoleList = proRoleDao.queryRoleByUserId(param.getProjectId(),userByToken.getId()); |
|||
//查询用户可见的角色
|
|||
List<TallRoleVo.RoleInfo> roleInfoList = new ArrayList<>(); |
|||
if(CollectionUtil.isNotEmpty(userRoleList)){ |
|||
//不是关注者,查询可见的角色(完全屏蔽才不可见)
|
|||
roleInfoList = proRoleDao.notAttentionQueryRole(param.getProjectId(),userRoleList); |
|||
}else { |
|||
// //是关注者查询可见的角色(未设置过对谁不可见信息的角色)
|
|||
// roleInfoList = proRoleDao.attentionQueryRole(param.getProjectId());
|
|||
//TODO 0号项目游客查看所有,默认属于管理员
|
|||
ProRoleExample proRoleExample = new ProRoleExample(); |
|||
proRoleExample.createCriteria().andProjectIdEqualTo(param.getProjectId()); |
|||
List<ProRole> proRoles = proRoleDao.selectByExample(proRoleExample); |
|||
if(CollectionUtil.isNotEmpty(proRoles)){ |
|||
for (ProRole proRole : proRoles) { |
|||
if("管理员".equals(proRole.getName())){ |
|||
TallRoleVo.RoleInfo roleInfo = new TallRoleVo.RoleInfo(); |
|||
roleInfo.setId(proRole.getId()); |
|||
roleInfo.setName(proRole.getName()); |
|||
roleInfo.setMine(1); |
|||
roleInfoList.add(roleInfo); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
//查询配置信息
|
|||
List<Long> showRoleList = proRoleDao.queryShowByUserAndProject(param.getProjectId(),userByToken.getId()); |
|||
if(CollectionUtil.isNotEmpty(showRoleList)){ |
|||
for (Long showRoleId : showRoleList) { |
|||
//循环配置内的信息去匹配角色列表,来确定角色该放在什么地方
|
|||
for (TallRoleVo.RoleInfo roleInfo : roleInfoList) { |
|||
if(showRoleId.equals(roleInfo.getId())){ |
|||
//和配置内的信息相同则放入展示角色列表
|
|||
visibleList.add(roleInfo); |
|||
//同时删除数组内的信息
|
|||
roleInfoList.remove(roleInfo); |
|||
//跳出循环,开始配置信息内的下一个
|
|||
break; |
|||
} |
|||
} |
|||
} |
|||
//剩下的角色全部放在不可见角色列表
|
|||
invisibleList.addAll(roleInfoList); |
|||
}else { |
|||
//没有配置信息则按默认规则
|
|||
if (CollectionUtil.isNotEmpty(roleInfoList)) { |
|||
//循环所有角色
|
|||
for (TallRoleVo.RoleInfo roleInfo : roleInfoList) { |
|||
//如果是项目经理,放入展示的角色
|
|||
if (roleInfo.getPm() == 1) { |
|||
visibleList.add(roleInfo); |
|||
continue; |
|||
} |
|||
//是用户所属的角色,放入展示的角色列表
|
|||
if (roleInfo.getMine() == 1) { |
|||
visibleList.add(roleInfo); |
|||
continue; |
|||
} else { |
|||
//不是用户所属的角色,但展示角色列表数量不足设置的数量
|
|||
|
|||
//展示数量等于0,展示全部
|
|||
if(param.getNum() == 0){ |
|||
visibleList.add(roleInfo); |
|||
continue; |
|||
} |
|||
//不是用户所属的角色,但展示角色列表数量不足五个,
|
|||
if (visibleList.size() < param.getNum()) { |
|||
visibleList.add(roleInfo); |
|||
continue; |
|||
} |
|||
} |
|||
//不满足上面条件的,放入不展示的角色列表
|
|||
invisibleList.add(roleInfo); |
|||
} |
|||
} |
|||
} |
|||
queryRole.setVisibleList(visibleList); |
|||
queryRole.setInvisibleList(invisibleList); |
|||
return queryRole; |
|||
} |
|||
|
|||
@Override |
|||
public List<TallTaskVo.QueryTask> queryPermanentGlobalTask(String token, TallTaskDto.QueryPermanentGlobalTask param) { |
|||
//TODO 通过token向tall获取用户信息,
|
|||
Long userId = null; |
|||
|
|||
//查找当前角色是否有查看权限
|
|||
Boolean isLook = queryRoleIsLook(param.getRoleId(), userId); |
|||
if (BooleanUtil.isFalse(isLook)) { |
|||
throw new BaseException(CodeEnum.NO_POWER); |
|||
} |
|||
List<Long> roleIds = new ArrayList<>(); |
|||
roleIds.add(param.getRoleId()); |
|||
|
|||
List<TallTaskVo.QueryTask> permanentGlobalTask = taskDetailDao.queryPermanentGlobalTask(roleIds); |
|||
//查找项目面板和插件信息
|
|||
queryPluginForTask(permanentGlobalTask); |
|||
//查询任务下的检查人
|
|||
queryCheckerOfTask(permanentGlobalTask); |
|||
return permanentGlobalTask; |
|||
} |
|||
|
|||
@Override |
|||
public List<TallTaskVo.QueryTask> queryGlobalTask(String token, TallTaskDto.QueryGlobalTask param) { |
|||
//TODO 通过token向tall获取用户信息,
|
|||
Long userId = null; |
|||
|
|||
//查找当前角色是否有查看权限
|
|||
Boolean isLook = queryRoleIsLook(param.getRoleId(), userId); |
|||
if (BooleanUtil.isFalse(isLook)) { |
|||
throw new BaseException(CodeEnum.NO_POWER); |
|||
} |
|||
List<Long> roleIds = new ArrayList<>(); |
|||
roleIds.add(param.getRoleId()); |
|||
//查询当前角色是否项目经理
|
|||
List<TallTaskVo.QueryTask> globalTask = taskDetailDao.queryGlobalTask(roleIds, param.getTimeNode(), param.getTimeUnit()); |
|||
queryPluginForTask(globalTask); |
|||
//查询任务下的检查人
|
|||
queryCheckerOfTask(globalTask); |
|||
return globalTask; |
|||
} |
|||
|
|||
@Override |
|||
public List<TallTaskVo.QueryTask> queryRegularTask(String token, TallTaskDto.QueryRegularTask param) { |
|||
//TODO 通过token向tall获取用户信息,
|
|||
Long userId = null; |
|||
|
|||
//查找类型:0向上查找,1向下查找(默认),下查包含自己,上查不包含
|
|||
//根据参数配置sql语句
|
|||
String query = ""; |
|||
String timeFormat = Constant.timeFormat.get(param.getTimeUnit()); |
|||
String unit = Constant.timeUnit.get(param.getTimeUnit()); |
|||
if (0 == param.getQueryType()) { |
|||
query = "interval -" + param.getQueryNum() + " " + unit; |
|||
} else { |
|||
query += "interval " + (param.getQueryNum() - 1) + " " + unit; |
|||
} |
|||
//查找当前角色是否有查看权限
|
|||
Boolean isLook = queryRoleIsLook(param.getRoleId(), userId); |
|||
if (BooleanUtil.isFalse(isLook)) { |
|||
throw new BaseException(BasicsCodeError.NOT_PERMISSION); |
|||
} |
|||
List<Long> roleIds = new ArrayList<>(); |
|||
roleIds.add(param.getRoleId()); |
|||
|
|||
//TODO 季度未实现
|
|||
List<TallTaskVo.QueryTask> regularTask = taskDetailDao.queryRegularTask(roleIds, param.getTimeUnit(), param.getTimeNode(), param.getQueryType(), query, timeFormat); |
|||
//如果该时段没有任务向上或向下补充
|
|||
if (CollectionUtil.isEmpty(regularTask)) { |
|||
List<TallTaskVo.QueryTask> replenishTask = taskDetailDao.continueQueryTask(roleIds, param.getTimeUnit(), param.getTimeNode(), param.getQueryType(), query, timeFormat); |
|||
Map<String, List<TallTaskVo.QueryTask>> taskMap = replenishTask.stream().collect(Collectors.groupingBy(task -> new SimpleDateFormat("yyyy-MM-dd").format(new Date(task.getPlanStart())))); |
|||
List<String> mapOfKey = new ArrayList<>(); |
|||
taskMap.forEach((key, val) -> mapOfKey.add(key)); |
|||
if (CollectionUtil.isNotEmpty(mapOfKey)) { |
|||
if (0 == param.getQueryType()) { |
|||
String max = Collections.max(mapOfKey); |
|||
queryPluginForTask(taskMap.get(max)); |
|||
return taskMap.get(max); |
|||
} else { |
|||
String min = Collections.min(mapOfKey); |
|||
queryPluginForTask(taskMap.get(min)); |
|||
return taskMap.get(min); |
|||
} |
|||
} |
|||
queryPluginForTask(replenishTask); |
|||
//查询任务下的检查人
|
|||
queryCheckerOfTask(replenishTask); |
|||
return replenishTask; |
|||
} |
|||
queryPluginForTask(regularTask); |
|||
//查询任务下的检查人
|
|||
queryCheckerOfTask(regularTask); |
|||
return regularTask; |
|||
} |
|||
|
|||
/** |
|||
* 判断当前用户的角色是否被设置不可见(是否有权限查看任务) |
|||
* |
|||
* @param roleId 查看的角色id |
|||
* @param userId 用户id |
|||
* @return 是否可见(true可见, false不可见) |
|||
*/ |
|||
public Boolean queryRoleIsLook(Long roleId, Long userId) { |
|||
byte visitor = 0; |
|||
Long projectId = roleDao.findRoleOfProjectId(roleId); |
|||
if (ObjectUtil.isNull(projectId)) { |
|||
throw new BaseException(BasicsCodeError.ROLE_ERROR); |
|||
} |
|||
Long memberId = memberDao.findUserOfMemberId(projectId, userId); |
|||
//不是项目成员则为游客
|
|||
if (ObjectUtil.isNull(memberId)) { |
|||
visitor = 1; |
|||
} |
|||
//查看角色互斥表是否有对所属角色不可见
|
|||
List<Long> repulsionRoleIds = roleRepulsionDao.findRepulsionByRoleId(roleId); |
|||
//如果为游客
|
|||
if (1 == visitor) { |
|||
return !CollectionUtil.isNotEmpty(repulsionRoleIds); |
|||
} |
|||
//查找成员所属的所有角色
|
|||
List<Long> roleIds = roleMemberDao.findMemberOfRoleIds(memberId); |
|||
if (CollectionUtil.isEmpty(roleIds)) { |
|||
if (CollectionUtil.isNotEmpty(repulsionRoleIds)) { |
|||
return false; |
|||
} |
|||
} |
|||
//排斥角色包含所有所属角色则不可见
|
|||
if (CollectionUtil.isNotEmpty(repulsionRoleIds) && CollectionUtil.isNotEmpty(roleIds)) { |
|||
boolean isLook = repulsionRoleIds.containsAll(roleIds); |
|||
return !isLook; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 查询任务的插件相关信息 |
|||
* |
|||
* @param taskList 任务列表 |
|||
*/ |
|||
public void queryPluginForTask(List<TallTaskVo.QueryTask> taskList) { |
|||
if (CollectionUtil.isNotEmpty(taskList)) { |
|||
for (TallTaskVo.QueryTask queryTask : taskList) { |
|||
List<List<TallTaskVo.TaskPluginInfo>> plugins = new ArrayList<>(); |
|||
//如果任务面板信息不为空,则根据任务面板的行/列创建二维数组
|
|||
if (ObjectUtil.isNotNull(queryTask.getPanel())) { |
|||
int panelRow = queryTask.getPanel().getRow(); |
|||
int panelCol = queryTask.getPanel().getCol(); |
|||
if (0 != panelRow && 0 != panelCol) { |
|||
//创建任务面板的二维数组
|
|||
createSecondPanel(plugins, panelRow, panelCol); |
|||
//将插件放入二维数组对应的位置中
|
|||
List<TallTaskVo.TaskPluginInfo> taskPluginInfoList = taskPluginDao.queryTaskOfPlugin(queryTask.getDetailId()); |
|||
putDateInList(taskPluginInfoList, plugins, queryTask); |
|||
} else { |
|||
//根据插件最大的行和列创建二维数组
|
|||
createPanelByPlugin(queryTask.getDetailId(), plugins, queryTask); |
|||
} |
|||
} else { |
|||
//根据插件最大的行和列创建二维数组
|
|||
createPanelByPlugin(queryTask.getDetailId(), plugins, queryTask); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
/** |
|||
* 创建面板 |
|||
* |
|||
* @param plugins 插件列表 |
|||
* @param row 行 |
|||
* @param col 列 |
|||
*/ |
|||
public void createSecondPanel(List<List<TallTaskVo.TaskPluginInfo>> plugins, int row, int col) { |
|||
for (int i = 0; i < row; i++) { |
|||
List<TallTaskVo.TaskPluginInfo> pluginInfoList = new ArrayList<>(); |
|||
for (int j = 0; j < col; j++) { |
|||
pluginInfoList.add(null); |
|||
} |
|||
plugins.add(pluginInfoList); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 查询任务下的检查人 |
|||
* @param taskList 任务列表 |
|||
*/ |
|||
public void queryCheckerOfTask(List<TallTaskVo.QueryTask> taskList) { |
|||
if (CollectionUtil.isNotEmpty(taskList)) { |
|||
for (TallTaskVo.QueryTask queryTask : taskList) { |
|||
List<TallTaskVo.CheckerOfTask> checkerList = roleTaskDao.queryCheckerOfTask(queryTask.getDetailId()); |
|||
queryTask.setCheckerList(checkerList); |
|||
} |
|||
} |
|||
} |
|||
/** |
|||
* 向空面板里插入插件详情 |
|||
* |
|||
* @param taskPluginInfoList 插件详情列表 |
|||
* @param plugins 插件列表 |
|||
* @param queryTask 任务 |
|||
*/ |
|||
public void putDateInList(List<TallTaskVo.TaskPluginInfo> taskPluginInfoList, List<List<TallTaskVo.TaskPluginInfo>> plugins, TallTaskVo.QueryTask queryTask) { |
|||
for (TallTaskVo.TaskPluginInfo taskPlugin : taskPluginInfoList) { |
|||
int pluginCol = taskPlugin.getCol(); |
|||
int pluginRow = taskPlugin.getRow(); |
|||
if (0 == pluginCol || 0 == pluginRow) { |
|||
continue; |
|||
} |
|||
plugins.get(pluginRow - 1).set(pluginCol - 1, taskPlugin); |
|||
} |
|||
queryTask.setPlugins(plugins); |
|||
} |
|||
/** |
|||
* 根据插件的最大行列创建面板 |
|||
* |
|||
* @param taskDetailId 任务详情id |
|||
* @param plugins 插件列表 |
|||
* @param queryTask 任务 |
|||
*/ |
|||
public void createPanelByPlugin(Long taskDetailId, List<List<TallTaskVo.TaskPluginInfo>> plugins, TallTaskVo.QueryTask queryTask) { |
|||
List<TallTaskVo.TaskPluginInfo> taskPluginInfoList = taskPluginDao.queryTaskOfPlugin(taskDetailId); |
|||
if (CollectionUtil.isNotEmpty(taskPluginInfoList)) { |
|||
List<Integer> col = taskPluginInfoList.stream().map(TallTaskVo.TaskPluginInfo::getCol).collect(Collectors.toList()); |
|||
List<Integer> row = taskPluginInfoList.stream().map(TallTaskVo.TaskPluginInfo::getRow).collect(Collectors.toList()); |
|||
Integer newCol = Collections.max(col); |
|||
Integer newRow = Collections.max(row); |
|||
//创建任务面板的二维数组
|
|||
createSecondPanel(plugins, newRow, newCol); |
|||
//将插件放入二维数组对应的位置中
|
|||
putDateInList(taskPluginInfoList, plugins, queryTask); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,123 @@ |
|||
package com.ccsens.ptccsens.util; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 常量相关 |
|||
* @author AUSU |
|||
*/ |
|||
public class Constant { |
|||
|
|||
/**零号项目Id*/ |
|||
public static Long ZERO_PROJECT_ID = 1484800783814889472L; |
|||
/**引导页任务名*/ |
|||
public static String ZERO_GUIDE = "引导页"; |
|||
/**广告页任务名*/ |
|||
public static String ZERO_ADVERTISING = "广告页"; |
|||
|
|||
public static Map<Integer, String> timeUnit = new HashMap<>(); |
|||
public static Map<Integer, String> timeFormat = new HashMap<>(); |
|||
static { |
|||
timeUnit.put(1,"SECOND"); |
|||
timeUnit.put(2,"MINUTE"); |
|||
timeUnit.put(3,"HOUR"); |
|||
timeUnit.put(4,"DAY"); |
|||
timeUnit.put(5,"WEEK"); |
|||
timeUnit.put(6,"MONTH"); |
|||
timeUnit.put(7,"QUARTER"); |
|||
timeUnit.put(8,"YEAR"); |
|||
timeFormat.put(1,"%Y-%m-%d %h:%m:%s"); |
|||
timeFormat.put(2,"%Y-%m-%d %h:%m"); |
|||
timeFormat.put(3,"%Y-%m-%d %h"); |
|||
timeFormat.put(4,"%Y-%m-%d"); |
|||
timeFormat.put(5,"%Y-%u"); |
|||
timeFormat.put(6,"%Y-%m"); |
|||
timeFormat.put(7,"7"); |
|||
timeFormat.put(8,"%Y"); |
|||
} |
|||
|
|||
public static final class TaskType { |
|||
/**未开始*/ |
|||
public static final byte PENDING = 0; |
|||
/**进行中*/ |
|||
public static final byte PROCESSING = 1; |
|||
/**暂停中*/ |
|||
public static final byte PAUSE = 2; |
|||
/**已结束*/ |
|||
public static final byte COMPLETED = 3; |
|||
} |
|||
public static final class TaskOperationType { |
|||
/**开始*/ |
|||
public static final byte START = 0; |
|||
/**暂停*/ |
|||
public static final byte PAUSE = 1; |
|||
/**继续*/ |
|||
public static final byte TASK_CONTINUE = 2; |
|||
/**完成*/ |
|||
public static final byte COMPLETE = 3; |
|||
} |
|||
|
|||
public static final class MessageType { |
|||
/**修改任务状态*/ |
|||
public static final String TASK_STATUS = "taskStatus"; |
|||
/**上传交付物*/ |
|||
public static final String UPLOAD_DELIVER = "uploadDeliver"; |
|||
/**检查交付物*/ |
|||
public static final String CHECKER_DELIVER = "checkerDeliver"; |
|||
} |
|||
|
|||
public enum ROLE_LEVEL { |
|||
/**系统角色*/ |
|||
MEMBER((byte)0,"项目成员"),PM((byte)1,"项目经理"),STAKEHOLDER((byte)2,"干系人"),PIPE((byte)3,"管带"),GOD((byte)4,"上帝"); |
|||
|
|||
public Byte value; |
|||
public String phase; |
|||
ROLE_LEVEL(Byte value, String thePhase){ |
|||
this.value =value; |
|||
this.phase = thePhase; |
|||
} |
|||
} |
|||
|
|||
public static final Long SPRCTATOR_ID = 0L; |
|||
public static final String SPRCTATOR = "观众"; |
|||
|
|||
/**图片类型*/ |
|||
public static final String FILE_TYPE_IMG = "bmp,jpg,jpeg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,WMF,webp"; |
|||
/**文档类型*/ |
|||
public static final String FILE_TYPE_DOCUMENT = "doc, dot, wps, wpt, docx, dotx, docm, dotm, xls, xlt, et, xlsx, xltx, csv, xlsm, xltm, ppt,pptx,pptm,ppsx,ppsm,pps,potx,potm,dpt,dps, pdf"; |
|||
|
|||
|
|||
/**验证手机正则*/ |
|||
public static final String PHONE_REGEX = "^[1]([3-9])[0-9]{9}$"; |
|||
/**字符串分隔符*/ |
|||
public static final String STRING_REGEX = ",|,|;|;|、|/"; |
|||
/**wbs相关*/ |
|||
public static final class WbsExcel { |
|||
/**wbsSheet*/ |
|||
public static final String WBS_SHEET = "WBS"; |
|||
/**项目成员Sheet*/ |
|||
public static final String MEMBER_SHEET = "项目成员表"; |
|||
/**项目信息头*/ |
|||
public static final String PROJECT_INFO_TITLE = "项目信息"; |
|||
/**任务信息头*/ |
|||
public static final String TASK_INFO_TITLE = "项目任务分解"; |
|||
/**excel文件格式验证*/ |
|||
public static final String WBS_FILE_FORMAT = "xls,xlsx"; |
|||
/**插件配置表*/ |
|||
public static final String WBS_PLUGIN_CONFIG = "插件配置表"; |
|||
} |
|||
|
|||
/**wbs表时长对应关系表*/ |
|||
public static final Map<String, Long> WBS_DURATION = new HashMap<>(); |
|||
static { |
|||
WBS_DURATION.put("s",1000L); |
|||
WBS_DURATION.put("min",60 * 1000L); |
|||
WBS_DURATION.put("h",60 * 60 * 1000L); |
|||
WBS_DURATION.put("d",24 * 60 * 60 * 1000L); |
|||
WBS_DURATION.put("w",7 * 24 * 60 * 60 * 1000L); |
|||
WBS_DURATION.put("m",30 * 24 * 60 * 60 * 1000L); |
|||
WBS_DURATION.put("y",365 * 24 * 60 * 60 * 1000L); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
<?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.ptccsens.persist.dao.LabelBusinessDao"> |
|||
|
|||
<insert id="insertAllBusinessLabel"> |
|||
INSERT INTO t_label_business ( |
|||
id, |
|||
label_id, |
|||
user_id, |
|||
business_type, |
|||
business_id |
|||
) |
|||
VALUES |
|||
<foreach collection="businessLabelList" item="item" separator=","> |
|||
(#{item.id},#{item.labelId},#{item.userId},#{item.businessType},#{item.businessId}) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
<select id="findBusinessLabelByBid" resultType="com.ccsens.ptccsens.bean.po.LabelBusiness"> |
|||
SELECT |
|||
id, |
|||
label_id, |
|||
user_id, |
|||
business_type, |
|||
business_id |
|||
FROM |
|||
t_label_business |
|||
WHERE |
|||
rec_status=0 |
|||
AND |
|||
business_id IN |
|||
<foreach collection="businessIdList" index="index" item="item" open="(" separator="," close=")"> |
|||
#{item} |
|||
</foreach> |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,49 @@ |
|||
<?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.ptccsens.persist.dao.LabelDao"> |
|||
|
|||
<update id="delByBusinessIdAndType"> |
|||
UPDATE |
|||
t_label_business |
|||
SET |
|||
rec_status = 2 |
|||
WHERE |
|||
business_id = #{businessId} |
|||
and business_type = #{type} |
|||
</update> |
|||
|
|||
<select id="queryIsPm" resultType="String"> |
|||
select t_label.description |
|||
from t_label,t_label_type |
|||
where t_label.id=#{labelId} |
|||
and t_label.`level` = 1 |
|||
and t_label.label_type_id=t_label_type.id |
|||
</select> |
|||
|
|||
<select id="getLabelByTypeAndLevel" resultType="java.lang.Long"> |
|||
SELECT |
|||
l.id |
|||
FROM |
|||
t_label l |
|||
LEFT JOIN t_label_type lt on l.label_type_id = lt.id |
|||
WHERE |
|||
lt.label_type = #{type} |
|||
and |
|||
l.level = #{level} |
|||
limit 1 |
|||
</select> |
|||
|
|||
<select id="getLabelByName" resultType="java.lang.Long"> |
|||
SELECT |
|||
l.id |
|||
FROM |
|||
t_label l |
|||
LEFT JOIN t_label_type lt on l.label_type_id = lt.id |
|||
WHERE |
|||
lt.label_type = #{type} |
|||
and |
|||
l.description = #{sysRole} |
|||
limit 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,59 @@ |
|||
<?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.ptccsens.persist.dao.ProParentTaskDao"> |
|||
|
|||
<insert id="insertAllParentTask"> |
|||
INSERT INTO t_pro_parent_task ( |
|||
id, |
|||
task_detail_id, |
|||
parent_task_detail_id |
|||
) |
|||
VALUES |
|||
<foreach collection="newParentTaskList" item="item" separator=","> |
|||
(#{item.id},#{item.taskDetailId},#{item.parentTaskDetailId}) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
<!-- <select id="findTaskByParentId" resultType="com.ccsensptos.tallsdk.bean.vo.TallTaskVo$TaskDetail">--> |
|||
<!-- SELECT--> |
|||
<!-- d.id AS detailId,--> |
|||
<!-- d.`name`,--> |
|||
<!-- d.description,--> |
|||
<!-- d.cycle,--> |
|||
<!-- pt.id AS parentTaskId,--> |
|||
<!-- pt.parent_task_detail_id AS parentTaskDetailId--> |
|||
<!-- FROM--> |
|||
<!-- t_pro_parent_task AS pt--> |
|||
<!-- LEFT JOIN t_pro_task_detail AS d ON d.id = pt.task_detail_id--> |
|||
<!-- WHERE--> |
|||
<!-- pt.parent_task_detail_id = #{oldProjectId}--> |
|||
<!-- 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> |
@ -0,0 +1,103 @@ |
|||
<?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.ptccsens.persist.dao.ProRoleDao"> |
|||
|
|||
<select id="findRoleOfProjectId" resultType="java.lang.Long"> |
|||
SELECT |
|||
project_id |
|||
FROM |
|||
t_pro_role |
|||
WHERE |
|||
rec_status = 0 |
|||
AND id = #{roleId} |
|||
</select> |
|||
<select id="queryRoleByUserId" resultType="com.ccsens.ptccsens.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 m.project_id = #{projectId} |
|||
and r.rec_status = 0 |
|||
and rm.rec_status = 0 |
|||
and m.rec_status = 0 |
|||
</select> |
|||
<select id="notAttentionQueryRole" resultType="com.ccsensptos.tallsdk.bean.vo.TallRoleVo$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 |
|||
and rr.repulsion_role_id in |
|||
<foreach collection="userRoleList" index="index" item="item" open="(" separator="," close=")"> |
|||
#{item.id} |
|||
</foreach> |
|||
WHERE |
|||
r.project_id = #{projectId} |
|||
and r.rec_status = 0 |
|||
and l.`level` < 2 |
|||
and l.rec_status = 0 |
|||
and |
|||
( |
|||
rr.repulsion_role_id not in |
|||
<foreach collection="userRoleList" index="index" item="item" open="(" separator="," close=")"> |
|||
#{item.id} |
|||
</foreach> |
|||
or |
|||
rr.id is null |
|||
) |
|||
GROUP BY r.id |
|||
ORDER BY pm DESC,mine DESC,r.id |
|||
</select> |
|||
<select id="attentionQueryRole" resultType="com.ccsensptos.tallsdk.bean.vo.TallRoleVo$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` < 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> |
@ -0,0 +1,45 @@ |
|||
<?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.ptccsens.persist.dao.ProRoleMemberDao"> |
|||
<update id="delByRoleId"> |
|||
update |
|||
t_pro_role_member |
|||
set |
|||
rec_status = 2 |
|||
where |
|||
role_id = #{roleId} |
|||
</update> |
|||
<!-- <update id="delByMemberId">--> |
|||
<!-- update--> |
|||
<!-- t_pro_role_member--> |
|||
<!-- set--> |
|||
<!-- rec_status = 2--> |
|||
<!-- where--> |
|||
<!-- member_id = #{memberId}--> |
|||
<!-- </update>--> |
|||
|
|||
<select id="findMemberOfRoleIds" resultType="java.lang.Long"> |
|||
SELECT |
|||
role_id |
|||
FROM |
|||
t_pro_role_member |
|||
WHERE |
|||
rec_status = 0 |
|||
AND member_id = #{memberId} |
|||
</select> |
|||
|
|||
<!-- <select id="queryByRoleAndMember" resultType="com.ccsens.common.bean.po.ProRoleMember">--> |
|||
<!-- SELECT--> |
|||
<!-- id,--> |
|||
<!-- role_id,--> |
|||
<!-- member_id,--> |
|||
<!-- operator--> |
|||
<!-- FROM--> |
|||
<!-- t_pro_role_member--> |
|||
<!-- WHERE--> |
|||
<!-- rec_status = 0--> |
|||
<!-- AND role_id = #{roleId}--> |
|||
<!-- AND member_id = #{memberId}--> |
|||
<!-- </select>--> |
|||
|
|||
</mapper> |
@ -0,0 +1,43 @@ |
|||
<?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.ptccsens.persist.dao.ProRoleRepulsionDao"> |
|||
<!-- <insert id="insertRoleRepulsionList">--> |
|||
<!-- INSERT INTO t_pro_role_repulsion (--> |
|||
<!-- id,--> |
|||
<!-- role_id,--> |
|||
<!-- repulsion_role_id,--> |
|||
<!-- operator--> |
|||
<!-- )--> |
|||
<!-- VALUES--> |
|||
<!-- <foreach collection="newRoleRepulsionList" item="item" separator=",">--> |
|||
<!-- (#{item.id},#{item.roleId},#{item.repulsionRoleId},#{item.operator})--> |
|||
<!-- </foreach>--> |
|||
<!-- </insert>--> |
|||
|
|||
<select id="findRepulsionByRoleId" resultType="java.lang.Long"> |
|||
SELECT |
|||
repulsion_role_id |
|||
FROM |
|||
t_pro_role_repulsion |
|||
WHERE |
|||
rec_status = 0 |
|||
AND role_id = #{roleId} |
|||
</select> |
|||
|
|||
<!-- <select id="findRepulsionByRoleIdList" resultType="com.ccsens.common.bean.po.ProRoleRepulsion">--> |
|||
<!-- SELECT--> |
|||
<!-- id,--> |
|||
<!-- role_id,--> |
|||
<!-- repulsion_role_id,--> |
|||
<!-- operator--> |
|||
<!-- FROM--> |
|||
<!-- t_pro_role_repulsion--> |
|||
<!-- WHERE--> |
|||
<!-- rec_status = 0--> |
|||
<!-- AND role_id IN--> |
|||
<!-- <foreach collection="oldRoleList" index="index" item="item" open="(" separator="," close=")">--> |
|||
<!-- #{item.id}--> |
|||
<!-- </foreach>--> |
|||
<!-- </select>--> |
|||
|
|||
</mapper> |
@ -0,0 +1,71 @@ |
|||
<?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.ptccsens.persist.dao.ProRoleTaskDao"> |
|||
|
|||
<!-- <insert id="insertAllRoleTask">--> |
|||
<!-- INSERT INTO t_pro_role_task (--> |
|||
<!-- id,--> |
|||
<!-- role_id,--> |
|||
<!-- task_id,--> |
|||
<!-- operator--> |
|||
<!-- )--> |
|||
<!-- VALUES--> |
|||
<!-- <foreach collection="roleTaskList" item="item" separator=",">--> |
|||
<!-- (#{item.id},#{item.roleId},#{item.taskId},#{item.operator})--> |
|||
<!-- </foreach>--> |
|||
<!-- </insert>--> |
|||
<!-- <update id="delByTaskDetailIdAndType">--> |
|||
<!-- update--> |
|||
<!-- t_pro_role_task--> |
|||
<!-- set--> |
|||
<!-- rec_status = 2--> |
|||
<!-- where--> |
|||
<!-- task_id = #{detailId}--> |
|||
<!-- and role_duty = #{roleDuty}--> |
|||
<!-- </update>--> |
|||
|
|||
<!-- <select id="findRoleTaskByRoleId" resultType="com.ccsens.common.bean.po.ProRoleTask">--> |
|||
<!-- SELECT--> |
|||
<!-- id,--> |
|||
<!-- role_id,--> |
|||
<!-- task_id,--> |
|||
<!-- operator--> |
|||
<!-- FROM--> |
|||
<!-- t_pro_role_task--> |
|||
<!-- WHERE--> |
|||
<!-- rec_status = 0--> |
|||
<!-- AND role_id IN--> |
|||
<!-- <foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">--> |
|||
<!-- #{item}--> |
|||
<!-- </foreach>--> |
|||
<!-- </select>--> |
|||
|
|||
<!-- <select id="isMyTask" resultType="java.lang.Long">--> |
|||
<!-- SELECT--> |
|||
<!-- id--> |
|||
<!-- FROM--> |
|||
<!-- t_pro_role_task--> |
|||
<!-- WHERE--> |
|||
<!-- task_id = #{taskDetailId}--> |
|||
<!-- AND role_id IN--> |
|||
<!-- <foreach collection="roleIdList" item="id" open="(" separator="," close=")">--> |
|||
<!-- #{id}--> |
|||
<!-- </foreach>--> |
|||
|
|||
<!-- </select>--> |
|||
|
|||
<select id="queryCheckerOfTask" resultType="com.ccsensptos.tallsdk.bean.vo.TallTaskVo$CheckerOfTask"> |
|||
SELECT |
|||
r.id, |
|||
r.`name` |
|||
FROM |
|||
t_pro_role_task AS rt |
|||
LEFT JOIN t_pro_role AS r ON r.id = rt.role_id |
|||
WHERE |
|||
rt.rec_status = 0 |
|||
AND r.rec_status = 0 |
|||
AND rt.task_id = #{detailId} |
|||
AND rt.role_duty = 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,67 @@ |
|||
<?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.ptccsens.persist.dao.ProTaskPluginDao"> |
|||
|
|||
<!-- <insert id="insertAllTaskPlugin">--> |
|||
<!-- INSERT INTO t_pro_task_plugin (--> |
|||
<!-- id,--> |
|||
<!-- param,--> |
|||
<!-- plgin_row,--> |
|||
<!-- plgin_col,--> |
|||
<!-- task_detail_id,--> |
|||
<!-- plugin_id,--> |
|||
<!-- colspan,--> |
|||
<!-- rowspan--> |
|||
<!-- )--> |
|||
<!-- VALUES--> |
|||
<!-- <foreach collection="taskPluginList" item="item" separator=",">--> |
|||
<!-- (#{item.id},#{item.param},#{item.plginRow},#{item.plginCol},#{item.taskDetailId},#{item.pluginId},#{item.colspan},#{item.rowspan})--> |
|||
<!-- </foreach>--> |
|||
<!-- </insert>--> |
|||
|
|||
<!-- <update id="delByTaskDetailId">--> |
|||
<!-- update--> |
|||
<!-- t_pro_task_plugin--> |
|||
<!-- set--> |
|||
<!-- rec_status = 2--> |
|||
<!-- where--> |
|||
<!-- task_detail_id = #{taskDetailId}--> |
|||
<!-- </update>--> |
|||
|
|||
<select id="queryTaskOfPlugin" resultType="com.ccsensptos.tallsdk.bean.vo.TallTaskVo$TaskPluginInfo"> |
|||
SELECT |
|||
tp.plugin_id AS pluginId, |
|||
tp.param As param, |
|||
tp.plgin_row AS `row`, |
|||
tp.plgin_col AS col, |
|||
tp.colspan AS colspan, |
|||
tp.rowspan AS rowspan, |
|||
tp.id AS pluginTaskId |
|||
FROM |
|||
t_pro_task_plugin AS tp |
|||
LEFT JOIN t_pro_task_detail AS td ON td.id = tp.task_detail_id |
|||
WHERE td.rec_status = 0 AND tp.rec_status = 0 |
|||
AND tp.task_detail_id = #{detailTaskId} |
|||
</select> |
|||
|
|||
<!-- <select id="findPluginByTaskIdList" resultType="com.ccsens.common.bean.po.ProTaskPlugin">--> |
|||
<!-- SELECT--> |
|||
<!-- id,--> |
|||
<!-- param,--> |
|||
<!-- plgin_row,--> |
|||
<!-- plgin_col,--> |
|||
<!-- task_detail_id,--> |
|||
<!-- plugin_id,--> |
|||
<!-- colspan,--> |
|||
<!-- rowspan--> |
|||
<!-- FROM--> |
|||
<!-- t_pro_task_plugin--> |
|||
<!-- WHERE--> |
|||
<!-- rec_status = 0--> |
|||
<!-- AND task_detail_id IN--> |
|||
<!-- <foreach collection="oldTaskIdList" index="index" item="item" open="(" separator="," close=")">--> |
|||
<!-- #{item}--> |
|||
<!-- </foreach>--> |
|||
<!-- </select>--> |
|||
|
|||
</mapper> |
@ -0,0 +1,63 @@ |
|||
<?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.ptccsens.persist.dao.ProTaskSubDao"> |
|||
|
|||
<insert id="insertAllTaskSub"> |
|||
INSERT INTO t_pro_task_sub ( |
|||
id, |
|||
plan_start_time, |
|||
plan_duration, |
|||
plan_end_time, |
|||
task_detail_id |
|||
) |
|||
VALUES |
|||
<foreach collection="newTaskSubList" item="item" separator=","> |
|||
(#{item.id},#{item.planStartTime},#{item.planDuration},#{item.planEndTime},#{item.taskDetailId}) |
|||
</foreach> |
|||
</insert> |
|||
<update id="deleteOldSubTask"> |
|||
update |
|||
t_pro_task_sub |
|||
set |
|||
rec_status = 2 |
|||
where |
|||
task_detail_id = #{taskDetailId} |
|||
</update> |
|||
|
|||
<select id="findSubTaskByDetail" resultType="com.ccsens.ptccsens.bean.po.ProTaskSub"> |
|||
SELECT |
|||
id, |
|||
plan_start_time, |
|||
plan_duration, |
|||
plan_end_time, |
|||
task_detail_id |
|||
FROM |
|||
t_pro_task_sub |
|||
WHERE |
|||
rec_status = 0 |
|||
AND task_detail_id = #{id} |
|||
</select> |
|||
|
|||
<select id="findNextTaskSub" resultType="com.ccsens.ptccsens.bean.po.ProTaskSub"> |
|||
SELECT |
|||
s.id, |
|||
s.plan_start_time, |
|||
s.plan_duration, |
|||
s.plan_end_time, |
|||
s.real_start_time, |
|||
s.real_duration, |
|||
s.real_end_time, |
|||
s.task_detail_id |
|||
FROM |
|||
t_pro_task_detail AS d |
|||
LEFT JOIN t_pro_task_sub AS s ON d.id = s.task_detail_id |
|||
WHERE |
|||
d.rec_status = 0 |
|||
AND s.rec_status = 0 |
|||
AND s.task_status = 0 |
|||
AND d.id = #{nextTaskDetailId} |
|||
AND s.plan_start_time >= #{planTime} |
|||
LIMIT 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,23 @@ |
|||
<?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.ptccsens.persist.dao.ProTaskVersionDao"> |
|||
|
|||
|
|||
<select id="findVersionByProjectId" resultType="com.ccsens.ptccsens.bean.po.ProTaskVersion"> |
|||
SELECT |
|||
id, |
|||
task_detail_id, |
|||
task_version_info, |
|||
project_type, |
|||
address |
|||
FROM |
|||
t_pro_task_version |
|||
WHERE |
|||
rec_status = 0 |
|||
AND task_detail_id = #{projectId} |
|||
ORDER BY |
|||
created_at DESC |
|||
LIMIT 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,50 @@ |
|||
<?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.ptccsens.persist.dao.ProjectDao"> |
|||
|
|||
<update id="updateStatusById"> |
|||
UPDATE t_pro_task_detail |
|||
SET rec_status = 2 |
|||
WHERE |
|||
id = #{projectId} |
|||
</update> |
|||
|
|||
<select id="queryByCreator" resultType="com.ccsens.ptccsens.bean.vo.ProjectVo$SysProject"> |
|||
SELECT |
|||
t.id, |
|||
t.`name` |
|||
FROM |
|||
t_pro_member m, |
|||
t_pro_role_member rm, |
|||
t_pro_role r, |
|||
t_label l, |
|||
t_pro_task_detail t |
|||
WHERE |
|||
m.id = rm.member_id |
|||
and r.id = rm.role_id |
|||
and r.label_id = l.id |
|||
and l.`level` = 5 |
|||
and r.project_id = t.id |
|||
and m.user_id = #{userId} |
|||
and m.rec_status = 0 |
|||
and rm.rec_status = 0 |
|||
and r.rec_status = 0 |
|||
and t.rec_status = 0 |
|||
and l.rec_status = 0 |
|||
</select> |
|||
|
|||
<select id="selectById" resultType="com.ccsens.ptccsens.bean.vo.ProjectVo$SysProject"> |
|||
SELECT |
|||
d.id, |
|||
d.`name`, |
|||
s.plan_start_time AS beginTime, |
|||
s.plan_end_time AS endTime |
|||
FROM |
|||
t_pro_task_detail AS d |
|||
LEFT JOIN t_pro_task_sub AS s ON d.id = s.task_detail_id |
|||
WHERE |
|||
d.rec_status = 0 |
|||
AND s.rec_status = 0 |
|||
AND d.id = #{projectId} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
<?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.ptccsens.persist.dao.UserDao"> |
|||
|
|||
|
|||
<select id="getUserIdByPhone" resultType="com.ccsens.ptccsens.bean.po.ProUser"> |
|||
select |
|||
* |
|||
from |
|||
t_pro_user |
|||
where |
|||
phone = #{phone} |
|||
and rec_status = 0 |
|||
limit 1 |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,385 @@ |
|||
<?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.ptccsens.persist.mapper.ProUserMapper"> |
|||
<resultMap id="BaseResultMap" type="com.ccsens.ptccsens.bean.po.ProUser"> |
|||
<id column="id" jdbcType="BIGINT" property="id" /> |
|||
<result column="name" jdbcType="VARCHAR" property="name" /> |
|||
<result column="gender" jdbcType="TINYINT" property="gender" /> |
|||
<result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl" /> |
|||
<result column="country" jdbcType="VARCHAR" property="country" /> |
|||
<result column="province" jdbcType="VARCHAR" property="province" /> |
|||
<result column="city" jdbcType="VARCHAR" property="city" /> |
|||
<result column="phone" jdbcType="VARCHAR" property="phone" /> |
|||
<result column="id_card" jdbcType="VARCHAR" property="idCard" /> |
|||
<result column="power" jdbcType="TINYINT" property="power" /> |
|||
<result column="device_id" jdbcType="VARCHAR" property="deviceId" /> |
|||
<result column="auth_type" jdbcType="TINYINT" property="authType" /> |
|||
<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, name, gender, avatar_url, country, province, city, phone, id_card, power, device_id, |
|||
auth_type, operator, created_at, updated_at, rec_status |
|||
</sql> |
|||
<select id="selectByExample" parameterType="com.ccsens.ptccsens.bean.po.ProUserExample" resultMap="BaseResultMap"> |
|||
select |
|||
<if test="distinct"> |
|||
distinct |
|||
</if> |
|||
<include refid="Base_Column_List" /> |
|||
from t_pro_user |
|||
<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_pro_user |
|||
where id = #{id,jdbcType=BIGINT} |
|||
</select> |
|||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
|||
delete from t_pro_user |
|||
where id = #{id,jdbcType=BIGINT} |
|||
</delete> |
|||
<delete id="deleteByExample" parameterType="com.ccsens.ptccsens.bean.po.ProUserExample"> |
|||
delete from t_pro_user |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</delete> |
|||
<insert id="insert" parameterType="com.ccsens.ptccsens.bean.po.ProUser"> |
|||
insert into t_pro_user (id, name, gender, |
|||
avatar_url, country, province, |
|||
city, phone, id_card, |
|||
power, device_id, auth_type, |
|||
operator, created_at, updated_at, |
|||
rec_status) |
|||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, |
|||
#{avatarUrl,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, |
|||
#{city,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, |
|||
#{power,jdbcType=TINYINT}, #{deviceId,jdbcType=VARCHAR}, #{authType,jdbcType=TINYINT}, |
|||
#{operator,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, |
|||
#{recStatus,jdbcType=TINYINT}) |
|||
</insert> |
|||
<insert id="insertSelective" parameterType="com.ccsens.ptccsens.bean.po.ProUser"> |
|||
insert into t_pro_user |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="id != null"> |
|||
id, |
|||
</if> |
|||
<if test="name != null"> |
|||
name, |
|||
</if> |
|||
<if test="gender != null"> |
|||
gender, |
|||
</if> |
|||
<if test="avatarUrl != null"> |
|||
avatar_url, |
|||
</if> |
|||
<if test="country != null"> |
|||
country, |
|||
</if> |
|||
<if test="province != null"> |
|||
province, |
|||
</if> |
|||
<if test="city != null"> |
|||
city, |
|||
</if> |
|||
<if test="phone != null"> |
|||
phone, |
|||
</if> |
|||
<if test="idCard != null"> |
|||
id_card, |
|||
</if> |
|||
<if test="power != null"> |
|||
power, |
|||
</if> |
|||
<if test="deviceId != null"> |
|||
device_id, |
|||
</if> |
|||
<if test="authType != null"> |
|||
auth_type, |
|||
</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="name != null"> |
|||
#{name,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="gender != null"> |
|||
#{gender,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="avatarUrl != null"> |
|||
#{avatarUrl,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="country != null"> |
|||
#{country,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="province != null"> |
|||
#{province,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="city != null"> |
|||
#{city,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="phone != null"> |
|||
#{phone,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="idCard != null"> |
|||
#{idCard,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="power != null"> |
|||
#{power,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="deviceId != null"> |
|||
#{deviceId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authType != null"> |
|||
#{authType,jdbcType=TINYINT}, |
|||
</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.ptccsens.bean.po.ProUserExample" resultType="java.lang.Long"> |
|||
select count(*) from t_pro_user |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</select> |
|||
<update id="updateByExampleSelective" parameterType="map"> |
|||
update t_pro_user |
|||
<set> |
|||
<if test="record.id != null"> |
|||
id = #{record.id,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.name != null"> |
|||
name = #{record.name,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.gender != null"> |
|||
gender = #{record.gender,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="record.avatarUrl != null"> |
|||
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.country != null"> |
|||
country = #{record.country,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.province != null"> |
|||
province = #{record.province,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.city != null"> |
|||
city = #{record.city,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.phone != null"> |
|||
phone = #{record.phone,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.idCard != null"> |
|||
id_card = #{record.idCard,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.power != null"> |
|||
power = #{record.power,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="record.deviceId != null"> |
|||
device_id = #{record.deviceId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.authType != null"> |
|||
auth_type = #{record.authType,jdbcType=TINYINT}, |
|||
</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_pro_user |
|||
set id = #{record.id,jdbcType=BIGINT}, |
|||
name = #{record.name,jdbcType=VARCHAR}, |
|||
gender = #{record.gender,jdbcType=TINYINT}, |
|||
avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}, |
|||
country = #{record.country,jdbcType=VARCHAR}, |
|||
province = #{record.province,jdbcType=VARCHAR}, |
|||
city = #{record.city,jdbcType=VARCHAR}, |
|||
phone = #{record.phone,jdbcType=VARCHAR}, |
|||
id_card = #{record.idCard,jdbcType=VARCHAR}, |
|||
power = #{record.power,jdbcType=TINYINT}, |
|||
device_id = #{record.deviceId,jdbcType=VARCHAR}, |
|||
auth_type = #{record.authType,jdbcType=TINYINT}, |
|||
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.ptccsens.bean.po.ProUser"> |
|||
update t_pro_user |
|||
<set> |
|||
<if test="name != null"> |
|||
name = #{name,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="gender != null"> |
|||
gender = #{gender,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="avatarUrl != null"> |
|||
avatar_url = #{avatarUrl,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="country != null"> |
|||
country = #{country,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="province != null"> |
|||
province = #{province,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="city != null"> |
|||
city = #{city,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="phone != null"> |
|||
phone = #{phone,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="idCard != null"> |
|||
id_card = #{idCard,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="power != null"> |
|||
power = #{power,jdbcType=TINYINT}, |
|||
</if> |
|||
<if test="deviceId != null"> |
|||
device_id = #{deviceId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authType != null"> |
|||
auth_type = #{authType,jdbcType=TINYINT}, |
|||
</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.ptccsens.bean.po.ProUser"> |
|||
update t_pro_user |
|||
set name = #{name,jdbcType=VARCHAR}, |
|||
gender = #{gender,jdbcType=TINYINT}, |
|||
avatar_url = #{avatarUrl,jdbcType=VARCHAR}, |
|||
country = #{country,jdbcType=VARCHAR}, |
|||
province = #{province,jdbcType=VARCHAR}, |
|||
city = #{city,jdbcType=VARCHAR}, |
|||
phone = #{phone,jdbcType=VARCHAR}, |
|||
id_card = #{idCard,jdbcType=VARCHAR}, |
|||
power = #{power,jdbcType=TINYINT}, |
|||
device_id = #{deviceId,jdbcType=VARCHAR}, |
|||
auth_type = #{authType,jdbcType=TINYINT}, |
|||
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> |
Loading…
Reference in new issue