Commit f32793c3 by 翁国栋

重复审批bug

parent 07b22e04
...@@ -19,6 +19,7 @@ import lombok.AllArgsConstructor; ...@@ -19,6 +19,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Transient;
/** /**
* @author Tang 2020-04-17 * @author Tang 2020-04-17
...@@ -32,7 +33,7 @@ import lombok.NoArgsConstructor; ...@@ -32,7 +33,7 @@ import lombok.NoArgsConstructor;
public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> { public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -57,11 +58,14 @@ public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> { ...@@ -57,11 +58,14 @@ public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> {
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间") @ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime; private Date createTime;
@TableField(fill = FieldFill.UPDATE) @TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "操作时间 ", example = "操作时间") @ApiModelProperty(value = "操作时间 ", example = "操作时间")
private Date updateTime; private Date updateTime;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "")
private List<SpmkExecutor> spmkExecutors; private List<SpmkExecutor> spmkExecutors;
} }
\ No newline at end of file
...@@ -135,7 +135,7 @@ public class DiskFilesController { ...@@ -135,7 +135,7 @@ public class DiskFilesController {
diskFilesLog.setFilesId(diskFiles.getId()); diskFilesLog.setFilesId(diskFiles.getId());
diskFilesLog.setFileSize(dto.getFileSize() + "B"); diskFilesLog.setFileSize(dto.getFileSize() + "B");
diskFilesLog.setTitle(dto.getResourceFileName()); diskFilesLog.setTitle(dto.getResourceFileName());
diskFilesLog.setType(JxglEnumInterface.DiskFilesLogType.CREATE_LOG.getType()); diskFilesLog.setType(JxglEnumInterface.DiskFilesLogType.CREATE_LOG.getType());
diskFilesLog.insert(); diskFilesLog.insert();
} }
......
...@@ -64,6 +64,7 @@ public class CmsController { ...@@ -64,6 +64,7 @@ public class CmsController {
@Autowired @Autowired
private CmsIsReadMapper cmsIsReadMapper; private CmsIsReadMapper cmsIsReadMapper;
// @Autowired // @Autowired
// private CmsAnnouncementMapper cmsAnnouncementMapper; // private CmsAnnouncementMapper cmsAnnouncementMapper;
...@@ -756,6 +757,10 @@ public class CmsController { ...@@ -756,6 +757,10 @@ public class CmsController {
} }
return ResultUtil.success(); return ResultUtil.success();
} }
@PostMapping(value = "/getUnreadCmsList")
@ApiOperation(value = "获取当前用户的未读传阅列表", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> shxxquery(@CurrentUser UserBean userBean) {
return ResultUtil.data(cmsIsReadMapper.getUnreadList(userBean.getEmpNum()));
}
} }
...@@ -62,6 +62,9 @@ public class AdminSpmkController { ...@@ -62,6 +62,9 @@ public class AdminSpmkController {
@Autowired @Autowired
private SpmkAssoBusinessFactory spmkAssoBusinessFactory; private SpmkAssoBusinessFactory spmkAssoBusinessFactory;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject(); private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
@Resource @Resource
...@@ -144,6 +147,11 @@ public class AdminSpmkController { ...@@ -144,6 +147,11 @@ public class AdminSpmkController {
} }
} }
//如果是再次审批
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord.builder().id(approvingDto.getExecuteRecordId()).build().selectById();
if(spmkApproveExecuteRecord.getSts()>1){
spmkApproveExecuteRecordMapper.delExecuteRecord(approvingDto.getExecuteRecordId(), asId);
}
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(),FlowChildren.class); List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(),FlowChildren.class);
RouterUtils.updateRefuseToAgree( RouterUtils.updateRefuseToAgree(
...@@ -157,7 +165,9 @@ public class AdminSpmkController { ...@@ -157,7 +165,9 @@ public class AdminSpmkController {
approvingDto.getUser(), approvingDto.getUser(),
approvingDto.getSignatureImg(), approvingDto.getSignatureImg(),
userBean.getEmpNum(), userBean.getEmpNum(),
approvingDto.getUserList() approvingDto.getUserList(),
approvingDto.getTypeIndex(),
approvingDto.getUserIndex()
); );
...@@ -168,6 +178,10 @@ public class AdminSpmkController { ...@@ -168,6 +178,10 @@ public class AdminSpmkController {
sadsUpdate.setRequestData(ad.getRequestData()); sadsUpdate.setRequestData(ad.getRequestData());
}*/ }*/
sadsUpdate.updateById(); sadsUpdate.updateById();
//最后一条数据 //最后一条数据
FlowChildren fc = CollUtil.getLast(listFlowChildren); FlowChildren fc = CollUtil.getLast(listFlowChildren);
if (fc.getExecute() == "2") { if (fc.getExecute() == "2") {
......
...@@ -1225,14 +1225,14 @@ public class SpmkController { ...@@ -1225,14 +1225,14 @@ public class SpmkController {
int currentIndex = spmkApproveDetailDto.getIndex(); int currentIndex = spmkApproveDetailDto.getIndex();
for (int i = currentIndex + 1; i < listFlowChildren.size(); i++) { for (int i = currentIndex + 1; i < listFlowChildren.size(); i++) {
if (i == currentIndex + 1) { if (i == currentIndex + 1) {
if (!listFlowChildren.get(currentIndex).getExecute().equals("1")) { if (!listFlowChildren.get(currentIndex).getExecute().equals("1")&&!listFlowChildren.get(currentIndex).getExecute().equals("0")) {
//如果当前索引下的都要变更为0未执行 //如果当前索引下的都要变更为0未执行
FlowChildren flowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex()); FlowChildren flowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex());
User user = flowChildren.getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex()); User user = flowChildren.getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex());
SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(user.getId()), spmkApproveDetailSummary.getApproveSummaryId()); SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(user.getId()), spmkApproveDetailSummary.getApproveSummaryId());
// //删除审批过的人记录 //删除审批过的人记录
if (spmkApproveExecuteRecord != null) { if (spmkApproveExecuteRecord != null) {
spmkApproveExecuteRecordMapper.delExecutor(spmkApproveExecuteRecord.getId(), spmkApproveDetailSummary.getApproveSummaryId()); spmkApproveExecuteRecordMapper.delExecuteRecord(spmkApproveExecuteRecord.getId(), spmkApproveDetailSummary.getApproveSummaryId());
} }
listFlowChildren.get(i).setExecute("1"); listFlowChildren.get(i).setExecute("1");
listFlowChildren.get(i).getRelation().forEach(v -> { listFlowChildren.get(i).getRelation().forEach(v -> {
......
package cn.timer.api.dao.qyxx; package cn.timer.api.dao.qyxx;
import cn.timer.api.bean.qyxx.CmsContent;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -8,9 +9,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -8,9 +9,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.qyxx.CmsIsRead; import cn.timer.api.bean.qyxx.CmsIsRead;
import cn.timer.api.dto.qyxx.QyxxIsReadDto; import cn.timer.api.dto.qyxx.QyxxIsReadDto;
import java.util.List;
/** /**
* OA消息内容表 * OA消息内容表
* *
* @author dsc 2019-12-12 * @author dsc 2019-12-12
*/ */
@Repository @Repository
...@@ -18,11 +21,12 @@ public interface CmsIsReadMapper extends BaseMapper<CmsIsRead> { ...@@ -18,11 +21,12 @@ public interface CmsIsReadMapper extends BaseMapper<CmsIsRead> {
/** /**
* 查询已读人 * 查询已读人
* *
* @param mid * @param mid
* @param orgCode * @param orgCode
* @return * @return
*/ */
QyxxIsReadDto queryIsReadEmp(@Param(value = "orgCode") Integer orgCode, @Param(value = "mid") Integer mid); QyxxIsReadDto queryIsReadEmp(@Param(value = "orgCode") Integer orgCode, @Param(value = "mid") Integer mid);
List<CmsContent> getUnreadList(@Param(value="userId")Integer userId);
} }
...@@ -18,6 +18,6 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord; ...@@ -18,6 +18,6 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveExecuteRecord> { public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveExecuteRecord> {
List<SpmkApproveExecuteRecord> selectListByAsId(@Param("id") Integer id); List<SpmkApproveExecuteRecord> selectListByAsId(@Param("id") Integer id);
int delExecutor(@Param("id") Integer id,@Param("approveSummaryId") Integer approveSummaryId); int delExecuteRecord(@Param("recordId") Integer recordId,@Param("approveSummaryId") Integer approveSummaryId);
SpmkApproveExecuteRecord selectExecuteRecordById(@Param("userId") Integer userId,@Param("approveSummaryId") Integer approveSummaryId); SpmkApproveExecuteRecord selectExecuteRecordById(@Param("userId") Integer userId,@Param("approveSummaryId") Integer approveSummaryId);
} }
...@@ -50,4 +50,10 @@ public class AdminApprovingDto { ...@@ -50,4 +50,10 @@ public class AdminApprovingDto {
@ApiModelProperty(value = "申请数据 ", example = "申请数据", required = true) @ApiModelProperty(value = "申请数据 ", example = "申请数据", required = true)
private Integer execute; private Integer execute;
@ApiModelProperty(value = "节点索引 ", example = "节点索引", required = true)
private Integer typeIndex;
@ApiModelProperty(value = "节点用户索引 ", example = "节点用户索引", required = true)
private Integer userIndex;
} }
...@@ -927,13 +927,18 @@ public class RouterUtils { ...@@ -927,13 +927,18 @@ public class RouterUtils {
* @param opinion 意见 * @param opinion 意见
* @param sts 状态 1执行中 2通过 3拒绝 4转派 * @param sts 状态 1执行中 2通过 3拒绝 4转派
*/ */
public static void updateRefuseToAgree(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,Integer currentSts,User redeployUser,String signatureImg,Integer empNum,List<User> redeployUserList) throws Exception { public static void updateRefuseToAgree(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,Integer currentSts,User redeployUser,String signatureImg,Integer empNum,List<User> redeployUserList,Integer typeIndex,Integer userIndex) throws Exception {
//拒绝单
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord.builder().id(executeRecordId).build().selectById();
if(currentSts==3){ if(currentSts==3){
SpmkExecutor.builder().id(executorId).sts(sts).opinion(opinion).build().updateById(); SpmkExecutor.builder().id(executorId).sts(sts).opinion(opinion).build().updateById();
SpmkApproveExecuteRecord.builder().id(executeRecordId).sts(sts).build().updateById(); spmkApproveExecuteRecord.builder().id(executeRecordId).sts(sts).build().updateById();
// 更新 审批汇总 状态 // 更新 审批汇总 状态
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).updateTime(new Date()).sts(SpmkEnumInterface.ApproveSummarySts.IN.ordinal()).build().updateById(); SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).updateTime(new Date()).sts(SpmkEnumInterface.ApproveSummarySts.IN.ordinal()).build().updateById();
}else if(currentSts==2){
SpmkApproveSummary.builder().id(asId).currentApprover(listFlowChildren.get(typeIndex).getRelation().get(0).getUsers().get(userIndex).getName()).updateTime(new Date()).sts(SpmkEnumInterface.ApproveSummarySts.IN.ordinal()).build().updateById();
} }
//是否有下一个审批人 //是否有下一个审批人
boolean hasNextApprover = false; boolean hasNextApprover = false;
//统计并序审批 还有几个执行中的 //统计并序审批 还有几个执行中的
...@@ -946,9 +951,12 @@ public class RouterUtils { ...@@ -946,9 +951,12 @@ public class RouterUtils {
//初始化转派人数据 用于转派 //初始化转派人数据 用于转派
String flowChildrenJson = "{\"className\":\"audit\",\"execute\":\"0\",\"flow\":true,\"relation\":[{\"approvalOrder\":\"0\",\"departmentId\":\"\",\"down\":0,\"empty\":0,\"name\":\"\",\"signature\":0,\"type\":\"users\",\"upward\":0,\"users\":[{\"execute\":\"0\",\"headUrl\":\"\",\"id\":\"\",\"name\":\"\"}]}]}"; String flowChildrenJson = "{\"className\":\"audit\",\"execute\":\"0\",\"flow\":true,\"relation\":[{\"approvalOrder\":\"0\",\"departmentId\":\"\",\"down\":0,\"empty\":0,\"name\":\"\",\"signature\":0,\"type\":\"users\",\"upward\":0,\"users\":[{\"execute\":\"0\",\"headUrl\":\"\",\"id\":\"\",\"name\":\"\"}]}]}";
FlowChildren flowChildren = jsonObject.parseObject(flowChildrenJson,FlowChildren.class); FlowChildren flowChildren = jsonObject.parseObject(flowChildrenJson,FlowChildren.class);
boolean isApprover = false;
for (int i = 0,n = listFlowChildren.size(); i < n; i++) { for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
//等于当前审批人
if(i==typeIndex){
listFlowChildren.get(i).setExecute(EXECUTING);
}
// 新增 执行人 // 新增 执行人
List<User> listUser = CollUtil.toList(); List<User> listUser = CollUtil.toList();
boolean aobl = false;//用于判断是 否并序审批 boolean aobl = false;//用于判断是 否并序审批
...@@ -971,7 +979,10 @@ public class RouterUtils { ...@@ -971,7 +979,10 @@ public class RouterUtils {
} }
} }
if(isApprover){
listFlowChildren.get(i).setExecute(UNEXECUTED);
listFlowChildren.get(i).getRelation().get(0).getUsers().forEach(v->v.setExecute(UNEXECUTED));
}
//判断大节点的执行状态 0 未执行 1 执行中 2 已执行 //判断大节点的执行状态 0 未执行 1 执行中 2 已执行
//执行中 //执行中
if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) { if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
...@@ -980,10 +991,13 @@ public class RouterUtils { ...@@ -980,10 +991,13 @@ public class RouterUtils {
//遍历当前节点审批人 //遍历当前节点审批人
outloop: // 标识 (若内层满足条件直接跳到该层循环) outloop: // 标识 (若内层满足条件直接跳到该层循环)
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) { for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
if(i_user==userIndex){
isApprover=true;
listUser.get(i_user).setExecute(EXECUTING);
}
//判断用户执行状态 0 未执行 1 执行中 2 已执行 //判断用户执行状态 0 未执行 1 执行中 2 已执行
//已执行 //已执行
if (EXECUTED.equals(listUser.get(i_user).getExecute())) { if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
return;
//执行中 //执行中
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) { }else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
//判断当前节点审批人id 等于 操作用户id 则更新执行人信息:审批意见、状态(0未执行 1执行中 2同意 3拒接 4转派) //判断当前节点审批人id 等于 操作用户id 则更新执行人信息:审批意见、状态(0未执行 1执行中 2同意 3拒接 4转派)
...@@ -1120,7 +1134,8 @@ public class RouterUtils { ...@@ -1120,7 +1134,8 @@ public class RouterUtils {
} }
//判断大节点为未执行 //判断大节点为未执行
}else if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) { }
else if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
//判断无下一个审批人 并且 执行中的小于等于1 //判断无下一个审批人 并且 执行中的小于等于1
if (!hasNextApprover && es<=1) { if (!hasNextApprover && es<=1) {
switch (listFlowChildren.get(i).getClassName()) { switch (listFlowChildren.get(i).getClassName()) {
...@@ -1252,11 +1267,8 @@ public class RouterUtils { ...@@ -1252,11 +1267,8 @@ public class RouterUtils {
} }
} }
//重新新修改审批结果 //重新新修改审批结果
}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;
} }
} }
for (int i = 0; i < listFlowChildren.size(); i++) { for (int i = 0; i < listFlowChildren.size(); i++) {
......
...@@ -45,19 +45,27 @@ ...@@ -45,19 +45,27 @@
a.read_time ASC a.read_time ASC
</select> </select>
<!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.cmsI.CmsIsRead"> <select id="getUnreadList" resultType="cn.timer.api.bean.qyxx.CmsContent">
INSERT INTO cms_is_read <trim prefix="(" suffix=")" suffixOverrides=","> select cc.* from cms_content cc
<if test ='null != mid'> mid, </if> <if test ='null != uid'> uid </if> </trim> left JOIN cms_content_read ccs on ccs.cms_content_id=cc.id
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null != WHERE ccs.read_status = 0 and ccs.user_id=#{userId}
mid'> #{mid}, </if> <if test ='null != uid'> #{uid} </if> </trim> </insert> order by ccs.create_time desc
<delete id="delete" > DELETE FROM cms_is_read WHERE id = #{id} </delete> limit 10
<update id="update" parameterType="cn.timer.api.bean.cmsI.CmsIsRead"> UPDATE </select>
cms_is_read <set> <if test ='null != mid'>mid = #{mid},</if> <if test ='null
!= uid'>uid = #{uid}</if> </set> WHERE id = #{id} </update> <select id="load" <!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.cmsI.CmsIsRead">
resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM INSERT INTO cms_is_read <trim prefix="(" suffix=")" suffixOverrides=",">
cms_is_read WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap"> <if test ='null != mid'> mid, </if> <if test ='null != uid'> uid </if> </trim>
SELECT <include refid="Base_Column_List" /> FROM cms_is_read LIMIT #{offset}, <trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null !=
#{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer"> mid'> #{mid}, </if> <if test ='null != uid'> #{uid} </if> </trim> </insert>
<delete id="delete" > DELETE FROM cms_is_read WHERE id = #{id} </delete>
<update id="update" parameterType="cn.timer.api.bean.cmsI.CmsIsRead"> UPDATE
cms_is_read <set> <if test ='null != mid'>mid = #{mid},</if> <if test ='null
!= uid'>uid = #{uid}</if> </set> WHERE id = #{id} </update> <select id="load"
resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM
cms_is_read WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM cms_is_read LIMIT #{offset},
#{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1) FROM cms_is_read </select> --> SELECT count(1) FROM cms_is_read </select> -->
</mapper> </mapper>
\ No newline at end of file
...@@ -172,10 +172,10 @@ ...@@ -172,10 +172,10 @@
WHERE sr.approve_summary_id = #{approveSummaryId} and se.emp_num = #{userId} WHERE sr.approve_summary_id = #{approveSummaryId} and se.emp_num = #{userId}
</select> </select>
<delete id="delExecutor"> <delete id="delExecuteRecord">
DELETE FROM spmk_approve_execute_record DELETE sr,se FROM spmk_approve_execute_record sr
WHERE approve_summary_id = #{approveSummaryId} and id <![CDATA[ > ]]> #{id} LEFT JOIN spmk_executor se on sr.id=se.approve_execute_record_id
WHERE sr.approve_summary_id = #{approveSummaryId} and sr.id <![CDATA[ > ]]> #{recordId}
</delete> </delete>
</mapper> </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