diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index a888aa3f..f1a195da 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -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 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 resultDetails = resultDetailService.selectByRecordId(recordResultId); if (CollectionUtils.isNotEmpty(resultDetails)) { Map 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 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; - } + /** * 保存 */ diff --git a/src/main/java/com/lz/modules/app/utils/t/EightTuple.java b/src/main/java/com/lz/modules/app/utils/t/EightTuple.java new file mode 100644 index 00000000..e80dc2ec --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/EightTuple.java @@ -0,0 +1,21 @@ +package com.lz.modules.app.utils.t; + +public class EightTuple extends SevenTuple { + + + 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; + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/EleventTuple.java b/src/main/java/com/lz/modules/app/utils/t/EleventTuple.java new file mode 100644 index 00000000..74201a2a --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/EleventTuple.java @@ -0,0 +1,22 @@ +package com.lz.modules.app.utils.t; + +import java.io.Serializable; + +public class EleventTuple extends TenTuple 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; + } + +} diff --git a/src/main/java/com/lz/modules/app/utils/t/FiveTuple.java b/src/main/java/com/lz/modules/app/utils/t/FiveTuple.java new file mode 100644 index 00000000..78642157 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/FiveTuple.java @@ -0,0 +1,33 @@ +//: net/mindview/util/FiveTuple.java +package com.lz.modules.app.utils.t; + + +/***** + * + * 增加类型参数是一件简单的事情 + * + * @param + * @param + * @param + * @param + * @param + */ +public class FiveTuple extends FourTuple { + 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; + } +} + + +///:~ diff --git a/src/main/java/com/lz/modules/app/utils/t/FourTuple.java b/src/main/java/com/lz/modules/app/utils/t/FourTuple.java new file mode 100644 index 00000000..4edf1184 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/FourTuple.java @@ -0,0 +1,32 @@ +//: net/mindview/util/FourTuple.java +package com.lz.modules.app.utils.t; + + +/*** + * + * + * 355页 + * + * + * @param + * @param + * @param + * @param + */ +public class FourTuple extends ThreeTuple { + 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; + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/ISuperTuple.java b/src/main/java/com/lz/modules/app/utils/t/ISuperTuple.java new file mode 100644 index 00000000..054e5e4b --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/ISuperTuple.java @@ -0,0 +1,7 @@ +package com.lz.modules.app.utils.t; + +interface ISuperTuple { + + +} + diff --git a/src/main/java/com/lz/modules/app/utils/t/NineTuple.java b/src/main/java/com/lz/modules/app/utils/t/NineTuple.java new file mode 100644 index 00000000..f2c1da0b --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/NineTuple.java @@ -0,0 +1,19 @@ +package com.lz.modules.app.utils.t; + +public class NineTuple extends EightTuple { + + 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; + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/OneTuple.java b/src/main/java/com/lz/modules/app/utils/t/OneTuple.java new file mode 100644 index 00000000..cabc52ff --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/OneTuple.java @@ -0,0 +1,22 @@ +package com.lz.modules.app.utils.t; + +import java.io.Serializable; + +public class OneTuple implements Serializable { + private A first; + + public OneTuple(A a) { + first = a; + } + + public A getFirst() { + return first; + } + + public void setFirst(A first) { + this.first = first; + } + + +} + diff --git a/src/main/java/com/lz/modules/app/utils/t/SevenTuple.java b/src/main/java/com/lz/modules/app/utils/t/SevenTuple.java new file mode 100644 index 00000000..6670b091 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/SevenTuple.java @@ -0,0 +1,19 @@ +package com.lz.modules.app.utils.t; + +public class SevenTuple extends SixTuple { + + 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; + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/SixTuple.java b/src/main/java/com/lz/modules/app/utils/t/SixTuple.java new file mode 100644 index 00000000..9f8cf5c0 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/SixTuple.java @@ -0,0 +1,48 @@ +package com.lz.modules.app.utils.t; + +import com.alibaba.fastjson.JSON; + +/****** + * + * + * + * @param + * @param + * @param + * @param + * @param + * @param + */ +public class SixTuple extends FiveTuple { + 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 a() { + return new SixTuple( + "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)); + + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/SuperTuple.java b/src/main/java/com/lz/modules/app/utils/t/SuperTuple.java new file mode 100644 index 00000000..0accd0d6 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/SuperTuple.java @@ -0,0 +1,46 @@ +package com.lz.modules.app.utils.t; + +public class SuperTuple { + + 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 = ""; + + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/TenTuple.java b/src/main/java/com/lz/modules/app/utils/t/TenTuple.java new file mode 100644 index 00000000..2b2c37ff --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/TenTuple.java @@ -0,0 +1,23 @@ +package com.lz.modules.app.utils.t; + +import java.io.Serializable; + +public class TenTuple extends NineTuple 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; + } + + +} diff --git a/src/main/java/com/lz/modules/app/utils/t/ThreeTuple.java b/src/main/java/com/lz/modules/app/utils/t/ThreeTuple.java new file mode 100644 index 00000000..e40ea096 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/ThreeTuple.java @@ -0,0 +1,25 @@ +package com.lz.modules.app.utils.t; + + +/*** + * @param + * @param + * @param + */ +public class ThreeTuple extends TwoTuple { + 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; + } +} diff --git a/src/main/java/com/lz/modules/app/utils/t/Tuple.java b/src/main/java/com/lz/modules/app/utils/t/Tuple.java new file mode 100644 index 00000000..90bdefc9 --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/Tuple.java @@ -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 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)); + + + } + + +} diff --git a/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java b/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java new file mode 100644 index 00000000..88789d4a --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/TupleUtils.java @@ -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 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 tupleToMap(TwoTuple tuple) { + Map 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 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 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 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 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 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 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 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 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 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 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()); + } + + +} diff --git a/src/main/java/com/lz/modules/app/utils/t/TwoTuple.java b/src/main/java/com/lz/modules/app/utils/t/TwoTuple.java new file mode 100644 index 00000000..ca6fecdc --- /dev/null +++ b/src/main/java/com/lz/modules/app/utils/t/TwoTuple.java @@ -0,0 +1,20 @@ +package com.lz.modules.app.utils.t; + +public class TwoTuple extends OneTuple { + 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; + } + +} + diff --git a/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java index 1d814b4a..00c013bd 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java @@ -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 { @@ -33,4 +36,6 @@ public interface FlowRecordMapper extends BaseMapper { FlowRecord selectLastFlowRecordByRecordId(@Param("recordId") Long recordId); FlowRecord selectNotApprovalStaffIdFlowRecords(@Param("recordId") Long recordId); + + List selectFlowRecordByRecordId(@Param("recordId") Long recordId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java b/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java index 6ebcec94..8c3a9e8a 100644 --- a/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java +++ b/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java @@ -20,6 +20,14 @@ public class StaffRoleDto { } + + public static String getStaffRole(Long staffId ,Long roloId) { + List staffRoleDtoList = new ArrayList<>(); + StaffRoleDto staffRoleDto = new StaffRoleDto(staffId,roloId); + staffRoleDtoList.add(staffRoleDto); + return JSON.toJSONString(staffRoleDtoList); + } + public static void main(String[] args) { List staffRoleDtoList = new ArrayList<>(); StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l); diff --git a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java index 5611fc00..18ca7567 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java @@ -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; /** *

@@ -33,4 +36,8 @@ public interface FlowRecordService extends IService { FlowRecord selectLastFlowRecordByRecordId(Long recordResultId); FlowRecord selectNotApprovalStaffIdFlowRecords(Long recordId); + + List selectFlowRecordByRecordId(Long recordId); + + void initYeJi(ResultRecord resultRecord ); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java index af24e959..86f0b85d 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java @@ -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; + /** *

* 流转记录表 服务类 @@ -23,6 +32,12 @@ public class FlowRecordServiceImpl extends ServiceImpl 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 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); + } + } diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java index ee0788fe..1f9246ae 100644 --- a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java +++ b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java @@ -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 { R approval(Long resultRecordId, Long userId); List selectResultRecordByIds(List recordIds); + + TwoTuple getFlowInfo(Long staffId); + + ResultRecord createResultRecord(Long userId, int type); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index f16b163e..38640c8e 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -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.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 resultRecords = pageUtils.getList(); if(CollectionUtils.isNotEmpty(resultRecords)){ List list = new ArrayList<>(); @@ -221,16 +218,12 @@ public class ResultRecordServiceImpl extends ServiceImpl> flowInfo = getFlowInfo(resultRecord.getStaffId()); + Long flowId = flowInfo.getFirst(); + List list = flowInfo.getSecond(); List flowRelations = flowRelationService.selectFlowRelationAll(); Map staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p)); // approvalList = [ME,ONE_D,TWO_D,HR,BOSS] diff --git a/src/main/resources/mapper/flow/FlowRecordMapper.xml b/src/main/resources/mapper/flow/FlowRecordMapper.xml index 0a99e9bb..6fa869d7 100644 --- a/src/main/resources/mapper/flow/FlowRecordMapper.xml +++ b/src/main/resources/mapper/flow/FlowRecordMapper.xml @@ -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 + +