From 3d6e5914be06df8e307ddcf4e94bf92c96b8fe90 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Sun, 23 Aug 2020 17:40:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lz/common/utils/Constant.java | 6 ++ .../controller/ResultRecordController.java | 67 +++++-------------- .../lz/modules/app/utils/t/TupleUtils.java | 2 +- .../modules/flow/entity/FlowDepartment.java | 34 +++------- .../com/lz/modules/flow/entity/StaffRole.java | 16 ++--- .../lz/modules/flow/model/StaffRoleDto.java | 6 ++ .../lz/modules/flow/model/TypeFlowDto.java | 60 +++++++++++++++++ .../lz/modules/flow/model/TypeRoleDto.java | 47 +++++++++++++ .../flow/service/FlowRecordService.java | 2 +- .../service/impl/FlowRecordServiceImpl.java | 10 +-- .../modules/sys/entity/app/ResultRecord.java | 3 + .../sys/service/app/ResultRecordService.java | 6 +- .../app/impl/ResultRecordServiceImpl.java | 61 ++++++++++++----- .../mapper/flow/FlowDepartmentMapper.xml | 19 +++--- .../resources/mapper/flow/StaffRoleMapper.xml | 14 ++-- src/test/java/com/lz/mysql/MysqlMain.java | 2 +- 16 files changed, 227 insertions(+), 128 deletions(-) create mode 100644 src/main/java/com/lz/modules/flow/model/TypeFlowDto.java create mode 100644 src/main/java/com/lz/modules/flow/model/TypeRoleDto.java diff --git a/src/main/java/com/lz/common/utils/Constant.java b/src/main/java/com/lz/common/utils/Constant.java index c9c08727..3ed55c5f 100644 --- a/src/main/java/com/lz/common/utils/Constant.java +++ b/src/main/java/com/lz/common/utils/Constant.java @@ -48,6 +48,7 @@ public class Constant { public static final String SING = "【霖梓控股】"; public static final Integer STATUS_3 = 3; + public static String CHILD = "child"; /** * 菜单类型 @@ -155,6 +156,11 @@ public class Constant { public static final String INVELOMENT_TYPE_PRE_ENV = "preissue"; public static final String FORMAL_APP_IDENTIFY = "www"; public static final String ME = "ME"; + public static final String TYPE2 = "type2"; + public static final String TYPE1 = "type1"; + public static final String SELF = "self"; + public static final String TYPE = "type"; + public static final Integer TWO = 2; } 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 f1a195da..f533b35c 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -13,7 +13,6 @@ import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.entity.FlowRecord; import com.lz.modules.flow.entity.RecordAuth; import com.lz.modules.flow.model.Auth; -import com.lz.modules.flow.model.StaffRoleDto; import com.lz.modules.flow.req.ResultDetailReq; import com.lz.modules.flow.service.FlowRecordService; import com.lz.modules.flow.service.RecordAuthService; @@ -25,11 +24,8 @@ import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.service.app.ResultCommentService; import com.lz.modules.sys.service.app.ResultDetailService; import com.lz.modules.sys.service.app.ResultRecordService; -import javafx.beans.property.ReadOnlyBooleanWrapper; -import net.sf.jsqlparser.parser.JJTCCJSqlParserState; import org.apache.commons.collections.CollectionUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.hibernate.validator.constraints.URL; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -94,6 +90,10 @@ public class ResultRecordController extends AbstractController { .put("departmentList", departmentList1); } + + + + @RequestMapping("/getStaffResultDetail") public R getStaffResultDetail(ResultRecordReq req) { int yeJiCheckNum = 0; @@ -108,52 +108,27 @@ public class ResultRecordController extends AbstractController { StaffDepartmentDto departmentDto = departmentsService.selectStaffAllDepartments(departmentsStaffRelateEntity.getDepartmentId()); SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM"); List list = new ArrayList<>(); - Long recordResultId = req.getRecordResultId(); // 获取权限 Auth auth = new Auth(); List listAuth = new ArrayList<>(); if (req.getRecordType() == 1) { //新增目标 listAuth = recordAuthService.selectAuthInfo(7l); auth = recordAuthService.getAuth(listAuth); + resultRecord = resultRecordService.createResultRecord(getUserId(), req.getRecordType(), 7l); + flowRecordService.initFlowRecord(resultRecord, 7l, req.getType(), "月初目标"); + recordType = 3; } else if (req.getRecordType() == 2) { //新增业绩 listAuth = recordAuthService.selectAuthInfo(8l); auth = recordAuthService.getAuth(listAuth); auth.setWenHuaEdit(1); - - ResultRecord resultRecordOld = resultRecordService.selectResultRecordByStaffId(getUserId()); - ResultRecord resultRecordNew = null; - if (resultRecordOld != null) { - Long recordId = resultRecordOld.getId(); - resultRecordOld.setId(null); - resultRecordOld.setFlowStaffIdRole(resultDetailService.initRole(resultRecordOld.getStaffId(), 8l)); - resultRecordService.insertResultRecord(resultRecordOld); - - flowRecordService.initYeJi(resultRecordOld); - resultRecordNew = resultRecordOld; - List resultDetails = resultDetailService.selectByRecordId(recordId); - if (CollectionUtils.isNotEmpty(resultDetails)) { - // 保存业绩相关 - for (ResultDetail resultDetail : resultDetails) { - resultDetail.setRecordId(resultRecordNew.getId()); - resultDetail.setId(null); - resultDetailService.insertResultDetail(resultDetail); - } - } - } else { - resultRecordNew = resultRecordService.createResultRecord(getUserId(), 2); - } + resultRecord = resultRecordService.initResult(getUserId(), req.getRecordType(), 8l); recordType = 3; - //保存文件价值观 - resultDetailService.insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId()); - resultDetailService.insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId()); - recordResultId = resultRecordNew.getId(); } else if (resultRecord != null) { Map staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole()); listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId())); auth = recordAuthService.getAuth(listAuth); } - - List resultDetails = resultDetailService.selectByRecordId(recordResultId); + List resultDetails = resultDetailService.selectByRecordId(resultRecord.getId()); if (CollectionUtils.isNotEmpty(resultDetails)) { Map details = resultDetails.stream().collect(Collectors.groupingBy(ResultDetail::getType, Collectors.counting())); int tempType1 = NumberUtil.objToIntDefault(details.get(new Integer(1)), 0); @@ -226,7 +201,7 @@ public class ResultRecordController extends AbstractController { .put("list", list) .put("auth", auth) .put("recordType", recordType) - .put("recordResultId", recordResultId) + .put("recordResultId", resultRecord.getId()) .put("yeJiCheckNum", yeJiCheckNum) .put("wenHuaJiaZhiGuanNum", wenHuaJiaZhiGuanNum) .put("lastResultNum", lastResultNum) @@ -368,34 +343,24 @@ public class ResultRecordController extends AbstractController { */ @RequestMapping("/detailAddOrUpdate") public R detailAddOrUpdate(ResultDetailReq req) { - Long recordId = 0l; + ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordId()); + req.setKeyResult(StringUtil.decodeBase64(req.getKeyResult())); + req.setCheckResult(StringUtil.decodeBase64(req.getCheckResult())); + req.setScoreComment(StringUtil.decodeBase64(req.getScoreComment())); ResultDetail old = resultDetailService.selectResultDetailById(req.getId()); if (old != null) { com.lz.modules.app.utils.BeanUtils.copyProperty(old, req, false); - old.setKeyResult(StringUtil.decodeBase64(req.getKeyResult())); - old.setCheckResult(StringUtil.decodeBase64(req.getCheckResult())); - old.setScoreComment(StringUtil.decodeBase64(req.getScoreComment())); - recordId = old.getRecordId(); resultDetailService.updateResultDetailById(old); } else { - ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordId()); - if (resultRecord == null) { - resultRecordService.createResultRecord(getUserId(), req.getRecordType()); - } - recordId = resultRecord.getId(); - req.setKeyResult(StringUtil.decodeBase64(req.getKeyResult())); - req.setCheckResult(StringUtil.decodeBase64(req.getCheckResult())); - req.setScoreComment(StringUtil.decodeBase64(req.getScoreComment())); ResultDetail resultDetail = new ResultDetail(); BeanUtils.copyProperties(req, resultDetail); resultDetail.setRecordId(resultRecord.getId()); - resultDetail.setStaffId(getUserId()); + resultDetail.setStaffId(resultRecord.getStaffId()); resultDetailService.insertResultDetail(resultDetail); } - return R.ok("保存成功").put("recordId", recordId); + return R.ok("保存成功").put("recordId", resultRecord.getId()); } - /** * 保存 */ diff --git a/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java b/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java index 88789d4a..8b24e077 100644 --- a/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java +++ b/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java @@ -1,7 +1,7 @@ package com.lz.modules.app.utils.t; import com.google.common.collect.Maps; -import tool.util.StringUtil; +import com.lz.common.utils.StringUtil; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java b/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java index 73cdd977..55b328bc 100644 --- a/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java +++ b/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java @@ -9,7 +9,7 @@ import java.util.Date; * 菜单权限表 *

*流转关系表 * @author quyixiao -* @since 2020-08-20 +* @since 2020-08-23 */ @Data @@ -26,10 +26,8 @@ public class FlowDepartment implements java.io.Serializable { private Date gmtModified; //员工 id private Long staffId; - //自己部门小伙伴 走的 流程id - private Long childFlowId; //自己走的流程 id - private Long selfFlowId; + private String flowIds; //部门级别 private String departmentLevel; // @@ -109,34 +107,19 @@ public class FlowDepartment implements java.io.Serializable { this.staffId = staffId; } - /** - * 自己部门小伙伴 走的 流程id - * @return - */ - public Long getChildFlowId() { - return childFlowId; - } - /** - * 自己部门小伙伴 走的 流程id - * @param childFlowId - */ - public void setChildFlowId(Long childFlowId) { - this.childFlowId = childFlowId; - } - /** * 自己走的流程 id * @return */ - public Long getSelfFlowId() { - return selfFlowId; + public String getFlowIds() { + return flowIds; } /** * 自己走的流程 id - * @param selfFlowId + * @param flowIds */ - public void setSelfFlowId(Long selfFlowId) { - this.selfFlowId = selfFlowId; + public void setFlowIds(String flowIds) { + this.flowIds = flowIds; } /** @@ -177,8 +160,7 @@ public class FlowDepartment implements java.io.Serializable { ",gmtCreate=" + gmtCreate + ",gmtModified=" + gmtModified + ",staffId=" + staffId + - ",childFlowId=" + childFlowId + - ",selfFlowId=" + selfFlowId + + ",flowIds=" + flowIds + ",departmentLevel=" + departmentLevel + ",parentId=" + parentId + "}"; diff --git a/src/main/java/com/lz/modules/flow/entity/StaffRole.java b/src/main/java/com/lz/modules/flow/entity/StaffRole.java index dcca44a5..d306d7c6 100644 --- a/src/main/java/com/lz/modules/flow/entity/StaffRole.java +++ b/src/main/java/com/lz/modules/flow/entity/StaffRole.java @@ -9,7 +9,7 @@ import java.util.Date; * 菜单权限表 *

*流转关系表 * @author quyixiao -* @since 2020-08-20 +* @since 2020-08-23 */ @Data @@ -29,7 +29,7 @@ public class StaffRole implements java.io.Serializable { //角色 private String departmentLevel; //角色 id - private Long roleId; + private String typeRoleIds; /** * * @return @@ -124,15 +124,15 @@ public class StaffRole implements java.io.Serializable { * 角色 id * @return */ - public Long getRoleId() { - return roleId; + public String getTypeRoleIds() { + return typeRoleIds; } /** * 角色 id - * @param roleId + * @param typeRoleIds */ - public void setRoleId(Long roleId) { - this.roleId = roleId; + public void setTypeRoleIds(String typeRoleIds) { + this.typeRoleIds = typeRoleIds; } @Override @@ -144,7 +144,7 @@ public class StaffRole implements java.io.Serializable { ",gmtModified=" + gmtModified + ",staffId=" + staffId + ",departmentLevel=" + departmentLevel + - ",roleId=" + roleId + + ",typeRoleIds=" + typeRoleIds + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java b/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java index 8c3a9e8a..93df5cc5 100644 --- a/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java +++ b/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java @@ -33,6 +33,12 @@ public class StaffRoleDto { StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l); staffRoleDtoList.add(staffRoleDto); System.out.println(JSON.toJSONString(staffRoleDtoList)); + + + + + + } } diff --git a/src/main/java/com/lz/modules/flow/model/TypeFlowDto.java b/src/main/java/com/lz/modules/flow/model/TypeFlowDto.java new file mode 100644 index 00000000..0c109bd3 --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/TypeFlowDto.java @@ -0,0 +1,60 @@ +package com.lz.modules.flow.model; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.lz.common.utils.Constant; +import com.lz.common.utils.NumberUtil; +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class TypeFlowDto { + private String type; + private Long flowId; + + public TypeFlowDto() { + } + + public TypeFlowDto(String type, Long flowId) { + this.type = type; + this.flowId = flowId; + } + + + public static Long getFlowId(String flowInfo, String orderTo, Integer type) { + Map map = JSONObject.parseObject(flowInfo, Map.class); + JSONObject flowType = map.get(orderTo); + Map list = JSONObject.parseObject(flowType.toJSONString(), Map.class); + return NumberUtil.objToLongDefault(list.get(Constant.TYPE + type),0l); + } + + + public static void main(String[] args) { + Map> map = new HashMap<>(); + Map map1 = new HashMap<>(); + map1.put("type1" ,6l); + map1.put("type2", 1l); + + + Map map2 = new HashMap<>(); + map2.put("type1",7l); + map2.put("type2",2l); + + map.put("child",map1); + map.put("self",map2); + + String a = JSON.toJSONString(map); + System.out.println(a); + Long b = getFlowId(a,"self",2); + System.out.println(b); + + + + + } + + + +} diff --git a/src/main/java/com/lz/modules/flow/model/TypeRoleDto.java b/src/main/java/com/lz/modules/flow/model/TypeRoleDto.java new file mode 100644 index 00000000..2d82f19e --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/TypeRoleDto.java @@ -0,0 +1,47 @@ +package com.lz.modules.flow.model; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.lz.common.utils.Constant; +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class TypeRoleDto { + private String type; + private Long roleId; + + public TypeRoleDto() { + } + + public TypeRoleDto(String type, Long roleId) { + this.type = type; + this.roleId = roleId; + } + + public static Long getRoleId(String flowInfo, Integer type) { + Map a = JSONObject.parseObject(JSON.toJSONBytes(flowInfo), Map.class); + return a.get(Constant.TYPE + type); + } + + + + public static void main(String[] args) { + Map map = new HashMap(); + map.put("type1",3l); + map.put("type2",3l); + System.out.println(JSON.toJSONString(map)); + + + Map a = JSONObject.parseObject(JSON.toJSONBytes(map),Map.class); + System.out.println(a.get("type1")); + + + + } + + + +} diff --git a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java index 18ca7567..5166868f 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java @@ -39,5 +39,5 @@ public interface FlowRecordService extends IService { List selectFlowRecordByRecordId(Long recordId); - void initYeJi(ResultRecord resultRecord ); + void initFlowRecord(ResultRecord resultRecord , Long roleId , Integer type , String name); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java index 86f0b85d..a17a3fea 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java @@ -11,6 +11,7 @@ import com.lz.modules.flow.model.StaffRoleDto; import com.lz.modules.flow.service.FlowRecordService; import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.service.app.ResultRecordService; +import org.apache.tomcat.util.bcel.Const; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -86,17 +87,18 @@ public class FlowRecordServiceImpl extends ServiceImpl flowInfo = resultRecordService.getFlowInfo(resultRecord.getStaffId()); + flowRecord.setFlowStaffIdRole(StaffRoleDto.getStaffRole(resultRecord.getStaffId(), roleId)); + OneTuple flowInfo = resultRecordService.getFlowInfo(resultRecord.getStaffId(), type); flowRecord.setFlowId(flowInfo.getFirst()); flowRecord.setApprovalStaffId(resultRecord.getStaffId()); flowRecord.setApprovalStaffName(staffEntity.getName()); flowRecord.setFlowIndex(0); - flowRecord.setFlowName(staffEntity.getName() + "-新建目标"); + flowRecord.setFlowName(staffEntity.getName() + "-"+name); flowRecord.setRecordStaffId(resultRecord.getStaffId()); flowRecord.setRecordId(resultRecord.getId()); flowRecord.setStatus(0); diff --git a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java index e940b963..abdf882f 100644 --- a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java +++ b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java @@ -297,4 +297,7 @@ public class ResultRecord implements java.io.Serializable { ",staffName=" + staffName + "}"; } + + + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java index 1f9246ae..1f52e5a1 100644 --- a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java +++ b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java @@ -50,7 +50,9 @@ public interface ResultRecordService extends IService { List selectResultRecordByIds(List recordIds); - TwoTuple getFlowInfo(Long staffId); + TwoTuple getFlowInfo(Long staffId,Integer type); - ResultRecord createResultRecord(Long userId, int type); + ResultRecord createResultRecord(Long userId, int type,Long roleId); + + ResultRecord initResult(Long staffId ,Integer recordType,Long roleId) ; } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index 38640c8e..0e6c3e3f 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -17,9 +17,12 @@ 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.StaffRoleDto; +import com.lz.modules.flow.model.TypeFlowDto; +import com.lz.modules.flow.model.TypeRoleDto; import com.lz.modules.flow.service.*; import com.lz.modules.sys.dao.app.ResultRecordMapper; import com.lz.modules.sys.entity.SysUserEntity; +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; @@ -218,15 +221,16 @@ public class ResultRecordServiceImpl extends ServiceImpl list = new ArrayList<>(); list.add(flowDepartment); @@ -243,14 +247,10 @@ public class ResultRecordServiceImpl extends ServiceImpl resultDetails = resultDetailService.selectByRecordId(recordId); + if (CollectionUtils.isNotEmpty(resultDetails)) { + // 保存业绩相关 + for (ResultDetail resultDetail : resultDetails) { + resultDetail.setRecordId(resultRecordNew.getId()); + resultDetail.setId(null); + resultDetail.setType(Constant.TWO); + resultDetailService.insertResultDetail(resultDetail); + } + } + } else { + resultRecordNew = resultRecordService.createResultRecord(staffId,recordType,roleId); + } + //保存文件价值观 + resultDetailService.insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), staffId); + resultDetailService.insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), staffId); + return resultRecordNew; + } + @Override public R approval(Long resultRecordId, Long userId) { ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId); StaffEntity mySelf = staffService.selectStaffById(userId); - TwoTuple> flowInfo = getFlowInfo(resultRecord.getStaffId()); + TwoTuple> flowInfo = getFlowInfo(resultRecord.getStaffId(),resultRecord.getType()); Long flowId = flowInfo.getFirst(); List list = flowInfo.getSecond(); List flowRelations = flowRelationService.selectFlowRelationAll(); @@ -303,24 +334,24 @@ public class ResultRecordServiceImpl extends ServiceImpl staffRoleDtos = new ArrayList<>(); if (Constant.ME.equals(departmentLevel)) { //如果是自己 approvalStaff = staff; // 是自己进行审批 - StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(),flows.get(flowIndex-1).getRoleId()); + StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(), flows.get(flowIndex - 1).getRoleId()); staffRoleDtos.add(staffRoleDto); } else { FlowDepartment flowD = staffEntityMap.get(departmentLevel); if (flowD == null) { List staffRoles = staffRoleService.selectByRole(departmentLevel); - for(StaffRole staffRole: staffRoles ){ + for (StaffRole staffRole : staffRoles) { List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); Map 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(),staffRole.getRoleId()); + if (StringUtil.isNotBlank(value)) { + StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(), TypeRoleDto.getRoleId(staffRole.getTypeRoleIds(),resultRecord.getType())); staffRoleDtos.add(staffRoleDto); } } } - if(staffRoleDtos.size() == 1 ){ //表示只有一个审批的用户 + if (staffRoleDtos.size() == 1) { //表示只有一个审批的用户 approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId()); } } else { diff --git a/src/main/resources/mapper/flow/FlowDepartmentMapper.xml b/src/main/resources/mapper/flow/FlowDepartmentMapper.xml index 951e6779..9e6398b3 100644 --- a/src/main/resources/mapper/flow/FlowDepartmentMapper.xml +++ b/src/main/resources/mapper/flow/FlowDepartmentMapper.xml @@ -9,8 +9,7 @@ - - + @@ -18,7 +17,7 @@ - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, child_flow_id AS childFlowId, self_flow_id AS selfFlowId, department_level AS departmentLevel, parent_id AS parentId + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, flow_ids AS flowIds, department_level AS departmentLevel, parent_id AS parentId @@ -32,8 +31,7 @@ insert into lz_flow_department( staff_id, - child_flow_id, - self_flow_id, + flow_ids, department_level, parent_id, is_delete, @@ -41,8 +39,7 @@ gmt_modified )values( #{ staffId}, - #{ childFlowId}, - #{ selfFlowId}, + #{ flowIds}, #{ departmentLevel}, #{ parentId}, 0, @@ -59,8 +56,7 @@ is_delete = #{isDelete}, gmt_create = #{gmtCreate}, staff_id = #{staffId}, - child_flow_id = #{childFlowId}, - self_flow_id = #{selfFlowId}, + flow_ids = #{flowIds}, department_level = #{departmentLevel}, parent_id = #{parentId} @@ -76,8 +72,7 @@ is_delete = #{isDelete}, gmt_create = #{gmtCreate}, staff_id = #{staffId}, - child_flow_id = #{childFlowId}, - self_flow_id = #{selfFlowId}, + flow_ids = #{flowIds}, department_level = #{departmentLevel}, parent_id = #{parentId} ,gmt_modified = now() @@ -90,6 +85,8 @@ + + diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index 57908862..7c3ffade 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -10,13 +10,13 @@ - + - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, role_id AS roleId + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, type_role_ids AS typeRoleIds @@ -31,14 +31,14 @@ insert into lz_staff_role( staff_id, department_level, - role_id, + type_role_ids, is_delete, gmt_create, gmt_modified )values( #{ staffId}, #{ departmentLevel}, - #{ roleId}, + #{ typeRoleIds}, 0, now(), now() @@ -54,7 +54,7 @@ gmt_create = #{gmtCreate}, staff_id = #{staffId}, department_level = #{departmentLevel}, - role_id = #{roleId} + type_role_ids = #{typeRoleIds} ,gmt_modified = now() where id = #{id} @@ -69,7 +69,7 @@ gmt_create = #{gmtCreate}, staff_id = #{staffId}, department_level = #{departmentLevel}, - role_id = #{roleId} + type_role_ids = #{typeRoleIds} ,gmt_modified = now() where id = #{id} @@ -79,8 +79,6 @@ update lz_staff_role set is_delete = 1 where id=#{id} limit 1 - - diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index 8e2d97ad..fb0774b6 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -63,7 +63,7 @@ public class MysqlMain { - list.add(new TablesBean("luck")); + list.add(new TablesBean("lz_staff_role")); List list2 = new ArrayList();