| | |
| | | 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.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.language.Language; |
| | | import com.java110.dto.menuCatalog.MenuCatalogDto; |
| | | import com.java110.dto.store.StoreDto; |
| | | import com.java110.intf.store.IStoreInnerServiceSMO; |
| | | import com.java110.intf.user.IMenuCatalogV1InnerServiceSMO; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.factory.ApplicationContextFactory; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "menu.listCatalog") |
| | | public class ListCatalogCmd extends AbstractServiceCmdListener { |
| | | public class ListCatalogCmd extends Cmd { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ListCatalogCmd.class); |
| | | @Autowired |
| | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | if(!reqJson.containsKey("storeId") || StringUtil.isEmpty(reqJson.getString("storeId"))){ |
| | | reqJson.put("storeId",cmdDataFlowContext.getReqHeaders().get("store-id")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | menuCatalogDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | String lang = cmdDataFlowContext.getReqHeaders().get(CommonConstant.JAVA110_LANG); |
| | | if (!StringUtil.isEmpty(lang) && !CommonConstant.LANG_ZH_CN.equals(lang)) { |
| | | Language language = ApplicationContextFactory.getBean(lang, Language.class); |
| | | if (language != null) { |
| | | menuCatalogDtos = language.getMenuCatalog(menuCatalogDtos); |
| | | } |
| | | |
| | | } |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, menuCatalogDtos); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |