@@ -24,6 +24,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||
"com.ningdatech.pmapi.sys.controller", | |||
"com.ningdatech.pmapi.todocenter.controller", | |||
"com.ningdatech.pmapi.user.controller", | |||
"com.ningdatech.pmapi.expert.controller" | |||
}) | |||
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.pmapi.expert.manage.ExpertReviewManage; | |||
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.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
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 java.util.List; | |||
/** | |||
* <p> | |||
@@ -37,4 +38,24 @@ public class ExpertReviewController { | |||
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); | |||
} | |||
} |
@@ -1,10 +1,15 @@ | |||
package com.ningdatech.pmapi.expert.manage; | |||
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.util.CollUtils; | |||
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.req.ExpertReviewDetailReq; | |||
import com.ningdatech.pmapi.expert.model.vo.ExpertReviewDetailVO; | |||
import com.ningdatech.pmapi.expert.service.IExpertReviewService; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -33,6 +38,20 @@ public class ExpertReviewManage { | |||
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) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
Long projectId = req.getProjectId(); | |||
@@ -60,7 +79,7 @@ public class ExpertReviewManage { | |||
review.setContent(JSONUtil.toJsonStr(req.getReviewTemplateOptions())); | |||
review.setProjectId(req.getProjectId()); | |||
review.setTemplateId(req.getTemplateId()); | |||
review.setAdvice(req.getOtherAdvice()); | |||
review.setOtherAdvice(req.getOtherAdvice()); | |||
review.setAttachFileId(req.getAttachFileId()); | |||
review.setIsFinal(req.getIsFinal()); | |||
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); | |||
} | |||
} |
@@ -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; | |||
@ApiModelProperty("意见或建议") | |||
private String advice; | |||
private String otherAdvice; | |||
@ApiModelProperty("附件ID") | |||
private Long attachFileId; | |||
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.expert.model.req; | |||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateOptionDTO; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -30,7 +31,7 @@ public class ExpertReviewDetailReq { | |||
@Valid | |||
@ApiModelProperty("配置模版") | |||
@NotEmpty(message = "配置不能为空") | |||
private List<ReviewTemplateOptionVO> reviewTemplateOptions; | |||
private List<ReviewTemplateOptionDTO> reviewTemplateOptions; | |||
@ApiModelProperty("其他意见或建议") | |||
@NotEmpty(message = "其他意见或建议不能为空") | |||
@@ -47,21 +48,4 @@ public class ExpertReviewDetailReq { | |||
@NotNull(message = "是否是最终意见不能为空") | |||
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; | |||
} |
@@ -11,7 +11,6 @@ import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
@@ -20,10 +19,6 @@ import org.springframework.web.bind.annotation.RestController; | |||
import javax.validation.Valid; | |||
/** | |||
* <p> | |||
* 用户信息表 前端控制器 | |||
* </p> | |||
* | |||
* @author Liuxinxin | |||
* @since 2023-01-04 | |||
*/ | |||
@@ -41,10 +36,10 @@ public class UserInfoController { | |||
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 = "用户详情") | |||
@@ -42,4 +42,6 @@ public class UserInfo implements Serializable { | |||
private Long accountId; | |||
private String available; | |||
} |
@@ -1,14 +1,25 @@ | |||
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.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.ReqUserDisablePO; | |||
import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | |||
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | |||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | |||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/13 上午9:09 | |||
@@ -17,12 +28,47 @@ import org.springframework.stereotype.Component; | |||
@RequiredArgsConstructor | |||
public class UserInfoManage { | |||
private final IDingOrganizationService iDingOrganizationService; | |||
private final IDingEmployeeInfoService iDingEmployeeInfoService; | |||
private final IUserInfoService iUserInfoService; | |||
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) { | |||
} | |||
@@ -12,11 +12,18 @@ import javax.validation.constraints.NotBlank; | |||
*/ | |||
@Data | |||
@ApiModel("用户禁用PO") | |||
@ApiModel("用户禁用/启用 PO") | |||
public class ReqUserDisablePO { | |||
@NotBlank(message = "用户ID不能为空") | |||
@ApiModelProperty("用户id") | |||
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") | |||
private Long userId; | |||
@ApiModelProperty("浙政钉 用户编码") | |||
private String employeeCode; | |||
@ApiModelProperty("姓名") | |||
private String name; | |||
@@ -28,8 +31,8 @@ public class ResUserInfoListVO { | |||
@ApiModelProperty("所在单位(主职)") | |||
private String orgName; | |||
@ApiModelProperty("所在单位(主职)id") | |||
private Long orgId; | |||
@ApiModelProperty("所在单位(主职)code") | |||
private String orgCode; | |||
@ApiModelProperty("所属区域") | |||
private Long regionId; | |||
@@ -38,7 +41,7 @@ public class ResUserInfoListVO { | |||
private List<Role> userRoleList; | |||
@ApiModelProperty("状态") | |||
private String status; | |||
private Boolean status; | |||
@ApiModelProperty("更新时间") | |||
private LocalDateTime updateTime; | |||