新增仓库时给当前用户自动授权
This commit is contained in:
@@ -128,6 +128,26 @@ public class DepotService {
|
|||||||
depot.setType(0);
|
depot.setType(0);
|
||||||
depot.setIsDefault(false);
|
depot.setIsDefault(false);
|
||||||
result=depotMapper.insertSelective(depot);
|
result=depotMapper.insertSelective(depot);
|
||||||
|
//新增仓库时给当前用户自动授权
|
||||||
|
Long userId = userService.getUserId(request);
|
||||||
|
Long depotId = getIdByName(depot.getName());
|
||||||
|
String ubKey = "[" + depotId + "]";
|
||||||
|
List<UserBusiness> ubList = userBusinessService.getBasicData(userId.toString(), "UserDepot");
|
||||||
|
if(ubList ==null || ubList.size() == 0) {
|
||||||
|
JSONObject ubObj = new JSONObject();
|
||||||
|
ubObj.put("type", "UserDepot");
|
||||||
|
ubObj.put("keyId", userId);
|
||||||
|
ubObj.put("value", ubKey);
|
||||||
|
userBusinessService.insertUserBusiness(ubObj, request);
|
||||||
|
} else {
|
||||||
|
UserBusiness ubInfo = ubList.get(0);
|
||||||
|
JSONObject ubObj = new JSONObject();
|
||||||
|
ubObj.put("id", ubInfo.getId());
|
||||||
|
ubObj.put("type", ubInfo.getType());
|
||||||
|
ubObj.put("keyId", ubInfo.getKeyId());
|
||||||
|
ubObj.put("value", ubInfo.getValue() + ubKey);
|
||||||
|
userBusinessService.updateUserBusiness(ubObj, request);
|
||||||
|
}
|
||||||
logService.insertLog("仓库",
|
logService.insertLog("仓库",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depot.getName()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depot.getName()).toString(), request);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
|||||||
Reference in New Issue
Block a user