diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java index 3ec3d921..8c8dfe40 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java @@ -36,6 +36,7 @@ import com.actionsoft.apps.coe.pal.pal.ws.model.CoeWorkSpaceModel; import com.actionsoft.apps.coe.pal.pal.ws.web.CoeWorkSpaceWeb; import com.actionsoft.apps.coe.pal.teamwork.web.ProcessPublishWeb; import com.actionsoft.apps.coe.pal.teamwork.web.TeamWorkManagerWeb; +import com.actionsoft.bpms.util.UtilString; import com.actionsoft.exception.ExceptionUtil; import com.actionsoft.i18n.I18nRes; import com.alibaba.fastjson.JSONArray; @@ -3005,6 +3006,66 @@ public class CoEPALController { } + + /** + * 添加回复功能 + * @param me + * @param ruuid + * @param replyContent + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_add_reply") + public String createReply(UserContext me,String ruuid,String replyContent) { + CoeProcessLevelWeb web = new CoeProcessLevelWeb(me); + return web.createReply(me,ruuid,replyContent); + } + + /** + *加载回复列表 + * @param me + * @param ruuid + * @param replyContent + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_GetReply") + public String GetReply(UserContext me, RequestParams params, String start, String size, String ruuid) { + String returnstrs = ""; + int startnum = -1; + int sizenum = -1; + if (!UtilString.isEmpty(start)) { + startnum = Integer.parseInt(start); + } else { + startnum = 1; + } + if (!UtilString.isEmpty(size)) { + sizenum = Integer.parseInt(size); + } else { + sizenum = 20; + } + + CoeProcessLevelWeb mdWeb = new CoeProcessLevelWeb(me); + returnstrs = mdWeb.getReplyList(startnum, sizenum, ruuid); + return returnstrs.toString(); + + } + + /** + * 删除评论功能 + * @param me + * @param params + * @param sid + * @param replyId + * @param messageId + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal_delete_reply_by_id") + public String deleteReply(UserContext me, RequestParams params, String sid, String replyId, String messageId) { + CoeProcessLevelWeb web = new CoeProcessLevelWeb(me); + return web.deleteReply(replyId, messageId); + } + + + /** * 获取最近编辑的文件和收藏的文件 * @param me diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/dao/PalDaoFactory.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/dao/PalDaoFactory.java new file mode 100644 index 00000000..a1e0fdf0 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/dao/PalDaoFactory.java @@ -0,0 +1,11 @@ +package com.actionsoft.apps.coe.pal.pal.repository.dao; + +public class PalDaoFactory { + + + + public static PalDataReplyDao createPalDataReplyDao() { return new PalDataReplyDao(); } + + + +} diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/dao/PalDataReplyDao.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/dao/PalDataReplyDao.java new file mode 100644 index 00000000..d45d98e3 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/dao/PalDataReplyDao.java @@ -0,0 +1,223 @@ +package com.actionsoft.apps.coe.pal.pal.repository.dao; + +import com.actionsoft.apps.coe.pal.pal.repository.model.PalDataReplyModel; +import com.actionsoft.bpms.commons.database.RowMapper; +import com.actionsoft.bpms.commons.mvc.dao.DaoObject; +import com.actionsoft.bpms.commons.pagination.SQLPagination; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UtilString; +import com.actionsoft.exception.AWSDataAccessException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + +public class PalDataReplyDao + extends DaoObject +{ + @Override + public String entityName() { return "APP_ACT_PAL_DATA_REPLY"; } + + + + @Override + public int insert(PalDataReplyModel model) { + Map paramsMap = new HashMap<>(); + paramsMap.put("ID", model.getId()); + paramsMap.put("DATAID", model.getDataId()); + paramsMap.put("REPLYER", model.getReplyer()); + paramsMap.put("REPLYTIME", model.getReplyTime()); + paramsMap.put("REPLYCONTENT", model.getReplyContent()); + paramsMap.put("REPLYERIP", model.getReplyerIp()); + paramsMap.put("ORGID", model.getOrgId()); + int result = DBSql.update(DBSql.getInsertStatement("APP_ACT_PAL_DATA_REPLY", paramsMap), paramsMap); + return result; + } + + + + + @Override + public RowMapper rowMapper() { return null; } + + private static class PalMessageReplyModelMapper implements RowMapper { + private PalMessageReplyModelMapper() {} + + @Override + public PalDataReplyModel mapRow(ResultSet rs, int arg1) throws SQLException { + PalDataReplyModel model = new PalDataReplyModel(); + + model.setId(rs.getString("ID")); + model.setDataId(rs.getString("DATAID")); + model.setReplyer(rs.getString("REPLYER")); + model.setReplyTime(rs.getTimestamp("REPLYTIME")); + model.setReplyContent(rs.getString("REPLYCONTENT")); + model.setOrgId(rs.getString("ORGID")); + model.setReplyerIp(rs.getString("ID")); + + return model; + } + } + + + @Override + public int update(PalDataReplyModel model) throws AWSDataAccessException { + Map paramsMap = new HashMap<>(); + StringBuffer sql = new StringBuffer(); + sql.append("update ").append("APP_ACT_PAL_DATA_REPLY").append(" set REPLYCONTENT=:replycontent where id=:id"); + + paramsMap.put("replycontent", model.getReplyContent()); + paramsMap.put("id", model.getId()); + int result = DBSql.update(sql.toString(), paramsMap); + return result; + } + + public List getReplyByDataId(String dataid) throws SQLException { + List list = new ArrayList<>(); + StringBuffer sql = new StringBuffer(); + try { + sql.append("select * from ").append("APP_ACT_PAL_DATA_REPLY").append(" where ").append("DATAID").append(" = ? order by replytime desc"); + list = DBSql.query(sql.toString(), new PalMessageReplyModelMapper(), new Object[] { dataid }); + } catch (Exception e) { + throw new SQLException(e); + } + return list; + } + + + + + + + + public int getReplyListCount(String dataId, String whereSql, String orderBy) throws SQLException { + StringBuffer sql = new StringBuffer(); + sql.append("select count(id) from ").append("APP_ACT_PAL_DATA_REPLY").append(" where 1=1 "); + if (!UtilString.isEmpty(whereSql)) { + sql.append(" and " + whereSql); + } + return DBSql.getInt(sql.toString(), new Object[] { dataId }); + } + + + + + + + + public List getReplyList(String dataId, int start, int size, String whereSql, String orderBy) throws SQLException { + List list = new ArrayList<>(); + StringBuffer sql = new StringBuffer(); + sql.append("select * from ").append("APP_ACT_PAL_DATA_REPLY").append(" where 1=1 "); + if (!UtilString.isEmpty(whereSql)) { + sql.append(" and " + whereSql); + } + + + if (!UtilString.isEmpty(orderBy)) { + sql.append(orderBy); + } + if (start > 0 && size > 0) { + list = DBSql.query(SQLPagination.getPaginitionSQL(sql.toString(), start, size), new PalMessageReplyModelMapper(), new Object[] { dataId }); + } else { + list = DBSql.query(sql.toString(), new PalMessageReplyModelMapper(), new Object[] { dataId }); + } + return list; + } + + + + + + + + + + + + + + + + + + + + + + + + public List getManageReplyList(int start, int size, String whereSql, String orderBy) throws SQLException { + List list = new ArrayList<>(); + StringBuffer sql = new StringBuffer(); + sql.append("select * from ").append("APP_ACT_PAL_DATA_REPLY").append(" where 1=1 "); + if (!UtilString.isEmpty(whereSql)) { + sql.append(" and " + whereSql); + } + + + if (!UtilString.isEmpty(orderBy)) { + sql.append(orderBy); + } + if (start > 0 && size > 0) { + list = DBSql.query(SQLPagination.getPaginitionSQL(sql.toString(), start, size), new PalMessageReplyModelMapper(), new Object[0]); + } else { + list = DBSql.query(sql.toString(), new PalMessageReplyModelMapper(), new Object[0]); + } + return list; + } + + + + + + + + + public int getManageReplyListCount(String whereSql, String orderBy) throws SQLException { + StringBuffer sql = new StringBuffer(); + sql.append("select count(id) from ").append("APP_ACT_PAL_DATA_REPLY").append(" where 1=1 "); + if (!UtilString.isEmpty(whereSql)) { + sql.append(" and " + whereSql); + } + return DBSql.getInt(sql.toString(), new Object[0]); + } + + public boolean deleteReplyByDataid(String dataid) throws SQLException { + Map params = new HashMap<>(); + StringBuffer sql = new StringBuffer(); + sql.append(" delete from ").append("APP_ACT_PAL_DATA_REPLY").append(" where ").append("DATAID").append("=:dataid"); + params.put("dataid", dataid); + DBSql.update(sql.toString(), params); + return true; + } + + public boolean deleteReplyByDataid(String dataid, Connection conn) throws SQLException { + Map params = new HashMap<>(); + StringBuffer sql = new StringBuffer(); + sql.append(" delete from ").append("APP_ACT_PAL_DATA_REPLY").append(" where ").append("DATAID").append("=:dataid"); + params.put("dataid", dataid); + DBSql.update(conn, sql.toString(), params); + return true; + } + + public boolean deleteReplyById(String replyid) throws SQLException { + Map params = new HashMap<>(); + StringBuffer sql = new StringBuffer(); + sql.append(" delete from ").append("APP_ACT_PAL_DATA_REPLY").append(" where ID=:replyid"); + params.put("replyid", replyid); + DBSql.update(sql.toString(), params); + return true; + } + + public PalDataReplyModel getReplyById(String id) { + StringBuffer sql = new StringBuffer(); + sql.append("SELECT * FROM ").append("APP_ACT_PAL_DATA_REPLY").append(" WHERE ID = ?"); + return (PalDataReplyModel)DBSql.getObject(sql.toString(), new PalMessageReplyModelMapper(), new Object[] { id }); + } +} diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java index 9a8260b1..88b10e51 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java @@ -42,7 +42,6 @@ public class SynchronousOrgJob implements IJob { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - Map idRelationMap = new HashMap<>(); //先执行新建操作产生plid PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); @@ -54,6 +53,7 @@ public class SynchronousOrgJob implements IJob { Timestamp nowTime = new Timestamp(System.currentTimeMillis()); + PALRepositoryModelImpl model = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", "内蒙古伊利实业集团股份有限公司", "", 1, "org", "org", true, 1, id1, false, "org.normal", "0", 1, null, @@ -61,6 +61,7 @@ public class SynchronousOrgJob implements IJob { null, null, null, null, null, null, null, 1); coeProcessLevel.insert(model); + parentModelId=model.getId(); orgindex = 0; createTree(); @@ -88,7 +89,6 @@ public class SynchronousOrgJob implements IJob { Timestamp nowTime = new Timestamp(System.currentTimeMillis()); if (org.getString("PARENTDEPARTMENTID").equals("0")) { - System.out.println("orgdepartment======="+org.getString("DEPARTMENTNAME")); String sql1 = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE WSID='6f4e292c-1b90-4dd2-8c20-7da159cb20a5' and EXT1='" + org.getString("ID") + "'"; String parentPalOrgId1 = DBSql.getString(sql1); if(StringUtil.isEmpty(parentPalOrgId1)){ @@ -108,8 +108,6 @@ public class SynchronousOrgJob implements IJob { if(StringUtil.isNotEmpty(parentPalOrgId)){ - System.out.println("orgdepartment======"+org.getString("ID")); - System.out.println("orgdepartment======="+org.getString("DEPARTMENTNAME")); PALRepositoryModelImpl model2 = CoeProcessLevelUtil.createPALRepositoryModel(id1, plRid1, "6f4e292c-1b90-4dd2-8c20-7da159cb20a5", org.getString("DEPARTMENTNAME"), "", 1, getParentPalOrgId(org), "org", true, 1, id1, false, "org.normal", "0", Integer.valueOf(org.getString("ORDERINDEX")), null, @@ -187,6 +185,8 @@ public class SynchronousOrgJob implements IJob { definition.remove("commonShapeConfig"); } + + List orgdepartmentList=DBSql.getMaps("select POSITION_NO,POSITION_NAME from ORGUSER WHERE DEPARTMENTID=?",departmentId); int zindex = 1; diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/model/PalDataReplyModel.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/model/PalDataReplyModel.java new file mode 100644 index 00000000..4233e088 --- /dev/null +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/model/PalDataReplyModel.java @@ -0,0 +1,101 @@ +package com.actionsoft.apps.coe.pal.pal.repository.model; + +import com.actionsoft.bpms.commons.mvc.model.ModelBean; +import java.sql.Timestamp; + + + + + + + + + + +public class PalDataReplyModel + extends ModelBean +{ + private static final long serialVersionUID = 1L; + public static final String DATABASE_ENTITY = "APP_ACT_PAL_DATA_REPLY"; + public static final String REPLY_ID = "ID"; + public static final String DATA_ID = "DATAID"; + public static final String REPLY_CONTENT = "REPLYCONTENT"; + public static final String REPLY_TIME = "REPLYTIME"; + public static final String REPLYER = "REPLYER"; + public static final String REPLYER_IP = "REPLYERIP"; + public static final String ORG_ID = "ORGID"; + private String id; + private String dataId; + private String replyContent; + private Timestamp replyTime; + private String replyer; + private String orgId; + private String replyerIp; + + public PalDataReplyModel() {} + + public PalDataReplyModel(String id, String dataId, String replyContent, Timestamp replyTime, String replyer, String orgId, String replyerIp) { + this.id = id; + this.dataId = dataId; + this.replyContent = replyContent; + this.replyTime = replyTime; + this.replyer = replyer; + this.orgId = orgId; + this.replyerIp = replyerIp; + } + + + public Timestamp getReplyTime() { return this.replyTime; } + + + + public void setReplyTime(Timestamp replyTime) { this.replyTime = replyTime; } + + + + public String getReplyer() { return this.replyer; } + + + + public void setReplyer(String replyer) { this.replyer = replyer; } + + + + public String getId() { return this.id; } + + + + public void setId(String id) { this.id = id; } + + + + public String getReplyContent() { return this.replyContent; } + + + + public void setReplyContent(String replyContent) { this.replyContent = replyContent; } + + + + public String getOrgId() { return this.orgId; } + + + + public void setOrgId(String orgId) { this.orgId = orgId; } + + + + public String getDataId() { return this.dataId; } + + + + public void setDataId(String dataId) { this.dataId = dataId; } + + + + public String getReplyerIp() { return this.replyerIp; } + + + + public void setReplyerIp(String replyerIp) { this.replyerIp = replyerIp; } +} diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java index 701d7b44..5fcdc78d 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java @@ -99,6 +99,7 @@ import com.actionsoft.i18n.I18nRes; import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.api.AppAPI; import com.actionsoft.sdk.local.api.LogAPI; +import com.actionsoft.sdk.local.api.PortalAPI; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -129,6 +130,9 @@ public class CoeProcessLevelWeb extends ActionWeb { private String sysAppPlatform; private String value; + + PalDataReplyDao cmrdao = PalDaoFactory.createPalDataReplyDao(); + public CoeProcessLevelWeb(UserContext uc) { super(uc); _uc = uc; @@ -8618,6 +8622,147 @@ public class CoeProcessLevelWeb extends ActionWeb { return ro.toString(); } + + + + public String createReply(UserContext me,String ruuid,String replyContent){ + ResponseObject result = ResponseObject.newOkResponse(); + AppAPI appApi = SDK.getAppAPI(); + Date now = new Date(); + Timestamp replyTime = new Timestamp(now.getTime()); + try { + Map paramsMap = new HashMap<>(); + paramsMap.put("ID", UUIDGener.getUUID()); + paramsMap.put("DATAID", ruuid); + paramsMap.put("REPLYER", me.getUID()); + paramsMap.put("REPLYTIME", replyTime); + paramsMap.put("REPLYCONTENT", replyContent); + paramsMap.put("REPLYERIP", me.getClientIP()); + paramsMap.put("ORGID", me.getDepartmentModel().getCompanyId()); + int createresult = DBSql.update(DBSql.getInsertStatement("APP_ACT_PAL_DATA_REPLY", paramsMap), paramsMap); + result.put("result","ok"); + }catch (Exception e) { + e.printStackTrace(); + result.put("result","error"); + } + return result.toString(); + } + + + + public String getReplyList(int start, int size, String messageid) { + AppAPI appApi = SDK.getAppAPI(); + ResponseObject result = ResponseObject.newOkResponse(); + try { + result.put("replyList", getReplyListJson(start, size, messageid)); + result.put("counts", Integer.valueOf(getReplyListCount(start, size, messageid))); + } + catch (Exception e) { + result.err(appApi.i18NValue("com.actionsoft.apps.coe.pal", getContext(),"") + e.getMessage()); + e.printStackTrace(); + } + return result.toString(); + } + + + + +public String deleteReply(String replyid, String messageid) { + ResponseObject result = ResponseObject.newOkResponse(); + AppAPI appApi = SDK.getAppAPI(); + + try { + this.cmrdao.deleteReplyById(replyid); + /*PalDataModel message = CmsDataCache.getModel(messageid); + message.setReplyNum(message.getReplyNum() - 1); + CmsDataCache.putModel(message);*/ + } catch (SQLException e) { + e.printStackTrace(); + result.err(appApi.i18NValue("com.actionsoft.apps.coe.pal", getContext(), "") + e.getMessage()); + } + return result.toString(); +} + + + + + + public JSONArray getReplyListJson(int start, int size, String messageid) { + JSONArray list = new JSONArray(); + List replylist = new ArrayList<>(); + StringBuffer whereSql = new StringBuffer(); + StringBuffer orderBySql = new StringBuffer(); + PortalAPI portalApi = SDK.getPortalAPI(); + + try { + whereSql.setLength(0); + whereSql.append("DATAID = ?"); + orderBySql.setLength(0); + orderBySql.append(" order by REPLYTIME asc "); + replylist = this.cmrdao.getReplyList(messageid, start, size, whereSql.toString(), orderBySql.toString()); + + int i = start; + for (PalDataReplyModel model1 : replylist) { + JSONObject json1 = new JSONObject(); + json1.put("index", Integer.valueOf(i)); + json1.put("id", model1.getId()); + json1.put("msgId", model1.getDataId()); + json1.put("replyContent", model1.getReplyContent()); + json1.put("replyUser", model1.getReplyer()); + json1.put("userPhoto", portalApi.getUserPhoto(getContext(), model1.getReplyer())); + String replyUserName = ""; + UserModel userModel = UserCache.getModel(model1.getReplyer()); + if (userModel == null || userModel.isClosed()) { + replyUserName = model1.getReplyer(); + } else { + + replyUserName = SDK.getORGAPI().getUserNames(model1.getReplyer()); + } + json1.put("replyUserName", I18nRes.findValue("_bpm.platform", replyUserName)); + + Timestamp replyTime = model1.getReplyTime(); + String zonedReplyTime = UtilDate.datetimeFormat(replyTime, true); + json1.put("replyTime", zonedReplyTime); + String deletePermit = "0"; + + + if (model1.getReplyer() != null) { + + boolean systemAdmin = SDK.getPermAPI().isSystemAdministrator(getContext().getUID()); + + if (model1.getReplyer().equals(getContext().getUID()) || systemAdmin) { + deletePermit = "1"; + } + } + json1.put("deletePermit", deletePermit); + list.add(json1); + i++; + } + } catch (SQLException e) { + e.printStackTrace(); + } + return list; + } + + + + + + public int getReplyListCount(int start, int size, String messageid) { + int counts = 0; + StringBuffer whereSql = new StringBuffer(); + StringBuffer orderBySql = new StringBuffer(); + try { + whereSql.setLength(0); + whereSql.append("DATAID = ? "); + counts = this.cmrdao.getReplyListCount(messageid, whereSql.toString(), orderBySql.toString()); + } catch (SQLException e) { + e.printStackTrace(); + } + return counts; + } + + /** * 获取最近的文件和收藏的文件 * @param wsId diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html index c39d1b1f..0eafd156 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html @@ -83,6 +83,9 @@ + + + @@ -91,6 +94,10 @@ + + + + + + + + + @@ -252,6 +566,14 @@ + + + + + + + + <#processlink_ete_js>