自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 请求外部接口-hutool-HttpUtil

hutool httpUtil 请求外部接口

2024-02-01 11:13:13 535 1

原创 int类型相除保留两位小数

方法一: double rate = new BigDecimal(((double) count / all) * 100).setScale(1, BigDecimal.ROUND_DOWN).doubleValue();方法二: // 创建一个数值格式化对象 NumberFormat numberFormat = NumberFormat.getInstance(); // 设置精确到小数点后2位

2022-04-27 11:29:37 2032

原创 SpringCloud(6)---熔断降级理解、Hystrix实战

https://www.cnblogs.com/qdhxhz/p/9581440.html

2021-10-26 17:55:49 81

原创 数据库根据业务分表取模

String contractNo = "VSP-20211021144142";int num= HashModel.getHashNmu(contractNo, 32);String tableName = "contract_commodity_"+num;// 得到 "contract_commodity_0~31` 中的某一个表public class HashModel { /** * hash 取模 */ public static int ge

2021-10-25 11:06:49 224

原创 给图片添加围栏

/** * 根据图片路径获取图片流+ 围栏渲染 动态设置图片大小,并以图片流的方式返回 * @param response * @param filePath 文件路径 eg: E:\\datacenter\\zhqb_electronicfence\\zhqb_electronicfence\\106051260944084055\\wpy-001\\2\\20210413202127.jpg * @param fenceArea 围栏坐标 [{"x":308.609375,"y":111

2021-04-15 20:59:48 149

原创 文件以流的方式返回,图片流返回

文件以流的方式返回 /** * 根据图片路径获取文件流 * * @param response 返回值 * @param path 图片路径 * @throws ServletException * @throws IOException */ @ApiOperation("根据图片路径获取文件流") @GetMapping("/getPresentImageStream") public void service(HttpServletResponse respo.

2021-04-15 20:31:07 1297

原创 文件上传 1. 从路径A复制到路径B 2. 通过流上传文件

从路径A复制到路径B/** * 根据文件路径上传文件 * @param path * @param fileDocment * @return */ private String fileUploadByFilePath(String path, String fileDocment) { // 读取图片 File fileImage = new File(path); String filepath = fileDocment + File.separator + .

2021-04-15 20:21:42 96

原创 jpa查询方式

sql查询@Query(value = "select * from base_preset where base_sensor_id = ?1 and preset_no in (?2)" ,nativeQuery = true) List<BasePreset> findBySensorIdAndPresetNo(Long sensorId, List<String> presetNos);多条件无sql查询@Autowiredprivate BaseDept.

2021-04-10 16:17:32 229

原创 java 中文按照字母排序

List<String> supplierNames = null; if(equipmentInfoVOList != null && equipmentInfoVOList.size() !=0){ supplierNames = equipmentInfoVOList.stream().filter(f -> f != null).filter(f -> StringUtils.isNotEmpty(f.getManufact

2021-02-08 15:49:31 268 1

原创 使用mongoTemplate进行Aggregation聚合查询

1.Criteria criteria = getCriteria(materialInfoDTO,userVo); Query query = new Query(); query.addCriteria(criteria); long sumCount = mongoTemplate.count(query, MaterialInfo.class); Aggregation aggregation = Aggregation.newA

2021-01-08 17:49:39 5131 1

原创 apache.poi 处理word模板

<!--word模板--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> <dependenc.

2020-10-20 18:39:39 595

原创 1.文件从服务器下载到本地,2.文件删除,3文件从服务器下载到浏览器,4文件从本地下载到浏览器 等

**import javax.servlet.http.HttpServletRequest;import java.io.*;import java.net.HttpURLConnection;import java.net.MalformedURLException;import java.net.URL;import java.net.URLConnection;public class FileUtil { /* * 根据指定URL将文件下载到指定目标

2020-10-20 10:42:23 223

原创 word转PDF

docx4j依赖: <dependency> <groupId>org.docx4j</groupId> <artifactId>docx4j-export-fo</artifactId> <version>6.1.0</version> </dependency> /** * docx4j .

2020-10-17 11:35:05 178

原创 mybatis分页

//获取数据 PageHelper.startPage(outsourceunitDTO.getPage(),outsourceunitDTO.getSize()); List<OutsourceunitVo> outsourceunitVos = outsourceUnitMapper.getOutsourceUnit(outsourceunitDTO); PageInfo<OutsourceunitVo> pageData = ne

2020-07-20 09:57:04 82

原创 mybatis sql一对多查询 返回对象或list中包含子list

数据库对应关系如下图: 两个表的关联关系 是store_code 和 sku_code 同时相等要求查询结果(图一)"list": [ { "storeCode": "0001", "skuCode": "0200000306", "proStatus": 0, "curNumber": 3, ...

2020-06-05 18:18:57 5836 1

原创 极光推送:后台向APP:android,ios极光推送消息

1. 添加依赖//jpush compile group: 'cn.jpush.api', name: 'jpush-client', version: '3.3.4'2. 注册极光用户//APP端注册极光Id,jpushId为每个用户在各个设备的唯一标识 public void registeAuroral(String jpushId) { JPushInterfac...

2019-06-06 15:39:04 2095

翻译 zuul简单搭建

创建好eureka实现zuul:首先是添加pom.xml文件的依赖: <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> &l...

2019-05-31 09:33:20 523

翻译 mysqlsla安装和使用介绍

安装mysqlsla源码路径:https://github.com/daniel-nichter/hackmysql.com源码存放路径:/usr/local/src1、获取源码如果没有git命令,请先安装gityum -y install gityum -y install perl-ExtUtils-Embedcd /usr/local/srcgit clone http...

2019-05-16 20:27:15 1396

原创 mongoDB操作

1. 查询Query query = new Query(Criteria.where(“sourceId”).is(sourceId).and(“userId”).is(userId).and(“createDate”).in(times));query.with(new Sort(Sort.Direction.DESC, “createDate”));List userHealthDat...

2019-05-08 15:08:42 262

原创 使用restFul进行post和get请求

1.1 postForObjectString urlAddPatients = “http://192.168.10.180:8000/life-account/”+"/static/patients/addpatients";CompleteUserInfo completeUserInfo = new CompleteUserInfo();completeUserInfo.se...

2019-05-07 16:50:29 3037

原创 mysql行转列

SELECT user_id userId,update_date datatime, MAX(CASE dictionary_code WHEN 'LRTZ_JKZB_XY1' THEN num ELSE 0 END ) xueyang, MAX(CASE dictionary_code WHEN 'LRTZ_JKZB_XY' THEN num ELSE 0 E...

2019-05-07 16:39:16 786

原创 Excel导出

String fileName = “导出Excel.xlsx”; //创建名称String rpath = null;ClassLoader cldr=getClass().getClassLoader();if(null!=cldr){rpath = cldr.getResource("/").getPath();}else{rpath="###";}String os = S...

2019-04-02 12:03:22 92

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除