解决财务单据删除逻辑的bug

This commit is contained in:
季圣华 2020-10-05 20:32:12 +08:00
parent ce3fbfb557
commit 3534c26ae3
5 changed files with 19 additions and 38 deletions

View File

@ -496,10 +496,8 @@
//删除财务信息
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
$.messager.confirm('删除确认','确定要删除此财务信息吗',function(r)
{
if (r)
{
$.messager.confirm('删除确认','确定要删除此财务信息吗',function(r) {
if (r) {
$.ajax({
type:"post",
url: "/accountHead/batchDeleteAccountHeadByIds",
@ -511,19 +509,7 @@
if(res && res.code == 200) {
$("#searchBtn").click();
} else {
if(res && res.code == 601){
var jsondata={};
jsondata.ids=accountHeadID;
jsondata.deleteType='2';
var type='single';
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
return;
}else{
$.messager.alert('删除提示', '删除信息失败请稍后再试', 'error');
return;
}
$.messager.alert('删除提示', '删除财务信息失败请稍后再试', 'error');
}
},
//此处添加错误处理

View File

@ -111,9 +111,6 @@ public class AccountHeadController {
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 批量删除账户信息
* create time: 2019/3/29 10:49
* @Param: ids
@ -122,25 +119,8 @@ public class AccountHeadController {
@RequestMapping(value = "/batchDeleteAccountHeadByIds")
public Object batchDeleteAccountHeadByIds(@RequestParam("ids") String ids,@RequestParam(value="deleteType",
required =false,defaultValue= BusinessConstants.DELETE_TYPE_NORMAL)String deleteType) throws Exception {
JSONObject result = ExceptionConstants.standardSuccess();
int i=0;
if(BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)){
i= accountHeadService.batchDeleteAccountHeadByIdsNormal(ids);
}else if(BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)){
i= accountHeadService.batchDeleteAccountHeadByIds(ids);
}else{
logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
ExceptionConstants.DELETE_REFUSED_CODE,ExceptionConstants.DELETE_REFUSED_MSG,ids,deleteType);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
ExceptionConstants.DELETE_REFUSED_MSG);
}
if(i<1){
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_CODE,
ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_MSG);
}
accountHeadService.batchDeleteAccountHeadByIds(ids);
return result;
}

View File

@ -32,4 +32,6 @@ public interface AccountItemMapperEx {
List<AccountItem> getAccountItemListByHeaderIds(@Param("headerIds") String[] headerIds);
List<AccountItem> getAccountItemListByInOutItemIds(@Param("inOutItemIds") String[] inOutItemIds);
int batchDeleteAccountItemByHeadIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
}

View File

@ -320,6 +320,9 @@ public class AccountHeadService {
String [] idArray=ids.split(",");
int result = 0;
try{
//删除主表
result = accountItemMapperEx.batchDeleteAccountItemByHeadIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
//删除子表
result = accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
JshException.writeFail(logger, e);

View File

@ -96,4 +96,14 @@
)
and ifnull(delete_flag,'0') !='1'
</select>
<update id="batchDeleteAccountItemByHeadIds">
update jsh_account_item
set delete_flag='1'
where 1=1
and header_id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>