java110
2021-09-06 f278bf1dc5f6091b60acea56a5c19d1fa24a8aff
service-front/src/main/java/com/java110/front/smo/impl/PrivilegeServiceSMOImpl.java
old mode 100644 new mode 100755
@@ -4,10 +4,12 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.component.BaseComponentSMO;
import com.java110.core.context.IPageData;
import com.java110.core.smo.IGetCommunityStoreInfoSMO;
import com.java110.front.smo.IPrivilegeServiceSMO;
import com.java110.utils.constant.ServiceConstant;
import com.java110.utils.util.Assert;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
@@ -20,6 +22,9 @@
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private IGetCommunityStoreInfoSMO getCommunityStoreInfoSMOImpl;
    /**
     * 查询 权限组
@@ -295,7 +300,7 @@
        JSONObject privilegeInfoObj = JSONObject.parseObject(pd.getReqData());
        Assert.jsonObjectHaveKey(privilegeInfoObj, "pgId", "请求报文中未包含权限组ID 节点");
        Assert.jsonObjectHaveKey(privilegeInfoObj, "pId", "请求报文中未包含权限ID 节点");
        //Assert.jsonObjectHaveKey(privilegeInfoObj, "pId", "请求报文中未包含权限ID 节点");
        ResponseEntity<String> storeInfo = super.getStoreInfo(pd, restTemplate);
@@ -322,7 +327,11 @@
        Assert.hasLength(pd.getUserId(), "用户未登录请先登录");
        JSONObject privilegeInfoObj = JSONObject.parseObject(pd.getReqData());
        Assert.jsonObjectHaveKey(privilegeInfoObj, "staffId", "请求报文中未包含员工ID 节点");
        //Assert.jsonObjectHaveKey(privilegeInfoObj, "staffId", "请求报文中未包含员工ID 节点");
        if (!privilegeInfoObj.containsKey("staffId")) {
            privilegeInfoObj.put("staffId", pd.getUserId());
        }
        ResponseEntity<String> storeInfo = super.getStoreInfo(pd, restTemplate);
@@ -337,6 +346,9 @@
        ResponseEntity<String> privilegeGroup = super.callCenterService(restTemplate, pd, "",
                ServiceConstant.SERVICE_API_URL + "/api/query.user.privilege?userId=" + privilegeInfoObj.getString("staffId") + "&domain=" + storeInfoObj.getString("storeTypeCd"), HttpMethod.GET);
//        ResultVo resultVo = getCommunityStoreInfoSMOImpl.getUserPrivileges(pd, privilegeInfoObj.getString("staffId"), storeInfoObj.getString("storeTypeCd"), restTemplate);
//        ResponseEntity<String> privilegeGroup = new ResponseEntity<>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST);
        if (privilegeGroup.getStatusCode() != HttpStatus.OK) {
            return privilegeGroup;
        }
@@ -344,6 +356,14 @@
        JSONArray privileges = resultObj.getJSONArray("privileges");
        JSONArray tmpPrivilegeArrays = new JSONArray();
        JSONObject privilegeObj = null;
        for (int privilegeIndex = 0; privilegeIndex < privileges.size(); privilegeIndex++) {
            privilegeObj = privileges.getJSONObject(privilegeIndex);
            hasSameData(privilegeObj, tmpPrivilegeArrays);
        }
        JSONObject resObj = new JSONObject();
        resObj.put("datas", privileges);