diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 10f33422..3bbf3ff8 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -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 resultModels = resultModelService.selectResultModelByGroupId(resultRecord.getEvaluationId()); + //获取计算公式 + List calculateModels = getCalculate(resultModels.get(0).getCalculateId()); + StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId()); resultRecordDetailDto.setAvatar(staffEntity.getAvatar()); resultRecordDetailDto.setJobNumber(staffEntity.getJobNumber()); List resultRecortModelDtos = new ArrayList<>(); for (ResultModel model:resultModels ) { - resultRecordDetailDto.setCalculateId(model.getCalculateId()); resultRecordDetailDto.setGradeGroupId(model.getGradeGroupId()); ResultRecortModelDto resultRecortModelDto = new ResultRecortModelDto(); BeanUtils.copyProperties(model, resultRecortModelDto); - List detailDtos = resultDetailService.selectDtosByRecordId(resultRecord.getId(), model.getType()); + List 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 getCalculate(Long id){ + ResultCalculate resultCalculate = + resultCalculateService.selectResultCalculateById(id); + char[] chars = new char[resultCalculate.getCalculate().length()]; + resultCalculate.getCalculate().getChars(0, chars.length, chars, 0); + List 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) { diff --git a/src/main/java/com/lz/modules/flow/entity/FlowChart.java b/src/main/java/com/lz/modules/flow/entity/FlowChart.java index 8a905d87..2b635c2b 100644 --- a/src/main/java/com/lz/modules/flow/entity/FlowChart.java +++ b/src/main/java/com/lz/modules/flow/entity/FlowChart.java @@ -10,7 +10,7 @@ import java.util.Date; *

*

*流程图,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 + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/model/CalculateModel.java b/src/main/java/com/lz/modules/flow/model/CalculateModel.java new file mode 100644 index 00000000..47302e8b --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/CalculateModel.java @@ -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;//计算方法 + - * / +} diff --git a/src/main/java/com/lz/modules/flow/model/FlowChartDto.java b/src/main/java/com/lz/modules/flow/model/FlowChartDto.java index 081f0d17..a40c7b3d 100644 --- a/src/main/java/com/lz/modules/flow/model/FlowChartDto.java +++ b/src/main/java/com/lz/modules/flow/model/FlowChartDto.java @@ -40,6 +40,9 @@ public class FlowChartDto { @ApiModelProperty(value = "节点详细数据", name = "chartDetails") private FlowChartDetailRecordListDto chartDetails; + //描述,前端提示,如果有值就提示 + @ApiModelProperty(value = "描述,前端提示,如果有值就提示", name = "desc") + private String desc; /** * * @return diff --git a/src/main/java/com/lz/modules/flow/model/ResultDetailDto.java b/src/main/java/com/lz/modules/flow/model/ResultDetailDto.java index 4a34c817..31c0df9a 100644 --- a/src/main/java/com/lz/modules/flow/model/ResultDetailDto.java +++ b/src/main/java/com/lz/modules/flow/model/ResultDetailDto.java @@ -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; /** * diff --git a/src/main/java/com/lz/modules/flow/model/ResultRecordDetailDto.java b/src/main/java/com/lz/modules/flow/model/ResultRecordDetailDto.java index a51737a2..868f7ce3 100644 --- a/src/main/java/com/lz/modules/flow/model/ResultRecordDetailDto.java +++ b/src/main/java/com/lz/modules/flow/model/ResultRecordDetailDto.java @@ -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; + //使用的哪个等级。等级组id,lz_result_grade的group_id @ApiModelProperty(value = "使用的哪个等级。等级组id,lz_result_grade的group_id", name = "gradeGroupId") diff --git a/src/main/java/com/lz/modules/flow/req/FlowChartReq.java b/src/main/java/com/lz/modules/flow/req/FlowChartReq.java index 679aa94b..4ac4678d 100644 --- a/src/main/java/com/lz/modules/flow/req/FlowChartReq.java +++ b/src/main/java/com/lz/modules/flow/req/FlowChartReq.java @@ -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 diff --git a/src/main/resources/mapper/flow/FlowChartMapper.xml b/src/main/resources/mapper/flow/FlowChartMapper.xml index 13dc9324..7cf2e556 100644 --- a/src/main/resources/mapper/flow/FlowChartMapper.xml +++ b/src/main/resources/mapper/flow/FlowChartMapper.xml @@ -14,12 +14,13 @@ + - 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 @@ -38,6 +39,7 @@ type, step_index, flow_process, + desc, is_delete, gmt_create, gmt_modified @@ -48,6 +50,7 @@ #{ type}, #{ stepIndex}, #{ flowProcess}, + #{ desc}, 0, now(), now() @@ -66,7 +69,8 @@ status = #{status}, type = #{type}, step_index = #{stepIndex}, - flow_process = #{flowProcess} + flow_process = #{flowProcess}, + desc = #{desc} ,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} diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index 26edba35..b9a6be0a 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -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 list2 = new ArrayList(); Map map = MysqlUtil2ShowCreateTable.getComments();