我的已办修改;考核任务清单中查看评分详情加上指标得分;问题整改查询

master
wany 2024-09-11 14:03:44 +08:00
parent 55f0174f8c
commit 9613abd60d
9 changed files with 173 additions and 18 deletions

View File

@ -1,8 +1,12 @@
package com.gunshi.project.xyt.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.entity.so.AssessTaskPageSo;
import com.gunshi.project.xyt.entity.vo.AssessRatingVo;
import com.gunshi.project.xyt.entity.vo.AssessRectifyVo;
import com.gunshi.project.xyt.entity.vo.AssessScoreVo;
import com.gunshi.project.xyt.model.AssessTeamRating;
import com.gunshi.project.xyt.service.AssessTeamRatingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
@ -52,6 +56,17 @@ public class AssessTeamRatingController extends AbstractCommonFileController{
return R.ok(service.scoreDetail(objectId));
}
@Operation(summary = "考核问题整改")
@PostMapping("/list/page")
public R<Page<AssessRectifyVo>> listPage(@Validated @RequestBody AssessTaskPageSo page) {
return R.ok(service.listPage(page));
}
@Operation(summary = "整改")
@PostMapping("/rectify")
public R<String> rectify(@Validated @RequestBody AssessTeamRating rating) {
return R.ok(service.rectify(rating));
}
@Override
public String getGroupId() {

View File

@ -27,10 +27,13 @@ public class AssessTaskPageSo {
@Schema(description="考核任务名称")
private String taskName;
@Schema(description="状态0未启动 1评分中 2审核中 3已审核 5已作废")
@Schema(description="任务状态0未启动 1评分中 2审核中 3已审核 5已作废;整改状态0未整改 1已整改")
private Integer status;
@Schema(description="当前登录人id")
private Long userId;
@Schema(description="整改对象")
private String objectUserName;
}

View File

@ -6,6 +6,8 @@ import com.gunshi.project.xyt.model.AssessTeamRating;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class AssessRatingVo extends AssessTeamRating {
@ -22,6 +24,9 @@ public class AssessRatingVo extends AssessTeamRating {
@Schema(description="标准分数")
private Integer standardScore;
@Schema(description="指标得分")
private BigDecimal indicatorScore;
@Schema(description="考核成员id")
@JsonSerialize(using = ToStringSerializer.class)
private Long teamUserId;

View File

@ -0,0 +1,35 @@
package com.gunshi.project.xyt.entity.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.gunshi.project.xyt.model.AssessTeamRating;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class AssessRectifyVo extends AssessTeamRating {
@Schema(description="考核类目id")
@JsonSerialize(using = ToStringSerializer.class)
private Long categoryId;
@Schema(description="考核类目名称")
private String name;
@Schema(description="指标名称")
private String indicatorName;
@Schema(description="任务名称")
private String taskName;
@Schema(description="考核对象id")
@JsonSerialize(using = ToStringSerializer.class)
private Long objectUserId;
@Schema(description="考核对象")
private String objectUserName;
@Schema(description="考核等级1优秀 2良好 3合格")
private Integer assessLevel;
}

View File

@ -32,12 +32,7 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
<script>
select t.* from public.assess_task t where t.status != 4 and t.id in
(select distinct(task_id) from public.assess_team where team_user_id = #{obj.userId}
<if test="type == 1">
and status in (1,9)
</if>
<if test="type == 2">
and status = 2
</if>
and status in (1,9)
)
<if test="obj.taskName != null and obj.taskName != ''">
and t.task_name like concat('%', #{obj.taskName}, '%')
@ -53,7 +48,29 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
</if>
</script>
""")
Page<AssessTask> myTodo(Page<AssessTask> page,@Param("obj") AssessTaskPageSo page1,@Param("type") Integer type);
Page<AssessTask> myTodo(Page<AssessTask> page,@Param("obj") AssessTaskPageSo page1);
@Select("""
<script>
select t.* from public.assess_task t where t.status != 4 and t.id in
<foreach collection="taskIds" item="id" separator="," open="(" close=")">
#{id}
</foreach>
<if test="obj.taskName != null and obj.taskName != ''">
and t.task_name like concat('%', #{obj.taskName}, '%')
</if>
<if test="obj.dateRangeSo != null and obj.dateRangeSo.start != null">
and t.start_date <![CDATA[>=]]> #{obj.dateRangeSo.start}
</if>
<if test="obj.dateRangeSo != null and obj.dateRangeSo.end != null">
and t.start_date <![CDATA[<=]]> #{obj.dateRangeSo.end}
</if>
<if test="obj.status != null">
and t.status = #{obj.status}
</if>
</script>
""")
Page<AssessTask> myDone(Page<AssessTask> page,@Param("obj") AssessTaskPageSo page1,@Param("taskIds") List<Long> taskIds);
@Select("""
<script>
@ -74,4 +91,13 @@ public interface AssessTaskMapper extends BaseMapper<AssessTask> {
</script>
""")
List<AssessResultVo> result(@Param("taskId") Long id);
@Select("""
<script>
select m.task_id from (
select task_id,count(task_id) as count1,count(status = 2 or null) as count2
from assess_team where team_user_id =#{userId} group by task_id ) m where m.count1 = m.count2
</script>
""")
List<Long> myDoneTask(@Param("userId") Long userId);
}

View File

@ -1,7 +1,10 @@
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.entity.so.AssessTaskPageSo;
import com.gunshi.project.xyt.entity.vo.AssessRatingVo;
import com.gunshi.project.xyt.entity.vo.AssessRectifyVo;
import com.gunshi.project.xyt.model.AssessTeamRating;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -30,13 +33,43 @@ public interface AssessTeamRatingMapper extends BaseMapper<AssessTeamRating> {
@Select("""
<script>
select t1.*,t2.indicator_name,t2.category_id,t3.name,t4.team_user_id,t4.team_user_name from public.assess_team_rating t1
select t1.*,t2.indicator_name,t2.category_id,t3.name,t4.team_user_id,t4.team_user_name,t5.assess_score as indicatorScore from public.assess_team_rating t1
left join public.assess_indicator t2 on t1.indicator_id = t2.id
left join public.assess_category t3 on t2.category_id = t3.id
left join public.assess_team t4 on t1.team_id = t4.id
left join public.assess_object_rating t5 on t1.indicator_id = t5.indicator_id
where t1.team_id in (select id from public.assess_team where object_id = #{objectId})
and t5.object_id = #{objectId}
order by t2.order_index
</script>
""")
List<AssessRatingVo> scoreByObjectId(@Param("objectId") Long objectId);
@Select("""
<script>
select t.*,t1.object_id,t2.object_user_name,t2.assess_level,t3.indicator_name,t4.name,t5.task_name from public.assess_team_rating t\s
left join public.assess_team t1 on t.team_id = t1.id
left join public.assess_object t2 on t1.object_id = t2.id
left join public.assess_indicator t3 on t.indicator_id = t3.id
left join public.assess_category t4 on t3.category_id = t4.id
left join public.assess_task t5 on t1.task_id = t5.id
where t.is_need_rectify = 1
<if test="obj.userId != null">
and t.object_id = #{obj.userId}
</if>
<if test="obj.taskName != null and obj.taskName != ''">
and t5.task_name like concat('%', #{obj.taskName}, '%')
</if>
<if test="obj.dateRangeSo != null and obj.dateRangeSo.start != null">
and t.rectify_last_date <![CDATA[>=]]> #{obj.dateRangeSo.start}
</if>
<if test="obj.dateRangeSo != null and obj.dateRangeSo.end != null">
and t.rectify_last_date <![CDATA[<=]]> #{obj.dateRangeSo.end}
</if>
<if test="obj.status != null">
and t.rectify_status = #{obj.status}
</if>
</script>
""")
Page<AssessRectifyVo> listPage(Page<AssessRectifyVo> page,@Param("obj") AssessTaskPageSo page1);
}

View File

@ -104,10 +104,6 @@ public class AssessTeamRating implements Serializable {
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
private Date rectifyLastDate;
@TableField(exist = false)
@Schema(description = "现场图片")
private List<FileAssociations> files;
/**
* 0 1
*/
@ -131,4 +127,12 @@ public class AssessTeamRating implements Serializable {
@Size(max = 500,message = "整改说明最大长度要小于 500")
private String rectifyDesc;
@TableField(exist = false)
@Schema(description = "现场图片")
private List<FileAssociations> files;
@TableField(exist = false)
@Schema(description = "整改附件")
private List<FileAssociations> rectifyFiles;
}

View File

@ -1,6 +1,7 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -134,7 +135,7 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
}
public Page<AssessTask> myTodo(AssessTaskPageSo page) {
Page<AssessTask> res = this.baseMapper.myTodo(page.getPageSo().toPage(), page,1);
Page<AssessTask> res = this.baseMapper.myTodo(page.getPageSo().toPage(),page);
if (res.getRecords() != null && res.getRecords().size() > 0) {
fillObject(res.getRecords(),page.getUserId());
}
@ -149,7 +150,11 @@ public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
}
public Page<AssessTask> myDone(AssessTaskPageSo page) {
Page<AssessTask> res = this.baseMapper.myTodo(page.getPageSo().toPage(), page,2);
List<Long> taskIds = this.baseMapper.myDoneTask(page.getUserId());
if (CollectionUtils.isEmpty(taskIds)) {
return null;
}
Page<AssessTask> res = this.baseMapper.myDone(page.getPageSo().toPage(), page,taskIds);
if (res.getRecords() != null && res.getRecords().size() > 0) {
fillObject(res.getRecords(),page.getUserId());
}

View File

@ -3,8 +3,11 @@ package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.entity.so.AssessTaskPageSo;
import com.gunshi.project.xyt.entity.vo.AssessRatingVo;
import com.gunshi.project.xyt.entity.vo.AssessRectifyVo;
import com.gunshi.project.xyt.entity.vo.AssessScoreVo;
import com.gunshi.project.xyt.mapper.*;
import com.gunshi.project.xyt.model.*;
@ -56,7 +59,7 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
this.delData(teamId);
for(AssessTeamRating rating : ratings){
rating.setId(IdWorker.getId());
fileService.saveFile(rating.getFiles(), getGroupId(), rating.getId().toString());
fileService.save(rating.getFiles(), rating.getId().toString(), getGroupId(),getScoreType());
}
AssessTask task = taskMapper.selectById(vo.getTaskId());
//更新该考核人员对考核对象的状态为已评分
@ -154,11 +157,19 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
return "assessTeamRating";
}
public String getScoreType() {
return "assessScore";
}
public String getRectifyType() {
return "assessRectify";
}
public List<AssessRatingVo> doDetail(Long teamId) {
List<AssessRatingVo> list = this.baseMapper.scoreDetail(teamId);
for (AssessRatingVo vo : list){
if(vo.getIsNeedRectify() == 1){
vo.setFiles(fileService.getFiles(getGroupId(),vo.getId().toString()));
vo.setFiles(fileService.queryFileList(vo.getId().toString(),getGroupId(),getScoreType()));
}
}
return list;
@ -168,7 +179,7 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
List<AssessTeamRating> ratings = vo.getRatings();
for(AssessTeamRating rating : ratings){
rating.setId(IdWorker.getId());
fileService.saveFile(rating.getFiles(), getGroupId(), rating.getId().toString());
fileService.save(rating.getFiles(), rating.getId().toString(), getGroupId(),getScoreType());
}
Long teamId = ratings.get(0).getTeamId();
this.delData(teamId);
@ -183,6 +194,24 @@ public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper,
List<AssessRatingVo> list = this.baseMapper.scoreByObjectId(objectId);
return list.stream().collect(Collectors.groupingBy(AssessTeamRating::getIndicatorId));
}
public Page<AssessRectifyVo> listPage(AssessTaskPageSo page) {
Page<AssessRectifyVo> res = this.baseMapper.listPage(page.getPageSo().toPage(), page);
if (res.getRecords() != null && res.getRecords().size() > 0) {
for (AssessRectifyVo record : res.getRecords()) {
record.setFiles(fileService.queryFileList(record.getId().toString(),getGroupId(),getScoreType()));
record.setRectifyFiles(fileService.queryFileList(record.getId().toString(),getGroupId(),getRectifyType()));
}
}
return res;
}
public String rectify(AssessTeamRating rating) {
rating.setRectifyStatus(1);
this.updateById(rating);
fileService.save(rating.getRectifyFiles(),rating.getId().toString(),getGroupId(),getRectifyType());
return "整改成功";
}
}