1个文件已删除
33个文件已修改
2 文件已重命名
4个文件已添加
| New file |
| | |
| | | package com.java110.dto; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class CmdListenerDto implements Serializable { |
| | | private String beanName; |
| | | |
| | | private String serviceCode; |
| | | |
| | | public CmdListenerDto() { |
| | | } |
| | | |
| | | public CmdListenerDto(String beanName, String serviceCode) { |
| | | this.beanName = beanName; |
| | | this.serviceCode = serviceCode; |
| | | } |
| | | |
| | | public String getBeanName() { |
| | | return beanName; |
| | | } |
| | | |
| | | public void setBeanName(String beanName) { |
| | | this.beanName = beanName; |
| | | } |
| | | |
| | | public String getServiceCode() { |
| | | return serviceCode; |
| | | } |
| | | |
| | | public void setServiceCode(String serviceCode) { |
| | | this.serviceCode = serviceCode; |
| | | } |
| | | } |
| | |
| | | package com.java110.core.annotation; |
| | | |
| | | import com.java110.dto.CmdListenerDto; |
| | | import com.java110.utils.util.Assert; |
| | | import org.springframework.beans.factory.BeanClassLoaderAware; |
| | | import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; |
| | |
| | | Java110Cmd.class.getCanonicalName()); |
| | | |
| | | String beanName = getListenerName(attributes,beanDefinition); |
| | | String serviceCode = attributes.get("serviceCode").toString(); |
| | | |
| | | |
| | | /*BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(beanDefinition, beanName); |
| | | BeanDefinitionReaderUtils.registerBeanDefinition(definitionHolder, registry);*/ |
| | | Method method = cmdPublishClass.getMethod("addListener",String.class); |
| | | method.invoke(null,beanName); |
| | | Method method = cmdPublishClass.getMethod("addListener", CmdListenerDto.class); |
| | | method.invoke(null,new CmdListenerDto(beanName,serviceCode)); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.context.PageData; |
| | | import com.java110.core.factory.DataFlowFactory; |
| | | import com.java110.core.smo.IGetCommunityStoreInfoSMO; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.utils.cache.PrivilegeCache; |
| | | import com.java110.utils.constant.CommonConstant; |
| | |
| | | */ |
| | | public class BaseController extends AppBase { |
| | | |
| | | @Autowired |
| | | private IGetCommunityStoreInfoSMO getCommunityStoreInfoSMOImpl; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return businessServiceDataFlow; |
| | | } |
| | | |
| | | protected void hasPrivilege(RestTemplate restTemplate, IPageData pd, String resource) { |
| | | ResponseEntity<String> responseEntity = null; |
| | | //没有用户的情况下不做权限判断 |
| | | if (StringUtil.isEmpty(pd.getUserId())) { |
| | | return; |
| | | } |
| | | JSONObject paramIn = new JSONObject(); |
| | | //paramIn.put("resource", resource); |
| | | paramIn.put("userId", pd.getUserId()); |
| | | |
| | | //校验资源路劲是否定义权限 |
| | | List<BasePrivilegeDto> basePrivilegeDtos = PrivilegeCache.getPrivileges(); |
| | | if (basePrivilegeDtos == null || basePrivilegeDtos.size() < 1) { |
| | | return; |
| | | } |
| | | String tmpResource = null; |
| | | boolean hasPrivilege = false; |
| | | for (BasePrivilegeDto privilegeDto : basePrivilegeDtos) { |
| | | if (resource.equals(privilegeDto.getResource())) { |
| | | hasPrivilege = true; |
| | | } |
| | | } |
| | | if (!hasPrivilege) { //权限没有配置,直接跳过 |
| | | return; |
| | | } |
| | | |
| | | ResultVo resultVo = getCommunityStoreInfoSMOImpl.checkUserHasResourceListener(restTemplate, pd, paramIn, pd.getUserId()); |
| | | if (resultVo == null || resultVo.getCode() != ResultVo.CODE_OK) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | JSONArray privileges = JSONArray.parseArray(resultVo.getMsg()); |
| | | |
| | | hasPrivilege = false; |
| | | if (privileges == null || privileges.size() < 1) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | for (int privilegeIndex = 0; privilegeIndex < privileges.size(); privilegeIndex++) { |
| | | tmpResource = privileges.getJSONObject(privilegeIndex).getString("resource"); |
| | | if (resource.equals(tmpResource)) { |
| | | hasPrivilege = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!hasPrivilege) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.smo.IGetCommunityStoreInfoSMO; |
| | | import com.java110.entity.component.ComponentValidateResult; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.exception.SMOException; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.Assert; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by wuxw on 2019/3/22. |
| | |
| | | |
| | | protected static final int MAX_ROW = 50; |
| | | |
| | | @Autowired(required = false) |
| | | private IGetCommunityStoreInfoSMO getCommunityStoreInfoSMOImpl; |
| | | |
| | | /** |
| | | * 调用组件 |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询商户信息 |
| | | * |
| | | * @return |
| | | */ |
| | | protected ResponseEntity<String> getStoreInfo(IPageData pd, RestTemplate restTemplate) { |
| | | Assert.hasLength(pd.getUserId(), "用户未登录请先登录"); |
| | | |
| | | ResultVo resultVo = getCommunityStoreInfoSMOImpl.getStoreInfo(pd, restTemplate, pd.getUserId()); |
| | | |
| | | 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 = getCommunityStoreInfoSMOImpl.getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate); |
| | | return new ResponseEntity<String>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | /** |
| | | * 查询商户信息 |
| | | * |
| | | * @return |
| | | */ |
| | | protected void checkStoreEnterCommunity(IPageData pd, String storeId, String storeTypeCd, String communityId, RestTemplate restTemplate) { |
| | | Assert.hasLength(pd.getUserId(), "用户未登录请先登录"); |
| | | ResponseEntity<String> responseEntity = null; |
| | | responseEntity = getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "还未入驻小区,请先入驻小区"); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "data", "还未入驻小区,请先入驻小区"); |
| | | |
| | | JSONObject community = JSONObject.parseObject(responseEntity.getBody().toString()); |
| | | |
| | | JSONArray communitys = community.getJSONArray("data"); |
| | | |
| | | if (communitys == null || communitys.size() == 0) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "还未入驻小区,请先入驻小区"); |
| | | } |
| | | |
| | | JSONObject currentCommunity = getCurrentCommunity(communitys, communityId); |
| | | |
| | | if (currentCommunity == null) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "传入小区ID非法,请正常操作"); |
| | | } |
| | | |
| | | } |
| | | |
| | | private JSONObject getCurrentCommunity(JSONArray communitys, String communityId) { |
| | | for (int communityIndex = 0; communityIndex < communitys.size(); communityIndex++) { |
| | | if (communityId.equals(communitys.getJSONObject(communityIndex).getString("communityId"))) { |
| | | return communitys.getJSONObject(communityIndex); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 校验 员工 商户 小区 关系 |
| | | * <p> |
| | | * 判断员工和商户是否有关系, 商户和 小区是否有关系 |
| | | * |
| | | * @param pd 页面数据封装 |
| | | * @param restTemplate http调用工具 |
| | | * @return ComponentValidateResult 校验对象 |
| | | */ |
| | | protected ComponentValidateResult validateStoreStaffCommunityRelationship(IPageData pd, RestTemplate restTemplate) { |
| | | |
| | | // 校验 员工和商户是否有关系 |
| | | ResponseEntity responseEntity = getStoreInfo(pd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, responseEntity.getBody() + ""); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点"); |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点"); |
| | | |
| | | String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId"); |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | |
| | | JSONObject paramIn = JSONObject.parseObject(pd.getReqData()); |
| | | |
| | | String communityId = ""; |
| | | if (paramIn.containsKey("communityId") && !StringUtil.isEmpty(paramIn.getString("communityId"))) { |
| | | communityId = paramIn.getString("communityId"); |
| | | checkStoreEnterCommunity(pd, storeId, storeTypeCd, communityId, restTemplate); |
| | | } |
| | | return new ComponentValidateResult(storeId, storeTypeCd, communityId, pd.getUserId(), pd.getUserName()); |
| | | } |
| | | |
| | | /** |
| | | * 校验 员工 商户 关系 |
| | | * <p> |
| | | * 判断员工和商户是否有关系, 商户和 是否有关系 |
| | | * |
| | | * @param pd 页面数据封装 |
| | | * @param restTemplate http调用工具 |
| | | * @return ComponentValidateResult 校验对象 |
| | | */ |
| | | protected ComponentValidateResult validateStoreStaffRelationship(IPageData pd, RestTemplate restTemplate) { |
| | | |
| | | // 校验 员工和商户是否有关系 |
| | | ResponseEntity responseEntity = getStoreInfo(pd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, responseEntity.getBody() + ""); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点"); |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点"); |
| | | |
| | | String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId"); |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | |
| | | return new ComponentValidateResult(storeId, storeTypeCd, "", pd.getUserId(), pd.getUserName()); |
| | | } |
| | | |
| | | /** |
| | | * 分页信息校验 |
| | |
| | | //调用builder |
| | | T dataFlowContext = (T)doBuilder(reqInfo, headerAll); |
| | | //后处理 |
| | | afterBuilder((IOrderDataFlowContext) dataFlowContext); |
| | | afterBuilder((ICmdDataFlowContext) dataFlowContext); |
| | | return dataFlowContext; |
| | | } |
| | | |
| | |
| | | */ |
| | | public abstract ICmdDataFlowContext doBuilder(String reqInfo, Map<String,String> headerAll) throws Exception; |
| | | |
| | | protected void afterBuilder(IOrderDataFlowContext dataFlowContext){ |
| | | protected void afterBuilder(ICmdDataFlowContext dataFlowContext){ |
| | | |
| | | } |
| | | |
| | |
| | | import com.java110.core.event.center.DataFlowListenerOrderComparator; |
| | | import com.java110.core.event.service.api.ServiceDataFlowEvent; |
| | | import com.java110.core.event.service.api.ServiceDataFlowListener; |
| | | import com.java110.dto.CmdListenerDto; |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.http.HttpMethod; |
| | | |
| | | import java.lang.annotation.Annotation; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * 保存侦听实例信息,一般启动时加载 |
| | | */ |
| | | private static final List<String> listeners = new ArrayList<String>(); |
| | | private static final List<CmdListenerDto> listeners = new ArrayList<CmdListenerDto>(); |
| | | |
| | | /** |
| | | * 根据 事件类型查询侦听 |
| | |
| | | * |
| | | * @param listener |
| | | */ |
| | | public static void addListener(String listener) { |
| | | public static void addListener(CmdListenerDto listener) { |
| | | listeners.add(listener); |
| | | } |
| | | |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<String> getListeners() { |
| | | public static List<CmdListenerDto> getListeners() { |
| | | return listeners; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<ServiceCmdListener> cmdListeners = new ArrayList<ServiceCmdListener>(); |
| | | for (String listenerBeanName : getListeners()) { |
| | | ServiceCmdListener listener = ApplicationContextFactory.getBean(listenerBeanName, ServiceCmdListener.class); |
| | | Java110Cmd java110Cmd = listener.getClass().getDeclaredAnnotation(Java110Cmd.class); |
| | | if(java110Cmd.serviceCode().equals(serviceCode)) { |
| | | for (CmdListenerDto listenerBean : getListeners()) { |
| | | ServiceCmdListener listener = ApplicationContextFactory.getBean(listenerBean.getBeanName(), ServiceCmdListener.class); |
| | | if(listenerBean.getServiceCode().equals(serviceCode)) { |
| | | cmdListeners.add(listener); |
| | | } |
| | | } |
| | |
| | | && ServiceCodeConstant.SERVICE_CODE_SYSTEM_TRANSFER.equals(serviceCode)) { |
| | | dataFlowListeners.add(listener); |
| | | } |
| | | |
| | | //特殊处理 透传类接口 |
| | | if (ServiceCodeConstant.SERVICE_CODE_SYSTEM_CMD.equals(listener.getServiceCode()) |
| | | && ServiceCodeConstant.SERVICE_CODE_SYSTEM_CMD.equals(serviceCode)) { |
| | | dataFlowListeners.add(listener); |
| | | } |
| | | } |
| | | |
| | | //这里排序 |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | /** |
| | | * 类表述:删除 |
| | | * 服务编码:@@templateCode@@.Delete@@TemplateCode@@ |
| | | * 服务编码:@@templateCode@@.delete@@TemplateCode@@ |
| | | * 请求路劲:/app/@@templateCode@@.Delete@@TemplateCode@@ |
| | | * add by 吴学文 at @@date@@ mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | |
| | | |
| | | /** |
| | | * 类表述:查询 |
| | | * 服务编码:@@templateCode@@.List@@TemplateCode@@ |
| | | * 服务编码:@@templateCode@@.list@@TemplateCode@@ |
| | | * 请求路劲:/app/@@templateCode@@.List@@TemplateCode@@ |
| | | * add by 吴学文 at @@date@@ mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | |
| | | |
| | | /** |
| | | * 类表述:保存 |
| | | * 服务编码:@@templateCode@@.Save@@TemplateCode@@ |
| | | * 服务编码:@@templateCode@@.save@@TemplateCode@@ |
| | | * 请求路劲:/app/@@templateCode@@.Save@@TemplateCode@@ |
| | | * add by 吴学文 at @@date@@ mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | |
| | | |
| | | /** |
| | | * 类表述:更新 |
| | | * 服务编码:@@templateCode@@.Update@@TemplateCode@@ |
| | | * 服务编码:@@templateCode@@.update@@TemplateCode@@ |
| | | * 请求路劲:/app/@@templateCode@@.Update@@TemplateCode@@ |
| | | * add by 吴学文 at @@date@@ mail: 928255095@qq.com |
| | | * open source address: https://gitee.com/wuxw7/MicroCommunity |
| | |
| | | { |
| | | "templateName": "流程实例", |
| | | "templateCode": "oaWorkflow", |
| | | "templateKey": "flowId", |
| | | "templateKeyName": "工作流ID", |
| | | "searchCode": "flowId", |
| | | "searchName": "工作流ID", |
| | | "directories": "property", |
| | | "templateName": "业务轨迹", |
| | | "templateCode": "businessTableHis", |
| | | "templateKey": "hisId", |
| | | "templateKeyName": "轨迹ID", |
| | | "searchCode": "hisId", |
| | | "searchName": "轨迹ID", |
| | | "directories": "dev", |
| | | "conditions": [ |
| | | { |
| | | "name": "流程名称", |
| | | "inputType": "input", |
| | | "code": "flowName", |
| | | "whereCondition": "equal" |
| | | }, |
| | | { |
| | | "name": "描述", |
| | | "inputType": "input", |
| | | "code": "describle", |
| | | "whereCondition": "equal" |
| | | }, |
| | | { |
| | | "name": "流程类型", |
| | | "name": "动作", |
| | | "inputType": "select", |
| | | "selectValue":"1001,2002", |
| | | "selectValueName":"国内,国外", |
| | | "code": "flowType", |
| | | "selectValue":"ADD,MOD,DEL", |
| | | "selectValueName":"添加,修改,删除", |
| | | "code": "action", |
| | | "whereCondition": "equal" |
| | | }, |
| | | { |
| | | "name": "表名", |
| | | "inputType": "input", |
| | | "code": "actionObj", |
| | | "whereCondition": "equal" |
| | | }, |
| | | { |
| | | "name": "业务类型", |
| | | "inputType": "input", |
| | | "code": "businessTypeCd", |
| | | "whereCondition": "equal" |
| | | } |
| | | ], |
| | | "columns": [ |
| | | { |
| | | "code": "flowName", |
| | | "cnCode": "流程名称", |
| | | "desc": "必填,请填写流程名称", |
| | | "code": "businessTypeCd", |
| | | "cnCode": "业务类型", |
| | | "desc": "必填,请填写业务类型", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "input", |
| | | "limit": "maxLength", |
| | | "limitParam": "30", |
| | | "limitErrInfo": "业务类型超过30位", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "action", |
| | | "cnCode": "动作", |
| | | "desc": "必填,请选择动作", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "select", |
| | | "selectValue":"ADD,MOD,DEL", |
| | | "selectValueName":"添加,修改,删除", |
| | | "limit": "maxLength", |
| | | "limitParam": "12", |
| | | "limitErrInfo": "动作不能为空", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "actionObj", |
| | | "cnCode": "表名", |
| | | "desc": "必填,请填写表名", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "input", |
| | | "limit": "maxLength", |
| | | "limitParam": "64", |
| | | "limitErrInfo": "流程名称超过64位", |
| | | "limitErrInfo": "表名超过64位", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "flowType", |
| | | "cnCode": "流程类型", |
| | | "desc": "必填,请填写流程类型", |
| | | "code": "actionObjHis", |
| | | "cnCode": "轨迹表名", |
| | | "desc": "必填,请填写轨迹表名", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "select", |
| | | "selectValue":"1001", |
| | | "selectValueName":"普通流程", |
| | | "inputType": "input", |
| | | "limit": "maxLength", |
| | | "limitParam": "12", |
| | | "limitErrInfo": "流程类型不能为空", |
| | | "limitParam": "64", |
| | | "limitErrInfo": "轨迹表名超过64位", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "describle", |
| | | "code": "remark", |
| | | "cnCode": "备注", |
| | | "desc": "可填,请填写备注", |
| | | "required": false, |
| | |
| | | * @param businessTableHisDtoDtoDtos |
| | | */ |
| | | public static void setValue(List<BusinessTableHisDto> businessTableHisDtoDtoDtos) { |
| | | if (businessTableHisDtoDtoDtos == null || businessTableHisDtoDtoDtos.size() < 1) { |
| | | return; |
| | | } |
| | | Jedis redis = null; |
| | | try { |
| | | redis = getJedis(); |
| | |
| | | * @return 返回 ResponseEntity 对象 |
| | | */ |
| | | public ResponseEntity<String> list(IPageData pd) { |
| | | pd.setApiUrl("/api/activities.listActivitiess"); |
| | | pd.setApiUrl("activities.listActivitiess"); |
| | | return commonGetSMOImpl.doService(pd); |
| | | } |
| | | |
| | |
| | | * @return 返回 ResponseEntity 对象 |
| | | */ |
| | | public ResponseEntity<String> list(IPageData pd) { |
| | | pd.setApiUrl("/api/activities.listActivitiess"); |
| | | pd.setApiUrl("activities.listActivitiess"); |
| | | return commonGetSMOImpl.doService(pd); |
| | | } |
| | | |
| | |
| | | * @return ResponseEntity 对象 |
| | | */ |
| | | public ResponseEntity<String> delete(IPageData pd) { |
| | | pd.setApiUrl("/api/activities.deleteActivities"); |
| | | pd.setApiUrl("activities.deleteActivities"); |
| | | return commonPostSMOImpl.doService(pd); |
| | | } |
| | | |
| | |
| | | */ |
| | | package com.java110.api.controller; |
| | | |
| | | import com.java110.api.smo.privilege.IPrivilegeSMO; |
| | | import com.java110.core.base.controller.BaseController; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.utils.constant.CommonConstant; |
| | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private IPrivilegeSMO privilegeSMOImpl; |
| | | |
| | | /** |
| | | * 流程处理方法 |
| | | * |
| | |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | System.out.println("数据获取成功"); |
| | | //权限校验 |
| | | hasPrivilege(restTemplate, pd, "/" + flowCode); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/" + flowCode); |
| | | validateFlowData(flowCode, pd); |
| | | |
| | | } catch (Throwable e) { |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.smo.IApiServiceSMO; |
| | | import com.java110.api.smo.api.IApiSMO; |
| | | import com.java110.api.smo.privilege.IPrivilegeSMO; |
| | | import com.java110.core.base.controller.BaseController; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.utils.constant.CommonConstant; |
| | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private IPrivilegeSMO privilegeSMOImpl; |
| | | |
| | | /** |
| | | * 资源请求 post方式 |
| | | * <p> |
| | |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_POST); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", service, postInfo, headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | responseEntity = apiServiceSMOImpl.service(postInfo, headers); |
| | | } catch (Throwable e) { |
| | | logger.error("请求post 方法[" + service + "]失败:" + postInfo, e); |
| | |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_GET); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", "", headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | //responseEntity = apiSMOImpl.doApi(JSONObject.toJSONString(getParameterStringMap(request)), headers, request); |
| | | responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers); |
| | | |
| | |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_GET); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", "", headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + resource + "/" + action); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/app/" + resource + "/" + action); |
| | | //responseEntity = apiSMOImpl.doApi(JSONObject.toJSONString(getParameterStringMap(request)), headers, request); |
| | | responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers); |
| | | } catch (Throwable e) { |
| | |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_POST); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", action, postInfo, headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + resource + "/" + action); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/app/" + resource + "/" + action); |
| | | //responseEntity = apiSMOImpl.doApi(postInfo, headers, request); |
| | | responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers); |
| | | } catch (Throwable e) { |
| | |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_PUT); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", service, postInfo, headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | //responseEntity = apiSMOImpl.doApi(postInfo, headers, request); |
| | | responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers); |
| | | } catch (Throwable e) { |
| | |
| | | headers.put(CommonConstant.HTTP_METHOD, CommonConstant.HTTP_METHOD_DELETE); |
| | | logger.debug("api:{} 请求报文为:{},header信息为:{}", service, "", headers); |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | privilegeSMOImpl.hasPrivilege(restTemplate, pd, "/app/" + service); |
| | | //responseEntity = apiSMOImpl.doApi(JSONObject.toJSONString(getParameterStringMap(request)), headers, request); |
| | | responseEntity = apiServiceSMOImpl.service(JSONObject.toJSONString(getParameterStringMap(request)), headers); |
| | | } catch (Throwable e) { |
| | |
| | | package com.java110.api.controller.component; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.core.base.controller.BaseController; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.context.PageData; |
| | |
| | | * 组件调用处理类 |
| | | */ |
| | | @RestController |
| | | public class CallComponentController extends BaseController { |
| | | public class CallComponentController extends DefaultAbstractComponentSMO { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(CallComponentController.class); |
| | | private static final String VERSION = "version"; |
| | |
| | | Assert.hasLength(api, "参数错误,未传入api编码"); |
| | | |
| | | IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA); |
| | | pd.setApiUrl("/api/" + api); |
| | | pd.setApiUrl(api); |
| | | //权限校验 |
| | | hasPrivilege(restTemplate, pd, "/callComponent/" + api); |
| | | |
| | |
| | | import com.java110.dto.order.OrderDto; |
| | | import com.java110.entity.center.AppService; |
| | | import com.java110.intf.job.IDataBusInnerServiceSMO; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | |
| | | requestUrl += ("?" + param); |
| | | } |
| | | try { |
| | | if (CommonConstant.HTTP_METHOD_GET.equals(service.getMethod())) { |
| | | responseEntity = restTemplate.exchange(requestUrl, HttpMethod.GET, httpEntity, String.class); |
| | | } else if (CommonConstant.HTTP_METHOD_PUT.equals(service.getMethod())) { |
| | | responseEntity = restTemplate.exchange(requestUrl, HttpMethod.PUT, httpEntity, String.class); |
| | | } else if (CommonConstant.HTTP_METHOD_DELETE.equals(service.getMethod())) { |
| | | responseEntity = restTemplate.exchange(requestUrl, HttpMethod.DELETE, httpEntity, String.class); |
| | | } else { |
| | | responseEntity = restTemplate.exchange(requestUrl, HttpMethod.POST, httpEntity, String.class); |
| | | } |
| | | responseEntity = restTemplate.exchange(requestUrl, HttpMethod.POST, httpEntity, String.class); |
| | | HttpHeaders headers = responseEntity.getHeaders(); |
| | | String oId = "-1"; |
| | | if (headers.containsKey(OrderDto.O_ID)) { |
| | |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.SERVICE_CODE_SYSTEM_TRANSFER; |
| | | return ServiceCodeConstant.SERVICE_CODE_SYSTEM_CMD; |
| | | } |
| | | |
| | | @Override |
| | |
| | | HttpEntity<String> httpEntity = new HttpEntity<String>(reqJson.toJSONString(), header); |
| | | String orgRequestUrl = context.getRequestHeaders().get("REQUEST_URL"); |
| | | |
| | | String serviceCode = "/" + reqHeader.get(CommonConstant.HTTP_RESOURCE) + "/" + reqHeader.get(CommonConstant.HTTP_ACTION); |
| | | //String serviceCode = "/" + reqHeader.get(CommonConstant.HTTP_RESOURCE) + "/" + reqHeader.get(CommonConstant.HTTP_ACTION); |
| | | String serviceCode = service.getServiceCode(); |
| | | serviceCode = serviceCode.startsWith("/") ? serviceCode : ("/" + serviceCode); |
| | | |
| | | String requestUrl = service.getUrl() + serviceCode; |
| | | |
| | |
| | | } |
| | | for (String privilegeCode : privilegeCodes) { |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", ServiceConstant.SERVICE_API_URL |
| | | + "/api/check.user.hasPrivilege?userId=" + pd.getUserId() + "&pId=" + privilegeCode, HttpMethod.GET); |
| | | + "check.user.hasPrivilege?userId=" + pd.getUserId() + "&pId=" + privilegeCode, HttpMethod.GET); |
| | | if (responseEntity.getStatusCode() == HttpStatus.OK) { |
| | | //throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "用户没有权限操作权限" + privilegeCodes); |
| | | break; |
| | |
| | | package com.java110.api.smo; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.properties.WechatAuthProperties; |
| | | import com.java110.core.component.AbstractComponentSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.entity.component.ComponentValidateResult; |
| | | import com.java110.utils.cache.PrivilegeCache; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.constant.ServiceCodeConstant; |
| | |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.utils.util.UrlParamToJsonUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.client.HttpStatusCodeException; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | public class DefaultAbstractComponentSMO extends AbstractComponentSMO { |
| | | |
| | | private static final Logger logger = LoggerFactory.getLogger(DefaultAbstractComponentSMO.class); |
| | | protected static final String DEFAULT_PAY_ADAPT = "wechatPayAdapt";// 默认微信通用支付 |
| | | |
| | | @Autowired |
| | | private IGetCommunityStoreInfoSMO getCommunityStoreInfoSMOImpl; |
| | | |
| | | |
| | | @Autowired |
| | | private WechatAuthProperties wechatAuthProperties; |
| | | |
| | |
| | | } |
| | | for (String privilegeCode : privilegeCodes) { |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", ServiceConstant.SERVICE_API_URL |
| | | + "/api/check.user.hasPrivilege?userId=" + pd.getUserId() + "&pId=" + privilegeCode, HttpMethod.GET); |
| | | + "check.user.hasPrivilege?userId=" + pd.getUserId() + "&pId=" + privilegeCode, HttpMethod.GET); |
| | | if (responseEntity.getStatusCode() == HttpStatus.OK) { |
| | | //throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "用户没有权限操作权限" + privilegeCodes); |
| | | break; |
| | |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "用户没有权限操作权限" + privilegeCodes); |
| | | } |
| | | } |
| | | |
| | | protected void hasPrivilege(RestTemplate restTemplate, IPageData pd, String resource) { |
| | | ResponseEntity<String> responseEntity = null; |
| | | //没有用户的情况下不做权限判断 |
| | | if (StringUtil.isEmpty(pd.getUserId())) { |
| | | return; |
| | | } |
| | | JSONObject paramIn = new JSONObject(); |
| | | //paramIn.put("resource", resource); |
| | | paramIn.put("userId", pd.getUserId()); |
| | | |
| | | //校验资源路劲是否定义权限 |
| | | List<BasePrivilegeDto> basePrivilegeDtos = PrivilegeCache.getPrivileges(); |
| | | if (basePrivilegeDtos == null || basePrivilegeDtos.size() < 1) { |
| | | return; |
| | | } |
| | | String tmpResource = null; |
| | | boolean hasPrivilege = false; |
| | | for (BasePrivilegeDto privilegeDto : basePrivilegeDtos) { |
| | | if (resource.equals(privilegeDto.getResource())) { |
| | | hasPrivilege = true; |
| | | } |
| | | } |
| | | if (!hasPrivilege) { //权限没有配置,直接跳过 |
| | | return; |
| | | } |
| | | |
| | | ResultVo resultVo = getCommunityStoreInfoSMOImpl.checkUserHasResourceListener(restTemplate, pd, paramIn, pd.getUserId()); |
| | | if (resultVo == null || resultVo.getCode() != ResultVo.CODE_OK) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | JSONArray privileges = JSONArray.parseArray(resultVo.getMsg()); |
| | | |
| | | hasPrivilege = false; |
| | | if (privileges == null || privileges.size() < 1) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | for (int privilegeIndex = 0; privilegeIndex < privileges.size(); privilegeIndex++) { |
| | | tmpResource = privileges.getJSONObject(privilegeIndex).getString("resource"); |
| | | if (resource.equals(tmpResource)) { |
| | | hasPrivilege = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!hasPrivilege) { |
| | | throw new UnsupportedOperationException("用户没有权限操作"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询商户信息 |
| | | * |
| | | * @return |
| | | */ |
| | | protected ResponseEntity<String> getStoreInfo(IPageData pd, RestTemplate restTemplate) { |
| | | Assert.hasLength(pd.getUserId(), "用户未登录请先登录"); |
| | | |
| | | ResultVo resultVo = getCommunityStoreInfoSMOImpl.getStoreInfo(pd, restTemplate, pd.getUserId()); |
| | | |
| | | 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 = getCommunityStoreInfoSMOImpl.getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate); |
| | | return new ResponseEntity<String>(resultVo.getMsg(), resultVo.getCode() == ResultVo.CODE_OK ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | /** |
| | | * 查询商户信息 |
| | | * |
| | | * @return |
| | | */ |
| | | protected void checkStoreEnterCommunity(IPageData pd, String storeId, String storeTypeCd, String communityId, RestTemplate restTemplate) { |
| | | Assert.hasLength(pd.getUserId(), "用户未登录请先登录"); |
| | | ResponseEntity<String> responseEntity = null; |
| | | responseEntity = getStoreEnterCommunitys(pd, storeId, storeTypeCd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "还未入驻小区,请先入驻小区"); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "data", "还未入驻小区,请先入驻小区"); |
| | | |
| | | JSONObject community = JSONObject.parseObject(responseEntity.getBody().toString()); |
| | | |
| | | JSONArray communitys = community.getJSONArray("data"); |
| | | |
| | | if (communitys == null || communitys.size() == 0) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "还未入驻小区,请先入驻小区"); |
| | | } |
| | | |
| | | JSONObject currentCommunity = getCurrentCommunity(communitys, communityId); |
| | | |
| | | if (currentCommunity == null) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, "传入小区ID非法,请正常操作"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private JSONObject getCurrentCommunity(JSONArray communitys, String communityId) { |
| | | for (int communityIndex = 0; communityIndex < communitys.size(); communityIndex++) { |
| | | if (communityId.equals(communitys.getJSONObject(communityIndex).getString("communityId"))) { |
| | | return communitys.getJSONObject(communityIndex); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 校验 员工 商户 小区 关系 |
| | | * <p> |
| | | * 判断员工和商户是否有关系, 商户和 小区是否有关系 |
| | | * |
| | | * @param pd 页面数据封装 |
| | | * @param restTemplate http调用工具 |
| | | * @return ComponentValidateResult 校验对象 |
| | | */ |
| | | protected ComponentValidateResult validateStoreStaffCommunityRelationship(IPageData pd, RestTemplate restTemplate) { |
| | | |
| | | // 校验 员工和商户是否有关系 |
| | | ResponseEntity responseEntity = getStoreInfo(pd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, responseEntity.getBody() + ""); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点"); |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点"); |
| | | |
| | | String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId"); |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | |
| | | JSONObject paramIn = JSONObject.parseObject(pd.getReqData()); |
| | | |
| | | String communityId = ""; |
| | | if (paramIn.containsKey("communityId") && !StringUtil.isEmpty(paramIn.getString("communityId"))) { |
| | | communityId = paramIn.getString("communityId"); |
| | | checkStoreEnterCommunity(pd, storeId, storeTypeCd, communityId, restTemplate); |
| | | } |
| | | return new ComponentValidateResult(storeId, storeTypeCd, communityId, pd.getUserId(), pd.getUserName()); |
| | | } |
| | | |
| | | /** |
| | | * 校验 员工 商户 关系 |
| | | * <p> |
| | | * 判断员工和商户是否有关系, 商户和 是否有关系 |
| | | * |
| | | * @param pd 页面数据封装 |
| | | * @param restTemplate http调用工具 |
| | | * @return ComponentValidateResult 校验对象 |
| | | */ |
| | | protected ComponentValidateResult validateStoreStaffRelationship(IPageData pd, RestTemplate restTemplate) { |
| | | |
| | | // 校验 员工和商户是否有关系 |
| | | ResponseEntity responseEntity = getStoreInfo(pd, restTemplate); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, responseEntity.getBody() + ""); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeId", "根据用户ID查询商户ID失败,未包含storeId节点"); |
| | | Assert.jsonObjectHaveKey(responseEntity.getBody().toString(), "storeTypeCd", "根据用户ID查询商户类型失败,未包含storeTypeCd节点"); |
| | | |
| | | String storeId = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeId"); |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | |
| | | return new ComponentValidateResult(storeId, storeTypeCd, "", pd.getUserId(), pd.getUserName()); |
| | | } |
| | | |
| | | } |
old mode 100755
new mode 100644
| File was renamed from java110-core/src/main/java/com/java110/core/smo/impl/GetCommunityStoreInfoSMOImpl.java |
| | |
| | | package com.java110.core.smo.impl; |
| | | package com.java110.api.smo; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.cache.Java110RedisConfig; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.factory.CallApiServiceFactory; |
| | | import com.java110.core.smo.IGetCommunityStoreInfoSMO; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | @Service |
| | | public class GetCommunityStoreInfoSMOImpl implements IGetCommunityStoreInfoSMO { |
| | | public class GetCommunityStoreInfoSMOImpl extends DefaultAbstractComponentSMO implements IGetCommunityStoreInfoSMO { |
| | | |
| | | private static final String BASE_PRIVILEGE = "JAVA110_BASE_PRIVILEGE"; |
| | | |
| | |
| | | |
| | | Assert.hasLength(pd.getUserId(), "用户未登录请先登录"); |
| | | ResponseEntity<String> responseEntity = null; |
| | | responseEntity = CallApiServiceFactory.callCenterService(restTemplate, pd, "", "query.store.byuser?userId=" + userId, HttpMethod.GET); |
| | | responseEntity = super.callCenterService(restTemplate, pd, "", "query.store.byuser?userId=" + userId, HttpMethod.GET); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | throw new IllegalArgumentException(responseEntity.getBody()); |
| | | } |
| | |
| | | // "query.myCommunity.byMember?memberId=" + storeId + "&memberTypeCd=" |
| | | // + MappingCache.getValue(MappingConstant.DOMAIN_STORE_TYPE_2_COMMUNITY_MEMBER_TYPE, storeTypeCd), HttpMethod.GET); |
| | | |
| | | responseEntity = CallApiServiceFactory.callCenterService(restTemplate, pd, "", |
| | | "communitys/queryStoreCommunitys?memberId=" + storeId + "&memberTypeCd=" |
| | | responseEntity = super.callCenterService(restTemplate, pd, "", |
| | | "/communitys/queryStoreCommunitys?memberId=" + storeId + "&memberTypeCd=" |
| | | + MappingCache.getValue(MappingConstant.DOMAIN_STORE_TYPE_2_COMMUNITY_MEMBER_TYPE, storeTypeCd), HttpMethod.GET); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | |
| | | @Cacheable(value = "getUserPrivileges" + Java110RedisConfig.DEFAULT_EXPIRE_TIME_KEY, key = "#staffId") |
| | | public ResultVo getUserPrivileges(IPageData pd, String staffId, String storeTypeCd, RestTemplate restTemplate) { |
| | | |
| | | ResponseEntity<String> privilegeGroup = CallApiServiceFactory.callCenterService(restTemplate, pd, "", |
| | | ResponseEntity<String> privilegeGroup = super.callCenterService(restTemplate, pd, "", |
| | | "query.user.privilege?userId=" + staffId + "&domain=" + storeTypeCd, HttpMethod.GET); |
| | | if (privilegeGroup.getStatusCode() != HttpStatus.OK) { |
| | | throw new IllegalArgumentException(privilegeGroup.getBody()); |
| | |
| | | @Cacheable(value = "checkUserHasResourceListener" + Java110RedisConfig.DEFAULT_EXPIRE_TIME_KEY, key = "#cacheKey") |
| | | public ResultVo checkUserHasResourceListener(RestTemplate restTemplate, IPageData pd, JSONObject paramIn, String cacheKey) { |
| | | ResponseEntity<String> responseEntity = null; |
| | | responseEntity = CallApiServiceFactory.callCenterService(restTemplate, pd, paramIn.toJSONString(), |
| | | responseEntity = super.callCenterService(restTemplate, pd, paramIn.toJSONString(), |
| | | "basePrivilege.CheckUserHasResourceListener", |
| | | HttpMethod.POST); |
| | | |
old mode 100755
new mode 100644
| File was renamed from java110-core/src/main/java/com/java110/core/smo/IGetCommunityStoreInfoSMO.java |
| | |
| | | package com.java110.core.smo; |
| | | package com.java110.api.smo; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.context.IPageData; |
| | |
| | | //获取请求参数 |
| | | JSONObject reqParam = JSONObject.parseObject(pd.getReqData()); |
| | | //拉取数据 |
| | | String url = ServiceConstant.SERVICE_API_URL.concat("/api/dict.queryDict").concat(mapToUrlParam(reqParam)); |
| | | String url = ServiceConstant.SERVICE_API_URL.concat("dict.queryDict").concat(mapToUrlParam(reqParam)); |
| | | ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "", url, HttpMethod.GET); |
| | | return responseEntity; |
| | | } |
| | |
| | | reqParam.put("name", "pay_fee"); |
| | | reqParam.put("type", "fee_type_cd"); |
| | | //拉取数据 |
| | | String url = ServiceConstant.SERVICE_API_URL.concat("/api/dict.queryDict").concat(mapToUrlParam(reqParam)); |
| | | String url = ServiceConstant.SERVICE_API_URL.concat("dict.queryDict").concat(mapToUrlParam(reqParam)); |
| | | ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "", url, HttpMethod.GET); |
| | | return responseEntity; |
| | | } |
| | |
| | | //获取请求参数 |
| | | JSONObject reqParam = JSONObject.parseObject(pd.getReqData()); |
| | | //拉取数据 |
| | | String url=ServiceConstant.SERVICE_API_URL.concat("/api/dict.queryDict").concat(mapToUrlParam(reqParam)); |
| | | String url=ServiceConstant.SERVICE_API_URL.concat("dict.queryDict").concat(mapToUrlParam(reqParam)); |
| | | ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",url , HttpMethod.GET); |
| | | return responseEntity; |
| | | } |
| | |
| | | ResponseEntity<String> responseEntity = null; |
| | | Assert.hasLength(pd.getUserId(),"用户还未登录请先登录"); |
| | | |
| | | responseEntity = this.callCenterService(restTemplate,pd,"", ServiceConstant.SERVICE_API_URL+"/api/query.store.byuser?userId="+pd.getUserId(), HttpMethod.GET); |
| | | responseEntity = this.callCenterService(restTemplate,pd,"", "query.store.byuser?userId="+pd.getUserId(), HttpMethod.GET); |
| | | |
| | | if(responseEntity.getStatusCode() != HttpStatus.OK){ |
| | | |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.core.component.BaseComponentSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.smo.IGetCommunityStoreInfoSMO; |
| | | import com.java110.api.smo.IGetCommunityStoreInfoSMO; |
| | | import com.java110.api.smo.IPrivilegeServiceSMO; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | package com.java110.api.smo.login.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.context.PageData; |
| | | import com.java110.core.factory.AuthenticationFactory; |
| | |
| | | * wx登录 |
| | | */ |
| | | @Service("propertyAppLoginSMOImpl") |
| | | public class PropertyAppLoginSMOImpl extends AppAbstractComponentSMO implements IPropertyAppLoginSMO { |
| | | public class PropertyAppLoginSMOImpl extends DefaultAbstractComponentSMO implements IPropertyAppLoginSMO { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(PropertyAppLoginSMOImpl.class); |
| | | |
| | |
| | | JSONObject loginInfo = JSONObject.parseObject(pd.getReqData()); |
| | | |
| | | loginInfo.put("passwd", AuthenticationFactory.passwdMd5(loginInfo.getString("password"))); |
| | | responseEntity = this.callCenterService(restTemplate, pd, loginInfo.toJSONString(), ServiceConstant.SERVICE_API_URL +"/api/user.service.login", HttpMethod.POST); |
| | | responseEntity = this.callCenterService(restTemplate, pd, loginInfo.toJSONString(), "user.service.login", HttpMethod.POST); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | return responseEntity; |
| | | } |
| New file |
| | |
| | | package com.java110.api.smo.privilege; |
| | | |
| | | import com.java110.core.context.IPageData; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | public interface IPrivilegeSMO { |
| | | |
| | | void hasPrivilege(RestTemplate restTemplate, IPageData pd, String resource); |
| | | } |
| New file |
| | |
| | | package com.java110.api.smo.privilege.impl; |
| | | |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.api.smo.privilege.IPrivilegeSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | @Service |
| | | public class PrivilegeSMOImpl extends DefaultAbstractComponentSMO implements IPrivilegeSMO { |
| | | @Override |
| | | public void hasPrivilege(RestTemplate restTemplate, IPageData pd, String resource) { |
| | | super.hasPrivilege(restTemplate, pd, resource); |
| | | } |
| | | } |
| | |
| | | |
| | | //因为好多朋友启动时 不加 参数-Dcache 所以启动时检测 redis 中是否存在 java110_hc_version |
| | | String mapping = MappingCache.getValue("java110_hc_version"); |
| | | //String mapping = ""; |
| | | if (StringUtil.isEmpty(mapping)) { |
| | | IDevServiceCacheSMO devServiceCacheSMOImpl = (IDevServiceCacheSMO) ApplicationContextFactory.getBean("devServiceCacheSMOImpl"); |
| | | devServiceCacheSMOImpl.startFlush(); |
| | |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "businessTableHis.DeleteBusinessTableHis") |
| | | @Java110Cmd(serviceCode = "businessTableHis.deleteBusinessTableHis") |
| | | public class DeleteBusinessTableHisCmd extends AbstractServiceCmdListener { |
| | | private static Logger logger = LoggerFactory.getLogger(DeleteBusinessTableHisCmd.class); |
| | | |
| | |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "businessTableHis.ListBusinessTableHis") |
| | | @Java110Cmd(serviceCode = "businessTableHis.listBusinessTableHis") |
| | | public class ListBusinessTableHisCmd extends AbstractServiceCmdListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ListBusinessTableHisCmd.class); |
| | |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "businessTableHis.SaveBusinessTableHis") |
| | | @Java110Cmd(serviceCode = "businessTableHis.saveBusinessTableHis") |
| | | public class SaveBusinessTableHisCmd extends AbstractServiceCmdListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(SaveBusinessTableHisCmd.class); |
| | |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "businessTableHis.UpdateBusinessTableHis") |
| | | @Java110Cmd(serviceCode = "businessTableHis.updateBusinessTableHis") |
| | | public class UpdateBusinessTableHisCmd extends AbstractServiceCmdListener { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(UpdateBusinessTableHisCmd.class); |
| New file |
| | |
| | | package com.java110.dev.cmd.cache; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dev.smo.IDevServiceCacheSMO; |
| | | import com.java110.service.context.DataQuery; |
| | | import com.java110.service.context.DataQueryFactory; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 保存编码映射处理类 |
| | | */ |
| | | @Java110Cmd(serviceCode = "flush.center.cache") |
| | | public class FlushCacheCmd extends AbstractServiceCmdListener { |
| | | |
| | | @Autowired |
| | | IDevServiceCacheSMO devServiceCacheSMOImpl; |
| | | |
| | | @Override |
| | | protected void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | devServiceCacheSMOImpl.flush(reqJson.toJavaObject(Map.class)); |
| | | |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |
| | | } |
| | | } |