diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/controller/InvoiceReceiveController.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/controller/InvoiceReceiveController.java index fc2c1733..4a3afbd9 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/controller/InvoiceReceiveController.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/controller/InvoiceReceiveController.java @@ -8,9 +8,12 @@ import com.alibaba.fastjson.JSON; import com.alibaba.nacos.client.naming.utils.CollectionUtils; import com.dxhy.order.baseservice.constant.OrderEnum; import com.dxhy.order.constant.*; +import com.dxhy.order.consumer.modules.manager.model.PushTicketModel; import com.dxhy.order.consumer.modules.manager.model.dto.ManualPushInvoiceDTO; +import com.dxhy.order.consumer.modules.ticketpool.service.PushTicketPoolService; import com.dxhy.order.consumer.openapi.protocol.v4.order.*; import com.dxhy.order.consumer.openapi.protocol.v6.order.*; +import com.dxhy.order.consumer.utils.DateUtils; import com.dxhy.order.exception.OrderReceiveException; import com.dxhy.order.model.*; import com.dxhy.order.model.newsk.invoiceissue.*; @@ -93,6 +96,9 @@ public class InvoiceReceiveController { @Resource private SimsBackService simsBackService; + @Resource + private PushTicketPoolService pushTicketPoolService; + /** * 接收底层发票推送的接口 */ @@ -498,6 +504,73 @@ public class InvoiceReceiveController { } } + + /** + * 发票手动回推企业 + */ + @ApiOperation(value = "批量推送票池", notes = "开票结果接收-推送票池") + @PostMapping("/batchPushInvoice") + @SysLog(operation = "手动推送发票数据", operationDesc = "手动推送发票数据", key = "推送发票") + public R batchPushInvoice( @ApiParam(name = "pushTicketModel", value = "推送票池实体", required = true) @RequestBody PushTicketModel pushTicketModel) { + R r; + try { + if (pushTicketModel == null || StringUtils.isBlank(pushTicketModel.getPushType())) { + return R.error(OrderInfoContentEnum.INVOICE_PARAM_ERROR); + } + + if (pushTicketModel.getPushType().equals("1")){ + //按照发票号码和发票代码进行推送 + + if (StringUtils.isBlank(pushTicketModel.getFpdm())){ + R.error("发票代码不能为空"); + } + + if (StringUtils.isBlank(pushTicketModel.getFphm())){ + R.error("发票号码不能为空"); + } + + if (StringUtils.isBlank(pushTicketModel.getNsrsbh())){ + R.error("纳税人识别号不能为空"); + } + + + return pushTicketPoolService.pushTicketPool(pushTicketModel.getFpdm(), pushTicketModel.getFphm(), pushTicketModel.getNsrsbh()); + + }else if (pushTicketModel.getPushType().equals("2")){ + + if (StringUtils.isBlank(pushTicketModel.getStartTime())){ + R.error("开始时间不能为空"); + } + + if (StringUtils.isBlank(pushTicketModel.getEndTime())){ + R.error("结束时间不能为空"); + } + + String startTime = DateUtils.getMorning(DateUtils.strToDate(pushTicketModel.getStartTime())); + + String endTime = DateUtils.getNight(DateUtils.strToDate(pushTicketModel.getEndTime())); + + List invoiceInfos = orderInvoiceInfoService.selectOrderInvoiceInfoByTime(startTime, endTime); + + if (invoiceInfos != null && invoiceInfos.size() > 0){ + + for (OrderInvoiceInfo invoiceInfo : invoiceInfos) { + pushTicketPoolService.pushTicketPool(invoiceInfo.getFpdm(), invoiceInfo.getFphm(), invoiceInfo.getXhfNsrsbh()); + } + } + return R.ok(); + + } + + return R.error("不存在的推送方式"); + + + } catch (Exception e) { + log.error("{}批量推送票池:{}", LOGGER_MSG, e); + return R.error(); + } + } + private List convetDdfpzxxBO(List qdInvoicePushBackRequestList){ List ddfpzxxList = new ArrayList<>(qdInvoicePushBackRequestList.size()); qdInvoicePushBackRequestList.forEach(invoiceIssueRequest -> { diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/model/PushTicketModel.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/model/PushTicketModel.java new file mode 100644 index 00000000..1e6fc65e --- /dev/null +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/model/PushTicketModel.java @@ -0,0 +1,14 @@ +package com.dxhy.order.consumer.modules.manager.model; + +import lombok.Data; + +@Data +public class PushTicketModel { + private String nsrsbh; + private String fpdm; + private String fphm; + private String fpqqlsh; + private String pushType; + private String endTime; + private String startTime; +} diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java index 87e9523a..925d5dd4 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java @@ -246,6 +246,13 @@ public class PushInvoiceServiceImpl implements PushInvoiceService { try { if (StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFphm())) { pushTicketPoolService.pushTicketPool(commonTsMqData.getFpTsMqData().getFpdm(), commonTsMqData.getFpTsMqData().getFphm(), commonTsMqData.getNsrsbh()); + }else { + if (StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFpqqlsh())){ + OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpqqlsh(commonTsMqData.getFpTsMqData().getFpqqlsh(), shList); + if (StringUtils.isNotBlank(orderInvoiceInfo.getFphm())){ + pushTicketPoolService.pushTicketPool(orderInvoiceInfo.getFpdm(), orderInvoiceInfo.getFphm(), commonTsMqData.getNsrsbh()); + } + } } } catch (Exception e) { diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/utils/DateUtils.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/utils/DateUtils.java new file mode 100644 index 00000000..83e745cb --- /dev/null +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/utils/DateUtils.java @@ -0,0 +1,866 @@ +package com.dxhy.order.consumer.utils; + +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @author jiaohongyang + */ +@SuppressWarnings({"AlibabaLowerCamelCaseVariableNaming", "AlibabaUndefineMagicConstant"}) +public class DateUtils { + + public static final String YYYYMMDD = "yyyyMMdd"; + + /** + * 获取现在时间,这个好用 + * + * 返回长时间格式 yyyy-MM-dd HH:mm:ss + */ + public static Date getSqlDate() { + return new java.sql.Date(System.currentTimeMillis()); + } + + /** + * 获取现在时间 + * + * 返回长时间格式 yyyy-MM-dd HH:mm:ss + */ + public static Date getSqlDateLong() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(0); + return formatter.parse(dateString, pos); + } + + /** + * 获取现在时间 + * + * 返回长时间格式 yyyy-MM-dd HH:mm:ss + */ + public static Date getNowDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + return formatter.parse(dateString, pos); + } + + /** + * 获取现在时间 + * + * 返回短时间格式 yyyy-MM-dd + */ + public static Date getNowDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + return formatter.parse(dateString, pos); + } + + /** + * 获取现在时间 + * + * 返回字符串格式 yyyy-MM-dd HH:mm:ss + */ + public static String getStringDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return formatter.format(currentTime); + } + + /** + * 获取现在时间 + * + * 返回短时间字符串格式yyyy-MM-dd + */ + public static String getStringDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + return formatter.format(currentTime); + } + + /** + * 获取时间 小时:分;秒 HH:mm:ss + * + * + */ + public static String getTimeShort() { + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); + Date currentTime = new Date(); + return formatter.format(currentTime); + } + + /** + * 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss + * + * @param strDate + * 日期 + * + */ + public static Date strToDateLong(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + return formatter.parse(strDate, pos); + } + + /** + * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss + * + * @param dateDate + * 日期 + * + */ + public static String dateToStrLong(Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return formatter.format(dateDate); + } + + /** + * 将短时间格式时间转换为字符串 yyyy-MM-dd + * + * @param dateDate + * 日期 + * + */ + public static String dateToStr(Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + return formatter.format(dateDate); + } + + public static String dateToStr(Date dateDate, String format) { + SimpleDateFormat formatter = new SimpleDateFormat(format); + return formatter.format(dateDate); + } + + /** + * 日期格式化到月份 + * + * @param dateDate + * 日期 + * + */ + public static String dateToMonthStr(Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); + return formatter.format(dateDate); + } + + /** + * 将短时间格式字符串转换为时间 yyyy-MM-dd + * + * @param strDate + * 日期 + * + */ + public static Date strToDate(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + return formatter.parse(strDate, pos); + } + + /** + * @param strDate + * 日期 + * + */ + public static Date strToDateChina(String strDate) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); + ParsePosition pos = new ParsePosition(0); + return sdf.parse(strDate, pos); + } + + /** + * 得到现在时间 + * + * + */ + public static Date getNow() { + return new Date(); + } + + /** + * 提取一个月中的最后一天 + * + * @param day + * 日期 + * + */ + public static Date getLastDate(long day) { + Date date = new Date(); + long date3Hm = date.getTime() - 3600000 * 34 * day; + return new Date(date3Hm); + } + + /** + * 得到现在时间 + * + * 字符串 yyyyMMdd HHmmss + */ + public static String getStringToday() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss"); + return formatter.format(currentTime); + } + + /** + * 得到现在小时 + */ + public static String getHour() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String hour; + hour = dateString.substring(11, 13); + return hour; + } + + /** + * 得到现在分钟 + * + * + */ + public static String getTime() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String min; + min = dateString.substring(14, 16); + return min; + } + + /** + * 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。 + * + * @param sformat + * yyyyMMddhhmmss + * + */ + public static String getUserDate(String sformat) { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat(sformat); + return formatter.format(currentTime); + } + + /** + * 二个小时时间间的差值,必须保证二个时间都是"HH:MM"的格式,返回字符型的分钟 + */ + public static String getTwoHour(String st1, String st2) { + String[] kk; + String[] jj; + kk = st1.split(":"); + jj = st2.split(":"); + if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) { + return "0"; + } else { + double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60; + double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60; + if ((y - u) > 0) { + return y - u + ""; + } else { + return "0"; + } + } + } + + /** + * 得到二个日期间的间隔天数 + */ + public static String getTwoDay(String sj1, String sj2) { + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + long day; + try { + Date date = myFormatter.parse(sj1); + Date mydate = myFormatter.parse(sj2); + day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + } catch (Exception e) { + return ""; + } + return day + ""; + } + + /** + * 时间前推或后推分钟,其中JJ表示分钟. + */ + public static String getPreTime(String sj1, String jj) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String mydate1 = ""; + try { + Date date1 = format.parse(sj1); + long time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60; + date1.setTime(time * 1000); + mydate1 = format.format(date1); + } catch (Exception ignored) { + } + return mydate1; + } + + /** + * 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数 + * + * @param nowdate + * 日期 + * @param delay + * 日期 + */ + public static String getNextDay(String nowdate, String delay) { + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String mdate; + Date d = strToDate(nowdate); + long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60; + d.setTime(myTime * 1000); + mdate = format.format(d); + return mdate; + } catch (Exception e) { + return ""; + } + } + + /** + * 判断是否润年 详细设计: 1.被400整除是闰年,否则: 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年 3.能被4整除同时能被100整除则不是闰年 + * + * @param ddate + * 日期 + * + */ + public static boolean isLeapYear(String ddate) { + + Date d = strToDate(ddate); + GregorianCalendar gc = (GregorianCalendar)Calendar.getInstance(); + gc.setTime(d); + int year = gc.get(Calendar.YEAR); + if ((year % 400) == 0) { + return true; + } else if ((year % 4) == 0) { + return (year % 100) != 0; + } else { + return false; + } + } + + /** + * 返回美国时间格式 26 Apr 2006 + * + * @param str + * 日期 + * + */ + public static String getEDate(String str) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(str, pos); + String j = strtodate.toString(); + String[] k = j.split(" "); + return k[2] + k[1].toUpperCase() + k[5].substring(2, 4); + } + + /** + * 获取一个月的最后一天 + * + * @param dat + * 日期 + * + */ + public static String getEndDateOfMonth(String dat) { + String str = dat.substring(0, 8); + String month = dat.substring(5, 7); + int mon = Integer.parseInt(month); + if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { + str += "31"; + } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { + str += "30"; + } else { + if (isLeapYear(dat)) { + str += "29"; + } else { + str += "28"; + } + } + return str; + } + + /** + * 判断二个时间是否在同一个周 + * + * @param date1 + * 日期 + * @param date2 + * 日期 + * + */ + public static boolean isSameWeekDates(Date date1, Date date2) { + Calendar cal1 = Calendar.getInstance(); + Calendar cal2 = Calendar.getInstance(); + cal1.setTime(date1); + cal2.setTime(date2); + int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR); + if (0 == subYear) { + return cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR); + } else if (1 == subYear && Calendar.DECEMBER == cal2.get(Calendar.MONTH)) { + // 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周 + return cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR); + } else if (-1 == subYear && Calendar.DECEMBER == cal1.get(Calendar.MONTH)) { + return cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR); + } + return false; + } + + /** + * 产生周序列,即得到当前时间所在的年度是第几周 + * + * + */ + public static String getSeqWeek() { + Calendar c = Calendar.getInstance(Locale.CHINA); + String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR)); + if (week.length() == 1) { + week = "0" + week; + } + String year = Integer.toString(c.get(Calendar.YEAR)); + return year + week; + } + + /** + * 获得一个日期所在的周的星期几的日期,如要找出2002年2月3日所在周的星期一是几号 + * + * @param sdate + * 日期 + * @param num + * 星期 + * + */ + public static String getWeek(String sdate, String num) { + // 再转换为时间 + Date dd = strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(dd); + // 返回星期一所在的日期 + if ("1".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + // 返回星期二所在的日期 + } else if ("2".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); + } else if ("3".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); + } else if ("4".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); + } else if ("5".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); + } else if ("6".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); + } else if ("0".equals(num)) { + c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + } + return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); + } + + /** + * 根据一个日期,返回是星期几的字符串 + * + * @param sdate + * 日期 + * + */ + public static String getWeek(String sdate) { + // 再转换为时间 + Date date = strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + // hour中存的就是星期几了,其范围 1~7 + return new SimpleDateFormat("EEEE").format(c.getTime()); + } + + public static String getWeekStr(String sdate) { + String str; + str = getWeek(sdate); + switch (str) { + case "1": + str = "星期日"; + break; + case "2": + str = "星期一"; + break; + case "3": + str = "星期二"; + break; + case "4": + str = "星期三"; + break; + case "5": + str = "星期四"; + break; + case "6": + str = "星期五"; + break; + case "7": + str = "星期六"; + break; + default: + break; + } + return str; + } + + /** + * 两个时间之间的天数 + * + * @param date1 + * 日期 + * @param date2 + * 日期 + * + */ + public static long getDays(String date1, String date2) { + if (date1 == null || "".equals(date1)) { + return 0; + } + if (date2 == null || "".equals(date2)) { + return 0; + } + // 转换为标准时间 + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + Date mydate = null; + try { + date = myFormatter.parse(date1); + mydate = myFormatter.parse(date2); + } catch (Exception ignored) { + } + assert mydate != null; + return (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + } + + /** + * 形成如下的日历 , 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间 此函数返回该日历第一行星期日所在的日期 + * + * @param sdate + * 日期 + * + */ + public static String getNowMonth(String sdate) { + // 取该时间所在月的一号 + sdate = sdate.substring(0, 8) + "01"; + // 得到这个月的1号是星期几 + Date date = strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + int u = c.get(Calendar.DAY_OF_WEEK); + return getNextDay(sdate, (1 - u) + ""); + } + + /** + * 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数 + * + * @param k + * 表示是取几位随机数,可以自己定 + */ + public static String getNo(int k) { + return getUserDate("yyyyMMddhhmmss") + getRandom(k); + } + + /** + * 返回一个随机数 + * + * @param i + * 随机数 + * + */ + public static String getRandom(int i) { + Random jjj = new Random(); + if (i == 0) { + return ""; + } + StringBuilder jj = new StringBuilder(); + for (int k = 0; k < i; k++) { + jj.append(jjj.nextInt(9)); + } + return jj.toString(); + } + + /** + * @param date + * 日期 + */ + public static boolean RightDate(String date) { + SimpleDateFormat sdf;; + if (date == null) { + return true; + } + if (date.length() > 10) { + sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } else { + sdf = new SimpleDateFormat("yyyy-MM-dd"); + } + try { + sdf.parse(date); + } catch (ParseException pe) { + return true; + } + return false; + } + + /** + * //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4 + * 以缩写不带其它符号形式返回 // 5 以点号.返回 + */ + public static String getStringDateMonth(String sdate, String nd, String yf, String rq, String format) { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + // 年份 + String s_nd = dateString.substring(0, 4); + // 月份 + String s_yf = dateString.substring(5, 7); + // 日期 + String s_rq = dateString.substring(8, 10); + String sreturn = ""; + // 处理空值情况 + if (sdate == null || "".equals(sdate) || RightDate(sdate)) { + if ("1".equals(nd)) { + sreturn = s_nd; + // 处理间隔符 + if ("1".equals(format)) { + sreturn = sreturn + "年"; + } else if ("2".equals(format)) { + sreturn = sreturn + "-"; + } else if ("3".equals(format)) { + sreturn = sreturn + "/"; + } else if ("5".equals(format)) { + sreturn = sreturn + "."; + } + } + // 处理月份 + if ("1".equals(yf)) { + sreturn = sreturn + s_yf; + if ("1".equals(format)) { + sreturn = sreturn + "月"; + } else if ("2".equals(format)) { + sreturn = sreturn + "-"; + } else if ("3".equals(format)) { + sreturn = sreturn + "/"; + } else if ("5".equals(format)) { + sreturn = sreturn + "."; + } + } + // 处理日期 + if ("1".equals(rq)) { + sreturn = sreturn + s_rq; + if ("1".equals(format)) { + sreturn = sreturn + "日"; + } + } + } else { + // 不是空值,也是一个合法的日期值,则先将其转换为标准的时间格式 + // 年份 + s_nd = sdate.substring(0, 4); + // 月份 + s_yf = sdate.substring(5, 7); + // 日期 + s_rq = sdate.substring(8, 10); + if ("1".equals(nd)) { + sreturn = s_nd; + // 处理间隔符 + if ("1".equals(format)) { + sreturn = sreturn + "年"; + } else if ("2".equals(format)) { + sreturn = sreturn + "-"; + } else if ("3".equals(format)) { + sreturn = sreturn + "/"; + } else if ("5".equals(format)) { + sreturn = sreturn + "."; + } + } + // 处理月份 + if ("1".equals(yf)) { + sreturn = sreturn + s_yf; + if ("1".equals(format)) { + sreturn = sreturn + "月"; + } else if ("2".equals(format)) { + sreturn = sreturn + "-"; + } else if ("3".equals(format)) { + sreturn = sreturn + "/"; + } else if ("5".equals(format)) { + sreturn = sreturn + "."; + } + } + // 处理日期 + if ("1".equals(rq)) { + sreturn = sreturn + s_rq; + if ("1".equals(format)) { + sreturn = sreturn + "日"; + } + } + } + return sreturn; + } + + public static String getNextMonthDay(String sdate, int m) { + sdate = getOKDate(sdate); + int year = Integer.parseInt(sdate.substring(0, 4)); + int month = Integer.parseInt(sdate.substring(5, 7)); + month = month + m; + if (month < 0) { + month = month + 12; + year = year - 1; + } else if (month > 12) { + month = month - 12; + year = year + 1; + } + String smonth = ""; + if (month < 10) { + smonth = "0" + month; + } else { + smonth = "" + month; + } + return year + "-" + smonth + "-10"; + } + + public static String getOKDate(String sdate) { + if (sdate == null || "".equals(sdate)) { + return getStringDateShort(); + } + if (RightDate(sdate)) { + sdate = getStringDateShort(); + } + // 将“/”转换为“-” + sdate = sdate.replace("/", "-"); + // 如果只有8位长度,则要进行转换 + if (sdate.length() == 8) { + sdate = sdate.substring(0, 4) + "-" + sdate.substring(4, 6) + "-" + sdate.substring(6, 8); + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(sdate, pos); + return formatter.format(strtodate); + } + + /** + * 获取某年第一天日期 + * + * @param year + * 年份 Date + */ + public static Date getYearFirst(int year) { + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(Calendar.YEAR, year); + return calendar.getTime(); + } + + /** + * 获取某年最后一天日期 + * + * @param year + * 年份 Date + */ + public static Date getYearLast(int year) { + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(Calendar.YEAR, year); + calendar.roll(Calendar.DAY_OF_YEAR, -1); + + return calendar.getTime(); + } + + /** + * 将短时间格式时间转换为字符串 yyyy-MM-dd + * + * + */ + public static String getNowYyyyMmDd() { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); + return formatter.format(new Date()); + } + + /** + * 格式化时间为 yyyy-MM-dd 00:00:00 + * + * + * @throws ParseException + */ + public static String getMorning(Date date) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + return dateFormat.format(calendar.getTime()); + } + + /** + * 格式化时间为 yyyy-MM-dd 23:59:59 + * + * @param date + * + */ + public static String getNight(Date date) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + return dateFormat.format(calendar.getTime()); + } + + /** + * 属期相关日期没- + * + * @param strDate + * + */ + public static Date strToDatePeriod(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); + ParsePosition pos = new ParsePosition(0); + return formatter.parse(strDate, pos); + } + + /** + * yyyyMMdd ת yyyy-MM-dd + * + * @param strDate + * + */ + public static String strToStrDate(String strDate) { + String strtostr = ""; + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat formatter2 = new SimpleDateFormat("yyyyMMdd"); + Date date = formatter2.parse(strDate); + strtostr = formatter.format(date); + } catch (ParseException e) { + e.printStackTrace(); + } + return strtostr; + } + + /** + * yyyy-MM-dd ת yyyyMMdd + * + * @param strDate + * + */ + public static String strToStrDate2(String strDate) { + String strtostr = ""; + try { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat formatter2 = new SimpleDateFormat("yyyyMMdd"); + Date date = formatter.parse(strDate); + strtostr = formatter2.format(date); + } catch (ParseException e) { + e.printStackTrace(); + } + return strtostr; + } + + public static String getNowTimeStamp() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + return formatter.format(currentTime); + } + +} diff --git a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderInvoiceInfoMapper.java b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderInvoiceInfoMapper.java index 46907136..d5e1f6d5 100644 --- a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderInvoiceInfoMapper.java +++ b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderInvoiceInfoMapper.java @@ -276,4 +276,6 @@ public interface OrderInvoiceInfoMapper { * @return : int */ int updateOrderInvoiceInfoById(@Param("orderInvoiceInfo") OrderInvoiceInfo orderInvoiceInfo); + + List selectOrderInvoiceInfoByTime(@Param("startTime") String startTime, @Param("endTime") String endTime); } diff --git a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/OrderInvoiceInfoService.java b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/OrderInvoiceInfoService.java index b8abc685..efab7515 100644 --- a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/OrderInvoiceInfoService.java +++ b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/OrderInvoiceInfoService.java @@ -292,6 +292,7 @@ public interface OrderInvoiceInfoService { R stageRedInvoiceData(RedInvoiceStageReqPo redInvoiceSaveReqPo); + List selectOrderInvoiceInfoByTime(String startTime, String endTime); /** diff --git a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/impl/OrderInvoiceInfoServiceImpl.java b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/impl/OrderInvoiceInfoServiceImpl.java index d025259b..146f004f 100644 --- a/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/impl/OrderInvoiceInfoServiceImpl.java +++ b/order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/impl/OrderInvoiceInfoServiceImpl.java @@ -1776,6 +1776,11 @@ public class OrderInvoiceInfoServiceImpl implements OrderInvoiceInfoService { return R.ok(); } + @Override + public List selectOrderInvoiceInfoByTime(String startTime, String endTime) { + return orderInvoiceInfoMapper.selectOrderInvoiceInfoByTime(startTime,endTime); + } + public boolean getBzhStatus(String bzdh,String clint){ //拼凑报文 IsInput isInput = new IsInput(); diff --git a/order-management-invoice/src/main/resources/mybatis/mapper/OrderInvoiceInfoMapper.xml b/order-management-invoice/src/main/resources/mybatis/mapper/OrderInvoiceInfoMapper.xml index 80bc177a..5595dce3 100644 --- a/order-management-invoice/src/main/resources/mybatis/mapper/OrderInvoiceInfoMapper.xml +++ b/order-management-invoice/src/main/resources/mybatis/mapper/OrderInvoiceInfoMapper.xml @@ -2381,4 +2381,16 @@ order_invoice_info where order_info_id=#{orderInfoId} + + + + + + + +