给接口移除角色类型的参数逻辑

This commit is contained in:
季圣华
2023-11-18 21:22:17 +08:00
parent 8ccb855472
commit 2efb0894fe
11 changed files with 64 additions and 96 deletions

View File

@@ -32,7 +32,6 @@ public class AccountHeadComponent implements ICommonQuery {
private List<?> getAccountHeadList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String type = StringUtil.getInfo(search, "type");
String roleType = StringUtil.getInfo(search, "roleType");
String billNo = StringUtil.getInfo(search, "billNo");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
@@ -43,7 +42,7 @@ public class AccountHeadComponent implements ICommonQuery {
String status = StringUtil.getInfo(search, "status");
String remark = StringUtil.getInfo(search, "remark");
String number = StringUtil.getInfo(search, "number");
return accountHeadService.select(type, roleType, billNo, beginTime, endTime, organId, creator, handsPersonId,
return accountHeadService.select(type, billNo, beginTime, endTime, organId, creator, handsPersonId,
accountId, status, remark, number, QueryUtils.offset(map), QueryUtils.rows(map));
}
@@ -51,7 +50,6 @@ public class AccountHeadComponent implements ICommonQuery {
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String type = StringUtil.getInfo(search, "type");
String roleType = StringUtil.getInfo(search, "roleType");
String billNo = StringUtil.getInfo(search, "billNo");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
@@ -62,7 +60,7 @@ public class AccountHeadComponent implements ICommonQuery {
String status = StringUtil.getInfo(search, "status");
String remark = StringUtil.getInfo(search, "remark");
String number = StringUtil.getInfo(search, "number");
return accountHeadService.countAccountHead(type, roleType, billNo, beginTime, endTime, organId, creator, handsPersonId,
return accountHeadService.countAccountHead(type, billNo, beginTime, endTime, organId, creator, handsPersonId,
accountId, status, remark, number);
}

View File

@@ -89,12 +89,12 @@ public class AccountHeadService {
return list;
}
public List<AccountHeadVo4ListEx> select(String type, String roleType, String billNo, String beginTime, String endTime,
public List<AccountHeadVo4ListEx> select(String type, String billNo, String beginTime, String endTime,
Long organId, Long creator, Long handsPersonId, Long accountId, String status,
String remark, String number, int offset, int rows) throws Exception{
List<AccountHeadVo4ListEx> resList = new ArrayList<>();
try{
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo,
@@ -131,12 +131,12 @@ public class AccountHeadService {
return resList;
}
public Long countAccountHead(String type, String roleType, String billNo, String beginTime, String endTime,
public Long countAccountHead(String type, String billNo, String beginTime, String endTime,
Long organId, Long creator, Long handsPersonId, Long accountId, String status,
String remark, String number) throws Exception{
Long result=null;
try{
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
result = accountHeadMapperEx.countsByAccountHead(type, creatorArray, billNo,
@@ -149,17 +149,13 @@ public class AccountHeadService {
/**
* 根据角色类型获取操作员数组
* @param roleType
* @return
* @throws Exception
*/
private String[] getCreatorArray(String roleType) throws Exception {
private String[] getCreatorArray() throws Exception {
String creator = "";
User user = userService.getCurrentUser();
//再从后端获取一次角色类型,防止前端关闭了缓存功能
if(StringUtil.isEmpty(roleType)) {
roleType = userService.getRoleTypeByUserId(user.getId()).getType(); //角色类型
}
String roleType = userService.getRoleTypeByUserId(user.getId()).getType(); //角色类型
if(BusinessConstants.ROLE_TYPE_PRIVATE.equals(roleType)) {
creator = user.getId().toString();
} else if(BusinessConstants.ROLE_TYPE_THIS_ORG.equals(roleType)) {

View File

@@ -33,7 +33,6 @@ public class DepotHeadComponent implements ICommonQuery {
String search = map.get(Constants.SEARCH);
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
@@ -47,7 +46,7 @@ public class DepotHeadComponent implements ICommonQuery {
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String remark = StringUtil.getInfo(search, "remark");
return depotHeadService.select(type, subType, roleType, hasDebt, status, purchaseStatus, number, linkNumber,
return depotHeadService.select(type, subType, hasDebt, status, purchaseStatus, number, linkNumber,
beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark, QueryUtils.offset(map), QueryUtils.rows(map));
}
@@ -56,7 +55,6 @@ public class DepotHeadComponent implements ICommonQuery {
String search = map.get(Constants.SEARCH);
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String roleType = StringUtil.getInfo(search, "roleType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
@@ -70,7 +68,7 @@ public class DepotHeadComponent implements ICommonQuery {
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String remark = StringUtil.getInfo(search, "remark");
return depotHeadService.countDepotHead(type, subType, roleType, hasDebt, status, purchaseStatus, number, linkNumber,
return depotHeadService.countDepotHead(type, subType, hasDebt, status, purchaseStatus, number, linkNumber,
beginTime, endTime, materialParam, organId, creator, depotId, accountId, remark);
}

View File

@@ -109,7 +109,7 @@ public class DepotHeadService {
return list;
}
public List<DepotHeadVo4List> select(String type, String subType, String roleType, String hasDebt, String status, String purchaseStatus, String number, String linkNumber,
public List<DepotHeadVo4List> select(String type, String subType, String hasDebt, String status, String purchaseStatus, String number, String linkNumber,
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark, int offset, int rows) throws Exception {
List<DepotHeadVo4List> resList = new ArrayList<>();
try{
@@ -118,7 +118,7 @@ public class DepotHeadService {
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
String billCategory = getBillCategory(subType);
String [] depotArray = getDepotArray(subType);
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
String [] purchaseStatusArray = StringUtil.isNotEmpty(purchaseStatus) ? purchaseStatus.split(",") : null;
String [] organArray = getOrganArray(subType, purchaseStatus);
@@ -221,12 +221,12 @@ public class DepotHeadService {
return resList;
}
public Long countDepotHead(String type, String subType, String roleType, String hasDebt, String status, String purchaseStatus, String number, String linkNumber,
public Long countDepotHead(String type, String subType, String hasDebt, String status, String purchaseStatus, String number, String linkNumber,
String beginTime, String endTime, String materialParam, Long organId, Long creator, Long depotId, Long accountId, String remark) throws Exception{
Long result=null;
try{
String [] depotArray = getDepotArray(subType);
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
String [] statusArray = StringUtil.isNotEmpty(status) ? status.split(",") : null;
String [] purchaseStatusArray = StringUtil.isNotEmpty(purchaseStatus) ? purchaseStatus.split(",") : null;
String [] organArray = getOrganArray(subType, purchaseStatus);
@@ -257,12 +257,11 @@ public class DepotHeadService {
/**
* 根据角色类型获取操作员数组
* @param roleType
* @return
* @throws Exception
*/
public String[] getCreatorArray(String roleType) throws Exception {
String creator = getCreatorByRoleType(roleType);
public String[] getCreatorArray() throws Exception {
String creator = getCreatorByCurrentUser();
String [] creatorArray=null;
if(StringUtil.isNotEmpty(creator)){
creatorArray = creator.split(",");
@@ -305,17 +304,13 @@ public class DepotHeadService {
/**
* 根据角色类型获取操作员
* @param roleType
* @return
* @throws Exception
*/
public String getCreatorByRoleType(String roleType) throws Exception {
public String getCreatorByCurrentUser() throws Exception {
String creator = "";
User user = userService.getCurrentUser();
//再从后端获取一次角色类型,防止前端关闭了缓存功能
if(StringUtil.isEmpty(roleType)) {
roleType = userService.getRoleTypeByUserId(user.getId()).getType(); //角色类型
}
String roleType = userService.getRoleTypeByUserId(user.getId()).getType(); //角色类型
if(BusinessConstants.ROLE_TYPE_PRIVATE.equals(roleType)) {
creator = user.getId().toString();
} else if(BusinessConstants.ROLE_TYPE_THIS_ORG.equals(roleType)) {
@@ -677,10 +672,10 @@ public class DepotHeadService {
}
public List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type, Boolean forceFlag, String materialParam,
List<Long> depotList, Integer oId, String roleType, Integer offset, Integer rows)throws Exception {
List<Long> depotList, Integer oId, Integer offset, Integer rows)throws Exception {
List<DepotHeadVo4InOutMCount> list = null;
try{
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
String subType = "出库".equals(type)? "销售" : "";
String [] organArray = getOrganArray(subType, "");
list =depotHeadMapperEx.findInOutMaterialCount(beginTime, endTime, type, forceFlag, materialParam, depotList, oId,
@@ -692,10 +687,10 @@ public class DepotHeadService {
}
public int findInOutMaterialCountTotal(String beginTime, String endTime, String type, Boolean forceFlag, String materialParam,
List<Long> depotList, Integer oId, String roleType)throws Exception {
List<Long> depotList, Integer oId)throws Exception {
int result = 0;
try{
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
String subType = "出库".equals(type)? "销售" : "";
String [] organArray = getOrganArray(subType, "");
result =depotHeadMapperEx.findInOutMaterialCountTotal(beginTime, endTime, type, forceFlag, materialParam, depotList, oId,
@@ -1132,10 +1127,10 @@ public class DepotHeadService {
}
public Map<String, Object> getBuyAndSaleStatistics(String today, String monthFirstDay, String yesterdayBegin, String yesterdayEnd,
String yearBegin, String yearEnd, String roleType, HttpServletRequest request) throws Exception {
String yearBegin, String yearEnd, HttpServletRequest request) throws Exception {
Long userId = userService.getUserId(request);
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
Map<String, Object> map = new HashMap<>();
//今日
BigDecimal todayBuy = getBuyAndSaleBasicStatistics("入库", "采购",
@@ -1232,12 +1227,12 @@ public class DepotHeadService {
}
public List<DepotHeadVo4List> debtList(Long organId, String materialParam, String number, String beginTime, String endTime,
String roleType, String status, Integer offset, Integer rows) {
String status, Integer offset, Integer rows) {
List<DepotHeadVo4List> resList = new ArrayList<>();
try{
String depotIds = depotService.findDepotStrByCurrentUser();
String [] depotArray=depotIds.split(",");
String [] creatorArray = getCreatorArray(roleType);
String [] creatorArray = getCreatorArray();
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<DepotHeadVo4List> list=depotHeadMapperEx.debtList(organId, creatorArray, status, number,
@@ -1252,12 +1247,12 @@ public class DepotHeadService {
}
public int debtListCount(Long organId, String materialParam, String number, String beginTime, String endTime,
String roleType, String status) {
String status) {
int total = 0;
try {
String depotIds = depotService.findDepotStrByCurrentUser();
String[] depotArray = depotIds.split(",");
String[] creatorArray = getCreatorArray(roleType);
String[] creatorArray = getCreatorArray();
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime, BusinessConstants.DAY_LAST_TIME);
total = depotHeadMapperEx.debtListCount(organId, creatorArray, status, number,
@@ -1269,7 +1264,7 @@ public class DepotHeadService {
}
public void debtExport(Long organId, String materialParam, String number, String type, String subType,
String beginTime, String endTime, String roleType, String status, String mpList,
String beginTime, String endTime, String status, String mpList,
HttpServletRequest request, HttpServletResponse response) {
try {
Long userId = userService.getUserId(request);
@@ -1277,7 +1272,7 @@ public class DepotHeadService {
String billCategory = getBillCategory(subType);
String depotIds = depotService.findDepotStrByCurrentUser();
String[] depotArray = depotIds.split(",");
String[] creatorArray = getCreatorArray(roleType);
String[] creatorArray = getCreatorArray();
status = StringUtil.isNotEmpty(status) ? status : null;
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime, BusinessConstants.DAY_LAST_TIME);

View File

@@ -365,10 +365,10 @@ public class DepotItemService {
* @return
* @throws Exception
*/
public BigDecimal inOrOutPrice(String type, String subType, String month, String roleType) throws Exception{
public BigDecimal inOrOutPrice(String type, String subType, String month) throws Exception{
BigDecimal result= BigDecimal.ZERO;
try{
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
String [] creatorArray = depotHeadService.getCreatorArray();
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
String beginTime = Tools.firstDayOfMonth(month) + BusinessConstants.DAY_FIRST_TIME;
String endTime = Tools.lastDayOfMonth(month) + BusinessConstants.DAY_LAST_TIME;
@@ -387,10 +387,10 @@ public class DepotItemService {
* @return
* @throws Exception
*/
public BigDecimal inOrOutRetailPrice(String type, String subType, String month, String roleType) throws Exception{
public BigDecimal inOrOutRetailPrice(String type, String subType, String month) throws Exception{
BigDecimal result= BigDecimal.ZERO;
try{
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
String [] creatorArray = depotHeadService.getCreatorArray();
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
String beginTime = Tools.firstDayOfMonth(month) + BusinessConstants.DAY_FIRST_TIME;
String endTime = Tools.lastDayOfMonth(month) + BusinessConstants.DAY_LAST_TIME;

View File

@@ -37,8 +37,7 @@ public class SupplierComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
String roleType = StringUtil.getInfo(search, "roleType");
return supplierService.select(supplier, type, phonenum, telephone, roleType, QueryUtils.offset(map), QueryUtils.rows(map));
return supplierService.select(supplier, type, phonenum, telephone, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
@@ -48,8 +47,7 @@ public class SupplierComponent implements ICommonQuery {
String type = StringUtil.getInfo(search, "type");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
String roleType = StringUtil.getInfo(search, "roleType");
return supplierService.countSupplier(supplier, type, phonenum, telephone, roleType);
return supplierService.countSupplier(supplier, type, phonenum, telephone);
}
@Override

View File

@@ -96,10 +96,10 @@ public class SupplierService {
return list;
}
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, String roleType, int offset, int rows) throws Exception{
public List<Supplier> select(String supplier, String type, String phonenum, String telephone, int offset, int rows) throws Exception{
List<Supplier> resList = new ArrayList<Supplier>();
try{
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
String [] creatorArray = depotHeadService.getCreatorArray();
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, creatorArray, offset, rows);
for(Supplier s : list) {
Integer supplierId = s.getId().intValue();
@@ -152,10 +152,10 @@ public class SupplierService {
return resList;
}
public Long countSupplier(String supplier, String type, String phonenum, String telephone, String roleType) throws Exception{
public Long countSupplier(String supplier, String type, String phonenum, String telephone) throws Exception{
Long result=null;
try{
String [] creatorArray = depotHeadService.getCreatorArray(roleType);
String [] creatorArray = depotHeadService.getCreatorArray();
result=supplierMapperEx.countsBySupplier(supplier, type, phonenum, telephone, creatorArray);
}catch(Exception e){
JshException.readFail(logger, e);

View File

@@ -350,7 +350,6 @@ public class UserService {
data.put("msgTip", msgTip);
if(user!=null){
String roleType = getRoleTypeByUserId(user.getId()).getType(); //角色类型
redisService.storageObjectBySession(token,"roleType",roleType);
redisService.storageObjectBySession(token,"clientIp", Tools.getLocalIp(request));
logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getLoginName()).toString(),