|
|
@@ -103,6 +103,9 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
if (!nodeLog.testValidity()) {
|
|
|
return;
|
|
|
}
|
|
|
+ StringBuilder customDes = new StringBuilder();
|
|
|
+ if (!customDes(customDes)) return;
|
|
|
+ LogUtil.i("customDes=" + customDes.toString());
|
|
|
if (!canSubmit()) return;
|
|
|
iApproval.showLoading();
|
|
|
String url = "common/review.action";
|
|
|
@@ -115,7 +118,7 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
param.put("_center", "0");//是否集团账套
|
|
|
param.put("_noc", 1);//权限管控
|
|
|
param.put("holdtime", 4311);//holdtime
|
|
|
- param.put("customDes", "");//审批要点customDes=1.11111(2)
|
|
|
+ param.put("customDes", customDes.toString());//审批要点customDes=1.11111(2)
|
|
|
Request.Bulider bulider = new Request.Bulider()
|
|
|
.setUrl(url)
|
|
|
.setMode(Request.Mode.POST)
|
|
|
@@ -393,6 +396,9 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
JSONObject button = OACheckUtil.getJSONObject(object, "button");
|
|
|
if (currentnode != null) {
|
|
|
record.needInputKeys = getJson2Text(button, "jt_neccessaryfield");
|
|
|
+ //TODO 测试数据
|
|
|
+ record.needInputKeys = testNeerInput();
|
|
|
+ record.showNeedMessage = "必填字段未填写";
|
|
|
}
|
|
|
iApproval.showTitile(record);
|
|
|
loadDetailedList();
|
|
|
@@ -475,12 +481,15 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
continue;
|
|
|
}
|
|
|
String value = OACheckUtil.getJson2Text(data, valueKey);//获取第一个字段的值
|
|
|
- if (StringUtils.isEmpty(value)) continue;
|
|
|
+ if (StringUtils.isEmpty(value)) value = "";//TODO 当value为空时候,可能是需要输入的字段,不能返回
|
|
|
boolean mergeAble = OACheckUtil.getJsonIntager(config, "FD_APPWIDTH", "FD_APPWIDTH") == 1;
|
|
|
Approval.ItemData itemData = new Approval.ItemData();
|
|
|
itemData.key = key;
|
|
|
itemData.values = value;
|
|
|
- if (!StringUtils.isEmpty(record.needInputKeys) && record.needInputKeys.contains(key)) {
|
|
|
+ LogUtil.i("这里验证是必填字段的问题");
|
|
|
+ LogUtil.i("record.needInputKeys=" + record.needInputKeys);
|
|
|
+ LogUtil.i("valueKey=" + valueKey);
|
|
|
+ if (!StringUtils.isEmpty(record.needInputKeys) && record.needInputKeys.contains(valueKey)) {
|
|
|
itemData.type = Approval.ItemType.P;
|
|
|
} else {
|
|
|
itemData.type = Approval.ItemType.V;
|
|
|
@@ -618,15 +627,18 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
|
|
|
|
|
|
private void handlerSetupTask(JSONObject object) throws Exception {
|
|
|
- String data = OACheckUtil.getJson2Text(object, "data");
|
|
|
JSONArray arrayCS = OACheckUtil.getJsonArray(object, "cs");
|
|
|
- if (!StringUtils.isEmpty(data)) {
|
|
|
- //需要把该数据填充到对应上面
|
|
|
- String[] datas = data.split(";");
|
|
|
- }
|
|
|
if (!ListUtils.isEmpty(arrayCS)) {
|
|
|
+ String data = OACheckUtil.getJson2Text(object, "data");
|
|
|
+ String[] datas = null;
|
|
|
+ if (!StringUtils.isEmpty(data)) {
|
|
|
+ //需要把该数据填充到对应上面
|
|
|
+ datas = data.split(";");
|
|
|
+ }
|
|
|
for (int i = 0; i < arrayCS.size(); i++) {
|
|
|
- Approval.ItemData itemData = getItemBySetupTask(arrayCS.getString(i));
|
|
|
+ Approval.ItemData itemData = getItemBySetupTask(arrayCS.getString(i), datas);
|
|
|
+
|
|
|
+
|
|
|
if (itemData != null) {
|
|
|
pointsList.add(itemData);
|
|
|
}
|
|
|
@@ -650,7 +662,7 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
* ..$N为非必填字段,
|
|
|
* ..$Y表示该字段为必填字段,
|
|
|
*/
|
|
|
- private Approval.ItemData getItemBySetupTask(String cs) throws Exception {
|
|
|
+ private Approval.ItemData getItemBySetupTask(String cs, String[] datas) throws Exception {
|
|
|
if (!StringUtils.isEmpty(cs)) {
|
|
|
LogUtil.i("cs=" + cs);
|
|
|
Approval.ItemData itemData = new Approval.ItemData();
|
|
|
@@ -678,21 +690,52 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
itemData.inputType = 3;
|
|
|
itemData.type = Approval.ItemType.P;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ itemData.type = Approval.ItemType.P;
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(neer)) {
|
|
|
itemData.mustInput = "Y".equals(neer);
|
|
|
}
|
|
|
}
|
|
|
+ if (datas != null && datas.length > 0 && !StringUtils.isEmpty(itemData.key)) {
|
|
|
+ for (String data : datas) {
|
|
|
+ if (data.contains(itemData.key)) {
|
|
|
+ String values = OACheckUtil.getFirstBrackets(data);
|
|
|
+ if (!StringUtils.isEmpty(values))
|
|
|
+ itemData.values = values;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return itemData;
|
|
|
}
|
|
|
- return itemData;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private boolean canSubmit() {
|
|
|
+ private boolean customDes(StringBuilder customDes) {
|
|
|
+ if (!ListUtils.isEmpty(pointsList)) {
|
|
|
+ LogUtil.i("show Presenter pointsList .....");
|
|
|
+ for (Approval.ItemData itemData : pointsList) {
|
|
|
+ LogUtil.i(itemData.toString());
|
|
|
+ if (itemData.mustInput && StringUtils.isEmpty(itemData.values)) {
|
|
|
+ String message = OACheckUtil.getString(R.string.approval_points) + " " + itemData.key + " " + OACheckUtil.getString(R.string.is_must_input);
|
|
|
+ LogUtil.i("message=" + message);
|
|
|
+ iApproval.showToast(message, R.color.load_submit);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(itemData.key) && !StringUtils.isEmpty(itemData.values))
|
|
|
+ customDes.append(itemData.key + "\\(" + itemData.values + "\\);");
|
|
|
+ }
|
|
|
+ OACheckUtil.removieLast(customDes);
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private boolean canSubmit() {
|
|
|
+ //TODO 判断要点
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//TODO 测试数据
|
|
|
private void testTaskSetupTask() throws Exception {
|
|
|
@@ -711,6 +754,10 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
handlerSetupTask(JSONArray.parseObject(json));
|
|
|
}
|
|
|
|
|
|
+ private String testNeerInput() throws Exception {
|
|
|
+ return "fp_v3;fpd_total";
|
|
|
+ }
|
|
|
+
|
|
|
private void addTastEnclosure() {
|
|
|
|
|
|
Approval.Enclosure enclosure = new Approval.Enclosure();
|
|
|
@@ -731,4 +778,6 @@ public class ApprovalPresenter implements OnHttpResultListener {
|
|
|
enclosure.name = "测试excel数据.xlsx";
|
|
|
enclosureList.add(enclosure);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|