给转账单据做明细和付款账户的重复提示
This commit is contained in:
@@ -104,10 +104,11 @@ public class BusinessConstants {
|
|||||||
public static final String BILL_TYPE_PRODUCE_IN = "生产入库";
|
public static final String BILL_TYPE_PRODUCE_IN = "生产入库";
|
||||||
/**
|
/**
|
||||||
* 财务单据分类
|
* 财务单据分类
|
||||||
* 收款、付款
|
* 收款、付款、转账
|
||||||
* */
|
* */
|
||||||
public static final String TYPE_MONEY_IN = "收款";
|
public static final String TYPE_MONEY_IN = "收款";
|
||||||
public static final String TYPE_MONEY_OUT = "付款";
|
public static final String TYPE_MONEY_OUT = "付款";
|
||||||
|
public static final String TYPE_GIRO = "转账";
|
||||||
/**
|
/**
|
||||||
* 批量插入sql时最大的数据条数
|
* 批量插入sql时最大的数据条数
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -491,6 +491,9 @@ public class ExceptionConstants {
|
|||||||
//财务信息录入-单据编号已经存在
|
//财务信息录入-单据编号已经存在
|
||||||
public static final int ACCOUNT_HEAD_BILL_NO_EXIST_CODE = 9500005;
|
public static final int ACCOUNT_HEAD_BILL_NO_EXIST_CODE = 9500005;
|
||||||
public static final String ACCOUNT_HEAD_BILL_NO_EXIST_MSG = "抱歉,单据编号已经存在";
|
public static final String ACCOUNT_HEAD_BILL_NO_EXIST_MSG = "抱歉,单据编号已经存在";
|
||||||
|
//财务信息录入-付款账户和明细中的账户重复
|
||||||
|
public static final int ACCOUNT_HEAD_ACCOUNT_REPEAT_CODE = 9500006;
|
||||||
|
public static final String ACCOUNT_HEAD_ACCOUNT_REPEAT_MSG = "抱歉,付款账户:%s和明细中的账户重复";
|
||||||
/**
|
/**
|
||||||
* 财务明细信息
|
* 财务明细信息
|
||||||
* type = 100
|
* type = 100
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsh.erp.service.accountHead;
|
package com.jsh.erp.service.accountHead;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
@@ -7,6 +8,7 @@ import com.jsh.erp.datasource.entities.*;
|
|||||||
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.datasource.mappers.AccountItemMapperEx;
|
||||||
|
import com.jsh.erp.datasource.mappers.AccountMapper;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.exception.JshException;
|
import com.jsh.erp.exception.JshException;
|
||||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||||
@@ -45,8 +47,6 @@ public class AccountHeadService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountItemService accountItemService;
|
private AccountItemService accountItemService;
|
||||||
@Resource
|
@Resource
|
||||||
private DepotHeadService depotHeadService;
|
|
||||||
@Resource
|
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
private SupplierService supplierService;
|
private SupplierService supplierService;
|
||||||
@@ -54,6 +54,8 @@ public class AccountHeadService {
|
|||||||
private LogService logService;
|
private LogService logService;
|
||||||
@Resource
|
@Resource
|
||||||
private AccountItemMapperEx accountItemMapperEx;
|
private AccountItemMapperEx accountItemMapperEx;
|
||||||
|
@Resource
|
||||||
|
private AccountMapper accountMapper;
|
||||||
|
|
||||||
public AccountHead getAccountHead(long id) throws Exception {
|
public AccountHead getAccountHead(long id) throws Exception {
|
||||||
AccountHead result=null;
|
AccountHead result=null;
|
||||||
@@ -297,6 +299,23 @@ public class AccountHeadService {
|
|||||||
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_BILL_NO_EXIST_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_BILL_NO_EXIST_CODE,
|
||||||
String.format(ExceptionConstants.ACCOUNT_HEAD_BILL_NO_EXIST_MSG));
|
String.format(ExceptionConstants.ACCOUNT_HEAD_BILL_NO_EXIST_MSG));
|
||||||
}
|
}
|
||||||
|
//校验付款账户和明细中的账户重复(转账单据)
|
||||||
|
if(BusinessConstants.TYPE_GIRO.equals(accountHead.getType())) {
|
||||||
|
JSONArray rowArr = JSONArray.parseArray(rows);
|
||||||
|
if (null != rowArr && rowArr.size()>0) {
|
||||||
|
for (int i = 0; i < rowArr.size(); i++) {
|
||||||
|
JSONObject object = JSONObject.parseObject(rowArr.getString(i));
|
||||||
|
if (object.get("accountId") != null && !object.get("accountId").equals("")) {
|
||||||
|
Long accoutId = object.getLong("accountId");
|
||||||
|
String accountName = accountMapper.selectByPrimaryKey(accoutId).getName();
|
||||||
|
if(accoutId.equals(accountHead.getAccountId())) {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_ACCOUNT_REPEAT_CODE,
|
||||||
|
String.format(ExceptionConstants.ACCOUNT_HEAD_ACCOUNT_REPEAT_MSG, accountName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
accountHead.setCreator(userInfo==null?null:userInfo.getId());
|
accountHead.setCreator(userInfo==null?null:userInfo.getId());
|
||||||
if(StringUtil.isEmpty(accountHead.getStatus())) {
|
if(StringUtil.isEmpty(accountHead.getStatus())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user