public static void copyLinkedDemographicsPropertiesToLocal(LoggedInInfo loggedInInfo, Integer localDemographicId) { try { DemographicWs demographicWs = CaisiIntegratorManager.getDemographicWs(loggedInInfo, loggedInInfo.getCurrentFacility()); List<DemographicTransfer> directLinks=demographicWs.getDirectlyLinkedDemographicsByDemographicId(localDemographicId); logger.debug("found linked demographics size:"+directLinks.size()); if (directLinks.size()>0) { DemographicTransfer demographicTransfer=directLinks.get(0); logger.debug("remoteDemographic:"+ReflectionToStringBuilder.toString(demographicTransfer)); DemographicDao demographicDao=(DemographicDao) SpringUtils.getBean("demographicDao"); Demographic demographic=demographicDao.getDemographicById(localDemographicId); CaisiIntegratorManager.copyDemographicFieldsIfNotNull(demographicTransfer, demographic); demographic.setRosterDate(new Date()); demographicDao.save(demographic); } } catch (Exception e) { logger.error("Error", e); } }
private void processIntercept(@SuppressWarnings("rawtypes") Iterator processorChain, BaseService baseService, IData idata, ServiceStatus serviceStatus) throws ServerException { FlowPosition pipelinePosition = new FlowPosition(BEFORE, baseService.getNSName().getFullName()); InterceptResult beforeIntResult = processAdvice(false, pipelinePosition, idata, serviceStatus); if (beforeIntResult.getException() != null) { return; // Exception in before to prevent execution of service/mock } pipelinePosition.setInterceptPoint(INVOKE); InterceptResult intResult = processAdvice(true, pipelinePosition, idata, serviceStatus); if (intResult.hasIntercepted() && logger.isDebugEnabled()) { logger.info("Intercepted: " + ReflectionToStringBuilder.toString(serviceStatus)); } if (!intResult.hasIntercepted() && processorChain.hasNext()) { ((InvokeChainProcessor) processorChain.next()).process(processorChain, baseService, idata, serviceStatus); } pipelinePosition.setInterceptPoint(AFTER); processAdvice(false, pipelinePosition, idata, serviceStatus); }
/** * 对象转字符串 * @param obj * 目标对象 * * @param style * @see org.apache.commons.lang.builder.ToStringStyle * * @return */ public static String toString(Object obj, ToStringStyle style){ if(null == obj){ return ""; } StringBuilder defaultObjReg = new StringBuilder(); defaultObjReg.append("^[\\w\\.]*"); defaultObjReg.append(obj.getClass().getSimpleName()); defaultObjReg.append("@"); defaultObjReg.append("[a-zA-Z0-9]+"); defaultObjReg.append("$"); // 未重写toString if(String.valueOf(obj).matches(defaultObjReg.toString())){ return ReflectionToStringBuilder.toString(obj, style); } return obj.toString(); }
@Override public String toString() { class DataObjectToStringBuilder extends ReflectionToStringBuilder { private DataObjectToStringBuilder(Object object) { super(object); } @Override public boolean accept(Field field) { if (field.getType().isPrimitive() || field.getType().isEnum() || java.lang.String.class.isAssignableFrom(field.getType()) || java.lang.Number.class.isAssignableFrom(field.getType()) || java.util.Collection.class.isAssignableFrom(field.getType())) { return super.accept(field); } return false; } }; return new DataObjectToStringBuilder(this).toString(); }
@Override public String toString() { class BusinessObjectToStringBuilder extends ReflectionToStringBuilder { private BusinessObjectToStringBuilder(Object object) { super(object); } @Override public boolean accept(Field field) { // ignore printing out byte arrays in toString methods if (byte[].class.isAssignableFrom(field.getType())) { return false; } return String.class.isAssignableFrom(field.getType()) || ClassUtils.isPrimitiveOrWrapper(field.getType()); } } return new BusinessObjectToStringBuilder(this).toString(); }
public AuthenticationFailureHandler failureLogin(){ AuthenticationFailureHandler handler = new AuthenticationFailureHandler() { @Override public void onAuthenticationFailure(HttpServletRequest arg0, HttpServletResponse arg1, AuthenticationException arg2) throws IOException, ServletException { System.out.println("SecurityConfig.failureLogin()#httpservletrequest\n" + ReflectionToStringBuilder.toString(arg0, ToStringStyle.SIMPLE_STYLE) + "\n----------------" + "\ngetQueryString: " + arg0.getQueryString() + "\ngetRequestURI: " + arg0.getRequestURI() + "\ngetServletPath: " + arg0.getServletPath() + "\ngetRequestURL: " + arg0.getRequestURL() + "\n\n" ); arg1.setStatus(HttpServletResponse.SC_UNAUTHORIZED); arg1.sendRedirect("login"); } }; return handler; }
protected CommandResult execute(List<String> commands) { if (log.isDebugEnabled()) { log.debug(commands); } // タイムアウトしないようにする long timeout = Long.MAX_VALUE; CommandResult result = CommandUtils.execute(commands, timeout); if (log.isDebugEnabled()) { log.debug(ReflectionToStringBuilder.toString(result)); } return result; }
/** * {@inheritDoc} */ @Override public void addCanonicalName(String fqdn, String canonicalName) { List<String> commands = createCommands(); List<String> stdins = createAddCanonicalName(fqdn, canonicalName); CommandResult result = execute(commands, stdins); if (result.getExitValue() != 0) { // CNAMEレコードの追加に失敗 AutoException exception = new AutoException("ECOMMON-000205", fqdn, canonicalName); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE)); throw exception; } // CNAMEの確認はしない(参照先ホスト名を解決できない場合もあるため) }
public InstanceDto waitInstance(String instanceId) { // インスタンスの処理待ち String[] stableStatus = new String[] { "running", "stopped" }; // TODO: ニフティクラウドAPIの経過観察(インスタンスのステータス warning はAPIリファレンスに記載されていない) String[] unstableStatus = new String[] { "pending", "warning" };// InstanceDto instance; while (true) { instance = describeInstance(instanceId); String status = instance.getState().getName(); if (ArrayUtils.contains(stableStatus, status)) { break; } if (!ArrayUtils.contains(unstableStatus, status)) { // 予期しないステータス AutoException exception = new AutoException("EPROCESS-000604", instanceId, status); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance)); throw exception; } } return instance; }
public VolumeDto waitCreateVolume(String volumeId) { // ボリュームの作成待ち VolumeDto volume = null; volume = waitVolume(volumeId); String status = volume.getStatus(); if (!"in-use".equals(status)) { // ボリューム作成失敗時 AutoException exception = new AutoException("EPROCESS-000621", volumeId, status); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume)); throw exception; } // ログ出力 if (log.isInfoEnabled()) { log.info(MessageUtils.getMessage("IPROCESS-100522", volumeId)); } return volume; }
protected VolumeDto waitVolume(String volumeId) { // Volumeの処理待ち String[] stableStatus = new String[] { "available", "in-use" }; String[] unstableStatus = new String[] { "creating" }; VolumeDto volume = null; while (true) { volume = describeVolume(volumeId); String status; status = volume.getStatus(); if (ArrayUtils.contains(stableStatus, status)) { break; } if (!ArrayUtils.contains(unstableStatus, status)) { // 予期しないステータス AutoException exception = new AutoException("EPROCESS-000620", volumeId, status); exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume)); throw exception; } } return volume; }
@Override protected Connection doConnect(final ISupplierWithException<Connection, SQLException> supplier) throws DatabaseAnonymizerException { final Field[] allFields = supplier.getClass().getDeclaredFields(); assertEquals(1, allFields.length); final Field field = allFields[0]; field.setAccessible(true); try { // not exactly a great test, but checks that supplier has parent's properties at least final String representation = ReflectionToStringBuilder.toString(field.get(supplier)); log.debug(representation); assertTrue(representation.contains( "[driver=java.util.List,vendor=mssql,url=invalid-url,userName=invalid-user,password=invalid-pass]")); } catch (IllegalArgumentException | IllegalAccessException e) { log.error(e.toString()); } return mockConnection; }
public static void main(String[] args) { List<TestVo> list = new ArrayList<TestVo>(); for (int i = 0; i < 10; i++) { TestVo a = new TestVo(); a.setId(new Long(i)); long tt = i % 3; a.setCreatorId(tt); list.add(a); } Map<?, List<Object>> map = SubGroupUtils.getByPropertyValue(list, "CreatorId"); for (Map.Entry<?, List<Object>> e : map.entrySet()) { System.out.println((Long) e.getKey() + "=" + ReflectionToStringBuilder.toString(e.getValue())); } }
/** * @see org.kuali.kfs.module.tem.batch.service.ImportedExpensePendingEntryService#buildDebitPendingEntry(org.kuali.kfs.module.tem.businessobject.AgencyStagingData, org.kuali.kfs.module.tem.businessobject.TripAccountingInformation, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, java.lang.String, org.kuali.rice.kns.util.KualiDecimal, boolean) */ @Override public List<GeneralLedgerPendingEntry> buildDebitPendingEntry(AgencyStagingData agencyData, TripAccountingInformation info, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, String objectCode, KualiDecimal amount, boolean generateOffset){ List<GeneralLedgerPendingEntry> entryList = new ArrayList<GeneralLedgerPendingEntry>(); GeneralLedgerPendingEntry pendingEntry = buildGeneralLedgerPendingEntry(agencyData, info, sequenceHelper, info.getTripChartCode(), objectCode, amount, KFSConstants.GL_DEBIT_CODE); if(ObjectUtils.isNotNull(pendingEntry )) { pendingEntry.setAccountNumber(info.getTripAccountNumber()); pendingEntry.setSubAccountNumber(StringUtils.defaultIfEmpty(info.getTripSubAccountNumber(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber())); LOG.info("Created DEBIT GLPE: " + pendingEntry.getDocumentNumber() + " for AGENCY Import Expense: " + agencyData.getId() + " TripId: " + agencyData.getTripId() + "\n\n" + ReflectionToStringBuilder.reflectionToString(pendingEntry, ToStringStyle.MULTI_LINE_STYLE)); //add to list if entry was created successfully entryList.add(pendingEntry); //handling offset if (generateOffset){ generateOffsetPendingEntry(entryList, sequenceHelper, pendingEntry); } } return entryList; }
/** * @see org.kuali.kfs.module.tem.batch.service.ImportedExpensePendingEntryService#buildCreditPendingEntry(org.kuali.kfs.module.tem.businessobject.AgencyStagingData, org.kuali.kfs.module.tem.businessobject.TripAccountingInformation, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, java.lang.String, org.kuali.rice.kns.util.KualiDecimal, boolean) */ @Override public List<GeneralLedgerPendingEntry> buildServiceFeeCreditPendingEntry(AgencyStagingData agencyData, TripAccountingInformation info, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, AgencyServiceFee serviceFee, KualiDecimal amount, boolean generateOffset){ List<GeneralLedgerPendingEntry> entryList = new ArrayList<GeneralLedgerPendingEntry>(); GeneralLedgerPendingEntry pendingEntry = buildGeneralLedgerPendingEntry(agencyData, info, sequenceHelper, serviceFee.getCreditChartCode(), serviceFee.getCreditObjectCode(), amount, KFSConstants.GL_CREDIT_CODE); if(ObjectUtils.isNotNull(pendingEntry )) { pendingEntry.setAccountNumber(serviceFee.getCreditAccountNumber()); pendingEntry.setSubAccountNumber(GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber()); } LOG.info("Created ServiceFee CREDIT GLPE: " + pendingEntry.getDocumentNumber() + " for AGENCY Import Expense: " + agencyData.getId() + " TripId: " + agencyData.getTripId() + "\n\n" + ReflectionToStringBuilder.reflectionToString(pendingEntry, ToStringStyle.MULTI_LINE_STYLE)); //add to list if entry was created successfully if (ObjectUtils.isNotNull(pendingEntry)) { entryList.add(pendingEntry); //handling offset if (generateOffset){ generateOffsetPendingEntry(entryList, sequenceHelper, pendingEntry); } } return entryList; }
@Override public String toString() { class VendorTaxChangeToStringBuilder extends ReflectionToStringBuilder { private VendorTaxChangeToStringBuilder(Object object) { super(object); } @Override public boolean accept(Field field) { if (BusinessObject.class.isAssignableFrom(field.getType())) { return false; } DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class); AttributeSecurity attributeSecurity = dataDictionaryService.getAttributeSecurity(VendorTaxChange.class.getName(), field.getName()); if (ObjectUtils.isNotNull(attributeSecurity) && (attributeSecurity.isHide() || attributeSecurity.isMask() || attributeSecurity.isPartialMask())) { return false; } return super.accept(field); } }; ReflectionToStringBuilder toStringBuilder = new VendorTaxChangeToStringBuilder(this); return toStringBuilder.toString(); }
@Override public String toString() { class VendorHeaderToStringBuilder extends ReflectionToStringBuilder { private VendorHeaderToStringBuilder(Object object) { super(object); } @Override public boolean accept(Field field) { if (BusinessObject.class.isAssignableFrom(field.getType())) { return false; } DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class); AttributeSecurity attributeSecurity = dataDictionaryService.getAttributeSecurity(VendorHeader.class.getName(), field.getName()); if (ObjectUtils.isNotNull(attributeSecurity) && (attributeSecurity.isHide() || attributeSecurity.isMask() || attributeSecurity.isPartialMask())) { return false; } return super.accept(field); } }; ReflectionToStringBuilder toStringBuilder = new VendorHeaderToStringBuilder(this); return toStringBuilder.toString(); }
@Override public String toString() { class BusinessObjectToStringBuilder extends ReflectionToStringBuilder { private BusinessObjectToStringBuilder(Object object) { super(object); } @Override public boolean accept(Field field) { return String.class.isAssignableFrom(field.getType()) || ClassUtils.isPrimitiveOrWrapper(field.getType()); } } return new BusinessObjectToStringBuilder(this).toString(); }
public static PlayerAllInOne get(int playerId, boolean debug) { PlayerAllInOne playerAllInOne = StandardDao.getInstance().select(PlayerAllInOne.class, playerId); if (debug) { System.out.println(ReflectionToStringBuilder.reflectionToString(playerAllInOne)); System.out.println("PlayerBagStore size= " + playerAllInOne.getPlayerBagStore().getPlayerBagList().size()); System.out.println("PlayerEventSysStore size= " + playerAllInOne.getPlayerEventSysStore().getPlayerEventSysList().size()); System.out.println("PlayerFriendStore size= " + playerAllInOne.getPlayerFriendStore().getPlayerFriendList().size()); System.out.println("PlayerGuajiStore size= " + playerAllInOne.getPlayerGuajiStore().getPlayerGuajiList().size()); System.out.println("PlayerMsgStore size= " + playerAllInOne.getPlayerMsgStore().getPlayerMsgList().size()); System.out.println("PlayerRechargeStore size= " + playerAllInOne.getPlayerRechargeStore().getPlayerRechargeList().size()); System.out.println("PlayerTaskLevelBattleAgainStore size= " + playerAllInOne.getPlayerTaskLevelBattleAgainStore().getPlayerTaskLevelBattleAgainList().size()); System.out.println("PlayerWuxingCardStore size= " + playerAllInOne.getPlayerWuxingCardStore().getPlayerWuxingCardList().size()); System.out.println("PlayerWuxingRaffleInfoStore size= " + playerAllInOne.getPlayerWuxingRaffleInfoStore().getPlayerWuxingRaffleInfoList().size()); } return playerAllInOne; }
public static void copyLinkedDemographicsPropertiesToLocal(Integer localDemographicId) { try { DemographicWs demographicWs = CaisiIntegratorManager.getDemographicWs(); List<DemographicTransfer> directLinks=demographicWs.getDirectlyLinkedDemographicsByDemographicId(localDemographicId); logger.debug("found linked demographics size:"+directLinks.size()); if (directLinks.size()>0) { DemographicTransfer demographicTransfer=directLinks.get(0); logger.debug("remoteDemographic:"+ReflectionToStringBuilder.toString(demographicTransfer)); DemographicDao demographicDao=(DemographicDao) SpringUtils.getBean("demographicDao"); Demographic demographic=demographicDao.getDemographicById(localDemographicId); CaisiIntegratorManager.copyDemographicFieldsIfNotNull(demographicTransfer, demographic); demographic.setRosterDate(new Date()); demographicDao.save(demographic); } } catch (Exception e) { logger.error("Error", e); } }
@Override public String toString() { class BusinessObjectToStringBuilder extends ReflectionToStringBuilder { private BusinessObjectToStringBuilder(Object object) { super(object); } public boolean accept(Field field) { if (BusinessObject.class.isAssignableFrom(field.getType())) { return false; } return super.accept(field); } }; ReflectionToStringBuilder toStringBuilder = new BusinessObjectToStringBuilder(this); return toStringBuilder.toString(); }
@Override public Rule find(RuleQuery query) { Collection<Rule> all = findAll(query); if (all.size() > 1) { throw new IllegalArgumentException("Non unique result for rule query: " + ReflectionToStringBuilder.toString(query, ToStringStyle.SHORT_PREFIX_STYLE)); } else if (all.isEmpty()) { return null; } else { return all.iterator().next(); } }
@Override public void run() { try { while (true) { int i = pageAtomicInteger.decrementAndGet(); if (i <= 0) { break; } logger.error(String.format("本次是该请求的第 [%s] 页数据", i)); List<M> list = query(i, example); if (list != null && !list.isEmpty()) { // 处理数据 shoot(list); } else { logger.error("这个页数怎么可能没有数据呢!! i= " + i); continue; } logger.info(String.format("处理数据第 [%s] 页完成。", i)); } countDownLatch.countDown(); } catch (Exception e) { logger.error(String .format("查询数据失败! 参数 = [%s] \n e = [%s]", ReflectionToStringBuilder.reflectionToString(example), ExceptionUtils .getStackTrace(e))); } finally { //等待主线程超时 } }
public static boolean hasDifferentRemoteDemographics(LoggedInInfo loggedInInfo, Integer localDemographicId) { boolean ret = false; try { DemographicWs demographicWs = CaisiIntegratorManager.getDemographicWs(loggedInInfo, loggedInInfo.getCurrentFacility()); List<DemographicTransfer> directLinks=demographicWs.getDirectlyLinkedDemographicsByDemographicId(localDemographicId); logger.debug("found linked demographics size:"+directLinks.size()); if (directLinks.size()>0) { DemographicTransfer demographicTransfer=directLinks.get(0); logger.debug("remoteDemographic:"+ReflectionToStringBuilder.toString(demographicTransfer)); DemographicDao demographicDao=(DemographicDao) SpringUtils.getBean("demographicDao"); Demographic demographic=demographicDao.getDemographicById(localDemographicId); if (demographicTransfer.getBirthDate()!=null && !(DateUtils.getNumberOfDaysBetweenTwoDates(demographicTransfer.getBirthDate(),demographic.getBirthDay()) == 0)) ret = true; if (demographicTransfer.getCity()!=null && !demographicTransfer.getCity().equalsIgnoreCase(demographic.getCity())) ret = true; if (demographicTransfer.getFirstName()!=null && !demographicTransfer.getFirstName().equals(demographic.getFirstName())) ret = true; if (demographicTransfer.getGender()!=null && !demographicTransfer.getGender().toString().equals(demographic.getSex())) ret = true; if (demographicTransfer.getHin()!=null && !demographicTransfer.getHin().equals(demographic.getHin())) ret = true; if (demographicTransfer.getHinType()!=null && !demographicTransfer.getHinType().equals(demographic.getHcType())) ret = true; if (demographicTransfer.getHinVersion()!=null && !demographicTransfer.getHinVersion().equals(demographic.getVer())) ret = true; if (isRemoteDateDifferent(DateUtils.toGregorianCalendar(demographic.getEffDate()),demographicTransfer.getHinValidStart())) ret = true; if (isRemoteDateDifferent(DateUtils.toGregorianCalendar(demographic.getHcRenewDate()),demographicTransfer.getHinValidEnd())) ret = true; if (demographicTransfer.getLastName()!=null && !demographicTransfer.getLastName().equals(demographic.getLastName())) ret = true; if (demographicTransfer.getProvince()!=null && !demographicTransfer.getProvince().equalsIgnoreCase(demographic.getProvince())) ret = true; if (demographicTransfer.getSin()!=null && !demographicTransfer.getSin().equals(demographic.getSin())) ret = true; if (demographicTransfer.getStreetAddress()!=null && !demographicTransfer.getStreetAddress().equals(demographic.getAddress())) ret = true; if (demographicTransfer.getPhone1()!=null && !demographicTransfer.getPhone1().equals(demographic.getPhone())) ret = true; if (demographicTransfer.getPhone2()!=null&& !demographicTransfer.getPhone2().equals(demographic.getPhone2())) ret = true; } } catch (Exception e) { logger.error("Error", e); } return ret; }
public EfmpatientformlistSendPhrAction(HttpServletRequest request) { localUri = getEformRequestUrl(request); // this really doesn't look thread safe, although I have no proof of it so I'll just note it as such. clientId = request.getParameter("clientId"); LoggedInInfo loggedInInfo=LoggedInInfo.getLoggedInInfoFromSession(request); providerNo=loggedInInfo.getLoggedInProviderNo(); logger.debug(ReflectionToStringBuilder.toString(this)); }
/** * 添加课程 * 讲解一下什么是数据绑定 * 数据绑定,就是将请求中的字段,按照名字匹配的原则,填入到对象模型 * 通常在前台,一些添加功能中,都是由html的input标签组成各种零散的文本框供用户填写 * 当点击保存的时候,数据来到我们的后台,如何将这些零散的数据自动放入到我们的java对象当中 * * 当我们在springMVC里面做重定向,只需要在return的字符串里面加上redirect:+路径即可 * @return */ @RequestMapping(value="save",method=RequestMethod.POST) //使用@ModelAttribute标签也可,它拥有更多高级功能 public String save(@ModelAttribute Course course){ // public String save(Course course){ log.debug("info of course:"); //ReflectionToStringBuilder是commons lang里面的一个类,在日志输出调试的时候非常常用 log.debug(ReflectionToStringBuilder.toString(course)); //做一些业务操作,比如数据持久化 course.setCourseId(123); return "redirect:view2/" + course.getCourseId(); }
/** * 发送验证码 * @param mobileNum 手机号 * @param validCode 验证码内容 * @param signName 短信签名 * @param templateNum 模板号 * @param opeateName 操作名称(日志用) * @return 发送是否成功 */ private boolean sentValidCodeSms(String mobileNum, String validCode,String signName,String templateNum,String opeateName){ AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest(); req.setSmsType("normal"); req.setSmsFreeSignName(signName); req.setSmsParamString("{\"code\":\"" + validCode + "\",\"product\":\" "+SMS_PRODUCT_NAME+" \"}"); req.setRecNum(mobileNum); req.setSmsTemplateCode(templateNum); AlibabaAliqinFcSmsNumSendResponse rsp ; try { rsp = getSmsClient().execute(req); if (rsp==null){ log.error("验证码-"+opeateName+"-失败:返回结果为null,mobile:{} validCode{}",mobileNum,validCode); return false; }else{ if(!rsp.isSuccess()){ log.error("验证码-"+opeateName+"-失败:返回结果失败:,mobile:{} code:{} response:{}",mobileNum,validCode, ReflectionToStringBuilder.toString(rsp, ToStringStyle.SIMPLE_STYLE)); return false; } } } catch (ApiException e) { log.error("验证码-"+opeateName+"-失败:短信发送异常,mobile:"+mobileNum+" code:"+validCode, e); } log.info("验证码-"+opeateName+":发送成功,mobile:{} validCode:{}",mobileNum,validCode); return true; }
@RequestMapping("loginByPass") @ResponseBody public CommonResponse<LoginAccount> loginByPassword(@ValidateBody(requiredAttrs = {"mobile", "password"}) LoginAccountRequest body, RedisRequestSession session,CommonRequest request) { //TODO 调试完成候去掉,保护用户关键信息隐私 log.info("密码登陆开始:入参:body:{},request:{}", ReflectionToStringBuilder.toString(body, ToStringStyle.SIMPLE_STYLE),ReflectionToStringBuilder.toString(request, ToStringStyle.SIMPLE_STYLE)); CommonResponse<LoginAccount> response = loginAccountService.loginByPass(body.getMobile(), body.getPassword(), session,request); log.info("密码登陆完成:{}", ReflectionToStringBuilder.toString(response, ToStringStyle.SIMPLE_STYLE)); return response; }
@RequestMapping(value = "loginByCode",method = {RequestMethod.POST}) @ResponseBody public CommonResponse<LoginAccount> loginByCode(@ValidateBody(requiredAttrs = {"mobile", "verifyCode"}) LoginAccountRequest body, RedisRequestSession session,CommonRequest request) { log.info("验证码登陆开始:入参:body:{},request:{}", ReflectionToStringBuilder.toString(body, ToStringStyle.SIMPLE_STYLE),ReflectionToStringBuilder.toString(request, ToStringStyle.SIMPLE_STYLE)); CommonResponse<LoginAccount> response = loginAccountService.loginByVerifyCode(body.getMobile(), body.getVerifyCode(), session,request); log.info("验证码登陆完成:{}", ReflectionToStringBuilder.toString(response, ToStringStyle.SIMPLE_STYLE)); return response; }
@RequestMapping("getRegVerifyCode") @ResponseBody public CommonResponse<String> getRegVerifyCode(@ValidateBody(requiredAttrs = "mobile") LoginAccountRequest body, RedisRequestSession session) { log.info("获取注册验证码开始:入参:body:{}", ReflectionToStringBuilder.toString(body, ToStringStyle.SIMPLE_STYLE)); CommonResponse<String> response = loginAccountService.getRegVerifyCode(body.getMobile(), session); log.info("获取注册验证码完成:{}", ReflectionToStringBuilder.toString(response, ToStringStyle.SIMPLE_STYLE)); return response; }
@RequestMapping("getLoginVerifyCode") @ResponseBody public CommonResponse<String> getLoginVerifyCode(@ValidateBody(requiredAttrs = "mobile") LoginAccountRequest body, RedisRequestSession session) { log.info("获取登陆验证码开始:入参:body:{}", ReflectionToStringBuilder.toString(body, ToStringStyle.SIMPLE_STYLE)); CommonResponse<String> response = loginAccountService.getLoginVerifyCode(body.getMobile(), session); log.info("获取登陆验证码完成:{}", ReflectionToStringBuilder.toString(response, ToStringStyle.SIMPLE_STYLE)); return response; }
@RequestMapping("reg") @ResponseBody public CommonResponse<LoginAccount> reg(@ValidateBody(requiredAttrs = {"mobile","verifyCode"}) LoginAccountRequest body, RedisRequestSession session,CommonRequest request) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException { log.info("注册开始:入参:body:{},request:{}", ReflectionToStringBuilder.toString(body, ToStringStyle.SIMPLE_STYLE),ReflectionToStringBuilder.toString(request, ToStringStyle.SIMPLE_STYLE)); CommonResponse<LoginAccount> response = loginAccountService.registerAccount(body, session,request); log.info("注册完成:{}", ReflectionToStringBuilder.toString(response, ToStringStyle.SIMPLE_STYLE)); return response; }
@RequestMapping("update") @ResponseBody public CommonResponse<LoginAccount> updateInfo(@ValidateBody(requiredAttrs = {"mobile"}) LoginAccountRequest body, RedisRequestSession session,CommonRequest request) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException { log.info("更新用户信息开始:入参:body:{},request:{}", ReflectionToStringBuilder.toString(body, ToStringStyle.SIMPLE_STYLE),ReflectionToStringBuilder.toString(request, ToStringStyle.SIMPLE_STYLE)); CommonResponse<LoginAccount> response = loginAccountService.updateAccount(body, session,request); log.info("更新用户信息完成:{}", ReflectionToStringBuilder.toString(response, ToStringStyle.SIMPLE_STYLE)); return response; }
@Override public String toString() { synchronized (monitor) { return new ReflectionToStringBuilder(this) .setExcludeFieldNames(FIELDS_EXCLUDED_FROM_TOSTRING) .toString(); } }
@Override public String toString() { ReflectionToStringBuilder tsb = new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); return tsb.toString(); }
@Override public String toString() { return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) { @Override protected boolean accept(Field f) { return super.accept(f) && !f.getName().equals("password"); } }.toString(); }
public static String logConnectionException(ConnectionException connEx, PartnerConnection conn, String soql) { StringBuffer returnString = new StringBuffer("Connection Exception encountered "); if (null != soql) { returnString.append("when trying to query : " + soql); } returnString.append(" The connection exception description says : " + connEx.getMessage()); returnString.append(" Object dump for the Connection object: " + ReflectionToStringBuilder.toString(conn)); return returnString.toString(); }