|
|
@@ -9,10 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sun.xml.internal.xsom.impl.Ref;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
-import common.annotation.API;
|
|
|
-import common.annotation.CACHEING;
|
|
|
-import common.annotation.CACHEING_CLEAN;
|
|
|
-import common.annotation.cm;
|
|
|
+import common.annotation.*;
|
|
|
import common.data.*;
|
|
|
import common.data.Row;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
@@ -39,7 +36,6 @@ public class cashbill extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 下载凭证导入单模板
|
|
|
*
|
|
|
@@ -289,7 +285,7 @@ public class cashbill extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @API(title = "收支凭证新建更新", apiversion = R.ID20221009102803.v1.class,intervaltime = 200)
|
|
|
+ @API(title = "收支凭证新建更新", apiversion = R.ID20221009102803.v1.class, intervaltime = 200)
|
|
|
@CACHEING_CLEAN(apiversions = {R.ID20221009102903.v1.class, R.ID20221010102903.v1.class, R.ID20221009103003.v1.class, R.ID20230111103403.v1.class})
|
|
|
public String insertormodify_creditbill() throws YosException {
|
|
|
Long sa_cashbillid = content.getLong("sa_cashbillid");
|
|
|
@@ -443,7 +439,7 @@ public class cashbill extends Controller {
|
|
|
where = where + " and ifnull(t3.isrebate,0) ='" + whereObject.getLongValue("isrebate") + "'";
|
|
|
}
|
|
|
if (whereObject.containsKey("remarks") && !"".equals(whereObject.getString("remarks"))) {
|
|
|
- where = where+" and t1.remarks like'%"+whereObject.getString("remarks") + "%' ";
|
|
|
+ where = where + " and t1.remarks like'%" + whereObject.getString("remarks") + "%' ";
|
|
|
}
|
|
|
if (whereObject.containsKey("agentinfo") && !"".equals(whereObject.getString("agentinfo"))) {
|
|
|
where = where + " and(t2.enterprisename like'%" + whereObject.getString("agentinfo") + "%'"
|
|
|
@@ -451,10 +447,13 @@ public class cashbill extends Controller {
|
|
|
+ ")";
|
|
|
}
|
|
|
}
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "收支凭证列表查询", pageSize, pageNumber, pageSorting);
|
|
|
- sqlFactory.addParameter_SQL("where", where);
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+ if (pageSorting.equals("''")) {
|
|
|
+ pageSorting = "status desc, createdate desc";
|
|
|
+ }
|
|
|
+ QuerySQL querySQL = queryList(where);
|
|
|
+ querySQL.setOrderBy(pageSorting);
|
|
|
+ querySQL.setPage(pageSize, pageNumber);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
ArrayList sa_cashbillids = rows.toArrayList("sa_cashbillid", new ArrayList<>());
|
|
|
sa_cashbillids.add(0L);
|
|
|
|
|
|
@@ -511,7 +510,7 @@ public class cashbill extends Controller {
|
|
|
where = where + " and ifnull(t3.isrebate,0) ='" + whereObject.getLongValue("isrebate") + "'";
|
|
|
}
|
|
|
if (whereObject.containsKey("remarks") && !"".equals(whereObject.getString("remarks"))) {
|
|
|
- where = where+" and t1.remarks like'%"+whereObject.getString("remarks") + "%' ";
|
|
|
+ where = where + " and t1.remarks like'%" + whereObject.getString("remarks") + "%' ";
|
|
|
}
|
|
|
if (whereObject.containsKey("agentinfo") && !"".equals(whereObject.getString("agentinfo"))) {
|
|
|
where = where + " and(t2.enterprisename like'%" + whereObject.getString("agentinfo") + "%'"
|
|
|
@@ -519,17 +518,41 @@ public class cashbill extends Controller {
|
|
|
+ ")";
|
|
|
}
|
|
|
}
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this, "收支凭证列表查询", pageSize, pageNumber, pageSorting);
|
|
|
- sqlFactory.addParameter_SQL("where", where);
|
|
|
- sqlFactory.addParameter("siteid", siteid);
|
|
|
- Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
+ if (pageSorting.equals("''")) {
|
|
|
+ pageSorting = "status desc, createdate desc";
|
|
|
+ }
|
|
|
+ QuerySQL querySQL = queryList(where);
|
|
|
+ querySQL.setOrderBy(pageSorting);
|
|
|
+ querySQL.setPage(pageSize, pageNumber);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
for (Row row : rows) {
|
|
|
row.put("amount", row.getBigDecimal("amount"));
|
|
|
}
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
+ public QuerySQL queryList(String where) throws YosException {
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_cashbill");
|
|
|
+ querySQL.setTableAlias("t1");
|
|
|
+ querySQL.addQueryFields("unwriteoffamount", "t1.amount - t1.writeoffamount");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t2", "t1.sys_enterpriseid = t2.sys_enterpriseid and t1.siteid = t2.siteid",
|
|
|
+ "enterprisename", "abbreviation");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t4", "t4.sys_enterpriseid = t2.sys_enterpriseid and t4.siteid = t2.siteid",
|
|
|
+ "agentnum");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_accountclass", "t3", "t1.sa_accountclassid = t3.sa_accountclassid and t1.siteid = t3.siteid and t3.isused = 1",
|
|
|
+ "accountno", "accountname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_cashbill", "t5", "t1.siteid = t5.siteid and t5.ownerid = t1.sa_cashbillid and t5.ownertable = 'sa_cashbill'");
|
|
|
+
|
|
|
+ querySQL.addQueryFields("offsettingbillno", "t5.billno");
|
|
|
+ querySQL.setWhere(where);
|
|
|
+ querySQL.setWhere("t1.siteid", siteid);
|
|
|
+ return querySQL;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@API(title = "收支凭证详情", apiversion = R.ID20221009103003.v1.class)
|
|
|
+ @QUERYBYROWINDEX(uniquecolumnname = "sa_cashbillid", listapiversion = {R.ID20221010102903.v1.class, R.ID20221009102903.v1.class})
|
|
|
public String queryCashbillMain() throws YosException {
|
|
|
Long sa_cashbillid = content.getLong("sa_cashbillid");
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "收支凭证详情查询");
|