diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 2b0d82b..8493fb0 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -14,7 +14,7 @@ import java.util.Collections; public class GeneratorCodeKingbaseConfig { private static final String PATH_LXX = "/Users/liuxinxin/IdeaProjects/project-management/pmapi/src/main/java"; - private static final String PATH_YYD = "/Users/wendy/code project/java/project-management/pmapi/src/main/java"; + private static final String PATH_YYD = "/Users/wendy/coding/java/project-management/pmapi/src/main/java"; private static final String PATH_LS = ""; private static final String PATH_ZPF = "D:\\ningda\\project-management\\pmapi\\src\\main\\java"; private static final String PATH_CMM = "D:\\work\\project-management\\project-management\\pmapi\\src\\main\\java"; @@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { public static void main(String[] args) { //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); - generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_app_indicator"); + generate("CMM", "meeting", PATH_YYD, "meeting_expert_judge"); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java new file mode 100644 index 0000000..5aaed94 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingExpertJudgeController.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.meeting.controller; + + +import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq; +import com.ningdatech.pmapi.meeting.manage.MeetingExpertJudgeManage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + *

+ * 前端控制器 + *

+ * + * @author WendyYang + * @since 2023-07-31 + */ +@Api(tags = "履职评价管理") +@AllArgsConstructor +@RestController +@RequestMapping("/api/v1/meeting/expert-judge") +public class MeetingExpertJudgeController { + + private final MeetingExpertJudgeManage expertJudgeManage; + + @ApiOperation("保存履职评价") + @PostMapping("/submit") + public void saveExpertJudge(@Valid @RequestBody MeetingExpertJudgeReq req) { + expertJudgeManage.saveExpertJudge(req); + } + + @ApiOperation("查看履职评价") + @GetMapping("/detail/{meetingExpertId}") + public MeetingExpertJudgeReq expertJudgeDetail(@PathVariable Long meetingExpertId) { + return expertJudgeManage.expertJudgeDetail(meetingExpertId); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java new file mode 100644 index 0000000..8eeb308 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpertJudge.java @@ -0,0 +1,63 @@ +package com.ningdatech.pmapi.meeting.entity.domain; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 会议专家履职评价表 + *

+ * + * @author WendyYang + * @since 2023-07-31 + */ +@Data +@TableName("meeting_expert_judge") +@ApiModel(value = "MeetingExpertJudge对象") +public class MeetingExpertJudge implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty("会议专家ID") + private Long meetingExpertId; + + @ApiModelProperty("评分(1~10)") + private Integer score; + + @ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") + private Integer attended; + + @ApiModelProperty("参与程度:1 积极、2 消极") + private Integer performance; + + @ApiModelProperty("是否提出建议:true 是、false 否") + private Boolean advised; + + @ApiModelProperty("是否早退:true 早退、false 未早退") + private Boolean leaveEarly; + + @ApiModelProperty("是否违规:true 是、false 否") + private Boolean brokeRule; + + @ApiModelProperty("违规内容") + private String brokeRuleContent; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java index 9991234..bf2fca7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingAndAttendStatusDTO.java @@ -15,6 +15,10 @@ public class MeetingAndAttendStatusDTO { private Long meetingId; + private Long meetingExpertId; + + private Long expertId; + private Integer status; private Boolean attended; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java new file mode 100644 index 0000000..7cf802c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingExpertJudgeReq.java @@ -0,0 +1,61 @@ +package com.ningdatech.pmapi.meeting.entity.req; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + *

+ * MeetingExpertJudgeReq + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Data +public class MeetingExpertJudgeReq { + + private Long id; + + @NotNull(message = "会议ID不能为空") + private Long meetingId; + + @NotNull(message = "会议专家ID不能为空") + private Long meetingExpertId; + + @ApiModelProperty("评分(1~10)") + @NotNull(message = "评分不能为空") + private Integer score; + + @ApiModelProperty("是否参加:1 准时、2 迟到、3 缺席") + @NotNull(message = "是否参加不能为空") + private Integer attended; + + @ApiModelProperty("参与程度:1 积极、2 消极") + @NotNull(message = "参与度不能为空") + private Integer performance; + + @ApiModelProperty("是否提出建议:true 是、false 否") + @NotNull(message = "是否提出建议不能为空") + private Boolean advised; + + @ApiModelProperty("是否早退:true 早退、false 未早退") + @NotNull(message = "是否早退不能为空") + private Boolean leaveEarly; + + @ApiModelProperty("是否违规:true 是、false 否") + @NotNull(message = "是否违规不能为空") + private Boolean brokeRule; + + @ApiModelProperty("违规内容") + private String brokeRuleContent; + + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createOn; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java index 5c6e43a..c502c6e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/MeetingByManagerVO.java @@ -29,6 +29,9 @@ public class MeetingByManagerVO { @ApiModelProperty("会议ID") private Long meetingId; + @ApiModelProperty("会议专家ID") + private Long meetingExpertId; + @ApiModelProperty("会议开始时间") @JSONField(format = "yyyy-MM-dd HH:mm") private LocalDateTime startTime; @@ -70,4 +73,7 @@ public class MeetingByManagerVO { @ApiModelProperty("联系方式") private String contact; + @ApiModelProperty("是否评价") + private Boolean hasJudge; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java new file mode 100644 index 0000000..323eda3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingExpertJudgeManage.java @@ -0,0 +1,80 @@ +package com.ningdatech.pmapi.meeting.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.cache.lock.DistributedLock; +import com.ningdatech.pmapi.meeting.entity.domain.Meeting; +import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; +import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; +import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; +import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; +import com.ningdatech.pmapi.meeting.entity.req.MeetingExpertJudgeReq; +import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService; +import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; +import com.ningdatech.pmapi.meeting.service.IMeetingService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * MeetingExpertJudgeManage + *

+ * + * @author WendyYang + * @since 2023/7/31 + **/ +@Component +@AllArgsConstructor +public class MeetingExpertJudgeManage { + + private final IMeetingExpertJudgeService expertJudgeService; + private final IMeetingExpertService meetingExpertService; + private final IMeetingService meetingService; + private final DistributedLock distributedLock; + + private MeetingExpertJudge getMeetingExpertJudge(Long meetingExpertId) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MeetingExpertJudge.class) + .eq(MeetingExpertJudge::getMeetingExpertId, meetingExpertId); + return expertJudgeService.getOne(query); + } + + public void saveExpertJudge(MeetingExpertJudgeReq req) { + String key = "lock_expert_judge:" + req.getMeetingExpertId(); + if (!distributedLock.lock(key, 3)) { + throw BizException.wrap("履职评价失败,请重试"); + } + try { + // 会议状态校验 + Meeting meeting = meetingService.getById(req.getMeetingId()); + if (meeting == null || MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { + throw BizException.wrap("会议不存在或已取消"); + } + // 专家抽取状态校验 + MeetingExpert expert = meetingExpertService.getById(req.getMeetingExpertId()); + if (expert == null || (ExpertAttendStatusEnum.AGREED.eq(expert.getStatus()) + && ExpertAttendStatusEnum.ON_LEAVE.eq(expert.getStatus()))) { + throw BizException.wrap("未被抽中专家无法进行履职评价"); + } + // 智能履职评价一次 + MeetingExpertJudge judge = getMeetingExpertJudge(req.getMeetingExpertId()); + if (judge != null) { + throw BizException.wrap("履职评价已提交"); + } + MeetingExpertJudge entity = BeanUtil.copyProperties(req, MeetingExpertJudge.class); + expertJudgeService.save(entity); + } finally { + distributedLock.releaseLock(key); + } + } + + public MeetingExpertJudgeReq expertJudgeDetail(Long meetingExpertId) { + MeetingExpertJudge judge = getMeetingExpertJudge(meetingExpertId); + if (judge == null) { + throw BizException.wrap("履职评价未提交"); + } + return BeanUtil.copyProperties(judge, MeetingExpertJudgeReq.class); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 96e61d9..f55c4e3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -97,6 +97,7 @@ public class MeetingManage { private final ExpertInviteHelper expertInviteHelper; private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; private final MeetingDataScopeHelper meetingDataScopeHelper; + private final IMeetingExpertJudgeService expertJudgeService; private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; private static final String MEETING_CREATE_KEY = "MEETING_CREATE:"; @@ -324,7 +325,11 @@ public class MeetingManage { return PageVo.empty(); } Map mapByMeetingId = new HashMap<>(16); - meetings.forEach(w -> mapByMeetingId.put(w.getMeetingId(), w)); + List meetingExpertIds = new ArrayList<>(); + meetings.forEach(w -> { + mapByMeetingId.put(w.getMeetingId(), w); + meetingExpertIds.add(w.getMeetingExpertId()); + }); LambdaQueryWrapper query = new LambdaQueryWrapper() .orderByDesc(Meeting::getCreateOn) .in(Meeting::getId, mapByMeetingId.keySet()) @@ -337,11 +342,14 @@ public class MeetingManage { if (page.getTotal() == 0) { return PageVo.empty(); } + List existsMeIds = expertJudgeService.listExistsMeetingExpertIds(meetingExpertIds); PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); page.getRecords().forEach(meeting -> { MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); MeetingAndAttendStatusDTO info = mapByMeetingId.get(meeting.getId()); + item.setMeetingExpertId(info.getMeetingExpertId()); item.setExpertStatus(info.getStatus()); + item.setHasJudge(existsMeIds.contains(info.getMeetingExpertId())); result.getRecords().add(item); }); return result; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java new file mode 100644 index 0000000..d178d32 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.meeting.mapper; + +import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-07-31 + */ +public interface MeetingExpertJudgeMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml new file mode 100644 index 0000000..25776c8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertJudgeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml index f83ff1d..619829d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml @@ -4,7 +4,7 @@