Commit 8c8bf906 by 龙于生 Committed by 284718418@qq.com

新增审批节点并序审批功能

parent 57e1a36a
......@@ -726,7 +726,6 @@ public class SpmkController {
@ApiOperationSupport(order = 19)
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectAd(@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
......@@ -778,7 +777,10 @@ public class SpmkController {
redisUtil.set(asId.toString(),0,500);
return ResultUtil.error("您已审批过!");
}
Integer integer = spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal()));
if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
......@@ -808,11 +810,13 @@ public class SpmkController {
approvingDto.getOpinion(),
approvingDto.getSts(),
approvingDto.getUser(),
approvingDto.getSignatureImg()
approvingDto.getSignatureImg(),
userBean.getEmpNum()
);
// 更新 flowChildren
SpmkApproveDetailSummary.builder().id(ad.getId()).flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
//最后一条数据
FlowChildren fc = CollUtil.getLast(listFlowChildren);
if (fc.getExecute() == "2") {
// 查询 SpmkApproveSummary 状态
......
......@@ -93,7 +93,9 @@ public class SpmkServiceImpl implements SpmkService{
public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId) {
// TODO Auto-generated method stub
//SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
//审批详情
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, asId));
//审批汇总
SpmkApproveSummary sum = null;
if(ad != null) {
sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime)
......@@ -104,6 +106,7 @@ public class SpmkServiceImpl implements SpmkService{
if (ad == null) {
return null;
}
//审批操作记录
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(asId);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","flowChildren","spmkApproveExecuteRecord");
if(ad.getRequestData() !=null) {
......
......@@ -53,4 +53,9 @@ public class Relation implements Serializable{
*/
private Integer signature;
/**
* 同级审批次序 0依次 1同时
*/
private String approvalOrder;
}
......@@ -463,6 +463,42 @@ public class RouterUtils {
.insert();
break;
case AUDIT:
// 新增 执行人
List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers();
Relation relation1 =listFlowChildren.get(i).getRelation().get(0);
if("1".equals(relation1.getApprovalOrder())){
for (User user2 : listUser) {
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(user2.getId()))
.operatorHeaderUrl(user2.getHeadUrl())
.executorName(user2.getName())
.build();
user2.setExecute("1");
switch (user2.getExecute()) {
case EXECUTING:
executor.setSts(ExecutorSts.IN_EXECUTION.ordinal());
executor.insert();
break;
case EXECUTED:
executor.setSts(ExecutorSts.AGREE.ordinal());
executor.insert();
break;
}
}
}else{
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
......@@ -472,10 +508,6 @@ public class RouterUtils {
.build();
// 新增 审批执行记录
aer2.insert();
// 新增 执行人
List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers();
for (User user2 : listUser) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
......@@ -494,6 +526,8 @@ public class RouterUtils {
break;
}
}
}
break;
case COPY:
SpmkApproveExecuteRecord aer3 = SpmkApproveExecuteRecord
......@@ -536,10 +570,12 @@ public class RouterUtils {
* @param opinion 意见
* @param sts 状态 1执行中 2通过 3拒绝
*/
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser,String signatureImg ) throws Exception {
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser,String signatureImg,Integer empNum ) throws Exception {
boolean hasNextApprover = false;
int es=0;
for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
// 新增 执行人
......@@ -548,14 +584,32 @@ public class RouterUtils {
List<Relation> listR = listFlowChildren.get(i).getRelation();
if (CollectionUtil.isNotEmpty(listR)) {
listUser = listR.get(0).getUsers();
if("1".equals(listR.get(0).getApprovalOrder())){
for (User user:listR.get(0).getUsers()
) {
if ("1".equals(user.getExecute())){
es++;
}
}
/*for (int j = 0; j < listR.get(0).getUsers().size(); j++) {
String execute = listR.get(0).getUsers().get(j).getExecute();
if("1".equals(execute)){
es++;
}
}*/
}
}
if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
if (Integer.parseInt(listUser.get(i_user).getId()) == empNum){
SpmkExecutor.builder()
.id(executorId)
.opinion(opinion)
......@@ -567,6 +621,8 @@ public class RouterUtils {
.build()
.updateById();
listUser.get(i_user).setExecute(EXECUTED);
}
// 历史审批人
SpmkApproveSummary.builder()
......@@ -574,6 +630,7 @@ public class RouterUtils {
.historyApprover(listUser.get(i_user).getName())
.build()
.updateById();
//拒绝处理
// 0未执行 1执行中 2同意 3拒绝 4 转派
if (sts == ExecutorSts.REFUSE.ordinal()) {
// 更新 审批汇总 状态
......@@ -629,11 +686,16 @@ public class RouterUtils {
.build();
// 更新 审批执行记录
aer.updateById();
if(es<=1){
listFlowChildren.get(i).setExecute(EXECUTED);
}
}
}else if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
if (!hasNextApprover) {
if (!hasNextApprover && es<=1) {
switch (listFlowChildren.get(i).getClassName()) {
case CREATOR:
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment