Browse Source

Merge branch 'dev' of wujunjie/patient-co-management into dev

yeshijie 7 years ago
parent
commit
4846e8b930

+ 26 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -722,14 +722,14 @@ public class OnePayService {
    }
    /**
     * 按月缴费获取签约月数
     * 按月缴费获取签约月数(算法已更改)
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static int monthBetween(String fromStr, String toStr, String formatStr) {
    public static int monthBetweenBak(String fromStr, String toStr, String formatStr) {
        try {
            SimpleDateFormat format = new SimpleDateFormat(formatStr);
            Calendar bef = Calendar.getInstance();
@ -745,6 +745,30 @@ public class OnePayService {
        }
    }
    /**
     * 按月缴费获取签约月数
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static int monthBetween(String fromStr, String toStr, String formatStr) {
        SimpleDateFormat format = new SimpleDateFormat(formatStr);
        try {
            Calendar bef = Calendar.getInstance();
            Calendar aft = Calendar.getInstance();
            bef.setTime(format.parse(fromStr));
            aft.setTime(format.parse(toStr));
            int result = aft.get(Calendar.MONTH) - bef.get(Calendar.MONTH);
            int month = (aft.get(Calendar.YEAR) - bef.get(Calendar.YEAR)) * 12;
            return Math.abs(month + result) + 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }
    /**
     * 按月缴费获取总金额
     *