mgt fix
mgt fix
This commit is contained in:
@@ -64,8 +64,8 @@ public class AccountsController {
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd(@ModelAttribute("appAccounts") Accounts appAccounts) {
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsAdd");
|
||||
Applications app= applicationsService.get(appAccounts.getAppId());
|
||||
appAccounts.setAppName(app.getName());
|
||||
//Applications app= applicationsService.get(appAccounts.getAppId());
|
||||
//appAccounts.setAppName(app.getName());
|
||||
modelAndView.addObject("model",appAccounts);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@@ -66,13 +66,14 @@ public class GroupMemberController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = { "/gridUserMemberInGroup" })
|
||||
@RequestMapping(value = { "/queryMemberInGroup" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<UserInfo> gridUserMemberInGroup(@ModelAttribute("groups") GroupMember groupMember) {
|
||||
public JpaPageResults<GroupMember> queryMemberInGroup(@ModelAttribute("groupMember") GroupMember groupMember) {
|
||||
_logger.debug("groupMember : "+groupMember);
|
||||
if(groupMember.getGroupId()==null||groupMember.getGroupId().equals("")||groupMember.getGroupId().equals("ALL_USER_GROUP")){
|
||||
return groupMemberService.gridAllMemberInGroup(groupMember);
|
||||
return groupMemberService.queryPageResults("allMemberInGroup",groupMember);
|
||||
}else{
|
||||
return groupMemberService.gridMemberInGroup(groupMember);
|
||||
return groupMemberService.queryPageResults("memberInGroup",groupMember);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,10 +86,10 @@ public class GroupMemberController {
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/gridUserMemberNotInGroup" })
|
||||
@RequestMapping(value = { "/queryMemberNotInGroup" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<UserInfo> queryUserMemberNotInGroupGrid(@ModelAttribute("groupMember") GroupMember groupMember) {
|
||||
return groupMemberService.gridMemberNotInGroup(groupMember);
|
||||
public JpaPageResults<GroupMember> queryMemberNotInGroupGrid(@ModelAttribute("groupMember") GroupMember groupMember) {
|
||||
return groupMemberService.queryPageResults("memberNotInGroup",groupMember);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,23 +125,17 @@ public class GroupMemberController {
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@ResponseBody
|
||||
public Message deleteGroupMember(@ModelAttribute("groupMember") GroupMember groupMember) {
|
||||
if (groupMember == null || groupMember.getGroupId() == null) {
|
||||
_logger.debug("groupMember : "+groupMember);
|
||||
|
||||
if (groupMember == null || groupMember.getId() == null) {
|
||||
return new Message("传入参数为空",MessageType.error);
|
||||
}
|
||||
String groupId = groupMember.getGroupId();
|
||||
|
||||
|
||||
boolean result = true;
|
||||
String memberIds = groupMember.getMemberId();
|
||||
String memberNames = groupMember.getMemberName();
|
||||
if (memberIds != null) {
|
||||
String[] arrMemberIds = memberIds.split(",");
|
||||
String[] arrMemberNames = memberNames.split(",");
|
||||
|
||||
String groupMemberIds = groupMember.getId();
|
||||
if (groupMemberIds != null) {
|
||||
String[] arrMemberIds = groupMemberIds.split(",");
|
||||
for (int i = 0; i < arrMemberIds.length; i++) {
|
||||
GroupMember newGroupMember = new GroupMember(groupId,groupMember.getGroupName(), arrMemberIds[i], arrMemberNames[i],"USER");
|
||||
newGroupMember.setId(newGroupMember.generateId());
|
||||
result = groupMemberService.delete(newGroupMember);
|
||||
groupMemberService.remove(arrMemberIds[i]);
|
||||
}
|
||||
if(!result) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_ERROR),MessageType.error);
|
||||
|
||||
@@ -35,12 +35,13 @@ public class GroupPrivilegesController {
|
||||
return new ModelAndView("groupapp/groupAppsList");
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/gridAppsInGroup" })
|
||||
@RequestMapping(value = { "/queryAppsInGroup" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<Applications> queryAppsInGroupGrid(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
|
||||
public JpaPageResults<GroupPrivileges> queryAppsInGroup(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
|
||||
|
||||
JpaPageResults<Applications> jqGridApp;
|
||||
jqGridApp= groupPrivilegesService.gridAppsInGroup(groupApp);
|
||||
JpaPageResults<GroupPrivileges> jqGridApp;
|
||||
|
||||
jqGridApp= groupPrivilegesService.queryPageResults("appsInGroup",groupApp);
|
||||
|
||||
if(jqGridApp!=null&&jqGridApp.getRows()!=null){
|
||||
for (Applications app : jqGridApp.getRows()){
|
||||
@@ -59,13 +60,12 @@ public class GroupPrivilegesController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = { "/appsNotInGroupGrid" })
|
||||
@RequestMapping(value = { "/queryAppsNotInGroup" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<Applications> queryAppsNotInGroupGrid(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
|
||||
|
||||
JpaPageResults<Applications> jqGridApp;
|
||||
public JpaPageResults<GroupPrivileges> queryAppsNotInGroup(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
|
||||
JpaPageResults<GroupPrivileges> jqGridApp;
|
||||
|
||||
jqGridApp= groupPrivilegesService.gridAppsNotInGroupGrid(groupApp);
|
||||
jqGridApp= groupPrivilegesService.queryPageResults("appsNotInGroup",groupApp);
|
||||
|
||||
if(jqGridApp!=null&&jqGridApp.getRows()!=null){
|
||||
for (Applications app : jqGridApp.getRows()){
|
||||
@@ -107,20 +107,18 @@ public class GroupPrivilegesController {
|
||||
@RequestMapping(value = {"/delete"})
|
||||
@ResponseBody
|
||||
public Message deleteGroupApp(@ModelAttribute("groupApp") GroupPrivileges groupApp) {
|
||||
if (groupApp == null || groupApp.getGroupId() == null) {
|
||||
if (groupApp == null || groupApp.getId() == null) {
|
||||
return new Message("传入参数为空",MessageType.error);
|
||||
}
|
||||
String groupId = groupApp.getGroupId();
|
||||
String privilegesIds = groupApp.getId();
|
||||
|
||||
|
||||
boolean result = true;
|
||||
String appIds = groupApp.getAppId();
|
||||
if (appIds != null) {
|
||||
String[] arrAppIds = appIds.split(",");
|
||||
if (privilegesIds != null) {
|
||||
String[] arrPrivilegesIds = privilegesIds.split(",");
|
||||
|
||||
for (int i = 0; i < arrAppIds.length; i++) {
|
||||
GroupPrivileges newGroupApp = new GroupPrivileges(groupId, arrAppIds[i]);
|
||||
result = groupPrivilegesService.delete(newGroupApp);
|
||||
for (int i = 0; i < arrPrivilegesIds.length; i++) {
|
||||
result = groupPrivilegesService.remove(arrPrivilegesIds[i]);
|
||||
}
|
||||
if(!result) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_ERROR),MessageType.error);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class GroupsController {
|
||||
public Message delete(@ModelAttribute("group") Groups group) {
|
||||
_logger.debug("-delete group :" + group);
|
||||
|
||||
if (groupsService.delete(group)) {
|
||||
if (groupsService.remove(group.getId())) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.maxkey.web.contorller;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.dao.service.OrganizationsService;
|
||||
import org.maxkey.domain.Organizations;
|
||||
import org.maxkey.web.WebContext;
|
||||
@@ -24,7 +25,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Controller
|
||||
@RequestMapping({"/orgs"})
|
||||
public class OrganizationsController{
|
||||
public class OrganizationsController {
|
||||
static final Logger _logger = LoggerFactory.getLogger(OrganizationsController.class);
|
||||
|
||||
|
||||
@@ -36,35 +37,19 @@ public class OrganizationsController{
|
||||
@RequestMapping({"/tree"})
|
||||
public List<HashMap<String, Object>> organizationsTree(@RequestParam(value = "id", required = false) String id) {
|
||||
_logger.debug("organizationsTree id :" + id);
|
||||
Organizations org = new Organizations();
|
||||
List<Organizations> organizationsList = this.organizationsService.query(org);
|
||||
|
||||
Organizations rootOrganization = new Organizations();
|
||||
rootOrganization.setId("1");
|
||||
rootOrganization.setName("");
|
||||
rootOrganization.setFullName("");
|
||||
rootOrganization.setpName("Root");
|
||||
rootOrganization.setxPath("/1");
|
||||
rootOrganization.setxNamePath("/" );
|
||||
rootOrganization.setpId("-1");
|
||||
|
||||
Organizations queryOrg = new Organizations();
|
||||
List<Organizations> organizationsList = this.organizationsService.query(queryOrg);
|
||||
TreeNodeList treeNodeList = new TreeNodeList();
|
||||
TreeNode rootTreeNode = new TreeNode("1", "");
|
||||
rootTreeNode.setAttr("data", rootOrganization);
|
||||
rootTreeNode.setPId(rootOrganization.getpId());
|
||||
rootTreeNode.setAttr("open", Boolean.valueOf(true));
|
||||
treeNodeList.addTreeNode(rootTreeNode.getAttr());
|
||||
|
||||
for (Organizations organization : organizationsList) {
|
||||
TreeNode treeNode = new TreeNode(organization.getId(), organization.getName());
|
||||
if (organization.getHasChild() != null && organization.getHasChild().equals(Character.valueOf('Y'))) {
|
||||
for (Organizations org : organizationsList) {
|
||||
TreeNode treeNode = new TreeNode(org.getId(), org.getName());
|
||||
if (org.getHasChild() != null && org.getHasChild().startsWith("Y")) {
|
||||
treeNode.setHasChild();
|
||||
}
|
||||
|
||||
|
||||
treeNode.setAttr("data", organization);
|
||||
treeNode.setPId(organization.getpId());
|
||||
if (organization.getId().equals("1")) {
|
||||
treeNode.setAttr("data", org);
|
||||
treeNode.setPId(org.getpId());
|
||||
if (org.getId().equals("1")) {
|
||||
treeNode.setAttr("open", Boolean.valueOf(true));
|
||||
} else {
|
||||
treeNode.setAttr("open", Boolean.valueOf(false));
|
||||
@@ -78,10 +63,17 @@ public class OrganizationsController{
|
||||
|
||||
|
||||
|
||||
@RequestMapping({"/list"})
|
||||
public ModelAndView orgsTreeList() { return new ModelAndView("orgs/orgsList"); }
|
||||
@RequestMapping({ "/list" })
|
||||
public ModelAndView orgsTreeList() {
|
||||
return new ModelAndView("orgs/orgsList");
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/pageresults" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<Organizations> pageResults(@ModelAttribute("orgs") Organizations orgs) {
|
||||
return organizationsService.queryPageResults(orgs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping({"/orgsSelect/{deptId}/{department}"})
|
||||
@@ -93,20 +85,26 @@ public class OrganizationsController{
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd(@ModelAttribute("org") Organizations org) {
|
||||
ModelAndView modelAndView=new ModelAndView("/orgs/orgsAdd");
|
||||
org =organizationsService.get(org.getId());
|
||||
modelAndView.addObject("model",org);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping({"/add"})
|
||||
public Message insert(@ModelAttribute("organization") Organizations organization) {
|
||||
_logger.debug("-Add :" + organization);
|
||||
if (null == organization.getId() || organization.getId().equals("")) {
|
||||
organization.generateId();
|
||||
public Message insert(@ModelAttribute("org") Organizations org) {
|
||||
_logger.debug("-Add :" + org);
|
||||
if (null == org.getId() || org.getId().equals("")) {
|
||||
org.generateId();
|
||||
}
|
||||
|
||||
if (this.organizationsService.insert(organization)) {
|
||||
if (this.organizationsService.insert(org)) {
|
||||
return new Message(WebContext.getI18nValue("message.action.insert.success"), MessageType.success);
|
||||
}
|
||||
|
||||
@@ -122,9 +120,9 @@ public class OrganizationsController{
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping({"/query"})
|
||||
public Message query(@ModelAttribute("organization") Organizations organization) {
|
||||
_logger.debug("-query :" + organization);
|
||||
if (this.organizationsService.load(organization) != null) {
|
||||
public Message query(@ModelAttribute("org") Organizations org) {
|
||||
_logger.debug("-query :" + org);
|
||||
if (this.organizationsService.load(org) != null) {
|
||||
return new Message(WebContext.getI18nValue("message.action.insert.success"), MessageType.success);
|
||||
}
|
||||
|
||||
@@ -134,15 +132,22 @@ public class OrganizationsController{
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("/orgs/orgsUpdate");
|
||||
Organizations org =organizationsService.get(id);
|
||||
|
||||
modelAndView.addObject("model",org);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping({"/update"})
|
||||
public Message update(@ModelAttribute("organization") Organizations organization) {
|
||||
_logger.debug("-update organization :" + organization);
|
||||
if (this.organizationsService.update(organization)) {
|
||||
public Message update(@ModelAttribute("org") Organizations org) {
|
||||
_logger.debug("-update organization :" + org);
|
||||
if (this.organizationsService.update(org)) {
|
||||
return new Message(WebContext.getI18nValue("message.action.update.success"), MessageType.success);
|
||||
}
|
||||
|
||||
@@ -155,12 +160,11 @@ public class OrganizationsController{
|
||||
|
||||
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping({"/delete"})
|
||||
public Message delete(@ModelAttribute("organization") Organizations organization) {
|
||||
_logger.debug("-delete organization :" + organization);
|
||||
if (this.organizationsService.delete(organization)) {
|
||||
public Message delete(@ModelAttribute("org") Organizations org) {
|
||||
_logger.debug("-delete organization :" + org);
|
||||
if (this.organizationsService.remove(org.getId())) {
|
||||
return new Message(WebContext.getI18nValue("message.action.delete.success"), MessageType.success);
|
||||
}
|
||||
|
||||
@@ -172,4 +176,11 @@ public class OrganizationsController{
|
||||
|
||||
@RequestMapping({"/orgUsersList"})
|
||||
public ModelAndView orgUsersList() { return new ModelAndView("orgs/orgUsersList"); }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
package org.maxkey.web.contorller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.maxkey.dao.service.ReportService;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
/**
|
||||
* @author Crystal.Sea
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = { "/report" })
|
||||
public class ReportLoginController {
|
||||
final static Logger _logger = LoggerFactory.getLogger(ReportLoginController.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("reportService")
|
||||
private ReportService reportService;
|
||||
|
||||
|
||||
@RequestMapping(value = { "/login/day" })
|
||||
public ModelAndView dayReport(
|
||||
@RequestParam(value="reportDate",required=false) String reportDate) {
|
||||
ModelAndView modelAndView=new ModelAndView("report/login/day");
|
||||
if(reportDate==null||reportDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
reportDate=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
List<Map<String, Object>> listDayReport=reportService.analysisDay(reportDate);
|
||||
Integer[] dayReportArray=new Integer[24];
|
||||
for(int i=0;i<24;i++){
|
||||
dayReportArray[i]=0;
|
||||
}
|
||||
for(Map<String, Object> record :listDayReport){
|
||||
Integer count=Integer.parseInt(record.get("REPORTCOUNT").toString());
|
||||
int hour=Integer.parseInt(record.get("REPORTHOUR").toString());
|
||||
dayReportArray[hour]=count;
|
||||
}
|
||||
|
||||
String jsonDayReport=JsonUtils.gson2Json(dayReportArray);
|
||||
_logger.info(""+jsonDayReport);
|
||||
|
||||
modelAndView.addObject("dayReportArray",jsonDayReport);
|
||||
modelAndView.addObject("reportDate",reportDate);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/login/month" })
|
||||
public ModelAndView monthReport(
|
||||
@RequestParam(value="reportDate",required=false) String reportDate) {
|
||||
ModelAndView modelAndView=new ModelAndView("report/login/month");
|
||||
if(reportDate==null||reportDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
reportDate=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
List<Map<String, Object>> listMonthReport=reportService.analysisMonth(reportDate);
|
||||
Integer[] monthReportArray=new Integer[31];
|
||||
for(int i=0;i<31;i++){
|
||||
monthReportArray[i]=0;
|
||||
}
|
||||
for(Map<String, Object> record :listMonthReport){
|
||||
Integer count=Integer.parseInt(record.get("REPORTCOUNT").toString());
|
||||
int day=Integer.parseInt(record.get("REPORTDAY").toString());
|
||||
monthReportArray[day-1]=count;
|
||||
}
|
||||
|
||||
String jsonMonthReport=JsonUtils.gson2Json(monthReportArray);
|
||||
_logger.info(""+jsonMonthReport);
|
||||
|
||||
modelAndView.addObject("jsonMonthReport",jsonMonthReport);
|
||||
modelAndView.addObject("reportDate",reportDate);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/login/year" })
|
||||
public ModelAndView yearReport(
|
||||
@RequestParam(value="reportDate",required=false) Integer reportDate) {
|
||||
ModelAndView modelAndView=new ModelAndView("report/login/year");
|
||||
if(reportDate==null||reportDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
reportDate=Integer.parseInt(currentdateTime.toString( DateTimeFormat.forPattern("yyyy")));
|
||||
}
|
||||
|
||||
List<Map<String, Object>> listMonthReport=reportService.analysisYear(reportDate);
|
||||
|
||||
Integer[] monthReportArray=new Integer[12];
|
||||
for(int i=0;i<12;i++){
|
||||
monthReportArray[i]=0;
|
||||
}
|
||||
for(Map<String, Object> record :listMonthReport){
|
||||
Integer count=Integer.parseInt(record.get("REPORTCOUNT").toString());
|
||||
int month=Integer.parseInt(record.get("REPORTMONTH").toString());
|
||||
monthReportArray[month-1]=count;
|
||||
}
|
||||
|
||||
String jsonMonthReport=JsonUtils.gson2Json(monthReportArray);
|
||||
_logger.info(""+jsonMonthReport);
|
||||
|
||||
modelAndView.addObject("jsonMonthReport",jsonMonthReport);
|
||||
modelAndView.addObject("reportDate",reportDate);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/login/browser" })
|
||||
public ModelAndView browserReport(
|
||||
@RequestParam(value="startDate",required=false) String startDate,
|
||||
@RequestParam(value="endDate",required=false) String endDate) {
|
||||
ModelAndView modelAndView=new ModelAndView("report/login/browser");
|
||||
String startDateTime="";
|
||||
String endDateTime="";
|
||||
if(startDate==null||startDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
startDate=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd"));
|
||||
startDateTime=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd 00:00:00"));
|
||||
}else{
|
||||
startDateTime=startDate+" 00:00:00";
|
||||
}
|
||||
if(endDate==null||endDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
endDate=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd"));
|
||||
endDateTime=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd 23:59:59"));
|
||||
}else{
|
||||
endDateTime=endDate+" 23:59:59";
|
||||
}
|
||||
|
||||
Map<String,Object> reportDate=new HashMap<String,Object>();
|
||||
reportDate.put("startDate", startDateTime);
|
||||
reportDate.put("endDate", endDateTime);
|
||||
List<Map<String, Object>> listReport=reportService.analysisBrowser(reportDate);
|
||||
|
||||
Integer[] countArray=new Integer[listReport.size()];
|
||||
String [] categoryArray=new String[listReport.size()];
|
||||
String [] categoryPieArray=new String[listReport.size()];
|
||||
Map[] countPieArray=new HashMap[listReport.size()];
|
||||
for(int i=0;i<listReport.size();i++){
|
||||
countArray[i]=0;
|
||||
}
|
||||
int recordCount=listReport.size()-1;
|
||||
|
||||
Integer countAll=0;
|
||||
for(Map<String, Object> record :listReport){
|
||||
countAll=countAll+Integer.parseInt(record.get("REPORTCOUNT").toString());
|
||||
}
|
||||
_logger.info("countAll : "+countAll);
|
||||
|
||||
for(Map<String, Object> record :listReport){
|
||||
Integer count=Integer.parseInt(record.get("REPORTCOUNT").toString());
|
||||
String browser=record.get("BROWSER").toString();
|
||||
|
||||
countArray[recordCount]=count;
|
||||
categoryArray[recordCount]=browser;
|
||||
String pieBrowser=((count*100f)/countAll)+"";
|
||||
if(pieBrowser.length()>5){
|
||||
pieBrowser=browser+"("+(pieBrowser.substring(0, 5))+"%)";
|
||||
}else{
|
||||
pieBrowser=browser+"("+pieBrowser+"%)";
|
||||
}
|
||||
Map<String,Object> nameValue=new HashMap<String,Object>();
|
||||
nameValue.put("name", pieBrowser);
|
||||
nameValue.put("value", count);
|
||||
countPieArray[recordCount]=nameValue;
|
||||
categoryPieArray[recordCount]=pieBrowser;
|
||||
|
||||
_logger.info("count : "+count);
|
||||
|
||||
recordCount--;
|
||||
}
|
||||
|
||||
String jsonReport=JsonUtils.gson2Json(countArray);
|
||||
String categoryReport=JsonUtils.gson2Json(categoryArray);
|
||||
String pieReport=JsonUtils.gson2Json(countPieArray);
|
||||
String categoryPieReport=JsonUtils.gson2Json(categoryPieArray);
|
||||
_logger.info(""+jsonReport);
|
||||
|
||||
modelAndView.addObject("jsonReport",jsonReport);
|
||||
modelAndView.addObject("categoryReport",categoryReport);
|
||||
modelAndView.addObject("categoryPieReport",categoryPieReport);
|
||||
modelAndView.addObject("pieReport",pieReport);
|
||||
modelAndView.addObject("startDate",startDate);
|
||||
modelAndView.addObject("endDate",endDate);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/login/app" })
|
||||
public ModelAndView appReport(
|
||||
@RequestParam(value="startDate",required=false) String startDate,
|
||||
@RequestParam(value="endDate",required=false) String endDate) {
|
||||
ModelAndView modelAndView=new ModelAndView("report/login/app");
|
||||
String startDateTime="";
|
||||
String endDateTime="";
|
||||
if(startDate==null||startDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
startDate=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd"));
|
||||
startDateTime=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd 00:00:00"));
|
||||
}else{
|
||||
startDateTime=startDate+" 00:00:00";
|
||||
}
|
||||
if(endDate==null||endDate.equals("")){
|
||||
DateTime currentdateTime = new DateTime();
|
||||
endDate=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd"));
|
||||
endDateTime=currentdateTime.toString( DateTimeFormat.forPattern("yyyy-MM-dd 23:59:59"));
|
||||
}else{
|
||||
endDateTime=endDate+" 23:59:59";
|
||||
}
|
||||
|
||||
Map<String,Object> reportDate=new HashMap<String,Object>();
|
||||
reportDate.put("startDate", startDateTime);
|
||||
reportDate.put("endDate", endDateTime);
|
||||
List<Map<String, Object>> listReport=reportService.analysisApp(reportDate);
|
||||
|
||||
Integer[] countArray=new Integer[listReport.size()];
|
||||
String [] categoryArray=new String[listReport.size()];
|
||||
|
||||
for(int i=0;i<listReport.size();i++){
|
||||
countArray[i]=0;
|
||||
}
|
||||
int recordCount=listReport.size()-1;
|
||||
for(Map<String, Object> record :listReport){
|
||||
Integer count=Integer.parseInt(record.get("REPORTCOUNT").toString());
|
||||
String app=record.get("APPNAME").toString();
|
||||
countArray[recordCount]=count;
|
||||
categoryArray[recordCount]=app;
|
||||
|
||||
recordCount--;
|
||||
}
|
||||
|
||||
String jsonReport=JsonUtils.gson2Json(countArray);
|
||||
String categoryReport=JsonUtils.gson2Json(categoryArray);
|
||||
|
||||
_logger.info(""+jsonReport);
|
||||
|
||||
modelAndView.addObject("jsonReport",jsonReport);
|
||||
modelAndView.addObject("categoryReport",categoryReport);
|
||||
modelAndView.addObject("startDate",startDate);
|
||||
modelAndView.addObject("endDate",endDate);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import java.beans.PropertyEditorSupport;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -14,7 +13,6 @@ import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.dao.service.UserInfoService;
|
||||
import org.maxkey.domain.UserInfo;
|
||||
import org.maxkey.util.DateUtils;
|
||||
import org.maxkey.util.JsonUtils;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.maxkey.web.WebContext;
|
||||
@@ -87,13 +85,9 @@ public class UserInfoController {
|
||||
return new ModelAndView("/userinfo/usersList");
|
||||
}
|
||||
|
||||
@RequestMapping(value={"/usersSelect/{uid}/{username}"})
|
||||
public ModelAndView usersSelect(
|
||||
@PathVariable("uid") String uid,
|
||||
@PathVariable("username") String username){
|
||||
ModelAndView modelAndView= new ModelAndView("/userinfo/usersSelect");
|
||||
modelAndView.addObject("uid", uid);
|
||||
modelAndView.addObject("username", username);
|
||||
@RequestMapping(value={"/select"})
|
||||
public ModelAndView usersSelect(){
|
||||
ModelAndView modelAndView= new ModelAndView("/userinfo/userinfoSelect");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@@ -124,12 +118,10 @@ public class UserInfoController {
|
||||
@RequestMapping(value={"/forwardUpdate/{id}"})
|
||||
public ModelAndView forwardUpdateUsers(@PathVariable("id")String id){
|
||||
ModelAndView modelAndView=new ModelAndView("/userinfo/userUpdate");
|
||||
UserInfo userInfo=new UserInfo();
|
||||
userInfo.setId(id);
|
||||
userInfo=userInfoService.load(userInfo);
|
||||
WebContext.getSession().setAttribute(userInfo.getId(), userInfo.getPicture());
|
||||
|
||||
|
||||
UserInfo userInfo=userInfoService.get(id);
|
||||
if(userInfo.getPicture()!=null){
|
||||
WebContext.getSession().setAttribute(userInfo.getId(), userInfo.getPicture());
|
||||
}
|
||||
|
||||
modelAndView.addObject("model", userInfo);
|
||||
return modelAndView;
|
||||
@@ -234,9 +226,7 @@ public class UserInfoController {
|
||||
@RequestMapping(value={"/forwardChangePassword/{id}"})
|
||||
public ModelAndView forwardChangePassword(@PathVariable("id")String id){
|
||||
ModelAndView modelAndView=new ModelAndView("/userinfo/changePassword");
|
||||
UserInfo userInfo=new UserInfo();
|
||||
userInfo.setId(id);
|
||||
userInfo=userInfoService.load(userInfo);
|
||||
UserInfo userInfo=userInfoService.get(id);
|
||||
|
||||
modelAndView.addObject("model", userInfo);
|
||||
return modelAndView;
|
||||
|
||||
Reference in New Issue
Block a user