| New file |
| | |
| | | package com.java110.dev.cmd.mapping; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.mapping.MappingDto; |
| | | import com.java110.intf.community.IMappingInnerServiceSMO; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | @Java110Cmd(serviceCode = "mapping.deleteMapping") |
| | | public class DeleteMappingCmd extends Cmd { |
| | | @Autowired |
| | | private IMappingInnerServiceSMO mappingInnerServiceSMOImpl; |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "id", "编码ID不能为空"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | MappingDto mappingDto = BeanConvertUtil.covertBean(reqJson, MappingDto.class); |
| | | |
| | | int count = mappingInnerServiceSMOImpl.deleteMapping(mappingDto); |
| | | |
| | | if (count < 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "编辑数据失败"); |
| | | } |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("", HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.mapping; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.mapping.MappingDto; |
| | | import com.java110.intf.community.IMappingInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.api.mapping.ApiMappingDataVo; |
| | | import com.java110.vo.api.mapping.ApiMappingVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "mapping.listMappings") |
| | | public class ListMappingsCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IMappingInnerServiceSMO mappingInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | super.validatePageInfo(reqJson); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | MappingDto mappingDto = BeanConvertUtil.covertBean(reqJson, MappingDto.class); |
| | | |
| | | int count = mappingInnerServiceSMOImpl.queryMappingsCount(mappingDto); |
| | | |
| | | List<ApiMappingDataVo> mappings = null; |
| | | |
| | | if (count > 0) { |
| | | mappings = BeanConvertUtil.covertBeanList(mappingInnerServiceSMOImpl.queryMappings(mappingDto), ApiMappingDataVo.class); |
| | | } else { |
| | | mappings = new ArrayList<>(); |
| | | } |
| | | |
| | | ApiMappingVo apiMappingVo = new ApiMappingVo(); |
| | | |
| | | apiMappingVo.setTotal(count); |
| | | apiMappingVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row"))); |
| | | apiMappingVo.setMappings(mappings); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiMappingVo), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.mapping; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.mapping.MappingDto; |
| | | import com.java110.intf.community.IMappingInnerServiceSMO; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | @Java110Cmd(serviceCode = "mapping.saveMapping") |
| | | public class SaveMappingCmd extends Cmd { |
| | | @Autowired |
| | | private IMappingInnerServiceSMO mappingInnerServiceSMOImpl; |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "domain", "必填,请填写域"); |
| | | Assert.hasKeyAndValue(reqJson, "name", "必填,请填写名称"); |
| | | Assert.hasKeyAndValue(reqJson, "key", "必填,请填写键"); |
| | | Assert.hasKeyAndValue(reqJson, "value", "必填,请填写值"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | MappingDto mappingDto = BeanConvertUtil.covertBean(reqJson, MappingDto.class); |
| | | |
| | | int count = mappingInnerServiceSMOImpl.saveMapping(mappingDto); |
| | | |
| | | |
| | | if (count < 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "保存数据失败"); |
| | | } |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("", HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.mapping; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.mapping.MappingDto; |
| | | import com.java110.intf.community.IMappingInnerServiceSMO; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | @Java110Cmd(serviceCode = "mapping.updateMapping") |
| | | public class UpdateMappingCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IMappingInnerServiceSMO mappingInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "id", "编码ID不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "domain", "必填,请填写域"); |
| | | Assert.hasKeyAndValue(reqJson, "name", "必填,请填写名称"); |
| | | Assert.hasKeyAndValue(reqJson, "key", "必填,请填写键"); |
| | | Assert.hasKeyAndValue(reqJson, "value", "必填,请填写值"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | MappingDto mappingDto = BeanConvertUtil.covertBean(reqJson, MappingDto.class); |
| | | |
| | | int count = mappingInnerServiceSMOImpl.updateMapping(mappingDto); |
| | | |
| | | |
| | | if (count < 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "编辑数据失败"); |
| | | } |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>("", HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.menuGroup; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.menuGroup.MenuGroupDto; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | @Java110Cmd(serviceCode = "menuGroup.deleteMenuGroup") |
| | | public class DeleteMenuGroupCmd extends Cmd{ |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "gId", "组Id不能为空"); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | ResponseEntity<String> responseEntity = null; |
| | | |
| | | MenuGroupDto menuGroupDto = BeanConvertUtil.covertBean(reqJson, MenuGroupDto.class); |
| | | |
| | | |
| | | int saveFlag = menuInnerServiceSMOImpl.deleteMenuGroup(menuGroupDto); |
| | | |
| | | responseEntity = new ResponseEntity<String>(saveFlag > 0 ? "成功" : "失败", saveFlag > 0 ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.menuGroup; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.menuGroup.MenuGroupDto; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.api.menuGroup.ApiMenuGroupDataVo; |
| | | import com.java110.vo.api.menuGroup.ApiMenuGroupVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Java110Cmd(serviceCode = "menuGroup.listMenuGroups") |
| | | public class ListMenuGroupsCmd extends Cmd{ |
| | | |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | super.validatePageInfo(reqJson); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | MenuGroupDto menuGroupDto = BeanConvertUtil.covertBean(reqJson, MenuGroupDto.class); |
| | | |
| | | int count = menuInnerServiceSMOImpl.queryMenuGroupsCount(menuGroupDto); |
| | | |
| | | List<ApiMenuGroupDataVo> menuGroups = null; |
| | | |
| | | if (count > 0) { |
| | | menuGroups = BeanConvertUtil.covertBeanList(menuInnerServiceSMOImpl.queryMenuGroups(menuGroupDto), ApiMenuGroupDataVo.class); |
| | | } else { |
| | | menuGroups = new ArrayList<>(); |
| | | } |
| | | |
| | | ApiMenuGroupVo apiMenuGroupVo = new ApiMenuGroupVo(); |
| | | |
| | | apiMenuGroupVo.setTotal(count); |
| | | apiMenuGroupVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row"))); |
| | | apiMenuGroupVo.setMenuGroups(menuGroups); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiMenuGroupVo), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.menuGroup; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.menuGroup.MenuGroupDto; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | @Java110Cmd(serviceCode = "menuGroup.saveMenuGroup") |
| | | public class SaveMenuGroupCmd extends Cmd{ |
| | | |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "name", "必填,请填写组名称"); |
| | | Assert.hasKeyAndValue(reqJson, "icon", "必填,请填写icon"); |
| | | Assert.hasKeyAndValue(reqJson, "seq", "必填,请填写序列"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | ResponseEntity<String> responseEntity = null; |
| | | |
| | | MenuGroupDto menuGroupDto = BeanConvertUtil.covertBean(reqJson, MenuGroupDto.class); |
| | | |
| | | freshGId(menuGroupDto); |
| | | |
| | | |
| | | int saveFlag = menuInnerServiceSMOImpl.saveMenuGroup(menuGroupDto); |
| | | |
| | | responseEntity = new ResponseEntity<String>(saveFlag > 0 ? "成功" : "失败", saveFlag > 0 ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | |
| | | /** |
| | | * 刷新 菜单组ID |
| | | * @param menuGroupDto |
| | | */ |
| | | private void freshGId(MenuGroupDto menuGroupDto) { |
| | | |
| | | if(!StringUtils.isEmpty(menuGroupDto.getgId())){ |
| | | return ; |
| | | } |
| | | //生成流水 |
| | | menuGroupDto.setgId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.MENU_GROUP)); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.java110.dev.cmd.menuGroup; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.menuGroup.MenuGroupDto; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | @Java110Cmd(serviceCode = "menuGroup.updateMenuGroup") |
| | | public class UpdateMenuGroupCmd extends Cmd { |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.hasKeyAndValue(reqJson, "gId", "组Id不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "name", "必填,请填写组名称"); |
| | | Assert.hasKeyAndValue(reqJson, "icon", "必填,请填写icon"); |
| | | Assert.hasKeyAndValue(reqJson, "seq", "必填,请填写序列"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | ResponseEntity<String> responseEntity = null; |
| | | |
| | | MenuGroupDto menuGroupDto = BeanConvertUtil.covertBean(reqJson, MenuGroupDto.class); |
| | | |
| | | |
| | | int saveFlag = menuInnerServiceSMOImpl.updateMenuGroup(menuGroupDto); |
| | | |
| | | responseEntity = new ResponseEntity<String>(saveFlag > 0 ? "成功" : "失败", saveFlag > 0 ? HttpStatus.OK : HttpStatus.BAD_REQUEST); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |