fix
This commit is contained in:
parent
4f3343179f
commit
bd6f92ee76
@ -0,0 +1,52 @@
|
|||||||
|
package com.lz.modules.performance.controller;
|
||||||
|
|
||||||
|
import com.lz.common.utils.R;
|
||||||
|
import com.lz.modules.performance.req.ResultUpdateTakReq;
|
||||||
|
import com.lz.modules.performance.res.ResultTaskDetailRes;
|
||||||
|
import com.lz.modules.performance.res.TaskListRes;
|
||||||
|
import com.lz.modules.performance.service.ResultTaskService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiResponse;
|
||||||
|
import io.swagger.annotations.ApiResponses;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: djc
|
||||||
|
* @Desc:
|
||||||
|
* @Date: 2020/12/9 9:52
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/performance")
|
||||||
|
@Slf4j
|
||||||
|
@Api(value="绩效任务接口", tags={"绩效任务"})
|
||||||
|
public class ResultTaskController {
|
||||||
|
@Autowired
|
||||||
|
private ResultTaskService resultTaskService;
|
||||||
|
|
||||||
|
@GetMapping("/result/taskDetail")
|
||||||
|
@ApiOperation("获取绩效任务详情")
|
||||||
|
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ResultTaskDetailRes.class)})
|
||||||
|
public R taskDetail(Long detailId){
|
||||||
|
ResultTaskDetailRes resultTaskDetailRes = resultTaskService.taskDetail(detailId);
|
||||||
|
return R.ok().put("data",resultTaskDetailRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/result/updateTask")
|
||||||
|
@ApiOperation("任务修改")
|
||||||
|
@ApiResponses({@ApiResponse(code = 200,message = "成功")})
|
||||||
|
public R updateTask(ResultUpdateTakReq req){
|
||||||
|
int i = resultTaskService.saveOrUpdateResultTask(req);
|
||||||
|
if(i>0){
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -8,9 +8,13 @@ package com.lz.modules.performance.dao;
|
|||||||
* @since 2020-12-08
|
* @since 2020-12-08
|
||||||
*/
|
*/
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||||
import com.lz.modules.performance.entity.ResultTask;
|
import com.lz.modules.performance.entity.ResultTask;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ResultTaskMapper extends BaseMapper<ResultTask> {
|
public interface ResultTaskMapper extends BaseMapper<ResultTask> {
|
||||||
|
|
||||||
@ -29,5 +33,7 @@ public interface ResultTaskMapper extends BaseMapper<ResultTask> {
|
|||||||
|
|
||||||
int deleteResultTaskById(@Param("id") Long id);
|
int deleteResultTaskById(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<ResultTaskDto> selectResultTasksByDetailId(Long detailId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.lz.modules.performance.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: djc
|
||||||
|
* @Desc:
|
||||||
|
* @Date: 2020/12/9 10:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ResultTaskDto {
|
||||||
|
//任务名称
|
||||||
|
@ApiModelProperty(value = "任务名称", name = "name")
|
||||||
|
private String name;
|
||||||
|
//任务的当前进度
|
||||||
|
@ApiModelProperty(value = "任务的当前进度", name = "processRate")
|
||||||
|
private BigDecimal processRate;
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.lz.modules.performance.req;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: djc
|
||||||
|
* @Desc:
|
||||||
|
* @Date: 2020/12/9 9:59
|
||||||
|
*/
|
||||||
|
public class ResultTaskDetailReq {
|
||||||
|
private Long detailId;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.lz.modules.performance.req;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: djc
|
||||||
|
* @Desc:
|
||||||
|
* @Date: 2020/12/9 10:32
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ResultUpdateTakReq {
|
||||||
|
//绩效详情id
|
||||||
|
@ApiModelProperty(value = "绩效详情id(如果任务id为空,必传)", name = "detailId")
|
||||||
|
private Long detailId;
|
||||||
|
//任务id
|
||||||
|
@ApiModelProperty(value = "任务id", name = "tasklId")
|
||||||
|
private Long tasklId;
|
||||||
|
//任务名称
|
||||||
|
@ApiModelProperty(value = "任务名称", name = "name")
|
||||||
|
private String name;
|
||||||
|
//任务的当前进度
|
||||||
|
@ApiModelProperty(value = "任务的当前进度", name = "processRate")
|
||||||
|
private BigDecimal processRate;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.lz.modules.performance.res;
|
||||||
|
|
||||||
|
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||||
|
import com.lz.modules.performance.entity.ResultTask;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: djc
|
||||||
|
* @Desc:
|
||||||
|
* @Date: 2020/12/9 10:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "绩效任务详情")
|
||||||
|
public class ResultTaskDetailRes {
|
||||||
|
|
||||||
|
//集体进度
|
||||||
|
@ApiModelProperty(value = "集体进度", name = "processRate")
|
||||||
|
private BigDecimal processRate;
|
||||||
|
//目标
|
||||||
|
@ApiModelProperty(value = "目标", name = "target")
|
||||||
|
private String target;
|
||||||
|
//任务列表
|
||||||
|
@ApiModelProperty(value = "集体进度", name = "resultTasks")
|
||||||
|
private List<ResultTaskDto> resultTasks;
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@ package com.lz.modules.performance.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.lz.modules.performance.entity.ResultTask;
|
import com.lz.modules.performance.entity.ResultTask;
|
||||||
|
import com.lz.modules.performance.req.ResultUpdateTakReq;
|
||||||
|
import com.lz.modules.performance.res.ResultTaskDetailRes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -29,5 +31,9 @@ public interface ResultTaskService extends IService<ResultTask> {
|
|||||||
|
|
||||||
int deleteResultTaskById(Long id);
|
int deleteResultTaskById(Long id);
|
||||||
|
|
||||||
|
ResultTaskDetailRes taskDetail(Long detailId);
|
||||||
|
|
||||||
|
int saveOrUpdateResultTask(ResultUpdateTakReq req);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2,11 +2,22 @@ package com.lz.modules.performance.service.impl;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.lz.modules.performance.dao.ResultTaskMapper;
|
import com.lz.modules.performance.dao.ResultTaskMapper;
|
||||||
|
import com.lz.modules.performance.dto.ResultTaskDto;
|
||||||
import com.lz.modules.performance.entity.ResultTask;
|
import com.lz.modules.performance.entity.ResultTask;
|
||||||
|
import com.lz.modules.performance.req.ResultUpdateTakReq;
|
||||||
|
import com.lz.modules.performance.res.ResultTaskDetailRes;
|
||||||
import com.lz.modules.performance.service.ResultTaskService;
|
import com.lz.modules.performance.service.ResultTaskService;
|
||||||
|
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||||
|
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 任务表 服务类
|
* 任务表 服务类
|
||||||
@ -16,12 +27,15 @@ import org.springframework.stereotype.Service;
|
|||||||
* @since 2020-12-08
|
* @since 2020-12-08
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultTask> implements ResultTaskService {
|
public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultTask> implements ResultTaskService {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResultTaskMapper resultTaskMapper;
|
private ResultTaskMapper resultTaskMapper;
|
||||||
|
@Autowired
|
||||||
|
private ResultDetailService resultDetailService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -58,6 +72,38 @@ public class ResultTaskServiceImpl extends ServiceImpl<ResultTaskMapper, ResultT
|
|||||||
return resultTaskMapper.deleteResultTaskById(id);
|
return resultTaskMapper.deleteResultTaskById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultTaskDetailRes taskDetail(Long detailId) {
|
||||||
|
ResultTaskDetailRes res = new ResultTaskDetailRes();
|
||||||
|
ResultDetail resultDetail = resultDetailService.selectResultDetailById(detailId);
|
||||||
|
Optional.ofNullable(resultDetail).ifPresent(resultDetail1 -> {
|
||||||
|
res.setProcessRate(resultDetail1.getProcessRate());
|
||||||
|
res.setTarget(resultDetail1.getTarget());
|
||||||
|
});
|
||||||
|
List<ResultTaskDto> resultTasks = resultTaskMapper.selectResultTasksByDetailId(detailId);
|
||||||
|
res.setResultTasks(resultTasks);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int saveOrUpdateResultTask(ResultUpdateTakReq req) {
|
||||||
|
Long tasklId = req.getTasklId();
|
||||||
|
Long detailId = req.getDetailId();
|
||||||
|
if(tasklId==null && detailId == null){
|
||||||
|
log.error("任务保存或更新失败:tasklId, detailId都为空");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ResultTask resultTask;
|
||||||
|
if(tasklId == null){
|
||||||
|
log.info("绩效任务新增操作。。。");
|
||||||
|
resultTask = new ResultTask();
|
||||||
|
BeanUtils.copyProperties(req,resultTask);
|
||||||
|
resultTask.setDetailId(detailId);
|
||||||
|
return resultTaskMapper.insertResultTask(resultTask).intValue();
|
||||||
|
}
|
||||||
|
log.info("绩效任务修改操作。。。");
|
||||||
|
resultTask = resultTaskMapper.selectResultTaskById(tasklId);
|
||||||
|
BeanUtils.copyProperties(req,resultTask);
|
||||||
|
return resultTaskMapper.updateResultTaskById(resultTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,6 +79,9 @@ public class ResultDetail implements java.io.Serializable {
|
|||||||
//维度id lz_result_model的id
|
//维度id lz_result_model的id
|
||||||
@ApiModelProperty(value = "维度id lz_result_model的id", name = "modelId")
|
@ApiModelProperty(value = "维度id lz_result_model的id", name = "modelId")
|
||||||
private Long modelId;
|
private Long modelId;
|
||||||
|
//进度
|
||||||
|
@ApiModelProperty(value = "进度", name = "processRate")
|
||||||
|
private BigDecimal processRate;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -379,6 +382,20 @@ public class ResultDetail implements java.io.Serializable {
|
|||||||
this.modelId = modelId;
|
this.modelId = modelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进度
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BigDecimal getProcessRate() {
|
||||||
|
return processRate;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 进度
|
||||||
|
* @param processRate
|
||||||
|
*/
|
||||||
|
public void setProcessRate(BigDecimal processRate) {
|
||||||
|
this.processRate = processRate;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ResultDetail{" +
|
return "ResultDetail{" +
|
||||||
@ -402,6 +419,7 @@ public class ResultDetail implements java.io.Serializable {
|
|||||||
",staffId=" + staffId +
|
",staffId=" + staffId +
|
||||||
",priority=" + priority +
|
",priority=" + priority +
|
||||||
",modelId=" + modelId +
|
",modelId=" + modelId +
|
||||||
|
",processRate=" + processRate +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,12 +24,13 @@
|
|||||||
<result column="staff_id" property="staffId"/>
|
<result column="staff_id" property="staffId"/>
|
||||||
<result column="priority" property="priority"/>
|
<result column="priority" property="priority"/>
|
||||||
<result column="model_id" property="modelId"/>
|
<result column="model_id" property="modelId"/>
|
||||||
|
<result column="process_rate" property="processRate"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, back_id AS backId, is_edit AS isEdit, type AS type, target AS target, key_result AS keyResult, key_result_3_5 AS keyResult35, key_result_3_7 AS keyResult37, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority, model_id AS modelId
|
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, back_id AS backId, is_edit AS isEdit, type AS type, target AS target, key_result AS keyResult, key_result_3_5 AS keyResult35, key_result_3_7 AS keyResult37, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority, model_id AS modelId, process_rate AS processRate
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
@ -58,6 +59,7 @@
|
|||||||
<if test="staffId != null">staff_id, </if>
|
<if test="staffId != null">staff_id, </if>
|
||||||
<if test="priority != null">priority, </if>
|
<if test="priority != null">priority, </if>
|
||||||
<if test="modelId != null">model_id, </if>
|
<if test="modelId != null">model_id, </if>
|
||||||
|
<if test="processRate != null">process_rate, </if>
|
||||||
is_delete,
|
is_delete,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
gmt_modified
|
gmt_modified
|
||||||
@ -78,6 +80,7 @@
|
|||||||
<if test="staffId != null">#{ staffId}, </if>
|
<if test="staffId != null">#{ staffId}, </if>
|
||||||
<if test="priority != null">#{ priority}, </if>
|
<if test="priority != null">#{ priority}, </if>
|
||||||
<if test="modelId != null">#{ modelId}, </if>
|
<if test="modelId != null">#{ modelId}, </if>
|
||||||
|
<if test="processRate != null">#{ processRate}, </if>
|
||||||
0,
|
0,
|
||||||
now(),
|
now(),
|
||||||
now()
|
now()
|
||||||
@ -106,7 +109,8 @@
|
|||||||
<if test="recordId != null">record_id = #{recordId},</if>
|
<if test="recordId != null">record_id = #{recordId},</if>
|
||||||
<if test="staffId != null">staff_id = #{staffId},</if>
|
<if test="staffId != null">staff_id = #{staffId},</if>
|
||||||
<if test="priority != null">priority = #{priority},</if>
|
<if test="priority != null">priority = #{priority},</if>
|
||||||
<if test="modelId != null">model_id = #{modelId}</if>
|
<if test="modelId != null">model_id = #{modelId},</if>
|
||||||
|
<if test="processRate != null">process_rate = #{processRate}</if>
|
||||||
</trim>
|
</trim>
|
||||||
,gmt_modified = now()
|
,gmt_modified = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
@ -134,8 +138,9 @@
|
|||||||
record_id = #{recordId},
|
record_id = #{recordId},
|
||||||
staff_id = #{staffId},
|
staff_id = #{staffId},
|
||||||
priority = #{priority},
|
priority = #{priority},
|
||||||
model_id = #{modelId}
|
model_id = #{modelId},
|
||||||
,gmt_modified = now()
|
process_rate = #{processRate}
|
||||||
|
,gmt_modified = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
@ -79,5 +79,9 @@
|
|||||||
update lz_result_task set is_delete = 1 where id=#{id} limit 1
|
update lz_result_task set is_delete = 1 where id=#{id} limit 1
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectResultTasksByDetailId" resultType="com.lz.modules.performance.dto.ResultTaskDto">
|
||||||
|
select name,process_rate from lz_result_task where detail_id=#{detailId} and is_delete = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@ -84,9 +84,7 @@ public class MysqlMain {
|
|||||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||||
|
|
||||||
|
|
||||||
list.add(new TablesBean("lz_result_task"));
|
list.add(new TablesBean("lz_result_detail"));
|
||||||
list.add(new TablesBean("lz_task_process_record"));
|
|
||||||
list.add(new TablesBean("lz_task_comment"));
|
|
||||||
|
|
||||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user