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())
......@@ -1253,12 +1261,13 @@ public class SpmkController {
continue;
}
}
listFlowChildren.get(i).setExecute("0");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> u.setExecute("0"));
});
listFlowChildren.get(i).setExecute("0");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> u.setExecute("0"));
});
}
SpmkApproveSummary.builder().sts(0).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
}
// 更新 flowChildren
......
......@@ -11,12 +11,13 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
/**
* 审批执行记录
*
*
* @author Tang 2020-04-17
*/
@Repository
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;
}
}
......
......@@ -12,7 +12,7 @@
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="BaseResultMapDto" type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord" >
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
......@@ -21,7 +21,7 @@
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<collection column="SpmkExecutor_id" property="spmkExecutors" ofType="cn.timer.api.bean.spmk.SpmkExecutor"
<collection column="SpmkExecutor_id" property="spmkExecutors" ofType="cn.timer.api.bean.spmk.SpmkExecutor"
resultMap="cn.timer.api.dao.spmk.SpmkExecutorMapper.BaseResultMap" columnPrefix="SpmkExecutor_">
</collection>
</resultMap>
......@@ -35,7 +35,7 @@
create_time,
update_time
</sql>
<sql id="Base_Column_List_a">
a.id,
a.approve_summary_id,
......@@ -45,7 +45,7 @@
a.create_time,
a.update_time
</sql>
<sql id="Base_Column_List_Alias_b">
b.id SpmkExecutor_id,
b.approve_execute_record_id SpmkExecutor_approve_execute_record_id,
......@@ -59,7 +59,7 @@
b.update_time SpmkExecutor_update_time,
b.signature_img SpmkExecutor_signature_img
</sql>
<sql id="Base_Column_List_Alias">
id SpmkApproveExecuteRecord_id,
approve_summary_id SpmkApproveExecuteRecord_approve_summary_id,
......@@ -69,21 +69,21 @@
create_time SpmkApproveExecuteRecord_create_time,
update_time SpmkApproveExecuteRecord_update_time
</sql>
<select id="selectListByAsId" resultMap="BaseResultMapDto">
SELECT
SELECT
<include refid="Base_Column_List_a" />,
<include refid="Base_Column_List_Alias_b" />
FROM spmk_approve_execute_record a
LEFT JOIN spmk_executor b ON a.id = b.approve_execute_record_id
WHERE a.approve_summary_id = #{id}
WHERE a.approve_summary_id = #{id}
ORDER BY a.id, b.id
</select>
<!--
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
INSERT INTO spmk_approve_execute_record
......@@ -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>
\ No newline at end of file
</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