Ver Fonte

Merge remote-tracking branch 'origin/dev' into dev

wangliang há 4 anos atrás
pai
commit
676747af8f

+ 56 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/EnvBean.java

@@ -0,0 +1,56 @@
+package com.qmth.themis.business.bean.exam;
+
+import java.util.List;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("检查版本机构等环境信息返回信息")
+public class EnvBean {
+
+	@ApiModelProperty("version")
+	private VersionBean version;
+
+	@ApiModelProperty("orgInfo")
+	private OrgInfoBean orgInfo;
+
+	@ApiModelProperty("currentTime")
+	private Long currentTime;
+
+	@ApiModelProperty("黑名单资源文件下载地址")
+	private List<String> denyList;
+
+	public VersionBean getVersion() {
+		return version;
+	}
+
+	public void setVersion(VersionBean version) {
+		this.version = version;
+	}
+
+	public OrgInfoBean getOrgInfo() {
+		return orgInfo;
+	}
+
+	public void setOrgInfo(OrgInfoBean orgInfo) {
+		this.orgInfo = orgInfo;
+	}
+
+	public Long getCurrentTime() {
+		return currentTime;
+	}
+
+	public void setCurrentTime(Long currentTime) {
+		this.currentTime = currentTime;
+	}
+
+	public List<String> getDenyList() {
+		return denyList;
+	}
+
+	public void setDenyList(List<String> denyList) {
+		this.denyList = denyList;
+	}
+
+
+}

+ 43 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/OrgInfoBean.java

@@ -0,0 +1,43 @@
+package com.qmth.themis.business.bean.exam;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("机构信息")
+public class OrgInfoBean {
+
+	@ApiModelProperty("name")
+	private String name;
+
+	@ApiModelProperty("logo")
+	private String logo;
+
+	@ApiModelProperty("updateTime")
+	private Long updateTime;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getLogo() {
+		return logo;
+	}
+
+	public void setLogo(String logo) {
+		this.logo = logo;
+	}
+
+	public Long getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Long updateTime) {
+		this.updateTime = updateTime;
+	}
+
+
+}

+ 43 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/VersionBean.java

@@ -0,0 +1,43 @@
+package com.qmth.themis.business.bean.exam;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("版本信息")
+public class VersionBean {
+
+	@ApiModelProperty("name")
+	private String name;
+
+	@ApiModelProperty("value")
+	private Integer value;
+
+	@ApiModelProperty("url")
+	private String url;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Integer getValue() {
+		return value;
+	}
+
+	public void setValue(Integer value) {
+		this.value = value;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	
+}

+ 38 - 15
themis-exam/src/main/java/com/qmth/themis/exam/api/SysController.java

@@ -1,35 +1,58 @@
 package com.qmth.themis.exam.api;
 
-import com.qmth.themis.business.constant.SystemConstant;
-import com.qmth.themis.common.enums.ExceptionResultEnum;
-import com.qmth.themis.common.exception.BusinessException;
-import com.qmth.themis.common.util.Result;
-import com.qmth.themis.common.util.ResultUtil;
-import io.swagger.annotations.*;
+import java.util.Date;
+
+import javax.annotation.Resource;
+
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Objects;
+import com.qmth.themis.business.bean.exam.EnvBean;
+import com.qmth.themis.business.bean.exam.OrgInfoBean;
+import com.qmth.themis.business.bean.exam.VersionBean;
+import com.qmth.themis.business.entity.TBOrg;
+import com.qmth.themis.business.service.TBOrgService;
+import com.qmth.themis.common.util.Result;
+import com.qmth.themis.common.util.ResultUtil;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 
 @Api(tags = "系统信息Controller")
 @RestController
 @RequestMapping("/${prefix.url.exam}/sys")
 public class SysController {
+	
+	@Resource
+	private TBOrgService orgService;
 
     @ApiOperation(value = "获取环境接口")
     @RequestMapping(value = "/env", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "环境信息", response = Result.class)})
     public Result env(@ApiParam(value = "机构id", required = false) @RequestParam(required = false) Long orgId) {
+    	EnvBean env=new EnvBean();
+    	if(orgId!=null) {
+    		TBOrg org=orgService.getById(orgId);
+    		if(org!=null) {
+    			OrgInfoBean orgInfo=new OrgInfoBean();
+    			orgInfo.setLogo(org.getLogo());
+    			orgInfo.setName(org.getName());
+    			orgInfo.setUpdateTime((org.getUpdateTime()==null?null:org.getUpdateTime().getTime()));
+    			env.setOrgInfo(orgInfo);
+    		}
+    	}
+    	env.setCurrentTime(new Date().getTime());
+    	VersionBean v=new VersionBean();
+    	v.setName("1.2.0");
+    	v.setValue(12);
+    	v.setUrl("xxxxxx");
+    	env.setVersion(v);
 
-//        if (Objects.isNull(orgId) || Objects.equals(orgId, "")) {
-//            throw new BusinessException(ExceptionResultEnum.ORG_ID_IS_NULL);
-//        }
-//        SchoolDto schoolDto = (SchoolDto) redisTemplate.opsForValue().get(SystemConstant.SCHOOL_CACHE + orgId);
-//        Map map = new HashMap();
-//        map.put(SystemConstant.ENV_FILEHOST, schoolDto.getFileHost());
-//        return ResultUtil.ok(map);
-        return ResultUtil.ok(SystemConstant.SUCCESS);
+        return ResultUtil.ok(env);
     }
 }