从源更新

This commit is contained in:
caijulong
2019-11-01 15:55:03 +08:00
486 changed files with 133424 additions and 9281 deletions

View File

@@ -1,38 +1,39 @@
package com.jsh.erp.service;
import java.lang.annotation.*;
/**
* @author jishenghua 2018-10-7 15:25:39
* user-5
* role-10
* app-15
* depot-20
* log-25
* functions-30
* inOutItem-35
* unit-40
* person-45
* userBusiness-50
* systemConfig-55
* materialProperty-60
* account-65
* supplier-70
* materialCategory-75
* material-80
* depotHead-85
* depotItem-90
* accountHead-95
* accountItem-100
* serialNumber-105
* organization-110
* orgaUserRel-115
*/
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface ResourceInfo {
String value();
int type();
}
package com.jsh.erp.service;
import java.lang.annotation.*;
/**
* @author jishenghua 2018-10-7 15:25:39
* user-5
* role-10
* depot-20
* log-25
* functions-30
* inOutItem-35
* unit-40
* person-45
* userBusiness-50
* systemConfig-55
* materialProperty-60
* account-65
* supplier-70
* materialCategory-75
* material-80
* depotHead-85
* depotItem-90
* accountHead-95
* accountItem-100
* serialNumber-105
* organization-110
* orgaUserRel-115
* tenant-120
* msg-125
*/
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface ResourceInfo {
String value();
int type();
}

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.vo.AccountVo4InOutList;
import com.jsh.erp.datasource.vo.AccountVo4List;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -69,10 +70,7 @@ public class AccountService {
try{
list=accountMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
@@ -84,10 +82,7 @@ public class AccountService {
try{
list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
String timeStr = Tools.getCurrentMonth();
if (null != list && null !=timeStr) {
@@ -112,10 +107,7 @@ public class AccountService {
try{
result=accountMapperEx.countsByAccount(name, serialNo, remark);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -131,10 +123,7 @@ public class AccountService {
try{
result = accountMapper.insertSelective(account);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -147,10 +136,7 @@ public class AccountService {
try{
result = accountMapper.updateByPrimaryKeySelective(account);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -161,10 +147,7 @@ public class AccountService {
try{
result = accountMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -178,10 +161,7 @@ public class AccountService {
try{
result = accountMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -193,10 +173,7 @@ public class AccountService {
try{
list = accountMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -209,10 +186,7 @@ public class AccountService {
try{
list = accountMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -247,10 +221,7 @@ public class AccountService {
try{
dataList = depotHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (dataList != null) {
for (DepotHead depotHead : dataList) {
@@ -296,10 +267,7 @@ public class AccountService {
try{
dataList = accountHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (dataList != null) {
for (AccountHead accountHead : dataList) {
@@ -340,10 +308,7 @@ public class AccountService {
try{
dataList = accountHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (dataList != null) {
String ids = "";
@@ -411,10 +376,7 @@ public class AccountService {
try{
dataList = depotHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (dataList != null) {
for (DepotHead depotHead : dataList) {
@@ -442,10 +404,7 @@ public class AccountService {
try{
list = accountMapperEx.findAccountInOutList(accountId, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -455,10 +414,7 @@ public class AccountService {
try{
result = accountMapperEx.findAccountInOutListCount(accountId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -475,10 +431,7 @@ public class AccountService {
try{
result = accountMapper.updateByExampleSelective(account, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -493,10 +446,7 @@ public class AccountService {
try{
result = accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -530,10 +480,7 @@ public class AccountService {
try{
accountHeadList = accountHeadMapperEx.getAccountHeadListByAccountIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(accountHeadList!=null&&accountHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
@@ -548,10 +495,7 @@ public class AccountService {
try{
accountItemList = accountItemMapperEx.getAccountItemListByAccountIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(accountItemList!=null&&accountItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",
@@ -566,10 +510,7 @@ public class AccountService {
try{
depotHeadList = depotHeadMapperEx.getDepotHeadListByAccountIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,AccountIds[{}]",

View File

@@ -10,6 +10,7 @@ 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.accountItem.AccountItemService;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -51,10 +52,7 @@ public class AccountHeadService {
try{
result=accountHeadMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -65,10 +63,7 @@ public class AccountHeadService {
try{
list=accountHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -79,10 +74,7 @@ public class AccountHeadService {
try{
list = accountHeadMapperEx.selectByConditionAccountHead(type, billNo, beginTime, endTime, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (null != list) {
for (AccountHeadVo4ListEx ah : list) {
@@ -103,10 +95,7 @@ public class AccountHeadService {
try{
result = accountHeadMapperEx.countsByAccountHead(type, billNo, beginTime, endTime);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -118,10 +107,7 @@ public class AccountHeadService {
try{
result = accountHeadMapper.insertSelective(accountHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -134,10 +120,7 @@ public class AccountHeadService {
try{
result = accountHeadMapper.updateByPrimaryKeySelective(accountHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -148,10 +131,7 @@ public class AccountHeadService {
try{
result = accountHeadMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -165,10 +145,7 @@ public class AccountHeadService {
try{
result = accountHeadMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -180,15 +157,11 @@ public class AccountHeadService {
try{
list = accountHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
String modeName = "";
if (mode.equals("实际")) {
@@ -200,10 +173,7 @@ public class AccountHeadService {
try{
result = accountHeadMapperEx.findAllMoney(supplierId, type, modeName, endTime);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -264,10 +234,7 @@ public class AccountHeadService {
try{
list = accountHeadMapperEx.getDetailByNumber(billNo);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (null != list) {
for (AccountHeadVo4ListEx ah : list) {
@@ -293,10 +260,7 @@ public class AccountHeadService {
try{
result = accountHeadMapperEx.batchDeleteAccountHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -328,10 +292,7 @@ public class AccountHeadService {
try{
accountItemList = accountItemMapperEx.getAccountItemListByHeaderIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(accountItemList!=null&&accountItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,HeaderIds[{}]",

View File

@@ -12,6 +12,7 @@ import com.jsh.erp.datasource.mappers.AccountItemMapper;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.datasource.vo.AccountItemVo4List;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.ErpInfo;
@@ -51,10 +52,7 @@ public class AccountItemService {
try{
result=accountItemMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -66,10 +64,7 @@ public class AccountItemService {
try{
list=accountItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -79,10 +74,7 @@ public class AccountItemService {
try{
list = accountItemMapperEx.selectByConditionAccountItem(name, type, remark, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -92,10 +84,7 @@ public class AccountItemService {
try{
result = accountItemMapperEx.countsByAccountItem(name, type, remark);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -107,10 +96,7 @@ public class AccountItemService {
try{
result = accountItemMapper.insertSelective(accountItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -123,10 +109,7 @@ public class AccountItemService {
try{
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -137,10 +120,7 @@ public class AccountItemService {
try{
result = accountItemMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -154,10 +134,7 @@ public class AccountItemService {
try{
result = accountItemMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -169,10 +146,7 @@ public class AccountItemService {
try{
list = accountItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -183,10 +157,7 @@ public class AccountItemService {
try{
result = accountItemMapper.insertSelective(accountItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -197,10 +168,7 @@ public class AccountItemService {
try{
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -210,10 +178,7 @@ public class AccountItemService {
try{
list = accountItemMapperEx.getDetailList(headerId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -301,10 +266,7 @@ public class AccountItemService {
try{
result = accountItemMapperEx.batchDeleteAccountItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.app;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "app", type = 15)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface AppResource {
}

View File

@@ -1,294 +0,0 @@
package com.jsh.erp.service.app;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.AppMapper;
import com.jsh.erp.datasource.mappers.AppMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@Service
public class AppService {
private Logger logger = LoggerFactory.getLogger(AppService.class);
@Resource
private AppMapper appMapper;
@Resource
private AppMapperEx appMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
@Resource
private UserBusinessService userBusinessService;
public List<App> findDock()throws Exception{
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("dock").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
/**
* create by: cjl
* description:
* 桌面功能菜单初始化列表
* create time: 2019/1/11 16:59
* @Param: null
* @return
*/
public List<App> findDesk()throws Exception{
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public App getApp(long id)throws Exception {
App result=null;
try{
result=appMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public List<App> getApp()throws Exception {
AppExample example = new AppExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public List<App> select(String name, String type, int offset, int rows)throws Exception {
List<App> list=null;
try{
list=appMapperEx.selectByConditionApp(name, type, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public Long countApp(String name, String type)throws Exception {
Long result=null;
try{
result=appMapperEx.countsByApp(name, type);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertApp(String beanJson, HttpServletRequest request)throws Exception {
App app = JSONObject.parseObject(beanJson, App.class);
int result=0;
try{
result=appMapper.insertSelective(app);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateApp(String beanJson, Long id) throws Exception{
App app = JSONObject.parseObject(beanJson, App.class);
app.setId(id);
int result=0;
try{
result=appMapper.updateByPrimaryKeySelective(app);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteApp(Long id)throws Exception {
int result=0;
try{
result=appMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteApp(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
AppExample example = new AppExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result=appMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
public List<App> findRoleAPP()throws Exception{
AppExample example = new AppExample();
example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public List<App> findAppInIds(String ids, String type)throws Exception{
List<Long> idList = StringUtil.strToLongList(ids);
AppExample example = new AppExample();
example.createCriteria().andZlEqualTo(type).andEnabledEqualTo(true).andIdIn(idList)
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("Sort");
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAppByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_APP,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
int result=0;
try{
result=appMapperEx.batchDeleteAppByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
public List<App> findAppByUserId(String userId)throws Exception {
List<UserBusiness> roleList = userBusinessService.findRoleByUserId(userId);
String roles = null;
if(roleList!=null && roleList.size()>0 && roleList.get(0)!=null){
roles = roleList.get(0).getValue();
}
if(roles!=null) {
roles = roles.replaceAll("\\]\\[",",").replaceAll("\\]","").replaceAll("\\[",""); //转为逗号隔开的
}
List<UserBusiness> appList = userBusinessService.findAppByRoles(roles);
String apps = null;
if(appList!=null && appList.size()>0 && appList.get(0)!=null){
apps = appList.get(0).getValue();
}
if(apps!=null) {
apps = apps.replaceAll("\\]\\[",",").replaceAll("\\]","").replaceAll("\\[",""); //转为逗号隔开的
}
List<App> deskList = findAppInIds(apps,"desk");
return deskList;
}
/**
* 通过number列表查询app list
* @param numberList
* @return
*/
public List<App> findAppByNumber(List<String> numberList) throws Exception{
AppExample example = new AppExample();
example.createCriteria().andEnabledEqualTo(true).andNumberIn(numberList);
List<App> list=null;
try{
list=appMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
}

View File

@@ -1,7 +1,6 @@
package com.jsh.erp.service.depot;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.app.AppResource;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;

View File

@@ -7,6 +7,7 @@ import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -46,10 +47,7 @@ public class DepotService {
try{
result=depotMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -61,10 +59,7 @@ public class DepotService {
try{
list=depotMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -77,10 +72,7 @@ public class DepotService {
try{
list=depotMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -90,10 +82,7 @@ public class DepotService {
try{
list=depotMapperEx.selectByConditionDepot(name, type, remark, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -103,10 +92,7 @@ public class DepotService {
try{
result=depotMapperEx.countsByDepot(name, type, remark);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -118,10 +104,7 @@ public class DepotService {
try{
result=depotMapper.insertSelective(depot);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -134,10 +117,7 @@ public class DepotService {
try{
result= depotMapper.updateByPrimaryKeySelective(depot);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -148,10 +128,7 @@ public class DepotService {
try{
result= depotMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -165,10 +142,7 @@ public class DepotService {
try{
result= depotMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -180,10 +154,7 @@ public class DepotService {
try{
list= depotMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -196,10 +167,7 @@ public class DepotService {
try{
list= depotMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -212,10 +180,7 @@ public class DepotService {
try{
list= depotMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -225,10 +190,7 @@ public class DepotService {
try{
list= depotMapperEx.getDepotList(parameterMap);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -243,10 +205,7 @@ public class DepotService {
try{
result= depotMapperEx.batchDeleteDepotByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -280,10 +239,7 @@ public class DepotService {
try{
depotHeadList= depotHeadMapperEx.getDepotHeadListByDepotIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
@@ -298,10 +254,7 @@ public class DepotService {
try{
depotItemList= depotItemMapperEx.getDepotItemListListByDepotIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(depotItemList!=null&&depotItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,DepotIds[{}]",
@@ -329,10 +282,7 @@ public class DepotService {
try{
result = depotMapper.updateByExampleSelective(depot, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}

View File

@@ -15,6 +15,7 @@ import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
import com.jsh.erp.datasource.vo.DepotHeadVo4List;
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.depotItem.DepotItemService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.serialNumber.SerialNumberService;
@@ -65,10 +66,7 @@ public class DepotHeadService {
try{
result=depotHeadMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -80,10 +78,7 @@ public class DepotHeadService {
try{
list=depotHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -95,10 +90,7 @@ public class DepotHeadService {
try{
list=depotHeadMapperEx.selectByConditionDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (null != list) {
for (DepotHeadVo4List dh : list) {
@@ -106,10 +98,6 @@ public class DepotHeadService {
String otherMoneyListStr = dh.getOthermoneylist().replace("[", "").replace("]", "").replaceAll("\"", "");
dh.setOthermoneylist(otherMoneyListStr);
}
if(dh.getOthermoneyitem() != null) {
String otherMoneyItemStr = dh.getOthermoneyitem().replace("[", "").replace("]", "").replaceAll("\"", "");
dh.setOthermoneyitem(otherMoneyItemStr);
}
if(dh.getChangeamount() != null) {
dh.setChangeamount(dh.getChangeamount().abs());
}
@@ -134,10 +122,7 @@ public class DepotHeadService {
try{
result=depotHeadMapperEx.countsByDepotHead(type, subType, number, beginTime, endTime, materialParam, depotIds);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -158,10 +143,7 @@ public class DepotHeadService {
try{
result=depotHeadMapper.insert(depotHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -172,10 +154,7 @@ public class DepotHeadService {
try{
dh = depotHeadMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
depotHead.setId(id);
@@ -186,10 +165,7 @@ public class DepotHeadService {
try{
result = depotHeadMapper.updateByPrimaryKey(depotHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -200,10 +176,7 @@ public class DepotHeadService {
try{
result = depotHeadMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -217,10 +190,7 @@ public class DepotHeadService {
try{
result = depotHeadMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -232,10 +202,7 @@ public class DepotHeadService {
try{
list = depotHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -254,10 +221,7 @@ public class DepotHeadService {
try{
result = depotHeadMapper.updateByExampleSelective(depotHead, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -270,10 +234,7 @@ public class DepotHeadService {
try{
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
}
@@ -290,15 +251,13 @@ public class DepotHeadService {
}
public String findMaterialsListByHeaderId(Long id)throws Exception {
String result = null;
try{
result = depotHeadMapperEx.findMaterialsListByHeaderId(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -312,10 +271,7 @@ public class DepotHeadService {
try{
list = depotHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -329,10 +285,7 @@ public class DepotHeadService {
try{
list =depotHeadMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -342,10 +295,7 @@ public class DepotHeadService {
try{
list =depotHeadMapperEx.findByAll(beginTime, endTime, type, pid, dids, oId, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -355,10 +305,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findByAllCount(beginTime, endTime, type, pid, dids, oId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -368,10 +315,7 @@ public class DepotHeadService {
try{
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, pid, dids, oId, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -381,10 +325,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, pid, dids, oId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -394,10 +335,7 @@ public class DepotHeadService {
try{
list =depotHeadMapperEx.findStatementAccount(beginTime, endTime, organId, supType, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -407,10 +345,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findStatementAccountCount(beginTime, endTime, organId, supType);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -426,10 +361,7 @@ public class DepotHeadService {
try{
result =depotHeadMapperEx.findAllMoney(supplierId, type, subType, modeName, endTime);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -490,10 +422,7 @@ public class DepotHeadService {
try{
list = depotHeadMapperEx.getDetailByNumber(number);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (null != list) {
for (DepotHeadVo4List dh : list) {
@@ -539,16 +468,14 @@ public class DepotHeadService {
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
//判断用户是否已经登录过,登录过不再处理
User userInfo=userService.getCurrentUser();
depotHead.setHandspersonid(userInfo==null?null:userInfo.getId());
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
depotHead.setCreatetime(new Timestamp(System.currentTimeMillis()));
depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
try{
depotHeadMapperEx.adddepotHead(depotHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
/**入库和出库处理预付款信息*/
@@ -568,10 +495,7 @@ public class DepotHeadService {
try{
depotHeadMapper.updateByExampleSelective(depotHeadOrders, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
}
}
@@ -589,7 +513,8 @@ public class DepotHeadService {
* @return java.lang.Object
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, BigDecimal preTotalPrice)throws Exception {
public void updateDepotHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated,
BigDecimal preTotalPrice, Long tenantId)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -603,10 +528,7 @@ public class DepotHeadService {
try{
depotHeadMapperEx.updatedepotHead(depotHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
/**入库和出库处理预付款信息*/
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
@@ -642,10 +564,7 @@ public class DepotHeadService {
try{
depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id,BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
/**回收序列号*/
@@ -660,10 +579,7 @@ public class DepotHeadService {
try{
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long []{id});
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
/**删除单据主表信息*/
@@ -700,11 +616,12 @@ public class DepotHeadService {
try{
result = depotHeadMapperEx.batchDeleteDepotHeadByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
public BigDecimal getBuyAndSaleStatistics(String type, String subType, Integer hasSupplier, String beginTime, String endTime) {
return depotHeadMapperEx.getBuyAndSaleStatistics(type, subType, hasSupplier, beginTime, endTime);
}
}

View File

@@ -10,7 +10,9 @@ import com.jsh.erp.datasource.mappers.DepotItemMapper;
import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
import com.jsh.erp.datasource.mappers.SerialNumberMapperEx;
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
import com.jsh.erp.datasource.vo.DepotItemVo4Stock;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.material.MaterialService;
import com.jsh.erp.service.serialNumber.SerialNumberService;
@@ -217,48 +219,7 @@ public class DepotItemService {
try{
result = depotItemMapperEx.findDetailByTypeAndMaterialIdCounts(mId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public List<DepotItemVo4Material> findStockNumByMaterialIdList(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.valueOf(mIdStr);
}
String monthTime = map.get("monthTime");
List<DepotItemVo4Material> list =null;
try{
list = depotItemMapperEx.findStockNumByMaterialIdList(mId, monthTime, QueryUtils.offset(map), QueryUtils.rows(map));
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public Long findStockNumByMaterialIdCounts(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.parseLong(mIdStr);
}
String monthTime = map.get("monthTime");
Long result =null;
try{
result = depotItemMapperEx.findStockNumByMaterialIdCounts(mId, monthTime);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -269,10 +230,7 @@ public class DepotItemService {
try{
result = depotItemMapper.insertSelective(depotItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -283,31 +241,10 @@ public class DepotItemService {
try{
result = depotItemMapper.updateByPrimaryKeySelective(depotItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return depotItemMapper.updateByPrimaryKeySelective(depotItem);
}
public Long findByTypeAndMaterialId(String type, Long mId) throws Exception{
Long result = 0l;
try{
if(type.equals(TYPE)) {
result= depotItemMapperEx.findByTypeAndMaterialIdIn(mId);
} else {
result= depotItemMapperEx.findByTypeAndMaterialIdOut(mId);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
public int findByTypeAndMaterialIdAndDepotId(String type, Long mId, Long depotId) {
if(type.equals(TYPE)) {
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdIn(depotId, mId);
@@ -321,10 +258,7 @@ public class DepotItemService {
try{
list = depotItemMapperEx.getDetailList(headerId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -334,10 +268,7 @@ public class DepotItemService {
try{
list = depotItemMapperEx.findByAll(headIds, materialIds, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -347,86 +278,13 @@ public class DepotItemService {
try{
result = depotItemMapperEx.findByAllCount(headIds, materialIds);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
public BigDecimal findByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
BigDecimal result=null;
try{
if (TYPE.equals(type)) {
if (isPrev) {
result= depotItemMapperEx.findByTypeInIsPrev(ProjectId, MId, MonthTime);
} else {
result= depotItemMapperEx.findByTypeInIsNotPrev(ProjectId, MId, MonthTime);
}
} else {
if (isPrev) {
result= depotItemMapperEx.findByTypeOutIsPrev(ProjectId, MId, MonthTime);
} else {
result= depotItemMapperEx.findByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
}
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public BigDecimal findPriceByType(String type, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
BigDecimal result=null;
try{
if (TYPE.equals(type)) {
if (isPrev) {
result= depotItemMapperEx.findPriceByTypeInIsPrev(ProjectId, MId, MonthTime);
} else {
result= depotItemMapperEx.findPriceByTypeInIsNotPrev(ProjectId, MId, MonthTime);
}
} else {
if (isPrev) {
result= depotItemMapperEx.findPriceByTypeOutIsPrev(ProjectId, MId, MonthTime);
} else {
result= depotItemMapperEx.findPriceByTypeOutIsNotPrev(ProjectId, MId, MonthTime);
}
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public BigDecimal findAssembleByType(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev)throws Exception {
BigDecimal result=null;
try{
if (isPrev) {
result= depotItemMapperEx.findAssembleIsPrev(subType, mType, ProjectId, MId, MonthTime);
} else {
result= depotItemMapperEx.findAssembleIsNotPrev(subType, mType, ProjectId, MId, MonthTime);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) throws Exception{
BigDecimal result=null;
BigDecimal result= BigDecimal.ZERO;
try{
if (SUM_TYPE.equals(sumType)) {
result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
@@ -440,8 +298,25 @@ public class DepotItemService {
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
/**
* 统计采购或销售的总金额
* @param type
* @param subType
* @param MonthTime
* @return
* @throws Exception
*/
public BigDecimal inOrOutPrice(String type, String subType, String MonthTime) throws Exception{
BigDecimal result= BigDecimal.ZERO;
try{
result = depotItemMapperEx.inOrOutPrice(type, subType, MonthTime);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
/**
* 2019-02-02修改
@@ -466,282 +341,282 @@ public class DepotItemService {
//获得当前操作人
User userInfo=userService.getCurrentUser();
//转为json
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
/**
* 2019-01-28优先处理删除的
* 删除的可以继续卖,删除的需要将使用的序列号回收
* 插入的需要判断当前货源是否充足
* 更新的需要判断货源是否充足
* */
if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) {
//首先回收序列号,如果是调拨,不用处理序列号
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
if(depotItem==null){
continue;
}
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
userInfo);
}
}
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
}
this.batchDeleteDepotItemByIds(bf.toString());
}
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
DepotItem depotItem = new DepotItem();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
depotItem.setHeaderid(headerId);
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
depotItem.setMunit(tempInsertedJson.getString("Unit"));
Material material= materialService.getMaterial(depotItem.getMaterialid());
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
String Unit = tempInsertedJson.get("Unit").toString();
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
/***
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
* */
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
}
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempInsertedJson.getString("Remark"));
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
}
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
}
if (tempInsertedJson.get("OtherField1") != null) {
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
}
if (tempInsertedJson.get("OtherField2") != null) {
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
}
if (tempInsertedJson.get("OtherField3") != null) {
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
}
if (tempInsertedJson.get("OtherField4") != null) {
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
}
if (tempInsertedJson.get("OtherField5") != null) {
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
}
if (tempInsertedJson.get("MType") != null) {
depotItem.setMtype(tempInsertedJson.getString("MType"));
}
/**
* 出库时判断库存是否充足
* */
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(depotItem==null){
continue;
}
if(material==null){
continue;
}
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid()).compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
/**出库时处理序列号*/
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.insertDepotItemWithObj(depotItem);
}
}
if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) {
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
/**
* 2019-01-28优先处理删除的
* 删除的可以继续卖,删除的需要将使用的序列号回收
* 插入的需要判断当前货源是否充足
* 更新的需要判断货源是否充足
* */
if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) {
//首先回收序列号,如果是调拨,不用处理序列号
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
if(depotItem==null){
continue;
}
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
//首先回收序列号
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber() == null ? 0 : depotItem.getBasicnumber()).intValue(),
userInfo);
}
/**收回序列号的时候释放库存*/
depotItem.setOpernumber(BigDecimal.ZERO);
depotItem.setBasicnumber(BigDecimal.ZERO);
this.updateDepotItemWithObj(depotItem);
}
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
userInfo);
}
depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
if(!material.getId().equals(depotItem.getMaterialid())){
material= materialService.getMaterial(depotItem.getMaterialid());
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
String Unit = tempUpdatedJson.get("Unit").toString();
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
}
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
}
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
depotItem.setMtype(tempUpdatedJson.getString("MType"));
/**
* create by: qiankunpingtai
* create time: 2019/3/25 15:18
* websitehttps://qiankunpingtai.cn
* description:
* 修改了商品类型时,库中的商品和页面传递的不同
* 这里需要重新获取页面传递的商品信息
*/
if(!material.getId().equals(depotItem.getMaterialid())){
if(material==null){
continue;
}
}
/**出库时处理序列号*/
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid())
.compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.updateDepotItemWithObj(depotItem);
}
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
}
this.batchDeleteDepotItemByIds(bf.toString());
}
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
DepotItem depotItem = new DepotItem();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
depotItem.setHeaderid(headerId);
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
depotItem.setMunit(tempInsertedJson.getString("Unit"));
Material material= materialService.getMaterial(depotItem.getMaterialid());
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
String Unit = tempInsertedJson.get("Unit").toString();
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
/***
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
* */
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
}
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempInsertedJson.getString("Remark"));
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
}
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
}
if (tempInsertedJson.get("OtherField1") != null) {
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
}
if (tempInsertedJson.get("OtherField2") != null) {
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
}
if (tempInsertedJson.get("OtherField3") != null) {
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
}
if (tempInsertedJson.get("OtherField4") != null) {
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
}
if (tempInsertedJson.get("OtherField5") != null) {
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
}
if (tempInsertedJson.get("MType") != null) {
depotItem.setMtype(tempInsertedJson.getString("MType"));
}
/**
* 出库时判断库存是否充足
* */
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(depotItem==null){
continue;
}
if(material==null){
continue;
}
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid()).compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
/**出库时处理序列号*/
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.insertDepotItemWithObj(depotItem);
}
}
if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) {
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
if(depotItem==null){
continue;
}
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
//首先回收序列号
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber() == null ? 0 : depotItem.getBasicnumber()).intValue(),
userInfo);
}
/**收回序列号的时候释放库存*/
depotItem.setOpernumber(BigDecimal.ZERO);
depotItem.setBasicnumber(BigDecimal.ZERO);
this.updateDepotItemWithObj(depotItem);
}
}
depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
if(!material.getId().equals(depotItem.getMaterialid())){
material= materialService.getMaterial(depotItem.getMaterialid());
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
String Unit = tempUpdatedJson.get("Unit").toString();
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
}
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
}
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
depotItem.setMtype(tempUpdatedJson.getString("MType"));
/**
* create by: qiankunpingtai
* create time: 2019/3/25 15:18
* websitehttps://qiankunpingtai.cn
* description:
* 修改了商品类型时,库中的商品和页面传递的不同
* 这里需要重新获取页面传递的商品信息
*/
if(!material.getId().equals(depotItem.getMaterialid())){
if(material==null){
continue;
}
}
/**出库时处理序列号*/
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid())
.compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.updateDepotItemWithObj(depotItem);
}
}
return null;
}
/**
@@ -801,10 +676,7 @@ public class DepotItemService {
try{
list =depotItemMapperEx.findStockWarningCount( offset, rows, pid);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -814,10 +686,7 @@ public class DepotItemService {
try{
result =depotItemMapperEx.findStockWarningCountTotal(pid);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -850,4 +719,59 @@ public class DepotItemService {
}
return result;
}
/**
* 统计该商品已分批出库的总数量-用于订单
* @param mid
* @param headerId
* @return
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public BigDecimal getFinishNumber(Long mid, Long headerId) {
DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
String linkNumber = depotHead.getLinknumber(); //关联单号
BigDecimal count = depotItemMapperEx.getFinishNumber(mid, linkNumber);
return count;
}
/**
* 库存统计
* @param depotId
* @param mId
* @param beginTime
* @param endTime
* @return
*/
public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
BigDecimal intNum = stockObj.getInNum();
BigDecimal outNum = stockObj.getOutNum();
return intNum.subtract(outNum);
}
/**
* 入库统计
* @param depotId
* @param mId
* @param beginTime
* @param endTime
* @return
*/
public BigDecimal getInNumByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
return stockObj.getInNum();
}
/**
* 出库统计
* @param depotId
* @param mId
* @param beginTime
* @param endTime
* @return
*/
public BigDecimal getOutNumByParam(Long depotId, Long mId, String beginTime, String endTime, Long tenantId){
DepotItemVo4Stock stockObj = depotItemMapperEx.getStockByParam(depotId, mId, beginTime, endTime, tenantId);
return stockObj.getOutNum();
}
}

View File

@@ -1,7 +1,6 @@
package com.jsh.erp.service.functions;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.app.AppResource;
import com.jsh.erp.service.functions.FunctionsService;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.FunctionsMapper;
import com.jsh.erp.datasource.mappers.FunctionsMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -44,10 +45,7 @@ public class FunctionsService {
try{
result=functionsMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -59,10 +57,7 @@ public class FunctionsService {
try{
list=functionsMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -72,10 +67,7 @@ public class FunctionsService {
try{
list=functionsMapperEx.selectByConditionFunctions(name, type, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -85,10 +77,7 @@ public class FunctionsService {
try{
result=functionsMapperEx.countsByFunctions(name, type);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -100,10 +89,7 @@ public class FunctionsService {
try{
result=functionsMapper.insertSelective(depot);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -116,10 +102,7 @@ public class FunctionsService {
try{
result=functionsMapper.updateByPrimaryKeySelective(depot);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -130,10 +113,7 @@ public class FunctionsService {
try{
result=functionsMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -147,10 +127,7 @@ public class FunctionsService {
try{
result=functionsMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -162,10 +139,7 @@ public class FunctionsService {
try{
list = functionsMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -179,10 +153,7 @@ public class FunctionsService {
try{
list = functionsMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -196,10 +167,7 @@ public class FunctionsService {
try{
list =functionsMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -214,10 +182,7 @@ public class FunctionsService {
try{
list =functionsMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -233,10 +198,7 @@ public class FunctionsService {
try{
result =functionsMapperEx.batchDeleteFunctionsByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.datasource.mappers.InOutItemMapper;
import com.jsh.erp.datasource.mappers.InOutItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -45,10 +46,7 @@ public class InOutItemService {
try{
result=inOutItemMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -60,10 +58,7 @@ public class InOutItemService {
try{
list=inOutItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -73,10 +68,7 @@ public class InOutItemService {
try{
list=inOutItemMapperEx.selectByConditionInOutItem(name, type, remark, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -86,10 +78,7 @@ public class InOutItemService {
try{
result=inOutItemMapperEx.countsByInOutItem(name, type, remark);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -101,10 +90,7 @@ public class InOutItemService {
try{
result=inOutItemMapper.insertSelective(depot);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -117,10 +103,7 @@ public class InOutItemService {
try{
result=inOutItemMapper.updateByPrimaryKeySelective(depot);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -131,10 +114,7 @@ public class InOutItemService {
try{
result=inOutItemMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -148,10 +128,7 @@ public class InOutItemService {
try{
result=inOutItemMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -163,10 +140,7 @@ public class InOutItemService {
try{
list=inOutItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
@@ -184,10 +158,7 @@ public class InOutItemService {
try{
list=inOutItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -202,10 +173,7 @@ public class InOutItemService {
try{
result=inOutItemMapperEx.batchDeleteInOutItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -237,10 +205,7 @@ public class InOutItemService {
try{
accountItemList=accountItemMapperEx.getAccountItemListByInOutItemIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(accountItemList!=null&&accountItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,InOutItemIds[{}]",

View File

@@ -10,7 +10,9 @@ import com.jsh.erp.datasource.mappers.LogMapper;
import com.jsh.erp.datasource.mappers.LogMapperEx;
import com.jsh.erp.datasource.vo.LogVo4List;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -37,10 +39,7 @@ public class LogService {
try{
result=logMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -51,10 +50,7 @@ public class LogService {
try{
list=logMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -65,11 +61,13 @@ public class LogService {
try{
list=logMapperEx.selectByConditionLog(operation, usernameID, clientIp, status, beginTime, endTime,
contentdetails, offset, rows);
if (null != list) {
for (LogVo4List log : list) {
log.setCreateTimeStr(Tools.getCenternTime(log.getCreatetime()));
}
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -80,10 +78,7 @@ public class LogService {
try{
result=logMapperEx.countsByLog(operation, usernameID, clientIp, status, beginTime, endTime, contentdetails);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -95,10 +90,7 @@ public class LogService {
try{
result=logMapper.insertSelective(log);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -111,10 +103,7 @@ public class LogService {
try{
result=logMapper.updateByPrimaryKeySelective(log);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -125,10 +114,7 @@ public class LogService {
try{
result=logMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -142,10 +128,7 @@ public class LogService {
try{
result=logMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -223,14 +206,10 @@ public class LogService {
Byte status = 0;
log.setStatus(status);
log.setContentdetails(type + getModule(apiName));
log.setRemark(type + getModule(apiName));
try{
logMapper.insertSelective(log);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
}

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.DepotItemMapperEx;
import com.jsh.erp.datasource.mappers.MaterialMapper;
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.depotItem.DepotItemService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
@@ -47,10 +48,7 @@ public class MaterialService {
try{
result=materialMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -62,10 +60,7 @@ public class MaterialService {
try{
list=materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -78,10 +73,7 @@ public class MaterialService {
try{
list= materialMapperEx.selectByConditionMaterial(name, model,categoryIds,mpList, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (null != list) {
for (MaterialVo4Unit m : list) {
@@ -108,9 +100,8 @@ public class MaterialService {
}
}
m.setMaterialOther(materialOther);
Long InSum = depotItemService.findByTypeAndMaterialId("入库", m.getId());
Long OutSum = depotItemService.findByTypeAndMaterialId("出库", m.getId());
m.setStock(InSum - OutSum);
Long tenantId = m.getTenantId();
m.setStock(depotItemService.getStockByParam(null,m.getId(),null,null,tenantId));
resList.add(m);
}
}
@@ -122,10 +113,7 @@ public class MaterialService {
try{
result= materialMapperEx.countsByMaterial(name, model,categoryIds,mpList);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -138,10 +126,7 @@ public class MaterialService {
try{
result= materialMapper.insertSelective(material);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -160,10 +145,7 @@ public class MaterialService {
materialMapperEx.updateUnitIdNullByPrimaryKey(id); //将多单位置空
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return res;
@@ -175,10 +157,7 @@ public class MaterialService {
try{
result= materialMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -192,10 +171,7 @@ public class MaterialService {
try{
result= materialMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -207,10 +183,7 @@ public class MaterialService {
try{
list= materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -235,10 +208,7 @@ public class MaterialService {
try{
list= materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -257,10 +227,7 @@ public class MaterialService {
try{
result= materialMapper.updateByExampleSelective(material, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -270,10 +237,7 @@ public class MaterialService {
try{
result= materialMapperEx.findUnitName(mId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -283,10 +247,7 @@ public class MaterialService {
try{
list= materialMapperEx.findById(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -296,10 +257,7 @@ public class MaterialService {
try{
list= materialMapperEx.findBySelect();
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -312,10 +270,7 @@ public class MaterialService {
try{
list= materialMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -326,10 +281,7 @@ public class MaterialService {
try{
list= materialMapperEx.findByAll(name, model, categoryIds);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (null != list) {
for (MaterialVo4Unit m : list) {
@@ -352,8 +304,7 @@ public class MaterialService {
info.code = 200;
data.put("message", "成功");
} catch (Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
JshException.writeFail(logger, e);
e.printStackTrace();
info.code = 500;
data.put("message", e.getMessage());
@@ -367,10 +318,7 @@ public class MaterialService {
try{
list= materialMapperEx.getMaterialEnableSerialNumberList(parameterMap);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -385,10 +333,7 @@ public class MaterialService {
try{
result= materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -421,10 +366,7 @@ public class MaterialService {
try{
depotItemList= depotItemMapperEx.getDepotItemListListByMaterialIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(depotItemList!=null&&depotItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,MaterialIds[{}]",

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx;
import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -46,10 +47,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -60,10 +58,7 @@ public class MaterialCategoryService {
try{
list=materialCategoryMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -73,10 +68,7 @@ public class MaterialCategoryService {
try{
list = getMCList(parentId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -105,10 +97,7 @@ public class MaterialCategoryService {
try{
list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -118,10 +107,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapperEx.countsByMaterialCategory(name, parentId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -133,10 +119,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapper.insertSelective(materialCategory);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -149,10 +132,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapper.updateByPrimaryKeySelective(materialCategory);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -163,10 +143,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -180,10 +157,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -199,10 +173,7 @@ public class MaterialCategoryService {
try{
list=materialCategoryMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -219,10 +190,7 @@ public class MaterialCategoryService {
try{
list=materialCategoryMapperEx.getNodeTree(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -264,10 +232,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapperEx.addMaterialCategory(mc);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -289,10 +254,7 @@ public class MaterialCategoryService {
try{
result=materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -317,10 +279,7 @@ public class MaterialCategoryService {
try{
result= materialCategoryMapperEx.editMaterialCategory(mc);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -339,10 +298,7 @@ public class MaterialCategoryService {
try{
mList= materialCategoryMapperEx.getMaterialCategoryBySerialNo(mc.getSerialNo());
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(mList==null||mList.size()<1){
//未查询到对应数据,编号可用
@@ -397,10 +353,7 @@ public class MaterialCategoryService {
try{
materialList= materialMapperEx.getMaterialListByCategoryIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(materialList!=null&&materialList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]",
@@ -415,10 +368,7 @@ public class MaterialCategoryService {
try{
materialCategoryList= materialCategoryMapperEx.getMaterialCategoryListByCategoryIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(materialCategoryList!=null&&materialCategoryList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,CategoryIds[{}]",

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.MaterialPropertyMapper;
import com.jsh.erp.datasource.mappers.MaterialPropertyMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -43,10 +44,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -58,10 +56,7 @@ public class MaterialPropertyService {
try{
list=materialPropertyMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -71,10 +66,7 @@ public class MaterialPropertyService {
try{
list=materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -84,10 +76,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapperEx.countsByMaterialProperty(name);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -99,10 +88,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapper.insertSelective(materialProperty);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -115,10 +101,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapper.updateByPrimaryKeySelective(materialProperty);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -129,10 +112,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -146,10 +126,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -168,10 +145,7 @@ public class MaterialPropertyService {
try{
result=materialPropertyMapperEx.batchDeleteMaterialPropertyByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;

View File

@@ -1,4 +1,4 @@
package com.jsh.erp.service.app;
package com.jsh.erp.service.msg;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
@@ -11,62 +11,61 @@ import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "app_component")
@AppResource
public class AppComponent implements ICommonQuery {
@Service(value = "msg_component")
@MsgResource
public class MsgComponent implements ICommonQuery {
@Resource
private AppService appService;
private MsgService msgService;
@Override
public Object selectOne(Long id) throws Exception {
return appService.getApp(id);
return msgService.getMsg(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getAppList(map);
return getMsgList(map);
}
private List<?> getAppList(Map<String, String> map)throws Exception {
private List<?> getMsgList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
String order = QueryUtils.order(map);
return appService.select(name, type, QueryUtils.offset(map), QueryUtils.rows(map));
String filter = QueryUtils.filter(map);
return msgService.select(name, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
public Long counts(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
return appService.countApp(name, type);
return msgService.countMsg(name);
}
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return appService.insertApp(beanJson, request);
return msgService.insertMsg(beanJson, request);
}
@Override
public int update(String beanJson, Long id)throws Exception {
return appService.updateApp(beanJson, id);
return msgService.updateMsg(beanJson, id);
}
@Override
public int delete(Long id)throws Exception {
return appService.deleteApp(id);
return msgService.deleteMsg(id);
}
@Override
public int batchDelete(String ids)throws Exception {
return appService.batchDeleteApp(ids);
return msgService.batchDeleteMsg(ids);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return 0;
return msgService.checkIsNameExist(id, name);
}
}

View File

@@ -0,0 +1,15 @@
package com.jsh.erp.service.msg;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2019-9-7 22:52:35
*/
@ResourceInfo(value = "msg", type = 125)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MsgResource {
}

View File

@@ -0,0 +1,229 @@
package com.jsh.erp.service.msg;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Msg;
import com.jsh.erp.datasource.entities.MsgExample;
import com.jsh.erp.datasource.mappers.MsgMapper;
import com.jsh.erp.datasource.mappers.MsgMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
public class MsgService {
private Logger logger = LoggerFactory.getLogger(MsgService.class);
@Resource
private MsgMapper msgMapper;
@Resource
private MsgMapperEx msgMapperEx;
@Resource
private DepotHeadService depotHeadService;
@Resource
private LogService logService;
public Msg getMsg(long id)throws Exception {
Msg result=null;
try{
result=msgMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
public List<Msg> getMsg()throws Exception {
MsgExample example = new MsgExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Msg> list=null;
try{
list=msgMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public List<Msg> select(String name, int offset, int rows)throws Exception {
List<Msg> list=null;
try{
list=msgMapperEx.selectByConditionMsg(name, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
public Long countMsg(String name)throws Exception {
Long result=null;
try{
result=msgMapperEx.countsByMsg(name);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMsg(String beanJson, HttpServletRequest request)throws Exception {
Msg msg = JSONObject.parseObject(beanJson, Msg.class);
int result=0;
try{
result=msgMapper.insertSelective(msg);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateMsg(String beanJson, Long id) throws Exception{
Msg msg = JSONObject.parseObject(beanJson, Msg.class);
msg.setId(id);
int result=0;
try{
result=msgMapper.updateByPrimaryKeySelective(msg);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteMsg(Long id)throws Exception {
int result=0;
try{
result=msgMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMsg(String ids) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids);
MsgExample example = new MsgExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result=msgMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
public int checkIsNameExist(Long id, String name)throws Exception {
MsgExample example = new MsgExample();
example.createCriteria().andIdNotEqualTo(id).andMsgTitleEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Msg> list=null;
try{
list= msgMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list==null?0:list.size();
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 逻辑删除角色信息
* create time: 2019/3/28 15:44
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMsgByIds(String ids) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
String [] idArray=ids.split(",");
int result=0;
try{
result=msgMapperEx.batchDeleteMsgByIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
public List<Msg> getMsgByStatus(String status)throws Exception {
MsgExample example = new MsgExample();
example.createCriteria().andStatusEqualTo(status).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Msg> list=null;
try{
list=msgMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void batchUpdateStatus(String ids, String status) throws Exception{
List<Long> idList = StringUtil.strToLongList(ids);
Msg msg = new Msg();
msg.setStatus(status);
MsgExample example = new MsgExample();
example.createCriteria().andIdIn(idList);
try{
msgMapper.updateByExampleSelective(msg, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
}
}

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.OrgaUserRelMapper;
import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.organization.OrganizationService;
import com.jsh.erp.service.user.UserService;
@@ -53,10 +54,7 @@ public class OrgaUserRelService {
try{
result=orgaUserRelMapper.insertSelective(orgaUserRel);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -68,10 +66,7 @@ public class OrgaUserRelService {
try{
result=orgaUserRelMapper.updateByPrimaryKeySelective(orgaUserRel);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -81,10 +76,7 @@ public class OrgaUserRelService {
try{
result=orgaUserRelMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -97,10 +89,7 @@ public class OrgaUserRelService {
try{
result=orgaUserRelMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -137,10 +126,7 @@ public class OrgaUserRelService {
try{
result=orgaUserRelMapperEx.addOrgaUserRel(orgaUserRel);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result>0){
return orgaUserRel;
@@ -170,10 +156,7 @@ public class OrgaUserRelService {
try{
result=orgaUserRelMapperEx.updateOrgaUserRel(orgaUserRel);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result>0){
return orgaUserRel;

View File

@@ -11,6 +11,7 @@ import com.jsh.erp.datasource.mappers.OrganizationMapper;
import com.jsh.erp.datasource.mappers.OrganizationMapperEx;
import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -56,10 +57,7 @@ public class OrganizationService {
try{
result=organizationMapper.insertSelective(organization);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -71,10 +69,7 @@ public class OrganizationService {
try{
result=organizationMapper.updateByPrimaryKeySelective(organization);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -84,10 +79,7 @@ public class OrganizationService {
try{
result=organizationMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -100,10 +92,7 @@ public class OrganizationService {
try{
result=organizationMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -138,10 +127,7 @@ public class OrganizationService {
try{
result=organizationMapperEx.addOrganization(org);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -171,10 +157,7 @@ public class OrganizationService {
try{
result=organizationMapperEx.editOrganization(org);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -184,10 +167,7 @@ public class OrganizationService {
try{
list=organizationMapperEx.getNodeTree(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -199,10 +179,7 @@ public class OrganizationService {
try{
list=organizationMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -214,10 +191,7 @@ public class OrganizationService {
try{
list=organizationMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -269,10 +243,7 @@ public class OrganizationService {
result=organizationMapperEx.batchDeleteOrganizationByIds(
new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
import com.jsh.erp.datasource.mappers.PersonMapper;
import com.jsh.erp.datasource.mappers.PersonMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -48,10 +49,7 @@ public class PersonService {
try{
result=personMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -63,10 +61,7 @@ public class PersonService {
try{
list=personMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -76,10 +71,7 @@ public class PersonService {
try{
list=personMapperEx.selectByConditionPerson(name, type, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -89,10 +81,7 @@ public class PersonService {
try{
result=personMapperEx.countsByPerson(name, type);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -104,10 +93,7 @@ public class PersonService {
try{
result=personMapper.insertSelective(person);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -120,10 +106,7 @@ public class PersonService {
try{
result=personMapper.updateByPrimaryKeySelective(person);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -134,10 +117,7 @@ public class PersonService {
try{
result=personMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -151,10 +131,7 @@ public class PersonService {
try{
result=personMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -166,10 +143,7 @@ public class PersonService {
try{
list=personMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -183,10 +157,7 @@ public class PersonService {
try{
list=personMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
StringBuffer sb = new StringBuffer();
if (null != list) {
@@ -205,10 +176,7 @@ public class PersonService {
try{
list=personMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -224,10 +192,7 @@ public class PersonService {
try{
result=personMapperEx.batchDeletePersonByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -260,10 +225,7 @@ public class PersonService {
try{
accountHeadList=accountHeadMapperEx.getAccountHeadListByHandsPersonIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(accountHeadList!=null&&accountHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",
@@ -278,10 +240,7 @@ public class PersonService {
try{
depotHeadList=depotHeadMapperEx.getDepotHeadListByHandsPersonIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,HandsPersonIds[{}]",

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.RoleMapper;
import com.jsh.erp.datasource.mappers.RoleMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -43,10 +44,7 @@ public class RoleService {
try{
result=roleMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -56,10 +54,7 @@ public class RoleService {
try{
list=roleMapperEx.getRoleList(parameterMap);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -69,10 +64,7 @@ public class RoleService {
try{
list=roleMapperEx.selectByConditionRole(name, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -82,10 +74,7 @@ public class RoleService {
try{
result=roleMapperEx.countsByRole(name);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -97,10 +86,7 @@ public class RoleService {
try{
result=roleMapper.insertSelective(role);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -113,10 +99,7 @@ public class RoleService {
try{
result=roleMapper.updateByPrimaryKeySelective(role);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -127,10 +110,7 @@ public class RoleService {
try{
result=roleMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -144,10 +124,7 @@ public class RoleService {
try{
result=roleMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -160,10 +137,7 @@ public class RoleService {
try{
list=roleMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -187,10 +161,7 @@ public class RoleService {
try{
result=roleMapperEx.batchDeleteRoleByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}

View File

@@ -6,6 +6,7 @@ import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.depotItem.DepotItemService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.material.MaterialService;
@@ -53,10 +54,7 @@ public class SerialNumberService {
try{
result=serialNumberMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -67,10 +65,7 @@ public class SerialNumberService {
try{
list=serialNumberMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -80,10 +75,7 @@ public class SerialNumberService {
try{
list=serialNumberMapperEx.selectByConditionSerialNumber(serialNumber, materialName,offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
@@ -94,10 +86,7 @@ public class SerialNumberService {
try{
result=serialNumberMapperEx.countSerialNumber(serialNumber, materialName);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -110,10 +99,7 @@ public class SerialNumberService {
try{
result=serialNumberMapper.insertSelective(serialNumber);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -126,10 +112,7 @@ public class SerialNumberService {
try{
result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -140,10 +123,7 @@ public class SerialNumberService {
try{
result=serialNumberMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -157,10 +137,7 @@ public class SerialNumberService {
try{
result=serialNumberMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -172,10 +149,7 @@ public class SerialNumberService {
try{
list=serialNumberMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -192,10 +166,7 @@ public class SerialNumberService {
try{
result=serialNumberMapper.updateByExampleSelective(serialNumber, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -206,10 +177,7 @@ public class SerialNumberService {
try{
list=serialNumberMapperEx.findById(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -226,10 +194,7 @@ public class SerialNumberService {
try{
mlist = materialMapperEx.findByMaterialName(materialName);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(mlist==null||mlist.size()<1){
@@ -250,10 +215,7 @@ public class SerialNumberService {
try{
list = serialNumberMapperEx.findBySerialNumber(serialNumber);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(list!=null&&list.size()>0){
if(list.size()>1){
@@ -305,10 +267,7 @@ public class SerialNumberService {
try{
result = serialNumberMapperEx.addSerialNumber(serialNumberEx);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result>0){
return serialNumberEx;
@@ -333,10 +292,7 @@ public class SerialNumberService {
try{
result = serialNumberMapperEx.updateSerialNumber(serialNumberEx);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result>0){
return serialNumberEx;
@@ -357,10 +313,7 @@ public class SerialNumberService {
try{
mlist = materialMapperEx.findByMaterialName(materialName);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if (mlist == null || mlist.size() < 1) {
//商品名称不存在
@@ -471,10 +424,7 @@ public class SerialNumberService {
try{
result = serialNumberMapperEx.sellSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -496,10 +446,7 @@ public class SerialNumberService {
try{
result = serialNumberMapperEx.cancelSerialNumber(materialId,depotheadId,count,new Date(),user==null?null:user.getId());
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -507,7 +454,7 @@ public class SerialNumberService {
/**
* create by: cjl
* description:
*批量添加序列号
*批量添加序列号最多500个
* create time: 2019/1/29 15:11
* @Param: materialName
 * @Param: serialNumberPrefix
@@ -555,10 +502,7 @@ public class SerialNumberService {
try{
result = serialNumberMapperEx.batAddSerialNumber(list);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
serialNumberMapperEx.batAddSerialNumber(list);
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
@@ -585,10 +529,7 @@ public class SerialNumberService {
try{
result = serialNumberMapperEx.batchDeleteSerialNumberByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.DepotHeadMapperEx;
import com.jsh.erp.datasource.mappers.SupplierMapper;
import com.jsh.erp.datasource.mappers.SupplierMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.accountHead.AccountHeadService;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.service.log.LogService;
@@ -57,10 +58,7 @@ public class SupplierService {
try{
result=supplierMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -72,10 +70,7 @@ public class SupplierService {
try{
list=supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -117,10 +112,7 @@ public class SupplierService {
resList.add(s);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return resList;
}
@@ -130,10 +122,7 @@ public class SupplierService {
try{
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, description);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -145,10 +134,7 @@ public class SupplierService {
try{
result=supplierMapper.insertSelective(supplier);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -167,10 +153,7 @@ public class SupplierService {
try{
result=supplierMapper.updateByPrimaryKeySelective(supplier);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -181,10 +164,7 @@ public class SupplierService {
try{
result=supplierMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return supplierMapper.deleteByPrimaryKey(id);
}
@@ -198,10 +178,7 @@ public class SupplierService {
try{
result=supplierMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -213,10 +190,7 @@ public class SupplierService {
try{
list= supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -230,10 +204,7 @@ public class SupplierService {
try{
supplier = supplierMapper.selectByPrimaryKey(supplierId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
int result=0;
try{
@@ -242,10 +213,7 @@ public class SupplierService {
result=supplierMapper.updateByPrimaryKeySelective(supplier);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -258,10 +226,7 @@ public class SupplierService {
try{
list = supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -275,10 +240,7 @@ public class SupplierService {
try{
list = supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -292,10 +254,7 @@ public class SupplierService {
try{
list = supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -309,10 +268,7 @@ public class SupplierService {
try{
list = supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -331,10 +287,7 @@ public class SupplierService {
try{
result = supplierMapper.updateByExampleSelective(supplier, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -348,10 +301,7 @@ public class SupplierService {
try{
list = supplierMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -362,10 +312,7 @@ public class SupplierService {
try{
list = supplierMapperEx.findByAll(supplier, type, phonenum, telephone, description);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -383,8 +330,6 @@ public class SupplierService {
info.code = 200;
data.put("message", "成功");
} catch (Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
e.printStackTrace();
info.code = 500;
data.put("message", e.getMessage());
@@ -403,10 +348,7 @@ public class SupplierService {
try{
result = supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -439,10 +381,7 @@ public class SupplierService {
try{
accountHeadList = accountHeadMapperEx.getAccountHeadListByOrganIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(accountHeadList!=null&&accountHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",
@@ -457,10 +396,7 @@ public class SupplierService {
try{
depotHeadList = depotHeadMapperEx.getDepotHeadListByOrganIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(depotHeadList!=null&&depotHeadList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,OrganIds[{}]",

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.SystemConfigMapper;
import com.jsh.erp.datasource.mappers.SystemConfigMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -44,10 +45,7 @@ public class SystemConfigService {
try{
result=systemConfigMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -59,10 +57,7 @@ public class SystemConfigService {
try{
list=systemConfigMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -71,10 +66,7 @@ public class SystemConfigService {
try{
list=systemConfigMapperEx.selectByConditionSystemConfig(companyName, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -84,10 +76,7 @@ public class SystemConfigService {
try{
result=systemConfigMapperEx.countsBySystemConfig(companyName);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -99,10 +88,7 @@ public class SystemConfigService {
try{
result=systemConfigMapper.insertSelective(systemConfig);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -115,10 +101,7 @@ public class SystemConfigService {
try{
result=systemConfigMapper.updateByPrimaryKeySelective(systemConfig);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -129,10 +112,7 @@ public class SystemConfigService {
try{
result=systemConfigMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -146,10 +126,7 @@ public class SystemConfigService {
try{
result=systemConfigMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -161,10 +138,7 @@ public class SystemConfigService {
try{
list=systemConfigMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -180,11 +154,42 @@ public class SystemConfigService {
try{
result=systemConfigMapperEx.batchDeleteSystemConfigByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
/**
* 获取仓库开关
* @return
* @throws Exception
*/
public boolean getDepotFlag() throws Exception {
boolean depotFlag = false;
List<SystemConfig> list = getSystemConfig();
if(list.size()>0) {
String flag = list.get(0).getDepotFlag();
if(("1").equals(flag)) {
depotFlag = true;
}
}
return depotFlag;
}
/**
* 获取客户开关
* @return
* @throws Exception
*/
public boolean getCustomerFlag() throws Exception {
boolean customerFlag = false;
List<SystemConfig> list = getSystemConfig();
if(list.size()>0) {
String flag = list.get(0).getCustomerFlag();
if(("1").equals(flag)) {
customerFlag = true;
}
}
return customerFlag;
}
}

View File

@@ -0,0 +1,71 @@
package com.jsh.erp.service.tenant;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.user.UserResource;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "tenant_component")
@TenantResource
public class TenantComponent implements ICommonQuery {
@Resource
private TenantService tenantService;
@Override
public Object selectOne(Long id) throws Exception {
return tenantService.getTenant(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getTenantList(map);
}
private List<?> getTenantList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName");
return tenantService.select(loginName, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName");
return tenantService.countTenant(loginName);
}
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return tenantService.insertTenant(beanJson, request);
}
@Override
public int update(String beanJson, Long id)throws Exception {
return tenantService.updateTenant(beanJson, id);
}
@Override
public int delete(Long id)throws Exception {
return tenantService.deleteTenant(id);
}
@Override
public int batchDelete(String ids)throws Exception {
return tenantService.batchDeleteTenant(ids);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return tenantService.checkIsNameExist(id, name);
}
}

View File

@@ -0,0 +1,15 @@
package com.jsh.erp.service.tenant;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2019-6-27 22:56:56
*/
@ResourceInfo(value = "tenant", type = 120)
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TenantResource {
}

View File

@@ -0,0 +1,145 @@
package com.jsh.erp.service.tenant;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.TenantMapper;
import com.jsh.erp.datasource.mappers.TenantMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Service
public class TenantService {
private Logger logger = LoggerFactory.getLogger(TenantService.class);
@Resource
private TenantMapper tenantMapper;
@Resource
private TenantMapperEx tenantMapperEx;
public Tenant getTenant(long id)throws Exception {
Tenant result=null;
try{
result=tenantMapper.selectByPrimaryKey(id);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<Tenant> getTenant()throws Exception {
TenantExample example = new TenantExample();
List<Tenant> list=null;
try{
list=tenantMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Tenant> select(String loginName, int offset, int rows)throws Exception {
List<Tenant> list=null;
try{
list=tenantMapperEx.selectByConditionTenant(loginName, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long countTenant(String loginName)throws Exception {
Long result=null;
try{
result=tenantMapperEx.countsByTenant(loginName);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertTenant(String beanJson, HttpServletRequest request)throws Exception {
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
int result=0;
try{
tenant.setUserNumLimit(2); //默认用户限制数量
tenant.setBillsNumLimit(200); //默认单据限制数量
tenant.setCreateTime(new Date());
result=tenantMapper.insertSelective(tenant);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateTenant(String beanJson, Long id)throws Exception {
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
int result=0;
try{
tenant.setId(id);
result=tenantMapper.updateByPrimaryKeySelective(tenant);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteTenant(Long id)throws Exception {
int result=0;
try{
result= tenantMapper.deleteByPrimaryKey(id);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteTenant(String ids)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
TenantExample example = new TenantExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result= tenantMapper.deleteByExample(example);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public int checkIsNameExist(Long id, String name)throws Exception {
TenantExample example = new TenantExample();
example.createCriteria().andIdEqualTo(id);
List<Tenant> list=null;
try{
list= tenantMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
public Tenant getTenantByTenantId(long tenantId) {
Tenant tenant = new Tenant();
TenantExample example = new TenantExample();
example.createCriteria().andTenantIdEqualTo(tenantId);
List<Tenant> list = tenantMapper.selectByExample(example);
if(list.size()>0) {
tenant = list.get(0);
}
return tenant;
}
}

View File

@@ -1,7 +1,6 @@
package com.jsh.erp.service.unit;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.app.AppResource;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;

View File

@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.MaterialMapperEx;
import com.jsh.erp.datasource.mappers.UnitMapper;
import com.jsh.erp.datasource.mappers.UnitMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
@@ -45,10 +46,7 @@ public class UnitService {
try{
result=unitMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -60,10 +58,7 @@ public class UnitService {
try{
list=unitMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -73,10 +68,7 @@ public class UnitService {
try{
list=unitMapperEx.selectByConditionUnit(name, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -86,10 +78,7 @@ public class UnitService {
try{
result=unitMapperEx.countsByUnit(name);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -101,10 +90,7 @@ public class UnitService {
try{
result=unitMapper.insertSelective(unit);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -117,10 +103,7 @@ public class UnitService {
try{
result=unitMapper.updateByPrimaryKeySelective(unit);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -131,10 +114,7 @@ public class UnitService {
try{
result=unitMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -148,10 +128,7 @@ public class UnitService {
try{
result=unitMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -163,10 +140,7 @@ public class UnitService {
try{
list=unitMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -181,10 +155,7 @@ public class UnitService {
try{
result=unitMapperEx.batchDeleteUnitByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -217,10 +188,7 @@ public class UnitService {
try{
materialList=materialMapperEx.getMaterialListByUnitIds(idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(materialList!=null&&materialList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,UnitIds[{}]",

View File

@@ -13,11 +13,11 @@ import com.jsh.erp.datasource.mappers.UserMapper;
import com.jsh.erp.datasource.mappers.UserMapperEx;
import com.jsh.erp.datasource.vo.TreeNodeEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.orgaUserRel.OrgaUserRelService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.ExceptionCodeConstants;
import com.jsh.erp.utils.JshException;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.apache.ibatis.annotations.DeleteProvider;
@@ -60,10 +60,7 @@ public class UserService {
try{
result=userMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -74,10 +71,7 @@ public class UserService {
try{
list=userMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -87,10 +81,7 @@ public class UserService {
try{
list=userMapperEx.selectByConditionUser(userName, loginName, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -100,10 +91,7 @@ public class UserService {
try{
result=userMapperEx.countsByUser(userName, loginName);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -132,10 +120,7 @@ public class UserService {
try{
result=userMapper.insertSelective(user);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -156,10 +141,7 @@ public class UserService {
try{
result=userMapper.updateByPrimaryKeySelective(user);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -180,10 +162,7 @@ public class UserService {
try{
result=userMapper.updateByPrimaryKeySelective(user);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -208,10 +187,7 @@ public class UserService {
try{
result=userMapper.updateByPrimaryKeySelective(user);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -222,10 +198,7 @@ public class UserService {
try{
result= userMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -239,16 +212,12 @@ public class UserService {
try{
result= userMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
public int validateUser(String username, String password) throws JshException {
try {
public int validateUser(String username, String password){
/**默认是可以登录的*/
List<User> list = null;
try {
@@ -275,9 +244,6 @@ public class UserService {
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
}
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
} catch (Exception e) {
throw new JshException("unknown exception", e);
}
}
public User getUserByUserName(String username)throws Exception {
@@ -287,10 +253,7 @@ public class UserService {
try{
list= userMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
User user =null;
if(list!=null&&list.size()>0){
@@ -309,10 +272,7 @@ public class UserService {
try{
list= userMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -334,10 +294,7 @@ public class UserService {
try{
list= userMapperEx.getUserList(parameterMap);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -406,10 +363,7 @@ public class UserService {
try{
result= userMapperEx.addUser(ue);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result>0){
return ue;
@@ -480,10 +434,7 @@ public class UserService {
try{
userMapper.updateByPrimaryKeySelective(user);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
}
@@ -542,10 +493,7 @@ public class UserService {
try{
result=userMapperEx.updateUser(ue);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result>0){
return ue;
@@ -645,10 +593,7 @@ public class UserService {
try{
list=userMapperEx.getUserListByUserNameAndTenantId(userName,tenantId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -661,10 +606,7 @@ public class UserService {
try{
list=userMapperEx.getUserListByLoginName(loginName);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -699,10 +641,7 @@ public class UserService {
try{
result=userMapperEx.batDeleteOrUpdateUser(idsArray,BusinessConstants.USER_STATUS_DELETE);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
if(result<1){
logger.error("异常码[{}],异常提示[{}],参数,ids:[{}]",
@@ -717,10 +656,7 @@ public class UserService {
try{
list=userMapperEx.getNodeTree();
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}

View File

@@ -7,8 +7,8 @@ import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.CommonQueryManager;
import com.jsh.erp.service.app.AppService;
import com.jsh.erp.service.functions.FunctionsService;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
@@ -41,9 +41,6 @@ public class UserBusinessService {
@Resource
private FunctionsService functionsService;
@Resource
private AppService appService;
@Resource
private CommonQueryManager configResourceManager;
@@ -52,10 +49,7 @@ public class UserBusinessService {
try{
result=userBusinessMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -67,10 +61,7 @@ public class UserBusinessService {
try{
list=userBusinessMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -82,14 +73,7 @@ public class UserBusinessService {
try{
result=userBusinessMapper.insertSelective(userBusiness);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
// 更新应用权限
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) {
result = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
JshException.writeFail(logger, e);
}
return result;
}
@@ -102,14 +86,7 @@ public class UserBusinessService {
try{
result=userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
// 更新应用权限
if (BusinessConstants.TYPE_NAME_ROLE_FUNCTIONS.equals(userBusiness.getType()) && result > 0) {
result = insertOrUpdateAppValue(BusinessConstants.TYPE_NAME_ROLE_APP, userBusiness.getKeyid(), userBusiness.getValue());
JshException.writeFail(logger, e);
}
return result;
}
@@ -120,10 +97,7 @@ public class UserBusinessService {
try{
result=userBusinessMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -137,10 +111,7 @@ public class UserBusinessService {
try{
result=userBusinessMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -157,10 +128,7 @@ public class UserBusinessService {
try{
list= userBusinessMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -173,10 +141,7 @@ public class UserBusinessService {
try{
list= userBusinessMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
Long id = null;
if(list!=null&&list.size() > 0) {
@@ -199,10 +164,7 @@ public class UserBusinessService {
try{
list= userBusinessMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
if(list!=null&&list.size() > 0) {
return true;
@@ -224,10 +186,7 @@ public class UserBusinessService {
try{
result= userBusinessMapper.updateByExampleSelective(userBusiness, example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -240,10 +199,7 @@ public class UserBusinessService {
try{
list= userBusinessMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -257,10 +213,7 @@ public class UserBusinessService {
try{
list= userBusinessMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -276,60 +229,7 @@ public class UserBusinessService {
try{
result= userBusinessMapperEx.batchDeleteUserBusinessByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
/**
* 通过功能RoleFunctions权限更新应用RoleApp权限
* @param type
* @param keyId
* @param functionIds
* @return
*/
public int insertOrUpdateAppValue(String type, String keyId, String functionIds) throws Exception{
int result=0;
functionIds = functionIds.replaceAll("\\]\\[", ",").
replaceAll("\\[","").replaceAll("\\]","");
List<Functions> functionsList = functionsService.findByIds(functionIds);
if (!CollectionUtils.isEmpty(functionsList)) {
Set<String> appNumbers = new HashSet<>();
String appNumber;
for (Functions functions : functionsList) {
appNumber = functions.getNumber().substring(0, 2);
appNumbers.add(appNumber);
}
List<String> appNumberList = new ArrayList<>(appNumbers);
List<App> appList = appService.findAppByNumber(appNumberList);
StringBuilder appIdSb = new StringBuilder();
if (!CollectionUtils.isEmpty(appList)) {
for (App app : appList) {
appIdSb.append("[" + app.getId() + "]");
}
List<UserBusiness> userBusinessList = getBasicData(keyId, type);
try{
if(userBusinessList.size() > 0) {
UserBusiness userBusiness = userBusinessList.get(0);
userBusiness.setValue(appIdSb.toString());
result = userBusinessMapper.updateByPrimaryKeySelective(userBusiness);
} else {
UserBusiness userBusiness = new UserBusiness();
userBusiness.setType(type);
userBusiness.setKeyid(keyId);
userBusiness.setValue(appIdSb.toString());
result = userBusinessMapper.insertSelective(userBusiness);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
}
JshException.writeFail(logger, e);
}
return result;
}