提交修改
This commit is contained in:
parent
5c3ce58607
commit
3d6e5914be
@ -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;
|
||||
}
|
||||
|
||||
@ -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<ResultDetailResp> list = new ArrayList<>();
|
||||
Long recordResultId = req.getRecordResultId();
|
||||
// 获取权限
|
||||
Auth auth = new Auth();
|
||||
List<RecordAuth> 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<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);
|
||||
}
|
||||
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<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
|
||||
listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId()));
|
||||
auth = recordAuthService.getAuth(listAuth);
|
||||
}
|
||||
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordResultId);
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(resultRecord.getId());
|
||||
if (CollectionUtils.isNotEmpty(resultDetails)) {
|
||||
Map<Integer, Long> 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());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.Date;
|
||||
* 菜单权限表
|
||||
* </p>*流转关系表
|
||||
* @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 +
|
||||
"}";
|
||||
|
||||
@ -9,7 +9,7 @@ import java.util.Date;
|
||||
* 菜单权限表
|
||||
* </p>*流转关系表
|
||||
* @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 +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,12 @@ public class StaffRoleDto {
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);
|
||||
staffRoleDtoList.add(staffRoleDto);
|
||||
System.out.println(JSON.toJSONString(staffRoleDtoList));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
src/main/java/com/lz/modules/flow/model/TypeFlowDto.java
Normal file
60
src/main/java/com/lz/modules/flow/model/TypeFlowDto.java
Normal 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);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
47
src/main/java/com/lz/modules/flow/model/TypeRoleDto.java
Normal file
47
src/main/java/com/lz/modules/flow/model/TypeRoleDto.java
Normal 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"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -39,5 +39,5 @@ public interface FlowRecordService extends IService<FlowRecord> {
|
||||
|
||||
List<FlowRecord> selectFlowRecordByRecordId(Long recordId);
|
||||
|
||||
void initYeJi(ResultRecord resultRecord );
|
||||
void initFlowRecord(ResultRecord resultRecord , Long roleId , Integer type , String name);
|
||||
}
|
||||
@ -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<FlowRecordMapper, FlowRec
|
||||
return flowRecordMapper.selectFlowRecordByRecordId(recordId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initYeJi(ResultRecord resultRecord) {
|
||||
public void initFlowRecord(ResultRecord resultRecord, Long roleId , Integer type , String name) {
|
||||
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
FlowRecord flowRecord = new FlowRecord();
|
||||
flowRecord.setFlowStaffIdRole(StaffRoleDto.getStaffRole(resultRecord.getStaffId(), 8l));
|
||||
OneTuple<Long> flowInfo = resultRecordService.getFlowInfo(resultRecord.getStaffId());
|
||||
flowRecord.setFlowStaffIdRole(StaffRoleDto.getStaffRole(resultRecord.getStaffId(), roleId));
|
||||
OneTuple<Long> 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);
|
||||
|
||||
@ -297,4 +297,7 @@ public class ResultRecord implements java.io.Serializable {
|
||||
",staffName=" + staffName +
|
||||
"}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -50,7 +50,9 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
|
||||
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) ;
|
||||
}
|
||||
@ -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<ResultRecordMapper, Res
|
||||
public void updateFlowStaffIdRoleToNull(Long id) {
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TwoTuple getFlowInfo(Long staffId) {
|
||||
public TwoTuple getFlowInfo(Long staffId, Integer type) {
|
||||
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) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
|
||||
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
|
||||
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工
|
||||
flowId = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, type);//表示是部门下的普通员工
|
||||
}
|
||||
List<FlowDepartment> list = new ArrayList<>();
|
||||
list.add(flowDepartment);
|
||||
@ -243,14 +247,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
|
||||
@Override
|
||||
public ResultRecord createResultRecord(Long staffId ,int type) {
|
||||
public ResultRecord createResultRecord(Long staffId, int type,Long roleId) {
|
||||
ResultRecord resultRecord = new ResultRecord();
|
||||
resultRecord.setMonthTime(new Date());
|
||||
if (type == 1) {
|
||||
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,7l));
|
||||
} else {
|
||||
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,8l));
|
||||
}
|
||||
resultRecord.setFlowStaffIdRole(resultDetailService.initRole(staffId,roleId));
|
||||
resultRecord.setStaffId(staffId);
|
||||
resultRecord.setStatus(0);
|
||||
resultRecord.setType(type);
|
||||
@ -258,12 +258,43 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
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
|
||||
public R approval(Long resultRecordId, Long userId) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
|
||||
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();
|
||||
List<FlowDepartment> list = flowInfo.getSecond();
|
||||
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
|
||||
@ -303,24 +334,24 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
List<StaffRoleDto> 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<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
|
||||
for(StaffRole staffRole: staffRoles ){
|
||||
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(),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 {
|
||||
|
||||
@ -9,8 +9,7 @@
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="staff_id" property="staffId"/>
|
||||
<result column="child_flow_id" property="childFlowId"/>
|
||||
<result column="self_flow_id" property="selfFlowId"/>
|
||||
<result column="flow_ids" property="flowIds"/>
|
||||
<result column="department_level" property="departmentLevel"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
</resultMap>
|
||||
@ -18,7 +17,7 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<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>
|
||||
|
||||
|
||||
@ -32,8 +31,7 @@
|
||||
<insert id="insertFlowDepartment" parameterType="FlowDepartment" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into lz_flow_department(
|
||||
<if test="staffId != null">staff_id, </if>
|
||||
<if test="childFlowId != null">child_flow_id, </if>
|
||||
<if test="selfFlowId != null">self_flow_id, </if>
|
||||
<if test="flowIds != null">flow_ids, </if>
|
||||
<if test="departmentLevel != null">department_level, </if>
|
||||
<if test="parentId != null">parent_id, </if>
|
||||
is_delete,
|
||||
@ -41,8 +39,7 @@
|
||||
gmt_modified
|
||||
)values(
|
||||
<if test="staffId != null">#{ staffId}, </if>
|
||||
<if test="childFlowId != null">#{ childFlowId}, </if>
|
||||
<if test="selfFlowId != null">#{ selfFlowId}, </if>
|
||||
<if test="flowIds != null">#{ flowIds}, </if>
|
||||
<if test="departmentLevel != null">#{ departmentLevel}, </if>
|
||||
<if test="parentId != null">#{ parentId}, </if>
|
||||
0,
|
||||
@ -59,8 +56,7 @@
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
<if test="staffId != null">staff_id = #{staffId},</if>
|
||||
<if test="childFlowId != null">child_flow_id = #{childFlowId},</if>
|
||||
<if test="selfFlowId != null">self_flow_id = #{selfFlowId},</if>
|
||||
<if test="flowIds != null">flow_ids = #{flowIds},</if>
|
||||
<if test="departmentLevel != null">department_level = #{departmentLevel},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId}</if>
|
||||
</trim>
|
||||
@ -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 @@
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="staff_id" property="staffId"/>
|
||||
<result column="department_level" property="departmentLevel"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
<result column="type_role_ids" property="typeRoleIds"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<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>
|
||||
|
||||
|
||||
@ -31,14 +31,14 @@
|
||||
insert into lz_staff_role(
|
||||
<if test="staffId != null">staff_id, </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,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
)values(
|
||||
<if test="staffId != null">#{ staffId}, </if>
|
||||
<if test="departmentLevel != null">#{ departmentLevel}, </if>
|
||||
<if test="roleId != null">#{ roleId}, </if>
|
||||
<if test="typeRoleIds != null">#{ typeRoleIds}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
@ -54,7 +54,7 @@
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
<if test="staffId != null">staff_id = #{staffId},</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>
|
||||
,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}
|
||||
</update>
|
||||
@ -79,8 +79,6 @@
|
||||
update lz_staff_role set is_delete = 1 where id=#{id} limit 1
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
@ -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>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user