优化单据的删除逻辑,解决图片被误删的bug
This commit is contained in:
@@ -220,6 +220,12 @@ public class AccountHeadService {
|
|||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
String [] idArray=ids.split(",");
|
String [] idArray=ids.split(",");
|
||||||
List<AccountHead> list = getAccountHeadListByIds(ids);
|
List<AccountHead> list = getAccountHeadListByIds(ids);
|
||||||
|
for(AccountHead accountHead: list){
|
||||||
|
if(!"0".equals(accountHead.getStatus())) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
//删除主表
|
//删除主表
|
||||||
accountItemMapperEx.batchDeleteAccountItemByHeadIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
accountItemMapperEx.batchDeleteAccountItemByHeadIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||||
//删除子表
|
//删除子表
|
||||||
@@ -231,10 +237,6 @@ public class AccountHeadService {
|
|||||||
if(StringUtil.isNotEmpty(accountHead.getFileName())) {
|
if(StringUtil.isNotEmpty(accountHead.getFileName())) {
|
||||||
pathList.add(accountHead.getFileName());
|
pathList.add(accountHead.getFileName());
|
||||||
}
|
}
|
||||||
if("1".equals(accountHead.getStatus())) {
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_CODE,
|
|
||||||
String.format(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_MSG));
|
|
||||||
}
|
|
||||||
if("收预付款".equals(accountHead.getType())){
|
if("收预付款".equals(accountHead.getType())){
|
||||||
if (accountHead.getOrganId() != null) {
|
if (accountHead.getOrganId() != null) {
|
||||||
//更新会员预付款
|
//更新会员预付款
|
||||||
|
|||||||
@@ -445,16 +445,16 @@ public class DepotHeadService {
|
|||||||
public int batchDeleteBillByIds(String ids)throws Exception {
|
public int batchDeleteBillByIds(String ids)throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
||||||
//路径列表
|
|
||||||
List<String> pathList = new ArrayList<>();
|
|
||||||
List<DepotHead> dhList = getDepotHeadListByIds(ids);
|
List<DepotHead> dhList = getDepotHeadListByIds(ids);
|
||||||
for(DepotHead depotHead: dhList){
|
for(DepotHead depotHead: dhList){
|
||||||
sb.append("[").append(depotHead.getNumber()).append("]");
|
|
||||||
if(StringUtil.isNotEmpty(depotHead.getFileName())) {
|
|
||||||
pathList.add(depotHead.getFileName());
|
|
||||||
}
|
|
||||||
//只有未审核的单据才能被删除
|
//只有未审核的单据才能被删除
|
||||||
if("0".equals(depotHead.getStatus())) {
|
if(!"0".equals(depotHead.getStatus())) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(DepotHead depotHead: dhList){
|
||||||
|
sb.append("[").append(depotHead.getNumber()).append("]");
|
||||||
User userInfo = userService.getCurrentUser();
|
User userInfo = userService.getCurrentUser();
|
||||||
//删除入库单据,先校验序列号是否出库,如果未出库则同时删除序列号,如果已出库则不能删除单据
|
//删除入库单据,先校验序列号是否出库,如果未出库则同时删除序列号,如果已出库则不能删除单据
|
||||||
if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())) {
|
if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())) {
|
||||||
@@ -567,9 +567,12 @@ public class DepotHeadService {
|
|||||||
//更新当前成本价
|
//更新当前成本价
|
||||||
depotItemService.updateCurrentUnitPrice(depotItem);
|
depotItemService.updateCurrentUnitPrice(depotItem);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE,
|
//路径列表
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG));
|
List<String> pathList = new ArrayList<>();
|
||||||
|
for(DepotHead depotHead: dhList){
|
||||||
|
if(StringUtil.isNotEmpty(depotHead.getFileName())) {
|
||||||
|
pathList.add(depotHead.getFileName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//逻辑删除文件
|
//逻辑删除文件
|
||||||
|
|||||||
Reference in New Issue
Block a user