xinyb
6 天以前 ee2316e2cb7afde1c54f5e4216a1b0d1e055749e
src/com/yc/crm/mail/action/MailTag.java
@@ -3,6 +3,7 @@
//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;
@@ -16,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;
/**
@@ -147,7 +149,7 @@
     * @return
     */
    @GetMapping("/getTagList.do")
    public AllBackMsg getTagList(String search,@RequestParam(defaultValue = "-1") Integer type, 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();
@@ -158,7 +160,7 @@
            }
            DataSourceEntity dataSource = MultiDataSource.getDataSourceMap(request);//获取数据源
            SpObserver.setDBtoInstance("_" + dataSource.getDbId());
            List<T482115Entity> list = mailTagIfc.getTagList(userCode, search,type);
            List<T482115Entity> list = mailTagIfc.getTagList(userCode, search, type);
            msg.setSuccess("执行成功", list);
        } catch (Exception e) {
            msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
@@ -167,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;
        }
    }
}