Merge remote-tracking branch 'origin/dev_1.1.0' into dev_1.1.0
commit
86015a72ff
|
@ -1,13 +1,24 @@
|
|||
package tech.unissense.pms.web.controller.business.examine.detail;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
||||
import tech.unissense.pms.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表控制层
|
||||
|
@ -16,14 +27,18 @@ import javax.annotation.Resource;
|
|||
* @since 2025-01-02 10:18:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("examineDetail")
|
||||
public class ExamineDetailController {
|
||||
@RequestMapping("examine/detail")
|
||||
public class ExamineDetailController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
@Autowired
|
||||
private ExamineDetailService examineDetailService;
|
||||
@Autowired
|
||||
private ExamineUserService examineUserService;
|
||||
|
||||
@Autowired
|
||||
private ExamineConfigService configService;
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
|
@ -47,6 +62,41 @@ public class ExamineDetailController {
|
|||
return ResponseEntity.ok(this.examineDetailService.insert(examineDetail));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public AjaxResult list(ExamineDetailRequestDto dto) {
|
||||
Assert.notNull(dto.getExamineTaskId(), "考核任务ID不能为空");
|
||||
Assert.notNull(dto.getExamineId(), "考核ID不能为空");
|
||||
Assert.notEmpty(dto.getReviewType(), "任务类型不能为空");
|
||||
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(dto.getExamineTaskId());
|
||||
examineConfig.setReviewType(dto.getReviewType());
|
||||
List<ExamineConfig> configList = configService.list(examineConfig);
|
||||
|
||||
|
||||
return AjaxResult.success(examineDetailService.formatData(configList,dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param examineDetail 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping("/batch")
|
||||
public AjaxResult addBatch(@RequestBody ExamineDto examineDto) {
|
||||
Assert.notEmpty(examineDto.getExamineDetailList(), "考核详情不能为空");
|
||||
Assert.notNull(examineDto.getExamineId(), "考核ID不能为空");
|
||||
for (ExamineDetail examineDetail : examineDto.getExamineDetailList()) {
|
||||
examineDetail.setExamineId(examineDto.getExamineId());
|
||||
}
|
||||
//保存detail详情
|
||||
this.examineDetailService.insertBatch(examineDto.getExamineDetailList());
|
||||
//保存总体评价
|
||||
examineUserService.updateContent(examineDto);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ExamineConfig implements Serializable {
|
|||
* 考核id
|
||||
*/
|
||||
private Integer examineTaskId;
|
||||
|
||||
private Integer sortNum;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -82,5 +82,7 @@ public interface ExamineConfigMapper {
|
|||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<ExamineConfig> list(ExamineConfig examineConfig);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
|||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)表服务接口
|
||||
*
|
||||
|
@ -44,4 +46,5 @@ public interface ExamineConfigService {
|
|||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
List<ExamineConfig> list(ExamineConfig examineConfig);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import tech.unissense.pms.business.examine.config.service.ExamineConfigService;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核配置表(ExamineConfig)表服务实现类
|
||||
|
@ -65,4 +67,9 @@ public class ExamineConfigServiceImpl implements ExamineConfigService {
|
|||
public boolean deleteById(Integer id) {
|
||||
return this.examineConfigMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineConfig> list(ExamineConfig examineConfig) {
|
||||
return examineConfigMapper.list(examineConfig);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package tech.unissense.pms.business.examine.detail.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ExamineDetailRequestDto
|
||||
* @Description :
|
||||
* @DATE : Created in 14:46 2025/1/2
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/1/2 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class ExamineDetailRequestDto {
|
||||
private Integer examineTaskId;
|
||||
private Integer examineId;
|
||||
private String reviewType;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package tech.unissense.pms.business.examine.detail.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ExamineDto
|
||||
* @Description :
|
||||
* @DATE : Created in 14:21 2025/1/2
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/1/2 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@Data
|
||||
public class ExamineDto {
|
||||
private List<ExamineDetail> examineDetailList;
|
||||
private Integer examineId;
|
||||
private String judgeContent;
|
||||
}
|
|
@ -24,14 +24,6 @@ public interface ExamineDetailMapper {
|
|||
*/
|
||||
ExamineDetail queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param examineDetail 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<ExamineDetail> queryAllByLimit(ExamineDetail examineDetail, @Param("pageable") Pageable pageable);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
|
@ -82,5 +74,6 @@ public interface ExamineDetailMapper {
|
|||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
List<ExamineDetail> list(ExamineDetail examineDetail);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package tech.unissense.pms.business.examine.detail.service;
|
||||
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
||||
import tech.unissense.pms.business.examine.detail.vo.ExamineDetailVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表服务接口
|
||||
|
@ -45,4 +50,7 @@ public interface ExamineDetailService {
|
|||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
void insertBatch(List<ExamineDetail> list);
|
||||
|
||||
List<ExamineDetailVo> formatData(List<ExamineConfig> configList, ExamineDetailRequestDto dto);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package tech.unissense.pms.business.examine.detail.service.impl;
|
||||
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.detail.domain.ExamineDetail;
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDetailRequestDto;
|
||||
import tech.unissense.pms.business.examine.detail.mapper.ExamineDetailMapper;
|
||||
import tech.unissense.pms.business.examine.detail.service.ExamineDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.examine.detail.vo.ExamineDetailVo;
|
||||
import tech.unissense.pms.common.utils.bean.BeanUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 考核人员详情表(ExamineDetail)表服务实现类
|
||||
|
@ -65,4 +72,31 @@ public class ExamineDetailServiceImpl implements ExamineDetailService {
|
|||
public boolean deleteById(Integer id) {
|
||||
return this.examineDetailMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertBatch(List<ExamineDetail> list) {
|
||||
examineDetailMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineDetailVo> formatData(List<ExamineConfig> configList, ExamineDetailRequestDto dto) {
|
||||
List<ExamineDetailVo> examineDetailVoList = new ArrayList<>();
|
||||
ExamineDetail examineDetail = new ExamineDetail();
|
||||
examineDetail.setExamineId(dto.getExamineId());
|
||||
List<ExamineDetail> list = examineDetailMapper.list(examineDetail);
|
||||
Map<Integer, ExamineDetail> scoreMap = list.stream().collect(Collectors.toMap(ExamineDetail::getConfigId
|
||||
, Function.identity(), (v1, v2) -> v1));
|
||||
for (ExamineConfig examineConfig : configList) {
|
||||
ExamineDetailVo examineDetailVo = new ExamineDetailVo();
|
||||
BeanUtils.copyProperties(examineConfig, examineDetailVo);
|
||||
ExamineDetail detail = scoreMap.get(examineConfig.getId());
|
||||
examineDetailVo.setScore(detail == null ? 0 : detail.getScore());
|
||||
examineDetailVo.setRemark(detail == null ? "" : detail.getRemark());
|
||||
examineDetailVoList.add(examineDetailVo);
|
||||
}
|
||||
// examineDetailVoList.sort(Comparator.comparing(ExamineDetailVo::getSortNum));
|
||||
return examineDetailVoList;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package tech.unissense.pms.business.examine.detail.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : ExamineDetailVo
|
||||
* @Description :
|
||||
* @DATE : Created in 14:59 2025/1/2
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/1/2 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ExamineDetailVo extends ExamineConfig {
|
||||
|
||||
private Integer score;
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package tech.unissense.pms.business.examine.user.service;
|
||||
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
@ -48,4 +49,6 @@ public interface ExamineUserService {
|
|||
boolean deleteById(Integer id);
|
||||
|
||||
List<ExamineUser> list(ExamineUser examineUser);
|
||||
|
||||
void updateContent(ExamineDto examineDto);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package tech.unissense.pms.business.examine.user.service.impl;
|
||||
|
||||
import tech.unissense.pms.business.examine.detail.dto.ExamineDto;
|
||||
import tech.unissense.pms.business.examine.user.domain.ExamineUser;
|
||||
import tech.unissense.pms.business.examine.user.mapper.ExamineUserMapper;
|
||||
import tech.unissense.pms.business.examine.user.service.ExamineUserService;
|
||||
|
@ -71,4 +72,12 @@ public class ExamineUserServiceImpl implements ExamineUserService {
|
|||
public List<ExamineUser> list(ExamineUser examineUser) {
|
||||
return examineUserMapper.list(examineUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateContent(ExamineDto examineDto) {
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setId(examineDto.getExamineId());
|
||||
examineUser.setJudgeContent(examineDto.getJudgeContent());
|
||||
examineUserMapper.update(examineUser);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,29 @@
|
|||
<result property="remarks" column="remarks" jdbcType="VARCHAR"/>
|
||||
<result property="weight" column="weight" jdbcType="NUMERIC"/>
|
||||
<result property="examineTaskId" column="examine_task_id" jdbcType="INTEGER"/>
|
||||
<result property="sortNum" column="sort_num" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineConfigMap">
|
||||
<sql id="base_query">
|
||||
select id,
|
||||
review_type,
|
||||
review_category,
|
||||
review_item,
|
||||
remarks,
|
||||
weight,
|
||||
examine_task_id
|
||||
examine_task_id,
|
||||
sort_num
|
||||
from pms_examine_config
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineConfigMap">
|
||||
<include refid="base_query"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="ExamineConfigMap">
|
||||
select
|
||||
id, review_type, review_category, review_item, remarks, weight, examine_task_id
|
||||
from pms_examine_config
|
||||
<include refid="base_query"/>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
|
@ -84,6 +87,32 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="list" resultMap="ExamineConfigMap">
|
||||
<include refid="base_query"/>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="reviewType != null and reviewType != ''">
|
||||
and review_type = #{reviewType}
|
||||
</if>
|
||||
<if test="reviewCategory != null and reviewCategory != ''">
|
||||
and review_category = #{reviewCategory}
|
||||
</if>
|
||||
<if test="reviewItem != null and reviewItem != ''">
|
||||
and review_item = #{reviewItem}
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
and remarks = #{remarks}
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
and weight = #{weight}
|
||||
</if>
|
||||
<if test="examineTaskId != null">
|
||||
and examine_task_id = #{examineTaskId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
|
|
|
@ -10,22 +10,23 @@
|
|||
<result property="configId" column="config_id" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineDetailMap">
|
||||
<sql id="base_query">
|
||||
select id,
|
||||
examine_id,
|
||||
score,
|
||||
remark,
|
||||
config_id
|
||||
from pms_examine_detail
|
||||
</sql>
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExamineDetailMap">
|
||||
<include refid="base_query"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="ExamineDetailMap">
|
||||
select
|
||||
id, examine_id, score, remark, config_id
|
||||
from pms_examine_detail
|
||||
<select id="list" resultMap="ExamineDetailMap">
|
||||
<include refid="base_query"/>
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
|
@ -43,7 +44,6 @@
|
|||
and config_id = #{configId}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
|
|
Loading…
Reference in New Issue