消息接口

This commit is contained in:
mzr 2025-07-03 10:16:02 +08:00
parent 91ce065bdf
commit 4bd070516b
2 changed files with 13 additions and 5 deletions

7
uapbd/META-INF/msg.rest Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding='gb2312'?>
<module>
<rest>
<resource classname="nccloud.api.uapbd.msg.MsgResource" exinfo=""/>
</rest>
</module>

View File

@ -3,15 +3,15 @@ package nccloud.api.uapbd.msg;
import com.alibaba.fastjson.JSONObject;
import nc.bs.dao.DAOException;
import nc.bs.logging.Logger;
import nc.bs.pub.pf.PfMessageUtil;
import nc.bs.trade.business.HYSuperDMO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.msg.CommonMessageVO;
import nc.vo.pub.msg.UserNameObject;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.sm.UserVO;
import nccloud.api.rest.utils.ResultMessageUtil;
import nccloud.baseapp.core.log.NCCForUAPLogger;
import nccloud.bs.pub.pf.PfMessageUtil;
import nccloud.commons.lang.StringUtils;
import nccloud.ws.rest.resource.AbstractNCCRestResource;
import org.json.JSONString;
@ -57,7 +57,7 @@ public class MsgResource extends AbstractNCCRestResource {
String roleId = (String) jsonObject.get("roleId");
try {
// 通知消息字段最大为4000位
if (content.length() > 1500) {
if (content != null && content.length() > 1500) {
content = content.substring(0, 1500);
}
@ -111,17 +111,18 @@ public class MsgResource extends AbstractNCCRestResource {
return null;
}
String strWhere = " dr = 0 AND cuserid in (" +
"select cuserid from sm_user_role where pk_role = [roleId] and (disabledate is null or disabledate >= [now]) " +
"select cuserid from sm_user_role where pk_role = '[roleId]' and (disabledate is null or disabledate >= '[now]') " +
")";
strWhere = strWhere.replace("[roleId]", roleId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = sdf.format(new Date());
strWhere = strWhere.replace("[now]", time);
NCCForUAPLogger.debug("time = " + time);
// NCCForUAPLogger.debug("time = " + time);
try {
vos = (UserVO[]) getSuperDMO().queryByWhereClause(UserVO.class, strWhere);
} catch (DAOException e) {
Logger.error("MsgResource-getUserByRole-exp:" + e.getMessage());
ExceptionUtils.wrappBusinessException(e.getMessage());
}
return vos;