New file |
| | |
| | | package com.hx.encryption; |
| | | |
| | | import com.hx.util.MD5Util; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | /* |
| | | * @Description: his助手调用 phitab 订单加密工具 |
| | | * @Author: wangrenhuang |
| | | * @Date: 2022/2/15-11:20 |
| | | */ |
| | | public class PTEncryptionUtil { |
| | | |
| | | /* |
| | | * 日期加密 |
| | | * date 要加密的日期 |
| | | * */ |
| | | public static String encryption(Date date){ |
| | | Calendar cal=Calendar.getInstance(); |
| | | cal.setTime(date); |
| | | int year = cal.get(Calendar.YEAR);//获取年份 |
| | | int month=cal.get(Calendar.MONTH);//获取月份 |
| | | int day=cal.get(Calendar.DATE);//获取日 |
| | | int hour=cal.get(Calendar.HOUR_OF_DAY);//小时 |
| | | int minute=cal.get(Calendar.MINUTE);//分 |
| | | int second=cal.get(Calendar.SECOND);//秒 |
| | | |
| | | String yearStr = com.hx.mp.util.MD5Util.MD5Encode(year+"",""); |
| | | String monthStr = com.hx.mp.util.MD5Util.MD5Encode(month+"",""); |
| | | String dayStr = com.hx.mp.util.MD5Util.MD5Encode(day+"",""); |
| | | String hourStr = com.hx.mp.util.MD5Util.MD5Encode(hour+"",""); |
| | | String minuteStr = com.hx.mp.util.MD5Util.MD5Encode(minute+"",""); |
| | | String secondStr = com.hx.mp.util.MD5Util.MD5Encode(second+"",""); |
| | | |
| | | StringBuffer result = new StringBuffer(); |
| | | result.append(yearStr).append("-").append(monthStr).append("-").append(dayStr).append("-") |
| | | .append(hourStr).append("-").append(minuteStr).append("-").append(secondStr); |
| | | |
| | | return result.toString(); |
| | | } |
| | | } |