|
|
@@ -21,7 +21,7 @@ public class submitedit extends Controller {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 经销商提报列表查询
|
|
|
+ * 业务员提报列表查询
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -31,7 +31,6 @@ public class submitedit extends Controller {
|
|
|
*/
|
|
|
String[] sortfield = {"t1.checkdate"};
|
|
|
String sort = getSort(sortfield, "t1.checkdate desc");
|
|
|
-
|
|
|
/**
|
|
|
* 过滤条件设置
|
|
|
*/
|
|
|
@@ -49,48 +48,107 @@ public class submitedit extends Controller {
|
|
|
where.append(")");
|
|
|
}
|
|
|
}
|
|
|
+ SQLFactory submitedithead = new SQLFactory(this, "提报列表查询", pageSize, pageNumber, sort);
|
|
|
+ submitedithead.addParameter("siteid", siteid);
|
|
|
+ submitedithead.addParameter("tenterprise_userid", userid);
|
|
|
+ submitedithead.addParameter_SQL("where", where);
|
|
|
+ Rows rows = dbConnect.runSqlQuery(submitedithead.getSQL());
|
|
|
+
|
|
|
+ SQLFactory editstatuslist = new SQLFactory(this, "提报列表查询_提报状态查询");
|
|
|
+ editstatuslist.addParameter("siteid", siteid);
|
|
|
+ editstatuslist.addParameter("tenterprise_userid", userid);
|
|
|
+ editstatuslist.addParameter_in("tsubmiteditmodelid", rows.toArray("tsubmiteditmodelid"));
|
|
|
+ RowsMap editstatusrowsMap = dbConnect.runSqlQuery(editstatuslist).toRowsMap("tsubmiteditmodelid");
|
|
|
|
|
|
- SQLFactory costhead = new SQLFactory(this, "提报列表查询", pageSize, pageNumber, sort);
|
|
|
- costhead.addParameter("siteid", siteid);
|
|
|
- costhead.addParameter("tenterprise_userid", userid);
|
|
|
- costhead.addParameter_SQL("where", where);
|
|
|
- Rows rows = dbConnect.runSqlQuery(costhead.getSQL());
|
|
|
+ for (Row row : rows) {
|
|
|
+ String tsubmiteditmodelid = row.getString("tsubmiteditmodelid");
|
|
|
+ if (editstatusrowsMap.containsKey(tsubmiteditmodelid)) {
|
|
|
+ row.put("fisread", editstatusrowsMap.get(tsubmiteditmodelid).get(0).getInteger("fisread") > 0 ? 1 : 0);
|
|
|
+ row.put("fissubmit", editstatusrowsMap.get(tsubmiteditmodelid).get(0).getInteger("fissubmit") > 0 ? 1 : 0);
|
|
|
+ } else {
|
|
|
+ row.put("fisread", 0);
|
|
|
+ row.put("fissubmit", 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
return getSucReturnObject().setDataByPaging(rows, sortfield).setFinalDo(DataPool.defaultdatalife, 1);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * 经销商提报主界面
|
|
|
+ * 业务员提报主界面
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public String query_submiteditmodelMain() {
|
|
|
String tsubmiteditmodelid = content.getString("tsubmiteditmodelid");//提报模板ID
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "提报主界面查询");
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("tenterprise_userid", userid);
|
|
|
- sqlFactory.addParameter("tsubmiteditmodelid", tsubmiteditmodelid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
+ SQLFactory submithead = new SQLFactory(this, "提报主界面查询");
|
|
|
+ submithead.addParameter("siteid", siteid);
|
|
|
+ submithead.addParameter("tsubmiteditmodelid", tsubmiteditmodelid);
|
|
|
+ Rows headrows = dbConnect.runSqlQuery(submithead.getSQL());
|
|
|
+ for (Row row : headrows) {
|
|
|
+ SQLFactory submitlist = new SQLFactory(this, "提报主界面查询_提报明细");
|
|
|
+ submitlist.addParameter("siteid", siteid);
|
|
|
+ submitlist.addParameter("tenterprise_userid", userid);
|
|
|
+ submitlist.addParameter("tsubmiteditmodelid", tsubmiteditmodelid);
|
|
|
+ Rows listrows = dbConnect.runSqlQuery(submitlist.getSQL());
|
|
|
+
|
|
|
+ String fstatus = listrows.getLastRow().getString("fstatus");
|
|
|
+ row.put("fissubmit", "提交".equals(fstatus) ? 1 : 0);
|
|
|
+ row.put("submiteditlist", listrows);
|
|
|
+ }
|
|
|
dbConnect.runSqlUpdate("update tsubmitedit set fisread=1 where siteid='" + siteid + "' and tsubmiteditmodelid='" + tsubmiteditmodelid + "' and tenterprise_userid='" + userid + "'");
|
|
|
- return getSucReturnObject().setData(rows).toString();
|
|
|
+ return getSucReturnObject().setData(headrows).toString();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 业务员新建提报,针对一事多报的功能
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String newedit() throws D3bException {
|
|
|
+ long tsubmiteditmodelid = content.getLongValue("tsubmiteditmodelid");//提报模板ID
|
|
|
+
|
|
|
+ Rows check = dbConnect.runSqlQuery("select tsubmiteditid from tsubmitedit where siteid='" + siteid + "' and fstatus='新建' and tsubmiteditmodelid='" + tsubmiteditmodelid + "' and tenterprise_userid='" + userid + "'");
|
|
|
+ if (!check.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("已存在一个未提交的提报,不可进行新增操作").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ String fcontent = content.getString("fcontent", "tsubmitedit.fcontent", "提报内容");
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "新增");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("createby", username);
|
|
|
+ sqlFactory.addParameter("tsubmiteditmodelid", tsubmiteditmodelid);
|
|
|
+ sqlFactory.addParameter("tenterprise_userid", userid);
|
|
|
+ sqlFactory.addParameter("tagentsid", tagentsid);
|
|
|
+ sqlFactory.addParameter("fcontent", fcontent);
|
|
|
+ String status = dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
+ if ("true".equalsIgnoreCase(status)) {
|
|
|
+ return query_submiteditmodelMain();
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg(status).toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 经销商保存
|
|
|
+ * 业务员提报保存
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public String saveedit() {
|
|
|
- String tsubmiteditmodelid = content.getString("tsubmiteditmodelid");//提报模板ID
|
|
|
- String fcontent = content.getString("fcontent");//提报模板ID
|
|
|
+ public String saveedit() throws D3bException {
|
|
|
+ long tsubmiteditmodelid = content.getLong("tsubmiteditmodelid");//提报模板ID
|
|
|
+ long tsubmiteditid = content.getLong("tsubmiteditid");//提报ID
|
|
|
+
|
|
|
+ Rows check = dbConnect.runSqlQuery("select tsubmiteditid from tsubmitedit where siteid='" + siteid + "' and fstatus='提交' and tsubmiteditmodelid='" + tsubmiteditmodelid + "' and tsubmiteditid='" + tsubmiteditid + "' and tenterprise_userid='" + userid + "'");
|
|
|
+ if (!check.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("当前提报已提交,不可进行修改操作").toString();
|
|
|
+ }
|
|
|
|
|
|
+ String fcontent = content.getString("fcontent", "tsubmitedit.fcontent", "提报内容");
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "保存");
|
|
|
sqlFactory.addParameter("fcontent", fcontent);
|
|
|
sqlFactory.addParameter("changeby", username);
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
- sqlFactory.addParameter("submitby", username);
|
|
|
sqlFactory.addParameter("tsubmiteditmodelid", tsubmiteditmodelid);
|
|
|
+ sqlFactory.addParameter("tsubmiteditid", tsubmiteditid);
|
|
|
sqlFactory.addParameter("tenterprise_userid", userid);
|
|
|
String status = dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
if ("true".equalsIgnoreCase(status)) {
|
|
|
@@ -101,19 +159,27 @@ public class submitedit extends Controller {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 经销商提交
|
|
|
+ * 业务员提交
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public String submitedit() throws D3bException {
|
|
|
String tsubmiteditmodelid = content.getString("tsubmiteditmodelid");//提报模板ID
|
|
|
- String fcontent = content.getString("fcontent", "tsubmitedit.fcontent", "提报内容");//提报模板ID
|
|
|
+ String tsubmiteditid = content.getString("tsubmiteditid");//提报ID
|
|
|
+
|
|
|
+ Rows check = dbConnect.runSqlQuery("select tsubmiteditid from tsubmitedit where siteid='" + siteid + "' and fstatus='提交' and tsubmiteditmodelid='" + tsubmiteditmodelid + "' and tsubmiteditid='" + tsubmiteditid + "' and tenterprise_userid='" + userid + "'");
|
|
|
+ if (!check.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("当前提报已提交,不可进行提交操作").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ String fcontent = content.getString("fcontent", "tsubmitedit.fcontent", "提报内容");
|
|
|
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "提报");
|
|
|
- sqlFactory.addParameter("fcontent", fcontent);
|
|
|
sqlFactory.addParameter("submitby", username);
|
|
|
+ sqlFactory.addParameter("fcontent", fcontent);
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("tsubmiteditmodelid", tsubmiteditmodelid);
|
|
|
+ sqlFactory.addParameter("tsubmiteditid", tsubmiteditid);
|
|
|
sqlFactory.addParameter("tenterprise_userid", userid);
|
|
|
String status = dbConnect.runSqlUpdate(sqlFactory.getSQL());
|
|
|
if ("true".equalsIgnoreCase(status)) {
|
|
|
@@ -123,7 +189,6 @@ public class submitedit extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 下级提报管理列表查询
|
|
|
*/
|