去除外键之财务主表jsh_accounthead相关修改
This commit is contained in:
@@ -495,7 +495,19 @@
|
|||||||
if(res && res.code == 200) {
|
if(res && res.code == 200) {
|
||||||
$("#searchBtn").click();
|
$("#searchBtn").click();
|
||||||
} else {
|
} else {
|
||||||
$.messager.alert('删除提示', '删除财务信息失败,请稍后再试!', 'error');
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//此处添加错误处理
|
//此处添加错误处理
|
||||||
@@ -553,29 +565,7 @@
|
|||||||
}
|
}
|
||||||
ids += row[i].id + ",";
|
ids += row[i].id + ",";
|
||||||
}
|
}
|
||||||
//批量更新会员的预收款信息
|
|
||||||
for(var i = 0;i < row.length; i ++) {
|
|
||||||
if(listType === "收预付款"){
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "/supplier/updateAdvanceIn",
|
|
||||||
dataType: "json",
|
|
||||||
data:{
|
|
||||||
supplierId: row[i].organid, //会员id
|
|
||||||
advanceIn: 0 - row[i].totalprice //删除时同时删除用户的预付款信息
|
|
||||||
},
|
|
||||||
success: function(res){
|
|
||||||
if(res && res.code === 200) {
|
|
||||||
//保存会员预收款成功
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(){
|
|
||||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//批量删除
|
//批量删除
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
@@ -590,15 +580,19 @@
|
|||||||
$("#searchBtn").click();
|
$("#searchBtn").click();
|
||||||
$(":checkbox").attr("checked", false);
|
$(":checkbox").attr("checked", false);
|
||||||
} else {
|
} else {
|
||||||
$.messager.alert('删除提示', '删除财务信息失败,请稍后再试!', 'error');
|
if(res && res.code == 601){
|
||||||
}
|
var jsondata={};
|
||||||
},
|
jsondata.ids=ids;
|
||||||
success: function (res) {
|
jsondata.deleteType='2';
|
||||||
if(res && res.code === 200) {
|
var type='batch';
|
||||||
$("#searchBtn").click();
|
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||||
$(":checkbox").attr("checked", false);
|
}else if(res && res.code == 600){
|
||||||
} else {
|
$.messager.alert('删除提示', res.msg, 'error');
|
||||||
$.messager.alert('删除提示', '删除财务信息失败,请稍后再试!', 'error');
|
return;
|
||||||
|
}else{
|
||||||
|
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//此处添加错误处理
|
//此处添加错误处理
|
||||||
@@ -606,13 +600,71 @@
|
|||||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//批量更新会员的预收款信息
|
||||||
|
for(var i = 0;i < row.length; i ++) {
|
||||||
|
if(listType === "收预付款"){
|
||||||
|
$.ajax({
|
||||||
|
type:"post",
|
||||||
|
url: "/supplier/updateAdvanceIn",
|
||||||
|
dataType: "json",
|
||||||
|
data:{
|
||||||
|
supplierId: row[i].organid, //会员id
|
||||||
|
advanceIn: 0 - row[i].totalprice //删除时同时删除用户的预付款信息
|
||||||
|
},
|
||||||
|
success: function(res){
|
||||||
|
if(res && res.code === 200) {
|
||||||
|
//保存会员预收款成功
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 确认强制删除
|
||||||
|
* */
|
||||||
|
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||||
|
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||||
|
if (r) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: url,
|
||||||
|
dataType: "json",
|
||||||
|
data: (jsondata),
|
||||||
|
success: function (res) {
|
||||||
|
if(res && res.code == 200) {
|
||||||
|
$("#searchBtn").click();
|
||||||
|
if(type=='batch'){
|
||||||
|
$(":checkbox").attr("checked", false);
|
||||||
|
}
|
||||||
|
}else if(res && res.code == 600){
|
||||||
|
$.messager.alert('删除提示', res.msg, 'error');
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//此处添加错误处理
|
||||||
|
error: function () {
|
||||||
|
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//增加
|
|
||||||
|
//增加
|
||||||
function addAccountHead(){
|
function addAccountHead(){
|
||||||
$('#accountHeadFM').form('clear');
|
$('#accountHeadFM').form('clear');
|
||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsh.erp.controller;
|
package com.jsh.erp.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.AccountHead;
|
import com.jsh.erp.datasource.entities.AccountHead;
|
||||||
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
||||||
@@ -158,10 +159,21 @@ public class AccountHeadController {
|
|||||||
* @return java.lang.Object
|
* @return java.lang.Object
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/batchDeleteAccountHeadByIds")
|
@RequestMapping(value = "/batchDeleteAccountHeadByIds")
|
||||||
public Object batchDeleteAccountHeadByIds(@RequestParam("ids") String ids) throws Exception {
|
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();
|
JSONObject result = ExceptionConstants.standardSuccess();
|
||||||
int i= accountHeadService.batchDeleteAccountHeadByIds(ids);
|
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){
|
if(i<1){
|
||||||
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
|
logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
|
||||||
ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_MSG,ids);
|
ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_CODE,ExceptionConstants.ACCOUNT_HEAD_DELETE_FAILED_MSG,ids);
|
||||||
|
|||||||
@@ -28,4 +28,6 @@ public interface AccountItemMapperEx {
|
|||||||
int batchDeleteAccountItemByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
|
int batchDeleteAccountItemByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String[] ids);
|
||||||
|
|
||||||
List<AccountItem> getAccountItemListByAccountIds(@Param("accountIds") String[] accountIds);
|
List<AccountItem> getAccountItemListByAccountIds(@Param("accountIds") String[] accountIds);
|
||||||
|
|
||||||
|
List<AccountItem> getAccountItemListByHeaderIds(@Param("headerIds") String[] headerIds);
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.jsh.erp.service.accountHead;
|
package com.jsh.erp.service.accountHead;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.entities.AccountHead;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.AccountHeadExample;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
|
||||||
import com.jsh.erp.datasource.entities.User;
|
|
||||||
import com.jsh.erp.datasource.mappers.AccountHeadMapper;
|
import com.jsh.erp.datasource.mappers.AccountHeadMapper;
|
||||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||||
|
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||||
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import com.jsh.erp.utils.Tools;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -39,6 +39,8 @@ public class AccountHeadService {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
@Resource
|
||||||
|
private AccountItemMapperEx accountItemMapperEx;
|
||||||
|
|
||||||
public AccountHead getAccountHead(long id) {
|
public AccountHead getAccountHead(long id) {
|
||||||
return accountHeadMapper.selectByPrimaryKey(id);
|
return accountHeadMapper.selectByPrimaryKey(id);
|
||||||
@@ -142,4 +144,41 @@ public class AccountHeadService {
|
|||||||
String [] idArray=ids.split(",");
|
String [] idArray=ids.split(",");
|
||||||
return accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
return accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* create by: qiankunpingtai
|
||||||
|
* website:https://qiankunpingtai.cn
|
||||||
|
* description:
|
||||||
|
* 正常删除,要考虑数据完整性,进行完整性校验
|
||||||
|
* create time: 2019/4/10 15:49
|
||||||
|
* @Param: ids
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public int batchDeleteAccountHeadByIdsNormal(String ids) throws Exception {
|
||||||
|
/**
|
||||||
|
* 校验
|
||||||
|
* 1、财务子表 jsh_accountitem
|
||||||
|
* 是否有相关数据
|
||||||
|
* */
|
||||||
|
int deleteTotal=0;
|
||||||
|
if(StringUtils.isEmpty(ids)){
|
||||||
|
return deleteTotal;
|
||||||
|
}
|
||||||
|
String [] idArray=ids.split(",");
|
||||||
|
/**
|
||||||
|
* 校验财务子表 jsh_accountitem
|
||||||
|
* */
|
||||||
|
List<AccountItem> accountItemList=accountItemMapperEx.getAccountItemListByHeaderIds(idArray);
|
||||||
|
if(accountItemList!=null&&accountItemList.size()>0){
|
||||||
|
logger.error("异常码[{}],异常提示[{}],参数,HeaderIds[{}]",
|
||||||
|
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
|
||||||
|
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 校验通过执行删除操作
|
||||||
|
* */
|
||||||
|
deleteTotal= batchDeleteAccountHeadByIds(ids);
|
||||||
|
return deleteTotal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class PersonService {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchDeletePersonByIdsNormal(String ids) {
|
public int batchDeletePersonByIdsNormal(String ids) throws Exception {
|
||||||
/**
|
/**
|
||||||
* 校验
|
* 校验
|
||||||
* 1、财务主表 jsh_accounthead
|
* 1、财务主表 jsh_accounthead
|
||||||
|
|||||||
@@ -72,4 +72,16 @@
|
|||||||
)
|
)
|
||||||
and ifnull(delete_Flag,'0') !='1'
|
and ifnull(delete_Flag,'0') !='1'
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getAccountItemListByHeaderIds" resultMap="com.jsh.erp.datasource.mappers.AccountItemMapper.BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="com.jsh.erp.datasource.mappers.AccountItemMapper.Base_Column_List" />
|
||||||
|
from jsh_accountitem
|
||||||
|
where 1=1
|
||||||
|
and headerId in (
|
||||||
|
<foreach collection="headerIds" item="headerId" separator=",">
|
||||||
|
#{headerId}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
and ifnull(delete_Flag,'0') !='1'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user