# Conflicts: # pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.javamaster
@@ -1,8 +1,11 @@ | |||
package com.ningdatech.pmapi; | |||
import com.ningdatech.basic.util.SpringUtils; | |||
import org.mybatis.spring.annotation.MapperScan; | |||
import org.springframework.boot.SpringApplication; | |||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
import org.springframework.context.ApplicationContext; | |||
import org.springframework.context.ConfigurableApplicationContext; | |||
import org.springframework.context.annotation.EnableAspectJAutoProxy; | |||
import org.springframework.scheduling.annotation.EnableAsync; | |||
import org.springframework.scheduling.annotation.EnableScheduling; | |||
@@ -22,7 +25,9 @@ public class App { | |||
protected static final String MAPPER_PACKAGES = "com.ningdatech.pmapi.**.mapper"; | |||
public static void main(String[] args) { | |||
SpringApplication.run(App.class, args); | |||
ApplicationContext context = SpringApplication.run(App.class, args); | |||
// 设置applicationContext | |||
SpringUtils.setApplicationContext(context); | |||
} | |||
} |
@@ -25,7 +25,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||
"com.ningdatech.pmapi.user.controller", | |||
"com.ningdatech.pmapi.meeting.controller", | |||
"com.ningdatech.pmapi.expert.controller", | |||
"com.ningdatech.pmapi.sms.controller" | |||
"com.ningdatech.pmapi.sms.controller", | |||
"com.ningdatech.pmapi.workbench.controller" | |||
}) | |||
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | |||
@@ -0,0 +1,34 @@ | |||
package com.ningdatech.pmapi.expert.constant; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import java.util.Arrays; | |||
/** | |||
* <p> | |||
* ReviewResultEnum | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 14:17 2023/3/20 | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
public enum ReviewResultEnum { | |||
PASSED(1, "通过"), | |||
TO_BE_REVIEWED(2, "需复核"), | |||
REFUSED(3, "不通过"); | |||
private final int code; | |||
private final String value; | |||
public static ReviewResultEnum getByCode(int code) { | |||
return Arrays.stream(values()) | |||
.filter(w -> w.getCode() == code) | |||
.findFirst() | |||
.orElseThrow(() -> new IllegalArgumentException("无效的审核结果编码")); | |||
} | |||
} |
@@ -62,7 +62,6 @@ public class ExpertReviewManage { | |||
try { | |||
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId); | |||
if (req.getIsFinal()) { | |||
// TODO 判断所有专家是否都已评价 | |||
if (reviews.isEmpty()) { | |||
throw BizException.wrap("请先填写个人评审意见"); | |||
} | |||
@@ -4,6 +4,7 @@ import com.ningdatech.pmapi.expert.model.entity.ExpertReview; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
@@ -25,4 +26,32 @@ public interface IExpertReviewService extends IService<ExpertReview> { | |||
**/ | |||
List<ExpertReview> listByProjectIdAndExpertId(Long projectId, Long expertId); | |||
/** | |||
* 获取最终评审结果 | |||
* | |||
* @param meetingId 会议ID | |||
* @param projectId 项目ID | |||
* @return {@link ExpertReview} | |||
* @author WendyYang | |||
**/ | |||
ExpertReview getFinalReview(Long meetingId, Long projectId); | |||
/** | |||
* 获取最终评审结果 | |||
* | |||
* @param meetingId 会议ID | |||
* @return {@link ExpertReview} | |||
* @author WendyYang | |||
**/ | |||
Map<Long, ExpertReview> listFinalReviewMap(Long meetingId); | |||
/** | |||
* 获取最终评审结果 | |||
* | |||
* @param meetingId 会议ID | |||
* @return {@link ExpertReview} | |||
* @author WendyYang | |||
**/ | |||
List<ExpertReview> listFinalReview(Long meetingId); | |||
} |
@@ -3,12 +3,15 @@ package com.ningdatech.pmapi.expert.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.expert.mapper.ExpertReviewMapper; | |||
import com.ningdatech.pmapi.expert.model.entity.ExpertReview; | |||
import com.ningdatech.pmapi.expert.service.IExpertReviewService; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
@@ -30,4 +33,27 @@ public class ExpertReviewServiceImpl extends ServiceImpl<ExpertReviewMapper, Exp | |||
return list(query); | |||
} | |||
@Override | |||
public ExpertReview getFinalReview(Long meetingId, Long projectId) { | |||
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class); | |||
query.eq(ExpertReview::getProjectId, projectId); | |||
query.eq(ExpertReview::getMeetingId, meetingId); | |||
query.eq(ExpertReview::getIsFinal, Boolean.TRUE); | |||
query.last(BizConst.LIMIT_1); | |||
return getOne(query); | |||
} | |||
@Override | |||
public Map<Long, ExpertReview> listFinalReviewMap(Long meetingId) { | |||
return CollUtils.listToMap(listFinalReview(meetingId), ExpertReview::getProjectId); | |||
} | |||
@Override | |||
public List<ExpertReview> listFinalReview(Long meetingId) { | |||
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class); | |||
query.eq(ExpertReview::getMeetingId, meetingId); | |||
query.eq(ExpertReview::getIsFinal, Boolean.TRUE); | |||
return list(query); | |||
} | |||
} |
@@ -177,13 +177,13 @@ public class MeetingController { | |||
@GetMapping("/option/project") | |||
@ApiOperation("项目列表(创建会议添加项目)") | |||
public PageVo<ProjectLibListItemVO> projectList(MeetingOptionProjectReq req) { | |||
public PageVo<MeetingReviewProjectVO> projectList(MeetingOptionProjectReq req) { | |||
return meetingManage.optionProject(req); | |||
} | |||
@GetMapping("/{meetingId}/projects") | |||
@ApiOperation("会议关联项目列表") | |||
public List<ProjectLibListItemVO> projectsByMeetingId(@PathVariable Long meetingId) { | |||
public List<MeetingReviewProjectVO> projectsByMeetingId(@PathVariable Long meetingId) { | |||
return meetingManage.projectsByMeetingId(meetingId); | |||
} | |||
@@ -26,6 +26,9 @@ public class InviteExpertListItemVO extends ExpertBasicInfoVO { | |||
@ApiModelProperty("会议ID") | |||
private Long meetingId; | |||
@ApiModelProperty("手机号") | |||
private String mobile; | |||
@ApiModelProperty("专家会议ID") | |||
private Long expertMeetingId; | |||
@@ -83,4 +83,13 @@ public class MeetingDetailBasicVO { | |||
@ApiModelProperty("评审项目信息") | |||
private List<MeetingReviewProjectDTO> projects; | |||
@ApiModelProperty("是否已停止邀请") | |||
private Boolean invitedStopped; | |||
@ApiModelProperty("是否已确认名单") | |||
private Boolean confirmedRoster; | |||
@ApiModelProperty("邀请类型") | |||
private Integer inviteType; | |||
} |
@@ -0,0 +1,53 @@ | |||
package com.ningdatech.pmapi.meeting.entity.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.experimental.Tolerate; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
/** | |||
* <p> | |||
* MeetingReviewProjectVO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 13:57 2023/3/20 | |||
*/ | |||
@Data | |||
@Builder | |||
public class MeetingReviewProjectVO { | |||
@Tolerate | |||
public MeetingReviewProjectVO() { | |||
} | |||
@ApiModelProperty("项目ID") | |||
private Long id; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@ApiModelProperty("申报金额") | |||
private BigDecimal declaredAmount; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("申报年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("申报单位") | |||
private String buildOrg; | |||
@ApiModelProperty("评审结果") | |||
private String reviewResult; | |||
@ApiModelProperty("创建时间") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | |||
private LocalDateTime createOn; | |||
} |
@@ -18,8 +18,11 @@ import com.ningdatech.basic.util.StrPool; | |||
import com.ningdatech.basic.util.ValidUtil; | |||
import com.ningdatech.cache.lock.DistributedLock; | |||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | |||
import com.ningdatech.pmapi.expert.constant.ReviewResultEnum; | |||
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; | |||
import com.ningdatech.pmapi.expert.helper.PermissionCheckHelper; | |||
import com.ningdatech.pmapi.expert.model.entity.ExpertReview; | |||
import com.ningdatech.pmapi.expert.service.IExpertReviewService; | |||
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; | |||
import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder; | |||
import com.ningdatech.pmapi.meeting.entity.domain.*; | |||
@@ -41,7 +44,6 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
import com.ningdatech.pmapi.organization.service.IGovBusinessStripService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.sys.model.dto.RegionDTO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
@@ -89,7 +91,7 @@ public class MeetingManage { | |||
private final IMeetingOuterProjectService meetingOuterProjectService; | |||
private final IGovBusinessStripService businessStripService; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final IExpertReviewService expertReviewService; | |||
private final ExpertInviteHelper expertInviteHelper; | |||
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; | |||
@@ -373,6 +375,9 @@ public class MeetingManage { | |||
.createOn(meeting.getCreateOn()) | |||
.creator(meeting.getCreator()) | |||
.createBy(meeting.getCreator()) | |||
.inviteType(meeting.getInviteType()) | |||
.confirmedRoster(meeting.getConfirmedRoster()) | |||
.invitedStopped(meeting.getInviteStatus()) | |||
.build(); | |||
if (meeting.getIsInnerProject()) { | |||
List<MeetingInnerProject> innerProjects = meetingInnerProjectService.listByMeetingId(meetingId); | |||
@@ -415,6 +420,7 @@ public class MeetingManage { | |||
item.setExpertMeetingId(sme.getId()); | |||
item.setMeetingId(sme.getMeetingId()); | |||
item.setStatus(sme.getStatus()); | |||
item.setMobile(sme.getMobile()); | |||
item.setNoticeTime(sme.getCreateOn()); | |||
item.setRuleId(sme.getRuleId()); | |||
if (ExpertAttendStatusEnum.NOTICING.eq(sme.getStatus())) { | |||
@@ -485,6 +491,7 @@ public class MeetingManage { | |||
if (CollUtil.isNotEmpty(randoms)) { | |||
randoms.forEach(random -> { | |||
RandomInviteRuleVO randomRule = JSON.parseObject(random.getInviteRule(), RandomInviteRuleVO.class); | |||
randomRule.setId(random.getId()); | |||
if (randomRule.getExpertTags() != null) { | |||
randomRule.getExpertTags().forEach(w -> { | |||
List<String> tagNames = CollUtils.convert(w.getTagCodes(), tagCode -> tagCache.getByTagCode(tagCode).getTagName()); | |||
@@ -525,6 +532,7 @@ public class MeetingManage { | |||
List<ExpertInviteRule> appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT); | |||
ExpertInviteRule appoint = appoints.get(0); | |||
AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); | |||
appointRule.setId(appoint.getId()); | |||
AppointRuleVO vo = new AppointRuleVO(); | |||
vo.setInviteDesc(appointRule.getInviteDesc()); | |||
vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIdList()).values())); | |||
@@ -722,7 +730,7 @@ public class MeetingManage { | |||
return PageVo.of(page.getRecords(), page.getTotal()); | |||
} | |||
public PageVo<ProjectLibListItemVO> optionProject(MeetingOptionProjectReq req) { | |||
public PageVo<MeetingReviewProjectVO> optionProject(MeetingOptionProjectReq req) { | |||
String meetingType = req.getMeetingType(); | |||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class); | |||
switch (MeetingReviewTypeEnum.getByCode(meetingType)) { | |||
@@ -742,28 +750,38 @@ public class MeetingManage { | |||
return PageVo.empty(); | |||
} | |||
Page<Project> page = projectService.page(req.page(), query); | |||
PageVo<ProjectLibListItemVO> result = PageVo.of(null, page.getTotal()); | |||
PageVo<MeetingReviewProjectVO> result = PageVo.of(null, page.getTotal()); | |||
if (result.getTotal() > 0) { | |||
result.setRecords(CollUtils.convert(page.getRecords(), this::buildProjectList)); | |||
} | |||
return result; | |||
} | |||
public List<ProjectLibListItemVO> projectsByMeetingId(Long meetingId) { | |||
public List<MeetingReviewProjectVO> projectsByMeetingId(Long meetingId) { | |||
Meeting meeting = meetingService.getById(meetingId); | |||
if (meeting.getIsInnerProject()) { | |||
List<MeetingInnerProject> projects = meetingInnerProjectService.listByMeetingId(meetingId); | |||
List<Long> projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); | |||
List<Project> projectList = projectService.listByIds(projectIdList); | |||
return CollUtils.convert(projectList, this::buildProjectList); | |||
Map<Long, ExpertReview> reviewMap = expertReviewService.listFinalReviewMap(meetingId); | |||
return CollUtils.convert(projectList, w -> { | |||
MeetingReviewProjectVO vo = buildProjectList(w); | |||
ExpertReview review = reviewMap.get(w.getId()); | |||
if (review != null) { | |||
vo.setReviewResult(ReviewResultEnum.getByCode(review.getReviewResult()).getValue()); | |||
} else { | |||
vo.setReviewResult("--"); | |||
} | |||
return vo; | |||
}); | |||
} else { | |||
List<MeetingOuterProject> projects = meetingOuterProjectService.listByMeetingId(meetingId); | |||
return BeanUtil.copyToList(projects, ProjectLibListItemVO.class); | |||
return BeanUtil.copyToList(projects, MeetingReviewProjectVO.class); | |||
} | |||
} | |||
private ProjectLibListItemVO buildProjectList(Project project) { | |||
return ProjectLibListItemVO | |||
private MeetingReviewProjectVO buildProjectList(Project project) { | |||
return MeetingReviewProjectVO | |||
.builder() | |||
.id(project.getId()) | |||
.projectName(project.getProjectName()) | |||
@@ -771,6 +789,7 @@ public class MeetingManage { | |||
.projectType(project.getProjectType()) | |||
.projectYear(project.getProjectYear()) | |||
.buildOrg(project.getBuildOrgName()) | |||
.createOn(project.getCreateOn()) | |||
.build(); | |||
} | |||
@@ -6,10 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
import com.ningdatech.pmapi.projectdeclared.service.IDeclaredStatisticsService; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
@@ -64,7 +65,7 @@ public class DefaultDeclaredProjectManage { | |||
private final IProjectInstService projectInstService; | |||
private final StateMachineUtils stateMachineUtils; | |||
private final IDeclaredStatisticsService statisticsService; | |||
//项目名称去重 | |||
public void checkDuplication(ProjectDTO project){ | |||
@@ -232,4 +233,10 @@ public class DefaultDeclaredProjectManage { | |||
throw new BusinessException("提交预审 项目信息修改 错误 :" + e.getMessage()); | |||
} | |||
} | |||
public DeclaredProjectStatisticsPO declaredProjectStatistics(Integer year){ | |||
UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | |||
//查此人建设单位的项目 | |||
return statisticsService.getStatistics(userInfo.getOrganizationCode(),year); | |||
} | |||
} |
@@ -6,19 +6,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.exception.BusinessException; | |||
import com.wflow.workflow.bean.dto.OrgInfoDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | |||
import com.wflow.workflow.service.ProcessInstanceService; | |||
import com.wflow.workflow.service.ProcessModelService; | |||
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.projectdeclared.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author zpf | |||
* @since 2023-02-05 | |||
*/ | |||
public interface DeclaredStatisticsMapper extends BaseMapper { | |||
DeclaredProjectStatisticsPO getStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); | |||
} |
@@ -0,0 +1,22 @@ | |||
<?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.projectdeclared.mapper.DeclaredStatisticsMapper"> | |||
<select id="getStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | |||
SELECT | |||
count(0) totalNum, | |||
count(CASE WHEN p.project_type = 1 THEN 1 end) buildNum, | |||
count(CASE WHEN p.project_type = 2 THEN 1 end) operationNum, | |||
count(CASE WHEN p.stage = 10000 THEN 1 end) notApprovedNum, | |||
count(CASE WHEN p.stage = 20000 THEN 1 end) approvedNum, | |||
count(CASE WHEN p.stage = 20000 AND p.status = 20002 THEN 1 end) constructionNum, | |||
count(CASE WHEN p.stage = 20000 AND p.status = 20003 THEN 1 end) tobeInspectedNum, | |||
count(CASE WHEN p.stage = 30000 THEN 1 end) archivedNum, | |||
sum(p.declare_amount) declaredAmount, | |||
sum(p.approval_amount) approvalAmount | |||
FROM | |||
nd_project p | |||
WHERE build_org_code = #{orgCode} and project_year = #{year} | |||
</select> | |||
</mapper> |
@@ -0,0 +1,40 @@ | |||
package com.ningdatech.pmapi.projectdeclared.model.po; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.math.BigDecimal; | |||
/** | |||
* @Classname DeclaredProjectStatistics | |||
* @Description | |||
* @Date 2023/3/20 16:29 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
public class DeclaredProjectStatisticsPO { | |||
@ApiModelProperty("总项目数") | |||
private Integer totalNum; | |||
@ApiModelProperty("建设项目数") | |||
private Integer buildNum; | |||
@ApiModelProperty("运维项目数") | |||
private Integer operationNum; | |||
@ApiModelProperty("待立项数") | |||
private Integer notApprovedNum; | |||
@ApiModelProperty("已立项数") | |||
private Integer approvedNum; | |||
@ApiModelProperty("建设中数") | |||
private Integer constructionNum; | |||
@ApiModelProperty("待验收数") | |||
private Integer tobeInspectedNum; | |||
@ApiModelProperty("已归档数") | |||
private Integer archivedNum; | |||
@ApiModelProperty("申报总金额") | |||
private BigDecimal declaredAmount; | |||
@ApiModelProperty("立项总金额") | |||
private BigDecimal approvalAmount; | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.ningdatech.pmapi.projectdeclared.service; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author zpf | |||
* @since 2023-02-05 | |||
*/ | |||
public interface IDeclaredStatisticsService { | |||
DeclaredProjectStatisticsPO getStatistics(String orgCode,Integer year); | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.ningdatech.pmapi.projectdeclared.service.impl; | |||
import com.ningdatech.pmapi.projectdeclared.mapper.DeclaredStatisticsMapper; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
import com.ningdatech.pmapi.projectdeclared.service.IDeclaredStatisticsService; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author zpf | |||
* @since 2023-02-05 | |||
*/ | |||
@Service | |||
@AllArgsConstructor | |||
public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService { | |||
private final DeclaredStatisticsMapper declaredStatisticsMapper; | |||
/** | |||
* 根据userId 去查询 申报项目统计 | |||
* @param orgCode | |||
* @return | |||
*/ | |||
@Override | |||
public DeclaredProjectStatisticsPO getStatistics(String orgCode,Integer year) { | |||
return declaredStatisticsMapper.getStatistics(orgCode,year); | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.provincial.controller; | |||
import cn.hutool.core.io.resource.ResourceUtil; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
@@ -12,6 +13,8 @@ import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
/** | |||
* @Classname TestController | |||
@@ -43,4 +46,21 @@ public class TestController { | |||
private ApiResponse detail(@RequestParam String projectId){ | |||
return joinReviewProvincialBureauService.processInfo(projectId); | |||
} | |||
@GetMapping("/path") | |||
@ApiOperation("测试获取详情") | |||
private String path() throws IOException { | |||
// String template = ResourceUtil.getResource("template").getPath(); | |||
// return template; | |||
InputStream in = this.getClass().getResourceAsStream("/template/simsun.ttc"); | |||
StringBuilder sb = new StringBuilder(); | |||
int n; | |||
while ((n=in.read())!=-1){ | |||
sb.append((char)n); | |||
System.out.print((char)n); | |||
} | |||
return sb.toString(); | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.ningdatech.pmapi.sys.enumeration; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Objects; | |||
/** | |||
* | |||
* 公告类型枚举 | |||
* @author ZPF | |||
* @since 2023/02/24 16:14 | |||
*/ | |||
@Getter | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
public enum NoticeTypeEnum { | |||
/** | |||
* 公告类型枚举 | |||
*/ | |||
ANNOUNCEMENT(1, "公告"), | |||
HELP_DOCUMENTS(2, "帮助文档"); | |||
private Integer code; | |||
private String desc; | |||
public static String getDescByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (NoticeTypeEnum t : NoticeTypeEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.todocenter.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.codec.Base64; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.date.DatePattern; | |||
@@ -50,12 +51,15 @@ import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO; | |||
import com.ningdatech.pmapi.todocenter.model.dto.PdfGenerateDTO; | |||
import com.ningdatech.pmapi.todocenter.model.dto.SealInfoDTO; | |||
import com.ningdatech.pmapi.todocenter.model.dto.SignReqDTO; | |||
import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | |||
import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; | |||
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | |||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; | |||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | |||
import com.ningdatech.pmapi.todocenter.service.StatisticsService; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.ningdatech.pmapi.todocenter.utils.PdfUtils; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
@@ -68,6 +72,7 @@ import com.wflow.exception.BusinessException; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import com.wflow.workflow.bean.dto.ReqProcessHandlerDTO; | |||
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; | |||
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.process.enums.NodeTypeEnum; | |||
import com.wflow.workflow.bean.vo.ProcessInstanceVo; | |||
@@ -131,6 +136,8 @@ public class TodoCenterManage { | |||
private final FileService fileService; | |||
private final ICompanySignatureService companySignatureService; | |||
private final StatisticsService statisticsService; | |||
/** | |||
* 待办中心待我处理项目列表查询 | |||
@@ -1242,4 +1249,15 @@ public class TodoCenterManage { | |||
Project declaredProject = projectService.getById(projectId); | |||
return getSealedPdf(req, declaredProject); | |||
} | |||
//获取当前登录人的 待办中心统计数据 | |||
public TodoCenterStatisticsVO todoCenterStatistics(){ | |||
Long userId = LoginUserUtil.getUserId(); | |||
//为了查询效率 还是自己去写统计接口 | |||
TodoCenterStatisticsPO statistics = statisticsService.getStatistics(userId); | |||
TodoCenterStatisticsVO statisticsVO = BeanUtil.copyProperties(statistics,TodoCenterStatisticsVO.class); | |||
return statisticsVO; | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
package com.ningdatech.pmapi.todocenter.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; | |||
import org.apache.ibatis.annotations.Param; | |||
public interface StatisticsMapper extends BaseMapper { | |||
TodoCenterStatisticsPO getStatistics(@Param("userId") Long userId); | |||
} |
@@ -0,0 +1,24 @@ | |||
<?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.todocenter.mapper.StatisticsMapper"> | |||
<select id="getStatistics" parameterType="java.lang.Long" | |||
resultType="com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO"> | |||
SELECT | |||
sum(CASE WHEN tol.todoNum IS NOT NULL AND tol.todoNum > 0 THEN 1 ELSE 0 end) todoNum, | |||
sum(CASE WHEN tol.idoNum IS NOT NULL AND tol.idoNum > 0 THEN 1 ELSE 0 end) idoNum, | |||
sum(CASE WHEN tol.mysubmitNum IS NOT NULL AND tol.mysubmitNum > 0 THEN 1 ELSE 0 end) mysubmitNum, | |||
sum(CASE WHEN tol.ccmeNum IS NOT NULL AND tol.ccmeNum > 0 THEN 1 ELSE 0 end) ccmeNum | |||
FROM ( | |||
SELECT | |||
sum(CASE WHEN ht.assignee_ = #{userId} AND ht.end_time_ is NULL THEN 1 end) todoNum, | |||
sum(CASE WHEN ht.assignee_ = #{userId} AND ht.end_time_ IS not NULL THEN 1 end) idoNum, | |||
sum(CASE WHEN hp.start_user_id_ = #{userId} THEN 1 end) mysubmitNum, | |||
0 ccmeNum | |||
FROM | |||
act_hi_procinst hp | |||
LEFT JOIN | |||
act_hi_taskinst ht ON hp.proc_inst_id_ = ht.proc_inst_id_ | |||
GROUP BY hp.id_ | |||
) tol | |||
</select> | |||
</mapper> |
@@ -0,0 +1,27 @@ | |||
package com.ningdatech.pmapi.todocenter.model.po; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @Classname TodoCenterStatisticsPO | |||
* @Description | |||
* @Date 2023/3/20 11:51 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
public class TodoCenterStatisticsPO { | |||
@ApiModelProperty("待处理数") | |||
private Integer todoNum; | |||
@ApiModelProperty("已处理数") | |||
private Integer idoNum; | |||
@ApiModelProperty("我发起数") | |||
private Integer mysubmitNum; | |||
@ApiModelProperty("抄送我数") | |||
private Integer ccmeNum; | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.ningdatech.pmapi.todocenter.model.vo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @Classname TodoCenterStatistics | |||
* @Description | |||
* @Date 2023/3/20 11:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
public class TodoCenterStatisticsVO { | |||
@ApiModelProperty("待处理数") | |||
private Integer todoNum; | |||
@ApiModelProperty("已处理数") | |||
private Integer idoNum; | |||
@ApiModelProperty("我发起数") | |||
private Integer mysubmitNum; | |||
@ApiModelProperty("抄送我数") | |||
private Integer ccmeNum; | |||
@ApiModelProperty("待我处理列表 5个") | |||
private List<TodoVO> todoList; | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.ningdatech.pmapi.todocenter.model.vo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
/** | |||
* @Classname TodoVO | |||
* @Description | |||
* @Date 2023/3/20 11:04 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
public class TodoVO { | |||
@ApiModelProperty("项目工作流nodeId") | |||
private String nodeId; | |||
@ApiModelProperty("项目ID") | |||
private Long projectId; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.ningdatech.pmapi.todocenter.service; | |||
import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; | |||
/** | |||
* @Classname StatisticsService | |||
* @Description | |||
* @Date 2023/3/20 11:20 | |||
* @Author PoffyZhang | |||
*/ | |||
public interface StatisticsService { | |||
//根据用户id 去查询 一些统计数据 | |||
TodoCenterStatisticsPO getStatistics(Long userId); | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.ningdatech.pmapi.todocenter.service.impl; | |||
import com.ningdatech.pmapi.todocenter.mapper.StatisticsMapper; | |||
import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; | |||
import com.ningdatech.pmapi.todocenter.service.StatisticsService; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Classname StatisticsService | |||
* @Description | |||
* @Date 2023/3/20 11:20 | |||
* @Author PoffyZhang | |||
*/ | |||
@Service | |||
@AllArgsConstructor | |||
public class StatisticsServiceImpl implements StatisticsService { | |||
private final StatisticsMapper mapper; | |||
@Override | |||
public TodoCenterStatisticsPO getStatistics(Long userId) { | |||
return mapper.getStatistics(userId); | |||
} | |||
} |
@@ -1,20 +1,31 @@ | |||
package com.ningdatech.pmapi.workbench.controller; | |||
import com.ningdatech.pmapi.workbench.manage.WorkbenchManage; | |||
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; | |||
import io.swagger.annotations.Api; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 工作台前端控制器 | |||
* | |||
* @author CMM | |||
* @author ZPF | |||
* @since 2023/03/17 15:35 | |||
*/ | |||
@RestController | |||
@AllArgsConstructor | |||
@Api(tags = "工作台控制器") | |||
@RequestMapping("/api/v1/todo-center") | |||
@RequestMapping("/api/v1/workbench") | |||
public class WorkbenchController { | |||
private WorkbenchManage workbenchManage; | |||
/** | |||
* @param year | |||
* @return | |||
*/ | |||
@GetMapping | |||
public WorkbenchVO workbench(@RequestParam(defaultValue = "2023") Integer year){ | |||
return workbenchManage.getWorkbenchData(year); | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.ningdatech.pmapi.workbench.converter; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; | |||
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
* @Classname WorkbenchConverter | |||
* @Description | |||
* @Date 2023/3/20 17:23 | |||
* @Author PoffyZhang | |||
*/ | |||
public class WorkbenchConverter { | |||
public static WorkbenchVO.DeclaredStatistics convert(DeclaredProjectStatisticsPO po) { | |||
WorkbenchVO.DeclaredStatistics res = BeanUtil.copyProperties(po,WorkbenchVO.DeclaredStatistics.class); | |||
return res; | |||
} | |||
public static TodoVO convert(ResToBeProcessedVO vo) { | |||
TodoVO res = new TodoVO(); | |||
res.setNodeId(vo.getNodeId()); | |||
res.setProjectId(vo.getProjectId()); | |||
res.setProjectName(vo.getProjectName()); | |||
return res; | |||
} | |||
} |
@@ -0,0 +1,76 @@ | |||
package com.ningdatech.pmapi.workbench.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | |||
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.sys.enumeration.NoticeTypeEnum; | |||
import com.ningdatech.pmapi.sys.manage.NoticeManage; | |||
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; | |||
import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; | |||
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | |||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; | |||
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname WorkbenchManage | |||
* @Description | |||
* @Date 2023/3/20 10:56 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@AllArgsConstructor | |||
public class WorkbenchManage { | |||
private final TodoCenterManage todoCenterManage; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final DeclaredProjectManage declaredProjectManage; | |||
private final NoticeManage noticeManage; | |||
public WorkbenchVO getWorkbenchData(Integer year){ | |||
UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | |||
WorkbenchVO res = new WorkbenchVO(); | |||
//1.待办中心数据 | |||
TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(); | |||
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); | |||
toBeProcessedReq.setPageNumber(1); | |||
toBeProcessedReq.setPageSize(5); | |||
statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() | |||
.stream().map(v -> WorkbenchConverter.convert(v)).collect(Collectors.toList())); | |||
res.setTodoCerter(statisticsVO); | |||
//2.项目统计数据 | |||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectStatistics(year))); | |||
ProjectListReq projectListReq = new ProjectListReq(); | |||
projectListReq.setPageNumber(1); | |||
projectListReq.setPageSize(5); | |||
projectListReq.setProjectYear(year); | |||
res.setProjects(declaredProjectManage.projectLibList(projectListReq).getRecords().stream().collect(Collectors.toList())); | |||
//3.政策文件 | |||
NoticeListReq noticeListReq = new NoticeListReq(); | |||
noticeListReq.setType(NoticeTypeEnum.HELP_DOCUMENTS.getCode()); | |||
noticeListReq.setPageNumber(1); | |||
noticeListReq.setPageSize(5); | |||
res.setNoticeList(noticeManage.listByManager(noticeListReq).getRecords().stream().collect(Collectors.toList())); | |||
return res; | |||
} | |||
} |
@@ -0,0 +1,62 @@ | |||
package com.ningdatech.pmapi.workbench.model.vo; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
/** | |||
* @Classname WorkbenchVO | |||
* @Description | |||
* @Date 2023/3/20 9:33 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
public class WorkbenchVO implements Serializable { | |||
@ApiModelProperty("待办中心统计数据 以及代办处理") | |||
public TodoCenterStatisticsVO todoCerter; | |||
@ApiModelProperty("单位申报管理统计数据") | |||
public DeclaredStatistics orgDeclared; | |||
@ApiModelProperty("区域申报管理统计数据 只有区域管理员才有数据") | |||
public DeclaredStatistics regionDeclared; | |||
@ApiModelProperty("项目动态") | |||
public List<ProjectLibListItemVO> projects; | |||
@ApiModelProperty("公告列表") | |||
public List<NoticeListItemVO> noticeList; | |||
@Data | |||
public static class DeclaredStatistics { | |||
@ApiModelProperty("总项目数") | |||
private Integer totalNum; | |||
@ApiModelProperty("建设项目数") | |||
private Integer buildNum; | |||
@ApiModelProperty("运维项目数") | |||
private Integer operationNum; | |||
@ApiModelProperty("待立项数") | |||
private Integer notApprovedNum; | |||
@ApiModelProperty("已立项数") | |||
private Integer approvedNum; | |||
@ApiModelProperty("建设中数") | |||
private Integer constructionNum; | |||
@ApiModelProperty("待验收数") | |||
private Integer tobeInspectedNum; | |||
@ApiModelProperty("已归档数") | |||
private Integer archivedNum; | |||
@ApiModelProperty("申报总金额") | |||
private BigDecimal declaredAmount; | |||
@ApiModelProperty("立项总金额") | |||
private BigDecimal approvalAmount; | |||
} | |||
} |