Commit b2eded42 authored by kang.nie@inzymeits.com's avatar kang.nie@inzymeits.com
Browse files

初始化代码

parent 12156d65
Pipeline #3109 failed with stages
in 0 seconds
package com.cusc.nirvana.user.rnr.mg.dto;
import com.cusc.nirvana.user.rnr.mg.common.BaseRnrMgPageDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 消息模板配置(RnrNoticeTemplateConfig)传输对象类
*
* @author yuy336
* @since 2022-06-01 11:05:30
*/
@ApiModel(value = "消息模板配置", description = "消息模板配置")
@Data
public class RnrNoticeTemplateConfigDTO extends BaseRnrMgPageDTO {
private static final long serialVersionUID = 733623188788035690L;
@ApiModelProperty(value = "业务类型:1 实名, 2 解绑, 3 换件, 4 信息变更,5 重绑")
private Integer rnrBizzType;
@ApiModelProperty(value = "通知方式:短信、邮箱、webhook")
private Integer noticeWay;
@ApiModelProperty(value = "标签code")
private String tagcode;
@ApiModelProperty(value = "模板编号")
private String templateCode;
@ApiModelProperty(value = "模板内容")
private String templateContent;
@ApiModelProperty(value = "语言版本")
private String lang;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "租户编号")
private String tenantNo;
@ApiModelProperty(value = "最后一次操作人")
private String operator;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import com.cusc.nirvana.user.rnr.mg.common.BaseRnrMgPageDTO;
import com.cusc.nirvana.user.rnr.mg.constants.RnrResponseCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 实名工单信息(MgRnrOrder)传输对象类
*
* @author yuy336
* @since 2022-01-26 13:38:31
*/
@ApiModel(value = "实名工单信息", description = "实名工单信息")
@Data
public class RnrOrderDTO extends BaseRnrMgPageDTO {
private static final long serialVersionUID = 191679603133132959L;
private static final String ORDER_TYPE_ERROR = RnrResponseCode.CERT_TYPE_ERROR.getDescription();
@ApiModelProperty(value = "业务主键")
private String uuid;
@ApiModelProperty(value = "应用id")
private String applicationId;
@ApiModelProperty(value = "审核用户id")
private String userId;
@ApiModelProperty(value = "工单类型")
// @NotNull(groups = SaveRelation.class, message = "工单类型不能为空")
// @EnumValue(groups = SaveRelation.class, message = "工单类型错误", intValues = {0, 1, 2, 3, 4, 5, 6, 7})
private Integer orderType;
@ApiModelProperty(value = "实名id")
// @NotBlank(groups = SaveRelation.class, message = "实名id不能为空")
private String rnrId;
@ApiModelProperty(value = "审核类型,0为自动,1为手动")
// @NotNull(groups = SaveRelation.class, message = "审核类型不能为空")
private Integer auditType;
@ApiModelProperty(value = "工单来源")
// @NotBlank(groups = SaveRelation.class, message = "工单来源不能为空")
private String orderSource;
@ApiModelProperty(value = "工单状态 0 已提交 ,待确认,1 待分派/认领,2 待审核,3 审核通过,4 未通过,9 系统审核不通过; 具体枚举值参考:OrderStatus")
// @NotNull(groups = SaveRelation.class, message = "工单状态不能为空")
// @EnumValue(groups = SaveRelation.class, message = "工单状态错误", intValues = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9})
private Integer orderStatus;
@ApiModelProperty(value = "是否批量订单,参考枚举:ORDER_BATCH。0 不是,1是")
private Integer isBatchOrder;
@ApiModelProperty(value = "三方系统流水号")
// @NotBlank(groups = SaveRelation.class, message = "三方系统流水号不能为空")
private String serialNumber;
@ApiModelProperty(value = "审批编号,工单系统流水号")
// @NotBlank(groups = SaveRelation.class, message = "审批编号不能为空")
private String approvalNo;
@ApiModelProperty(value = "分派时间")
private Date allocateTime;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
@ApiModelProperty(value = "最终审批时间")
private Date finalApproveTime;
@ApiModelProperty(value = "更新码")
private Integer updatedCode;
@ApiModelProperty(value = "评审意见")
private String verifyComments;
@ApiModelProperty(value = "备注信息")
private String comment;
@ApiModelProperty(value = "业务区分")
private String channelId;
@ApiModelProperty(value = "租户编号")
private String tenantNo;
@ApiModelProperty(value = "分表路由键")
private Long routingKey;
@ApiModelProperty(value = "最后一次操作人")
private String operator;
@ApiModelProperty(value = "是否是自动实名")
private boolean autoRnr;
@ApiModelProperty(value = "订单延迟配置")
private String orderDelay;
@ApiModelProperty(value = "老状态")
private Integer oldOrderStatus;
@ApiModelProperty(value = "是否发送工单系统")
private Boolean sendWorkOrder;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "业务类型:1 实名, 2 解绑, 3 换件, 4 信息变更,5 重绑")
private Integer rnrBizzType;
@ApiModelProperty("创建时间查询开始")
private Date createTimeQueryStart;
@ApiModelProperty("创建时间查询结束")
private Date createTimeQueryEnd;
private List<String> uuidList;
private List<String> rnrIdList;
/**
* 审核人
*/
private String reviewUserId;
/**
* 组织id集合
*/
private List<String> orgIdList;
/**
* 订单状态集合
*/
private List<Integer> orderStatusList;
/**
* 订单类型集合
*/
private List<Integer> orderTypeList;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import com.cusc.nirvana.user.rnr.mg.common.BaseRnrMgPageDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 实名工单操作日志(MgRnrOrderOperationLog)传输对象类
*
* @author yuy336
* @since 2022-03-04 10:07:42
*/
@ApiModel(value = "实名工单操作日志", description = "实名工单操作日志")
@Data
public class RnrOrderOperationLogDTO extends BaseRnrMgPageDTO {
private static final long serialVersionUID = -50160020144957830L;
@ApiModelProperty(value = "业务主键")
private String uuid;
@ApiModelProperty(value = "工单uuid")
private String orderId;
@ApiModelProperty(value = "实名id")
private String rnrId;
@ApiModelProperty(value = "操作类型")
private Integer optType;
@ApiModelProperty(value = "租户编号")
private String tenantNo;
@ApiModelProperty(value = "更新内容")
private String updatedContent;
@ApiModelProperty(value = "操作时间")
private Date optTime;
@ApiModelProperty(value = "更新码")
private Long updatedCode;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 实名关系信息表对象类
*
* @author yuy336
* @since 2022-02-10 18:28:52
*/
@ApiModel(value = "实名关系信息表", description = "实名关系信息表")
@Data
public class RnrRelationDTO implements Serializable {
private static final long serialVersionUID = -31644503457036551L;
@ApiModelProperty(value = "随机数")
private String serialNumber;
@ApiModelProperty(value = "请求id")
private String requestId;
@ApiModelProperty(value = "租户编号")
private String tenantNo;
@ApiModelProperty(value = "是否是委托实名 0 否 1 是")
private Integer isTrust;
@ApiModelProperty(value = "是否是二手车实名 0 否 1 是")
private Integer isSecondHandCar;
@ApiModelProperty(value = "订单信息dto")
private RnrOrderDTO order;
@ApiModelProperty(value = "实名信息dto")
private MgRnrInfoDTO info;
@ApiModelProperty(value = "实名公司信息dto")
private MgRnrCompanyInfoDTO companyInfo;
@ApiModelProperty(value = "实名卡信息")
private List<MgRnrCardInfoDTO> cardList;
@ApiModelProperty(value = "实名标签信息")
private List<MgRnrTagDTO> rnrTagList;
@ApiModelProperty(value = "实名联系人信息")
private List<MgRnrLiaisonInfoDTO> rnrLiaisonList;
@ApiModelProperty(value = "实名文件信息")
private List<MgRnrFileDTO> rnrFileList;
private Integer carNumber;
public RnrRelationDTO() {
}
public RnrRelationDTO(RnrOrderDTO order, MgRnrInfoDTO info,
MgRnrCompanyInfoDTO companyInfo,
List<MgRnrCardInfoDTO> cardList,
List<MgRnrTagDTO> rnrTagList,
List<MgRnrLiaisonInfoDTO> rnrLiaisonList,
List<MgRnrFileDTO> rnrFileList) {
this.order = order;
this.info = info;
this.companyInfo = companyInfo;
this.cardList = cardList;
this.rnrTagList = rnrTagList;
this.rnrLiaisonList = rnrLiaisonList;
this.rnrFileList = rnrFileList;
}
}
package com.cusc.nirvana.user.rnr.mg.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.*;
import java.util.List;
/**
* 实名iccid信息表
*
* @author yuy336
* @since 2022-02-10 18:28:52
*/
@ApiModel(value = "实名iccid信息表", description = "实名iccid信息表")
@Data
public class RnrRelationIccidDTO implements Serializable {
private static final long serialVersionUID = -31644503457036551L;
@ApiModelProperty(value = "租户编号")
private String tenantNo;
@ApiModelProperty(value = "iccid集合信息")
private List<String> iccidList;
@ApiModelProperty(value = "锁定的值")
private String value;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.*;
/**
* 实名解绑DTO
*
* @author yuy336
* @since 2022-02-10 18:28:52
*/
@ApiModel(value = "实名解绑DTO", description = "实名解绑DTO")
@Data
public class RnrUnbindDTO implements Serializable {
private static final long serialVersionUID = -31644503457036551L;
@ApiModelProperty(value = "VIN")
private String vin;
@ApiModelProperty(value = "ICCID")
private String iccid;
@ApiModelProperty(value = "姓名")
private String fullName;
@ApiModelProperty(value = "证件类型")
private String certType;
@ApiModelProperty(value = "证件号码")
private String certNumber;
@ApiModelProperty(value = "联系电话")
private String phone;
@ApiModelProperty(value = "解绑原因 1.报废 2.过户3.二手车交易9.其他")
private Integer reason;
@ApiModelProperty(value = "解绑说明")
private String description;
@ApiModelProperty(value = "交易证明")
private String evidence;
@ApiModelProperty(value = "是否手工界解绑")
private boolean isManualUnbind;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.cusc.nirvana.user.rnr.mg.validation.group.Delete;
import com.cusc.nirvana.user.rnr.mg.validation.group.Insert;
import com.cusc.nirvana.user.rnr.mg.validation.group.Update;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* Sim卡、车卡关系文件导入历史对象
*
* @author yuy336
* @since 2022-04-19 20:11:15
*/
@ApiModel(value = "SimFileHistoryDTO对象", description = "")
@Data
public class SimFileHistoryDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 业务UUID
*/
@ApiModelProperty(value = "业务UUID", example = "10000")
@NotNull(message = "业务uuid不能为空", groups = Update.class)
@Length(message = "业务uuid长度不能大于32", max = 32, groups = {Update.class, Delete.class})
private String uuid;
/**
* 组织业务ID
*/
@ApiModelProperty(value = "组织ID", example = "1001")
@NotNull(message = "组织业务uuid不能为空", groups = {Insert.class, Update.class, Delete.class})
private String orgUuid;
/**
* 文件名称
*/
@ApiModelProperty(value = "文件名称", example = "文件名称")
@NotNull(message = "文件名称不能为空", groups = {Insert.class, Update.class})
@Length(message = "文件名长度不能大于100", max = 100, groups = {Insert.class, Update.class})
private String fileName;
/**
* 是否校验通过
*/
@ApiModelProperty(value = "是否校验通过", example = "1")
@NotNull(message = "是否通过校验不能为空", groups = {Insert.class, Update.class})
private Integer verification;
/**
* 异常信息
*/
@ApiModelProperty(value = "异常信息", example = "异常信息")
private String errorInfo;
/**
* 批次
*/
@ApiModelProperty(value = "批次", example = "批次")
private String batchNo;
/**
* 总行数
*/
@ApiModelProperty(value = "总行数", example = "1")
private Integer totalCount;
/**
* 错误行数
*/
@ApiModelProperty(value = "错误行数", example = "1")
private Integer errorCount;
/**
* 0-导入中 1-导入成功
*/
@ApiModelProperty(value = "处理结果,0-导入中 1-导入成功 2-错误", example = "1")
private Integer status;
/**
* 文件类型,0:sim卡, 1:车卡关系
*/
@ApiModelProperty(value = "文件类型,0:sim卡, 1:车卡关系", example = "1")
@NotNull(message = "文件类型不能为空", groups = {Insert.class, Update.class})
private Integer fileType;
/**
* 文件存储地址
*/
@ApiModelProperty(value = "文件存储地址", example = "文件存储地址")
private String fileAddr;
/**
* 导入错误文件地址
*/
@ApiModelProperty(value = "错误信息文件地址")
private String errorFileAddr;
/**导入方式,0-新增 1-修改*/
@ApiModelProperty(value = "导入方式,0-新增 1-修改", example = "文件存储地址")
private Integer importType;
/**
* 业务描述
*/
@ApiModelProperty(value = "业务描述", example = "业务描述")
private String description;
@ApiModelProperty(value = "是否删除,0:未删除,1:已删除", example = "0")
private Integer isDelete;
@ApiModelProperty(value = "创建时间", example = "2022-01-01 00:00:00")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "创建时间", example = "2022-01-01 00:00:00")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@ApiModelProperty(value = "创建人", example = "zhangshan")
private String creator;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import com.cusc.nirvana.user.rnr.mg.common.BaseRnrMgPageDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
@ApiModel(value = "SimFileHistoryQueryDTO对象", description = "查询参数对象")
@Data
public class SimFileHistoryQueryDTO extends BaseRnrMgPageDTO {
/**组织uuid*/
@ApiModelProperty(value = "组织uuid, 为必填项", required = true)
@NotNull(message = "组织uuid不能为空")
private String orgUuid;
@ApiModelProperty(value = "文件类型,0:sim卡,1:车卡关系", required = true)
// @NotNull(message = "文件类型不能为空")
private Integer fileType;
/**处理结果*/
@ApiModelProperty(value = "处理结果,0-导入中 1-导入成功 2-错误", required = true)
private Integer status;
/**查询开始时间*/
@ApiModelProperty(value = "查询开始时间,非必填", required = false)
private Date startCreateTime;
/**查询结束时间*/
@ApiModelProperty(value = "查询结束时间, 非必填", required = false)
private Date endCreateTime;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class SimVehicleDTO {
/**vin码*/
@ApiModelProperty(value = "VIN码", required = true)
@NotBlank(message = "VIN码不能为空")
private String vin;
/**ICCID*/
@ApiModelProperty(value = "iccid", required = true)
@NotBlank(message = "iccid不能为空")
private String iccid;
@ApiModelProperty(value = "msisdn")
private String msisdn;
@ApiModelProperty(value = "imsi")
private String imsi;
@ApiModelProperty(value = "ip")
private String ip;
@ApiModelProperty(value = "是否允许车主自己实名")
private Boolean realBySelf = false;
/**失败原因*/
@ApiModelProperty(value = "返回的错误信息,作为入参时不需要传递")
private String failReason;
@ApiModelProperty(value = "绑定关系 0-已绑定;1-已解绑")
private Integer bindingStatus;
@ApiModelProperty(value = "运营商类型")
private String mbCode;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import com.cusc.nirvana.user.rnr.mg.constants.MessageCallbackStatusEnum;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author yubo
* @since 2022-05-03 15:41
*/
@Data
@Accessors(chain = true)
public class SurplusConfirmDto {
/**
* 回复确认信息 Y/N
*/
private int callbackStatusEnum;
/**
* 一车多卡的订单ID
*/
private String orderId;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 实名解绑DTO
*
* @author yuy336
* @since 2022-02-10 18:28:52
*/
@ApiModel(value = "车企解绑DTO", description = "车企解绑DTO")
@Data
public class VehicleUnbindDTO extends RnrRelationDTO {
@ApiModelProperty(value = "需要解绑的卡的UUID")
private List<String> cardIds;
@ApiModelProperty(value = "需要解绑的业务ID")
private List<String> rnrIds;
}
package com.cusc.nirvana.user.rnr.mg.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "vin和iccid对应类")
public class VinIccidMapDTO {
private List<String> iccids;
private String vin;
}
package com.cusc.nirvana.user.rnr.mg.util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
@Slf4j
public class DateUtil {
//日期格式
public static String yyyyMM = "yyyyMM";
public static String yyyyMMdd = "yyyyMMdd";
public static String yyyyMMddHHmm = "yyyyMMddHHmm";
public static String yyyyMMddHHmmss = "yyyyMMddHHmmss";
public static String yyyyMMddHHmmssS = "yyyyMMddHHmmssS";
public static String yyyyMMddHHmmssSSS = "yyyyMMddHHmmssSSS";
public static String dayChiness = "yyyy年MM月dd日";
public static String dayChinessTwo = "yyyy年MM月dd日HH:mm";
//中划线日期格式
public static String yyyy_MM_dd = "yyyy-MM-dd";
public static String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
public static String yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss";
public static String yyyy_MM_dd_HH_mm_ss_S = "yyyy-MM-dd HH:mm:ss.S";
//反斜杠日期格式
public static String YYYYsMMsDD = "yyyy/MM/dd";
public static String MMsDDsYYYY = "MM/dd/yyyy";
public static String DDsMMsYYYY = "dd/MM/yyyy";
//时间按
public static String MM_dd = "MM-dd";
public static String HH_mm = "HH:mm"; //24小时制
public static String hh_mm = "hh:mm"; //12小时制
public static String HHmm = "HHmm";
public static String hhmm = "hhmm";
//英文日期
public static String ddMMM = "ddMMM"; //09Oct
public static String ddMMMyy = "ddMMMyy"; //01Jan09
public static String ddMMMyyyy = "ddMMMyyyy"; //01Jan2009
public static Calendar getCalendar(Date date) {
try {
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setTime(date);
return calendar;
} catch (Exception e) {
return null;
}
}
public static Calendar getCalendarByDateStr(String dateString, String formater) throws Exception {
try {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new SimpleDateFormat(formater).parse(dateString));
return calendar;
} catch (Exception e) {
return null;
}
}
/////////////////////////////////////////////////////////////////////////////////////
//----------------------- 取得相隔指定天数的日期 ---------------------------------//
/////////////////////////////////////////////////////////////////////////////////////
public static String BEFORE = "-"; //减少天数
public static String AFTER = "+"; //增加天数
/**
* 取得相隔数量的日期的日期
*
* @param date 指定日期
* @param type BEFORE:往前,AFTER:往后
* @param interval 相隔的日期
*/
public static Date getIntervalDate(Date date, String type, int interval) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.DATE, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.DATE, +interval);
}
return cal.getTime();
}
/**
* 取得相隔数量的日期的日期字符串
*/
public static String getIntervalDateStr(Date date, String formater, String type, int interval) {
Date lastDate = getIntervalDate(date, type, interval);
return DateUtil.toString(lastDate, formater);
}
/**
* 取得相隔数量的月份的日期字符串
*/
public static String getIntervalMonthStr(Date date, String formater, String type, int interval) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.MONTH, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.MONTH, +interval);
}
Date lastDate = cal.getTime();
return DateUtil.toString(lastDate, formater);
}
/**
* 取得两个时间的间隔,于得到的时间为格林尼治时间,相应间去8小时,得到北京时间
*
* @param depTime 出发日期
* @param arrTime 到达日期
*/
public static Date getSpanTime(Date depTime, Date arrTime) {
Date spanTime = new Date();
spanTime.setTime(arrTime.getTime() - depTime.getTime() - 28800000);
return spanTime;
}
public static Date getSpanTime(String depTimeStr, String arrTimeStr) {
Date depTime = DateUtil.toDate(depTimeStr, DateUtil.HH_mm);
Date arrTime = DateUtil.toDate(arrTimeStr, DateUtil.HH_mm);
Date spanTime = new Date();
spanTime.setTime(arrTime.getTime() - depTime.getTime() - 28800000);
return spanTime;
}
public static long getSpanSeconds(Date startTime, Date endTime) {
return endTime.getTime() - startTime.getTime();
}
/**
* 取得当前年、月、日、小时、分、秒等数值
**/
public static int getCurrentYear() {
return Calendar.getInstance().get(Calendar.YEAR);
}
public static int getCurrentMonth() {
return Calendar.getInstance().get(Calendar.MONTH);
}
public static int getCurrentDay() {
return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
}
public static int getCurrentHour12() {
return Calendar.getInstance().get(Calendar.HOUR);
}
public static int getCurrentHour24() {
return Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
}
public static int getCurrentMinute() {
return Calendar.getInstance().get(Calendar.MINUTE);
}
public static int getCurrentSecond() {
return Calendar.getInstance().get(Calendar.SECOND);
}
/////////////////////////////////////////////////////////////////////////////////////
//---------------------------- 日期类型之间的转换 ---------------------------------//
/////////////////////////////////////////////////////////////////////////////////////
/**
* 把字符串日期类型按照格式转换成Date日期,缺省的日期格式为yyyy-MM-dd
*
* @param dateStr 字符串类型日期
* @param formater 日期格式,缺省为yyyy-MM-dd
*/
public static Date toDate(String dateStr, String formater) {
if (!StringUtils.hasText(dateStr)) {
return null;
}
try {
if (StringUtils.hasText(formater)) {
return new SimpleDateFormat(formater).parse(dateStr);
} else {
return new SimpleDateFormat(yyyy_MM_dd).parse(dateStr);
}
} catch (Exception pe) {
return null;
}
}
/**
* Date类型:不同格式之间的转换
*
* @param oldDate 老的日期
* @param oldFormater 老的日期格式
* @param newFormater 新的日期格式
*/
public static Date toDate(Date oldDate, String oldFormater, String newFormater) {
if (oldDate == null) return null;
try {
String oldDateString = DateUtil.toString(oldDate, oldFormater);
return DateUtil.toDate(oldDateString, newFormater);
} catch (Exception pe) {
return null;
}
}
/**
* 把字符串日期类型按照格式转换成Date日期,缺省的日期格式为yyyy-MM-dd
*
* @param dateStr 字符串类型日期
* @param oriFormater 日期格式,缺省为yyyy-MM-dd
* @param oriLocale 语言变量,为NULL使用缺省的Locale
*/
public static Date toDate(String dateStr, String oriFormater, Locale oriLocale) {
//如果语言环境为空,则直接返回toDate(dateStr,formater);
if (oriLocale == null) {
return toDate(dateStr, oriFormater);
}
if (!StringUtils.hasText(dateStr)) {
return null;
}
try {
if (StringUtils.hasText(oriFormater)) {
return new SimpleDateFormat(oriFormater, oriLocale).parse(dateStr);
} else {
return new SimpleDateFormat(yyyy_MM_dd, oriLocale).parse(dateStr);
}
} catch (Exception pe) {
return null;
}
}
/**
* 把日期类型按照格式转换成字符串,缺省的日期格式为yyyy-MM-dd
*
* @param date Date类型日期
* @param dstFormater 日期格式,缺省为yyyy-MM-dd
*/
public static String toString(Date date, String dstFormater) {
try {
//缺省的日期格式为
if (!StringUtils.hasText(dstFormater)) {
return new SimpleDateFormat("yyyy-MM-dd").format(date);
} else {
return new SimpleDateFormat(dstFormater).format(date);
}
} catch (Exception e) {
return null;
}
}
/**
* 把日期类型按照格式转换成字符串
*
* @param date Date类型日期
* @param dstFormater 日期格式,缺省为yyyy-MM-dd
*/
public static String toString(Date date, String dstFormater, Locale dstLocale) {
try {
if (!StringUtils.hasText(dstFormater)) {
dstFormater = DateUtil.ddMMMyy;
}
if (dstLocale == null) {
return new SimpleDateFormat(dstFormater).format(date).toUpperCase();
} else {
return new SimpleDateFormat(dstFormater, dstLocale).format(date).toUpperCase();
}
} catch (Exception e) {
return null;
}
}
/**
* 把日期字符串按照格式相互转换
*
* @param oriDateStr 原始日期字符串
* @param oriFormater 日期日期的格式
* @param dstFormater 转换后的日期格式
*/
public static String toString(String oriDateStr, String oriFormater, String dstFormater) {
try {
if (!StringUtils.hasText(oriDateStr)) {
return "";
}
if (!StringUtils.hasText(oriFormater)) {
oriFormater = DateUtil.yyyy_MM_dd;
}
Date date = DateUtil.toDate(oriDateStr, oriFormater);
if (!StringUtils.hasText(dstFormater)) {
dstFormater = DateUtil.yyyy_MM_dd;
}
return new SimpleDateFormat(dstFormater).format(date);
} catch (Exception e) {
return null;
}
}
/**
* 把日期字符串按照格式相互转换(原始日期和目标日期都有LOCALE要求)
*
* @param oriDateStr 原始日期字符串
* @param oriFormater 日期日期的格式
* @param oriLocale 原始日期的LOCALE
* @param dstFormater 目标日期的格式
* @param dstLocale 目标日期的LOCALE
*/
public static String toString(String oriDateStr, String oriFormater, Locale oriLocale, String dstFormater, Locale dstLocale) {
try {
if (!StringUtils.hasText(oriDateStr)) {
return "";
}
if (!StringUtils.hasText(oriFormater)) {
oriFormater = DateUtil.yyyy_MM_dd;
}
Date date = DateUtil.toDate(oriDateStr, oriFormater, oriLocale);
if (!StringUtils.hasText(dstFormater)) {
dstFormater = DateUtil.ddMMMyy;
}
if (dstLocale == null) {
return new SimpleDateFormat(dstFormater).format(date).toUpperCase();
} else {
return new SimpleDateFormat(dstFormater, dstLocale).format(date).toUpperCase();
}
} catch (Exception e) {
return null;
}
}
public static String formatDate(String value, String oldStyle, String newStyle) {
if (!StringUtils.hasText(value)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat(oldStyle);
SimpleDateFormat df1 = new SimpleDateFormat(newStyle);
try {
return df1.format(df.parse(value));
} catch (ParseException e) {
return "";
}
}
////////////////////////////////////////////////////////////////////////////////////
// 中文日期 ///
////////////////////////////////////////////////////////////////////////////////////
/**
* 取得中文格式的日期 --> 2010年3月5日
*/
public static String getChineseDate(Date d) {
if (d == null) {
return null;
}
String dtrDate = new SimpleDateFormat(yyyyMMdd).format(d);
return dtrDate.substring(0, 4) + "\u5E74" + Integer.parseInt(dtrDate.substring(4, 6)) + "\u6708" + Integer.parseInt(dtrDate.substring(6, 8)) + "\u65E5";
}
/**
* 取得中文格式的日期 --> 2010年03月15日
*/
public static String getChineseYyyyMmDd(Date d) {
if (d == null) return null;
String dtrDate = new SimpleDateFormat(yyyyMMdd).format(d);
return dtrDate.substring(0, 4) + "\u5E74" + dtrDate.substring(4, 6) + "\u6708" + dtrDate.substring(6, 8) + "\u65E5";
}
/**
* 取得中文格式的日期 --> 03月15日 16:15
*/
public static String getChineseDateMMddHHss(Date d) {
if (d == null) {
return null;
}
String dtrDate = DateUtil.toString(d, DateUtil.yyyy_MM_dd_HH_mm);
return dtrDate.substring(5, 7) + "\u6708" + dtrDate.substring(8, 10) + "\u65E5" + dtrDate.substring(11);
}
/**
* 取得中文的星期名称
*/
public static String getCnDayNameOfWeek(Date date) {
String[] weeks = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar calendar = DateUtil.getCalendar(date);
int day = calendar.get(Calendar.DAY_OF_WEEK);
return weeks[day - 1];
}
/**
* 取得中文的星期名称
*/
public static String getCnDayNameOfWeek(String strDate) {
Date date = DateUtil.toDate(strDate, null);
return getCnDayNameOfWeek(date);
}
/**
* 取得月份的序号
*/
public static String getNumberByEnMonth(String enMonthString) {
String[] months = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
for (int i = 0; i < months.length; i++) {
if (months[i].equalsIgnoreCase(enMonthString)) {
if (i < 9) {
return "0" + (i + 1);
}
return Integer.toString(i + 1);
}
}
return null;
}
/**
* 取得相隔数量的【日或者月】的日期
*
* @param date 指定日期
* @param type BEFORE:往前,AFTER:往后
* @param intervalString 相隔的日或者月,格式为 14D/12M【相隔14日/相隔12月】
*/
public static Date getIntervalDate(Date date, String type, String intervalString) {
try {
//14D --> interval=14,dayOrMonth=D
int interval = Integer.valueOf(intervalString.substring(0, intervalString.length() - 1));
String dayOrMonth = intervalString.substring(intervalString.length() - 1);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
if ("S".equals(dayOrMonth.toUpperCase())) {
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.SECOND, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.SECOND, +interval);
}
} else if ("I".equals(dayOrMonth.toUpperCase())) {
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.MINUTE, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.MINUTE, +interval);
}
} else if ("H".equals(dayOrMonth.toUpperCase())) {
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.HOUR, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.HOUR, +interval);
}
} else if ("D".equals(dayOrMonth.toUpperCase())) {
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.DATE, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.DATE, +interval);
}
} else if ("M".equals(dayOrMonth.toUpperCase())) {
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.MONTH, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.MONTH, +interval);
}
} else if ("Y".equals(dayOrMonth.toUpperCase())) {
if (DateUtil.BEFORE.equals(type)) {
cal.add(Calendar.YEAR, -interval);
}
if (DateUtil.AFTER.equals(type)) {
cal.add(Calendar.YEAR, +interval);
}
}
return cal.getTime();
} catch (Exception e) {
return null;
}
}
public static Date getIntervalDate(String dateStr, String type, String intervalString) {
Date date = DateUtil.toDate(dateStr, DateUtil.yyyy_MM_dd);
return getIntervalDate(date, type, intervalString);
}
////////////////////////////////////////////////////////////////////////////////////
// 国际化日期 //
////////////////////////////////////////////////////////////////////////////////////
/**
* 根据语言类型获取星期名称
*
* @param date
* @param locale
* @return
*/
public static String getDayofTheWeek(Date date, Locale locale) {
if (locale != null && locale.toString().startsWith(Locale.UK.toString())) {
String[] weeks = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
Calendar calendar = DateUtil.getCalendar(date);
int day = calendar.get(Calendar.DAY_OF_WEEK);
return weeks[day - 1];
}
return DateUtil.getCnDayNameOfWeek(date);
}
/**
* 根据语言类型获取日期格式
*
* @param date
* @param locale
* @return
*/
public static String getDate(Date date, Locale locale) {
if (locale != null && locale.toString().startsWith(Locale.UK.toString())) {
return DateUtil.toString(date, DateUtil.MM_dd);
}
return DateUtil.getChineseDate(date).substring(5);
}
/**
* 根据语言类型获取日期格式
*
* @param date
* @param locale
* @return
*/
public static String getFormatDateForUpdateTime(Date date, Locale locale) {
if (locale != null && locale.toString().startsWith(Locale.UK.toString())) {
return DateUtil.toString(date, DateUtil.yyyy_MM_dd_HH_mm);
}
return DateUtil.getChineseDateMMddHHss(date);
}
public static XMLGregorianCalendar date2XMLGregorianCalendar(Date date) {
if (date == null) {
return null;
}
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
XMLGregorianCalendar xmlCa = null;
try {
xmlCa = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
} catch (Exception e) {
log.error("xml date error", e);
}
return xmlCa;
}
/**
* 对字符串日期信息 进行验证是否合法
*/
public static boolean isValidDate(String strDate) {
SimpleDateFormat parser = new SimpleDateFormat(yyyyMMdd);
parser.setLenient(false);
try {
parser.parse(strDate);
return true;
} catch (Exception e) {
return false;
}
}
}
package com.cusc.nirvana.user.rnr.mg.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.cusc.nirvana.common.result.PageResult;
import com.cusc.nirvana.common.result.Response;
import com.cusc.nirvana.user.rnr.mg.common.MgLogOutputJsonSerializeFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.List;
/**
* Description: resttemplate封装
* <br />
* CreateDate 2021-11-01 16:46
*
* @author yuyi
**/
public class RnrMgRestTemplateUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(RnrMgRestTemplateUtils.class);
/**
* Description: post请求Response泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> Response<T> postForResponse(RestTemplate restTemplate, String url, Object request,
Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postForResponse url: {},request: {}", url,
JSON.toJSONString(request, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(request), String.class, urlVariables);
Response<T> result = JSON.parseObject(entity.getBody(), new TypeReference<Response<T>>(cls) {
}.getType());
LOGGER.info("postForResponse url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: post请求Response泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static Response postForResponse(RestTemplate restTemplate, String url, Object request,
Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postForResponse url: {},request: {}", url,
JSON.toJSONString(request, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(request), String.class, urlVariables);
Response result = JSON.parseObject(entity.getBody(), Response.class);
LOGGER.info("postForResponse url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: post请求Response<PageResult>泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> Response<PageResult<T>> postForResponsePageResult(RestTemplate restTemplate, String url,
Object request,
Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postForResponsePageResult url: {},request: {}", url,
JSON.toJSONString(request, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(request), String.class, urlVariables);
Response<PageResult<T>> result = JSON.parseObject(entity.getBody(),
new TypeReference<Response<PageResult<T>>>(cls) {
}.getType());
LOGGER.info("postForResponsePageResult url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: post请求Response<List>泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> Response<List<T>> postForResponseList(RestTemplate restTemplate, String url, Object request,
Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postForResponseList url: {},request: {}", url,
JSON.toJSONString(request, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(request), String.class, urlVariables);
Response<List<T>> result = JSON.parseObject(entity.getBody(), new TypeReference<Response<List<T>>>(cls) {
}.getType());
LOGGER.info("postForResponseList url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: post请求泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> T postForObject(RestTemplate restTemplate, String url, Object request,
Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postForObject url: {},request: {}", url,
JSON.toJSONString(request, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, new HttpEntity<>(request), String.class, urlVariables);
LOGGER.info("postForObject url: {},response: {},cost: {} ms", url,
JSON.toJSONString(entity.getBody(), new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return JSON.parseObject(entity.getBody(), cls);
}
/**
* Description: post请求泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> T postForObject(RestTemplate restTemplate, String url, HttpEntity<?> requestEntity,
Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postForObject url: {},request: {}", url,
JSON.toJSONString(requestEntity, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class, urlVariables);
T result = JSON.parseObject(entity.getBody(), cls);
LOGGER.info("postForObject url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: get 请求响应泛型对象
* <br />
* CreateDate 2022-05-13 18:41:15
*
* @author yuyi
**/
public static <T> T getForObject(RestTemplate restTemplate, String url, Class<T> cls) {
long startTime = System.currentTimeMillis();
LOGGER.info("getForObject url: {}", url);
ResponseEntity<String> entity = restTemplate.getForEntity(url, String.class);
T result = JSON.parseObject(entity.getBody(), cls);
LOGGER.info("getForObject url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: post请求Response泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> Response<T> getForResponse(RestTemplate restTemplate, String url, Class<T> cls) {
long startTime = System.currentTimeMillis();
LOGGER.info("getForResponse url: {}", url);
ResponseEntity<String> entity = restTemplate.getForEntity(url, String.class);
Response<T> result = JSON.parseObject(entity.getBody(), new TypeReference<Response<T>>(cls) {
}.getType());
LOGGER.info("getForResponse url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
public static <T> Response<List<T>> getForResponseList(RestTemplate restTemplate, String url,
Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("getForResponseList url: {},request: {}", url,
JSON.toJSONString(urlVariables, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.GET, null, String.class, urlVariables);
Response<List<T>> result = JSON.parseObject(entity.getBody(), new TypeReference<Response<List<T>>>(cls) {
}.getType());
LOGGER.info("getForResponseList url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
/**
* Description: post请求Response泛型
* <br />
* CreateDate 2021-11-01 16:53:25
*
* @author yuyi
**/
public static <T> Response<T> postEntityForResponse(RestTemplate restTemplate, String url, HttpEntity<?> requestEntity, Class<T> cls, Object... urlVariables) {
long startTime = System.currentTimeMillis();
LOGGER.info("postEntityForResponse url: {},request: {}", url,
JSON.toJSONString(requestEntity, new MgLogOutputJsonSerializeFilter()));
ResponseEntity<String> entity =
restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class, urlVariables);
Response<T> result = JSON.parseObject(entity.getBody(), new TypeReference<Response<T>>(cls) {
}.getType());
LOGGER.info("postEntityForResponse url: {},response: {},cost: {} ms", url,
JSON.toJSONString(result, new MgLogOutputJsonSerializeFilter()),
System.currentTimeMillis() - startTime);
return result;
}
}
package com.cusc.nirvana.user.rnr.mg.validation.annotation;
import com.cusc.nirvana.user.rnr.mg.constants.RnrOrderStatusEnum;
import com.cusc.nirvana.user.rnr.mg.constants.RnrOrderType;
import com.cusc.nirvana.user.rnr.mg.validation.validator.EnumValueValidator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* 枚举校验注解
*
* @author yubo
* @since 2022-04-15 16:54
*/
@Target({ElementType.FIELD})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = {EnumValueValidator.class})
public @interface EnumValue {
// 默认错误消息
String message() default "必须为指定值";
String[] strValues() default {};
int[] intValues() default {};
// 分组
Class<?>[] groups() default {};
// 负载
Class<? extends Payload>[] payload() default {};
// 指定多个时使用
@Target({ElementType.FIELD})
@Retention(RUNTIME)
@Documented
@interface List {
EnumValue[] value();
}
}
package com.cusc.nirvana.user.rnr.mg.validation.group;
public interface Delete {
}
package com.cusc.nirvana.user.rnr.mg.validation.group;
public interface Insert {
}
package com.cusc.nirvana.user.rnr.mg.validation.group;
public interface Query {
}
package com.cusc.nirvana.user.rnr.mg.validation.group;
import javax.validation.groups.Default;
/**
* @author yubo
* @since 2022-04-15 15:38
*/
public interface SaveRelation extends Default {
}
package com.cusc.nirvana.user.rnr.mg.validation.group;
public interface Update {
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment