@@ -1,6 +1,8 @@ | |||||
package com.ningdatech.pmapi.common.constant; | package com.ningdatech.pmapi.common.constant; | ||||
/** | /** | ||||
* 浙政钉常量 | * 浙政钉常量 | ||||
* | |||||
* @author CMM | * @author CMM | ||||
* @since 2023/02/01 14:49 | * @since 2023/02/01 14:49 | ||||
*/ | */ | ||||
@@ -9,4 +11,4 @@ public interface DingConstant { | |||||
* 工作通知 | * 工作通知 | ||||
*/ | */ | ||||
String WORKING_NOTICE = "/message/workNotification"; | String WORKING_NOTICE = "/message/workNotification"; | ||||
} | |||||
} |
@@ -24,6 +24,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||||
"com.ningdatech.pmapi.sys.controller", | "com.ningdatech.pmapi.sys.controller", | ||||
"com.ningdatech.pmapi.todocenter.controller", | "com.ningdatech.pmapi.todocenter.controller", | ||||
"com.ningdatech.pmapi.user.controller", | "com.ningdatech.pmapi.user.controller", | ||||
"com.ningdatech.pmapi.expert.controller" | |||||
}) | }) | ||||
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | ||||
@@ -4,15 +4,16 @@ package com.ningdatech.pmapi.expert.controller; | |||||
import com.ningdatech.log.annotation.WebLog; | import com.ningdatech.log.annotation.WebLog; | ||||
import com.ningdatech.pmapi.expert.manage.ExpertReviewManage; | import com.ningdatech.pmapi.expert.manage.ExpertReviewManage; | ||||
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; | import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; | ||||
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; | |||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiImplicitParam; | |||||
import io.swagger.annotations.ApiImplicitParams; | |||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import org.springframework.web.bind.annotation.PostMapping; | |||||
import org.springframework.web.bind.annotation.RequestBody; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import javax.validation.Valid; | import javax.validation.Valid; | ||||
import java.util.List; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -37,4 +38,24 @@ public class ExpertReviewController { | |||||
expertReviewManage.expertReview(req); | expertReviewManage.expertReview(req); | ||||
} | } | ||||
@GetMapping("/detail/{projectId}/{userId}") | |||||
@ApiOperation("获取专家评审详情") | |||||
@ApiImplicitParams({ | |||||
@ApiImplicitParam(name = "userId", value = "专家ID"), | |||||
@ApiImplicitParam(name = "projectId", value = "项目ID") | |||||
}) | |||||
public ExpertReviewDetailVO getExpertReviewDetail(@PathVariable Long userId, @PathVariable Long projectId) { | |||||
return expertReviewManage.getExpertReviewDetail(userId, projectId); | |||||
} | |||||
@GetMapping("/listForGroupLeader/{projectId}/{userId}") | |||||
@ApiImplicitParams({ | |||||
@ApiImplicitParam(name = "userId", value = "专家ID"), | |||||
@ApiImplicitParam(name = "projectId", value = "项目ID") | |||||
}) | |||||
@ApiOperation("查看组员评审意见") | |||||
public List<ExpertReviewDetailVO> listForGroupLeader(@PathVariable Long userId, @PathVariable Long projectId) { | |||||
return expertReviewManage.listForGroupLeader(projectId, userId); | |||||
} | |||||
} | } |
@@ -6,12 +6,14 @@ import com.ningdatech.pmapi.expert.manage.ReviewTemplateSettingsManage; | |||||
import com.ningdatech.pmapi.expert.model.req.ReviewTemplateReq; | import com.ningdatech.pmapi.expert.model.req.ReviewTemplateReq; | ||||
import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; | import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiImplicitParam; | |||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import javax.validation.Valid; | import javax.validation.Valid; | ||||
import java.util.List; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -42,10 +44,18 @@ public class ReviewTemplateSettingsController { | |||||
reviewTemplateSettingsManage.saveOrUpdate(req); | reviewTemplateSettingsManage.saveOrUpdate(req); | ||||
} | } | ||||
@GetMapping("/template/{templateId}") | |||||
@GetMapping("/template") | |||||
@ApiModelProperty("根据模版ID获取评审模版") | @ApiModelProperty("根据模版ID获取评审模版") | ||||
public ReviewTemplateVO getTemplateById(@PathVariable Long templateId) { | |||||
@ApiImplicitParam(name = "templateId", defaultValue = "模版ID") | |||||
public ReviewTemplateVO getTemplateById(@RequestParam Long templateId) { | |||||
return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId); | return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId); | ||||
} | } | ||||
@GetMapping("/templates") | |||||
@ApiModelProperty("(批量)根据模版ID获取评审模版") | |||||
@ApiImplicitParam(name = "templateIds", defaultValue = "模版ID集合") | |||||
public List<ReviewTemplateVO> getTemplateById(@RequestParam List<Long> templateIds) { | |||||
return reviewTemplateSettingsManage.listReviewTemplateSettings(templateIds); | |||||
} | |||||
} | } |
@@ -1,10 +1,15 @@ | |||||
package com.ningdatech.pmapi.expert.manage; | package com.ningdatech.pmapi.expert.manage; | ||||
import cn.hutool.json.JSONUtil; | import cn.hutool.json.JSONUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.cache.lock.DistributedLock; | import com.ningdatech.cache.lock.DistributedLock; | ||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; | |||||
import com.ningdatech.pmapi.expert.model.entity.ExpertReview; | import com.ningdatech.pmapi.expert.model.entity.ExpertReview; | ||||
import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; | import com.ningdatech.pmapi.expert.model.req.ExpertReviewDetailReq; | ||||
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; | |||||
import com.ningdatech.pmapi.expert.service.IExpertReviewService; | import com.ningdatech.pmapi.expert.service.IExpertReviewService; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -33,6 +38,20 @@ public class ExpertReviewManage { | |||||
return EXPERT_REVIEW_KEY + projectId + ":" + expertId; | return EXPERT_REVIEW_KEY + projectId + ":" + expertId; | ||||
} | } | ||||
private ExpertReviewDetailVO buildExpertReviewDetail(ExpertReview review) { | |||||
return ExpertReviewDetailVO.builder() | |||||
.reviewResult(review.getReviewResult()) | |||||
.creator(review.getCreator()) | |||||
.projectId(review.getProjectId()) | |||||
.templateId(review.getTemplateId()) | |||||
.otherAdvice(review.getOtherAdvice()) | |||||
.isFinal(review.getIsFinal()) | |||||
.createOn(review.getCreateOn()) | |||||
.attachFileId(review.getAttachFileId()) | |||||
.reviewTemplateOptions(JSONUtil.toList(review.getContent(), ReviewTemplateOptionDTO.class)) | |||||
.build(); | |||||
} | |||||
public void expertReview(ExpertReviewDetailReq req) { | public void expertReview(ExpertReviewDetailReq req) { | ||||
Long userId = LoginUserUtil.getUserId(); | Long userId = LoginUserUtil.getUserId(); | ||||
Long projectId = req.getProjectId(); | Long projectId = req.getProjectId(); | ||||
@@ -60,7 +79,7 @@ public class ExpertReviewManage { | |||||
review.setContent(JSONUtil.toJsonStr(req.getReviewTemplateOptions())); | review.setContent(JSONUtil.toJsonStr(req.getReviewTemplateOptions())); | ||||
review.setProjectId(req.getProjectId()); | review.setProjectId(req.getProjectId()); | ||||
review.setTemplateId(req.getTemplateId()); | review.setTemplateId(req.getTemplateId()); | ||||
review.setAdvice(req.getOtherAdvice()); | |||||
review.setOtherAdvice(req.getOtherAdvice()); | |||||
review.setAttachFileId(req.getAttachFileId()); | review.setAttachFileId(req.getAttachFileId()); | ||||
review.setIsFinal(req.getIsFinal()); | review.setIsFinal(req.getIsFinal()); | ||||
review.setCreator(LoginUserUtil.getUsername()); | review.setCreator(LoginUserUtil.getUsername()); | ||||
@@ -70,4 +89,22 @@ public class ExpertReviewManage { | |||||
} | } | ||||
} | } | ||||
public ExpertReviewDetailVO getExpertReviewDetail(Long projectId, Long userId) { | |||||
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId); | |||||
reviews.removeIf(ExpertReview::getIsFinal); | |||||
if (reviews.isEmpty()) { | |||||
throw BizException.wrap("评审记录不存在"); | |||||
} | |||||
return buildExpertReviewDetail(reviews.get(0)); | |||||
} | |||||
public List<ExpertReviewDetailVO> listForGroupLeader(Long projectId, Long userId) { | |||||
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class); | |||||
query.eq(ExpertReview::getProjectId, projectId); | |||||
query.ne(ExpertReview::getCreateBy, userId); | |||||
query.orderByDesc(ExpertReview::getCreateOn); | |||||
List<ExpertReview> reviews = expertReviewService.list(query); | |||||
return CollUtils.convert(reviews, this::buildExpertReviewDetail); | |||||
} | |||||
} | } |
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | import com.ningdatech.pmapi.common.constant.BizConst; | ||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; | import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; | ||||
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; | import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; | ||||
@@ -16,6 +17,8 @@ import lombok.AllArgsConstructor; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import java.util.List; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* ReviewTemplateSettingsManage | * ReviewTemplateSettingsManage | ||||
@@ -62,6 +65,11 @@ public class ReviewTemplateSettingsManage { | |||||
return buildTemplateDetail(settings); | return buildTemplateDetail(settings); | ||||
} | } | ||||
public List<ReviewTemplateVO> listReviewTemplateSettings(List<Long> templateIds) { | |||||
List<ReviewTemplateSettings> settings = reviewTemplateSettingsService.listByIds(templateIds); | |||||
return CollUtils.convert(settings, this::buildTemplateDetail); | |||||
} | |||||
private ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) { | private ReviewTemplateVO buildTemplateDetail(ReviewTemplateSettings settings) { | ||||
if (settings == null) { | if (settings == null) { | ||||
throw BizException.wrap("模版不存在"); | throw BizException.wrap("模版不存在"); | ||||
@@ -0,0 +1,39 @@ | |||||
package com.ningdatech.pmapi.expert.model.dto; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Builder; | |||||
import lombok.Data; | |||||
import lombok.experimental.Tolerate; | |||||
import javax.validation.constraints.NotEmpty; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* ReviewTemplateOptionVO | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 16:12 2023/2/15 | |||||
*/ | |||||
@Data | |||||
@Builder | |||||
public class ReviewTemplateOptionDTO { | |||||
@Tolerate | |||||
public ReviewTemplateOptionDTO() { | |||||
} | |||||
@ApiModelProperty("问题序号") | |||||
@NotNull(message = "问题序号不能为空") | |||||
private Integer questionSerialNo; | |||||
@ApiModelProperty("选项序号") | |||||
@NotEmpty(message = "选项序号不能为空") | |||||
private List<Integer> optionSerialNo; | |||||
@ApiModelProperty("其他意见或建议") | |||||
private String otherAdvice; | |||||
} |
@@ -37,7 +37,7 @@ public class ExpertReview implements Serializable { | |||||
private String content; | private String content; | ||||
@ApiModelProperty("意见或建议") | @ApiModelProperty("意见或建议") | ||||
private String advice; | |||||
private String otherAdvice; | |||||
@ApiModelProperty("附件ID") | @ApiModelProperty("附件ID") | ||||
private Long attachFileId; | private Long attachFileId; | ||||
@@ -1,8 +1,6 @@ | |||||
package com.ningdatech.pmapi.expert.model.entity; | package com.ningdatech.pmapi.expert.model.entity; | ||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.baomidou.mybatisplus.annotation.*; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -41,12 +39,16 @@ public class ReviewTemplateSettings implements Serializable { | |||||
@ApiModelProperty("区域编码") | @ApiModelProperty("区域编码") | ||||
private String regionCode; | private String regionCode; | ||||
@TableField(fill = FieldFill.INSERT) | |||||
private Long createBy; | private Long createBy; | ||||
@TableField(fill = FieldFill.INSERT_UPDATE) | |||||
private Long updateBy; | private Long updateBy; | ||||
@TableField(fill = FieldFill.INSERT) | |||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
@TableField(fill = FieldFill.INSERT_UPDATE) | |||||
private LocalDateTime updateOn; | private LocalDateTime updateOn; | ||||
} | } |
@@ -1,5 +1,6 @@ | |||||
package com.ningdatech.pmapi.expert.model.req; | package com.ningdatech.pmapi.expert.model.req; | ||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; | |||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -30,7 +31,7 @@ public class ExpertReviewDetailReq { | |||||
@Valid | @Valid | ||||
@ApiModelProperty("配置模版") | @ApiModelProperty("配置模版") | ||||
@NotEmpty(message = "配置不能为空") | @NotEmpty(message = "配置不能为空") | ||||
private List<ReviewTemplateOptionVO> reviewTemplateOptions; | |||||
private List<ReviewTemplateOptionDTO> reviewTemplateOptions; | |||||
@ApiModelProperty("其他意见或建议") | @ApiModelProperty("其他意见或建议") | ||||
@NotEmpty(message = "其他意见或建议不能为空") | @NotEmpty(message = "其他意见或建议不能为空") | ||||
@@ -47,21 +48,4 @@ public class ExpertReviewDetailReq { | |||||
@NotNull(message = "是否是最终意见不能为空") | @NotNull(message = "是否是最终意见不能为空") | ||||
private Boolean isFinal; | private Boolean isFinal; | ||||
@Data | |||||
public static class ReviewTemplateOptionVO { | |||||
@ApiModelProperty("问题序号") | |||||
@NotNull(message = "问题序号不能为空") | |||||
private Integer questionSerialNo; | |||||
@ApiModelProperty("选项序号") | |||||
@NotEmpty(message = "选项序号不能为空") | |||||
private List<Integer> optionSerialNo; | |||||
@ApiModelProperty("其他意见或建议") | |||||
private String otherAdvice; | |||||
} | |||||
} | } |
@@ -0,0 +1,55 @@ | |||||
package com.ningdatech.pmapi.expert.model.vo; | |||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Builder; | |||||
import lombok.Data; | |||||
import lombok.experimental.Tolerate; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* ExpertReviewDetailVO | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 14:37 2023/2/15 | |||||
*/ | |||||
@Data | |||||
@Builder | |||||
public class ExpertReviewDetailVO { | |||||
@Tolerate | |||||
public ExpertReviewDetailVO() { | |||||
} | |||||
@ApiModelProperty("模版ID") | |||||
private Long templateId; | |||||
@ApiModelProperty("项目ID") | |||||
private Long projectId; | |||||
@ApiModelProperty("配置模版") | |||||
private List<ReviewTemplateOptionDTO> reviewTemplateOptions; | |||||
@ApiModelProperty("其他意见或建议") | |||||
private String otherAdvice; | |||||
@ApiModelProperty("附件ID") | |||||
private Long attachFileId; | |||||
@ApiModelProperty("评审结果:1 通过、2 需复核、3 不通过") | |||||
private Integer reviewResult; | |||||
@ApiModelProperty("是否是最终意见") | |||||
private Boolean isFinal; | |||||
@ApiModelProperty("评审时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("专家名称") | |||||
private String creator; | |||||
} |
@@ -4,6 +4,7 @@ import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo; | |||||
import com.wflow.workflow.bean.process.OrgUser; | import com.wflow.workflow.bean.process.OrgUser; | ||||
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum; | import com.wflow.workflow.bean.process.enums.ApprovalModeEnum; | ||||
import com.wflow.workflow.bean.process.enums.NodeTypeEnum; | import com.wflow.workflow.bean.process.enums.NodeTypeEnum; | ||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import com.wflow.workflow.enums.ProcessHandlerEnum; | import com.wflow.workflow.enums.ProcessHandlerEnum; | ||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import lombok.Builder; | import lombok.Builder; | ||||
@@ -47,7 +48,7 @@ public class ProgressNode { | |||||
/** | /** | ||||
* 节点相关人员 | * 节点相关人员 | ||||
*/ | */ | ||||
private OrgUser user; | |||||
private UserInfoVO user; | |||||
/** | /** | ||||
* 该节点动作操作类型 | * 该节点动作操作类型 | ||||
*/ | */ | ||||
@@ -0,0 +1,22 @@ | |||||
package com.ningdatech.pmapi.todocenter.bean.entity; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Data; | |||||
import lombok.NoArgsConstructor; | |||||
/** | |||||
* 发送工作通知所需信息 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/15 13:57 | |||||
*/ | |||||
@Data | |||||
@AllArgsConstructor | |||||
@NoArgsConstructor | |||||
public class WorkNoticeInfo { | |||||
private Long accountId; | |||||
private String organizationCode; | |||||
private String organizationName; | |||||
private String bizMsgId; | |||||
private String receiverUserId; | |||||
} |
@@ -1,11 +1,9 @@ | |||||
package com.ningdatech.pmapi.todocenter.bean.vo; | package com.ningdatech.pmapi.todocenter.bean.vo; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; | import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.wflow.workflow.bean.process.OrgUser; | |||||
import com.wflow.workflow.bean.process.form.Form; | import com.wflow.workflow.bean.process.form.Form; | ||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import lombok.Builder; | import lombok.Builder; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -62,15 +60,7 @@ public class ProcessProgressDetailVo { | |||||
/** | /** | ||||
* 发起人 | * 发起人 | ||||
*/ | */ | ||||
private OrgUser startTempUser; | |||||
/** | |||||
* 发起人 | |||||
*/ | |||||
private UserInfo startUser; | |||||
/** | |||||
* 发起人部门 | |||||
*/ | |||||
private String startDept; | |||||
private UserInfoVO startUser; | |||||
/** | /** | ||||
* 发起时间 | * 发起时间 | ||||
*/ | */ | ||||
@@ -1,8 +1,8 @@ | |||||
package com.ningdatech.pmapi.todocenter.bean.vo; | package com.ningdatech.pmapi.todocenter.bean.vo; | ||||
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; | import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.wflow.workflow.bean.process.OrgUser; | |||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import lombok.Builder; | import lombok.Builder; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -21,15 +21,21 @@ import java.util.Date; | |||||
@AllArgsConstructor | @AllArgsConstructor | ||||
@Builder | @Builder | ||||
public class ProgressNodeAuditInfoVo extends ProcessComment { | public class ProgressNodeAuditInfoVo extends ProcessComment { | ||||
@ApiModelProperty("评论ID") | |||||
private String id; | private String id; | ||||
@ApiModelProperty("评论") | |||||
private String type; | private String type; | ||||
@ApiModelProperty("任务ID") | |||||
private String taskId; | private String taskId; | ||||
@ApiModelProperty("评论类型") | |||||
private String commentType; | private String commentType; | ||||
private UserInfo user; | |||||
@ApiModelProperty("评论用户信息") | |||||
private UserInfoVO user; | |||||
@ApiModelProperty("评论时间") | |||||
private Date createTime; | private Date createTime; | ||||
} | } |
@@ -7,7 +7,8 @@ package com.ningdatech.pmapi.todocenter.constant; | |||||
public interface WorkNotice { | public interface WorkNotice { | ||||
public final String PASS_MSG_TEMPLATE = "标题:审核任务 内容:【%s】的【%s】需要您审核。"; | public final String PASS_MSG_TEMPLATE = "标题:审核任务 内容:【%s】的【%s】需要您审核。"; | ||||
public final String PASS_MSG_TEMPLATE2 = "【%s】已通过【%s】,请及时开始下一步操作。"; | public final String PASS_MSG_TEMPLATE2 = "【%s】已通过【%s】,请及时开始下一步操作。"; | ||||
public final String PASS_MSG_TEMPLATE3 = "【%s】的【%s】被退回,请及时处理。"; | |||||
public final String BACK_MSG_TEMPLATE = "【%s】的【%s】被退回,请及时处理。"; | |||||
public final String REJECT_MSG_TEMPLATE = "【%s】的【%s】被驳回,请及时处理。"; | |||||
} | } |
@@ -2,27 +2,29 @@ package com.ningdatech.pmapi.todocenter.manage; | |||||
import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||
import cn.hutool.core.util.StrUtil; | import cn.hutool.core.util.StrUtil; | ||||
import cn.hutool.json.JSONUtil; | |||||
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.basic.enumeration.Status; | |||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.NdDateUtils; | import com.ningdatech.basic.util.NdDateUtils; | ||||
import com.ningdatech.pmapi.common.constant.DingConstant; | |||||
import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; | import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum; | ||||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | ||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | import com.ningdatech.pmapi.common.util.ExcelDownUtil; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; | import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; | ||||
import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; | import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; | ||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | |||||
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; | import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; | ||||
import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo; | import com.ningdatech.pmapi.todocenter.bean.vo.ProgressNodeAuditInfoVo; | ||||
import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId; | import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId; | ||||
@@ -34,11 +36,10 @@ import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO; | |||||
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO; | import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO; | ||||
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedExportDTO; | import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedExportDTO; | ||||
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO; | import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO; | ||||
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageContent; | |||||
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageText; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | import com.ningdatech.pmapi.user.entity.UserInfo; | ||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import com.wflow.bean.do_.UserDo; | |||||
import com.ningdatech.zwdd.client.ZwddClient; | |||||
import com.wflow.bean.entity.WflowCcTasks; | import com.wflow.bean.entity.WflowCcTasks; | ||||
import com.wflow.bean.entity.WflowModelHistorys; | import com.wflow.bean.entity.WflowModelHistorys; | ||||
import com.wflow.bean.entity.WflowModels; | import com.wflow.bean.entity.WflowModels; | ||||
@@ -47,7 +48,6 @@ import com.wflow.mapper.WflowCcTasksMapper; | |||||
import com.wflow.mapper.WflowModelHistorysMapper; | import com.wflow.mapper.WflowModelHistorysMapper; | ||||
import com.wflow.service.OrgRepositoryService; | import com.wflow.service.OrgRepositoryService; | ||||
import com.wflow.utils.CodeUtil; | import com.wflow.utils.CodeUtil; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||||
import com.wflow.workflow.bean.process.OrgUser; | import com.wflow.workflow.bean.process.OrgUser; | ||||
import com.wflow.workflow.bean.process.ProcessNode; | import com.wflow.workflow.bean.process.ProcessNode; | ||||
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum; | import com.wflow.workflow.bean.process.enums.ApprovalModeEnum; | ||||
@@ -56,6 +56,7 @@ import com.wflow.workflow.bean.process.form.Form; | |||||
import com.wflow.workflow.bean.process.props.ApprovalProps; | import com.wflow.workflow.bean.process.props.ApprovalProps; | ||||
import com.wflow.workflow.bean.vo.ProcessInstanceVo; | import com.wflow.workflow.bean.vo.ProcessInstanceVo; | ||||
import com.wflow.workflow.bean.vo.ProcessTaskVo; | import com.wflow.workflow.bean.vo.ProcessTaskVo; | ||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import com.wflow.workflow.config.WflowGlobalVarDef; | import com.wflow.workflow.config.WflowGlobalVarDef; | ||||
import com.wflow.workflow.enums.ProcessHandlerEnum; | import com.wflow.workflow.enums.ProcessHandlerEnum; | ||||
import com.wflow.workflow.service.FormService; | import com.wflow.workflow.service.FormService; | ||||
@@ -82,8 +83,6 @@ import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; | |||||
import org.flowable.variable.api.history.HistoricVariableInstance; | import org.flowable.variable.api.history.HistoricVariableInstance; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import javax.annotation.Resource; | |||||
import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.time.format.DateTimeFormatter; | import java.time.format.DateTimeFormatter; | ||||
@@ -118,8 +117,9 @@ public class TodoCenterManage { | |||||
private final IUserInfoService userInfoService; | private final IUserInfoService userInfoService; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final StateMachineUtils stateMachineUtils; | private final StateMachineUtils stateMachineUtils; | ||||
// @Resource(name = "executableClient") | |||||
// private ExecutableClient client; | |||||
private final ZwddClient zwddClient; | |||||
private final IDingEmployeeInfoService dingEmployeeInfoService; | |||||
private final IDingOrganizationService dingOrganizationService; | |||||
/** | /** | ||||
* 待办中心待我处理项目列表查询 | * 待办中心待我处理项目列表查询 | ||||
@@ -177,31 +177,45 @@ public class TodoCenterManage { | |||||
// 从待办任务列表中取出当前登录用户及项目实例对应的任务 | // 从待办任务列表中取出当前登录用户及项目实例对应的任务 | ||||
Task task = taskMap.get(d.getInstCode()); | Task task = taskMap.get(d.getInstCode()); | ||||
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); | HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); | ||||
//HashSet<String> userSet = new HashSet<>(); | |||||
//userSet.add(instance.getStartUserId()) ; | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId()))); | |||||
UserInfoVO owner = new UserInfoVO(); | |||||
owner.setUserId(Long.valueOf(instance.getStartUserId())); | |||||
res.setOwner(owner); | |||||
// 从缓存取 | // 从缓存取 | ||||
staterUsers.add(String.valueOf(userId)); | staterUsers.add(String.valueOf(userId)); | ||||
ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) | |||||
.taskDefKey(task.getTaskDefinitionKey()).processDefId(task.getProcessDefinitionId()) | |||||
.executionId(task.getExecutionId()).nodeId(task.getTaskDefinitionKey()) | |||||
.deployId(instance.getDeploymentId()).processDefName(instance.getProcessDefinitionName()) | |||||
.version(instance.getProcessDefinitionVersion()).instanceId(task.getProcessInstanceId()) | |||||
.ownerId(instance.getStartUserId()).createTime(instance.getStartTime()) | |||||
.taskCreateTime(task.getCreateTime()).build(); | |||||
ProcessTaskVo processTaskVo = ProcessTaskVo.builder() | |||||
.taskId(task.getId()) | |||||
.taskName(task.getName()) | |||||
.taskDefKey(task.getTaskDefinitionKey()) | |||||
.processDefId(task.getProcessDefinitionId()) | |||||
.executionId(task.getExecutionId()) | |||||
.nodeId(task.getTaskDefinitionKey()) | |||||
.deployId(instance.getDeploymentId()) | |||||
.processDefName(instance.getProcessDefinitionName()) | |||||
.version(instance.getProcessDefinitionVersion()) | |||||
.instanceId(task.getProcessInstanceId()) | |||||
.ownerId(instance.getStartUserId()) | |||||
.createTime(instance.getStartTime()) | |||||
.taskCreateTime(task.getCreateTime()) | |||||
.build(); | |||||
res.setProcessTaskInfo(processTaskVo); | res.setProcessTaskInfo(processTaskVo); | ||||
return res; | return res; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
// 取用户信息,减少数据库查询,一次构建 | |||||
if (isNotEmpty(staterUsers)) { | |||||
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); | |||||
resVos.stream() | |||||
.peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) | |||||
.collect(Collectors.toList()); | |||||
// Map<Long,UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) | |||||
// .collect(Collectors.toList()); | |||||
} | |||||
if (isEmpty(resVos)) { | if (isEmpty(resVos)) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
// 取用户信息,减少数据库查询,一次构建 | |||||
List<ResToBeProcessedDTO> result = null; | |||||
if (isNotEmpty(staterUsers)) { | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
//result = resVos.stream() | |||||
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) | |||||
// .collect(Collectors.toList()); | |||||
} | |||||
// return PageVo.of(result, total); | |||||
return PageVo.of(resVos, total); | return PageVo.of(resVos, total); | ||||
} | } | ||||
@@ -365,24 +379,26 @@ public class TodoCenterManage { | |||||
Map<String, Object> var = new HashMap<>(16); | Map<String, Object> var = new HashMap<>(16); | ||||
var.put("approve_" + task.getId(), param.getAction()); | var.put("approve_" + task.getId(), param.getAction()); | ||||
// 保存审核意见 | // 保存审核意见 | ||||
if (hasComment(param.getAuditInfo())) { | if (hasComment(param.getAuditInfo())) { | ||||
// 执行自定义的保存评论的功能 | // 执行自定义的保存评论的功能 | ||||
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | ||||
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | ||||
} | } | ||||
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 | |||||
// 获取bpm对象 | // 获取bpm对象 | ||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | ||||
// 获取根节点即流程发起节点 | // 获取根节点即流程发起节点 | ||||
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | ||||
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 | |||||
// sendWorkNoticeToStartUser(task, projectName, rootNode); | |||||
// TODO 中止流程并使项目进入对应状态,给项目创建人、 | |||||
// 流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 | |||||
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); | |||||
// 获取浙政钉用户ID | |||||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); | |||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
WflowModels wflowModels = getLastWflowModels(task); | |||||
String formName = wflowModels.getFormName(); | |||||
String msg = String.format(REJECT_MSG_TEMPLATE, projectName, formName); | |||||
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | |||||
// 更新项目状态和流程状态 | // 更新项目状态和流程状态 | ||||
updateRejectProjectStatus(userId, declaredProject); | updateRejectProjectStatus(userId, declaredProject); | ||||
taskService.complete(param.getTaskId(), var); | taskService.complete(param.getTaskId(), var); | ||||
@@ -458,7 +474,6 @@ public class TodoCenterManage { | |||||
/** | /** | ||||
* 审批任务:通过 | * 审批任务:通过 | ||||
* | |||||
* @param task 当前任务 | * @param task 当前任务 | ||||
* @param userId | * @param userId | ||||
* @param param 参数 | * @param param 参数 | ||||
@@ -491,26 +506,25 @@ public class TodoCenterManage { | |||||
Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); | Task currentTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); | ||||
// 获取审核人信息,向审核人发送工作通知 | // 获取审核人信息,向审核人发送工作通知 | ||||
String currentUserId = currentTask.getAssignee(); | String currentUserId = currentTask.getAssignee(); | ||||
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); | |||||
// TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知 | |||||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(currentUserId)); | |||||
// 获取发送浙政钉工作通知必要信息 | |||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | ||||
// sendWorkNotice(auditUserInfo,msg); | |||||
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | |||||
return; | return; | ||||
} | } | ||||
// 获取bpm对象 | // 获取bpm对象 | ||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | ||||
// 若不是被退回项目,传节点定义key 获取当前节点 | // 若不是被退回项目,传节点定义key 获取当前节点 | ||||
FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); | FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); | ||||
// TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, | // TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, | ||||
// 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) | // 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) | ||||
// 需要先通过后才能有下一个节点的信息 | // 需要先通过后才能有下一个节点的信息 | ||||
taskService.complete(param.getTaskId(), var); | taskService.complete(param.getTaskId(), var); | ||||
String nextUserId = getNextUserId(currentNode, processInstanceId); | |||||
// 获取当前项目状态 | // 获取当前项目状态 | ||||
Integer status = declaredProject.getStatus(); | Integer status = declaredProject.getStatus(); | ||||
// 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | ||||
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | |||||
HistoricProcessInstance instance = historyService | HistoricProcessInstance instance = historyService | ||||
.createHistoricProcessInstanceQuery() | .createHistoricProcessInstanceQuery() | ||||
.processInstanceId(processInstanceId) | .processInstanceId(processInstanceId) | ||||
@@ -533,22 +547,63 @@ public class TodoCenterManage { | |||||
throw new IllegalStateException("Unexpected value: " + status); | throw new IllegalStateException("Unexpected value: " + status); | ||||
} | } | ||||
} | } | ||||
// 若有下一个审核人(当前节点的用户),向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 | |||||
// 若有下一个审核人(当前节点的用户), | |||||
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 | |||||
String nextUserId = getNextUserId(currentNode, processInstanceId); | |||||
if (Objects.nonNull(nextUserId)) { | if (Objects.nonNull(nextUserId)) { | ||||
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); | |||||
// TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知 | |||||
// 获取浙政钉用户ID | |||||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); | |||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | ||||
// sendWorkNotice(auditUserInfo,msg); | |||||
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | |||||
} else { | } else { | ||||
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | // 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | ||||
// TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 | // TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 | ||||
// 获取根节点即流程发起节点 | // 获取根节点即流程发起节点 | ||||
// FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | |||||
// sendPassWorkNoticeToStartUser(task, projectName, rootNode); | |||||
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | |||||
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); | |||||
// 获取浙政钉用户ID | |||||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); | |||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
WflowModels wflowModels = getLastWflowModels(task); | |||||
String formName = wflowModels.getFormName(); | |||||
String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); | |||||
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* 获取发送浙政钉工作通知的信息 | |||||
* @param auditUserInfo | |||||
* @return com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo | |||||
* @author CMM | |||||
* @since 2023/02/15 14:04 | |||||
*/ | |||||
private WorkNoticeInfo getSendWorkNoticeInfo(UserInfo auditUserInfo) { | |||||
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); | |||||
Long accountId = auditUserInfo.getAccountId(); | |||||
if (Objects.isNull(accountId)){ | |||||
throw new BizException("该用户没有录入浙政钉信息!"); | |||||
} | |||||
workNoticeInfo.setAccountId(accountId); | |||||
// 根据浙政钉用户ID获取部门code | |||||
DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getId, accountId)); | |||||
String organizationCode = employeeInfo.getOrganizationCode(); | |||||
workNoticeInfo.setOrganizationCode(organizationCode); | |||||
// 根据部门code获取部门名称 | |||||
DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||||
.eq(DingOrganization::getOrganizationCode, organizationCode)); | |||||
String organizationName = dingOrganization.getOrganizationName(); | |||||
workNoticeInfo.setOrganizationName(organizationName); | |||||
// 构建唯一的消息ID | |||||
String bizMsgId = "ZD_WORK_NOTICE_" + "_" + organizationCode + "_" + organizationName + accountId; | |||||
workNoticeInfo.setBizMsgId(bizMsgId); | |||||
String receiverUserId = String.valueOf(accountId); | |||||
workNoticeInfo.setReceiverUserId(receiverUserId); | |||||
return workNoticeInfo; | |||||
} | |||||
/** | |||||
* 当为通过操作时,更新项目表中项目状态 | * 当为通过操作时,更新项目表中项目状态 | ||||
* | * | ||||
* @param userId | * @param userId | ||||
@@ -577,26 +632,6 @@ public class TodoCenterManage { | |||||
} | } | ||||
/** | /** | ||||
* 给流程发起人发送工作通知 | |||||
* | |||||
* @param task 当前任务 | |||||
* @param projectName 项目名称 | |||||
* @param rootNode 流程发起节点 | |||||
* @return void | |||||
* @author CMM | |||||
* @since 2023/02/03 | |||||
*/ | |||||
private void sendPassWorkNoticeToStartUser(Task task, String projectName, FlowNode rootNode) { | |||||
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); | |||||
UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); | |||||
// 从历史表获取最新版本的流程 | |||||
WflowModels wflowModels = getLastWflowModels(task); | |||||
String formName = wflowModels.getFormName(); | |||||
String msg = String.format(PASS_MSG_TEMPLATE2, projectName, formName); | |||||
sendWorkNotice(startUserInfo, msg); | |||||
} | |||||
/** | |||||
* 获取流程发起节点的用户ID | * 获取流程发起节点的用户ID | ||||
* | * | ||||
* @param rootNode 根节点 | * @param rootNode 根节点 | ||||
@@ -627,7 +662,6 @@ public class TodoCenterManage { | |||||
return rootUserId; | return rootUserId; | ||||
} | } | ||||
/** | /** | ||||
* 获取当前节点的下一个节点的审核用户ID | * 获取当前节点的下一个节点的审核用户ID | ||||
* | * | ||||
@@ -677,44 +711,6 @@ public class TodoCenterManage { | |||||
} | } | ||||
/** | /** | ||||
* 发送浙政钉工作通知 | |||||
* | |||||
* @param auditUserInfo 审核人信息 | |||||
* @param msg 要发送的工作通知 | |||||
* @return void | |||||
* @author CMM | |||||
* @since 2023/02/01 | |||||
*/ | |||||
private void sendWorkNotice(UserInfo auditUserInfo, String msg) { | |||||
// TODO 获取浙政钉唯一标识 | |||||
// String dingKey = null; | |||||
// IntelligentGetClient intelligentGetClient = client.newIntelligentGetClient(DingConstant.WORKING_NOTICE); | |||||
// OapiMessageWorkNotificationRequest request = new OapiMessageWorkNotificationRequest(); | |||||
// // 消息体(参考下文示例消息格式) | |||||
// MessageText messageText = new MessageText(); | |||||
// messageText.setMsgType("text"); | |||||
// MessageContent messageContent = new MessageContent(); | |||||
// | |||||
// messageContent.setContent(msg); | |||||
// messageText.setText(messageContent); | |||||
// request.setMsg(JSONUtil.toJsonStr(messageText)); | |||||
// // 构建唯一的消息ID | |||||
// // String bizMsgId = "ZB_URGE_NOTICE_" + "_" + auditUserInfo.getDeptId() + "_" + auditUserInfo.getUserId(); | |||||
// // request.setBizMsgId(bizMsgId); | |||||
// request.setBizMsgId(null); | |||||
// // 租户id | |||||
// // request.setTenantId(GovDingProperties.tenantId.toString()); | |||||
// request.setReceiverIds(dingKey); | |||||
// // 获取结果 | |||||
// OapiMessageWorkNotificationResponse apiResult = intelligentGetClient.get(request); | |||||
// if (!apiResult.getSuccess() || !JSONUtil.parseObj(apiResult.getContent()).getBool("success")) { | |||||
// log.warn("发送工作通知失败: {}", apiResult.getContent()); | |||||
// throw new BizException(Status.BAD_REQUEST.toString()); | |||||
// } | |||||
} | |||||
/** | |||||
* 撤销流程处理 | * 撤销流程处理 | ||||
* | * | ||||
* @param handledTaskInstance 已处理的历史任务实例 | * @param handledTaskInstance 已处理的历史任务实例 | ||||
@@ -819,8 +815,6 @@ public class TodoCenterManage { | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* 当为撤回操作时,更新项目表中的项目状态为前一个状态 | * 当为撤回操作时,更新项目表中的项目状态为前一个状态 | ||||
* | * | ||||
@@ -861,20 +855,18 @@ public class TodoCenterManage { | |||||
Project declaredProject = projectService | Project declaredProject = projectService | ||||
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | ||||
String projectName = declaredProject.getProjectName(); | String projectName = declaredProject.getProjectName(); | ||||
// 保存审核意见 | // 保存审核意见 | ||||
if (hasComment(param.getAuditInfo())) { | if (hasComment(param.getAuditInfo())) { | ||||
// 执行自定义的保存评论的功能 | // 执行自定义的保存评论的功能 | ||||
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | ||||
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | ||||
} | } | ||||
// 获取bpm对象 | // 获取bpm对象 | ||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | ||||
// 传节点定义key 获取根节点即流程发起节点 | // 传节点定义key 获取根节点即流程发起节点 | ||||
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | ||||
// TODO 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, | |||||
// 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录, | |||||
// 执行自定义回退逻辑,回退到流程发起人 | // 执行自定义回退逻辑,回退到流程发起人 | ||||
// 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新 | // 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新 | ||||
managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId())); | managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId())); | ||||
@@ -889,40 +881,26 @@ public class TodoCenterManage { | |||||
declaredProject.setUpdateBy(userId); | declaredProject.setUpdateBy(userId); | ||||
projectService.updateById(declaredProject); | projectService.updateById(declaredProject); | ||||
// TODO 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 | // TODO 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 | ||||
// sendBackWorkNoticeToStartUser(task, projectName, rootNode); | |||||
} | |||||
/** | |||||
* 给流程发起人发送流程退回工作通知 | |||||
* | |||||
* @param task | |||||
* @param projectName | |||||
* @param rootNode | |||||
* @return void | |||||
* @author CMM | |||||
* @since 2023/02/14 15:32 | |||||
*/ | |||||
private void sendBackWorkNoticeToStartUser(Task task, String projectName, FlowNode rootNode) { | |||||
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); | String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); | ||||
UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); | |||||
// 从历史表获取最新版本的流程 | |||||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(startUserId)); | |||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
WflowModels wflowModels = getLastWflowModels(task); | WflowModels wflowModels = getLastWflowModels(task); | ||||
String formName = wflowModels.getFormName(); | String formName = wflowModels.getFormName(); | ||||
String msg = String.format(PASS_MSG_TEMPLATE3, projectName, formName); | |||||
sendWorkNotice(startUserInfo, msg); | |||||
String msg = String.format(BACK_MSG_TEMPLATE, projectName, formName); | |||||
zwddClient.sendWorkNotice(sendWorkNoticeInfo.getReceiverUserId(),sendWorkNoticeInfo.getBizMsgId(),msg); | |||||
} | } | ||||
/** | /** | ||||
* 查询流程表单数据及审批的进度步骤 | * 查询流程表单数据及审批的进度步骤 | ||||
* | |||||
* @param nodeId 当前获取流程人员关联的流程节点ID | * @param nodeId 当前获取流程人员关联的流程节点ID | ||||
* @param instanceId 流程实例ID | * @param instanceId 流程实例ID | ||||
* @return 流程进度及表单详情 | * @return 流程进度及表单详情 | ||||
*/ | */ | ||||
public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId) { | public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId) { | ||||
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | ||||
.processInstanceId(instanceId).singleResult(); | |||||
.processInstanceId(instanceId) | |||||
.singleResult(); | |||||
// 取表单及表单数据 | // 取表单及表单数据 | ||||
HistoricVariableInstance forms = historyService.createHistoricVariableInstanceQuery() | HistoricVariableInstance forms = historyService.createHistoricVariableInstanceQuery() | ||||
.processInstanceId(instanceId) | .processInstanceId(instanceId) | ||||
@@ -933,7 +911,9 @@ public class TodoCenterManage { | |||||
List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list(); | List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery().processInstanceId(instanceId).list(); | ||||
formDatas = historyService | formDatas = historyService | ||||
.createHistoricVariableInstanceQuery() | .createHistoricVariableInstanceQuery() | ||||
.executionIds(historicTaskInstances.stream().map(HistoricTaskInstance::getExecutionId).collect(Collectors.toSet())) | |||||
.executionIds(historicTaskInstances.stream() | |||||
.map(HistoricTaskInstance::getExecutionId) | |||||
.collect(Collectors.toSet())) | |||||
.processInstanceId(instanceId) | .processInstanceId(instanceId) | ||||
.list(); | .list(); | ||||
} else { | } else { | ||||
@@ -949,15 +929,17 @@ public class TodoCenterManage { | |||||
ProcessNode<?> currentNode = null; | ProcessNode<?> currentNode = null; | ||||
if (StrUtil.isNotBlank(nodeId)) { | if (StrUtil.isNotBlank(nodeId)) { | ||||
// 搜索当前版本流程的配置 | // 搜索当前版本流程的配置 | ||||
WflowModelHistorys modelHistory = modelHistorysMapper.selectOne( | |||||
new QueryWrapper<>(WflowModelHistorys.builder().processDefId(instance.getProcessDefinitionId()) | |||||
.version(instance.getProcessDefinitionVersion()).build())); | |||||
WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder() | |||||
.processDefId(instance.getProcessDefinitionId()) | |||||
.version(instance.getProcessDefinitionVersion()) | |||||
.build())); | |||||
currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId); | currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId); | ||||
} | } | ||||
UserDo users = orgRepositoryService.getUserById(instance.getStartUserId()); | |||||
OrgUser startUser = | |||||
OrgUser.builder().id(users.getUserId()).name(users.getUserName()).avatar(users.getAvatar()).build(); | |||||
//UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId())); | |||||
//HashSet<String> userSet = new HashSet<>(); | |||||
//userSet.add(String.valueOf(userInfo.getId())); | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
//UserInfoVO userInfoVO = userMap.get(userInfo.getId()); | |||||
List<ProgressNode> taskRecords = getHisTaskRecords(instanceId, nodePropsValue); | List<ProgressNode> taskRecords = getHisTaskRecords(instanceId, nodePropsValue); | ||||
// 获取添加抄送任务 | // 获取添加抄送任务 | ||||
taskRecords.addAll(getCcTaskRecords(instanceId)); | taskRecords.addAll(getCcTaskRecords(instanceId)); | ||||
@@ -965,27 +947,32 @@ public class TodoCenterManage { | |||||
// TODO 下版实现 获取等待中且还未开始的任务,如果存在条件则需要直接解析条件 | // TODO 下版实现 获取等待中且还未开始的任务,如果存在条件则需要直接解析条件 | ||||
taskRecords.addAll(getFutureTask(instanceId)); | taskRecords.addAll(getFutureTask(instanceId)); | ||||
} | } | ||||
taskRecords = | |||||
taskRecords.stream().sorted(Comparator.comparing(ProgressNode::getStartTime)).collect(Collectors.toList()); | |||||
taskRecords.add(0, | |||||
ProgressNode.builder().nodeId("root").name("提交申请").user(startUser).nodeType(NodeTypeEnum.ROOT) | |||||
.startTime(instance.getStartTime()).finishTime(instance.getStartTime()).taskId("root") | |||||
.result(ProcessHandlerEnum.PASS).build()); | |||||
taskRecords = taskRecords.stream() | |||||
.sorted(Comparator.comparing(ProgressNode::getStartTime)) | |||||
.collect(Collectors.toList()); | |||||
taskRecords.add(0, ProgressNode.builder() | |||||
.nodeId("root") | |||||
.name("提交申请") | |||||
//.user(userInfoVO) | |||||
.nodeType(NodeTypeEnum.ROOT) | |||||
.startTime(instance.getStartTime()) | |||||
.finishTime(instance.getStartTime()) | |||||
.taskId("root") | |||||
.result(ProcessHandlerEnum.PASS).build()); | |||||
// 提取全量表单数据 | // 提取全量表单数据 | ||||
Map<String, Object> formData = | |||||
formDatas.stream().filter(CodeUtil.distinctByKey(HistoricVariableInstance::getVariableName)).collect( | |||||
Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue)); | |||||
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery() | |||||
.processInstanceId(instanceId).variableName("owner").singleResult(); | |||||
ProcessInstanceUserDto owner = (ProcessInstanceUserDto) variableInstance.getValue(); | |||||
ProcessProgressDetailVo res = ProcessProgressDetailVo.builder().instanceId(instanceId) | |||||
Map<String, Object> formData = formDatas.stream() | |||||
.filter(CodeUtil.distinctByKey(HistoricVariableInstance::getVariableName)) | |||||
.collect(Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue)); | |||||
ProcessProgressDetailVo res = ProcessProgressDetailVo.builder() | |||||
.instanceId(instanceId) | |||||
.version(instance.getProcessDefinitionVersion()) | .version(instance.getProcessDefinitionVersion()) | ||||
.formItems(formService.filterFormAndDataByPermConfig((List<Form>) forms.getValue(), formData, currentNode)) | .formItems(formService.filterFormAndDataByPermConfig((List<Form>) forms.getValue(), formData, currentNode)) | ||||
.formData(formData).processDefName(instance.getProcessDefinitionName()).startTempUser(startUser) | |||||
.startDept(null == owner ? null : owner.getOrgName()).result(instance.getEndActivityId()) | |||||
.startTime(instance.getStartTime()).progress(taskRecords).build(); | |||||
// UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId())); | |||||
// res.setStartUser(userInfo); | |||||
.formData(formData).processDefName(instance.getProcessDefinitionName()) | |||||
.result(instance.getEndActivityId()) | |||||
.startTime(instance.getStartTime()) | |||||
.progress(taskRecords) | |||||
.build(); | |||||
//res.setStartUser(userInfoVO); | |||||
if (Objects.isNull(instance.getEndActivityId())) { | if (Objects.isNull(instance.getEndActivityId())) { | ||||
res.setStatus(ProcessStatusEnum.UNDER_REVIEW.name()); | res.setStatus(ProcessStatusEnum.UNDER_REVIEW.name()); | ||||
} else if (HisProInsEndActId.BACK.equals(instance.getEndActivityId())) { | } else if (HisProInsEndActId.BACK.equals(instance.getEndActivityId())) { | ||||
@@ -1007,16 +994,21 @@ public class TodoCenterManage { | |||||
*/ | */ | ||||
private List<ProgressNode> getCcTaskRecords(String instanceId) { | private List<ProgressNode> getCcTaskRecords(String instanceId) { | ||||
Set<String> ccUsers = new HashSet<>(); | Set<String> ccUsers = new HashSet<>(); | ||||
List<ProgressNode> ccList = ccTasksMapper | |||||
.selectList(new QueryWrapper<WflowCcTasks>().eq("instance_id", instanceId)).stream().map(task -> { | |||||
List<ProgressNode> ccList = ccTasksMapper.selectList(new QueryWrapper<WflowCcTasks>() | |||||
.eq("instance_id", instanceId)) | |||||
.stream() | |||||
.map(task -> { | |||||
ccUsers.add(task.getUserId()); | ccUsers.add(task.getUserId()); | ||||
return ProgressNode.builder().nodeId(task.getNodeId()).nodeType(NodeTypeEnum.CC) | return ProgressNode.builder().nodeId(task.getNodeId()).nodeType(NodeTypeEnum.CC) | ||||
.name(task.getNodeName()).user(OrgUser.builder().id(task.getUserId()).build()) | |||||
.startTime(task.getCreateTime()).finishTime(task.getCreateTime()).build(); | |||||
.name(task.getNodeName()) | |||||
.user(UserInfoVO.builder().userId(Long.valueOf(task.getUserId())).build()) | |||||
.startTime(task.getCreateTime()) | |||||
.finishTime(task.getCreateTime()) | |||||
.build(); | |||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
if (isNotEmpty(ccUsers)) { | if (isNotEmpty(ccUsers)) { | ||||
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(ccUsers); | |||||
ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getId()))).collect(Collectors.toList()); | |||||
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(ccUsers); | |||||
ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList()); | |||||
} | } | ||||
return ccList; | return ccList; | ||||
} | } | ||||
@@ -1033,20 +1025,25 @@ public class TodoCenterManage { | |||||
.processInstanceId(instanceId).orderByHistoricActivityInstanceStartTime().asc().list(); | .processInstanceId(instanceId).orderByHistoricActivityInstanceStartTime().asc().list(); | ||||
Set<String> userSet = new HashSet<>(); | Set<String> userSet = new HashSet<>(); | ||||
// 获取节点处理结果 | // 获取节点处理结果 | ||||
Map<String, | |||||
ProcessHandlerEnum> varMap = historyService.createHistoricVariableInstanceQuery() | |||||
.processInstanceId(instanceId).variableNameLike("approve_%").list().stream().collect( | |||||
Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); | |||||
Map<String, ProcessHandlerEnum> varMap = historyService.createHistoricVariableInstanceQuery() | |||||
.processInstanceId(instanceId) | |||||
.variableNameLike("approve_%") | |||||
.list().stream() | |||||
.collect(Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); | |||||
Map<String, List<ProgressNodeAuditInfoVo>> commentMap = new HashMap<>(); | Map<String, List<ProgressNodeAuditInfoVo>> commentMap = new HashMap<>(); | ||||
// 统一处理所有评论数据,省的多次查询 | // 统一处理所有评论数据,省的多次查询 | ||||
List<ProgressNodeAuditInfoVo> cmvos = | |||||
taskService.getProcessInstanceComments(instanceId).stream().map(comment -> { | |||||
List<ProgressNodeAuditInfoVo> cmvos = taskService.getProcessInstanceComments(instanceId).stream() | |||||
.map(comment -> { | |||||
userSet.add(comment.getUserId()); | userSet.add(comment.getUserId()); | ||||
ProgressNodeAuditInfoVo progressNodeAuditInfoVo = | |||||
ProgressNodeAuditInfoVo.builder().id(comment.getId()).taskId(comment.getTaskId()) | |||||
.commentType(comment.getType()).type("COMMENT").createTime(comment.getTime()) | |||||
.user(UserInfo.builder().id(Long.valueOf(comment.getUserId())).build()).build(); | |||||
ProgressNodeAuditInfoVo progressNodeAuditInfoVo = ProgressNodeAuditInfoVo.builder() | |||||
.id(comment.getId()) | |||||
.taskId(comment.getTaskId()) | |||||
.commentType(comment.getType()) | |||||
.type("COMMENT") | |||||
.createTime(comment.getTime()) | |||||
.user(UserInfoVO.builder().userId(Long.valueOf(comment.getUserId())).build()) | |||||
.build(); | |||||
ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); | ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); | ||||
progressNodeAuditInfoVo.setText(processComment.getText()); | progressNodeAuditInfoVo.setText(processComment.getText()); | ||||
progressNodeAuditInfoVo.setAttachments(processComment.getAttachments()); | progressNodeAuditInfoVo.setAttachments(processComment.getAttachments()); | ||||
@@ -1061,23 +1058,29 @@ public class TodoCenterManage { | |||||
// 再将评论按照任务一次构建,方便取出 | // 再将评论按照任务一次构建,方便取出 | ||||
Map<String, ProgressNodeAuditInfoVo> commentsMap = | Map<String, ProgressNodeAuditInfoVo> commentsMap = | ||||
cmvos.stream().collect(Collectors.toMap(ProgressNodeAuditInfoVo::getTaskId, c -> c)); | cmvos.stream().collect(Collectors.toMap(ProgressNodeAuditInfoVo::getTaskId, c -> c)); | ||||
List<ProgressNode> progressNodes = | |||||
list.stream().filter(his -> ObjectUtil.isNotNull(his.getTaskId())).map(his -> { | |||||
List<ProgressNode> progressNodes = list.stream().filter(his -> ObjectUtil.isNotNull(his.getTaskId())) | |||||
.map(his -> { | |||||
Object props = nodeProps.get(his.getActivityId()); | Object props = nodeProps.get(his.getActivityId()); | ||||
ApprovalModeEnum approvalMode = null; | ApprovalModeEnum approvalMode = null; | ||||
if (props instanceof ApprovalProps) { | if (props instanceof ApprovalProps) { | ||||
approvalMode = ((ApprovalProps) props).getMode(); | approvalMode = ((ApprovalProps) props).getMode(); | ||||
} | } | ||||
userSet.add(his.getAssignee()); | userSet.add(his.getAssignee()); | ||||
return ProgressNode.builder().nodeId(his.getActivityId()).name(his.getActivityName()) | |||||
.nodeType(NodeTypeEnum.APPROVAL).user(OrgUser.builder().id(his.getAssignee()).build()) | |||||
.startTime(his.getStartTime()).finishTime(his.getEndTime()).taskId(his.getTaskId()) | |||||
.approvalMode(approvalMode).auditInfo(commentsMap.get(his.getTaskId())) | |||||
return ProgressNode.builder() | |||||
.nodeId(his.getActivityId()) | |||||
.name(his.getActivityName()) | |||||
.nodeType(NodeTypeEnum.APPROVAL) | |||||
.user(UserInfoVO.builder().userId(Long.valueOf(his.getAssignee())).build()) | |||||
.startTime(his.getStartTime()) | |||||
.finishTime(his.getEndTime()) | |||||
.taskId(his.getTaskId()) | |||||
.approvalMode(approvalMode) | |||||
.auditInfo(commentsMap.get(his.getTaskId())) | |||||
.result(varMap.get("approve_" + his.getTaskId())).build(); | .result(varMap.get("approve_" + his.getTaskId())).build(); | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
if (isNotEmpty(userSet)) { | if (isNotEmpty(userSet)) { | ||||
Map<String, OrgUser> map = userDeptOrLeaderService.getUserMapByIds(userSet); | |||||
progressNodes.forEach(n -> n.setUser(map.get(n.getUser().getId()))); | |||||
Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
progressNodes.stream().peek(v -> v.setUser(userMap.get(v.getUser().getUserId()))).collect(Collectors.toList()); | |||||
} | } | ||||
return progressNodes; | return progressNodes; | ||||
} | } | ||||
@@ -1158,6 +1161,13 @@ public class TodoCenterManage { | |||||
// 从已处理任务实例列表中取出当前登录用户及项目实例对应的任务实例 | // 从已处理任务实例列表中取出当前登录用户及项目实例对应的任务实例 | ||||
HistoricTaskInstance task = taskInstanceMap.get(d.getInstCode()); | HistoricTaskInstance task = taskInstanceMap.get(d.getInstCode()); | ||||
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); | HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); | ||||
//HashSet<String> userSet = new HashSet<>(); | |||||
//userSet.add(instance.getStartUserId()) ; | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
//res.setOwner(userMap.get(Long.valueOf(instance.getStartUserId()))); | |||||
UserInfoVO owner = new UserInfoVO(); | |||||
owner.setUserId(Long.valueOf(instance.getStartUserId())); | |||||
res.setOwner(owner); | |||||
// 从缓存取 | // 从缓存取 | ||||
staterUsers.add(instance.getStartUserId()); | staterUsers.add(instance.getStartUserId()); | ||||
ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) | ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) | ||||
@@ -1170,19 +1180,18 @@ public class TodoCenterManage { | |||||
res.setProcessTaskInfo(processTaskVo); | res.setProcessTaskInfo(processTaskVo); | ||||
return res; | return res; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
// 取用户信息,减少数据库查询,一次构建 | |||||
if (isNotEmpty(staterUsers)) { | |||||
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); | |||||
resVos.stream() | |||||
.peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) | |||||
.collect(Collectors.toList()); | |||||
// Map<Long,UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) | |||||
// .collect(Collectors.toList()); | |||||
} | |||||
if (isEmpty(resVos)) { | if (isEmpty(resVos)) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
} | } | ||||
// 取用户信息,减少数据库查询,一次构建 | |||||
List<ResToBeProcessedDTO> result = null; | |||||
if (isNotEmpty(staterUsers)) { | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
//result = resVos.stream().peek(v -> v.getProcessTaskInfo() | |||||
// .setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) | |||||
// .collect(Collectors.toList()); | |||||
} | |||||
// return PageVo.of(result, total); | |||||
return PageVo.of(resVos, total); | return PageVo.of(resVos, total); | ||||
} | } | ||||
@@ -1335,24 +1344,30 @@ public class TodoCenterManage { | |||||
res.setProcessLaunchTime(launchTime); | res.setProcessLaunchTime(launchTime); | ||||
HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); | HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); | ||||
staterUsers.add(ist.getStartUserId()); | staterUsers.add(ist.getStartUserId()); | ||||
//HashSet<String> userSet = new HashSet<>(); | |||||
//userSet.add(instance.getStartUserId()) ; | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId()))); | |||||
UserInfoVO owner = new UserInfoVO(); | |||||
owner.setUserId(Long.valueOf(ist.getStartUserId())); | |||||
res.setOwner(owner); | |||||
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); | ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); | ||||
res.setProcessInstanceInfo(processInstanceVo); | res.setProcessInstanceInfo(processInstanceVo); | ||||
return res; | return res; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
if (isEmpty(resVos)) { | |||||
return PageVo.empty(); | |||||
} | |||||
// 取用户信息,减少数据库查询,一次构建 | |||||
List<ResToBeProcessedDTO> result = null; | |||||
if (isNotEmpty(staterUsers)) { | if (isNotEmpty(staterUsers)) { | ||||
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); | |||||
resVos.stream().map(v -> { | |||||
v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); | |||||
return v; | |||||
}).collect(Collectors.toList()); | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
//result = resVos.stream() | |||||
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) | |||||
// .collect(Collectors.toList()); | |||||
} | } | ||||
// if (CollectionUtil.isNotEmpty(staterUsers)) { | |||||
// Map<Long, UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
// resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) | |||||
// .collect(Collectors.toList()); | |||||
// } | |||||
// return PageVo.of(result, total); | |||||
return PageVo.of(resVos, total); | return PageVo.of(resVos, total); | ||||
} | } | ||||
@@ -1552,24 +1567,29 @@ public class TodoCenterManage { | |||||
res.setProcessLaunchTime(launchTime); | res.setProcessLaunchTime(launchTime); | ||||
HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); | HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); | ||||
staterUsers.add(ist.getStartUserId()); | staterUsers.add(ist.getStartUserId()); | ||||
//HashSet<String> userSet = new HashSet<>(); | |||||
//userSet.add(instance.getStartUserId()) ; | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(userSet); | |||||
//res.setOwner(userMap.get(Long.valueOf(ist.getStartUserId()))); | |||||
UserInfoVO owner = new UserInfoVO(); | |||||
owner.setUserId(Long.valueOf(ist.getStartUserId())); | |||||
res.setOwner(owner); | |||||
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); | ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); | ||||
res.setProcessInstanceInfo(processInstanceVo); | res.setProcessInstanceInfo(processInstanceVo); | ||||
return res; | return res; | ||||
}).collect(Collectors.toList()); | }).collect(Collectors.toList()); | ||||
if (isEmpty(resVos)) { | |||||
return PageVo.empty(); | |||||
} | |||||
// 取用户信息,减少数据库查询,一次构建 | |||||
List<ResToBeProcessedDTO> result = null; | |||||
if (isNotEmpty(staterUsers)) { | if (isNotEmpty(staterUsers)) { | ||||
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); | |||||
resVos.stream().map(v -> { | |||||
v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId())); | |||||
return v; | |||||
}).collect(Collectors.toList()); | |||||
//Map<Long, UserInfoVO> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
//result = resVos.stream() | |||||
// .peek(v -> v.getProcessTaskInfo().setStartUser(userMap.get(Long.valueOf(v.getProcessTaskInfo().getOwnerId())))) | |||||
// .collect(Collectors.toList()); | |||||
} | } | ||||
// if (CollectionUtil.isNotEmpty(staterUsers)) { | |||||
// Map<Long, UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers); | |||||
// resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) | |||||
// .collect(Collectors.toList()); | |||||
// } | |||||
// return PageVo.of(result, total); | |||||
return PageVo.of(resVos, total); | return PageVo.of(resVos, total); | ||||
} | } | ||||
@@ -1,20 +1,18 @@ | |||||
package com.ningdatech.pmapi.todocenter.model.dto.res; | package com.ningdatech.pmapi.todocenter.model.dto.res; | ||||
import java.io.Serializable; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | import com.fasterxml.jackson.annotation.JsonFormat; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.wflow.workflow.bean.vo.ProcessInstanceVo; | import com.wflow.workflow.bean.vo.ProcessInstanceVo; | ||||
import com.wflow.workflow.bean.vo.ProcessTaskVo; | import com.wflow.workflow.bean.vo.ProcessTaskVo; | ||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import java.io.Serializable; | |||||
import java.math.BigDecimal; | |||||
import java.time.LocalDateTime; | |||||
/** | /** | ||||
* 待办中心-待我处理返回实体信息 | * 待办中心-待我处理返回实体信息 | ||||
@@ -71,5 +69,5 @@ public class ResToBeProcessedDTO implements Serializable { | |||||
private ProcessInstanceVo processInstanceInfo; | private ProcessInstanceVo processInstanceInfo; | ||||
@ApiModelProperty("流程发起人信息") | @ApiModelProperty("流程发起人信息") | ||||
private UserInfo owner; | |||||
private UserInfoVO owner; | |||||
} | } |
@@ -1,13 +0,0 @@ | |||||
package com.ningdatech.pmapi.todocenter.zwdd.model; | |||||
import lombok.Data; | |||||
/** | |||||
* 消息内容 | |||||
* @author CMM | |||||
* @since 2023/02/01 14:54 | |||||
*/ | |||||
@Data | |||||
public class MessageContent { | |||||
private String content; | |||||
} |
@@ -1,17 +0,0 @@ | |||||
package com.ningdatech.pmapi.todocenter.zwdd.model; | |||||
import lombok.Data; | |||||
/** | |||||
* 文本消息 | |||||
* @author CMM | |||||
* @since 2023/02/01 14:53 | |||||
*/ | |||||
@Data | |||||
public class MessageText { | |||||
private String msgType; | |||||
private MessageContent text; | |||||
} |
@@ -11,22 +11,18 @@ import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | |||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Controller; | |||||
import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||
import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | ||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
import org.springframework.web.bind.annotation.RestController; | |||||
import javax.validation.Valid; | import javax.validation.Valid; | ||||
/** | /** | ||||
* <p> | |||||
* 用户信息表 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | * @author Liuxinxin | ||||
* @since 2023-01-04 | * @since 2023-01-04 | ||||
*/ | */ | ||||
@Controller | |||||
@RestController | |||||
@RequestMapping("/api/v1/user-info") | @RequestMapping("/api/v1/user-info") | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
@Api(value = "UserInfoController", tags = "用户管理") | @Api(value = "UserInfoController", tags = "用户管理") | ||||
@@ -40,10 +36,10 @@ public class UserInfoController { | |||||
return userInfoManage.list(reqUserInfoListPO); | return userInfoManage.list(reqUserInfoListPO); | ||||
} | } | ||||
@ApiOperation(value = "用户禁用", notes = "用户禁用") | |||||
@PostMapping("/disable") | |||||
public void disable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO) { | |||||
userInfoManage.disable(reqUserDisablePO); | |||||
@ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用") | |||||
@PostMapping("/disable-enable") | |||||
public void disableOrEnable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO) { | |||||
userInfoManage.disableOrEnable(reqUserDisablePO); | |||||
} | } | ||||
@ApiOperation(value = "用户详情", notes = "用户详情") | @ApiOperation(value = "用户详情", notes = "用户详情") | ||||
@@ -1,99 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
@TableName("nd_user_auth") | |||||
@ApiModel(value = "NdUserAuth对象", description = "") | |||||
public class NdUserAuth implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private Long userId; | |||||
private String authType; | |||||
private String identifier; | |||||
private String credential; | |||||
public Long getId() { | |||||
return id; | |||||
} | |||||
public void setId(Long id) { | |||||
this.id = id; | |||||
} | |||||
public LocalDateTime getCreateOn() { | |||||
return createOn; | |||||
} | |||||
public void setCreateOn(LocalDateTime createOn) { | |||||
this.createOn = createOn; | |||||
} | |||||
public LocalDateTime getUpdateOn() { | |||||
return updateOn; | |||||
} | |||||
public void setUpdateOn(LocalDateTime updateOn) { | |||||
this.updateOn = updateOn; | |||||
} | |||||
public Long getUserId() { | |||||
return userId; | |||||
} | |||||
public void setUserId(Long userId) { | |||||
this.userId = userId; | |||||
} | |||||
public String getAuthType() { | |||||
return authType; | |||||
} | |||||
public void setAuthType(String authType) { | |||||
this.authType = authType; | |||||
} | |||||
public String getIdentifier() { | |||||
return identifier; | |||||
} | |||||
public void setIdentifier(String identifier) { | |||||
this.identifier = identifier; | |||||
} | |||||
public String getCredential() { | |||||
return credential; | |||||
} | |||||
public void setCredential(String credential) { | |||||
this.credential = credential; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return "NdUserAuth{" + | |||||
"id=" + id + | |||||
", createOn=" + createOn + | |||||
", updateOn=" + updateOn + | |||||
", userId=" + userId + | |||||
", authType=" + authType + | |||||
", identifier=" + identifier + | |||||
", credential=" + credential + | |||||
"}"; | |||||
} | |||||
} |
@@ -1,109 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
@TableName("nd_user_info") | |||||
@ApiModel(value = "NdUserInfo对象", description = "") | |||||
public class NdUserInfo implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
private Long id; | |||||
private LocalDateTime createOn; | |||||
private LocalDateTime updateOn; | |||||
private Long createBy; | |||||
private Long updateBy; | |||||
private String username; | |||||
private String mobile; | |||||
private String realName; | |||||
public Long getId() { | |||||
return id; | |||||
} | |||||
public void setId(Long id) { | |||||
this.id = id; | |||||
} | |||||
public LocalDateTime getCreateOn() { | |||||
return createOn; | |||||
} | |||||
public void setCreateOn(LocalDateTime createOn) { | |||||
this.createOn = createOn; | |||||
} | |||||
public LocalDateTime getUpdateOn() { | |||||
return updateOn; | |||||
} | |||||
public void setUpdateOn(LocalDateTime updateOn) { | |||||
this.updateOn = updateOn; | |||||
} | |||||
public Long getCreateBy() { | |||||
return createBy; | |||||
} | |||||
public void setCreateBy(Long createBy) { | |||||
this.createBy = createBy; | |||||
} | |||||
public Long getUpdateBy() { | |||||
return updateBy; | |||||
} | |||||
public void setUpdateBy(Long updateBy) { | |||||
this.updateBy = updateBy; | |||||
} | |||||
public String getUsername() { | |||||
return username; | |||||
} | |||||
public void setUsername(String username) { | |||||
this.username = username; | |||||
} | |||||
public String getMobile() { | |||||
return mobile; | |||||
} | |||||
public void setMobile(String mobile) { | |||||
this.mobile = mobile; | |||||
} | |||||
public String getRealName() { | |||||
return realName; | |||||
} | |||||
public void setRealName(String realName) { | |||||
this.realName = realName; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return "NdUserInfo{" + | |||||
"id=" + id + | |||||
", createOn=" + createOn + | |||||
", updateOn=" + updateOn + | |||||
", createBy=" + createBy + | |||||
", updateBy=" + updateBy + | |||||
", username=" + username + | |||||
", mobile=" + mobile + | |||||
", realName=" + realName + | |||||
"}"; | |||||
} | |||||
} |
@@ -1,7 +1,5 @@ | |||||
package com.ningdatech.pmapi.user.entity; | package com.ningdatech.pmapi.user.entity; | ||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -11,20 +9,19 @@ import java.time.LocalDateTime; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户鉴权表 | |||||
* | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
@Data | |||||
@TableName("nd_user_auth") | @TableName("nd_user_auth") | ||||
@ApiModel(value = "UserAuth对象", description = "用户鉴权表") | |||||
@Data | |||||
@ApiModel(value = "NdUserAuth对象", description = "") | |||||
public class UserAuth implements Serializable { | public class UserAuth implements Serializable { | ||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private Long id; | private Long id; | ||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
@@ -38,5 +35,4 @@ public class UserAuth implements Serializable { | |||||
private String identifier; | private String identifier; | ||||
private String credential; | private String credential; | ||||
} | } |
@@ -1,10 +1,7 @@ | |||||
package com.ningdatech.pmapi.user.entity; | package com.ningdatech.pmapi.user.entity; | ||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Builder; | import lombok.Builder; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -13,70 +10,38 @@ import java.time.LocalDateTime; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户信息表 | |||||
* | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
@Data | |||||
@TableName("nd_user_info") | @TableName("nd_user_info") | ||||
@ApiModel(value = "UserInfo对象", description = "用户信息表") | |||||
@Builder | @Builder | ||||
@Data | |||||
@ApiModel(value = "NdUserInfo对象", description = "") | |||||
public class UserInfo implements Serializable { | public class UserInfo implements Serializable { | ||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@ApiModelProperty("主键") | |||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private Long id; | private Long id; | ||||
@ApiModelProperty("创建时间") | |||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
@ApiModelProperty("最后修改时间") | |||||
private LocalDateTime updateOn; | private LocalDateTime updateOn; | ||||
@ApiModelProperty("创建人") | |||||
private Long createBy; | private Long createBy; | ||||
@ApiModelProperty("最后修改人") | |||||
private Long updateBy; | private Long updateBy; | ||||
@ApiModelProperty("用户名(登陆账号)") | |||||
private String username; | private String username; | ||||
@ApiModelProperty("手机") | |||||
private String mobile; | private String mobile; | ||||
@ApiModelProperty("用户真实姓名") | |||||
private String realName; | private String realName; | ||||
@ApiModelProperty("所属公司id") | |||||
private Long companyId; | |||||
@ApiModelProperty("所属公司名称") | |||||
private String companyName; | |||||
@ApiModelProperty("用户角色") | |||||
private String role; | |||||
@ApiModelProperty("区域id") | |||||
private Long regionCode; | |||||
@ApiModelProperty("头像文件id") | |||||
private Long avatarFileId; | |||||
@ApiModelProperty("所负责的公司id列表") | |||||
private String manageCompanyIds; | |||||
@ApiModelProperty("是否删除") | |||||
private Boolean deleted; | |||||
@ApiModelProperty("身份证号") | |||||
private String idCard; | |||||
@ApiModelProperty("浙政钉accountId") | |||||
private Long accountId; | private Long accountId; | ||||
private String available; | |||||
} | } |
@@ -1,15 +1,25 @@ | |||||
package com.ningdatech.pmapi.user.manage; | package com.ningdatech.pmapi.user.manage; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.user.mapper.UserInfoMapper; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | |||||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; | import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | ||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
* @date 2023/2/13 上午9:09 | * @date 2023/2/13 上午9:09 | ||||
@@ -17,15 +27,48 @@ import org.springframework.stereotype.Component; | |||||
@Component | @Component | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class UserInfoManage { | public class UserInfoManage { | ||||
private final UserInfoMapper userInfoMapper; | |||||
private final IDingOrganizationService iDingOrganizationService; | |||||
private final IDingEmployeeInfoService iDingEmployeeInfoService; | |||||
private final IUserInfoService iUserInfoService; | |||||
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | ||||
LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getMainJob, "true"); | |||||
return null; | |||||
Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); | |||||
List<DingEmployeeInfo> records = page.getRecords(); | |||||
long total = page.getTotal(); | |||||
List<ResUserInfoListVO> resUserInfoListVOList = new ArrayList<>(); | |||||
if (records != null && records.size() > 0) { | |||||
resUserInfoListVOList = records.stream() | |||||
.map(r -> { | |||||
ResUserInfoListVO resListVO = new ResUserInfoListVO(); | |||||
resListVO.setName(r.getEmployeeName()); | |||||
resListVO.setOrgName(r.getOrganizationCode()); | |||||
resListVO.setOrgCode(r.getOrganizationCode()); | |||||
// TODO 从用户信息中获取 | |||||
// resListVO.setPhoneNo(); | |||||
// 从所属组织中获取 | |||||
// resListVO.setRegionId(); | |||||
resListVO.setStatus(false); | |||||
resListVO.setUpdateTime(r.getUpdateOn()); | |||||
// 从用户信息中获取 | |||||
resListVO.setUserId(1L); | |||||
resListVO.setEmployeeCode(r.getEmployeeCode()); | |||||
resListVO.setUserRoleList(new ArrayList<>()); | |||||
return resListVO; | |||||
}).collect(Collectors.toList()); | |||||
} | |||||
PageVo<ResUserInfoListVO> pageVo = new PageVo<>(); | |||||
pageVo.setTotal(total); | |||||
pageVo.setRecords(resUserInfoListVOList); | |||||
return pageVo; | |||||
} | } | ||||
public void disable(ReqUserDisablePO reqUserDisablePO) { | |||||
public void disableOrEnable(ReqUserDisablePO reqUserDisablePO) { | |||||
} | } | ||||
@@ -1,16 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.mapper; | |||||
import com.ningdatech.pmapi.user.entity.NdUserAuth; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
public interface NdUserAuthMapper extends BaseMapper<NdUserAuth> { | |||||
} |
@@ -1,5 +0,0 @@ | |||||
<?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.ningdatech.pmapi.user.mapper.NdUserAuthMapper"> | |||||
</mapper> |
@@ -1,6 +1,6 @@ | |||||
package com.ningdatech.pmapi.user.mapper; | package com.ningdatech.pmapi.user.mapper; | ||||
import com.ningdatech.pmapi.user.entity.NdUserInfo; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
/** | /** | ||||
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
* @author Lierbao | * @author Lierbao | ||||
* @since 2023-02-01 | * @since 2023-02-01 | ||||
*/ | */ | ||||
public interface NdUserInfoMapper extends BaseMapper<NdUserInfo> { | |||||
public interface NdUserInfoMapper extends BaseMapper<UserInfo> { | |||||
} | } |
@@ -1,15 +1,15 @@ | |||||
package com.ningdatech.pmapi.user.mapper; | package com.ningdatech.pmapi.user.mapper; | ||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.ningdatech.pmapi.user.entity.UserAuth; | import com.ningdatech.pmapi.user.entity.UserAuth; | ||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户鉴权表 Mapper 接口 | |||||
* Mapper 接口 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
public interface UserAuthMapper extends BaseMapper<UserAuth> { | public interface UserAuthMapper extends BaseMapper<UserAuth> { | ||||
@@ -1,16 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.mapper; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* 用户信息表 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
*/ | |||||
public interface UserInfoMapper extends BaseMapper<UserInfo> { | |||||
} |
@@ -1,5 +0,0 @@ | |||||
<?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.ningdatech.pmapi.user.mapper.UserInfoMapper"> | |||||
</mapper> |
@@ -12,11 +12,18 @@ import javax.validation.constraints.NotBlank; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("用户禁用PO") | |||||
@ApiModel("用户禁用/启用 PO") | |||||
public class ReqUserDisablePO { | public class ReqUserDisablePO { | ||||
@NotBlank(message = "用户ID不能为空") | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("浙政钉 用户编码") | |||||
private String employeeCode; | |||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("操作 true: 启用 / false 禁用") | |||||
private Boolean operation; | |||||
} | } |
@@ -19,6 +19,9 @@ public class ResUserInfoListVO { | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@ApiModelProperty("浙政钉 用户编码") | |||||
private String employeeCode; | |||||
@ApiModelProperty("姓名") | @ApiModelProperty("姓名") | ||||
private String name; | private String name; | ||||
@@ -28,8 +31,8 @@ public class ResUserInfoListVO { | |||||
@ApiModelProperty("所在单位(主职)") | @ApiModelProperty("所在单位(主职)") | ||||
private String orgName; | private String orgName; | ||||
@ApiModelProperty("所在单位(主职)id") | |||||
private Long orgId; | |||||
@ApiModelProperty("所在单位(主职)code") | |||||
private String orgCode; | |||||
@ApiModelProperty("所属区域") | @ApiModelProperty("所属区域") | ||||
private Long regionId; | private Long regionId; | ||||
@@ -38,7 +41,7 @@ public class ResUserInfoListVO { | |||||
private List<Role> userRoleList; | private List<Role> userRoleList; | ||||
@ApiModelProperty("状态") | @ApiModelProperty("状态") | ||||
private String status; | |||||
private Boolean status; | |||||
@ApiModelProperty("更新时间") | @ApiModelProperty("更新时间") | ||||
private LocalDateTime updateTime; | private LocalDateTime updateTime; | ||||
@@ -1,16 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.service; | |||||
import com.ningdatech.pmapi.user.entity.NdUserAuth; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
public interface INdUserAuthService extends IService<NdUserAuth> { | |||||
} |
@@ -1,16 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.service; | |||||
import com.ningdatech.pmapi.user.entity.NdUserInfo; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
public interface INdUserInfoService extends IService<NdUserInfo> { | |||||
} |
@@ -1,16 +1,21 @@ | |||||
package com.ningdatech.pmapi.user.service; | package com.ningdatech.pmapi.user.service; | ||||
import com.ningdatech.pmapi.user.entity.UserAuth; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.ningdatech.pmapi.user.entity.UserAuth; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import java.util.Map; | |||||
import java.util.Set; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户鉴权表 服务类 | |||||
* 服务类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
public interface IUserAuthService extends IService<UserAuth> { | public interface IUserAuthService extends IService<UserAuth> { | ||||
Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers); | |||||
} | } |
@@ -2,19 +2,19 @@ package com.ningdatech.pmapi.user.service; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | import com.ningdatech.pmapi.user.entity.UserInfo; | ||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Set; | import java.util.Set; | ||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户信息表 服务类 | |||||
* 服务类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
public interface IUserInfoService extends IService<UserInfo> { | public interface IUserInfoService extends IService<UserInfo> { | ||||
Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers); | |||||
Map<Long, UserInfoVO> getUserMapByIds(Set<String> staterUsers); | |||||
} | } |
@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.service.impl; | |||||
import com.ningdatech.pmapi.user.entity.NdUserAuth; | |||||
import com.ningdatech.pmapi.user.mapper.NdUserAuthMapper; | |||||
import com.ningdatech.pmapi.user.service.INdUserAuthService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
@Service | |||||
public class NdUserAuthServiceImpl extends ServiceImpl<NdUserAuthMapper, NdUserAuth> implements INdUserAuthService { | |||||
} |
@@ -1,20 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.service.impl; | |||||
import com.ningdatech.pmapi.user.entity.NdUserInfo; | |||||
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; | |||||
import com.ningdatech.pmapi.user.service.INdUserInfoService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | |||||
@Service | |||||
public class NdUserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, NdUserInfo> implements INdUserInfoService { | |||||
} |
@@ -1,20 +1,36 @@ | |||||
package com.ningdatech.pmapi.user.service.impl; | package com.ningdatech.pmapi.user.service.impl; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.ningdatech.pmapi.user.entity.UserAuth; | import com.ningdatech.pmapi.user.entity.UserAuth; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||||
import com.ningdatech.pmapi.user.mapper.UserAuthMapper; | import com.ningdatech.pmapi.user.mapper.UserAuthMapper; | ||||
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; | |||||
import com.ningdatech.pmapi.user.service.IUserAuthService; | import com.ningdatech.pmapi.user.service.IUserAuthService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Set; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户鉴权表 服务实现类 | |||||
* 服务实现类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
@Service | @Service | ||||
@RequiredArgsConstructor | |||||
public class UserAuthServiceImpl extends ServiceImpl<UserAuthMapper, UserAuth> implements IUserAuthService { | public class UserAuthServiceImpl extends ServiceImpl<UserAuthMapper, UserAuth> implements IUserAuthService { | ||||
private final NdUserInfoMapper userInfoMapper; | |||||
@Override | |||||
public Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers) { | |||||
List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers); | |||||
return userInfos.stream().collect(Collectors.toMap(UserInfo::getId, u -> u)); | |||||
} | |||||
} | } |
@@ -1,35 +1,61 @@ | |||||
package com.ningdatech.pmapi.user.service.impl; | package com.ningdatech.pmapi.user.service.impl; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import com.ningdatech.pmapi.user.entity.UserInfo; | import com.ningdatech.pmapi.user.entity.UserInfo; | ||||
import com.ningdatech.pmapi.user.mapper.UserInfoMapper; | |||||
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper; | |||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import com.wflow.workflow.bean.vo.UserInfoVO; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.apache.catalina.User; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Set; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
* <p> | * <p> | ||||
* 用户信息表 服务实现类 | |||||
* 服务实现类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Liuxinxin | |||||
* @since 2023-01-04 | |||||
* @author Lierbao | |||||
* @since 2023-02-01 | |||||
*/ | */ | ||||
@Service | @Service | ||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements IUserInfoService { | |||||
private final UserInfoMapper userInfoMapper; | |||||
public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> implements IUserInfoService { | |||||
private final NdUserInfoMapper userInfoMapper; | |||||
private final IDingEmployeeInfoService dingEmployeeInfoService; | |||||
private final IDingOrganizationService dingOrganizationService; | |||||
@Override | @Override | ||||
public Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers) { | |||||
public Map<Long, UserInfoVO> getUserMapByIds(Set<String> staterUsers) { | |||||
List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers); | List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers); | ||||
return userInfos.stream().collect(Collectors.toMap(UserInfo::getId,u -> u )); | |||||
List<UserInfoVO> resVos = userInfos.stream().map(u -> { | |||||
UserInfoVO userInfoVO = new UserInfoVO(); | |||||
userInfoVO.setUserId(u.getId()); | |||||
userInfoVO.setRealName(u.getRealName()); | |||||
userInfoVO.setAccountId(u.getAccountId()); | |||||
Long accountId = u.getAccountId(); | |||||
if (Objects.isNull(accountId)){ | |||||
throw new BizException("该用户没有录入浙政钉用户信息!"); | |||||
} | |||||
// 根据浙政钉用户ID获取部门code | |||||
DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getId, accountId)); | |||||
String organizationCode = employeeInfo.getOrganizationCode(); | |||||
// 根据部门code获取部门名称 | |||||
DingOrganization dingOrganization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||||
.eq(DingOrganization::getOrganizationCode, organizationCode)); | |||||
String organizationName = dingOrganization.getOrganizationName(); | |||||
userInfoVO.setOrganizationCode(organizationCode); | |||||
userInfoVO.setOrganizationName(organizationName); | |||||
return userInfoVO; | |||||
}).collect(Collectors.toList()); | |||||
return resVos.stream().collect(Collectors.toMap(UserInfoVO::getUserId, v -> v)); | |||||
} | } | ||||
} | } |