|
|
@@ -1,17 +1,19 @@
|
|
|
package restcontroller.saletool.notice;
|
|
|
|
|
|
+import beans.attachment.Attachment;
|
|
|
import beans.department.Department;
|
|
|
+import beans.parameter.Parameter;
|
|
|
+import beans.remind.Remind;
|
|
|
import beans.salearea.SaleArea;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
import common.annotation.API;
|
|
|
import common.annotation.CACHEING;
|
|
|
-import common.data.Row;
|
|
|
-import common.data.Rows;
|
|
|
-import common.data.RowsMap;
|
|
|
-import common.data.SQLFactory;
|
|
|
+import common.data.*;
|
|
|
import restcontroller.R;
|
|
|
+import utility.email.Email;
|
|
|
+import utility.email.EmailContent;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
@@ -109,30 +111,76 @@ public class notice extends Controller {
|
|
|
return getSucReturnObject().setData(rows).setTips(object).toString();
|
|
|
}
|
|
|
|
|
|
- @API(title = "通告详情")
|
|
|
- public String queryNoticeMain() throws YosException {
|
|
|
+
|
|
|
+ @API(title = "确认已知", apiversion = R.ID20240320152902.v1.class)
|
|
|
+ public String confirmed() throws YosException {
|
|
|
Long sat_noticeid = content.getLong("sat_noticeid");
|
|
|
- // 新增记录
|
|
|
- addReadRecord(sat_noticeid);
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "通告详情查询");
|
|
|
- sqlFactory.addParameter("sat_noticeid", sat_noticeid);
|
|
|
- sqlFactory.addParameter("userid", userid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
|
|
|
- // 附件
|
|
|
- ArrayList<Long> ids = rows.toArrayList("sat_noticeid", new ArrayList<Long>());
|
|
|
- RowsMap attRowsMap = getAttachmentUrl("sat_notice", ids);
|
|
|
- for (Row row : rows) {
|
|
|
- Rows Rows = attRowsMap.get(row.getString("sat_noticeid"));
|
|
|
- if (Rows.isEmpty()) {
|
|
|
- row.put("attinfos", new Rows());
|
|
|
- } else {
|
|
|
- row.put("attinfos", Rows);
|
|
|
- }
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_notice_read");
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
+ updateSQL.setValue("confirmed", 1);
|
|
|
+ updateSQL.setWhere("sat_noticeid", sat_noticeid);
|
|
|
+ updateSQL.setWhere("createuserid", userid);
|
|
|
+ updateSQL.update();
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "发送邮件", apiversion = R.ID20240320153302.v1.class)
|
|
|
+ public String sendMail() throws Exception {
|
|
|
+ Long sat_noticeid = content.getLong("sat_noticeid");
|
|
|
+ String email = content.getStringValue("email");
|
|
|
+
|
|
|
+ if (!Parameter.get(siteid, "remind_mail").equalsIgnoreCase("1")) {
|
|
|
+ return getErrReturnObject().setErrMsg("邮件功能未开启").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ Rows rows = dbConnect.runSqlQuery("SELECT * from sat_notice where sat_noticeid=" + sat_noticeid);
|
|
|
+ if (rows.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("数据不存在").toString();
|
|
|
}
|
|
|
- return getSucReturnObject().setData(rows.get(0)).toString();
|
|
|
+
|
|
|
+ Rows rowsAtt = Attachment.get(this, "sat_notice", sat_noticeid);
|
|
|
+
|
|
|
+ EmailContent emailContent = new EmailContent();
|
|
|
+ emailContent.addText(rows.get(0).getString("content"));
|
|
|
+ for (Row rowAtt : rowsAtt) {
|
|
|
+ emailContent.addFile(rowAtt.getString("url"));
|
|
|
+ }
|
|
|
+ Remind remind = new Remind(siteid);
|
|
|
+ remind.setTitle(rows.get(0).getString("title"));
|
|
|
+ remind.setToemail(email);
|
|
|
+ remind.setContent(emailContent);
|
|
|
+ remind.sendByMail();
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
+// @API(title = "通告详情")
|
|
|
+// public String queryNoticeMain() throws YosException {
|
|
|
+// Long sat_noticeid = content.getLong("sat_noticeid");
|
|
|
+// // 新增记录
|
|
|
+// addReadRecord(sat_noticeid);
|
|
|
+// SQLFactory sqlFactory = new SQLFactory(this, "通告详情查询");
|
|
|
+// sqlFactory.addParameter("sat_noticeid", sat_noticeid);
|
|
|
+// sqlFactory.addParameter("userid", userid);
|
|
|
+// Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+//
|
|
|
+// // 附件
|
|
|
+// ArrayList<Long> ids = rows.toArrayList("sat_noticeid", new ArrayList<Long>());
|
|
|
+// RowsMap attRowsMap = getAttachmentUrl("sat_notice", ids);
|
|
|
+// for (Row row : rows) {
|
|
|
+// Rows Rows = attRowsMap.get(row.getString("sat_noticeid"));
|
|
|
+// if (Rows.isEmpty()) {
|
|
|
+// row.put("attinfos", new Rows());
|
|
|
+// } else {
|
|
|
+// row.put("attinfos", Rows);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return getSucReturnObject().setData(rows.get(0)).toString();
|
|
|
+// }
|
|
|
+
|
|
|
/**
|
|
|
* 查询阅读记录(通告留言和打分)
|
|
|
*
|