党政同责评分 部门总分

This commit is contained in:
mythxb 2024-04-02 17:25:52 +08:00
parent adad656fd1
commit 13a3e4eb17
7 changed files with 251 additions and 2 deletions

View File

@ -0,0 +1,74 @@
package com.rzyc.bean.ex;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
* @author dong
* @date 2024-04-02 16:27
* @Version V1.0
*/
@ApiModel("管理员评分")
public class ItemRatingDto {
@NotNull(message = "用户不能为空")
@ApiModelProperty(value = "用户id",required = true)
private String userId;
@NotNull(message = "评分标准不能为空")
@ApiModelProperty(value = "评分标准id",required = true)
private String standardId;
@NotNull(message = "分数")
@ApiModelProperty(value = "评分标准id",required = true)
private Double score;
@NotNull(message = "部门不能为空")
@ApiModelProperty(value = "部门id",required = true)
private String performId;
@ApiModelProperty(value = "意见建议")
private String opinion;
public String getOpinion() {
return opinion;
}
public void setOpinion(String opinion) {
this.opinion = opinion;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getStandardId() {
return standardId;
}
public void setStandardId(String standardId) {
this.standardId = standardId;
}
public Double getScore() {
return score;
}
public void setScore(Double score) {
this.score = score;
}
public String getPerformId() {
return performId;
}
public void setPerformId(String performId) {
this.performId = performId;
}
}

View File

@ -0,0 +1,40 @@
package com.rzyc.bean.ex;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
* @author dong
* @date 2024-04-02 17:10
* @Version V1.0
*/
@ApiModel("考核总分")
public class UnitTotalScoreDto {
@NotNull(message = "考核不能为空")
@ApiModelProperty(value = "考核id",required = true)
private String examineId;
@NotNull(message = "部门不能为空")
@ApiModelProperty(value = "部门id",required = true)
private String performId;
public String getExamineId() {
return examineId;
}
public void setExamineId(String examineId) {
this.examineId = examineId;
}
public String getPerformId() {
return performId;
}
public void setPerformId(String performId) {
this.performId = performId;
}
}

View File

@ -2,6 +2,7 @@ package com.rzyc.mapper.ex;
import com.rzyc.model.ex.ExPerform; import com.rzyc.model.ex.ExPerform;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/** /**
* <p> * <p>
@ -13,4 +14,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface ExPerformMapper extends BaseMapper<ExPerform> { public interface ExPerformMapper extends BaseMapper<ExPerform> {
/*查询总分*/
ExPerform findPerform(@Param("performId") String performId,
@Param("examineId") String examineId);
} }

View File

@ -5,6 +5,8 @@ import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -42,6 +44,7 @@ public class ExPerform implements Serializable {
@TableField("user_id") @TableField("user_id")
private String userId; private String userId;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@TableField("create_time") @TableField("create_time")
private Date createTime; private Date createTime;
@ -50,6 +53,7 @@ public class ExPerform implements Serializable {
@TableField("create_by") @TableField("create_by")
private String createBy; private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
@TableField("modify_time") @TableField("modify_time")
private Date modifyTime; private Date modifyTime;

View File

@ -20,4 +20,12 @@
relation_id, perform_id, examine_id, socre_num, user_id, create_time, create_by, modify_time, modify_by relation_id, perform_id, examine_id, socre_num, user_id, create_time, create_by, modify_time, modify_by
</sql> </sql>
<!--查询总分-->
<select id="findPerform" resultMap="BaseResultMap">
SELECT *
FROM ex_perform ep
WHERE ep.`perform_id` = #{performId}
AND ep.`examine_id` = #{examineId}
</select>
</mapper> </mapper>

View File

@ -95,8 +95,10 @@
LEFT JOIN `ex_score` sc ON es.`standard_id` = sc.`standard_id` LEFT JOIN `ex_score` sc ON es.`standard_id` = sc.`standard_id`
AND sc.`perform_id` = #{performId} AND sc.`perform_id` = #{performId}
LEFT JOIN `ex_score_file` sf ON sc.`socre_id` = sf.`socre_id` LEFT JOIN `ex_score_file` sf ON sc.`socre_id` = sf.`socre_id`
WHERE es.`item_type` = #{itemType} WHERE es.`examine_state` = #{examineState}
AND es.`examine_state` = #{examineState} <if test="null != itemType">
AND es.`item_type` = #{itemType}
</if>
AND es.`examine_id` = #{examineId} AND es.`examine_id` = #{examineId}
AND (es.`perform_id` = #{performId} OR es.`perform_id` IS NULL OR es.`perform_id` = '') AND (es.`perform_id` = #{performId} OR es.`perform_id` IS NULL OR es.`perform_id` = '')
ORDER BY es.`sort_id` ASC; ORDER BY es.`sort_id` ASC;

View File

@ -677,4 +677,120 @@ public class ExamineController extends BaseController{
return result; return result;
} }
/**
* 考核项评分
* @version v1.0
* @author dong
* @date 2024/4/2 16:27
*/
@LoginAuth
@ApiOperation(value = "考核项评分", notes = "考核项评分")
@PostMapping(value = "itemRating")
public SingleResult<String> itemRating(@Valid @RequestBody ItemRatingDto itemRatingDto)throws Exception{
SingleResult<String> result = new SingleResult<>();
//查询指标项
ExStandard standard = exStandardMapper.selectById(itemRatingDto.getStandardId());
if(null != standard){
//单项分数
ExScore exScore = exScoreMapper.findByPerformId(itemRatingDto.getStandardId(),itemRatingDto.getPerformId());
if(null == exScore){
exScore = new ExScore();
exScore.setSocreId(RandomNumber.getUUid());
exScore.setExamineId(standard.getExamineId());
exScore.setPerformId(itemRatingDto.getPerformId());
exScore.setStandardId(standard.getStandardId());
exScore.setOpinion(itemRatingDto.getOpinion());
exScore.setSocreNum(itemRatingDto.getScore());
exScore.setCreateTime(new Date());
exScore.setModifyTime(new Date());
exScore.setCreateBy(itemRatingDto.getUserId());
exScore.setModifyBy(itemRatingDto.getUserId());
exScoreMapper.insert(exScore);
}else{
ExScore score = new ExScore();
score.setSocreId(exScore.getSocreId());
score.setSocreNum(itemRatingDto.getScore());
score.setOpinion(itemRatingDto.getOpinion());
score.setModifyTime(new Date());
score.setModifyBy(itemRatingDto.getUserId());
exScoreMapper.updateById(score);
}
//计算总分
handleTotalScore(itemRatingDto.getPerformId(),standard.getExamineId(),itemRatingDto.getUserId());
}
return result;
}
/**
* 计算总分
* @version v1.0
* @author dong
* @date 2024/4/2 17:07
*/
private ExPerform handleTotalScore(String PerformId,String examineId,String userId)throws Exception{
Double scoreNum = 0.0;
ListPerform listPerform = listPerformMapper.selectByPrimaryKey(PerformId);
if(null != listPerform){
//计算总分
List<StandardInfo> exStandards = exStandardMapper.standardScoreList(null,listPerform.getExamineState(),examineId,PerformId);
if(null != exStandards && exStandards.size() > 0){
for (StandardInfo standardInfo : exStandards){
if(null != standardInfo.getSocreNum()){
scoreNum += standardInfo.getSocreNum();
}
}
}
}
ExPerform exPerform = exPerformMapper.findPerform(PerformId,examineId);
if(null == exPerform){
exPerform = new ExPerform();
exPerform.setRelationId(RandomNumber.getUUid());
exPerform.setPerformId(PerformId);
exPerform.setExamineId(examineId);
exPerform.setSocreNum(scoreNum);
exPerform.setUserId(userId);
exPerform.setCreateTime(new Date());
exPerform.setModifyTime(new Date());
exPerform.setCreateBy(userId);
exPerform.setModifyBy(userId);
exPerformMapper.insert(exPerform);
}else{
exPerform.setSocreNum(scoreNum);
exPerform.setUserId(userId);
exPerform.setModifyTime(new Date());
exPerform.setModifyBy(userId);
exPerformMapper.updateById(exPerform);
}
return exPerform;
}
/**
* 部门考核总分
* @version v1.0
* @author dong
* @date 2024/4/2 15:17
*/
@LoginAuth
@ApiOperation(value = "部门考核总分", notes = "部门考核总分")
@GetMapping(value = "unitTotalScore")
public SingleResult<ExPerform> unitTotalScore(@Valid UnitTotalScoreDto unitTotalScoreDto)throws Exception{
SingleResult<ExPerform> result = new SingleResult<>();
ExPerform exPerform = handleTotalScore(unitTotalScoreDto.getPerformId(),unitTotalScoreDto.getExamineId(),getUserId());
result.setData(exPerform);
return result;
}
} }