提交修改

This commit is contained in:
quyixiao 2020-08-28 18:08:20 +08:00
parent 89d09f336e
commit a444640a23
18 changed files with 286 additions and 49 deletions

View File

@ -356,23 +356,6 @@ public class StringUtil extends StringUtils {
/**
*
*
* @param args
*/
public static void main(String[] args) {
Set<String> set = new HashSet<>( );
for(long i = 0 ;i < 2000000 ;i ++){
String a = getThirdNo("jdk","2",i);
set.add(a);
}
System.out.println(set.size());
}
public static String removeDoubleChar(String str){
if(str.indexOf("\"")==0) {
str = str.substring(1, str.length()); //去掉第一个 "
@ -650,4 +633,18 @@ public class StringUtil extends StringUtils {
}
return html.replaceAll("\\<.*?>","");
}
public static String realNameTo2(String value) {
if(StringUtil.isBlank(value)){
return "";
}
if(value.length() > 2 ){
return value.substring(value.length()-2);
}
return value;
}
public static void main(String[] args) {
System.out.println(realNameTo2("xxxxx"));
}
}

View File

@ -9,6 +9,7 @@ import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.ResultDetailResp;
import com.lz.modules.app.resp.Step;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
@ -191,6 +192,7 @@ public class ResultRecordController extends AbstractController {
}
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(resultRecord.getId());
List<Step> stepList = resultDetailService.getStepList(resultRecord);
BigDecimal sumWenHuaJiaZhiGuan = BigDecimal.ZERO;
BigDecimal sumYeJi = BigDecimal.ZERO;
if (CollectionUtils.isNotEmpty(resultDetails)) {
@ -288,6 +290,7 @@ public class ResultRecordController extends AbstractController {
.put("commentNum", commentNum)
.put("superStaff", superStaff)
.put("fileCount",fileCount)
.put("stepList",stepList)
;
}
@ -325,6 +328,13 @@ public class ResultRecordController extends AbstractController {
flowRecordService.updateFlowRecordById(flowRecord);
}
}
// 可能会被删除
FlowRecord lastFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
lastFlowRecord.setGmtCreate(new Date());
lastFlowRecord.setGmtModified(new Date());
flowRecordService.insertFlowRecord(lastFlowRecord);// 新插入一条提交记录
StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId());
r = R.ok("成功")
.put("from", mySelf)
@ -546,6 +556,8 @@ public class ResultRecordController extends AbstractController {
public R detailAddOrUpdate(ResultDetailReq req) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordId());
req.setKeyResult(StringUtil.decodeBase64(req.getKeyResult()));
req.setKeyResult35(StringUtil.decodeBase64(req.getKeyResult35()));
req.setKeyResult37(StringUtil.decodeBase64(req.getKeyResult37()));
req.setCheckResult(StringUtil.decodeBase64(req.getCheckResult()));
req.setScoreComment(StringUtil.decodeBase64(req.getScoreComment()));
ResultDetail old = resultDetailService.selectResultDetailById(req.getId());

View File

@ -43,4 +43,9 @@ public class ResultDetailResp {
private int isAdd;
private int isEdit;
private String keyResult35;
//关键结果3.7分标准
private String keyResult37;
}

View File

@ -0,0 +1,24 @@
package com.lz.modules.app.resp;
import lombok.Data;
@Data
public class Step {
private String name ;
private String time ;
private int status ;
private String statusStr;
public Step() {
}
public Step(String name, String time, int status, String statusStr) {
this.name = name;
this.time = time;
this.status = status;
this.statusStr = statusStr;
}
}

View File

@ -40,4 +40,6 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectFlowRecordByRecordId(@Param("recordId") Long recordId);
List<FlowRecord> selectFlowRecordByResultRecordIdFlowId(@Param("recordId") Long recordId, @Param("rollbackFlowId") Long rollbackFlowId);
List<FlowRecord> selectFlowRecordByFlowId(@Param("recordId") Long recordId);
}

View File

@ -24,4 +24,6 @@ public class Auth {
private int approvelCommit;
private int uploadFile;
private int downFile;
private int keyResult35;
private int keyResult37;
}

View File

@ -42,4 +42,10 @@ public class ResultDetailReq {
private int page = 1;
private int limit = 10 ;
//关键结果_3.5标准
private String keyResult35;
//关键结果3.7分标准
private String keyResult37;
}

View File

@ -42,4 +42,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
void initFlowRecord(ResultRecord resultRecord , Long roleId , Integer type , String name);
List<FlowRecord> selectFlowRecordByResultRecordIdFlowId(Long recordResultId, Long rollbackFlowId);
List<FlowRecord> selectFlowRecordByFlowId(Long recordId);
}

View File

@ -110,5 +110,10 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectFlowRecordByResultRecordIdFlowId(recordResultId, rollbackFlowId);
}
@Override
public List<FlowRecord> selectFlowRecordByFlowId(Long recordId) {
return flowRecordMapper.selectFlowRecordByFlowId(recordId);
}
}

View File

@ -123,7 +123,8 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
auth.setWaitCommit(NumberUtil.objToIntDefault(map.get("waitCommit"), 0));
auth.setApprovelCommit(NumberUtil.objToIntDefault(map.get("approvelCommit"), 0));
auth.setUploadFile(NumberUtil.objToIntDefault(map.get("uploadFile"), 0));
auth.setUploadFile(NumberUtil.objToIntDefault(map.get("uploadFile"), 0));
auth.setKeyResult35(NumberUtil.objToIntDefault(map.get("keyResult35"), 0));
auth.setKeyResult37(NumberUtil.objToIntDefault(map.get("keyResult37"), 0));
return auth;
}

View File

@ -11,7 +11,7 @@ import java.util.Date;
* 菜单权限表
* </p>*业绩详情表
* @author quyixiao
* @since 2020-08-13
* @since 2020-08-28
*/
@Data
@ -32,6 +32,10 @@ public class ResultDetail implements java.io.Serializable {
private String target;
//关键结果
private String keyResult;
//关键结果_3.5标准
private String keyResult35;
//关键结果3.7分标准
private String keyResult37;
//考核权重
private BigDecimal checkWeight;
//考核结果
@ -48,15 +52,6 @@ public class ResultDetail implements java.io.Serializable {
private Long staffId;
//优先级从大到小
private Integer priority;
public ResultDetail() {
}
public ResultDetail(Integer type) {
this.type = type;
}
/**
*
* @return
@ -162,6 +157,36 @@ public class ResultDetail implements java.io.Serializable {
this.keyResult = keyResult;
}
/**
* 关键结果_3.5标准
* @return
*/
public String getKeyResult35() {
return keyResult35;
}
/**
* 关键结果_3.5标准
* @param keyResult35
*/
public void setKeyResult35(String keyResult35) {
this.keyResult35 = keyResult35;
}
/**
* 关键结果3.7分标准
* @return
*/
public String getKeyResult37() {
return keyResult37;
}
/**
* 关键结果3.7分标准
* @param keyResult37
*/
public void setKeyResult37(String keyResult37) {
this.keyResult37 = keyResult37;
}
/**
* 考核权重
* @return
@ -292,6 +317,8 @@ public class ResultDetail implements java.io.Serializable {
",type=" + type +
",target=" + target +
",keyResult=" + keyResult +
",keyResult35=" + keyResult35 +
",keyResult37=" + keyResult37 +
",checkWeight=" + checkWeight +
",checkResult=" + checkResult +
",superScore=" + superScore +

View File

@ -3,8 +3,10 @@ package com.lz.modules.sys.service.app;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.BigDecimalUtil;
import com.lz.modules.app.resp.ResultDetailResp;
import com.lz.modules.app.resp.Step;
import com.lz.modules.flow.model.Auth;
import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import java.math.BigDecimal;
import java.util.List;
@ -57,4 +59,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
void insertWenHuaJiaZhiGua(String s, Long id, Long userId);
String initRole(Long staffId, Long l);
List<Step> getStepList(ResultRecord resultRecord);
}

View File

@ -5,6 +5,7 @@ import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.flow.entity.Flow;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultRecord;
@ -57,4 +58,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
ResultRecord initResult(Long staffId ,Integer recordType,Long roleId) ;
R checkApproval(Long recordId);
int getDepartmentLevelIndex(List<Flow> list, int flowIndex);
}

View File

@ -3,18 +3,31 @@ package com.lz.modules.sys.service.app.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.BigDecimalUtil;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.resp.ResultDetailResp;
import com.lz.modules.app.resp.Step;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.Auth;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.flow.service.*;
import com.lz.modules.sys.dao.app.ResultDetailMapper;
import com.lz.modules.sys.entity.app.ResultDetail;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@ -26,12 +39,24 @@ import java.util.List;
*/
@Service
@Slf4j
public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, ResultDetail> implements ResultDetailService {
@Autowired
@Autowired
private ResultDetailMapper resultDetailMapper;
@Autowired
private StaffService staffService;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private FlowRelationService flowRelationService;
@Autowired
private StaffRoleService staffRoleService;
@Override
@ -40,6 +65,18 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
}
@Autowired
private StaffRoleDepartmentService staffRoleDepartmentService;
@Autowired
private DepartmentsService departmentsService;
@Autowired
private FlowService flowService;
@Autowired
private FlowRecordService flowRecordService;
@Override
public Long insertResultDetail(ResultDetail resultDetail){
@ -173,4 +210,91 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
return JSON.toJSONString(staffRoles);
}
@Override
public List<Step> getStepList(ResultRecord resultRecord) {
Long staffId = resultRecord.getStaffId();
int type = resultRecord.getType();
String departmentId = resultRecord.getDepartmentId();
List<Step> stepList = new ArrayList<>();
StaffEntity mySelf = staffService.selectStaffById(staffId);
TwoTuple<Long, List<FlowDepartment>> flowInfo = resultRecordService.getFlowInfo(staffId, type);
Long flowId = flowInfo.getFirst();
List<FlowDepartment> list = flowInfo.getSecond();
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
//approvalList = [ME,ONE_D,TWO_D,HR,BOSS]
List<String> approvalList = new ArrayList<>();
Map<String,String> roleNameMap = new HashMap<>();
approvalList.add("ME");
roleNameMap.put("ME",mySelf.getName());
for (FlowRelation flowRelation : flowRelations) {
FlowDepartment flowDepartment = staffEntityMap.get(flowRelation.getChild());
if (flowDepartment != null || flowRelation.getCanReplace() == 0) {
approvalList.add(flowRelation.getChild());
String departmentLevel = flowRelation.getChild();
if(flowDepartment != null ){
StaffEntity flowStaff = staffService.selectStaffById(flowDepartment.getStaffId());
roleNameMap.put(departmentLevel,flowStaff.getName());
}else{
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
Long approvalStaffId = 0l;
for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(departmentId);
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if (StringUtil.isNotBlank(value)) {
approvalStaffId =staffRole.getStaffId();
break;
}
}
}
StaffEntity flowStaff = staffService.selectStaffById(approvalStaffId);
roleNameMap.put(departmentLevel,flowStaff.getName());
}
}
}
log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) + " roleNameMap : " + JSON.toJSONString(roleNameMap));
List<Flow> flows = flowService.selectByFlowId(flowId);
List<FlowRecord> flowRecordList = flowRecordService.selectFlowRecordByFlowId(resultRecord.getId());
SimpleDateFormat myFmt2 = new SimpleDateFormat("MM-dd HH:mm");
FlowRecord lastFlowRecord = null;
if (CollectionUtils.isNotEmpty(flowRecordList)) {
int status = 0;
int index = 0;
for (FlowRecord flowRecord : flowRecordList) {
String name = roleNameMap.get(flowRecord.getDepartmentLevel());
String time = myFmt2.format(flowRecord.getGmtCreate());
String statusStr = "通过";
if (flowRecord.getStatus().equals(0)) {
if (status == 1) {
statusStr = "驳回";
}
lastFlowRecord = flowRecord;
status = 0;
} else if (flowRecord.getStatus().equals(1)) {
status = 1;
}
if (index == flowRecordList.size() - 1) {
stepList.add(new Step(name, time, 1, "审批中" ));
} else {
stepList.add(new Step(name, time, 1, index == 0 ? "提交" : statusStr));
}
index++;
}
}
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
log.info("flowIndex = " + flowIndex);
for (int i = flowIndex; i < flowIndex + 10; i++) {
int index = resultRecordService.getDepartmentLevelIndex(flows, i);
if (index < 0 || index >= approvalList.size()) {
break;
}
String departmentLevel = approvalList.get(index);
stepList.add(new Step(roleNameMap.get(departmentLevel), "", 0, ""));
}
return stepList;
}
}

View File

@ -392,22 +392,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
} else {
FlowDepartment flowD = staffEntityMap.get(departmentLevel);
if (flowD == null) {
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if (StringUtil.isNotBlank(value)) {
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(), roleId != null && roleId > 0 ? roleId :
TypeRoleDto.getRoleId(staffRole.getTypeRoleIds(), resultRecord.getType()));
staffRoleDtos.add(staffRoleDto);
}
}
}
if (staffRoleDtos.size() >= 1) { //表示只有一个审批的用户
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
}
approvalStaff = getApprovalStaff(resultRecord, departmentLevel, approvalStaff, staffRoleDtos, roleId);
} else {
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(), roleId);
@ -433,12 +418,34 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
.put("type", WorkMsgTypeEnum.SUBMIT);
}
private StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, StaffEntity approvalStaff, List<StaffRoleDto> staffRoleDtos, Long roleId) {
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if (StringUtil.isNotBlank(value)) {
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(), roleId != null && roleId > 0 ? roleId :
TypeRoleDto.getRoleId(staffRole.getTypeRoleIds(), resultRecord.getType()));
staffRoleDtos.add(staffRoleDto);
}
}
}
if (staffRoleDtos.size() >= 1) { //表示只有一个审批的用户
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
}
return approvalStaff;
}
@Override
public List<ResultRecord> selectResultRecordByIds(List<Long> recordIds) {
return resultRecordMapper.selectResultRecordByIds(recordIds);
}
@Override
public int getDepartmentLevelIndex(List<Flow> list, int flowIndex) {
if (flowIndex > list.size()) {
return -1 ;

View File

@ -11,6 +11,8 @@
<result column="type" property="type"/>
<result column="target" property="target"/>
<result column="key_result" property="keyResult"/>
<result column="key_result_3_5" property="keyResult35"/>
<result column="key_result_3_7" property="keyResult37"/>
<result column="check_weight" property="checkWeight"/>
<result column="check_result" property="checkResult"/>
<result column="super_score" property="superScore"/>
@ -24,7 +26,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, 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
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, 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
</sql>
@ -40,6 +42,8 @@
<if test="type != null">type, </if>
<if test="target != null">target, </if>
<if test="keyResult != null">key_result, </if>
<if test="keyResult35 != null">key_result_3_5, </if>
<if test="keyResult37 != null">key_result_3_7, </if>
<if test="checkWeight != null">check_weight, </if>
<if test="checkResult != null">check_result, </if>
<if test="superScore != null">super_score, </if>
@ -55,6 +59,8 @@
<if test="type != null">#{ type}, </if>
<if test="target != null">#{ target}, </if>
<if test="keyResult != null">#{ keyResult}, </if>
<if test="keyResult35 != null">#{ keyResult35}, </if>
<if test="keyResult37 != null">#{ keyResult37}, </if>
<if test="checkWeight != null">#{ checkWeight}, </if>
<if test="checkResult != null">#{ checkResult}, </if>
<if test="superScore != null">#{ superScore}, </if>
@ -79,6 +85,8 @@
<if test="type != null">type = #{type},</if>
<if test="target != null">target = #{target},</if>
<if test="keyResult != null">key_result = #{keyResult},</if>
<if test="keyResult35 != null">key_result_3_5 = #{keyResult35},</if>
<if test="keyResult37 != null">key_result_3_7 = #{keyResult37},</if>
<if test="checkWeight != null">check_weight = #{checkWeight},</if>
<if test="checkResult != null">check_result = #{checkResult},</if>
<if test="superScore != null">super_score = #{superScore},</if>
@ -102,6 +110,8 @@
type = #{type},
target = #{target},
key_result = #{keyResult},
key_result_3_5 = #{keyResult35},
key_result_3_7 = #{keyResult37},
check_weight = #{checkWeight},
check_result = #{checkResult},
super_score = #{superScore},
@ -120,6 +130,7 @@
</update>
<select id="selectByRecordId" resultType="com.lz.modules.sys.entity.app.ResultDetail">
select * from lz_result_detail where record_id=#{recordResultId} and is_delete = 0 order by type asc ,priority desc
</select>

View File

@ -134,5 +134,10 @@
</select>
<select id="selectFlowRecordByFlowId" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId}
</select>
</mapper>

View File

@ -63,7 +63,7 @@ public class MysqlMain {
}
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_result_record"));
list.add(new TablesBean("lz_result_detail"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();