public void add(){ doAdd(); } private void doAdd(){ }
public class FrontConst { public static final String COOKIE_LOGINNAME = "loginNameCookie"; public static final String COOKIE_PASSWORD = "passWordCookie"; }
public class BizUtil { /** * 把1个集合,转换成Map。用法示例:Map dictionaryMap = BizUtil.listToMap("BIANMA", dictionarys); * @param keyName 集合元素唯一字段的名称 * @param list 集合元素 * @return map */ public static Map listToMap(final String keyName, List list) { if(CollectionUtils.isEmpty(list)){ return null; } return Maps.uniqueIndex(list, new Function() { @Override public K apply(V v) { try { return (K)PropertyUtils.getSimpleProperty(v, keyName); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { e.printStackTrace(); return null; } } }); } /** * 把1个集合,转换成Map。用法示例:Map dictionaryMap = * BizUtil.listToMap(String.class, Dictionary.class, "BIANMA", dictionarys); * * @param k * Map的key的class * @param v * Map的value的class,集合list元素的类型 * @param keyName * 集合元素唯一字段的名称 * @param list * 集合元素 * @return map */ //这种方式,废弃了,需要多传2个参数 public static Map listToMap(Class k, Class v, String keyName, List list) { Map map = Maps.newHashMap(); if (CollectionUtils.isNotEmpty(list)) { for (V val : list) { try { PropertyDescriptor pd = new PropertyDescriptor(keyName, v); Method getMethod = pd.getReadMethod();// 获得get方法 Object o = getMethod.invoke(val);// 执行get方法返回一个Object if (o != null && o.getClass().equals(k)) { map.put((K) o, val); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | IntrospectionException e) { e.printStackTrace(); } } } return map; }
public String add(){ Member member = this.getMember(); if(StringUtils.isBlank(...){ return error("地址信息有误!"); }}
public enum OrderPayStatusEnum { NO("0", "未支付"), YES("1", "已支付"); private String code; private String remark; OrderPayStatusEnum(String code, String remark) { this.code = code; this.remark = remark; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public static String getPayStatus(String code){ if(StringUtils.isEmpty(code)){ return null; } if(code.equals(NO.getCode())){ return NO.getRemark(); }else if(code.equals(YES.getCode())){ return YES.getRemark(); } return null; }}
<context:property-placeholder location="file:${config_path}/config/mail.properties" ignore-unresolvable="true" /> <bean id="javaMailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="${mailServerHost}" /> <property name="port" value="${mailServerPort}" /> <property name="javaMailProperties"> <props> <prop key="mail.smtp.auth">trueprop> <prop key="mail.smtp.timeout">25000prop> props> property> <property name="username" value="${mailUserName}" /> <property name="password" value="${mailPassword}" /> <property name="defaultEncoding" value="UTF-8" /> bean> <bean id="mailClientServer" class="com.shop.common.mail.MailClientServer"> <property name="javaMailSender" ref="javaMailSender" /> <property name="configuration" ref="freeMarkerConfigurationFactory" /> <property name="mailFromAddress" value="${mailFromAddress}" /> bean>
<context:property-placeholder location="file:${config_path}/config/oss.properties" ignore-unresolvable="true" /> <bean id="ossConfig" class="com.shop.common.oss.OssConfig"> <property name="endpoint" value="${oss.endpoint}" /> <property name="bucketName" value="${oss.bucketName}" /> <property name="accessKeyId" value="${oss.accessKeyId}" /> <property name="accessKeySecret" value="${oss.accessKeySecret}" /> <property name="imgDomain" value="${oss.imgDomain}" /> <property name="fileDomain" value="${oss.fileDomain}" /> bean>
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow