|
|
@@ -31,13 +31,19 @@ public class DailySign extends Controller {
|
|
|
|
|
|
Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
|
|
|
+ String ondate = content.getStringValueForDate("ondate", "yyyy-MM-dd", "null");
|
|
|
+ if (!ondate.equals("null") && dbConnect.runSqlQuery("SELECT 1 from sat_sharematerial WHERE ondate='" + ondate + "' and siteid='" + siteid + "' and sat_sharematerialid != " + sat_sharematerialid).isNotEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg("上档日期已存在").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (sat_sharematerialid <= 0) {
|
|
|
sat_sharematerialid = createTableID(sat_sharematerial);
|
|
|
InsertSQL sqlFactory = SQLFactory.createInsertSQL(this, sat_sharematerial);
|
|
|
sqlFactory.setSiteid(siteid);
|
|
|
sqlFactory.setUniqueid(sat_sharematerialid);
|
|
|
sqlFactory.setValue("sys_enterpriseid", sys_enterpriseid);
|
|
|
- sqlFactory.setValue("ondate", content.getStringValueForDate("ondate", "yyyy-MM-dd", "null"));
|
|
|
+ sqlFactory.setValue("ondate", ondate);
|
|
|
sqlFactory.setValue("isqrcode", content.getBooleanValue("isqrcode"));
|
|
|
sqlFactory.setValue("qrcodecontent", content.getStringValue("qrcodecontent", true));
|
|
|
sqlFactory.setValue("notes", content.getStringValue("notes"));
|
|
|
@@ -50,7 +56,7 @@ public class DailySign extends Controller {
|
|
|
UpdateSQL sqlFactory = SQLFactory.createUpdateSQL(this, sat_sharematerial);
|
|
|
sqlFactory.setUniqueid(sat_sharematerialid);
|
|
|
sqlFactory.setSiteid(siteid);
|
|
|
- sqlFactory.setValue("ondate", content.getStringValueForDate("ondate", "yyyy-MM-dd", "null"));
|
|
|
+ sqlFactory.setValue("ondate", ondate);
|
|
|
sqlFactory.setValue("isqrcode", content.getBooleanValue("isqrcode"));
|
|
|
sqlFactory.setValue("qrcodecontent", content.getStringValue("qrcodecontent", true));
|
|
|
sqlFactory.setValue("notes", content.getStringValue("notes"));
|
|
|
@@ -135,14 +141,29 @@ public class DailySign extends Controller {
|
|
|
where.append("t1.createdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
|
|
|
where.append(")");
|
|
|
}
|
|
|
+ if (whereObject.containsKey("week") && !"".equals(whereObject.getString("week"))) {
|
|
|
+ int week = whereObject.getIntValue("week");
|
|
|
+ if (week == 0) {
|
|
|
+ where.append(" and (WEEK(t1.ondate)=WEEK(CURRENT_DATE))");
|
|
|
+ }
|
|
|
+ if (week > 0) {
|
|
|
+ where.append(" and (WEEK(t1.ondate)=WEEK(CURRENT_DATE)+" + week + ")");
|
|
|
+ }
|
|
|
+ if (week < 0) {
|
|
|
+ where.append(" and (WEEK(t1.ondate)=WEEK(CURRENT_DATE)-" + Math.abs(week) + ")");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, sat_sharematerial,
|
|
|
"sat_sharematerialid", "type", "notes", "isqrcode", "qrcodecontent", "ondate", "readcount", "downloadcount", "createdate")
|
|
|
.setTableAlias("t1");
|
|
|
sqlFactory.setSiteid(siteid);
|
|
|
+ sqlFactory.setWhere("classid", 1);
|
|
|
sqlFactory.setWhere(where.toString());
|
|
|
sqlFactory.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
+ System.err.println(sqlFactory.getSQL());
|
|
|
Rows rows = sqlFactory.query();
|
|
|
|
|
|
ArrayList<Long> ids = rows.toArrayList("sat_sharematerialid", new ArrayList<>());
|
|
|
@@ -172,23 +193,23 @@ public class DailySign extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- boolean isdownload=content.getBooleanValue("isdownload");
|
|
|
- Long sat_sharematerialid=content.getLongValue("sat_sharematerialid");
|
|
|
+ boolean isdownload = content.getBooleanValue("isdownload");
|
|
|
+ Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
|
|
|
QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, "sat_sharematerial_read")
|
|
|
.setTableAlias("t1");
|
|
|
- sqlFactory.addJoinTable(JOINTYPE.left,"sys_users","t2","t2.userid=t1.createuserid","name");
|
|
|
- sqlFactory.addQueryFields("address","''");
|
|
|
+ sqlFactory.addJoinTable(JOINTYPE.left, "sys_users", "t2", "t2.userid=t1.createuserid", "name");
|
|
|
+ sqlFactory.addQueryFields("address", "''");
|
|
|
sqlFactory.setSiteid(siteid);
|
|
|
sqlFactory.setWhere(where.toString());
|
|
|
- sqlFactory.setWhere("isdownload",isdownload);
|
|
|
- sqlFactory.setWhere("sat_sharematerialid",sat_sharematerialid);
|
|
|
+ sqlFactory.setWhere("isdownload", isdownload);
|
|
|
+ sqlFactory.setWhere("sat_sharematerialid", sat_sharematerialid);
|
|
|
sqlFactory.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
Rows rows = sqlFactory.query();
|
|
|
|
|
|
ArrayList<Long> ids = rows.toArrayList("createuserid", new ArrayList<>());
|
|
|
// 附件
|
|
|
- RowsMap RowsMap = Attachment.get(this,"sys_users",ids);
|
|
|
+ RowsMap RowsMap = Attachment.get(this, "sys_users", ids);
|
|
|
for (Row row : rows) {
|
|
|
Rows Rows = RowsMap.getOrDefault(row.getString("createuserid"), new Rows());
|
|
|
row.put("attinfos", Rows);
|