添加注释

This commit is contained in:
cjl
2019-01-11 17:57:35 +08:00
parent 85d96bb226
commit 36139e26a4
2 changed files with 134 additions and 120 deletions

View File

@@ -1,119 +1,126 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.datasource.entities.App; import com.jsh.erp.datasource.entities.App;
import com.jsh.erp.service.app.AppService; import com.jsh.erp.service.app.AppService;
import com.jsh.erp.service.userBusiness.UserBusinessService; import com.jsh.erp.service.userBusiness.UserBusinessService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
/** /**
* @author ji_sheng_hua 752*718*920 * @author ji_sheng_hua 752*718*920
*/ */
@RestController @RestController
@RequestMapping(value = "/app") @RequestMapping(value = "/app")
public class AppController { public class AppController {
private Logger logger = LoggerFactory.getLogger(AppController.class); private Logger logger = LoggerFactory.getLogger(AppController.class);
@Resource @Resource
private AppService appService; private AppService appService;
@Resource @Resource
private UserBusinessService userBusinessService; private UserBusinessService userBusinessService;
/**
@GetMapping(value = "/findDesk") * create by: cjl
public JSONObject findDesk(HttpServletRequest request) { * description:
JSONObject obj = new JSONObject(); * 桌面菜单按钮初始化
List<App> dockList = appService.findDock(); * create time: 2019/1/11 17:01
JSONArray dockArray = new JSONArray(); * @Param: request
if (null != dockList) { * @return com.alibaba.fastjson.JSONObject
for (App app : dockList) { */
JSONObject item = new JSONObject(); @GetMapping(value = "/findDesk")
item.put("id", app.getId()); public JSONObject findDesk(HttpServletRequest request) {
item.put("title", app.getName()); JSONObject obj = new JSONObject();
item.put("type", app.getType()); List<App> dockList = appService.findDock();
item.put("icon", "../../upload/images/deskIcon/" + app.getIcon()); JSONArray dockArray = new JSONArray();
item.put("url", app.getUrl()); if (null != dockList) {
item.put("width", app.getWidth()); for (App app : dockList) {
item.put("height", app.getHeight()); JSONObject item = new JSONObject();
item.put("isresize", app.getResize()); item.put("id", app.getId());
item.put("isopenmax", app.getOpenmax()); item.put("title", app.getName());
item.put("isflash", app.getFlash()); item.put("type", app.getType());
dockArray.add(item); item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
} item.put("url", app.getUrl());
} item.put("width", app.getWidth());
obj.put("dock",dockArray); item.put("height", app.getHeight());
item.put("isresize", app.getResize());
List<App> deskList = appService.findDesk(); item.put("isopenmax", app.getOpenmax());
JSONArray deskArray = new JSONArray(); item.put("isflash", app.getFlash());
if (null != deskList) { dockArray.add(item);
for (App app : deskList) { }
JSONObject item = new JSONObject(); }
item.put("id", app.getId()); obj.put("dock",dockArray);
item.put("title", app.getName());
item.put("type", app.getType()); List<App> deskList = appService.findDesk();
item.put("icon", "../../upload/images/deskIcon/" + app.getIcon()); JSONArray deskArray = new JSONArray();
item.put("url", "../../pages/common/menu.html?appID=" + app.getNumber() + "&id=" + app.getId()); if (null != deskList) {
item.put("width", app.getWidth()); for (App app : deskList) {
item.put("height", app.getHeight()); JSONObject item = new JSONObject();
item.put("isresize", app.getResize()); item.put("id", app.getId());
item.put("isopenmax", app.getOpenmax()); item.put("title", app.getName());
item.put("isflash", app.getFlash()); item.put("type", app.getType());
deskArray.add(item); item.put("icon", "../../upload/images/deskIcon/" + app.getIcon());
} item.put("url", "../../pages/common/menu.html?appID=" + app.getNumber() + "&id=" + app.getId());
} item.put("width", app.getWidth());
obj.put("desk",deskArray); item.put("height", app.getHeight());
return obj; item.put("isresize", app.getResize());
} item.put("isopenmax", app.getOpenmax());
item.put("isflash", app.getFlash());
/** deskArray.add(item);
* 角色对应应用显示 }
* @param request }
* @return obj.put("desk",deskArray);
*/ return obj;
@PostMapping(value = "/findRoleAPP") }
public JSONArray findRoleAPP(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request) { /**
JSONArray arr = new JSONArray(); * 角色对应应用显示
try { * @param request
List<App> dataList = appService.findRoleAPP(); * @return
//开始拼接json数据 */
JSONObject outer = new JSONObject(); @PostMapping(value = "/findRoleAPP")
outer.put("id", 1); public JSONArray findRoleAPP(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
outer.put("text", "应用列表"); HttpServletRequest request) {
outer.put("state", "open"); JSONArray arr = new JSONArray();
//存放数据json数组 try {
JSONArray dataArray = new JSONArray(); List<App> dataList = appService.findRoleAPP();
if (null != dataList) { //开始拼接json数据
for (App app : dataList) { JSONObject outer = new JSONObject();
JSONObject item = new JSONObject(); outer.put("id", 1);
item.put("id", app.getId()); outer.put("text", "应用列表");
item.put("text", app.getName()); outer.put("state", "open");
//勾选判断1 //存放数据json数组
Boolean flag = false; JSONArray dataArray = new JSONArray();
try { if (null != dataList) {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + app.getId().toString() + "]"); for (App app : dataList) {
} catch (Exception e) { JSONObject item = new JSONObject();
logger.error(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + type + " KeyId为 " + keyId + " 存在异常!"); item.put("id", app.getId());
} item.put("text", app.getName());
if (flag == true) { //勾选判断1
item.put("checked", true); Boolean flag = false;
} try {
//结束 flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + app.getId().toString() + "]");
dataArray.add(item); } catch (Exception e) {
} logger.error(">>>>>>>>>>>>>>>>>设置角色对应的应用:类型" + type + " KeyId为 " + keyId + " 存在异常!");
} }
outer.put("children", dataArray); if (flag == true) {
arr.add(outer); item.put("checked", true);
} catch (Exception e) { }
e.printStackTrace(); //结束
} dataArray.add(item);
return arr; }
} }
} outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
e.printStackTrace();
}
return arr;
}
}

View File

@@ -28,7 +28,14 @@ public class AppService {
List<App> list = appMapper.selectByExample(example); List<App> list = appMapper.selectByExample(example);
return list; return list;
} }
/**
* create by: cjl
* description:
* 桌面功能菜单初始化列表
* create time: 2019/1/11 16:59
* @Param: null
* @return
*/
public List<App> findDesk(){ public List<App> findDesk(){
AppExample example = new AppExample(); AppExample example = new AppExample();
example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true); example.createCriteria().andZlEqualTo("desk").andEnabledEqualTo(true);