给单据的审核增加日志
This commit is contained in:
@@ -509,6 +509,12 @@ public class ExceptionConstants {
|
|||||||
//财务信息录入-付款账户和明细中的账户重复
|
//财务信息录入-付款账户和明细中的账户重复
|
||||||
public static final int ACCOUNT_HEAD_ACCOUNT_REPEAT_CODE = 9500006;
|
public static final int ACCOUNT_HEAD_ACCOUNT_REPEAT_CODE = 9500006;
|
||||||
public static final String ACCOUNT_HEAD_ACCOUNT_REPEAT_MSG = "抱歉,付款账户:%s和明细中的账户重复";
|
public static final String ACCOUNT_HEAD_ACCOUNT_REPEAT_MSG = "抱歉,付款账户:%s和明细中的账户重复";
|
||||||
|
//财务信息审核-只有未审核的单据才能审核
|
||||||
|
public static final int ACCOUNT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE = 9500007;
|
||||||
|
public static final String ACCOUNT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG = "抱歉,只有未审核的单据才能审核";
|
||||||
|
//财务信息反审核-只有已审核的单据才能反审核
|
||||||
|
public static final int ACCOUNT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE = 9500008;
|
||||||
|
public static final String ACCOUNT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG = "抱歉,只有已审核的单据才能反审核";
|
||||||
/**
|
/**
|
||||||
* 财务明细信息
|
* 财务明细信息
|
||||||
* type = 100
|
* type = 100
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class AccountHeadService {
|
|||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
accountHead.setCreator(userInfo==null?null:userInfo.getId());
|
accountHead.setCreator(userInfo==null?null:userInfo.getId());
|
||||||
result = accountHeadMapper.insertSelective(accountHead);
|
result = accountHeadMapper.insertSelective(accountHead);
|
||||||
logService.insertLog("财务",
|
logService.insertLog("财务单据",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillNo()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillNo()).toString(), request);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
@@ -173,7 +173,7 @@ public class AccountHeadService {
|
|||||||
int result=0;
|
int result=0;
|
||||||
try{
|
try{
|
||||||
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
|
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
|
||||||
logService.insertLog("财务",
|
logService.insertLog("财务单据",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).toString(), request);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.writeFail(logger, e);
|
JshException.writeFail(logger, e);
|
||||||
@@ -224,7 +224,7 @@ public class AccountHeadService {
|
|||||||
}
|
}
|
||||||
//逻辑删除文件
|
//逻辑删除文件
|
||||||
systemConfigService.deleteFileByPathList(pathList);
|
systemConfigService.deleteFileByPathList(pathList);
|
||||||
logService.insertLog("财务", sb.toString(),
|
logService.insertLog("财务单据", sb.toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -251,32 +251,46 @@ public class AccountHeadService {
|
|||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int batchSetStatus(String status, String accountHeadIds)throws Exception {
|
public int batchSetStatus(String status, String accountHeadIds)throws Exception {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
try{
|
|
||||||
List<Long> ahIds = new ArrayList<>();
|
List<Long> ahIds = new ArrayList<>();
|
||||||
|
List<String> noList = new ArrayList<>();
|
||||||
List<Long> ids = StringUtil.strToLongList(accountHeadIds);
|
List<Long> ids = StringUtil.strToLongList(accountHeadIds);
|
||||||
for(Long id: ids) {
|
for(Long id: ids) {
|
||||||
AccountHead accountHead = getAccountHead(id);
|
AccountHead accountHead = getAccountHead(id);
|
||||||
if("0".equals(status)){
|
if("0".equals(status)){
|
||||||
|
//进行反审核操作
|
||||||
if("1".equals(accountHead.getStatus())) {
|
if("1".equals(accountHead.getStatus())) {
|
||||||
ahIds.add(id);
|
ahIds.add(id);
|
||||||
|
noList.add(accountHead.getBillNo());
|
||||||
|
} else {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.ACCOUNT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
} else if("1".equals(status)){
|
} else if("1".equals(status)){
|
||||||
|
//进行审核操作
|
||||||
if("0".equals(accountHead.getStatus())) {
|
if("0".equals(accountHead.getStatus())) {
|
||||||
ahIds.add(id);
|
ahIds.add(id);
|
||||||
|
noList.add(accountHead.getBillNo());
|
||||||
|
} else {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE,
|
||||||
|
String.format(ExceptionConstants.ACCOUNT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ahIds.size()>0) {
|
if(!ahIds.isEmpty()) {
|
||||||
AccountHead accountHead = new AccountHead();
|
AccountHead accountHead = new AccountHead();
|
||||||
accountHead.setStatus(status);
|
accountHead.setStatus(status);
|
||||||
AccountHeadExample example = new AccountHeadExample();
|
AccountHeadExample example = new AccountHeadExample();
|
||||||
example.createCriteria().andIdIn(ahIds);
|
example.createCriteria().andIdIn(ahIds);
|
||||||
result = accountHeadMapper.updateByExampleSelective(accountHead, example);
|
result = accountHeadMapper.updateByExampleSelective(accountHead, example);
|
||||||
} else {
|
//记录日志
|
||||||
return 1;
|
if(!noList.isEmpty() && ("0".equals(status) || "1".equals(status))) {
|
||||||
|
String statusStr = status.equals("1")?"[审核]":"[反审核]";
|
||||||
|
logService.insertLog("财务单据",
|
||||||
|
new StringBuffer(statusStr).append(String.join(", ", noList)).toString(),
|
||||||
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
} else {
|
||||||
JshException.writeFail(logger, e);
|
result = 1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -326,8 +340,9 @@ public class AccountHeadService {
|
|||||||
//更新会员预付款
|
//更新会员预付款
|
||||||
supplierService.updateAdvanceIn(accountHead.getOrganId());
|
supplierService.updateAdvanceIn(accountHead.getOrganId());
|
||||||
}
|
}
|
||||||
|
String statusStr = accountHead.getStatus().equals("1")?"[审核]":"";
|
||||||
logService.insertLog("财务单据",
|
logService.insertLog("财务单据",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillNo()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(accountHead.getBillNo()).append(statusStr).toString(), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
@@ -353,8 +368,9 @@ public class AccountHeadService {
|
|||||||
//更新会员预付款
|
//更新会员预付款
|
||||||
supplierService.updateAdvanceIn(accountHead.getOrganId());
|
supplierService.updateAdvanceIn(accountHead.getOrganId());
|
||||||
}
|
}
|
||||||
|
String statusStr = accountHead.getStatus().equals("1")?"[审核]":"";
|
||||||
logService.insertLog("财务单据",
|
logService.insertLog("财务单据",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).append(statusStr).toString(), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AccountHeadVo4ListEx> getDetailByNumber(String billNo)throws Exception {
|
public List<AccountHeadVo4ListEx> getDetailByNumber(String billNo)throws Exception {
|
||||||
|
|||||||
@@ -673,6 +673,7 @@ public class DepotHeadService {
|
|||||||
public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
|
public int batchSetStatus(String status, String depotHeadIDs)throws Exception {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
List<Long> dhIds = new ArrayList<>();
|
List<Long> dhIds = new ArrayList<>();
|
||||||
|
List<String> noList = new ArrayList<>();
|
||||||
List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
|
List<Long> ids = StringUtil.strToLongList(depotHeadIDs);
|
||||||
for(Long id: ids) {
|
for(Long id: ids) {
|
||||||
DepotHead depotHead = getDepotHead(id);
|
DepotHead depotHead = getDepotHead(id);
|
||||||
@@ -680,6 +681,7 @@ public class DepotHeadService {
|
|||||||
//进行反审核操作
|
//进行反审核操作
|
||||||
if("1".equals(depotHead.getStatus()) && "0".equals(depotHead.getPurchaseStatus())) {
|
if("1".equals(depotHead.getStatus()) && "0".equals(depotHead.getPurchaseStatus())) {
|
||||||
dhIds.add(id);
|
dhIds.add(id);
|
||||||
|
noList.add(depotHead.getNumber());
|
||||||
} else if("2".equals(depotHead.getPurchaseStatus())) {
|
} else if("2".equals(depotHead.getPurchaseStatus())) {
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_PURCHASE_STATUS_TWO_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_PURCHASE_STATUS_TWO_CODE,
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_PURCHASE_STATUS_TWO_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_PURCHASE_STATUS_TWO_MSG));
|
||||||
@@ -694,13 +696,14 @@ public class DepotHeadService {
|
|||||||
//进行审核操作
|
//进行审核操作
|
||||||
if("0".equals(depotHead.getStatus())) {
|
if("0".equals(depotHead.getStatus())) {
|
||||||
dhIds.add(id);
|
dhIds.add(id);
|
||||||
|
noList.add(depotHead.getNumber());
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE,
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE,
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dhIds.size()>0) {
|
if(!dhIds.isEmpty()) {
|
||||||
DepotHead depotHead = new DepotHead();
|
DepotHead depotHead = new DepotHead();
|
||||||
depotHead.setStatus(status);
|
depotHead.setStatus(status);
|
||||||
DepotHeadExample example = new DepotHeadExample();
|
DepotHeadExample example = new DepotHeadExample();
|
||||||
@@ -715,6 +718,13 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//记录日志
|
||||||
|
if(!noList.isEmpty() && ("0".equals(status) || "1".equals(status))) {
|
||||||
|
String statusStr = status.equals("1")?"[审核]":"[反审核]";
|
||||||
|
logService.insertLog("单据",
|
||||||
|
new StringBuffer(statusStr).append(String.join(", ", noList)).toString(),
|
||||||
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1211,8 +1221,9 @@ public class DepotHeadService {
|
|||||||
/**入库和出库处理单据子表信息*/
|
/**入库和出库处理单据子表信息*/
|
||||||
depotItemService.saveDetials(rows,headId, "add",request);
|
depotItemService.saveDetials(rows,headId, "add",request);
|
||||||
}
|
}
|
||||||
|
String statusStr = depotHead.getStatus().equals("1")?"[审核]":"";
|
||||||
logService.insertLog("单据",
|
logService.insertLog("单据",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depotHead.getNumber()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depotHead.getNumber()).append(statusStr).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,8 +1322,9 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
/**入库和出库处理单据子表信息*/
|
/**入库和出库处理单据子表信息*/
|
||||||
depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
|
depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
|
||||||
|
String statusStr = depotHead.getStatus().equals("1")?"[审核]":"";
|
||||||
logService.insertLog("单据",
|
logService.insertLog("单据",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHead.getNumber()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHead.getNumber()).append(statusStr).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user