修改审核为拒绝直接将数据删除

This commit is contained in:
sunzheng
2024-01-11 19:08:05 +08:00
parent 62dac46bd2
commit da27b502e7
2 changed files with 26 additions and 14 deletions
@@ -335,7 +335,8 @@ public class ProjectDetailServiceImpl implements ProjectDetailService {
p.setPostalCodeContacts(payContactsManagementTemporary.getPostalCode());
p.setContactAddress(payContactsManagementTemporary.getContactAddress());
});
projectDetailVO.setPayDraftingGroupSubItemContactsLists(listPayDraftingGroupSubItemContacts);
List<PayWorkingGroupSubItemContacts> payWorkingGroupSubItemContactsList = JSON.parseArray(JSONArray.toJSONString(listPayDraftingGroupSubItemContacts), PayWorkingGroupSubItemContacts.class);
projectDetailVO.setPayWorkingGroupSubItemContactsList(payWorkingGroupSubItemContactsList);
}
}
}else {
@@ -2,6 +2,7 @@ package com.jero.drafting.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -153,6 +154,7 @@ public class PayDraftingGroupSubItemServiceImpl extends ServiceImpl<PayDraftingG
LambdaQueryWrapper<PayDraftingGroupSubItem> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PayDraftingGroupSubItem::getDraftingGroupId, payDraftingGroupSubItem.getDraftingGroupId());
queryWrapper.eq(PayDraftingGroupSubItem::getChargeCompanyId, payDraftingGroupSubItem.getChargeCompanyId());
queryWrapper.ne(PayDraftingGroupSubItem::getCheckResult,DraftingConstant.CHECK_REJECTION);
PayDraftingGroupSubItem payDraftingGroupSubItemNew = payDraftingGroupSubItemService.getOne(queryWrapper);
// 企业和联系人同时存在,则校验不通过
if (!Objects.isNull(payDraftingGroupSubItemNew)) {
@@ -707,22 +709,31 @@ public class PayDraftingGroupSubItemServiceImpl extends ServiceImpl<PayDraftingG
String checkRemark = checkVO.getCheckRemark();
Integer checkResult = checkVO.getCheckResult();
PayDraftingGroupSubItem payDraftingGroupSubItem = payDraftingGroupSubItemService.getById(payDraftingGroupSubItemId);
PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(payDraftingGroupSubItem.getDraftingGroupId());
//判断是否有权限审核
verificationGuests(payDraftingGroupSubItem);
LambdaUpdateWrapper<PayDraftingGroupSubItem> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(PayDraftingGroupSubItem::getId,payDraftingGroupSubItemId);
updateWrapper.set(StringUtils.isNotBlank(checkRemark),PayDraftingGroupSubItem::getCheckRemark,checkRemark);
updateWrapper.set(!Objects.isNull(checkResult),PayDraftingGroupSubItem::getCheckResult,checkResult);
payDraftingGroupSubItemService.update(updateWrapper);
// 如果审核通过,发送消息
if(Objects.equals(checkVO.getCheckResult(),DraftingConstant.CHECK_PASS)) {
PayDraftingGroupSubItem draftingGroupSubItem = payDraftingGroupSubItemService.getById(payDraftingGroupSubItemId);
if (Objects.isNull(draftingGroupSubItem) || StringUtils.isBlank(draftingGroupSubItem.getDraftingGroupId())) {
throw new JeroBootException("起草组不存在");
}
PayDraftingGroup payDraftingGroup = payDraftingGroupService.getById(draftingGroupSubItem.getDraftingGroupId());
List<PayDraftingGroupSubItemContacts> payDraftingGroupSubItemContactsList = draftingGroupSubItem.getPayDraftingGroupSubItemContactsList();
sendMessage(draftingGroupSubItem,payDraftingGroup,payDraftingGroupSubItemContactsList);
// 审核通过,将状态改为2 发送消息
LambdaUpdateWrapper<PayDraftingGroupSubItem> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(PayDraftingGroupSubItem::getId,payDraftingGroupSubItemId);
updateWrapper.set(StringUtils.isNotBlank(checkRemark),PayDraftingGroupSubItem::getCheckRemark,checkRemark);
updateWrapper.set(!Objects.isNull(checkResult),PayDraftingGroupSubItem::getCheckResult,checkResult);
payDraftingGroupSubItemService.update(updateWrapper);
LambdaQueryWrapper<PayDraftingGroupSubItemContacts> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PayDraftingGroupSubItemContacts::getDraftingGroupId,payDraftingGroupSubItem.getDraftingGroupId());
queryWrapper.eq(PayDraftingGroupSubItemContacts::getDraftingGroupSubId,payDraftingGroupSubItem.getId());
List<PayDraftingGroupSubItemContacts> payDraftingGroupSubItemContactsList = payDraftingGroupSubItemContactsService.list(queryWrapper);
sendMessage(payDraftingGroupSubItem,payDraftingGroup,payDraftingGroupSubItemContactsList);
}
if(Objects.equals(checkVO.getCheckResult(),DraftingConstant.CHECK_REJECTION)) {
// 直接将数据删除
payDraftingGroupSubItemService.removeById(payDraftingGroupSubItemId);
// 删除对应的联系表
LambdaQueryWrapper<PayDraftingGroupSubItemContacts> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PayDraftingGroupSubItemContacts::getDraftingGroupId,payDraftingGroupSubItem.getDraftingGroupId());
queryWrapper.eq(PayDraftingGroupSubItemContacts::getDraftingGroupSubId,payDraftingGroupSubItem.getId());
payDraftingGroupSubItemContactsService.remove(queryWrapper);
}
}