xinyb
6 天以前 ee2316e2cb7afde1c54f5e4216a1b0d1e055749e
src/com/yc/crm/mail/action/MailTag.java
@@ -1,6 +1,9 @@
package com.yc.crm.mail.action;
import com.yc.crm.mail.entity.T482115Entity;
//import com.yc.crm.mail.entity.T482115Entity;
import com.yc.crm.base.entity.T482115Entity;
import com.yc.crm.mail.entity.MailModuleBelowEntity;
import com.yc.crm.mail.service.MailTagIfc;
import com.yc.crm.mail.util.AllBackMsg;
import com.yc.entity.DataSourceEntity;
@@ -14,6 +17,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
/**
@@ -77,8 +81,8 @@
    public AllBackMsg updateTag(@RequestBody T482115Entity tag, HttpServletRequest request, HttpServletResponse response) {
        AllBackMsg msg = new AllBackMsg();
        try {
            if (tag.getTagId() == null) {
                msg.setFail("缺少SignId值,请检查");
            if (tag.getTagId() == null || tag.getTagId().equals(0)) {
                msg.setFail("缺少tagId值,请检查");
                return msg;
            }
            HttpSession session = request.getSession();
@@ -112,8 +116,8 @@
    public AllBackMsg deleteTag(@RequestParam(defaultValue = "0") Integer tagId, HttpServletRequest request, HttpServletResponse response) {
        AllBackMsg msg = new AllBackMsg();
        try {
            if (tagId == 0) {
                msg.setFail("签名ID获取不到");
            if (tagId.equals(0)) {
                msg.setFail("标签ID获取不到");
                return msg;
            }
            HttpSession session = request.getSession();
@@ -138,13 +142,14 @@
    /**
     * 标签查询
     *
     * @param search   搜索
     * @param request
     * @param response
     * @return
     */
    @GetMapping("/getTagList.do")
    public AllBackMsg getTagList(String search, HttpServletRequest request, HttpServletResponse response) {
    public AllBackMsg getTagList(String search, @RequestParam(defaultValue = "-1") Integer type, HttpServletRequest request, HttpServletResponse response) {
        AllBackMsg msg = new AllBackMsg();
        try {
            HttpSession session = request.getSession();
@@ -155,7 +160,7 @@
            }
            DataSourceEntity dataSource = MultiDataSource.getDataSourceMap(request);//获取数据源
            SpObserver.setDBtoInstance("_" + dataSource.getDbId());
            List<T482115Entity> list = mailTagIfc.getTagList(userCode, search);
            List<T482115Entity> list = mailTagIfc.getTagList(userCode, search, type);
            msg.setSuccess("执行成功", list);
        } catch (Exception e) {
            msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
@@ -164,4 +169,47 @@
        }
        return msg;
    }
    /**
     * 标签树结构
     *
     * @param t482107
     * @param rowId
     * @return
     */
    public static List<MailModuleBelowEntity> getTagModule(List<T482115Entity> T482115) {
        List<MailModuleBelowEntity> tagList = new ArrayList<>();
        MailModuleBelowEntity tag1 = new MailModuleBelowEntity();
        tag1.setKey("systemTag");
        tag1.setType("tag");
        tag1.setName("系统标签");
        MailModuleBelowEntity tag2 = new MailModuleBelowEntity();
        tag2.setKey("customTag");
        tag2.setType("tag");
        tag2.setName("自定义标签");
        try {
            List<MailModuleBelowEntity> system = new ArrayList<>();
            List<MailModuleBelowEntity> custom = new ArrayList<>();
            for (T482115Entity t : T482115) {
                MailModuleBelowEntity tag = new MailModuleBelowEntity();
                tag.setId(t.getTagId());
                tag.setType("tag");
                tag.setName(t.getTagName());
                if (t.isSystemFlag()) {
                    tag.setKey("systemTag" + t.getTagId());
                    system.add(tag);
                } else {
                    tag.setKey("customTag" + t.getTagId());
                    custom.add(tag);
                }
            }
            tag1.setList(system);
            tag2.setList(custom);
            tagList.add(tag1);
            tagList.add(tag2);
            return tagList;
        } catch (Exception e) {
            throw e;
        }
    }
}