提交修改

This commit is contained in:
quyixiao 2020-08-23 17:40:16 +08:00
parent 5c3ce58607
commit 3d6e5914be
16 changed files with 227 additions and 128 deletions

View File

@ -48,6 +48,7 @@ public class Constant {
public static final String SING = "【霖梓控股】"; public static final String SING = "【霖梓控股】";
public static final Integer STATUS_3 = 3; 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 INVELOMENT_TYPE_PRE_ENV = "preissue";
public static final String FORMAL_APP_IDENTIFY = "www"; public static final String FORMAL_APP_IDENTIFY = "www";
public static final String ME = "ME"; 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;
} }

View File

@ -13,7 +13,6 @@ import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.FlowRecord; import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.flow.entity.RecordAuth; import com.lz.modules.flow.entity.RecordAuth;
import com.lz.modules.flow.model.Auth; 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.req.ResultDetailReq;
import com.lz.modules.flow.service.FlowRecordService; import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.RecordAuthService; 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.ResultCommentService;
import com.lz.modules.sys.service.app.ResultDetailService; import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService; 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.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.hibernate.validator.constraints.URL;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -94,6 +90,10 @@ public class ResultRecordController extends AbstractController {
.put("departmentList", departmentList1); .put("departmentList", departmentList1);
} }
@RequestMapping("/getStaffResultDetail") @RequestMapping("/getStaffResultDetail")
public R getStaffResultDetail(ResultRecordReq req) { public R getStaffResultDetail(ResultRecordReq req) {
int yeJiCheckNum = 0; int yeJiCheckNum = 0;
@ -108,52 +108,27 @@ public class ResultRecordController extends AbstractController {
StaffDepartmentDto departmentDto = departmentsService.selectStaffAllDepartments(departmentsStaffRelateEntity.getDepartmentId()); StaffDepartmentDto departmentDto = departmentsService.selectStaffAllDepartments(departmentsStaffRelateEntity.getDepartmentId());
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM");
List<ResultDetailResp> list = new ArrayList<>(); List<ResultDetailResp> list = new ArrayList<>();
Long recordResultId = req.getRecordResultId();
// 获取权限 // 获取权限
Auth auth = new Auth(); Auth auth = new Auth();
List<RecordAuth> listAuth = new ArrayList<>(); List<RecordAuth> listAuth = new ArrayList<>();
if (req.getRecordType() == 1) { //新增目标 if (req.getRecordType() == 1) { //新增目标
listAuth = recordAuthService.selectAuthInfo(7l); listAuth = recordAuthService.selectAuthInfo(7l);
auth = recordAuthService.getAuth(listAuth); auth = recordAuthService.getAuth(listAuth);
resultRecord = resultRecordService.createResultRecord(getUserId(), req.getRecordType(), 7l);
flowRecordService.initFlowRecord(resultRecord, 7l, req.getType(), "月初目标");
recordType = 3;
} else if (req.getRecordType() == 2) { //新增业绩 } else if (req.getRecordType() == 2) { //新增业绩
listAuth = recordAuthService.selectAuthInfo(8l); listAuth = recordAuthService.selectAuthInfo(8l);
auth = recordAuthService.getAuth(listAuth); auth = recordAuthService.getAuth(listAuth);
auth.setWenHuaEdit(1); auth.setWenHuaEdit(1);
resultRecord = resultRecordService.initResult(getUserId(), req.getRecordType(), 8l);
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<ResultDetail> 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);
}
recordType = 3; recordType = 3;
//保存文件价值观
resultDetailService.insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId());
resultDetailService.insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId());
recordResultId = resultRecordNew.getId();
} else if (resultRecord != null) { } else if (resultRecord != null) {
Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole()); Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId())); listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId()));
auth = recordAuthService.getAuth(listAuth); auth = recordAuthService.getAuth(listAuth);
} }
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(resultRecord.getId());
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordResultId);
if (CollectionUtils.isNotEmpty(resultDetails)) { if (CollectionUtils.isNotEmpty(resultDetails)) {
Map<Integer, Long> details = resultDetails.stream().collect(Collectors.groupingBy(ResultDetail::getType, Collectors.counting())); Map<Integer, Long> details = resultDetails.stream().collect(Collectors.groupingBy(ResultDetail::getType, Collectors.counting()));
int tempType1 = NumberUtil.objToIntDefault(details.get(new Integer(1)), 0); int tempType1 = NumberUtil.objToIntDefault(details.get(new Integer(1)), 0);
@ -226,7 +201,7 @@ public class ResultRecordController extends AbstractController {
.put("list", list) .put("list", list)
.put("auth", auth) .put("auth", auth)
.put("recordType", recordType) .put("recordType", recordType)
.put("recordResultId", recordResultId) .put("recordResultId", resultRecord.getId())
.put("yeJiCheckNum", yeJiCheckNum) .put("yeJiCheckNum", yeJiCheckNum)
.put("wenHuaJiaZhiGuanNum", wenHuaJiaZhiGuanNum) .put("wenHuaJiaZhiGuanNum", wenHuaJiaZhiGuanNum)
.put("lastResultNum", lastResultNum) .put("lastResultNum", lastResultNum)
@ -368,34 +343,24 @@ public class ResultRecordController extends AbstractController {
*/ */
@RequestMapping("/detailAddOrUpdate") @RequestMapping("/detailAddOrUpdate")
public R detailAddOrUpdate(ResultDetailReq req) { 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()); ResultDetail old = resultDetailService.selectResultDetailById(req.getId());
if (old != null) { if (old != null) {
com.lz.modules.app.utils.BeanUtils.copyProperty(old, req, false); 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); resultDetailService.updateResultDetailById(old);
} else { } 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(); ResultDetail resultDetail = new ResultDetail();
BeanUtils.copyProperties(req, resultDetail); BeanUtils.copyProperties(req, resultDetail);
resultDetail.setRecordId(resultRecord.getId()); resultDetail.setRecordId(resultRecord.getId());
resultDetail.setStaffId(getUserId()); resultDetail.setStaffId(resultRecord.getStaffId());
resultDetailService.insertResultDetail(resultDetail); resultDetailService.insertResultDetail(resultDetail);
} }
return R.ok("保存成功").put("recordId", recordId); return R.ok("保存成功").put("recordId", resultRecord.getId());
} }
/** /**
* 保存 * 保存
*/ */

View File

@ -1,7 +1,7 @@
package com.lz.modules.app.utils.t; package com.lz.modules.app.utils.t;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import tool.util.StringUtil; import com.lz.common.utils.StringUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

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

View File

@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表 * 菜单权限表
* </p>*流转关系表 * </p>*流转关系表
* @author quyixiao * @author quyixiao
* @since 2020-08-20 * @since 2020-08-23
*/ */
@Data @Data
@ -29,7 +29,7 @@ public class StaffRole implements java.io.Serializable {
//角色 //角色
private String departmentLevel; private String departmentLevel;
//角色 id //角色 id
private Long roleId; private String typeRoleIds;
/** /**
* *
* @return * @return
@ -124,15 +124,15 @@ public class StaffRole implements java.io.Serializable {
* 角色 id * 角色 id
* @return * @return
*/ */
public Long getRoleId() { public String getTypeRoleIds() {
return roleId; return typeRoleIds;
} }
/** /**
* 角色 id * 角色 id
* @param roleId * @param typeRoleIds
*/ */
public void setRoleId(Long roleId) { public void setTypeRoleIds(String typeRoleIds) {
this.roleId = roleId; this.typeRoleIds = typeRoleIds;
} }
@Override @Override
@ -144,7 +144,7 @@ public class StaffRole implements java.io.Serializable {
",gmtModified=" + gmtModified + ",gmtModified=" + gmtModified +
",staffId=" + staffId + ",staffId=" + staffId +
",departmentLevel=" + departmentLevel + ",departmentLevel=" + departmentLevel +
",roleId=" + roleId + ",typeRoleIds=" + typeRoleIds +
"}"; "}";
} }
} }

View File

@ -33,6 +33,12 @@ public class StaffRoleDto {
StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l); StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);
staffRoleDtoList.add(staffRoleDto); staffRoleDtoList.add(staffRoleDto);
System.out.println(JSON.toJSONString(staffRoleDtoList)); System.out.println(JSON.toJSONString(staffRoleDtoList));
} }
} }

View File

@ -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<String, JSONObject> map = JSONObject.parseObject(flowInfo, Map.class);
JSONObject flowType = map.get(orderTo);
Map<String, Integer> list = JSONObject.parseObject(flowType.toJSONString(), Map.class);
return NumberUtil.objToLongDefault(list.get(Constant.TYPE + type),0l);
}
public static void main(String[] args) {
Map<String, Map<String, Long>> map = new HashMap<>();
Map<String, Long> map1 = new HashMap<>();
map1.put("type1" ,6l);
map1.put("type2", 1l);
Map<String,Long> 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);
}
}

View File

@ -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<String, Long> a = JSONObject.parseObject(JSON.toJSONBytes(flowInfo), Map.class);
return a.get(Constant.TYPE + type);
}
public static void main(String[] args) {
Map<String,Long> map = new HashMap();
map.put("type1",3l);
map.put("type2",3l);
System.out.println(JSON.toJSONString(map));
Map<String,Long > a = JSONObject.parseObject(JSON.toJSONBytes(map),Map.class);
System.out.println(a.get("type1"));
}
}

View File

@ -39,5 +39,5 @@ public interface FlowRecordService extends IService<FlowRecord> {
List<FlowRecord> selectFlowRecordByRecordId(Long recordId); List<FlowRecord> selectFlowRecordByRecordId(Long recordId);
void initYeJi(ResultRecord resultRecord ); void initFlowRecord(ResultRecord resultRecord , Long roleId , Integer type , String name);
} }

View File

@ -11,6 +11,7 @@ import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.flow.service.FlowRecordService; import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.sys.entity.app.ResultRecord; import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -86,17 +87,18 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectFlowRecordByRecordId(recordId); return flowRecordMapper.selectFlowRecordByRecordId(recordId);
} }
@Override @Override
public void initYeJi(ResultRecord resultRecord) { public void initFlowRecord(ResultRecord resultRecord, Long roleId , Integer type , String name) {
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId()); StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
FlowRecord flowRecord = new FlowRecord(); FlowRecord flowRecord = new FlowRecord();
flowRecord.setFlowStaffIdRole(StaffRoleDto.getStaffRole(resultRecord.getStaffId(), 8l)); flowRecord.setFlowStaffIdRole(StaffRoleDto.getStaffRole(resultRecord.getStaffId(), roleId));
OneTuple<Long> flowInfo = resultRecordService.getFlowInfo(resultRecord.getStaffId()); OneTuple<Long> flowInfo = resultRecordService.getFlowInfo(resultRecord.getStaffId(), type);
flowRecord.setFlowId(flowInfo.getFirst()); flowRecord.setFlowId(flowInfo.getFirst());
flowRecord.setApprovalStaffId(resultRecord.getStaffId()); flowRecord.setApprovalStaffId(resultRecord.getStaffId());
flowRecord.setApprovalStaffName(staffEntity.getName()); flowRecord.setApprovalStaffName(staffEntity.getName());
flowRecord.setFlowIndex(0); flowRecord.setFlowIndex(0);
flowRecord.setFlowName(staffEntity.getName() + "-新建目标"); flowRecord.setFlowName(staffEntity.getName() + "-"+name);
flowRecord.setRecordStaffId(resultRecord.getStaffId()); flowRecord.setRecordStaffId(resultRecord.getStaffId());
flowRecord.setRecordId(resultRecord.getId()); flowRecord.setRecordId(resultRecord.getId());
flowRecord.setStatus(0); flowRecord.setStatus(0);

View File

@ -297,4 +297,7 @@ public class ResultRecord implements java.io.Serializable {
",staffName=" + staffName + ",staffName=" + staffName +
"}"; "}";
} }
} }

View File

@ -50,7 +50,9 @@ public interface ResultRecordService extends IService<ResultRecord> {
List<ResultRecord> selectResultRecordByIds(List<Long> recordIds); List<ResultRecord> selectResultRecordByIds(List<Long> 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) ;
} }

View File

@ -17,9 +17,12 @@ import com.lz.modules.app.service.StaffService;
import com.lz.modules.app.utils.t.TwoTuple; import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.flow.entity.*; import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.StaffRoleDto; 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.flow.service.*;
import com.lz.modules.sys.dao.app.ResultRecordMapper; import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.SysUserEntity; 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.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService; import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService; import com.lz.modules.sys.service.app.ResultRecordService;
@ -218,15 +221,16 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
public void updateFlowStaffIdRoleToNull(Long id) { public void updateFlowStaffIdRoleToNull(Long id) {
resultRecordMapper.updateFlowStaffIdRoleToNull(id); resultRecordMapper.updateFlowStaffIdRoleToNull(id);
} }
@Override @Override
public TwoTuple getFlowInfo(Long staffId) { public TwoTuple getFlowInfo(Long staffId, Integer type) {
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffId); FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffId);
Long flowId = flowDepartment != null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己 Long flowId = flowDepartment != null ? TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.SELF, type) : 0l; // 表示是部门主管自己
if (flowDepartment == null) { if (flowDepartment == null) {
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId); DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId()); DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId()); flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工 flowId = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, type);//表示是部门下的普通员工
} }
List<FlowDepartment> list = new ArrayList<>(); List<FlowDepartment> list = new ArrayList<>();
list.add(flowDepartment); list.add(flowDepartment);
@ -243,14 +247,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Override @Override
public ResultRecord createResultRecord(Long staffId ,int type) { public ResultRecord createResultRecord(Long staffId, int type,Long roleId) {
ResultRecord resultRecord = new ResultRecord(); ResultRecord resultRecord = new ResultRecord();
resultRecord.setMonthTime(new Date()); resultRecord.setMonthTime(new Date());
if (type == 1) { resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,roleId));
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,7l));
} else {
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,8l));
}
resultRecord.setStaffId(staffId); resultRecord.setStaffId(staffId);
resultRecord.setStatus(0); resultRecord.setStatus(0);
resultRecord.setType(type); resultRecord.setType(type);
@ -258,12 +258,43 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
return resultRecord; return resultRecord;
} }
@Override
public ResultRecord initResult(Long staffId ,Integer recordType,Long roleId) {
ResultRecord resultRecordOld = resultRecordService.selectResultRecordByStaffId(staffId);
ResultRecord resultRecordNew = null;
if (resultRecordOld != null) {
Long recordId = resultRecordOld.getId();
resultRecordOld.setId(null);
resultRecordOld.setType(Constant.TWO);
resultRecordOld.setFlowStaffIdRole(resultDetailService.initRole(resultRecordOld.getStaffId(), roleId));
resultRecordService.insertResultRecord(resultRecordOld);
flowRecordService.initFlowRecord(resultRecordOld,roleId,recordType,"月未总结");
resultRecordNew = resultRecordOld;
List<ResultDetail> 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 @Override
public R approval(Long resultRecordId, Long userId) { public R approval(Long resultRecordId, Long userId) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId); ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
StaffEntity mySelf = staffService.selectStaffById(userId); StaffEntity mySelf = staffService.selectStaffById(userId);
TwoTuple<Long, List<FlowDepartment>> flowInfo = getFlowInfo(resultRecord.getStaffId()); TwoTuple<Long, List<FlowDepartment>> flowInfo = getFlowInfo(resultRecord.getStaffId(),resultRecord.getType());
Long flowId = flowInfo.getFirst(); Long flowId = flowInfo.getFirst();
List<FlowDepartment> list = flowInfo.getSecond(); List<FlowDepartment> list = flowInfo.getSecond();
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll(); List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
@ -303,24 +334,24 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
List<StaffRoleDto> staffRoleDtos = new ArrayList<>(); List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
if (Constant.ME.equals(departmentLevel)) { //如果是自己 if (Constant.ME.equals(departmentLevel)) { //如果是自己
approvalStaff = staff; // 是自己进行审批 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); staffRoleDtos.add(staffRoleDto);
} else { } else {
FlowDepartment flowD = staffEntityMap.get(departmentLevel); FlowDepartment flowD = staffEntityMap.get(departmentLevel);
if (flowD == null) { if (flowD == null) {
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel); List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
for(StaffRole staffRole: staffRoles ){ for (StaffRole staffRole : staffRoles) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId()); Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) { for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId()); String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if(StringUtil.isNotBlank(value) ){ if (StringUtil.isNotBlank(value)) {
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(),staffRole.getRoleId()); StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(), TypeRoleDto.getRoleId(staffRole.getTypeRoleIds(),resultRecord.getType()));
staffRoleDtos.add(staffRoleDto); staffRoleDtos.add(staffRoleDto);
} }
} }
} }
if(staffRoleDtos.size() == 1 ){ //表示只有一个审批的用户 if (staffRoleDtos.size() == 1) { //表示只有一个审批的用户
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId()); approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
} }
} else { } else {

View File

@ -9,8 +9,7 @@
<result column="gmt_create" property="gmtCreate"/> <result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/> <result column="gmt_modified" property="gmtModified"/>
<result column="staff_id" property="staffId"/> <result column="staff_id" property="staffId"/>
<result column="child_flow_id" property="childFlowId"/> <result column="flow_ids" property="flowIds"/>
<result column="self_flow_id" property="selfFlowId"/>
<result column="department_level" property="departmentLevel"/> <result column="department_level" property="departmentLevel"/>
<result column="parent_id" property="parentId"/> <result column="parent_id" property="parentId"/>
</resultMap> </resultMap>
@ -18,7 +17,7 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
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
</sql> </sql>
@ -32,8 +31,7 @@
<insert id="insertFlowDepartment" parameterType="FlowDepartment" useGeneratedKeys="true" keyProperty="id" > <insert id="insertFlowDepartment" parameterType="FlowDepartment" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_department( insert into lz_flow_department(
<if test="staffId != null">staff_id, </if> <if test="staffId != null">staff_id, </if>
<if test="childFlowId != null">child_flow_id, </if> <if test="flowIds != null">flow_ids, </if>
<if test="selfFlowId != null">self_flow_id, </if>
<if test="departmentLevel != null">department_level, </if> <if test="departmentLevel != null">department_level, </if>
<if test="parentId != null">parent_id, </if> <if test="parentId != null">parent_id, </if>
is_delete, is_delete,
@ -41,8 +39,7 @@
gmt_modified gmt_modified
)values( )values(
<if test="staffId != null">#{ staffId}, </if> <if test="staffId != null">#{ staffId}, </if>
<if test="childFlowId != null">#{ childFlowId}, </if> <if test="flowIds != null">#{ flowIds}, </if>
<if test="selfFlowId != null">#{ selfFlowId}, </if>
<if test="departmentLevel != null">#{ departmentLevel}, </if> <if test="departmentLevel != null">#{ departmentLevel}, </if>
<if test="parentId != null">#{ parentId}, </if> <if test="parentId != null">#{ parentId}, </if>
0, 0,
@ -59,8 +56,7 @@
<if test="isDelete != null">is_delete = #{isDelete},</if> <if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> <if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="staffId != null">staff_id = #{staffId},</if> <if test="staffId != null">staff_id = #{staffId},</if>
<if test="childFlowId != null">child_flow_id = #{childFlowId},</if> <if test="flowIds != null">flow_ids = #{flowIds},</if>
<if test="selfFlowId != null">self_flow_id = #{selfFlowId},</if>
<if test="departmentLevel != null">department_level = #{departmentLevel},</if> <if test="departmentLevel != null">department_level = #{departmentLevel},</if>
<if test="parentId != null">parent_id = #{parentId}</if> <if test="parentId != null">parent_id = #{parentId}</if>
</trim> </trim>
@ -76,8 +72,7 @@
is_delete = #{isDelete}, is_delete = #{isDelete},
gmt_create = #{gmtCreate}, gmt_create = #{gmtCreate},
staff_id = #{staffId}, staff_id = #{staffId},
child_flow_id = #{childFlowId}, flow_ids = #{flowIds},
self_flow_id = #{selfFlowId},
department_level = #{departmentLevel}, department_level = #{departmentLevel},
parent_id = #{parentId} parent_id = #{parentId}
,gmt_modified = now() ,gmt_modified = now()
@ -90,6 +85,8 @@
</update> </update>
<select id="selectByStaffId" resultType="com.lz.modules.flow.entity.FlowDepartment"> <select id="selectByStaffId" resultType="com.lz.modules.flow.entity.FlowDepartment">
select * from lz_flow_department where is_delete = 0 and staff_id = #{staffId} limit 1 select * from lz_flow_department where is_delete = 0 and staff_id = #{staffId} limit 1
</select> </select>

View File

@ -10,13 +10,13 @@
<result column="gmt_modified" property="gmtModified"/> <result column="gmt_modified" property="gmtModified"/>
<result column="staff_id" property="staffId"/> <result column="staff_id" property="staffId"/>
<result column="department_level" property="departmentLevel"/> <result column="department_level" property="departmentLevel"/>
<result column="role_id" property="roleId"/> <result column="type_role_ids" property="typeRoleIds"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
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
</sql> </sql>
@ -31,14 +31,14 @@
insert into lz_staff_role( insert into lz_staff_role(
<if test="staffId != null">staff_id, </if> <if test="staffId != null">staff_id, </if>
<if test="departmentLevel != null">department_level, </if> <if test="departmentLevel != null">department_level, </if>
<if test="roleId != null">role_id, </if> <if test="typeRoleIds != null">type_role_ids, </if>
is_delete, is_delete,
gmt_create, gmt_create,
gmt_modified gmt_modified
)values( )values(
<if test="staffId != null">#{ staffId}, </if> <if test="staffId != null">#{ staffId}, </if>
<if test="departmentLevel != null">#{ departmentLevel}, </if> <if test="departmentLevel != null">#{ departmentLevel}, </if>
<if test="roleId != null">#{ roleId}, </if> <if test="typeRoleIds != null">#{ typeRoleIds}, </if>
0, 0,
now(), now(),
now() now()
@ -54,7 +54,7 @@
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if> <if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="staffId != null">staff_id = #{staffId},</if> <if test="staffId != null">staff_id = #{staffId},</if>
<if test="departmentLevel != null">department_level = #{departmentLevel},</if> <if test="departmentLevel != null">department_level = #{departmentLevel},</if>
<if test="roleId != null">role_id = #{roleId}</if> <if test="typeRoleIds != null">type_role_ids = #{typeRoleIds}</if>
</trim> </trim>
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
@ -69,7 +69,7 @@
gmt_create = #{gmtCreate}, gmt_create = #{gmtCreate},
staff_id = #{staffId}, staff_id = #{staffId},
department_level = #{departmentLevel}, department_level = #{departmentLevel},
role_id = #{roleId} type_role_ids = #{typeRoleIds}
,gmt_modified = now() ,gmt_modified = now()
where id = #{id} where id = #{id}
</update> </update>
@ -79,8 +79,6 @@
update lz_staff_role set is_delete = 1 where id=#{id} limit 1 update lz_staff_role set is_delete = 1 where id=#{id} limit 1
</update> </update>
<select id="selectByStaffId" resultType="com.lz.modules.flow.entity.StaffRole"> <select id="selectByStaffId" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and staff_id = #{staffId} limit 1 select * from lz_staff_role where is_delete = 0 and staff_id = #{staffId} limit 1
</select> </select>

View File

@ -63,7 +63,7 @@ public class MysqlMain {
list.add(new TablesBean("luck")); list.add(new TablesBean("lz_staff_role"));
List<TablesBean> list2 = new ArrayList<TablesBean>(); List<TablesBean> list2 = new ArrayList<TablesBean>();