考核任务
parent
9dad212d54
commit
50dc78cd13
|
|
@ -0,0 +1,77 @@
|
|||
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.model.AssessTask;
|
||||
import com.gunshi.project.xyt.service.AssessTaskService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
/**
|
||||
* 描述: 考核任务
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:04
|
||||
*/
|
||||
@Tag(name = "考核任务")
|
||||
@RestController
|
||||
@RequestMapping(value="/assessTask")
|
||||
public class AssessTaskController extends AbstractCommonFileController{
|
||||
|
||||
@Autowired
|
||||
private AssessTaskService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<AssessTask> insert(@Validated(Insert.class) @RequestBody AssessTask dto) {
|
||||
return R.ok(service.saveData(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<AssessTask> update(@Validated(Update.class) @RequestBody AssessTask dto) {
|
||||
return R.ok(service.updateData(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Long id) {
|
||||
return R.ok(service.delData(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "详情")
|
||||
@GetMapping("/detail/{id}")
|
||||
public R<AssessTask> detail(@Schema(name = "id") @PathVariable("id") Long id) {
|
||||
return R.ok(service.detail(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "考核任务清单")
|
||||
@PostMapping("/list/page")
|
||||
public R<Page<AssessTask>> listPage(@Validated @RequestBody AssessTaskPageSo page) {
|
||||
return R.ok(service.listPage(page));
|
||||
}
|
||||
|
||||
@Operation(summary = "启动")
|
||||
@GetMapping("/start/{id}")
|
||||
public R<String> start(@Schema(name = "id") @PathVariable("id") Long id) {
|
||||
return R.ok(service.start(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "考核任务清单")
|
||||
@PostMapping("/myTodo/page")
|
||||
public R<Page<AssessTask>> myTodo(@Validated @RequestBody AssessTaskPageSo page) {
|
||||
return R.ok(service.myTodo(page));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "assessTask";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.gunshi.core.result.R;
|
||||
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.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核评分详情
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:20:04
|
||||
*/
|
||||
@Tag(name = "考核评分详情")
|
||||
@RestController
|
||||
@RequestMapping(value="/assessTeamRating")
|
||||
public class AssessTeamRatingController extends AbstractCommonFileController{
|
||||
|
||||
@Autowired
|
||||
private AssessTeamRatingService service;
|
||||
|
||||
|
||||
@Operation(summary = "评分")
|
||||
@PostMapping("/score")
|
||||
public R<Boolean> score(@Validated @RequestBody List<AssessTeamRating> dto) {
|
||||
return R.ok(service.score(dto));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "assessTeamRating";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.gunshi.project.xyt.entity.so;
|
||||
|
||||
import com.gunshi.db.dto.DateRangeSo;
|
||||
import com.gunshi.db.dto.PageSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Created by wanyan on 2024/3/19
|
||||
*
|
||||
* @author wanyan
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "考核任务分页查询对象")
|
||||
public class AssessTaskPageSo {
|
||||
|
||||
@NotNull(message = "分页参数不能为空")
|
||||
@Schema(description = "分页参数")
|
||||
private PageSo pageSo;
|
||||
|
||||
@Schema(description="时段")
|
||||
private DateRangeSo dateRangeSo;
|
||||
|
||||
@Schema(description="考核任务名称")
|
||||
private String taskName;
|
||||
|
||||
@Schema(description="状态(0未启动 1评分中 2审核中 3已审核 5已作废)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="当前登录人id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.AssessObject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核对象
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:30
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssessObjectMapper extends BaseMapper<AssessObject> {
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t1.id from public.assess_assess_object t1
|
||||
where t1.task_id = #{taskId}
|
||||
</script>
|
||||
""")
|
||||
List<Long> queryObjectByTaskId(@Param("taskId") Long taskId);
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
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.model.AssessTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核任务
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:04
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssessTaskMapper extends BaseMapper<AssessTask> {
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t1.indicator_id from public.assess_template_indicator_rel t1
|
||||
where t1.template_id = #{templateId}
|
||||
</script>
|
||||
""")
|
||||
List<Long> queryIndicators(@Param("templateId") Long templateId);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.* from public.assess_task t where t.task_id in
|
||||
(select distinct(task_id) from public.assess_team where team_user_id = #{obj.userId} and status = 1)
|
||||
<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.end_date <![CDATA[<=]]> #{obj.dateRangeSo.end}
|
||||
</if>
|
||||
<if test="obj.status != null">
|
||||
and t.status = #{obj.status}
|
||||
</if>
|
||||
</script>
|
||||
""")
|
||||
Page<AssessTask> myTodo(Page<AssessTask> page,@Param("obj") AssessTaskPageSo page1);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.AssessTeam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 考核组成员
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:47
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssessTeamMapper extends BaseMapper<AssessTeam> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.AssessTeamRating;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 考核评分详情
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:20:04
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssessTeamRatingMapper extends BaseMapper<AssessTeamRating> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 描述: 考核对象
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:30
|
||||
*/
|
||||
@Schema(description="考核对象")
|
||||
@Data
|
||||
@TableName("public.assess_object")
|
||||
public class AssessObject implements Serializable {
|
||||
|
||||
public final static String thisTableName = "AssessObject";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 考核任务id
|
||||
*/
|
||||
@TableField(value="task_id")
|
||||
@Schema(description="考核任务id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 考核对象id
|
||||
*/
|
||||
@TableField(value="object_user_id")
|
||||
@Schema(description="考核对象id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long objectUserId;
|
||||
|
||||
/**
|
||||
* 考核对象
|
||||
*/
|
||||
@TableField(value="object_user_name")
|
||||
@Schema(description="考核对象")
|
||||
@Size(max = 100,message = "考核对象最大长度要小于 100")
|
||||
private String objectUserName;
|
||||
|
||||
/**
|
||||
* 标准得分
|
||||
*/
|
||||
@TableField(value="standard_score")
|
||||
@Schema(description="标准得分")
|
||||
private Integer standardScore;
|
||||
|
||||
/**
|
||||
* 考核得分
|
||||
*/
|
||||
@TableField(value="assess_score")
|
||||
@Schema(description="考核得分")
|
||||
private BigDecimal assessScore;
|
||||
|
||||
/**
|
||||
* 考核等级(1优秀 2良好 3合格)
|
||||
*/
|
||||
@TableField(value="assess_level")
|
||||
@Schema(description="考核等级(1优秀 2良好 3合格)")
|
||||
private Integer assessLevel;
|
||||
|
||||
/**
|
||||
* 状态(0未启动 1评分中 2已完成)
|
||||
*/
|
||||
@TableField(value="status")
|
||||
@Schema(description="状态(0未启动 1评分中 2已完成)")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核任务
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:04
|
||||
*/
|
||||
@Schema(description="考核任务")
|
||||
@Data
|
||||
@TableName("public.assess_task")
|
||||
public class AssessTask implements Serializable {
|
||||
|
||||
public final static String thisTableName = "AssessTask";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 考核任务名称
|
||||
*/
|
||||
@TableField(value="task_name")
|
||||
@Schema(description="考核任务名称")
|
||||
@Size(max = 100,message = "考核任务名称最大长度要小于 100")
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 考核频次(1年度 2季度 3月度)
|
||||
*/
|
||||
@TableField(value="task_freq")
|
||||
@Schema(description="考核频次(1年度 2季度 3月度)")
|
||||
private Integer taskFreq;
|
||||
|
||||
/**
|
||||
* 综合计算得分方式(1取最低 2平均)
|
||||
*/
|
||||
@TableField(value="score_way")
|
||||
@Schema(description="综合计算得分方式(1取最低 2平均)")
|
||||
private Integer scoreWay;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
@TableField(value="template_id")
|
||||
@Schema(description="模板id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long templateId;
|
||||
|
||||
/**
|
||||
* 考核批次
|
||||
*/
|
||||
@TableField(value="assess_batch")
|
||||
@Schema(description="考核批次")
|
||||
@Size(max = 100,message = "考核批次最大长度要小于 100")
|
||||
private String assessBatch;
|
||||
|
||||
/**
|
||||
* 考核周期开始日期
|
||||
*/
|
||||
@TableField(value="start_date")
|
||||
@Schema(description="考核周期开始日期")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 考核周期结束日期
|
||||
*/
|
||||
@TableField(value="end_date")
|
||||
@Schema(description="考核周期结束日期")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 状态(0未启动 1评分中 2审核中 3已审核 5已作废)
|
||||
*/
|
||||
@TableField(value="status")
|
||||
@Schema(description="状态(0未启动 1评分中 2审核中 3已审核 5已作废)")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@TableField(value="create_user_id")
|
||||
@Schema(description="创建人id")
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
@TableField(value="create_user_name")
|
||||
@Schema(description="创建人名称")
|
||||
@Size(max = 100,message = "创建人名称最大长度要小于 100")
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value="create_time")
|
||||
@Schema(description="创建时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "考核组成员")
|
||||
private List<AssessTeam> assessTeams;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "考核对象")
|
||||
private List<AssessObject> assessObjects;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "考核方案")
|
||||
private List<FileAssociations> files;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 描述: 考核组成员
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:46
|
||||
*/
|
||||
@Schema(description="考核组成员")
|
||||
@Data
|
||||
@TableName("public.assess_team")
|
||||
public class AssessTeam implements Serializable {
|
||||
|
||||
public final static String thisTableName = "AssessTeam";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 考核对象id
|
||||
*/
|
||||
@TableField(value="task_id")
|
||||
@Schema(description="考核任务id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 考核对象id
|
||||
*/
|
||||
@TableField(value="object_id")
|
||||
@Schema(description="考核对象id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 考核成员id
|
||||
*/
|
||||
@TableField(value="team_user_id")
|
||||
@Schema(description="考核成员id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long teamUserId;
|
||||
|
||||
/**
|
||||
* 考核成员
|
||||
*/
|
||||
@TableField(value="team_user_name")
|
||||
@Schema(description="考核成员")
|
||||
@Size(max = 100,message = "考核成员最大长度要小于 100")
|
||||
private String teamUserName;
|
||||
|
||||
/**
|
||||
* 标准得分
|
||||
*/
|
||||
@TableField(value="standard_score")
|
||||
@Schema(description="标准得分")
|
||||
private Integer standardScore;
|
||||
|
||||
/**
|
||||
* 考核得分
|
||||
*/
|
||||
@TableField(value="assess_score")
|
||||
@Schema(description="考核得分")
|
||||
private BigDecimal assessScore;
|
||||
|
||||
/**
|
||||
* 考核等级(1优秀 2良好 3合格)
|
||||
*/
|
||||
@TableField(value="assess_level")
|
||||
@Schema(description="考核等级(1优秀 2良好 3合格)")
|
||||
private Integer assessLevel;
|
||||
|
||||
/**
|
||||
* 状态(0未启动 1评分中 2已完成)
|
||||
*/
|
||||
@TableField(value="status")
|
||||
@Schema(description="状态(0未启动 1评分中 2已完成)")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核评分详情
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:20:03
|
||||
*/
|
||||
@Schema(description="考核评分详情")
|
||||
@Data
|
||||
@TableName("public.assess_team_rating")
|
||||
public class AssessTeamRating implements Serializable {
|
||||
|
||||
public final static String thisTableName = "AssessTeamRating";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 考核成员id
|
||||
*/
|
||||
@TableField(value="team_id")
|
||||
@Schema(description="考核成员id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 考核指标id
|
||||
*/
|
||||
@TableField(value="indicator_id")
|
||||
@Schema(description="考核指标id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long indicatorId;
|
||||
|
||||
/**
|
||||
* 标准分数
|
||||
*/
|
||||
@TableField(value="standard_score")
|
||||
@Schema(description="标准分数")
|
||||
private Integer standardScore;
|
||||
|
||||
/**
|
||||
* 考核得分
|
||||
*/
|
||||
@TableField(value="assess_score")
|
||||
@Schema(description="考核得分")
|
||||
private BigDecimal assessScore;
|
||||
|
||||
/**
|
||||
* 是否需要整改(0否 1是)
|
||||
*/
|
||||
@TableField(value="is_need_rectify")
|
||||
@Schema(description="是否需要整改(0否 1是)")
|
||||
private Integer isNeedRectify;
|
||||
|
||||
/**
|
||||
* 问题描述
|
||||
*/
|
||||
@TableField(value="problem_desc")
|
||||
@Schema(description="问题描述")
|
||||
@Size(max = 500,message = "问题描述最大长度要小于 500")
|
||||
private String problemDesc;
|
||||
|
||||
/**
|
||||
* 整改要求
|
||||
*/
|
||||
@TableField(value="rectify_requirement")
|
||||
@Schema(description="整改要求")
|
||||
@Size(max = 500,message = "整改要求最大长度要小于 500")
|
||||
private String rectifyRequirement;
|
||||
|
||||
/**
|
||||
* 整改期限
|
||||
*/
|
||||
@TableField(value="rectify_last_date")
|
||||
@Schema(description="整改期限")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
private Date rectifyLastDate;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "现场图片")
|
||||
private List<FileAssociations> files;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.AssessObjectMapper;
|
||||
import com.gunshi.project.xyt.model.AssessObject;
|
||||
import com.gunshi.project.xyt.model.AssessTeam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核对象
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AssessObjectService extends ServiceImpl<AssessObjectMapper, AssessObject>
|
||||
{
|
||||
@Autowired
|
||||
private AssessTeamService assessTeamService;
|
||||
|
||||
public void saveObject(List<AssessObject> assessObjects,List<AssessTeam> assessTeams, Long taskId) {
|
||||
List<AssessTeam> teams = new ArrayList<>();
|
||||
assessObjects.stream().forEach(o->{
|
||||
long objectId = IdWorker.getId();
|
||||
o.setId(objectId);
|
||||
o.setTaskId(taskId);
|
||||
o.setStatus(0);
|
||||
assessTeams.stream().forEach(t->{
|
||||
t.setId(IdWorker.getId());
|
||||
t.setTaskId(taskId);
|
||||
t.setObjectId(objectId);
|
||||
t.setStatus(0);
|
||||
});
|
||||
teams.addAll(assessTeams);
|
||||
});
|
||||
this.saveBatch(assessObjects);
|
||||
assessTeamService.saveBatch(teams);
|
||||
}
|
||||
|
||||
public void delObject(Long taskId) {
|
||||
assessTeamService.remove(new QueryWrapper<AssessTeam>().eq("task_id",taskId));
|
||||
this.remove(new QueryWrapper<AssessObject>().eq("task_id",taskId));
|
||||
}
|
||||
|
||||
public void updateObject(List<AssessObject> assessObjects,List<AssessTeam> assessTeams, Long taskId) {
|
||||
this.delObject(taskId);
|
||||
this.saveObject(assessObjects,assessTeams,taskId);
|
||||
}
|
||||
|
||||
public List<AssessObject> getObject(Long taskId) {
|
||||
List<AssessObject> list = this.list(new QueryWrapper<AssessObject>().eq("task_id",taskId));
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<AssessTeam> getTeam(Long taskId) {
|
||||
List<AssessTeam> list = assessTeamService.list(new QueryWrapper<AssessTeam>().eq("task_id",taskId));
|
||||
return list;
|
||||
}
|
||||
|
||||
public void updateTeams(List<AssessTeam> teams) {
|
||||
assessTeamService.updateBatchById(teams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
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.mapper.AssessTaskMapper;
|
||||
import com.gunshi.project.xyt.model.AssessObject;
|
||||
import com.gunshi.project.xyt.model.AssessTask;
|
||||
import com.gunshi.project.xyt.model.AssessTeam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 考核任务
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AssessTaskService extends ServiceImpl<AssessTaskMapper, AssessTask>
|
||||
{
|
||||
@Autowired
|
||||
private AssessObjectService assessObjectService;
|
||||
|
||||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
public AssessTask saveData(AssessTask dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
dto.setStatus(0);
|
||||
dto.setCreateTime(new Date());
|
||||
assessObjectService.saveObject(dto.getAssessObjects(),dto.getAssessTeams(),dto.getId());
|
||||
this.save(dto);
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getId().toString());
|
||||
return dto;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return "assessTask";
|
||||
}
|
||||
|
||||
public Boolean delData(Long id) {
|
||||
AssessTask task = this.getById(id);
|
||||
if (Objects.isNull(task)) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
if(task.getStatus() != 0){
|
||||
throw new IllegalArgumentException("只能删除未启动的考核任务");
|
||||
}
|
||||
fileService.deleteFile(getGroupId(),id.toString());
|
||||
assessObjectService.delObject(id);
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
public AssessTask updateData(AssessTask dto) {
|
||||
if (Objects.isNull(this.getById(dto.getId()))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean result = this.updateById(dto);
|
||||
if (result) {
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
||||
assessObjectService.updateObject(dto.getAssessObjects(),dto.getAssessTeams(),dto.getId());
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
public AssessTask detail(Long id) {
|
||||
AssessTask task = this.getById(id);
|
||||
task.setFiles(fileService.getFiles(getGroupId(),id.toString()));
|
||||
task.setAssessTeams(assessObjectService.getTeam(id));
|
||||
task.setAssessObjects(assessObjectService.getObject(id));
|
||||
return task;
|
||||
}
|
||||
|
||||
public Page<AssessTask> listPage(AssessTaskPageSo page) {
|
||||
LambdaQueryWrapper<AssessTask> queryWrapper = Wrappers.lambdaQuery();
|
||||
if (ObjectUtils.isNotNull(page.getTaskName())) {
|
||||
queryWrapper.like(AssessTask::getTaskName, page.getTaskName());
|
||||
}
|
||||
if (page.getStatus() != null) {
|
||||
queryWrapper.eq(AssessTask::getStatus, page.getStatus());
|
||||
}
|
||||
if(page.getDateRangeSo() != null && page.getDateRangeSo().getStart() != null){
|
||||
queryWrapper.ge(AssessTask::getStartDate,page.getDateRangeSo().getStart());
|
||||
}
|
||||
if(page.getDateRangeSo() != null && page.getDateRangeSo().getEnd() != null){
|
||||
queryWrapper.le(AssessTask::getEndDate,page.getDateRangeSo().getEnd());
|
||||
}
|
||||
return this.page(page.getPageSo().toPage(),queryWrapper);
|
||||
}
|
||||
|
||||
public String start(Long id) {
|
||||
AssessTask task = this.getById(id);
|
||||
task.setStatus(1);
|
||||
this.updateById(task);
|
||||
//生成考核评分任务
|
||||
Long templateId = task.getTemplateId();
|
||||
//任务中的考核对象
|
||||
List<AssessObject> objects = assessObjectService.getObject(id);
|
||||
objects.stream().forEach(o->o.setStatus(1));
|
||||
assessObjectService.updateBatchById(objects);
|
||||
//任务中的考核成员
|
||||
List<AssessTeam> teams = assessObjectService.getTeam(id);
|
||||
teams.stream().forEach(o->o.setStatus(1));
|
||||
assessObjectService.updateTeams(teams);
|
||||
return "启动成功";
|
||||
}
|
||||
|
||||
public Page<AssessTask> myTodo(AssessTaskPageSo page) {
|
||||
return this.baseMapper.myTodo(page.getPageSo().toPage(),page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.AssessTeamMapper;
|
||||
import com.gunshi.project.xyt.mapper.AssessTeamRatingMapper;
|
||||
import com.gunshi.project.xyt.model.AssessTeam;
|
||||
import com.gunshi.project.xyt.model.AssessTeamRating;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 描述: 考核评分详情
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:20:04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AssessTeamRatingService extends ServiceImpl<AssessTeamRatingMapper, AssessTeamRating>
|
||||
{
|
||||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
@Autowired
|
||||
private AssessTeamMapper teamMapper;
|
||||
|
||||
|
||||
public Boolean score(List<AssessTeamRating> dto) {
|
||||
for(AssessTeamRating rating : dto){
|
||||
rating.setId(IdWorker.getId());
|
||||
fileService.saveFile(rating.getFiles(), getGroupId(), rating.getId().toString());
|
||||
}
|
||||
//更新该考核人员对考核对象的状态为已评分
|
||||
Long teamId = dto.get(0).getTeamId();
|
||||
AssessTeam assessTeam = teamMapper.selectById(teamId);
|
||||
assessTeam.setStatus(2);
|
||||
teamMapper.updateById(assessTeam);
|
||||
updateObjectAndTask(assessTeam.getObjectId(),assessTeam.getTaskId());
|
||||
return this.saveBatch(dto);
|
||||
}
|
||||
|
||||
private void updateObjectAndTask(Long objectId, Long taskId) {
|
||||
//先判断该次评分是否是该考核对象的最后一次评分
|
||||
//todo
|
||||
// 如果为最后一次评分,就要计算该考核对象的最终得分
|
||||
teamMapper.selectCount(new QueryWrapper<AssessTeam>().eq("object_id",objectId));
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return "assessTeamRating";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.AssessTeamMapper;
|
||||
import com.gunshi.project.xyt.model.AssessTeam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 描述: 考核组成员
|
||||
* author: xusan
|
||||
* date: 2024-09-05 14:19:47
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AssessTeamService extends ServiceImpl<AssessTeamMapper, AssessTeam>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue