技术
愛~杦辷个訾
这个作者很懒,什么都没留下…
展开
-
SpringBoot读取Resource下文件的几种方式亲测可用记录一下
最近在项目中涉及到Excle的导入功能,通常是我们定义完模板供用户下载,用户按照模板填写完后上传;这里待下载模板位置为resource/excelTemplate/test.xlsx,尝试了四种读取方式,并且测试了四种读取方式分别的windows开发环境下(IDE中)读取和生产环境(linux下jar包运行读取)。第一种:ClassPathResource classPathResource = new ClassPathResource("excleTemplate/test.xlsx");.原创 2021-03-25 12:53:38 · 143 阅读 · 0 评论 -
记一次JPA表关联查询,自定义返回结果
在这之前在网上搜了好多种方式都不能进行多表关联查询,并自定义返回结果集。这里采用的是接口的形式,封住返回集的。话不多说上代码。*****************表对应的实体*****************package com.cn.domain;import lombok.Data;import javax.persistence.*;import java.io.Serializable;@Data@Entity@Table(name = "user")public.原创 2020-06-05 10:17:19 · 395 阅读 · 0 评论 -
Jackson和fastjson处理返回的参数为null、或者不返回
package com.aiqin.bms.slcs.api.config;import com.alibaba.fastjson.serializer.SerializerFeature;import com.alibaba.fastjson.support.config.FastJsonConfig;import com.alibaba.fastjson.support.spring...原创 2020-03-06 15:07:23 · 2842 阅读 · 2 评论 -
The field file exceeds its maximum permitted size of 1048576 bytes
错误信息:The field file exceeds its maximum permitted size of 1048576 bytes原因是因为SpringBoot内嵌tomcat默认所能上传的文件大小为1M,超出这个就会报错。解决办法:1.修改application.yml配置文件spring: http: multipart: enab...原创 2020-03-04 14:23:05 · 4851 阅读 · 0 评论 -
java8 对list集合中的对象遍历,重新赋值两种方法,遍历某个属性返回数组
import lombok.extern.slf4j.Slf4j;import org.springframework.beans.BeanUtils;import java.util.ArrayList;import java.util.List;import java.util.UUID;import java.util.stream.Collectors;/** * d...原创 2020-01-11 15:52:51 · 49897 阅读 · 2 评论 -
springboot 处理返回结果中字段为空或为null,不展示字段的问题(字段展示不全)
package com.aiqin.mgs.market.api.config;import com.alibaba.fastjson.serializer.SerializerFeature;import com.alibaba.fastjson.support.config.FastJsonConfig;import com.alibaba.fastjson.support.spri...原创 2019-11-22 17:08:23 · 6156 阅读 · 1 评论 -
将一个字符串,按字符串的顺序,将字符改成大写,并保存到数组中。
In this simple Kata your task is to create a function that turns a string into a Mexican Wave. You will be passed a string and you must return that string in an array where an uppercase letter is a pe...原创 2019-04-15 14:53:24 · 549 阅读 · 0 评论 -
从4个元素的签名开始,每个后续元素是前面4个的总和,一个Pentabonacci带有5个元素的签名,每个后续元素是前面5个元素的总和,依此类推。
If you have completed the Tribonacci sequence kata, you would know by now that mister Fibonacci has at least a bigger brother. If not, give it a quick look to get how things work.Well, time to expan...原创 2019-04-24 08:48:00 · 195 阅读 · 0 评论 -
给定一个数组,输出笑脸的个数。
笑脸组成规则:-笑脸必须包含眼睛。用“:”或“;”表示。-笑脸可以有鼻子,也可以没有。用“-”或“~”表示。-笑脸必须有嘴巴。用“)”或“D”表示。例如笑脸::) ;) :~) ;~) :-) ;-) :D ;D等Given an array (arr) as an argument complete the function countSmileys that s...原创 2019-04-24 10:33:32 · 376 阅读 · 0 评论 -
计算一个数的阶乘
import java.math.BigInteger;import java.util.ArrayList;/** * @program: nettytest * @description: * @create: 2019/04/24 16:32 */public class Kata1 { public static String Factorial(int num...转载 2019-04-24 17:27:33 · 615 阅读 · 0 评论 -
图中显示了6个正方形,其边长为1、1、2、3、5、8。很容易看出这些方块的周长之和是:4*(1+1+2+3+5+8)=4*20=80
图中显示了6个正方形,其边长为1、1、2、3、5、8。很容易看出这些方块的周长之和是:4*(1+1+2+3+5+8)=4*20=80当有n+1个正方形以与图中相同的方式排列时,你能给出矩形中所有正方形的周长之和吗?可选文字#提示:参见斐波那契序列#参考:http://oeis.org/a00045函数周长具有参数n,其中n+1是平方数(从0到n编号),并返回所有平方的总周长。...原创 2019-04-29 13:52:57 · 598 阅读 · 0 评论 -
两个大数相乘、相加,使用字符串计算。(搬砖)
代码:依赖:<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --><dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lan...转载 2019-04-29 14:02:16 · 195 阅读 · 0 评论 -
用10的连续幂除以13,得到下列无限重复余数:1,10,9,12,3,4。随意给出一个数,从个位开始,依次乘以余数,并相加,得出一个新数值。用新数值重复上述过程,直到新数值是一个固定值,返回结果。
When you divide the successive powers of10by13you get the following remainders of the integer divisions:1, 10, 9, 12, 3, 4.Then the whole pattern repeats.Hence the following method: Multiply...原创 2019-04-17 10:01:22 · 720 阅读 · 0 评论 -
如果我们列出10以下的所有自然数是3或5的倍数,我们得到3,5,6和9.这些倍数的总和是23。 完成解决方案,使其返回传入数字下方所有3或5的倍数之和。
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Finish the solution so that it returns the sum of all the multiple...原创 2019-04-13 14:18:53 · 2922 阅读 · 0 评论 -
springboot1.5.9整合elasticsearch2.3.5附带demo
springboot1.5.9整合elasticsearch2.3.5附带demo注意点操作注意点注意springboot-data-elasticsearch和elasticsearch版本号的对应,这个是严格要求。操作1.下载elasticsearch2.3.5.zip修改C:\ruanjian\elasticsearch2.3.5\config下面的配置文件。cluster.n...原创 2018-12-24 15:56:21 · 787 阅读 · 0 评论 -
一个孩子在一栋高楼的第N层玩球。这层楼的高度h是已知的。
一个孩子在一栋高楼的第N层玩球。这层楼的高度h是已知的。他把球从窗口扔了出去。球反弹(例如)到其高度的三分之二(反弹0.66)。他母亲从离地1.5米的窗户向外看。妈妈会看到球在她窗前经过多少次(包括什么时候落下和弹跳)?有效实验必须满足三个条件:**以米为单位的浮动参数“h”必须大于0****浮动参数“bounce”必须大于0小于1****浮动参数“window”必须小...原创 2019-04-04 19:36:17 · 209 阅读 · 0 评论 -
斐波那契数列1, 1 ,1, 3, 5, 9, 17, 31, ...找规律,用Java实现第n项数组
废话不多说直接上代码import java.util.ArrayList;import java.util.Arrays;import java.util.List;/** * @create: 2019/03/30 14:56 */public class ArrTest { public static double[] tribonacci(double[] s, ...原创 2019-04-01 09:19:13 · 6272 阅读 · 0 评论 -
给出一个数组,返回它的最大值和最小值。
Ben has a very simple idea to make some profit: he buys something and sells it again. Of course, this wouldn't give him any profit at all if he was simply to buy and sell it at the same price. Inst...原创 2019-04-11 19:25:04 · 613 阅读 · 0 评论 -
创建一个函数,该函数可以将任何非负整数作为参数,并以其降序返回数字。如:21445输出54421
您的任务是创建一个函数,该函数可以将任何非负整数作为参数,并以其降序返回数字。 基本上,重新排列数字以创建尽可能高的数字。Examples:Input:21445Output:54421Input:145263Output:654321Input:1254859723Output:9875543221代码import java.util.Array...原创 2019-04-08 16:29:53 · 714 阅读 · 1 评论 -
给定一个整数,确定它是否是正方形数字:
给定一个整数,确定它是否是正方形数字:在数学中,平方数或正方形是整数,它是整数的平方; 换句话说,它是一些整数与自身的产物。例如:isSquare(-1) returns falseisSquare(0) returns trueisSquare(3) returns falseisSquare(4) returns trueisSquare(25) returns t...原创 2019-04-08 16:48:59 · 330 阅读 · 0 评论 -
替换掉一个字符串中的_和-,并将之后的字母改为大写。
例如:i_am-a_student 转为:iAmAStudentI-can_do-it 转为:ICanDoIt代码:import java.util.regex.Matcher;import java.util.regex.Pattern;class Solution{ //方法一 static String toCamelCase(Stri...原创 2019-04-12 08:58:14 · 442 阅读 · 0 评论 -
找出字符串的最大值和最小值输出
In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number.Example:HighAndLow("1 2 3 4 5") // return "5 1"HighAndLow("1 2 -3 4...原创 2019-04-12 14:53:53 · 2514 阅读 · 0 评论 -
Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and
Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be case insensitive. The string can contain any char.Examples input/output:XO("ooxx") => tru...原创 2019-04-12 15:16:30 · 1855 阅读 · 0 评论 -
给出一个数,各个位相乘,直到积为小于10的书数,输出他的计算次数。
Write a function,persistence, that takes in a positive parameternumand returns its multiplicative persistence, which is the number of times you must multiply the digits innumuntil you reach a sing...原创 2019-04-12 17:45:07 · 233 阅读 · 0 评论 -
比对另一个字符串中是否含有本字符串的组成字母
Complete the functionscramble(str1, str2)that returnstrueif a portion ofstr1characters can be rearranged to matchstr2, otherwise returnsfalse.Notes:Only lower case letters will be used (a-...原创 2019-04-12 19:17:07 · 214 阅读 · 0 评论 -
判断两个字符串中三个相同和两个相同的字符串
TripleDouble(451999277L,41177722899L)----->1TripleDouble(4321L,41177722899L)----->0代码:public class Katas { public static int TripleDouble(long num1, long num2) { String p=Str...原创 2019-04-13 13:52:45 · 366 阅读 · 0 评论 -
SpringBoot-RestTemplate实现调用第三方API传参问题
SpringBoot-RestTemplate传参请求第三方接口时,参数传不过去,因为我用了 Map<String, String> data = new HashMap<String, String>();这样是不行的,必须使用MultiValueMap<String, String> params= new LinkedMultiValueMap<&...原创 2018-12-29 11:21:58 · 1762 阅读 · 0 评论