tianboguang 3 år sedan
förälder
incheckning
a204f94c20

+ 18 - 0
platform-common/src/main/java/com/platform/service/impl/ZhiHouseService.java

@@ -315,4 +315,22 @@ public class ZhiHouseService {
         List<JSONObject> message = JSONArray.parseArray(JSONArray.toJSONString(responseEntity.getBody().getMessage()),JSONObject.class);
         return message;
     }
+
+    public JSONObject getSysUserListPageByDeptIdsAndUserName(Long deptId,Long page,Long limit, String username) {
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("username", username);
+        mp.put("companyId", deptId);
+        mp.put("page", page);
+        mp.put("limit", limit);
+        String url = zhiHouseHost + "api/shop/queryAllUserPageByDeptIdAndUserName";
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        if(responseEntity.getStatusCode()!= HttpStatus.OK){
+            throw new CommonBaseException(ResultCodeEnum.D100);
+        }
+        if (responseEntity.getBody().getCode() != 200) {
+            throw new CommonBaseException(ResultCodeEnum.D100,responseEntity.getBody().getError());
+        }
+        //把信息封装为json
+        return JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getMessage()));
+    }
 }

+ 59 - 0
platform-shop/src/main/java/com/platform/controller/SysUserController.java

@@ -0,0 +1,59 @@
+package com.platform.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.platform.entity.Result;
+import com.platform.entity.SysUserBrand;
+import com.platform.service.custom.MySysUserBrandService;
+import com.platform.service.impl.ZhiHouseService;
+import com.platform.utils.PageUtilsPlus;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 系统用户
+ *
+ * @author lipengjun
+ * @email 939961241@qq.com
+ * @date 2016年10月31日 上午10:40:10
+ */
+@RestController
+@RequestMapping("/sys/user")
+@Slf4j
+public class SysUserController extends AbstractController {
+
+    @Autowired
+    private MySysUserBrandService mySysUserBrandService;
+
+    @Autowired
+    private ZhiHouseService zhiHouseService;
+
+    /**
+     * 店铺绑定的用户列表
+     */
+    @PostMapping("/bindList")
+    public Result userBindList(@RequestBody JSONObject param) {
+        // 查询用户信息
+        JSONObject result = zhiHouseService.getSysUserListPageByDeptIdsAndUserName(getDeptId(),
+                param.getLong("page"),param.getLong("limit"), param.getString("username"));
+        List<Object> users = result.getJSONArray("records");
+        if(!ObjectUtils.isEmpty(users)){
+            users.stream().map(object->JSONObject.parseObject(JSONObject.toJSONString(object))).forEach(user->{
+                // 查找直播间数据
+                SysUserBrand userBrand = mySysUserBrandService.getUserBrandById(user.getLong("id"), param.getInteger("brandId"));
+                if(!ObjectUtils.isEmpty(userBrand.getCanShow())){
+                    user.put("canShow",userBrand.getCanShow());
+                }
+            });
+        }
+        // 处理场景数据
+        PageUtilsPlus pageResult = PageUtilsPlus.page(users, result.getLong("totalCount"), param.getLong("limit"), param.getLong("page"));
+        return Result.success(pageResult);
+    }
+}