优化单据的删除逻辑,解决图片被误删的bug
This commit is contained in:
parent
b729ec87df
commit
5afce93691
@ -220,6 +220,12 @@ public class AccountHeadService {
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
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);
|
||||
//删除子表
|
||||
@ -231,10 +237,6 @@ public class AccountHeadService {
|
||||
if(StringUtil.isNotEmpty(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 (accountHead.getOrganId() != null) {
|
||||
//更新会员预付款
|
||||
|
||||
@ -445,16 +445,16 @@ public class DepotHeadService {
|
||||
public int batchDeleteBillByIds(String ids)throws Exception {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
||||
//路径列表
|
||||
List<String> pathList = new ArrayList<>();
|
||||
List<DepotHead> dhList = getDepotHeadListByIds(ids);
|
||||
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();
|
||||
//删除入库单据,先校验序列号是否出库,如果未出库则同时删除序列号,如果已出库则不能删除单据
|
||||
if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())) {
|
||||
@ -567,9 +567,12 @@ public class DepotHeadService {
|
||||
//更新当前成本价
|
||||
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());
|
||||
}
|
||||
}
|
||||
//逻辑删除文件
|
||||
|
||||
Loading…
Reference in New Issue
Block a user