package com.miniframe.bisiness.system; import com.miniframe.core.ExecProcessFlow; import com.miniframe.core.exception.BusinessException; import com.miniframe.core.ext.UtilTools; import com.miniframe.generate.appcode.UserType; import com.miniframe.generate.business.system.model.B00001BaseModel; import com.miniframe.model.system.*; import com.miniframe.model.system.dao.SysDepartmentMapper; import com.miniframe.model.system.dao.SysUserMapper; import com.miniframe.model.system.dao.UserCertificationMapper; import com.miniframe.tools.XIDateTimeUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 基础系统,“个人信息查询”逻辑处理(重新生成不覆盖)。 */ public class B00001Service extends B00001BaseModel implements ExecProcessFlow { private static final long serialVersionUID = -7051358269847459502L; /** * 基础系统,“个人信息查询”业务核心处理 */ public void transExecute() throws Exception { SysUserMapper sysUserDAO = UtilTools.getBean(SysUserMapper.class); SysUserSQLBuilder sysUserSQLBuilder = new SysUserSQLBuilder(); sysUserSQLBuilder.createCriteria().andIdEqualTo(this.getA_systemhead().getUserId()); List sysUsers = sysUserDAO.selectByExample(sysUserSQLBuilder); if (null == sysUsers || sysUsers.size() < 1) { throw new BusinessException("未找到用户信息"); } SysUser sysUser = sysUsers.get(0); // 基本信息 this.getD_b00001().setHeadProfile(sysUser.getHeadPortait()); this.getD_b00001().setNickName(sysUser.getNickname() == null ? sysUser.getUsername() : sysUser.getNickname()); this.getD_b00001().setInviteCode(sysUser.getInviteCode()); this.getD_b00001().setMobileNo(sysUser.getUsermobnub()); this.getD_b00001().setTelNo(sysUser.getUsertelnum()); this.getD_b00001().setScore(sysUser.getScore() != null ? String.valueOf(sysUser.getScore()) : "0"); this.getD_b00001().setUserState(String.valueOf(sysUser.getUserstate())); this.getD_b00001().setUserName(sysUser.getUsername()); this.getD_b00001().setPersonWords(sysUser.getPersonWords()); this.getD_b00001().setOrgCode(sysUser.getOrgcode()); this.getD_b00001().setOrgDeptCode(sysUser.getOrgDeptCode()); this.getD_b00001().setRegTime(XIDateTimeUtils.getStrFromDate(sysUser.getCreateTime())); this.getD_b00001().setUserType(sysUser.getUserType()); /** * 认证信息 */ UserCertificationMapper certificationDao = UtilTools.getBean(UserCertificationMapper.class); UserCertificationSQLBuilder certificationSQLBuilder =new UserCertificationSQLBuilder(); certificationSQLBuilder.createCriteria().andUidEqualTo(sysUser.getId()); List certifications = certificationDao.selectByExample(certificationSQLBuilder); if (null == certifications || certifications.size() < 1) { this.getD_b00001().setAuthenticationState("0"); }else{ UserCertification certification = certifications.get(0); this.getD_b00001().setCertName(certification.getName()); this.getD_b00001().setCertNo(certification.getNumber()); this.getD_b00001().setCertType(certification.getType()); this.getD_b00001().setCertTime(XIDateTimeUtils.getStrFromDate(certification.getAuthTime())); this.getD_b00001().setCertFile(certification.getAuthFile()); this.getD_b00001().setAuthenticationState(certification.getState()); } if(sysUser.getUserType().equals(UserType.son.getIndex())){ }else { SysUserSQLBuilder sonUserSQLBuilder=new SysUserSQLBuilder(); sonUserSQLBuilder.createCriteria().andSuperiorUserIdEqualTo(sysUser.getId()); List sonUserList = UtilTools.getBean(SysUserMapper.class).selectByExample(sonUserSQLBuilder); List userIdList = null; if(sonUserList!=null && sonUserList.size()>0) { userIdList=sonUserList.stream().map(data->data.getId()).distinct() .collect(Collectors.toList()); } if(userIdList == null){ userIdList=new ArrayList<>(); } userIdList.add(sysUser.getId()); } if(UtilTools.isNotNullAndBlank(sysUser.getOrgcode())){ try{ SysDepartmentMapper sysDepartmentMapper=UtilTools.getBean(SysDepartmentMapper.class); SysDepartment sysDepartment=sysDepartmentMapper.selectByPrimaryKey(sysUser.getOrgcode()); if(sysDepartment!=null){ this.getD_b00001().setOrgCodeText(sysDepartment.getDeptname()); } }catch (Exception e){} } if(UtilTools.isNotNullAndBlank(sysUser.getOrgDeptCode())){ try{ SysDepartmentMapper sysDepartmentMapper=UtilTools.getBean(SysDepartmentMapper.class); SysDepartment sysDepartment=sysDepartmentMapper.selectByPrimaryKey(sysUser.getOrgDeptCode()); if(sysDepartment!=null){ this.getD_b00001().setOrgDeptCodeText(sysDepartment.getDeptname()); } }catch (Exception e){} } // VExtUserSQLBuilder VExtUserSQLBuilder = new VExtUserSQLBuilder(); // VExtUserSQLBuilder.createCriteria().andIdEqualTo(sysUser.getId()); // List VExtUserList = UtilTools.getBean(VExtUserMapper.class).selectByExample(VExtUserSQLBuilder); // if (VExtUserList != null && VExtUserList.size() > 0) { // VExtUser VExtUser = VExtUserList.get(0); // // String certState = VExtUser.getCertState(); // if (certState == null) { // certState = CertificationState.noCertificate.getIndex(); // } // this.getD_b00001().setAuthenticationState(certState); // this.getD_b00001().setCertType(VExtUser.getCertType()); // this.getD_b00001().setCertName(VExtUser.getCertName()); // this.getD_b00001().setCertNo(VExtUser.getCertNumber()); // this.getD_b00001().setCertFile(VExtUser.getCertFile()); // this.getD_b00001().setCertTime(XIDateTimeUtils.getStrFromDate(VExtUser.getCertAuthTime())); // } } /** * 基础系统,“个人信息查询”业务前处理 */ public void preTransFlow() throws Exception { this.validater(); } /** * 基础系统,“个人信息查询”业务后处理 */ public void afterTransFlow() throws Exception { } /** * 基础系统,“个人信息查询”逻辑入口处理方法 */ @SuppressWarnings("rawtypes") @Override public Map execute(Map vars) throws Exception { this.setTransMap(vars); preTransFlow();// 执行业务开始的规则检查和校验 transExecute();// 执行核心业务段 afterTransFlow();// 执行核心逻辑完成后的收尾逻辑 return this.getTransMap(); } }