增加仓库和客户配置开关(全部完成)
This commit is contained in:
@@ -12,6 +12,7 @@ import com.jsh.erp.datasource.entities.Depot;
|
||||
import com.jsh.erp.datasource.entities.DepotEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.depot.DepotService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.*;
|
||||
import org.slf4j.Logger;
|
||||
@@ -40,6 +41,9 @@ public class DepotController {
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@GetMapping(value = "/getAllList")
|
||||
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
@@ -102,6 +106,14 @@ public class DepotController {
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户拥有权限的仓库列表
|
||||
* @param type
|
||||
* @param keyId
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/findDepotByUserId")
|
||||
public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
|
||||
HttpServletRequest request) throws Exception{
|
||||
@@ -110,6 +122,7 @@ public class DepotController {
|
||||
List<Depot> dataList = depotService.findUserDepot();
|
||||
//开始拼接json数据
|
||||
if (null != dataList) {
|
||||
boolean depotFlag = systemConfigService.getDepotFlag();
|
||||
for (Depot depot : dataList) {
|
||||
JSONObject item = new JSONObject();
|
||||
//勾选判断1
|
||||
@@ -119,7 +132,7 @@ public class DepotController {
|
||||
} catch (DataAccessException e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
|
||||
}
|
||||
if (flag == true) {
|
||||
if (!depotFlag || flag) {
|
||||
item.put("id", depot.getId());
|
||||
item.put("depotName", depot.getName());
|
||||
arr.add(item);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.Supplier;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.supplier.SupplierService;
|
||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||
import com.jsh.erp.utils.*;
|
||||
@@ -44,6 +45,10 @@ public class SupplierController {
|
||||
|
||||
@Resource
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@@ -81,6 +86,7 @@ public class SupplierController {
|
||||
List<Supplier> supplierList = supplierService.findBySelectCus();
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != supplierList) {
|
||||
boolean depotFlag = systemConfigService.getDepotFlag();
|
||||
for (Supplier supplier : supplierList) {
|
||||
JSONObject item = new JSONObject();
|
||||
//勾选判断1
|
||||
@@ -90,7 +96,7 @@ public class SupplierController {
|
||||
} catch (DataAccessException e) {
|
||||
logger.error(">>>>>>>>>>>>>>>>>查询用户对应的客户:存在异常!");
|
||||
}
|
||||
if (flag == true) {
|
||||
if (!depotFlag || flag) {
|
||||
item.put("id", supplier.getId());
|
||||
item.put("supplier", supplier.getSupplier()); //客户名称
|
||||
dataArray.add(item);
|
||||
|
||||
@@ -187,4 +187,38 @@ public class SystemConfigService {
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user