Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-10-28 11:25:07 +08:00
commit 3c3b3707d5
9 changed files with 120 additions and 15 deletions

View File

@ -16,10 +16,7 @@ import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.Auth;
import com.lz.modules.flow.model.ResultDetailDto;
import com.lz.modules.flow.model.ResultRecordDetailDto;
import com.lz.modules.flow.model.ResultRecortModelDto;
import com.lz.modules.flow.model.*;
import com.lz.modules.flow.req.ResultDetailReq;
import com.lz.modules.flow.service.*;
import com.lz.modules.sys.controller.AbstractController;
@ -93,6 +90,9 @@ public class ResultRecordController extends AbstractController {
@Autowired
private ResultModelService resultModelService;
@Autowired
private ResultCalculateService resultCalculateService;
/**
* 列表
*/
@ -343,20 +343,27 @@ public class ResultRecordController extends AbstractController {
ResultRecordDetailDto resultRecordDetailDto = new ResultRecordDetailDto();
BeanUtils.copyProperties(resultRecord, resultRecordDetailDto);
List<ResultModel> resultModels = resultModelService.selectResultModelByGroupId(resultRecord.getEvaluationId());
//获取计算公式
List<CalculateModel> calculateModels = getCalculate(resultModels.get(0).getCalculateId());
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
resultRecordDetailDto.setAvatar(staffEntity.getAvatar());
resultRecordDetailDto.setJobNumber(staffEntity.getJobNumber());
List<ResultRecortModelDto> resultRecortModelDtos = new ArrayList<>();
for (ResultModel model:resultModels
) {
resultRecordDetailDto.setCalculateId(model.getCalculateId());
resultRecordDetailDto.setGradeGroupId(model.getGradeGroupId());
ResultRecortModelDto resultRecortModelDto = new ResultRecortModelDto();
BeanUtils.copyProperties(model, resultRecortModelDto);
List<ResultDetailDto> detailDtos = resultDetailService.selectDtosByRecordId(resultRecord.getId(), model.getType());
List<ResultDetailDto> detailDtos =
resultDetailService.selectDtosByRecordId(resultRecord.getId(), model.getType());
//下面设置计算公式
resultRecortModelDto.setDetailDtos(detailDtos);
resultRecortModelDtos.add(resultRecortModelDto);
}
resultRecordDetailDto.setRecortModelDtos(resultRecortModelDtos);
return R.ok().put("data", resultRecordDetailDto);
@ -364,6 +371,61 @@ public class ResultRecordController extends AbstractController {
}
private List<CalculateModel> getCalculate(Long id){
ResultCalculate resultCalculate =
resultCalculateService.selectResultCalculateById(id);
char[] chars = new char[resultCalculate.getCalculate().length()];
resultCalculate.getCalculate().getChars(0, chars.length, chars, 0);
List<CalculateModel> calculateModels = new ArrayList<>();
CalculateModel calculateModel = null;
int type = 0;//0table名称 1字段名称
String value = "";
for (int i = 0; i < chars.length;i++
) {
char b = chars[i];
if(b == '*' || b == '/' || b == '+' || b == '-'){
calculateModel.setFieldName(getBeanName(value));
calculateModel.setOpt(String.valueOf(b));
calculateModels.add(calculateModel);
calculateModel = null;
type = 0;
value = "";
continue;
}else if(b == '>'){
if(type == 0){
value = value.replace("lz_", "");//去掉lz_前缀
calculateModel.setTableName(getBeanName(value));
}
type--;
type *= -1;
value = "";
continue;
}
if(calculateModel == null){
calculateModel = new CalculateModel();
}
value += String.valueOf(b);
if(i == chars.length - 1){
calculateModel.setFieldName(getBeanName(value));
calculateModels.add(calculateModel);
break;
}
}
return calculateModels;
}
private String getBeanName(String value){
String[] bean = value.split("_");
value = "";
for(String s:bean){
value += s.substring(0, 1).toUpperCase() + s.substring(1);
}
return value;
}
@PostMapping("/saveDetail")
@ApiOperation("保存绩效详情-吴林")
public R saveDetail(@RequestBody @ApiParam ResultRecordDetailDto dto) {

View File

@ -10,7 +10,7 @@ import java.util.Date;
* <p>
* </p>*流程图lz_flow的父
* @author quyixiao
* @since 2020-10-26
* @since 2020-10-28
*/
@Data
@ -47,6 +47,9 @@ public class FlowChart implements java.io.Serializable {
//当前是目标确认还是评分0目标制定1目标确认2执行中3结果值录入4评分5考核结束
@ApiModelProperty(value = "当前是目标确认还是评分0目标制定1目标确认2执行中3结果值录入4评分5考核结束", name = "flowProcess")
private Integer flowProcess;
//描述前端提示如果有值就提示
@ApiModelProperty(value = "描述,前端提示,如果有值就提示", name = "desc")
private String desc;
/**
*
* @return
@ -197,6 +200,21 @@ public class FlowChart implements java.io.Serializable {
this.flowProcess = flowProcess;
}
/**
* 描述前端提示如果有值就提示
* @return
*/
public String getDesc() {
return desc;
}
/**
* 描述前端提示如果有值就提示
* @param desc
*/
public void setDesc(String desc) {
this.desc = desc;
}
@Override
public String toString() {
return "FlowChart{" +
@ -210,6 +228,7 @@ public class FlowChart implements java.io.Serializable {
",type=" + type +
",stepIndex=" + stepIndex +
",flowProcess=" + flowProcess +
",desc=" + desc +
"}";
}
}

View File

@ -0,0 +1,12 @@
package com.lz.modules.flow.model;
import lombok.Data;
/*
* 计算公式
* */
@Data
public class CalculateModel {
private String tableName;//表明对象名称
private String fieldName;//字段属性名称
private String opt;//计算方法 + - * /
}

View File

@ -40,6 +40,9 @@ public class FlowChartDto {
@ApiModelProperty(value = "节点详细数据", name = "chartDetails")
private FlowChartDetailRecordListDto chartDetails;
//描述前端提示如果有值就提示
@ApiModelProperty(value = "描述,前端提示,如果有值就提示", name = "desc")
private String desc;
/**
*
* @return

View File

@ -44,9 +44,11 @@ public class ResultDetailDto {
@ApiModelProperty(value = "评分说明", name = "scoreComment")
private String scoreComment;
//评分说明
@ApiModelProperty(value = "计算公式", name = "calculate")
private String calculate;
//优先级从大到小
@ApiModelProperty(value = "优先级,从大到小", name = "priority")
@ApiModelProperty(value = "优先级,从到大", name = "priority")
private Integer priority;
/**
*

View File

@ -37,8 +37,7 @@ public class ResultRecordDetailDto {
@ApiModelProperty(value = "员工id", name = "staffId")
private Long staffId;
@ApiModelProperty(value = "lz_result_calculate 的id计算法方法id", name = "calculateId")
private Long calculateId;
//使用的哪个等级等级组idlz_result_grade的group_id
@ApiModelProperty(value = "使用的哪个等级。等级组idlz_result_grade的group_id", name = "gradeGroupId")

View File

@ -53,6 +53,9 @@ public class FlowChartReq implements java.io.Serializable {
//执行步骤第几步从0开始
@ApiModelProperty(value = "执行步骤第几步从0开始", name = "stepIndex")
private Integer stepIndex;
//描述前端提示如果有值就提示
@ApiModelProperty(value = "描述,前端提示,如果有值就提示", name = "desc")
private String desc;
/**
*
* @return

View File

@ -14,12 +14,13 @@
<result column="type" property="type"/>
<result column="step_index" property="stepIndex"/>
<result column="flow_process" property="flowProcess"/>
<result column="desc" property="desc"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, process_id AS processId, status AS status, type AS type, step_index AS stepIndex, flow_process AS flowProcess
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, process_id AS processId, status AS status, type AS type, step_index AS stepIndex, flow_process AS flowProcess, desc AS desc
</sql>
@ -38,6 +39,7 @@
<if test="type != null">type, </if>
<if test="stepIndex != null">step_index, </if>
<if test="flowProcess != null">flow_process, </if>
<if test="desc != null">desc, </if>
is_delete,
gmt_create,
gmt_modified
@ -48,6 +50,7 @@
<if test="type != null">#{ type}, </if>
<if test="stepIndex != null">#{ stepIndex}, </if>
<if test="flowProcess != null">#{ flowProcess}, </if>
<if test="desc != null">#{ desc}, </if>
0,
now(),
now()
@ -66,7 +69,8 @@
<if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="stepIndex != null">step_index = #{stepIndex},</if>
<if test="flowProcess != null">flow_process = #{flowProcess}</if>
<if test="flowProcess != null">flow_process = #{flowProcess},</if>
<if test="desc != null">desc = #{desc}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -84,7 +88,8 @@
status = #{status},
type = #{type},
step_index = #{stepIndex},
flow_process = #{flowProcess}
flow_process = #{flowProcess},
desc = #{desc}
,gmt_modified = now()
where id = #{id}
</update>

View File

@ -96,7 +96,7 @@ public class MysqlMain {
//list.add(new TablesBean("lz_flow_chart_detail_record"));
//list.add(new TablesBean("lz_flow_approval_role"));
list.add(new TablesBean("lz_result_detail"));
list.add(new TablesBean("lz_flow_chart"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();