提交修改

This commit is contained in:
quyixiao 2020-08-22 15:15:37 +08:00
parent c0950a7282
commit a8264f5e57
23 changed files with 915 additions and 46 deletions

View File

@ -10,9 +10,12 @@ import com.lz.modules.app.resp.ResultDetailResp;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
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;
import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.SysUserEntity;
@ -22,8 +25,11 @@ 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;
@ -64,6 +70,8 @@ public class ResultRecordController extends AbstractController {
@Autowired
private ResultCommentService resultCommentService;
@Autowired
private FlowRecordService flowRecordService;
/**
@ -111,6 +119,7 @@ public class ResultRecordController extends AbstractController {
listAuth = recordAuthService.selectAuthInfo(8l);
auth = recordAuthService.getAuth(listAuth);
auth.setWenHuaEdit(1);
ResultRecord resultRecordOld = resultRecordService.selectResultRecordByStaffId(getUserId());
ResultRecord resultRecordNew = null;
if (resultRecordOld != null) {
@ -118,6 +127,8 @@ public class ResultRecordController extends AbstractController {
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)) {
@ -129,10 +140,10 @@ public class ResultRecordController extends AbstractController {
}
}
} else {
resultRecordNew = createResultRecord(getUserId(), 2);
resultRecordNew = resultRecordService.createResultRecord(getUserId(), 2);
}
//保存文件价值观
recordType = 3;
//保存文件价值观
resultDetailService.insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId());
resultDetailService.insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId());
recordResultId = resultRecordNew.getId();
@ -141,6 +152,7 @@ public class ResultRecordController extends AbstractController {
listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId()));
auth = recordAuthService.getAuth(listAuth);
}
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordResultId);
if (CollectionUtils.isNotEmpty(resultDetails)) {
Map<Integer, Long> details = resultDetails.stream().collect(Collectors.groupingBy(ResultDetail::getType, Collectors.counting()));
@ -204,7 +216,6 @@ public class ResultRecordController extends AbstractController {
list.add(comment);
}
}
String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId());
return R.ok()
.put("staffName", staffEntity.getName())
@ -264,7 +275,9 @@ public class ResultRecordController extends AbstractController {
if (resultComment == null || !getUserId().equals(resultComment.getStaffId())) {
resultComment = new ResultComment();
}
return R.ok().put("resultComment", resultComment);
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordId(recordId);
return R.ok().put("resultComment", resultComment)
.put("list",flowRecords);
}
/**
@ -367,7 +380,7 @@ public class ResultRecordController extends AbstractController {
} else {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordId());
if (resultRecord == null) {
createResultRecord(getUserId(), req.getRecordType());
resultRecordService.createResultRecord(getUserId(), req.getRecordType());
}
recordId = resultRecord.getId();
req.setKeyResult(StringUtil.decodeBase64(req.getKeyResult()));
@ -382,20 +395,7 @@ public class ResultRecordController extends AbstractController {
return R.ok("保存成功").put("recordId", recordId);
}
public ResultRecord createResultRecord(Long staffId ,int type) {
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.setStaffId(getUserId());
resultRecord.setStatus(0);
resultRecord.setType(type);
resultRecordService.insertResultRecord(resultRecord);
return resultRecord;
}
/**
* 保存
*/

View File

@ -0,0 +1,21 @@
package com.lz.modules.app.utils.t;
public class EightTuple<A, B, C, D, E, F, G, H> extends SevenTuple<A, B, C, D, E, F, G> {
private H eight;
public EightTuple(A a, B b, C c, D d, E e, F f, G g, H h) {
super(a, b, c, d, e, f, g);
eight = h;
}
public H getEight() {
return eight;
}
public void setEight(H eight) {
this.eight = eight;
}
}

View File

@ -0,0 +1,22 @@
package com.lz.modules.app.utils.t;
import java.io.Serializable;
public class EleventTuple<A, B, C, D, E, F, G, H, I, J, K> extends TenTuple<A, B, C, D, E, F, G, H, I, J> implements Serializable {
private K elevent;
public EleventTuple(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) {
super(a, b, c, d, e, f, g, h, i, j);
elevent = k;
}
public K getElevent() {
return elevent;
}
public void setElevent(K elevent) {
this.elevent = elevent;
}
}

View File

@ -0,0 +1,33 @@
//: net/mindview/util/FiveTuple.java
package com.lz.modules.app.utils.t;
/*****
*
* 增加类型参数是一件简单的事情
*
* @param <A>
* @param <B>
* @param <C>
* @param <D>
* @param <E>
*/
public class FiveTuple<A, B, C, D, E> extends FourTuple<A, B, C, D> {
private E fifth;
public FiveTuple(A a, B b, C c, D d, E e) {
super(a, b, c, d);
fifth = e;
}
public E getFifth() {
return fifth;
}
public void setFifth(E fifth) {
this.fifth = fifth;
}
}
///:~

View File

@ -0,0 +1,32 @@
//: net/mindview/util/FourTuple.java
package com.lz.modules.app.utils.t;
/***
*
*
* 355页
*
*
* @param <A>
* @param <B>
* @param <C>
* @param <D>
*/
public class FourTuple<A, B, C, D> extends ThreeTuple<A, B, C> {
private D fourth;
public FourTuple(A a, B b, C c, D d) {
super(a, b, c);
fourth = d;
}
public D getFourth() {
return fourth;
}
public void setFourth(D fourth) {
this.fourth = fourth;
}
}

View File

@ -0,0 +1,7 @@
package com.lz.modules.app.utils.t;
interface ISuperTuple<A extends Object, B extends Object> {
}

View File

@ -0,0 +1,19 @@
package com.lz.modules.app.utils.t;
public class NineTuple<A, B, C, D, E, F, G, H, I> extends EightTuple<A, B, C, D, E, F, G, H> {
private I nine;
public NineTuple(A a, B b, C c, D d, E e, F f, G g, H h, I i) {
super(a, b, c, d, e, f, g, h);
nine = i;
}
public I getNine() {
return nine;
}
public void setNine(I nine) {
this.nine = nine;
}
}

View File

@ -0,0 +1,22 @@
package com.lz.modules.app.utils.t;
import java.io.Serializable;
public class OneTuple<A> implements Serializable {
private A first;
public OneTuple(A a) {
first = a;
}
public A getFirst() {
return first;
}
public void setFirst(A first) {
this.first = first;
}
}

View File

@ -0,0 +1,19 @@
package com.lz.modules.app.utils.t;
public class SevenTuple<A, B, C, D, E, F, G> extends SixTuple<A, B, C, D, E, F> {
private G seven;
public SevenTuple(A a, B b, C c, D d, E e, F f, G g) {
super(a, b, c, d, e, f);
seven = g;
}
public G getSeven() {
return seven;
}
public void setSeven(G seven) {
this.seven = seven;
}
}

View File

@ -0,0 +1,48 @@
package com.lz.modules.app.utils.t;
import com.alibaba.fastjson.JSON;
/******
*
*
*
* @param <A>
* @param <B>
* @param <C>
* @param <D>
* @param <E>
* @param <F>
*/
public class SixTuple<A, B, C, D, E, F> extends FiveTuple<A, B, C, D, E> {
public F sixth;
public SixTuple(A a, B b, C c, D d, E e, F f) {
super(a, b, c, d, e);
sixth = f;
}
public F getSixth() {
return sixth;
}
public void setSixth(F sixth) {
this.sixth = sixth;
}
static SixTuple<String, String, String, Float, Double, Byte> a() {
return new SixTuple<String, String, String, Float, Double, Byte>(
"11111", "", "hi", (float) 4.7,
1.1, (byte) 1);
}
public static void main(String[] args) {
SixTuple result = a();
System.out.println(result.getFirst());
System.out.println(JSON.toJSONString(result));
}
}

View File

@ -0,0 +1,46 @@
package com.lz.modules.app.utils.t;
public class SuperTuple<A, B, C> {
private A first;
private B second;
private C third;
public SuperTuple(A a, B b, C c) {
this.first = a;
this.second = b;
this.third = c;
}
public A getFirst() {
return first;
}
public void setFirst(A first) {
this.first = first;
}
public B getSecond() {
return second;
}
public void setSecond(B second) {
this.second = second;
}
public C getThird() {
return third;
}
public void setThird(C third) {
this.third = third;
}
public static void main(String[] args) {
String a = "";
String b = "";
}
}

View File

@ -0,0 +1,23 @@
package com.lz.modules.app.utils.t;
import java.io.Serializable;
public class TenTuple<A, B, C, D, E, F, G, H, I, J> extends NineTuple<A, B, C, D, E, F, G, H, I> implements Serializable {
private J ten;
public TenTuple(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) {
super(a, b, c, d, e, f, g, h, i);
ten = j;
}
public J getTen() {
return ten;
}
public void setTen(J ten) {
this.ten = ten;
}
}

View File

@ -0,0 +1,25 @@
package com.lz.modules.app.utils.t;
/***
* @param <A>
* @param <B>
* @param <C>
*/
public class ThreeTuple<A, B, C> extends TwoTuple<A, B> {
private C third;
public ThreeTuple(A a, B b, C c) {
super(a, b);
third = c;
}
public C getThird() {
return third;
}
public void setThird(C third) {
this.third = third;
}
}

View File

@ -0,0 +1,273 @@
package com.lz.modules.app.utils.t;
import com.alibaba.fastjson.JSON;
import java.io.Serializable;
public class Tuple implements Serializable {
private EleventTuple data;
public Tuple() {
this.data = new EleventTuple(null, null, null, null, null, null, null, null, null, null, null);
}
public Tuple(Object a) {
this.data = new EleventTuple(a, null, null, null, null, null, null, null, null, null, null);
}
public Tuple(Object a, Object b) {
this.data = new EleventTuple(a, b, null, null, null, null, null, null, null, null, null);
}
public Tuple(Object a, Object b, Object c) {
this.data = new EleventTuple(a, b, c, null, null, null, null, null, null, null, null);
}
public Tuple(Object a, Object b, Object c, Object d) {
this.data = new EleventTuple(a, b, c, d, null, null, null, null, null, null, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e) {
this.data = new EleventTuple(a, b, c, d, e, null, null, null, null, null, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e, Object f) {
this.data = new EleventTuple(a, b, c, d, e, f, null, null, null, null, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g) {
this.data = new EleventTuple(a, b, c, d, e, f, g, null, null, null, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h) {
this.data = new EleventTuple(a, b, c, d, e, f, g, h, null, null, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h, Object i) {
this.data = new EleventTuple(a, b, c, d, e, f, g, h, i, null, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h, Object i, Object j) {
this.data = new EleventTuple(a, b, c, d, e, f, g, h, i, j, null);
}
public Tuple(Object a, Object b, Object c, Object d, Object e, Object f, Object g, Object h, Object i, Object j, Object k) {
this.data = new EleventTuple(a, b, c, d, e, f, g, h, i, j, k);
}
public EleventTuple getData() {
return data;
}
public void setData(EleventTuple data) {
this.data = data;
}
public void add(Object object) {
EleventTuple<Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object> data = this.getData();
if (data.getFirst() == null) {
data.setFirst(object);
this.setData(data);
return;
}
if (data.getSecond() == null) {
data.setSecond(object);
this.setData(data);
return;
}
if (data.getThird() == null) {
data.setThird(object);
this.setData(data);
return;
}
if (data.getFourth() == null) {
data.setFourth(object);
this.setData(data);
return;
}
if (data.getFifth() == null) {
data.setFifth(object);
this.setData(data);
return;
}
if (data.getSixth() == null) {
data.setSixth(object);
this.setData(data);
return;
}
if (data.getElevent() == null) {
data.setElevent(object);
this.setData(data);
return;
}
if (data.getEight() == null) {
data.setEight(object);
this.setData(data);
return;
}
if (data.getNine() == null) {
data.setNine(object);
this.setData(data);
return;
}
if (data.getTen() == null) {
data.setTen(object);
this.setData(data);
return;
}
}
public Tuple(Tuple tuple) {
this.data = new EleventTuple(null, null, null, null, null, null, null, null, null, null, null);
if (tuple == null || tuple.getData() == null) {
return;
}
EleventTuple elevent = tuple.getData();
if (elevent.getFirst() != null) {
this.data.setFirst(elevent.getFirst());
this.setData(data);
} else {
return;
}
if (elevent.getSecond() != null) {
this.data.setSecond(elevent.getSecond());
this.setData(data);
} else {
return;
}
if (elevent.getThird() != null) {
this.data.setThird(elevent.getThird());
this.setData(data);
} else {
return;
}
if (elevent.getFourth() != null) {
this.data.setFourth(elevent.getFourth());
this.setData(data);
} else {
return;
}
if (elevent.getFifth() != null) {
this.data.setFifth(elevent.getFifth());
this.setData(data);
} else {
return;
}
if (elevent.getSixth() != null) {
this.data.setSixth(elevent.getSixth());
this.setData(data);
} else {
return;
}
if (elevent.getElevent() != null) {
this.data.setElevent(elevent.getElevent());
this.setData(data);
} else {
return;
}
if (elevent.getEight() != null) {
this.data.setEight(elevent.getEight());
this.setData(data);
} else {
return;
}
if (elevent.getNine() != null) {
this.data.setNine(elevent.getNine());
this.setData(data);
} else {
return;
}
if (elevent.getTen() != null) {
this.data.setTen(elevent.getTen());
this.setData(data);
} else {
return;
}
}
public static String getString(Tuple tuple) {
StringBuilder sb = new StringBuilder(" ");
EleventTuple elevent = tuple.getData();
if (elevent.getFirst() != null) {
sb.append(elevent.getFirst()).append(" ");
}else{
return sb.toString();
}
if (elevent.getSecond() != null) {
sb.append(elevent.getSecond()).append(" ");
}else{
return sb.toString();
}
if (elevent.getThird() != null) {
sb.append(elevent.getThird()).append(" ");
}else{
return sb.toString();
}
if (elevent.getFourth() != null) {
sb.append(elevent.getFourth()).append(" ");
}else{
return sb.toString();
}
if (elevent.getFifth() != null) {
sb.append(elevent.getFifth()).append(" ");
}else{
return sb.toString();
}
if (elevent.getSixth() != null) {
sb.append(elevent.getSixth()).append(" ");
}else{
return sb.toString();
}
if (elevent.getElevent() != null) {
sb.append(elevent.getElevent()).append(" ");
}else{
return sb.toString();
}
if (elevent.getEight() != null) {
sb.append(elevent.getEight()).append(" ");
}else{
return sb.toString();
}
if (elevent.getNine() != null) {
sb.append(elevent.getNine()).append(" ");
}else{
return sb.toString();
}
if (elevent.getTen() != null) {
sb.append(elevent.getTen()).append(" ");
}else{
return sb.toString();
}
return sb.toString();
}
public static void main(String[] args) {
Tuple data = new Tuple("1", 2, 3);
System.out.println(JSON.toJSONString(data));
Tuple data1 = new Tuple(data);
data1.add(4);
data1.add(5);
System.out.println(JSON.toJSONString(data1));
}
}

View File

@ -0,0 +1,172 @@
package com.lz.modules.app.utils.t;
import com.google.common.collect.Maps;
import tool.util.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class TupleUtils {
public static final List<String> contains = new ArrayList<>();
static {
contains.add("String");
contains.add("Double");
contains.add("double");
contains.add("Float");
contains.add("float");
contains.add("Long");
contains.add("long");
contains.add("Integer");
contains.add("int");
contains.add("Byte");
contains.add("byte");
contains.add("Character");
contains.add("Short");
contains.add("short");
contains.add("boolean");
contains.add("Boolean");
}
public static Map<String, Object> tupleToMap(TwoTuple tuple) {
Map<String, Object> map = Maps.newHashMap();
if (tuple instanceof TenTuple) {
getTen(tuple, map);
} else if (tuple instanceof NineTuple) {
getNine(tuple, map);
} else if (tuple instanceof EightTuple) {
getEight(tuple, map);
} else if (tuple instanceof SevenTuple) {
getSeven(tuple, map);
} else if (tuple instanceof SixTuple) {
getSix(tuple, map);
} else if (tuple instanceof FiveTuple) {
getFive(tuple, map);
} else if (tuple instanceof FourTuple) {
getFourth(tuple, map);
} else if (tuple instanceof ThreeTuple) {
getThree(tuple, map);
} else if (tuple instanceof TwoTuple) {
getTwo(tuple, map);
}
return map;
}
private static void getTen(TwoTuple tuple, Map<String, Object> map) {
//10
String tenName = getSimpleName(((TenTuple) tuple).getTen().getClass().getSimpleName());
buildParams(tenName, "ten", ((TenTuple) tuple).getTen(), map);
//9
getNine(tuple, map);
}
private static void getNine(TwoTuple tuple, Map<String, Object> map) {
//9
String nineName = getSimpleName(((NineTuple) tuple).getNine().getClass().getSimpleName());
buildParams(nineName, "nine", ((NineTuple) tuple).getNine(), map);
//8
getEight(tuple, map);
}
private static void getEight(TwoTuple tuple, Map<String, Object> map) {
//8
String eight = getSimpleName(((EightTuple) tuple).getEight().getClass().getSimpleName());
buildParams(eight, "eight", ((EightTuple) tuple).getEight(), map);
//7
getSeven(tuple, map);
}
private static void getSeven(TwoTuple tuple, Map<String, Object> map) {
//7
String seven = getSimpleName(((SevenTuple) tuple).getSeven().getClass().getSimpleName());
buildParams(seven, "seven", ((SevenTuple) tuple).getSeven(), map);
//6
getSix(tuple, map);
}
private static void getSix(TwoTuple tuple, Map<String, Object> map) {
//6
String sixth = getSimpleName(((SixTuple) tuple).getSixth().getClass().getSimpleName());
buildParams(sixth, "sixth", ((SixTuple) tuple).getSixth(), map);
//5
getFive(tuple, map);
}
private static void getFive(TwoTuple tuple, Map<String, Object> map) {
//5
String fifth = getSimpleName(((FiveTuple) tuple).getFifth().getClass().getSimpleName());
buildParams(fifth, "fifth", ((FiveTuple) tuple).getFifth(), map);
//4
getFourth(tuple, map);
}
private static void getFourth(TwoTuple tuple, Map<String, Object> map) {
//4
String fourth = getSimpleName(((FourTuple) tuple).getFourth().getClass().getSimpleName());
buildParams(fourth, "fourth", ((FourTuple) tuple).getFourth(), map);
//3
getThree(tuple, map);
}
private static void getThree(TwoTuple tuple, Map<String, Object> map) {
//3
String third = getSimpleName(((ThreeTuple) tuple).getThird().getClass().getSimpleName());
buildParams(third, "third", ((ThreeTuple) tuple).getThird(), map);
//2
getTwo(tuple, map);
}
private static void getTwo(TwoTuple tuple, Map<String, Object> map) {
//2
String secend = getSimpleName(tuple.getSecond().getClass().getSimpleName());
buildParams(secend, "secend", tuple.getSecond(), map);
//1
String firstName = getSimpleName(tuple.getFirst().getClass().getSimpleName());
buildParams(firstName, "first", tuple.getFirst(), map);
}
public static void buildParams(String simpleName, String defaultValue, Object value, Map<String, Object> data) {
if (StringUtil.isEmpty(simpleName)) {
simpleName = defaultValue;
return;
}
data.put(simpleName, value);
}
public static String getSimpleName(String simpleName) {
if (contains.contains(simpleName)) {
return null;
}
return (simpleName.substring(0, 1)).toLowerCase()
+ simpleName.substring(1, simpleName.length());
}
}

View File

@ -0,0 +1,20 @@
package com.lz.modules.app.utils.t;
public class TwoTuple<A, B> extends OneTuple<A> {
private B second;
public TwoTuple(A a, B b) {
super(a);
second = b;
}
public B getSecond() {
return second;
}
public void setSecond(B second) {
this.second = second;
}
}

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.FlowRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
@ -33,4 +36,6 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
FlowRecord selectLastFlowRecordByRecordId(@Param("recordId") Long recordId);
FlowRecord selectNotApprovalStaffIdFlowRecords(@Param("recordId") Long recordId);
List<FlowRecord> selectFlowRecordByRecordId(@Param("recordId") Long recordId);
}

View File

@ -20,6 +20,14 @@ public class StaffRoleDto {
}
public static String getStaffRole(Long staffId ,Long roloId) {
List<StaffRoleDto> staffRoleDtoList = new ArrayList<>();
StaffRoleDto staffRoleDto = new StaffRoleDto(staffId,roloId);
staffRoleDtoList.add(staffRoleDto);
return JSON.toJSONString(staffRoleDtoList);
}
public static void main(String[] args) {
List<StaffRoleDto> staffRoleDtoList = new ArrayList<>();
StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);

View File

@ -2,6 +2,9 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.sys.entity.app.ResultRecord;
import java.util.List;
/**
* <p>
@ -33,4 +36,8 @@ public interface FlowRecordService extends IService<FlowRecord> {
FlowRecord selectLastFlowRecordByRecordId(Long recordResultId);
FlowRecord selectNotApprovalStaffIdFlowRecords(Long recordId);
List<FlowRecord> selectFlowRecordByRecordId(Long recordId);
void initYeJi(ResultRecord resultRecord );
}

View File

@ -1,12 +1,21 @@
package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.Constant;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.app.utils.t.OneTuple;
import com.lz.modules.flow.dao.FlowRecordMapper;
import com.lz.modules.flow.entity.FlowRecord;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 流转记录表 服务类
@ -23,6 +32,12 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
@Autowired
private FlowRecordMapper flowRecordMapper;
@Autowired
private StaffService staffService;
@Autowired
private ResultRecordService resultRecordService;
@Override
@ -66,5 +81,27 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectNotApprovalStaffIdFlowRecords(recordId);
}
@Override
public List<FlowRecord> selectFlowRecordByRecordId(Long recordId) {
return flowRecordMapper.selectFlowRecordByRecordId(recordId);
}
@Override
public void initYeJi(ResultRecord resultRecord) {
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.setFlowId(flowInfo.getFirst());
flowRecord.setApprovalStaffId(resultRecord.getStaffId());
flowRecord.setApprovalStaffName(staffEntity.getName());
flowRecord.setFlowIndex(0);
flowRecord.setFlowName(staffEntity.getName() + "-新建目标");
flowRecord.setRecordStaffId(resultRecord.getStaffId());
flowRecord.setRecordId(resultRecord.getId());
flowRecord.setStatus(0);
flowRecord.setDepartmentLevel(Constant.ME);
}
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.utils.t.TwoTuple;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultRecord;
@ -48,4 +49,8 @@ public interface ResultRecordService extends IService<ResultRecord> {
R approval(Long resultRecordId, Long userId);
List<ResultRecord> selectResultRecordByIds(List<Long> recordIds);
TwoTuple getFlowInfo(Long staffId);
ResultRecord createResultRecord(Long userId, int type);
}

View File

@ -14,12 +14,14 @@ import com.lz.modules.app.resp.ResultRecordResp;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
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.service.*;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultDetailService;
import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
@ -89,6 +91,9 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Autowired
private DepartmentsService departmentsService;
@Autowired
private ResultDetailService resultDetailService;
@ -146,28 +151,20 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
}
params.setDepartmentIds(departmentIds);
PageUtils pageUtils = null;
if(params.getIsSelf() == 1){ // 我的业绩
params.setStaffId(user.getUserId());
pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
page -> resultRecordMapper.selectByCondition(page, params)
);
}else{ // 部门审批
String departmentLevel = "";
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId());
if(flowDepartment !=null){
departmentLevel = flowDepartment.getDepartmentLevel();
}else{
StaffRole staffRole = staffRoleService.selectByStaffId(user.getUserId());
departmentLevel= staffRole.getDepartmentLevel();
String departmentLevel = Constant.ME;
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId());
if (flowDepartment != null) {
departmentLevel = flowDepartment.getDepartmentLevel();
} else {
StaffRole staffRole = staffRoleService.selectByStaffId(user.getUserId());
if (staffRole != null) {
departmentLevel = staffRole.getDepartmentLevel();
}
params.setDepartmentLevel(departmentLevel);
pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
page -> resultRecordMapper.selectByConditionByLeader(page, params)
);
}
params.setDepartmentLevel(departmentLevel);
PageUtils pageUtils = PageUtils.startPage(params.getPage(), params.getLimit()).doSelect(
page -> resultRecordMapper.selectByConditionByLeader(page, params)
);
List<ResultRecord> resultRecords = pageUtils.getList();
if(CollectionUtils.isNotEmpty(resultRecords)){
List<ResultRecordResp> list = new ArrayList<>();
@ -221,16 +218,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
public void updateFlowStaffIdRoleToNull(Long id) {
resultRecordMapper.updateFlowStaffIdRoleToNull(id);
}
@Override
public R approval(Long resultRecordId,Long userId) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(resultRecordId);
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
StaffEntity mySelf = staffService.selectStaffById(userId);
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffEntity.getId());
public TwoTuple getFlowInfo(Long staffId) {
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffId);
Long flowId = flowDepartment != null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己
if (flowDepartment == null) {
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工
@ -245,6 +238,34 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
break;
}
}
return new TwoTuple(flowId, list);
}
@Override
public ResultRecord createResultRecord(Long staffId ,int type) {
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.setStaffId(staffId);
resultRecord.setStatus(0);
resultRecord.setType(type);
resultRecordService.insertResultRecord(resultRecord);
return resultRecord;
}
@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());
Long flowId = flowInfo.getFirst();
List<FlowDepartment> list = flowInfo.getSecond();
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
// approvalList = [ME,ONE_D,TWO_D,HR,BOSS]

View File

@ -124,6 +124,10 @@
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status = 0 and (approval_staff_id is null or approval_staff_id = '') order by id desc limit 1
</select>
<select id="selectFlowRecordByRecordId" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId}
</select>
</mapper>