一、需求
二.构建对象与属性
@Data @Accessors(chain = true) public class InspecDataVO implements Serializable { @FieldName(description = "检查资料") private InspectionDataVO checkInfo; @FieldName(description = "评价") private InvestInfoVO investInfo;
@Data @Accessors(chain = true) public class InspectionDataVO extends CommonAttrDTO implements Serializable { private static final long serialVersionUID = 8501998152744700892L; /** * 用户名 */ @FieldName(description = "用户名") private String userName; /** * 用户手机号 */ @FieldName(description = "用户手机号") private String userPhone; @FieldName(description = "属性名称") private String name; /** * 二级分类列表 * 贷款与经营核实 */ @FieldName(description = "贷款与经营核实") private List<DhCheckInfoVO> dhCheckInfoVOS; @Override public boolean checkCompleted() { for(DhCheckInfoVO checkCat : dhCheckInfoVOS){ if(!checkCat.checkCompleted()){ this.setCompleted(false); return false; } } this.setCompleted(true); return true; } }
@Data @Accessors(chain = true) public class DhCheckInfoVO extends CommonAttrDTO { private static final long serialVersionUID = -7130678131807641490L; @FieldName(description = "描述") private String name; @FieldName(description = "一级类目") private List<DhCheckCatVO> dhCheckInfoVOS; @FieldName(description = "类型") private String type; @Override public boolean checkCompleted() { for(DhCheckCatVO checkCat : dhCheckInfoVOS){ if(!checkCat.checkCompleted()){ this.setCompleted(false); return false; } } this.setCompleted(true); return true; } }
@Data @Accessors(chain = true) public class DhCheckCatVO extends CommonAttrDTO { /** * 类目名称 */ @FieldName(description = "类目名称") private String name; /** * 属性 */ @FieldName(description = "属性") private List<DhCheckAttrVO> dhCheckInfoVOS; @FieldName(description = "类型") private String type; @Override public boolean checkCompleted() { for(DhCheckAttrVO attrVO : dhCheckInfoVOS){ if(!attrVO.checkCompleted()){ this.setCompleted(false); return false; } } this.setCompleted(true); return true; } }
@EqualsAndHashCode(callSuper = true) @Data public class DhCheckAttrVO extends CommonAttrDTO implements Serializable { private static final long serialVersionUID = 8490599408623805493L; @FieldName(description = "属性名称") private String name; @FieldName(description = "属性类型") private String type; @FieldName(description = "属性值") private String value; @FieldName(description = "属性编号") private String code; @Override public boolean checkCompleted() { if(!StringUtils.isEmpty(value)){ this.setCompleted(true); return true; } return false; } }
@Data @Accessors(chain = true) public abstract class CommonAttrDTO implements Serializable { private static final long serialVersionUID = 1L; private Integer id; @FieldName(description = "是否可编辑 0=不可编辑 1=可编辑") private Integer editFlag = 1; /** * 是否完成 */ @FieldName(description = "是否完成") private Boolean completed = false; @FieldName(description = "是否必填,1-是,0-否 2=有条件选题") private Integer mustFill = 1; @FieldName(description = "确定按钮是否置灰,0-置灰,1-不置灰") private int sureFlag = 1; /** * 排序字段 */ @FieldName(description = "排序") private Integer sortOrder; @FieldName(description = "属性logo") private String logo; public abstract boolean checkCompleted(); }
public InspecDataVO inspectionData(InspectionReq inspectionReq) { log.info("进入资料检查查询"+ JSONObject.toJSONString(inspectionReq)); VisitSurveyTask visitSurveyTask = new VisitSurveyTask(); String taskNum=inspectionReq.getTaskNum(); Long taskId =inspectionReq.getTaskId(); visitSurveyTask.setTaskNum(taskNum); visitSurveyTask.setId(taskId); InspecDataVO inspecDataVO =new InspecDataVO(); InspectionDataVO inspectionDataVO = new InspectionDataVO(); inspectionDataVO.setName("检查资料"); List dhCheckInfoVOS = new ArrayList<DhCheckInfoVO>(); /** * 贷款用途核实开始 */ DhCheckInfoVO loanPurpose =new DhCheckInfoVO(); loanPurpose.setName("贷款用途核实"); log.info("获在Apollo获取贷款用途核实URL:"+ JSONObject.toJSONString(appConfig.getLoanUrl())); loanPurpose.setLogo(appConfig.getLoanUrl()); //贷款用途核实类目列表 List<DhCheckCatVO> loanPurposeCats = new ArrayList<DhCheckCatVO>(); loanPurpose.setDhCheckInfoVOS(loanPurposeCats); //客户客户实际贷款用途描述 loanPurpose DhCheckCatVO loanPurposeDescCat = new DhCheckCatVO(); loanPurposeDescCat.setName("客户实际贷款用途描述"); loanPurposeDescCat.setType("post_sub_cate"); List<DhCheckAttrVO> loanPurposeDescCatAttrs = Lists.newArrayList(); loanPurposeDescCat.setDhCheckInfoVOS(loanPurposeDescCatAttrs); DhCheckAttrVO loanPurposeAttr = new DhCheckAttrVO(); loanPurposeAttr.setName(""); loanPurposeAttr.setType("text"); loanPurposeAttr.setCode("01"); loanPurposeAttr.setName("用途描述"); loanPurposeDescCatAttrs.add(loanPurposeAttr); //贷款用途影像资料上传loanUoload DhCheckCatVO loanPurposeUploadCat = new DhCheckCatVO(); loanPurposeUploadCat.setName("贷款用途影像资料上传"); loanPurposeUploadCat.setType("post_sub_upload_cate"); List<DhCheckAttrVO> loanPurposeUploadCatAttrs = Lists.newArrayList(); loanPurposeUploadCat.setDhCheckInfoVOS(loanPurposeUploadCatAttrs); DhCheckAttrVO loanPurposeUploadAttr = new DhCheckAttrVO(); loanPurposeUploadAttr.setValue(""); loanPurposeUploadAttr.setType("image"); loanPurposeUploadAttr.setCode("05"); loanPurposeUploadAttr.setName("贷款用途影像资料"); loanPurposeUploadCatAttrs.add(loanPurposeUploadAttr); loanPurposeCats.add(loanPurposeDescCat); loanPurposeCats.add(loanPurposeUploadCat); /** * 贷款用途核实结束 */ /** * 经营情况核实开始 */ DhCheckInfoVO businessCondition =new DhCheckInfoVO(); businessCondition.setName("经营情况核实"); log.info("获在Apollo获取经营情况核实URL:"+ JSONObject.toJSONString(appConfig.getBussinesUrl())); businessCondition.setLogo(appConfig.getBussinesUrl()); List<DhCheckCatVO> businessConditionCats = Lists.newArrayList(); businessCondition.setDhCheckInfoVOS(businessConditionCats); DhCheckCatVO businessConditionDescCat = new DhCheckCatVO(); businessConditionDescCat.setName("客户正常经营情况"); businessConditionDescCat.setType("post_sub_cate"); List<DhCheckAttrVO> businessConditionDescCatAttrs = Lists.newArrayList(); businessConditionDescCat.setDhCheckInfoVOS(businessConditionDescCatAttrs); DhCheckAttrVO businessConditionDescCatAttr = new DhCheckAttrVO(); businessConditionDescCatAttr.setName("客户正常经营情况描述"); businessConditionDescCatAttr.setValue(""); businessConditionDescCatAttr.setType("text"); businessConditionDescCatAttr.setCode("02"); DhCheckAttrVO businessConditionLast3MCatAttr = new DhCheckAttrVO(); businessConditionLast3MCatAttr.setName("客户近3个月交易情况描述"); businessConditionLast3MCatAttr.setValue(""); businessConditionLast3MCatAttr.setType("text"); businessConditionLast3MCatAttr.setCode("03"); DhCheckAttrVO riskPolicyDescCatAttr = new DhCheckAttrVO(); riskPolicyDescCatAttr.setName("客户触碰风险策略说明"); riskPolicyDescCatAttr.setValue(""); riskPolicyDescCatAttr.setType("text"); riskPolicyDescCatAttr.setCode("04"); businessConditionDescCatAttrs.add(businessConditionDescCatAttr); businessConditionDescCatAttrs.add(businessConditionLast3MCatAttr); businessConditionDescCatAttrs.add(riskPolicyDescCatAttr); DhCheckCatVO businessConditionUploadCat = new DhCheckCatVO(); businessConditionUploadCat.setName("客户经营情况影像资料上传"); businessConditionUploadCat.setType("post_sub_upload_cate"); List<DhCheckAttrVO> businessConditionUploadCatAttrs = Lists.newArrayList(); businessConditionUploadCat.setDhCheckInfoVOS(businessConditionUploadCatAttrs); DhCheckAttrVO businessConditionUploadCatAttr = new DhCheckAttrVO(); businessConditionUploadCatAttr.setValue(""); businessConditionUploadCatAttr.setType("image"); businessConditionUploadCatAttr.setCode("06"); businessConditionUploadCatAttr.setName("经营环境照片上传"); DhCheckAttrVO businessConditionLast3MUploadCatAttr = new DhCheckAttrVO(); businessConditionLast3MUploadCatAttr.setValue(""); businessConditionLast3MUploadCatAttr.setType("image"); businessConditionLast3MUploadCatAttr.setCode("07"); businessConditionLast3MUploadCatAttr.setName("近3个月交易流水、经营证明上传"); DhCheckAttrVO riskPolicyDescUploadCatAttr = new DhCheckAttrVO(); riskPolicyDescUploadCatAttr.setValue(""); riskPolicyDescUploadCatAttr.setType("image"); riskPolicyDescUploadCatAttr.setCode("08"); riskPolicyDescUploadCatAttr.setName("触碰风险资料补充"); businessConditionUploadCatAttrs.add(businessConditionUploadCatAttr); businessConditionUploadCatAttrs.add(businessConditionLast3MUploadCatAttr); businessConditionUploadCatAttrs.add(riskPolicyDescUploadCatAttr); businessConditionCats.add(businessConditionDescCat); businessConditionCats.add(businessConditionUploadCat);
dhCheckInfoVOS.add(loanPurpose);
dhCheckInfoVOS.add(businessCondition);
inspectionDataVO.setDhCheckInfoVOS(dhCheckInfoVOS);
InvestInfoVO investInfoVO =new InvestInfoVO();
investInfoVO.setName("综合评价");
investInfoVO.setValue("");
investInfoVO.setType("text");
investInfoVO.setCode("09");
inspecDataVO.setCheckInfo(inspectionDataVO);
inspecDataVO.setInvestInfo(investInfoVO);
// inspecDataVO.setType("post_sub_cate");
log.info("进入资料检查查询参数"+ JSONObject.toJSONString(visitSurveyTask));
List<DhWarningCheckResult> checkResultlist= xxxxxxxxxxxxx;
VisitSurveyTask condition = new VisitSurveyTask();
xxxxxxxxxxxxxxxxxxxxxxxxxx
List<VisitSurveyTask> visitSurveyTesks = xxxxxxxxxxxxxxxxxxxxxxxxxx
log.info("进入资料检查查询状态返回"+ JSONObject.toJSONString(visitSurveyTesks));
int editFlag = 1;
if(CollectionUtils.isNotEmpty(visitSurveyTesks)){
// 已处理或已关闭 置为不可编辑
if(visitSurveyTesks.get(0).getStatus() == 4 || visitSurveyTesks.get(0).getStatus() == 5){
editFlag = 0;
}
}
// 设置编辑状态
if(editFlag == 0){
loanPurposeAttr.setEditFlag(0);
businessConditionDescCatAttr.setEditFlag(0);
businessConditionLast3MCatAttr.setEditFlag(0);
riskPolicyDescCatAttr.setEditFlag(0);
loanPurposeUploadAttr.setEditFlag(0);
businessConditionUploadCatAttr.setEditFlag(0);
businessConditionLast3MUploadCatAttr.setEditFlag(0);
riskPolicyDescUploadCatAttr.setEditFlag(0);
investInfoVO.setEditFlag(0);
loanPurposeDescCat.setEditFlag(0);
loanPurposeUploadCat.setEditFlag(0);
businessConditionDescCat.setEditFlag(0);
businessConditionUploadCat.setEditFlag(0);
}
// 填充属性值
if( CollectionUtils.isNotEmpty(checkResultlist) && checkResultlist.size()>0){
for (DhWarningCheckResult v : checkResultlist){
if(v.getItemCode() !=null && v.getItemCode().equals("01")){
loanPurposeAttr.setValue(v.getItemValue());
loanPurposeAttr.setCompleted(true);
}
// if(loanPurposeAttr.getCompleted().equals(true)){
// loanPurposeAttr.setCompleted(true);
// }
if(v.getItemCode() !=null && v.getItemCode().equals("02")){
businessConditionDescCatAttr.setValue(v.getItemValue());
businessConditionDescCatAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("03")){
businessConditionLast3MCatAttr.setValue(v.getItemValue());
businessConditionLast3MCatAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("04")){
riskPolicyDescCatAttr.setValue(v.getItemValue());
riskPolicyDescCatAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("05")){
loanPurposeUploadAttr.setValue(v.getItemValue());
loanPurposeUploadAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("06")){
businessConditionUploadCatAttr.setValue(v.getItemValue());
businessConditionUploadCatAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("07")){
businessConditionLast3MUploadCatAttr.setValue(v.getItemValue());
businessConditionLast3MUploadCatAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("08")){
riskPolicyDescUploadCatAttr.setValue(v.getItemValue());
riskPolicyDescUploadCatAttr.setCompleted(true);
}
if(v.getItemCode() !=null && v.getItemCode().equals("09")){
investInfoVO.setValue(v.getItemValue());
investInfoVO.setCompleted(true);
}
}
}
// 填充是否完成
investInfoVO.checkCompleted();
inspectionDataVO.checkCompleted();
businessConditionUploadCat.checkCompleted();
businessCondition.checkCompleted();
businessConditionDescCat.checkCompleted();
loanPurposeDescCat.checkCompleted();
VisitSurveyTask task = new VisitSurveyTask();
task.setId(xxxxxxxxxxxx);
List<VisitSurveyTask> selectVisit = visitSurveyTaskStub.selectCheckResultStatus(task);
if(CollectionUtils.isNotEmpty(selectVisit) && selectVisit.size()>0){
if("电联".equals(selectVisit.get(0).getTaskContent())){
inspecDataVO.setCheckInfo(null);
}
}
log.info("进入资料检查查询返回"+ JSONObject.toJSONString(inspecDataVO));
return inspecDataVO;
}
三,返回报文
{ "checkInfo": { "completed": false, "dhCheckInfoVOS": [{ "completed": false, "dhCheckInfoVOS": [{ "completed": false, "dhCheckInfoVOS": [{ "code": "02", "completed": false, "editFlag": 1, "mustFill": 1, "name": "客户正常经营情况描述", "sureFlag": 1, "type": "text", "value": "" }, { "code": "", "completed": false, "editFlag": 1, "mustFill": 1, "name": "客户近3个月交易情况描述", "sureFlag": 1, "type": "text", "value": "03" }, { "code": "04", "completed": false, "editFlag": 1, "mustFill": 1, "name": "客户触碰风险策略说明", "sureFlag": 1, "type": "text", "value": "" }], "editFlag": 1, "mustFill": 1, "name": "客户正常经营情况", "sureFlag": 1, "type": "post_sub_upload_cate" }, { "completed": false, "dhCheckInfoVOS": [{ "code": "06", "completed": false, "editFlag": 1, "mustFill": 1, "name": "经营环境照片上传", "sureFlag": 1, "type": "image", "value": "" }, { "code": "07", "completed": false, "editFlag": 1, "mustFill": 1, "name": "近3个月交易流水、经营证明上传", "sureFlag": 1, "type": "image", "value": "" }, { "code": "08", "completed": false, "editFlag": 1, "mustFill": 1, "name": "触碰风险资料补充", "sureFlag": 1, "type": "image", "value": "" }], "editFlag": 1, "mustFill": 1, "name": "贷款用途影像资料上传", "sureFlag": 1, "type": "post_sub_upload_cate" }], "editFlag": 1, "logo": "wKgc4WFfBAWAKkXXAAAEwNLIne4382.png", "mustFill": 1, "name": "经营情况核实", "sureFlag": 1 }, { "completed": false, "dhCheckInfoVOS": [{ "completed": false, "dhCheckInfoVOS": [{ "code": "01", "completed": false, "editFlag": 1, "mustFill": 1, "name": "用途描述", "sureFlag": 1, "type": "text" }], "editFlag": 1, "mustFill": 1, "name": "客户实际贷款用途描述", "sureFlag": 1, "type": "post_sub_cate" }, { "completed": false, "dhCheckInfoVOS": [{ "code": "05", "completed": false, "editFlag": 1, "mustFill": 1, "name": "贷款用途影像资料", "sureFlag": 1, "type": "image", "value": "" }], "editFlag": 1, "mustFill": 1, "name": "贷款用途影像资料上传", "sureFlag": 1, "type": "post_sub_upload_cate" }], "editFlag": 1, "logo": "wKgc4WFfBAWAKkXXAAAEwNLIne4382.png", "mustFill": 1, "name": "贷款用途核实", "sureFlag": 1 }], "editFlag": 1, "mustFill": 1, "name": "检查资料", "sureFlag": 1 }, "investInfo": { "code": "09", "completed": false, "editFlag": 1, "mustFill": 1, "name": "综合评价", "sureFlag": 1, "type": "text", "value": "" } }