NutzCN Logo
问答 nutz 架构何如何地址网址就能访问后台接口???
发布于 2546天前 作者 qq_e3b6dba3 1448 次浏览 复制 上一个帖子 下一个帖子
标签:

nutz 架构何如何地址网址就能访问后台接口:

package com.ruyima.eop.controller.business;

import java.sql.Timestamp;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.nutz.ioc.annotation.InjectName;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;

import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

import com.ruyima.eop.pageModel.CellOpen;
import com.ruyima.eop.pageModel.Command;
import com.ruyima.eop.pageModel.Json;
import com.ruyima.eop.pageModel.JsonObjectData;

import com.ruyima.model.BoxCode;
import com.ruyima.model.Tbl_cabinet_command;
import com.ruyima.model.Tbl_cell;

import com.ruyima.util.Const;

import com.ruyima.eop.service.*;

@IocBean
@InjectName
@At("/celltest")
public class CelltestModule {

	// private static final Log log = Logs.getLog(ExpressModule.class);
	//
	@Inject
	public ICabinetService cabinetService;
	@Inject
	protected ICellService cellService;

	@Inject
	protected ILoggerService loggerService;

	// 远程开箱
	@At
	@Ok("json")
	public Object yuanOpenCell(@Param("cell_id") Integer cell_id,
			@Param("..") Tbl_cabinet_command cabinetCommand,
			@Param("port") Integer port, @Param("openLevel") Integer openLevel,
			HttpServletRequest req) {
		Json j = new Json();
		j.setSucc(false);
		j.setMsg("控制指令创建失败!");
		try {
			if (port == null) {
				Tbl_cell cell = cellService.findById(cell_id);
				port = cell.getPort();
				cabinetCommand.setCabinet_id(cell.getCabinet_id());
			}
		} catch (Exception e) {
			e.printStackTrace();
			return j;
		}

		cabinetCommand
				.setCreate_time(new Timestamp(System.currentTimeMillis()));

		cabinetCommand.setResult(BoxCode.tbl_cabinet_command.result.TOBESEND);
		JsonObjectData jsonData = new JsonObjectData();
		jsonData.setLevel(openLevel);
		CellOpen cellOpen = new CellOpen();
		cellOpen.setPort(port);
		jsonData.setCells(new CellOpen[] { cellOpen });
		Command command = new Command();
		command.setServiceName(Const.REMOTE_SERVICENAME_OPENCELL);
		command.setJsonObjectData(jsonData);
		String commandJson = JSONObject
				.toJSONStringWithDateFormat(command, "yyyy-MM-dd HH:mm:ss",
						SerializerFeature.WriteDateUseDateFormat);
		cabinetCommand.setCommand(commandJson);
		cabinetCommand.setRemark("云端远程开箱");
		if (cabinetService.remoteConsole(cabinetCommand) != null) {
			j.setSucc(true);
			j.setMsg("控制指令创建成功!");
			/*
			 * loggerService.addCabinetRemoteLog(cabinetCommand,
			 * SessionInfo.getSessionInfo(req));
			 */
		}
		// 记录开箱动作,写入格子操作日志
		cellService.addCellPorcessLog(cell_id,
				BoxCode.Tbl_cell_process_log.powder_type.PHOMEAPP,
				BoxCode.Tbl_cell_process_log.process_code.INTPUT,
				BoxCode.Tbl_cell_process_log.user_type.OWNER);
		return j;
	}

}

6 回复

如何这个不被过滤器过滤呢?

@Filters()

在那个位置?兽哥

入口方法上

已经查到了,再次表示感谢

添加回复
请先登陆
回到顶部