| | |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.privilege.BasePrivilegeDto; |
| | | import com.java110.dto.store.StoreDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.entity.component.ComponentValidateResult; |
| | | import com.java110.dto.system.ComponentValidateResult; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.intf.user.IUserInnerServiceSMO; |
| | | import com.java110.utils.cache.PrivilegeCache; |
| | | import com.java110.utils.constant.CommonConstant; |
| | |
| | | private static final String URL_API = ""; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private WechatAuthProperties wechatAuthProperties; |
| | | |
| | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IGetCommunityStoreInfoSMO getCommunityStoreInfoSMOImpl; |
| | | |
| | | //微信支付 |
| | | public static final String DOMAIN_WECHAT_PAY = "WECHAT_PAY"; |
| | | // 微信服务商支付开关 |
| | |
| | | private static final String WECHAT_SERVICE_APP_ID = "SERVICE_APP_ID"; |
| | | |
| | | private static final String WECHAT_SERVICE_MCH_ID = "SERVICE_MCH_ID"; |
| | | |
| | | |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | headers.put(CommonConstant.USER_ID, StringUtil.isEmpty(pd.getUserId()) ? "-1" : pd.getUserId()); |
| | | |
| | | if (!headers.containsKey(CommonConstant.HTTP_USER_ID)) { |
| | | headers.put(CommonConstant.HTTP_USER_ID, StringUtil.isEmpty(pd.getUserId()) ? "-1" : pd.getUserId()); |
| | | } |
| | | if (!headers.containsKey(CommonConstant.HTTP_APP_ID)) { |
| | | headers.put(CommonConstant.HTTP_APP_ID, pd.getAppId()); |
| | | |
| | | } |
| | | if (!headers.containsKey(CommonConstant.APP_ID)) { |
| | | headers.put(CommonConstant.APP_ID, pd.getAppId()); |
| | | } |
| | | if (!headers.containsKey(CommonConstant.HTTP_TRANSACTION_ID)) { |
| | | headers.put(CommonConstant.HTTP_TRANSACTION_ID, GenerateCodeFactory.getUUID()); |
| | |
| | | headers.put(CommonConstant.HTTP_USER_ID, "-1"); |
| | | } |
| | | |
| | | headers.put(CommonConstant.USER_ID, "-1"); |
| | | |
| | | if (!headers.containsKey(CommonConstant.HTTP_USER_ID)) { |
| | | headers.put(CommonConstant.HTTP_USER_ID, "-1"); |
| | | if (!headers.containsKey(CommonConstant.USER_ID)) { |
| | | headers.put(CommonConstant.USER_ID, "-1"); |
| | | } |
| | | if (!headers.containsKey(CommonConstant.HTTP_TRANSACTION_ID)) { |
| | | headers.put(CommonConstant.HTTP_TRANSACTION_ID, GenerateCodeFactory.getUUID()); |
| | |
| | | if (basePrivilegeDtos == null || basePrivilegeDtos.size() < 1) { |
| | | return; |
| | | } |
| | | String tmpResource = null; |
| | | boolean hasPrivilege = false; |
| | | for (BasePrivilegeDto privilegeDto : basePrivilegeDtos) { |
| | | if (resource.equals(privilegeDto.getResource())) { |
| | |
| | | return; |
| | | } |
| | | |
| | | ResultVo resultVo = null; |
| | | if (resultVo == null || |
| | | resultVo.getCode() != ResultVo.CODE_OK) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | JSONArray privileges = JSONArray.parseArray(resultVo.getMsg()); |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource(resource); |
| | | basePrivilegeDto.setUserId(pd.getUserId()); |
| | | List<Map> privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto); |
| | | |
| | | hasPrivilege = false; |
| | | if (privileges == null || privileges.size() < 1) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | |
| | | hasPrivilege = false; |
| | | for (int privilegeIndex = 0; privilegeIndex < privileges.size(); privilegeIndex++) { |
| | | tmpResource = privileges.getJSONObject(privilegeIndex).getString("resource"); |
| | | if (resource.equals(tmpResource)) { |
| | | if (resource.equals(privileges.get(privilegeIndex).get("resource"))) { |
| | | hasPrivilege = true; |
| | | break; |
| | | } |
| | |
| | | protected ResponseEntity<String> getStoreInfo(IPageData pd, RestTemplate restTemplate) { |
| | | Assert.hasLength(pd.getUserId(), "用户未登录请先登录"); |
| | | |
| | | ResultVo resultVo = null; |
| | | |
| | | ResultVo resultVo = getCommunityStoreInfoSMOImpl.getStoreInfo(pd, restTemplate, pd.getUserId()); |
| | | logger.debug("ruleId getStoreInfo :{}", resultVo.toString()); |
| | | return new ResponseEntity<String>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | private ResponseEntity<String> getStoreEnterCommunitys(IPageData pd, String storeId, String storeTypeCd, RestTemplate restTemplate) { |
| | | ResultVo resultVo = null; |
| | | ResultVo resultVo = getCommunityStoreInfoSMOImpl.getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate); |
| | | return new ResponseEntity<String>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | } |
| | | |