Commit bca92c3a by 罗绍泽

应用接口初始化

parent 84e9a1d3
......@@ -154,7 +154,7 @@ var result = jwAppPortletModel.jwAppsPortletActAction.saveLayout({
</tr>
<tr>
<td>参数备注</td>
<td>FIELD_COLUMN_ID:栏目id</td>
<td>1.columnsId:栏目id;2.portlets:portlets的id数组</td>
</tr>
<tr>
<td><span class="look">结果查看</span></td>
......
......@@ -5,6 +5,7 @@
<struts>
<package name="src_jwapp" extends="gaowj">
<!-- Portlet相关 -->
<action name="jwAppsPortletAct_*" class="com.jw.app.portlet.action.actAction"
method="{1}">
<result name="json" type="json">
......@@ -21,5 +22,18 @@
method="{1}">
<result name="{1}">/jwapp/pages/portlet/{1}.jsp</result>
</action>
<!-- 集成应用相关 -->
<action name="jwAppsAppstoreAct_*" class="com.jw.app.apps.action.actAction"
method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="jwAppsAppstoreData_*" class="com.jw.app.apps.action.dataAction"
method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
</package>
</struts>
package com.jw.app.apps.action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import net.sf.json.JSONObject;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Encipher;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.AppsBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.jw.app.business.utils.QueryParamUtil;
import com.jw.app.business.utils.Status;
public class actAction extends BasicAction{
/**
*
*/
private static final long serialVersionUID = 6517074422672442333L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public String insertAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
if(entity.get("PWD") != null){
entity.put("PWD", Encipher.EncodePasswd((String)entity.get("PWD")));
}
String returnid = "";
Map<String,Object> query = new HashMap<String,Object>();
query.put("APP_ID", entity.get("APP_ID"));
query.put("USERID", entity.get("USERID"));
List<Map<String, Object>> listData = business.list_app_account(query);
if(listData.size()<1){
returnid = business.insert_app_account(entity);
}
jsonObject.putAll(Status.getStatus(Status.INSERT_OK_RETURNID,returnid));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
if(entity.get("PWD") != null){
entity.put("PWD", Encipher.EncodePasswd((String)entity.get("PWD")));
}
business.update_app_account(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_app_account(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
try{
entity = QueryParamUtil.StringToDate(entity);
String returnid = business.insert_app(entity);
//操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertApp", ""+entity,"增加集成应用记录",returnid,(String)entity.get("NAME"),"JW_APPS_APPS_APP");
jsonObject.putAll(Status.getStatus(Status.INSERT_OK_RETURNID,returnid));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
// System.out.println("------update"+entity);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_app(entity);
//操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateApp", ""+entity,"修改集成应用记录",(String)entity.get("APP_ID"),(String)entity.get("NAME"),"JW_APPS_APPS_APP");
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
Map<String,Object>query=new HashMap<String, Object>();
deletekey="";
for (String string : ListKey) {
deletekey+="\'"+string+"\',";
}
deletekey = deletekey.substring(0,deletekey.length() - 1);
query.put("list", deletekey);
List<Map<String,Object>>list=business.list_app(query);
query=new HashMap<String, Object>();
//名称
String Name="";
for (Map<String, Object> map : list) {
Name+=map.get("NAME")+",";
}
query.put("NAME", Name);
business.delete_app(ListKey);
business.delete_install_app_id(ListKey);
business.delete_uninstall_app_id(ListKey);
//操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteApp", ""+ListKey.toString(),"删除集成应用记录",ListKey.toString(),query.toString(),"JW_APPS_APPS_APP");
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.insert_category(entity);
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_category(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_category(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertDefaultInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
SystemOpeBusiness business_sys = BusinessManager.getBusiness(SystemOpeBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
try{
entity = QueryParamUtil.StringToDate(entity);
List<Map<String,Object>> alluser=new ArrayList<Map<String,Object>>();
if(entity.get("G_ID")!=null&&!entity.get("G_ID").toString().equals("all"))
{
String gids[] = ((String)entity.get("G_ID")).split(",");
for(int i=0;i<gids.length;i++){
Map<String, Object>map=new HashMap<String, Object>();
map.put("EMDEPART", gids[i]);
List<Map<String,Object>> t_alluser= business_sys.listLoginUserInfo(map);
alluser.addAll(t_alluser);
}
}
else {
alluser= business_sys.listLoginUserInfo(null);
}
//删除原有此APP的所有用户
String app_id = (String) entity.get("APP_ID");
List<String> delApp = new ArrayList<String>();
delApp.add(app_id);
business.delete_install_app_id(delApp);
business.delete_uninstall_app_id(delApp);
//重新为所有用户安装此app
String is_default = (String) entity.get("IS_DEFAULT");
for(Map<String,Object> user:alluser){
Map<String,Object> entityNew = new HashMap<String,Object>();
entityNew.put("APP_ID", entity.get("APP_ID"));
entityNew.put("USERID", user.get("CODE"));
if(StringUtils.isNotEmpty(is_default) && StringUtils.equals(is_default, "1")){
business.insert_install(entityNew);
}else{
business.insert_uninstall(entityNew);
}
}
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String insertDefaultInstallNewUser() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
List<Map<String,Object>> alluser = business.list_userallapp_newuser(null);
for(Map<String,Object> user:alluser){
Map<String,Object> entityNew = new HashMap<String,Object>();
entityNew.put("APP_ID", entity.get("APP_ID"));
entityNew.put("USERID", user.get("CODE"));
business.insert_install(entityNew);
}
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String insertInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.insert_install(entity);
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_install(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_install(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteInstall_app_id() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_install_app_id(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteInstall_app_user() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_install_app_user(entity);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertUninstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.insert_uninstall(entity);
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateUninstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_uninstall(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteUninstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_uninstall(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteUninstall_app_id() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_uninstall_app_id(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteUninstall_app_user() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_uninstall_app_user(entity);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String uploadApp() throws BusinessException{
String upPath = request.getSession().getServletContext().getRealPath("/uploadFile/apps/apps");
super.setUserUploadFilePath(upPath);
return super.upload();
}
}
package com.jw.app.apps.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Encipher;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.SessionUtil;
import com.jw.app.business.AppsBusiness;
import com.jw.app.business.utils.QueryParamUtil;
public class dataAction extends BasicAction{
/**
*
*/
private static final long serialVersionUID = -4630126275397330597L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
rows = getPageSize();
return rows;
}
public void setRows(int rows) {
setPageSize(rows);
this.rows = getPageSize();
}
public int getPage() {
page = getPageNo();
return page;
}
public void setPage(int page) {
setPageNo(page);
this.page = getPageNo();
}
public String listAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_app_account(pageNo,pageSize,query);
for(Map<String,Object>m : pageRows.getItems()){
if(m.get("PWD")!=null){
m.put("PWD", Encipher.DecodePasswd((String)m.get("PWD")));
}
}
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listAllAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listData = business.list_app_account(query);
for(Map<String,Object>m : listData){
if(m.get("PWD")!=null){
m.put("PWD", Encipher.DecodePasswd((String)m.get("PWD")));
}
}
int listDataCount = business.listCount_app_account(query);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_app(pageNo,pageSize,query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listAllApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listData = business.list_apps_portal(query);
int listDataCount = business.listCount_app(query);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listAllCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listData = business.list_category(query);
int listDataCount = business.listCount_category(query);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listUserAllApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
query.put("USERID", SessionUtil.getCode());
Page<Map<String, Object>> pageRows = business.list_userallapp(pageNo,pageSize,query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
package com.jw.app.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface AppsBusiness {
//APP_ACCOUNT 模拟登陆帐号密码管理
String insert_app_account(Map<String,Object> entity) throws BusinessException ;
void update_app_account(Map<String,Object> entity) throws BusinessException ;
void delete_app_account(List<String> list)throws BusinessException;
Page<Map<String, Object>> list_app_account(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_app_account(Map<String, Object> query) throws BusinessException ;
int listCount_app_account(Map<String, Object> query) throws BusinessException ;
//APPS_APP app详细信息
String insert_app(Map<String,Object> entity) throws BusinessException ;
void update_app(Map<String,Object> entity) throws BusinessException ;
void delete_app(List<String> list)throws BusinessException;
Page<Map<String, Object>> list_app(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_app(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_apps_portal(Map<String, Object> query) throws BusinessException ;
int listCount_app(Map<String, Object> query) throws BusinessException ;
//APPS_CATEGORY app分类信息
void insert_category(Map<String,Object> entity) throws BusinessException ;
void update_category(Map<String,Object> entity) throws BusinessException ;
void delete_category(List<String> list)throws BusinessException;
Page<Map<String, Object>> list_category(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_category(Map<String, Object> query) throws BusinessException ;
int listCount_category(Map<String, Object> query) throws BusinessException ;
//APP_INSTALL app用户安装信息
void insert_install(Map<String,Object> entity) throws BusinessException ;
void update_install(Map<String,Object> entity) throws BusinessException ;
void delete_install(List<String> list)throws BusinessException;
void delete_install_app_id(List<String> list) throws BusinessException ;
void delete_install_app_user(Map<String, Object> query) throws BusinessException ;
Page<Map<String, Object>> list_install(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_install(Map<String, Object> query) throws BusinessException ;
int listCount_install(Map<String, Object> query) throws BusinessException ;
//APPS_UNINSTALL app用户卸载信息
void insert_uninstall(Map<String,Object> entity) throws BusinessException ;
void update_uninstall(Map<String, Object> query)throws BusinessException;
void delete_uninstall(List<String> list)throws BusinessException;
void delete_uninstall_app_id(List<String> list) throws BusinessException ;
void delete_uninstall_app_user(Map<String, Object> query) throws BusinessException ;
Page<Map<String, Object>> list_uninstall(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_uninstall(Map<String, Object> query) throws BusinessException ;
int listCount_uninstall(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP用户所有已安装和未安装app信息
Page<Map<String, Object>> list_userallapp(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_userallapp(Map<String, Object> query) throws BusinessException ;
int listCount_userallapp(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP_NEWUSER找出所有未安装app的信息
List<Map<String,Object>> list_userallapp_newuser(Map<String,Object> query) throws BusinessException ;
}
package com.jw.app.business.apps;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil;
import com.jw.app.business.AppsBusiness;
public class AppsBusinessImpl implements AppsBusiness {
private AppsDAO appsDAO;
public AppsDAO getAppsDAO() {
return appsDAO;
}
public void setAppsDAO(AppsDAO appsDAO) {
this.appsDAO = appsDAO;
}
/**--------------APPS_APP app详细信息---------------- **/
@Override
public String insert_app_account(Map<String, Object> entity)
throws BusinessException {
String new_id = java.util.UUID.randomUUID().toString();
if(entity.get("IDU")==null){
entity.put("IDU", new_id);
}
if(entity.get("USERID")==null){
entity.put("USERID", SessionUtil.getCode());
}
if(entity.get("SIGN")==null){
entity.put("SIGN", "1");
}
if(entity.get("ALIAS")==null){
entity.put("ALIAS", SessionUtil.getEmname());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_app_account(entity);
}
//
return new_id;
}
@Override
public void update_app_account(Map<String, Object> entity)
throws BusinessException {
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("IDU",str)) continue;
if (StringUtils.equalsIgnoreCase("USERID",str)) continue;
if (StringUtils.equalsIgnoreCase("APP_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_app_account(entity);
}
//
}
@Override
public void delete_app_account(List<String> list)
throws BusinessException {
appsDAO.delete_app_account(list);
}
@Override
public Page<Map<String, Object>> list_app_account(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_app_account(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_app_account(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_app_account(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_app_account(query);
}
@Override
public int listCount_app_account(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_app_account(query);
}
/**--------------APPS_APP app详细信息---------------- **/
@Override
public String insert_app(Map<String, Object> entity)
throws BusinessException {
String new_id = java.util.UUID.randomUUID().toString();
if(entity.get("APP_ID")==null){
entity.put("APP_ID", new_id);
}
if(entity.get("CREATE_TIME")==null){
entity.put("CREATE_TIME", new Date());
}
if(entity.get("CREATOR_ID")==null){
entity.put("CREATOR_ID", SessionUtil.getCode());
}
if(entity.get("NEED_HEAD")==null){
entity.put("NEED_HEAD", "0");
}
if(entity.get("DELETE_FLAG")==null){
entity.put("DELETE_FLAG", "0");
}
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_app(entity);
}
//
return new_id;
}
@Override
public void update_app(Map<String, Object> entity)
throws BusinessException {
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//删除原来的图片
if(entity.get("OLD_IMAGE")!=null){
String delFileName = (String) entity.get("OLD_IMAGE");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 不存在!");
}
entity.remove("OLD_IMAGE");
}
//
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("APP_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_app(entity);
}
//
}
@Override
public void delete_app(List<String> list)
throws BusinessException {
List<Map<String, Object>> list_delete_app = appsDAO.list_delete_app(list);
appsDAO.delete_app(list);
for(Map<String, Object> mfile : list_delete_app){
if(mfile.get("IMG_ID_L")!=null){
String delFileName = (String) mfile.get("IMG_ID_L");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(IMG_ID_L)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(IMG_ID_L)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(IMG_ID_L)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(IMG_ID_L)图片:"+delFileName+" 不存在!");
}
}else if(mfile.get("IMG_ID_M")!=null){
String delFileName = (String) mfile.get("IMG_ID_M");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(IMG_ID_M)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(IMG_ID_M)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(IMG_ID_M)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(IMG_ID_M)图片:"+delFileName+" 不存在!");
}
}else if(mfile.get("IMG_ID_S")!=null){
String delFileName = (String) mfile.get("IMG_ID_S");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(IMG_ID_S)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(IMG_ID_S)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(IMG_ID_S)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(IMG_ID_S)图片:"+delFileName+" 不存在!");
}
}
}
}
@Override
public Page<Map<String, Object>> list_app(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_app(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_app(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_app(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_app(query);
}
@Override
public int listCount_app(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_app(query);
}
/**--------------APPS_CATEGORY app分类信息---------------- **/
@Override
public void insert_category(Map<String, Object> entity)
throws BusinessException {
if(entity.get("CATEGORY_ID")==null){
entity.put("CATEGORY_ID", java.util.UUID.randomUUID().toString());
}
if(entity.get("CREATE_TIME")==null){
entity.put("CREATE_TIME", new Date());
}
if(entity.get("CREATOR_ID")==null){
entity.put("CREATOR_ID", SessionUtil.getCode());
}
if(entity.get("DELETE_FLAG")==null){
entity.put("DELETE_FLAG", "0");
}
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_category(entity);
}
//
}
@Override
public void update_category(Map<String, Object> entity)
throws BusinessException {
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("CATEGORY_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_category(entity);
}
//
}
@Override
public void delete_category(List<String> list)
throws BusinessException {
appsDAO.delete_category(list);
}
@Override
public Page<Map<String, Object>> list_category(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_category(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_category(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_category(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_category(query);
}
@Override
public int listCount_category(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_category(query);
}
/**--------------APP_INSTALL app用户安装信息 ---------------- **/
@Override
public void insert_install(Map<String, Object> entity)
throws BusinessException {
if(entity.get("RESOURCE_ID")==null){
entity.put("RESOURCE_ID", java.util.UUID.randomUUID().toString());
}
if(entity.get("USERID")==null){
entity.put("USERID", SessionUtil.getCode());
}
if(entity.get("INSTALL_TIME")==null){
entity.put("INSTALL_TIME", new Date());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_install(entity);
}
//
}
@Override
public void update_install(Map<String, Object> entity)
throws BusinessException {
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("RESOURCE_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_install(entity);
}
//
}
@Override
public void delete_install(List<String> list)
throws BusinessException {
appsDAO.delete_install(list);
}
@Override
public void delete_install_app_id(List<String> list)
throws BusinessException {
appsDAO.delete_install_app_id(list);
}
@Override
public void delete_install_app_user(Map<String, Object> query)
throws BusinessException {
if(query.get("USERID")==null){
query.put("USERID", SessionUtil.getCode());
}
appsDAO.delete_install_app_user(query);
}
@Override
public Page<Map<String, Object>> list_install(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_install(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_install(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_install(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_install(query);
}
@Override
public int listCount_install(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_install(query);
}
/**--------------APPS_UNINSTALL app用户卸载信息 ---------------- **/
@Override
public void insert_uninstall(Map<String, Object> entity)
throws BusinessException {
if(entity.get("RESOURCE_ID")==null){
entity.put("RESOURCE_ID", java.util.UUID.randomUUID().toString());
}
if(entity.get("USERID")==null){
entity.put("USERID", SessionUtil.getCode());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_uninstall(entity);
}
//
}
@Override
public void update_uninstall(Map<String, Object> entity)
throws BusinessException {
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("RESOURCE_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_uninstall(entity);
}
//
}
@Override
public void delete_uninstall(List<String> list)
throws BusinessException {
appsDAO.delete_uninstall(list);
}
@Override
public void delete_uninstall_app_id(List<String> list)
throws BusinessException {
appsDAO.delete_uninstall_app_id(list);
}
@Override
public void delete_uninstall_app_user(Map<String, Object> query)
throws BusinessException {
if(query.get("USERID")==null){
query.put("USERID", SessionUtil.getCode());
}
appsDAO.delete_uninstall_app_user(query);
}
@Override
public Page<Map<String, Object>> list_uninstall(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_uninstall(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_uninstall(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_uninstall(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_uninstall(query);
}
@Override
public int listCount_uninstall(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_uninstall(query);
}
/**--------------APPS_USERALLAPP用户所有已安装和未安装app信息 ---------------- **/
@Override
public Page<Map<String, Object>> list_userallapp(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_userallapp(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_userallapp(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
/**--------------APPS_USERALLAPP_NEWUSER找出所有未安装app的信息 ---------------- **/
@Override
public List<Map<String, Object>> list_userallapp(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_userallapp(query);
}
@Override
public int listCount_userallapp(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_userallapp(query);
}
@Override
public List<Map<String, Object>> list_userallapp_newuser(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_userallapp_newuser(query);
}
@Override
public List<Map<String, Object>> list_apps_portal(Map<String, Object> query) throws BusinessException {
return appsDAO.list_apps_portal(query);
}
}
package com.jw.app.business.apps;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface AppsDAO {
//APP_ACCOUNT 模拟登陆帐号密码管理
void insert_app_account(Map<String,Object> entity) throws BusinessException ;
void update_app_account(Map<String,Object> entity) throws BusinessException ;
void delete_app_account(List<String> list) throws BusinessException;
List<Map<String,Object>> list_app_account(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_app_account(Map<String,Object> query) throws BusinessException ;
int listCount_app_account(Map<String, Object> query) throws BusinessException ;
//APPS_APP app详细信息
void insert_app(Map<String,Object> entity) throws BusinessException ;
void update_app(Map<String,Object> entity) throws BusinessException ;
void delete_app(List<String> list) throws BusinessException;
List<Map<String,Object>> list_app(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_app(Map<String,Object> query) throws BusinessException ;
int listCount_app(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_delete_app(List<String> list) throws BusinessException;
//APPS_CATEGORY app分类信息
void insert_category(Map<String,Object> entity) throws BusinessException ;
void update_category(Map<String,Object> entity) throws BusinessException ;
void delete_category(List<String> list) throws BusinessException;
List<Map<String,Object>> list_category(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_category(Map<String,Object> query) throws BusinessException ;
int listCount_category(Map<String, Object> query) throws BusinessException ;
//APP_INSTALL app用户安装信息
void insert_install(Map<String,Object> entity) throws BusinessException ;
void update_install(Map<String,Object> entity) throws BusinessException ;
void delete_install(List<String> list) throws BusinessException;
void delete_install_app_id(List<String> list) throws BusinessException ;
void delete_install_app_user(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_install(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_install(Map<String,Object> query) throws BusinessException ;
int listCount_install(Map<String, Object> query) throws BusinessException ;
//APPS_UNINSTALL app用户卸载信息
void insert_uninstall(Map<String,Object> entity) throws BusinessException ;
void update_uninstall(Map<String,Object> entity) throws BusinessException ;
void delete_uninstall(List<String> list) throws BusinessException;
void delete_uninstall_app_id(List<String> list) throws BusinessException ;
void delete_uninstall_app_user(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_uninstall(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_uninstall(Map<String,Object> query) throws BusinessException ;
int listCount_uninstall(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP用户所有已安装和未安装app信息
List<Map<String,Object>> list_userallapp(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_userallapp(Map<String,Object> query) throws BusinessException ;
int listCount_userallapp(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP_NEWUSER找出所有未安装app的信息
List<Map<String,Object>> list_userallapp_newuser(Map<String,Object> query) throws BusinessException ;
List<Map<String,Object>> list_apps_portal(Map<String,Object> query) throws BusinessException ;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jw.app.business.apps.AppsDAO">
<!-- APP_ACCOUNT 模拟登陆帐号密码管理 -->
<insert id="insert_app_account" parameterType="map">
insert into APP_ACCOUNT(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_app_account" parameterType="map">
<![CDATA[
update APP_ACCOUNT set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="IDU != null and IDU != ''">
and IDU = #{IDU}
</if>
<if test="USERID != null and USERID != ''">
and USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</where>
</update>
<delete id="delete_app_account" parameterType="list">
<![CDATA[
delete from APP_ACCOUNT where IDU IN
]]>
<foreach collection="list" item="IDU" open="(" separator="," close=")">
#{IDU}
</foreach>
</delete>
<select id="list_app_account" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APP_ACCOUNT f where 1=1
]]>
<if test="IDU != null and IDU != ''">
and f.IDU = #{IDU}
</if>
<if test="ALIAS != null and ALIAS != ''">
and f.ALIAS like '%${ALIAS}%'
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="ACCOUNTU != null and ACCOUNTU != ''">
and f.ACCOUNTU = #{ACCOUNTU}
</if>
<if test="PWD != null and PWD != ''">
and f.PWD = #{PWD}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
</select>
<select id="listCount_app_account" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APP_ACCOUNT f where 1=1
]]>
<if test="IDU != null and IDU != ''">
and f.IDU = #{IDU}
</if>
<if test="ALIAS != null and ALIAS != ''">
and f.ALIAS like '%${ALIAS}%'
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="ACCOUNTU != null and ACCOUNTU != ''">
and f.ACCOUNTU = #{ACCOUNTU}
</if>
<if test="PWD != null and PWD != ''">
and f.PWD = #{PWD}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
</select>
<!-- APPS_APP app详细信息 -->
<insert id="insert_app" parameterType="map">
insert into APPS_APP(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_app" parameterType="map">
<![CDATA[
update APPS_APP set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</where>
</update>
<delete id="delete_app" parameterType="list">
<![CDATA[
delete APPS_APP where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</delete>
<select id="list_app" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APPS_APP f where 1=1
]]>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and f.CATEGORY = #{CATEGORY}
</if>
<if test="IS_CLASSIC != null and IS_CLASSIC != ''">
and f.IS_CLASSIC = #{IS_CLASSIC}
</if>
<if test="IS_DEFAULT != null and IS_DEFAULT != ''">
and f.IS_DEFAULT = #{IS_DEFAULT}
</if>
<if test="APP_CODE != null and APP_CODE != ''">
and f.APP_CODE = #{APP_CODE}
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.OPEN_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.OPEN_TIME &lt;= #{END_TIME}
</if>
<if test="list != null and list != ''">
and f.APP_ID in ( ${list} )
</if>
<if test="G_ID != null and G_ID != ''">
and f.G_ID like '%${G_ID}%'
</if>
<if test="ORDERBY != null and ORDERBY != ''">
order by '${ORDERBY}'
</if>
</select>
<select id="listCount_app" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_APP f where 1=1
]]>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and f.CATEGORY = #{CATEGORY}
</if>
<if test="IS_CLASSIC != null and IS_CLASSIC != ''">
and f.IS_CLASSIC = #{IS_CLASSIC}
</if>
<if test="IS_DEFAULT != null and IS_DEFAULT != ''">
and f.IS_DEFAULT = #{IS_DEFAULT}
</if>
<if test="APP_CODE != null and APP_CODE != ''">
and f.APP_CODE = #{APP_CODE}
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.OPEN_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.OPEN_TIME &lt;= #{END_TIME}
</if>
<if test="list != null and list != ''">
and f.APP_ID in ( ${list} )
</if>
<if test="G_ID != null and G_ID != ''">
and f.G_ID like '%${G_ID}%'
</if>
</select>
<select id="list_delete_app" parameterType="list" resultType="upperCaseKeyMap">
<![CDATA[
select APP_ID,IMG_ID_L,IMG_ID_M,IMG_ID_S from APPS_APP where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</select>
<!-- APPS_CATEGORY app分类信息 -->
<insert id="insert_category" parameterType="map">
insert into APPS_CATEGORY(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_category" parameterType="map">
<![CDATA[
update APPS_CATEGORY set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="CATEGORY_ID != null and CATEGORY_ID != ''">
and CATEGORY_ID = #{CATEGORY_ID}
</if>
</where>
</update>
<delete id="delete_category" parameterType="list">
<![CDATA[
delete APPS_CATEGORY where DELETE_FLAG = '1' AND CATEGORY_ID IN
]]>
<foreach collection="list" item="CATEGORY_ID" open="(" separator="," close=")">
#{CATEGORY_ID}
</foreach>
</delete>
<select id="list_category" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APPS_CATEGORY f where 1=1
]]>
<if test="CATEGORY_ID != null and CATEGORY_ID != ''">
and f.CATEGORY_ID = #{CATEGORY_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
order by DISPLAY_ORDER
</select>
<select id="listCount_category" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_CATEGORY f where 1=1
]]>
<if test="CATEGORY_ID != null and CATEGORY_ID != ''">
and f.CATEGORY_ID = #{CATEGORY_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
</select>
<!-- APP_INSTALL app用户安装信息 -->
<insert id="insert_install" parameterType="map">
insert into APP_INSTALL(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_install" parameterType="map">
<![CDATA[
update APP_INSTALL set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and RESOURCE_ID = #{RESOURCE_ID}
</if>
</where>
</update>
<delete id="delete_install" parameterType="list">
<![CDATA[
delete from APP_INSTALL where RESOURCE_ID IN
]]>
<foreach collection="list" item="RESOURCE_ID" open="(" separator="," close=")">
#{RESOURCE_ID}
</foreach>
</delete>
<delete id="delete_install_app_id" parameterType="list">
<![CDATA[
delete from APP_INSTALL where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</delete>
<delete id="delete_install_app_user" parameterType="map">
<![CDATA[
delete from APP_INSTALL where USERID = #{USERID}
]]>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</delete>
<select id="list_install" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*,app.NAME APPNAME,app.PUB_DATE APPPUB_DATE,app.CATEGORY APPCATEGORY,app.LINK APPLINK,app.IMG_ID_L APPIMG_ID_L,app.IMG_ID_M APPIMG_ID_M,
app.IMG_ID_S APPIMG_ID_S
from APP_INSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and f.RESOURCE_ID = #{RESOURCE_ID}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and app.CATEGORY = #{CATEGORY}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.INSTALL_TIME &gt;= #{INSTALL_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.INSTALL_TIME &lt;= #{INSTALL_TIME}
</if>
order by ORDER_NUM
</select>
<select id="listCount_install" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from from APP_INSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and f.RESOURCE_ID = #{RESOURCE_ID}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and app.CATEGORY = #{CATEGORY}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.INSTALL_TIME &gt;= #{INSTALL_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.INSTALL_TIME &lt;= #{INSTALL_TIME}
</if>
</select>
<!-- APPS_UNINSTALL app用户卸载信息 -->
<insert id="insert_uninstall" parameterType="map">
insert into APPS_UNINSTALL(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_uninstall" parameterType="map">
<![CDATA[
update APPS_UNINSTALL set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and RESOURCE_ID = #{RESOURCE_ID}
</if>
</where>
</update>
<delete id="delete_uninstall" parameterType="list">
<![CDATA[
delete from APPS_UNINSTALL where RESOURCE_ID IN
]]>
<foreach collection="list" item="RESOURCE_ID" open="(" separator="," close=")">
#{RESOURCE_ID}
</foreach>
</delete>
<delete id="delete_uninstall_app_id" parameterType="list">
<![CDATA[
delete from APPS_UNINSTALL where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</delete>
<delete id="delete_uninstall_app_user" parameterType="map">
<![CDATA[
delete from APPS_UNINSTALL where USERID = #{USERID}
]]>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</delete>
<select id="list_uninstall" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*,app.NAME APPNAME,app.PUB_DATE APPPUB_DATE,app.CATEGORY APPCATEGORY,app.LINK APPLINK,app.IMG_ID_L APPIMG_ID_L,app.IMG_ID_M APPIMG_ID_M,
app.IMG_ID_S APPIMG_ID_S
from APPS_UNINSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
</select>
<select id="listCount_uninstall" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_UNINSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
</select>
<select id="list_userallapp" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APPS_USERALLAPP f
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="APPNAME != null and APPNAME != ''">
and f.APPNAME like '%${APPNAME}%'
</if>
<if test="INSTALL_STATUS != null and INSTALL_STATUS != ''">
and f.INSTALL_STATUS = #{INSTALL_STATUS}
</if>
<if test="APPCATEGORY != null and APPCATEGORY != ''">
and f.APPCATEGORY = #{APPCATEGORY}
</if>
<if test="APPIS_CLASSIC != null and APPIS_CLASSIC != ''">
and f.APPIS_CLASSIC = #{APPIS_CLASSIC}
</if>
<if test="APPIS_DEFAULT != null and APPIS_DEFAULT != ''">
and f.APPIS_DEFAULT = #{APPIS_DEFAULT}
</if>
</select>
<select id="listCount_userallapp" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_USERALLAPP f
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="APPNAME != null and APPNAME != ''">
and f.APPNAME like '%${APPNAME}%'
</if>
<if test="INSTALL_STATUS != null and INSTALL_STATUS != ''">
and f.INSTALL_STATUS = #{INSTALL_STATUS}
</if>
<if test="APPCATEGORY != null and APPCATEGORY != ''">
and f.APPCATEGORY = #{APPCATEGORY}
</if>
<if test="APPIS_CLASSIC != null and APPIS_CLASSIC != ''">
and f.APPIS_CLASSIC = #{APPIS_CLASSIC}
</if>
<if test="APPIS_DEFAULT != null and APPIS_DEFAULT != ''">
and f.APPIS_DEFAULT = #{APPIS_DEFAULT}
</if>
</select>
<select id="list_userallapp_newuser" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.* from APPS_USERALLAPP_NEWUSER f where 1=1
]]>
</select>
<select id="list_apps_portal" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.* from b_t_ufp_apps f where f.IS_DELETE=0
]]>
</select>
</mapper>
\ No newline at end of file
......@@ -16,13 +16,13 @@ import com.jw.app.business.PortletBusiness;
import com.jw.app.business.utils.QueryParamUtil;
public class PortletBusinessImpl implements PortletBusiness {
/**
* 默认模板的标识符
*/
private static final String DEFAULT="default";
private PortletDAO portletDAO;
private static final String DEFAULT = "default";
private PortletDAO portletDAO;
public PortletDAO getPortletDAO() {
return portletDAO;
......@@ -32,38 +32,18 @@ public class PortletBusinessImpl implements PortletBusiness {
this.portletDAO = portletDAO;
}
@Override
public List<Map<String, Object>> list_portlet_template_by_user(Map<String, Object> query)
throws BusinessException {
List<Map<String, Object>> listData=null;
public List<Map<String, Object>> list_portlet_template_by_user(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData = null;
try {
query.put("USER_ID", SessionUtil.getEmid());
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
if(listData.size()==0){
//如果当前登陆人还没有设置自定义的资源,则显示默认的资源
if (listData.size() == 0) {
// 如果当前登陆人还没有设置自定义的资源,则显示默认的资源
query.put("USER_ID", DEFAULT);
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
}
for(Map<String, Object> map:listData){
if("5".equals(map.get("P_TYPE"))){
//如果是内容发布,则将内容发布的信息传回去
Map<String, Object> contentQuery=new HashMap<String, Object>();
contentQuery.put("PORTAL_ID", map.get("PORTLET_ID"));
List<Map<String, Object>> listInfo=portletDAO.list_portlet_content(contentQuery);
map.put("INFOS", listInfo);
}else if("4".equals(map.get("P_TYPE"))){
//如果是模拟登陆,则把登录的url和用户密码传回去
Map<String, Object> appQuery=new HashMap<String, Object>();
//当前登陆人,当前需要模拟登录的APP_ID
appQuery.put("APP_ID", map.get("APP_ID"));
appQuery.put("USER_ID", SessionUtil.getEmid());
List<Map<String, Object>> listWebInfo=portletDAO.list_app_acount(appQuery);
if(listWebInfo.size()>0){
map.put("WEB_INFO", listWebInfo.get(0));
}
}
}
manageMap(listData);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -74,9 +54,36 @@ public class PortletBusinessImpl implements PortletBusiness {
return listData;
}
/**
* 处理特殊信息
*
* @param listData
*/
private void manageMap(List<Map<String, Object>> listData) {
for (Map<String, Object> map : listData) {
if ("5".equals(map.get("P_TYPE"))) {
// 如果是内容发布,则将内容发布的信息传回去
Map<String, Object> contentQuery = new HashMap<String, Object>();
contentQuery.put("PORTAL_ID", map.get("PORTLET_ID"));
List<Map<String, Object>> listInfo = portletDAO.list_portlet_content(contentQuery);
map.put("INFOS", listInfo);
} else if ("4".equals(map.get("P_TYPE"))) {
// 如果是模拟登陆,则把登录的url和用户密码传回去
Map<String, Object> appQuery = new HashMap<String, Object>();
// 当前登陆人,当前需要模拟登录的APP_ID
appQuery.put("APP_ID", map.get("APP_ID"));
appQuery.put("USER_ID", SessionUtil.getEmid());
List<Map<String, Object>> listWebInfo = portletDAO.list_app_acount(appQuery);
if (listWebInfo.size() > 0) {
map.put("WEB_INFO", listWebInfo.get(0));
}
}
}
}
@Override
public List<Map<String, Object>> list_portlet_columns(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData=null;
List<Map<String, Object>> listData = null;
try {
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_columns(query));
} catch (IOException e) {
......@@ -91,9 +98,10 @@ public class PortletBusinessImpl implements PortletBusiness {
@Override
public List<Map<String, Object>> list_portlet_template(Map<String, Object> query) throws BusinessException {
List<Map<String, Object>> listData=null;
List<Map<String, Object>> listData = null;
try {
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template(query));
manageMap(listData);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -105,44 +113,44 @@ public class PortletBusinessImpl implements PortletBusiness {
}
@Override
public void saveLayout(String columnsId,List<Map<String, Object>> list) throws BusinessException {
String userId=SessionUtil.getEmid();
List<Map<String, Object>> listData=null;
public void saveLayout(String columnsId, List<Map<String, Object>> list) throws BusinessException {
String userId = SessionUtil.getEmid();
List<Map<String, Object>> listData = null;
try {
Map<String,Object> query=new HashMap<String, Object>();
Map<String, Object> query = new HashMap<String, Object>();
query.put("USER_ID", userId);
query.put("COLUMN_ID", columnsId);
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
if(listData.size()==0){
//如果当前登陆人没有设置自己的模板布局,则查询默认的布局
if (listData.size() == 0) {
// 如果当前登陆人没有设置自己的模板布局,则查询默认的布局
query.put("USER_ID", DEFAULT);
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
}
//验证用户传过来的布局和数据库中的布局是否一致,默认为一致
boolean same=true;
if(listData.size()!=list.size()){
same=false;
}else{
//长度一致的情况下,判断每一个索引所在位置的portletId是否一致
for(int i=0;i<listData.size();i++){
//只要有一个不满足,则设置same为false
if(!listData.get(i).get("PORTLET_ID").equals(list.get(i).get("PORTLET_ID"))){
same=false;
// 验证用户传过来的布局和数据库中的布局是否一致,默认为一致
boolean same = true;
if (listData.size() != list.size()) {
same = false;
} else {
// 长度一致的情况下,判断每一个索引所在位置的portletId是否一致
for (int i = 0; i < listData.size(); i++) {
// 只要有一个不满足,则设置same为false
if (!listData.get(i).get("PORTLET_ID").equals(list.get(i).get("PORTLET_ID"))) {
same = false;
break;
}
}
}
if(!same){
//如果不一致,则将用户的自定义模板布局删除,重新添加新布局进行保存
Map<String,Object> deleteQuery=new HashMap<String, Object>();
if (!same) {
// 如果不一致,则将用户的自定义模板布局删除,重新添加新布局进行保存
Map<String, Object> deleteQuery = new HashMap<String, Object>();
deleteQuery.put("USER_ID", userId);
portletDAO.delete_portlet_template_user(deleteQuery);
//重新添加
int index=0;
// 重新添加
int index = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String now=formatter.format(new Date());
for(Map<String, Object> map:list){
String now = formatter.format(new Date());
for (Map<String, Object> map : list) {
map.put("ID", UUID.randomUUID().toString());
map.put("USER_ID", userId);
map.put("ORDER_NUM", index++);
......@@ -160,14 +168,14 @@ public class PortletBusinessImpl implements PortletBusiness {
e.printStackTrace();
}
}
private List<Map<String,Object>> mapToList(Map<String, Object> map){
List<Map<String,Object>> entity=new ArrayList<Map<String,Object>>();
for (Map.Entry<String,Object> entry : map.entrySet()) {
Map<String,Object> field=new HashMap<String, Object>();
field.put("key", entry.getKey());
field.put("value", entry.getValue());
entity.add(field);
private List<Map<String, Object>> mapToList(Map<String, Object> map) {
List<Map<String, Object>> entity = new ArrayList<Map<String, Object>>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
Map<String, Object> field = new HashMap<String, Object>();
field.put("key", entry.getKey());
field.put("value", entry.getValue());
entity.add(field);
}
return entity;
}
......
......@@ -115,10 +115,19 @@
<select id="list_app_acount" parameterType="map"
resultType="upperCaseKeyMap">
select btua.*,btumu.USER_NAME,btumu.USER_PWD,btumu.USER_ID from b_t_ufp_apps btua
left join b_t_ufp_mapper_user btumu
on btua.APP_ID=btumu.APP_ID
WHERE btumu.USER_ID=#{USER_ID} AND btua.APP_ID=#{APP_ID}
SELECT
btua.*, btumu.USER_NAME,
btumu.USER_PWD,
btumu.USER_ID,
ctso.USER_ID AS SSO_USER_ID
FROM
b_t_ufp_apps btua
LEFT JOIN b_t_ufp_mapper_user btumu ON btua.APP_ID = btumu.APP_ID
LEFT JOIN c_t_sys_otherlogin ctso ON btumu.USER_ID = ctso.USER_SYS_NAME
AND btumu.APP_ID = ctso.YIYONG_ID
WHERE
ctso.USER_ID = #{USER_ID}
AND ctso.YIYONG_ID = #{APP_ID}
</select>
<delete id="delete_portlet_template_user" parameterType="map">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment