فهرست منبع

新增管理端:活动管理模块

沈静伟 4 سال پیش
والد
کامیت
3d67816189

+ 5 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/activity/SQL/活动列表查询.sql

@@ -0,0 +1,5 @@
+select t1.tactivityid,t1.siteid,t1.ftitle,t1.fbegdate,t1.fenddate,t1.fstatus,t1.fnotes,t1.fshow_url,
+count(t2.tagentsid)as fagentcount from tactivity t1
+left join tactivity_agentmsg t2 on t1.siteid=t2.siteid and t1.tactivityid=t2.tactivityid
+where t1.siteid=$siteid$ and $where$
+group by  t1.tactivityid,t1.siteid,t1.ftitle,t1.fbegdate,t1.fenddate,t1.fstatus,t1.fnotes,t1.fshow_url

+ 5 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/activity/SQL/活动商户列表查询.sql

@@ -0,0 +1,5 @@
+select t1.tactivity_agentmsgid, t1.tagentsid, t1.tactivityid,t2.fagentname, t1.fbrand, t1.fintroduction,t1.flocationclass, t1.fcontact, t1.fphonenumber,
+       t1.flocation,t1.fstatus
+from tactivity_agentmsg t1
+inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+where t1.siteid=$siteid$ and t1.tactivityid=$tactivityid$ and $where$

+ 5 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/activity/SQL/活动商户详情查询.sql

@@ -0,0 +1,5 @@
+select t1.tactivity_agentmsgid, t1.tagentsid, t1.tactivityid,t2.fagentname, t1.fbrand, t1.fintroduction,t1.flocationclass, t1.fcontact, t1.fphonenumber,
+       t1.flocation,t1.fstatus
+from tactivity_agentmsg t1
+inner join tagents t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid
+where t1.siteid=$siteid$ and t1.tactivityid=$tactivityid$ and t1.tagentsid=$tagentsid$

+ 4 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/activity/SQL/活动商户详情查询_活动商品列表.sql

@@ -0,0 +1,4 @@
+select t1.tactivityid,t1.tactivity_agentproductsid, t1.tagents_productid, t2.fprodname,t1.fintroduction
+from tactivity_agentproducts t1
+inner join tagents_product t2 on t1.siteid=t2.siteid and t1.tagentsid=t2.tagentsid and t1.tagents_productid=t2.tagents_productid
+where t1.siteid=$siteid$ and t1.tactivityid=$tactivityid$ and t1.tagentsid=$tagentsid$

+ 255 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/activity/activity.java

@@ -0,0 +1,255 @@
+package com.cnd3b.restcontroller.enterprise.activity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.cnd3b.common.Controller;
+import com.cnd3b.common.D3bException;
+import com.cnd3b.common.data.Row;
+import com.cnd3b.common.data.Rows;
+import com.cnd3b.common.data.RowsMap;
+import com.cnd3b.common.data.SQLFactory;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+
+import java.util.Date;
+
+public class activity extends Controller {
+    public activity(JSONObject content) {
+        super(content);
+    }
+
+    /**
+     * 活动列表查询
+     *
+     * @return
+     */
+    public String query_activityList() {
+        /**
+         *排序条件设置
+         */
+        String[] sortfield = {"t1.tactivityid desc"};
+        String sort = getSort(sortfield, "t1.tactivityid desc");
+        /**
+         * 过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and(");
+                where.append("t1.ftitle like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.fnotes like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+        }
+        SQLFactory sqlFactory = new SQLFactory(this, "活动列表查询", pageSize, pageNumber, sort);
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter_SQL("where", where);
+
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        return getSucReturnObject().setDataByPaging(rows).saveToDataPool().toString();
+    }
+
+    /**
+     * 活动新增修改
+     *
+     * @return
+     */
+    public String insertormodify_activity() throws D3bException, P2Exception {
+        long tactivityid = content.getLong("tactivityid");
+        String ftitle = content.getString("ftitle", "tactivity.ftitle", "活动名称");
+        String fnotes = content.getString("fnotes", "tactivity.fnotes", "活动介绍");
+        String fshow_url = content.getString("fshow_url", "tactivity.fshow_url", "活动宣传页");
+        String fstatus = content.getString("fstatus");
+        Date fbegdate = content.getDate("fbegdate");//开始时间
+        Date fenddate = content.getDate("fenddate");//结束时间
+
+        PaoSetRemote tactivitySet = getP2ServerSystemPaoSet("tactivity", "siteid='" + siteid + "' and tactivityid='" + tactivityid + "'");
+        PaoRemote tactivity = null;
+        if (tactivityid <= 0 || tactivitySet.isEmpty()) {
+            tactivity = tactivitySet.addAtEnd();
+            tactivity.setValue("siteid", siteid, 11L);//企业ID
+            tactivity.setValue("createby", username, 11L);//录入人
+            tactivity.setValue("createdate", sysdate, 11L);//录入时间
+        } else {
+            tactivity = tactivitySet.getPao(0);
+        }
+        tactivity.setValue("fstatus", fstatus, 11L);
+        tactivity.setValue("ftitle", ftitle, 11L);
+        tactivity.setValue("fnotes", fnotes, 11L);
+        tactivity.setValue("fshow_url", fshow_url, 11L);
+        tactivity.setValue("fbegdate", fbegdate, 11L);
+        tactivity.setValue("fenddate", fenddate, 11L);
+        tactivity.setValue("changedate", sysdate, 11L);
+        tactivity.setValue("changeby", username, 11L);
+
+        content.put("tactivityid", tactivity.getUniqueIDValue());
+        tactivitySet.save();
+        return getSucReturnObject().toString();
+    }
+
+    /**
+     * 活动商户列表查询
+     *
+     * @return
+     */
+    public String query_activityAgentList() {
+        long tactivityid = content.getLong("tactivityid");
+
+        /**
+         *排序条件设置
+         */
+        String[] sortfield = {"t1.tactivityid"};
+        String sort = getSort(sortfield, "t1.tactivityid");
+        /**
+         * 过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and(");
+                where.append("t2.fagentname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.fbrand like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+        }
+        SQLFactory sqlFactory = new SQLFactory(this, "活动商户列表查询", pageSize, pageNumber, sort);
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("tactivityid", tactivityid);
+        sqlFactory.addParameter_SQL("where", where);
+
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        RowsMap brandlogoRowsMap = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"), "brandlogo");
+        for (Row row : rows) {
+            row.put("attinfos", brandlogoRowsMap.get(row.getString("tagentsid")));
+        }
+        return getSucReturnObject().setDataByPaging(rows).saveToDataPool().toString();
+    }
+
+    /**
+     * 活动商户详情查询
+     *
+     * @return
+     */
+    public String query_activityAgentMain() {
+        long tactivityid = content.getLong("tactivityid");
+        long tagentsid = content.getLong("tagentsid");
+
+        SQLFactory sqlFactory = new SQLFactory(this, "活动商户详情查询");
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("tactivityid", tactivityid);
+        sqlFactory.addParameter("tagentsid", tagentsid);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        RowsMap brandlogoRowsMap = getAttachmentUrl("tagents", rows.toArrayList("tagentsid"), "brandlogo");
+        for (Row row : rows) {
+            row.put("attinfos", brandlogoRowsMap.get(row.getString("tagentsid")));
+        }
+        return getSucReturnObject().setData(rows).saveToDataPool().toString();
+    }
+
+    /**
+     * 新增活动商户
+     *
+     * @return
+     */
+    public String insertormodify_activityAgent() throws D3bException, P2Exception {
+        long tactivityid = content.getLong("tactivityid");
+        long tagentsid = content.getLong("tagentsid");
+
+        String fbrand = content.getString("fbrand", "tactivity_agentmsg.fbrand", "参展品牌");
+        String fcontact = content.getString("fcontact", "tactivity_agentmsg.fcontact", "活动联系人");
+        String fintroduction = content.getString("fintroduction", "tactivity_agentmsg.fintroduction", "商户介绍");
+        String flocation = content.getString("flocation", "tactivity_agentmsg.flocation", "活动位置、展位");
+        String flocationclass = content.getString("flocationclass", "tactivity_agentmsg.flocationclass", "活动位置、展区分类");
+        String fphonenumber = content.getString("fphonenumber", "tactivity_agentmsg.fphonenumber", "联系人手机号");
+        String fstatus = content.getString("fstatus", "tactivity_agentmsg.fstatus", "状态");
+
+
+        PaoSetRemote tactivity_agentmsgSet = getP2ServerSystemPaoSet("tactivity_agentmsg", "siteid='" + siteid + "' and tactivityid='" + tactivityid + "' and tagentsid='" + tagentsid + "'");
+        PaoRemote tactivity_agentmsg = null;
+        if (tactivity_agentmsgSet.isEmpty()) {
+            tactivity_agentmsg = tactivity_agentmsgSet.addAtEnd();
+            tactivity_agentmsg.setValue("tactivityid", tactivityid, 11L);
+            tactivity_agentmsg.setValue("tagentsid", tagentsid, 11L);
+            tactivity_agentmsg.setValue("siteid", siteid, 11L);//企业ID
+            tactivity_agentmsg.setValue("createby", username, 11L);//录入人
+            tactivity_agentmsg.setValue("createdate", sysdate, 11L);//录入时间
+        } else {
+            tactivity_agentmsg = tactivity_agentmsgSet.getPao(0);
+        }
+        tactivity_agentmsg.setValue("fstatus", fstatus, 11L);
+        tactivity_agentmsg.setValue("fbrand", fbrand, 11L);
+        tactivity_agentmsg.setValue("fcontact", fcontact, 11L);
+        tactivity_agentmsg.setValue("fintroduction", fintroduction, 11L);
+        tactivity_agentmsg.setValue("flocation", flocation, 11L);
+        tactivity_agentmsg.setValue("flocationclass", flocationclass, 11L);
+        tactivity_agentmsg.setValue("fphonenumber", fphonenumber, 11L);
+        tactivity_agentmsg.setValue("changedate", sysdate, 11L);
+        tactivity_agentmsg.setValue("changeby", username, 11L);
+
+        content.put("tactivityid", tactivity_agentmsg.getUniqueIDValue());
+        tactivity_agentmsgSet.save();
+
+        return query_activityAgentMain();
+    }
+
+    /**
+     * 活动商户商品列表查询
+     *
+     * @return
+     */
+    public String query_activityAgentMain_prodlist() {
+        long tactivityid = content.getLong("tactivityid");
+        long tagentsid = content.getLong("tagentsid");
+        /**
+         *排序条件设置
+         */
+        String[] sortfield = {"t1.tagents_productid desc"};
+        String sort = getSort(sortfield, "t1.tagents_productid desc");
+
+        SQLFactory prodsql = new SQLFactory(this, "活动商户详情查询_活动商品列表", pageSize, pageNumber, sort);
+        prodsql.addParameter("siteid", siteid);
+        prodsql.addParameter("tactivityid", tactivityid);
+        prodsql.addParameter("tagentsid", tagentsid);
+        Rows prodRows = dbConnect.runSqlQuery(prodsql.getSQL());
+        RowsMap prodattinfosMap = getAttachmentUrl("tagents_product", prodRows.toArrayList("tagents_productid"));
+
+        for (Row prodrow : prodRows) {
+            prodrow.put("attinfos", prodattinfosMap.get(prodrow.getString("tagents_productid")));
+        }
+        return getSucReturnObject().setDataByPaging(prodRows).saveToDataPool().toString();
+    }
+
+    /**
+     * 新增活动商户商品
+     *
+     * @return
+     */
+    public String insertormodify_activityAgentProd() throws D3bException, P2Exception {
+        long tactivityid = content.getLong("tactivityid");
+        long tagentsid = content.getLong("tagentsid");
+        long tagents_productid = content.getLong("tagents_productid");
+
+        String fintroduction = content.getString("fintroduction", "tactivity_agentproducts.fintroduction", "产品介绍");
+
+        PaoSetRemote tactivity_agentproductsSet = getP2ServerSystemPaoSet("tactivity_agentproducts", "siteid='" + siteid + "' and tactivityid='" + tactivityid + "' and tagentsid='" + tagentsid + "' and tagents_productid='" + tagents_productid + "'");
+        PaoRemote tactivity_agentproducts = null;
+        if (tactivity_agentproductsSet.isEmpty()) {
+            tactivity_agentproducts = tactivity_agentproductsSet.addAtEnd();
+            tactivity_agentproducts.setValue("tactivityid", tactivityid, 11L);
+            tactivity_agentproducts.setValue("tagentsid", tagentsid, 11L);
+            tactivity_agentproducts.setValue("tagents_productid", tagents_productid, 11L);
+            tactivity_agentproducts.setValue("siteid", siteid, 11L);//企业ID
+            tactivity_agentproducts.setValue("createby", username, 11L);//录入人
+            tactivity_agentproducts.setValue("createdate", sysdate, 11L);//录入时间
+        } else {
+            tactivity_agentproducts = tactivity_agentproductsSet.getPao(0);
+        }
+        tactivity_agentproducts.setValue("fintroduction", fintroduction, 11L);
+        tactivity_agentproducts.setValue("changedate", sysdate, 11L);
+        tactivity_agentproducts.setValue("changeby", username, 11L);
+        tactivity_agentproductsSet.save();
+        return getSucReturnObject().toString();
+    }
+}

+ 19 - 5
src/dsb/com/cnd3b/restcontroller/enterprise/tagents/tagents.java

@@ -136,13 +136,15 @@ public class tagents extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
+
     /**
      * 商户信息调整申请
      *
      * @return
      */
     public String modify_agent() throws D3bException, P2Exception {
-        long tagentsid = content.getLong("tagentsid");//经销商id
+        long tagentsid = content.getLong("tagentsid");//经销商id,0表示新增
+        String ftype = content.getString("ftype");//商户认证、普通修改、新增
         /**
          * 只有个人才可进行商户认证
          */
@@ -160,7 +162,9 @@ public class tagents extends Controller {
             fchangemsgObject.checkStringLength("fdutyparagraph", "tagents.fdutyparagraph", "统一社会代码");//统一社会信用代码
             fchangemsgObject.checkStringLength("fbrand", "tagents.fbrand", "经营品牌");//统一社会信用代码
 
-            dbConnect.runSqlUpdate("update tagents_msgchangeapp set fstatus='作废' where siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and fstatus='申请'");
+            if (tagentsid > 0) {
+                dbConnect.runSqlUpdate("update tagents_msgchangeapp set fstatus='作废' where siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and fstatus='申请'");
+            }
 
             long tagents_msgchangappid = 0;
             PaoSetRemote tagents_msgchangeappSet = getP2ServerSystemPaoSet("tagents_msgchangeapp");
@@ -168,9 +172,19 @@ public class tagents extends Controller {
             tagents_msgchangappid = tagents_msgchangeapp.getUniqueIDValue();
             tagents_msgchangeapp.setValue("fchangemsg", fchangemsgObject.toJSONString(), 11L);
             tagents_msgchangeapp.setValue("fstatus", "申请", 11L);
-            tagents_msgchangeapp.setValue("ftype", "普通修改", 11L);
-            tagents_msgchangeapp.setValue("siteid", siteid, 11L);
+            tagents_msgchangeapp.setValue("ftype", ftype, 11L);
+            if (tagentsid == 0) {
+                PaoSetRemote tagentsSet = tagents_msgchangeapp.getPaoSet("$tagents", "tagents");
+                PaoRemote tagents = tagentsSet.addAtEnd();
+                tagents.setValue("siteid", "BWJ", 11L);//企业ID
+                tagents.setValue("createdate", getDateTime(), 11L);//录入时间
+                tagents.setValue("fphonenumber", fchangemsgObject.getString("fphonenumber"), 11L);
+                tagents.setValue("fjoindate", getDateTime(), 11L);
+                tagents.setValue("ftype", "个人", 11L);
+                tagentsid = tagents.getUniqueIDValue();
+            }
             tagents_msgchangeapp.setValue("tagentsid", tagentsid, 11L);
+            tagents_msgchangeapp.setValue("siteid", siteid, 11L);
             tagents_msgchangeapp.setValue("tenterprise_userid", userid, 11L);
             tagents_msgchangeapp.setValue("changeby", username, 11L);//修改人
             tagents_msgchangeapp.setValue("changedate", sysdate, 11L);//修改时间
@@ -190,7 +204,7 @@ public class tagents extends Controller {
      * @throws D3bException
      * @throws P2Exception
      */
-    public String check_agentmodify() throws D3bException, P2Exception {
+    public String check_agentmodify() throws P2Exception {
         long tagents_msgchangappid = content.getLong("tagents_msgchangappid");
         Rows rows = dbConnect.runSqlQuery("select ftype,fchangemsg,tagentsid from tagents_msgchangeapp where fstatus='申请'and siteid='" + siteid + "' and tagents_msgchangappid='" + tagents_msgchangappid + "'");
         if (rows.isEmpty()) {