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-26 14:28:44 +08:00
commit 1f9c89769c
23 changed files with 869 additions and 571 deletions

View File

@ -10,9 +10,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @类描述字符串工具类
* @author 陈金虎 2017年1月16日 下午11:43:50
* @类描述字符串工具类
* @注意本内容仅限于杭州霖梓网络科技有限公司内部传阅禁止外泄以及用于其他的商业目的
*/
public class StringUtil extends StringUtils {
@ -23,6 +22,7 @@ public class StringUtil extends StringUtils {
private static final String[] DUOTRIKEY = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V"};
private static final String[] CARDINALNUM = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
private static final String[] NUMBERS = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
/**
* 通过StringBuffer来组装字符串
*
@ -62,10 +62,8 @@ public class StringUtil extends StringUtils {
/**
* 把list按分隔符转换成字符串
*
* @param strList
* list数据
* @param separator
* 分隔符
* @param strList list数据
* @param separator 分隔符
* @return
*/
public static String turnListToStr(Collection<String> strList, String separator) {
@ -86,10 +84,8 @@ public class StringUtil extends StringUtils {
/**
* 把字符串数组按分隔符转化成字符串
*
* @param strArr
* 字符串数组
* @param separator
* 分隔符
* @param strArr 字符串数组
* @param separator 分隔符
* @return
*/
public static String turnArrayToStr(String separator, String... strArr) {
@ -149,12 +145,10 @@ public class StringUtil extends StringUtils {
}
/**
* @方法描述将字符串中的emoji符号转换为*
*
* @author huyang 2017年4月6日下午12:38:04
* @param source
* 待处理字符串
* @param source 待处理字符串
* @return
* @方法描述将字符串中的emoji符号转换为*
* @author huyang 2017年4月6日下午12:38:04
* @注意本内容仅限于杭州霖梓网络科技有限公司内部传阅禁止外泄以及用于其他的商业目的
*/
public static String filterEmoji(String source) {
@ -182,10 +176,10 @@ public class StringUtil extends StringUtils {
}
/**
* @Title: UrlEncoder
* @Description: 字符串编码
* @param sStr
* @return
* @Title: UrlEncoder
* @Description: 字符串编码
*/
public final static String UrlEncoder(String sStr) {
String sReturnCode = "";
@ -197,10 +191,10 @@ public class StringUtil extends StringUtils {
}
/**
* @Title: UrlDecoder
* @Description: 字符串解码
* @param sStr
* @return
* @Title: UrlDecoder
* @Description: 字符串解码
*/
public static String UrlDecoder(String sStr) {
if (isEmpty(sStr)) {
@ -276,7 +270,6 @@ public class StringUtil extends StringUtils {
}
/**
* fmai 根据时间数据生产相应的字符串
*
@ -306,7 +299,6 @@ public class StringUtil extends StringUtils {
}
/**
* 首字母大写
*
@ -334,7 +326,6 @@ public class StringUtil extends StringUtils {
}
/**
* 将对象转为字符串
*
@ -355,7 +346,6 @@ public class StringUtil extends StringUtils {
}
public static String removeDoubleChar(String str) {
if (str.indexOf("\"") == 0) {
str = str.substring(1, str.length()); //去掉第一个 "
@ -367,10 +357,9 @@ public class StringUtil extends StringUtils {
}
/**
* 通过请求参数获取键值对
*
* @param requestParams
* @return
*/
@ -389,9 +378,9 @@ public class StringUtil extends StringUtils {
}
/**
* 除去数组中的空值和签名参数
*
* @param sArray 签名参数组
* @return 去掉空值与签名参数后的新签名参数组
*/
@ -418,6 +407,7 @@ public class StringUtil extends StringUtils {
/**
* 把数组所有元素排序并按照参数=参数值的模式用&字符拼接成字符串
*
* @param params 需要排序并参与字符拼接的参数组
* @return 拼接后字符串
*/
@ -508,6 +498,7 @@ public class StringUtil extends StringUtils {
/**
* 截取一个字符串中两个字符串中间的字符串
*
* @param str
* @param strStart
* @param strEnd
@ -537,6 +528,7 @@ public class StringUtil extends StringUtils {
/**
* Object转换String
*
* @param obj
* @return
*/
@ -550,6 +542,7 @@ public class StringUtil extends StringUtils {
/**
* 手机号的粗略校验要求严谨时慎用
*
* @param inputStr
* @return
*/
@ -580,8 +573,10 @@ public class StringUtil extends StringUtils {
public static List<Long> strs2list(String strs) {
return strs2list(strs, ",");
}
/**
* 根据分隔符获取Long型的集合
*
* @param listStr
* @param symbol
* @return
@ -605,6 +600,7 @@ public class StringUtil extends StringUtils {
/**
* 将字符串的首字母转大写
*
* @param str 需要转换的字符串
* @return
*/
@ -643,6 +639,7 @@ public class StringUtil extends StringUtils {
}
return value;
}
public static void main(String[] args) {
System.out.println(realNameTo2("xxxxx"));
@ -674,4 +671,16 @@ public class StringUtil extends StringUtils {
}
return false;
}
public static List<Long> strToLongs(String roleIds) {
List<Long> list = new ArrayList<>();
if (StringUtil.isEmpty(roleIds)) {
return list;
}
String[] roleId = roleIds.split(",");
for (String r : roleId) {
list.add(NumberUtil.objToLongDefault(r, -1));
}
return list;
}
}

View File

@ -642,4 +642,12 @@ public class ResultRecordController extends AbstractController {
}
}

View File

@ -257,4 +257,13 @@ public class TestController {
}
}
// http://localhost:8080/lz_management/test/resultrecord?resultRecordId=157
@RequestMapping("/test/resultrecord")
public void resultRecorcd(Long resultRecordId) throws Exception{
R r = resultRecordService.initFlowRecord(resultRecordId);
}
}

View File

@ -0,0 +1,36 @@
package com.lz.modules.app.enums;
public enum FlowApprovalRoleTypeEnums {
ME(-1,"自己"),
STAFF(0,"指定员工"),
ONE_SUPPER(1,"一级主管"),
TWO_SUPPER(2,"二级主管"),
THREE_SUPPER(3,"三级主管"),
FOUR_SUPPER(4,"四级主管"),
FIVE_SUPPER(5,"五级主管");
private Integer type;
private String desc ;
FlowApprovalRoleTypeEnums(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

View File

@ -0,0 +1,33 @@
package com.lz.modules.app.enums;
public enum FlowRecordStatusEnums {
UN_TO_STATUS(0, "流程未到"),
FINISHED_STATUS(1, "流程已走"),
CURRENT_FLOW_STATUS(2, "当前流程"),
SKIP_STATUS(3, "跳过");
private Integer status;
private String desc ;
FlowRecordStatusEnums(Integer name, String desc) {
this.status = name;
this.desc = desc;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

View File

@ -34,4 +34,6 @@ public interface FlowApprovalRoleMapper extends BaseMapper<FlowApprovalRole> {
Long insertFlowApprovalRoles(@Param("list") List<FlowApprovalRole> flowApprovalRoles);
List<FlowApprovalRole> selectFlowApprovalRoleList(@Param("flowIds") List<Long> flowIds);
}

View File

@ -58,4 +58,5 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<TaskListDto> selectFinishTasksByApprovalStaffId(@Param("approvalStaffId") Long approvalStaffId, @Param("page") IPage page);
void insertFlowRecords(@Param("flowRecords") List<FlowRecord> flowRecords);
}

View File

@ -37,7 +37,7 @@ public class FlowApprovalRole implements java.io.Serializable {
private Integer type;
//审批人角色id
@ApiModelProperty(value = "审批人角色id", name = "roleId")
private Long roleId;
private String roleId;
//流程表id
@ApiModelProperty(value = "流程表id", name = "flowId")
private Long flowId;
@ -142,14 +142,14 @@ public class FlowApprovalRole implements java.io.Serializable {
* 审批人角色id
* @return
*/
public Long getRoleId() {
public String getRoleId() {
return roleId;
}
/**
* 审批人角色id
* @param roleId
*/
public void setRoleId(Long roleId) {
public void setRoleId(String roleId) {
this.roleId = roleId;
}

View File

@ -23,7 +23,7 @@ public class FlowApprovalRoleDto {
private Integer type;
//审批人角色id
@ApiModelProperty(value = "审批人角色id", name = "roleId")
private Long roleId;
private String roleId;
//流程表id
@ApiModelProperty(value = "流程表id", name = "flowId")
private Long flowId;
@ -80,14 +80,14 @@ public class FlowApprovalRoleDto {
* 审批人角色id
* @return
*/
public Long getRoleId() {
public String getRoleId() {
return roleId;
}
/**
* 审批人角色id
* @param roleId
*/
public void setRoleId(Long roleId) {
public void setRoleId(String roleId) {
this.roleId = roleId;
}

View File

@ -28,6 +28,9 @@ public class StaffRoleDto {
return JSON.toJSONString(staffRoleDtoList);
}
public static void main(String[] args) {
List<StaffRoleDto> staffRoleDtoList = new ArrayList<>();
StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);

View File

@ -0,0 +1,30 @@
package com.lz.modules.flow.model;
import com.alibaba.fastjson.JSON;
import java.util.*;
public class StaffRoles {
private Long staffId;
private List<Long> roleIds;
public StaffRoles(Long staffId, List<Long> roleIds) {
this.staffId = staffId;
this.roleIds = roleIds;
}
public static String getStaffRole(Long staffId, List<Long> roloIds) {
Set<Long> set = new HashSet<>();
for (Long roleId : roloIds) {
set.add(roleId);
}
List<Long> list = new ArrayList<>();
list.addAll(set);
Map<String, List<Long>> map = new HashMap<>();
map.put(staffId + "", list );
return JSON.toJSONString(map);
}
}

View File

@ -46,7 +46,7 @@ public class FlowApprovalRoleReq implements java.io.Serializable {
private Integer type;
//审批人角色id
@ApiModelProperty(value = "审批人角色id", name = "roleId")
private Long roleId;
private String roleId;
//流程表id
@ApiModelProperty(value = "流程表id", name = "flowId")
private Long flowId;
@ -148,14 +148,14 @@ public class FlowApprovalRoleReq implements java.io.Serializable {
* 审批人角色id
* @return
*/
public Long getRoleId() {
public String getRoleId() {
return roleId;
}
/**
* 审批人角色id
* @param roleId
*/
public void setRoleId(Long roleId) {
public void setRoleId(String roleId) {
this.roleId = roleId;
}

View File

@ -33,4 +33,6 @@ public interface FlowApprovalRoleService extends IService<FlowApprovalRole> {
Long insertFlowApprovalRoles(List<FlowApprovalRole> flowApprovalRoles);
List<FlowApprovalRole> selectFlowApprovalRoleList(List<Long> flowIds);
}

View File

@ -57,4 +57,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
Long copyFlowRecord(FlowRecord flowRecord);
PageUtils selectTaskListByApprovalStaffId(AssessTaskReq req, Long approvalStaffId);
void insertFlowRecords(List<FlowRecord> flowRecords);
}

View File

@ -89,5 +89,12 @@ public class FlowApprovalRoleServiceImpl extends ServiceImpl<FlowApprovalRoleMap
}
@Override
public List<FlowApprovalRole> selectFlowApprovalRoleList(List<Long> flowIds) {
return flowApprovalRoleMapper.selectFlowApprovalRoleList(flowIds);
}
}

View File

@ -158,4 +158,9 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return pageUtils;
}
@Override
public void insertFlowRecords(List<FlowRecord> flowRecords) {
flowRecordMapper.insertFlowRecords(flowRecords);
}
}

View File

@ -125,7 +125,8 @@ public class FlowStartController {
if(flowStart1 == null){
flowStartService.insertFlowStart(flowStart);
}else{
flowStart = flowStart1;
flowStart.setId(flowStart1.getId());
}
@ -257,34 +258,49 @@ public class FlowStartController {
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(Long.parseLong(roleId));
flowApprovalRole.setRoleId(roleId);
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
}*/
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
}
}
stepIndex++;
}else{
String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(Long.parseLong(roleId));
flowApprovalRole.setRoleId(roleId);
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
}
}*/
stepIndex++;
}

View File

@ -107,4 +107,5 @@ public interface ResultRecordService extends IService<ResultRecord> {
void batchDeleteByStaffIds(List<String> staffIds);
R initFlowRecord(Long resultRecordId);
}

View File

@ -12,6 +12,8 @@ import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.enums.FlowApprovalRoleTypeEnums;
import com.lz.modules.app.enums.FlowRecordStatusEnums;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp;
import com.lz.modules.app.resp.ResultRecordResp;
@ -21,10 +23,7 @@ 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.enums.FlowRecordEnum;
import com.lz.modules.flow.model.Auth;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.flow.model.TypeFlowDto;
import com.lz.modules.flow.model.TypeRoleDto;
import com.lz.modules.flow.model.*;
import com.lz.modules.flow.service.*;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.req.AssessDetailReq;
@ -118,6 +117,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Autowired
private DingtalkBusiness dingtalkBusiness;
@Autowired
private FlowApprovalRoleService flowApprovalRoleService;
@Value("${dingtalk.appid}")
private String appid;
@ -684,6 +686,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
lastFlowRecordNoStatus.setGmtCreate(new Date()); //更新驳回时间
flowRecordService.updateFlowRecordById(lastFlowRecordNoStatus);
// 可能会被删除
FlowRecord lastUsedFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(resultRecord.getId());
lastUsedFlowRecord.setId(null);
@ -746,4 +749,85 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
public void batchDeleteByStaffIds(List<String> staffIds) {
}
@Override
public R initFlowRecord(Long resultRecordId) {
ResultRecord resultRecord = resultRecordMapper.selectResultRecordById(resultRecordId);
List<Flow> flows = flowService.selectByFlowId(resultRecord.getEvaluationId());
List<Long> flowIds = new ArrayList<>();
for(Flow flow:flows){
flowIds.add(flow.getId());
}
List<FlowApprovalRole> flowApprovalRoles =flowApprovalRoleService.selectFlowApprovalRoleList(flowIds);
int i = 0 ;
DepartmentsStaffRelateEntity relateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(resultRecord.getStaffId());
Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(relateEntity.getDepartmentId());
List<FlowRecord> flowRecords = new ArrayList<>();
for(FlowApprovalRole flowApprovalRole:flowApprovalRoles){
FlowRecord flowRecord = new FlowRecord();
flowRecord.setRecordId(resultRecord.getId());
StaffEntity staffEntity = new StaffEntity();
if(FlowApprovalRoleTypeEnums.ME.getType().equals(flowApprovalRole.getType())){
staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
}else if(FlowApprovalRoleTypeEnums.STAFF.getType().equals(flowApprovalRole.getType())){
staffEntity = staffService.selectStaffById(flowApprovalRole.getApprovalId());
}else if(FlowApprovalRoleTypeEnums.ONE_SUPPER.getType().equals(flowApprovalRole.getType())){
staffEntity = getDepartmentStaff(map,1);
}else if(FlowApprovalRoleTypeEnums.TWO_SUPPER.getType().equals(flowApprovalRole.getType())){
staffEntity = getDepartmentStaff(map,2);
}else if(FlowApprovalRoleTypeEnums.THREE_SUPPER.getType().equals(flowApprovalRole.getType())){
staffEntity = getDepartmentStaff(map,3);
}else if(FlowApprovalRoleTypeEnums.FOUR_SUPPER.getType().equals(flowApprovalRole.getType())){
staffEntity = getDepartmentStaff(map,4);
}else if(FlowApprovalRoleTypeEnums.FOUR_SUPPER.getType().equals(flowApprovalRole.getType())){
staffEntity = getDepartmentStaff(map,5);
}
flowRecord.setApprovalStaffName(staffEntity.getName());
flowRecord.setApprovalStaffId(staffEntity.getId());
flowRecord.setFlowName(getFlow(flows,flowApprovalRole.getFlowId()).getOptDesc());
flowRecord.setRecordStaffId(resultRecord.getStaffId());
flowRecord.setFlowId(flowApprovalRole.getFlowId());
String staffRole = StaffRoles.getStaffRole(staffEntity.getId(), StringUtil.strToLongs(flowApprovalRole.getRoleId()));
if(i == 0 ){
flowRecord.setStatus(FlowRecordStatusEnums.CURRENT_FLOW_STATUS.getStatus());
resultRecord.setFlowStaffIdRole(staffRole);
}else{
flowRecord.setStatus(FlowRecordStatusEnums.UN_TO_STATUS.getStatus());
}
flowRecord.setFlowStaffIdRole(staffRole);
flowRecord.setFlowIndex(flowApprovalRole.getStepIndex());
flowRecord.setType(flowApprovalRole.getStepType()); //步骤类型0依次1或签同时通知一人通过或拒绝即可2会签同时通知所有人同意才可
i ++;
flowRecords.add(flowRecord);
}
flowRecordService.insertFlowRecords(flowRecords);
resultRecordService.updateResultRecordById(resultRecord);
return R.ok();
}
public StaffEntity getDepartmentStaff(Map<String, String> map, int level) {
for (int i = 1; i < 6; i++) {
String deparment = map.get("dd" + i );
if (StringUtil.isNotBlank(deparment)) {
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectDepartmentByDepartmentId(deparment);
if (departmentsStaffRelateEntity != null) {
StaffEntity staffEntity = staffService.selectStaffById(departmentsStaffRelateEntity.getStaffId());
if (level == i) {
return staffEntity;
}
}
}
}
return new StaffEntity();
}
public Flow getFlow(List<Flow> flows,Long flowId){
for(Flow flow : flows){
if(flow.getId().equals(flowId)){
return flow;
}
}
return new Flow();
}
}

View File

@ -118,5 +118,15 @@
;
</insert>
<select id="selectFlowApprovalRoleList" resultType="com.lz.modules.flow.entity.FlowApprovalRole">
select * from lz_flow_approval_role where flow_id in
<foreach collection="flowIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by step_index asc
</select>
</mapper>

View File

@ -108,6 +108,7 @@
)
</insert>
<update id="updateFlowRecordById" parameterType="FlowRecord" >
update
lz_flow_record
@ -221,5 +222,44 @@
order by r.gmt_modified desc
</select>
<insert id="insertFlowRecords">
insert into lz_flow_record(
department_level,
record_id,
approval_staff_id,
approval_staff_name,
flow_name,
record_staff_id,
flow_id,
flow_index,
status,
flow_staff_id_role,
status_name,
type,
is_delete,
gmt_create,
gmt_modified
)values
<foreach collection="flowRecords" item="item" separator=",">
( #{ item.departmentLevel},
#{ item.recordId},
#{ item.approvalStaffId},
#{ item.approvalStaffName},
#{ item.flowName},
#{ item.recordStaffId},
#{ item.flowId},
#{ item.flowIndex},
#{ item.status},
#{ item.flowStaffIdRole},
#{ item.statusName},
#{ item.type},
0,
now(),
now()
)
</foreach>
</insert>
</mapper>

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_evaluation_group"));
list.add(new TablesBean("lz_flow_record"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();