Compare commits
3 Commits
65ee65cd30
...
b42bc3afb8
Author | SHA1 | Date |
---|---|---|
ggxl | b42bc3afb8 | |
ggxl | 129c22f002 | |
ggxl | 6251ccdd07 |
|
@ -0,0 +1,108 @@
|
|||
package shkd.repc.resm.formplugin;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.entity.ILocaleString;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.EventObject;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* 单据界面插件
|
||||
*/
|
||||
public class BringScoreDescribeSummaryPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
/*
|
||||
* 考察任务-考察任务汇总评分时将我的考察中评分说明(优)带到考察结果中
|
||||
* */
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
|
||||
String openType = (String) this.getView().getFormShowParameter().getCustomParam("opentype");
|
||||
String billStatus = this.getModel().getDataEntity().getString("billstatus");
|
||||
DynamicObject dataEntity = this.getModel().getDataEntity();
|
||||
DynamicObject examTaskSummary = QueryServiceHelper.queryOne("resm_examtask_summary", "id", (new QFilter("evaltask", "=", dataEntity.getPkValue())).toArray());
|
||||
if (examTaskSummary == null) {
|
||||
if (!StringUtils.isEmpty(openType) && "sumup".equals(openType) && "ORDERED".equals(billStatus)) {
|
||||
DynamicObject[] myEvals = BusinessDataServiceHelper.load("resm_myexam", "creator.name,evalrole,entry_evalscore.score,entry_evalscore.evalindex,entry_evalscore.coredesc,entry_evalscore.qeug_scoredesc,entry_evalscore.evalator,entry_evalscore.evalator.name,opinionplus", new QFilter[]{new QFilter("evaltask", "=", dataEntity.getPkValue())});
|
||||
DynamicObjectCollection evalDetailEntry = this.getModel().getEntryEntity("entry_evaldetail");
|
||||
|
||||
for (int i = 0; i < evalDetailEntry.size(); ++i) {
|
||||
DynamicObject evalDetailEntryRow = (DynamicObject) evalDetailEntry.get(i);
|
||||
|
||||
String myEvalDesc = "";
|
||||
DynamicObject evaluatorBill = BusinessDataServiceHelper.loadSingle("resm_evaluator", "evalentryid,entry_evaluator.user,entry_evaluator.role,entry_evaluator.user.name,entry_evaluator.weight", new QFilter[]{new QFilter("evalentryid", "=", String.valueOf(evalDetailEntryRow.getPkValue()))});
|
||||
if (evaluatorBill != null) {
|
||||
for (int j = 0; j < myEvals.length; ++j) {
|
||||
DynamicObject myEval = myEvals[j];
|
||||
DynamicObjectCollection evalScoreEntry = myEval.getDynamicObjectCollection("entry_evalscore");
|
||||
|
||||
label93:
|
||||
for(int k = 0; k < evalScoreEntry.size(); ++k) {
|
||||
DynamicObject evalScoreEntryRow = (DynamicObject)evalScoreEntry.get(k);
|
||||
if (evalDetailEntryRow.getDynamicObject("evalindex") != null && evalScoreEntryRow.getDynamicObject("evalindex") != null && evalDetailEntryRow.getDynamicObject("evalindex").getPkValue().equals(evalScoreEntryRow.getDynamicObject("evalindex").getPkValue())) {
|
||||
DynamicObjectCollection evaluatorEntry = evaluatorBill.getDynamicObjectCollection("entry_evaluator");
|
||||
Iterator var22 = evaluatorEntry.iterator();
|
||||
|
||||
while(true) {
|
||||
while(true) {
|
||||
if (!var22.hasNext()) {
|
||||
continue label93;
|
||||
}
|
||||
|
||||
DynamicObject evaluatorEntryRow = (DynamicObject)var22.next();
|
||||
if (evaluatorEntryRow.getDynamicObject("user") != null && evalScoreEntryRow.getDynamicObject("evalator") != null) {
|
||||
if (evaluatorEntryRow.getDynamicObject("user").getPkValue().equals(evalScoreEntryRow.getDynamicObject("evalator").getPkValue())) {
|
||||
myEvalDesc = myEvalDesc + this.assembleUserMyEvalDesc(evalScoreEntryRow, evaluatorEntryRow);
|
||||
}
|
||||
} else if (myEval.getDynamicObject("evalrole") != null && evaluatorEntryRow.getDynamicObject("role") != null && evaluatorEntryRow.getDynamicObject("role").getPkValue().equals(myEval.getDynamicObject("evalrole").getPkValue())) {
|
||||
myEvalDesc = myEvalDesc + this.assembleRoleMyEvalDesc(myEval, evalScoreEntryRow, evaluatorEntryRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.getModel().setValue("qeug_myevaldesc", this.trimDescValue(myEvalDesc), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String assembleUserMyEvalDesc(DynamicObject evalScoreEntryRow, DynamicObject evaluatorEntryRow) {
|
||||
String result = evaluatorEntryRow.getDynamicObject("user").getString("name") + "(";
|
||||
ILocaleString localeString = evalScoreEntryRow.getLocaleString("qeug_scoredesc");
|
||||
if (localeString != null && !localeString.isEmpty() && localeString.getLocaleValue() != null && !localeString.getLocaleValue().isEmpty()) {
|
||||
result = result + localeString.getLocaleValue();
|
||||
return result + "),\n";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
protected String assembleRoleMyEvalDesc(DynamicObject myEval, DynamicObject evalScoreEntryRow, DynamicObject evaluatorEntryRow) {
|
||||
String result = myEval.getString("creator.name") + "(";
|
||||
ILocaleString localeString = evalScoreEntryRow.getLocaleString("qeug_scoredesc");
|
||||
if (localeString != null && !localeString.isEmpty() && localeString.getLocaleValue() != null && !localeString.getLocaleValue().isEmpty()) {
|
||||
result = result + localeString.getLocaleValue();
|
||||
return result + "),\n";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
protected String trimDescValue(String desc) {
|
||||
return desc.isEmpty() ? "" : desc.substring(0, desc.lastIndexOf(",") < 0 ? desc.length() - 1 : desc.lastIndexOf(","));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue