Просмотр исходного кода

修复 保存房屋 userId为空的问题

wuxw лет назад: 6
Родитель
Сommit
6c9ddc2eac

+ 3 - 0
Api/src/main/java/com/java110/api/listener/room/BindingAddRoomBindingListener.java

@@ -57,15 +57,18 @@ public class BindingAddRoomBindingListener extends AbstractServiceApiListener {
         JSONObject addRoomView = getObj(infos, "addRoomView");
         if (!hasKey(viewFloorInfo, "floorId")) {
             viewFloorInfo.put("floorId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_floorId));
+            viewFloorInfo.put("userId", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
             businesses.add(addBusinessFloor(viewFloorInfo, context));
         }
         if (!hasKey(viewUnitInfo, "unitId")) {
             viewUnitInfo.put("unitId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_unitId));
+            viewUnitInfo.put("userId", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
             viewUnitInfo.put("unitId", viewFloorInfo.getString("floorId"));
             businesses.add(addBusinessUnit(viewUnitInfo, context));
         }
         if (!hasKey(addRoomView, "roomId")) {
             addRoomView.put("roomId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_roomId));
+            addRoomView.put("userId", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
             addRoomView.put("unitId", viewUnitInfo.getString("unitId"));
             businesses.add(addBusinessRoom(addRoomView, context));
         }

+ 1 - 0
java110-code-generator/src/main/java/com/java110/code/relationship/GeneratorBindingComponent.java

@@ -411,6 +411,7 @@ public class GeneratorBindingComponent extends BaseGenerator {
             ifCode.append("" +
                     "        if(!hasKey("+vcName+", \"" + flowObj.getString("flowKey") + "\")){\n" +
                     "             "+vcName+".put(\"" + flowObj.getString("flowKey") + "\", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_" + flowObj.getString("flowKey") + "));\n" +
+                    "             "+vcName+".put(\"userId\", context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));\n" +
                     "             businesses.add(add" + toUpperCaseFirstOne(flowObj.getString("businessName")) + "("+vcName+", context));\n" +
                     "        }\n");