m0_37729339
码龄8年
求更新 关注
提问 私信
  • 博客:31,065
    社区:582
    问答:9,997
    41,644
    总访问量
  • 18
    原创
  • 1,168
    粉丝
  • 42
    关注
IP属地以运营商信息为准,境内显示到省(区、市),境外显示到国家(地区)
IP 属地:浙江省
加入CSDN时间: 2017-03-02

个人简介:开发

博客简介:

m0_37729339的博客

查看详细资料
个人成就
  • 获得5次点赞
  • 内容获得20次评论
  • 获得54次收藏
  • 博客总排名1,604,841名
创作历程
  • 5篇
    2021年
  • 5篇
    2020年
  • 3篇
    2019年
  • 4篇
    2018年
  • 1篇
    2017年
成就勋章
TA的专栏
  • java
    16篇
  • 加密
  • 微信
    1篇
  • mysql
    1篇
  • jmeter测试
    1篇

TA关注的专栏 1

TA关注的收藏夹 0

TA关注的社区 5

TA参与的活动 0

兴趣领域 设置
  • 大数据
    mysqlredis
  • 后端
    spring架构
  • 搜索
    elasticsearch
创作活动更多

新星杯·14天创作挑战营·第13期

这是一个以写作博客为目的的创作活动,旨在鼓励大学生博主们挖掘自己的创作潜能,展现自己的写作才华。如果你是一位热爱写作的、想要展现自己创作才华的小伙伴,那么,快来参加吧!我们一起发掘写作的魅力,书写出属于我们的故事。我们诚挚邀请你们参加为期14天的创作挑战赛!注: 1、参赛者可以进入活动群进行交流、互相鼓励与支持(开卷),虚竹哥会分享创作心得和涨粉心得,答疑及活动群请见:https://bbs.csdn.net/topics/619781944 【进活动群,得奖概率会更大,因为有辅导】 2、文章质量分查询:https://www.csdn.net/qc

80人参与 去参加
  • 最近
  • 文章
  • 专栏
  • 代码仓
  • 资源
  • 收藏
  • 关注/订阅/互动
更多
  • 最近

  • 文章

  • 专栏

  • 代码仓

  • 资源

  • 收藏

  • 关注/订阅/互动

  • 社区

  • 帖子

  • 问答

  • 课程

  • 视频

搜索 取消

idea pom文件里面内容为什么是灰的?

答:

是不是前面注释掉了,注意<!-- 这个注释头,是否没有写结尾注释

回答问题 2022.06.28

list对象中根据某个字段排序 汇总某个数据

答:

如果是getElectricityA这个数据是String类型,可以在LoopLineDataVO里面再写一个get方法

public double getDoubleElectricityA(){
return Double.valueOf(getElectricityA());
}
回答问题 2022.03.30

list添加值,试过很多,都不可以

答:

没有初始化

List<CommunityComTm> list = new ArrayList();

回答问题 2022.03.29

这两种字符串拼接方式哪一种好呢?或者说还有更好的拼接方式吗

答:

大量字符串拼接可以用StringBuilder,少量String就够了,StringBuilder就不要用+了,直接append

回答问题 2022.03.29

为什么正常post请求不能在body中接多个参数呢?

答:

body参数要用json或是xml或者其他格式进行传递,如果已经是这种格式要看接口是怎么定义的

回答问题 2022.03.29

为什么我复制一个项目却用不了

答:

在pom.xml文件上右键

img

回答问题 2022.03.24

写了一个synchronized 同步方法,但是没有达到同步效果,求解答!

答:

这不是一个线程一个线程的在调用吗,第一个线程执行删除操作失败了,第二个线程才进去执行删除这个文件

回答问题 2022.03.24

MySQL 查询某月一整月的数据

答:

select * from a where year(date)='2022' and month(date)='04'

回答问题 2022.03.23

在项目里新建一个jar里面的类不好使?

答:

文件路径要跟之前那个一样,可以把之前的文件拷贝一下放到一样的文件路径里面,再改一下你想改的方法

回答问题 2022.03.23

设计电话号码的java程序

答:

public static void main(String[] args) throws IOException {
        Map map = new HashMap();
        Map newMap = new HashMap();
        while (map.size()<10){
            newMap = saveName(newMap);
            if(newMap==null){
                break;
            }
            map.putAll(newMap);
        }
        File file = new File("E:/电话号码.java");
        if(file.exists()){
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        try (FileWriter fileWriter = new FileWriter("E:/电话号码.java")) {
            fileWriter.append(map.toString());
        }

    }

    public static Map saveName(Map map){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第"+(map.size()+1)+"个名称:");
        String name = sc.nextLine();
        if(map.containsKey(name)){
            System.out.println("该用户电话号码为:"+map.get(name));
            return map;
        }
        if(name.equals("quit")){
            return null;
        }
        System.out.println("请输入电话号码:");
        String phone = sc.nextLine();
        if(phone.equals("quit")){
            return null;
        }
        map.put(name,phone);
        return map;
    }
回答问题 2022.03.21

想让一个字段的行数作为筛选条件

答:

SELECT
    a,
    b,
    c,
    d,
    e,
    payable_amount
FROM
    (
        SELECT
            a,
            b,
            c,
            d,
            e,
            f,
            REPLACE (
                m.money,
                CONCAT(t.amount, ','),
                ''
            ) AS payable_amount
        FROM
            tblM AS m
        LEFT JOIN (
            SELECT
                m.a AS a,
                REPLACE (
                    m.money,
                    CONCAT(t.amount, ','),
                    ''
                ) AS payable_amount
            FROM
                tblM AS m
            LEFT JOIN tblT AS t ON t.a = m.a
            ORDER BY
                payable_amount
            LIMIT 10
        ) t1 ON t1.a = m.a
    ) t2
WHERE
    t2.a IS NOT NULL
)
回答问题 2022.03.18

idea中的.fxml资源无法加载

答:

@FXMLView(value = "/fxml/login.fxml",title = "")
public class LoginFXML extends AbstractFxmlView {

}

Application文件中:
@SpringBootApplication
@Slf4j
public class DemoApplication extends AbstractJavaFxApplicationSupport {

    public static void main(String[] args) {
//        launch(DemoApplication.class, LoginFXML.class,new SplashScreen(), args);
        launch(DemoApplication.class, LoginFXML.class, args);
    }
回答问题 2022.03.18

为啥我这里取了流根本拿不到数据啊,求解答

答:

    public static Map<String, String> httpPost(String url, String param, Map<String, String> headers, ContentType contentType) {
        HttpPost httpPost = new HttpPost(url);
        CloseableHttpResponse response = null;
        Map<String, String> result = new HashMap<>();
        try {
            // 设置header
            if (headers != null) {
                for (Entry<String, String> entry : headers.entrySet()) {
                    httpPost.setHeader(entry.getKey(), entry.getValue());
                }
            }

            StringEntity paramEntity = new StringEntity(param, contentType);
            httpPost.setEntity(paramEntity);
            response = httpClient.execute(httpPost);
            result = getResult(response);
        } catch (IOException e) {
            log.error("http请求异常,{}", url, e);
        } finally {
            try {
                if (response != null) {
                    response.close();
                }
            } catch (IOException e) {
                log.error("response.close失败", e);
            }
        }
        return result;
    }

    /**
     * 获取Response返回结果
     *
     * @param response
     * @return
     * @throws IOException
     */
    private static Map<String, String> getResult(CloseableHttpResponse response) throws IOException {
        Map<String, String> result = new HashMap<>();
        String statusCode = response.getStatusLine().getStatusCode() + "";
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            String content = EntityUtils.toString(entity, CHARSET);
            result.put(CONTENT, content);
            result.put(STATUSCODE, statusCode);
        }
        return result;
    }

   public static final String CONTENT = "content";
    public static final String STATUSCODE = "statusCode";

    private static final String CHARSET = "UTF-8";
回答问题 2022.03.18

web service:cxf整合spring的webapp项目如何发布到linux服务器?

答:

在服务器安装tomcat,将war包放入tomcatwebapps目录下,启动tomcat

回答问题 2022.03.17

ES并发更新数据失败

答:

并发更新的话可以用bulkUpdate方法,把indesRequest放入list

回答问题 2022.03.17

Java在notepad++中运行时提示解析时已经到达文件结尾是什么原因

答:

img


这个移到上面的大括号里面去

回答问题 2022.03.17

NullPointerException

答:

img


你这个pets是new出来的,也没有调用add方法赋值,第一个对象肯定是空的

回答问题 2022.03.17

同志们,怎样用Java编写一个类来进行四则运算

答:
public class TestClass {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        System.out.println("请输入第一个数字:");
        int a = s.nextInt();
        System.out.println("First Number: "+a);
        System.out.println("请输入第二个数字:");
        int b = s.nextInt();
        System.out.println("Second Number: "+b);
        int result = Matrx.add(a,b);
        System.out.println("计算结果为:"+result);
    }

   static class Matrx{
       public static int add (int x,int y){
            return x+y;
        }
    }
}

img

回答问题 2022.03.17

注释里面的问题求解求解

答:

定义为0 初始值
%.2f 保留两位小数

回答问题 2022.03.17

Java问题,主要是购物车那一块不知道如何写

答:

普通工厂模式


   @Data
    @Builder
    public class Commodity {
        private int id;
        private String name;
        private String price;
    }

    public interface Shopping {
        Commodity shopping();
    }

    public class OppoShop implements Shopping {
        @Override
        public Commodity shopping() {
            Commodity commodity = Commodity.builder()
                    .id(1)
                    .name("oppo")
                    .price("1").build();
            return commodity;
        }
    }

    public class WLShop implements Shopping {
        @Override
        public Commodity shopping() {
            Commodity commodity = Commodity.builder()
                    .id(2)
                    .name("卫龙")
                    .price("2").build();
            return commodity;
        }
    }

    public class BLKShop implements Shopping {
        @Override
        public Commodity shopping() {
            Commodity commodity = Commodity.builder()
                    .id(3)
                    .name("保暖裤")
                    .price("3").build();
            return commodity;
        }
    }

    public class ShoppingFactory {
        public Shopping shop(String type) {
            switch (type) {
                case "oppo":
                    return new OppoShop();
                case "wl":
                    return new WLShop();
                case "blk":
                    return new BLKShop();
                default:
                    return null;
            }
        }
    }

    public void test() {
        ShoppingFactory shoppingFactory = new ShoppingFactory();
        Shopping shopping = shoppingFactory.shop("oppo");
        Commodity oppoCom = shopping.shopping();

        shopping = shoppingFactory.shop("wl");
        Commodity wlcom = shopping.shopping();

        shopping = shoppingFactory.shop("blk");
        Commodity blkCom = shopping.shopping();

        List<Commodity> commodities = new ArrayList<Commodity>(){{
            add(oppoCom);
            add(wlcom);
            add(blkCom);
        }};
        commodities.stream().sorted(Comparator.comparing(Commodity::getPrice)).collect(Collectors.toList());
        System.out.println(commodities.toString());
    }
回答问题 2022.03.01
加载更多