修复动态考察结果汇总考察计划为空异常
This commit is contained in:
parent
a3d3130d0b
commit
e9b47fae67
|
@ -45,92 +45,95 @@ public class ExamTaskSummaryListPlugin extends AbstractListPlugin implements Plu
|
|||
long evalTaskId = evaltask.getLong("id");
|
||||
QFilter qFilter = new QFilter("plandetails.evaltask.id", QCP.equals, evalTaskId);
|
||||
DynamicObject examPlan = BusinessDataServiceHelper.loadSingle("resm_investigationplan", qFilter.toArray());
|
||||
DynamicObject qeug_project = examPlan.getDynamicObject("qeug_project");//考察计划的项目
|
||||
if (qeug_project != null){
|
||||
projectName = qeug_project.getString("name");
|
||||
}
|
||||
DynamicObjectCollection plandetails = examPlan.getDynamicObjectCollection("plandetails");//计划详情-分为多个考察任务
|
||||
HashMap<String, HashMap<String, BigDecimal>> supOfUserGrade = new HashMap<String, HashMap<String, BigDecimal>>();//供应商对应人员评分:key为供应商名称,value为对应供应商考察成绩情况
|
||||
HashMap<String,HashMap<String,String>> userNames = new HashMap<String, HashMap<String,String>>();//人员及属性集合:用于构建单据字段
|
||||
for (DynamicObject plandetail : plandetails) {//循环多条考察任务
|
||||
String suppliersource = plandetail.getString("suppliersource");//供应商来源:区分正式供应商和潜在供应商
|
||||
HashSet<Long> userNamesNow = new HashSet<Long>();//当前任务人员主键集合
|
||||
ArrayList<DynamicObject> userDys = new ArrayList<>();//当前任务人员对象集合:存放当前考察任务对应的考察人员对象
|
||||
DynamicObject suppliername = plandetail.getDynamicObject("suppliername");//供应商对象
|
||||
Object sup_pkValue = suppliername.getPkValue();//供应商主键
|
||||
String supName = suppliername.getString("name");
|
||||
DynamicObject evaltask_l = plandetail.getDynamicObject("evaltask");//考察任务
|
||||
long evaltask_lPk = evaltask_l.getLong("id");//考察任务主键
|
||||
DynamicObject resm_exam_task = BusinessDataServiceHelper.loadSingle(evaltask_lPk, "resm_exam_task");//完整考察任务数据
|
||||
String evaloObject = resm_exam_task.getString("evalobject");//考察对象:区分角色或者人员
|
||||
boolean isRoleEval = StringUtils.equals("roleeval", evaloObject);
|
||||
DynamicObjectCollection entry_evaldetail = resm_exam_task.getDynamicObjectCollection("entry_evaldetail");
|
||||
DynamicObject evalDetailRow = entry_evaldetail.get(0);
|
||||
//todo:查询对应任务人员权重配置
|
||||
DynamicObject myEval = BusinessDataServiceHelper.loadSingle("resm_evaluator", "evalentryid,entry_evaluator.user,entry_evaluator.role", new QFilter[]{new QFilter("evalentryid", "=", String.valueOf(evalDetailRow.getPkValue()))});
|
||||
if (myEval != null) {
|
||||
DynamicObjectCollection entryentity = myEval.getDynamicObjectCollection("entry_evaluator");
|
||||
for(int k = 0; k < entryentity.size(); k++) {
|
||||
DynamicObject evaluatorEntryRow = (DynamicObject)entryentity.get(k);
|
||||
if (isRoleEval) {
|
||||
if (examPlan != null){
|
||||
DynamicObject qeug_project = examPlan.getDynamicObject("qeug_project");//考察计划的项目
|
||||
if (qeug_project != null){
|
||||
projectName = qeug_project.getString("name");
|
||||
}
|
||||
DynamicObjectCollection plandetails = examPlan.getDynamicObjectCollection("plandetails");//计划详情-分为多个考察任务
|
||||
HashMap<String, HashMap<String, BigDecimal>> supOfUserGrade = new HashMap<String, HashMap<String, BigDecimal>>();//供应商对应人员评分:key为供应商名称,value为对应供应商考察成绩情况
|
||||
HashMap<String,HashMap<String,String>> userNames = new HashMap<String, HashMap<String,String>>();//人员及属性集合:用于构建单据字段
|
||||
for (DynamicObject plandetail : plandetails) {//循环多条考察任务
|
||||
String suppliersource = plandetail.getString("suppliersource");//供应商来源:区分正式供应商和潜在供应商
|
||||
HashSet<Long> userNamesNow = new HashSet<Long>();//当前任务人员主键集合
|
||||
ArrayList<DynamicObject> userDys = new ArrayList<>();//当前任务人员对象集合:存放当前考察任务对应的考察人员对象
|
||||
DynamicObject suppliername = plandetail.getDynamicObject("suppliername");//供应商对象
|
||||
Object sup_pkValue = suppliername.getPkValue();//供应商主键
|
||||
String supName = suppliername.getString("name");
|
||||
DynamicObject evaltask_l = plandetail.getDynamicObject("evaltask");//考察任务
|
||||
long evaltask_lPk = evaltask_l.getLong("id");//考察任务主键
|
||||
DynamicObject resm_exam_task = BusinessDataServiceHelper.loadSingle(evaltask_lPk, "resm_exam_task");//完整考察任务数据
|
||||
String evaloObject = resm_exam_task.getString("evalobject");//考察对象:区分角色或者人员
|
||||
boolean isRoleEval = StringUtils.equals("roleeval", evaloObject);
|
||||
DynamicObjectCollection entry_evaldetail = resm_exam_task.getDynamicObjectCollection("entry_evaldetail");
|
||||
DynamicObject evalDetailRow = entry_evaldetail.get(0);
|
||||
//todo:查询对应任务人员权重配置
|
||||
DynamicObject myEval = BusinessDataServiceHelper.loadSingle("resm_evaluator", "evalentryid,entry_evaluator.user,entry_evaluator.role", new QFilter[]{new QFilter("evalentryid", "=", String.valueOf(evalDetailRow.getPkValue()))});
|
||||
if (myEval != null) {
|
||||
DynamicObjectCollection entryentity = myEval.getDynamicObjectCollection("entry_evaluator");
|
||||
for(int k = 0; k < entryentity.size(); k++) {
|
||||
DynamicObject evaluatorEntryRow = (DynamicObject)entryentity.get(k);
|
||||
if (isRoleEval) {
|
||||
// evaluatorSet.add((Long)evaluatorEntryRow.getDynamicObject("role").getPkValue());
|
||||
// evaluatorTempSet.add((Long)evaluatorEntryRow.getDynamicObject("role").getPkValue());
|
||||
} else {
|
||||
Long userPk = (Long) evaluatorEntryRow.getDynamicObject("user").getPkValue();
|
||||
DynamicObject bos_user = BusinessDataServiceHelper.loadSingle(userPk, "bos_user");
|
||||
if (bos_user != null){
|
||||
String name = bos_user.getString("name");
|
||||
String username = bos_user.getString("username");
|
||||
HashMap<String, String> userProperty = new HashMap<>();
|
||||
userProperty.put("name",name);
|
||||
userProperty.put("username",username);
|
||||
userNames.put(username,userProperty);//添加进入人员属性中
|
||||
userNamesNow.add(userPk);//添加进入当前人员主键集合
|
||||
userDys.add(bos_user);//添加进入当前人员对象集合
|
||||
} else {
|
||||
Long userPk = (Long) evaluatorEntryRow.getDynamicObject("user").getPkValue();
|
||||
DynamicObject bos_user = BusinessDataServiceHelper.loadSingle(userPk, "bos_user");
|
||||
if (bos_user != null){
|
||||
String name = bos_user.getString("name");
|
||||
String username = bos_user.getString("username");
|
||||
HashMap<String, String> userProperty = new HashMap<>();
|
||||
userProperty.put("name",name);
|
||||
userProperty.put("username",username);
|
||||
userNames.put(username,userProperty);//添加进入人员属性中
|
||||
userNamesNow.add(userPk);//添加进入当前人员主键集合
|
||||
userDys.add(bos_user);//添加进入当前人员对象集合
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QFilter myexam_QF = new QFilter("evaltask.id",QCP.equals,evaltask_lPk);//考察任务id
|
||||
myexam_QF.and("creator.id",QCP.in,userNamesNow);//当前考察人
|
||||
if ("resm_regsupplier".equals(suppliersource)){//潜在供应商
|
||||
myexam_QF.and("evalsupplier.id",QCP.equals,sup_pkValue);
|
||||
}else {//正式供应商
|
||||
myexam_QF.and("evaloffsupplier.id",QCP.equals,sup_pkValue);
|
||||
}
|
||||
//查询出该考察任务关联的我的考察
|
||||
DynamicObject[] resm_myexams = BusinessDataServiceHelper.load("resm_myexam", "creator,evalscore", myexam_QF.toArray());
|
||||
//todo:开始构建供应商对应人员评分
|
||||
HashMap<String, BigDecimal> userGrades = new HashMap<String, BigDecimal>();//人员成绩:key为人员用户名,value为人员分数
|
||||
if (resm_myexams.length > 0){
|
||||
for (DynamicObject resm_myexam : resm_myexams) {
|
||||
DynamicObject creator = resm_myexam.getDynamicObject("creator");//当前考察人
|
||||
BigDecimal evalscore = resm_myexam.getBigDecimal("evalscore");//考察得分
|
||||
String username = creator.getString("username");//人员用户名
|
||||
userGrades.put(username,evalscore);
|
||||
QFilter myexam_QF = new QFilter("evaltask.id",QCP.equals,evaltask_lPk);//考察任务id
|
||||
myexam_QF.and("creator.id",QCP.in,userNamesNow);//当前考察人
|
||||
if ("resm_regsupplier".equals(suppliersource)){//潜在供应商
|
||||
myexam_QF.and("evalsupplier.id",QCP.equals,sup_pkValue);
|
||||
}else {//正式供应商
|
||||
myexam_QF.and("evaloffsupplier.id",QCP.equals,sup_pkValue);
|
||||
}
|
||||
}else {
|
||||
//我的考察还未下达时,先赋值0;
|
||||
for (DynamicObject userDy : userDys) {
|
||||
String username = userDy.getString("username");
|
||||
userGrades.put(username,BigDecimal.ZERO);
|
||||
//查询出该考察任务关联的我的考察
|
||||
DynamicObject[] resm_myexams = BusinessDataServiceHelper.load("resm_myexam", "creator,evalscore", myexam_QF.toArray());
|
||||
//todo:开始构建供应商对应人员评分
|
||||
HashMap<String, BigDecimal> userGrades = new HashMap<String, BigDecimal>();//人员成绩:key为人员用户名,value为人员分数
|
||||
if (resm_myexams.length > 0){
|
||||
for (DynamicObject resm_myexam : resm_myexams) {
|
||||
DynamicObject creator = resm_myexam.getDynamicObject("creator");//当前考察人
|
||||
BigDecimal evalscore = resm_myexam.getBigDecimal("evalscore");//考察得分
|
||||
String username = creator.getString("username");//人员用户名
|
||||
userGrades.put(username,evalscore);
|
||||
}
|
||||
}else {
|
||||
//我的考察还未下达时,先赋值0;
|
||||
for (DynamicObject userDy : userDys) {
|
||||
String username = userDy.getString("username");
|
||||
userGrades.put(username,BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
supOfUserGrade.put(supName,userGrades);
|
||||
}
|
||||
supOfUserGrade.put(supName,userGrades);
|
||||
}
|
||||
//todo: 构建传参
|
||||
FormShowParameter formShowParameter = new FormShowParameter();
|
||||
formShowParameter.setFormId("qeug_dynamicexampage");
|
||||
formShowParameter.setCaption(projectName+"供应商评分汇总表");
|
||||
formShowParameter.setCustomParam("supOfUserGrade",supOfUserGrade);
|
||||
formShowParameter.setCustomParam("userNames",userNames);
|
||||
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||
//todo: 构建传参
|
||||
FormShowParameter formShowParameter = new FormShowParameter();
|
||||
formShowParameter.setFormId("qeug_dynamicexampage");
|
||||
formShowParameter.setCaption(projectName+"供应商评分汇总表");
|
||||
formShowParameter.setCustomParam("supOfUserGrade",supOfUserGrade);
|
||||
formShowParameter.setCustomParam("userNames",userNames);
|
||||
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||
// StyleCss inlineStyleCss = new StyleCss();
|
||||
// inlineStyleCss.setHeight("600");
|
||||
// inlineStyleCss.setWidth("1000");
|
||||
// formShowParameter.getOpenStyle().setInlineStyleCss(inlineStyleCss);
|
||||
getView().showForm(formShowParameter);
|
||||
|
||||
getView().showForm(formShowParameter);
|
||||
}else {
|
||||
this.getView().showTipNotification("对应考察计划数据异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue