Commit 31fd1b65 authored by 季圣华's avatar 季圣华
Browse files

新增仓库时给当前用户自动授权

parent 08f2ccdd
......@@ -128,6 +128,26 @@ public class DepotService {
depot.setType(0);
depot.setIsDefault(false);
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("仓库",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depot.getName()).toString(), request);
}catch(Exception e){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment