소스 검색

1:添加订单请求接口
2:添加审核通知请求接口
3:添加支付回调接口
4:其他

wangming 3 년 전
부모
커밋
22fa2886c0

+ 12 - 32
ruoyi-admin/src/main/java/com/ruoyi/web/controller/opt/OptController.java

@@ -8,6 +8,10 @@ import com.ruoyi.common.json.JSONObject;
 import com.ruoyi.common.request.ProcessInfoReq;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.opt.domain.CompanyInfo;
+import com.ruoyi.opt.service.ICompanyInfoService;
+import com.ruoyi.opt.service.IProcessInfoService;
+import com.ruoyi.opt.service.IProjectInfoService;
 import com.ruoyi.opt.service.ISysInfoConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.annotations.Param;
@@ -41,6 +45,12 @@ public class OptController {
 
     @Autowired
     private ISysInfoConfigService sysInfoConfigService;
+    @Autowired
+    private IProcessInfoService processInfoService;
+    @Autowired
+    private ICompanyInfoService companyInfoService;
+    @Autowired
+    private IProjectInfoService projectInfoService;
 
 
     /**
@@ -66,8 +76,8 @@ public class OptController {
             //拿到解析结果,进行解析
             ProcessInfoReq processInfoReq = JSON.parseObject(processResult, ProcessInfoReq.class);
             if (StringUtils.isNotNull(processInfoReq)){
-                //入本地库
-
+                //入本地企业信息
+                companyInfoService.insertCompanyInfoByWww(processInfoReq);
             } else {
                 log.info("订单数据为空,请求失败,请求id为:" + processId);
                 return R.failwww("订单数据为空,接收失败");
@@ -81,35 +91,5 @@ public class OptController {
         return R.okwww();
     }
 
-    
-    /**
-    * @desc : 此接口为给www推送审核状态通知
-    * @author : wangming
-    * @createTime : 2022/9/6 11:40
-    * @param : []
-    * @return : com.ruoyi.common.core.domain.R
-    */
-    @PostMapping("/check_inform")
-    public R checkInform(){
-        return null;
-    }
-
-
-    /**
-    * @desc : 此接口为支付通知
-    * @author : wangming
-    * @createTime : 2022/9/6 15:48
-    * @param : []
-    * @return : com.ruoyi.common.core.domain.R
-    */
-    @PostMapping("/pay_inform")
-    public R payInform(){
-        return null;
-    }
-
-    @PostMapping("fill_template")
-    public R fillTemplate(){
-        return null;
-    }
 
 }

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/opt/ProcessInfoController.java

@@ -110,7 +110,8 @@ public class ProcessInfoController extends BaseController
     @ResponseBody
     public AjaxResult editSave(ProcessInfo processInfo)
     {
-        return toAjax(processInfoService.updateProcessInfo(processInfo));
+        AjaxResult ajaxResult = processInfoService.updateProcessInfo(processInfo);
+        return ajaxResult;
     }
 
     /**

+ 28 - 0
ruoyi-common/src/main/java/com/ruoyi/common/request/CheckInformBo.java

@@ -0,0 +1,28 @@
+package com.ruoyi.common.request;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author : wangming
+ * @CreateTime : 2022-09-07
+ * @Desc : 审核通知实体类
+ */
+@Data
+public class CheckInformBo implements Serializable {
+
+    private static final long serialVersionUID = -1185015143654744140L;
+
+    private String processId;    //业务流水号
+    private String code;         //状态码  01-审核通过   02-审核未通过
+    private String applyPolicyNo; //投保单号
+    private String totalAmt;      //保额
+    private String premium;       //保费
+    private String skAccountName; //收款账号名称
+    private String skAccount;     //收款账号
+    private String skKHH;         //收款开户行
+    private String payUrl;        //支付地址   如需跳转到支付页面则该字段不能为空
+    private String message;       //审核不通过原因   审核通过时为空
+    private String postscript;    //打款附言
+}

+ 26 - 0
ruoyi-common/src/main/java/com/ruoyi/common/request/PayInfomBo.java

@@ -0,0 +1,26 @@
+package com.ruoyi.common.request;
+
+import lombok.Data;
+
+/**
+ * @Author : wangming
+ * @CreateTime : 2022-09-07
+ * @Desc : 支付请求回调数据Bo
+ */
+@Data
+public class PayInfomBo {
+
+    private static final long serialVersionUID = -1185015143654744140L;
+
+    private String processId;          //业务流水号,同一笔交易保持一致
+    private String applyPolicyNo;      //投保单号
+    private String companyName;        //企业名称
+    private String companySocialNo;    //企业统一社会信用代码
+    private String payAccountName;     //付款账户名称
+    private String payBank;            //付款帐户开户行
+    private String payAccount;        //付款帐户帐号
+    private String cost;              //付款金额
+    private String policyPath;        //保函下载地址,没有值传空字符串
+    private String fpxzUrl;           //发票下载链接,没有值传空字符串
+
+}

+ 1293 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtil.java

@@ -0,0 +1,1293 @@
+package com.ruoyi.common.utils;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ * 日期工具类
+ * 
+ * @author zhujt
+ *
+ */
+public class DateUtil {
+
+	/*
+	 * 2011-01-01 01:01:00
+	 */
+	private static SimpleDateFormat fullSDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+	private static SimpleDateFormat fullSD = new SimpleDateFormat("yyyy-MM-dd");
+	/**
+	 * Get full time string, like 2011-01-01 01:01:00
+	 * 
+	 * @return
+	 */
+	public static String getCurrentTime() {
+		return fullSDF.format(new Date());
+	}
+	
+	public static String getCurrentDate() {
+		return fullSD.format(new Date());
+	}
+
+	static long now;
+	public static final String FORMAT_TIME = "yyyy-MM-dd HH:mm:ss"; // 默认时间格式
+	
+	public static final String FORMAT_TIME_MINUTE = "yyyy-MM-dd HH:mm"; // 默认时间格式
+
+	public static final String FORMAT_DATE = "yyyy-MM-dd"; // 默认日期格式
+
+	public static final String FORMAT_DTIME = "yyyyMMdd"; // 数据库日期格式
+
+	public static final String FORMAT_MONTH = "yyyy-MM"; // 默认月份格式
+
+	public static final String FORMAT_YEAR = "yyyy"; // 默认年格式
+
+	public static final String FORMAT_DATE2 = "yyyy/MM/dd"; //
+	
+	public static Date CurrTime;
+	public final static DateFormat FullFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	public final static DateFormat MinuteFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+	public final static DateFormat HourFormat = new SimpleDateFormat("yyyy-MM-dd HH");
+	public final static DateFormat DayFormat = new SimpleDateFormat("yyyy-MM-dd");
+	public final static DateFormat MonthFormat = new SimpleDateFormat("yyyy-MM");
+	public final static DateFormat YearFormat = new SimpleDateFormat("yyyy");
+	public final static DateFormat HourNumFormat = new SimpleDateFormat("yyyyMMddHH");
+
+	public final static String FULL_FORMAT_REGEX = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$";
+	public final static String HOUR_FORMAT_REGEX = "^\\d{4}-\\d{2}-\\d{2} \\d{2}$";
+	public final static String DAY_FORMAT_REGEX = "^\\d{4}-\\d{2}-\\d{2}$";
+	public final static String MONTH_FORMAT_REGEX = "^\\d{4}-\\d{2}";
+	public final static String YEAR_FORMAT_REGEX = "^\\d{4}$";
+
+	public final static String YEARTOHOUR_FORMAT_REGEX = "^\\d{4}-\\d{2}-\\d{2}\\d{2}$";
+	public final static String YEARTOMONTH_FORMAT_REGEX = "^\\d{4}\\d{2}$";
+	public final static String QUARTER_FORMAT_REGEX = "^\\d{4}Q\\d{1}$";
+	public final static int FULL_FORMAT = 0;
+	public final static int HOUR_FORMAT = 1;
+	public final static int DAY_FORMAT = 2;
+	public final static int MONTH_FORMAT = 3;
+	public final static int YEAR_FORMAT = 4;
+
+	public static String getLongToString(Long longtime) {
+		if (longtime == null) {
+			return "";
+		}
+		return fullSDF.format(new Date(longtime));
+	}
+
+	public static String getTimestampToString(Timestamp time) {
+		return fullSDF.format(time);
+	}
+
+	public static String getCurrTime() {
+		Date date_time = new Date();
+		return FormatDate(date_time, "yyyy-MM-dd HH:mm:ss");
+	}
+
+	public static String getCurrDetailTime() {
+		Date date_time = new Date();
+		return FormatDate(date_time, "yyyy-MM-dd HH-mm-ss");
+	}
+
+	public static String getCurrYY() {
+		Date date_time = new Date();
+		String date = FormatDate(date_time, "yyyy-MM-dd HH:mm:ss");
+		return date.substring(0, 4);
+	}
+
+	public static String getCurrMM() {
+		Date date_time = new Date();
+		String date = FormatDate(date_time, "yyyy-MM-dd HH:mm:ss");
+		return date.substring(5, 7);
+	}
+
+	public static String getCurrDD() {
+		Date date_time = new Date();
+		String date = FormatDate(date_time, "yyyy-MM-dd HH:mm:ss");
+		return date.substring(8, 10);
+	}
+
+	public static String getCurrHH() {
+		Date date_time = new Date();
+		String date = FormatDate(date_time, "yyyy-MM-dd HH:mm:ss");
+		return date.substring(11, 13);
+	}
+
+	public static String getYear(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "yyyy");
+	}
+
+	public static String getMonth(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "MM");
+	}
+
+	public static String dateToday_year(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "yyyy");
+	}
+
+	public static String dateToday(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "yyyy-MM-dd");
+	}
+
+	public static String getDay(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "dd");
+	}
+
+	public static String getHour(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "HH");
+	}
+
+	public static String getMinute(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "mm");
+	}
+
+	public static String getSecond(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "ss");
+	}
+
+	public static String dateToString(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "yyyy-MM-dd HH:mm:ss");
+	}
+
+	public static String dateToStringShort(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "yyyy-MM-dd");
+	}
+
+	public static String ToString(Date date) {
+		if (date == null)
+			return "";
+		else
+			return FormatDate(date, "yyyy-MM-dd") + " 23:59:59";
+	}
+
+	public static Date addTime(Date date, int field, int amount) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		calendar.add(field, amount);
+		return calendar.getTime();
+	}
+
+	/**
+	 * 解析日期yyyy-MM-dd HH:mm:ss
+	 *
+	 * @param date 日期字符串
+	 * @return
+	 */
+	public static Date parse(String date) {
+		if (date == null) {
+			return null;
+		}
+
+		try {
+			return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date);
+		} catch (ParseException e) {
+			return null;
+		}
+	}
+
+	public static Date stringToDate(String dateString) {
+		String sf = "yyyy-MM-dd HH:mm:ss";
+		Date dt = new Date();
+		try {
+			dt = stringToDate(dateString, sf);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return dt;
+	}
+
+	public static Date stringToDateShort(String dateString) {
+		if (dateString == null || dateString.trim().equals("")) {
+			return null;
+		} else {
+			String sf = "yyyy-MM-dd";
+			Date dt = stringToDate(dateString, sf);
+			return dt;
+		}
+	}
+
+	public static String FormatDate(Date date, String sf) {
+		if (date == null) {
+			return "";
+		} else {
+			SimpleDateFormat dateformat = new SimpleDateFormat(sf);
+			return dateformat.format(date);
+		}
+	}
+
+	public static String getDateFormatStr(String formart) {
+		return new SimpleDateFormat(formart).format(new Date());
+	}
+
+	public static Date stringToDate(String dateString, String sf) {
+		// ParsePosition pos = new ParsePosition(0);
+		SimpleDateFormat sdf = new SimpleDateFormat(sf);
+		try {
+			Date dt = sdf.parse(dateString);
+			sdf.format(dt);
+			return dt;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+
+	}
+
+	public static Date stringToDateAddOneDay(String dateString, String sf) {
+		ParsePosition pos = new ParsePosition(0);
+		SimpleDateFormat sdf = new SimpleDateFormat(sf);
+		Date dt = sdf.parse(dateString, pos);
+
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(dt);
+		cal.add(Calendar.DATE, 1);
+
+		return cal.getTime();
+	}
+
+	public static Date addAnyDay(Date date, int dayCount) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(date);
+		cal.add(Calendar.DATE, dayCount);
+
+		return cal.getTime();
+	}
+
+	public static Date addAnyMonth(Date date, int monthCount) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(date);
+		cal.add(Calendar.MONTH, monthCount);
+
+		return cal.getTime();
+	}
+
+	public static long diffTwoDate(Date date1, Date date2) {
+		long l1 = date1.getTime();
+		long l2 = date2.getTime();
+		return l1 - l2;
+	}
+
+	public String getDateChangeTime(String currentTime, String type, int iQuantity) {
+		Date curr = stringToDate(currentTime);
+		curr = getDateChangeTime(curr, type, iQuantity);
+		return dateToString(curr);
+	}
+
+	public static int whichFormat(String time) {
+		if (time.matches(HOUR_FORMAT_REGEX)) {
+			return HOUR_FORMAT;
+		} else if (time.matches(DAY_FORMAT_REGEX)) {
+			return DAY_FORMAT;
+		} else if (time.matches(MONTH_FORMAT_REGEX)) {
+			return MONTH_FORMAT;
+		} else if (time.matches(YEAR_FORMAT_REGEX)) {
+			return YEAR_FORMAT;
+		} else {
+			return FULL_FORMAT;
+		}
+	}
+
+	public static Date getFirstTimeOfMonth(Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(time);
+		cal.set(Calendar.DAY_OF_MONTH, 1);
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		return cal.getTime();
+	}
+
+	public static Date getFirstTimeOfDay(Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(time);
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		return cal.getTime();
+	}
+
+//	public static void main(String[] args) {
+//		System.out.println(getFirstTimeOfDay(new Date()));
+//		System.out.println(getLastTimeOfDay(new Date()));
+//		System.out.println(HourNumFormat.format(getFirstTimeOfDay(new Date())));
+//		System.out.println(HourNumFormat.format(getLastTimeOfDay(new Date())));
+//		String format = HourNumFormat.format(getFirstTimeOfDay(new Date()));
+//		String format2 = HourNumFormat.format(getLastTimeOfDay(new Date()));
+//		int a = Integer.valueOf(format);
+//		int b = Integer.valueOf(format2);
+//		System.out.println(b - a);
+//	}
+
+	public static Date getNextHour(Date startDate) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(startDate);
+		cal.add(Calendar.HOUR_OF_DAY, 1);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		return cal.getTime();
+	}
+
+	/**
+	 * 根据指定日期,延后addHour小时
+	 * @param startDate
+	 * @param addHour
+	 * @return
+	 */
+	public static Date getNextHour(Date startDate,int addHour) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(startDate);
+		cal.add(Calendar.HOUR_OF_DAY, addHour);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		return cal.getTime();
+	}
+
+	public static boolean compareDateByHour(Date endDate, Date nextDate) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(endDate);
+		calendar.set(Calendar.SECOND, 0);
+		calendar.set(Calendar.MINUTE, 0);
+		Calendar nextCalendar = Calendar.getInstance();
+		nextCalendar.setTime(nextDate);
+		nextCalendar.set(Calendar.SECOND, 0);
+		nextCalendar.set(Calendar.MINUTE, 0);
+		if (calendar.compareTo(nextCalendar) >= 0) {
+			return true;
+		}
+		return false;
+	}
+
+	public static Date getLastTimeOfDay(Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(getFirstTimeOfDay(time));
+		cal.add(Calendar.DAY_OF_YEAR, 1);
+		cal.add(Calendar.SECOND, -1);
+		return cal.getTime();
+	}
+
+	public static Date getFirstTimeOfHour(Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(time);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		return cal.getTime();
+	}
+
+	public static Date getLastTimeOfHour(Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(getFirstTimeOfHour(time));
+		cal.add(Calendar.HOUR_OF_DAY, 1);
+		cal.add(Calendar.SECOND, -1);
+		return cal.getTime();
+	}
+
+	public static Date getLastTimeOfMonth(Date time) {
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(getFirstTimeOfMonth(time));
+		cal.add(Calendar.MONTH, 1);
+		cal.add(Calendar.SECOND, -1);
+		return cal.getTime();
+	}
+
+	public static Date getDateChangeTime(Date currentTime, String type, int iQuantity) {
+		int year = Integer.parseInt(FormatDate(currentTime, "yyyy"));
+		int month = Integer.parseInt(FormatDate(currentTime, "MM"));
+		int day = Integer.parseInt(FormatDate(currentTime, "dd"));
+		int hour = Integer.parseInt(FormatDate(currentTime, "HH"));
+		int mi = Integer.parseInt(FormatDate(currentTime, "mm"));
+		int ss = Integer.parseInt(FormatDate(currentTime, "ss"));
+		GregorianCalendar gc = new GregorianCalendar(year, month, day, hour, mi, ss);
+		if (type.equalsIgnoreCase("y"))
+			gc.add(1, iQuantity);
+		else if (type.equalsIgnoreCase("m"))
+			gc.add(2, iQuantity);
+		else if (type.equalsIgnoreCase("d"))
+			gc.add(5, iQuantity);
+		else if (type.equalsIgnoreCase("h"))
+			gc.add(10, iQuantity);
+		else if (type.equalsIgnoreCase("mi"))
+			gc.add(12, iQuantity);
+		else if (type.equalsIgnoreCase("s"))
+			gc.add(13, iQuantity);
+		gc.add(2, -1);
+		return gc.getTime();
+	}
+
+	public static Date convertStringToDate(String str, String pattern) {
+		Date date = null;
+
+		if (str.equals("") || str == null)
+			return date;
+
+		SimpleDateFormat formatter = new SimpleDateFormat(pattern);
+		try {
+			date = formatter.parse(str);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		return date;
+	}
+
+	static {
+		now = System.currentTimeMillis();
+		CurrTime = new Date(now);
+	}
+
+	// 返回日期字符串("yyyy-mm")的年
+	public static int getYear(String s) {
+		if (s == null || s.length() < 4) {
+			return 1970;
+		}
+		return Integer.parseInt(s.substring(0, 4));
+	}
+
+	// 返回日期字符串("yyyy-mm")的月
+	public static int getMonth(String s) {
+		if (s == null || s.length() < 7) {
+			return 1;
+		}
+		return Integer.parseInt(s.substring(5, 7));
+	}
+
+	// 指定年月的最后一天的日期 yyyy-mm
+	public static String getDateOfLastDay(String date, String format) {
+		int year = getYear(date);
+		int month = getMonth(date);
+		int day = 1;
+		Calendar calendar = new GregorianCalendar();
+		calendar.set(year, month, day);
+		calendar.roll(Calendar.MONDAY, -1);
+		calendar.roll(Calendar.DATE, 0 - calendar.get(Calendar.DATE));
+		calendar.set(Calendar.HOUR, 0);
+		calendar.set(Calendar.MINUTE, 0);
+		calendar.set(Calendar.SECOND, 0);
+		calendar.set(Calendar.MILLISECOND, 0);
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		return sdf.format(calendar.getTime());
+	}
+
+	// 指定年月的第一天的日期 yyyy-mm
+	public static String getDateOfFirstDay(String date) {
+		if (date == null || date.trim().length() <= 0) {
+			return date;
+		}
+		String[] dateStrs = date.split("-");
+		if (dateStrs == null || dateStrs.length != 2) {
+			return date;
+		}
+		return date + "-" + "01";
+	}
+
+	public static Time getSqlTime(String str) {
+		try {
+			return new Time(fullSDF.parse(str).getTime());
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	public static Timestamp getSqlTimeStamp(String str) {
+		try {
+			return new Timestamp(fullSDF.parse(str).getTime());
+		} catch (Exception e) {
+			e.printStackTrace();
+			return null;
+		}
+	}
+
+	public static long getDWMStartTime(String type) {
+		Long startTime = null;
+		if (type.equals("D")) {
+			Calendar cal = Calendar.getInstance();
+			cal.set(Calendar.HOUR_OF_DAY, 0);
+			cal.set(Calendar.SECOND, 0);
+			cal.set(Calendar.MINUTE, 0);
+			cal.set(Calendar.MILLISECOND, 0);
+			startTime = cal.getTimeInMillis();
+		} else if (type.equals("W")) {
+			Calendar cal = Calendar.getInstance();
+			if (cal.get(Calendar.DAY_OF_WEEK) == 1) {
+				cal.add(Calendar.WEEK_OF_YEAR, -1);
+			}
+			cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+			cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
+			startTime = cal.getTimeInMillis();
+		} else if (type.equals("M")) {
+			Calendar cal = Calendar.getInstance();
+			cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+			cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
+			startTime = cal.getTimeInMillis();
+		}
+		// System.out.println(new Timestamp(startTime));
+		return startTime;
+	}
+
+	public static String getDWMStartTimeToString(String type) {
+		return DayFormat.format(new Date(getDWMStartTime(type)));
+	}
+
+	public static String[] getDateStringInWorM(String type) {
+		List<String> dates = new ArrayList<String>();
+		Calendar calendar = Calendar.getInstance();
+		calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONDAY), calendar.get(Calendar.DAY_OF_MONTH), 0,
+				0, 0);
+		if (type.equals("M")) {
+			calendar.set(Calendar.DATE, 1);
+			int month = calendar.get(Calendar.MONTH);
+			while (calendar.get(Calendar.MONTH) == month) {
+				dates.add(DayFormat.format(calendar.getTime()));
+				calendar.add(Calendar.DATE, 1);
+			}
+		}
+		if (type.equals("W")) {
+			if (calendar.get(Calendar.DAY_OF_WEEK) == 1) {
+				calendar.add(Calendar.WEEK_OF_YEAR, -1);
+			}
+			int week = calendar.get(Calendar.WEEK_OF_YEAR);
+			// System.out.println("week="+week);
+			calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
+			// 取完整的一周
+			while (calendar.get(Calendar.WEEK_OF_YEAR) == week
+					|| calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+				dates.add(DayFormat.format(calendar.getTime()));
+				calendar.add(Calendar.DATE, 1);
+			}
+		}
+
+		if (type.equals("D")) {
+			dates.add(DayFormat.format(calendar.getTime()));
+		}
+		return dates.toArray(new String[dates.size()]);
+	}
+
+	public static String[] getDateStringForMon(int year, int mon) {
+		List<String> dates = new ArrayList<String>();
+		try {
+			int i = 1;
+			Calendar a = Calendar.getInstance();
+			a.set(Calendar.YEAR, year);
+			a.set(Calendar.MONTH, mon - 1);
+			a.set(Calendar.DATE, 1);
+			a.roll(Calendar.DATE, -1);
+			int maxDate = a.get(Calendar.DATE);
+
+			while (i <= maxDate) {
+				dates.add(DayFormat.format(stringToDate(year + "-" + mon + "-" + i, "yyyy-MM-dd")));
+				i++;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return dates.toArray(new String[dates.size()]);
+	}
+
+	/**
+	 * 两个时间之间相差距离多少天
+	 * 
+	 * @param str1
+	 *            时间参数 1:
+	 * @param str2
+	 *            时间参数 2:
+	 * @return 相差天数
+	 */
+	public static long getDistanceDays(String str1, String str2) {
+		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+		Date one;
+		Date two;
+		long days = 0;
+		try {
+			one = df.parse(str1);
+			two = df.parse(str2);
+			long time1 = one.getTime();
+			long time2 = two.getTime();
+			long diff;
+			if (time1 < time2) {
+				diff = time2 - time1;
+			} else {
+				diff = time1 - time2;
+			}
+			days = diff / (1000 * 60 * 60 * 24);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return days;
+	}
+
+	/**
+	 * 两个时间相差距离多少天多少小时多少分多少秒
+	 * 
+	 * @param str1
+	 *            时间参数 1 格式:1990-01-01 12:00:00
+	 * @param str2
+	 *            时间参数 2 格式:2009-01-01 12:00:00
+	 * @return long[] 返回值为:{天, 时, 分, 秒}
+	 */
+	public static long[] getDistanceTimes(String str1, String str2) {
+		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date one;
+		Date two;
+		long day = 0;
+		long hour = 0;
+		long min = 0;
+		long sec = 0;
+		try {
+			one = df.parse(str1);
+			two = df.parse(str2);
+			long time1 = one.getTime();
+			long time2 = two.getTime();
+			long diff;
+			if (time1 < time2) {
+				diff = time2 - time1;
+			} else {
+				diff = time1 - time2;
+			}
+			day = diff / (24 * 60 * 60 * 1000);
+			hour = (diff / (60 * 60 * 1000) - day * 24);
+			min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60);
+			sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		long[] times = { day, hour, min, sec };
+		return times;
+	}
+
+	/**
+	 * 两个时间相差距离多少天多少小时多少分多少秒
+	 * 
+	 * @param str1
+	 *            时间参数 1 格式:1990-01-01 12:00:00
+	 * @param str2
+	 *            时间参数 2 格式:2009-01-01 12:00:00
+	 * @return String 返回值为:xx天xx小时xx分xx秒
+	 */
+	public static String getDistanceTime(String str1, String str2) {
+		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date one;
+		Date two;
+		long day = 0;
+		long hour = 0;
+		long min = 0;
+		long sec = 0;
+		try {
+			one = df.parse(str1);
+			two = df.parse(str2);
+			long time1 = one.getTime();
+			long time2 = two.getTime();
+			long diff;
+			if (time1 < time2) {
+				diff = time2 - time1;
+			} else {
+				diff = time1 - time2;
+			}
+			day = diff / (24 * 60 * 60 * 1000);
+			hour = (diff / (60 * 60 * 1000) - day * 24);
+			min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60);
+			sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return day + "天" + hour + "小时" + min + "分" + sec + "秒";
+	}
+
+	public static String getDistanceTime(long time1, long time2) {
+		long day = 0;
+		long hour = 0;
+		long min = 0;
+		long sec = 0;
+		long diff = 0;
+		if (time1 < time2) {
+			diff = time2 - time1;
+		} else {
+			diff = time1 - time2;
+		}
+		day = diff / (24 * 60 * 60 * 1000);
+		hour = (diff / (60 * 60 * 1000) - day * 24);
+		min = ((diff / (60 * 1000)) - day * 24 * 60 - hour * 60);
+		sec = (diff / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+		return day + "天" + hour + "小时" + min + "分" + sec + "秒";
+	}
+
+	public static long getDistanceTime(String str1) throws Exception {
+		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		Date one;
+		long time = 0;
+		try {
+			one = df.parse(str1);
+			time = one.getTime();
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return time;
+	}
+
+	/**
+	 * 取得当前日期所在周的第一天
+	 *
+	 * @param date
+	 * @return
+	 */
+	public static Date getFirstDayOfWeek(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setFirstDayOfWeek(Calendar.SUNDAY);
+		calendar.setTime(date);
+		calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek()); // Sunday
+		return calendar.getTime();
+	}
+
+	/**
+	 * 取得当前日期所在周的最后一天
+	 *
+	 * @param date
+	 * @return
+	 */
+	public static Date getLastDayOfWeek(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setFirstDayOfWeek(Calendar.SUNDAY);
+		calendar.setTime(date);
+		calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek() + 6); // Saturday
+		return calendar.getTime();
+	}
+
+	/**
+	 *Nov 14, 2019 4:13:31 PM 格式转换方法
+	 * @return
+	 */
+	public static String  parseDate(String  dates) throws ParseException {
+		SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String newDate = "MMM dd, yyyy hh:mm:ss aa";
+		SimpleDateFormat dateFormat = new SimpleDateFormat(newDate, Locale.ENGLISH);
+		Date formatDate= dateFormat.parse(dates);
+		String hdate = date.format(formatDate);
+		return hdate;
+	}
+
+
+	/**
+	 * 判断传入的时间与type需对应的时间是否匹配
+	 * @param time
+	 * @param type
+	 * @return
+	 */
+	public static Boolean timeMatchType(String time, Integer type){
+		Boolean b = true;
+		if (StringUtils.isNotBlank(time)) {
+			//1.H  2.D  3.W  4.M  5.Q  6.Y  7.A
+			switch (type) {
+				case 1:
+					b = time.matches(YEARTOHOUR_FORMAT_REGEX);
+					break;
+				case 2: case 3: case 7:
+					b = time.matches(DAY_FORMAT_REGEX);
+					break;
+				case 4:
+					b = time.matches(YEARTOMONTH_FORMAT_REGEX);
+					break;
+				case 5:
+					b = time.matches(QUARTER_FORMAT_REGEX);
+					break;
+				case 6:
+					b = time.matches(YEAR_FORMAT_REGEX);
+					break;
+			}
+		}
+		return b;
+	}
+
+	/**
+	 * 解析日期
+	 *
+	 * @param date    日期字符串
+	 * @param pattern 日期格式
+	 * @return
+	 */
+	public static Date parse(String date, String pattern) {
+		if (date == null) {
+			return null;
+		}
+		Date resultDate = null;
+		try {
+			resultDate = new SimpleDateFormat(pattern).parse(date);
+		} catch (ParseException e) {
+
+		}
+		return resultDate;
+	}
+	/**
+	 * 根据日期类型type得到开始时间
+	 * @param starttime
+	 * @param type
+	 * @return
+	 * @author wanghw
+	 */
+	public static String setStarttime(String starttime, int type) {
+		if(StringUtils.isNotBlank(starttime)) {
+			starttime = starttime.replace("-","");
+			if(type==7) {
+				SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
+				Calendar c = Calendar.getInstance();
+				Date date = null;
+				try {
+					date=formatter.parse(starttime);
+				} catch (ParseException e) {
+					e.printStackTrace();
+				}
+				c.setTime(date);
+				//得到前一天日期
+				int day = c.get(Calendar.DATE);
+				c.set(Calendar.DATE, day - 1);
+				starttime = formatter.format(c.getTime());
+			}
+		}
+		return starttime;
+	}
+
+	/**
+	 * 根据日期类型type得到结束时间
+	 * @param endtime
+	 * @param type
+	 * @return
+	 * @author wanghw
+	 */
+	public static String setEndtime(String endtime, int type)  {
+		SimpleDateFormat sdf;
+		Date date=new Date();
+		String time = null ;
+		if(StringUtils.isBlank(endtime)) {
+			//1.H  2.D  3.W  4.M  5.Q  6.Y  7.A
+			switch (type){
+				case 1:
+					sdf = new SimpleDateFormat("yyyyMMddHH");
+					time = sdf.format(date);
+					break;
+				case 2: case 3: case 7:
+					sdf = new SimpleDateFormat("yyyyMMdd");
+					time = sdf.format(date);
+					break;
+				case 4:
+					sdf = new SimpleDateFormat("yyyyMM");
+					time = sdf.format(date);
+					break;
+				case 5:
+					time = getQn();
+					break;
+				case 6:
+					sdf = new SimpleDateFormat("yyyy");
+					time = sdf.format(date);
+					break;
+			}
+		}else {
+			time = endtime.replace("-","");
+			SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
+			if(type==7 && Integer.parseInt(time) > Integer.parseInt(sdf1.format(date))) {
+				time = sdf1.format(date);
+			}
+		}
+
+		return time;
+	}
+	/**
+	 * 得到当前日期所在季度
+	 * @return YYYYQn
+	 * @author wanghw
+	 */
+	/**
+	 * 得到当前日期所在季度
+	 * @return YYYYQn
+	 * @author wanghw
+	 */
+	public static String getQn() {
+		Date dt = new Date();
+		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
+		SimpleDateFormat sdf2 = new SimpleDateFormat("M");
+		String year = sdf1.format(dt);
+		String m = sdf2.format(dt);
+		int Qn = Integer.parseInt(m);
+		String endtime = null;
+		if(1<=Qn && Qn<=3) {
+			endtime = year + "Q1";
+		}else if(4<=Qn && Qn<=6) {
+			endtime = year + "Q2";
+		}else if(7<=Qn && Qn<=9) {
+			endtime = year + "Q3";
+		}else{
+			endtime = year + "Q4";
+		}
+		return endtime;
+	}
+    /**
+     * 获取给定日期yyyyMMdd所在周的周一的日期
+     * @param str
+     * @return
+     * @author wanghw
+     */
+    public static String getMonday(String str) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+        Calendar cal = Calendar.getInstance();
+        Date date = null;
+        try {
+			date = format.parse(str);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        cal.setTime(date);
+        //cal.setFirstDayOfWeek(Calendar.MONDAY);
+        cal.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY);
+        return format.format(cal.getTime());
+    }
+
+	/**
+	 * 获取指定类型时间点时间
+	 * @param dtime
+	 * @param type
+	 * @return
+	 */
+	public static String setDtime(String dtime, int type) {
+        SimpleDateFormat sdf;
+        Date dt = new Date();//yyyy-MM-dd HH:mm:ss
+        if(StringUtils.isBlank(dtime)) {
+            //1.H  2.D  3.W  4.M  5.Q  6.Y  7.A
+            switch (type){
+                case 1:
+                    sdf = new SimpleDateFormat("yyyyMMddHH");
+                    dtime = sdf.format(dt);
+                    break;
+                case 2: case 7:
+                    sdf = new SimpleDateFormat("yyyyMMdd");
+                    dtime = sdf.format(dt);
+                    break;
+				case 3:
+					sdf = new SimpleDateFormat("yyyyMMdd");
+					dtime = getMonday(sdf.format(dt));
+					break;
+				case 4:
+                    sdf = new SimpleDateFormat("yyyyMM");
+                    dtime = sdf.format(dt);
+                    break;
+                case 5:
+                    dtime = getQn();
+                    break;
+				case 6:
+                    sdf = new SimpleDateFormat("yyyy");
+                    dtime = sdf.format(dt);
+                    break;
+            }
+        }else {
+            dtime = dtime.replace("-","");
+        }
+        return dtime;
+    }
+	/**
+	 * 解析日期 yyyy-MM-dd HH:mm:ss 为 Long
+	 *
+	 * @param dateStr
+	 * @return
+	 * @author wanghw
+	 */
+	public static Long format(String dateStr) {
+		Long timestamp = 0L;
+		if (null == dateStr || dateStr.length() < 0) {
+			return timestamp;
+		}
+		try {
+			SimpleDateFormat format = new SimpleDateFormat(FORMAT_TIME);
+			Date date = format.parse(dateStr);
+			timestamp = date.getTime();
+		} catch (Exception e) {
+			// ignore
+		}
+		return timestamp;
+	}
+
+	/**
+	 * @return
+	 * @Author:wangming
+	 * @Description:TODO(字符串时间转时间戳格式)
+	 * @Date 13:59 2019/12/7
+	 * @Param
+	 */
+	public static Long stringDataConvertLong(String stringData) {
+		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+		try {
+			Date parse = simpleDateFormat.parse(stringData);
+			return parse.getTime();
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+	/**
+     * 解析日期 yyyy-MM-dd HH:mm:ss
+     *
+     * @param timestamp
+     * @return
+     */
+    public static String format(Long timestamp) {
+        String dateStr = "";
+        if (null == timestamp || timestamp.longValue() < 0) {
+            return dateStr;
+        }
+        try {
+            Date date = new Date(timestamp);
+            SimpleDateFormat format = new SimpleDateFormat(FORMAT_TIME);
+            dateStr = format.format(date);
+        } catch (Exception e) {
+            // ignore
+        }
+
+        return dateStr;
+    }
+
+	/**
+	 * 解析日期 yyyy-MM-dd
+	 *
+	 * @param timestamp
+	 * @return
+	 */
+	public static String formatYMD(Long timestamp) {
+		String dateStr = "";
+		if (null == timestamp || timestamp.longValue() <= 0) {
+			return dateStr;
+		}
+		try {
+			Date date = new Date(timestamp);
+			SimpleDateFormat format = new SimpleDateFormat(FORMAT_DATE);
+			dateStr = format.format(date);
+		} catch (Exception e) {
+			// ignore
+		}
+
+		return dateStr;
+	}
+	
+	/**
+     * 解析日期 yyyy-MM-dd HH:mm:ss
+     *
+     * @param timestamp
+     * @return
+     */
+    public static String format(Long timestamp, String pattern) {
+        String dateStr = "";
+        if (null == timestamp || timestamp.longValue() < 0) {
+            return dateStr;
+        }
+        try {
+            Date date = new Date(timestamp);
+            SimpleDateFormat format = new SimpleDateFormat(pattern);
+            dateStr = format.format(date);
+        } catch (Exception e) {
+            // ignore
+        }
+
+        return dateStr;
+    }
+    
+    /**
+     * 获取当前时间前几天时间,按指定格式返回
+     *
+     * @param days
+     * @return
+     */
+	public static String forwardDay(Integer days, String format) {
+		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		Date date = new Date();
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		calendar.add(Calendar.DAY_OF_MONTH, -days);
+		date = calendar.getTime();
+		return sdf.format(date);
+	}
+	
+	/**
+     * 获取指定时间前几天时间,按指定格式返回
+     *
+     * @param days
+     * @return
+     * @author wanghw
+     */
+    public static String forwardDay(Integer days, String dates, String format) {
+    	SimpleDateFormat sdf = new SimpleDateFormat(format);
+		Date date = null;
+		try {
+			date = sdf.parse(dates);
+		} catch (ParseException e) {
+			//e.printStackTrace();
+		}
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTime(date);
+		calendar.add(Calendar.DAY_OF_MONTH, -days);
+		date = calendar.getTime();
+		return sdf.format(date);
+    }
+    
+    /**
+	 * 根据开始日期和结束日期,得到之间的每一天,并倒序
+	 * @param startTime
+	 * @param endTime
+	 * @return
+	 */
+	public static List<String> getDescDays(String startTime, String endTime) {
+        // 返回的日期集合
+        List<String> days = new ArrayList<String>();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date start = dateFormat.parse(startTime);
+            Date end = dateFormat.parse(endTime);
+            
+            Calendar tempStart = Calendar.getInstance();
+            tempStart.setTime(start);
+
+            Calendar tempEnd = Calendar.getInstance();
+            tempEnd.setTime(end);
+            tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
+            while (tempStart.before(tempEnd)) {
+                days.add(dateFormat.format(tempStart.getTime()));
+                tempStart.add(Calendar.DAY_OF_YEAR, 1);
+            }
+
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        Collections.reverse(days);
+        return days;
+    }
+
+	/**
+	 * 时间字符串转为时间戳
+	 *
+	 * @param time    时间字符串
+	 * @param pattern 时间格式
+	 * @return
+	 */
+	public static long timeStringToTimestamp(String time, String pattern) {
+		LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern));
+		return localDateTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
+	}
+
+	/**
+	 * 日期字符串转为时间戳
+	 *
+	 * @param date    日期字符串
+	 * @param pattern 日期格式
+	 * @return
+	 */
+	public static long dateStringToTimestamp(String date, String pattern) {
+		LocalDateTime localDateTime = LocalDate.parse(date, DateTimeFormatter.ofPattern(pattern)).atStartOfDay();
+		return localDateTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
+	}
+
+
+	/**
+	 * 时间戳转字符串
+	 *
+	 * @param timestamp 时间戳
+	 * @param pattern   时间格式
+	 * @return
+	 */
+	public static String timestampToTimeString(long timestamp, String pattern) {
+		DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
+		return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()).format(dateTimeFormatter);
+	}
+	
+	/**
+	 * @Author:wangming
+	 * @Description:TODO(获取某个月份第一天开始时间戳)
+	 * @Date 16:44 2020/10/26
+	 * @Param
+	 * @return 
+	 */
+	public static Long getStartTime(String time){
+		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
+		Date date = null;
+		try {
+			date = df.parse(time);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		Calendar c = Calendar.getInstance();
+		c.setTime(date);
+		c.add(Calendar.MONTH, 0); //获取当前月第一天
+		c.set(Calendar.DAY_OF_MONTH, 1); //设置为1号,当前日期既为本月第一天
+		c.set(Calendar.HOUR_OF_DAY, 0); //将小时至0
+		c.set(Calendar.MINUTE, 0); //将分钟至0
+		c.set(Calendar.SECOND,0); //将秒至0
+		c.set(Calendar.MILLISECOND, 0); //将毫秒至0
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String startDate = sdf.format(c.getTime());    //月份开始时间
+		return c.getTimeInMillis();
+	}
+	
+	/**
+	 * @Author:wangming
+	 * @Description:TODO(获取某月最后一天的结束时间戳)
+	 * @Date 16:47 2020/10/26
+	 * @Param
+	 * @return 
+	 */
+	public static Long getEndTime(String time){
+		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
+		Date date = null;
+		try {
+			date = df.parse(time);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		Calendar c2 = Calendar.getInstance();
+		c2.setTime(date);
+		c2.set(Calendar.DAY_OF_MONTH, c2.getActualMaximum(Calendar.DAY_OF_MONTH)); //获取当前月最后一天
+		c2.set(Calendar.HOUR_OF_DAY, 23); //将小时至23
+		c2.set(Calendar.MINUTE, 59); //将分钟至59
+		c2.set(Calendar.SECOND,59); //将秒至59
+		c2.set(Calendar.MILLISECOND, 999); //将毫秒至999
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String endDate = sdf.format(c2.getTime());          //结束时间字符串
+		return c2.getTimeInMillis();
+	}
+	
+	
+    
+}

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/opt/domain/CompanyInfo.java

@@ -1,5 +1,6 @@
 package com.ruoyi.opt.domain;
 
+import lombok.experimental.Accessors;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/opt/service/ICompanyInfoService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.opt.service;
 
 import java.util.List;
+
+import com.ruoyi.common.request.ProcessInfoReq;
 import com.ruoyi.opt.domain.CompanyInfo;
 
 /**
@@ -11,6 +13,15 @@ import com.ruoyi.opt.domain.CompanyInfo;
  */
 public interface ICompanyInfoService 
 {
+
+    /**
+     * 新增企业信息
+     *
+     * @param processInfoReq www订单信息
+     * @return 结果
+     */
+    public void insertCompanyInfoByWww(ProcessInfoReq processInfoReq);
+
     /**
      * 查询企业信息
      * 
@@ -35,6 +46,7 @@ public interface ICompanyInfoService
      */
     public int insertCompanyInfo(CompanyInfo companyInfo);
 
+
     /**
      * 修改企业信息
      * 

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/opt/service/IProcessInfoService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.opt.service;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.opt.domain.ProcessInfo;
 
 /**
@@ -41,7 +43,7 @@ public interface IProcessInfoService
      * @param processInfo 保函订单
      * @return 结果
      */
-    public int updateProcessInfo(ProcessInfo processInfo);
+    public AjaxResult updateProcessInfo(ProcessInfo processInfo);
 
     /**
      * 批量删除保函订单

+ 91 - 0
ruoyi-system/src/main/java/com/ruoyi/opt/service/impl/CompanyInfoServiceImpl.java

@@ -1,13 +1,27 @@
 package com.ruoyi.opt.service.impl;
 
+import java.util.Date;
 import java.util.List;
+
+import com.ruoyi.common.request.ProcessInfoReq;
+import com.ruoyi.common.utils.DateUtil;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.opt.domain.ProcessInfo;
+import com.ruoyi.opt.domain.ProjectInfo;
+import com.ruoyi.opt.mapper.ProcessInfoMapper;
+import com.ruoyi.opt.mapper.ProjectInfoMapper;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.opt.mapper.CompanyInfoMapper;
 import com.ruoyi.opt.domain.CompanyInfo;
 import com.ruoyi.opt.service.ICompanyInfoService;
 import com.ruoyi.common.core.text.Convert;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
 
 /**
  * 企业信息Service业务层处理
@@ -15,11 +29,88 @@ import com.ruoyi.common.core.text.Convert;
  * @author chengpan
  * @date 2022-09-06
  */
+
 @Service
+@EnableTransactionManagement
+@Slf4j
 public class CompanyInfoServiceImpl implements ICompanyInfoService 
 {
     @Autowired
     private CompanyInfoMapper companyInfoMapper;
+    @Autowired
+    private ProcessInfoMapper processInfoMapper;
+    @Autowired
+    private ProjectInfoMapper projectInfoMapper;
+
+
+
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor=Exception.class)
+    public void insertCompanyInfoByWww(ProcessInfoReq processInfoReq) {
+        try {
+            if (!ObjectUtils.isEmpty(processInfoReq)){
+                //开始入库企业信息
+                CompanyInfo companyInfo = new CompanyInfo();
+                companyInfo.setCompanyNm(processInfoReq.getCompanyName());
+                companyInfo.setCompanySocialNo(processInfoReq.getCompanySocialno());
+                companyInfo.setBasicAccountBank(processInfoReq.getBasicAccountBank());
+                companyInfo.setBasicAccountNo(processInfoReq.getBasicAccountNo());
+                companyInfo.setCompanyTp("1");
+                companyInfo.setApplyNm(processInfoReq.getApplyName());
+                companyInfo.setApplyTel(processInfoReq.getApplyTel());
+                companyInfo.setStatus("0");
+                companyInfo.setCreateBy(null);
+                companyInfo.setCreateTime(new Date("yyyy-MM-dd"));
+                companyInfo.setUpdateBy(null);
+                companyInfo.setUpdateTime(new Date("yyyy-MM-dd"));
+                companyInfoMapper.insertCompanyInfo(companyInfo);
+
+                //开始入库项目信息
+                ProjectInfo projectInfo = new ProjectInfo();
+                projectInfo.setProjectCd(processInfoReq.getProjectId());
+                projectInfo.setProjectNm(processInfoReq.getProjectName());
+                projectInfo.setTenderNo(processInfoReq.getTenderNo());
+                projectInfo.setBidOpenTime(processInfoReq.getTenderTime());
+                projectInfo.setBailAmt(processInfoReq.getBailAmt());
+                projectInfo.setTendereeNm(processInfoReq.getTendereeName());
+                projectInfo.setTenderTp("2");
+                projectInfo.setTendererAddress(processInfoReq.getTendererAddress());
+                projectInfo.setTendereeCd(processInfoReq.getTendereeCode());
+                projectInfo.setNoticeSendTime(processInfoReq.getNoticeSendTime());
+                projectInfo.setAreaCd(processInfoReq.getAreaCode());
+                projectInfo.setStatus("0");
+                projectInfo.setCreateBy(null);
+                projectInfo.setCreateTime(new Date("yyyy-MM-dd"));
+                projectInfo.setUpdateBy(null);
+                projectInfo.setUpdateTime(new Date("yyyy-MM-dd"));
+                projectInfoMapper.insertProjectInfo(projectInfo);
+
+                //开始组装数据准备入库
+                ProcessInfo processInfo = new ProcessInfo();
+                processInfo.setProcessId(processInfoReq.getProcessId());
+                processInfo.setProcessStsCd("01");
+                processInfo.setPremiumAmt(processInfoReq.getPremium());
+                processInfo.setLoanAmt(processInfoReq.getLoanAmt());
+                processInfo.setPolicySignUrl(null);
+                processInfo.setPolicyDlUrl(null);
+                processInfo.seteInvoiceUrl(null);
+                processInfo.setProjectId(projectInfo.getProjectId());
+                processInfo.setCompanyId(companyInfo.getCompanyId());
+                processInfo.setExpireTime(Long.valueOf(processInfoReq.getExpireDate()));
+                processInfo.setApprovedTime(new Date("yyyy-MM-dd"));
+                processInfo.setPostscript(null);
+                processInfo.setRejectReason(null);
+                processInfo.setApplyTime(DateUtil.stringToDate(processInfoReq.getApplyTime()));
+                processInfo.setCreateBy(null);
+                processInfo.setUpdateBy(null);
+                processInfo.setUpdateTime(new Date("yyyy-MM-dd"));
+                processInfoMapper.insertProcessInfo(processInfo);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("订单id为:" + processInfoReq.getProcessId() + ",的信息入库失败:" + System.nanoTime());
+        }
+    }
 
     /**
      * 查询企业信息

+ 99 - 3
ruoyi-system/src/main/java/com/ruoyi/opt/service/impl/ProcessInfoServiceImpl.java

@@ -1,13 +1,31 @@
 package com.ruoyi.opt.service.impl;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.json.JSONObject;
+import com.ruoyi.common.request.CheckInformBo;
+import com.ruoyi.common.request.PayInfomBo;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.opt.domain.CompanyInfo;
+import com.ruoyi.opt.mapper.CompanyInfoMapper;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.ruoyi.opt.mapper.ProcessInfoMapper;
 import com.ruoyi.opt.domain.ProcessInfo;
 import com.ruoyi.opt.service.IProcessInfoService;
 import com.ruoyi.common.core.text.Convert;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
 
 /**
  * 保函订单Service业务层处理
@@ -16,10 +34,20 @@ import com.ruoyi.common.core.text.Convert;
  * @date 2022-09-06
  */
 @Service
+@EnableTransactionManagement
+@Slf4j
 public class ProcessInfoServiceImpl implements IProcessInfoService 
 {
     @Autowired
     private ProcessInfoMapper processInfoMapper;
+    @Autowired
+    private CompanyInfoMapper companyInfoMapper;
+    //审核通知接口
+    @Value("checkUrl")
+    private String checklUrl;
+    //支付通知接口
+    @Value("payUrl")
+    private String payUrl;
 
     /**
      * 查询保函订单
@@ -64,10 +92,78 @@ public class ProcessInfoServiceImpl implements IProcessInfoService
      * @return 结果
      */
     @Override
-    public int updateProcessInfo(ProcessInfo processInfo)
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor=Exception.class)
+    public AjaxResult updateProcessInfo(ProcessInfo processInfo)
     {
-        processInfo.setUpdateTime(DateUtils.getNowDate());
-        return processInfoMapper.updateProcessInfo(processInfo);
+        try {
+            String status = processInfo.getProcessStsCd();
+            CompanyInfo companyInfo = companyInfoMapper.selectCompanyInfoByCompanyId(processInfo.getCompanyId());
+            processInfo.setUpdateTime(DateUtils.getNowDate());
+            //判断是什么操作,如果是02 03表示是审核操作   05表示已支付操作
+            if ("02".equals(status) || "03".equals(status)){
+                //审核操作,先组装参数
+                CheckInformBo checkInformBo = new CheckInformBo();
+                if ("02".equals(status)){   //审核通过
+                    checkInformBo.setCode("01");
+                } else {   //审核不通过
+                    checkInformBo.setCode("02");
+                    checkInformBo.setMessage(processInfo.getRejectReason());   //拒绝原因
+                }
+                checkInformBo.setProcessId(processInfo.getProcessId());
+                checkInformBo.setApplyPolicyNo(null);    //投保单号
+                checkInformBo.setPremium(processInfo.getPremiumAmt());    //保费
+                checkInformBo.setTotalAmt(processInfo.getLoanAmt());       //保额
+                //开户行
+                if (!ObjectUtils.isEmpty(companyInfo)){
+                    checkInformBo.setSkKHH(companyInfo.getBasicAccountBank());    //收款开户行
+                    checkInformBo.setSkAccount(companyInfo.getBasicAccountNo());   //收款账号
+                }
+                checkInformBo.setPostscript(processInfo.getPostscript());
+                String checkJsonString = JSONObject.valueAsStr(checkInformBo);
+                //http请求调用
+                String checkResult = HttpUtils.sendPost(checklUrl, checkJsonString);
+                //解析json结果
+                Map<String, Object> resultMap = JSON.parseObject(checkResult, Map.class);
+                if ("0000".equals(resultMap.get("code").toString())){
+                    int i = processInfoMapper.updateProcessInfo(processInfo);
+                    return AjaxResult.success();
+                } else {
+                    return AjaxResult.error(resultMap.get("message").toString());
+                }
+            } else if ("05".equals(processInfo.getProcessStsCd())){
+                //已支付操作   开始组装参数
+                PayInfomBo payInfomBo = new PayInfomBo();
+                payInfomBo.setProcessId(processInfo.getProcessId());
+                payInfomBo.setApplyPolicyNo(null);    //投保单号
+                if (!ObjectUtils.isEmpty(companyInfo)){
+                    payInfomBo.setCompanyName(companyInfo.getCompanyNm());
+                    payInfomBo.setCompanySocialNo(companyInfo.getCompanySocialNo());
+                    payInfomBo.setPayAccountName(null);
+                    payInfomBo.setPayBank(companyInfo.getBasicAccountBank());
+                    payInfomBo.setPayAccount(companyInfo.getBasicAccountNo());
+                }
+                payInfomBo.setCost(null);
+                String payJsonString = JSONObject.valueAsStr(payInfomBo);
+                //http请求调用
+                String payResult = HttpUtils.sendPost(payUrl, payJsonString);
+                //解析json结果
+                Map<String, Object> resultMap = JSON.parseObject(payResult, Map.class);
+                if ("0000".equals(resultMap.get("code").toString())){
+                    //成功
+                    int i = processInfoMapper.updateProcessInfo(processInfo);
+                    return AjaxResult.success();
+                } else {
+                    return AjaxResult.error(resultMap.get("message").toString());
+                }
+            } else {
+                int i = processInfoMapper.updateProcessInfo(processInfo);
+                return AjaxResult.success();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("修改错误,订单号为:" + processInfo.getProcessId());
+            return AjaxResult.error("订单修改失败,未知错误,请联系相关人员!");
+        }
     }
 
     /**

+ 5 - 0
ruoyi-system/src/main/resources/mapper/opt/ProjectInfoMapper.xml

@@ -52,6 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertProjectInfo" parameterType="ProjectInfo" useGeneratedKeys="true" keyProperty="projectId">
+        <selectKey keyProperty="projectId" order="AFTER" resultType="java.lang.Long" >
+            SELECT LAST_INSERT_ID();
+        </selectKey>
         insert into t_project_info
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="projectCd != null">project_cd,</if>
@@ -70,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            project_Id
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="projectCd != null">#{projectCd},</if>
@@ -88,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            #{projectId}
          </trim>
     </insert>