Commit bca92c3a by 罗绍泽

应用接口初始化

parent 84e9a1d3
...@@ -154,7 +154,7 @@ var result = jwAppPortletModel.jwAppsPortletActAction.saveLayout({ ...@@ -154,7 +154,7 @@ var result = jwAppPortletModel.jwAppsPortletActAction.saveLayout({
</tr> </tr>
<tr> <tr>
<td>参数备注</td> <td>参数备注</td>
<td>FIELD_COLUMN_ID:栏目id</td> <td>1.columnsId:栏目id;2.portlets:portlets的id数组</td>
</tr> </tr>
<tr> <tr>
<td><span class="look">结果查看</span></td> <td><span class="look">结果查看</span></td>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<struts> <struts>
<package name="src_jwapp" extends="gaowj"> <package name="src_jwapp" extends="gaowj">
<!-- Portlet相关 -->
<action name="jwAppsPortletAct_*" class="com.jw.app.portlet.action.actAction" <action name="jwAppsPortletAct_*" class="com.jw.app.portlet.action.actAction"
method="{1}"> method="{1}">
<result name="json" type="json"> <result name="json" type="json">
...@@ -21,5 +22,18 @@ ...@@ -21,5 +22,18 @@
method="{1}"> method="{1}">
<result name="{1}">/jwapp/pages/portlet/{1}.jsp</result> <result name="{1}">/jwapp/pages/portlet/{1}.jsp</result>
</action> </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> </package>
</struts> </struts>
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.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 ;
}
...@@ -16,13 +16,13 @@ import com.jw.app.business.PortletBusiness; ...@@ -16,13 +16,13 @@ import com.jw.app.business.PortletBusiness;
import com.jw.app.business.utils.QueryParamUtil; import com.jw.app.business.utils.QueryParamUtil;
public class PortletBusinessImpl implements PortletBusiness { public class PortletBusinessImpl implements PortletBusiness {
/** /**
* 默认模板的标识符 * 默认模板的标识符
*/ */
private static final String DEFAULT="default"; private static final String DEFAULT = "default";
private PortletDAO portletDAO; private PortletDAO portletDAO;
public PortletDAO getPortletDAO() { public PortletDAO getPortletDAO() {
return portletDAO; return portletDAO;
...@@ -32,38 +32,18 @@ public class PortletBusinessImpl implements PortletBusiness { ...@@ -32,38 +32,18 @@ public class PortletBusinessImpl implements PortletBusiness {
this.portletDAO = portletDAO; this.portletDAO = portletDAO;
} }
@Override @Override
public List<Map<String, Object>> list_portlet_template_by_user(Map<String, Object> query) public List<Map<String, Object>> list_portlet_template_by_user(Map<String, Object> query) throws BusinessException {
throws BusinessException { List<Map<String, Object>> listData = null;
List<Map<String, Object>> listData=null;
try { try {
query.put("USER_ID", SessionUtil.getEmid()); query.put("USER_ID", SessionUtil.getEmid());
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query)); listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
if(listData.size()==0){ if (listData.size() == 0) {
//如果当前登陆人还没有设置自定义的资源,则显示默认的资源 // 如果当前登陆人还没有设置自定义的资源,则显示默认的资源
query.put("USER_ID", DEFAULT); query.put("USER_ID", DEFAULT);
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query)); listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
} }
for(Map<String, Object> map:listData){ manageMap(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));
}
}
}
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
...@@ -74,9 +54,36 @@ public class PortletBusinessImpl implements PortletBusiness { ...@@ -74,9 +54,36 @@ public class PortletBusinessImpl implements PortletBusiness {
return listData; 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 @Override
public List<Map<String, Object>> list_portlet_columns(Map<String, Object> query) throws BusinessException { 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 { try {
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_columns(query)); listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_columns(query));
} catch (IOException e) { } catch (IOException e) {
...@@ -91,9 +98,10 @@ public class PortletBusinessImpl implements PortletBusiness { ...@@ -91,9 +98,10 @@ public class PortletBusinessImpl implements PortletBusiness {
@Override @Override
public List<Map<String, Object>> list_portlet_template(Map<String, Object> query) throws BusinessException { 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 { try {
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template(query)); listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template(query));
manageMap(listData);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
...@@ -105,44 +113,44 @@ public class PortletBusinessImpl implements PortletBusiness { ...@@ -105,44 +113,44 @@ public class PortletBusinessImpl implements PortletBusiness {
} }
@Override @Override
public void saveLayout(String columnsId,List<Map<String, Object>> list) throws BusinessException { public void saveLayout(String columnsId, List<Map<String, Object>> list) throws BusinessException {
String userId=SessionUtil.getEmid(); String userId = SessionUtil.getEmid();
List<Map<String, Object>> listData=null; List<Map<String, Object>> listData = null;
try { try {
Map<String,Object> query=new HashMap<String, Object>(); Map<String, Object> query = new HashMap<String, Object>();
query.put("USER_ID", userId); query.put("USER_ID", userId);
query.put("COLUMN_ID", columnsId); query.put("COLUMN_ID", columnsId);
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query)); listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
if(listData.size()==0){ if (listData.size() == 0) {
//如果当前登陆人没有设置自己的模板布局,则查询默认的布局 // 如果当前登陆人没有设置自己的模板布局,则查询默认的布局
query.put("USER_ID", DEFAULT); query.put("USER_ID", DEFAULT);
listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query)); listData = QueryParamUtil.ClobToString(portletDAO.list_portlet_template_user(query));
} }
//验证用户传过来的布局和数据库中的布局是否一致,默认为一致 // 验证用户传过来的布局和数据库中的布局是否一致,默认为一致
boolean same=true; boolean same = true;
if(listData.size()!=list.size()){ if (listData.size() != list.size()) {
same=false; same = false;
}else{ } else {
//长度一致的情况下,判断每一个索引所在位置的portletId是否一致 // 长度一致的情况下,判断每一个索引所在位置的portletId是否一致
for(int i=0;i<listData.size();i++){ for (int i = 0; i < listData.size(); i++) {
//只要有一个不满足,则设置same为false // 只要有一个不满足,则设置same为false
if(!listData.get(i).get("PORTLET_ID").equals(list.get(i).get("PORTLET_ID"))){ if (!listData.get(i).get("PORTLET_ID").equals(list.get(i).get("PORTLET_ID"))) {
same=false; same = false;
break; break;
} }
} }
} }
if(!same){ if (!same) {
//如果不一致,则将用户的自定义模板布局删除,重新添加新布局进行保存 // 如果不一致,则将用户的自定义模板布局删除,重新添加新布局进行保存
Map<String,Object> deleteQuery=new HashMap<String, Object>(); Map<String, Object> deleteQuery = new HashMap<String, Object>();
deleteQuery.put("USER_ID", userId); deleteQuery.put("USER_ID", userId);
portletDAO.delete_portlet_template_user(deleteQuery); portletDAO.delete_portlet_template_user(deleteQuery);
//重新添加 // 重新添加
int index=0; int index = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String now=formatter.format(new Date()); String now = formatter.format(new Date());
for(Map<String, Object> map:list){ for (Map<String, Object> map : list) {
map.put("ID", UUID.randomUUID().toString()); map.put("ID", UUID.randomUUID().toString());
map.put("USER_ID", userId); map.put("USER_ID", userId);
map.put("ORDER_NUM", index++); map.put("ORDER_NUM", index++);
...@@ -160,14 +168,14 @@ public class PortletBusinessImpl implements PortletBusiness { ...@@ -160,14 +168,14 @@ public class PortletBusinessImpl implements PortletBusiness {
e.printStackTrace(); e.printStackTrace();
} }
} }
private List<Map<String,Object>> mapToList(Map<String, Object> map){ private List<Map<String, Object>> mapToList(Map<String, Object> map) {
List<Map<String,Object>> entity=new ArrayList<Map<String,Object>>(); List<Map<String, Object>> entity = new ArrayList<Map<String, Object>>();
for (Map.Entry<String,Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
Map<String,Object> field=new HashMap<String, Object>(); Map<String, Object> field = new HashMap<String, Object>();
field.put("key", entry.getKey()); field.put("key", entry.getKey());
field.put("value", entry.getValue()); field.put("value", entry.getValue());
entity.add(field); entity.add(field);
} }
return entity; return entity;
} }
......
...@@ -115,10 +115,19 @@ ...@@ -115,10 +115,19 @@
<select id="list_app_acount" parameterType="map" <select id="list_app_acount" parameterType="map"
resultType="upperCaseKeyMap"> resultType="upperCaseKeyMap">
select btua.*,btumu.USER_NAME,btumu.USER_PWD,btumu.USER_ID from b_t_ufp_apps btua SELECT
left join b_t_ufp_mapper_user btumu btua.*, btumu.USER_NAME,
on btua.APP_ID=btumu.APP_ID btumu.USER_PWD,
WHERE btumu.USER_ID=#{USER_ID} AND btua.APP_ID=#{APP_ID} 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> </select>
<delete id="delete_portlet_template_user" parameterType="map"> <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