Commit 07b22e04 by 翁国栋

添加审批人会影响到抄送人bug

parent f442114b
......@@ -77,8 +77,6 @@ public class AdminSpmkController {
@ApiOperationSupport(order = 20)
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
/*判断是否有权限转派*/
//if(approvingDto.getSts()==4){
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
......
......@@ -1220,27 +1220,35 @@ public class SpmkController {
SpmkApproveDetailSummary spmkApproveDetailSummary = SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId()).build().selectById();
List<FlowChildren> listFlowChildren = spmkApproveDetailDto.getFlowChildren();
//只有添加审批人才会有值
if (spmkApproveDetailDto.getIndex() != null) {
if (spmkApproveDetailDto.getIndex() != null && spmkApproveDetailDto.getIndex() != null) {
//如果当前索引下的都要变更为0未执行
int currentIndex=spmkApproveDetailDto.getIndex();
for (int i = currentIndex+1; i < listFlowChildren.size(); i++) {
int currentIndex = spmkApproveDetailDto.getIndex();
for (int i = currentIndex + 1; i < listFlowChildren.size(); i++) {
if (i == currentIndex + 1) {
if (!listFlowChildren.get(currentIndex).getExecute().equals("1")) {
//如果当前索引下的都要变更为0未执行
FlowChildren flowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex());
User user = flowChildren.getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex());
SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(user.getId()), spmkApproveDetailSummary.getApproveSummaryId());
// //删除审批过的人记录
if (spmkApproveExecuteRecord != null) {
spmkApproveExecuteRecordMapper.delExecutor(spmkApproveExecuteRecord.getId(), spmkApproveDetailSummary.getApproveSummaryId());
}
listFlowChildren.get(i).setExecute("1");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> {
u.setExecute("1");
//添加审批记录
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord
SpmkApproveExecuteRecord spmkApproveExecuteRecord1 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
.name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
.type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
.sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
spmkApproveExecuteRecord.insert();
spmkApproveExecuteRecord1.insert();
SpmkExecutor.builder()
.approveExecuteRecordId(spmkApproveExecuteRecord.getId())
.approveExecuteRecordId(spmkApproveExecuteRecord1.getId())
.empNum(Integer.parseInt(u.getId()))
.operatorHeaderUrl(u.getHeadUrl())
.executorName(u.getName())
......@@ -1259,6 +1267,7 @@ public class SpmkController {
});
}
SpmkApproveSummary.builder().sts(0).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
}
// 更新 flowChildren
......
......@@ -18,5 +18,6 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveExecuteRecord> {
List<SpmkApproveExecuteRecord> selectListByAsId(@Param("id") Integer id);
int delExecutor(@Param("id") Integer id,@Param("approveSummaryId") Integer approveSummaryId);
SpmkApproveExecuteRecord selectExecuteRecordById(@Param("userId") Integer userId,@Param("approveSummaryId") Integer approveSummaryId);
}
......@@ -63,4 +63,6 @@ public class SpmkApproveDetailDto {
private Integer index;//插入审批人的索引
private Integer userIndex;//插入审批人的当前用户索引
}
......@@ -983,7 +983,7 @@ public class RouterUtils {
//判断用户执行状态 0 未执行 1 执行中 2 已执行
//已执行
if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
return;
//执行中
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
//判断当前节点审批人id 等于 操作用户id 则更新执行人信息:审批意见、状态(0未执行 1执行中 2同意 3拒接 4转派)
......@@ -998,11 +998,6 @@ public class RouterUtils {
.sts(sts)
.signatureImg(signatureImg)
.build().updateById();
// if(spmkExecutor.getId()==0){
// spmkExecutor.insert();
// }else{
// spmkExecutor.updateById();
// }
listUser.get(i_user).setExecute(EXECUTED);
......@@ -1256,6 +1251,11 @@ public class RouterUtils {
break;
}
}
//重新新修改审批结果
}else if(EXECUTED.equals(listFlowChildren.get(i).getExecute())){
SpmkExecutor.builder().id(executorId).sts(sts).opinion(opinion).build().updateById();
SpmkApproveExecuteRecord.builder().id(executeRecordId).sts(sts).build().updateById();
return;
}
}
......
......@@ -166,5 +166,16 @@
</select>
-->
<select id="selectExecuteRecordById" resultType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
SELECT sr.id FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se ON se.approve_execute_record_id=sr.id
WHERE sr.approve_summary_id = #{approveSummaryId} and se.emp_num = #{userId}
</select>
<delete id="delExecutor">
DELETE FROM spmk_approve_execute_record
WHERE approve_summary_id = #{approveSummaryId} and id <![CDATA[ > ]]> #{id}
</delete>
</mapper>
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